@dodoex/widgets 3.0.1-solana.6 → 3.0.1-solana.7

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/index.js CHANGED
@@ -20,4 +20,4 @@ import{useLingui as e,I18nProvider as t,Trans as n}from"@lingui/react";import{i1
20
20
  object-assign
21
21
  (c) Sindre Sorhus
22
22
  @license MIT
23
- */function As(){if(Rs)return ks;Rs=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return ks=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach((function(e){o[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}()?Object.assign:function(o,i){for(var r,a,l=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(o),s=1;s<arguments.length;s++){for(var d in r=Object(arguments[s]))t.call(r,d)&&(l[d]=r[d]);if(e){a=e(r);for(var c=0;c<a.length;c++)n.call(r,a[c])&&(l[a[c]]=r[a[c]])}}return l},ks}function Hs(){if(Ss)return Ms;Ss=1;return Ms="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function Ps(){return Ts?Es:(Ts=1,Es=Function.call.bind(Object.prototype.hasOwnProperty))}if("production"!==process.env.NODE_ENV){var Bs=Ns();ys.exports=function(){if(Vs)return Is;Vs=1;var e=Ns(),t=As(),n=Hs(),o=Ps(),i=function(){if(Ls)return Ws;Ls=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=Hs(),n={},o=Ps();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function i(i,r,a,l,s){if("production"!==process.env.NODE_ENV)for(var d in i)if(o(i,d)){var c;try{if("function"!=typeof i[d]){var u=Error((l||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw u.name="Invariant Violation",u}c=i[d](r,d,l,a,null,t)}catch(e){c=e}if(!c||c instanceof Error||e((l||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof c+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),c instanceof Error&&!(c.message in n)){n[c.message]=!0;var p=s?s():"";e("Failed "+a+" type: "+c.message+(null!=p?p:""))}}}return i.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(n={})},Ws=i}(),r=function(){};function a(){return null}return"production"!==process.env.NODE_ENV&&(r=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),Is=function(l,s){var d="function"==typeof Symbol&&Symbol.iterator,c="@@iterator",u="<<anonymous>>",p={array:g("array"),bigint:g("bigint"),bool:g("boolean"),func:g("function"),number:g("number"),object:g("object"),string:g("string"),symbol:g("symbol"),any:m(a),arrayOf:function(e){return m((function(t,o,i,r,a){if("function"!=typeof e)return new f("Property `"+a+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var l=t[o];if(!Array.isArray(l))return new f("Invalid "+r+" `"+a+"` of type `"+y(l)+"` supplied to `"+i+"`, expected an array.");for(var s=0;s<l.length;s++){var d=e(l,s,i,r,a+"["+s+"]",n);if(d instanceof Error)return d}return null}))},element:m((function(e,t,n,o,i){var r=e[t];return l(r)?null:new f("Invalid "+o+" `"+i+"` of type `"+y(r)+"` supplied to `"+n+"`, expected a single ReactElement.")})),elementType:m((function(t,n,o,i,r){var a=t[n];return e.isValidElementType(a)?null:new f("Invalid "+i+" `"+r+"` of type `"+y(a)+"` supplied to `"+o+"`, expected a single ReactElement type.")})),instanceOf:function(e){return m((function(t,n,o,i,r){if(!(t[n]instanceof e)){var a=e.name||u;return new f("Invalid "+i+" `"+r+"` of type `"+((l=t[n]).constructor&&l.constructor.name?l.constructor.name:u)+"` supplied to `"+o+"`, expected instance of `"+a+"`.")}var l;return null}))},node:m((function(e,t,n,o,i){return v(e[t])?null:new f("Invalid "+o+" `"+i+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return m((function(t,i,r,a,l){if("function"!=typeof e)return new f("Property `"+l+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var s=t[i],d=y(s);if("object"!==d)return new f("Invalid "+a+" `"+l+"` of type `"+d+"` supplied to `"+r+"`, expected an object.");for(var c in s)if(o(s,c)){var u=e(s,c,r,a,l+"."+c,n);if(u instanceof Error)return u}return null}))},oneOf:function(e){return Array.isArray(e)?m((function(t,n,o,i,r){for(var a=t[n],l=0;l<e.length;l++)if(h(a,e[l]))return null;var s=JSON.stringify(e,(function(e,t){return"symbol"===b(t)?String(t):t}));return new f("Invalid "+i+" `"+r+"` of value `"+String(a)+"` supplied to `"+o+"`, expected one of "+s+".")})):("production"!==process.env.NODE_ENV&&r(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),a)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&r("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var t=0;t<e.length;t++){var i=e[t];if("function"!=typeof i)return r("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+j(i)+" at index "+t+"."),a}return m((function(t,i,r,a,l){for(var s=[],d=0;d<e.length;d++){var c=(0,e[d])(t,i,r,a,l,n);if(null==c)return null;c.data&&o(c.data,"expectedType")&&s.push(c.data.expectedType)}return new f("Invalid "+a+" `"+l+"` supplied to `"+r+"`"+(s.length>0?", expected one of type ["+s.join(", ")+"]":"")+".")}))},shape:function(e){return m((function(t,o,i,r,a){var l=t[o],s=y(l);if("object"!==s)return new f("Invalid "+r+" `"+a+"` of type `"+s+"` supplied to `"+i+"`, expected `object`.");for(var d in e){var c=e[d];if("function"!=typeof c)return x(i,r,a,d,b(c));var u=c(l,d,i,r,a+"."+d,n);if(u)return u}return null}))},exact:function(e){return m((function(i,r,a,l,s){var d=i[r],c=y(d);if("object"!==c)return new f("Invalid "+l+" `"+s+"` of type `"+c+"` supplied to `"+a+"`, expected `object`.");var u=t({},i[r],e);for(var p in u){var h=e[p];if(o(e,p)&&"function"!=typeof h)return x(a,l,s,p,b(h));if(!h)return new f("Invalid "+l+" `"+s+"` key `"+p+"` supplied to `"+a+"`.\nBad object: "+JSON.stringify(i[r],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var m=h(d,p,a,l,s+"."+p,n);if(m)return m}return null}))}};function h(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function f(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function m(e){if("production"!==process.env.NODE_ENV)var t={},o=0;function i(i,a,l,d,c,p,h){if(d=d||u,p=p||l,h!==n){if(s){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var g=d+":"+l;!t[g]&&o<3&&(r("You are manually calling a React.PropTypes validation function for the `"+p+"` prop on `"+d+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),t[g]=!0,o++)}}return null==a[l]?i?null===a[l]?new f("The "+c+" `"+p+"` is marked as required in `"+d+"`, but its value is `null`."):new f("The "+c+" `"+p+"` is marked as required in `"+d+"`, but its value is `undefined`."):null:e(a,l,d,c,p)}var a=i.bind(null,!1);return a.isRequired=i.bind(null,!0),a}function g(e){return m((function(t,n,o,i,r,a){var l=t[n];return y(l)!==e?new f("Invalid "+i+" `"+r+"` of type `"+b(l)+"` supplied to `"+o+"`, expected `"+e+"`.",{expectedType:e}):null}))}function x(e,t,n,o,i){return new f((e||"React class")+": "+t+" type `"+n+"."+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}function v(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(v);if(null===e||l(e))return!0;var t=function(e){var t=e&&(d&&e[d]||e[c]);if("function"==typeof t)return t}(e);if(!t)return!1;var n,o=t.call(e);if(t!==e.entries){for(;!(n=o.next()).done;)if(!v(n.value))return!1}else for(;!(n=o.next()).done;){var i=n.value;if(i&&!v(i[1]))return!1}return!0;default:return!1}}function y(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function b(e){if(null==e)return""+e;var t=y(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function j(e){var t=b(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return f.prototype=Error.prototype,p.checkPropTypes=i,p.resetWarningCache=i.resetWarningCache,p.PropTypes=p,p},Is}()(Bs.isElement,!0)}else ys.exports=function(){if(Zs)return Os;Zs=1;var e=Hs();function t(){}function n(){}return n.resetWarningCache=t,Os=function(){function o(t,n,o,i,r,a){if(a!==e){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function i(){return o}o.isRequired=o;var r={array:o,bigint:o,bool:o,func:o,number:o,object:o,string:o,symbol:o,any:o,arrayOf:i,element:o,elementType:o,instanceOf:i,node:o,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return r.PropTypes=r,r}}()();var Us=_e(ys.exports);function Ds(e,t){return"production"===process.env.NODE_ENV?()=>null:function(...n){return e(...n)||t(...n)}}function Ys(e,t,n,o,i){const r=e[t],a=i||t;if(null==r||"undefined"==typeof window)return null;let l;const s=r.type;return"function"!=typeof s||function(e){const{prototype:t={}}=e;return Boolean(t.isReactComponent)}(s)||(l="Did you accidentally use a plain function component for an element instead?"),void 0!==l?new Error(`Invalid ${o} \`${a}\` supplied to \`${n}\`. Expected an element that can hold a ref. ${l} For more information see https://mui.com/r/caveat-with-refs-guide`):null}const zs=Ds(Us.element,Ys);zs.isRequired=Ds(Us.element.isRequired,Ys);const Xs="exact-prop: ​";function qs(e){return e&&e.ownerDocument||document}const Js="undefined"!=typeof window?z.useLayoutEffect:z.useEffect;function Gs(e){const t=z.useRef(e);return Js((()=>{t.current=e})),z.useRef(((...e)=>(0,t.current)(...e))).current}function Qs(...e){return z.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{!function(e,t){"function"==typeof e?e(t):e&&(e.current=t)}(e,t)}))}),e)}const _s={};const Ks=[];class $s{static create(){return new $s}currentId=null;start(e,t){this.clear(),this.currentId=setTimeout((()=>{this.currentId=null,t()}),e)}clear=()=>{null!==this.currentId&&(clearTimeout(this.currentId),this.currentId=null)};disposeEffect=()=>this.clear}function ed(){const e=function(e,t){const n=z.useRef(_s);return n.current===_s&&(n.current=e(t)),n}($s.create).current;var t;return t=e.disposeEffect,z.useEffect(t,Ks),e}const td={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function nd(e){var t,n,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=nd(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function od(){for(var e,t,n=0,o="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=nd(e))&&(o&&(o+=" "),o+=t);return o}function id(e,t=[]){if(void 0===e)return{};const n={};return Object.keys(e).filter((n=>n.match(/^on[A-Z]/)&&"function"==typeof e[n]&&!t.includes(n))).forEach((t=>{n[t]=e[t]})),n}function rd(e){if(void 0===e)return{};const t={};return Object.keys(e).filter((t=>!(t.match(/^on[A-Z]/)&&"function"==typeof e[t]))).forEach((n=>{t[n]=e[n]})),t}function ad(e){const{elementType:t,externalSlotProps:n,ownerState:o,skipResolvingSlotProps:i=!1,...r}=e,a=i?{}:function(e,t,n){return"function"==typeof e?e(t,n):e}(n,o),{props:l,internalRef:s}=function(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:o,externalForwardedProps:i,className:r}=e;if(!t){const e=od(n?.className,r,i?.className,o?.className),t={...n?.style,...i?.style,...o?.style},a={...n,...i,...o};return e.length>0&&(a.className=e),Object.keys(t).length>0&&(a.style=t),{props:a,internalRef:void 0}}const a=id({...i,...o}),l=rd(o),s=rd(i),d=t(a),c=od(d?.className,n?.className,r,i?.className,o?.className),u={...d?.style,...n?.style,...i?.style,...o?.style},p={...d,...n,...s,...l};return c.length>0&&(p.className=c),Object.keys(u).length>0&&(p.style=u),{props:p,internalRef:d.ref}}({...r,externalSlotProps:a}),d=function(e,t,n){return void 0===e||"string"==typeof e?t:{...t,ownerState:{...t.ownerState,...n}}}(t,{...l,ref:Qs(s,a?.ref,e.additionalProps?.ref)},o);return d}function ld(e){return e.substring(2).toLowerCase()}function sd(e){const{children:t,disableReactTree:n=!1,mouseEvent:o="onClick",onClickAway:i,touchEvent:r="onTouchEnd"}=e,a=z.useRef(!1),l=z.useRef(null),s=z.useRef(!1),d=z.useRef(!1);z.useEffect((()=>(setTimeout((()=>{s.current=!0}),0),()=>{s.current=!1})),[]);const c=Qs((u=t)&&z.isValidElement(u)?u.props.propertyIsEnumerable("ref")?u.props.ref:u.ref:null,l);var u;const p=Gs((e=>{const t=d.current;d.current=!1;const o=qs(l.current);if(!s.current||!l.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}(e,o))return;if(a.current)return void(a.current=!1);let r;r=e.composedPath?e.composedPath().indexOf(l.current)>-1:!o.documentElement.contains(e.target)||l.current.contains(e.target),r||!n&&t||i(e)})),h=e=>n=>{d.current=!0;const o=t.props[e];o&&o(n)},f={ref:c};return!1!==r&&(f[r]=h(r)),z.useEffect((()=>{if(!1!==r){const e=ld(r),t=qs(l.current),n=()=>{a.current=!0};return t.addEventListener(e,p),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,p),t.removeEventListener("touchmove",n)}}}),[p,r]),!1!==o&&(f[o]=h(o)),z.useEffect((()=>{if(!1!==o){const e=ld(o),t=qs(l.current);return t.addEventListener(e,p),()=>{t.removeEventListener(e,p)}}}),[p,o]),ut.jsx(z.Fragment,{children:z.cloneElement(t,f)})}"production"!==process.env.NODE_ENV&&(sd.propTypes={children:zs.isRequired,disableReactTree:Us.bool,mouseEvent:Us.oneOf(["onClick","onMouseDown","onMouseUp","onPointerDown","onPointerUp",!1]),onClickAway:Us.func.isRequired,touchEvent:Us.oneOf(["onTouchEnd","onTouchStart",!1])}),"production"!==process.env.NODE_ENV&&(sd.propTypes=function(e){return"production"===process.env.NODE_ENV?e:{...e,[Xs]:t=>{const n=Object.keys(t).filter((t=>!e.hasOwnProperty(t)));return n.length>0?new Error(`The following props are not supported: ${n.map((e=>`\`${e}\``)).join(", ")}. Please remove them.`):null}}}(sd.propTypes));const dd="base";function cd(e,t){const n=td[t];return n?`${dd}--${n}`:function(e,t){return`${dd}-${e}-${t}`}(e,t)}const ud="Snackbar";function pd(e){return cd(ud,e)}!function(e,t){const n={};t.forEach((t=>{n[t]=cd(e,t)}))}(ud,["root"]);const hd={disableDefaultClasses:!1},fd=z.createContext(hd);"production"!==process.env.NODE_ENV&&(fd.displayName="ClassNameConfiguratorContext");const md=()=>function(e,t,n){const o={};for(const i in e){const r=e[i];let a="";for(let e=0;e<r.length;e+=1){const o=r[e];o&&(a+=t(o)+" ",n&&n[o]&&(a+=n[o]+" "))}o[i]=a}return o}({root:["root"]},function(e){const{disableDefaultClasses:t}=z.useContext(fd);return n=>t?"":e(n)}(pd)),gd=z.forwardRef((function(e,t){const{autoHideDuration:n=null,children:o,disableWindowBlurListener:i=!1,exited:r=!0,onBlur:a,onClose:l,onFocus:s,onMouseEnter:d,onMouseLeave:c,open:u,resumeHideDuration:p,slotProps:h={},slots:f={},...m}=e,g=md(),{getRootProps:x,onClickAway:v}=function(e={}){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:o,open:i,resumeHideDuration:r}=e,a=ed();z.useEffect((()=>{if(i)return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){e.defaultPrevented||"Escape"===e.key&&o?.(e,"escapeKeyDown")}}),[i,o]);const l=Gs(((e,t)=>{o?.(e,t)})),s=Gs((e=>{o&&null!=e&&a.start(e,(()=>{l(null,"timeout")}))}));z.useEffect((()=>(i&&s(t),a.clear)),[i,t,s,a]);const d=a.clear,c=z.useCallback((()=>{null!=t&&s(null!=r?r:.5*t)}),[t,r,s]),u=e=>t=>{const n=e.onFocus;n?.(t),d()},p=e=>t=>{const n=e.onMouseEnter;n?.(t),d()},h=e=>t=>{const n=e.onMouseLeave;n?.(t),c()};return z.useEffect((()=>{if(!n&&i)return window.addEventListener("focus",c),window.addEventListener("blur",d),()=>{window.removeEventListener("focus",c),window.removeEventListener("blur",d)}}),[n,i,c,d]),{getRootProps:(t={})=>{const n={...id(e),...id(t)};return{role:"presentation",...t,...n,onBlur:(o=n,e=>{const t=o.onBlur;t?.(e),c()}),onFocus:u(n),onMouseEnter:p(n),onMouseLeave:h(n)};var o},onClickAway:e=>{o?.(e,"clickaway")}}}({...e,autoHideDuration:n,disableWindowBlurListener:i,onClose:l,open:u,resumeHideDuration:p}),y=e,b=f.root||"div",j=ad({elementType:b,getSlotProps:x,externalForwardedProps:m,externalSlotProps:h.root,additionalProps:{ref:t},ownerState:y,className:g.root}),C=ad({elementType:sd,externalSlotProps:h.clickAwayListener,additionalProps:{onClickAway:v},ownerState:y});return delete C.ownerState,!u&&r?null:ut.jsx(sd,{...C,children:ut.jsx(b,{...j,children:o})})}));function xd({size:e,color:t,time:n,strokeWidth:o=2,sx:i}){const[r,a]=q("0 1069"),l=e/2,s=l-1;return J((()=>{a(2*Math.PI*s+" 0")}),[]),ut.jsx(m,{width:e,height:e,component:"svg",sx:Object.assign({position:"absolute",top:`-${o}`,left:`-${o}`,transform:"rotate(-90deg)"},i),children:ut.jsx(m,{component:"circle",cx:l,cy:l,r:s,strokeWidth:o,stroke:t,fill:"none",strokeDasharray:r,sx:{transition:`stroke-dasharray ${n}`}})})}"production"!==process.env.NODE_ENV&&(gd.propTypes={autoHideDuration:Us.number,children:Us.node,disableWindowBlurListener:Us.bool,exited:Us.bool,onClose:Us.func,open:Us.bool,resumeHideDuration:Us.number,slotProps:Us.shape({clickAwayListener:Us.oneOfType([Us.func,Us.shape({children:Us.element.isRequired,disableReactTree:Us.bool,mouseEvent:Us.oneOf(["onClick","onMouseDown","onMouseUp","onPointerDown","onPointerUp",!1]),onClickAway:Us.func,touchEvent:Us.oneOf(["onTouchEnd","onTouchStart",!1])})]),root:Us.oneOfType([Us.func,Us.object])}),slots:Us.shape({root:Us.elementType})});var vd=X.memo(xd);const yd=Ie((e=>({notify:null,toast:t=>{e({notify:t})},close:()=>{e({notify:null})}}))),bd={entering:"translateX(0)",entered:"translateX(0)",exiting:"translateX(500px)",exited:"translateX(500px)",unmounted:"translateX(500px)"};function jd(){const e=g(),{notify:t,close:n}=yd(),[o,i]=X.useState(!0),r=X.useRef(null),a=null==t?void 0:t.timeout,l=!!t;let s=ut.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ut.jsx("circle",{cx:"18",cy:"18",r:"16.5",stroke:"#2FBA90",strokeWidth:"3"}),ut.jsx("path",{d:"M25.1384 11.334L14.8873 21.5851L10.8584 17.5718L8.66504 19.7651L14.8873 25.9873L27.3317 13.5429L25.1384 11.334Z",fill:"#2FBA90"})]});switch(null==t?void 0:t.type){case"error":s=ut.jsxs("svg",{width:"36",height:"37",viewBox:"0 0 36 37",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ut.jsx("circle",{cx:"18",cy:"18.5",r:"16.5",stroke:"#FF6187",strokeWidth:"3"}),ut.jsx("path",{d:"M25.3331 13.0452L19.8782 18.5L25.3331 23.9548L23.5148 25.7731L18.06 20.3183L12.6051 25.7731L10.7869 23.9548L16.2417 18.5L10.7869 13.0452L12.6051 11.2269L18.06 16.6817L23.5148 11.2269L25.3331 13.0452Z",fill:"#FF6187"})]});break;case"warning":s=ut.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ut.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.4065 3.6189L9.62438 3.59576L3.39812 9.78928L3.37498 18.5714L9.5685 24.7976L18.3506 24.8208L24.5769 18.6273L24.6 9.84516L18.4065 3.6189ZM26.9359 8.88481L19.3791 1.28812L8.66403 1.25988L1.06734 8.81663L1.0391 19.5317L8.59585 27.1284L19.311 27.1567L26.9076 19.5999L26.9359 8.88481Z",fill:"#B15600"}),ut.jsx("path",{d:"M15.1664 7.58398H12.8331V16.9173H15.1664V7.58398Z",fill:"#B15600"}),ut.jsx("path",{d:"M13.9998 21.6395C14.8896 21.6395 15.6109 20.9181 15.6109 20.0283C15.6109 19.1386 14.8896 18.4172 13.9998 18.4172C13.11 18.4172 12.3887 19.1386 12.3887 20.0283C12.3887 20.9181 13.11 21.6395 13.9998 21.6395Z",fill:"#B15600"})]})}return ut.jsx(m,{component:gd,open:l,autoHideDuration:a,onClose:(e,t)=>{"clickaway"!==t&&n()},exited:o,sx:{position:"fixed",top:20,left:20,right:20,zIndex:1,[e.breakpoints.up("tablet")]:{left:"auto"}},children:ut.jsx(Ye,{timeout:{enter:400,exit:400},in:l,appear:!0,unmountOnExit:!0,onEnter:()=>{i(!1)},onExited:()=>{i(!0)},nodeRef:r,children:o=>ut.jsxs(m,{ref:r,sx:{display:"flex",justifyContent:"space-between",p:12,borderRadius:8,backgroundColor:"background.paper",color:"text.primary",border:"solid 1px",borderColor:"border.main",boxShadow:"0px 6px 12px 0px rgba(0, 0, 0, 0.10)",transform:bd[o],transition:"transform 300ms ease",[e.breakpoints.up("tablet")]:{p:20,width:"auto",maxWidth:328}},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(m,{sx:{mt:7,"& > svg":{width:28,height:28},[e.breakpoints.up("tablet")]:{"& > svg":{width:36,height:36}}},children:t?s:""}),ut.jsxs(m,{sx:{ml:20},children:[ut.jsx(m,{sx:{typography:"caption"},children:null==t?void 0:t.message}),(null==t?void 0:t.link)?ut.jsxs(m,{component:"a",target:"_blank",rel:"noopener noreferrer",href:t.link.outerLink,sx:{display:"inline-flex",alignItems:"center",typography:"body2",color:"text.secondary","&:hover":{color:"text.primary"}},children:[t.link.text,ut.jsx(m,{component:"svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{ml:4,width:18,height:18},children:ut.jsx("path",{d:"M4.22703 13.2122L10.6811 6.75812L4.75206 6.75812L4.75736 5.25729H13.2426V13.7426H11.7471L11.7418 7.81878L5.28769 14.2729L4.22703 13.2122Z",fill:"currentColor"})})]}):"",(null==t?void 0:t.content)?ut.jsx(m,{sx:{mt:4,typography:"body2",color:"text.secondary"},children:t.content}):""]})]}),ut.jsxs(m,{sx:{position:"relative",top:10,ml:12,display:"flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:12,borderStyle:"solid",borderWidth:a?"2.4px":0,borderColor:e.palette.border.main,backgroundColor:a?"transparent":e.palette.background.paperDarkContrast,cursor:"pointer",boxSizing:"border-box",[e.breakpoints.up("tablet")]:{ml:28}},onClick:n,children:[a?ut.jsx(vd,{size:24,strokeWidth:"2.4px",time:`${a}ms`,color:e.palette.text.disabled}):"",ut.jsx(m,{component:"svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:16,height:16,border:"none",color:e.palette.text.disabled},children:ut.jsx("g",{children:ut.jsx("path",{d:"M12.8897 4.36345L9.25313 8L12.8897 11.6365L11.6775 12.8487L8.04095 9.21218L4.4044 12.8487L3.19221 11.6365L6.82876 8L3.19221 4.36345L4.4044 3.15127L8.04095 6.78782L11.6775 3.15127L12.8897 4.36345Z",fill:"currentColor"})})})]})]})})})}var Cd;function wd(){return wd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},wd.apply(null,arguments)}const kd=e=>z.createElement("svg",wd({width:"33px",height:"33px",viewBox:"0 0 33 33",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},e),Cd||(Cd=z.createElement("g",{stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},z.createElement("g",{transform:"translate(-186.000000, -375.000000)",stroke:"currentColor",strokeWidth:4},z.createElement("g",{transform:"translate(18.000000, 291.000000)"},z.createElement("g",{transform:"translate(40.000000, 83.000000)"},z.createElement("path",{d:"M159,32 C159,15.9837423 146.016258,3 130,3"}))))))),Rd=300;function Md({open:e,onClose:t,afterClose:n,title:o,rightSlot:i,canBack:r=!0,children:a,height:l,testId:s}){return ut.jsxs(m,{sx:{position:"absolute",top:e?0:"100%",transition:`all ${Rd}ms`,zIndex:20,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",backgroundColor:"background.paper",borderRadius:16,height:l},"data-testid":s,"data-active":e?"1":"0",children:[o?ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20},children:[ut.jsx(m,{sx:{display:"flex",alignItems:"center",typography:"caption"},children:o}),i,!i&&r&&ut.jsx(m,{component:$e.Error,sx:{color:"text.secondary",cursor:"pointer"},onClick:()=>{t&&t(),setTimeout((()=>n&&n()),Rd)}})]}):"",e?a:""]})}function Sd({open:e,onClose:t,afterClose:n,title:o,rightSlot:i,canBack:r=!0,children:a,height:l,testId:s}){return ut.jsx(x,{open:e,onClose:t,"data-testid":s,"data-active":e?"1":"0",children:ut.jsxs(m,{sx:{display:"flex",flexDirection:"column",height:l},children:[o?ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20},children:[ut.jsx(m,{sx:{display:"flex",alignItems:"center",typography:"caption"},children:o}),i,!i&&r&&ut.jsx(m,{component:$e.Error,sx:{color:"text.secondary",cursor:"pointer"},onClick:()=>{t&&t(),setTimeout((()=>n&&n()),Rd)}})]}):"",e?a:""]})})}function Ed(e){var{scope:t,modal:n}=e,o=nr(e,["scope","modal"]);const{widgetRef:i,DialogComponent:r}=ar();if(r)return ut.jsx(r,{scope:t,...o});const a=n?Sd:Md;return(null==i?void 0:i.current)&&!t?ze(ut.jsx(a,{...o}),i.current):ut.jsx(a,{...o})}const Td=6;function Wd({showingDone:e,errorMessage:t}){var n;const o=g();return t?ut.jsx(m,{component:$e.ErrorWarn,sx:{width:64,height:64,color:"error.main"}}):e?ut.jsx(m,{component:$e.DoneBorder,sx:{width:64,height:64,color:"success.main"}}):ut.jsx(m,{sx:{mx:"auto",border:`${Td}px solid ${null===(n=o.palette)||void 0===n?void 0:n.background.input}`,borderRadius:"50%",width:"64px",height:"64px",position:"relative",animation:"loadingRotate 1.1s infinite linear","@keyframes loadingRotate":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(359deg)"}}},children:ut.jsx(m,{component:kd,sx:{position:"absolute",top:`-${Td}px`,right:`-${Td}px`,color:"primary.main"}})})}function Ld({showingDone:e,showing:t}){return ut.jsxs(m,{sx:{display:"flex",alignItems:"center",flexDirection:"column"},children:[ut.jsx(m,{sx:{mt:60},children:e?o._({id:"4xbbt/",message:"{0} confirmed",values:{0:null==t?void 0:t.brief}}):o._({id:"/nzjSF",message:"{0} pending",values:{0:null==t?void 0:t.brief}})}),(null==t?void 0:t.subtitle)?ut.jsx(m,{sx:{mt:20,typography:"body2"},children:null==t?void 0:t.subtitle}):""]})}function Id({isStarted:e,isEnded:t,tx:o}){const[i,r]=q(0),{chainId:a}=sr(),l=Q((()=>`https://${Fi[a||1]}/tx/${o}`),[o,a]),s=Q((()=>{const e=Math.floor(i/60),t=i%60;return e?`${e}m ${t}s`:`${t}s`}),[i]),d=$();return J((()=>(e&&(r(0),window.clearInterval(d.current),d.current=window.setInterval((()=>{r((e=>e+1))}),1e3)),()=>{window.clearInterval(d.current)})),[e]),J((()=>{t&&window.clearInterval(d.current)}),[t]),ut.jsxs(m,{sx:{mt:20,pt:20,display:"flex",justifyContent:"space-between",alignItems:"center",typography:"body2",color:"text.secondary",border:"solid 1px transparent",borderTopColor:"border.main"},children:[ut.jsxs(m,{children:[ut.jsx(n,{id:"+Jkdiu",message:"Transaction Time:"}),s]}),ut.jsxs(y,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},component:"a",href:l,target:"_blank",rel:"noopener noreferrer",children:[ut.jsx(n,{id:"S3piC2",message:"Tx"}),ut.jsx(m,{component:$e.ArrowTopRightBorder,sx:{width:16,height:16,ml:6}})]})]})}function Vd(e){var{children:t,executionStatus:o}=e;const i=zr(nr(e,["children","executionStatus"])),{ctxVal:r,showing:a,closeShowing:l,showingDone:s,errorMessage:d,transactionTx:c}=Object.assign(Object.assign({},i),o),u=de(),p=ar((e=>e.noSubmissionDialog));return ut.jsxs(Xr.Provider,{value:r,children:[t,ut.jsx(Ed,{open:!!a&&!p,onClose:l,id:"submission",children:ut.jsxs(m,{sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",px:20,pb:20,flex:1,overflowY:"auto"},children:[ut.jsxs(m,{children:[ut.jsx(m,{sx:{textAlign:"center",pt:60},children:ut.jsx(Wd,{showingDone:s,errorMessage:d})}),d?ut.jsxs(m,{sx:{textAlign:"center",mt:60},children:[ut.jsx(m,{children:ut.jsx(n,{id:"kf83Ld",message:"Something went wrong."})}),ut.jsx(m,{sx:{color:"text.secondary",mt:12,typography:"body2",wordBreak:"break-all"},children:d})]}):ut.jsxs(ut.Fragment,{children:[ut.jsx(Ld,{showingDone:s,showing:a}),ut.jsx(Id,{isStarted:!!a,isEnded:s,tx:c})]})]}),ut.jsx(v,{fullWidth:!0,size:v.Size.big,onClick:()=>{u(hr(gr.Initial)),l()},sx:{mt:20},children:d?ut.jsx(n,{id:"1QfxQT",message:"Dismiss"}):ut.jsx(n,{id:"yz7wBu",message:"Close"})})]})})]})}const Od="dodo-widget-container";function Zd(e){return e.noLangProvider?ut.jsx(ut.Fragment,{children:e.children}):ut.jsx(ms,{locale:e.locale,children:ut.jsx(Vd,{...e,children:e.children})})}function Fd(e){!function({tokenList:e,popularTokenList:t}){const n=de();J((()=>{(()=>{or(this,void 0,void 0,(function*(){let o=[];o=re(e)?e:ie(t,Wa,(e=>e.address.toLowerCase()+e.chainId+e.side)),n(La(o))}))})()}),[e,n,t]),J((()=>{n(Ia(null!=t?t:[]))}),[t,n])}(e),Ur();const t=e.width||375,n=e.height||494,{widgetRef:o}=ar();return e.noUI?ut.jsx(Zd,{...e,children:e.children}):ut.jsx(Zd,{...e,children:ut.jsx(m,{sx:{width:t,height:n,overflow:"hidden",position:"relative",display:"flex",flexDirection:"column",minWidth:335,minHeight:494,borderRadius:16,backgroundColor:"background.paper"},className:Od,ref:o,children:e.children})})}function Nd(e){var t,n;const o=$(null);return ut.jsx(ue,{store:ra,children:ut.jsx(rr,{...Object.assign(Object.assign({},e),{widgetRef:null!==(t=e.widgetRef)&&void 0!==t?t:o,apiDomain:null!==(n=e.apiDomain)&&void 0!==n?n:"dodoex.io"}),children:ut.jsx(xs,{children:ut.jsx(is,{children:ut.jsx(Fd,{...e})})})})})}function Ad(e){const t=b({mode:e.colorMode,theme:e.theme,lang:e.locale||$l});return e.apikey||e.apiServices||console.error("apikey and apiServices must have a."),ut.jsxs(j,{theme:t,children:[ut.jsx(C,{container:`.${Od}, .${w}, .${k}`}),ut.jsx(je,{client:gs,children:ut.jsxs(Nd,{...e,children:[e.children,ut.jsx(jd,{})]})})]})}function Hd(e){var{sx:t}=e,n=nr(e,["sx"]);const{width:o}=ar(),i=Q((()=>{let e="";return"number"==typeof o?e=`${o}px`:o&&(e=o),e?`calc(${e} - 40px)`:"auto"}),[o]);return ut.jsx(R,{container:document.querySelector(`.${Od}`),maxWidth:i,sx:Object.assign({cursor:"help"},t),...n})}function Pd(e){var t,{chainId:o,includeButton:i}=e,r=nr(e,["chainId","includeButton"]);const{account:a,chainId:l}=sr(),{onConnectWalletClick:s}=ar(),[d,c]=X.useState(!1),{setVisible:u}=Ue();return!a||d||void 0===l||o&&o!==l?ut.jsx(ut.Fragment,{children:ut.jsx(v,{...r,isLoading:d,onClick:()=>or(this,void 0,void 0,(function*(){if(s){c(!0);const e=yield s();if(c(!1),e)return}u(!0)})),children:d?ut.jsx(n,{id:"J28zul",message:"Connecting..."}):ut.jsx(n,{id:"r7ScnQ",message:"Connect to a wallet"})})}):i?ut.jsx(ut.Fragment,{children:null!==(t=r.children)&&void 0!==t?t:null}):ut.jsx(v,{...r})}function Bd({needSwitchChain:e}){return ut.jsx(ut.Fragment,{children:ut.jsx(Pd,{size:v.Size.middle,fullWidth:!0,"data-testid":Xi,chainId:e})})}function Ud({open:e,execute:t,onClose:o,toToken:i,fromToken:r,fromAmount:a,toAmount:l,priceImpact:s,clearFromAmt:d,clearToAmt:c,baseFeeAmount:u,curToFiatPrice:p,curFromFiatPrice:h,additionalFeeAmount:f,loading:x,slippage:y}){var b,j;const C=g(),w=de(),k=ce(aa),R=Q((()=>!!s&&new te(s).gt(Bi)),[s]),[E,T]=q(!1),[W,L]=q(!1);return J((()=>{k!==gr.Pending&&o(),k===gr.TxSuccess&&(c(),d())}),[k]),J((()=>{T(!1)}),[p]),ut.jsx(Ed,{open:e,onClose:()=>{w(hr(gr.Initial)),o()},id:"swap-summary",title:ut.jsx(n,{id:"QR4/RH",message:"Swap summary"}),children:ut.jsxs(m,{sx:{margin:20,display:"flex",height:"100%",flexDirection:"column",borderTop:`1px solid ${C.palette.border.main}`},children:[ut.jsxs(m,{sx:{py:20,display:"flex",typography:"body2",alignItems:"center",justifyContent:"center",flexDirection:"column",borderBottom:`1px solid ${C.palette.border.main}`},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:[ut.jsx(Kl,{width:16,height:16,url:null==r?void 0:r.logoURI,address:null!==(b=null==r?void 0:r.address)&&void 0!==b?b:"",marginRight:6}),ut.jsx(m,{children:`${jr({input:a,decimals:null==r?void 0:r.decimals})} ${null==r?void 0:r.symbol}`})]}),null!==h&&ut.jsx(m,{sx:{mt:4,typography:"h6",color:C.palette.text.secondary},children:h?`$${br({input:h,showDecimals:1})}`:"-"})]}),ut.jsx(m,{sx:{width:16,mx:16},component:$e.DoubleRight}),ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex"},children:[ut.jsx(Kl,{width:16,height:16,marginRight:6,url:null==i?void 0:i.logoURI,address:null!==(j=null==i?void 0:i.address)&&void 0!==j?j:""}),ut.jsx(M,{loading:x,loadingProps:{width:30},children:`${jr({input:l,decimals:null==i?void 0:i.decimals})} ${null==i?void 0:i.symbol}`})]}),null!==h&&ut.jsx(M,{loading:x,loadingProps:{width:30},sx:{typography:"h6",mt:4,color:C.palette.text.secondary},children:p?`$${br({input:p,showDecimals:1})}(${s}%)`:"-"})]})]}),ut.jsxs(m,{sx:{mt:12,display:"flex",alignItems:"center",typography:"h6"},children:["1",null==r?void 0:r.symbol," = ",ut.jsx(M,{loading:x,loadingProps:{width:30},children:jr({input:new te(l).dividedBy(new te(a)),decimals:null==i?void 0:i.decimals})})," ",null==i?void 0:i.symbol]})]}),ut.jsxs(m,{sx:{py:15,typography:"body2",borderBottom:`1px solid ${C.palette.border.main}`},children:[ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",color:C.palette.text.secondary},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(m,{sx:{width:16,mr:7},component:$e.DetailBorder}),ut.jsx(n,{id:"XeovX3",message:"Swap Detail"})]}),ut.jsx(m,{component:S,children:ut.jsx(m,{onClick:()=>L(!W),sx:{width:10,color:"text.secondary",transform:W?"rotateX(0deg)":"rotateX(180deg)"},component:$e.CaretUp})})]}),ut.jsxs(m,{sx:{mt:16,display:W?"initial":"none"},children:[ut.jsxs(m,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(n,{id:"93m8jT",message:"Basic Fee"}),ut.jsx(Hd,{title:ut.jsx(n,{id:"8Z29ZO",message:"Estimated service provider fees"}),ml:5})]}),ut.jsx(M,{loading:x,loadingProps:{width:30},children:u?`${jr({input:u,decimals:null==i?void 0:i.decimals})} ${null==i?void 0:i.symbol}`:"0"})]}),ut.jsxs(m,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(n,{id:"J39pAJ",message:"Additional Fee"}),ut.jsx(Hd,{title:ut.jsx(n,{id:"ZXvy7b",message:"Additional routing fees set by the Widget user"}),ml:5})]}),ut.jsx(M,{loading:x,loadingProps:{width:30},children:f?`${jr({input:f,decimals:null==i?void 0:i.decimals})} ${null==i?void 0:i.symbol}`:"0"})]}),!!s&&ut.jsxs(m,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(n,{id:"T+qgFw",message:"Price Impact"}),ut.jsx(Hd,{title:ut.jsx(n,{id:"4kY4C4",message:"Due to the market condition, market price and estimated price may have a slight difference"}),ml:5})]}),ut.jsx(m,{children:`${s}%`})]}),ut.jsxs(m,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(n,{id:"CMHmbm",message:"Slippage"}),ut.jsx(Hd,{title:ut.jsx(n,{id:"GAypnX",message:"High slippage tolerance will increase the success rate of transaction, but might not get the best quote."}),ml:5})]}),ut.jsxs(m,{children:[y,"%"]})]})]})]}),ut.jsx(m,{sx:{flex:1}}),R&&ut.jsxs(m,{sx:{mb:14,display:"flex",cursor:"pointer",justifyContent:"center",alignItems:"center",typography:"h6"},onClick:()=>T(!E),children:[ut.jsx(m,{sx:{mr:4,width:18,height:18,alignItems:"center"},children:E?ut.jsx(m,{sx:{width:"100%",height:"100%",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"secondary.main"},children:ut.jsx(m,{component:$e.Done,sx:{width:14,color:"#1a1a1b"}})}):ut.jsx(m,{sx:{width:"100%",height:"100%",borderRadius:4,border:`1px solid ${C.palette.text.secondary}`}})}),ut.jsx(m,{children:ut.jsx(n,{components:{0:ut.jsx(m,{component:"span",sx:{color:"error.main"}})},values:{priceImpact:s},id:"Price impact reaches <0>{priceImpact}</0>%, accept the quote"})})]}),ut.jsx(v,{isLoading:k==gr.Pending,disabled:R&&!E,fullWidth:!0,onClick:()=>{t(),w(hr(gr.Pending))},children:k==gr.Pending?ut.jsx(n,{id:"P+K/3O",message:"Confirming"}):ut.jsx(n,{id:"lQ6r7x",message:"Confirm swap"})})]})})}var Dd;function Yd({fromToken:e,toToken:t}){const o=g(),{onlySolana:i}=ar();ja();const{customSlippage:r,customSlippageNum:a,handleSlippageChange:l,forecastSlippage:s,forecastSlippageQuery:d,recommendSlippage:c}=ka({fromToken:e,toToken:t}),[u,p]=X.useState(!1),[h,f]=X.useState();!h&&e&&t&&f(r?Dd.custom:Dd.recommend);const x=h===Dd.custom;return X.useRef(null),X.useMemo((()=>h===Dd.custom?a?new te(a).div(100).toNumber():void 0:new te(c).div(100).toNumber()),[h,c,a]),X.useCallback((e=>{x||f(Dd.custom),l({slippage:new te(e).times(100).toString(),disabled:!1,deleted:!1,recommend:String(c)})}),[x,c,l]),i?ut.jsxs(m,{sx:{pt:20,borderTop:`1px solid ${o.palette.border.main}`},children:[ut.jsxs(m,{sx:{mb:16,display:"flex",alignItems:"center"},children:[ut.jsx(n,{id:"lqTDfd",message:"Slippage Tolerance"}),ut.jsx(R,{title:ut.jsx(n,{id:"KAmxpM",message:"Attention: High slippage tolerance will increase the success rate of transaction, but might not get the best quote."}),ml:7})]}),ut.jsxs(m,{sx:{display:"flex",flexDirection:"column"},children:[ut.jsx(E,{placeholder:String(c),fullWidth:!0,sx:{height:36,"& input":{boxSizing:"border-box","&::placeholder":{color:"custom.input.placeholder",opacity:1}}},inputMode:"decimal",suffix:ut.jsx(m,{sx:{color:"text.disabled"},children:"%"}),value:r||"",onChange:e=>{const t=e.target.value;l({slippage:t,disabled:!1,recommend:String(c)})},onBlur:()=>{setTimeout((()=>{if(p(!1),!a)return void f(Dd.recommend);const e=!a||a<0;e&&r&&l({slippage:r,disabled:e,deleted:e,recommend:String(c)})}),10)}}),Number(r)>=Di&&ut.jsx(m,{sx:{typography:"h6",mt:6,color:"error.main"},children:ut.jsx(n,{id:"Zm56FI",message:"Maximum slippage do not exceed 50%"})})]})]}):null}function zd({checked:e,onChange:t,sx:o,disabled:i}){const r=g();let a=r.palette.background.paper;return e&&(a=r.palette.secondary.main),ut.jsxs(m,{sx:Object.assign({display:"flex",alignItems:"center",position:"relative",borderRadius:8,backgroundColor:r.palette.background.input,opacity:i?.5:1},o),component:S,disabled:i,onClick:()=>{i||t(!e)},children:[ut.jsx(m,{sx:{typography:"body2",fontWeight:600,pl:12,pr:13,pt:8,pb:9,width:"50%",zIndex:1,color:r.palette.text.primary,whiteSpace:"nowrap"},children:ut.jsx(n,{id:"az8lvo",message:"Off"})}),ut.jsx(m,{sx:{typography:"body2",fontWeight:600,pl:12,pr:13,pt:8,pb:9,width:"50%",zIndex:1,color:e?r.palette.secondary.contrastText:r.palette.text.primary,whiteSpace:"nowrap"},children:ut.jsx(n,{id:"Z5HWHd",message:"On"})}),ut.jsx(m,{sx:{borderRadius:6,backgroundColor:a,zIndex:0,position:"absolute",top:2,bottom:2,width:"calc(50% - 2px - 2px)",left:e?"calc(50% + 2px)":"2px",transition:"left 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"}})]})}function Xd({show:e,onClick:t}){const o=g();return ut.jsxs(y,{weak:!0,sx:{display:e?"flex":"none",alignItems:"center",position:"absolute",bottom:28,left:"50%",transform:"translateX(-50%)",p:o.spacing(8,20),fontWeight:600,borderRadius:20,border:`solid 1px ${o.palette.border.main}`,backgroundColor:"background.paperContrast",boxShadow:`0px 8px 16px 0px ${T("light"===o.palette.mode?"#FFF":"#000",.1)}`,cursor:"pointer",whiteSpace:"nowrap",gap:4},onClick:t,children:[ut.jsx(n,{id:"F8yRdq",message:"More trade settings"}),ut.jsx(m,{component:"svg",width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{color:"text.secondary"},children:ut.jsx("path",{d:"M12.5 19L6.5 13L7.9 11.6L12.5 16.175L17.1 11.6L18.5 13L12.5 19ZM12.5 13L6.5 6.99998L7.9 5.59998L12.5 10.175L17.1 5.59998L18.5 6.99998L12.5 13Z",fill:"currentColor"})})]})}function qd({open:e,onClose:t,fromToken:o,toToken:i}){const r=g(),{ddl:a,disableIndirectRouting:l}=ja(),{onlySolana:s}=ar(),d=X.useRef(null),[c,u]=X.useState(!1);return X.useEffect((()=>{const e=d.current,t=new ResizeObserver((()=>{e&&u(e.scrollHeight!==e.offsetHeight)})),n=ae((()=>{if(!e)return;const t=e.scrollTop+e.clientHeight<e.scrollHeight-2;u(t)}),50);return e&&(u(e.scrollHeight!==e.clientHeight),t.observe(e),e.addEventListener("scroll",n)),()=>{e&&(t.unobserve(e),e.removeEventListener("scroll",n))}}),[null==d?void 0:d.current]),ut.jsx(Ed,{open:e,onClose:t,id:"swap-settings",title:ut.jsx(n,{id:"Tz0i8g",message:"Settings"}),children:ut.jsxs(m,{sx:{px:20,pb:34,overflowY:"auto"},ref:d,children:[ut.jsx(Yd,{fromToken:o,toToken:i}),!s&&ut.jsxs(m,{sx:{mt:24,pt:14,borderTop:`solid 1px ${r.palette.border.main}`},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",fontWeight:600},children:[ut.jsx(n,{id:"zSMRJ/",message:"Transaction Deadline"}),ut.jsx(Hd,{title:ut.jsx(n,{id:"wmCrk7",message:"You may modify the transaction deadline, the maximum time allowed for a trade to be processed on-chain. However, please note that this may lead to your trade executing at a subpar price, as the market price may change during that time."}),ml:7})]}),ut.jsxs(m,{sx:{mt:16,display:"flex",alignItems:"center",gap:8,typography:"body2"},children:[ut.jsx(E,{sx:{width:80,height:34,lineHeight:1,typography:"body2","& input":{px:16,py:6}},placeholder:String(Yi),value:a,onChange:e=>{ja.setState({ddl:e.target.value})}}),ut.jsx(n,{id:"H9HlDe",message:"minutes"})]})]}),!s&&ut.jsx(m,{sx:{display:"flex",flexDirection:"column",gap:12,mt:24,pt:14,borderTop:`solid 1px ${r.palette.border.main}`},children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[ut.jsxs(m,{sx:{fontWeight:600},children:[ut.jsx(n,{id:"MXQodB",message:"Disable Indirect Routing"}),ut.jsx(Hd,{title:ut.jsx(n,{id:"Y0Knz4",message:"Checking this option means that the routing algorithm will only route to liquidity pools between the two tokens in the trading pair and will ignore routes with any intermediary tokens."}),ml:7})]}),ut.jsx(zd,{checked:l,onChange:e=>{ja.setState({disableIndirectRouting:e})}})]})}),ut.jsx(Xd,{show:c,onClick:()=>{var e,t;null===(e=d.current)||void 0===e||e.scrollTo({top:null===(t=d.current)||void 0===t?void 0:t.scrollHeight,behavior:"smooth"})}})]})})}function Jd({onClick:e,disabled:t,plus:n}){const o=g(),i=t||n||!e;return ut.jsx(m,{sx:{width:"100%",position:"relative"},children:ut.jsx(m,{component:S,sx:Object.assign({width:36,height:36,borderRadius:"50%",backgroundColor:o.palette.background.input,border:`4px solid ${o.palette.background.paper}`,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%) rotate(-90deg)",color:"text.secondary"},i?{cursor:"inherit"}:{"&:hover":{color:"text.primary"},"&:focus-visible":{"&::before":{content:'""',position:"absolute",display:"block",left:"50%",top:"50%",transform:"translate(-50%, -50%)",borderRadius:"50%",width:28,height:28,border:"solid 1px",borderColor:"text.primary"}}}),disabled:i,onClick:()=>{i||e&&e()},children:n?ut.jsx(m,{component:$e.Plus,sx:{width:18,height:18}}):ut.jsx(m,{component:$e.ArrowBack,sx:{width:18,height:18}})})})}!function(e){e.recommend="recommend",e.custom="custom"}(Dd||(Dd={}));const Gd=()=>{const{requests:e,updateText:t}=qr(),n=X.useMemo((()=>{let t={};return null==e||e.forEach((([e,n])=>{var o,i;if((n===dr.Running||n===dr.Success)&&(null===(o=e.metadata)||void 0===o?void 0:o.logBalance)&&(!e.doneTime||Math.ceil(Date.now()/1e3)-e.doneTime<300)){const n=null===(i=e.metadata)||void 0===i?void 0:i.logBalance;t=Object.assign(Object.assign({},t),n)}})),t}),[e&&Array.from(e)]),o=X.useMemo((()=>{let t={};return null==e||e.forEach((([e,n])=>{var o,i;if(n===dr.Success&&(null===(o=e.metadata)||void 0===o?void 0:o.logBalance)&&e.doneTime&&Math.ceil(Date.now()/1e3)-e.doneTime<300){const n=null===(i=e.metadata)||void 0===i?void 0:i.logBalance;t=Object.assign(Object.assign({},t),n)}})),t}),[e&&Array.from(e)]),i=X.useCallback(((e,n,o)=>{const i=e[n];if(!i)return!1;return!!(te.isBigNumber(o)?o:new te(o)).isEqualTo(i)||(t((e=>{var t;const o=Object.assign({},e.metadata);return(null===(t=null==o?void 0:o.logBalance)||void 0===t?void 0:t[n])?(delete o.logBalance[n],Object.keys(o.logBalance).length||delete o.logBalance,{brief:e.brief,spec:e.spec,metadata:o}):null})),!1)}),[t]),r=X.useCallback(((e,t)=>i(n,e,t)),[n,i]),a=X.useCallback(((e,t)=>i(o,e,t)),[o,i]);return{balanceData:n,balanceDataDone:o,isTokenLoading:r,isTokenLoadingDone:a}};function Qd({onClick:e,balance:t,decimals:o,address:i,showMaxBtn:r,canClickBalance:a,loading:l,balanceText:s}){const{palette:d}=g(),c=a&&(null==t?void 0:t.gt(0))&&e;return ut.jsxs(m,{sx:Object.assign({typography:"body2",alignItems:"center",color:d.text.secondary,wordBreak:"break-word",textAlign:"right"},c?{"&:hover":{color:d.text.primary,cursor:"pointer"}}:{}),onClick:c?()=>e(t?t.toString():""):void 0,children:[null!=s?s:ut.jsx(n,{id:"0QDjxt",message:"Balance:"})," ",l?ut.jsx(W,{sx:{position:"relative",top:-2,verticalAlign:"middle"}}):ut.jsxs(ut.Fragment,{children:[i?jr({input:t,decimals:Math.min(o||4,4)}):"-",r&&t&&t.gt(0)&&e&&ut.jsx(m,{component:S,sx:{ml:6,color:(null==t?void 0:t.gt(0))?d.primary.main:d.text.disabled,cursor:i?"pointer":"unset",typography:"body2"},onClick:()=>e&&e(t?t.toString():""),children:ut.jsx(n,{id:"CK1KXz",message:"Max"})})]})]})}const _d=ee((function({readOnly:e,sx:t,value:n,decimals:o,onChange:i,suffix:r,suffixGap:a=0,withClear:l,onFocus:s,placeholder:d,readonlyShowSuffix:c,typography:u},p){const h=g(),f=Q((()=>r||(l&&n&&i?ut.jsx(m,{component:S,sx:{ml:5,width:18,height:18,borderRadius:"50%",backgroundColor:"border.main",display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,color:"text.secondary","&:focus-visible":{border:"solid 1px",borderColor:"text.primary"}},onClick:()=>{i&&i("")},children:ut.jsx(m,{component:$e.Error,sx:{width:12}})}):void 0)),[i,r,h.palette.text.primary,n,l]);return ut.jsx(E,{fullWidth:!0,value:n,readOnly:e,placeholder:d||"0.00",onFocus:s,onChange:e=>{const t=e.target.value,n=0===t.length?"":kr(t,o);i&&i(n)},"data-testid":"number-input-wrapper",suffix:(!e||c)&&f,suffixGap:a,ref:p,sx:Object.assign({border:"none","& input":{fontSize:24,typography:u,border:"none",outline:"none",padding:0,color:"text.primary","&::placeholder":{fontSize:24,typography:u,color:"text.disabled"}}},t)})}));function Kd(){const e=g(),t=ar((e=>e.width)),[n,o]=X.useState(null!=t?t:"undefined"==typeof window?375:document.body.clientWidth);X.useEffect((()=>{const e=()=>{o("undefined"==typeof window?375:document.body.clientWidth)};return"number"!=typeof t?(e(),window.addEventListener("resize",e)):o(t),()=>{window.removeEventListener("resize",e)}}),[t]);return{isMobile:X.useMemo((()=>"number"==typeof n&&n<e.breakpoints.values.tablet),[n,e.breakpoints.values]),isTablet:X.useMemo((()=>"number"==typeof n&&n<e.breakpoints.values.tablet),[n,e.breakpoints.values]),minDevice:X.useCallback((e=>"number"==typeof n&&n>e),[n]),maxDevice:X.useCallback((e=>"number"==typeof n&&n<e),[n])}}const $d=[.25,.5,.75,1];function ec({value:e,onChange:t,sx:n}){const o=g(),i="light"===o.palette.mode,{isMobile:r}=Kd();return ut.jsx(m,{sx:Object.assign({display:"grid",gap:r?10:14,gridTemplateColumns:`repeat(${$d.length}, 1fr)`},n),children:$d.map((n=>{const r=n===e;return ut.jsxs(S,{disabled:!t,sx:{typography:"h6",borderRadius:4,padding:o.spacing(4,0),width:"100%",color:"text.secondary",backgroundColor:"background.paperDarkContrast","&:disabled":{color:"text.disabled"},"&:not(:disabled)&:hover":{color:o.palette.text.primary,backgroundColor:T(o.palette.text.primary,.2)},"&.selected, &:focus":{color:"#fff",backgroundColor:i?o.palette.primary.main:T(o.palette.text.primary,.4)}},onClick:()=>{!r&&t&&t(n)},className:r?"selected":void 0,children:[100*n,"%"]},n)}))})}function tc({token:e,onClick:t,showChainLogo:o,readonly:i,showChainName:r}){var a,l;const s=g(),d=(null==e?void 0:e.chainId)?Ql.get(e.chainId):null,c=r&&!!d;return ut.jsxs(m,{component:S,sx:{display:"flex",alignItems:"center",gap:8,color:s.palette.text.primary,typography:c?"body2":"body1",fontWeight:600,"&:focus-visible":{opacity:.5}},onClick:e=>{i||t&&t(e)},"data-testid":Gi,children:[!!(null==e?void 0:e.address)&&ut.jsx(Kl,{url:null==e?void 0:e.logoURI,address:null!==(a=null==e?void 0:e.address)&&void 0!==a?a:"",chainId:null==e?void 0:e.chainId,noShowChain:!o,width:30,height:30,chainSize:16,logoOffset:10,marginRight:0}),ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[(null==e?void 0:e.address)?ut.jsx(ut.Fragment,{children:ut.jsx(m,{children:null!==(l=null==e?void 0:e.symbol)&&void 0!==l?l:"-"})}):ut.jsx(n,{id:"sIPJGT",message:"SELECT TOKEN"}),!i&&ut.jsx("svg",{width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ut.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 11.75L12 7.25H6L9 11.75Z",fill:"currentColor"})})]}),!!c&&ut.jsxs(m,{sx:{display:"flex",alignItems:"center",typography:"h6",color:"text.secondary"},children:[d.name,ut.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ut.jsx("path",{d:"M5.6036 4.12761C5.50037 4.20906 5.3708 4.24967 5.23958 4.24169C5.10836 4.23372 4.98466 4.17773 4.89203 4.08438C4.7994 3.99103 4.74433 3.86685 4.7373 3.73549C4.73026 3.60413 4.77177 3.47477 4.8539 3.37205L5.96239 2.25211C6.46737 1.76405 7.14372 1.494 7.84575 1.5001C8.54779 1.50621 9.21934 1.78798 9.71577 2.28474C10.2122 2.78151 10.4938 3.4535 10.4999 4.156C10.506 4.85851 10.2361 5.5353 9.74839 6.04062L8.60241 7.16592C8.55441 7.22201 8.49533 7.26757 8.4289 7.29974C8.36246 7.3319 8.29009 7.34997 8.21635 7.35282C8.1426 7.35567 8.06906 7.34324 8.00034 7.3163C7.93162 7.28936 7.86921 7.2485 7.81702 7.19627C7.76483 7.14405 7.724 7.0816 7.69707 7.01284C7.67015 6.94407 7.65772 6.87048 7.66057 6.79668C7.66342 6.72289 7.68148 6.65047 7.71363 6.58399C7.74577 6.51751 7.7913 6.4584 7.84736 6.41036L8.97191 5.28506C9.25568 4.98032 9.41017 4.57725 9.40283 4.16078C9.39549 3.74431 9.22689 3.34695 8.93255 3.05242C8.63821 2.75788 8.24111 2.58917 7.82491 2.58182C7.40872 2.57447 7.00592 2.72906 6.70138 3.01302L5.6036 4.12761ZM6.34259 7.93755C6.38819 7.87582 6.44652 7.82461 6.51361 7.7874C6.58071 7.75018 6.65501 7.72783 6.73149 7.72185C6.80798 7.71586 6.88485 7.7264 6.95691 7.75273C7.02897 7.77906 7.09453 7.82058 7.14917 7.87447C7.2038 7.92836 7.24622 7.99337 7.27356 8.06509C7.3009 8.13682 7.31252 8.21358 7.30764 8.29019C7.30275 8.3668 7.28148 8.44147 7.24525 8.50913C7.20902 8.5768 7.15869 8.63589 7.09765 8.68239L5.96774 9.81305C5.45894 10.2708 4.7943 10.5163 4.11029 10.4992C3.42627 10.482 2.77479 10.2034 2.2896 9.72061C1.80441 9.23784 1.52232 8.58752 1.50127 7.90316C1.48021 7.2188 1.72179 6.55234 2.17638 6.04062L3.30629 4.93139C3.3504 4.86735 3.4079 4.81369 3.47482 4.77413C3.54174 4.73456 3.61646 4.71005 3.69379 4.70229C3.77113 4.69453 3.84922 4.70371 3.92266 4.72919C3.99609 4.75466 4.0631 4.79583 4.11904 4.84983C4.17497 4.90384 4.21849 4.96937 4.24657 5.0419C4.27464 5.11442 4.28661 5.19219 4.28163 5.2698C4.27665 5.34742 4.25484 5.42302 4.21773 5.49135C4.18062 5.55969 4.12908 5.61912 4.06671 5.66552L2.93144 6.79618C2.64767 7.10092 2.49318 7.50398 2.50052 7.92045C2.50786 8.33692 2.67647 8.73428 2.97081 9.02882C3.26515 9.32335 3.66224 9.49207 4.07844 9.49942C4.49463 9.50676 4.89743 9.35217 5.20197 9.06821L6.34259 7.93755ZM5.00919 7.76072C4.96119 7.81681 4.90211 7.86237 4.83567 7.89454C4.76924 7.9267 4.69687 7.94477 4.62312 7.94763C4.54937 7.95048 4.47583 7.93804 4.40711 7.9111C4.33839 7.88416 4.27598 7.8433 4.2238 7.79108C4.17161 7.73885 4.13077 7.6764 4.10385 7.60764C4.07693 7.53887 4.0645 7.46528 4.06735 7.39149C4.0702 7.31769 4.08826 7.24528 4.1204 7.17879C4.15255 7.11231 4.19808 7.0532 4.25413 7.00516L6.90487 4.35267C7.00731 4.26488 7.13909 4.21901 7.27386 4.22422C7.40863 4.22943 7.53648 4.28533 7.63185 4.38077C7.72722 4.4762 7.78309 4.60413 7.7883 4.73899C7.7935 4.87385 7.74766 5.00572 7.65993 5.10823L5.00919 7.76072Z",fill:"currentColor"})})]})]})]})}function nc({token:e,disabled:t,style:n,balance:o,onClick:i}){const r=g(),{account:a}=sr(),l=o?br({input:o}):"";return ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",typography:"body2",px:6,py:5,borderRadius:8,cursor:t?"auto":"pointer",opacity:t?.5:1,"&:hover":{backgroundColor:"hover.default"}},style:n,onClick:()=>{t||i()},"data-testid":tr,children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(Kl,{token:e}),ut.jsxs(m,{children:[ut.jsx(m,{sx:{fontWeight:600,textAlign:"left"},children:e.symbol}),a&&ut.jsx(m,{sx:{mt:4,textAlign:"left"},children:(null==o?void 0:o.gte(0))?l:ut.jsx(m,{component:$e.Loading,width:18,sx:{"& path":{fill:r.palette.text.disabled},animation:"loadingRotate 1.1s infinite linear","@keyframes loadingRotate":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(359deg)"}}}})})]})]}),ut.jsx(m,{sx:{color:"text.secondary",textAlign:"right"},children:e.name})]})}function oc({chain:e,active:t,onClick:o}){return ut.jsx(L,{title:e.name,placement:"top",onlyHover:!0,children:ut.jsxs(m,{sx:Object.assign({display:"flex",alignItems:"center",p:8,borderRadius:8,cursor:"pointer"},t?{backgroundColor:"secondary.main",color:"secondary.contrastText"}:{border:"1px solid",borderColor:"border.main","&:hover":{backgroundColor:"hover.default"}}),onClick:o,children:[ut.jsx(m,{component:e.logo,sx:{width:24,height:24}}),t?ut.jsxs(m,{sx:{ml:8},children:[ut.jsx(n,{id:"Fdp03t",message:"on"}),` ${e.name}`]}):""]})},e.chainId)}function ic(e){try{return new ke(e),!0}catch(e){return!1}}function rc(e){if(e.length<=10)return e;try{return new ke(e),`${e.slice(0,4)}...${e.slice(-4)}`}catch(t){return`${e.slice(0,6)}...${e.slice(-4)}`}}function ac(e,t,n="address"){return`https://${Fi[e]}${t?`/${n}/${t}`:""}`}function lc(){return ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between"},children:[ut.jsx(I,{variant:"circular",width:32,sx:{mt:8}}),ut.jsxs(m,{sx:{ml:8,flex:"1 0 auto"},children:[ut.jsx(I,{sx:{borderRadius:4},height:24}),ut.jsx(I,{sx:{mt:4,borderRadius:4},height:19,width:137})]})]})}function sc({chainId:e,value:t,onChange:n,occupiedAddrs:i,occupiedChainId:r,hiddenAddrs:a,showAddrs:l,visible:s,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,sx:f}){const{chainList:g,selectChainId:x,setSelectChainId:v}=function(e){const{chainId:t}=sr(),n=ce(ca),{crossChain:o,onlyChainId:i}=ar(),r=Q((()=>{const t=new Set;return n.forEach((n=>{n.side&&e&&n.side!==e||t.add(n.chainId)})),t}),[n,e]),a=Q((()=>{if(!o||i)return[];const e=new Map;let n;return Ql.forEach(((o,i)=>{if(r.has(o.chainId)){if(o.mainnet){if(t!==o.chainId)return;n=o.mainnet}e.set(i,Object.assign({},o))}})),void 0!==n&&e.delete(n),Array.from(e.values())}),[t,n,o,i]),l=Q((()=>!a.length||t&&r.has(t)?t:a[0].chainId),[t,r]),[s,d]=q(l);J((()=>{void 0===s&&d(l)}),[l]);const c=Q((()=>null!=s?s:l),[s,l]);return{chainList:a,selectChainId:c,setSelectChainId:d}}(d),{showTokenList:y,filter:b,setFilter:j,onSelectToken:C,popularTokenList:w,tokenInfoMap:k}=Aa({value:t,onChange:n,occupiedAddrs:i,occupiedChainId:r,hiddenAddrs:a,showAddrs:l,side:d,chainId:null!=e?e:x,visible:s,defaultLoadBalance:c,multiple:u}),R=$(null),[M,S]=q(0);J((()=>{if(s&&t)if(Array.isArray(t)){const[e]=t;e&&e.chainId!==x&&v(e.chainId)}else v(t.chainId)}),[t,s]),J((()=>{let e;return s&&(e=window.setTimeout((()=>{R.current&&S(R.current.offsetHeight-16)}),300)),()=>clearTimeout(e)}),[R,s,x]);const E=ve({queryKey:["token-picker-searchOtherAddress",b],queryFn:()=>h?h(b):null,enabled:ic(b)&&!!h}),T=G((({index:e,style:n})=>{var o;const i=y[e];if(!i)return null;let r=!1;return t&&(r=Array.isArray(t)?t.some((e=>e.address===i.address&&e.chainId===i.chainId)):t.address===i.address&&t.chainId===i.chainId),ut.jsx(nc,{token:i,disabled:r,style:n,onClick:()=>C(i),balance:null===(o=k.get(`${i.chainId}-${i.address}`))||void 0===o?void 0:o.balance},i.address+i.chainId)}),[y,w,t]);return ut.jsxs(m,{sx:Object.assign({display:"flex",flexDirection:"column",px:20,flex:1,overflow:"hidden"},f),children:[ut.jsx(V,{fullWidth:!0,height:48,value:b,onChange:e=>j(e.target.value),clearValue:()=>j(""),placeholder:null!=p?p:o._({id:"72/M0o",message:"Enter the token symbol or address"}),sx:{mb:16}}),void 0===e&&g.length?ut.jsx(m,{sx:{position:"relative",display:"flex",gap:8,flexWrap:"wrap",pb:32,"&::after":{content:'""',position:"absolute",bottom:16,left:0,right:0,height:"1px",backgroundColor:"border.main"}},children:g.map((e=>ut.jsx(oc,{chain:e,active:e.chainId===x,onClick:()=>{v(e.chainId)}},e.chainId)))}):"",ut.jsx(m,{sx:{pb:16,flex:1,minHeight:64},ref:R,children:y.length?ut.jsx(Xe,{height:M,itemCount:y.length,itemSize:52,width:"100%",className:"token-list",children:T}):ut.jsxs(m,{sx:{height:M,overflowY:"auto"},children:[E.isLoading?ut.jsx(lc,{}):"",E.data?E.data:""]})})]})}function dc({open:e,title:t,value:o,onClose:i,occupiedAddrs:r,hiddenAddrs:a,occupiedChainId:l,onTokenChange:s,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,chainId:f,modal:m}){const{height:g}=ar(),{isMobile:x}=Kd();return ut.jsx(Ed,{height:m?"80vh":g,open:e,onClose:i,title:null!=t?t:ut.jsx(n,{id:"T0Y2+3",message:"Select a token"}),id:"select-token",testId:er,modal:m,children:ut.jsx(sc,{value:o,visible:e,onChange:s,occupiedAddrs:r,occupiedChainId:l,hiddenAddrs:a,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,chainId:f,sx:m?{width:x?"100%":420,borderRadius:16}:void 0})})}function cc({sx:e,inputSx:t,amt:o,token:i,readOnly:r,showMaxBtn:l,canClickBalance:s,onMaxClick:d,fiatPriceTxt:c,occupiedAddrs:u,occupiedChainId:p,onInputFocus:h,onTokenClick:f,onInputChange:x,onTokenChange:y,side:b,showChainLogo:j,showChainName:C,defaultLoadBalance:w,overrideBalance:k,overrideBalanceLoading:R,balanceText:M,showPercentage:S,inputReadonlyTooltip:E,inputTypography:T,chainId:W,hideToken:L,checkLogBalance:I,notTokenPickerModal:V}){var Z,F;const{account:N,isSolana:A}=sr(),H=g(),{gotoBuyToken:P}=ar(),[B,U]=q(!1),{fetchTokenBalance:D}=Ar(),Y=ve({queryKey:[a,"token","getFetchTokenQuery",W,null==N?void 0:N.toLocaleLowerCase(),void 0,null==i?void 0:i.address],queryFn:()=>or(this,void 0,void 0,(function*(){if(!i)return;const e=yield D(i.address);return Object.assign(Object.assign({},i),{balance:e.amount,allowance:yr})})),enabled:!!N&&A&&!!i}),z=null!==(F=null!=k?k:null===(Z=Y.data)||void 0===Z?void 0:Z.balance)&&void 0!==F?F:null,{isTokenLoading:X}=Gd();let G=null!=R?R:Y.isLoading;!G&&z&&(I?G=Object.entries(I).some((([e,t])=>X(e,t))):i&&(G=X(i.address,z))),Hr({tokenList:i?[i]:[],chainId:null==i?void 0:i.chainId});const[Q,_]=q(0),K=$("");J((()=>{o!==K.current&&_(0)}),[o]);let ee=P&&z&&o&&z.lt(o);const te=!!x||!!E;return ut.jsxs(m,{sx:Object.assign({minHeight:te?133:"auto",padding:H.spacing(20,20,24),borderRadius:12,overflow:"hidden",display:"flex",flexDirection:"column",justifyContent:"space-between",backgroundColor:H.palette.background.input},e),children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4},children:[L?ut.jsx(m,{}):ut.jsx(tc,{token:i,showChainLogo:j,showChainName:C,onClick:()=>U(!0),readonly:!y}),ut.jsx(Qd,{balance:z,balanceText:M,onClick:r||!d&&!x?void 0:e=>{d?d(e):x&&x(e),0!==Q&&1!==Q&&(_(1),K.current=e)},showMaxBtn:l,canClickBalance:s,address:null==i?void 0:i.address,decimals:null==i?void 0:i.decimals,loading:G})]}),te&&(r&&E?ut.jsx(O,{title:E,arrow:!1,children:ut.jsx(m,{children:ut.jsx(_d,{value:o,readOnly:!0,withClear:!0,sx:Object.assign({mt:12},t)})})}):ut.jsx(_d,{value:o,onFocus:h,onChange:x?e=>{x(e),_(0)}:void 0,readOnly:r,withClear:!0,suffix:ee?ut.jsx(v,{variant:v.Variant.tag,backgroundColor:H.palette.background.paperDarkContrast,sx:{fontSize:12},onClick:e=>{e.stopPropagation(),null==P||P({token:i,account:N})},children:ut.jsx(n,{id:"qiOIiY",message:"Buy"})}):void 0,typography:T,sx:{mt:12}})),!r&&S?ut.jsx(ec,{sx:{mt:16},value:Q,onChange:z&&void 0!==(null==i?void 0:i.decimals)?e=>{if(z&&(null==i?void 0:i.decimals))if(_(e),1===e){const e=z.toString();d?d(e):x&&x(e),K.current=e}else if(x){const t=z.multipliedBy(e).dp(i.decimals).toString();x(t),K.current=t}}:void 0}):"",void 0!==c?ut.jsx(m,{sx:{mt:S?9:0,typography:"h6",color:H.palette.text.secondary},children:c}):"",ut.jsx(dc,{value:i,open:B,side:b,chainId:W,occupiedAddrs:u,occupiedChainId:p,defaultLoadBalance:w,onClose:()=>{U(!1),f&&f()},onTokenChange:(e,t)=>{U(!1),setTimeout((()=>{!Array.isArray(e)&&y&&y(e,t)}),Rd)},modal:!V})]})}function uc({toToken:e,fromToken:t,priceStatus:o,pricePerToToken:i,pricePerFromToken:r}){const[a,l]=q("-"),[s,d]=q(null),[c,u]=q("-"),[p,h]=q(null);J((()=>{l(null==t?void 0:t.symbol),u(null==e?void 0:e.symbol),d(i),h(r)}),[t,e,i,r]);const f=G((()=>{l(c),u(a),d(p),h(s)}),[a,s,c,p]);return ut.jsx(m,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:{[$r.Initial]:"-",[$r.Loading]:ut.jsxs(ut.Fragment,{children:[ut.jsx(W,{sx:{mr:5}}),ut.jsx(n,{id:"JdNn1Y",message:"Fetching best price..."})]}),[$r.Failed]:ut.jsxs(ut.Fragment,{children:[ut.jsx(m,{component:$e.Warn,sx:{width:15,mr:5,color:"warning.main"}}),ut.jsx(n,{id:"NVAuTg",message:"Quote not available"})]}),[$r.Success]:ut.jsxs(ut.Fragment,{children:[ut.jsx(m,{sx:{typography:"body2"},children:`1 ${a} = ${br({input:p,showDecimals:4})} ${c}`}),ut.jsx(m,{component:S,sx:{width:18,height:18,ml:6,borderRadius:"50%",backgroundColor:"border.main",display:"flex",justifyContent:"center",alignItems:"center"},children:ut.jsx(m,{sx:{width:16,color:"text.secondary"},onClick:f,component:$e.Switch})})]})}[o]})}function pc({getAutoSlippage:e,onPayTokenChange:t,onReceiveTokenChange:a}={}){var l,s;const d=g(),{isInflight:c}=Jr(),{chainId:u,account:p}=sr(),h=de(),{defaultChainId:f,noPowerBy:x,onlyChainId:y,onlySolana:b}=ar(),[j,C]=q(!1);Q((()=>{var e;return null===(e=r[null!=u?u:f])||void 0===e?void 0:e.address}),[u,f]);const[w,k]=q(""),[R,M]=q(""),[E,T]=q(""),[I,V]=q(""),O=Q((()=>le((e=>T(e)),1e3)),[]),Z=Q((()=>le((e=>V(e)),1e3)),[]),[F,N]=q(null),[A,H]=q(null),[P,B]=q(!1),[U,D]=q(!1),{toFiatPrice:Y,fromFiatPrice:z}=Kr({toToken:A,fromToken:F});!function({token:e,fiatPrice:t}){Q((()=>{var n;const o=null!==(n=null==e?void 0:e.decimals)&&void 0!==n?n:6,i=null!=t?new te(500).div(t):new te(0),r=Rr(i,o);return(r.lt(new te(1).times(new te(10).pow(o-3)))?new te(0):r).toString(10)}),[null==e?void 0:e.decimals,t])}({token:j?A:F,fiatPrice:j?Y:z}),function({fromToken:e,toToken:t,getAutoSlippage:n}){const o=de();J((()=>{(()=>{or(this,void 0,void 0,(function*(){if(!n)return;const i=n({fromToken:e,toToken:t});if(void 0!==i&&"number"!=typeof i){o(mr(!0));try{const e=yield i;o(fr({loading:!1,value:null!=e?e:null}))}catch(e){console.error(e),o(fr({loading:!1,value:null}))}}else o(fr({loading:!1,value:null}))}))})()}),[e,t])}({fromToken:F,toToken:A,getAutoSlippage:e});const{slippage:X,slippageLoading:_}=ka({fromToken:F,toToken:A}),{isApproving:K,isGetApproveLoading:$,needApprove:ee,insufficientBalance:ne,submitApprove:oe,getMaxBalance:ie}=Ta(F,{amount:E}),re=G((()=>{ve(ie())}),[ie]);Q((()=>!(!p||ne||K||$||ee)),[p,ne,K,$,ee]);const{status:ae,rawBrief:se,executeSwap:ue}=ea({toToken:A,fromToken:F,fromAmount:E,slippage:X}),{resAmount:pe,priceImpact:he,baseFeeAmount:fe,additionalFeeAmount:me,resPricePerToToken:ge,resPricePerFromToken:xe}=Q((()=>{if(!se)return{resAmount:null,priceImpact:null,baseFeeAmount:null,additionalFeeAmount:null,resPricePerToToken:null,resPricePerFromToken:null};const e=new te(se.inAmount).dividedBy(se.outAmount).toNumber(),t=new te(se.outAmount).dividedBy(se.inAmount).toNumber();return{resAmount:se.resAmount,priceImpact:se.priceImpact,baseFeeAmount:0,additionalFeeAmount:0,resPricePerToToken:e,resPricePerFromToken:t}}),[se]),ve=G((e=>{const t=e.toString();k(t),O(t)}),[k,O]),ye=G((e=>{const t=e.toString();M(t),Z(t)}),[M,Z]),be=G((e=>N((n=>{var o;const i="function"==typeof e?e(n):e;return u||h(Pr(null!==(o=null==i?void 0:i.chainId)&&void 0!==o?o:void 0)),t&&i&&i!==n&&t(i),i}))),[h,Pr,t,u]),je=G((e=>H((t=>{const n="function"==typeof e?e(t):e;return a&&n&&n!==t&&a(n),n}))),[a]);ha({fromToken:F,toToken:A,setFromToken:be,setToToken:je,updateFromAmt:ve,updateToAmt:ye,setIsReverseRouting:C});const Ce=G((()=>{ve(""),ye(""),be(A),je(F),Hi("from",A),Hi("to",F)}),[be,A,je,F,ve,ye]),we=G(((e,t)=>{if(t)return Ce();ve(""),ye(""),be(e),Hi("from",e)}),[Ce,ve,ye,be,Hi]),ke=G(((e,t)=>{if(t)return Ce();ve(""),ye(""),je(e),Hi("to",e)}),[Ce,ve,ye,be,Hi]),Re=G((()=>{j&&ve(""),C(!1)}),[j,ve,h]);G((()=>{j||ye(""),C(!0)}),[j,ye,h]);const Me=xa(X),Se=Q((()=>he?new te(he).multipliedBy(100).dp(4,te.ROUND_DOWN).toString():null),[he]),Ee=Q((()=>{const e=j?pe:E;return e&&z?new te(z).multipliedBy(e):null}),[z,E,j,pe]),Te=Q((()=>{if(!Y)return null;const e=j?I:pe;return e?new te(Y).multipliedBy(e):null}),[Y,I,j,pe]),We=Q((()=>ut.jsxs(m,{sx:{display:"flex",fontWeight:600,typography:"body2",alignItems:"center",justifyContent:"center"},children:[ut.jsx(Hd,{title:ut.jsx(n,{id:"4kY4C4",message:"Due to the market condition, market price and estimated price may have a slight difference"}),mr:8}),ut.jsxs(m,{sx:{display:"flex"},children:[ut.jsx(n,{id:"6+mYrD",message:"Current price impact"}),ut.jsxs(m,{sx:{color:d.palette.error.main,ml:4},children:[Se,"%"]})]})]})),[Se,d.palette.error.main]),Le=Q((()=>ut.jsx(uc,{toToken:A,fromToken:F,priceStatus:ae,pricePerToToken:ge,pricePerFromToken:xe})),[A,F,ae,ge,xe]),Ie=Q((()=>!(i[u||1]||y&&y===u)),[u]),Ve=Q((()=>!b&&!!u&&!!(null==F?void 0:F.chainId)&&(null==F?void 0:F.chainId)!==u),[u,null==F?void 0:F.chainId,b]),Oe=function({fromToken:e,toToken:t}){const n=ce(ca);return Q((()=>!(!e||n.some((t=>t.chainId===e.chainId&&t.address===e.address&&(!t.side||"to"===t.side))))||!(!t||n.some((e=>e.chainId===t.chainId&&e.address===t.address&&(!e.side||"from"===e.side))))),[e,t,n])}({fromToken:F,toToken:A}),Ze=Q((()=>Me&&new te(j?I:E).gt(0)&&!ne&&ae===$r.Success?ut.jsxs(m,{sx:{textAlign:"center",mb:8},children:[ut.jsx(m,{component:$e.Warn,sx:{position:"relative",top:2,mr:6,width:16,height:16,color:"warning.main"}}),o._({id:"//95jS",message:"The current slippage protection coefficient set exceeds {maxSlippageWarning}%, which may result in losses.",values:{maxSlippageWarning:ga}})]}):null),[Me,j,E,I,ae]),Fe=Q((()=>Ve?ut.jsxs(m,{sx:{textAlign:"center"},children:[ut.jsx(m,{component:$e.Warn,sx:{position:"relative",top:2,mr:6,width:16,height:16,color:"warning.main"}}),ut.jsx(n,{id:"54ffaC",message:"The current network is inconsistent with the wallet - please switch in wallet"})]}):ae===$r.Loading?ut.jsx(m,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:ut.jsxs(ut.Fragment,{children:[ut.jsx(W,{sx:{mr:5}}),ut.jsx(n,{id:"JdNn1Y",message:"Fetching best price..."})]})}):Ie?ut.jsxs(ut.Fragment,{children:[ut.jsx(m,{component:$e.Warn,sx:{mr:6,width:16,color:"warning.main"}}),ut.jsx(n,{id:"udsWDJ",message:"Unsupported network - switch to trade"})]}):w&&Se&&new te(Se).gt(Bi)?We:ut.jsxs(ut.Fragment,{children:[Ze,Le]})),[ae,Le,w,We,Se,Ie,Ve,Ze]),Ne=Q((()=>j?new te(R).gt(0)?jr({input:pe,decimals:null==F?void 0:F.decimals}):"-":w),[w,R,pe,F,j]),Ae=Q((()=>j?R:new te(w).gt(0)?jr({input:pe,decimals:null==A?void 0:A.decimals}):"-"),[w,R,pe,A,j]),He=Q((()=>{if(!p||(null==F?void 0:F.chainId)&&u!==F.chainId)return ut.jsx(Bd,{needSwitchChain:null==F?void 0:F.chainId});if(c)return ut.jsx(v,{fullWidth:!0,isLoading:!0,disabled:!0,children:ut.jsx(n,{id:"FRBvjQ",message:"Transaction Pending"})});if(!F||!A)return ut.jsx(v,{fullWidth:!0,disabled:!0,"data-testid":qi,children:ut.jsx(n,{id:"KlvBGJ",message:"Select Tokens"})});if(ee)return ut.jsx(v,{fullWidth:!0,disabled:K,onClick:()=>oe(),children:K?ut.jsx(n,{id:"j2Uisd",message:"Approving"}):ut.jsx(n,{id:"Z7ZXbT",message:"Approve"})});if(!new te(j?I:E).gt(0))return ut.jsx(v,{fullWidth:!0,disabled:!0,"data-testid":Qi,children:ut.jsx(n,{id:"iPMIoT",message:"Enter an amount"})});if(ae===$r.Loading)return ut.jsx(v,{fullWidth:!0,disabled:!0,"data-testid":_i,children:ut.jsx(n,{id:"OauUE6",message:"Fetching Price..."})});return!pe||ae===$r.Failed?ut.jsx(v,{fullWidth:!0,disabled:!0,children:ut.jsx(n,{id:"NVAuTg",message:"Quote not available"})}):ne?ut.jsx(v,{fullWidth:!0,disabled:!0,"data-testid":Ki,children:ut.jsx(n,{id:"znqB4T",message:"Insufficient balance"})}):ut.jsx(v,{fullWidth:!0,onClick:()=>B(!0),"data-testid":Ji,children:ut.jsx(n,{id:"K/Ay/d",message:"Review Swap"})})}),[p,F,u,c,A,ee,K,j,I,E,ae,pe,ne,oe]),Pe=Q((()=>F&&A?ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(Kl,{token:F,width:16,height:16,marginRight:6,chainId:F.chainId,noShowChain:!!y}),`${jr({input:j?pe:E,decimals:null==F?void 0:F.decimals})} ${null==F?void 0:F.symbol}`,ut.jsx(m,{component:$e.DoubleRight,sx:{width:12,height:12,mx:16}}),ut.jsx(Kl,{token:A,width:16,height:16,marginRight:6,chainId:A.chainId,noShowChain:!!y}),`${jr({input:j?I:pe,decimals:null==A?void 0:A.decimals})} ${null==A?void 0:A.symbol}`]}):ut.jsx(m,{})),[F,A,E,I,pe,j,y]);return ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",typography:"caption",margin:20},children:[ut.jsx(n,{id:"vH2C/2",message:"Swap"}),ut.jsx(L,{open:void 0,title:ut.jsx(n,{id:"NSCBTb",message:"The setting has been switched to swap mode"}),placement:"bottom-end",children:ut.jsx(m,{component:S,children:ut.jsx(m,{component:$e.Setting,onClick:()=>D(!0),sx:{width:19,height:19,color:"text.primary",cursor:"pointer"}})})})]}),ut.jsxs(m,{sx:{flex:1,padding:"0 16px 12px",overflowY:"auto"},children:[ut.jsxs(m,{children:[ut.jsx(cc,{sx:{mb:4},token:F,side:"from",amt:Ne,defaultLoadBalance:!0,onMaxClick:re,onInputChange:ve,onInputFocus:Re,showMaxBtn:!j&&!w,occupiedAddrs:[null!==(l=null==A?void 0:A.address)&&void 0!==l?l:""],occupiedChainId:null==A?void 0:A.chainId,fiatPriceTxt:Ee?`$${br({input:Ee,showDecimals:1})}`:"-",onTokenChange:we,readOnly:j,showChainLogo:!y,showChainName:!y,notTokenPickerModal:!0}),ut.jsx(Jd,{onClick:Ce,disabled:Oe}),ut.jsx(cc,{token:A,side:"to",amt:Ae,onInputChange:ye,occupiedAddrs:[null!==(s=null==F?void 0:F.address)&&void 0!==s?s:""],occupiedChainId:null==F?void 0:F.chainId,fiatPriceTxt:Te?`$${br({input:Te,showDecimals:1})}(${Se}%)`:"-",onTokenChange:ke,readOnly:!0,showChainLogo:!y,showChainName:!y,notTokenPickerModal:!0}),ut.jsx(m,{sx:{py:12,display:"flex",typography:"body2",alignItems:"center",justifyContent:"center",flexWrap:"wrap"},children:Fe})]}),He,x?"":ut.jsxs(m,{sx:{mt:13,display:"flex",typography:"h6",cursor:"pointer",justifyContent:"center",alignItems:"center",color:d.palette.text.disabled},onClick:()=>window.open(Wi),children:[ut.jsx(m,{sx:{width:18,height:18,transform:"translate(1px, 2px)","& path":{fill:d.palette.text.disabled}},component:$e.Dodo}),ut.jsx(n,{id:"7X+IbB",message:"Powered by DODO protocol"})]})]}),ut.jsx(Ud,{toToken:A,fromToken:F,fromAmount:j?pe:E,toAmount:j?I:pe,open:P,baseFeeAmount:fe,priceImpact:Se,additionalFeeAmount:me,curToFiatPrice:Te,execute:()=>ue(Pe),clearFromAmt:()=>ve(""),clearToAmt:()=>ye(""),curFromFiatPrice:Ee,onClose:()=>B(!1),loading:ae===$r.Loading,slippage:X}),ut.jsx(qd,{open:U,onClose:()=>D(!1),fromToken:F,toToken:A})]})}var hc;!function(e){e.Pool="pool",e.PoolDetail="poolDetail",e.CreatePool="createPool",e.ModifyPool="modifyPool",e.MiningList="miningList",e.MiningDetail="miningDetail",e.createPoolAMMV2="createPoolAMMV2",e.createPoolAMMV3="createPoolAMMV3"}(hc||(hc={}));const fc=Ie(((e,t)=>({page:void 0,historyList:[],push:t=>{e((e=>{var n;const o=[...e.historyList,null!==(n=e.page)&&void 0!==n?n:{type:hc.Pool}];return{page:t,historyList:o}}))},back:()=>{e((e=>{const t=e.historyList.length;if(!t)return"undefined"!=typeof window&&window.history&&history.back(),e;const n=[...e.historyList];return{page:n.splice(t-1,1)[0],historyList:n}}))}})));function mc({sx:e,onClick:t}){const o=g();return ut.jsxs(y,{onClick:()=>{t?t():fc.getState().back()},sx:se({display:"inline-flex",alignItems:"center",cursor:"pointer","& > svg":{mr:10}},e),children:[ut.jsx(m,{sx:{color:o.palette.text.secondary,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderColor:o.palette.border.main,borderStyle:"solid",borderWidth:1,borderRadius:"50%",backgroundColor:o.palette.background.paper,mr:6},children:ut.jsx($e.ArrowBack,{})}),ut.jsx(n,{id:"CKyk7Q",message:"Go back"})]})}function gc({statuses:e,children:t,buttonProps:o}){var i;if(!e.find((e=>e.needShowTokenStatusButton))&&t)return ut.jsx(ut.Fragment,{children:t});const r=e.find((e=>e.insufficientBalance));if(r)return ut.jsx(v,{fullWidth:!0,disabled:!0,...o,children:ut.jsx(n,{id:"m6RmA/",message:"Insufficient {0} balance",values:{0:null===(i=r.token)||void 0===i?void 0:i.symbol}})});const a=e.some((e=>e.isApproving));return ut.jsx(m,{sx:{display:"flex",alignItems:"center",gap:4},children:e.map(((e,t)=>{var i,r;let l="";return e.isApproving?l=ut.jsx(n,{id:"j2Uisd",message:"Approving"}):(e.needReset||e.needApprove)&&(l=e.approveTitle),l?ut.jsx(v,{fullWidth:!0,isLoading:e.isApproving,onClick:e.submitApprove,disabled:e.insufficientBalance||a,...o,children:l},null!==(r=null===(i=e.token)||void 0===i?void 0:i.symbol)&&void 0!==r?r:t):null}))})}function xc({token:e,chainId:t,showChainLogo:o,readonly:i,showChainName:r,logoSize:a=24,chainLogoSize:l=12,side:s,occupiedToken:d,defaultLoadBalance:c,notTokenPickerModal:u,border:p,px:h=20,py:f=8,highlightDefault:x,onTokenClick:v,onTokenChange:y}){var b,j;const{onlyChainId:C}=ar(),w=t||C,k=g(),[R,M]=X.useState(!1),E=(null==e?void 0:e.chainId)?Ql.get(e.chainId):null,T=r&&!!E;return ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{component:S,sx:Object.assign(Object.assign({display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,color:k.palette.text.primary,typography:T?"body2":"body1",fontWeight:600,px:h,py:f,"&:focus-visible":{opacity:.5}},!!p&&{border:`solid 1px ${k.palette.border.main}`,borderRadius:8,"&:hover":{backgroundColor:k.palette.hover.default}}),!(!x||e)&&{backgroundColor:k.palette.primary.main,color:k.palette.primary.contrastText,"&:hover":{opacity:.8}}),onClick:()=>{i||M(!0)},"data-testid":$i,children:[!!(null==e?void 0:e.address)&&ut.jsx(Kl,{url:null==e?void 0:e.logoURI,address:null!==(b=null==e?void 0:e.address)&&void 0!==b?b:"",chainId:null==e?void 0:e.chainId,noShowChain:!o,width:a,height:a,chainSize:l,logoOffset:10,marginRight:0}),ut.jsxs(m,{sx:{flex:1},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(null==e?void 0:e.address)?ut.jsx(ut.Fragment,{children:ut.jsx(m,{children:null!==(j=null==e?void 0:e.symbol)&&void 0!==j?j:"-"})}):ut.jsx(n,{id:"sIPJGT",message:"SELECT TOKEN"}),!i&&ut.jsx(m,{component:"svg",width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{flexShrink:0},children:ut.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.58398 12.376C6.78189 12.6728 7.21811 12.6728 7.41603 12.376L10.4818 7.77735C10.7033 7.44507 10.4651 7 10.0657 7H3.93426C3.53491 7 3.29672 7.44507 3.51823 7.77735L6.58398 12.376Z",fill:"currentColor"})})]}),!!T&&ut.jsxs(m,{sx:{display:"flex",alignItems:"center",typography:"h6",color:"text.secondary"},children:[E.name,ut.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ut.jsx("path",{d:"M5.6036 4.12761C5.50037 4.20906 5.3708 4.24967 5.23958 4.24169C5.10836 4.23372 4.98466 4.17773 4.89203 4.08438C4.7994 3.99103 4.74433 3.86685 4.7373 3.73549C4.73026 3.60413 4.77177 3.47477 4.8539 3.37205L5.96239 2.25211C6.46737 1.76405 7.14372 1.494 7.84575 1.5001C8.54779 1.50621 9.21934 1.78798 9.71577 2.28474C10.2122 2.78151 10.4938 3.4535 10.4999 4.156C10.506 4.85851 10.2361 5.5353 9.74839 6.04062L8.60241 7.16592C8.55441 7.22201 8.49533 7.26757 8.4289 7.29974C8.36246 7.3319 8.29009 7.34997 8.21635 7.35282C8.1426 7.35567 8.06906 7.34324 8.00034 7.3163C7.93162 7.28936 7.86921 7.2485 7.81702 7.19627C7.76483 7.14405 7.724 7.0816 7.69707 7.01284C7.67015 6.94407 7.65772 6.87048 7.66057 6.79668C7.66342 6.72289 7.68148 6.65047 7.71363 6.58399C7.74577 6.51751 7.7913 6.4584 7.84736 6.41036L8.97191 5.28506C9.25568 4.98032 9.41017 4.57725 9.40283 4.16078C9.39549 3.74431 9.22689 3.34695 8.93255 3.05242C8.63821 2.75788 8.24111 2.58917 7.82491 2.58182C7.40872 2.57447 7.00592 2.72906 6.70138 3.01302L5.6036 4.12761ZM6.34259 7.93755C6.38819 7.87582 6.44652 7.82461 6.51361 7.7874C6.58071 7.75018 6.65501 7.72783 6.73149 7.72185C6.80798 7.71586 6.88485 7.7264 6.95691 7.75273C7.02897 7.77906 7.09453 7.82058 7.14917 7.87447C7.2038 7.92836 7.24622 7.99337 7.27356 8.06509C7.3009 8.13682 7.31252 8.21358 7.30764 8.29019C7.30275 8.3668 7.28148 8.44147 7.24525 8.50913C7.20902 8.5768 7.15869 8.63589 7.09765 8.68239L5.96774 9.81305C5.45894 10.2708 4.7943 10.5163 4.11029 10.4992C3.42627 10.482 2.77479 10.2034 2.2896 9.72061C1.80441 9.23784 1.52232 8.58752 1.50127 7.90316C1.48021 7.2188 1.72179 6.55234 2.17638 6.04062L3.30629 4.93139C3.3504 4.86735 3.4079 4.81369 3.47482 4.77413C3.54174 4.73456 3.61646 4.71005 3.69379 4.70229C3.77113 4.69453 3.84922 4.70371 3.92266 4.72919C3.99609 4.75466 4.0631 4.79583 4.11904 4.84983C4.17497 4.90384 4.21849 4.96937 4.24657 5.0419C4.27464 5.11442 4.28661 5.19219 4.28163 5.2698C4.27665 5.34742 4.25484 5.42302 4.21773 5.49135C4.18062 5.55969 4.12908 5.61912 4.06671 5.66552L2.93144 6.79618C2.64767 7.10092 2.49318 7.50398 2.50052 7.92045C2.50786 8.33692 2.67647 8.73428 2.97081 9.02882C3.26515 9.32335 3.66224 9.49207 4.07844 9.49942C4.49463 9.50676 4.89743 9.35217 5.20197 9.06821L6.34259 7.93755ZM5.00919 7.76072C4.96119 7.81681 4.90211 7.86237 4.83567 7.89454C4.76924 7.9267 4.69687 7.94477 4.62312 7.94763C4.54937 7.95048 4.47583 7.93804 4.40711 7.9111C4.33839 7.88416 4.27598 7.8433 4.2238 7.79108C4.17161 7.73885 4.13077 7.6764 4.10385 7.60764C4.07693 7.53887 4.0645 7.46528 4.06735 7.39149C4.0702 7.31769 4.08826 7.24528 4.1204 7.17879C4.15255 7.11231 4.19808 7.0532 4.25413 7.00516L6.90487 4.35267C7.00731 4.26488 7.13909 4.21901 7.27386 4.22422C7.40863 4.22943 7.53648 4.28533 7.63185 4.38077C7.72722 4.4762 7.78309 4.60413 7.7883 4.73899C7.7935 4.87385 7.74766 5.00572 7.65993 5.10823L5.00919 7.76072Z",fill:"currentColor"})})]})]})]}),ut.jsx(dc,{value:e,open:R,side:s,chainId:w,occupiedAddrs:d?[d.address]:void 0,occupiedChainId:null==d?void 0:d.chainId,defaultLoadBalance:c,onClose:()=>{M(!1),v&&v()},onTokenChange:(e,t)=>{M(!1),setTimeout((()=>{!Array.isArray(e)&&y&&y(e,t)}),Rd)},modal:!u})]})}const vc=X.forwardRef((function(e,t){var{sx:n}=e,o=nr(e,["sx"]);const{isMobile:i}=Kd(),r=g();return ut.jsx(m,{className:"widget-module-container",ref:t,sx:Object.assign(Object.assign({flex:1,overflowY:"auto",backgroundColor:"background.default"},i?{padding:0,height:"100%",width:"100%",overflowX:"hidden"}:{padding:r.spacing(28,20,40,40),height:"auto"}),n),...o})})),yc="auto",bc="0.5";function jc({baseToken:t,quoteToken:n,pairMintAAmount:i,pairMintBAmount:r,slippage:a,isExists:l,poolInfo:s,poolKeys:d,successBack:c,submittedBack:u}){const p=qr(),{account:h}=sr(),f=rs();return e(),ye({mutationFn:()=>or(this,void 0,void 0,(function*(){if(!t||!n)throw new Error("token is undefined");if(!h)throw new Error("account is undefined");if(!s||!i||!r)throw new Error("poolInfo is undefined");if(!f)throw new Error("raydium is undefined");const e=new qe(new Je(i).mul(10**s.mintA.decimals).toFixed(0,Je.ROUND_DOWN)),m=new Ne(100*a*100,1e4),{execute:g}=l?yield f.cpmm.addLiquidity({poolInfo:s,poolKeys:d,inputAmount:e,slippage:m,baseIn:!0,txVersion:Ze.LEGACY}):yield f.cpmm.createPool({programId:Or,poolFeeAccount:Zr,mintA:s.mintA,mintB:s.mintB,mintAAmount:e,mintBAmount:new qe(new Je(r).mul(10**s.mintB.decimals).toFixed(0,Je.ROUND_DOWN)),startTime:new qe(0),feeConfig:Fr[0],associatedOnly:!1,ownerInfo:{useSOLBalance:!0},txVersion:es});return yield p.executeCustom({brief:l?o._({id:"E6MqGy",message:"Add liquidity"}):o._({id:"L37FfW",message:"Create AMM V2 Position"}),metadata:{[l?cr.addLiquidityAMMV2Position:cr.createAMMV2Position]:!0},handler:e=>or(this,void 0,void 0,(function*(){const{txId:t}=yield g({sendAndConfirm:!0});e.onSuccess(t)})),successBack:c,submittedBack:u})})),onError:e=>{console.error(e)}})}function Cc({pool:e,baseAmount:t,quoteAmount:n,slippage:o}){var i,r,a,l,s,d,c,u,p,h,f,m,g,x;const{account:v}=sr(),y=rs(),[b,j,C,w,k]=Q((()=>{if(!(null==e?void 0:e.baseToken)||!e.quoteToken)return[void 0,void 0,void 0,void 0,!0];const{baseToken:o,quoteToken:i}=e,r=new qe(new ke(o.address).toBuffer()).lte(new qe(new ke(i.address).toBuffer())),[a,l]=r?[o,i]:[i,o],[s,d]=r?[t,n]:[n,t];return[a,l,s,d,r]}),[t,e,n]),R=ve({queryKey:["cpmm","poolInfo",null==e?void 0:e.address],enabled:null!=(null==e?void 0:e.address),queryFn:()=>or(this,void 0,void 0,(function*(){if(!(null==e?void 0:e.address)||!y)return null;const{poolInfo:t,poolKeys:n,rpcData:o}=yield y.cpmm.getPoolInfoFromRpc(e.address);if(!o)return{baseReserve:0,quoteReserve:0,lpAmount:0};const[i,r]=t.mintA.address.toLowerCase()===e.baseToken.address.toLowerCase()?[e.baseToken.symbol,e.quoteToken.symbol]:[e.quoteToken.symbol,e.baseToken.symbol],a=Mr(t.lpAmount,t.lpMint.decimals);return{baseReserve:Mr(o.baseReserve.toNumber(),n.mintA.decimals),quoteReserve:Mr(o.quoteReserve.toNumber(),n.mintB.decimals),lpAmount:a,lpMint:t.lpMint,poolKeys:Object.assign(Object.assign({},n),{mintA:Object.assign(Object.assign({},n.mintA),{symbol:i}),mintB:Object.assign(Object.assign({},n.mintB),{symbol:r})}),poolInfo:Object.assign(Object.assign({},t),{lpAmount:a.toNumber(),mintA:Object.assign(Object.assign({},t.mintA),{symbol:i}),mintB:Object.assign(Object.assign({},t.mintB),{symbol:r})}),rpcData:o}}))}),M=ve({queryKey:["cpmm","lpBalance",null===(r=null===(i=R.data)||void 0===i?void 0:i.lpMint)||void 0===r?void 0:r.address],enabled:!!(v&&R.data&&(null===(a=R.data)||void 0===a?void 0:a.lpMint)&&(null===(s=null===(l=R.data)||void 0===l?void 0:l.lpMint)||void 0===s?void 0:s.address)&&(null===(c=null===(d=R.data)||void 0===d?void 0:d.lpMint)||void 0===c?void 0:c.decimals)),queryFn:()=>or(this,void 0,void 0,(function*(){var e,t,n,o,i;if(!(v&&R.data&&(null===(e=R.data)||void 0===e?void 0:e.lpMint)&&(null===(n=null===(t=R.data)||void 0===t?void 0:t.lpMint)||void 0===n?void 0:n.address)&&(null===(i=null===(o=R.data)||void 0===o?void 0:o.lpMint)||void 0===i?void 0:i.decimals)&&y))return null;yield y.account.fetchWalletTokenAccounts();const r=R.data.lpMint.address,a=y.account.tokenAccounts.find((e=>e.mint.toBase58()===r));if(!a)throw new Error(`you do not have balance in pool: ${r}`);return Mr(a.amount.toNumber(),R.data.lpMint.decimals)}))}),S=ve({queryKey:["cpmm","pairAmount",C,null===(u=R.data)||void 0===u?void 0:u.poolInfo],enabled:!(!R.data||!(null===(p=R.data)||void 0===p?void 0:p.poolInfo)||!C),queryFn:()=>or(this,void 0,void 0,(function*(){var e;if(!(R.data&&(null===(e=R.data)||void 0===e?void 0:e.poolInfo)&&C&&y))return null;const t=R.data.poolInfo,n=yield y.cpmm.computePairAmount({baseReserve:R.data.rpcData.baseReserve,quoteReserve:R.data.rpcData.quoteReserve,poolInfo:t,amount:C,slippage:new Ne(100*o*100,1e4),baseIn:!0,epochInfo:yield y.fetchEpochInfo()});return{pairMintAAmount:C,pairMintBAmount:Mr(n.anotherAmount.amount.toString(),t.mintB.decimals).toString(),liquidityMinted:Mr(n.liquidity.toString(),t.lpMint.decimals)}}))}),[E,T,W,L]=Q((()=>{if(!R.data||!M.data)return[void 0,void 0,void 0,void 0];const{baseReserve:e,quoteReserve:t,lpAmount:n}=R.data,o=M.data,i=o.div(n),r=o.multipliedBy(e).div(n),a=o.multipliedBy(t).div(n);return[o,i,r,a]}),[R.data,M.data]),I=X.useMemo((()=>R.isFetched&&null!=R.data),[R.isFetched,R.data]),[V,O]=X.useMemo((()=>{var e,o;if(I){if(null!=(null===(o=null===(e=R.data)||void 0===e?void 0:e.poolInfo)||void 0===o?void 0:o.price)){const e=new te(R.data.poolInfo.price);return[e,new te(1).div(e)]}return[void 0,void 0]}return t&&n?[new te(n).div(t),new te(t).div(n)]:[void 0,void 0]}),[t,I,null===(f=null===(h=R.data)||void 0===h?void 0:h.poolInfo)||void 0===f?void 0:f.price,n]);return{isFront:k,poolInfoQuery:R,lpBalanceQuery:M,lpBalance:E,lpBalancePercentage:T,lpToAmountA:W,lpToAmountB:L,price:V,invertedPrice:O,liquidityMinted:null===(m=S.data)||void 0===m?void 0:m.liquidityMinted,pairMintAAmount:null===(g=S.data)||void 0===g?void 0:g.pairMintAAmount,pairMintBAmount:null===(x=S.data)||void 0===x?void 0:x.pairMintBAmount,isExists:I}}const wc="DODO_WIDGET_POOL_LIST_TAB",kc="DODO_WIDGET_POOLS_LIST_FILTER_CHAIN";var Rc;!function(e){e.addLiquidity="add-liquidity",e.myLiquidity="my-liquidity",e.myCreated="my-created"}(Rc||(Rc={}));var Mc=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],o=0;o<e.rangeCount;o++)n.push(e.getRangeAt(o));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},Sc={"text/plain":"Text","text/html":"Url",default:"Text"};var Ec,Tc,Wc=function(e,t){var n,o,i,r,a,l,s=!1;t||(t={}),n=t.debug||!1;try{if(i=Mc(),r=document.createRange(),a=document.getSelection(),(l=document.createElement("span")).textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",(function(o){if(o.stopPropagation(),t.format)if(o.preventDefault(),void 0===o.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var i=Sc[t.format]||Sc.default;window.clipboardData.setData(i,e)}else o.clipboardData.clearData(),o.clipboardData.setData(t.format,e);t.onCopy&&(o.preventDefault(),t.onCopy(o.clipboardData))})),document.body.appendChild(l),r.selectNodeContents(l),a.addRange(r),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");s=!0}catch(i){n&&console.error("unable to copy using execCommand: ",i),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(i){n&&console.error("unable to copy using clipboardData: ",i),n&&console.error("falling back to prompt"),o=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(o,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(r):a.removeAllRanges()),l&&document.body.removeChild(l),i()}return s},Lc=_e(Wc);function Ic({copyText:e,size:t,sx:n,componentProps:i,onClick:r,children:a}){var l;const[s,d]=X.useState(!1);return ut.jsx(O,{title:o._({id:"6V3Ea3",message:"Copied"}),open:s,onClose:()=>d(!1),arrow:!1,children:ut.jsxs(m,{...i,component:null!==(l=null==i?void 0:i.component)&&void 0!==l?l:S,onClick:t=>{if(null==i?void 0:i.onClick)return i.onClick(t);t.stopPropagation(),e&&(Lc(e),d(!0)),r&&r()},sx:Object.assign({cursor:"pointer"},null==i?void 0:i.sx),children:[ut.jsx(m,{component:$e.Copy,sx:Object.assign({width:t||"auto",height:t||"auto"},n)}),a]})})}function Vc({truncate:e,address:t,disabledAddress:n,sx:o,handleOpen:i,addressHoverColor:r,addressHoverShowIcon:a}){return n?ut.jsx(m,{children:e?rc(t):t}):ut.jsx(Z,{lineSx:{bottom:-1},lineColor:null!=r?r:(null==o?void 0:o.color)||"",hoverSx:{color:"addressHoverColor","& svg":{display:"inline-block"}},className:"truncate-address-link",children:ut.jsxs(m,{onClick:e=>{null==i||i(e,"address")},sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[e?rc(t):t,a?ut.jsx(m,{component:$e.ArrowRight,sx:{display:"none",width:14,height:14}}):""]})})}function Oc({address:e,truncate:t,showCopy:n,size:o="medium",iconSize:i,iconSpace:r,sx:a,iconDarkHover:l,disabledAddress:s,addressHoverColor:d,addressHoverShowIcon:c,customChainId:u,handleOpen:p,onAddressClick:h}){const f=g(),x="medium"===o,v=l?F:y,b=e=>{let t=e?12:8;return r&&(t=r),l&&(t-=3),t},j="big"===o?"h5":x?"body1":"body2",{chainId:C}=sr(),w=null!=u?u:C,k=(t,n)=>{p?p(t,n):w&&(t.stopPropagation(),window.open(ac(w,e,"address")))};return ut.jsxs(m,{sx:Object.assign({display:"flex",alignItems:"center",typography:j,color:f.palette.text.primary,lineHeight:"normal"},a||{}),children:[ut.jsx(Vc,{truncate:t,address:e,disabledAddress:s,sx:a,typography:j,handleOpen:null!=h?h:k,addressHoverColor:d,addressHoverShowIcon:c}),ut.jsx(v,{sx:{display:"inline-flex",ml:b(x),cursor:"pointer"},onClick:e=>{k(e,"icon")},children:ut.jsx(m,{component:$e.ArrowTopRightBorder,sx:{width:i||(x?16:14),height:i||(x?16:14)}})}),n?ut.jsx(Ic,{size:i||(x?16:14),copyText:e,componentProps:{component:v,sx:{ml:b(x)}}}):null]})}function Zc(e){var{sx:t,label:n,children:o}=e,i=nr(e,["sx","label","children"]);return ut.jsxs(m,{sx:Object.assign({display:"flex",justifyContent:"space-between"},t),...i,children:[ut.jsx(m,{children:n}),ut.jsx(m,{sx:{textAlign:"right",fontWeight:600},children:o})]})}function Fc({tokens:e,width:t=24,height:n=24,gap:o=-4,cross:i,mr:r,chainId:a,showChainLogo:l,sx:s}){var d;const c=g(),{onlyChainId:u}=ar(),p=l&&!u;if(!e||e.length<=0)return null;const h=t/2;return ut.jsxs(m,{sx:Object.assign({display:"inline-flex",alignItems:"center",mr:r,position:"relative",zIndex:0},s),children:[e.map(((e,n)=>ut.jsx(m,{sx:{display:"inline-flex",width:t,height:t,ml:n>0?o:0,borderRadius:"50%",backgroundColor:c.palette.background.default},children:"object"==typeof e?ut.jsx(Kl,{address:e.address,width:t,height:t,chainId:a,url:e.logoURI,cross:i,noShowChain:!0,noBorder:!0,marginRight:0}):ut.jsx(m,{component:"img",height:t,src:e})},n))),p&&Ql.has(a)?ut.jsx(m,{component:null===(d=Ql.get(a))||void 0===d?void 0:d.logo,sx:{position:"absolute",bottom:0,right:0,zIndex:e.length+1,transform:"translateX(50%)",width:h,height:h}}):""]})}function Nc({baseToken:e,quoteToken:t,midPrice:n,loading:o,disabled:i}){const r=g(),[a,l]=q(!1),s=a?null==t?void 0:t.symbol:null==e?void 0:e.symbol,d=a&&n?new te(1).div(n):n,c=a?null==e?void 0:e.symbol:null==t?void 0:t.symbol;return ut.jsxs(M,{sx:{display:"flex",alignItems:"center",fontWeight:600,overflow:"hidden"},loading:o,loadingProps:{width:50},children:[e&&t?ut.jsx(L,{title:`1 ${s} = ${d?br({input:d}):""} ${c}`,children:n?ut.jsx(m,{sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:`1 ${s} = ${d?br({input:d}):""} ${c}`}):ut.jsxs(m,{children:[`1 ${s} = `,ut.jsx(M,{loading:o,loadingProps:{width:30},component:"span",sx:{display:"inline-block"},children:"-"}),` ${c}`]})}):"-",ut.jsx(m,{sx:Object.assign({display:"flex",alignItems:"center",justifyContent:"center",ml:4,width:18,height:18,backgroundColor:"background.paperDarkContrast",borderRadius:"50%"},!i&&{cursor:"pointer","&:hover":{backgroundColor:T(r.palette.text.primary,.04)}}),onClick:()=>{i||l((e=>!e))},children:ut.jsx(m,{component:$e.Switch,sx:{width:18,height:18}})})]})}function Ac({baseToken:e,quoteToken:t,loading:o,midPrice:i,lpBalancePercentage:r,sx:a}){const l=g(),s=!e||!t;return ut.jsxs(m,{sx:Object.assign({mt:20,border:"solid 1px",borderColor:"border.main",borderRadius:8},a),children:[ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:12,py:4,height:36,typography:"body2"},children:[ut.jsx(m,{sx:{color:"text.secondary",whiteSpace:"nowrap"},children:ut.jsx(n,{id:"kNeEXg",message:"Current Price"})}),ut.jsx(Nc,{baseToken:e,quoteToken:t,loading:o,disabled:s,midPrice:i})]}),ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:12,py:4,minHeight:36,typography:"body2",borderStyle:"solid",borderWidth:l.spacing(1,0,0),borderColor:"border.main"},children:[ut.jsx(m,{sx:{display:"flex",alignItems:"center",color:"text.secondary",whiteSpace:"nowrap"},children:ut.jsx(n,{id:"SbBMxj",message:"Share of pool"})}),ut.jsx(m,{sx:{display:"flex",alignItems:"center",fontWeight:600,textAlign:"right",ml:8,overflow:"hidden"},children:ut.jsx(M,{sx:{display:"flex",alignItems:"center",fontWeight:600,overflow:"hidden"},loading:o,loadingProps:{width:50},children:r?`${Ir({input:r,roundingMode:te.ROUND_DOWN})}`:"-%"})})]})]})}function Hc({open:e,onClose:t,slippage:o,baseToken:i,quoteToken:r,pairMintAAmount:a,pairMintBAmount:l,lpAmount:s,feeRate:d,price:c,lpBalancePercentage:u,pairAddress:p,createMutation:h}){const f=g(),{isMobile:x}=Kd();return ut.jsx(Ed,{modal:!0,open:e,onClose:t,title:s?ut.jsx(n,{id:"AeZIvT",message:"You will receive"}):ut.jsx(n,{id:"aM1tos",message:"You are creating a pool"}),children:ut.jsxs(m,{sx:{px:20,py:24,borderTopWidth:1,width:x?"100%":420},children:[ut.jsxs(m,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4,typography:"h3"},children:[ut.jsx(Fc,{width:24,height:24,tokens:i&&r?[i,r]:[]}),s?jr({input:s,decimals:null==i?void 0:i.decimals}):""]}),ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4,fontWeight:600},children:[ut.jsx(n,{id:"syToc5",message:"{0}/{1} Pool Tokens",values:{0:null==i?void 0:i.symbol,1:null==r?void 0:r.symbol}}),ut.jsx(m,{sx:{px:4,py:2,fontSize:10,lineHeight:1,backgroundColor:T(f.palette.purple.main,.1),color:f.palette.purple.main,borderRadius:4},children:ut.jsx(n,{id:"rbsyJM",message:"AMM V2"})})]})]}),ut.jsx(m,{sx:{mt:16,typography:"h6",color:"text.secondary",textAlign:"center"},children:ut.jsx(n,{id:"rQ9c+8",message:"Output is estimated. If the price changes by more than {0} your transaction will revert.",values:{0:Ir({input:o})}})}),ut.jsxs(m,{sx:{display:"flex",flexDirection:"column",gap:12,mt:20,p:20,typography:"body2",borderRadius:12,backgroundColor:f.palette.background.paperContrast},children:[ut.jsx(Zc,{label:ut.jsx(n,{id:"YG004A",message:"{0} deposited",values:{0:null==i?void 0:i.symbol}}),children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[ut.jsx(Kl,{width:18,height:18,marginRight:4,token:i}),jr({input:a,decimals:null==i?void 0:i.decimals})]})}),ut.jsx(Zc,{label:ut.jsx(n,{id:"YG004A",message:"{0} deposited",values:{0:null==r?void 0:r.symbol}}),children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(Kl,{width:18,height:18,marginRight:4,token:r}),jr({input:l,decimals:null==r?void 0:r.decimals})]})}),ut.jsx(Zc,{label:ut.jsx(n,{id:"EU3wU4",message:"Fee tier"}),children:null!=d?Number(d)/1e4+"%":"-"}),ut.jsx(Zc,{label:ut.jsx(n,{id:"fqDzSu",message:"Rate"}),children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(Kl,{width:18,height:18,marginRight:4,token:i}),ut.jsx(Nc,{baseToken:i,quoteToken:r,midPrice:c})]})}),ut.jsx(Zc,{label:ut.jsx(n,{id:"SbBMxj",message:"Share of pool"}),children:u?`${Ir({input:u})}`:"-%"}),ut.jsx(Zc,{label:ut.jsx(n,{id:"ESQO1L",message:"Pool address"}),children:ut.jsx(Oc,{showCopy:!1,address:null!=p?p:"",customChainId:null==i?void 0:i.chainId,truncate:!0,iconSpace:4,sx:{typography:"body2"}})})]}),ut.jsx(v,{fullWidth:!0,size:v.Size.big,sx:{mt:20},isLoading:h.isPending,onClick:()=>{h.mutate()},children:h.isPending?ut.jsx(n,{id:"pwUZo2",message:"Confirming..."}):ut.jsx(n,{id:"7VpPHA",message:"Confirm"})})]})})}function Pc({title:e,disabled:t,children:n}){return ut.jsxs(m,{sx:{display:"flex",flexDirection:"column",gap:12,opacity:t?.3:void 0},children:[ut.jsx(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",fontWeight:600},children:e}),n]})}function Bc({disabled:e,feeIndex:t,onChange:o,feeList:i}){const r=g(),[a,l]=X.useState(!1),{isMobile:s}=Kd(),d=e,c=i[t];return ut.jsxs(m,{sx:{opacity:e?.3:void 0,fontWeight:600},children:[ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:20,py:12,borderWidth:1,borderRadius:12},children:[ut.jsx(n,{id:"tMMG40",message:"{0}% fee tier",values:{0:c?new te(c.tradeFeeRate).div(1e4).toString():"-"}}),ut.jsx(S,{sx:{px:16,py:7,border:`solid 1px ${r.palette.text.primary}`,borderRadius:8,fontWeight:600,color:"text.primary",cursor:d?"default":"pointer"},disabled:d,onClick:()=>{d||l((e=>!e))},children:a?ut.jsx(n,{id:"vLyv1R",message:"Hide"}):ut.jsx(n,{id:"ePK91l",message:"Edit"})})]}),a&&ut.jsx(ut.Fragment,{children:ut.jsx(m,{sx:Object.assign({mt:12},s?{display:"grid",gap:8,gridTemplateColumns:"repeat(2, 1fr)"}:{display:"flex",alignItems:"center",gap:8,"& > label":{flex:1}}),children:i.map(((e,n)=>{const i=t===n;return ut.jsxs(m,{component:"label",sx:Object.assign({display:"flex",alignItems:"center",justifyContent:"space-between",px:20,py:12,borderWidth:1,borderRadius:12,cursor:"pointer"},i&&{borderColor:r.palette.primary.main}),children:[e.tradeFeeRate/1e4,"%",ut.jsx(N,{size:18,checked:i,onChange:(e,t)=>{t&&o(n)}})]},e.id)}))})})]})}function Uc({chainId:e,address:t,showName:n,size:o,offset:i,rightContent:r}){const a=ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:i},children:[ut.jsx(Kl,{chainId:e,address:t,width:o,height:o,noShowChain:!0,marginRight:0}),n]});return r?ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a,r]}):a}function Dc({isExists:e,poolInfo:t,poolInfoLoading:o,lpBalanceLoading:r,lpBalance:a,lpBalancePercentage:l,lpToAmountA:s,lpToAmountB:d,sx:c}){var u,p;const h=l?`${Ir({input:l,roundingMode:te.ROUND_DOWN})}`:void 0;return e&&t?ut.jsxs(m,{sx:Object.assign({px:20,py:12,borderWidth:1,borderRadius:8},c),children:[ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"YHc3B+",message:"My Liquidity"})}),ut.jsxs(m,{sx:{mt:12,display:"flex",alignItems:"center",flexWrap:"wrap"},children:[ut.jsx(Fc,{width:18,height:18,tokens:[t.mintA,t.mintB],mr:4}),ut.jsx(M,{loading:r,loadingProps:{width:50},sx:{mr:4},children:jr({input:a,decimals:t.lpMint.decimals})}),`${t.mintA.symbol}/${t.mintB.symbol} LP`,ut.jsx(L,{title:ut.jsxs(m,{sx:{display:"flex",flexDirection:"column",gap:10,typography:"body2",color:"text.primary"},children:[ut.jsx(Uc,{address:t.mintA.address,chainId:t.mintA.chainId,showName:null!==(u=t.mintA.symbol)&&void 0!==u?u:"",size:14,offset:4,rightContent:ut.jsx(M,{loading:o,loadingProps:{width:50},children:jr({input:s,decimals:t.mintA.decimals})})}),ut.jsx(Uc,{address:t.mintB.address,chainId:t.mintB.chainId,showName:null!==(p=t.mintB.symbol)&&void 0!==p?p:"",size:14,offset:4,rightContent:ut.jsx(M,{loading:o,loadingProps:{width:50},children:jr({input:d,decimals:t.mintB.decimals})})}),ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[ut.jsx(n,{id:"c4miqE",message:"Pool share"}),ut.jsx(M,{loading:o,loadingProps:{width:50},children:h})]})]}),sx:{padding:20,width:256},children:ut.jsx(y,{component:$e.DetailBorder,sx:{ml:4,width:16,height:16,cursor:"pointer"}})}),ut.jsx(m,{component:"a",target:"_blank",rel:"noopener noreferrer",href:ac(i.SOON_TESTNET,t.lpMint.address,"address"),sx:{ml:4,display:"inline-flex",height:16},children:ut.jsx(y,{component:$e.ArrowTopRightBorder,sx:{width:16,height:16}})})]})]}):null}function Yc({active:e,sx:t,onClick:o}){const i=g(),r="light"===i.palette.mode;let a=i.palette.primary.main,l="transparent";return e&&(a=i.palette.primary.contrastText,l=T(i.palette.primary.main,.8)),ut.jsx(m,{component:S,sx:Object.assign({typography:"body2",p:e?i.spacing(8,20,9):i.spacing(7,19,8),minWidth:79,border:e?void 0:`1px solid ${a}`,color:a,backgroundColor:l,borderRadius:8,fontWeight:600,"&:hover":{color:e?i.palette.primary.contrastText:i.palette.primary.main,backgroundColor:e?i.palette.primary.main:r?"rgba(26, 26, 27, 0.04)":"rgba(241, 249, 2, 0.08)"}},t),onClick:o,children:ut.jsx(n,{id:"R9Khdg",message:"Auto"})})}function zc({sx:e,disabled:t,slippage:o,onChangeSlippage:i}){const r=g(),a=o===yc,[l,s]=q(a?"":new te(o).times(100).toNumber());return ut.jsx(L,{disabled:t,onlyClick:!0,title:ut.jsxs(m,{sx:{backgroundColor:r.palette.background.paper,padding:r.spacing(16,20),borderRadius:16,width:375,maxWidth:"90vw",boxSizing:"border-box"},children:[ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",typography:"body2",color:"text.primary"},children:[ut.jsx("span",{children:ut.jsx(n,{id:"lqTDfd",message:"Slippage Tolerance"})}),ut.jsxs("span",{children:[a?bc:o&&new te(o).times(100).toNumber(),"%"]})]}),ut.jsxs(m,{sx:{mt:16,display:"flex",alignItems:"center",margin:r.spacing(16,0,0,0)},children:[ut.jsx(Yc,{sx:{borderRadius:8,whiteSpace:"nowrap"},onClick:()=>{s(""),i(yc)},active:a}),ut.jsx(E,{placeholder:String(bc),value:l,onChange:e=>{const{value:t}=e.target;s(t),i(t?new te(t).div(100).toNumber():yc)},onBlur:()=>{(!a&&new te(o).gt(.1)||new te(o).lte(0))&&(s(10),i(.1))},suffix:ut.jsx(m,{sx:{mr:16},children:"%"}),sx:{ml:8,"& input":{px:16,py:0,height:"39px"}}})]})]}),sx:{p:0},arrow:!1,placement:"bottom-end",children:ut.jsx(F,{sx:Object.assign({width:"max-content",alignItems:"right",margin:r.spacing(0,0,0,"auto"),p:r.spacing(4,12),borderRadius:20,backgroundColor:"background.paperDarkContrast",cursor:"pointer"},e),children:ut.jsx(m,{component:$e.Setting,sx:{width:18,height:18,"& path:last-child":{fill:r.palette.text.primary}}})})})}function Xc(){var e,t,o;const[i,r]=X.useState(0),[a,l]=X.useState(),[s,d]=X.useState(),[c,u]=X.useState(""),[p,h]=X.useState(""),[f,g]=X.useState(yc),x=f===yc?new te(bc).div(100).toNumber():f,{isMobile:y}=Kd(),{onlyChainId:b}=ar(),j=X.useMemo((()=>b||(null==a?void 0:a.chainId)||(null==s?void 0:s.chainId)),[b,a,s]),{poolKeys:C,poolInfo:w,pairAddress:k,price:R,isInvalidPair:M,invertedPrice:S,poolInfoLoading:E,lpBalanceLoading:T,lpBalance:W,lpBalancePercentage:L,lpToAmountA:I,lpToAmountB:V,liquidityMinted:O,pairMintAAmount:Z,pairMintBAmount:F,isExists:N}=function({baseToken:e,quoteToken:t,baseAmount:n,quoteAmount:o,feeIndex:i,slippage:r}){var a,l,s;const[d,c]=X.useMemo((()=>{if(!e||!t||null==i)return[void 0,!0];const n=new qe(new ke(e.address).toBuffer()).lte(new qe(new ke(t.address).toBuffer())),[o,r]=n?[e,t]:[t,e],[a,l]=[new ke(o.address),new ke(r.address)];return[Ae({poolId:void 0,programId:Or,configId:new ke(Fr[i].id),mintA:a,mintB:l}),a.toBase58()===l.toBase58()]}),[i,e,t]),{price:u,invertedPrice:p,poolInfoQuery:h,lpBalanceQuery:f,lpBalance:m,lpBalancePercentage:g,lpToAmountA:x,lpToAmountB:v,liquidityMinted:y,pairMintAAmount:b,pairMintBAmount:j,isExists:C}=Cc({pool:e&&t&&d?{baseToken:e,quoteToken:t,address:d.poolId.toBase58()}:void 0,baseAmount:n,quoteAmount:o,slippage:r});return{poolKeys:null===(a=h.data)||void 0===a?void 0:a.poolKeys,poolInfo:null===(l=h.data)||void 0===l?void 0:l.poolInfo,pairAddress:null===(s=null==d?void 0:d.poolId)||void 0===s?void 0:s.toBase58(),isInvalidPair:c,price:u,invertedPrice:p,poolInfoLoading:h.isLoading,lpBalanceLoading:f.isLoading,lpBalance:m,lpBalancePercentage:g,lpToAmountA:x,lpToAmountB:v,liquidityMinted:y,pairMintAAmount:b,pairMintBAmount:j,isExists:C}}({baseToken:a,quoteToken:s,baseAmount:c,quoteAmount:p,feeIndex:i,slippage:x}),A=function(e){const t=$();return J((()=>{t.current=e})),t.current}(R);if(R&&c&&!R.isEqualTo(null!=A?A:0)&&N){const t=R.times(c).dp(null!==(e=null==s?void 0:s.decimals)&&void 0!==e?e:18);t.isEqualTo(p)||h(t.toString())}const H=Ta(a,{amount:c}),P=Ta(s,{amount:p}),[B,U]=X.useState(!1),D=!a||!s,Y=()=>{fc.getState().push({type:hc.Pool})},z=jc({baseToken:a,quoteToken:s,pairMintAAmount:Z,pairMintBAmount:F,isExists:N,poolKeys:C,poolInfo:w,slippage:x,successBack:()=>{fc.getState().push({type:hc.Pool,params:{tab:Rc.myLiquidity}})}});return ut.jsxs(vc,{children:[ut.jsxs(m,{sx:{mx:"auto",borderRadius:y?0:16,backgroundColor:"background.paper",width:y?"100%":600,position:"relative",overflow:"hidden"},children:[y?ut.jsx(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20,pb:0},children:ut.jsx(mc,{onClick:Y})}):ut.jsxs(m,{sx:{position:"relative",display:"flex",justifyContent:"center",alignItems:"center",px:20,py:24,typography:"caption"},children:[ut.jsx(m,{component:$e.ArrowBack,sx:{position:"absolute",left:20,cursor:"pointer"},onClick:Y}),ut.jsx(n,{id:"E6MqGy",message:"Add liquidity"})]}),ut.jsxs(m,{sx:{display:"flex",flexDirection:"column",gap:20,pt:24,px:20,pb:20},children:[ut.jsx(Dc,{isExists:N,poolInfo:w,poolInfoLoading:E,lpBalanceLoading:T,lpBalance:W,lpBalancePercentage:L,lpToAmountA:I,lpToAmountB:V}),ut.jsxs(Pc,{title:ut.jsx(n,{id:"nxRg31",message:"Select pair"}),children:[ut.jsxs(m,{sx:{display:"grid",gridTemplateColumns:y?"repeat(1, 1fr)":"repeat(2, 1fr)",gap:12},children:[ut.jsx(xc,{border:!0,highlightDefault:!0,chainId:j,token:a,onTokenChange:(e,t)=>{t?(l(s),d(a),u(""),h("")):(l(e),u(""))},occupiedToken:s}),ut.jsx(xc,{border:!0,highlightDefault:!0,chainId:j,token:s,onTokenChange:(e,t)=>{t?(l(s),d(a)):(d(e),h(""))},occupiedToken:a})]}),ut.jsx(Bc,{feeIndex:i,onChange:r,feeList:Fr,disabled:D})]}),ut.jsx(Pc,{title:ut.jsx(n,{id:"MU9s7M",message:"Deposit amounts"}),disabled:D,children:ut.jsxs(m,{children:[ut.jsx(cc,{sx:{mb:4,pb:28,minHeight:"auto"},token:a,amt:c,defaultLoadBalance:!0,onInputChange:e=>{var t;u(e);const n=Number(e);N&&R&&n&&h(R.times(e).dp(null!==(t=null==s?void 0:s.decimals)&&void 0!==t?t:18).toString())},showMaxBtn:!0,occupiedAddrs:[null!==(t=null==s?void 0:s.address)&&void 0!==t?t:""],occupiedChainId:null==s?void 0:s.chainId,notTokenPickerModal:!0,showPercentage:!0,readOnly:D}),ut.jsx(Jd,{plus:!0}),ut.jsx(cc,{sx:{pb:20,minHeight:"auto"},token:s,amt:p,defaultLoadBalance:!0,onInputChange:e=>{var t;h(e);const n=Number(e);N&&S&&n&&u(S.times(e).dp(null!==(t=null==a?void 0:a.decimals)&&void 0!==t?t:18).toString())},showMaxBtn:!0,occupiedAddrs:[null!==(o=null==a?void 0:a.address)&&void 0!==o?o:""],occupiedChainId:null==a?void 0:a.chainId,notTokenPickerModal:!0,showPercentage:!0,readOnly:D}),ut.jsx(zc,{slippage:f,onChangeSlippage:g,disabled:D,sx:{mt:8}}),ut.jsx(Ac,{baseToken:a,quoteToken:s,loading:E,midPrice:R,lpBalancePercentage:N?L:100}),!!N&&ut.jsxs(m,{sx:{mt:20,p:20,borderRadius:16,backgroundColor:"background.paperContrast",typography:"h6",textAlign:"center","& > b":{fontWeight:600,color:"primary.main"}},children:["🌟",ut.jsx("b",{children:ut.jsx(n,{id:"e38JNU",message:"Tips:"})})," ",ut.jsx(n,{id:"XoymfI",message:"By adding liquidity you’ll earn <0>{0}</0>of all trades on this pair proportional to your share of the pool. Fees are added to the pool, accrue in real time and can be claimed by withdrawing your liquidity.",values:{0:Ir({input:Fr[i].tradeFeeRate/1e4})},components:{0:ut.jsx("b",{})}})]})]})})]}),ut.jsx(m,{sx:{py:16,px:20,borderTopWidth:1},children:ut.jsx(Pd,{fullWidth:!0,includeButton:!0,size:v.Size.big,disabled:D,chainId:j,children:ut.jsx(gc,{statuses:[H,P],buttonProps:{size:v.Size.big},children:ut.jsx(v,{fullWidth:!0,size:v.Size.big,disabled:!(a&&s&&c&&p&&!M&&null!=i),onClick:()=>U(!0),children:M?ut.jsx(n,{id:"R7D79P",message:"Invalid pair"}):ut.jsx(n,{id:"bwSQI0",message:"Supply"})})})})})]}),ut.jsx(Hc,{open:B,onClose:()=>U(!1),slippage:x,baseToken:a,pairMintAAmount:Z,quoteToken:s,pairMintBAmount:F,feeRate:Fr[i].tradeFeeRate,price:R,lpAmount:O,lpBalancePercentage:N?L:100,pairAddress:k,createMutation:z})]})}function qc({title:e,desc:t,linkTo:o,LeftImage:i,sx:r}){const a=g(),l="light"===a.palette.mode;return ut.jsxs(m,{sx:Object.assign({backgroundColor:a.palette.background.paper,borderRadius:16,padding:20},r),children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:[ut.jsx(m,{sx:{backgroundColor:T(a.palette.secondary.main,.3),color:l?"#EB8D27":a.palette.secondary.main,borderRadius:6,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center"},children:ut.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",children:ut.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.55558 0.888672C3.87558 0.888672 0.888916 3.87534 0.888916 7.55534C0.888916 11.2353 3.87558 14.222 7.55558 14.222C11.2356 14.222 14.2222 11.2353 14.2222 7.55534C14.2222 3.87534 11.2356 0.888672 7.55558 0.888672ZM8.22225 11.5553V10.222H6.88892V11.5553H8.22225ZM4.88892 6.22201C4.88892 4.74867 6.08225 3.55534 7.55558 3.55534C9.02892 3.55534 10.2222 4.74867 10.2222 6.22201C10.2222 7.07728 9.69557 7.53755 9.18276 7.9857C8.69626 8.41085 8.22225 8.82509 8.22225 9.55534H6.88892C6.88892 8.34116 7.51699 7.85973 8.06921 7.43646C8.50241 7.10441 8.88892 6.80815 8.88892 6.22201C8.88892 5.48867 8.28892 4.88867 7.55558 4.88867C6.82225 4.88867 6.22225 5.48867 6.22225 6.22201H4.88892Z",fill:"currentColor"})})}),ut.jsx(m,{sx:{color:a.palette.text.primary,typography:"body1",fontWeight:600,ml:4},children:ut.jsx(n,{id:"cmUrtC",message:"SEE HOW IT WORKS"})})]}),ut.jsxs(m,{sx:{mt:20,borderTopWidth:1,pt:20,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(m,{component:i,sx:{width:64,height:64,flexShrink:0}}),ut.jsxs(m,{sx:{ml:16,color:a.palette.text.primary,typography:"body1",fontWeight:600},children:[e,ut.jsx(m,{sx:{mt:4,color:a.palette.text.secondary,typography:"body2",fontWeight:500},children:t})]})]}),ut.jsx(m,{component:"a",href:o,target:"_blank",rel:"noopener noreferrer",sx:{pl:16,flexShrink:0},children:ut.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:ut.jsx("path",{d:"M7.23375 3.75L6 4.98375L10.0075 9L6 13.0162L7.23375 14.25L12.4838 9L7.23375 3.75Z",fill:a.palette.text.primary})})})]})]})}function Jc({message:e,onClose:t}){return ut.jsx(Ed,{open:!!e,onClose:t,id:"error-message",children:ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{sx:{flex:1,textAlign:"center"},children:[ut.jsx(m,{component:$e.ErrorWarn,sx:{mt:60,width:64,height:64,color:"error.main"}}),e?ut.jsxs(m,{sx:{textAlign:"center",mt:60},children:[ut.jsx(m,{children:ut.jsx(n,{id:"kf83Ld",message:"Something went wrong."})}),ut.jsx(m,{sx:{color:"text.secondary",mt:12,typography:"body2",wordBreak:"break-all"},children:e})]}):""]}),ut.jsx(m,{sx:{px:16,py:20},children:ut.jsx(v,{onClick:t,fullWidth:!0,children:ut.jsx(n,{id:"1QfxQT",message:"Dismiss"})})})]})})}function Gc({status:e,children:t,buttonProps:o}){return!e.needShowTokenStatusButton&&t?ut.jsx(ut.Fragment,{children:t}):e.insufficientBalance?ut.jsx(v,{fullWidth:!0,disabled:!0,...o,children:ut.jsx(n,{id:"znqB4T",message:"Insufficient balance"})}):ut.jsx(v,{fullWidth:!0,isLoading:e.isApproving,onClick:e.submitApprove,disabled:e.insufficientBalance,...o,children:e.isApproving?ut.jsx(n,{id:"j2Uisd",message:"Approving"}):e.approveTitle})}function Qc({chainId:e,baseTokenStatus:t,quoteTokenStatus:o,children:i}){const{runningRequests:r}=Jr(),{account:a,chainId:l}=sr();if(!a||e!==l)return ut.jsx(Pd,{chainId:e,fullWidth:!0});const s=r.some((e=>{var t,n;return(null===(t=e.metadata)||void 0===t?void 0:t[cr.addLiquidity])||(null===(n=e.metadata)||void 0===n?void 0:n[cr.removeLiquidity])})),d=[];t.needShowTokenStatusButton&&d.push(ut.jsx(Gc,{status:t})),o.needShowTokenStatusButton&&!t.isApproving&&d.push(ut.jsx(Gc,{status:o}));const c=d.length;return 2===c?ut.jsx(m,{sx:{display:"flex","& > button":{flex:1,"&:last-child":{ml:8}}},children:d.map((e=>e))}):1===c?d[0]:s?ut.jsx(v,{fullWidth:!0,disabled:!0,isLoading:!0,children:ut.jsx(n,{id:"UbRKMZ",message:"Pending"})}):ut.jsx(ut.Fragment,{children:i})}function _c({pool:e,maxBaseAmount:t,maxQuoteAmount:n,isRemove:o}){const[i,r]=X.useState(""),[a,l]=X.useState(""),[s,d]=X.useState(Pi),c=s===Pi?new te(bc).div(100).toNumber():s,u=()=>{r(""),l("")},p=Cc({pool:(null==e?void 0:e.baseToken)&&e.quoteToken?{baseToken:e.baseToken,quoteToken:e.quoteToken,address:e.address}:void 0,baseAmount:i,quoteAmount:a,slippage:c}),h=p.isFront?p.price:p.invertedPrice,f=h||new te(1),m=X.useRef(f);if(!e||f.isNaN())return{baseAmount:i,quoteAmount:a,handleChangeBaseAmount:()=>{},handleChangeQuoteAmount:()=>{},reset:u,uniV2Pair:p,slippage:s,slippageNumber:c,setSlippage:d};const g=e.baseToken.decimals,x=e.quoteToken.decimals,v=e=>{if(e){let i=f.multipliedBy(e).dp(x).toString();n&&o&&(n.lte(i)||(null==t?void 0:t.lte(0)))&&(i=n.toString()),l(i)}else l(e)};m.current&&f.isEqualTo(m.current)||(m.current=f,v(i));return{baseAmount:i,quoteAmount:a,handleChangeBaseAmount:e=>{let t=kr(e,g);null===t&&(t=i),r(t),v(t)},handleChangeQuoteAmount:e=>{let i=kr(e,x);null===i&&(i=a),l(i),(e=>{if(e){let i=new te(e).div(f).dp(g).toString();t&&o&&(t.lte(i)||(null==n?void 0:n.lte(0)))&&(i=t.toString()),r(i)}else r(e)})(i)},reset:u,midPrice:h,addPortion:f,amountCheckedDisabled:!i||!a,uniV2Pair:p,slippage:s,slippageNumber:c,setSlippage:d}}function Kc({submittedBack:e,pool:t}){var n,i,r;const a="SVM_AMMV2"===(null==t?void 0:t.type),[l,s]=X.useState(!1),{baseAmount:d,quoteAmount:c,midPrice:u,amountCheckedDisabled:p,uniV2Pair:h,handleChangeBaseAmount:f,handleChangeQuoteAmount:g,reset:x,slippage:y,slippageNumber:b,setSlippage:j}=_c({pool:t});X.useEffect((()=>{x()}),[t]);const C=Ta(null==t?void 0:t.baseToken,{amount:d}),w=Ta(null==t?void 0:t.quoteToken,{amount:c}),k=C.insufficientBalance||w.insufficientBalance,R=!t||k||!u||!!h.poolInfoQuery.isLoading||!!h.poolInfoQuery.error||p||h.poolInfoQuery.isLoading;let M=a?o._({id:"bwSQI0",message:"Supply"}):o._({id:"m16xKo",message:"Add"});k&&(M=o._({id:"znqB4T",message:"Insufficient balance"}));const S=jc({baseToken:null==t?void 0:t.baseToken,quoteToken:null==t?void 0:t.quoteToken,pairMintAAmount:h.pairMintAAmount,pairMintBAmount:h.pairMintBAmount,isExists:h.isExists,poolKeys:null===(n=h.poolInfoQuery.data)||void 0===n?void 0:n.poolKeys,poolInfo:null===(i=h.poolInfoQuery.data)||void 0===i?void 0:i.poolInfo,slippage:b,submittedBack:()=>{x(),e&&e(),s(!1)}}),E=!(null==t?void 0:t.baseToken)||!(null==t?void 0:t.quoteToken);return ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{sx:{pt:20,pb:18,px:20},children:[ut.jsx(cc,{sx:{mb:4,pb:28,minHeight:"auto"},amt:d,token:null==t?void 0:t.baseToken,canClickBalance:!0,showPercentage:!0,onInputChange:f,readOnly:h.poolInfoQuery.isLoading}),ut.jsx(Jd,{plus:!0}),ut.jsx(cc,{sx:{pb:20,minHeight:"auto"},amt:c,token:null==t?void 0:t.quoteToken,canClickBalance:!0,showPercentage:!0,onInputChange:g,readOnly:h.poolInfoQuery.isLoading}),ut.jsx(zc,{slippage:y,onChangeSlippage:j,disabled:E,sx:{mt:8}}),ut.jsx(Ac,{baseToken:null==t?void 0:t.baseToken,quoteToken:null==t?void 0:t.quoteToken,loading:h.poolInfoQuery.isLoading,midPrice:u,lpBalancePercentage:h.isExists?h.lpBalancePercentage:100})]}),ut.jsx(m,{sx:{px:20,py:16,position:"sticky",bottom:0,borderStyle:"solid",borderWidth:"1px 0 0",borderColor:"border.main",backgroundColor:"background.paper"},children:t?ut.jsx(Qc,{chainId:t.chainId,baseTokenStatus:C,quoteTokenStatus:w,children:ut.jsx(v,{fullWidth:!0,disabled:R,isLoading:S.isPending,onClick:()=>{R||s(!0)},children:M})}):ut.jsx(v,{fullWidth:!0,disabled:!0,children:M})}),ut.jsx(Jc,{message:null===(r=S.error)||void 0===r?void 0:r.message,onClose:()=>S.reset()}),a&&!!t&&ut.jsx(Hc,{open:l,onClose:()=>s(!1),slippage:b,baseToken:t.baseToken,quoteToken:t.quoteToken,pairMintAAmount:h.pairMintAAmount,pairMintBAmount:h.pairMintBAmount,feeRate:t.lpFeeRate,price:null==h?void 0:h.price,lpAmount:null==h?void 0:h.liquidityMinted,lpBalancePercentage:h.isExists?h.lpBalancePercentage:100,pairAddress:t.address,createMutation:S})]})}!function(e){e[e.Liquidity=1]="Liquidity",e[e.Mining=2]="Mining"}(Ec||(Ec={})),function(e){e[e.LOW=1e3]="LOW"}(Tc||(Tc={})),Tc.LOW;const $c={[Tc.LOW]:{label:"0.1%"}};function eu(e,t){var n;return e?{chainId:t,address:e.id,name:e.name,decimals:Number(e.decimals),symbol:e.symbol,logoURI:null!==(n=e.logoImg)&&void 0!==n?n:""}:e}function tu(e){var t,n,o,i;const r=null==e?void 0:e.pair;if(r)return{address:r.id,chainId:r.chainId,baseToken:eu(r.baseToken,r.chainId),quoteToken:eu(r.quoteToken,r.chainId),type:r.type,creator:r.creator,baseLpToken:{id:null===(t=r.baseLpToken)||void 0===t?void 0:t.id},quoteLpToken:{id:null===(n=r.quoteLpToken)||void 0===n?void 0:n.id},lpFeeRate:null===(o=null==e?void 0:e.pair)||void 0===o?void 0:o.lpFeeRate,mtFeeRate:null===(i=null==e?void 0:e.pair)||void 0===i?void 0:i.mtFeeRate}}function nu(e){const t=tu(e);if(t)return Object.assign(Object.assign({},t),{liquidityPositions:null==e?void 0:e.liquidityPositions})}function ou(e){switch(e){case"SVM_AMMV2":return"AMM V2";case"SVM_AMMV3":return"AMM V3";default:return"PMM"}}function iu({type:e,lpFeeRate:t,mtFeeRate:n}){var o,i;return"SVM_AMMV3"===e?null!==(i=null===(o=$c[t])||void 0===o?void 0:o.label)&&void 0!==i?i:"-":`${jr({input:new te(null!=t?t:0).plus(null!=n?n:0).div(1e4),decimals:4})}%`}function ru({hidePoolInfo:e,pool:t,children:o}){var i,r,a,l,s;const d=g(),c=!t,u="SVM_AMMV2"===(null==t?void 0:t.type),p=t?iu({type:t.type,lpFeeRate:null!==(i=t.lpFeeRate)&&void 0!==i?i:"0",mtFeeRate:null!==(r=t.mtFeeRate)&&void 0!==r?r:"0"}):"-";return ut.jsxs(m,{sx:{mt:16,mx:20,border:"solid 1px",borderColor:"border.main",borderRadius:12},children:[e?"":ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:d.spacing(12,20),borderStyle:"solid",borderColor:"border.main",borderWidth:d.spacing(0,0,1)},children:[ut.jsxs(m,{children:[ut.jsxs(M,{loading:c,loadingSx:{width:100,mb:4},sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[null===(a=null==t?void 0:t.baseToken)||void 0===a?void 0:a.symbol,"/",null===(l=null==t?void 0:t.quoteToken)||void 0===l?void 0:l.symbol,u&&ut.jsx(L,{title:ut.jsxs(m,{sx:{typography:"h6","& > b":{fontWeight:600,color:"primary.main"}},children:["🌟",ut.jsx("b",{children:ut.jsx(n,{id:"e38JNU",message:"Tips:"})})," ",ut.jsx(n,{id:"ipqmyu",message:"By adding liquidity you’ll earn <0>{feeRate}</0> of all trades on this pair proportional to your share of the pool. Fees are added to the pool, accrue in real time and can be claimed by withdrawing your liquidity.",values:{feeRate:p},components:{0:ut.jsx("b",{})}})]}),sx:{maxWidth:240},children:ut.jsx(m,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.disabled"},children:p})})]}),ut.jsx(M,{loading:c,children:ut.jsx(Oc,{address:null!==(s=null==t?void 0:t.address)&&void 0!==s?s:"",truncate:!0,iconSize:14,iconSpace:4,customChainId:null==t?void 0:t.chainId,sx:{typography:"h6",color:"text.secondary"}})})]}),(null==t?void 0:t.address)&&!u?ut.jsxs(m,{component:S,sx:{typography:"body2",display:"flex",alignItems:"center",color:"text.secondary"},onClick:()=>{fc.getState().push({type:hc.PoolDetail,params:{chainId:t.chainId,address:t.address}})},children:[ut.jsx(n,{id:"URmyfc",message:"Details"}),ut.jsx(m,{component:$e.ArrowRight,sx:{ml:4,position:"relative",top:1.2,width:16,height:16}})]}):""]}),ut.jsx(m,{sx:{p:d.spacing(12,20)},children:o})]})}var au;new p,new h,function(e){e[e.Add=1]="Add",e[e.Remove=2]="Remove"}(au||(au={}));const lu=[{value:0,label:"0%"},{value:25,label:"25%"},{value:50,label:"50%"},{value:75,label:"75%"},{value:100,label:"100%"}];function su({disabled:e,value:t,onChange:n,sx:o}){return ut.jsxs(m,{sx:Object.assign({p:20,backgroundColor:"background.input",borderRadius:12},o),children:[ut.jsx(_d,{value:String(t),onChange:e=>n(+e),readOnly:!0,readonlyShowSuffix:!0,suffix:ut.jsx(m,{sx:{typography:"h2"},children:"%"}),sx:{mt:12,"& input":{pl:0,typography:"h1"}}}),ut.jsx(m,{sx:{mt:20},children:ut.jsx(A,{marks:lu,step:1,disabled:e,value:t,onChange:(e,t)=>n(t)})})]})}const du=50;var cu;function uu({submittedBack:t,pool:n}){var i,r,a;const[l,s]=X.useState(""),[d,c]=X.useState(""),[u,p]=X.useState(Pi),h=u===Pi?new te(bc).div(100).toNumber():u,{isFront:f,price:g,invertedPrice:x,poolInfoQuery:y,lpBalanceQuery:b,lpBalance:j,lpBalancePercentage:C,lpToAmountA:w,lpToAmountB:k,liquidityMinted:R,pairMintAAmount:M,pairMintBAmount:S,isExists:E}=Cc({pool:(null==n?void 0:n.baseToken)&&n.quoteToken?{baseToken:n.baseToken,quoteToken:n.quoteToken,address:n.address}:void 0,baseAmount:void 0,quoteAmount:void 0,slippage:0}),{mode:T,modeOptions:W,handleChangeMode:L,sliderPercentage:I,handleChangeSliderPercentage:V,resetPercentage:O}=function({isBase:e,pool:t,baseOverride:n,quoteOverride:i,resetAmount:r,handleChangeBaseAmount:a,handleChangeQuoteAmount:l}){const[s,d]=X.useState(cu.percentage),[c,u]=X.useState(du),p=X.useRef(null),h=()=>{p.current&&clearTimeout(p.current)},f=()=>{h(),u(du)};return X.useEffect((()=>h),[]),{mode:s,modeOptions:[{key:cu.percentage,value:o._({id:"x4QVeW",message:"Percentage to remove"})}],handleChangeMode:e=>{d(e),null==r||r(),f()},sliderPercentage:c,handleChangeSliderPercentage:o=>{if(h(),o!==c&&u(o),!t)return;const r=100===o,s=()=>{if(t)if(e||void 0===e){if(n){let e=n.toString();r||(e=wr(n.times(o/100),t.baseToken.decimals)),null==a||a(e)}}else if(i){let e=i.toString();r||(e=wr(i.times(o/100),t.quoteToken.decimals)),null==l||l(e)}};r?s():p.current=setTimeout(s,100)},resetPercentage:f}}({isBase:!0,pool:n,baseOverride:w,quoteOverride:k}),Z=Ta(null==n?void 0:n.baseToken,{amount:l}),F=Ta(null==n?void 0:n.quoteToken,{amount:d}),N=!n||!!y.isLoading||!!y.error||!!b.error||b.isLoading,A=o._({id:"t/YqKh",message:"Remove"}),H=function({liquidityAmount:t,slippage:n,poolInfo:i,poolKeys:r,submittedBack:a}){const l=qr(),s=rs();return e(),ye({mutationFn:()=>or(this,void 0,void 0,(function*(){if(!s)throw new Error("raydium is undefined");if(!i||!r)throw new Error("poolInfo or poolKeys is undefined");if(!t)throw new Error("liquidityAmount is undefined");const e=new qe(new Ge(t.toString()).mul(10**i.lpMint.decimals).toFixed(0,Ge.ROUND_DOWN)),d=new Ne(100*n*100,1e4),{execute:c}=yield s.cpmm.withdrawLiquidity({poolInfo:i,poolKeys:r,lpAmount:e,txVersion:Ze.LEGACY,slippage:d});return yield l.executeCustom({brief:o._({id:"cJtosk",message:"Remove liquidity"}),metadata:{[cr.removeLiqidityAMMV2Position]:!0},handler:e=>or(this,void 0,void 0,(function*(){const{txId:t}=yield c({sendAndConfirm:!0});e.onSuccess(t)})),submittedBack:a})}))})}({liquidityAmount:null==j?void 0:j.times(I/100),slippage:h,poolKeys:null===(i=y.data)||void 0===i?void 0:i.poolKeys,poolInfo:null===(r=y.data)||void 0===r?void 0:r.poolInfo,submittedBack:()=>{t&&t()}}),P=!(null==n?void 0:n.baseToken)||!(null==n?void 0:n.quoteToken);return ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{sx:{pb:18,px:20},children:[ut.jsx(m,{sx:{pt:20},children:T===cu.percentage?ut.jsx(su,{disabled:y.isLoading||!j||j.lte(0),value:I,onChange:V}):ut.jsx(ut.Fragment,{})}),ut.jsx(zc,{slippage:u,onChangeSlippage:p,disabled:P,sx:{mt:8}}),ut.jsx(Ac,{baseToken:null==n?void 0:n.baseToken,quoteToken:null==n?void 0:n.quoteToken,loading:y.isLoading,midPrice:f?g:x,lpBalancePercentage:E?C:100})]}),ut.jsx(m,{sx:{px:20,py:16,position:"sticky",bottom:0,borderStyle:"solid",borderWidth:"1px 0 0",borderColor:"border.main",backgroundColor:"background.paper"},children:n?ut.jsx(Qc,{chainId:n.chainId,baseTokenStatus:Z,quoteTokenStatus:F,children:ut.jsx(v,{fullWidth:!0,disabled:N,isLoading:H.isPending,onClick:()=>{N||H.mutate()},children:A})}):ut.jsx(v,{fullWidth:!0,disabled:!0,children:A})}),ut.jsx(Jc,{message:null===(a=H.error)||void 0===a?void 0:a.message,onClose:()=>H.reset()})]})}function pu({pool:t,operate:n,hidePoolInfo:o,submittedBack:i}){var r;const{operateTab:a,operateTabs:l,handleChangeTab:s}=function(t=au.Add){const{i18n:n}=e(),[o,i]=X.useState(t),r=X.useMemo((()=>[{key:au.Add,value:n._({id:"m16xKo",message:"Add"})},{key:au.Remove,value:n._({id:"t/YqKh",message:"Remove"})}]),[n._]);return X.useEffect((()=>{i(t)}),[t]),{operateTab:o,operateTabs:r,handleChangeTab:e=>{i(e)}}}(n);sr();const{price:d,invertedPrice:c,poolInfoQuery:u,lpBalanceQuery:p,lpBalance:h,lpBalancePercentage:f,lpToAmountA:m,lpToAmountB:g,liquidityMinted:x,pairMintAAmount:v,pairMintBAmount:y,isExists:b}=Cc({pool:(null==t?void 0:t.baseToken)&&t.quoteToken?{baseToken:t.baseToken,quoteToken:t.quoteToken,address:t.address}:void 0,baseAmount:void 0,quoteAmount:void 0,slippage:0});return ut.jsxs(ut.Fragment,{children:[ut.jsx(ru,{pool:t,hidePoolInfo:o,children:ut.jsx(Dc,{isExists:b,poolInfo:null===(r=u.data)||void 0===r?void 0:r.poolInfo,poolInfoLoading:u.isLoading,lpBalanceLoading:p.isLoading,lpBalance:h,lpBalancePercentage:f,lpToAmountA:m,lpToAmountB:g,sx:{px:0,py:0,border:"none"}})}),ut.jsxs(H,{value:a,onChange:(e,t)=>{s(t)},children:[ut.jsx(P,{tabs:l,variant:"inPaper",tabsListSx:{mt:16,mx:20}}),ut.jsx(B,{value:au.Add,children:ut.jsx(Kc,{pool:t,submittedBack:i})}),ut.jsx(B,{value:au.Remove,children:ut.jsx(uu,{pool:t,submittedBack:i})})]})]})}function hu({onClose:t,pool:n,operate:o,hasMining:i,hidePoolInfo:r,sx:a}){const{poolOrMiningTab:l,poolOrMiningTabs:s,handleChangeTab:d}=function({hasMining:t}){const{i18n:n}=e(),[o,i]=X.useState(Ec.Liquidity);return{poolOrMiningTab:o,poolOrMiningTabs:X.useMemo((()=>{const e=[{key:Ec.Liquidity,value:n._({id:"6y2TB3",message:"Liquidity"})},{key:Ec.Mining,value:n._({id:"Sti4vy",message:"Mining"})}];return t?e:e.slice(0,1)}),[n._,t]),handleChangeTab:e=>{i(e)}}}({hasMining:i});return ut.jsx(m,{sx:a,children:ut.jsxs(H,{value:l,onChange:(e,t)=>{d(t)},sx:{display:"flex",flexDirection:"column",overflow:"hidden",height:"100%"},children:[ut.jsx(U,{tabs:s,tabsListSx:Object.assign({mx:20,justifyContent:t?"space-between":"flex-start"},{}),rightSlot:ut.jsx(m,{sx:{display:"flex",justifyContent:"center",alignItems:"center",gap:12},children:t?ut.jsx(m,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24,borderRadius:"50%",borderWidth:1,color:"text.secondary",cursor:"pointer"},children:ut.jsx(m,{component:$e.Error,sx:{width:16,height:16},onClick:()=>{t()}})}):void 0})}),ut.jsx(B,{value:Ec.Liquidity,sx:{flex:1,overflowY:"auto"},children:ut.jsx(pu,{pool:n,operate:o,hidePoolInfo:r,submittedBack:()=>{i&&d(Ec.Mining)}})})]})})}function fu(e){var{modal:t}=e,n=nr(e,["modal"]);const{isMobile:o}=Kd();return ut.jsx(Ed,{open:!!n.pool,onClose:n.onClose,scope:!o,modal:t,id:"pool-operate",children:ut.jsx(hu,{...n})})}!function(e){e[e.quantity=1]="quantity",e[e.percentage=2]="percentage"}(cu||(cu={}));const mu=e=>Object.keys(new Array(e+1).join(","));var gu,xu,vu;function yu({sx:e,hasSearch:t,emptyText:o}){return ut.jsxs(m,{sx:Object.assign({display:"flex",flexDirection:"column",gap:12,justifyContent:"center",alignItems:"center",typography:"body2",fontWeight:500,color:"text.secondary",textAlign:"center"},e),children:[ut.jsx(D,{hasSearch:t,sx:{width:60,height:60,borderRadius:12}}),ut.jsx(m,{children:null!=o?o:ut.jsx(n,{id:"AxPAXW",message:"No results found"})})]})}function bu(){return bu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},bu.apply(null,arguments)}!function(e){e[e.Failed=0]="Failed",e[e.Success=1]="Success",e[e.Warning=2]="Warning"}(gu||(gu={}));const ju=e=>z.createElement("svg",bu({width:60,height:60,viewBox:"0 0 60 60",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),z.createElement("g",{opacity:.5},z.createElement("mask",{id:"mask0_3521_179418",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:0,y:0,width:60,height:60},xu||(xu=z.createElement("rect",{width:60,height:60,rx:16,fill:"white"}))),vu||(vu=z.createElement("g",{mask:"url(#mask0_3521_179418)"},z.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 30.0352H60V16.0352C60 7.1986 52.8366 0.0351562 44 0.0351562H16C7.16344 0.0351562 0 7.1986 0 16.0352V30.0352Z",fill:"#727272",fillOpacity:.4}),z.createElement("path",{d:"M29.4643 4H16C9.37258 4 4 9.37258 4 16V27H27.1154L31.7914 18.7271L23.1831 13.6634L29.4643 4Z",fill:"#727272",fillOpacity:.4}),z.createElement("path",{d:"M31.7101 27H56V16C56 9.37258 50.6274 4 44 4H34.0384L34.1766 4.08987L28.8164 12.3364L37.2081 17.2727L31.7101 27Z",fill:"#727272",fillOpacity:.4}),z.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 44C0 52.8366 7.16344 60 16 60H44C52.8366 60 60 52.8366 60 44V30H0V44Z",fill:"#ABABAB",fillOpacity:.4}),z.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M59.4395 44.8861C59.4395 53.0965 52.7625 59.7526 44.5257 59.7526C36.2891 59.7526 29.6118 53.0965 29.6118 44.8861C29.6118 36.6756 36.2891 30.0195 44.5257 30.0195C52.7625 30.0195 59.4395 36.6756 59.4395 44.8861Z",fill:"#727272",fillOpacity:.4}),z.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.8277 44.8665C29.8277 53.077 23.1507 59.7331 14.9139 59.7331C6.67727 59.7331 0 53.077 0 44.8665C0 36.6561 6.67727 30 14.9139 30C23.1507 30 29.8277 36.6561 29.8277 44.8665Z",fill:"#727272",fillOpacity:.4}),z.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.9177 44.8883C51.9177 48.958 48.6082 52.257 44.5255 52.257C40.4431 52.257 37.1333 48.958 37.1333 44.8883C37.1333 40.8186 40.4431 37.5195 44.5255 37.5195C48.6082 37.5195 51.9177 40.8186 51.9177 44.8883Z",fill:"#444446"})))));function Cu({sx:e,refresh:t}){return ut.jsxs(m,{sx:se({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},e),children:[ut.jsx(m,{component:ju,sx:{display:"inline-block",width:60,height:60,mb:12}}),ut.jsx(m,{sx:{typography:"body2",width:252,textAlign:"center"},children:ut.jsx(m,{component:"span",sx:{color:"text.secondary"},children:ut.jsx(n,{id:"Vmw6BM",message:"Something went wrong…<0>Refresh again</0>",components:{0:ut.jsx(y,{component:"span",color:"primary.main",weak:!0,sx:{cursor:"pointer"},onClick:()=>{t()}})}})})})]})}function wu({loading:e,empty:t,hasSearch:n,children:o,refetch:i}){return e?ut.jsx(m,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",gap:24,px:24,height:320},children:mu(4).map(((e,t)=>ut.jsx(I,{width:"100%",height:45},t)))}):i?ut.jsx(Cu,{refresh:i,sx:{height:320}}):t?ut.jsx(yu,{hasSearch:n,sx:{height:320}}):ut.jsx(ut.Fragment,{children:o})}function ku({children:e,sx:t,gap:n=20,repeatBaseForLargeScreen:o=3}){const{isMobile:i,minDevice:r}=Kd();let a={};if(i)a={display:"flex",flexDirection:"column",gap:n};else{let e=2;[1418,1761,2104].some(((t,n)=>{if(r(t))return e=o+n,!0})),a={display:"grid",gap:n,gridTemplateColumns:`repeat(${e}, 1fr)`}}return ut.jsx(m,{sx:Object.assign(Object.assign({},a),t),children:e})}function Ru({address:e,chainId:t,hideName:o,sx:i}){const r=g(),a=wa(),{onlyChainId:l}=ar(),s=ve(Object.assign({},a.getQuery(f.graphql.fetchLiquidityLpPartnerRewards,{where:{chainId:l||void 0}})));if(!e)return null;const d=[];return("string"==typeof e?[e]:Array.from(new Set(e)).filter((e=>!!e))).forEach((e=>{var n,o,i;e&&(null===(i=null===(o=null===(n=s.data)||void 0===n?void 0:n.liquidity_getLpPartnerRewards)||void 0===o?void 0:o.partnerRewards)||void 0===i||i.some((n=>{var o,i,r,a,l,c,u,p,h,f,m,g,x,v;if((null==n?void 0:n.chainId)===t&&(null===(o=null==n?void 0:n.pool)||void 0===o?void 0:o.toLocaleLowerCase())===e.toLocaleLowerCase()){const e=null===(a=null===(r=null===(i=s.data)||void 0===i?void 0:i.liquidity_getLpPartnerRewards)||void 0===r?void 0:r.partnerInfos)||void 0===a?void 0:a.find((e=>(null==e?void 0:e.partner)===n.partner));if(!e)return;d.push({partner:{name:null!==(l=null==e?void 0:e.partner)&&void 0!==l?l:"",logo:null!==(c=null==e?void 0:e.logo)&&void 0!==c?c:"",introduction:null!==(u=null==e?void 0:e.introduction)&&void 0!==u?u:"",link:null!==(p=null==e?void 0:e.link)&&void 0!==p?p:"",extra:null!==(h=null==e?void 0:e.extra)&&void 0!==h?h:{},background:(null===(f=null==e?void 0:e.theme)||void 0===f?void 0:f[0])||void 0,color:(null===(m=null==e?void 0:e.theme)||void 0===m?void 0:m[1])||void 0},reward:null!==(g=null==n?void 0:n.reward)&&void 0!==g?g:"",type:null!==(x=null==n?void 0:n.type)&&void 0!==x?x:"stakelp",sort:null!==(v=null==e?void 0:e.sort)&&void 0!==v?v:Number.MAX_SAFE_INTEGER})}})))})),(null==d?void 0:d.length)?(d.sort(((e,t)=>e.sort-t.sort)),ut.jsx(m,{sx:Object.assign({display:"flex",alignItems:"center",gap:4},i),children:d.map((e=>ut.jsx(L,{leaveDelay:100,title:ut.jsxs(m,{sx:{maxWidth:240,whiteSpace:"pre-wrap"},children:[e.partner.introduction,!!e.partner.link&&ut.jsxs(m,{component:"a",target:"_blank",href:e.partner.link,rel:"noopener noreferrer",sx:{display:"flex",alignItems:"center",gap:4,color:"primary.main","&:hover":{opacity:.5}},children:[ut.jsx(n,{id:"zwWKhA",message:"Learn more"})," ",ut.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ut.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.91667 2.91667V11.0833H11.0833V7H12.25V11.0833C12.25 11.725 11.725 12.25 11.0833 12.25H2.91667C2.26917 12.25 1.75 11.725 1.75 11.0833V2.91667C1.75 2.275 2.26917 1.75 2.91667 1.75H7V2.91667H2.91667ZM8.16667 2.91667V1.75H12.25V5.83333H11.0833V3.73917L5.34917 9.47333L4.52667 8.65083L10.2608 2.91667H8.16667Z",fill:"currentColor"})})]})]}),children:ut.jsxs(S,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:4,p:r.spacing(0,4),height:20,borderRadius:4,background:e.partner.background,color:e.partner.color,whiteSpace:"nowrap"},children:[ut.jsx(m,{component:"img",src:e.partner.logo,alt:e.partner.name,sx:{width:14,height:14,borderRadius:"50%"}}),!o&&!!e.reward&&ut.jsx(m,{sx:{fontSize:"10px",fontWeight:600},children:e.reward})]})},e.partner.name+e.reward)))})):null}var Mu,Su;function Eu(){return Eu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Eu.apply(null,arguments)}const Tu=e=>z.createElement("svg",Eu({width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),Mu||(Mu=z.createElement("circle",{cx:16,cy:16,r:16,fill:"#FFE804"})),Su||(Su=z.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.5 12.25H12.25V8.5H8.5V12.25ZM14.125 23.5H17.875V19.75H14.125V23.5ZM12.25 23.5H8.5V19.75H12.25V23.5ZM8.5 17.875H12.25V14.125H8.5V17.875ZM17.875 17.875H14.125V14.125H17.875V17.875ZM19.75 8.5V12.25H23.5V8.5H19.75ZM17.875 12.25H14.125V8.5H17.875V12.25ZM19.75 17.875H23.5V14.125H19.75V17.875ZM23.5 23.5H19.75V19.75H23.5V23.5Z",fill:"#1A1A1B"}))),Wu="_default";function Lu({value:e,onChange:t,placeholder:n,options:o,sx:i,readOnly:r,valueOnlyIcon:a}){const l=g();return ut.jsx(Y,{value:null!=e?e:Wu,onChange:(n,o)=>{const i="number"==typeof e?Number(o):o;t(i===Wu?void 0:i)},disabled:r,sx:se({padding:l.spacing(8,12),"& .MuiSelect-select.MuiSelect-select.MuiSelect-select":{display:"flex",alignItems:"center",gap:8,padding:l.spacing(8,12,8,12),minHeight:"auto",backgroundColor:"transparent",color:"text.primary",borderRadius:8,typography:"body2",fontWeight:600,borderStyle:"solid",borderWidth:1,borderColor:"divider","& svg, & img":{width:24,height:24},'&:hover, &[aria-expanded="true"]':{backgroundColor:"background.paper"},"&.Mui-readOnly":{color:"text.disabled"}},"& .MuiSelect-icon":{color:r?"text.disabled":"text.primary"},"& .MuiOutlinedInput-notchedOutline":{display:"none"}},i),renderValue:t=>{if(!(null==t?void 0:t.value)||t.value===Wu)return ut.jsx(m,{sx:{color:"text.secondary"},children:null!=n?n:""});const i=o.find((t=>t.key===e));return i?ut.jsxs(ut.Fragment,{children:[i.logo,a?"":i.value]}):null},options:[...o]})}function Iu({isMobileStyle:e,chain:t,isLastItem:n,logoWidth:o,mobileLogoWidth:i,sx:r}){const a=g();return e?ut.jsxs(m,{sx:Object.assign({display:"flex",alignItems:"center",py:18,borderTop:`1px solid ${a.palette.border.main}`,borderBottom:n?`1px solid ${a.palette.border.main}`:"none"},r),children:[ut.jsx(m,{component:null==t?void 0:t.logo,sx:{width:i,height:i}}),ut.jsx(m,{component:"span",className:"name",sx:{marginLeft:8},children:null==t?void 0:t.name})]}):ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(m,{component:null==t?void 0:t.logo,sx:{width:o,height:o}}),ut.jsx(m,{component:"span",className:"name",sx:{marginLeft:8},children:null==t?void 0:t.name})]})}const Vu=-1;function Ou({chainId:t,setChainId:o,logoWidth:i=24,mobileLogoWidth:r=32,mainLogoWidth:a=24,mainMobileLogoWidth:l=18,notShowAllChain:s,valueOnlyIcon:d,sx:c}){const u=function(){const{chainId:e}=Oe();return Q((()=>{const t=new Map;let n;return Ql.forEach(((o,i)=>{if(o.mainnet){if(e!==o.chainId)return;n=o.mainnet}t.set(i,Object.assign({},o))})),void 0!==n&&t.delete(n),Array.from(t.values())}),[e])}(),[p,h]=X.useState(!1),{isMobile:f}=Kd(),{i18n:g}=e(),x=X.useCallback((()=>{const e=void 0===t?u[0]:u.find((e=>e.chainId===t));if(d){if(void 0===t||!e)return"";const n=f?r:a;return ut.jsx(m,{component:null==e?void 0:e.logo,sx:{width:n,height:n}})}return void 0!==t||s?e?ut.jsx(Iu,{isMobileStyle:f,chain:e,logoWidth:a,mobileLogoWidth:l}):null:ut.jsx(Iu,{isMobileStyle:f,chain:{chainId:Vu,logo:Tu,name:g._({id:"pY/ok7",message:"All chains"})},logoWidth:a,mobileLogoWidth:l,sx:{border:"none"}})}),[t,u,s,d,f,g._]),v=X.useMemo((()=>{const e=[];return s||e.push({key:Vu,value:ut.jsx(Iu,{isMobileStyle:f,chain:{chainId:Vu,logo:Tu,name:g._({id:"pY/ok7",message:"All chains"})},logoWidth:i,mobileLogoWidth:r})}),u.forEach(((t,n)=>{e.push({key:t.chainId,value:ut.jsx(Iu,{isLastItem:n===u.length-1,isMobileStyle:f,chain:t,logoWidth:i,mobileLogoWidth:r})})})),e}),[f,i,r,u,s]);return f?ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{component:S,onClick:()=>h(!0),sx:Object.assign({display:"flex",alignItems:"center",backgroundColor:"background.tag",borderRadius:8,border:"none",px:8,height:32,fontWeight:600,typography:"body2"},c),children:[ut.jsx(m,{sx:{pr:5},children:x()}),ut.jsx(m,{component:$e.CaretUp,sx:{width:12,height:12,transform:"rotate(180deg)"}})]}),ut.jsx(Ed,{open:p,title:ut.jsx(n,{id:"lJvbHq",message:"Select Network"}),onClose:()=>h(!1),id:"select-chain",modal:!0,children:ut.jsx(m,{sx:{mb:20},children:v.map((e=>ut.jsxs(m,{onClick:()=>{const t=e.key;o(t===Vu?void 0:Number(t)),h(!1)},sx:{position:"relative",px:20,"&:active":{backgroundColor:"hover.default"},"&:hover":{backgroundColor:"hover.default"},cursor:"pointer"},children:[e.value,(t?e.key===t:e.key===Vu)&&ut.jsx(m,{sx:{position:"absolute",left:0,top:24,height:20,width:2,backgroundColor:"text.primary"}})]},e.key)))})})]}):ut.jsx(Lu,{value:null!=t?t:Vu,onChange:e=>{o(e===Vu?void 0:e)},placeholder:g._({id:"lJvbHq",message:"Select Network"}),options:v,valueOnlyIcon:d,sx:Object.assign({height:32,fontWeight:600,typography:"body2"},c)})}function Zu({text:e,onClick:t}){const n=g();return ut.jsxs(m,{sx:{typography:"body2",display:"inline-flex",alignItems:"center",p:n.spacing(0,4,0,8),width:"max-content",height:32,backgroundColor:"hover.default",borderWidth:1,borderRadius:8,cursor:"pointer"},onClick:t,children:[e,ut.jsx(m,{component:$e.ArrowBack,sx:{ml:2,width:16,height:16,transform:"rotate(180deg)"}})]})}function Fu({lqList:e,onDeleteTag:t,sx:n}){var o;if(!(null==e?void 0:e.length))return null;if(!(null===(o=e[0])||void 0===o?void 0:o.pair))return null;const{pair:i}=e[0],r=eu(i.baseToken,i.chainId),a=eu(i.quoteToken,i.chainId);return r&&a?ut.jsxs(m,{sx:Object.assign({typography:"body2",display:"inline-flex",alignItems:"center",px:8,mr:8,borderRadius:8,fontWeight:600,height:32,backgroundColor:"hover.default"},n),children:[ut.jsx(Fc,{tokens:[r,a],chainId:r.chainId,width:20,mr:8}),r.symbol,"+",a.symbol,ut.jsx(m,{component:$e.Error,sx:{ml:4,width:16,height:16,cursor:"pointer",color:"text.secondary",position:"relative",top:1.5},onClick:()=>t()})]}):null}function Nu({tags:e,onDeleteTag:t,sx:n}){return e.length?ut.jsx(m,{sx:Object.assign({display:"inline-flex",alignItems:"center"},n),children:e.map((e=>ut.jsxs(m,{sx:{typography:"body2",display:"flex",alignItems:"center",px:8,mr:8,borderRadius:8,fontWeight:600,height:32,backgroundColor:"hover.default"},children:[ut.jsx(Kl,{address:e.address,width:20,height:20,chainId:e.chainId,url:e.logoURI,noShowChain:!0,marginRight:8}),e.symbol,ut.jsx(m,{component:$e.Error,sx:{ml:4,width:16,height:16,cursor:"pointer",color:"text.secondary",position:"relative",top:1.5},onClick:()=>t(e)})]},e.address)))}):null}function Au({chainId:e,address:t}){const{isMobile:n}=Kd();return ut.jsx(m,{component:"button",onClick:n=>{n.stopPropagation(),fc.getState().push({type:hc.PoolDetail,params:{chainId:e,address:t}})},sx:Object.assign({display:"flex",alignItems:"center",justifyContent:"center",borderRadius:8,cursor:"pointer",flexShrink:0,height:36,"&:hover":{opacity:.5}},n?{width:64,backgroundColor:"background.tag"}:{width:40,backgroundColor:"transparent",borderWidth:1}),children:ut.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ut.jsx("path",{d:"M5.83333 14.1667H7.5V8.33333H5.83333V14.1667ZM9.16667 14.1667H10.8333V5.83333H9.16667V14.1667ZM12.5 14.1667H14.1667V10.8333H12.5V14.1667ZM4.16667 17.5C3.70833 17.5 3.31597 17.3368 2.98958 17.0104C2.66319 16.684 2.5 16.2917 2.5 15.8333V4.16667C2.5 3.70833 2.66319 3.31597 2.98958 2.98958C3.31597 2.66319 3.70833 2.5 4.16667 2.5H15.8333C16.2917 2.5 16.684 2.66319 17.0104 2.98958C17.3368 3.31597 17.5 3.70833 17.5 4.16667V15.8333C17.5 16.2917 17.3368 16.684 17.0104 17.0104C16.684 17.3368 16.2917 17.5 15.8333 17.5H4.16667ZM4.16667 15.8333H15.8333V4.16667H4.16667V15.8333Z",fill:"#1A1A1B"})})})}function Hu(e){var{sx:t,children:o,hasMore:i,loadMore:r,loadMoreLoading:a}=e,l=nr(e,["sx","children","hasMore","loadMore","loadMoreLoading"]);const s=g();return ut.jsxs(m,{sx:Object.assign({position:"relative",flex:1,overflowY:"auto"},t),...l,children:[ut.jsx(m,{component:"table",sx:{width:"100%",borderCollapse:"collapse","& th":{p:24,typography:"body1",textAlign:"left",color:"text.secondary"},"& td":{px:24,py:20},"& thead":{position:"sticky",top:0,zIndex:2,backgroundColor:"background.paper"},"& th:last-child, & td:last-child":{position:"sticky",right:0,zIndex:1,backgroundColor:"background.paper","&::before":{content:'""',position:"absolute",top:0,bottom:0,left:1,width:"1px",boxShadow:`${T(s.palette.text.primary,.1)} -2px 0px 4px 0px`}}},children:o}),i&&ut.jsx(S,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:64,width:"100%",borderStyle:"solid",borderColor:"border.main",borderWidth:s.spacing(1,0,0,0),typography:"body2",color:"text.secondary","&:hover":{color:"text.primary"}},onClick:r,children:a?ut.jsx(W,{}):ut.jsxs(ut.Fragment,{children:[ut.jsx(n,{id:"yQ2kGp",message:"Load more"}),ut.jsx(m,{component:$e.ArrowRight,sx:{transform:"rotate(90deg)"}})]})})]})}function Pu({sx:e}){return ut.jsxs(m,{sx:Object.assign({px:20,pt:20,pb:12,backgroundColor:"background.paperContrast",borderRadius:16,display:"flex",flexDirection:"column"},e),children:[ut.jsx(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(I,{variant:"circular",width:48}),ut.jsx(I,{variant:"rounded",height:28,width:100,sx:{ml:8}})]})}),ut.jsxs(m,{sx:{display:"flex",alignItems:"center",mt:44},children:[ut.jsxs(m,{children:[ut.jsx(I,{variant:"rounded",height:24,width:100}),ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"rSayea",message:"APY"})})]}),ut.jsx(m,{sx:{display:"inline-block",mx:20,height:24,width:"1px",backgroundColor:"custom.border.default"}}),ut.jsxs(m,{children:[ut.jsx(I,{variant:"rounded",height:24,width:100}),ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"FHKsZF",message:"TVL"})})]})]}),ut.jsx(I,{variant:"rounded",height:32})]})}function Bu({chainId:e,baseToken:t,quoteToken:o,apy:i,hasQuote:r,hasMining:a,sx:l,children:s}){if(!t)return null;const d=r?[{token:t,transactionApy:null==i?void 0:i.transactionBaseApy,miningApy:null==i?void 0:i.miningBaseApy},{token:o,transactionApy:null==i?void 0:i.transactionQuoteApy,miningApy:null==i?void 0:i.miningQuoteApy}]:[{transactionApy:null==i?void 0:i.transactionBaseApy,miningApy:null==i?void 0:i.miningBaseApy}];return ut.jsx(L,{children:null!=s?s:ut.jsx(y,{component:$e.QuestionBorder,sx:Object.assign({width:15,height:15},l)}),title:ut.jsx(m,{sx:{width:236},children:d.map(((i,r)=>{var l,s,d,c;return ut.jsxs(m,{sx:{mt:0===r?0:20},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",typography:"body2",fontWeight:600,color:"text.primary"},children:[ut.jsx(m,{sx:{display:"flex",alignItems:"center"},children:i.token?ut.jsxs(ut.Fragment,{children:[ut.jsx(Kl,{width:14,height:14,marginRight:4,address:i.token.address,url:i.token.logoURI,chainId:e,noShowChain:!0}),i.token.symbol]}):ut.jsxs(ut.Fragment,{children:[ut.jsx(Fc,{tokens:[t,o],width:14,mr:4,chainId:e}),t.symbol,"/",null==o?void 0:o.symbol]})}),ut.jsx(m,{children:Vr(new te(null!==(d=i.transactionApy)&&void 0!==d?d:0).plus(null!==(c=i.miningApy)&&void 0!==c?c:0))})]}),ut.jsxs(m,{sx:{mt:8,display:"flex",justifyContent:"space-between",typography:"h6",color:"text.secondary"},children:[ut.jsx("span",{children:ut.jsx(n,{id:"OnDEky",message:"LP Fee"})}),ut.jsx("span",{children:i.transactionApy?Vr(new te(i.transactionApy)):"-"})]}),a?ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",typography:"h6",color:"text.secondary"},children:[ut.jsx("span",{children:ut.jsx(n,{id:"pSQ1lM",message:"MT Fee"})}),ut.jsx("span",{children:i.miningApy?Vr(new te(i.miningApy)):"-"})]}):""]},null!==(s=null===(l=i.token)||void 0===l?void 0:l.address)&&void 0!==s?s:1)}))})})}function Uu({sx:e,value:t,onChange:i,searchAddress:r}){const[a,l]=X.useState(!1),{isMobile:s}=Kd();return ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{component:S,sx:Object.assign(Object.assign({typography:"body2",display:"flex",alignItems:"center",justifyContent:"flex-start",px:12,height:32,backgroundColor:"background.tag",color:"text.secondary",borderRadius:8,fontWeight:600},s?{}:{minWidth:220}),e),onClick:()=>l(!0),children:[ut.jsx(m,{component:$e.Search,sx:{width:16,height:16,mr:8,flexShrink:0}}),ut.jsx(n,{id:"A1taO8",message:"Search"})]}),ut.jsx(dc,{value:t,open:a,multiple:!0,title:ut.jsx(n,{id:"o8aMNm",message:"Select a liquidity pool"}),searchPlaceholder:o._({id:"4nzwq3",message:"Search by token or pool address"}),onClose:()=>{l(!1)},onTokenChange:e=>{if(Array.isArray(e)){if(e.length>2){const t=[e[0],e[2]];i(t)}else i(e);l(!1)}},searchOtherAddress:e=>r(e,(()=>l(!1))),modal:!0})]})}function Du({list:e,onClick:t}){return ut.jsx(ut.Fragment,{children:null==e?void 0:e.map((e=>{var o,i,r,a;if(!(null==e?void 0:e.pair))return null;const l=e.pair,s=eu(l.baseToken,l.chainId),d=eu(l.quoteToken,l.chainId),c=l.apy?Vr(new te(null===(o=l.apy)||void 0===o?void 0:o.transactionBaseApy).plus(null!==(r=null===(i=l.apy)||void 0===i?void 0:i.miningBaseApy)&&void 0!==r?r:0)):void 0,u=p.utils.singleSideLp(l.type)&&l.apy?Vr(new te(l.apy.transactionQuoteApy).plus(null!==(a=l.apy.miningQuoteApy)&&void 0!==a?a:0)):void 0;return s&&d?ut.jsxs(m,{onClick:t,sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:10,py:20,borderRadius:8,cursor:"pointer","&:hover":{backgroundColor:"custom.background.listHover"}},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(Fc,{tokens:[s,d],chainId:l.chainId,width:24,mr:10}),ut.jsxs(m,{sx:{typography:"h5"},children:[s.symbol,"/",d.symbol]})]}),ut.jsxs(m,{children:[ut.jsxs(m,{sx:{color:"custom.status.green.default",fontWeight:600},children:[c,u?`/${u}`:""]}),ut.jsx(m,{sx:{mt:2,typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"rSayea",message:"APY"})})]})]},l.id):null}))})}function Yu(){const[e,t]=X.useState([]),[n,o]=X.useState([]),[i,r]=X.useMemo((()=>{const[t,n]=e;return[null==t?void 0:t.symbol,null==n?void 0:n.symbol]}),[e]);return{filterTokens:e,filterASymbol:i,filterBSymbol:r,filterAddressLqList:n,handleDeleteToken:e=>{t((t=>{const n=[...t],o=n.indexOf(e);return-1!==o&&n.splice(o,1),n}))},handleChangeFilterTokens:e=>{o([]),t(e)},handleChangeFilterAddress:e=>{o(e),t([])}}}function zu({lqList:e,setOperatePool:t,supportAMM:o}){const i=g();return ut.jsx(ut.Fragment,{children:null==e?void 0:e.map((e=>{var r,a,l,s,d,c,u;if(!(null==e?void 0:e.pair))return null;const h=e.pair,f=eu(h.baseToken,h.chainId),g=eu(h.quoteToken,h.chainId),x=h.apy?Vr(new te(null===(r=h.apy)||void 0===r?void 0:r.transactionBaseApy).plus(null!==(l=null===(a=h.apy)||void 0===a?void 0:a.miningBaseApy)&&void 0!==l?l:0)):void 0,y=p.utils.singleSideLp(h.type)&&h.apy?Vr(new te(h.apy.transactionQuoteApy).plus(null!==(s=h.apy.miningQuoteApy)&&void 0!==s?s:0)):void 0,b=!!(null===(d=h.miningAddress)||void 0===d?void 0:d[0]),j=ou(h.type);return ut.jsx(m,{sx:{p:8,borderRadius:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"border.disabled",backdropFilter:"blur(5px)"},children:ut.jsxs(m,{sx:{px:20,pt:20,pb:12,backgroundColor:"background.paper",borderRadius:16,borderWidth:1,borderStyle:"solid",borderColor:"border.main"},className:"gradient-card-border",onClick:()=>{o||fc.getState().push({type:hc.PoolDetail,params:{chainId:h.chainId,address:h.id}})},children:[ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap"},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:8},children:[f&&g?ut.jsx(Fc,{tokens:[f,g],width:24,mr:6,chainId:h.chainId,showChainLogo:!0}):"",ut.jsxs(m,{sx:{typography:"body2",fontWeight:600},children:[`${null==f?void 0:f.symbol}/${null==g?void 0:g.symbol}`,ut.jsx(Ru,{address:h.id,chainId:h.chainId})]})]}),b?ut.jsxs(m,{sx:{p:8,typography:"h6",fontWeight:"bold",background:`linear-gradient(180deg, ${T(i.palette.secondary.main,.3)} 0%, ${T(i.palette.purple.main,.3)} 100%)`,borderRadius:8,color:"purple.main",whiteSpace:"nowrap"},children:["✨ ",ut.jsx(n,{id:"Sti4vy",message:"Mining"})]}):""]}),ut.jsxs(m,{sx:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",rowGap:20,mt:44,"& > div:nth-child(odd)":{pr:20},"& > div:nth-child(even)":{position:"relative",pl:20,"&::before":{position:"absolute",left:0,top:"50%",transform:"translateY(-50%)",display:"inline-block",content:'""',height:24,width:"1px",backgroundColor:"border.main"}}},children:[o&&ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4,whiteSpace:"nowrap"},children:[j,ut.jsx(L,{title:ut.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:ut.jsx(m,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:iu({type:h.type,lpFeeRate:null!==(c=h.lpFeeRate)&&void 0!==c?c:0,mtFeeRate:null!==(u=h.mtFeeRate)&&void 0!==u?u:0})})})]}),ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"1Qz63U",message:"Pool Type"})})]}),ut.jsxs(m,{children:[ut.jsxs(m,{sx:{typography:"h5",color:"success.main"},children:[x,y?`/${y}`:""]}),ut.jsxs(m,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:[ut.jsx(n,{id:"rSayea",message:"APY"}),ut.jsx(Bu,{chainId:h.chainId,apy:h.apy,baseToken:f,quoteToken:g,hasQuote:!!y,hasMining:b,sx:{width:14,height:14}})]})]}),ut.jsxs(m,{children:[ut.jsxs(m,{sx:{typography:"h5"},children:["$",Lr(new te(h.tvl))]}),ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"FHKsZF",message:"TVL"})})]}),o&&ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4},children:["$",br({input:h.volume24H||0})]}),ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"Q8W3SC",message:"Volume (1D)"})})]})]}),ut.jsxs(m,{sx:{mt:20,display:"flex",gap:"8px"},children:[ut.jsx(Pd,{fullWidth:!0,size:v.Size.small,onClick:n=>{n.stopPropagation(),t({pool:tu(e),hasMining:b})},children:ut.jsx(n,{id:"m16xKo",message:"Add"})}),o&&"PMM"===j&&ut.jsx(Au,{chainId:h.chainId,address:h.id})]})]})},h.id+h.chainId)}))})}function Xu({lqList:e,operatePool:t,setOperatePool:i,hasMore:r,loadMore:a,loadMoreLoading:l,supportAMM:s}){const d=g();return ut.jsxs(Hu,{hasMore:r,loadMore:a,loadMoreLoading:l,children:[ut.jsx(m,{component:"thead",children:ut.jsxs(m,{component:"tr",children:[ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"AxdOHo",message:"Pair"})}),s&&ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"1Qz63U",message:"Pool Type"})}),ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"FHKsZF",message:"TVL"})}),ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"rSayea",message:"APY"})}),s&&ut.jsx("th",{children:ut.jsx(n,{id:"Q8W3SC",message:"Volume (1D)"})}),ut.jsx(m,{component:"th",sx:{width:80}})]})}),ut.jsx(m,{component:"tbody",children:null==e?void 0:e.map((e=>{var r,a,l,c,u,h,f,g;if(!(null==e?void 0:e.pair))return null;const x=e.pair,y=eu(x.baseToken,x.chainId),b=eu(x.quoteToken,x.chainId),j=x.apy?Vr(new te(null===(r=x.apy)||void 0===r?void 0:r.transactionBaseApy).plus(null!==(l=null===(a=x.apy)||void 0===a?void 0:a.miningBaseApy)&&void 0!==l?l:0)):void 0,C=p.utils.singleSideLp(x.type)&&x.apy?Vr(new te(x.apy.transactionQuoteApy).plus(null!==(c=x.apy.miningQuoteApy)&&void 0!==c?c:0)):void 0;let w="";if((null===(u=null==t?void 0:t.pool)||void 0===u?void 0:u.address)===x.id||(null==t?void 0:t.address)===x.id)if(t.operate===au.Remove)w=o._({id:"0+31GV",message:"Removing"});else w=o._({id:"1yHVE+",message:"Adding"});const k=!!(null===(h=x.miningAddress)||void 0===h?void 0:h[0]),R=ou(x.type),M=d.palette.background.tag;return ut.jsxs(m,{component:"tr",sx:{["&:hover td"+(w?", & td":"")]:{backgroundImage:`linear-gradient(${M}, ${M})`}},children:[ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[y&&b?ut.jsx(Fc,{tokens:[y,b],width:24,mr:10,chainId:x.chainId,showChainLogo:!0}):"",ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[`${null==y?void 0:y.symbol}/${null==b?void 0:b.symbol}`,ut.jsx(Ru,{address:x.id,chainId:x.chainId})]}),ut.jsx(Oc,{address:x.id,customChainId:x.chainId,truncate:!0,showCopy:!0,iconDarkHover:!0,iconSize:14,iconSpace:4,sx:{typography:"h6",color:"text.secondary"},disabledAddress:s,onAddressClick:()=>{fc.getState().push({type:hc.PoolDetail,params:{chainId:x.chainId,address:x.id}})}})]})]})}),s&&ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4},children:[ut.jsx(m,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary",whiteSpace:"nowrap"},children:R}),ut.jsx(L,{title:ut.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:ut.jsx(m,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:iu({type:x.type,lpFeeRate:null!==(f=x.lpFeeRate)&&void 0!==f?f:0,mtFeeRate:null!==(g=x.mtFeeRate)&&void 0!==g?g:0})})})]})}),ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{typography:"body2"},title:x.tvl?`$${br({input:x.tvl})}`:void 0,children:["$",Lr(new te(x.tvl))]})}),ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[k?ut.jsx(L,{title:o._({id:"Sti4vy",message:"Mining"}),children:ut.jsxs(m,{component:"span",sx:{typography:"body2",color:"success.main"},children:["✨"," "]})}):"",ut.jsx(Bu,{chainId:x.chainId,apy:x.apy,baseToken:y,quoteToken:b,hasQuote:!!C,hasMining:k,children:ut.jsxs(m,{component:"span",sx:{typography:"body2",fontWeight:600,display:"flex",alignItems:"center",width:"max-content",color:"success.main",cursor:"auto"},children:[j,C?`/${C}`:""]})})]})}),s&&ut.jsxs(m,{component:"td",children:["$",br({input:x.volume24H||0})]}),ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[s&&"PMM"===R&&ut.jsx(Au,{chainId:x.chainId,address:x.id}),w?ut.jsx(Zu,{text:w,onClick:()=>i(null)}):ut.jsx(v,{size:v.Size.small,onClick:()=>{i({pool:tu(e),hasMining:k})},children:o._({id:"m16xKo",message:"Add"})})]})})]},x.id+x.chainId)}))})]})}function qu({scrollParentRef:e,filterChainIds:t,activeChainId:n,handleChangeActiveChainId:o,operatePool:i,setOperatePool:r}){var a;const{onlyChainId:l,supportAMMV2:s,supportAMMV3:d,notSupportPMM:c}=ar(),{minDevice:u,isMobile:h}=Kd(),f=xe(),{filterTokens:g,filterASymbol:x,filterBSymbol:v,filterAddressLqList:y,handleDeleteToken:b,handleChangeFilterTokens:j,handleChangeFilterAddress:C}=Yu(),w=[];s&&w.push("SVM_AMMV2"),d&&w.push("SVM_AMMV3");const k={chainIds:t,pageSize:h?4:8,filterState:{viewOnlyOwn:!1,filterTypes:w}},R=wa(),M=R.getInfiniteQuery(p.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},k),{filterState:Object.assign({filterASymbol:x,filterBSymbol:v},k.filterState)})}),S=Ce(Object.assign(Object.assign({},M),{initialPageParam:1,getNextPageParam:e=>{var t;const{currentPage:n,totalCount:o,pageSize:i}=null!==(t=e.liquidity_list)&&void 0!==t?t:{};if(!n||!o||!i)return null;let r=Math.floor(o/i);return o%i&&(r+=1),n>=r?null:n+1}}));let E=[];const T=!!(null==y?void 0:y.length);T?E=[...y]:null===(a=S.data)||void 0===a||a.pages.forEach((e=>{var t,n;null===(n=null===(t=e.liquidity_list)||void 0===t?void 0:t.lqList)||void 0===n||n.forEach((e=>{null==E||E.push(e)}))}));const W=S.hasNextPage&&!T;return ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{sx:Object.assign(Object.assign({py:16,display:"flex",gap:8},u(475)?{}:{flexDirection:"column"}),h?{}:{px:20,borderBottomWidth:1}),children:[ut.jsxs(m,{sx:Object.assign({display:"flex",alignItems:"center",gap:8},u(475)?{}:{"& > button":{flex:1}}),children:[!l&&ut.jsx(Ou,{chainId:n,setChainId:o}),ut.jsx(Uu,{value:g,onChange:j,searchAddress:(e,t)=>or(this,void 0,void 0,(function*(){var n;const o=R.getInfiniteQuery(p.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},k),{filterState:Object.assign({address:e},k.filterState)})}),i=null===(n=(yield f.fetchQuery(o)).liquidity_list)||void 0===n?void 0:n.lqList;return(null==i?void 0:i.length)?ut.jsx(Du,{list:i,onClick:()=>{C(i),t()}}):null}))})]}),(T||!!g.length)&&ut.jsxs(m,{sx:{my:0},children:[T?ut.jsx(Fu,{lqList:y,onDeleteTag:()=>C([])}):"",ut.jsx(Nu,{tags:g,onDeleteTag:b})]})]}),h?ut.jsx(Qe,{hasMore:W,threshold:300,loadMore:le((()=>{S.hasNextPage&&!S.isFetching&&S.fetchNextPage()}),500),useWindow:!1,getScrollParent:()=>e.current||null,loader:ut.jsx(Pu,{sx:{mt:20}},"loader"),children:ut.jsxs(ku,{gap:12,children:[S.isLoading?ut.jsx(Pu,{}):"",!S.isLoading&&!(null==E?void 0:E.length)&&!S.error&&ut.jsx(yu,{sx:{mt:40},hasSearch:!!(n&&!l||x||v)}),!!S.error&&ut.jsx(Cu,{refresh:S.refetch,sx:{mt:40}}),ut.jsx(zu,{lqList:E,setOperatePool:r,supportAMM:s||d})]})}):ut.jsxs(ut.Fragment,{children:[ut.jsx(Xu,{lqList:E,operatePool:i,setOperatePool:r,hasMore:W,loadMoreLoading:S.isFetchingNextPage,loadMore:()=>{S.hasNextPage&&!S.isFetching&&S.fetchNextPage()},supportAMM:s||d}),ut.jsx(wu,{loading:S.isLoading,refetch:S.error?S.refetch:void 0,empty:!(null==E?void 0:E.length),hasSearch:!!(n&&!l||x||v)})]})]})}function Ju({onClick:e,title:t,desc:n}){const o=g();return ut.jsx(m,{sx:{mx:20,px:0,py:14,borderTop:`1px solid ${o.palette.border.main}`,[o.breakpoints.up("tablet")]:{borderTop:"none",mx:0,px:16,py:8}},children:ut.jsxs(S,{onClick:e,sx:{width:"100%",display:"flex",flexDirection:"column",gap:0,p:0,borderRadius:8,"&:hover":{backgroundColor:o.palette.background.tag},[o.breakpoints.up("tablet")]:{p:8}},children:[ut.jsx(m,{sx:{typography:"body1",fontWeight:600,color:o.palette.text.primary,textAlign:"left"},children:t}),ut.jsx(m,{sx:{typography:"h6",fontWeight:500,color:o.palette.text.secondary,textAlign:"left"},children:n})]})})}const Gu=e=>{const t=g(),{isMobile:o}=Kd(),{supportAMMV2:i,supportAMMV3:r,notSupportPMM:a}=ar(),[l,s]=X.useState(!1),d={[hc.CreatePool]:!a,[hc.createPoolAMMV2]:!!i,[hc.createPoolAMMV3]:!!r},c=Object.entries(d).filter((([e,t])=>!0===t)),u=1===c.length?c[0][0]:void 0;if(!u){const e=ut.jsxs(ut.Fragment,{children:[!a&&ut.jsx(Ju,{onClick:()=>{fc.getState().push({type:hc.CreatePool})},title:ut.jsx(n,{id:"Eif7f6",message:"PMM Pool"}),desc:ut.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})}),i&&ut.jsx(Ju,{onClick:()=>{fc.getState().push({type:hc.createPoolAMMV2})},title:ut.jsx(n,{id:"lNYomJ",message:"AMM V2 Position"}),desc:ut.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})}),r&&ut.jsx(Ju,{onClick:()=>{fc.getState().push({type:hc.createPoolAMMV3})},title:ut.jsx(n,{id:"sVlqoo",message:"AMM V3 Position"}),desc:ut.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})})]});return o?ut.jsxs(ut.Fragment,{children:[ut.jsxs(v,{variant:v.Variant.outlined,fullWidth:o,onClick:()=>{s(!0)},sx:{height:40},children:[ut.jsx(m,{component:$e.Plus,sx:{mr:4}}),ut.jsx(n,{id:"p2jbcE",message:"Create Pool"})]}),ut.jsx(Ed,{open:l,title:ut.jsx(n,{id:"p2jbcE",message:"Create Pool"}),onClose:()=>{s(!1)},modal:!0,children:ut.jsx(m,{sx:{mb:0},children:e})})]}):ut.jsx(L,{arrow:!1,leaveDelay:300,placement:o?"bottom":"bottom-end",sx:{p:0,backgroundColor:"background.paper"},title:ut.jsx(m,{children:e}),children:ut.jsxs(m,{sx:{width:o?"100%":"auto",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:10,pl:8,pr:16,py:7,borderRadius:8,borderWidth:1,borderColor:t.palette.text.primary,typography:"body1",fontWeight:600,color:t.palette.text.primary,cursor:"pointer","&:hover":{backgroundColor:t.palette.background.tag}},children:[ut.jsx(m,{component:$e.Plus}),ut.jsx(n,{id:"p2jbcE",message:"Create Pool"})]})})}return ut.jsxs(v,{variant:v.Variant.outlined,fullWidth:o,onClick:()=>{fc.getState().push({type:u})},sx:{height:40},children:[ut.jsx(m,{component:$e.Plus,sx:{mr:4}}),ut.jsx(n,{id:"p2jbcE",message:"Create Pool"})]})};const Qu=({outOfRange:e})=>{const t=g();return ut.jsx(L,{title:e?o._({id:"i3Z+/Z",message:"Out of range"}):o._({id:"vOyUlD",message:"In range"}),children:ut.jsx(m,{sx:{display:"flex",alignItems:"center"},children:e?ut.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:ut.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.583252 12.5416L6.99992 1.45825L13.4166 12.5416H0.583252ZM11.3924 11.3749L6.9999 3.78575L2.6074 11.3749H11.3924ZM7.58328 9.62492H6.41661V10.7916H7.58328V9.62492ZM6.41661 6.12492H7.58328V8.45825H6.41661V6.12492Z",fill:t.palette.warning.main})}):ut.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",children:ut.jsx("circle",{cx:"4",cy:"4",r:"4",fill:t.palette.success.main})})})})};var _u,Ku,$u;function ep({price:e,atLimit:t,direction:n}){return t[n]?n===Ku.LOWER?"0":"∞":"string"==typeof e&&"∞"===e?"∞":jr({input:e})}!function(e){e.MINT_1="MINT_1",e.MINT_2="MINT_2"}(_u||(_u={})),function(e){e.LOWER="LOWER",e.UPPER="UPPER"}(Ku||(Ku={})),function(e){e.TOKEN0="TOKEN0",e.TOKEN1="TOKEN1"}($u||($u={}));const tp=({onlyV3:e,setOnlyV3:t,sx:n})=>{const i=g(),{notSupportPMM:r}=ar();return ut.jsx(m,{component:S,onClick:()=>t(!e),sx:Object.assign({display:"flex",alignItems:"center",p:2,borderRadius:8,backgroundColor:i.palette.border.main},n),children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center",width:"100%",[i.breakpoints.up("tablet")]:{width:194}},children:[ut.jsx(m,{sx:Object.assign({flex:1,width:0,pt:4,pb:5,borderRadius:6,textAlign:"center",typography:"body2",whiteSpace:"nowrap"},e?{color:i.palette.text.primary,backgroundColor:i.palette.background.paper}:{color:i.palette.text.secondary,backgroundColor:"transparent"}),children:o._({id:"yoR+O6",message:"V3"})}),ut.jsx(m,{sx:Object.assign({flex:1,width:0,pt:4,pb:5,borderRadius:6,textAlign:"center",typography:"body2",whiteSpace:"nowrap"},e?{color:i.palette.text.secondary,backgroundColor:"transparent"}:{color:i.palette.text.primary,backgroundColor:i.palette.background.paper}),children:r?"V2":o._({id:"eK6I8d",message:"V2 & PMM"})})]})})};function np({account:e,lqList:t,setOperatePool:o,supportAMM:i}){const r=g();return ut.jsx(ut.Fragment,{children:null==t?void 0:t.map((t=>{var a,l,s,d,c,u,h,f,g,x,y,b,j,C;if(!(null==t?void 0:t.pair))return null;const w=t.pair,k=eu(w.baseToken,w.chainId),R=eu(w.quoteToken,w.chainId),M=p.utils.singleSideLp(w.type),S=w.apy?Vr(new te(null===(a=w.apy)||void 0===a?void 0:a.transactionBaseApy).plus(null!==(s=null===(l=w.apy)||void 0===l?void 0:l.miningBaseApy)&&void 0!==s?s:0)):"0%",E=M&&w.apy?Vr(new te(w.apy.transactionQuoteApy).plus(null!==(d=w.apy.miningQuoteApy)&&void 0!==d?d:0)):void 0;let W,I;(null===(c=t.liquidityPositions)||void 0===c?void 0:c.length)&&t.liquidityPositions.forEach((e=>{var t,n,o,i,r;if(null==e?void 0:e.liquidityTokenBalance){const a=null===(t=e.id)||void 0===t?void 0:t.split("-");if(2===(null==a?void 0:a.length)){const t=a[1].toLocaleLowerCase();if((null===(o=null===(n=null==w?void 0:w.baseLpToken)||void 0===n?void 0:n.id)||void 0===o?void 0:o.toLocaleLowerCase())===t)return void(W=new te(e.liquidityTokenBalance));(null===(r=null===(i=null==w?void 0:w.quoteLpToken)||void 0===i?void 0:i.id)||void 0===r?void 0:r.toLocaleLowerCase())===t&&(I=new te(e.liquidityTokenBalance))}}}));const V=!!(null===(u=w.miningAddress)||void 0===u?void 0:u[0]),O=null===(h=t.liquidityPositions)||void 0===h?void 0:h[0],Z=w.type,F=ou(Z),N="SVM_AMMV2"===Z,A="SVM_AMMV3"===Z;return ut.jsx(m,{sx:{p:8,borderRadius:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"border.disabled",backdropFilter:"blur(5px)"},children:ut.jsxs(m,{sx:{px:20,pt:20,pb:12,backgroundColor:"background.paper",borderRadius:16,borderWidth:1,borderStyle:"solid",borderColor:"border.main"},className:"gradient-card-border",onClick:()=>{i||fc.getState().push({type:hc.PoolDetail,params:{chainId:w.chainId,address:w.id}})},children:[ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap"},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:8},children:[k&&R?ut.jsx(Fc,{tokens:[k,R],width:24,mr:6,chainId:w.chainId,showChainLogo:!0}):"",ut.jsxs(m,{sx:{typography:"body2",fontWeight:600},children:[`${null==k?void 0:k.symbol}/${null==R?void 0:R.symbol}`,ut.jsx(Ru,{address:w.id,chainId:w.chainId})]})]}),V?ut.jsxs(m,{sx:{p:8,typography:"h6",fontWeight:"bold",background:`linear-gradient(180deg, ${T(r.palette.secondary.main,.3)} 0%, ${T(r.palette.purple.main,.3)} 100%)`,borderRadius:8,color:"purple.main",whiteSpace:"nowrap"},children:["✨ ",ut.jsx(n,{id:"Sti4vy",message:"Mining"})]}):""]}),ut.jsxs(m,{sx:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",rowGap:20,mt:44,"& > div:nth-child(odd)":{pr:20},"& > div:nth-child(even)":{position:"relative",pl:20,"&::before":{position:"absolute",left:0,top:"50%",transform:"translateY(-50%)",display:"inline-block",content:'""',height:24,width:"1px",backgroundColor:"border.main"}}},children:[i&&ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4,whiteSpace:"nowrap"},children:[F,ut.jsx(L,{title:ut.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:ut.jsx(m,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:iu({type:w.type,lpFeeRate:null!==(f=w.lpFeeRate)&&void 0!==f?f:0,mtFeeRate:null!==(g=w.mtFeeRate)&&void 0!==g?g:0})})})]}),ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"1Qz63U",message:"Pool Type"})})]}),A?null:ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{children:[ut.jsxs(m,{sx:{typography:"h5",color:"success.main"},children:[S,E?`/${E}`:""]}),ut.jsxs(m,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:[ut.jsx(n,{id:"rSayea",message:"APY"}),ut.jsx(Bu,{chainId:w.chainId,apy:w.apy,baseToken:k,quoteToken:R,hasQuote:!!E,hasMining:V,sx:{width:14,height:14}})]})]}),ut.jsxs(m,{children:[ut.jsxs(m,{sx:{typography:"h5"},children:["$",Lr(new te(w.tvl||0))]}),ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"FHKsZF",message:"TVL"})})]})]}),N&&ut.jsxs(m,{children:[ut.jsx(m,{sx:{typography:"h5"},children:Ir({input:null===(y=null===(x=t.liquidityPositions)||void 0===x?void 0:x[0])||void 0===y?void 0:y.poolShare})}),ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"h3PbRN",message:"My Pool Share"})})]}),ut.jsxs(m,{children:[ut.jsx(m,{sx:{typography:"h5",display:"flex",alignItems:"center",fontWeight:"bold"},children:A?(null==O?void 0:O.liquidityUSD)?`$${jr({input:O.liquidityUSD,decimals:2})}`:"-":ut.jsxs(ut.Fragment,{children:[M?ut.jsx(Kl,{address:null==k?void 0:k.address,chainId:w.chainId,url:null==k?void 0:k.logoURI,width:18,height:18,sx:{mr:4}}):ut.jsx(Fc,{tokens:k&&R?[k,R]:[],width:18,mr:4,showChainLogo:!1,chainId:w.chainId}),W?br({input:W}):"",M&&ut.jsxs(ut.Fragment,{children:[" / ",ut.jsx(Kl,{address:null==R?void 0:R.address,chainId:w.chainId,url:null==R?void 0:R.logoURI,width:18,height:18,sx:{mx:4}}),I?br({input:I}):"0"]})]})}),ut.jsx(m,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:ut.jsx(n,{id:"YHc3B+",message:"My Liquidity"})})]}),A&&ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4,color:"text.primary"},children:[ut.jsx(Qu,{outOfRange:null!==(b=null==O?void 0:O.outOfRange)&&void 0!==b&&b}),ut.jsx(m,{children:ut.jsxs(ut.Fragment,{children:[ut.jsxs("span",{children:[ep({price:null===(j=null==O?void 0:O.priceRange)||void 0===j?void 0:j.token0LowerPrice,atLimit:{},direction:Ku.LOWER})," "]}),null==k?void 0:k.symbol]})}),ut.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:ut.jsx("path",{d:"M15.75 9.50293L12.75 12.5029L11.7 11.4529L12.8813 10.2529L5.11875 10.2529L6.3 11.4529L5.25 12.5029L2.25 9.50293L5.25 6.50293L6.31875 7.55293L5.11875 8.75293L12.8813 8.75293L11.7 7.55293L12.75 6.50293L15.75 9.50293Z",fill:"currentColor",fillOpacity:"0.5"})}),ut.jsx(m,{children:ut.jsxs(ut.Fragment,{children:[ut.jsxs("span",{children:[ep({price:null===(C=null==O?void 0:O.priceRange)||void 0===C?void 0:C.token1LowerPrice,atLimit:{},direction:Ku.UPPER})," "]}),null==k?void 0:k.symbol]})})]}),ut.jsx(m,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:ut.jsx(n,{id:"YA4hwj",message:"Price Range"})})]})]}),ut.jsxs(m,{sx:{mt:20,display:"flex",gap:"8px"},children:[A?null:!!e&&ut.jsx(Pd,{fullWidth:!0,variant:v.Variant.outlined,size:v.Size.small,onClick:e=>{e.stopPropagation(),o({operate:au.Remove,pool:nu(t),hasMining:V})},children:ut.jsx(n,{id:"t/YqKh",message:"Remove"})}),ut.jsx(Pd,{fullWidth:!0,size:v.Size.small,onClick:e=>{e.stopPropagation(),o({operate:au.Add,pool:nu(t),hasMining:V})},children:ut.jsx(n,{id:"J/hVSQ",message:"{0}",values:{0:A?"Manage":"Add"}})}),i&&"PMM"===F&&ut.jsx(Au,{chainId:w.chainId,address:w.id})]})]})},A?null==O?void 0:O.id:w.id+w.chainId)}))})}function op({account:e,lqList:t,operatePool:i,setOperatePool:r,supportAMM:a,onlyV3:l}){const s=g();return ut.jsxs(Hu,{children:[ut.jsx(m,{component:"thead",children:ut.jsxs(m,{component:"tr",children:[ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"AxdOHo",message:"Pair"})}),a&&ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"1Qz63U",message:"Pool Type"})}),l?null:ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"FHKsZF",message:"TVL"})}),l?null:ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"rSayea",message:"APY"})}),ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"YHc3B+",message:"My Liquidity"})}),l?ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"YA4hwj",message:"Price Range"})}):null,ut.jsx(m,{component:"th",sx:{width:210}})]})}),ut.jsx(m,{component:"tbody",children:null==t?void 0:t.map((t=>{var d,c,u,h,f,g,x,y,b,j,C,w,k,R,M,S,E,T;if(!(null==t?void 0:t.pair))return null;const W=t.pair,I=eu(W.baseToken,W.chainId),V=eu(W.quoteToken,W.chainId),O=p.utils.singleSideLp(W.type),Z=W.apy?Vr(new te(null===(d=W.apy)||void 0===d?void 0:d.transactionBaseApy).plus(null!==(u=null===(c=W.apy)||void 0===c?void 0:c.miningBaseApy)&&void 0!==u?u:0)):void 0,F=O&&W.apy?Vr(new te(W.apy.transactionQuoteApy).plus(null!==(h=W.apy.miningQuoteApy)&&void 0!==h?h:0)):void 0;let N,A;(null===(f=t.liquidityPositions)||void 0===f?void 0:f.length)&&t.liquidityPositions.forEach((e=>{var t,n,o,i,r;if(null==e?void 0:e.liquidityTokenBalance){const a=null===(t=e.id)||void 0===t?void 0:t.split("-");if(2===(null==a?void 0:a.length)){const t=a[1].toLocaleLowerCase();if((null===(o=null===(n=null==W?void 0:W.baseLpToken)||void 0===n?void 0:n.id)||void 0===o?void 0:o.toLocaleLowerCase())===t)return void(N=new te(e.liquidityTokenBalance));(null===(r=null===(i=null==W?void 0:W.quoteLpToken)||void 0===i?void 0:i.id)||void 0===r?void 0:r.toLocaleLowerCase())===t&&(A=new te(e.liquidityTokenBalance))}}}));const H=null===(g=t.liquidityPositions)||void 0===g?void 0:g[0],P=W.type,B=ou(P),U="SVM_AMMV2"===P,D="SVM_AMMV3"===P;let Y="";if(D)(null===(b=null===(y=null===(x=null==i?void 0:i.pool)||void 0===x?void 0:x.liquidityPositions)||void 0===y?void 0:y[0])||void 0===b?void 0:b.id)===(null==H?void 0:H.id)&&(Y=o._({id:"p3607o",message:"Managing"}));else if((null===(j=null==i?void 0:i.pool)||void 0===j?void 0:j.address)===W.id||(null==i?void 0:i.address)===W.id)if(i.operate===au.Remove)Y=o._({id:"0+31GV",message:"Removing"});else Y=o._({id:"1yHVE+",message:"Adding"});const z=!!(null===(C=W.miningAddress)||void 0===C?void 0:C[0]),X=s.palette.background.tag;return ut.jsxs(m,{component:"tr",sx:{["&:hover td"+(Y?", & td":"")]:{backgroundImage:`linear-gradient(${X}, ${X})`}},children:[ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[I&&V?ut.jsx(Fc,{tokens:[I,V],width:24,mr:10,chainId:W.chainId,showChainLogo:!0}):"",ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[`${null==I?void 0:I.symbol}/${null==V?void 0:V.symbol}`,ut.jsx(Ru,{address:W.id,chainId:W.chainId})]}),ut.jsx(Oc,{address:W.id,customChainId:W.chainId,truncate:!0,showCopy:!0,iconDarkHover:!0,iconSize:14,iconSpace:4,disabledAddress:a,onAddressClick:()=>{fc.getState().push({type:hc.PoolDetail,params:{chainId:W.chainId,address:W.id}})},sx:{typography:"h6",color:"text.secondary"}})]})]})}),a&&ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4},children:[ut.jsx(m,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary",whiteSpace:"nowrap"},children:B}),ut.jsx(L,{title:ut.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:ut.jsx(m,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:iu({type:W.type,lpFeeRate:null!==(w=W.lpFeeRate)&&void 0!==w?w:0,mtFeeRate:null!==(k=W.mtFeeRate)&&void 0!==k?k:0})})})]})}),D?null:ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{typography:"body2"},title:W.tvl?`$${br({input:W.tvl||0})}`:void 0,children:["$",Lr(new te(W.tvl||0))]})}),D?null:ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[z?ut.jsx(L,{title:o._({id:"Sti4vy",message:"Mining"}),children:ut.jsxs(m,{component:"span",sx:{typography:"body2",color:"success.main"},children:["✨"," "]})}):"",ut.jsx(Bu,{chainId:W.chainId,apy:W.apy,baseToken:I,quoteToken:V,hasQuote:!!F,hasMining:z,children:ut.jsxs(m,{component:"span",sx:{typography:"body2",fontWeight:600,display:"flex",alignItems:"center",width:"max-content",color:"success.main",cursor:"auto"},children:[Z||"0%",F?`/${F}`:""]})})]})}),ut.jsx(m,{component:"td",children:ut.jsx(m,{sx:{display:"flex",alignItems:"center"},children:D?(null==H?void 0:H.liquidityUSD)?`$${jr({input:H.liquidityUSD,decimals:2})}`:"-":ut.jsxs(ut.Fragment,{children:[O?ut.jsx(Kl,{address:null==I?void 0:I.address,chainId:W.chainId,url:null==I?void 0:I.logoURI,width:24,height:24,noShowChain:!0,sx:{mr:4}}):ut.jsx(Fc,{tokens:I&&V?[I,V]:[],width:24,mr:4,showChainLogo:!1,chainId:W.chainId}),N?br({input:N}):"-",O&&ut.jsxs(ut.Fragment,{children:[" / ",ut.jsx(Kl,{address:null==V?void 0:V.address,chainId:W.chainId,url:null==V?void 0:V.logoURI,width:24,height:24,noShowChain:!0,sx:{mx:4}}),A?br({input:A}):"0"]}),U&&ut.jsx(L,{title:ut.jsx(n,{id:"NXZdrO",message:"My pool share"}),children:ut.jsx(m,{sx:{ml:4,px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Ir({input:null===(M=null===(R=t.liquidityPositions)||void 0===R?void 0:R[0])||void 0===M?void 0:M.poolShare})})})]})})}),l?ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4,color:"text.primary"},children:[ut.jsx(Qu,{outOfRange:null!==(S=null==H?void 0:H.outOfRange)&&void 0!==S&&S}),ut.jsx(m,{children:ut.jsxs(ut.Fragment,{children:[ut.jsxs("span",{children:[ep({price:null===(E=null==H?void 0:H.priceRange)||void 0===E?void 0:E.token0LowerPrice,atLimit:{},direction:Ku.LOWER})," "]}),null==I?void 0:I.symbol]})}),ut.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:ut.jsx("path",{d:"M15.75 9.50293L12.75 12.5029L11.7 11.4529L12.8813 10.2529L5.11875 10.2529L6.3 11.4529L5.25 12.5029L2.25 9.50293L5.25 6.50293L6.31875 7.55293L5.11875 8.75293L12.8813 8.75293L11.7 7.55293L12.75 6.50293L15.75 9.50293Z",fill:"currentColor",fillOpacity:"0.5"})}),ut.jsx(m,{children:ut.jsxs(ut.Fragment,{children:[ut.jsxs("span",{children:[ep({price:null===(T=null==H?void 0:H.priceRange)||void 0===T?void 0:T.token0UpperPrice,atLimit:{},direction:Ku.UPPER})," "]}),null==I?void 0:I.symbol]})})]})}):null,ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[a&&"PMM"===B&&ut.jsx(Au,{chainId:W.chainId,address:W.id}),Y?ut.jsx(Zu,{text:Y,onClick:()=>r(null)}):ut.jsxs(ut.Fragment,{children:[D?null:!!e&&ut.jsx(Pd,{variant:v.Variant.outlined,size:v.Size.small,onClick:e=>{e.stopPropagation(),r({operate:au.Remove,pool:nu(t),hasMining:z})},children:ut.jsx(n,{id:"t/YqKh",message:"Remove"})}),ut.jsx(Pd,{size:v.Size.small,onClick:()=>{r({pool:nu(t),hasMining:z})},children:D?o._({id:"wckWOP",message:"Manage"}):o._({id:"m16xKo",message:"Add"})})]})]})})]},D?null==H?void 0:H.id:W.id+W.chainId)}))})]})}function ip({account:e,filterChainIds:t,activeChainId:n,handleChangeActiveChainId:o,operatePool:i,setOperatePool:r}){var a,l,s,d,c,u,h;g();const{minDevice:f,isMobile:x}=Kd(),v=xe(),{onlyChainId:y,supportAMMV2:b,supportAMMV3:j,notSupportPMM:C}=ar(),[w,k]=X.useState(!1),{filterTokens:R,filterASymbol:M,filterBSymbol:S,filterAddressLqList:E,handleDeleteToken:T,handleChangeFilterTokens:W,handleChangeFilterAddress:L}=Yu();let I=[];b&&I.push("SVM_AMMV2"),j&&w&&(I=["SVM_AMMV3"]);const V={currentPage:1,pageSize:1e3,user:e,filterState:{viewOnlyOwn:!0,filterTypes:I}},O=wa(),Z=O.getQuery(p.graphql.fetchMyLiquidityList,{where:Object.assign(Object.assign({},V),{filterState:Object.assign({filterASymbol:M,filterBSymbol:S},V.filterState)})}),F=ve(Object.assign({},Z));let N=null!==(s=null===(l=null===(a=F.data)||void 0===a?void 0:a.liquidity_list)||void 0===l?void 0:l.lqList)&&void 0!==s?s:[];const A=!!(null==E?void 0:E.length);A?N=[...E]:t&&(N=null!==(h=null===(u=null===(c=null===(d=F.data)||void 0===d?void 0:d.liquidity_list)||void 0===c?void 0:c.lqList)||void 0===u?void 0:u.filter((e=>{var n,o;return t.includes(null!==(o=null===(n=null==e?void 0:e.pair)||void 0===n?void 0:n.chainId)&&void 0!==o?o:0)})))&&void 0!==h?h:[]);return ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{sx:Object.assign(Object.assign({py:16,display:"flex",gap:8},f(475)?{}:{flexDirection:"column"}),x?{}:{px:20,borderBottomWidth:1}),children:[ut.jsxs(m,{sx:Object.assign(Object.assign({display:"flex",alignItems:"center",gap:8},f(475)?{}:{"& > button":{flex:1,flexBasis:"100%"}}),x?{flexWrap:"wrap"}:{}),children:[!y&&ut.jsx(Ou,{chainId:n,setChainId:o}),j&&ut.jsx(tp,{onlyV3:w,setOnlyV3:k,sx:x?{flexGrow:1,flexBasis:"100%"}:void 0}),ut.jsx(Uu,{value:R,onChange:W,searchAddress:(e,t)=>or(this,void 0,void 0,(function*(){var n;const o=O.getInfiniteQuery(p.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},V),{filterState:Object.assign({address:e},V.filterState)})}),i=null===(n=(yield v.fetchQuery(o)).liquidity_list)||void 0===n?void 0:n.lqList;return(null==i?void 0:i.length)?ut.jsx(Du,{list:i,onClick:()=>{L(i),t()}}):null}))})]}),(A||!!R.length)&&ut.jsxs(m,{sx:{my:0},children:[A?ut.jsx(Fu,{lqList:E,onDeleteTag:()=>L([])}):"",ut.jsx(Nu,{tags:R,onDeleteTag:T})]})]}),x?ut.jsxs(ku,{gap:12,children:[F.isLoading?ut.jsx(Pu,{}):"",!F.isLoading&&!(null==N?void 0:N.length)&&!F.error&&ut.jsx(yu,{sx:{mt:40},hasSearch:!!(n&&!y||M||S)}),!!F.error&&ut.jsx(Cu,{refresh:F.refetch,sx:{mt:40}}),ut.jsx(np,{account:e,lqList:N,setOperatePool:r,supportAMM:b||j})]}):ut.jsxs(ut.Fragment,{children:[ut.jsx(op,{account:e,lqList:N,operatePool:i,setOperatePool:r,supportAMM:b||j,onlyV3:w}),ut.jsx(wu,{loading:F.isLoading,refetch:F.error?F.refetch:void 0,empty:!(null==N?void 0:N.length),hasSearch:!!(n&&!y||M||S)})]})]})}var rp,ap;function lp(){return lp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},lp.apply(null,arguments)}const sp=e=>z.createElement("svg",lp({width:66,height:64,viewBox:"0 0 66 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},e),rp||(rp=z.createElement("rect",{width:64,height:60.1342,fill:"url(#pattern0)"})),ap||(ap=z.createElement("defs",null,z.createElement("pattern",{id:"pattern0",patternContentUnits:"objectBoundingBox",width:1,height:1},z.createElement("use",{xlinkHref:"#image0_2465_53170",transform:"matrix(0.00671141 0 0 0.00714286 -0.503356 -0.9)"})),z.createElement("image",{id:"image0_2465_53170",width:300,height:300,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAADWuSURBVHgB7Z0JeFRVtu9XhYQwJRQzhulE5gYliPNEofc16rtXQvu10O1rCfdrW/F9V+Daer3dtyXwerDt9gLv2TYOLYFuVOhWwBm7NYUDICIEARkCphCCMicECAkk9fZ/n9qVk0pVxqqkEv6/79uc+dSpJOfPWmuvvbYIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEE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GBOV1cJ6HuLtw+5Hg1yO0NAcKdkOCfnP9lXp6QNg0Fq4WBmEgHcSeGBMQvmIJvyiAJdfEaA9xUcSU061g7CBlK5hgwq09ThKkGepIO11xaVRcPFKyLCLiGSS6Z5Pe7MrW1VY/OgfjE71VW6qrzpbIkGmJOWg8UrIscY+FV26msOuxTtpBHua3T1J+JR1oavx8VDFfr2YTYA3jRQsEidQJRa9dePMql9CD+1iwCpgRK9bSqmFTl2opzsoqWFAEULNIohn4nI6Pyguo4SEjIUB0CblvIdLUES3UuuOvqFdWJrZgcNjBJrPpD3O+XShU8l7zzZzGumwJFCGkBEDsTQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIQ3l/wMvNv557ac0YgAAAABJRU5ErkJggg=="}))));function dp(e){var{sx:t}=e,n=nr(e,["sx"]);return ut.jsx(B,{...n,sx:Object.assign(Object.assign({},t),{display:"flex",flexDirection:"column",overflow:"hidden"})})}function cp({params:t}){var n;const{isMobile:r}=Kd(),a=ar((e=>e.noDocumentLink)),l=X.useRef(null),{account:s}=sr(),{poolTab:d,tabs:c,handleChangePoolTab:u}=function({account:t,paramsTab:n}){const{i18n:o}=e(),[i,r]=X.useState(Rc.addLiquidity),{supportAMMV2:a,supportAMMV3:l,notSupportPMM:s}=ar(),d=X.useMemo((()=>{const e=[{key:Rc.addLiquidity,value:o._({id:"OBdohg",message:"Add Liquidity"})},{key:Rc.myLiquidity,value:o._({id:"YHc3B+",message:"My Liquidity"})}];return s||e.push({key:Rc.myCreated,value:a||l?o._({id:"zcVtwU",message:"My Pools (PMM)"}):o._({id:"fZFkP1",message:"My Pools"})}),e}),[o._,a,l,s]),c=X.useRef(!1);X.useEffect((()=>{const e=sessionStorage.getItem(wc);t&&e&&!c.current&&(c.current=!0,r(e))}),[t]);const u=e=>{r(e),sessionStorage.setItem(wc,e)};return X.useEffect((()=>{n&&u(n)}),[n]),{poolTab:i,tabs:d,handleChangePoolTab:u}}({account:s,paramsTab:null==t?void 0:t.tab}),{activeChainId:p,filterChainIds:h,handleChangeActiveChainId:f}=function(){const{chainId:e}=sr(),{onlyChainId:t}=ar(),[n,o]=X.useState(t),r=X.useMemo((()=>void 0!==n?[n]:_l(e)?void 0:Object.values(i).filter((e=>!!Number(e)))),[e,n]);return X.useEffect((()=>{const e=sessionStorage.getItem(kc);e&&o(Number(e))}),[]),{activeChainId:n,filterChainIds:r,handleChangeActiveChainId:e=>{void 0===e?sessionStorage.removeItem(kc):sessionStorage.setItem(kc,String(e)),o(e)}}}(),[g,x]=X.useState(null);return ut.jsxs(vc,{sx:Object.assign({},r?{p:20}:{display:"flex",gap:12,flex:1}),ref:l,children:[ut.jsx(m,{sx:r?{}:{p:8,borderRadius:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"border.disabled",backdropFilter:"blur(5px)",flex:1,overflow:"hidden",height:"max-content",maxHeight:"100%"},children:ut.jsxs(H,{value:d,onChange:(e,t)=>{u(t)},sx:r?{}:{display:"flex",flexDirection:"column",borderRadius:16,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"background.paper"},className:r?void 0:"gradient-card-border",children:[ut.jsxs(m,{sx:r?{}:{display:"flex",justifyContent:"space-between",p:20,borderBottomWidth:1},children:[ut.jsx(U,{tabs:c,variant:"rounded",tabsListSx:Object.assign({},r?{mb:16}:{borderBottomWidth:0,justifyContent:"space-between"}),tabSx:r?void 0:{mb:0}}),ut.jsx(Gu,{})]}),ut.jsx(dp,{value:Rc.addLiquidity,sx:{display:"flex",flexDirection:"column",overflow:"hidden"},children:ut.jsx(qu,{account:s,filterChainIds:h,scrollParentRef:l,activeChainId:p,handleChangeActiveChainId:f,operatePool:g,setOperatePool:x})}),ut.jsx(dp,{value:Rc.myLiquidity,children:ut.jsx(ip,{account:s,filterChainIds:h,activeChainId:p,handleChangeActiveChainId:f,operatePool:g,setOperatePool:x})})]})}),ut.jsxs(m,{sx:{position:"relative",width:a&&!g?"auto":375},children:[!a&&ut.jsx(qc,{title:o._({id:"6y2TB3",message:"Liquidity"}),desc:o._({id:"QNrpkx",message:"Classical AMM-like pool. Suitable for most assets."}),linkTo:"https://docs.dodoex.io/product/tutorial/how-to-provide-liquidity",LeftImage:sp}),"SVM_AMMV3"===(null===(n=null==g?void 0:g.pool)||void 0===n?void 0:n.type)&&g.pool.chainId?null:r?ut.jsx(fu,{account:s,onClose:()=>x(null),modal:r,pool:null==g?void 0:g.pool,operate:null==g?void 0:g.operate,hasMining:!1,hidePoolInfo:!1}):!!g&&ut.jsx(hu,{account:s,onClose:()=>x(null),pool:null==g?void 0:g.pool,operate:null==g?void 0:g.operate,hasMining:!1,hidePoolInfo:!1,sx:{width:375,height:"max-content",backgroundColor:"background.paper",borderRadius:16,overflow:"hidden"}})]})]})}function up(){const{routerPage:e}=ar(),t=fc((e=>e.page)),n=null!=e?e:t;switch(null==n?void 0:n.type){case hc.Pool:return ut.jsx(cp,{params:n.params});case hc.createPoolAMMV2:return ut.jsx(Xc,{});default:return ut.jsx(cp,{params:null==n?void 0:n.params})}}function pp(e){return ut.jsx(Ad,{...e,children:ut.jsx(pc,{getAutoSlippage:e.getAutoSlippage,onPayTokenChange:e.onPayTokenChange,onReceiveTokenChange:e.onReceiveTokenChange})})}function hp(e){return ut.jsx(Ad,{...e,children:ut.jsx(up,{})})}export{Xc as AMMV2Create,jd as Message,cp as PoolList,hp as PoolWidget,pp as SoonSwapWidget,Nd as UnstyleWidget,Ad as Widget};
23
+ */function As(){if(Rs)return ks;Rs=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return ks=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach((function(e){o[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}()?Object.assign:function(o,i){for(var r,a,l=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(o),s=1;s<arguments.length;s++){for(var d in r=Object(arguments[s]))t.call(r,d)&&(l[d]=r[d]);if(e){a=e(r);for(var c=0;c<a.length;c++)n.call(r,a[c])&&(l[a[c]]=r[a[c]])}}return l},ks}function Hs(){if(Ss)return Ms;Ss=1;return Ms="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function Ps(){return Ts?Es:(Ts=1,Es=Function.call.bind(Object.prototype.hasOwnProperty))}if("production"!==process.env.NODE_ENV){var Bs=Ns();ys.exports=function(){if(Vs)return Is;Vs=1;var e=Ns(),t=As(),n=Hs(),o=Ps(),i=function(){if(Ls)return Ws;Ls=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=Hs(),n={},o=Ps();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function i(i,r,a,l,s){if("production"!==process.env.NODE_ENV)for(var d in i)if(o(i,d)){var c;try{if("function"!=typeof i[d]){var u=Error((l||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw u.name="Invariant Violation",u}c=i[d](r,d,l,a,null,t)}catch(e){c=e}if(!c||c instanceof Error||e((l||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof c+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),c instanceof Error&&!(c.message in n)){n[c.message]=!0;var p=s?s():"";e("Failed "+a+" type: "+c.message+(null!=p?p:""))}}}return i.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(n={})},Ws=i}(),r=function(){};function a(){return null}return"production"!==process.env.NODE_ENV&&(r=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),Is=function(l,s){var d="function"==typeof Symbol&&Symbol.iterator,c="@@iterator",u="<<anonymous>>",p={array:g("array"),bigint:g("bigint"),bool:g("boolean"),func:g("function"),number:g("number"),object:g("object"),string:g("string"),symbol:g("symbol"),any:m(a),arrayOf:function(e){return m((function(t,o,i,r,a){if("function"!=typeof e)return new f("Property `"+a+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var l=t[o];if(!Array.isArray(l))return new f("Invalid "+r+" `"+a+"` of type `"+y(l)+"` supplied to `"+i+"`, expected an array.");for(var s=0;s<l.length;s++){var d=e(l,s,i,r,a+"["+s+"]",n);if(d instanceof Error)return d}return null}))},element:m((function(e,t,n,o,i){var r=e[t];return l(r)?null:new f("Invalid "+o+" `"+i+"` of type `"+y(r)+"` supplied to `"+n+"`, expected a single ReactElement.")})),elementType:m((function(t,n,o,i,r){var a=t[n];return e.isValidElementType(a)?null:new f("Invalid "+i+" `"+r+"` of type `"+y(a)+"` supplied to `"+o+"`, expected a single ReactElement type.")})),instanceOf:function(e){return m((function(t,n,o,i,r){if(!(t[n]instanceof e)){var a=e.name||u;return new f("Invalid "+i+" `"+r+"` of type `"+((l=t[n]).constructor&&l.constructor.name?l.constructor.name:u)+"` supplied to `"+o+"`, expected instance of `"+a+"`.")}var l;return null}))},node:m((function(e,t,n,o,i){return v(e[t])?null:new f("Invalid "+o+" `"+i+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return m((function(t,i,r,a,l){if("function"!=typeof e)return new f("Property `"+l+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var s=t[i],d=y(s);if("object"!==d)return new f("Invalid "+a+" `"+l+"` of type `"+d+"` supplied to `"+r+"`, expected an object.");for(var c in s)if(o(s,c)){var u=e(s,c,r,a,l+"."+c,n);if(u instanceof Error)return u}return null}))},oneOf:function(e){return Array.isArray(e)?m((function(t,n,o,i,r){for(var a=t[n],l=0;l<e.length;l++)if(h(a,e[l]))return null;var s=JSON.stringify(e,(function(e,t){return"symbol"===b(t)?String(t):t}));return new f("Invalid "+i+" `"+r+"` of value `"+String(a)+"` supplied to `"+o+"`, expected one of "+s+".")})):("production"!==process.env.NODE_ENV&&r(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),a)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&r("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var t=0;t<e.length;t++){var i=e[t];if("function"!=typeof i)return r("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+j(i)+" at index "+t+"."),a}return m((function(t,i,r,a,l){for(var s=[],d=0;d<e.length;d++){var c=(0,e[d])(t,i,r,a,l,n);if(null==c)return null;c.data&&o(c.data,"expectedType")&&s.push(c.data.expectedType)}return new f("Invalid "+a+" `"+l+"` supplied to `"+r+"`"+(s.length>0?", expected one of type ["+s.join(", ")+"]":"")+".")}))},shape:function(e){return m((function(t,o,i,r,a){var l=t[o],s=y(l);if("object"!==s)return new f("Invalid "+r+" `"+a+"` of type `"+s+"` supplied to `"+i+"`, expected `object`.");for(var d in e){var c=e[d];if("function"!=typeof c)return x(i,r,a,d,b(c));var u=c(l,d,i,r,a+"."+d,n);if(u)return u}return null}))},exact:function(e){return m((function(i,r,a,l,s){var d=i[r],c=y(d);if("object"!==c)return new f("Invalid "+l+" `"+s+"` of type `"+c+"` supplied to `"+a+"`, expected `object`.");var u=t({},i[r],e);for(var p in u){var h=e[p];if(o(e,p)&&"function"!=typeof h)return x(a,l,s,p,b(h));if(!h)return new f("Invalid "+l+" `"+s+"` key `"+p+"` supplied to `"+a+"`.\nBad object: "+JSON.stringify(i[r],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var m=h(d,p,a,l,s+"."+p,n);if(m)return m}return null}))}};function h(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function f(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function m(e){if("production"!==process.env.NODE_ENV)var t={},o=0;function i(i,a,l,d,c,p,h){if(d=d||u,p=p||l,h!==n){if(s){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var g=d+":"+l;!t[g]&&o<3&&(r("You are manually calling a React.PropTypes validation function for the `"+p+"` prop on `"+d+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),t[g]=!0,o++)}}return null==a[l]?i?null===a[l]?new f("The "+c+" `"+p+"` is marked as required in `"+d+"`, but its value is `null`."):new f("The "+c+" `"+p+"` is marked as required in `"+d+"`, but its value is `undefined`."):null:e(a,l,d,c,p)}var a=i.bind(null,!1);return a.isRequired=i.bind(null,!0),a}function g(e){return m((function(t,n,o,i,r,a){var l=t[n];return y(l)!==e?new f("Invalid "+i+" `"+r+"` of type `"+b(l)+"` supplied to `"+o+"`, expected `"+e+"`.",{expectedType:e}):null}))}function x(e,t,n,o,i){return new f((e||"React class")+": "+t+" type `"+n+"."+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}function v(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(v);if(null===e||l(e))return!0;var t=function(e){var t=e&&(d&&e[d]||e[c]);if("function"==typeof t)return t}(e);if(!t)return!1;var n,o=t.call(e);if(t!==e.entries){for(;!(n=o.next()).done;)if(!v(n.value))return!1}else for(;!(n=o.next()).done;){var i=n.value;if(i&&!v(i[1]))return!1}return!0;default:return!1}}function y(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function b(e){if(null==e)return""+e;var t=y(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function j(e){var t=b(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return f.prototype=Error.prototype,p.checkPropTypes=i,p.resetWarningCache=i.resetWarningCache,p.PropTypes=p,p},Is}()(Bs.isElement,!0)}else ys.exports=function(){if(Zs)return Os;Zs=1;var e=Hs();function t(){}function n(){}return n.resetWarningCache=t,Os=function(){function o(t,n,o,i,r,a){if(a!==e){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function i(){return o}o.isRequired=o;var r={array:o,bigint:o,bool:o,func:o,number:o,object:o,string:o,symbol:o,any:o,arrayOf:i,element:o,elementType:o,instanceOf:i,node:o,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return r.PropTypes=r,r}}()();var Us=_e(ys.exports);function Ds(e,t){return"production"===process.env.NODE_ENV?()=>null:function(...n){return e(...n)||t(...n)}}function Ys(e,t,n,o,i){const r=e[t],a=i||t;if(null==r||"undefined"==typeof window)return null;let l;const s=r.type;return"function"!=typeof s||function(e){const{prototype:t={}}=e;return Boolean(t.isReactComponent)}(s)||(l="Did you accidentally use a plain function component for an element instead?"),void 0!==l?new Error(`Invalid ${o} \`${a}\` supplied to \`${n}\`. Expected an element that can hold a ref. ${l} For more information see https://mui.com/r/caveat-with-refs-guide`):null}const zs=Ds(Us.element,Ys);zs.isRequired=Ds(Us.element.isRequired,Ys);const Xs="exact-prop: ​";function qs(e){return e&&e.ownerDocument||document}const Js="undefined"!=typeof window?z.useLayoutEffect:z.useEffect;function Gs(e){const t=z.useRef(e);return Js((()=>{t.current=e})),z.useRef(((...e)=>(0,t.current)(...e))).current}function Qs(...e){return z.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{!function(e,t){"function"==typeof e?e(t):e&&(e.current=t)}(e,t)}))}),e)}const _s={};const Ks=[];class $s{static create(){return new $s}currentId=null;start(e,t){this.clear(),this.currentId=setTimeout((()=>{this.currentId=null,t()}),e)}clear=()=>{null!==this.currentId&&(clearTimeout(this.currentId),this.currentId=null)};disposeEffect=()=>this.clear}function ed(){const e=function(e,t){const n=z.useRef(_s);return n.current===_s&&(n.current=e(t)),n}($s.create).current;var t;return t=e.disposeEffect,z.useEffect(t,Ks),e}const td={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function nd(e){var t,n,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=nd(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function od(){for(var e,t,n=0,o="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=nd(e))&&(o&&(o+=" "),o+=t);return o}function id(e,t=[]){if(void 0===e)return{};const n={};return Object.keys(e).filter((n=>n.match(/^on[A-Z]/)&&"function"==typeof e[n]&&!t.includes(n))).forEach((t=>{n[t]=e[t]})),n}function rd(e){if(void 0===e)return{};const t={};return Object.keys(e).filter((t=>!(t.match(/^on[A-Z]/)&&"function"==typeof e[t]))).forEach((n=>{t[n]=e[n]})),t}function ad(e){const{elementType:t,externalSlotProps:n,ownerState:o,skipResolvingSlotProps:i=!1,...r}=e,a=i?{}:function(e,t,n){return"function"==typeof e?e(t,n):e}(n,o),{props:l,internalRef:s}=function(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:o,externalForwardedProps:i,className:r}=e;if(!t){const e=od(n?.className,r,i?.className,o?.className),t={...n?.style,...i?.style,...o?.style},a={...n,...i,...o};return e.length>0&&(a.className=e),Object.keys(t).length>0&&(a.style=t),{props:a,internalRef:void 0}}const a=id({...i,...o}),l=rd(o),s=rd(i),d=t(a),c=od(d?.className,n?.className,r,i?.className,o?.className),u={...d?.style,...n?.style,...i?.style,...o?.style},p={...d,...n,...s,...l};return c.length>0&&(p.className=c),Object.keys(u).length>0&&(p.style=u),{props:p,internalRef:d.ref}}({...r,externalSlotProps:a}),d=function(e,t,n){return void 0===e||"string"==typeof e?t:{...t,ownerState:{...t.ownerState,...n}}}(t,{...l,ref:Qs(s,a?.ref,e.additionalProps?.ref)},o);return d}function ld(e){return e.substring(2).toLowerCase()}function sd(e){const{children:t,disableReactTree:n=!1,mouseEvent:o="onClick",onClickAway:i,touchEvent:r="onTouchEnd"}=e,a=z.useRef(!1),l=z.useRef(null),s=z.useRef(!1),d=z.useRef(!1);z.useEffect((()=>(setTimeout((()=>{s.current=!0}),0),()=>{s.current=!1})),[]);const c=Qs((u=t)&&z.isValidElement(u)?u.props.propertyIsEnumerable("ref")?u.props.ref:u.ref:null,l);var u;const p=Gs((e=>{const t=d.current;d.current=!1;const o=qs(l.current);if(!s.current||!l.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}(e,o))return;if(a.current)return void(a.current=!1);let r;r=e.composedPath?e.composedPath().indexOf(l.current)>-1:!o.documentElement.contains(e.target)||l.current.contains(e.target),r||!n&&t||i(e)})),h=e=>n=>{d.current=!0;const o=t.props[e];o&&o(n)},f={ref:c};return!1!==r&&(f[r]=h(r)),z.useEffect((()=>{if(!1!==r){const e=ld(r),t=qs(l.current),n=()=>{a.current=!0};return t.addEventListener(e,p),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,p),t.removeEventListener("touchmove",n)}}}),[p,r]),!1!==o&&(f[o]=h(o)),z.useEffect((()=>{if(!1!==o){const e=ld(o),t=qs(l.current);return t.addEventListener(e,p),()=>{t.removeEventListener(e,p)}}}),[p,o]),ut.jsx(z.Fragment,{children:z.cloneElement(t,f)})}"production"!==process.env.NODE_ENV&&(sd.propTypes={children:zs.isRequired,disableReactTree:Us.bool,mouseEvent:Us.oneOf(["onClick","onMouseDown","onMouseUp","onPointerDown","onPointerUp",!1]),onClickAway:Us.func.isRequired,touchEvent:Us.oneOf(["onTouchEnd","onTouchStart",!1])}),"production"!==process.env.NODE_ENV&&(sd.propTypes=function(e){return"production"===process.env.NODE_ENV?e:{...e,[Xs]:t=>{const n=Object.keys(t).filter((t=>!e.hasOwnProperty(t)));return n.length>0?new Error(`The following props are not supported: ${n.map((e=>`\`${e}\``)).join(", ")}. Please remove them.`):null}}}(sd.propTypes));const dd="base";function cd(e,t){const n=td[t];return n?`${dd}--${n}`:function(e,t){return`${dd}-${e}-${t}`}(e,t)}const ud="Snackbar";function pd(e){return cd(ud,e)}!function(e,t){const n={};t.forEach((t=>{n[t]=cd(e,t)}))}(ud,["root"]);const hd={disableDefaultClasses:!1},fd=z.createContext(hd);"production"!==process.env.NODE_ENV&&(fd.displayName="ClassNameConfiguratorContext");const md=()=>function(e,t,n){const o={};for(const i in e){const r=e[i];let a="";for(let e=0;e<r.length;e+=1){const o=r[e];o&&(a+=t(o)+" ",n&&n[o]&&(a+=n[o]+" "))}o[i]=a}return o}({root:["root"]},function(e){const{disableDefaultClasses:t}=z.useContext(fd);return n=>t?"":e(n)}(pd)),gd=z.forwardRef((function(e,t){const{autoHideDuration:n=null,children:o,disableWindowBlurListener:i=!1,exited:r=!0,onBlur:a,onClose:l,onFocus:s,onMouseEnter:d,onMouseLeave:c,open:u,resumeHideDuration:p,slotProps:h={},slots:f={},...m}=e,g=md(),{getRootProps:x,onClickAway:v}=function(e={}){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:o,open:i,resumeHideDuration:r}=e,a=ed();z.useEffect((()=>{if(i)return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){e.defaultPrevented||"Escape"===e.key&&o?.(e,"escapeKeyDown")}}),[i,o]);const l=Gs(((e,t)=>{o?.(e,t)})),s=Gs((e=>{o&&null!=e&&a.start(e,(()=>{l(null,"timeout")}))}));z.useEffect((()=>(i&&s(t),a.clear)),[i,t,s,a]);const d=a.clear,c=z.useCallback((()=>{null!=t&&s(null!=r?r:.5*t)}),[t,r,s]),u=e=>t=>{const n=e.onFocus;n?.(t),d()},p=e=>t=>{const n=e.onMouseEnter;n?.(t),d()},h=e=>t=>{const n=e.onMouseLeave;n?.(t),c()};return z.useEffect((()=>{if(!n&&i)return window.addEventListener("focus",c),window.addEventListener("blur",d),()=>{window.removeEventListener("focus",c),window.removeEventListener("blur",d)}}),[n,i,c,d]),{getRootProps:(t={})=>{const n={...id(e),...id(t)};return{role:"presentation",...t,...n,onBlur:(o=n,e=>{const t=o.onBlur;t?.(e),c()}),onFocus:u(n),onMouseEnter:p(n),onMouseLeave:h(n)};var o},onClickAway:e=>{o?.(e,"clickaway")}}}({...e,autoHideDuration:n,disableWindowBlurListener:i,onClose:l,open:u,resumeHideDuration:p}),y=e,b=f.root||"div",j=ad({elementType:b,getSlotProps:x,externalForwardedProps:m,externalSlotProps:h.root,additionalProps:{ref:t},ownerState:y,className:g.root}),C=ad({elementType:sd,externalSlotProps:h.clickAwayListener,additionalProps:{onClickAway:v},ownerState:y});return delete C.ownerState,!u&&r?null:ut.jsx(sd,{...C,children:ut.jsx(b,{...j,children:o})})}));function xd({size:e,color:t,time:n,strokeWidth:o=2,sx:i}){const[r,a]=q("0 1069"),l=e/2,s=l-1;return J((()=>{a(2*Math.PI*s+" 0")}),[]),ut.jsx(m,{width:e,height:e,component:"svg",sx:Object.assign({position:"absolute",top:`-${o}`,left:`-${o}`,transform:"rotate(-90deg)"},i),children:ut.jsx(m,{component:"circle",cx:l,cy:l,r:s,strokeWidth:o,stroke:t,fill:"none",strokeDasharray:r,sx:{transition:`stroke-dasharray ${n}`}})})}"production"!==process.env.NODE_ENV&&(gd.propTypes={autoHideDuration:Us.number,children:Us.node,disableWindowBlurListener:Us.bool,exited:Us.bool,onClose:Us.func,open:Us.bool,resumeHideDuration:Us.number,slotProps:Us.shape({clickAwayListener:Us.oneOfType([Us.func,Us.shape({children:Us.element.isRequired,disableReactTree:Us.bool,mouseEvent:Us.oneOf(["onClick","onMouseDown","onMouseUp","onPointerDown","onPointerUp",!1]),onClickAway:Us.func,touchEvent:Us.oneOf(["onTouchEnd","onTouchStart",!1])})]),root:Us.oneOfType([Us.func,Us.object])}),slots:Us.shape({root:Us.elementType})});var vd=X.memo(xd);const yd=Ie((e=>({notify:null,toast:t=>{e({notify:t})},close:()=>{e({notify:null})}}))),bd={entering:"translateX(0)",entered:"translateX(0)",exiting:"translateX(500px)",exited:"translateX(500px)",unmounted:"translateX(500px)"};function jd(){const e=g(),{notify:t,close:n}=yd(),[o,i]=X.useState(!0),r=X.useRef(null),a=null==t?void 0:t.timeout,l=!!t;let s=ut.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ut.jsx("circle",{cx:"18",cy:"18",r:"16.5",stroke:"#2FBA90",strokeWidth:"3"}),ut.jsx("path",{d:"M25.1384 11.334L14.8873 21.5851L10.8584 17.5718L8.66504 19.7651L14.8873 25.9873L27.3317 13.5429L25.1384 11.334Z",fill:"#2FBA90"})]});switch(null==t?void 0:t.type){case"error":s=ut.jsxs("svg",{width:"36",height:"37",viewBox:"0 0 36 37",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ut.jsx("circle",{cx:"18",cy:"18.5",r:"16.5",stroke:"#FF6187",strokeWidth:"3"}),ut.jsx("path",{d:"M25.3331 13.0452L19.8782 18.5L25.3331 23.9548L23.5148 25.7731L18.06 20.3183L12.6051 25.7731L10.7869 23.9548L16.2417 18.5L10.7869 13.0452L12.6051 11.2269L18.06 16.6817L23.5148 11.2269L25.3331 13.0452Z",fill:"#FF6187"})]});break;case"warning":s=ut.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ut.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.4065 3.6189L9.62438 3.59576L3.39812 9.78928L3.37498 18.5714L9.5685 24.7976L18.3506 24.8208L24.5769 18.6273L24.6 9.84516L18.4065 3.6189ZM26.9359 8.88481L19.3791 1.28812L8.66403 1.25988L1.06734 8.81663L1.0391 19.5317L8.59585 27.1284L19.311 27.1567L26.9076 19.5999L26.9359 8.88481Z",fill:"#B15600"}),ut.jsx("path",{d:"M15.1664 7.58398H12.8331V16.9173H15.1664V7.58398Z",fill:"#B15600"}),ut.jsx("path",{d:"M13.9998 21.6395C14.8896 21.6395 15.6109 20.9181 15.6109 20.0283C15.6109 19.1386 14.8896 18.4172 13.9998 18.4172C13.11 18.4172 12.3887 19.1386 12.3887 20.0283C12.3887 20.9181 13.11 21.6395 13.9998 21.6395Z",fill:"#B15600"})]})}return ut.jsx(m,{component:gd,open:l,autoHideDuration:a,onClose:(e,t)=>{"clickaway"!==t&&n()},exited:o,sx:{position:"fixed",top:20,left:20,right:20,zIndex:1,[e.breakpoints.up("tablet")]:{left:"auto"}},children:ut.jsx(Ye,{timeout:{enter:400,exit:400},in:l,appear:!0,unmountOnExit:!0,onEnter:()=>{i(!1)},onExited:()=>{i(!0)},nodeRef:r,children:o=>ut.jsxs(m,{ref:r,sx:{display:"flex",justifyContent:"space-between",p:12,borderRadius:8,backgroundColor:"background.paper",color:"text.primary",border:"solid 1px",borderColor:"border.main",boxShadow:"0px 6px 12px 0px rgba(0, 0, 0, 0.10)",transform:bd[o],transition:"transform 300ms ease",[e.breakpoints.up("tablet")]:{p:20,width:"auto",maxWidth:328}},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(m,{sx:{mt:7,"& > svg":{width:28,height:28},[e.breakpoints.up("tablet")]:{"& > svg":{width:36,height:36}}},children:t?s:""}),ut.jsxs(m,{sx:{ml:20},children:[ut.jsx(m,{sx:{typography:"caption"},children:null==t?void 0:t.message}),(null==t?void 0:t.link)?ut.jsxs(m,{component:"a",target:"_blank",rel:"noopener noreferrer",href:t.link.outerLink,sx:{display:"inline-flex",alignItems:"center",typography:"body2",color:"text.secondary","&:hover":{color:"text.primary"}},children:[t.link.text,ut.jsx(m,{component:"svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{ml:4,width:18,height:18},children:ut.jsx("path",{d:"M4.22703 13.2122L10.6811 6.75812L4.75206 6.75812L4.75736 5.25729H13.2426V13.7426H11.7471L11.7418 7.81878L5.28769 14.2729L4.22703 13.2122Z",fill:"currentColor"})})]}):"",(null==t?void 0:t.content)?ut.jsx(m,{sx:{mt:4,typography:"body2",color:"text.secondary"},children:t.content}):""]})]}),ut.jsxs(m,{sx:{position:"relative",top:10,ml:12,display:"flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:12,borderStyle:"solid",borderWidth:a?"2.4px":0,borderColor:e.palette.border.main,backgroundColor:a?"transparent":e.palette.background.paperDarkContrast,cursor:"pointer",boxSizing:"border-box",[e.breakpoints.up("tablet")]:{ml:28}},onClick:n,children:[a?ut.jsx(vd,{size:24,strokeWidth:"2.4px",time:`${a}ms`,color:e.palette.text.disabled}):"",ut.jsx(m,{component:"svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:16,height:16,border:"none",color:e.palette.text.disabled},children:ut.jsx("g",{children:ut.jsx("path",{d:"M12.8897 4.36345L9.25313 8L12.8897 11.6365L11.6775 12.8487L8.04095 9.21218L4.4044 12.8487L3.19221 11.6365L6.82876 8L3.19221 4.36345L4.4044 3.15127L8.04095 6.78782L11.6775 3.15127L12.8897 4.36345Z",fill:"currentColor"})})})]})]})})})}var Cd;function wd(){return wd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},wd.apply(null,arguments)}const kd=e=>z.createElement("svg",wd({width:"33px",height:"33px",viewBox:"0 0 33 33",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},e),Cd||(Cd=z.createElement("g",{stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},z.createElement("g",{transform:"translate(-186.000000, -375.000000)",stroke:"currentColor",strokeWidth:4},z.createElement("g",{transform:"translate(18.000000, 291.000000)"},z.createElement("g",{transform:"translate(40.000000, 83.000000)"},z.createElement("path",{d:"M159,32 C159,15.9837423 146.016258,3 130,3"}))))))),Rd=300;function Md({open:e,onClose:t,afterClose:n,title:o,rightSlot:i,canBack:r=!0,children:a,height:l,testId:s}){return ut.jsxs(m,{sx:{position:"absolute",top:e?0:"100%",transition:`all ${Rd}ms`,zIndex:20,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",backgroundColor:"background.paper",borderRadius:16,height:l},"data-testid":s,"data-active":e?"1":"0",children:[o?ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20},children:[ut.jsx(m,{sx:{display:"flex",alignItems:"center",typography:"caption"},children:o}),i,!i&&r&&ut.jsx(m,{component:$e.Error,sx:{color:"text.secondary",cursor:"pointer"},onClick:()=>{t&&t(),setTimeout((()=>n&&n()),Rd)}})]}):"",e?a:""]})}function Sd({open:e,onClose:t,afterClose:n,title:o,rightSlot:i,canBack:r=!0,children:a,height:l,testId:s}){return ut.jsx(x,{open:e,onClose:t,"data-testid":s,"data-active":e?"1":"0",children:ut.jsxs(m,{sx:{display:"flex",flexDirection:"column",height:l},children:[o?ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20},children:[ut.jsx(m,{sx:{display:"flex",alignItems:"center",typography:"caption"},children:o}),i,!i&&r&&ut.jsx(m,{component:$e.Error,sx:{color:"text.secondary",cursor:"pointer"},onClick:()=>{t&&t(),setTimeout((()=>n&&n()),Rd)}})]}):"",e?a:""]})})}function Ed(e){var{scope:t,modal:n}=e,o=nr(e,["scope","modal"]);const{widgetRef:i,DialogComponent:r}=ar();if(r)return ut.jsx(r,{scope:t,...o});const a=n?Sd:Md;return(null==i?void 0:i.current)&&!t?ze(ut.jsx(a,{...o}),i.current):ut.jsx(a,{...o})}const Td=6;function Wd({showingDone:e,errorMessage:t}){var n;const o=g();return t?ut.jsx(m,{component:$e.ErrorWarn,sx:{width:64,height:64,color:"error.main"}}):e?ut.jsx(m,{component:$e.DoneBorder,sx:{width:64,height:64,color:"success.main"}}):ut.jsx(m,{sx:{mx:"auto",border:`${Td}px solid ${null===(n=o.palette)||void 0===n?void 0:n.background.input}`,borderRadius:"50%",width:"64px",height:"64px",position:"relative",animation:"loadingRotate 1.1s infinite linear","@keyframes loadingRotate":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(359deg)"}}},children:ut.jsx(m,{component:kd,sx:{position:"absolute",top:`-${Td}px`,right:`-${Td}px`,color:"primary.main"}})})}function Ld({showingDone:e,showing:t}){return ut.jsxs(m,{sx:{display:"flex",alignItems:"center",flexDirection:"column"},children:[ut.jsx(m,{sx:{mt:60},children:e?o._({id:"4xbbt/",message:"{0} confirmed",values:{0:null==t?void 0:t.brief}}):o._({id:"/nzjSF",message:"{0} pending",values:{0:null==t?void 0:t.brief}})}),(null==t?void 0:t.subtitle)?ut.jsx(m,{sx:{mt:20,typography:"body2"},children:null==t?void 0:t.subtitle}):""]})}function Id({isStarted:e,isEnded:t,tx:o}){const[i,r]=q(0),{chainId:a}=sr(),l=Q((()=>`https://${Fi[a||1]}/tx/${o}`),[o,a]),s=Q((()=>{const e=Math.floor(i/60),t=i%60;return e?`${e}m ${t}s`:`${t}s`}),[i]),d=$();return J((()=>(e&&(r(0),window.clearInterval(d.current),d.current=window.setInterval((()=>{r((e=>e+1))}),1e3)),()=>{window.clearInterval(d.current)})),[e]),J((()=>{t&&window.clearInterval(d.current)}),[t]),ut.jsxs(m,{sx:{mt:20,pt:20,display:"flex",justifyContent:"space-between",alignItems:"center",typography:"body2",color:"text.secondary",border:"solid 1px transparent",borderTopColor:"border.main"},children:[ut.jsxs(m,{children:[ut.jsx(n,{id:"+Jkdiu",message:"Transaction Time:"}),s]}),ut.jsxs(y,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},component:"a",href:l,target:"_blank",rel:"noopener noreferrer",children:[ut.jsx(n,{id:"S3piC2",message:"Tx"}),ut.jsx(m,{component:$e.ArrowTopRightBorder,sx:{width:16,height:16,ml:6}})]})]})}function Vd(e){var{children:t,executionStatus:o}=e;const i=zr(nr(e,["children","executionStatus"])),{ctxVal:r,showing:a,closeShowing:l,showingDone:s,errorMessage:d,transactionTx:c}=Object.assign(Object.assign({},i),o),u=de(),p=ar((e=>e.noSubmissionDialog));return ut.jsxs(Xr.Provider,{value:r,children:[t,ut.jsx(Ed,{open:!!a&&!p,onClose:l,id:"submission",children:ut.jsxs(m,{sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",px:20,pb:20,flex:1,overflowY:"auto"},children:[ut.jsxs(m,{children:[ut.jsx(m,{sx:{textAlign:"center",pt:60},children:ut.jsx(Wd,{showingDone:s,errorMessage:d})}),d?ut.jsxs(m,{sx:{textAlign:"center",mt:60},children:[ut.jsx(m,{children:ut.jsx(n,{id:"kf83Ld",message:"Something went wrong."})}),ut.jsx(m,{sx:{color:"text.secondary",mt:12,typography:"body2",wordBreak:"break-all"},children:d})]}):ut.jsxs(ut.Fragment,{children:[ut.jsx(Ld,{showingDone:s,showing:a}),ut.jsx(Id,{isStarted:!!a,isEnded:s,tx:c})]})]}),ut.jsx(v,{fullWidth:!0,size:v.Size.big,onClick:()=>{u(hr(gr.Initial)),l()},sx:{mt:20},children:d?ut.jsx(n,{id:"1QfxQT",message:"Dismiss"}):ut.jsx(n,{id:"yz7wBu",message:"Close"})})]})})]})}const Od="dodo-widget-container";function Zd(e){return e.noLangProvider?ut.jsx(ut.Fragment,{children:e.children}):ut.jsx(ms,{locale:e.locale,children:ut.jsx(Vd,{...e,children:e.children})})}function Fd(e){!function({tokenList:e,popularTokenList:t}){const n=de();J((()=>{(()=>{or(this,void 0,void 0,(function*(){let o=[];o=re(e)?e:ie(t,Wa,(e=>e.address.toLowerCase()+e.chainId+e.side)),n(La(o))}))})()}),[e,n,t]),J((()=>{n(Ia(null!=t?t:[]))}),[t,n])}(e),Ur();const t=e.width||375,n=e.height||494,{widgetRef:o}=ar();return e.noUI?ut.jsx(Zd,{...e,children:e.children}):ut.jsx(Zd,{...e,children:ut.jsx(m,{sx:{width:t,height:n,overflow:"hidden",position:"relative",display:"flex",flexDirection:"column",minWidth:335,minHeight:494,borderRadius:16,backgroundColor:"background.paper"},className:Od,ref:o,children:e.children})})}function Nd(e){var t,n;const o=$(null);return ut.jsx(ue,{store:ra,children:ut.jsx(rr,{...Object.assign(Object.assign({},e),{widgetRef:null!==(t=e.widgetRef)&&void 0!==t?t:o,apiDomain:null!==(n=e.apiDomain)&&void 0!==n?n:"dodoex.io"}),children:ut.jsx(xs,{children:ut.jsx(is,{children:ut.jsx(Fd,{...e})})})})})}function Ad(e){const t=b({mode:e.colorMode,theme:e.theme,lang:e.locale||$l});return e.apikey||e.apiServices||console.error("apikey and apiServices must have a."),ut.jsxs(j,{theme:t,children:[ut.jsx(C,{container:`.${Od}, .${w}, .${k}`}),ut.jsx(je,{client:gs,children:ut.jsxs(Nd,{...e,children:[e.children,ut.jsx(jd,{})]})})]})}function Hd(e){var{sx:t}=e,n=nr(e,["sx"]);const{width:o}=ar(),i=Q((()=>{let e="";return"number"==typeof o?e=`${o}px`:o&&(e=o),e?`calc(${e} - 40px)`:"auto"}),[o]);return ut.jsx(R,{container:document.querySelector(`.${Od}`),maxWidth:i,sx:Object.assign({cursor:"help"},t),...n})}function Pd(e){var t,{chainId:o,includeButton:i}=e,r=nr(e,["chainId","includeButton"]);const{account:a,chainId:l}=sr(),{onConnectWalletClick:s}=ar(),[d,c]=X.useState(!1),{setVisible:u}=Ue();return!a||d||void 0===l||o&&o!==l?ut.jsx(ut.Fragment,{children:ut.jsx(v,{...r,isLoading:d,onClick:()=>or(this,void 0,void 0,(function*(){if(s){c(!0);const e=yield s();if(c(!1),e)return}u(!0)})),children:d?ut.jsx(n,{id:"J28zul",message:"Connecting..."}):ut.jsx(n,{id:"r7ScnQ",message:"Connect to a wallet"})})}):i?ut.jsx(ut.Fragment,{children:null!==(t=r.children)&&void 0!==t?t:null}):ut.jsx(v,{...r})}function Bd({needSwitchChain:e}){return ut.jsx(ut.Fragment,{children:ut.jsx(Pd,{size:v.Size.middle,fullWidth:!0,"data-testid":Xi,chainId:e})})}function Ud({open:e,execute:t,onClose:o,toToken:i,fromToken:r,fromAmount:a,toAmount:l,priceImpact:s,clearFromAmt:d,clearToAmt:c,baseFeeAmount:u,curToFiatPrice:p,curFromFiatPrice:h,additionalFeeAmount:f,loading:x,slippage:y}){var b,j;const C=g(),w=de(),k=ce(aa),R=Q((()=>!!s&&new te(s).gt(Bi)),[s]),[E,T]=q(!1),[W,L]=q(!1);return J((()=>{k!==gr.Pending&&o(),k===gr.TxSuccess&&(c(),d())}),[k]),J((()=>{T(!1)}),[p]),ut.jsx(Ed,{open:e,onClose:()=>{w(hr(gr.Initial)),o()},id:"swap-summary",title:ut.jsx(n,{id:"QR4/RH",message:"Swap summary"}),children:ut.jsxs(m,{sx:{margin:20,display:"flex",height:"100%",flexDirection:"column",borderTop:`1px solid ${C.palette.border.main}`},children:[ut.jsxs(m,{sx:{py:20,display:"flex",typography:"body2",alignItems:"center",justifyContent:"center",flexDirection:"column",borderBottom:`1px solid ${C.palette.border.main}`},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:[ut.jsx(Kl,{width:16,height:16,url:null==r?void 0:r.logoURI,address:null!==(b=null==r?void 0:r.address)&&void 0!==b?b:"",marginRight:6}),ut.jsx(m,{children:`${jr({input:a,decimals:null==r?void 0:r.decimals})} ${null==r?void 0:r.symbol}`})]}),null!==h&&ut.jsx(m,{sx:{mt:4,typography:"h6",color:C.palette.text.secondary},children:h?`$${br({input:h,showDecimals:1})}`:"-"})]}),ut.jsx(m,{sx:{width:16,mx:16},component:$e.DoubleRight}),ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex"},children:[ut.jsx(Kl,{width:16,height:16,marginRight:6,url:null==i?void 0:i.logoURI,address:null!==(j=null==i?void 0:i.address)&&void 0!==j?j:""}),ut.jsx(M,{loading:x,loadingProps:{width:30},children:`${jr({input:l,decimals:null==i?void 0:i.decimals})} ${null==i?void 0:i.symbol}`})]}),null!==h&&ut.jsx(M,{loading:x,loadingProps:{width:30},sx:{typography:"h6",mt:4,color:C.palette.text.secondary},children:p?`$${br({input:p,showDecimals:1})}(${s}%)`:"-"})]})]}),ut.jsxs(m,{sx:{mt:12,display:"flex",alignItems:"center",typography:"h6"},children:["1",null==r?void 0:r.symbol," = ",ut.jsx(M,{loading:x,loadingProps:{width:30},children:jr({input:new te(l).dividedBy(new te(a)),decimals:null==i?void 0:i.decimals})})," ",null==i?void 0:i.symbol]})]}),ut.jsxs(m,{sx:{py:15,typography:"body2",borderBottom:`1px solid ${C.palette.border.main}`},children:[ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",color:C.palette.text.secondary},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(m,{sx:{width:16,mr:7},component:$e.DetailBorder}),ut.jsx(n,{id:"XeovX3",message:"Swap Detail"})]}),ut.jsx(m,{component:S,children:ut.jsx(m,{onClick:()=>L(!W),sx:{width:10,color:"text.secondary",transform:W?"rotateX(0deg)":"rotateX(180deg)"},component:$e.CaretUp})})]}),ut.jsxs(m,{sx:{mt:16,display:W?"initial":"none"},children:[ut.jsxs(m,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(n,{id:"93m8jT",message:"Basic Fee"}),ut.jsx(Hd,{title:ut.jsx(n,{id:"8Z29ZO",message:"Estimated service provider fees"}),ml:5})]}),ut.jsx(M,{loading:x,loadingProps:{width:30},children:u?`${jr({input:u,decimals:null==i?void 0:i.decimals})} ${null==i?void 0:i.symbol}`:"0"})]}),ut.jsxs(m,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(n,{id:"J39pAJ",message:"Additional Fee"}),ut.jsx(Hd,{title:ut.jsx(n,{id:"ZXvy7b",message:"Additional routing fees set by the Widget user"}),ml:5})]}),ut.jsx(M,{loading:x,loadingProps:{width:30},children:f?`${jr({input:f,decimals:null==i?void 0:i.decimals})} ${null==i?void 0:i.symbol}`:"0"})]}),!!s&&ut.jsxs(m,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(n,{id:"T+qgFw",message:"Price Impact"}),ut.jsx(Hd,{title:ut.jsx(n,{id:"4kY4C4",message:"Due to the market condition, market price and estimated price may have a slight difference"}),ml:5})]}),ut.jsx(m,{children:`${s}%`})]}),ut.jsxs(m,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(n,{id:"CMHmbm",message:"Slippage"}),ut.jsx(Hd,{title:ut.jsx(n,{id:"GAypnX",message:"High slippage tolerance will increase the success rate of transaction, but might not get the best quote."}),ml:5})]}),ut.jsxs(m,{children:[y,"%"]})]})]})]}),ut.jsx(m,{sx:{flex:1}}),R&&ut.jsxs(m,{sx:{mb:14,display:"flex",cursor:"pointer",justifyContent:"center",alignItems:"center",typography:"h6"},onClick:()=>T(!E),children:[ut.jsx(m,{sx:{mr:4,width:18,height:18,alignItems:"center"},children:E?ut.jsx(m,{sx:{width:"100%",height:"100%",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"secondary.main"},children:ut.jsx(m,{component:$e.Done,sx:{width:14,color:"#1a1a1b"}})}):ut.jsx(m,{sx:{width:"100%",height:"100%",borderRadius:4,border:`1px solid ${C.palette.text.secondary}`}})}),ut.jsx(m,{children:ut.jsx(n,{components:{0:ut.jsx(m,{component:"span",sx:{color:"error.main"}})},values:{priceImpact:s},id:"Price impact reaches <0>{priceImpact}</0>%, accept the quote"})})]}),ut.jsx(v,{isLoading:k==gr.Pending,disabled:R&&!E,fullWidth:!0,onClick:()=>{t(),w(hr(gr.Pending))},children:k==gr.Pending?ut.jsx(n,{id:"P+K/3O",message:"Confirming"}):ut.jsx(n,{id:"lQ6r7x",message:"Confirm swap"})})]})})}var Dd;function Yd({fromToken:e,toToken:t}){const o=g(),{onlySolana:i}=ar();ja();const{customSlippage:r,customSlippageNum:a,handleSlippageChange:l,forecastSlippage:s,forecastSlippageQuery:d,recommendSlippage:c}=ka({fromToken:e,toToken:t}),[u,p]=X.useState(!1),[h,f]=X.useState();!h&&e&&t&&f(r?Dd.custom:Dd.recommend);const x=h===Dd.custom;return X.useRef(null),X.useMemo((()=>h===Dd.custom?a?new te(a).div(100).toNumber():void 0:new te(c).div(100).toNumber()),[h,c,a]),X.useCallback((e=>{x||f(Dd.custom),l({slippage:new te(e).times(100).toString(),disabled:!1,deleted:!1,recommend:String(c)})}),[x,c,l]),i?ut.jsxs(m,{sx:{pt:20,borderTop:`1px solid ${o.palette.border.main}`},children:[ut.jsxs(m,{sx:{mb:16,display:"flex",alignItems:"center"},children:[ut.jsx(n,{id:"lqTDfd",message:"Slippage Tolerance"}),ut.jsx(R,{title:ut.jsx(n,{id:"KAmxpM",message:"Attention: High slippage tolerance will increase the success rate of transaction, but might not get the best quote."}),ml:7})]}),ut.jsxs(m,{sx:{display:"flex",flexDirection:"column"},children:[ut.jsx(E,{placeholder:String(c),fullWidth:!0,sx:{height:36,"& input":{boxSizing:"border-box","&::placeholder":{color:"custom.input.placeholder",opacity:1}}},inputMode:"decimal",suffix:ut.jsx(m,{sx:{color:"text.disabled"},children:"%"}),value:r||"",onChange:e=>{const t=e.target.value;l({slippage:t,disabled:!1,recommend:String(c)})},onBlur:()=>{setTimeout((()=>{if(p(!1),!a)return void f(Dd.recommend);const e=!a||a<0;e&&r&&l({slippage:r,disabled:e,deleted:e,recommend:String(c)})}),10)}}),Number(r)>=Di&&ut.jsx(m,{sx:{typography:"h6",mt:6,color:"error.main"},children:ut.jsx(n,{id:"Zm56FI",message:"Maximum slippage do not exceed 50%"})})]})]}):null}function zd({checked:e,onChange:t,sx:o,disabled:i}){const r=g();let a=r.palette.background.paper;return e&&(a=r.palette.secondary.main),ut.jsxs(m,{sx:Object.assign({display:"flex",alignItems:"center",position:"relative",borderRadius:8,backgroundColor:r.palette.background.input,opacity:i?.5:1},o),component:S,disabled:i,onClick:()=>{i||t(!e)},children:[ut.jsx(m,{sx:{typography:"body2",fontWeight:600,pl:12,pr:13,pt:8,pb:9,width:"50%",zIndex:1,color:r.palette.text.primary,whiteSpace:"nowrap"},children:ut.jsx(n,{id:"az8lvo",message:"Off"})}),ut.jsx(m,{sx:{typography:"body2",fontWeight:600,pl:12,pr:13,pt:8,pb:9,width:"50%",zIndex:1,color:e?r.palette.secondary.contrastText:r.palette.text.primary,whiteSpace:"nowrap"},children:ut.jsx(n,{id:"Z5HWHd",message:"On"})}),ut.jsx(m,{sx:{borderRadius:6,backgroundColor:a,zIndex:0,position:"absolute",top:2,bottom:2,width:"calc(50% - 2px - 2px)",left:e?"calc(50% + 2px)":"2px",transition:"left 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"}})]})}function Xd({show:e,onClick:t}){const o=g();return ut.jsxs(y,{weak:!0,sx:{display:e?"flex":"none",alignItems:"center",position:"absolute",bottom:28,left:"50%",transform:"translateX(-50%)",p:o.spacing(8,20),fontWeight:600,borderRadius:20,border:`solid 1px ${o.palette.border.main}`,backgroundColor:"background.paperContrast",boxShadow:`0px 8px 16px 0px ${T("light"===o.palette.mode?"#FFF":"#000",.1)}`,cursor:"pointer",whiteSpace:"nowrap",gap:4},onClick:t,children:[ut.jsx(n,{id:"F8yRdq",message:"More trade settings"}),ut.jsx(m,{component:"svg",width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{color:"text.secondary"},children:ut.jsx("path",{d:"M12.5 19L6.5 13L7.9 11.6L12.5 16.175L17.1 11.6L18.5 13L12.5 19ZM12.5 13L6.5 6.99998L7.9 5.59998L12.5 10.175L17.1 5.59998L18.5 6.99998L12.5 13Z",fill:"currentColor"})})]})}function qd({open:e,onClose:t,fromToken:o,toToken:i}){const r=g(),{ddl:a,disableIndirectRouting:l}=ja(),{onlySolana:s}=ar(),d=X.useRef(null),[c,u]=X.useState(!1);return X.useEffect((()=>{const e=d.current,t=new ResizeObserver((()=>{e&&u(e.scrollHeight!==e.offsetHeight)})),n=ae((()=>{if(!e)return;const t=e.scrollTop+e.clientHeight<e.scrollHeight-2;u(t)}),50);return e&&(u(e.scrollHeight!==e.clientHeight),t.observe(e),e.addEventListener("scroll",n)),()=>{e&&(t.unobserve(e),e.removeEventListener("scroll",n))}}),[null==d?void 0:d.current]),ut.jsx(Ed,{open:e,onClose:t,id:"swap-settings",title:ut.jsx(n,{id:"Tz0i8g",message:"Settings"}),children:ut.jsxs(m,{sx:{px:20,pb:34,overflowY:"auto"},ref:d,children:[ut.jsx(Yd,{fromToken:o,toToken:i}),!s&&ut.jsxs(m,{sx:{mt:24,pt:14,borderTop:`solid 1px ${r.palette.border.main}`},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",fontWeight:600},children:[ut.jsx(n,{id:"zSMRJ/",message:"Transaction Deadline"}),ut.jsx(Hd,{title:ut.jsx(n,{id:"wmCrk7",message:"You may modify the transaction deadline, the maximum time allowed for a trade to be processed on-chain. However, please note that this may lead to your trade executing at a subpar price, as the market price may change during that time."}),ml:7})]}),ut.jsxs(m,{sx:{mt:16,display:"flex",alignItems:"center",gap:8,typography:"body2"},children:[ut.jsx(E,{sx:{width:80,height:34,lineHeight:1,typography:"body2","& input":{px:16,py:6}},placeholder:String(Yi),value:a,onChange:e=>{ja.setState({ddl:e.target.value})}}),ut.jsx(n,{id:"H9HlDe",message:"minutes"})]})]}),!s&&ut.jsx(m,{sx:{display:"flex",flexDirection:"column",gap:12,mt:24,pt:14,borderTop:`solid 1px ${r.palette.border.main}`},children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[ut.jsxs(m,{sx:{fontWeight:600},children:[ut.jsx(n,{id:"MXQodB",message:"Disable Indirect Routing"}),ut.jsx(Hd,{title:ut.jsx(n,{id:"Y0Knz4",message:"Checking this option means that the routing algorithm will only route to liquidity pools between the two tokens in the trading pair and will ignore routes with any intermediary tokens."}),ml:7})]}),ut.jsx(zd,{checked:l,onChange:e=>{ja.setState({disableIndirectRouting:e})}})]})}),ut.jsx(Xd,{show:c,onClick:()=>{var e,t;null===(e=d.current)||void 0===e||e.scrollTo({top:null===(t=d.current)||void 0===t?void 0:t.scrollHeight,behavior:"smooth"})}})]})})}function Jd({onClick:e,disabled:t,plus:n}){const o=g(),i=t||n||!e;return ut.jsx(m,{sx:{width:"100%",position:"relative"},children:ut.jsx(m,{component:S,sx:Object.assign({width:36,height:36,borderRadius:"50%",backgroundColor:o.palette.background.input,border:`4px solid ${o.palette.background.paper}`,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%) rotate(-90deg)",color:"text.secondary"},i?{cursor:"inherit"}:{"&:hover":{color:"text.primary"},"&:focus-visible":{"&::before":{content:'""',position:"absolute",display:"block",left:"50%",top:"50%",transform:"translate(-50%, -50%)",borderRadius:"50%",width:28,height:28,border:"solid 1px",borderColor:"text.primary"}}}),disabled:i,onClick:()=>{i||e&&e()},children:n?ut.jsx(m,{component:$e.Plus,sx:{width:18,height:18}}):ut.jsx(m,{component:$e.ArrowBack,sx:{width:18,height:18}})})})}!function(e){e.recommend="recommend",e.custom="custom"}(Dd||(Dd={}));const Gd=()=>{const{requests:e,updateText:t}=qr(),n=X.useMemo((()=>{let t={};return null==e||e.forEach((([e,n])=>{var o,i;if((n===dr.Running||n===dr.Success)&&(null===(o=e.metadata)||void 0===o?void 0:o.logBalance)&&(!e.doneTime||Math.ceil(Date.now()/1e3)-e.doneTime<300)){const n=null===(i=e.metadata)||void 0===i?void 0:i.logBalance;t=Object.assign(Object.assign({},t),n)}})),t}),[e&&Array.from(e)]),o=X.useMemo((()=>{let t={};return null==e||e.forEach((([e,n])=>{var o,i;if(n===dr.Success&&(null===(o=e.metadata)||void 0===o?void 0:o.logBalance)&&e.doneTime&&Math.ceil(Date.now()/1e3)-e.doneTime<300){const n=null===(i=e.metadata)||void 0===i?void 0:i.logBalance;t=Object.assign(Object.assign({},t),n)}})),t}),[e&&Array.from(e)]),i=X.useCallback(((e,n,o)=>{const i=e[n];if(!i)return!1;return!!(te.isBigNumber(o)?o:new te(o)).isEqualTo(i)||(t((e=>{var t;const o=Object.assign({},e.metadata);return(null===(t=null==o?void 0:o.logBalance)||void 0===t?void 0:t[n])?(delete o.logBalance[n],Object.keys(o.logBalance).length||delete o.logBalance,{brief:e.brief,spec:e.spec,metadata:o}):null})),!1)}),[t]),r=X.useCallback(((e,t)=>i(n,e,t)),[n,i]),a=X.useCallback(((e,t)=>i(o,e,t)),[o,i]);return{balanceData:n,balanceDataDone:o,isTokenLoading:r,isTokenLoadingDone:a}};function Qd({onClick:e,balance:t,decimals:o,address:i,showMaxBtn:r,canClickBalance:a,loading:l,balanceText:s}){const{palette:d}=g(),c=a&&(null==t?void 0:t.gt(0))&&e;return ut.jsxs(m,{sx:Object.assign({typography:"body2",alignItems:"center",color:d.text.secondary,wordBreak:"break-word",textAlign:"right"},c?{"&:hover":{color:d.text.primary,cursor:"pointer"}}:{}),onClick:c?()=>e(t?t.toString():""):void 0,children:[null!=s?s:ut.jsx(n,{id:"0QDjxt",message:"Balance:"})," ",l?ut.jsx(W,{sx:{position:"relative",top:-2,verticalAlign:"middle"}}):ut.jsxs(ut.Fragment,{children:[i?jr({input:t,decimals:Math.min(o||4,4)}):"-",r&&t&&t.gt(0)&&e&&ut.jsx(m,{component:S,sx:{ml:6,color:(null==t?void 0:t.gt(0))?d.primary.main:d.text.disabled,cursor:i?"pointer":"unset",typography:"body2"},onClick:()=>e&&e(t?t.toString():""),children:ut.jsx(n,{id:"CK1KXz",message:"Max"})})]})]})}const _d=ee((function({readOnly:e,sx:t,value:n,decimals:o,onChange:i,suffix:r,suffixGap:a=0,withClear:l,onFocus:s,placeholder:d,readonlyShowSuffix:c,typography:u},p){const h=g(),f=Q((()=>r||(l&&n&&i?ut.jsx(m,{component:S,sx:{ml:5,width:18,height:18,borderRadius:"50%",backgroundColor:"border.main",display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,color:"text.secondary","&:focus-visible":{border:"solid 1px",borderColor:"text.primary"}},onClick:()=>{i&&i("")},children:ut.jsx(m,{component:$e.Error,sx:{width:12}})}):void 0)),[i,r,h.palette.text.primary,n,l]);return ut.jsx(E,{fullWidth:!0,value:n,readOnly:e,placeholder:d||"0.00",onFocus:s,onChange:e=>{const t=e.target.value,n=0===t.length?"":kr(t,o);i&&i(n)},"data-testid":"number-input-wrapper",suffix:(!e||c)&&f,suffixGap:a,ref:p,sx:Object.assign({border:"none","& input":{fontSize:24,typography:u,border:"none",outline:"none",padding:0,color:"text.primary","&::placeholder":{fontSize:24,typography:u,color:"text.disabled"}}},t)})}));function Kd(){const e=g(),t=ar((e=>e.width)),[n,o]=X.useState(null!=t?t:"undefined"==typeof window?375:document.body.clientWidth);X.useEffect((()=>{const e=()=>{o("undefined"==typeof window?375:document.body.clientWidth)};return"number"!=typeof t?(e(),window.addEventListener("resize",e)):o(t),()=>{window.removeEventListener("resize",e)}}),[t]);return{isMobile:X.useMemo((()=>"number"==typeof n&&n<e.breakpoints.values.tablet),[n,e.breakpoints.values]),isTablet:X.useMemo((()=>"number"==typeof n&&n<e.breakpoints.values.tablet),[n,e.breakpoints.values]),minDevice:X.useCallback((e=>"number"==typeof n&&n>e),[n]),maxDevice:X.useCallback((e=>"number"==typeof n&&n<e),[n])}}const $d=[.25,.5,.75,1];function ec({value:e,onChange:t,sx:n}){const o=g(),i="light"===o.palette.mode,{isMobile:r}=Kd();return ut.jsx(m,{sx:Object.assign({display:"grid",gap:r?10:14,gridTemplateColumns:`repeat(${$d.length}, 1fr)`},n),children:$d.map((n=>{const r=n===e;return ut.jsxs(S,{disabled:!t,sx:{typography:"h6",borderRadius:4,padding:o.spacing(4,0),width:"100%",color:"text.secondary",backgroundColor:"background.paperDarkContrast","&:disabled":{color:"text.disabled"},"&:not(:disabled)&:hover":{color:o.palette.text.primary,backgroundColor:T(o.palette.text.primary,.2)},"&.selected, &:focus":{color:"#fff",backgroundColor:i?o.palette.primary.main:T(o.palette.text.primary,.4)}},onClick:()=>{!r&&t&&t(n)},className:r?"selected":void 0,children:[100*n,"%"]},n)}))})}function tc({token:e,onClick:t,showChainLogo:o,readonly:i,showChainName:r}){var a,l;const s=g(),d=(null==e?void 0:e.chainId)?Ql.get(e.chainId):null,c=r&&!!d;return ut.jsxs(m,{component:S,sx:{display:"flex",alignItems:"center",gap:8,color:s.palette.text.primary,typography:c?"body2":"body1",fontWeight:600,"&:focus-visible":{opacity:.5}},onClick:e=>{i||t&&t(e)},"data-testid":Gi,children:[!!(null==e?void 0:e.address)&&ut.jsx(Kl,{url:null==e?void 0:e.logoURI,address:null!==(a=null==e?void 0:e.address)&&void 0!==a?a:"",chainId:null==e?void 0:e.chainId,noShowChain:!o,width:30,height:30,chainSize:16,logoOffset:10,marginRight:0}),ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[(null==e?void 0:e.address)?ut.jsx(ut.Fragment,{children:ut.jsx(m,{children:null!==(l=null==e?void 0:e.symbol)&&void 0!==l?l:"-"})}):ut.jsx(n,{id:"sIPJGT",message:"SELECT TOKEN"}),!i&&ut.jsx("svg",{width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ut.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 11.75L12 7.25H6L9 11.75Z",fill:"currentColor"})})]}),!!c&&ut.jsxs(m,{sx:{display:"flex",alignItems:"center",typography:"h6",color:"text.secondary"},children:[d.name,ut.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ut.jsx("path",{d:"M5.6036 4.12761C5.50037 4.20906 5.3708 4.24967 5.23958 4.24169C5.10836 4.23372 4.98466 4.17773 4.89203 4.08438C4.7994 3.99103 4.74433 3.86685 4.7373 3.73549C4.73026 3.60413 4.77177 3.47477 4.8539 3.37205L5.96239 2.25211C6.46737 1.76405 7.14372 1.494 7.84575 1.5001C8.54779 1.50621 9.21934 1.78798 9.71577 2.28474C10.2122 2.78151 10.4938 3.4535 10.4999 4.156C10.506 4.85851 10.2361 5.5353 9.74839 6.04062L8.60241 7.16592C8.55441 7.22201 8.49533 7.26757 8.4289 7.29974C8.36246 7.3319 8.29009 7.34997 8.21635 7.35282C8.1426 7.35567 8.06906 7.34324 8.00034 7.3163C7.93162 7.28936 7.86921 7.2485 7.81702 7.19627C7.76483 7.14405 7.724 7.0816 7.69707 7.01284C7.67015 6.94407 7.65772 6.87048 7.66057 6.79668C7.66342 6.72289 7.68148 6.65047 7.71363 6.58399C7.74577 6.51751 7.7913 6.4584 7.84736 6.41036L8.97191 5.28506C9.25568 4.98032 9.41017 4.57725 9.40283 4.16078C9.39549 3.74431 9.22689 3.34695 8.93255 3.05242C8.63821 2.75788 8.24111 2.58917 7.82491 2.58182C7.40872 2.57447 7.00592 2.72906 6.70138 3.01302L5.6036 4.12761ZM6.34259 7.93755C6.38819 7.87582 6.44652 7.82461 6.51361 7.7874C6.58071 7.75018 6.65501 7.72783 6.73149 7.72185C6.80798 7.71586 6.88485 7.7264 6.95691 7.75273C7.02897 7.77906 7.09453 7.82058 7.14917 7.87447C7.2038 7.92836 7.24622 7.99337 7.27356 8.06509C7.3009 8.13682 7.31252 8.21358 7.30764 8.29019C7.30275 8.3668 7.28148 8.44147 7.24525 8.50913C7.20902 8.5768 7.15869 8.63589 7.09765 8.68239L5.96774 9.81305C5.45894 10.2708 4.7943 10.5163 4.11029 10.4992C3.42627 10.482 2.77479 10.2034 2.2896 9.72061C1.80441 9.23784 1.52232 8.58752 1.50127 7.90316C1.48021 7.2188 1.72179 6.55234 2.17638 6.04062L3.30629 4.93139C3.3504 4.86735 3.4079 4.81369 3.47482 4.77413C3.54174 4.73456 3.61646 4.71005 3.69379 4.70229C3.77113 4.69453 3.84922 4.70371 3.92266 4.72919C3.99609 4.75466 4.0631 4.79583 4.11904 4.84983C4.17497 4.90384 4.21849 4.96937 4.24657 5.0419C4.27464 5.11442 4.28661 5.19219 4.28163 5.2698C4.27665 5.34742 4.25484 5.42302 4.21773 5.49135C4.18062 5.55969 4.12908 5.61912 4.06671 5.66552L2.93144 6.79618C2.64767 7.10092 2.49318 7.50398 2.50052 7.92045C2.50786 8.33692 2.67647 8.73428 2.97081 9.02882C3.26515 9.32335 3.66224 9.49207 4.07844 9.49942C4.49463 9.50676 4.89743 9.35217 5.20197 9.06821L6.34259 7.93755ZM5.00919 7.76072C4.96119 7.81681 4.90211 7.86237 4.83567 7.89454C4.76924 7.9267 4.69687 7.94477 4.62312 7.94763C4.54937 7.95048 4.47583 7.93804 4.40711 7.9111C4.33839 7.88416 4.27598 7.8433 4.2238 7.79108C4.17161 7.73885 4.13077 7.6764 4.10385 7.60764C4.07693 7.53887 4.0645 7.46528 4.06735 7.39149C4.0702 7.31769 4.08826 7.24528 4.1204 7.17879C4.15255 7.11231 4.19808 7.0532 4.25413 7.00516L6.90487 4.35267C7.00731 4.26488 7.13909 4.21901 7.27386 4.22422C7.40863 4.22943 7.53648 4.28533 7.63185 4.38077C7.72722 4.4762 7.78309 4.60413 7.7883 4.73899C7.7935 4.87385 7.74766 5.00572 7.65993 5.10823L5.00919 7.76072Z",fill:"currentColor"})})]})]})]})}function nc({token:e,disabled:t,style:n,balance:o,onClick:i}){const r=g(),{account:a}=sr(),l=o?br({input:o}):"";return ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",typography:"body2",px:6,py:5,borderRadius:8,cursor:t?"auto":"pointer",opacity:t?.5:1,"&:hover":{backgroundColor:"hover.default"}},style:n,onClick:()=>{t||i()},"data-testid":tr,children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(Kl,{token:e}),ut.jsxs(m,{children:[ut.jsx(m,{sx:{fontWeight:600,textAlign:"left"},children:e.symbol}),a&&ut.jsx(m,{sx:{mt:4,textAlign:"left"},children:(null==o?void 0:o.gte(0))?l:ut.jsx(m,{component:$e.Loading,width:18,sx:{"& path":{fill:r.palette.text.disabled},animation:"loadingRotate 1.1s infinite linear","@keyframes loadingRotate":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(359deg)"}}}})})]})]}),ut.jsx(m,{sx:{color:"text.secondary",textAlign:"right"},children:e.name})]})}function oc({chain:e,active:t,onClick:o}){return ut.jsx(L,{title:e.name,placement:"top",onlyHover:!0,children:ut.jsxs(m,{sx:Object.assign({display:"flex",alignItems:"center",p:8,borderRadius:8,cursor:"pointer"},t?{backgroundColor:"secondary.main",color:"secondary.contrastText"}:{border:"1px solid",borderColor:"border.main","&:hover":{backgroundColor:"hover.default"}}),onClick:o,children:[ut.jsx(m,{component:e.logo,sx:{width:24,height:24}}),t?ut.jsxs(m,{sx:{ml:8},children:[ut.jsx(n,{id:"Fdp03t",message:"on"}),` ${e.name}`]}):""]})},e.chainId)}function ic(e){try{return new ke(e),!0}catch(e){return!1}}function rc(e){if(e.length<=10)return e;try{return new ke(e),`${e.slice(0,4)}...${e.slice(-4)}`}catch(t){return`${e.slice(0,6)}...${e.slice(-4)}`}}function ac(e,t,n="address"){return`https://${Fi[e]}${t?`/${n}/${t}`:""}`}function lc(){return ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between"},children:[ut.jsx(I,{variant:"circular",width:32,sx:{mt:8}}),ut.jsxs(m,{sx:{ml:8,flex:"1 0 auto"},children:[ut.jsx(I,{sx:{borderRadius:4},height:24}),ut.jsx(I,{sx:{mt:4,borderRadius:4},height:19,width:137})]})]})}function sc({chainId:e,value:t,onChange:n,occupiedAddrs:i,occupiedChainId:r,hiddenAddrs:a,showAddrs:l,visible:s,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,sx:f}){const{chainList:g,selectChainId:x,setSelectChainId:v}=function(e){const{chainId:t}=sr(),n=ce(ca),{crossChain:o,onlyChainId:i}=ar(),r=Q((()=>{const t=new Set;return n.forEach((n=>{n.side&&e&&n.side!==e||t.add(n.chainId)})),t}),[n,e]),a=Q((()=>{if(!o||i)return[];const e=new Map;let n;return Ql.forEach(((o,i)=>{if(r.has(o.chainId)){if(o.mainnet){if(t!==o.chainId)return;n=o.mainnet}e.set(i,Object.assign({},o))}})),void 0!==n&&e.delete(n),Array.from(e.values())}),[t,n,o,i]),l=Q((()=>!a.length||t&&r.has(t)?t:a[0].chainId),[t,r]),[s,d]=q(l);J((()=>{void 0===s&&d(l)}),[l]);const c=Q((()=>null!=s?s:l),[s,l]);return{chainList:a,selectChainId:c,setSelectChainId:d}}(d),{showTokenList:y,filter:b,setFilter:j,onSelectToken:C,popularTokenList:w,tokenInfoMap:k}=Aa({value:t,onChange:n,occupiedAddrs:i,occupiedChainId:r,hiddenAddrs:a,showAddrs:l,side:d,chainId:null!=e?e:x,visible:s,defaultLoadBalance:c,multiple:u}),R=$(null),[M,S]=q(0);J((()=>{if(s&&t)if(Array.isArray(t)){const[e]=t;e&&e.chainId!==x&&v(e.chainId)}else v(t.chainId)}),[t,s]),J((()=>{let e;return s&&(e=window.setTimeout((()=>{R.current&&S(R.current.offsetHeight-16)}),300)),()=>clearTimeout(e)}),[R,s,x]);const E=ve({queryKey:["token-picker-searchOtherAddress",b],queryFn:()=>h?h(b):null,enabled:ic(b)&&!!h}),T=G((({index:e,style:n})=>{var o;const i=y[e];if(!i)return null;let r=!1;return t&&(r=Array.isArray(t)?t.some((e=>e.address===i.address&&e.chainId===i.chainId)):t.address===i.address&&t.chainId===i.chainId),ut.jsx(nc,{token:i,disabled:r,style:n,onClick:()=>C(i),balance:null===(o=k.get(`${i.chainId}-${i.address}`))||void 0===o?void 0:o.balance},i.address+i.chainId)}),[y,w,t]);return ut.jsxs(m,{sx:Object.assign({display:"flex",flexDirection:"column",px:20,flex:1,overflow:"hidden"},f),children:[ut.jsx(V,{fullWidth:!0,height:48,value:b,onChange:e=>j(e.target.value),clearValue:()=>j(""),placeholder:null!=p?p:o._({id:"72/M0o",message:"Enter the token symbol or address"}),sx:{mb:16}}),void 0===e&&g.length?ut.jsx(m,{sx:{position:"relative",display:"flex",gap:8,flexWrap:"wrap",pb:32,"&::after":{content:'""',position:"absolute",bottom:16,left:0,right:0,height:"1px",backgroundColor:"border.main"}},children:g.map((e=>ut.jsx(oc,{chain:e,active:e.chainId===x,onClick:()=>{v(e.chainId)}},e.chainId)))}):"",ut.jsx(m,{sx:{pb:16,flex:1,minHeight:64},ref:R,children:y.length?ut.jsx(Xe,{height:M,itemCount:y.length,itemSize:52,width:"100%",className:"token-list",children:T}):ut.jsxs(m,{sx:{height:M,overflowY:"auto"},children:[E.isLoading?ut.jsx(lc,{}):"",E.data?E.data:""]})})]})}function dc({open:e,title:t,value:o,onClose:i,occupiedAddrs:r,hiddenAddrs:a,occupiedChainId:l,onTokenChange:s,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,chainId:f,modal:m}){const{height:g}=ar(),{isMobile:x}=Kd();return ut.jsx(Ed,{height:m?"80vh":g,open:e,onClose:i,title:null!=t?t:ut.jsx(n,{id:"T0Y2+3",message:"Select a token"}),id:"select-token",testId:er,modal:m,children:ut.jsx(sc,{value:o,visible:e,onChange:s,occupiedAddrs:r,occupiedChainId:l,hiddenAddrs:a,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,chainId:f,sx:m?{width:x?"100%":420,borderRadius:16}:void 0})})}function cc({sx:e,inputSx:t,amt:o,token:i,readOnly:r,showMaxBtn:l,canClickBalance:s,onMaxClick:d,fiatPriceTxt:c,occupiedAddrs:u,occupiedChainId:p,onInputFocus:h,onTokenClick:f,onInputChange:x,onTokenChange:y,side:b,showChainLogo:j,showChainName:C,defaultLoadBalance:w,overrideBalance:k,overrideBalanceLoading:R,balanceText:M,showPercentage:S,inputReadonlyTooltip:E,inputTypography:T,chainId:W,hideToken:L,checkLogBalance:I,notTokenPickerModal:V}){var Z,F;const{account:N,isSolana:A}=sr(),H=g(),{gotoBuyToken:P}=ar(),[B,U]=q(!1),{fetchTokenBalance:D}=Ar(),Y=ve({queryKey:[a,"token","getFetchTokenQuery",W,null==N?void 0:N.toLocaleLowerCase(),void 0,null==i?void 0:i.address],queryFn:()=>or(this,void 0,void 0,(function*(){if(!i)return;const e=yield D(i.address);return Object.assign(Object.assign({},i),{balance:e.amount,allowance:yr})})),enabled:!!N&&A&&!!i}),z=null!==(F=null!=k?k:null===(Z=Y.data)||void 0===Z?void 0:Z.balance)&&void 0!==F?F:null,{isTokenLoading:X}=Gd();let G=null!=R?R:Y.isLoading;!G&&z&&(I?G=Object.entries(I).some((([e,t])=>X(e,t))):i&&(G=X(i.address,z))),Hr({tokenList:i?[i]:[],chainId:null==i?void 0:i.chainId});const[Q,_]=q(0),K=$("");J((()=>{o!==K.current&&_(0)}),[o]);let ee=P&&z&&o&&z.lt(o);const te=!!x||!!E;return ut.jsxs(m,{sx:Object.assign({minHeight:te?133:"auto",padding:H.spacing(20,20,24),borderRadius:12,overflow:"hidden",display:"flex",flexDirection:"column",justifyContent:"space-between",backgroundColor:H.palette.background.input},e),children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4},children:[L?ut.jsx(m,{}):ut.jsx(tc,{token:i,showChainLogo:j,showChainName:C,onClick:()=>U(!0),readonly:!y}),ut.jsx(Qd,{balance:z,balanceText:M,onClick:r||!d&&!x?void 0:e=>{d?d(e):x&&x(e),0!==Q&&1!==Q&&(_(1),K.current=e)},showMaxBtn:l,canClickBalance:s,address:null==i?void 0:i.address,decimals:null==i?void 0:i.decimals,loading:G})]}),te&&(r&&E?ut.jsx(O,{title:E,arrow:!1,children:ut.jsx(m,{children:ut.jsx(_d,{value:o,readOnly:!0,withClear:!0,sx:Object.assign({mt:12},t)})})}):ut.jsx(_d,{value:o,onFocus:h,onChange:x?e=>{x(e),_(0)}:void 0,readOnly:r,withClear:!0,suffix:ee?ut.jsx(v,{variant:v.Variant.tag,backgroundColor:H.palette.background.paperDarkContrast,sx:{fontSize:12},onClick:e=>{e.stopPropagation(),null==P||P({token:i,account:N})},children:ut.jsx(n,{id:"qiOIiY",message:"Buy"})}):void 0,typography:T,sx:{mt:12}})),!r&&S?ut.jsx(ec,{sx:{mt:16},value:Q,onChange:z&&void 0!==(null==i?void 0:i.decimals)?e=>{if(z&&(null==i?void 0:i.decimals))if(_(e),1===e){const e=z.toString();d?d(e):x&&x(e),K.current=e}else if(x){const t=z.multipliedBy(e).dp(i.decimals).toString();x(t),K.current=t}}:void 0}):"",void 0!==c?ut.jsx(m,{sx:{mt:S?9:0,typography:"h6",color:H.palette.text.secondary},children:c}):"",ut.jsx(dc,{value:i,open:B,side:b,chainId:W,occupiedAddrs:u,occupiedChainId:p,defaultLoadBalance:w,onClose:()=>{U(!1),f&&f()},onTokenChange:(e,t)=>{U(!1),setTimeout((()=>{!Array.isArray(e)&&y&&y(e,t)}),Rd)},modal:!V})]})}function uc({toToken:e,fromToken:t,priceStatus:o,pricePerToToken:i,pricePerFromToken:r}){const[a,l]=q("-"),[s,d]=q(null),[c,u]=q("-"),[p,h]=q(null);J((()=>{l(null==t?void 0:t.symbol),u(null==e?void 0:e.symbol),d(i),h(r)}),[t,e,i,r]);const f=G((()=>{l(c),u(a),d(p),h(s)}),[a,s,c,p]);return ut.jsx(m,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:{[$r.Initial]:"-",[$r.Loading]:ut.jsxs(ut.Fragment,{children:[ut.jsx(W,{sx:{mr:5}}),ut.jsx(n,{id:"JdNn1Y",message:"Fetching best price..."})]}),[$r.Failed]:ut.jsxs(ut.Fragment,{children:[ut.jsx(m,{component:$e.Warn,sx:{width:15,mr:5,color:"warning.main"}}),ut.jsx(n,{id:"NVAuTg",message:"Quote not available"})]}),[$r.Success]:ut.jsxs(ut.Fragment,{children:[ut.jsx(m,{sx:{typography:"body2"},children:`1 ${a} = ${br({input:p,showDecimals:4})} ${c}`}),ut.jsx(m,{component:S,sx:{width:18,height:18,ml:6,borderRadius:"50%",backgroundColor:"border.main",display:"flex",justifyContent:"center",alignItems:"center"},children:ut.jsx(m,{sx:{width:16,color:"text.secondary"},onClick:f,component:$e.Switch})})]})}[o]})}function pc({getAutoSlippage:e,onPayTokenChange:t,onReceiveTokenChange:a}={}){var l,s;const d=g(),{isInflight:c}=Jr(),{chainId:u,account:p}=sr(),h=de(),{defaultChainId:f,noPowerBy:x,onlyChainId:y,onlySolana:b}=ar(),[j,C]=q(!1);Q((()=>{var e;return null===(e=r[null!=u?u:f])||void 0===e?void 0:e.address}),[u,f]);const[w,k]=q(""),[R,M]=q(""),[E,T]=q(""),[I,V]=q(""),O=Q((()=>le((e=>T(e)),1e3)),[]),Z=Q((()=>le((e=>V(e)),1e3)),[]),[F,N]=q(null),[A,H]=q(null),[P,B]=q(!1),[U,D]=q(!1),{toFiatPrice:Y,fromFiatPrice:z}=Kr({toToken:A,fromToken:F});!function({token:e,fiatPrice:t}){Q((()=>{var n;const o=null!==(n=null==e?void 0:e.decimals)&&void 0!==n?n:6,i=null!=t?new te(500).div(t):new te(0),r=Rr(i,o);return(r.lt(new te(1).times(new te(10).pow(o-3)))?new te(0):r).toString(10)}),[null==e?void 0:e.decimals,t])}({token:j?A:F,fiatPrice:j?Y:z}),function({fromToken:e,toToken:t,getAutoSlippage:n}){const o=de();J((()=>{(()=>{or(this,void 0,void 0,(function*(){if(!n)return;const i=n({fromToken:e,toToken:t});if(void 0!==i&&"number"!=typeof i){o(mr(!0));try{const e=yield i;o(fr({loading:!1,value:null!=e?e:null}))}catch(e){console.error(e),o(fr({loading:!1,value:null}))}}else o(fr({loading:!1,value:null}))}))})()}),[e,t])}({fromToken:F,toToken:A,getAutoSlippage:e});const{slippage:X,slippageLoading:_}=ka({fromToken:F,toToken:A}),{isApproving:K,isGetApproveLoading:$,needApprove:ee,insufficientBalance:ne,submitApprove:oe,getMaxBalance:ie}=Ta(F,{amount:E}),re=G((()=>{ve(ie())}),[ie]);Q((()=>!(!p||ne||K||$||ee)),[p,ne,K,$,ee]);const{status:ae,rawBrief:se,executeSwap:ue}=ea({toToken:A,fromToken:F,fromAmount:E,slippage:X}),{resAmount:pe,priceImpact:he,baseFeeAmount:fe,additionalFeeAmount:me,resPricePerToToken:ge,resPricePerFromToken:xe}=Q((()=>{if(!se)return{resAmount:null,priceImpact:null,baseFeeAmount:null,additionalFeeAmount:null,resPricePerToToken:null,resPricePerFromToken:null};const e=new te(se.inAmount).dividedBy(se.outAmount).toNumber(),t=new te(se.outAmount).dividedBy(se.inAmount).toNumber();return{resAmount:se.resAmount,priceImpact:se.priceImpact,baseFeeAmount:0,additionalFeeAmount:0,resPricePerToToken:e,resPricePerFromToken:t}}),[se]),ve=G((e=>{const t=e.toString();k(t),O(t)}),[k,O]),ye=G((e=>{const t=e.toString();M(t),Z(t)}),[M,Z]),be=G((e=>N((n=>{var o;const i="function"==typeof e?e(n):e;return u||h(Pr(null!==(o=null==i?void 0:i.chainId)&&void 0!==o?o:void 0)),t&&i&&i!==n&&t(i),i}))),[h,Pr,t,u]),je=G((e=>H((t=>{const n="function"==typeof e?e(t):e;return a&&n&&n!==t&&a(n),n}))),[a]);ha({fromToken:F,toToken:A,setFromToken:be,setToToken:je,updateFromAmt:ve,updateToAmt:ye,setIsReverseRouting:C});const Ce=G((()=>{ve(""),ye(""),be(A),je(F),Hi("from",A),Hi("to",F)}),[be,A,je,F,ve,ye]),we=G(((e,t)=>{if(t)return Ce();ve(""),ye(""),be(e),Hi("from",e)}),[Ce,ve,ye,be,Hi]),ke=G(((e,t)=>{if(t)return Ce();ve(""),ye(""),je(e),Hi("to",e)}),[Ce,ve,ye,be,Hi]),Re=G((()=>{j&&ve(""),C(!1)}),[j,ve,h]);G((()=>{j||ye(""),C(!0)}),[j,ye,h]);const Me=xa(X),Se=Q((()=>he?new te(he).multipliedBy(100).dp(4,te.ROUND_DOWN).toString():null),[he]),Ee=Q((()=>{const e=j?pe:E;return e&&z?new te(z).multipliedBy(e):null}),[z,E,j,pe]),Te=Q((()=>{if(!Y)return null;const e=j?I:pe;return e?new te(Y).multipliedBy(e):null}),[Y,I,j,pe]),We=Q((()=>ut.jsxs(m,{sx:{display:"flex",fontWeight:600,typography:"body2",alignItems:"center",justifyContent:"center"},children:[ut.jsx(Hd,{title:ut.jsx(n,{id:"4kY4C4",message:"Due to the market condition, market price and estimated price may have a slight difference"}),mr:8}),ut.jsxs(m,{sx:{display:"flex"},children:[ut.jsx(n,{id:"6+mYrD",message:"Current price impact"}),ut.jsxs(m,{sx:{color:d.palette.error.main,ml:4},children:[Se,"%"]})]})]})),[Se,d.palette.error.main]),Le=Q((()=>ut.jsx(uc,{toToken:A,fromToken:F,priceStatus:ae,pricePerToToken:ge,pricePerFromToken:xe})),[A,F,ae,ge,xe]),Ie=Q((()=>!(i[u||1]||y&&y===u)),[u]),Ve=Q((()=>!b&&!!u&&!!(null==F?void 0:F.chainId)&&(null==F?void 0:F.chainId)!==u),[u,null==F?void 0:F.chainId,b]),Oe=function({fromToken:e,toToken:t}){const n=ce(ca);return Q((()=>!(!e||n.some((t=>t.chainId===e.chainId&&t.address===e.address&&(!t.side||"to"===t.side))))||!(!t||n.some((e=>e.chainId===t.chainId&&e.address===t.address&&(!e.side||"from"===e.side))))),[e,t,n])}({fromToken:F,toToken:A}),Ze=Q((()=>Me&&new te(j?I:E).gt(0)&&!ne&&ae===$r.Success?ut.jsxs(m,{sx:{textAlign:"center",mb:8},children:[ut.jsx(m,{component:$e.Warn,sx:{position:"relative",top:2,mr:6,width:16,height:16,color:"warning.main"}}),o._({id:"//95jS",message:"The current slippage protection coefficient set exceeds {maxSlippageWarning}%, which may result in losses.",values:{maxSlippageWarning:ga}})]}):null),[Me,j,E,I,ae]),Fe=Q((()=>Ve?ut.jsxs(m,{sx:{textAlign:"center"},children:[ut.jsx(m,{component:$e.Warn,sx:{position:"relative",top:2,mr:6,width:16,height:16,color:"warning.main"}}),ut.jsx(n,{id:"54ffaC",message:"The current network is inconsistent with the wallet - please switch in wallet"})]}):ae===$r.Loading?ut.jsx(m,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:ut.jsxs(ut.Fragment,{children:[ut.jsx(W,{sx:{mr:5}}),ut.jsx(n,{id:"JdNn1Y",message:"Fetching best price..."})]})}):Ie?ut.jsxs(ut.Fragment,{children:[ut.jsx(m,{component:$e.Warn,sx:{mr:6,width:16,color:"warning.main"}}),ut.jsx(n,{id:"udsWDJ",message:"Unsupported network - switch to trade"})]}):w&&Se&&new te(Se).gt(Bi)?We:ut.jsxs(ut.Fragment,{children:[Ze,Le]})),[ae,Le,w,We,Se,Ie,Ve,Ze]),Ne=Q((()=>j?new te(R).gt(0)?jr({input:pe,decimals:null==F?void 0:F.decimals}):"-":w),[w,R,pe,F,j]),Ae=Q((()=>j?R:new te(w).gt(0)?jr({input:pe,decimals:null==A?void 0:A.decimals}):"-"),[w,R,pe,A,j]),He=Q((()=>{if(!p||(null==F?void 0:F.chainId)&&u!==F.chainId)return ut.jsx(Bd,{needSwitchChain:null==F?void 0:F.chainId});if(c)return ut.jsx(v,{fullWidth:!0,isLoading:!0,disabled:!0,children:ut.jsx(n,{id:"FRBvjQ",message:"Transaction Pending"})});if(!F||!A)return ut.jsx(v,{fullWidth:!0,disabled:!0,"data-testid":qi,children:ut.jsx(n,{id:"KlvBGJ",message:"Select Tokens"})});if(ee)return ut.jsx(v,{fullWidth:!0,disabled:K,onClick:()=>oe(),children:K?ut.jsx(n,{id:"j2Uisd",message:"Approving"}):ut.jsx(n,{id:"Z7ZXbT",message:"Approve"})});if(!new te(j?I:E).gt(0))return ut.jsx(v,{fullWidth:!0,disabled:!0,"data-testid":Qi,children:ut.jsx(n,{id:"iPMIoT",message:"Enter an amount"})});if(ae===$r.Loading)return ut.jsx(v,{fullWidth:!0,disabled:!0,"data-testid":_i,children:ut.jsx(n,{id:"OauUE6",message:"Fetching Price..."})});return!pe||ae===$r.Failed?ut.jsx(v,{fullWidth:!0,disabled:!0,children:ut.jsx(n,{id:"NVAuTg",message:"Quote not available"})}):ne?ut.jsx(v,{fullWidth:!0,disabled:!0,"data-testid":Ki,children:ut.jsx(n,{id:"znqB4T",message:"Insufficient balance"})}):ut.jsx(v,{fullWidth:!0,onClick:()=>B(!0),"data-testid":Ji,children:ut.jsx(n,{id:"K/Ay/d",message:"Review Swap"})})}),[p,F,u,c,A,ee,K,j,I,E,ae,pe,ne,oe]),Pe=Q((()=>F&&A?ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(Kl,{token:F,width:16,height:16,marginRight:6,chainId:F.chainId,noShowChain:!!y}),`${jr({input:j?pe:E,decimals:null==F?void 0:F.decimals})} ${null==F?void 0:F.symbol}`,ut.jsx(m,{component:$e.DoubleRight,sx:{width:12,height:12,mx:16}}),ut.jsx(Kl,{token:A,width:16,height:16,marginRight:6,chainId:A.chainId,noShowChain:!!y}),`${jr({input:j?I:pe,decimals:null==A?void 0:A.decimals})} ${null==A?void 0:A.symbol}`]}):ut.jsx(m,{})),[F,A,E,I,pe,j,y]);return ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",typography:"caption",margin:20},children:[ut.jsx(n,{id:"vH2C/2",message:"Swap"}),ut.jsx(L,{open:void 0,title:ut.jsx(n,{id:"NSCBTb",message:"The setting has been switched to swap mode"}),placement:"bottom-end",children:ut.jsx(m,{component:S,children:ut.jsx(m,{component:$e.Setting,onClick:()=>D(!0),sx:{width:19,height:19,color:"text.primary",cursor:"pointer"}})})})]}),ut.jsxs(m,{sx:{flex:1,padding:"0 16px 12px",overflowY:"auto"},children:[ut.jsxs(m,{children:[ut.jsx(cc,{sx:{mb:4},token:F,side:"from",amt:Ne,defaultLoadBalance:!0,onMaxClick:re,onInputChange:ve,onInputFocus:Re,showMaxBtn:!j&&!w,occupiedAddrs:[null!==(l=null==A?void 0:A.address)&&void 0!==l?l:""],occupiedChainId:null==A?void 0:A.chainId,fiatPriceTxt:Ee?`$${br({input:Ee,showDecimals:1})}`:"-",onTokenChange:we,readOnly:j,showChainLogo:!y,showChainName:!y,notTokenPickerModal:!0}),ut.jsx(Jd,{onClick:Ce,disabled:Oe}),ut.jsx(cc,{token:A,side:"to",amt:Ae,onInputChange:ye,occupiedAddrs:[null!==(s=null==F?void 0:F.address)&&void 0!==s?s:""],occupiedChainId:null==F?void 0:F.chainId,fiatPriceTxt:Te?`$${br({input:Te,showDecimals:1})}(${Se}%)`:"-",onTokenChange:ke,readOnly:!0,showChainLogo:!y,showChainName:!y,notTokenPickerModal:!0}),ut.jsx(m,{sx:{py:12,display:"flex",typography:"body2",alignItems:"center",justifyContent:"center",flexWrap:"wrap"},children:Fe})]}),He,x?"":ut.jsxs(m,{sx:{mt:13,display:"flex",typography:"h6",cursor:"pointer",justifyContent:"center",alignItems:"center",color:d.palette.text.disabled},onClick:()=>window.open(Wi),children:[ut.jsx(m,{sx:{width:18,height:18,transform:"translate(1px, 2px)","& path":{fill:d.palette.text.disabled}},component:$e.Dodo}),ut.jsx(n,{id:"7X+IbB",message:"Powered by DODO protocol"})]})]}),ut.jsx(Ud,{toToken:A,fromToken:F,fromAmount:j?pe:E,toAmount:j?I:pe,open:P,baseFeeAmount:fe,priceImpact:Se,additionalFeeAmount:me,curToFiatPrice:Te,execute:()=>ue(Pe),clearFromAmt:()=>ve(""),clearToAmt:()=>ye(""),curFromFiatPrice:Ee,onClose:()=>B(!1),loading:ae===$r.Loading,slippage:X}),ut.jsx(qd,{open:U,onClose:()=>D(!1),fromToken:F,toToken:A})]})}var hc;!function(e){e.Pool="pool",e.PoolDetail="poolDetail",e.CreatePool="createPool",e.ModifyPool="modifyPool",e.MiningList="miningList",e.MiningDetail="miningDetail",e.createPoolAMMV2="createPoolAMMV2",e.createPoolAMMV3="createPoolAMMV3"}(hc||(hc={}));const fc=Ie(((e,t)=>({page:void 0,historyList:[],push:t=>{e((e=>{var n;const o=[...e.historyList,null!==(n=e.page)&&void 0!==n?n:{type:hc.Pool}];return{page:t,historyList:o}}))},back:()=>{e((e=>{const t=e.historyList.length;if(!t)return"undefined"!=typeof window&&window.history&&history.back(),e;const n=[...e.historyList];return{page:n.splice(t-1,1)[0],historyList:n}}))}})));function mc({sx:e,onClick:t}){const o=g();return ut.jsxs(y,{onClick:()=>{t?t():fc.getState().back()},sx:se({display:"inline-flex",alignItems:"center",cursor:"pointer","& > svg":{mr:10}},e),children:[ut.jsx(m,{sx:{color:o.palette.text.secondary,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderColor:o.palette.border.main,borderStyle:"solid",borderWidth:1,borderRadius:"50%",backgroundColor:o.palette.background.paper,mr:6},children:ut.jsx($e.ArrowBack,{})}),ut.jsx(n,{id:"CKyk7Q",message:"Go back"})]})}function gc({statuses:e,children:t,buttonProps:o}){var i;if(!e.find((e=>e.needShowTokenStatusButton))&&t)return ut.jsx(ut.Fragment,{children:t});const r=e.find((e=>e.insufficientBalance));if(r)return ut.jsx(v,{fullWidth:!0,disabled:!0,...o,children:ut.jsx(n,{id:"m6RmA/",message:"Insufficient {0} balance",values:{0:null===(i=r.token)||void 0===i?void 0:i.symbol}})});const a=e.some((e=>e.isApproving));return ut.jsx(m,{sx:{display:"flex",alignItems:"center",gap:4},children:e.map(((e,t)=>{var i,r;let l="";return e.isApproving?l=ut.jsx(n,{id:"j2Uisd",message:"Approving"}):(e.needReset||e.needApprove)&&(l=e.approveTitle),l?ut.jsx(v,{fullWidth:!0,isLoading:e.isApproving,onClick:e.submitApprove,disabled:e.insufficientBalance||a,...o,children:l},null!==(r=null===(i=e.token)||void 0===i?void 0:i.symbol)&&void 0!==r?r:t):null}))})}function xc({token:e,chainId:t,showChainLogo:o,readonly:i,showChainName:r,logoSize:a=24,chainLogoSize:l=12,side:s,occupiedToken:d,defaultLoadBalance:c,notTokenPickerModal:u,border:p,px:h=20,py:f=8,highlightDefault:x,onTokenClick:v,onTokenChange:y}){var b,j;const{onlyChainId:C}=ar(),w=t||C,k=g(),[R,M]=X.useState(!1),E=(null==e?void 0:e.chainId)?Ql.get(e.chainId):null,T=r&&!!E;return ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{component:S,sx:Object.assign(Object.assign({display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,color:k.palette.text.primary,typography:T?"body2":"body1",fontWeight:600,px:h,py:f,"&:focus-visible":{opacity:.5}},!!p&&{border:`solid 1px ${k.palette.border.main}`,borderRadius:8,"&:hover":{backgroundColor:k.palette.hover.default}}),!(!x||e)&&{backgroundColor:k.palette.primary.main,color:k.palette.primary.contrastText,"&:hover":{opacity:.8}}),onClick:()=>{i||M(!0)},"data-testid":$i,children:[!!(null==e?void 0:e.address)&&ut.jsx(Kl,{url:null==e?void 0:e.logoURI,address:null!==(b=null==e?void 0:e.address)&&void 0!==b?b:"",chainId:null==e?void 0:e.chainId,noShowChain:!o,width:a,height:a,chainSize:l,logoOffset:10,marginRight:0}),ut.jsxs(m,{sx:{flex:1},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(null==e?void 0:e.address)?ut.jsx(ut.Fragment,{children:ut.jsx(m,{children:null!==(j=null==e?void 0:e.symbol)&&void 0!==j?j:"-"})}):ut.jsx(n,{id:"sIPJGT",message:"SELECT TOKEN"}),!i&&ut.jsx(m,{component:"svg",width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{flexShrink:0},children:ut.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.58398 12.376C6.78189 12.6728 7.21811 12.6728 7.41603 12.376L10.4818 7.77735C10.7033 7.44507 10.4651 7 10.0657 7H3.93426C3.53491 7 3.29672 7.44507 3.51823 7.77735L6.58398 12.376Z",fill:"currentColor"})})]}),!!T&&ut.jsxs(m,{sx:{display:"flex",alignItems:"center",typography:"h6",color:"text.secondary"},children:[E.name,ut.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ut.jsx("path",{d:"M5.6036 4.12761C5.50037 4.20906 5.3708 4.24967 5.23958 4.24169C5.10836 4.23372 4.98466 4.17773 4.89203 4.08438C4.7994 3.99103 4.74433 3.86685 4.7373 3.73549C4.73026 3.60413 4.77177 3.47477 4.8539 3.37205L5.96239 2.25211C6.46737 1.76405 7.14372 1.494 7.84575 1.5001C8.54779 1.50621 9.21934 1.78798 9.71577 2.28474C10.2122 2.78151 10.4938 3.4535 10.4999 4.156C10.506 4.85851 10.2361 5.5353 9.74839 6.04062L8.60241 7.16592C8.55441 7.22201 8.49533 7.26757 8.4289 7.29974C8.36246 7.3319 8.29009 7.34997 8.21635 7.35282C8.1426 7.35567 8.06906 7.34324 8.00034 7.3163C7.93162 7.28936 7.86921 7.2485 7.81702 7.19627C7.76483 7.14405 7.724 7.0816 7.69707 7.01284C7.67015 6.94407 7.65772 6.87048 7.66057 6.79668C7.66342 6.72289 7.68148 6.65047 7.71363 6.58399C7.74577 6.51751 7.7913 6.4584 7.84736 6.41036L8.97191 5.28506C9.25568 4.98032 9.41017 4.57725 9.40283 4.16078C9.39549 3.74431 9.22689 3.34695 8.93255 3.05242C8.63821 2.75788 8.24111 2.58917 7.82491 2.58182C7.40872 2.57447 7.00592 2.72906 6.70138 3.01302L5.6036 4.12761ZM6.34259 7.93755C6.38819 7.87582 6.44652 7.82461 6.51361 7.7874C6.58071 7.75018 6.65501 7.72783 6.73149 7.72185C6.80798 7.71586 6.88485 7.7264 6.95691 7.75273C7.02897 7.77906 7.09453 7.82058 7.14917 7.87447C7.2038 7.92836 7.24622 7.99337 7.27356 8.06509C7.3009 8.13682 7.31252 8.21358 7.30764 8.29019C7.30275 8.3668 7.28148 8.44147 7.24525 8.50913C7.20902 8.5768 7.15869 8.63589 7.09765 8.68239L5.96774 9.81305C5.45894 10.2708 4.7943 10.5163 4.11029 10.4992C3.42627 10.482 2.77479 10.2034 2.2896 9.72061C1.80441 9.23784 1.52232 8.58752 1.50127 7.90316C1.48021 7.2188 1.72179 6.55234 2.17638 6.04062L3.30629 4.93139C3.3504 4.86735 3.4079 4.81369 3.47482 4.77413C3.54174 4.73456 3.61646 4.71005 3.69379 4.70229C3.77113 4.69453 3.84922 4.70371 3.92266 4.72919C3.99609 4.75466 4.0631 4.79583 4.11904 4.84983C4.17497 4.90384 4.21849 4.96937 4.24657 5.0419C4.27464 5.11442 4.28661 5.19219 4.28163 5.2698C4.27665 5.34742 4.25484 5.42302 4.21773 5.49135C4.18062 5.55969 4.12908 5.61912 4.06671 5.66552L2.93144 6.79618C2.64767 7.10092 2.49318 7.50398 2.50052 7.92045C2.50786 8.33692 2.67647 8.73428 2.97081 9.02882C3.26515 9.32335 3.66224 9.49207 4.07844 9.49942C4.49463 9.50676 4.89743 9.35217 5.20197 9.06821L6.34259 7.93755ZM5.00919 7.76072C4.96119 7.81681 4.90211 7.86237 4.83567 7.89454C4.76924 7.9267 4.69687 7.94477 4.62312 7.94763C4.54937 7.95048 4.47583 7.93804 4.40711 7.9111C4.33839 7.88416 4.27598 7.8433 4.2238 7.79108C4.17161 7.73885 4.13077 7.6764 4.10385 7.60764C4.07693 7.53887 4.0645 7.46528 4.06735 7.39149C4.0702 7.31769 4.08826 7.24528 4.1204 7.17879C4.15255 7.11231 4.19808 7.0532 4.25413 7.00516L6.90487 4.35267C7.00731 4.26488 7.13909 4.21901 7.27386 4.22422C7.40863 4.22943 7.53648 4.28533 7.63185 4.38077C7.72722 4.4762 7.78309 4.60413 7.7883 4.73899C7.7935 4.87385 7.74766 5.00572 7.65993 5.10823L5.00919 7.76072Z",fill:"currentColor"})})]})]})]}),ut.jsx(dc,{value:e,open:R,side:s,chainId:w,occupiedAddrs:d?[d.address]:void 0,occupiedChainId:null==d?void 0:d.chainId,defaultLoadBalance:c,onClose:()=>{M(!1),v&&v()},onTokenChange:(e,t)=>{M(!1),setTimeout((()=>{!Array.isArray(e)&&y&&y(e,t)}),Rd)},modal:!u})]})}const vc=X.forwardRef((function(e,t){var{sx:n}=e,o=nr(e,["sx"]);const{isMobile:i}=Kd(),r=g();return ut.jsx(m,{className:"widget-module-container",ref:t,sx:Object.assign(Object.assign({flex:1,overflowY:"auto",backgroundColor:"background.default"},i?{padding:0,height:"100%",width:"100%",overflowX:"hidden"}:{padding:r.spacing(28,20,40,40),height:"auto"}),n),...o})})),yc="auto",bc="0.5";function jc({baseToken:t,quoteToken:n,pairMintAAmount:i,pairMintBAmount:r,slippage:a,isExists:l,poolInfo:s,poolKeys:d,successBack:c,submittedBack:u}){const p=qr(),{account:h}=sr(),f=rs();return e(),ye({mutationFn:()=>or(this,void 0,void 0,(function*(){if(!t||!n)throw new Error("token is undefined");if(!h)throw new Error("account is undefined");if(!s||!i||!r)throw new Error("poolInfo is undefined");if(!f)throw new Error("raydium is undefined");const e=new qe(new Je(i).mul(10**s.mintA.decimals).toFixed(0,Je.ROUND_DOWN)),m=new Ne(100*a*100,1e4),{execute:g}=l?yield f.cpmm.addLiquidity({poolInfo:s,poolKeys:d,inputAmount:e,slippage:m,baseIn:!0,txVersion:Ze.LEGACY}):yield f.cpmm.createPool({programId:Or,poolFeeAccount:Zr,mintA:s.mintA,mintB:s.mintB,mintAAmount:e,mintBAmount:new qe(new Je(r).mul(10**s.mintB.decimals).toFixed(0,Je.ROUND_DOWN)),startTime:new qe(0),feeConfig:Fr[0],associatedOnly:!1,ownerInfo:{useSOLBalance:!0},txVersion:es});return yield p.executeCustom({brief:l?o._({id:"E6MqGy",message:"Add liquidity"}):o._({id:"L37FfW",message:"Create AMM V2 Position"}),metadata:{[l?cr.addLiquidityAMMV2Position:cr.createAMMV2Position]:!0},handler:e=>or(this,void 0,void 0,(function*(){const{txId:t}=yield g({sendAndConfirm:!0});e.onSuccess(t)})),successBack:c,submittedBack:u})})),onError:e=>{console.error(e)}})}function Cc({pool:e,baseAmount:t,quoteAmount:n,slippage:o}){var i,r,a,l,s,d,c,u,p,h,f,m,g,x;const{account:v}=sr(),y=rs(),[b,j,C,w,k]=Q((()=>{if(!(null==e?void 0:e.baseToken)||!e.quoteToken)return[void 0,void 0,void 0,void 0,!0];const{baseToken:o,quoteToken:i}=e,r=new qe(new ke(o.address).toBuffer()).lte(new qe(new ke(i.address).toBuffer())),[a,l]=r?[o,i]:[i,o],[s,d]=r?[t,n]:[n,t];return[a,l,s,d,r]}),[t,e,n]),R=ve({queryKey:["cpmm","poolInfo",null==e?void 0:e.address],enabled:null!=(null==e?void 0:e.address),queryFn:()=>or(this,void 0,void 0,(function*(){if(!(null==e?void 0:e.address)||!y)return null;const{poolInfo:t,poolKeys:n,rpcData:o}=yield y.cpmm.getPoolInfoFromRpc(e.address);if(!o)return{baseReserve:0,quoteReserve:0,lpAmount:0};const[i,r]=t.mintA.address.toLowerCase()===e.baseToken.address.toLowerCase()?[e.baseToken.symbol,e.quoteToken.symbol]:[e.quoteToken.symbol,e.baseToken.symbol],a=Mr(t.lpAmount,t.lpMint.decimals);return{baseReserve:Mr(o.baseReserve.toNumber(),n.mintA.decimals),quoteReserve:Mr(o.quoteReserve.toNumber(),n.mintB.decimals),lpAmount:a,lpMint:t.lpMint,poolKeys:Object.assign(Object.assign({},n),{mintA:Object.assign(Object.assign({},n.mintA),{symbol:i}),mintB:Object.assign(Object.assign({},n.mintB),{symbol:r})}),poolInfo:Object.assign(Object.assign({},t),{lpAmount:a.toNumber(),mintA:Object.assign(Object.assign({},t.mintA),{symbol:i}),mintB:Object.assign(Object.assign({},t.mintB),{symbol:r})}),rpcData:o}}))}),M=ve({queryKey:["cpmm","lpBalance",null===(r=null===(i=R.data)||void 0===i?void 0:i.lpMint)||void 0===r?void 0:r.address],enabled:!!(v&&R.data&&(null===(a=R.data)||void 0===a?void 0:a.lpMint)&&(null===(s=null===(l=R.data)||void 0===l?void 0:l.lpMint)||void 0===s?void 0:s.address)&&(null===(c=null===(d=R.data)||void 0===d?void 0:d.lpMint)||void 0===c?void 0:c.decimals)),queryFn:()=>or(this,void 0,void 0,(function*(){var e,t,n,o,i;if(!(v&&R.data&&(null===(e=R.data)||void 0===e?void 0:e.lpMint)&&(null===(n=null===(t=R.data)||void 0===t?void 0:t.lpMint)||void 0===n?void 0:n.address)&&(null===(i=null===(o=R.data)||void 0===o?void 0:o.lpMint)||void 0===i?void 0:i.decimals)&&y))return null;yield y.account.fetchWalletTokenAccounts();const r=R.data.lpMint.address,a=y.account.tokenAccounts.find((e=>e.mint.toBase58()===r));if(!a)throw new Error(`you do not have balance in pool: ${r}`);return Mr(a.amount.toNumber(),R.data.lpMint.decimals)}))}),S=ve({queryKey:["cpmm","pairAmount",C,null===(u=R.data)||void 0===u?void 0:u.poolInfo],enabled:!(!R.data||!(null===(p=R.data)||void 0===p?void 0:p.poolInfo)||!C),queryFn:()=>or(this,void 0,void 0,(function*(){var e;if(!(R.data&&(null===(e=R.data)||void 0===e?void 0:e.poolInfo)&&C&&y))return null;const t=R.data.poolInfo,n=yield y.cpmm.computePairAmount({baseReserve:R.data.rpcData.baseReserve,quoteReserve:R.data.rpcData.quoteReserve,poolInfo:t,amount:C,slippage:new Ne(100*o*100,1e4),baseIn:!0,epochInfo:yield y.fetchEpochInfo()});return{pairMintAAmount:C,pairMintBAmount:Mr(n.anotherAmount.amount.toString(),t.mintB.decimals).toString(),liquidityMinted:Mr(n.liquidity.toString(),t.lpMint.decimals)}}))}),[E,T,W,L]=Q((()=>{if(!R.data||!M.data)return[void 0,void 0,void 0,void 0];const{baseReserve:e,quoteReserve:t,lpAmount:n}=R.data,o=M.data,i=o.div(n),r=o.multipliedBy(e).div(n),a=o.multipliedBy(t).div(n);return[o,i,r,a]}),[R.data,M.data]),I=X.useMemo((()=>R.isFetched&&null!=R.data),[R.isFetched,R.data]),[V,O]=X.useMemo((()=>{var e,o;if(I){if(null!=(null===(o=null===(e=R.data)||void 0===e?void 0:e.poolInfo)||void 0===o?void 0:o.price)){const e=new te(R.data.poolInfo.price);return[e,new te(1).div(e)]}return[void 0,void 0]}return t&&n?[new te(n).div(t),new te(t).div(n)]:[void 0,void 0]}),[t,I,null===(f=null===(h=R.data)||void 0===h?void 0:h.poolInfo)||void 0===f?void 0:f.price,n]);return{isFront:k,poolInfoQuery:R,lpBalanceQuery:M,lpBalance:E,lpBalancePercentage:T,lpToAmountA:W,lpToAmountB:L,price:V,invertedPrice:O,liquidityMinted:null===(m=S.data)||void 0===m?void 0:m.liquidityMinted,pairMintAAmount:null===(g=S.data)||void 0===g?void 0:g.pairMintAAmount,pairMintBAmount:null===(x=S.data)||void 0===x?void 0:x.pairMintBAmount,isExists:I}}const wc="DODO_WIDGET_POOL_LIST_TAB",kc="DODO_WIDGET_POOLS_LIST_FILTER_CHAIN";var Rc;!function(e){e.addLiquidity="add-liquidity",e.myLiquidity="my-liquidity",e.myCreated="my-created"}(Rc||(Rc={}));var Mc=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],o=0;o<e.rangeCount;o++)n.push(e.getRangeAt(o));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},Sc={"text/plain":"Text","text/html":"Url",default:"Text"};var Ec,Tc,Wc=function(e,t){var n,o,i,r,a,l,s=!1;t||(t={}),n=t.debug||!1;try{if(i=Mc(),r=document.createRange(),a=document.getSelection(),(l=document.createElement("span")).textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",(function(o){if(o.stopPropagation(),t.format)if(o.preventDefault(),void 0===o.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var i=Sc[t.format]||Sc.default;window.clipboardData.setData(i,e)}else o.clipboardData.clearData(),o.clipboardData.setData(t.format,e);t.onCopy&&(o.preventDefault(),t.onCopy(o.clipboardData))})),document.body.appendChild(l),r.selectNodeContents(l),a.addRange(r),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");s=!0}catch(i){n&&console.error("unable to copy using execCommand: ",i),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(i){n&&console.error("unable to copy using clipboardData: ",i),n&&console.error("falling back to prompt"),o=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(o,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(r):a.removeAllRanges()),l&&document.body.removeChild(l),i()}return s},Lc=_e(Wc);function Ic({copyText:e,size:t,sx:n,componentProps:i,onClick:r,children:a}){var l;const[s,d]=X.useState(!1);return ut.jsx(O,{title:o._({id:"6V3Ea3",message:"Copied"}),open:s,onClose:()=>d(!1),arrow:!1,children:ut.jsxs(m,{...i,component:null!==(l=null==i?void 0:i.component)&&void 0!==l?l:S,onClick:t=>{if(null==i?void 0:i.onClick)return i.onClick(t);t.stopPropagation(),e&&(Lc(e),d(!0)),r&&r()},sx:Object.assign({cursor:"pointer"},null==i?void 0:i.sx),children:[ut.jsx(m,{component:$e.Copy,sx:Object.assign({width:t||"auto",height:t||"auto"},n)}),a]})})}function Vc({truncate:e,address:t,disabledAddress:n,sx:o,handleOpen:i,addressHoverColor:r,addressHoverShowIcon:a}){return n?ut.jsx(m,{children:e?rc(t):t}):ut.jsx(Z,{lineSx:{bottom:-1},lineColor:null!=r?r:(null==o?void 0:o.color)||"",hoverSx:{color:"addressHoverColor","& svg":{display:"inline-block"}},className:"truncate-address-link",children:ut.jsxs(m,{onClick:e=>{null==i||i(e,"address")},sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[e?rc(t):t,a?ut.jsx(m,{component:$e.ArrowRight,sx:{display:"none",width:14,height:14}}):""]})})}function Oc({address:e,truncate:t,showCopy:n,size:o="medium",iconSize:i,iconSpace:r,sx:a,iconDarkHover:l,disabledAddress:s,addressHoverColor:d,addressHoverShowIcon:c,customChainId:u,handleOpen:p,onAddressClick:h}){const f=g(),x="medium"===o,v=l?F:y,b=e=>{let t=e?12:8;return r&&(t=r),l&&(t-=3),t},j="big"===o?"h5":x?"body1":"body2",{chainId:C}=sr(),w=null!=u?u:C,k=(t,n)=>{p?p(t,n):w&&(t.stopPropagation(),window.open(ac(w,e,"address")))};return ut.jsxs(m,{sx:Object.assign({display:"flex",alignItems:"center",typography:j,color:f.palette.text.primary,lineHeight:"normal"},a||{}),children:[ut.jsx(Vc,{truncate:t,address:e,disabledAddress:s,sx:a,typography:j,handleOpen:null!=h?h:k,addressHoverColor:d,addressHoverShowIcon:c}),ut.jsx(v,{sx:{display:"inline-flex",ml:b(x),cursor:"pointer"},onClick:e=>{k(e,"icon")},children:ut.jsx(m,{component:$e.ArrowTopRightBorder,sx:{width:i||(x?16:14),height:i||(x?16:14)}})}),n?ut.jsx(Ic,{size:i||(x?16:14),copyText:e,componentProps:{component:v,sx:{ml:b(x)}}}):null]})}function Zc(e){var{sx:t,label:n,children:o}=e,i=nr(e,["sx","label","children"]);return ut.jsxs(m,{sx:Object.assign({display:"flex",justifyContent:"space-between"},t),...i,children:[ut.jsx(m,{children:n}),ut.jsx(m,{sx:{textAlign:"right",fontWeight:600},children:o})]})}function Fc({tokens:e,width:t=24,height:n=24,gap:o=-4,cross:i,mr:r,chainId:a,showChainLogo:l,sx:s}){var d;const c=g(),{onlyChainId:u}=ar(),p=l&&!u;if(!e||e.length<=0)return null;const h=t/2;return ut.jsxs(m,{sx:Object.assign({display:"inline-flex",alignItems:"center",mr:r,position:"relative",zIndex:0},s),children:[e.map(((e,n)=>ut.jsx(m,{sx:{display:"inline-flex",width:t,height:t,ml:n>0?o:0,borderRadius:"50%",backgroundColor:c.palette.background.default},children:"object"==typeof e?ut.jsx(Kl,{address:e.address,width:t,height:t,chainId:a,url:e.logoURI,cross:i,noShowChain:!0,noBorder:!0,marginRight:0}):ut.jsx(m,{component:"img",height:t,src:e})},n))),p&&Ql.has(a)?ut.jsx(m,{component:null===(d=Ql.get(a))||void 0===d?void 0:d.logo,sx:{position:"absolute",bottom:0,right:0,zIndex:e.length+1,transform:"translateX(50%)",width:h,height:h}}):""]})}function Nc({baseToken:e,quoteToken:t,midPrice:n,loading:o,disabled:i}){const r=g(),[a,l]=q(!1),s=a?null==t?void 0:t.symbol:null==e?void 0:e.symbol,d=a&&n?new te(1).div(n):n,c=a?null==e?void 0:e.symbol:null==t?void 0:t.symbol;return ut.jsxs(M,{sx:{display:"flex",alignItems:"center",fontWeight:600,overflow:"hidden"},loading:o,loadingProps:{width:50},children:[e&&t?ut.jsx(L,{title:`1 ${s} = ${d?br({input:d}):""} ${c}`,children:n?ut.jsx(m,{sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:`1 ${s} = ${d?br({input:d}):""} ${c}`}):ut.jsxs(m,{children:[`1 ${s} = `,ut.jsx(M,{loading:o,loadingProps:{width:30},component:"span",sx:{display:"inline-block"},children:"-"}),` ${c}`]})}):"-",ut.jsx(m,{sx:Object.assign({display:"flex",alignItems:"center",justifyContent:"center",ml:4,width:18,height:18,backgroundColor:"background.paperDarkContrast",borderRadius:"50%"},!i&&{cursor:"pointer","&:hover":{backgroundColor:T(r.palette.text.primary,.04)}}),onClick:()=>{i||l((e=>!e))},children:ut.jsx(m,{component:$e.Switch,sx:{width:18,height:18}})})]})}function Ac({baseToken:e,quoteToken:t,loading:o,midPrice:i,lpBalancePercentage:r,sx:a}){const l=g(),s=!e||!t;return ut.jsxs(m,{sx:Object.assign({mt:20,border:"solid 1px",borderColor:"border.main",borderRadius:8},a),children:[ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:12,py:4,height:36,typography:"body2"},children:[ut.jsx(m,{sx:{color:"text.secondary",whiteSpace:"nowrap"},children:ut.jsx(n,{id:"kNeEXg",message:"Current Price"})}),ut.jsx(Nc,{baseToken:e,quoteToken:t,loading:o,disabled:s,midPrice:i})]}),ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:12,py:4,minHeight:36,typography:"body2",borderStyle:"solid",borderWidth:l.spacing(1,0,0),borderColor:"border.main"},children:[ut.jsx(m,{sx:{display:"flex",alignItems:"center",color:"text.secondary",whiteSpace:"nowrap"},children:ut.jsx(n,{id:"SbBMxj",message:"Share of pool"})}),ut.jsx(m,{sx:{display:"flex",alignItems:"center",fontWeight:600,textAlign:"right",ml:8,overflow:"hidden"},children:ut.jsx(M,{sx:{display:"flex",alignItems:"center",fontWeight:600,overflow:"hidden"},loading:o,loadingProps:{width:50},children:r?`${Ir({input:r,roundingMode:te.ROUND_DOWN})}`:"-%"})})]})]})}function Hc({open:e,onClose:t,slippage:o,baseToken:i,quoteToken:r,pairMintAAmount:a,pairMintBAmount:l,lpAmount:s,feeRate:d,price:c,lpBalancePercentage:u,pairAddress:p,createMutation:h}){const f=g(),{isMobile:x}=Kd();return ut.jsx(Ed,{modal:!0,open:e,onClose:t,title:s?ut.jsx(n,{id:"AeZIvT",message:"You will receive"}):ut.jsx(n,{id:"aM1tos",message:"You are creating a pool"}),children:ut.jsxs(m,{sx:{px:20,py:24,borderTopWidth:1,width:x?"100%":420},children:[ut.jsxs(m,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4,typography:"h3"},children:[ut.jsx(Fc,{width:24,height:24,tokens:i&&r?[i,r]:[]}),s?jr({input:s,decimals:null==i?void 0:i.decimals}):""]}),ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4,fontWeight:600},children:[ut.jsx(n,{id:"syToc5",message:"{0}/{1} Pool Tokens",values:{0:null==i?void 0:i.symbol,1:null==r?void 0:r.symbol}}),ut.jsx(m,{sx:{px:4,py:2,fontSize:10,lineHeight:1,backgroundColor:T(f.palette.purple.main,.1),color:f.palette.purple.main,borderRadius:4},children:ut.jsx(n,{id:"rbsyJM",message:"AMM V2"})})]})]}),ut.jsx(m,{sx:{mt:16,typography:"h6",color:"text.secondary",textAlign:"center"},children:ut.jsx(n,{id:"rQ9c+8",message:"Output is estimated. If the price changes by more than {0} your transaction will revert.",values:{0:Ir({input:o})}})}),ut.jsxs(m,{sx:{display:"flex",flexDirection:"column",gap:12,mt:20,p:20,typography:"body2",borderRadius:12,backgroundColor:f.palette.background.paperContrast},children:[ut.jsx(Zc,{label:ut.jsx(n,{id:"YG004A",message:"{0} deposited",values:{0:null==i?void 0:i.symbol}}),children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[ut.jsx(Kl,{width:18,height:18,marginRight:4,token:i}),jr({input:a,decimals:null==i?void 0:i.decimals})]})}),ut.jsx(Zc,{label:ut.jsx(n,{id:"YG004A",message:"{0} deposited",values:{0:null==r?void 0:r.symbol}}),children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(Kl,{width:18,height:18,marginRight:4,token:r}),jr({input:l,decimals:null==r?void 0:r.decimals})]})}),ut.jsx(Zc,{label:ut.jsx(n,{id:"EU3wU4",message:"Fee tier"}),children:null!=d?Number(d)/1e4+"%":"-"}),ut.jsx(Zc,{label:ut.jsx(n,{id:"fqDzSu",message:"Rate"}),children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(Kl,{width:18,height:18,marginRight:4,token:i}),ut.jsx(Nc,{baseToken:i,quoteToken:r,midPrice:c})]})}),ut.jsx(Zc,{label:ut.jsx(n,{id:"SbBMxj",message:"Share of pool"}),children:u?`${Ir({input:u})}`:"-%"}),ut.jsx(Zc,{label:ut.jsx(n,{id:"ESQO1L",message:"Pool address"}),children:ut.jsx(Oc,{showCopy:!1,address:null!=p?p:"",customChainId:null==i?void 0:i.chainId,truncate:!0,iconSpace:4,sx:{typography:"body2"}})})]}),ut.jsx(v,{fullWidth:!0,size:v.Size.big,sx:{mt:20},isLoading:h.isPending,onClick:()=>{h.mutate()},children:h.isPending?ut.jsx(n,{id:"pwUZo2",message:"Confirming..."}):ut.jsx(n,{id:"7VpPHA",message:"Confirm"})})]})})}function Pc({title:e,disabled:t,children:n}){return ut.jsxs(m,{sx:{display:"flex",flexDirection:"column",gap:12,opacity:t?.3:void 0},children:[ut.jsx(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",fontWeight:600},children:e}),n]})}function Bc({disabled:e,feeIndex:t,onChange:o,feeList:i}){const r=g(),[a,l]=X.useState(!1),{isMobile:s}=Kd(),d=e,c=i[t];return ut.jsxs(m,{sx:{opacity:e?.3:void 0,fontWeight:600},children:[ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:20,py:12,borderWidth:1,borderRadius:12},children:[ut.jsx(n,{id:"tMMG40",message:"{0}% fee tier",values:{0:c?new te(c.tradeFeeRate).div(1e4).toString():"-"}}),ut.jsx(S,{sx:{px:16,py:7,border:`solid 1px ${r.palette.text.primary}`,borderRadius:8,fontWeight:600,color:"text.primary",cursor:d?"default":"pointer"},disabled:d,onClick:()=>{d||l((e=>!e))},children:a?ut.jsx(n,{id:"vLyv1R",message:"Hide"}):ut.jsx(n,{id:"ePK91l",message:"Edit"})})]}),a&&ut.jsx(ut.Fragment,{children:ut.jsx(m,{sx:Object.assign({mt:12},s?{display:"grid",gap:8,gridTemplateColumns:"repeat(2, 1fr)"}:{display:"flex",alignItems:"center",gap:8,"& > label":{flex:1}}),children:i.map(((e,n)=>{const i=t===n;return ut.jsxs(m,{component:"label",sx:Object.assign({display:"flex",alignItems:"center",justifyContent:"space-between",px:20,py:12,borderWidth:1,borderRadius:12,cursor:"pointer"},i&&{borderColor:r.palette.primary.main}),children:[e.tradeFeeRate/1e4,"%",ut.jsx(N,{size:18,checked:i,onChange:(e,t)=>{t&&o(n)}})]},e.id)}))})})]})}function Uc({chainId:e,address:t,showName:n,size:o,offset:i,rightContent:r}){const a=ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:i},children:[ut.jsx(Kl,{chainId:e,address:t,width:o,height:o,noShowChain:!0,marginRight:0}),n]});return r?ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a,r]}):a}function Dc({isExists:e,poolInfo:t,poolInfoLoading:o,lpBalanceLoading:r,lpBalance:a,lpBalancePercentage:l,lpToAmountA:s,lpToAmountB:d,sx:c}){var u,p;const h=l?`${Ir({input:l,roundingMode:te.ROUND_DOWN})}`:void 0;return e&&t?ut.jsxs(m,{sx:Object.assign({px:20,py:12,borderWidth:1,borderRadius:8},c),children:[ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"YHc3B+",message:"My Liquidity"})}),ut.jsxs(m,{sx:{mt:12,display:"flex",alignItems:"center",flexWrap:"wrap"},children:[ut.jsx(Fc,{width:18,height:18,tokens:[t.mintA,t.mintB],mr:4}),ut.jsx(M,{loading:r,loadingProps:{width:50},sx:{mr:4},children:jr({input:a,decimals:t.lpMint.decimals})}),`${t.mintA.symbol}/${t.mintB.symbol} LP`,ut.jsx(L,{title:ut.jsxs(m,{sx:{display:"flex",flexDirection:"column",gap:10,typography:"body2",color:"text.primary"},children:[ut.jsx(Uc,{address:t.mintA.address,chainId:t.mintA.chainId,showName:null!==(u=t.mintA.symbol)&&void 0!==u?u:"",size:14,offset:4,rightContent:ut.jsx(M,{loading:o,loadingProps:{width:50},children:jr({input:s,decimals:t.mintA.decimals})})}),ut.jsx(Uc,{address:t.mintB.address,chainId:t.mintB.chainId,showName:null!==(p=t.mintB.symbol)&&void 0!==p?p:"",size:14,offset:4,rightContent:ut.jsx(M,{loading:o,loadingProps:{width:50},children:jr({input:d,decimals:t.mintB.decimals})})}),ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[ut.jsx(n,{id:"c4miqE",message:"Pool share"}),ut.jsx(M,{loading:o,loadingProps:{width:50},children:h})]})]}),sx:{padding:20,width:256},children:ut.jsx(y,{component:$e.DetailBorder,sx:{ml:4,width:16,height:16,cursor:"pointer"}})}),ut.jsx(m,{component:"a",target:"_blank",rel:"noopener noreferrer",href:ac(i.SOON_TESTNET,t.lpMint.address,"address"),sx:{ml:4,display:"inline-flex",height:16},children:ut.jsx(y,{component:$e.ArrowTopRightBorder,sx:{width:16,height:16}})})]})]}):null}function Yc({active:e,sx:t,onClick:o}){const i=g(),r="light"===i.palette.mode;let a=i.palette.primary.main,l="transparent";return e&&(a=i.palette.primary.contrastText,l=T(i.palette.primary.main,.8)),ut.jsx(m,{component:S,sx:Object.assign({typography:"body2",p:e?i.spacing(8,20,9):i.spacing(7,19,8),minWidth:79,border:e?void 0:`1px solid ${a}`,color:a,backgroundColor:l,borderRadius:8,fontWeight:600,"&:hover":{color:e?i.palette.primary.contrastText:i.palette.primary.main,backgroundColor:e?i.palette.primary.main:r?"rgba(26, 26, 27, 0.04)":"rgba(241, 249, 2, 0.08)"}},t),onClick:o,children:ut.jsx(n,{id:"R9Khdg",message:"Auto"})})}function zc({sx:e,disabled:t,slippage:o,onChangeSlippage:i}){const r=g(),a=o===yc,[l,s]=q(a?"":new te(o).times(100).toNumber());return ut.jsx(L,{disabled:t,onlyClick:!0,title:ut.jsxs(m,{sx:{backgroundColor:r.palette.background.paper,padding:r.spacing(16,20),borderRadius:16,width:375,maxWidth:"90vw",boxSizing:"border-box"},children:[ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",typography:"body2",color:"text.primary"},children:[ut.jsx("span",{children:ut.jsx(n,{id:"lqTDfd",message:"Slippage Tolerance"})}),ut.jsxs("span",{children:[a?bc:o&&new te(o).times(100).toNumber(),"%"]})]}),ut.jsxs(m,{sx:{mt:16,display:"flex",alignItems:"center",margin:r.spacing(16,0,0,0)},children:[ut.jsx(Yc,{sx:{borderRadius:8,whiteSpace:"nowrap"},onClick:()=>{s(""),i(yc)},active:a}),ut.jsx(E,{placeholder:String(bc),value:l,onChange:e=>{const{value:t}=e.target;s(t),i(t?new te(t).div(100).toNumber():yc)},onBlur:()=>{(!a&&new te(o).gt(.1)||new te(o).lte(0))&&(s(10),i(.1))},suffix:ut.jsx(m,{sx:{mr:16},children:"%"}),sx:{ml:8,"& input":{px:16,py:0,height:"39px"}}})]})]}),sx:{p:0},arrow:!1,placement:"bottom-end",children:ut.jsx(F,{sx:Object.assign({width:"max-content",alignItems:"right",margin:r.spacing(0,0,0,"auto"),p:r.spacing(4,12),borderRadius:20,backgroundColor:"background.paperDarkContrast",cursor:"pointer"},e),children:ut.jsx(m,{component:$e.Setting,sx:{width:18,height:18,"& path:last-child":{fill:r.palette.text.primary}}})})})}function Xc(){var e,t,o;const[i,r]=X.useState(0),[a,l]=X.useState(),[s,d]=X.useState(),[c,u]=X.useState(""),[p,h]=X.useState(""),[f,g]=X.useState(yc),x=f===yc?new te(bc).div(100).toNumber():f,{isMobile:y}=Kd(),{onlyChainId:b}=ar(),j=X.useMemo((()=>b||(null==a?void 0:a.chainId)||(null==s?void 0:s.chainId)),[b,a,s]),{poolKeys:C,poolInfo:w,pairAddress:k,price:R,isInvalidPair:M,invertedPrice:S,poolInfoLoading:E,lpBalanceLoading:T,lpBalance:W,lpBalancePercentage:L,lpToAmountA:I,lpToAmountB:V,liquidityMinted:O,pairMintAAmount:Z,pairMintBAmount:F,isExists:N}=function({baseToken:e,quoteToken:t,baseAmount:n,quoteAmount:o,feeIndex:i,slippage:r}){var a,l,s;const[d,c]=X.useMemo((()=>{if(!e||!t||null==i)return[void 0,!0];const n=new qe(new ke(e.address).toBuffer()).lte(new qe(new ke(t.address).toBuffer())),[o,r]=n?[e,t]:[t,e],[a,l]=[new ke(o.address),new ke(r.address)];return[Ae({poolId:void 0,programId:Or,configId:new ke(Fr[i].id),mintA:a,mintB:l}),a.toBase58()===l.toBase58()]}),[i,e,t]),{price:u,invertedPrice:p,poolInfoQuery:h,lpBalanceQuery:f,lpBalance:m,lpBalancePercentage:g,lpToAmountA:x,lpToAmountB:v,liquidityMinted:y,pairMintAAmount:b,pairMintBAmount:j,isExists:C}=Cc({pool:e&&t&&d?{baseToken:e,quoteToken:t,address:d.poolId.toBase58()}:void 0,baseAmount:n,quoteAmount:o,slippage:r});return{poolKeys:null===(a=h.data)||void 0===a?void 0:a.poolKeys,poolInfo:null===(l=h.data)||void 0===l?void 0:l.poolInfo,pairAddress:null===(s=null==d?void 0:d.poolId)||void 0===s?void 0:s.toBase58(),isInvalidPair:c,price:u,invertedPrice:p,poolInfoLoading:h.isLoading,lpBalanceLoading:f.isLoading,lpBalance:m,lpBalancePercentage:g,lpToAmountA:x,lpToAmountB:v,liquidityMinted:y,pairMintAAmount:b,pairMintBAmount:j,isExists:C}}({baseToken:a,quoteToken:s,baseAmount:c,quoteAmount:p,feeIndex:i,slippage:x}),A=function(e){const t=$();return J((()=>{t.current=e})),t.current}(R);if(R&&c&&!R.isEqualTo(null!=A?A:0)&&N){const t=R.times(c).dp(null!==(e=null==s?void 0:s.decimals)&&void 0!==e?e:18);t.isEqualTo(p)||h(t.toString())}const H=Ta(a,{amount:c}),P=Ta(s,{amount:p}),[B,U]=X.useState(!1),D=!a||!s,Y=()=>{fc.getState().push({type:hc.Pool})},z=jc({baseToken:a,quoteToken:s,pairMintAAmount:Z,pairMintBAmount:F,isExists:N,poolKeys:C,poolInfo:w,slippage:x,successBack:()=>{fc.getState().push({type:hc.Pool,params:{tab:Rc.myLiquidity}})}});return ut.jsxs(vc,{children:[ut.jsxs(m,{sx:{mx:"auto",borderRadius:y?0:16,backgroundColor:"background.paper",width:y?"100%":600,position:"relative",overflow:"hidden"},children:[y?ut.jsx(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20,pb:0},children:ut.jsx(mc,{onClick:Y})}):ut.jsxs(m,{sx:{position:"relative",display:"flex",justifyContent:"center",alignItems:"center",px:20,py:24,typography:"caption"},children:[ut.jsx(m,{component:$e.ArrowBack,sx:{position:"absolute",left:20,cursor:"pointer"},onClick:Y}),ut.jsx(n,{id:"E6MqGy",message:"Add liquidity"})]}),ut.jsxs(m,{sx:{display:"flex",flexDirection:"column",gap:20,pt:24,px:20,pb:20},children:[ut.jsx(Dc,{isExists:N,poolInfo:w,poolInfoLoading:E,lpBalanceLoading:T,lpBalance:W,lpBalancePercentage:L,lpToAmountA:I,lpToAmountB:V}),ut.jsxs(Pc,{title:ut.jsx(n,{id:"nxRg31",message:"Select pair"}),children:[ut.jsxs(m,{sx:{display:"grid",gridTemplateColumns:y?"repeat(1, 1fr)":"repeat(2, 1fr)",gap:12},children:[ut.jsx(xc,{border:!0,highlightDefault:!0,chainId:j,token:a,onTokenChange:(e,t)=>{t?(l(s),d(a),u(""),h("")):(l(e),u(""))},occupiedToken:s}),ut.jsx(xc,{border:!0,highlightDefault:!0,chainId:j,token:s,onTokenChange:(e,t)=>{t?(l(s),d(a)):(d(e),h(""))},occupiedToken:a})]}),ut.jsx(Bc,{feeIndex:i,onChange:r,feeList:Fr,disabled:D})]}),ut.jsx(Pc,{title:ut.jsx(n,{id:"MU9s7M",message:"Deposit amounts"}),disabled:D,children:ut.jsxs(m,{children:[ut.jsx(cc,{sx:{mb:4,pb:28,minHeight:"auto"},token:a,amt:c,defaultLoadBalance:!0,onInputChange:e=>{var t;u(e);const n=Number(e);N&&R&&n&&h(R.times(e).dp(null!==(t=null==s?void 0:s.decimals)&&void 0!==t?t:18).toString())},showMaxBtn:!0,occupiedAddrs:[null!==(t=null==s?void 0:s.address)&&void 0!==t?t:""],occupiedChainId:null==s?void 0:s.chainId,notTokenPickerModal:!0,showPercentage:!0,readOnly:D}),ut.jsx(Jd,{plus:!0}),ut.jsx(cc,{sx:{pb:20,minHeight:"auto"},token:s,amt:p,defaultLoadBalance:!0,onInputChange:e=>{var t;h(e);const n=Number(e);N&&S&&n&&u(S.times(e).dp(null!==(t=null==a?void 0:a.decimals)&&void 0!==t?t:18).toString())},showMaxBtn:!0,occupiedAddrs:[null!==(o=null==a?void 0:a.address)&&void 0!==o?o:""],occupiedChainId:null==a?void 0:a.chainId,notTokenPickerModal:!0,showPercentage:!0,readOnly:D}),ut.jsx(zc,{slippage:f,onChangeSlippage:g,disabled:D,sx:{mt:8}}),ut.jsx(Ac,{baseToken:a,quoteToken:s,loading:E,midPrice:R,lpBalancePercentage:N?L:100}),!!N&&ut.jsxs(m,{sx:{mt:20,p:20,borderRadius:16,backgroundColor:"background.paperContrast",typography:"h6",textAlign:"center","& > b":{fontWeight:600,color:"primary.main"}},children:["🌟",ut.jsx("b",{children:ut.jsx(n,{id:"e38JNU",message:"Tips:"})})," ",ut.jsx(n,{id:"XoymfI",message:"By adding liquidity you’ll earn <0>{0}</0>of all trades on this pair proportional to your share of the pool. Fees are added to the pool, accrue in real time and can be claimed by withdrawing your liquidity.",values:{0:Ir({input:Fr[i].tradeFeeRate/1e4})},components:{0:ut.jsx("b",{})}})]})]})})]}),ut.jsx(m,{sx:{py:16,px:20,borderTopWidth:1},children:ut.jsx(Pd,{fullWidth:!0,includeButton:!0,size:v.Size.big,disabled:D,chainId:j,children:ut.jsx(gc,{statuses:[H,P],buttonProps:{size:v.Size.big},children:ut.jsx(v,{fullWidth:!0,size:v.Size.big,disabled:!(a&&s&&c&&p&&!M&&null!=i),onClick:()=>U(!0),children:M?ut.jsx(n,{id:"R7D79P",message:"Invalid pair"}):ut.jsx(n,{id:"bwSQI0",message:"Supply"})})})})})]}),ut.jsx(Hc,{open:B,onClose:()=>U(!1),slippage:x,baseToken:a,pairMintAAmount:Z,quoteToken:s,pairMintBAmount:F,feeRate:Fr[i].tradeFeeRate,price:R,lpAmount:O,lpBalancePercentage:N?L:100,pairAddress:k,createMutation:z})]})}function qc({title:e,desc:t,linkTo:o,LeftImage:i,sx:r}){const a=g(),l="light"===a.palette.mode;return ut.jsxs(m,{sx:Object.assign({backgroundColor:a.palette.background.paper,borderRadius:16,padding:20},r),children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:[ut.jsx(m,{sx:{backgroundColor:T(a.palette.secondary.main,.3),color:l?"#EB8D27":a.palette.secondary.main,borderRadius:6,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center"},children:ut.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",children:ut.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.55558 0.888672C3.87558 0.888672 0.888916 3.87534 0.888916 7.55534C0.888916 11.2353 3.87558 14.222 7.55558 14.222C11.2356 14.222 14.2222 11.2353 14.2222 7.55534C14.2222 3.87534 11.2356 0.888672 7.55558 0.888672ZM8.22225 11.5553V10.222H6.88892V11.5553H8.22225ZM4.88892 6.22201C4.88892 4.74867 6.08225 3.55534 7.55558 3.55534C9.02892 3.55534 10.2222 4.74867 10.2222 6.22201C10.2222 7.07728 9.69557 7.53755 9.18276 7.9857C8.69626 8.41085 8.22225 8.82509 8.22225 9.55534H6.88892C6.88892 8.34116 7.51699 7.85973 8.06921 7.43646C8.50241 7.10441 8.88892 6.80815 8.88892 6.22201C8.88892 5.48867 8.28892 4.88867 7.55558 4.88867C6.82225 4.88867 6.22225 5.48867 6.22225 6.22201H4.88892Z",fill:"currentColor"})})}),ut.jsx(m,{sx:{color:a.palette.text.primary,typography:"body1",fontWeight:600,ml:4},children:ut.jsx(n,{id:"cmUrtC",message:"SEE HOW IT WORKS"})})]}),ut.jsxs(m,{sx:{mt:20,borderTopWidth:1,pt:20,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(m,{component:i,sx:{width:64,height:64,flexShrink:0}}),ut.jsxs(m,{sx:{ml:16,color:a.palette.text.primary,typography:"body1",fontWeight:600},children:[e,ut.jsx(m,{sx:{mt:4,color:a.palette.text.secondary,typography:"body2",fontWeight:500},children:t})]})]}),ut.jsx(m,{component:"a",href:o,target:"_blank",rel:"noopener noreferrer",sx:{pl:16,flexShrink:0},children:ut.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:ut.jsx("path",{d:"M7.23375 3.75L6 4.98375L10.0075 9L6 13.0162L7.23375 14.25L12.4838 9L7.23375 3.75Z",fill:a.palette.text.primary})})})]})]})}function Jc({message:e,onClose:t}){return ut.jsx(Ed,{open:!!e,onClose:t,id:"error-message",children:ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{sx:{flex:1,textAlign:"center"},children:[ut.jsx(m,{component:$e.ErrorWarn,sx:{mt:60,width:64,height:64,color:"error.main"}}),e?ut.jsxs(m,{sx:{textAlign:"center",mt:60},children:[ut.jsx(m,{children:ut.jsx(n,{id:"kf83Ld",message:"Something went wrong."})}),ut.jsx(m,{sx:{color:"text.secondary",mt:12,typography:"body2",wordBreak:"break-all"},children:e})]}):""]}),ut.jsx(m,{sx:{px:16,py:20},children:ut.jsx(v,{onClick:t,fullWidth:!0,children:ut.jsx(n,{id:"1QfxQT",message:"Dismiss"})})})]})})}function Gc({status:e,children:t,buttonProps:o}){return!e.needShowTokenStatusButton&&t?ut.jsx(ut.Fragment,{children:t}):e.insufficientBalance?ut.jsx(v,{fullWidth:!0,disabled:!0,...o,children:ut.jsx(n,{id:"znqB4T",message:"Insufficient balance"})}):ut.jsx(v,{fullWidth:!0,isLoading:e.isApproving,onClick:e.submitApprove,disabled:e.insufficientBalance,...o,children:e.isApproving?ut.jsx(n,{id:"j2Uisd",message:"Approving"}):e.approveTitle})}function Qc({chainId:e,baseTokenStatus:t,quoteTokenStatus:o,children:i}){const{runningRequests:r}=Jr(),{account:a,chainId:l}=sr();if(!a||e!==l)return ut.jsx(Pd,{chainId:e,fullWidth:!0});const s=r.some((e=>{var t,n;return(null===(t=e.metadata)||void 0===t?void 0:t[cr.addLiquidity])||(null===(n=e.metadata)||void 0===n?void 0:n[cr.removeLiquidity])})),d=[];t.needShowTokenStatusButton&&d.push(ut.jsx(Gc,{status:t})),o.needShowTokenStatusButton&&!t.isApproving&&d.push(ut.jsx(Gc,{status:o}));const c=d.length;return 2===c?ut.jsx(m,{sx:{display:"flex","& > button":{flex:1,"&:last-child":{ml:8}}},children:d.map((e=>e))}):1===c?d[0]:s?ut.jsx(v,{fullWidth:!0,disabled:!0,isLoading:!0,children:ut.jsx(n,{id:"UbRKMZ",message:"Pending"})}):ut.jsx(ut.Fragment,{children:i})}function _c({pool:e,maxBaseAmount:t,maxQuoteAmount:n,isRemove:o}){const[i,r]=X.useState(""),[a,l]=X.useState(""),[s,d]=X.useState(Pi),c=s===Pi?new te(bc).div(100).toNumber():s,u=()=>{r(""),l("")},p=Cc({pool:(null==e?void 0:e.baseToken)&&e.quoteToken?{baseToken:e.baseToken,quoteToken:e.quoteToken,address:e.address}:void 0,baseAmount:i,quoteAmount:a,slippage:c}),h=p.isFront?p.price:p.invertedPrice,f=h||new te(1),m=X.useRef(f);if(!e||f.isNaN())return{baseAmount:i,quoteAmount:a,handleChangeBaseAmount:()=>{},handleChangeQuoteAmount:()=>{},reset:u,uniV2Pair:p,slippage:s,slippageNumber:c,setSlippage:d};const g=e.baseToken.decimals,x=e.quoteToken.decimals,v=e=>{if(e){let i=f.multipliedBy(e).dp(x).toString();n&&o&&(n.lte(i)||(null==t?void 0:t.lte(0)))&&(i=n.toString()),l(i)}else l(e)};m.current&&f.isEqualTo(m.current)||(m.current=f,v(i));return{baseAmount:i,quoteAmount:a,handleChangeBaseAmount:e=>{let t=kr(e,g);null===t&&(t=i),r(t),v(t)},handleChangeQuoteAmount:e=>{let i=kr(e,x);null===i&&(i=a),l(i),(e=>{if(e){let i=new te(e).div(f).dp(g).toString();t&&o&&(t.lte(i)||(null==n?void 0:n.lte(0)))&&(i=t.toString()),r(i)}else r(e)})(i)},reset:u,midPrice:h,addPortion:f,amountCheckedDisabled:!i||!a,uniV2Pair:p,slippage:s,slippageNumber:c,setSlippage:d}}function Kc({submittedBack:e,pool:t}){var n,i,r;const a="SVM_AMMV2"===(null==t?void 0:t.type),[l,s]=X.useState(!1),{baseAmount:d,quoteAmount:c,midPrice:u,amountCheckedDisabled:p,uniV2Pair:h,handleChangeBaseAmount:f,handleChangeQuoteAmount:g,reset:x,slippage:y,slippageNumber:b,setSlippage:j}=_c({pool:t});X.useEffect((()=>{x()}),[t]);const C=Ta(null==t?void 0:t.baseToken,{amount:d}),w=Ta(null==t?void 0:t.quoteToken,{amount:c}),k=C.insufficientBalance||w.insufficientBalance,R=!t||k||!u||!!h.poolInfoQuery.isLoading||!!h.poolInfoQuery.error||p||h.poolInfoQuery.isLoading;let M=a?o._({id:"bwSQI0",message:"Supply"}):o._({id:"m16xKo",message:"Add"});k&&(M=o._({id:"znqB4T",message:"Insufficient balance"}));const S=jc({baseToken:null==t?void 0:t.baseToken,quoteToken:null==t?void 0:t.quoteToken,pairMintAAmount:h.pairMintAAmount,pairMintBAmount:h.pairMintBAmount,isExists:h.isExists,poolKeys:null===(n=h.poolInfoQuery.data)||void 0===n?void 0:n.poolKeys,poolInfo:null===(i=h.poolInfoQuery.data)||void 0===i?void 0:i.poolInfo,slippage:b,submittedBack:()=>{x(),e&&e(),s(!1)}}),E=!(null==t?void 0:t.baseToken)||!(null==t?void 0:t.quoteToken);return ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{sx:{pt:20,pb:18,px:20},children:[ut.jsx(cc,{sx:{mb:4,pb:28,minHeight:"auto"},amt:d,token:null==t?void 0:t.baseToken,canClickBalance:!0,showPercentage:!0,onInputChange:f,readOnly:h.poolInfoQuery.isLoading}),ut.jsx(Jd,{plus:!0}),ut.jsx(cc,{sx:{pb:20,minHeight:"auto"},amt:c,token:null==t?void 0:t.quoteToken,canClickBalance:!0,showPercentage:!0,onInputChange:g,readOnly:h.poolInfoQuery.isLoading}),ut.jsx(zc,{slippage:y,onChangeSlippage:j,disabled:E,sx:{mt:8}}),ut.jsx(Ac,{baseToken:null==t?void 0:t.baseToken,quoteToken:null==t?void 0:t.quoteToken,loading:h.poolInfoQuery.isLoading,midPrice:u,lpBalancePercentage:h.isExists?h.lpBalancePercentage:100})]}),ut.jsx(m,{sx:{px:20,py:16,position:"sticky",bottom:0,borderStyle:"solid",borderWidth:"1px 0 0",borderColor:"border.main",backgroundColor:"background.paper"},children:t?ut.jsx(Qc,{chainId:t.chainId,baseTokenStatus:C,quoteTokenStatus:w,children:ut.jsx(v,{fullWidth:!0,disabled:R,isLoading:S.isPending,onClick:()=>{R||s(!0)},children:M})}):ut.jsx(v,{fullWidth:!0,disabled:!0,children:M})}),ut.jsx(Jc,{message:null===(r=S.error)||void 0===r?void 0:r.message,onClose:()=>S.reset()}),a&&!!t&&ut.jsx(Hc,{open:l,onClose:()=>s(!1),slippage:b,baseToken:t.baseToken,quoteToken:t.quoteToken,pairMintAAmount:h.pairMintAAmount,pairMintBAmount:h.pairMintBAmount,feeRate:t.lpFeeRate,price:null==h?void 0:h.price,lpAmount:null==h?void 0:h.liquidityMinted,lpBalancePercentage:h.isExists?h.lpBalancePercentage:100,pairAddress:t.address,createMutation:S})]})}!function(e){e[e.Liquidity=1]="Liquidity",e[e.Mining=2]="Mining"}(Ec||(Ec={})),function(e){e[e.LOW=1e3]="LOW"}(Tc||(Tc={})),Tc.LOW;const $c={[Tc.LOW]:{label:"0.1%"}};function eu(e,t){var n;return e?{chainId:t,address:e.id,name:e.name,decimals:Number(e.decimals),symbol:e.symbol,logoURI:null!==(n=e.logoImg)&&void 0!==n?n:""}:e}function tu(e){var t,n,o,i;const r=null==e?void 0:e.pair;if(r)return{address:r.id,chainId:r.chainId,baseToken:eu(r.baseToken,r.chainId),quoteToken:eu(r.quoteToken,r.chainId),type:r.type,creator:r.creator,baseLpToken:{id:null===(t=r.baseLpToken)||void 0===t?void 0:t.id},quoteLpToken:{id:null===(n=r.quoteLpToken)||void 0===n?void 0:n.id},lpFeeRate:null===(o=null==e?void 0:e.pair)||void 0===o?void 0:o.lpFeeRate,mtFeeRate:null===(i=null==e?void 0:e.pair)||void 0===i?void 0:i.mtFeeRate}}function nu(e){const t=tu(e);if(t)return Object.assign(Object.assign({},t),{liquidityPositions:null==e?void 0:e.liquidityPositions})}function ou(e){switch(e){case"SVM_AMMV2":return"AMM V2";case"SVM_AMMV3":return"AMM V3";default:return"PMM"}}function iu({type:e,lpFeeRate:t,mtFeeRate:n}){var o,i;return"SVM_AMMV3"===e?null!==(i=null===(o=$c[t])||void 0===o?void 0:o.label)&&void 0!==i?i:"-":`${jr({input:new te(null!=t?t:0).plus(null!=n?n:0).div(1e4),decimals:4})}%`}function ru({hidePoolInfo:e,pool:t,children:o}){var i,r,a,l,s;const d=g(),c=!t,u="SVM_AMMV2"===(null==t?void 0:t.type),p=t?iu({type:t.type,lpFeeRate:null!==(i=t.lpFeeRate)&&void 0!==i?i:"0",mtFeeRate:null!==(r=t.mtFeeRate)&&void 0!==r?r:"0"}):"-";return ut.jsxs(m,{sx:{mt:16,mx:20,border:"solid 1px",borderColor:"border.main",borderRadius:12},children:[e?"":ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:d.spacing(12,20),borderStyle:"solid",borderColor:"border.main",borderWidth:d.spacing(0,0,1)},children:[ut.jsxs(m,{children:[ut.jsxs(M,{loading:c,loadingSx:{width:100,mb:4},sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[null===(a=null==t?void 0:t.baseToken)||void 0===a?void 0:a.symbol,"/",null===(l=null==t?void 0:t.quoteToken)||void 0===l?void 0:l.symbol,u&&ut.jsx(L,{title:ut.jsxs(m,{sx:{typography:"h6","& > b":{fontWeight:600,color:"primary.main"}},children:["🌟",ut.jsx("b",{children:ut.jsx(n,{id:"e38JNU",message:"Tips:"})})," ",ut.jsx(n,{id:"ipqmyu",message:"By adding liquidity you’ll earn <0>{feeRate}</0> of all trades on this pair proportional to your share of the pool. Fees are added to the pool, accrue in real time and can be claimed by withdrawing your liquidity.",values:{feeRate:p},components:{0:ut.jsx("b",{})}})]}),sx:{maxWidth:240},children:ut.jsx(m,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.disabled"},children:p})})]}),ut.jsx(M,{loading:c,children:ut.jsx(Oc,{address:null!==(s=null==t?void 0:t.address)&&void 0!==s?s:"",truncate:!0,iconSize:14,iconSpace:4,customChainId:null==t?void 0:t.chainId,sx:{typography:"h6",color:"text.secondary"}})})]}),(null==t?void 0:t.address)&&!u?ut.jsxs(m,{component:S,sx:{typography:"body2",display:"flex",alignItems:"center",color:"text.secondary"},onClick:()=>{fc.getState().push({type:hc.PoolDetail,params:{chainId:t.chainId,address:t.address}})},children:[ut.jsx(n,{id:"URmyfc",message:"Details"}),ut.jsx(m,{component:$e.ArrowRight,sx:{ml:4,position:"relative",top:1.2,width:16,height:16}})]}):""]}),ut.jsx(m,{sx:{p:d.spacing(12,20)},children:o})]})}var au;new p,new h,function(e){e[e.Add=1]="Add",e[e.Remove=2]="Remove"}(au||(au={}));const lu=[{value:0,label:"0%"},{value:25,label:"25%"},{value:50,label:"50%"},{value:75,label:"75%"},{value:100,label:"100%"}];function su({disabled:e,value:t,onChange:n,sx:o}){return ut.jsxs(m,{sx:Object.assign({p:20,backgroundColor:"background.input",borderRadius:12},o),children:[ut.jsx(_d,{value:String(t),onChange:e=>n(+e),readOnly:!0,readonlyShowSuffix:!0,suffix:ut.jsx(m,{sx:{typography:"h2"},children:"%"}),sx:{mt:12,"& input":{pl:0,typography:"h1"}}}),ut.jsx(m,{sx:{mt:20},children:ut.jsx(A,{marks:lu,step:1,disabled:e,value:t,onChange:(e,t)=>n(t)})})]})}const du=50;var cu;function uu({submittedBack:t,pool:n}){var i,r,a;const[l,s]=X.useState(""),[d,c]=X.useState(""),[u,p]=X.useState(Pi),h=u===Pi?new te(bc).div(100).toNumber():u,{isFront:f,price:g,invertedPrice:x,poolInfoQuery:y,lpBalanceQuery:b,lpBalance:j,lpBalancePercentage:C,lpToAmountA:w,lpToAmountB:k,liquidityMinted:R,pairMintAAmount:M,pairMintBAmount:S,isExists:E}=Cc({pool:(null==n?void 0:n.baseToken)&&n.quoteToken?{baseToken:n.baseToken,quoteToken:n.quoteToken,address:n.address}:void 0,baseAmount:void 0,quoteAmount:void 0,slippage:0}),{mode:T,modeOptions:W,handleChangeMode:L,sliderPercentage:I,handleChangeSliderPercentage:V,resetPercentage:O}=function({isBase:e,pool:t,baseOverride:n,quoteOverride:i,resetAmount:r,handleChangeBaseAmount:a,handleChangeQuoteAmount:l}){const[s,d]=X.useState(cu.percentage),[c,u]=X.useState(du),p=X.useRef(null),h=()=>{p.current&&clearTimeout(p.current)},f=()=>{h(),u(du)};return X.useEffect((()=>h),[]),{mode:s,modeOptions:[{key:cu.percentage,value:o._({id:"x4QVeW",message:"Percentage to remove"})}],handleChangeMode:e=>{d(e),null==r||r(),f()},sliderPercentage:c,handleChangeSliderPercentage:o=>{if(h(),o!==c&&u(o),!t)return;const r=100===o,s=()=>{if(t)if(e||void 0===e){if(n){let e=n.toString();r||(e=wr(n.times(o/100),t.baseToken.decimals)),null==a||a(e)}}else if(i){let e=i.toString();r||(e=wr(i.times(o/100),t.quoteToken.decimals)),null==l||l(e)}};r?s():p.current=setTimeout(s,100)},resetPercentage:f}}({isBase:!0,pool:n,baseOverride:w,quoteOverride:k}),Z=Ta(null==n?void 0:n.baseToken,{amount:l}),F=Ta(null==n?void 0:n.quoteToken,{amount:d}),N=!n||!!y.isLoading||!!y.error||!!b.error||b.isLoading,A=o._({id:"t/YqKh",message:"Remove"}),H=function({liquidityAmount:t,slippage:n,poolInfo:i,poolKeys:r,submittedBack:a}){const l=qr(),s=rs();return e(),ye({mutationFn:()=>or(this,void 0,void 0,(function*(){if(!s)throw new Error("raydium is undefined");if(!i||!r)throw new Error("poolInfo or poolKeys is undefined");if(!t)throw new Error("liquidityAmount is undefined");const e=new qe(new Ge(t.toString()).mul(10**i.lpMint.decimals).toFixed(0,Ge.ROUND_DOWN)),d=new Ne(100*n*100,1e4),{execute:c}=yield s.cpmm.withdrawLiquidity({poolInfo:i,poolKeys:r,lpAmount:e,txVersion:Ze.LEGACY,slippage:d});return yield l.executeCustom({brief:o._({id:"cJtosk",message:"Remove liquidity"}),metadata:{[cr.removeLiqidityAMMV2Position]:!0},handler:e=>or(this,void 0,void 0,(function*(){const{txId:t}=yield c({sendAndConfirm:!0});e.onSuccess(t)})),submittedBack:a})}))})}({liquidityAmount:null==j?void 0:j.times(I/100),slippage:h,poolKeys:null===(i=y.data)||void 0===i?void 0:i.poolKeys,poolInfo:null===(r=y.data)||void 0===r?void 0:r.poolInfo,submittedBack:()=>{t&&t()}}),P=!(null==n?void 0:n.baseToken)||!(null==n?void 0:n.quoteToken);return ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{sx:{pb:18,px:20},children:[ut.jsx(m,{sx:{pt:20},children:T===cu.percentage?ut.jsx(su,{disabled:y.isLoading||!j||j.lte(0),value:I,onChange:V}):ut.jsx(ut.Fragment,{})}),ut.jsx(zc,{slippage:u,onChangeSlippage:p,disabled:P,sx:{mt:8}}),ut.jsx(Ac,{baseToken:null==n?void 0:n.baseToken,quoteToken:null==n?void 0:n.quoteToken,loading:y.isLoading,midPrice:f?g:x,lpBalancePercentage:E?C:100})]}),ut.jsx(m,{sx:{px:20,py:16,position:"sticky",bottom:0,borderStyle:"solid",borderWidth:"1px 0 0",borderColor:"border.main",backgroundColor:"background.paper"},children:n?ut.jsx(Qc,{chainId:n.chainId,baseTokenStatus:Z,quoteTokenStatus:F,children:ut.jsx(v,{fullWidth:!0,disabled:N,isLoading:H.isPending,onClick:()=>{N||H.mutate()},children:A})}):ut.jsx(v,{fullWidth:!0,disabled:!0,children:A})}),ut.jsx(Jc,{message:null===(a=H.error)||void 0===a?void 0:a.message,onClose:()=>H.reset()})]})}function pu({pool:t,operate:n,hidePoolInfo:o,submittedBack:i}){var r;const{operateTab:a,operateTabs:l,handleChangeTab:s}=function(t=au.Add){const{i18n:n}=e(),[o,i]=X.useState(t),r=X.useMemo((()=>[{key:au.Add,value:n._({id:"m16xKo",message:"Add"})},{key:au.Remove,value:n._({id:"t/YqKh",message:"Remove"})}]),[n._]);return X.useEffect((()=>{i(t)}),[t]),{operateTab:o,operateTabs:r,handleChangeTab:e=>{i(e)}}}(n);sr();const{price:d,invertedPrice:c,poolInfoQuery:u,lpBalanceQuery:p,lpBalance:h,lpBalancePercentage:f,lpToAmountA:m,lpToAmountB:g,liquidityMinted:x,pairMintAAmount:v,pairMintBAmount:y,isExists:b}=Cc({pool:(null==t?void 0:t.baseToken)&&t.quoteToken?{baseToken:t.baseToken,quoteToken:t.quoteToken,address:t.address}:void 0,baseAmount:void 0,quoteAmount:void 0,slippage:0});return ut.jsxs(ut.Fragment,{children:[ut.jsx(ru,{pool:t,hidePoolInfo:o,children:ut.jsx(Dc,{isExists:b,poolInfo:null===(r=u.data)||void 0===r?void 0:r.poolInfo,poolInfoLoading:u.isLoading,lpBalanceLoading:p.isLoading,lpBalance:h,lpBalancePercentage:f,lpToAmountA:m,lpToAmountB:g,sx:{px:0,py:0,border:"none"}})}),ut.jsxs(H,{value:a,onChange:(e,t)=>{s(t)},children:[ut.jsx(P,{tabs:l,variant:"inPaper",tabsListSx:{mt:16,mx:20}}),ut.jsx(B,{value:au.Add,children:ut.jsx(Kc,{pool:t,submittedBack:i})}),ut.jsx(B,{value:au.Remove,children:ut.jsx(uu,{pool:t,submittedBack:i})})]})]})}function hu({onClose:t,pool:n,operate:o,hasMining:i,hidePoolInfo:r,sx:a}){const{poolOrMiningTab:l,poolOrMiningTabs:s,handleChangeTab:d}=function({hasMining:t}){const{i18n:n}=e(),[o,i]=X.useState(Ec.Liquidity);return{poolOrMiningTab:o,poolOrMiningTabs:X.useMemo((()=>{const e=[{key:Ec.Liquidity,value:n._({id:"6y2TB3",message:"Liquidity"})},{key:Ec.Mining,value:n._({id:"Sti4vy",message:"Mining"})}];return t?e:e.slice(0,1)}),[n._,t]),handleChangeTab:e=>{i(e)}}}({hasMining:i});return ut.jsx(m,{sx:a,children:ut.jsxs(H,{value:l,onChange:(e,t)=>{d(t)},sx:{display:"flex",flexDirection:"column",overflow:"hidden",height:"100%"},children:[ut.jsx(U,{tabs:s,tabsListSx:Object.assign({mx:20,justifyContent:t?"space-between":"flex-start"},{}),rightSlot:ut.jsx(m,{sx:{display:"flex",justifyContent:"center",alignItems:"center",gap:12},children:t?ut.jsx(m,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24,borderRadius:"50%",borderWidth:1,color:"text.secondary",cursor:"pointer"},children:ut.jsx(m,{component:$e.Error,sx:{width:16,height:16},onClick:()=>{t()}})}):void 0})}),ut.jsx(B,{value:Ec.Liquidity,sx:{flex:1,overflowY:"auto"},children:ut.jsx(pu,{pool:n,operate:o,hidePoolInfo:r,submittedBack:()=>{i&&d(Ec.Mining)}})})]})})}function fu(e){var{modal:t}=e,n=nr(e,["modal"]);const{isMobile:o}=Kd();return ut.jsx(Ed,{open:!!n.pool,onClose:n.onClose,scope:!o,modal:t,id:"pool-operate",children:ut.jsx(hu,{...n})})}!function(e){e[e.quantity=1]="quantity",e[e.percentage=2]="percentage"}(cu||(cu={}));const mu=e=>Object.keys(new Array(e+1).join(","));var gu,xu,vu;function yu({sx:e,hasSearch:t,emptyText:o}){return ut.jsxs(m,{sx:Object.assign({display:"flex",flexDirection:"column",gap:12,justifyContent:"center",alignItems:"center",typography:"body2",fontWeight:500,color:"text.secondary",textAlign:"center"},e),children:[ut.jsx(D,{hasSearch:t,sx:{width:60,height:60,borderRadius:12}}),ut.jsx(m,{children:null!=o?o:ut.jsx(n,{id:"AxPAXW",message:"No results found"})})]})}function bu(){return bu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},bu.apply(null,arguments)}!function(e){e[e.Failed=0]="Failed",e[e.Success=1]="Success",e[e.Warning=2]="Warning"}(gu||(gu={}));const ju=e=>z.createElement("svg",bu({width:60,height:60,viewBox:"0 0 60 60",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),z.createElement("g",{opacity:.5},z.createElement("mask",{id:"mask0_3521_179418",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:0,y:0,width:60,height:60},xu||(xu=z.createElement("rect",{width:60,height:60,rx:16,fill:"white"}))),vu||(vu=z.createElement("g",{mask:"url(#mask0_3521_179418)"},z.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 30.0352H60V16.0352C60 7.1986 52.8366 0.0351562 44 0.0351562H16C7.16344 0.0351562 0 7.1986 0 16.0352V30.0352Z",fill:"#727272",fillOpacity:.4}),z.createElement("path",{d:"M29.4643 4H16C9.37258 4 4 9.37258 4 16V27H27.1154L31.7914 18.7271L23.1831 13.6634L29.4643 4Z",fill:"#727272",fillOpacity:.4}),z.createElement("path",{d:"M31.7101 27H56V16C56 9.37258 50.6274 4 44 4H34.0384L34.1766 4.08987L28.8164 12.3364L37.2081 17.2727L31.7101 27Z",fill:"#727272",fillOpacity:.4}),z.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 44C0 52.8366 7.16344 60 16 60H44C52.8366 60 60 52.8366 60 44V30H0V44Z",fill:"#ABABAB",fillOpacity:.4}),z.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M59.4395 44.8861C59.4395 53.0965 52.7625 59.7526 44.5257 59.7526C36.2891 59.7526 29.6118 53.0965 29.6118 44.8861C29.6118 36.6756 36.2891 30.0195 44.5257 30.0195C52.7625 30.0195 59.4395 36.6756 59.4395 44.8861Z",fill:"#727272",fillOpacity:.4}),z.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.8277 44.8665C29.8277 53.077 23.1507 59.7331 14.9139 59.7331C6.67727 59.7331 0 53.077 0 44.8665C0 36.6561 6.67727 30 14.9139 30C23.1507 30 29.8277 36.6561 29.8277 44.8665Z",fill:"#727272",fillOpacity:.4}),z.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.9177 44.8883C51.9177 48.958 48.6082 52.257 44.5255 52.257C40.4431 52.257 37.1333 48.958 37.1333 44.8883C37.1333 40.8186 40.4431 37.5195 44.5255 37.5195C48.6082 37.5195 51.9177 40.8186 51.9177 44.8883Z",fill:"#444446"})))));function Cu({sx:e,refresh:t}){return ut.jsxs(m,{sx:se({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},e),children:[ut.jsx(m,{component:ju,sx:{display:"inline-block",width:60,height:60,mb:12}}),ut.jsx(m,{sx:{typography:"body2",width:252,textAlign:"center"},children:ut.jsx(m,{component:"span",sx:{color:"text.secondary"},children:ut.jsx(n,{id:"Vmw6BM",message:"Something went wrong…<0>Refresh again</0>",components:{0:ut.jsx(y,{component:"span",color:"primary.main",weak:!0,sx:{cursor:"pointer"},onClick:()=>{t()}})}})})})]})}function wu({loading:e,empty:t,hasSearch:n,children:o,refetch:i}){return e?ut.jsx(m,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",gap:24,px:24,height:320},children:mu(4).map(((e,t)=>ut.jsx(I,{width:"100%",height:45},t)))}):i?ut.jsx(Cu,{refresh:i,sx:{height:320}}):t?ut.jsx(yu,{hasSearch:n,sx:{height:320}}):ut.jsx(ut.Fragment,{children:o})}function ku({children:e,sx:t,gap:n=20,repeatBaseForLargeScreen:o=3}){const{isMobile:i,minDevice:r}=Kd();let a={};if(i)a={display:"flex",flexDirection:"column",gap:n};else{let e=2;[1418,1761,2104].some(((t,n)=>{if(r(t))return e=o+n,!0})),a={display:"grid",gap:n,gridTemplateColumns:`repeat(${e}, 1fr)`}}return ut.jsx(m,{sx:Object.assign(Object.assign({},a),t),children:e})}function Ru({address:e,chainId:t,hideName:o,sx:i}){const r=g(),a=wa(),{onlyChainId:l}=ar(),s=ve(Object.assign({},a.getQuery(f.graphql.fetchLiquidityLpPartnerRewards,{where:{chainId:l||void 0}})));if(!e)return null;const d=[];return("string"==typeof e?[e]:Array.from(new Set(e)).filter((e=>!!e))).forEach((e=>{var n,o,i;e&&(null===(i=null===(o=null===(n=s.data)||void 0===n?void 0:n.liquidity_getLpPartnerRewards)||void 0===o?void 0:o.partnerRewards)||void 0===i||i.some((n=>{var o,i,r,a,l,c,u,p,h,f,m,g,x,v;if((null==n?void 0:n.chainId)===t&&(null===(o=null==n?void 0:n.pool)||void 0===o?void 0:o.toLocaleLowerCase())===e.toLocaleLowerCase()){const e=null===(a=null===(r=null===(i=s.data)||void 0===i?void 0:i.liquidity_getLpPartnerRewards)||void 0===r?void 0:r.partnerInfos)||void 0===a?void 0:a.find((e=>(null==e?void 0:e.partner)===n.partner));if(!e)return;d.push({partner:{name:null!==(l=null==e?void 0:e.partner)&&void 0!==l?l:"",logo:null!==(c=null==e?void 0:e.logo)&&void 0!==c?c:"",introduction:null!==(u=null==e?void 0:e.introduction)&&void 0!==u?u:"",link:null!==(p=null==e?void 0:e.link)&&void 0!==p?p:"",extra:null!==(h=null==e?void 0:e.extra)&&void 0!==h?h:{},background:(null===(f=null==e?void 0:e.theme)||void 0===f?void 0:f[0])||void 0,color:(null===(m=null==e?void 0:e.theme)||void 0===m?void 0:m[1])||void 0},reward:null!==(g=null==n?void 0:n.reward)&&void 0!==g?g:"",type:null!==(x=null==n?void 0:n.type)&&void 0!==x?x:"stakelp",sort:null!==(v=null==e?void 0:e.sort)&&void 0!==v?v:Number.MAX_SAFE_INTEGER})}})))})),(null==d?void 0:d.length)?(d.sort(((e,t)=>e.sort-t.sort)),ut.jsx(m,{sx:Object.assign({display:"flex",alignItems:"center",gap:4},i),children:d.map((e=>ut.jsx(L,{leaveDelay:100,title:ut.jsxs(m,{sx:{maxWidth:240,whiteSpace:"pre-wrap"},children:[e.partner.introduction,!!e.partner.link&&ut.jsxs(m,{component:"a",target:"_blank",href:e.partner.link,rel:"noopener noreferrer",sx:{display:"flex",alignItems:"center",gap:4,color:"primary.main","&:hover":{opacity:.5}},children:[ut.jsx(n,{id:"zwWKhA",message:"Learn more"})," ",ut.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ut.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.91667 2.91667V11.0833H11.0833V7H12.25V11.0833C12.25 11.725 11.725 12.25 11.0833 12.25H2.91667C2.26917 12.25 1.75 11.725 1.75 11.0833V2.91667C1.75 2.275 2.26917 1.75 2.91667 1.75H7V2.91667H2.91667ZM8.16667 2.91667V1.75H12.25V5.83333H11.0833V3.73917L5.34917 9.47333L4.52667 8.65083L10.2608 2.91667H8.16667Z",fill:"currentColor"})})]})]}),children:ut.jsxs(S,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:4,p:r.spacing(0,4),height:20,borderRadius:4,background:e.partner.background,color:e.partner.color,whiteSpace:"nowrap"},children:[ut.jsx(m,{component:"img",src:e.partner.logo,alt:e.partner.name,sx:{width:14,height:14,borderRadius:"50%"}}),!o&&!!e.reward&&ut.jsx(m,{sx:{fontSize:"10px",fontWeight:600},children:e.reward})]})},e.partner.name+e.reward)))})):null}var Mu,Su;function Eu(){return Eu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Eu.apply(null,arguments)}const Tu=e=>z.createElement("svg",Eu({width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),Mu||(Mu=z.createElement("circle",{cx:16,cy:16,r:16,fill:"#FFE804"})),Su||(Su=z.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.5 12.25H12.25V8.5H8.5V12.25ZM14.125 23.5H17.875V19.75H14.125V23.5ZM12.25 23.5H8.5V19.75H12.25V23.5ZM8.5 17.875H12.25V14.125H8.5V17.875ZM17.875 17.875H14.125V14.125H17.875V17.875ZM19.75 8.5V12.25H23.5V8.5H19.75ZM17.875 12.25H14.125V8.5H17.875V12.25ZM19.75 17.875H23.5V14.125H19.75V17.875ZM23.5 23.5H19.75V19.75H23.5V23.5Z",fill:"#1A1A1B"}))),Wu="_default";function Lu({value:e,onChange:t,placeholder:n,options:o,sx:i,readOnly:r,valueOnlyIcon:a}){const l=g();return ut.jsx(Y,{value:null!=e?e:Wu,onChange:(n,o)=>{const i="number"==typeof e?Number(o):o;t(i===Wu?void 0:i)},disabled:r,sx:se({padding:l.spacing(8,12),"& .MuiSelect-select.MuiSelect-select.MuiSelect-select":{display:"flex",alignItems:"center",gap:8,padding:l.spacing(8,12,8,12),minHeight:"auto",backgroundColor:"transparent",color:"text.primary",borderRadius:8,typography:"body2",fontWeight:600,borderStyle:"solid",borderWidth:1,borderColor:"divider","& svg, & img":{width:24,height:24},'&:hover, &[aria-expanded="true"]':{backgroundColor:"background.paper"},"&.Mui-readOnly":{color:"text.disabled"}},"& .MuiSelect-icon":{color:r?"text.disabled":"text.primary"},"& .MuiOutlinedInput-notchedOutline":{display:"none"}},i),renderValue:t=>{if(!(null==t?void 0:t.value)||t.value===Wu)return ut.jsx(m,{sx:{color:"text.secondary"},children:null!=n?n:""});const i=o.find((t=>t.key===e));return i?ut.jsxs(ut.Fragment,{children:[i.logo,a?"":i.value]}):null},options:[...o]})}function Iu({isMobileStyle:e,chain:t,isLastItem:n,logoWidth:o,mobileLogoWidth:i,sx:r}){const a=g();return e?ut.jsxs(m,{sx:Object.assign({display:"flex",alignItems:"center",py:18,borderTop:`1px solid ${a.palette.border.main}`,borderBottom:n?`1px solid ${a.palette.border.main}`:"none"},r),children:[ut.jsx(m,{component:null==t?void 0:t.logo,sx:{width:i,height:i}}),ut.jsx(m,{component:"span",className:"name",sx:{marginLeft:8},children:null==t?void 0:t.name})]}):ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(m,{component:null==t?void 0:t.logo,sx:{width:o,height:o}}),ut.jsx(m,{component:"span",className:"name",sx:{marginLeft:8},children:null==t?void 0:t.name})]})}const Vu=-1;function Ou({chainId:t,setChainId:o,logoWidth:i=24,mobileLogoWidth:r=32,mainLogoWidth:a=24,mainMobileLogoWidth:l=18,notShowAllChain:s,valueOnlyIcon:d,sx:c}){const u=function(){const{chainId:e}=Oe();return Q((()=>{const t=new Map;let n;return Ql.forEach(((o,i)=>{if(o.mainnet){if(e!==o.chainId)return;n=o.mainnet}t.set(i,Object.assign({},o))})),void 0!==n&&t.delete(n),Array.from(t.values())}),[e])}(),[p,h]=X.useState(!1),{isMobile:f}=Kd(),{i18n:g}=e(),x=X.useCallback((()=>{const e=void 0===t?u[0]:u.find((e=>e.chainId===t));if(d){if(void 0===t||!e)return"";const n=f?r:a;return ut.jsx(m,{component:null==e?void 0:e.logo,sx:{width:n,height:n}})}return void 0!==t||s?e?ut.jsx(Iu,{isMobileStyle:f,chain:e,logoWidth:a,mobileLogoWidth:l}):null:ut.jsx(Iu,{isMobileStyle:f,chain:{chainId:Vu,logo:Tu,name:g._({id:"pY/ok7",message:"All chains"})},logoWidth:a,mobileLogoWidth:l,sx:{border:"none"}})}),[t,u,s,d,f,g._]),v=X.useMemo((()=>{const e=[];return s||e.push({key:Vu,value:ut.jsx(Iu,{isMobileStyle:f,chain:{chainId:Vu,logo:Tu,name:g._({id:"pY/ok7",message:"All chains"})},logoWidth:i,mobileLogoWidth:r})}),u.forEach(((t,n)=>{e.push({key:t.chainId,value:ut.jsx(Iu,{isLastItem:n===u.length-1,isMobileStyle:f,chain:t,logoWidth:i,mobileLogoWidth:r})})})),e}),[f,i,r,u,s]);return f?ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{component:S,onClick:()=>h(!0),sx:Object.assign({display:"flex",alignItems:"center",backgroundColor:"background.tag",borderRadius:8,border:"none",px:8,height:32,fontWeight:600,typography:"body2"},c),children:[ut.jsx(m,{sx:{pr:5},children:x()}),ut.jsx(m,{component:$e.CaretUp,sx:{width:12,height:12,transform:"rotate(180deg)"}})]}),ut.jsx(Ed,{open:p,title:ut.jsx(n,{id:"lJvbHq",message:"Select Network"}),onClose:()=>h(!1),id:"select-chain",modal:!0,children:ut.jsx(m,{sx:{mb:20},children:v.map((e=>ut.jsxs(m,{onClick:()=>{const t=e.key;o(t===Vu?void 0:Number(t)),h(!1)},sx:{position:"relative",px:20,"&:active":{backgroundColor:"hover.default"},"&:hover":{backgroundColor:"hover.default"},cursor:"pointer"},children:[e.value,(t?e.key===t:e.key===Vu)&&ut.jsx(m,{sx:{position:"absolute",left:0,top:24,height:20,width:2,backgroundColor:"text.primary"}})]},e.key)))})})]}):ut.jsx(Lu,{value:null!=t?t:Vu,onChange:e=>{o(e===Vu?void 0:e)},placeholder:g._({id:"lJvbHq",message:"Select Network"}),options:v,valueOnlyIcon:d,sx:Object.assign({height:32,fontWeight:600,typography:"body2"},c)})}function Zu({text:e,onClick:t}){const n=g();return ut.jsxs(m,{sx:{typography:"body2",display:"inline-flex",alignItems:"center",p:n.spacing(0,4,0,8),width:"max-content",height:32,backgroundColor:"hover.default",borderWidth:1,borderRadius:8,cursor:"pointer"},onClick:t,children:[e,ut.jsx(m,{component:$e.ArrowBack,sx:{ml:2,width:16,height:16,transform:"rotate(180deg)"}})]})}function Fu({lqList:e,onDeleteTag:t,sx:n}){var o;if(!(null==e?void 0:e.length))return null;if(!(null===(o=e[0])||void 0===o?void 0:o.pair))return null;const{pair:i}=e[0],r=eu(i.baseToken,i.chainId),a=eu(i.quoteToken,i.chainId);return r&&a?ut.jsxs(m,{sx:Object.assign({typography:"body2",display:"inline-flex",alignItems:"center",px:8,mr:8,borderRadius:8,fontWeight:600,height:32,backgroundColor:"hover.default"},n),children:[ut.jsx(Fc,{tokens:[r,a],chainId:r.chainId,width:20,mr:8}),r.symbol,"+",a.symbol,ut.jsx(m,{component:$e.Error,sx:{ml:4,width:16,height:16,cursor:"pointer",color:"text.secondary",position:"relative",top:1.5},onClick:()=>t()})]}):null}function Nu({tags:e,onDeleteTag:t,sx:n}){return e.length?ut.jsx(m,{sx:Object.assign({display:"inline-flex",alignItems:"center"},n),children:e.map((e=>ut.jsxs(m,{sx:{typography:"body2",display:"flex",alignItems:"center",px:8,mr:8,borderRadius:8,fontWeight:600,height:32,backgroundColor:"hover.default"},children:[ut.jsx(Kl,{address:e.address,width:20,height:20,chainId:e.chainId,url:e.logoURI,noShowChain:!0,marginRight:8}),e.symbol,ut.jsx(m,{component:$e.Error,sx:{ml:4,width:16,height:16,cursor:"pointer",color:"text.secondary",position:"relative",top:1.5},onClick:()=>t(e)})]},e.address)))}):null}function Au({chainId:e,address:t}){const{isMobile:n}=Kd();return ut.jsx(m,{component:"button",onClick:n=>{n.stopPropagation(),fc.getState().push({type:hc.PoolDetail,params:{chainId:e,address:t}})},sx:Object.assign({display:"flex",alignItems:"center",justifyContent:"center",borderRadius:8,cursor:"pointer",flexShrink:0,height:36,"&:hover":{opacity:.5}},n?{width:64,backgroundColor:"background.tag"}:{width:40,backgroundColor:"transparent",borderWidth:1}),children:ut.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ut.jsx("path",{d:"M5.83333 14.1667H7.5V8.33333H5.83333V14.1667ZM9.16667 14.1667H10.8333V5.83333H9.16667V14.1667ZM12.5 14.1667H14.1667V10.8333H12.5V14.1667ZM4.16667 17.5C3.70833 17.5 3.31597 17.3368 2.98958 17.0104C2.66319 16.684 2.5 16.2917 2.5 15.8333V4.16667C2.5 3.70833 2.66319 3.31597 2.98958 2.98958C3.31597 2.66319 3.70833 2.5 4.16667 2.5H15.8333C16.2917 2.5 16.684 2.66319 17.0104 2.98958C17.3368 3.31597 17.5 3.70833 17.5 4.16667V15.8333C17.5 16.2917 17.3368 16.684 17.0104 17.0104C16.684 17.3368 16.2917 17.5 15.8333 17.5H4.16667ZM4.16667 15.8333H15.8333V4.16667H4.16667V15.8333Z",fill:"#1A1A1B"})})})}function Hu(e){var{sx:t,children:o,hasMore:i,loadMore:r,loadMoreLoading:a}=e,l=nr(e,["sx","children","hasMore","loadMore","loadMoreLoading"]);const s=g();return ut.jsxs(m,{sx:Object.assign({position:"relative",flex:1,overflowY:"auto"},t),...l,children:[ut.jsx(m,{component:"table",sx:{width:"100%",borderCollapse:"collapse","& th":{p:24,typography:"body1",textAlign:"left",color:"text.secondary"},"& td":{px:24,py:20},"& thead":{position:"sticky",top:0,zIndex:2,backgroundColor:"background.paper"},"& th:last-child, & td:last-child":{position:"sticky",right:0,zIndex:1,backgroundColor:"background.paper","&::before":{content:'""',position:"absolute",top:0,bottom:0,left:1,width:"1px",boxShadow:`${T(s.palette.text.primary,.1)} -2px 0px 4px 0px`}}},children:o}),i&&ut.jsx(S,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:64,width:"100%",borderStyle:"solid",borderColor:"border.main",borderWidth:s.spacing(1,0,0,0),typography:"body2",color:"text.secondary","&:hover":{color:"text.primary"}},onClick:r,children:a?ut.jsx(W,{}):ut.jsxs(ut.Fragment,{children:[ut.jsx(n,{id:"yQ2kGp",message:"Load more"}),ut.jsx(m,{component:$e.ArrowRight,sx:{transform:"rotate(90deg)"}})]})})]})}function Pu({sx:e}){return ut.jsxs(m,{sx:Object.assign({px:20,pt:20,pb:12,backgroundColor:"background.paperContrast",borderRadius:16,display:"flex",flexDirection:"column"},e),children:[ut.jsx(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(I,{variant:"circular",width:48}),ut.jsx(I,{variant:"rounded",height:28,width:100,sx:{ml:8}})]})}),ut.jsxs(m,{sx:{display:"flex",alignItems:"center",mt:44},children:[ut.jsxs(m,{children:[ut.jsx(I,{variant:"rounded",height:24,width:100}),ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"rSayea",message:"APY"})})]}),ut.jsx(m,{sx:{display:"inline-block",mx:20,height:24,width:"1px",backgroundColor:"custom.border.default"}}),ut.jsxs(m,{children:[ut.jsx(I,{variant:"rounded",height:24,width:100}),ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"FHKsZF",message:"TVL"})})]})]}),ut.jsx(I,{variant:"rounded",height:32})]})}function Bu({chainId:e,baseToken:t,quoteToken:o,apy:i,hasQuote:r,hasMining:a,sx:l,children:s}){if(!t)return null;const d=r?[{token:t,transactionApy:null==i?void 0:i.transactionBaseApy,miningApy:null==i?void 0:i.miningBaseApy},{token:o,transactionApy:null==i?void 0:i.transactionQuoteApy,miningApy:null==i?void 0:i.miningQuoteApy}]:[{transactionApy:null==i?void 0:i.transactionBaseApy,miningApy:null==i?void 0:i.miningBaseApy}];return ut.jsx(L,{children:null!=s?s:ut.jsx(y,{component:$e.QuestionBorder,sx:Object.assign({width:15,height:15},l)}),title:ut.jsx(m,{sx:{width:236},children:d.map(((i,r)=>{var l,s,d,c;return ut.jsxs(m,{sx:{mt:0===r?0:20},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",typography:"body2",fontWeight:600,color:"text.primary"},children:[ut.jsx(m,{sx:{display:"flex",alignItems:"center"},children:i.token?ut.jsxs(ut.Fragment,{children:[ut.jsx(Kl,{width:14,height:14,marginRight:4,address:i.token.address,url:i.token.logoURI,chainId:e,noShowChain:!0}),i.token.symbol]}):ut.jsxs(ut.Fragment,{children:[ut.jsx(Fc,{tokens:[t,o],width:14,mr:4,chainId:e}),t.symbol,"/",null==o?void 0:o.symbol]})}),ut.jsx(m,{children:Vr(new te(null!==(d=i.transactionApy)&&void 0!==d?d:0).plus(null!==(c=i.miningApy)&&void 0!==c?c:0))})]}),ut.jsxs(m,{sx:{mt:8,display:"flex",justifyContent:"space-between",typography:"h6",color:"text.secondary"},children:[ut.jsx("span",{children:ut.jsx(n,{id:"OnDEky",message:"LP Fee"})}),ut.jsx("span",{children:i.transactionApy?Vr(new te(i.transactionApy)):"-"})]}),a?ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",typography:"h6",color:"text.secondary"},children:[ut.jsx("span",{children:ut.jsx(n,{id:"pSQ1lM",message:"MT Fee"})}),ut.jsx("span",{children:i.miningApy?Vr(new te(i.miningApy)):"-"})]}):""]},null!==(s=null===(l=i.token)||void 0===l?void 0:l.address)&&void 0!==s?s:1)}))})})}function Uu({sx:e,value:t,onChange:i,searchAddress:r}){const[a,l]=X.useState(!1),{isMobile:s}=Kd();return ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{component:S,sx:Object.assign(Object.assign({typography:"body2",display:"flex",alignItems:"center",justifyContent:"flex-start",px:12,height:32,backgroundColor:"background.tag",color:"text.secondary",borderRadius:8,fontWeight:600},s?{}:{minWidth:220}),e),onClick:()=>l(!0),children:[ut.jsx(m,{component:$e.Search,sx:{width:16,height:16,mr:8,flexShrink:0}}),ut.jsx(n,{id:"A1taO8",message:"Search"})]}),ut.jsx(dc,{value:t,open:a,multiple:!0,title:ut.jsx(n,{id:"o8aMNm",message:"Select a liquidity pool"}),searchPlaceholder:o._({id:"4nzwq3",message:"Search by token or pool address"}),onClose:()=>{l(!1)},onTokenChange:e=>{if(Array.isArray(e)){if(e.length>2){const t=[e[0],e[2]];i(t)}else i(e);l(!1)}},searchOtherAddress:e=>r(e,(()=>l(!1))),modal:!0})]})}function Du({list:e,onClick:t}){return ut.jsx(ut.Fragment,{children:null==e?void 0:e.map((e=>{var o,i,r,a;if(!(null==e?void 0:e.pair))return null;const l=e.pair,s=eu(l.baseToken,l.chainId),d=eu(l.quoteToken,l.chainId),c=l.apy?Vr(new te(null===(o=l.apy)||void 0===o?void 0:o.transactionBaseApy).plus(null!==(r=null===(i=l.apy)||void 0===i?void 0:i.miningBaseApy)&&void 0!==r?r:0)):void 0,u=p.utils.singleSideLp(l.type)&&l.apy?Vr(new te(l.apy.transactionQuoteApy).plus(null!==(a=l.apy.miningQuoteApy)&&void 0!==a?a:0)):void 0;return s&&d?ut.jsxs(m,{onClick:t,sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:10,py:20,borderRadius:8,cursor:"pointer","&:hover":{backgroundColor:"custom.background.listHover"}},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[ut.jsx(Fc,{tokens:[s,d],chainId:l.chainId,width:24,mr:10}),ut.jsxs(m,{sx:{typography:"h5"},children:[s.symbol,"/",d.symbol]})]}),ut.jsxs(m,{children:[ut.jsxs(m,{sx:{color:"custom.status.green.default",fontWeight:600},children:[c,u?`/${u}`:""]}),ut.jsx(m,{sx:{mt:2,typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"rSayea",message:"APY"})})]})]},l.id):null}))})}function Yu(){const[e,t]=X.useState([]),[n,o]=X.useState([]),[i,r]=X.useMemo((()=>{const[t,n]=e;return[null==t?void 0:t.symbol,null==n?void 0:n.symbol]}),[e]);return{filterTokens:e,filterASymbol:i,filterBSymbol:r,filterAddressLqList:n,handleDeleteToken:e=>{t((t=>{const n=[...t],o=n.indexOf(e);return-1!==o&&n.splice(o,1),n}))},handleChangeFilterTokens:e=>{o([]),t(e)},handleChangeFilterAddress:e=>{o(e),t([])}}}function zu({lqList:e,setOperatePool:t,supportAMM:o}){const i=g();return ut.jsx(ut.Fragment,{children:null==e?void 0:e.map((e=>{var r,a,l,s,d,c,u;if(!(null==e?void 0:e.pair))return null;const h=e.pair,f=eu(h.baseToken,h.chainId),g=eu(h.quoteToken,h.chainId),x=h.apy?Vr(new te(null===(r=h.apy)||void 0===r?void 0:r.transactionBaseApy).plus(null!==(l=null===(a=h.apy)||void 0===a?void 0:a.miningBaseApy)&&void 0!==l?l:0)):void 0,y=p.utils.singleSideLp(h.type)&&h.apy?Vr(new te(h.apy.transactionQuoteApy).plus(null!==(s=h.apy.miningQuoteApy)&&void 0!==s?s:0)):void 0,b=!!(null===(d=h.miningAddress)||void 0===d?void 0:d[0]),j=ou(h.type);return ut.jsx(m,{sx:{p:8,borderRadius:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"border.disabled",backdropFilter:"blur(5px)"},children:ut.jsxs(m,{sx:{px:20,pt:20,pb:12,backgroundColor:"background.paper",borderRadius:16,borderWidth:1,borderStyle:"solid",borderColor:"border.main"},className:"gradient-card-border",onClick:()=>{o||fc.getState().push({type:hc.PoolDetail,params:{chainId:h.chainId,address:h.id}})},children:[ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap"},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:8},children:[f&&g?ut.jsx(Fc,{tokens:[f,g],width:24,mr:6,chainId:h.chainId,showChainLogo:!0}):"",ut.jsxs(m,{sx:{typography:"body2",fontWeight:600},children:[`${null==f?void 0:f.symbol}/${null==g?void 0:g.symbol}`,ut.jsx(Ru,{address:h.id,chainId:h.chainId})]})]}),b?ut.jsxs(m,{sx:{p:8,typography:"h6",fontWeight:"bold",background:`linear-gradient(180deg, ${T(i.palette.secondary.main,.3)} 0%, ${T(i.palette.purple.main,.3)} 100%)`,borderRadius:8,color:"purple.main",whiteSpace:"nowrap"},children:["✨ ",ut.jsx(n,{id:"Sti4vy",message:"Mining"})]}):""]}),ut.jsxs(m,{sx:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",rowGap:20,mt:44,"& > div:nth-child(odd)":{pr:20},"& > div:nth-child(even)":{position:"relative",pl:20,"&::before":{position:"absolute",left:0,top:"50%",transform:"translateY(-50%)",display:"inline-block",content:'""',height:24,width:"1px",backgroundColor:"border.main"}}},children:[o&&ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4,whiteSpace:"nowrap"},children:[j,ut.jsx(L,{title:ut.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:ut.jsx(m,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:iu({type:h.type,lpFeeRate:null!==(c=h.lpFeeRate)&&void 0!==c?c:0,mtFeeRate:null!==(u=h.mtFeeRate)&&void 0!==u?u:0})})})]}),ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"1Qz63U",message:"Pool Type"})})]}),ut.jsxs(m,{children:[ut.jsxs(m,{sx:{typography:"h5",color:"success.main"},children:[x,y?`/${y}`:""]}),ut.jsxs(m,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:[ut.jsx(n,{id:"rSayea",message:"APY"}),ut.jsx(Bu,{chainId:h.chainId,apy:h.apy,baseToken:f,quoteToken:g,hasQuote:!!y,hasMining:b,sx:{width:14,height:14}})]})]}),ut.jsxs(m,{children:[ut.jsxs(m,{sx:{typography:"h5"},children:["$",Lr(new te(h.tvl))]}),ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"FHKsZF",message:"TVL"})})]}),o&&ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4},children:["$",br({input:h.volume24H||0})]}),ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"Q8W3SC",message:"Volume (1D)"})})]})]}),ut.jsxs(m,{sx:{mt:20,display:"flex",gap:"8px"},children:[ut.jsx(Pd,{fullWidth:!0,size:v.Size.small,onClick:n=>{n.stopPropagation(),t({pool:tu(e),hasMining:b})},children:ut.jsx(n,{id:"m16xKo",message:"Add"})}),o&&"PMM"===j&&ut.jsx(Au,{chainId:h.chainId,address:h.id})]})]})},h.id+h.chainId)}))})}function Xu({lqList:e,operatePool:t,setOperatePool:i,hasMore:r,loadMore:a,loadMoreLoading:l,supportAMM:s}){const d=g();return ut.jsxs(Hu,{hasMore:r,loadMore:a,loadMoreLoading:l,children:[ut.jsx(m,{component:"thead",children:ut.jsxs(m,{component:"tr",children:[ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"AxdOHo",message:"Pair"})}),s&&ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"1Qz63U",message:"Pool Type"})}),ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"FHKsZF",message:"TVL"})}),ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"rSayea",message:"APY"})}),s&&ut.jsx("th",{children:ut.jsx(n,{id:"Q8W3SC",message:"Volume (1D)"})}),ut.jsx(m,{component:"th",sx:{width:80}})]})}),ut.jsx(m,{component:"tbody",children:null==e?void 0:e.map((e=>{var r,a,l,c,u,h,f,g;if(!(null==e?void 0:e.pair))return null;const x=e.pair,y=eu(x.baseToken,x.chainId),b=eu(x.quoteToken,x.chainId),j=x.apy?Vr(new te(null===(r=x.apy)||void 0===r?void 0:r.transactionBaseApy).plus(null!==(l=null===(a=x.apy)||void 0===a?void 0:a.miningBaseApy)&&void 0!==l?l:0)):void 0,C=p.utils.singleSideLp(x.type)&&x.apy?Vr(new te(x.apy.transactionQuoteApy).plus(null!==(c=x.apy.miningQuoteApy)&&void 0!==c?c:0)):void 0;let w="";if((null===(u=null==t?void 0:t.pool)||void 0===u?void 0:u.address)===x.id||(null==t?void 0:t.address)===x.id)if(t.operate===au.Remove)w=o._({id:"0+31GV",message:"Removing"});else w=o._({id:"1yHVE+",message:"Adding"});const k=!!(null===(h=x.miningAddress)||void 0===h?void 0:h[0]),R=ou(x.type),M=d.palette.background.tag;return ut.jsxs(m,{component:"tr",sx:{["&:hover td"+(w?", & td":"")]:{backgroundImage:`linear-gradient(${M}, ${M})`}},children:[ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[y&&b?ut.jsx(Fc,{tokens:[y,b],width:24,mr:10,chainId:x.chainId,showChainLogo:!0}):"",ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[`${null==y?void 0:y.symbol}/${null==b?void 0:b.symbol}`,ut.jsx(Ru,{address:x.id,chainId:x.chainId})]}),ut.jsx(Oc,{address:x.id,customChainId:x.chainId,truncate:!0,showCopy:!0,iconDarkHover:!0,iconSize:14,iconSpace:4,sx:{typography:"h6",color:"text.secondary"},disabledAddress:s,onAddressClick:()=>{fc.getState().push({type:hc.PoolDetail,params:{chainId:x.chainId,address:x.id}})}})]})]})}),s&&ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4},children:[ut.jsx(m,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary",whiteSpace:"nowrap"},children:R}),ut.jsx(L,{title:ut.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:ut.jsx(m,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:iu({type:x.type,lpFeeRate:null!==(f=x.lpFeeRate)&&void 0!==f?f:0,mtFeeRate:null!==(g=x.mtFeeRate)&&void 0!==g?g:0})})})]})}),ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{typography:"body2"},title:x.tvl?`$${br({input:x.tvl})}`:void 0,children:["$",Lr(new te(x.tvl))]})}),ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[k?ut.jsx(L,{title:o._({id:"Sti4vy",message:"Mining"}),children:ut.jsxs(m,{component:"span",sx:{typography:"body2",color:"success.main"},children:["✨"," "]})}):"",ut.jsx(Bu,{chainId:x.chainId,apy:x.apy,baseToken:y,quoteToken:b,hasQuote:!!C,hasMining:k,children:ut.jsxs(m,{component:"span",sx:{typography:"body2",fontWeight:600,display:"flex",alignItems:"center",width:"max-content",color:"success.main",cursor:"auto"},children:[j,C?`/${C}`:""]})})]})}),s&&ut.jsxs(m,{component:"td",children:["$",br({input:x.volume24H||0})]}),ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[s&&"PMM"===R&&ut.jsx(Au,{chainId:x.chainId,address:x.id}),w?ut.jsx(Zu,{text:w,onClick:()=>i(null)}):ut.jsx(v,{size:v.Size.small,onClick:()=>{i({pool:tu(e),hasMining:k})},children:o._({id:"m16xKo",message:"Add"})})]})})]},x.id+x.chainId)}))})]})}function qu({scrollParentRef:e,filterChainIds:t,activeChainId:n,handleChangeActiveChainId:o,operatePool:i,setOperatePool:r}){var a;const{onlyChainId:l,supportAMMV2:s,supportAMMV3:d,notSupportPMM:c}=ar(),{minDevice:u,isMobile:h}=Kd(),f=xe(),{filterTokens:g,filterASymbol:x,filterBSymbol:v,filterAddressLqList:y,handleDeleteToken:b,handleChangeFilterTokens:j,handleChangeFilterAddress:C}=Yu(),w=[];s&&w.push("SVM_AMMV2"),d&&w.push("SVM_AMMV3");const k={chainIds:t,pageSize:h?4:8,filterState:{viewOnlyOwn:!1,filterTypes:w}},R=wa(),M=R.getInfiniteQuery(p.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},k),{filterState:Object.assign({filterASymbol:x,filterBSymbol:v},k.filterState)})}),S=Ce(Object.assign(Object.assign({},M),{initialPageParam:1,getNextPageParam:e=>{var t;const{currentPage:n,totalCount:o,pageSize:i}=null!==(t=e.liquidity_list)&&void 0!==t?t:{};if(!n||!o||!i)return null;let r=Math.floor(o/i);return o%i&&(r+=1),n>=r?null:n+1}}));let E=[];const T=!!(null==y?void 0:y.length);T?E=[...y]:null===(a=S.data)||void 0===a||a.pages.forEach((e=>{var t,n;null===(n=null===(t=e.liquidity_list)||void 0===t?void 0:t.lqList)||void 0===n||n.forEach((e=>{null==E||E.push(e)}))}));const W=S.hasNextPage&&!T;return ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{sx:Object.assign(Object.assign({py:16,display:"flex",gap:8},u(475)?{}:{flexDirection:"column"}),h?{}:{px:20,borderBottomWidth:1}),children:[ut.jsxs(m,{sx:Object.assign({display:"flex",alignItems:"center",gap:8},u(475)?{}:{"& > button":{flex:1}}),children:[!l&&ut.jsx(Ou,{chainId:n,setChainId:o}),ut.jsx(Uu,{value:g,onChange:j,searchAddress:(e,t)=>or(this,void 0,void 0,(function*(){var n;const o=R.getInfiniteQuery(p.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},k),{filterState:Object.assign({address:e},k.filterState)})}),i=null===(n=(yield f.fetchQuery(o)).liquidity_list)||void 0===n?void 0:n.lqList;return(null==i?void 0:i.length)?ut.jsx(Du,{list:i,onClick:()=>{C(i),t()}}):null}))})]}),(T||!!g.length)&&ut.jsxs(m,{sx:{my:0},children:[T?ut.jsx(Fu,{lqList:y,onDeleteTag:()=>C([])}):"",ut.jsx(Nu,{tags:g,onDeleteTag:b})]})]}),h?ut.jsx(Qe,{hasMore:W,threshold:300,loadMore:le((()=>{S.hasNextPage&&!S.isFetching&&S.fetchNextPage()}),500),useWindow:!1,getScrollParent:()=>e.current||null,loader:ut.jsx(Pu,{sx:{mt:20}},"loader"),children:ut.jsxs(ku,{gap:12,children:[S.isLoading?ut.jsx(Pu,{}):"",!S.isLoading&&!(null==E?void 0:E.length)&&!S.error&&ut.jsx(yu,{sx:{mt:40},hasSearch:!!(n&&!l||x||v)}),!!S.error&&ut.jsx(Cu,{refresh:S.refetch,sx:{mt:40}}),ut.jsx(zu,{lqList:E,setOperatePool:r,supportAMM:s||d})]})}):ut.jsxs(ut.Fragment,{children:[ut.jsx(Xu,{lqList:E,operatePool:i,setOperatePool:r,hasMore:W,loadMoreLoading:S.isFetchingNextPage,loadMore:()=>{S.hasNextPage&&!S.isFetching&&S.fetchNextPage()},supportAMM:s||d}),ut.jsx(wu,{loading:S.isLoading,refetch:S.error?S.refetch:void 0,empty:!(null==E?void 0:E.length),hasSearch:!!(n&&!l||x||v)})]})]})}function Ju({onClick:e,title:t,desc:n}){const o=g();return ut.jsx(m,{sx:{mx:20,px:0,py:14,borderTop:`1px solid ${o.palette.border.main}`,[o.breakpoints.up("tablet")]:{borderTop:"none",mx:0,px:16,py:8}},children:ut.jsxs(S,{onClick:e,sx:{width:"100%",display:"flex",flexDirection:"column",gap:0,p:0,borderRadius:8,"&:hover":{backgroundColor:o.palette.background.tag},[o.breakpoints.up("tablet")]:{p:8}},children:[ut.jsx(m,{sx:{typography:"body1",fontWeight:600,color:o.palette.text.primary,textAlign:"left"},children:t}),ut.jsx(m,{sx:{typography:"h6",fontWeight:500,color:o.palette.text.secondary,textAlign:"left"},children:n})]})})}const Gu=e=>{const t=g(),{isMobile:o}=Kd(),{supportAMMV2:i,supportAMMV3:r,notSupportPMM:a}=ar(),[l,s]=X.useState(!1),d={[hc.CreatePool]:!a,[hc.createPoolAMMV2]:!!i,[hc.createPoolAMMV3]:!!r},c=Object.entries(d).filter((([e,t])=>!0===t)),u=1===c.length?c[0][0]:void 0;if(!u){const e=ut.jsxs(ut.Fragment,{children:[!a&&ut.jsx(Ju,{onClick:()=>{fc.getState().push({type:hc.CreatePool})},title:ut.jsx(n,{id:"Eif7f6",message:"PMM Pool"}),desc:ut.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})}),i&&ut.jsx(Ju,{onClick:()=>{fc.getState().push({type:hc.createPoolAMMV2})},title:ut.jsx(n,{id:"lNYomJ",message:"AMM V2 Position"}),desc:ut.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})}),r&&ut.jsx(Ju,{onClick:()=>{fc.getState().push({type:hc.createPoolAMMV3})},title:ut.jsx(n,{id:"sVlqoo",message:"AMM V3 Position"}),desc:ut.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})})]});return o?ut.jsxs(ut.Fragment,{children:[ut.jsxs(v,{variant:v.Variant.outlined,fullWidth:o,onClick:()=>{s(!0)},sx:{height:40},children:[ut.jsx(m,{component:$e.Plus,sx:{mr:4}}),ut.jsx(n,{id:"p2jbcE",message:"Create Pool"})]}),ut.jsx(Ed,{open:l,title:ut.jsx(n,{id:"p2jbcE",message:"Create Pool"}),onClose:()=>{s(!1)},modal:!0,children:ut.jsx(m,{sx:{mb:0},children:e})})]}):ut.jsx(L,{arrow:!1,leaveDelay:300,placement:o?"bottom":"bottom-end",sx:{p:0,backgroundColor:"background.paper"},title:ut.jsx(m,{children:e}),children:ut.jsxs(m,{sx:{width:o?"100%":"auto",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:10,pl:8,pr:16,py:7,borderRadius:8,borderWidth:1,borderColor:t.palette.text.primary,typography:"body1",fontWeight:600,color:t.palette.text.primary,cursor:"pointer","&:hover":{backgroundColor:t.palette.background.tag}},children:[ut.jsx(m,{component:$e.Plus}),ut.jsx(n,{id:"p2jbcE",message:"Create Pool"})]})})}return ut.jsxs(v,{variant:v.Variant.outlined,fullWidth:o,onClick:()=>{fc.getState().push({type:u})},sx:{height:40},children:[ut.jsx(m,{component:$e.Plus,sx:{mr:4}}),ut.jsx(n,{id:"p2jbcE",message:"Create Pool"})]})};const Qu=({outOfRange:e})=>{const t=g();return ut.jsx(L,{title:e?o._({id:"i3Z+/Z",message:"Out of range"}):o._({id:"vOyUlD",message:"In range"}),children:ut.jsx(m,{sx:{display:"flex",alignItems:"center"},children:e?ut.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:ut.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.583252 12.5416L6.99992 1.45825L13.4166 12.5416H0.583252ZM11.3924 11.3749L6.9999 3.78575L2.6074 11.3749H11.3924ZM7.58328 9.62492H6.41661V10.7916H7.58328V9.62492ZM6.41661 6.12492H7.58328V8.45825H6.41661V6.12492Z",fill:t.palette.warning.main})}):ut.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",children:ut.jsx("circle",{cx:"4",cy:"4",r:"4",fill:t.palette.success.main})})})})};var _u,Ku,$u;function ep({price:e,atLimit:t,direction:n}){return t[n]?n===Ku.LOWER?"0":"∞":"string"==typeof e&&"∞"===e?"∞":jr({input:e})}!function(e){e.MINT_1="MINT_1",e.MINT_2="MINT_2"}(_u||(_u={})),function(e){e.LOWER="LOWER",e.UPPER="UPPER"}(Ku||(Ku={})),function(e){e.TOKEN0="TOKEN0",e.TOKEN1="TOKEN1"}($u||($u={}));const tp=({onlyV3:e,setOnlyV3:t,sx:n})=>{const i=g(),{notSupportPMM:r}=ar();return ut.jsx(m,{component:S,onClick:()=>t(!e),sx:Object.assign({display:"flex",alignItems:"center",p:2,borderRadius:8,backgroundColor:i.palette.border.main},n),children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center",width:"100%",[i.breakpoints.up("tablet")]:{width:194}},children:[ut.jsx(m,{sx:Object.assign({flex:1,width:0,pt:4,pb:5,borderRadius:6,textAlign:"center",typography:"body2",whiteSpace:"nowrap"},e?{color:i.palette.text.primary,backgroundColor:i.palette.background.paper}:{color:i.palette.text.secondary,backgroundColor:"transparent"}),children:o._({id:"yoR+O6",message:"V3"})}),ut.jsx(m,{sx:Object.assign({flex:1,width:0,pt:4,pb:5,borderRadius:6,textAlign:"center",typography:"body2",whiteSpace:"nowrap"},e?{color:i.palette.text.secondary,backgroundColor:"transparent"}:{color:i.palette.text.primary,backgroundColor:i.palette.background.paper}),children:r?"V2":o._({id:"eK6I8d",message:"V2 & PMM"})})]})})};function np({account:e,lqList:t,setOperatePool:o,supportAMM:i}){const r=g();return ut.jsx(ut.Fragment,{children:null==t?void 0:t.map((t=>{var a,l,s,d,c,u,h,f,g,x,y,b,j,C;if(!(null==t?void 0:t.pair))return null;const w=t.pair,k=eu(w.baseToken,w.chainId),R=eu(w.quoteToken,w.chainId),M=p.utils.singleSideLp(w.type),S=w.apy?Vr(new te(null===(a=w.apy)||void 0===a?void 0:a.transactionBaseApy).plus(null!==(s=null===(l=w.apy)||void 0===l?void 0:l.miningBaseApy)&&void 0!==s?s:0)):"0%",E=M&&w.apy?Vr(new te(w.apy.transactionQuoteApy).plus(null!==(d=w.apy.miningQuoteApy)&&void 0!==d?d:0)):void 0;let W,I;(null===(c=t.liquidityPositions)||void 0===c?void 0:c.length)&&t.liquidityPositions.forEach((e=>{var t,n,o,i,r;if(null==e?void 0:e.liquidityTokenBalance){const a=null===(t=e.id)||void 0===t?void 0:t.split("-");if(2===(null==a?void 0:a.length)){const t=a[1].toLocaleLowerCase();if((null===(o=null===(n=null==w?void 0:w.baseLpToken)||void 0===n?void 0:n.id)||void 0===o?void 0:o.toLocaleLowerCase())===t)return void(W=new te(e.liquidityTokenBalance));(null===(r=null===(i=null==w?void 0:w.quoteLpToken)||void 0===i?void 0:i.id)||void 0===r?void 0:r.toLocaleLowerCase())===t&&(I=new te(e.liquidityTokenBalance))}}}));const V=!!(null===(u=w.miningAddress)||void 0===u?void 0:u[0]),O=null===(h=t.liquidityPositions)||void 0===h?void 0:h[0],Z=w.type,F=ou(Z),N="SVM_AMMV2"===Z,A="SVM_AMMV3"===Z;return ut.jsx(m,{sx:{p:8,borderRadius:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"border.disabled",backdropFilter:"blur(5px)"},children:ut.jsxs(m,{sx:{px:20,pt:20,pb:12,backgroundColor:"background.paper",borderRadius:16,borderWidth:1,borderStyle:"solid",borderColor:"border.main"},className:"gradient-card-border",onClick:()=>{i||fc.getState().push({type:hc.PoolDetail,params:{chainId:w.chainId,address:w.id}})},children:[ut.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap"},children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:8},children:[k&&R?ut.jsx(Fc,{tokens:[k,R],width:24,mr:6,chainId:w.chainId,showChainLogo:!0}):"",ut.jsxs(m,{sx:{typography:"body2",fontWeight:600},children:[`${null==k?void 0:k.symbol}/${null==R?void 0:R.symbol}`,ut.jsx(Ru,{address:w.id,chainId:w.chainId})]})]}),V?ut.jsxs(m,{sx:{p:8,typography:"h6",fontWeight:"bold",background:`linear-gradient(180deg, ${T(r.palette.secondary.main,.3)} 0%, ${T(r.palette.purple.main,.3)} 100%)`,borderRadius:8,color:"purple.main",whiteSpace:"nowrap"},children:["✨ ",ut.jsx(n,{id:"Sti4vy",message:"Mining"})]}):""]}),ut.jsxs(m,{sx:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",rowGap:20,mt:44,"& > div:nth-child(odd)":{pr:20},"& > div:nth-child(even)":{position:"relative",pl:20,"&::before":{position:"absolute",left:0,top:"50%",transform:"translateY(-50%)",display:"inline-block",content:'""',height:24,width:"1px",backgroundColor:"border.main"}}},children:[i&&ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4,whiteSpace:"nowrap"},children:[F,ut.jsx(L,{title:ut.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:ut.jsx(m,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:iu({type:w.type,lpFeeRate:null!==(f=w.lpFeeRate)&&void 0!==f?f:0,mtFeeRate:null!==(g=w.mtFeeRate)&&void 0!==g?g:0})})})]}),ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"1Qz63U",message:"Pool Type"})})]}),A?null:ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{children:[ut.jsxs(m,{sx:{typography:"h5",color:"success.main"},children:[S,E?`/${E}`:""]}),ut.jsxs(m,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:[ut.jsx(n,{id:"rSayea",message:"APY"}),ut.jsx(Bu,{chainId:w.chainId,apy:w.apy,baseToken:k,quoteToken:R,hasQuote:!!E,hasMining:V,sx:{width:14,height:14}})]})]}),ut.jsxs(m,{children:[ut.jsxs(m,{sx:{typography:"h5"},children:["$",Lr(new te(w.tvl||0))]}),ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"FHKsZF",message:"TVL"})})]})]}),N&&ut.jsxs(m,{children:[ut.jsx(m,{sx:{typography:"h5"},children:Ir({input:null===(y=null===(x=t.liquidityPositions)||void 0===x?void 0:x[0])||void 0===y?void 0:y.poolShare})}),ut.jsx(m,{sx:{typography:"h6",color:"text.secondary"},children:ut.jsx(n,{id:"h3PbRN",message:"My Pool Share"})})]}),ut.jsxs(m,{children:[ut.jsx(m,{sx:{typography:"h5",display:"flex",alignItems:"center",fontWeight:"bold"},children:A?(null==O?void 0:O.liquidityUSD)?`$${jr({input:O.liquidityUSD,decimals:2})}`:"-":ut.jsxs(ut.Fragment,{children:[M?ut.jsx(Kl,{address:null==k?void 0:k.address,chainId:w.chainId,url:null==k?void 0:k.logoURI,width:18,height:18,sx:{mr:4}}):ut.jsx(Fc,{tokens:k&&R?[k,R]:[],width:18,mr:4,showChainLogo:!1,chainId:w.chainId}),W?br({input:W}):"",M&&ut.jsxs(ut.Fragment,{children:[" / ",ut.jsx(Kl,{address:null==R?void 0:R.address,chainId:w.chainId,url:null==R?void 0:R.logoURI,width:18,height:18,sx:{mx:4}}),I?br({input:I}):"0"]})]})}),ut.jsx(m,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:ut.jsx(n,{id:"YHc3B+",message:"My Liquidity"})})]}),A&&ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4,color:"text.primary"},children:[ut.jsx(Qu,{outOfRange:null!==(b=null==O?void 0:O.outOfRange)&&void 0!==b&&b}),ut.jsx(m,{children:ut.jsxs(ut.Fragment,{children:[ut.jsxs("span",{children:[ep({price:null===(j=null==O?void 0:O.priceRange)||void 0===j?void 0:j.token0LowerPrice,atLimit:{},direction:Ku.LOWER})," "]}),null==k?void 0:k.symbol]})}),ut.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:ut.jsx("path",{d:"M15.75 9.50293L12.75 12.5029L11.7 11.4529L12.8813 10.2529L5.11875 10.2529L6.3 11.4529L5.25 12.5029L2.25 9.50293L5.25 6.50293L6.31875 7.55293L5.11875 8.75293L12.8813 8.75293L11.7 7.55293L12.75 6.50293L15.75 9.50293Z",fill:"currentColor",fillOpacity:"0.5"})}),ut.jsx(m,{children:ut.jsxs(ut.Fragment,{children:[ut.jsxs("span",{children:[ep({price:null===(C=null==O?void 0:O.priceRange)||void 0===C?void 0:C.token1LowerPrice,atLimit:{},direction:Ku.UPPER})," "]}),null==k?void 0:k.symbol]})})]}),ut.jsx(m,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:ut.jsx(n,{id:"YA4hwj",message:"Price Range"})})]})]}),ut.jsxs(m,{sx:{mt:20,display:"flex",gap:"8px"},children:[A?null:!!e&&ut.jsx(Pd,{fullWidth:!0,variant:v.Variant.outlined,size:v.Size.small,onClick:e=>{e.stopPropagation(),o({operate:au.Remove,pool:nu(t),hasMining:V})},children:ut.jsx(n,{id:"t/YqKh",message:"Remove"})}),ut.jsx(Pd,{fullWidth:!0,size:v.Size.small,onClick:e=>{e.stopPropagation(),o({operate:au.Add,pool:nu(t),hasMining:V})},children:ut.jsx(n,{id:"J/hVSQ",message:"{0}",values:{0:A?"Manage":"Add"}})}),i&&"PMM"===F&&ut.jsx(Au,{chainId:w.chainId,address:w.id})]})]})},A?null==O?void 0:O.id:w.id+w.chainId)}))})}function op({account:e,lqList:t,operatePool:i,setOperatePool:r,supportAMM:a,onlyV3:l}){const s=g();return ut.jsxs(Hu,{children:[ut.jsx(m,{component:"thead",children:ut.jsxs(m,{component:"tr",children:[ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"AxdOHo",message:"Pair"})}),a&&ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"1Qz63U",message:"Pool Type"})}),l?null:ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"FHKsZF",message:"TVL"})}),l?null:ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"rSayea",message:"APY"})}),ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"YHc3B+",message:"My Liquidity"})}),l?ut.jsx(m,{component:"th",children:ut.jsx(n,{id:"YA4hwj",message:"Price Range"})}):null,ut.jsx(m,{component:"th",sx:{width:210}})]})}),ut.jsx(m,{component:"tbody",children:null==t?void 0:t.map((t=>{var d,c,u,h,f,g,x,y,b,j,C,w,k,R,M,S,E,T;if(!(null==t?void 0:t.pair))return null;const W=t.pair,I=eu(W.baseToken,W.chainId),V=eu(W.quoteToken,W.chainId),O=p.utils.singleSideLp(W.type),Z=W.apy?Vr(new te(null===(d=W.apy)||void 0===d?void 0:d.transactionBaseApy).plus(null!==(u=null===(c=W.apy)||void 0===c?void 0:c.miningBaseApy)&&void 0!==u?u:0)):void 0,F=O&&W.apy?Vr(new te(W.apy.transactionQuoteApy).plus(null!==(h=W.apy.miningQuoteApy)&&void 0!==h?h:0)):void 0;let N,A;(null===(f=t.liquidityPositions)||void 0===f?void 0:f.length)&&t.liquidityPositions.forEach((e=>{var t,n,o,i,r;if(null==e?void 0:e.liquidityTokenBalance){const a=null===(t=e.id)||void 0===t?void 0:t.split("-");if(2===(null==a?void 0:a.length)){const t=a[1].toLocaleLowerCase();if((null===(o=null===(n=null==W?void 0:W.baseLpToken)||void 0===n?void 0:n.id)||void 0===o?void 0:o.toLocaleLowerCase())===t)return void(N=new te(e.liquidityTokenBalance));(null===(r=null===(i=null==W?void 0:W.quoteLpToken)||void 0===i?void 0:i.id)||void 0===r?void 0:r.toLocaleLowerCase())===t&&(A=new te(e.liquidityTokenBalance))}}}));const H=null===(g=t.liquidityPositions)||void 0===g?void 0:g[0],P=W.type,B=ou(P),U="SVM_AMMV2"===P,D="SVM_AMMV3"===P;let Y="";if(D)(null===(b=null===(y=null===(x=null==i?void 0:i.pool)||void 0===x?void 0:x.liquidityPositions)||void 0===y?void 0:y[0])||void 0===b?void 0:b.id)===(null==H?void 0:H.id)&&(Y=o._({id:"p3607o",message:"Managing"}));else if((null===(j=null==i?void 0:i.pool)||void 0===j?void 0:j.address)===W.id||(null==i?void 0:i.address)===W.id)if(i.operate===au.Remove)Y=o._({id:"0+31GV",message:"Removing"});else Y=o._({id:"1yHVE+",message:"Adding"});const z=!!(null===(C=W.miningAddress)||void 0===C?void 0:C[0]),X=s.palette.background.tag;return ut.jsxs(m,{component:"tr",sx:{["&:hover td"+(Y?", & td":"")]:{backgroundImage:`linear-gradient(${X}, ${X})`}},children:[ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[I&&V?ut.jsx(Fc,{tokens:[I,V],width:24,mr:10,chainId:W.chainId,showChainLogo:!0}):"",ut.jsxs(m,{children:[ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[`${null==I?void 0:I.symbol}/${null==V?void 0:V.symbol}`,ut.jsx(Ru,{address:W.id,chainId:W.chainId})]}),ut.jsx(Oc,{address:W.id,customChainId:W.chainId,truncate:!0,showCopy:!0,iconDarkHover:!0,iconSize:14,iconSpace:4,disabledAddress:a,onAddressClick:()=>{fc.getState().push({type:hc.PoolDetail,params:{chainId:W.chainId,address:W.id}})},sx:{typography:"h6",color:"text.secondary"}})]})]})}),a&&ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4},children:[ut.jsx(m,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary",whiteSpace:"nowrap"},children:B}),ut.jsx(L,{title:ut.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:ut.jsx(m,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:iu({type:W.type,lpFeeRate:null!==(w=W.lpFeeRate)&&void 0!==w?w:0,mtFeeRate:null!==(k=W.mtFeeRate)&&void 0!==k?k:0})})})]})}),D?null:ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{typography:"body2"},title:W.tvl?`$${br({input:W.tvl||0})}`:void 0,children:["$",Lr(new te(W.tvl||0))]})}),D?null:ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[z?ut.jsx(L,{title:o._({id:"Sti4vy",message:"Mining"}),children:ut.jsxs(m,{component:"span",sx:{typography:"body2",color:"success.main"},children:["✨"," "]})}):"",ut.jsx(Bu,{chainId:W.chainId,apy:W.apy,baseToken:I,quoteToken:V,hasQuote:!!F,hasMining:z,children:ut.jsxs(m,{component:"span",sx:{typography:"body2",fontWeight:600,display:"flex",alignItems:"center",width:"max-content",color:"success.main",cursor:"auto"},children:[Z||"0%",F?`/${F}`:""]})})]})}),ut.jsx(m,{component:"td",children:ut.jsx(m,{sx:{display:"flex",alignItems:"center"},children:D?(null==H?void 0:H.liquidityUSD)?`$${jr({input:H.liquidityUSD,decimals:2})}`:"-":ut.jsxs(ut.Fragment,{children:[O?ut.jsx(Kl,{address:null==I?void 0:I.address,chainId:W.chainId,url:null==I?void 0:I.logoURI,width:24,height:24,noShowChain:!0,sx:{mr:4}}):ut.jsx(Fc,{tokens:I&&V?[I,V]:[],width:24,mr:4,showChainLogo:!1,chainId:W.chainId}),N?br({input:N}):"-",O&&ut.jsxs(ut.Fragment,{children:[" / ",ut.jsx(Kl,{address:null==V?void 0:V.address,chainId:W.chainId,url:null==V?void 0:V.logoURI,width:24,height:24,noShowChain:!0,sx:{mx:4}}),A?br({input:A}):"0"]}),U&&ut.jsx(L,{title:ut.jsx(n,{id:"NXZdrO",message:"My pool share"}),children:ut.jsx(m,{sx:{ml:4,px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Ir({input:null===(M=null===(R=t.liquidityPositions)||void 0===R?void 0:R[0])||void 0===M?void 0:M.poolShare})})})]})})}),l?ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:4,color:"text.primary"},children:[ut.jsx(Qu,{outOfRange:null!==(S=null==H?void 0:H.outOfRange)&&void 0!==S&&S}),ut.jsx(m,{children:ut.jsxs(ut.Fragment,{children:[ut.jsxs("span",{children:[ep({price:null===(E=null==H?void 0:H.priceRange)||void 0===E?void 0:E.token0LowerPrice,atLimit:{},direction:Ku.LOWER})," "]}),null==I?void 0:I.symbol]})}),ut.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:ut.jsx("path",{d:"M15.75 9.50293L12.75 12.5029L11.7 11.4529L12.8813 10.2529L5.11875 10.2529L6.3 11.4529L5.25 12.5029L2.25 9.50293L5.25 6.50293L6.31875 7.55293L5.11875 8.75293L12.8813 8.75293L11.7 7.55293L12.75 6.50293L15.75 9.50293Z",fill:"currentColor",fillOpacity:"0.5"})}),ut.jsx(m,{children:ut.jsxs(ut.Fragment,{children:[ut.jsxs("span",{children:[ep({price:null===(T=null==H?void 0:H.priceRange)||void 0===T?void 0:T.token0UpperPrice,atLimit:{},direction:Ku.UPPER})," "]}),null==I?void 0:I.symbol]})})]})}):null,ut.jsx(m,{component:"td",children:ut.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[a&&"PMM"===B&&ut.jsx(Au,{chainId:W.chainId,address:W.id}),Y?ut.jsx(Zu,{text:Y,onClick:()=>r(null)}):ut.jsxs(ut.Fragment,{children:[D?null:!!e&&ut.jsx(Pd,{variant:v.Variant.outlined,size:v.Size.small,onClick:e=>{e.stopPropagation(),r({operate:au.Remove,pool:nu(t),hasMining:z})},children:ut.jsx(n,{id:"t/YqKh",message:"Remove"})}),ut.jsx(Pd,{size:v.Size.small,onClick:()=>{r({pool:nu(t),hasMining:z})},children:D?o._({id:"wckWOP",message:"Manage"}):o._({id:"m16xKo",message:"Add"})})]})]})})]},D?null==H?void 0:H.id:W.id+W.chainId)}))})]})}function ip({account:e,filterChainIds:t,activeChainId:n,handleChangeActiveChainId:o,operatePool:i,setOperatePool:r}){var a,l,s,d,c,u,h;g();const{minDevice:f,isMobile:x}=Kd(),v=xe(),{onlyChainId:y,supportAMMV2:b,supportAMMV3:j,notSupportPMM:C}=ar(),[w,k]=X.useState(!1),{filterTokens:R,filterASymbol:M,filterBSymbol:S,filterAddressLqList:E,handleDeleteToken:T,handleChangeFilterTokens:W,handleChangeFilterAddress:L}=Yu();let I=[];b&&I.push("SVM_AMMV2"),j&&w&&(I=["SVM_AMMV3"]);const V={currentPage:1,pageSize:1e3,user:e,filterState:{viewOnlyOwn:!0,filterTypes:I}},O=wa(),Z=O.getQuery(p.graphql.fetchMyLiquidityList,{where:Object.assign(Object.assign({},V),{filterState:Object.assign({filterASymbol:M,filterBSymbol:S},V.filterState)})}),F=ve(Object.assign({},Z));let N=null!==(s=null===(l=null===(a=F.data)||void 0===a?void 0:a.liquidity_list)||void 0===l?void 0:l.lqList)&&void 0!==s?s:[];const A=!!(null==E?void 0:E.length);A?N=[...E]:t&&(N=null!==(h=null===(u=null===(c=null===(d=F.data)||void 0===d?void 0:d.liquidity_list)||void 0===c?void 0:c.lqList)||void 0===u?void 0:u.filter((e=>{var n,o;return t.includes(null!==(o=null===(n=null==e?void 0:e.pair)||void 0===n?void 0:n.chainId)&&void 0!==o?o:0)})))&&void 0!==h?h:[]);return ut.jsxs(ut.Fragment,{children:[ut.jsxs(m,{sx:Object.assign(Object.assign({py:16,display:"flex",gap:8},f(475)?{}:{flexDirection:"column"}),x?{}:{px:20,borderBottomWidth:1}),children:[ut.jsxs(m,{sx:Object.assign(Object.assign({display:"flex",alignItems:"center",gap:8},f(475)?{}:{"& > button":{flex:1,flexBasis:"100%"}}),x?{flexWrap:"wrap"}:{}),children:[!y&&ut.jsx(Ou,{chainId:n,setChainId:o}),j&&ut.jsx(tp,{onlyV3:w,setOnlyV3:k,sx:x?{flexGrow:1,flexBasis:"100%"}:void 0}),ut.jsx(Uu,{value:R,onChange:W,searchAddress:(e,t)=>or(this,void 0,void 0,(function*(){var n;const o=O.getInfiniteQuery(p.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},V),{filterState:Object.assign({address:e},V.filterState)})}),i=null===(n=(yield v.fetchQuery(o)).liquidity_list)||void 0===n?void 0:n.lqList;return(null==i?void 0:i.length)?ut.jsx(Du,{list:i,onClick:()=>{L(i),t()}}):null}))})]}),(A||!!R.length)&&ut.jsxs(m,{sx:{my:0},children:[A?ut.jsx(Fu,{lqList:E,onDeleteTag:()=>L([])}):"",ut.jsx(Nu,{tags:R,onDeleteTag:T})]})]}),x?ut.jsxs(ku,{gap:12,children:[F.isLoading?ut.jsx(Pu,{}):"",!F.isLoading&&!(null==N?void 0:N.length)&&!F.error&&ut.jsx(yu,{sx:{mt:40},hasSearch:!!(n&&!y||M||S)}),!!F.error&&ut.jsx(Cu,{refresh:F.refetch,sx:{mt:40}}),ut.jsx(np,{account:e,lqList:N,setOperatePool:r,supportAMM:b||j})]}):ut.jsxs(ut.Fragment,{children:[ut.jsx(op,{account:e,lqList:N,operatePool:i,setOperatePool:r,supportAMM:b||j,onlyV3:w}),ut.jsx(wu,{loading:F.isLoading,refetch:F.error?F.refetch:void 0,empty:!(null==N?void 0:N.length),hasSearch:!!(n&&!y||M||S)})]})]})}var rp,ap;function lp(){return lp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},lp.apply(null,arguments)}const sp=e=>z.createElement("svg",lp({width:66,height:64,viewBox:"0 0 66 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},e),rp||(rp=z.createElement("rect",{width:64,height:60.1342,fill:"url(#pattern0)"})),ap||(ap=z.createElement("defs",null,z.createElement("pattern",{id:"pattern0",patternContentUnits:"objectBoundingBox",width:1,height:1},z.createElement("use",{xlinkHref:"#image0_2465_53170",transform:"matrix(0.00671141 0 0 0.00714286 -0.503356 -0.9)"})),z.createElement("image",{id:"image0_2465_53170",width:300,height:300,xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAADWuSURBVHgB7Z0JeFRVtu9XhYQwJRQzhulE5gYliPNEofc16rtXQvu10O1rCfdrW/F9V+Daer3dtyXwerDt9gLv2TYOLYFuVOhWwBm7NYUDICIEARkCphCCMicECAkk9fZ/n9qVk0pVxqqkEv6/79uc+dSpJOfPWmuvvbYIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGkrdJOCCFO5qs2UrUNQgghcc7JQCOEkLgmQzV/oHmExB0JQggxePCP2+0OrpP4goJFSBXjMzIyBE0xSUjcQcEipAoPxCozMxPrUC23EEJIHAKV8q9cudJfUFBg4ljZQgghcYalWoFlWX7DrFmzjGjNEkIIiQM8qi1Q7STECpaV4eTJk37lHhrRyhXb2vIIIYQ0E4hJzVRtpdi5Vn7VI+hXMatqYuVk8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QQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIQ3l/wMvNv557ac0YgAAAABJRU5ErkJggg=="}))));function dp(e){var{sx:t}=e,n=nr(e,["sx"]);return ut.jsx(B,{...n,sx:Object.assign(Object.assign({},t),{display:"flex",flexDirection:"column",overflow:"hidden"})})}function cp({params:t}){var n;const{isMobile:r}=Kd(),a=ar((e=>e.noDocumentLink)),l=X.useRef(null),{account:s}=sr(),{poolTab:d,tabs:c,handleChangePoolTab:u}=function({account:t,paramsTab:n}){const{i18n:o}=e(),[i,r]=X.useState(Rc.addLiquidity),{supportAMMV2:a,supportAMMV3:l,notSupportPMM:s}=ar(),d=X.useMemo((()=>{const e=[{key:Rc.addLiquidity,value:o._({id:"OBdohg",message:"Add Liquidity"})},{key:Rc.myLiquidity,value:o._({id:"YHc3B+",message:"My Liquidity"})}];return s||e.push({key:Rc.myCreated,value:a||l?o._({id:"zcVtwU",message:"My Pools (PMM)"}):o._({id:"fZFkP1",message:"My Pools"})}),e}),[o._,a,l,s]),c=X.useRef(!1);X.useEffect((()=>{const e=sessionStorage.getItem(wc);t&&e&&!c.current&&(c.current=!0,r(e))}),[t]);const u=e=>{r(e),sessionStorage.setItem(wc,e)};return X.useEffect((()=>{n&&u(n)}),[n]),{poolTab:i,tabs:d,handleChangePoolTab:u}}({account:s,paramsTab:null==t?void 0:t.tab}),{activeChainId:p,filterChainIds:h,handleChangeActiveChainId:f}=function(){const{chainId:e}=sr(),{onlyChainId:t}=ar(),[n,o]=X.useState(t),r=X.useMemo((()=>void 0!==n?[n]:_l(e)?void 0:Object.values(i).filter((e=>!!Number(e)))),[e,n]);return X.useEffect((()=>{const e=sessionStorage.getItem(kc);e&&o(Number(e))}),[]),{activeChainId:n,filterChainIds:r,handleChangeActiveChainId:e=>{void 0===e?sessionStorage.removeItem(kc):sessionStorage.setItem(kc,String(e)),o(e)}}}(),[g,x]=X.useState(null);return ut.jsxs(vc,{sx:Object.assign({},r?{p:20}:{display:"flex",gap:12,flex:1}),ref:l,children:[ut.jsx(m,{sx:r?{}:{p:8,borderRadius:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"border.disabled",backdropFilter:"blur(5px)",flex:1,overflow:"hidden",height:"max-content",maxHeight:"100%"},children:ut.jsxs(H,{value:d,onChange:(e,t)=>{u(t)},sx:r?{}:{display:"flex",flexDirection:"column",borderRadius:16,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"background.paper"},className:r?void 0:"gradient-card-border",children:[ut.jsxs(m,{sx:r?{}:{display:"flex",justifyContent:"space-between",p:20,borderBottomWidth:1},children:[ut.jsx(U,{tabs:c,variant:"rounded",tabsListSx:Object.assign({},r?{mb:16}:{borderBottomWidth:0,justifyContent:"space-between"}),tabSx:r?void 0:{mb:0}}),ut.jsx(Gu,{})]}),ut.jsx(dp,{value:Rc.addLiquidity,sx:{display:"flex",flexDirection:"column",overflow:"hidden"},children:ut.jsx(qu,{account:s,filterChainIds:h,scrollParentRef:l,activeChainId:p,handleChangeActiveChainId:f,operatePool:g,setOperatePool:x})}),ut.jsx(dp,{value:Rc.myLiquidity,children:ut.jsx(ip,{account:s,filterChainIds:h,activeChainId:p,handleChangeActiveChainId:f,operatePool:g,setOperatePool:x})})]})}),ut.jsxs(m,{sx:{position:"relative",width:a&&!g?"auto":375},children:[!a&&ut.jsx(qc,{title:o._({id:"6y2TB3",message:"Liquidity"}),desc:o._({id:"QNrpkx",message:"Classical AMM-like pool. Suitable for most assets."}),linkTo:"https://docs.dodoex.io/product/tutorial/how-to-provide-liquidity",LeftImage:sp}),"SVM_AMMV3"===(null===(n=null==g?void 0:g.pool)||void 0===n?void 0:n.type)&&g.pool.chainId?null:r?ut.jsx(fu,{account:s,onClose:()=>x(null),modal:r,pool:null==g?void 0:g.pool,operate:null==g?void 0:g.operate,hasMining:!1,hidePoolInfo:!1}):!!g&&ut.jsx(hu,{account:s,onClose:()=>x(null),pool:null==g?void 0:g.pool,operate:null==g?void 0:g.operate,hasMining:!1,hidePoolInfo:!1,sx:{width:375,height:"max-content",backgroundColor:"background.paper",borderRadius:16,overflow:"hidden"}})]})]})}function up(){const{routerPage:e}=ar(),t=fc((e=>e.page)),n=null!=e?e:t;switch(null==n?void 0:n.type){case hc.Pool:return ut.jsx(cp,{params:n.params});case hc.createPoolAMMV2:return ut.jsx(Xc,{});default:return ut.jsx(cp,{params:null==n?void 0:n.params})}}function pp(e){return ut.jsx(Ad,{...e,children:ut.jsx(pc,{getAutoSlippage:e.getAutoSlippage,onPayTokenChange:e.onPayTokenChange,onReceiveTokenChange:e.onReceiveTokenChange})})}function hp(e){return ut.jsx(Ad,{...e,children:ut.jsx(up,{})})}export{Xc as AMMV2Create,jd as Message,cr as MetadataFlag,hc as PageType,cp as PoolList,hp as PoolWidget,pp as SoonSwapWidget,pc as Swap,Nd as UnstyleWidget,Ad as Widget,fc as useRouterStore};