@dodoex/widgets 3.0.1-solana.14 → 3.0.1-solana.15
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.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
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 ud(){if(Ks)return Qs;Ks=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return Qs=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,l,a=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)&&(a[d]=r[d]);if(e){l=e(r);for(var c=0;c<l.length;c++)n.call(r,l[c])&&(a[l[c]]=r[l[c]])}}return a},Qs}function pd(){if(ed)return $s;ed=1;return $s="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function hd(){return nd?td:(nd=1,td=Function.call.bind(Object.prototype.hasOwnProperty))}if("production"!==process.env.NODE_ENV){var md=cd();Xs.exports=function(){if(ld)return rd;ld=1;var e=cd(),t=ud(),n=pd(),o=hd(),i=function(){if(id)return od;id=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=pd(),n={},o=hd();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function i(i,r,l,a,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((a||"React class")+": "+l+" 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,a,l,null,t)}catch(e){c=e}if(!c||c instanceof Error||e((a||"React class")+": type specification of "+l+" `"+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 "+l+" type: "+c.message+(null!=p?p:""))}}}return i.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(n={})},od=i}(),r=function(){};function l(){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){}}),rd=function(a,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:f(l),arrayOf:function(e){return f((function(t,o,i,r,l){if("function"!=typeof e)return new m("Property `"+l+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var a=t[o];if(!Array.isArray(a))return new m("Invalid "+r+" `"+l+"` of type `"+v(a)+"` supplied to `"+i+"`, expected an array.");for(var s=0;s<a.length;s++){var d=e(a,s,i,r,l+"["+s+"]",n);if(d instanceof Error)return d}return null}))},element:f((function(e,t,n,o,i){var r=e[t];return a(r)?null:new m("Invalid "+o+" `"+i+"` of type `"+v(r)+"` supplied to `"+n+"`, expected a single ReactElement.")})),elementType:f((function(t,n,o,i,r){var l=t[n];return e.isValidElementType(l)?null:new m("Invalid "+i+" `"+r+"` of type `"+v(l)+"` supplied to `"+o+"`, expected a single ReactElement type.")})),instanceOf:function(e){return f((function(t,n,o,i,r){if(!(t[n]instanceof e)){var l=e.name||u;return new m("Invalid "+i+" `"+r+"` of type `"+((a=t[n]).constructor&&a.constructor.name?a.constructor.name:u)+"` supplied to `"+o+"`, expected instance of `"+l+"`.")}var a;return null}))},node:f((function(e,t,n,o,i){return y(e[t])?null:new m("Invalid "+o+" `"+i+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return f((function(t,i,r,l,a){if("function"!=typeof e)return new m("Property `"+a+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var s=t[i],d=v(s);if("object"!==d)return new m("Invalid "+l+" `"+a+"` of type `"+d+"` supplied to `"+r+"`, expected an object.");for(var c in s)if(o(s,c)){var u=e(s,c,r,l,a+"."+c,n);if(u instanceof Error)return u}return null}))},oneOf:function(e){return Array.isArray(e)?f((function(t,n,o,i,r){for(var l=t[n],a=0;a<e.length;a++)if(h(l,e[a]))return null;var s=JSON.stringify(e,(function(e,t){return"symbol"===b(t)?String(t):t}));return new m("Invalid "+i+" `"+r+"` of value `"+String(l)+"` 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."),l)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&r("Invalid argument supplied to oneOfType, expected an instance of array."),l;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+"."),l}return f((function(t,i,r,l,a){for(var s=[],d=0;d<e.length;d++){var c=(0,e[d])(t,i,r,l,a,n);if(null==c)return null;c.data&&o(c.data,"expectedType")&&s.push(c.data.expectedType)}return new m("Invalid "+l+" `"+a+"` supplied to `"+r+"`"+(s.length>0?", expected one of type ["+s.join(", ")+"]":"")+".")}))},shape:function(e){return f((function(t,o,i,r,l){var a=t[o],s=v(a);if("object"!==s)return new m("Invalid "+r+" `"+l+"` 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,l,d,b(c));var u=c(a,d,i,r,l+"."+d,n);if(u)return u}return null}))},exact:function(e){return f((function(i,r,l,a,s){var d=i[r],c=v(d);if("object"!==c)return new m("Invalid "+a+" `"+s+"` of type `"+c+"` supplied to `"+l+"`, 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(l,a,s,p,b(h));if(!h)return new m("Invalid "+a+" `"+s+"` key `"+p+"` supplied to `"+l+"`.\nBad object: "+JSON.stringify(i[r],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var f=h(d,p,l,a,s+"."+p,n);if(f)return f}return null}))}};function h(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function m(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function f(e){if("production"!==process.env.NODE_ENV)var t={},o=0;function i(i,l,a,d,c,p,h){if(d=d||u,p=p||a,h!==n){if(s){var f=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 f.name="Invariant Violation",f}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var g=d+":"+a;!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==l[a]?i?null===l[a]?new m("The "+c+" `"+p+"` is marked as required in `"+d+"`, but its value is `null`."):new m("The "+c+" `"+p+"` is marked as required in `"+d+"`, but its value is `undefined`."):null:e(l,a,d,c,p)}var l=i.bind(null,!1);return l.isRequired=i.bind(null,!0),l}function g(e){return f((function(t,n,o,i,r,l){var a=t[n];return v(a)!==e?new m("Invalid "+i+" `"+r+"` of type `"+b(a)+"` supplied to `"+o+"`, expected `"+e+"`.",{expectedType:e}):null}))}function x(e,t,n,o,i){return new m((e||"React class")+": "+t+" type `"+n+"."+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}function y(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(y);if(null===e||a(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(!y(n.value))return!1}else for(;!(n=o.next()).done;){var i=n.value;if(i&&!y(i[1]))return!1}return!0;default:return!1}}function v(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=v(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 m.prototype=Error.prototype,p.checkPropTypes=i,p.resetWarningCache=i.resetWarningCache,p.PropTypes=p,p},rd}()(md.isElement,!0)}else Xs.exports=function(){if(sd)return ad;sd=1;var e=pd();function t(){}function n(){}return n.resetWarningCache=t,ad=function(){function o(t,n,o,i,r,l){if(l!==e){var a=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 a.name="Invariant Violation",a}}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 fd=Lt(Xs.exports);function gd(e,t){return"production"===process.env.NODE_ENV?()=>null:function(...n){return e(...n)||t(...n)}}function xd(e,t,n,o,i){const r=e[t],l=i||t;if(null==r||"undefined"==typeof window)return null;let a;const s=r.type;return"function"!=typeof s||function(e){const{prototype:t={}}=e;return Boolean(t.isReactComponent)}(s)||(a="Did you accidentally use a plain function component for an element instead?"),void 0!==a?new Error(`Invalid ${o} \`${l}\` supplied to \`${n}\`. Expected an element that can hold a ref. ${a} For more information see https://mui.com/r/caveat-with-refs-guide`):null}const yd=gd(fd.element,xd);yd.isRequired=gd(fd.element.isRequired,xd);const vd="exact-prop: ";function bd(e){return e&&e.ownerDocument||document}const jd="undefined"!=typeof window?q.useLayoutEffect:q.useEffect;function wd(e){const t=q.useRef(e);return jd((()=>{t.current=e})),q.useRef(((...e)=>(0,t.current)(...e))).current}function Cd(...e){return q.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 kd={};const Rd=[];class Sd{static create(){return new Sd}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 Id(){const e=function(e,t){const n=q.useRef(kd);return n.current===kd&&(n.current=e(t)),n}(Sd.create).current;var t;return t=e.disposeEffect,q.useEffect(t,Rd),e}const Ed={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 Md(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=Md(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Td(){for(var e,t,n=0,o="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Md(e))&&(o&&(o+=" "),o+=t);return o}function Ld(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 Od(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 Wd(e){const{elementType:t,externalSlotProps:n,ownerState:o,skipResolvingSlotProps:i=!1,...r}=e,l=i?{}:function(e,t,n){return"function"==typeof e?e(t,n):e}(n,o),{props:a,internalRef:s}=function(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:o,externalForwardedProps:i,className:r}=e;if(!t){const e=Td(n?.className,r,i?.className,o?.className),t={...n?.style,...i?.style,...o?.style},l={...n,...i,...o};return e.length>0&&(l.className=e),Object.keys(t).length>0&&(l.style=t),{props:l,internalRef:void 0}}const l=Ld({...i,...o}),a=Od(o),s=Od(i),d=t(l),c=Td(d?.className,n?.className,r,i?.className,o?.className),u={...d?.style,...n?.style,...i?.style,...o?.style},p={...d,...n,...s,...a};return c.length>0&&(p.className=c),Object.keys(u).length>0&&(p.style=u),{props:p,internalRef:d.ref}}({...r,externalSlotProps:l}),d=function(e,t,n){return void 0===e||"string"==typeof e?t:{...t,ownerState:{...t.ownerState,...n}}}(t,{...a,ref:Cd(s,l?.ref,e.additionalProps?.ref)},o);return d}function Vd(e){return e.substring(2).toLowerCase()}function Fd(e){const{children:t,disableReactTree:n=!1,mouseEvent:o="onClick",onClickAway:i,touchEvent:r="onTouchEnd"}=e,l=q.useRef(!1),a=q.useRef(null),s=q.useRef(!1),d=q.useRef(!1);q.useEffect((()=>(setTimeout((()=>{s.current=!0}),0),()=>{s.current=!1})),[]);const c=Cd((u=t)&&q.isValidElement(u)?u.props.propertyIsEnumerable("ref")?u.props.ref:u.ref:null,a);var u;const p=wd((e=>{const t=d.current;d.current=!1;const o=bd(a.current);if(!s.current||!a.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}(e,o))return;if(l.current)return void(l.current=!1);let r;r=e.composedPath?e.composedPath().indexOf(a.current)>-1:!o.documentElement.contains(e.target)||a.current.contains(e.target),r||!n&&t||i(e)})),h=e=>n=>{d.current=!0;const o=t.props[e];o&&o(n)},m={ref:c};return!1!==r&&(m[r]=h(r)),q.useEffect((()=>{if(!1!==r){const e=Vd(r),t=bd(a.current),n=()=>{l.current=!0};return t.addEventListener(e,p),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,p),t.removeEventListener("touchmove",n)}}}),[p,r]),!1!==o&&(m[o]=h(o)),q.useEffect((()=>{if(!1!==o){const e=Vd(o),t=bd(a.current);return t.addEventListener(e,p),()=>{t.removeEventListener(e,p)}}}),[p,o]),zt.jsx(q.Fragment,{children:q.cloneElement(t,m)})}"production"!==process.env.NODE_ENV&&(Fd.propTypes={children:yd.isRequired,disableReactTree:fd.bool,mouseEvent:fd.oneOf(["onClick","onMouseDown","onMouseUp","onPointerDown","onPointerUp",!1]),onClickAway:fd.func.isRequired,touchEvent:fd.oneOf(["onTouchEnd","onTouchStart",!1])}),"production"!==process.env.NODE_ENV&&(Fd.propTypes=function(e){return"production"===process.env.NODE_ENV?e:{...e,[vd]: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}}}(Fd.propTypes));const Ad="base";function Zd(e,t){const n=Ed[t];return n?`${Ad}--${n}`:function(e,t){return`${Ad}-${e}-${t}`}(e,t)}const Pd="Snackbar";function Bd(e){return Zd(Pd,e)}!function(e,t){const n={};t.forEach((t=>{n[t]=Zd(e,t)}))}(Pd,["root"]);const Nd={disableDefaultClasses:!1},Ud=q.createContext(Nd);"production"!==process.env.NODE_ENV&&(Ud.displayName="ClassNameConfiguratorContext");const Hd=()=>function(e,t,n){const o={};for(const i in e){const r=e[i];let l="";for(let e=0;e<r.length;e+=1){const o=r[e];o&&(l+=t(o)+" ",n&&n[o]&&(l+=n[o]+" "))}o[i]=l}return o}({root:["root"]},function(e){const{disableDefaultClasses:t}=q.useContext(Ud);return n=>t?"":e(n)}(Bd)),Dd=q.forwardRef((function(e,t){const{autoHideDuration:n=null,children:o,disableWindowBlurListener:i=!1,exited:r=!0,onBlur:l,onClose:a,onFocus:s,onMouseEnter:d,onMouseLeave:c,open:u,resumeHideDuration:p,slotProps:h={},slots:m={},...f}=e,g=Hd(),{getRootProps:x,onClickAway:y}=function(e={}){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:o,open:i,resumeHideDuration:r}=e,l=Id();q.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 a=wd(((e,t)=>{o?.(e,t)})),s=wd((e=>{o&&null!=e&&l.start(e,(()=>{a(null,"timeout")}))}));q.useEffect((()=>(i&&s(t),l.clear)),[i,t,s,l]);const d=l.clear,c=q.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 q.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={...Ld(e),...Ld(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:a,open:u,resumeHideDuration:p}),v=e,b=m.root||"div",j=Wd({elementType:b,getSlotProps:x,externalForwardedProps:f,externalSlotProps:h.root,additionalProps:{ref:t},ownerState:v,className:g.root}),w=Wd({elementType:Fd,externalSlotProps:h.clickAwayListener,additionalProps:{onClickAway:y},ownerState:v});return delete w.ownerState,!u&&r?null:zt.jsx(Fd,{...w,children:zt.jsx(b,{...j,children:o})})}));function Yd({size:e,color:t,time:n,strokeWidth:o=2,sx:i}){const[r,l]=_("0 1069"),a=e/2,s=a-1;return J((()=>{l(2*Math.PI*s+" 0")}),[]),zt.jsx(x,{width:e,height:e,component:"svg",sx:Object.assign({position:"absolute",top:`-${o}`,left:`-${o}`,transform:"rotate(-90deg)"},i),children:zt.jsx(x,{component:"circle",cx:a,cy:a,r:s,strokeWidth:o,stroke:t,fill:"none",strokeDasharray:r,sx:{transition:`stroke-dasharray ${n}`}})})}"production"!==process.env.NODE_ENV&&(Dd.propTypes={autoHideDuration:fd.number,children:fd.node,disableWindowBlurListener:fd.bool,exited:fd.bool,onClose:fd.func,open:fd.bool,resumeHideDuration:fd.number,slotProps:fd.shape({clickAwayListener:fd.oneOfType([fd.func,fd.shape({children:fd.element.isRequired,disableReactTree:fd.bool,mouseEvent:fd.oneOf(["onClick","onMouseDown","onMouseUp","onPointerDown","onPointerUp",!1]),onClickAway:fd.func,touchEvent:fd.oneOf(["onTouchEnd","onTouchStart",!1])})]),root:fd.oneOfType([fd.func,fd.object])}),slots:fd.shape({root:fd.elementType})});var zd=G.memo(Yd);const Xd=Pe((e=>({notify:null,toast:t=>{e({notify:t})},close:()=>{e({notify:null})}}))),qd={entering:"translateX(0)",entered:"translateX(0)",exiting:"translateX(500px)",exited:"translateX(500px)",unmounted:"translateX(500px)"};function Gd(){const e=y(),{notify:t,close:n}=Xd(),[o,i]=G.useState(!0),r=G.useRef(null),l=null==t?void 0:t.timeout,a=!!t;let s=zt.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[zt.jsx("circle",{cx:"18",cy:"18",r:"16.5",stroke:"#2FBA90",strokeWidth:"3"}),zt.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=zt.jsxs("svg",{width:"36",height:"37",viewBox:"0 0 36 37",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[zt.jsx("circle",{cx:"18",cy:"18.5",r:"16.5",stroke:"#FF6187",strokeWidth:"3"}),zt.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=zt.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[zt.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"}),zt.jsx("path",{d:"M15.1664 7.58398H12.8331V16.9173H15.1664V7.58398Z",fill:"#B15600"}),zt.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 zt.jsx(x,{component:Dd,open:a,autoHideDuration:l,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:zt.jsx(ht,{timeout:{enter:400,exit:400},in:a,appear:!0,unmountOnExit:!0,onEnter:()=>{i(!1)},onExited:()=>{i(!0)},nodeRef:r,children:o=>zt.jsxs(x,{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:qd[o],transition:"transform 300ms ease",[e.breakpoints.up("tablet")]:{p:20,width:"auto",maxWidth:328}},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(x,{sx:{mt:7,"& > svg":{width:28,height:28},[e.breakpoints.up("tablet")]:{"& > svg":{width:36,height:36}}},children:t?s:""}),zt.jsxs(x,{sx:{ml:20},children:[zt.jsx(x,{sx:{typography:"caption"},children:null==t?void 0:t.message}),(null==t?void 0:t.link)?zt.jsxs(x,{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,zt.jsx(x,{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:zt.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)?zt.jsx(x,{sx:{mt:4,typography:"body2",color:"text.secondary"},children:t.content}):""]})]}),zt.jsxs(x,{sx:{position:"relative",top:10,ml:12,display:"flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:12,borderStyle:"solid",borderWidth:l?"2.4px":0,borderColor:e.palette.border.main,backgroundColor:l?"transparent":e.palette.background.paperDarkContrast,cursor:"pointer",boxSizing:"border-box",[e.breakpoints.up("tablet")]:{ml:28}},onClick:n,children:[l?zt.jsx(zd,{size:24,strokeWidth:"2.4px",time:`${l}ms`,color:e.palette.text.disabled}):"",zt.jsx(x,{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:zt.jsx("g",{children:zt.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 _d;function Jd(){return Jd=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},Jd.apply(null,arguments)}const Qd=e=>q.createElement("svg",Jd({width:"33px",height:"33px",viewBox:"0 0 33 33",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},e),_d||(_d=q.createElement("g",{stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},q.createElement("g",{transform:"translate(-186.000000, -375.000000)",stroke:"currentColor",strokeWidth:4},q.createElement("g",{transform:"translate(18.000000, 291.000000)"},q.createElement("g",{transform:"translate(40.000000, 83.000000)"},q.createElement("path",{d:"M159,32 C159,15.9837423 146.016258,3 130,3"}))))))),Kd=300;function $d({open:e,onClose:t,afterClose:n,title:o,rightSlot:i,canBack:r=!0,children:l,height:a,testId:s}){return zt.jsxs(x,{sx:{position:"absolute",top:e?0:"100%",transition:`all ${Kd}ms`,zIndex:20,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",backgroundColor:"background.paper",borderRadius:16,height:a},"data-testid":s,"data-active":e?"1":"0",children:[o?zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20},children:[zt.jsx(x,{sx:{display:"flex",alignItems:"center",typography:"caption"},children:o}),i,!i&&r&&zt.jsx(x,{component:Wt.Error,sx:{color:"text.secondary",cursor:"pointer"},onClick:()=>{t&&t(),setTimeout((()=>n&&n()),Kd)}})]}):"",e?l:""]})}function ec({open:e,onClose:t,afterClose:n,title:o,rightSlot:i,canBack:r=!0,children:l,height:a,testId:s}){return zt.jsx(v,{open:e,onClose:t,"data-testid":s,"data-active":e?"1":"0",children:zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",height:a},children:[o?zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20},children:[zt.jsx(x,{sx:{display:"flex",alignItems:"center",typography:"caption"},children:o}),i,!i&&r&&zt.jsx(x,{component:Wt.Error,sx:{color:"text.secondary",cursor:"pointer"},onClick:()=>{t&&t(),setTimeout((()=>n&&n()),Kd)}})]}):"",e?l:""]})})}function tc(e){var{scope:t,modal:n}=e,o=Tr(e,["scope","modal"]);const{widgetRef:i,DialogComponent:r}=Vr();if(r)return zt.jsx(r,{scope:t,...o});const l=n?ec:$d;return(null==i?void 0:i.current)&&!t?mt(zt.jsx(l,{...o}),i.current):zt.jsx(l,{...o})}const nc=6;function oc({showingDone:e,errorMessage:t}){var n;const o=y();return t?zt.jsx(x,{component:Wt.ErrorWarn,sx:{width:64,height:64,color:"error.main"}}):e?zt.jsx(x,{component:Wt.DoneBorder,sx:{width:64,height:64,color:"success.main"}}):zt.jsx(x,{sx:{mx:"auto",border:`${nc}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:zt.jsx(x,{component:Qd,sx:{position:"absolute",top:`-${nc}px`,right:`-${nc}px`,color:"primary.main"}})})}function ic({showingDone:e,showing:t}){return zt.jsxs(x,{sx:{display:"flex",alignItems:"center",flexDirection:"column"},children:[zt.jsx(x,{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)?zt.jsx(x,{sx:{mt:20,typography:"body2"},children:null==t?void 0:t.subtitle}):""]})}function rc({isStarted:e,isEnded:t,tx:o}){const[i,r]=_(0),{chainId:l}=Ar(),a=K((()=>`https://${fr[l||1]}/tx/${o}`),[o,l]),s=K((()=>{const e=Math.floor(i/60),t=i%60;return e?`${e}m ${t}s`:`${t}s`}),[i]),d=te();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]),zt.jsxs(x,{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:[zt.jsxs(x,{children:[zt.jsx(n,{id:"+Jkdiu",message:"Transaction Time:"}),s]}),zt.jsxs(j,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},component:"a",href:a,target:"_blank",rel:"noopener noreferrer",children:[zt.jsx(n,{id:"S3piC2",message:"Tx"}),zt.jsx(x,{component:Wt.ArrowTopRightBorder,sx:{width:16,height:16,ml:6}})]})]})}function lc(e){var{children:t,executionStatus:o}=e;const i=jl(Tr(e,["children","executionStatus"])),{ctxVal:r,showing:l,closeShowing:a,showingDone:s,errorMessage:d,transactionTx:c}=Object.assign(Object.assign({},i),o),u=pe(),p=Vr((e=>e.noSubmissionDialog));return zt.jsxs(wl.Provider,{value:r,children:[t,zt.jsx(tc,{open:!!l&&!p,onClose:a,id:"submission",children:zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",px:20,pb:20,flex:1,overflowY:"auto"},children:[zt.jsxs(x,{children:[zt.jsx(x,{sx:{textAlign:"center",pt:60},children:zt.jsx(oc,{showingDone:s,errorMessage:d})}),d?zt.jsxs(x,{sx:{textAlign:"center",mt:60},children:[zt.jsx(x,{children:zt.jsx(n,{id:"kf83Ld",message:"Something went wrong."})}),zt.jsx(x,{sx:{color:"text.secondary",mt:12,typography:"body2",wordBreak:"break-all"},children:d})]}):zt.jsxs(zt.Fragment,{children:[zt.jsx(ic,{showingDone:s,showing:l}),zt.jsx(rc,{isStarted:!!l,isEnded:s,tx:c})]})]}),zt.jsx(b,{fullWidth:!0,size:b.Size.big,onClick:()=>{u(Ur(Yr.Initial)),a()},sx:{mt:20},children:d?zt.jsx(n,{id:"1QfxQT",message:"Dismiss"}):zt.jsx(n,{id:"yz7wBu",message:"Close"})})]})})]})}const ac="dodo-widget-container";function sc(e){return e.noLangProvider?zt.jsx(zt.Fragment,{children:e.children}):zt.jsx(Hs,{locale:e.locale,children:zt.jsx(lc,{...e,children:e.children})})}function dc(e){!function({tokenList:e,popularTokenList:t}){const n=pe();J((()=>{(()=>{Lr(this,void 0,void 0,(function*(){let o=[];o=se(e)?e:ae(t,ia,(e=>e.address.toLowerCase()+e.chainId+e.side)),n(ra(o))}))})()}),[e,n,t]),J((()=>{n(la(null!=t?t:[]))}),[t,n])}(e),yl();const t=e.width||375,n=e.height||494,{widgetRef:o}=Vr();return e.noUI?zt.jsx(sc,{...e,children:e.children}):zt.jsx(sc,{...e,children:zt.jsx(x,{sx:{width:t,height:n,overflow:"hidden",position:"relative",display:"flex",flexDirection:"column",minWidth:335,minHeight:494,borderRadius:16,backgroundColor:"background.paper"},className:ac,ref:o,children:e.children})})}function cc(e){var t,n;const o=te(null);return zt.jsx(me,{store:Fl,children:zt.jsx(Wr,{...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:zt.jsx(Ys,{children:zt.jsx(Os,{children:zt.jsx(dc,{...e})})})})})}function uc(e){const t=w({mode:e.colorMode,theme:e.theme,lang:e.locale||Is});return e.apikey||e.apiServices||console.error("apikey and apiServices must have a."),zt.jsxs(C,{theme:t,children:[zt.jsx(k,{container:`.${ac}, .${R}, .${S}`}),zt.jsx(Re,{client:Ds,children:zt.jsxs(cc,{...e,children:[e.children,zt.jsx(Gd,{})]})})]})}function pc(e){var{sx:t}=e,n=Tr(e,["sx"]);const{width:o}=Vr(),i=K((()=>{let e="";return"number"==typeof o?e=`${o}px`:o&&(e=o),e?`calc(${e} - 40px)`:"auto"}),[o]);return zt.jsx(I,{container:document.querySelector(`.${ac}`),maxWidth:i,sx:Object.assign({cursor:"help"},t),...n})}function hc(e){var t,{chainId:o,includeButton:i}=e,r=Tr(e,["chainId","includeButton"]);const{account:l,chainId:a}=Ar(),{onConnectWalletClick:s}=Vr(),[d,c]=G.useState(!1),{setVisible:u}=pt();return!l||d||void 0===a||o&&o!==a?zt.jsx(zt.Fragment,{children:zt.jsx(b,{...r,isLoading:d,onClick:()=>Lr(this,void 0,void 0,(function*(){if(s){c(!0);const e=yield s();if(c(!1),e)return}u(!0)})),children:d?zt.jsx(n,{id:"J28zul",message:"Connecting..."}):zt.jsx(n,{id:"r7ScnQ",message:"Connect to a wallet"})})}):i?zt.jsx(zt.Fragment,{children:null!==(t=r.children)&&void 0!==t?t:null}):zt.jsx(b,{...r})}function mc({needSwitchChain:e}){return zt.jsx(zt.Fragment,{children:zt.jsx(hc,{size:b.Size.middle,fullWidth:!0,"data-testid":Rr,chainId:e})})}function fc({open:e,execute:t,onClose:o,toToken:i,fromToken:r,fromAmount:l,toAmount:a,priceImpact:s,clearFromAmt:d,clearToAmt:c,baseFeeAmount:u,curToFiatPrice:p,curFromFiatPrice:h,additionalFeeAmount:m,loading:f,slippage:g}){var v,j;const w=y(),C=pe(),k=he(Al),R=K((()=>!!s&&new ie(s).gt(br)),[s]),[S,I]=_(!1),[T,L]=_(!1);return J((()=>{k!==Yr.Pending&&o(),k===Yr.TxSuccess&&(c(),d())}),[k]),J((()=>{I(!1)}),[p]),zt.jsx(tc,{open:e,onClose:()=>{C(Ur(Yr.Initial)),o()},id:"swap-summary",title:zt.jsx(n,{id:"QR4/RH",message:"Swap summary"}),children:zt.jsxs(x,{sx:{margin:20,display:"flex",height:"100%",flexDirection:"column",borderTop:`1px solid ${w.palette.border.main}`},children:[zt.jsxs(x,{sx:{py:20,display:"flex",typography:"body2",alignItems:"center",justifyContent:"center",flexDirection:"column",borderBottom:`1px solid ${w.palette.border.main}`},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:[zt.jsx(Ss,{width:16,height:16,url:null==r?void 0:r.logoURI,address:null!==(v=null==r?void 0:r.address)&&void 0!==v?v:"",marginRight:6}),zt.jsx(x,{children:`${_r({input:l,decimals:null==r?void 0:r.decimals})} ${null==r?void 0:r.symbol}`})]}),null!==h&&zt.jsx(x,{sx:{mt:4,typography:"h6",color:w.palette.text.secondary},children:h?`$${Gr({input:h,showDecimals:1})}`:"-"})]}),zt.jsx(x,{sx:{width:16,mx:16},component:Wt.DoubleRight}),zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex"},children:[zt.jsx(Ss,{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:""}),zt.jsx(E,{loading:f,loadingProps:{width:30},children:`${_r({input:a,decimals:null==i?void 0:i.decimals})} ${null==i?void 0:i.symbol}`})]}),null!==h&&zt.jsx(E,{loading:f,loadingProps:{width:30},sx:{typography:"h6",mt:4,color:w.palette.text.secondary},children:p?`$${Gr({input:p,showDecimals:1})}(${s}%)`:"-"})]})]}),zt.jsxs(x,{sx:{mt:12,display:"flex",alignItems:"center",typography:"h6"},children:["1",null==r?void 0:r.symbol," = ",zt.jsx(E,{loading:f,loadingProps:{width:30},children:_r({input:new ie(a).dividedBy(new ie(l)),decimals:null==i?void 0:i.decimals})})," ",null==i?void 0:i.symbol]})]}),zt.jsxs(x,{sx:{py:15,typography:"body2",borderBottom:`1px solid ${w.palette.border.main}`},children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",color:w.palette.text.secondary},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(x,{sx:{width:16,mr:7},component:Wt.DetailBorder}),zt.jsx(n,{id:"XeovX3",message:"Swap Detail"})]}),zt.jsx(x,{component:M,children:zt.jsx(x,{onClick:()=>L(!T),sx:{width:10,color:"text.secondary",transform:T?"rotateX(0deg)":"rotateX(180deg)"},component:Wt.CaretUp})})]}),zt.jsxs(x,{sx:{mt:16,display:T?"initial":"none"},children:[zt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(n,{id:"93m8jT",message:"Basic Fee"}),zt.jsx(pc,{title:zt.jsx(n,{id:"8Z29ZO",message:"Estimated service provider fees"}),ml:5})]}),zt.jsx(E,{loading:f,loadingProps:{width:30},children:u?`${_r({input:u,decimals:null==i?void 0:i.decimals})} ${null==i?void 0:i.symbol}`:"0"})]}),zt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(n,{id:"J39pAJ",message:"Additional Fee"}),zt.jsx(pc,{title:zt.jsx(n,{id:"ZXvy7b",message:"Additional routing fees set by the Widget user"}),ml:5})]}),zt.jsx(E,{loading:f,loadingProps:{width:30},children:m?`${_r({input:m,decimals:null==i?void 0:i.decimals})} ${null==i?void 0:i.symbol}`:"0"})]}),!!s&&zt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(n,{id:"T+qgFw",message:"Price Impact"}),zt.jsx(pc,{title:zt.jsx(n,{id:"4kY4C4",message:"Due to the market condition, market price and estimated price may have a slight difference"}),ml:5})]}),zt.jsx(x,{children:`${s}%`})]}),zt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(n,{id:"CMHmbm",message:"Slippage"}),zt.jsx(pc,{title:zt.jsx(n,{id:"GAypnX",message:"High slippage tolerance will increase the success rate of transaction, but might not get the best quote."}),ml:5})]}),zt.jsxs(x,{children:[g,"%"]})]})]})]}),zt.jsx(x,{sx:{flex:1}}),R&&zt.jsxs(x,{sx:{mb:14,display:"flex",cursor:"pointer",justifyContent:"center",alignItems:"center",typography:"h6"},onClick:()=>I(!S),children:[zt.jsx(x,{sx:{mr:4,width:18,height:18,alignItems:"center"},children:S?zt.jsx(x,{sx:{width:"100%",height:"100%",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"secondary.main"},children:zt.jsx(x,{component:Wt.Done,sx:{width:14,color:"#1a1a1b"}})}):zt.jsx(x,{sx:{width:"100%",height:"100%",borderRadius:4,border:`1px solid ${w.palette.text.secondary}`}})}),zt.jsx(x,{children:zt.jsx(n,{components:{0:zt.jsx(x,{component:"span",sx:{color:"error.main"}})},values:{priceImpact:s},id:"Price impact reaches <0>{priceImpact}</0>%, accept the quote"})})]}),zt.jsx(b,{isLoading:k==Yr.Pending,disabled:R&&!S,fullWidth:!0,onClick:()=>{t(),C(Ur(Yr.Pending))},children:k==Yr.Pending?zt.jsx(n,{id:"P+K/3O",message:"Confirming"}):zt.jsx(n,{id:"lQ6r7x",message:"Confirm swap"})})]})})}var gc;function xc({fromToken:e,toToken:t}){const o=y(),{onlySolana:i}=Vr();_l();const{customSlippage:r,customSlippageNum:l,handleSlippageChange:a,forecastSlippage:s,forecastSlippageQuery:d,recommendSlippage:c}=Kl({fromToken:e,toToken:t}),[u,p]=G.useState(!1),[h,m]=G.useState();!h&&e&&t&&m(r?gc.custom:gc.recommend);const f=h===gc.custom;return G.useRef(null),G.useMemo((()=>h===gc.custom?l?new ie(l).div(100).toNumber():void 0:new ie(c).div(100).toNumber()),[h,c,l]),G.useCallback((e=>{f||m(gc.custom),a({slippage:new ie(e).times(100).toString(),disabled:!1,deleted:!1,recommend:String(c)})}),[f,c,a]),i?zt.jsxs(x,{sx:{pt:20,borderTop:`1px solid ${o.palette.border.main}`},children:[zt.jsxs(x,{sx:{mb:16,display:"flex",alignItems:"center"},children:[zt.jsx(n,{id:"lqTDfd",message:"Slippage Tolerance"}),zt.jsx(I,{title:zt.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})]}),zt.jsxs(x,{sx:{display:"flex",flexDirection:"column"},children:[zt.jsx(T,{placeholder:String(c),fullWidth:!0,sx:{height:36,"& input":{boxSizing:"border-box","&::placeholder":{color:"custom.input.placeholder",opacity:1}}},inputMode:"decimal",suffix:zt.jsx(x,{sx:{color:"text.disabled"},children:"%"}),value:r||"",onChange:e=>{const t=e.target.value;a({slippage:t,disabled:!1,recommend:String(c)})},onBlur:()=>{setTimeout((()=>{if(p(!1),!l)return void m(gc.recommend);const e=!l||l<0;e&&r&&a({slippage:r,disabled:e,deleted:e,recommend:String(c)})}),10)}}),Number(r)>=wr&&zt.jsx(x,{sx:{typography:"h6",mt:6,color:"error.main"},children:zt.jsx(n,{id:"Zm56FI",message:"Maximum slippage do not exceed 50%"})})]})]}):null}function yc({checked:e,onChange:t,sx:o,disabled:i}){const r=y();let l=r.palette.background.paper;return e&&(l=r.palette.secondary.main),zt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",position:"relative",borderRadius:8,backgroundColor:r.palette.background.input,opacity:i?.5:1},o),component:M,disabled:i,onClick:()=>{i||t(!e)},children:[zt.jsx(x,{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:zt.jsx(n,{id:"az8lvo",message:"Off"})}),zt.jsx(x,{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:zt.jsx(n,{id:"Z5HWHd",message:"On"})}),zt.jsx(x,{sx:{borderRadius:6,backgroundColor:l,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 vc({show:e,onClick:t}){const o=y();return zt.jsxs(j,{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 ${L("light"===o.palette.mode?"#FFF":"#000",.1)}`,cursor:"pointer",whiteSpace:"nowrap",gap:4},onClick:t,children:[zt.jsx(n,{id:"F8yRdq",message:"More trade settings"}),zt.jsx(x,{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:zt.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 bc({open:e,onClose:t,fromToken:o,toToken:i}){const r=y(),{ddl:l,disableIndirectRouting:a}=_l(),{onlySolana:s}=Vr(),d=G.useRef(null),[c,u]=G.useState(!1);return G.useEffect((()=>{const e=d.current,t=new ResizeObserver((()=>{e&&u(e.scrollHeight!==e.offsetHeight)})),n=de((()=>{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]),zt.jsx(tc,{open:e,onClose:t,id:"swap-settings",title:zt.jsx(n,{id:"Tz0i8g",message:"Settings"}),children:zt.jsxs(x,{sx:{px:20,pb:34,overflowY:"auto"},ref:d,children:[zt.jsx(xc,{fromToken:o,toToken:i}),!s&&zt.jsxs(x,{sx:{mt:24,pt:14,borderTop:`solid 1px ${r.palette.border.main}`},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",fontWeight:600},children:[zt.jsx(n,{id:"zSMRJ/",message:"Transaction Deadline"}),zt.jsx(pc,{title:zt.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})]}),zt.jsxs(x,{sx:{mt:16,display:"flex",alignItems:"center",gap:8,typography:"body2"},children:[zt.jsx(T,{sx:{width:80,height:34,lineHeight:1,typography:"body2","& input":{px:16,py:6}},placeholder:String(Cr),value:l,onChange:e=>{_l.setState({ddl:e.target.value})}}),zt.jsx(n,{id:"H9HlDe",message:"minutes"})]})]}),!s&&zt.jsx(x,{sx:{display:"flex",flexDirection:"column",gap:12,mt:24,pt:14,borderTop:`solid 1px ${r.palette.border.main}`},children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[zt.jsxs(x,{sx:{fontWeight:600},children:[zt.jsx(n,{id:"MXQodB",message:"Disable Indirect Routing"}),zt.jsx(pc,{title:zt.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})]}),zt.jsx(yc,{checked:a,onChange:e=>{_l.setState({disableIndirectRouting:e})}})]})}),zt.jsx(vc,{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 jc({onClick:e,disabled:t,plus:n}){const o=y(),i=t||n||!e;return zt.jsx(x,{sx:{width:"100%",position:"relative"},children:zt.jsx(x,{component:M,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?zt.jsx(x,{component:Wt.Plus,sx:{width:18,height:18}}):zt.jsx(x,{component:Wt.ArrowBack,sx:{width:18,height:18}})})})}!function(e){e.recommend="recommend",e.custom="custom"}(gc||(gc={}));const wc=()=>{const{requests:e,updateText:t}=Cl(),n=G.useMemo((()=>{let t={};return null==e||e.forEach((([e,n])=>{var o,i;if((n===Zr.Running||n===Zr.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=G.useMemo((()=>{let t={};return null==e||e.forEach((([e,n])=>{var o,i;if(n===Zr.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=G.useCallback(((e,n,o)=>{const i=e[n];if(!i)return!1;return!!(ie.isBigNumber(o)?o:new ie(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=G.useCallback(((e,t)=>i(n,e,t)),[n,i]),l=G.useCallback(((e,t)=>i(o,e,t)),[o,i]);return{balanceData:n,balanceDataDone:o,isTokenLoading:r,isTokenLoadingDone:l}};function Cc({onClick:e,balance:t,decimals:o,address:i,showMaxBtn:r,canClickBalance:l,loading:a,balanceText:s}){const{palette:d}=y(),c=l&&(null==t?void 0:t.gt(0))&&e;return zt.jsxs(x,{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:zt.jsx(n,{id:"0QDjxt",message:"Balance:"})," ",a?zt.jsx(O,{sx:{position:"relative",top:-2,verticalAlign:"middle"}}):zt.jsxs(zt.Fragment,{children:[i?_r({input:t,decimals:Math.min(o||4,4)}):"-",r&&t&&t.gt(0)&&e&&zt.jsx(x,{component:M,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:zt.jsx(n,{id:"CK1KXz",message:"Max"})})]})]})}const kc=ne((function({readOnly:e,sx:t,value:n,decimals:o,onChange:i,suffix:r,suffixGap:l=0,withClear:a,onFocus:s,placeholder:d,readonlyShowSuffix:c,typography:u},p){const h=y(),m=K((()=>r||(a&&n&&i?zt.jsx(x,{component:M,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:zt.jsx(x,{component:Wt.Error,sx:{width:12}})}):void 0)),[i,r,h.palette.text.primary,n,a]);return zt.jsx(T,{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)&&m,suffixGap:l,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 Rc(){const e=y(),t=Vr((e=>e.width)),[n,o]=G.useState(null!=t?t:"undefined"==typeof window?375:document.body.clientWidth);G.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:G.useMemo((()=>"number"==typeof n&&n<e.breakpoints.values.tablet),[n,e.breakpoints.values]),isTablet:G.useMemo((()=>"number"==typeof n&&n<e.breakpoints.values.tablet),[n,e.breakpoints.values]),minDevice:G.useCallback((e=>"number"==typeof n&&n>e),[n]),maxDevice:G.useCallback((e=>"number"==typeof n&&n<e),[n])}}const Sc=[.25,.5,.75,1];function Ic({value:e,onChange:t,sx:n}){const o=y(),i="light"===o.palette.mode,{isMobile:r}=Rc();return zt.jsx(x,{sx:Object.assign({display:"grid",gap:r?10:14,gridTemplateColumns:`repeat(${Sc.length}, 1fr)`},n),children:Sc.map((n=>{const r=n===e;return zt.jsxs(M,{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:L(o.palette.text.primary,.2)},"&.selected, &:focus":{color:"#fff",backgroundColor:i?o.palette.primary.main:L(o.palette.text.primary,.4)}},onClick:()=>{!r&&t&&t(n)},className:r?"selected":void 0,children:[100*n,"%"]},n)}))})}function Ec({token:e,onClick:t,showChainLogo:o,readonly:i,showChainName:r}){var l,a;const s=y(),d=(null==e?void 0:e.chainId)?ks.get(e.chainId):null,c=r&&!!d;return zt.jsxs(x,{component:M,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":Sr,children:[!!(null==e?void 0:e.address)&&zt.jsx(Ss,{url:null==e?void 0:e.logoURI,address:null!==(l=null==e?void 0:e.address)&&void 0!==l?l:"",chainId:null==e?void 0:e.chainId,noShowChain:!o,width:30,height:30,chainSize:16,logoOffset:10,marginRight:0}),zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[(null==e?void 0:e.address)?zt.jsx(zt.Fragment,{children:zt.jsx(x,{children:null!==(a=null==e?void 0:e.symbol)&&void 0!==a?a:"-"})}):zt.jsx(n,{id:"sIPJGT",message:"SELECT TOKEN"}),!i&&zt.jsx("svg",{width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 11.75L12 7.25H6L9 11.75Z",fill:"currentColor"})})]}),!!c&&zt.jsxs(x,{sx:{display:"flex",alignItems:"center",typography:"h6",color:"text.secondary"},children:[d.name,zt.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zt.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 Mc({token:e,disabled:t,style:n,balance:o,onClick:i}){const r=y(),{account:l}=Ar(),a=o?Gr({input:o}):"";return zt.jsxs(x,{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":Mr,children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(Ss,{token:e}),zt.jsxs(x,{children:[zt.jsx(x,{sx:{fontWeight:600,textAlign:"left"},children:e.symbol}),l&&zt.jsx(x,{sx:{mt:4,textAlign:"left"},children:(null==o?void 0:o.gte(0))?a:zt.jsx(x,{component:Wt.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)"}}}})})]})]}),zt.jsx(x,{sx:{color:"text.secondary",textAlign:"right"},children:e.name})]})}function Tc({chain:e,active:t,onClick:o}){return zt.jsx(W,{title:e.name,placement:"top",onlyHover:!0,children:zt.jsxs(x,{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:[zt.jsx(x,{component:e.logo,sx:{width:24,height:24}}),t?zt.jsxs(x,{sx:{ml:8},children:[zt.jsx(n,{id:"Fdp03t",message:"on"}),` ${e.name}`]}):""]})},e.chainId)}function Lc(e){try{return new Te(e),!0}catch(e){return!1}}function Oc(e){if(e.length<=10)return e;try{return new Te(e),`${e.slice(0,4)}...${e.slice(-4)}`}catch(t){return`${e.slice(0,6)}...${e.slice(-4)}`}}function Wc(e,t,n="address"){return`https://${fr[e]}${t?`/${n}/${t}`:""}`}function Vc(){return zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between"},children:[zt.jsx(V,{variant:"circular",width:32,sx:{mt:8}}),zt.jsxs(x,{sx:{ml:8,flex:"1 0 auto"},children:[zt.jsx(V,{sx:{borderRadius:4},height:24}),zt.jsx(V,{sx:{mt:4,borderRadius:4},height:19,width:137})]})]})}function Fc({chainId:e,value:t,onChange:n,occupiedAddrs:i,occupiedChainId:r,hiddenAddrs:l,showAddrs:a,visible:s,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,sx:m}){const{chainList:f,selectChainId:g,setSelectChainId:y}=function(e){const{chainId:t}=Ar(),n=he(Nl),{crossChain:o,onlyChainId:i}=Vr(),r=K((()=>{const t=new Set;return n.forEach((n=>{n.side&&e&&n.side!==e||t.add(n.chainId)})),t}),[n,e]),l=K((()=>{if(!o||i)return[];const e=new Map;let n;return ks.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]),a=K((()=>!l.length||t&&r.has(t)?t:l[0].chainId),[t,r]),[s,d]=_(a);J((()=>{void 0===s&&d(a)}),[a]);const c=K((()=>null!=s?s:a),[s,a]);return{chainList:l,selectChainId:c,setSelectChainId:d}}(d),{showTokenList:v,filter:b,setFilter:j,onSelectToken:w,popularTokenList:C,tokenInfoMap:k}=pa({value:t,onChange:n,occupiedAddrs:i,occupiedChainId:r,hiddenAddrs:l,showAddrs:a,side:d,chainId:null!=e?e:g,visible:s,defaultLoadBalance:c,multiple:u}),R=te(null),[S,I]=_(0);J((()=>{if(s&&t)if(Array.isArray(t)){const[e]=t;e&&e.chainId!==g&&y(e.chainId)}else y(t.chainId)}),[t,s]),J((()=>{let e;return s&&(e=window.setTimeout((()=>{R.current&&I(R.current.offsetHeight-16)}),300)),()=>clearTimeout(e)}),[R,s,g]);const E=we({queryKey:["token-picker-searchOtherAddress",b],queryFn:()=>h?h(b):null,enabled:Lc(b)&&!!h}),M=Q((({index:e,style:n})=>{var o;const i=v[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),zt.jsx(Mc,{token:i,disabled:r,style:n,onClick:()=>w(i),balance:null===(o=k.get(`${i.chainId}-${i.address}`))||void 0===o?void 0:o.balance},i.address+i.chainId)}),[v,C,t]);return zt.jsxs(x,{sx:Object.assign({display:"flex",flexDirection:"column",px:20,flex:1,overflow:"hidden"},m),children:[zt.jsx(F,{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&&f.length?zt.jsx(x,{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:f.map((e=>zt.jsx(Tc,{chain:e,active:e.chainId===g,onClick:()=>{y(e.chainId)}},e.chainId)))}):"",zt.jsx(x,{sx:{pb:16,flex:1,minHeight:64},ref:R,children:v.length?zt.jsx(ft,{height:S,itemCount:v.length,itemSize:52,width:"100%",className:"token-list",children:M}):zt.jsxs(x,{sx:{height:S,overflowY:"auto"},children:[E.isLoading?zt.jsx(Vc,{}):"",E.data?E.data:""]})})]})}function Ac({open:e,title:t,value:o,onClose:i,occupiedAddrs:r,hiddenAddrs:l,occupiedChainId:a,onTokenChange:s,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,chainId:m,modal:f}){const{height:g}=Vr(),{isMobile:x}=Rc();return zt.jsx(tc,{height:f?"80vh":g,open:e,onClose:i,title:null!=t?t:zt.jsx(n,{id:"T0Y2+3",message:"Select a token"}),id:"select-token",testId:Er,modal:f,children:zt.jsx(Fc,{value:o,visible:e,onChange:s,occupiedAddrs:r,occupiedChainId:a,hiddenAddrs:l,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,chainId:m,sx:f?{width:x?"100%":420,borderRadius:16}:void 0})})}function Zc(){return zt.jsx(x,{sx:{position:"relative",height:4},children:zt.jsx(x,{sx:{width:44,height:44,borderRadius:22,backgroundColor:"background.input",borderWidth:4,borderColor:"background.paper",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%,-50%) rotate(90deg)",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:zt.jsx(x,{component:Wt.Plus})})})}function Pc({sx:e,inputSx:t,amt:o,token:i,readOnly:r,showMaxBtn:l,canClickBalance:a,onMaxClick:s,fiatPriceTxt:d,occupiedAddrs:c,occupiedChainId:u,onInputFocus:p,onTokenClick:h,onInputChange:m,onTokenChange:f,side:g,showChainLogo:v,showChainName:j,defaultLoadBalance:w,overrideBalance:C,overrideBalanceLoading:k,balanceText:R,showPercentage:S,inputReadonlyTooltip:I,inputTypography:E,chainId:M,hideToken:T,checkLogBalance:L,notTokenPickerModal:O}){var W,V;const{account:F}=Ar(),Z=y(),{gotoBuyToken:P}=Vr(),[B,N]=_(!1),{fetchTokenBalance:U}=fl(),H=we({queryKey:["token","balance-allowance",null==i?void 0:i.address],queryFn:()=>Lr(this,void 0,void 0,(function*(){if(!i)return;const e=yield U(i.address);return Object.assign(Object.assign({},i),{balance:e.amount,allowance:qr})})),enabled:!!i}),D=null!==(V=null!=C?C:null===(W=H.data)||void 0===W?void 0:W.balance)&&void 0!==V?V:null,{isTokenLoading:Y}=wc();let z=null!=k?k:H.isLoading;!z&&D&&(L?z=Object.entries(L).some((([e,t])=>Y(e,t))):i&&(z=Y(i.address,D)));const[X,q]=_(0),G=te("");J((()=>{o!==G.current&&q(0)}),[o]);let Q=P&&D&&o&&D.lt(o);const K=!!m||!!I;return zt.jsxs(x,{sx:Object.assign({minHeight:K?133:"auto",padding:Z.spacing(20,20,24),borderRadius:12,overflow:"hidden",display:"flex",flexDirection:"column",justifyContent:"space-between",backgroundColor:Z.palette.background.input},e),children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4},children:[T?zt.jsx(x,{}):zt.jsx(Ec,{token:i,showChainLogo:v,showChainName:j,onClick:()=>N(!0),readonly:!f}),zt.jsx(Cc,{balance:D,balanceText:R,onClick:r||!s&&!m?void 0:e=>{s?s(e):m&&m(e),0!==X&&1!==X&&(q(1),G.current=e)},showMaxBtn:l,canClickBalance:a,address:null==i?void 0:i.address,decimals:null==i?void 0:i.decimals,loading:z})]}),K&&(r&&I?zt.jsx(A,{title:I,arrow:!1,children:zt.jsx(x,{children:zt.jsx(kc,{value:o,readOnly:!0,withClear:!0,sx:Object.assign({mt:12},t)})})}):zt.jsx(kc,{value:o,onFocus:p,onChange:m?e=>{m(e),q(0)}:void 0,readOnly:r,withClear:!0,suffix:Q?zt.jsx(b,{variant:b.Variant.tag,backgroundColor:Z.palette.background.paperDarkContrast,sx:{fontSize:12},onClick:e=>{e.stopPropagation(),null==P||P({token:i,account:F})},children:zt.jsx(n,{id:"qiOIiY",message:"Buy"})}):void 0,typography:E,sx:{mt:12}})),!r&&S?zt.jsx(Ic,{sx:{mt:16},value:X,onChange:D&&void 0!==(null==i?void 0:i.decimals)?e=>{if(D&&(null==i?void 0:i.decimals))if(q(e),1===e){const e=D.toString();s?s(e):m&&m(e),G.current=e}else if(m){const t=D.multipliedBy(e).dp(i.decimals).toString();m(t),G.current=t}}:void 0}):"",void 0!==d?zt.jsx(x,{sx:{mt:S?9:0,typography:"h6",color:Z.palette.text.secondary},children:d}):"",zt.jsx(Ac,{value:i,open:B,side:g,chainId:M,occupiedAddrs:c,occupiedChainId:u,defaultLoadBalance:w,onClose:()=>{N(!1),h&&h()},onTokenChange:(e,t)=>{N(!1),setTimeout((()=>{!Array.isArray(e)&&f&&f(e,t)}),Kd)},modal:!O})]})}function Bc({toToken:e,fromToken:t,priceStatus:o,pricePerToToken:i,pricePerFromToken:r}){const[l,a]=_("-"),[s,d]=_(null),[c,u]=_("-"),[p,h]=_(null);J((()=>{a(null==t?void 0:t.symbol),u(null==e?void 0:e.symbol),d(i),h(r)}),[t,e,i,r]);const m=Q((()=>{a(c),u(l),d(p),h(s)}),[l,s,c,p]);return zt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:{[Ml.Initial]:"-",[Ml.Loading]:zt.jsxs(zt.Fragment,{children:[zt.jsx(O,{sx:{mr:5}}),zt.jsx(n,{id:"JdNn1Y",message:"Fetching best price..."})]}),[Ml.Failed]:zt.jsxs(zt.Fragment,{children:[zt.jsx(x,{component:Wt.Warn,sx:{width:15,mr:5,color:"warning.main"}}),zt.jsx(n,{id:"NVAuTg",message:"Quote not available"})]}),[Ml.Success]:zt.jsxs(zt.Fragment,{children:[zt.jsx(x,{sx:{typography:"body2"},children:`1 ${l} = ${Gr({input:p,showDecimals:4})} ${c}`}),zt.jsx(x,{component:M,sx:{width:18,height:18,ml:6,borderRadius:"50%",backgroundColor:"border.main",display:"flex",justifyContent:"center",alignItems:"center"},children:zt.jsx(x,{sx:{width:16,color:"text.secondary"},onClick:m,component:Wt.Switch})})]})}[o]})}function Nc({getAutoSlippage:e,onPayTokenChange:t,onReceiveTokenChange:l}={}){var a,s;const d=y(),{isInflight:c}=kl(),{chainId:u,account:p}=Ar(),h=pe(),{defaultChainId:m,noPowerBy:f,onlyChainId:g,onlySolana:v}=Vr(),[j,w]=_(!1);K((()=>{var e;return null===(e=r[null!=u?u:m])||void 0===e?void 0:e.address}),[u,m]);const[C,k]=_(""),[R,S]=_(""),[I,E]=_(""),[T,L]=_(""),V=K((()=>ce((e=>E(e)),1e3)),[]),F=K((()=>ce((e=>L(e)),1e3)),[]),[A,Z]=_(null),[P,B]=_(null),[N,U]=_(!1),[H,D]=_(!1),{toFiatPrice:Y,fromFiatPrice:z}=El({toToken:P,fromToken:A});!function({token:e,fiatPrice:t}){K((()=>{var n;const o=null!==(n=null==e?void 0:e.decimals)&&void 0!==n?n:6,i=null!=t?new ie(500).div(t):new ie(0),r=$r(i,o);return(r.lt(new ie(1).times(new ie(10).pow(o-3)))?new ie(0):r).toString(10)}),[null==e?void 0:e.decimals,t])}({token:j?P:A,fiatPrice:j?Y:z}),function({fromToken:e,toToken:t,getAutoSlippage:n}){const o=pe();J((()=>{(()=>{Lr(this,void 0,void 0,(function*(){if(!n)return;const i=n({fromToken:e,toToken:t});if(void 0!==i&&"number"!=typeof i){o(Dr(!0));try{const e=yield i;o(Hr({loading:!1,value:null!=e?e:null}))}catch(e){console.error(e),o(Hr({loading:!1,value:null}))}}else o(Hr({loading:!1,value:null}))}))})()}),[e,t])}({fromToken:A,toToken:P,getAutoSlippage:e});const{slippage:X,slippageLoading:q}=Kl({fromToken:A,toToken:P}),{isApproving:G,isGetApproveLoading:$,needApprove:ee,insufficientBalance:te,submitApprove:ne,getMaxBalance:oe}=oa(A,{amount:I}),re=Q((()=>{ye(oe())}),[oe]);K((()=>!(!p||te||G||$||ee)),[p,te,G,$,ee]);const{status:le,rawBrief:ae,executeSwap:se}=Tl({toToken:P,fromToken:A,fromAmount:I,slippage:X}),{resAmount:de,priceImpact:ue,baseFeeAmount:me,additionalFeeAmount:fe,resPricePerToToken:ge,resPricePerFromToken:xe}=K((()=>{if(!ae)return{resAmount:null,priceImpact:null,baseFeeAmount:null,additionalFeeAmount:null,resPricePerToToken:null,resPricePerFromToken:null};const e=new ie(ae.inAmount).dividedBy(ae.outAmount).toNumber(),t=new ie(ae.outAmount).dividedBy(ae.inAmount).toNumber();return{resAmount:ae.resAmount,priceImpact:ae.priceImpact,baseFeeAmount:0,additionalFeeAmount:0,resPricePerToToken:e,resPricePerFromToken:t}}),[ae]),ye=Q((e=>{const t=e.toString();k(t),V(t)}),[k,V]),ve=Q((e=>{const t=e.toString();S(t),F(t)}),[S,F]),be=Q((e=>Z((n=>{var o;const i="function"==typeof e?e(n):e;return u||h(gl(null!==(o=null==i?void 0:i.chainId)&&void 0!==o?o:void 0)),t&&i&&i!==n&&t(i),i}))),[h,gl,t,u]),je=Q((e=>B((t=>{const n="function"==typeof e?e(t):e;return l&&n&&n!==t&&l(n),n}))),[l]);Dl({fromToken:A,toToken:P,setFromToken:be,setToToken:je,updateFromAmt:ye,updateToAmt:ve,setIsReverseRouting:w});const we=Q((()=>{ye(""),ve(""),be(P),je(A),yr("from",P),yr("to",A)}),[be,P,je,A,ye,ve]),Ce=Q(((e,t)=>{if(t)return we();ye(""),ve(""),be(e),yr("from",e)}),[we,ye,ve,be,yr]),ke=Q(((e,t)=>{if(t)return we();ye(""),ve(""),je(e),yr("to",e)}),[we,ye,ve,be,yr]),Re=Q((()=>{j&&ye(""),w(!1)}),[j,ye,h]);Q((()=>{j||ve(""),w(!0)}),[j,ve,h]);const Se=(e=>{const{defaultSlippage:t}=zl(void 0===e),n=he(Yl)||t;return K((()=>(void 0===e?Number(n):e)>5),[n,e])})(X),Ie=K((()=>ue?new ie(ue).multipliedBy(100).dp(4,ie.ROUND_DOWN).toString():null),[ue]),Ee=K((()=>{const e=j?de:I;return e&&z?new ie(z).multipliedBy(e):null}),[z,I,j,de]),Me=K((()=>{if(!Y)return null;const e=j?T:de;return e?new ie(Y).multipliedBy(e):null}),[Y,T,j,de]),Te=K((()=>zt.jsxs(x,{sx:{display:"flex",fontWeight:600,typography:"body2",alignItems:"center",justifyContent:"center"},children:[zt.jsx(pc,{title:zt.jsx(n,{id:"4kY4C4",message:"Due to the market condition, market price and estimated price may have a slight difference"}),mr:8}),zt.jsxs(x,{sx:{display:"flex"},children:[zt.jsx(n,{id:"6+mYrD",message:"Current price impact"}),zt.jsxs(x,{sx:{color:d.palette.error.main,ml:4},children:[Ie,"%"]})]})]})),[Ie,d.palette.error.main]),Le=K((()=>zt.jsx(Bc,{toToken:P,fromToken:A,priceStatus:le,pricePerToToken:ge,pricePerFromToken:xe})),[P,A,le,ge,xe]),Oe=K((()=>!(i[u||1]||g&&g===u)),[u]),We=K((()=>!v&&!!u&&!!(null==A?void 0:A.chainId)&&(null==A?void 0:A.chainId)!==u),[u,null==A?void 0:A.chainId,v]),Ve=function({fromToken:e,toToken:t}){const n=he(Nl);return K((()=>!(!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:A,toToken:P}),Fe=K((()=>Se&&new ie(j?T:I).gt(0)&&!te&&le===Ml.Success?zt.jsxs(x,{sx:{textAlign:"center",mb:8},children:[zt.jsx(x,{component:Wt.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:5}})]}):null),[Se,j,I,T,le]),Ae=K((()=>We?zt.jsxs(x,{sx:{textAlign:"center"},children:[zt.jsx(x,{component:Wt.Warn,sx:{position:"relative",top:2,mr:6,width:16,height:16,color:"warning.main"}}),zt.jsx(n,{id:"54ffaC",message:"The current network is inconsistent with the wallet - please switch in wallet"})]}):le===Ml.Loading?zt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:zt.jsxs(zt.Fragment,{children:[zt.jsx(O,{sx:{mr:5}}),zt.jsx(n,{id:"JdNn1Y",message:"Fetching best price..."})]})}):Oe?zt.jsxs(zt.Fragment,{children:[zt.jsx(x,{component:Wt.Warn,sx:{mr:6,width:16,color:"warning.main"}}),zt.jsx(n,{id:"udsWDJ",message:"Unsupported network - switch to trade"})]}):C&&Ie&&new ie(Ie).gt(br)?Te:zt.jsxs(zt.Fragment,{children:[Fe,Le]})),[le,Le,C,Te,Ie,Oe,We,Fe]),Ze=K((()=>j?new ie(R).gt(0)?_r({input:de,decimals:null==A?void 0:A.decimals}):"-":C),[C,R,de,A,j]),Pe=K((()=>j?R:new ie(C).gt(0)?_r({input:de,decimals:null==P?void 0:P.decimals}):"-"),[C,R,de,P,j]),Be=K((()=>{if(!p||(null==A?void 0:A.chainId)&&u!==A.chainId)return zt.jsx(mc,{needSwitchChain:null==A?void 0:A.chainId});if(c)return zt.jsx(b,{fullWidth:!0,isLoading:!0,disabled:!0,children:zt.jsx(n,{id:"FRBvjQ",message:"Transaction Pending"})});if(!A||!P)return zt.jsx(b,{fullWidth:!0,disabled:!0,"data-testid":"swap-alert-select-token-btn",children:zt.jsx(n,{id:"KlvBGJ",message:"Select Tokens"})});if(ee)return zt.jsx(b,{fullWidth:!0,disabled:G,onClick:()=>ne(),children:G?zt.jsx(n,{id:"j2Uisd",message:"Approving"}):zt.jsx(n,{id:"Z7ZXbT",message:"Approve"})});if(!new ie(j?T:I).gt(0))return zt.jsx(b,{fullWidth:!0,disabled:!0,"data-testid":"swap-alert-enter-amount-btn",children:zt.jsx(n,{id:"iPMIoT",message:"Enter an amount"})});if(le===Ml.Loading)return zt.jsx(b,{fullWidth:!0,disabled:!0,"data-testid":"swap-alert-fetch-price-btn",children:zt.jsx(n,{id:"OauUE6",message:"Fetching Price..."})});return!de||le===Ml.Failed?zt.jsx(b,{fullWidth:!0,disabled:!0,children:zt.jsx(n,{id:"NVAuTg",message:"Quote not available"})}):te?zt.jsx(b,{fullWidth:!0,disabled:!0,"data-testid":"swap-alert-insufficient-balance-btn",children:zt.jsx(n,{id:"znqB4T",message:"Insufficient balance"})}):zt.jsx(b,{fullWidth:!0,onClick:()=>U(!0),"data-testid":"swap-review-btn",children:zt.jsx(n,{id:"K/Ay/d",message:"Review Swap"})})}),[p,A,u,c,P,ee,G,j,T,I,le,de,te,ne]),Ne=K((()=>A&&P?zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(Ss,{token:A,width:16,height:16,marginRight:6,chainId:A.chainId,noShowChain:!!g}),`${_r({input:j?de:I,decimals:null==A?void 0:A.decimals})} ${null==A?void 0:A.symbol}`,zt.jsx(x,{component:Wt.DoubleRight,sx:{width:12,height:12,mx:16}}),zt.jsx(Ss,{token:P,width:16,height:16,marginRight:6,chainId:P.chainId,noShowChain:!!g}),`${_r({input:j?T:de,decimals:null==P?void 0:P.decimals})} ${null==P?void 0:P.symbol}`]}):zt.jsx(x,{})),[A,P,I,T,de,j,g]);return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",typography:"caption",margin:20},children:[zt.jsx(n,{id:"vH2C/2",message:"Swap"}),zt.jsx(W,{open:void 0,title:zt.jsx(n,{id:"NSCBTb",message:"The setting has been switched to swap mode"}),placement:"bottom-end",children:zt.jsx(x,{component:M,children:zt.jsx(x,{component:Wt.Setting,onClick:()=>D(!0),sx:{width:19,height:19,color:"text.primary",cursor:"pointer"}})})})]}),zt.jsxs(x,{sx:{flex:1,padding:"0 16px 12px",overflowY:"auto"},children:[zt.jsxs(x,{children:[zt.jsx(Pc,{sx:{mb:4},token:A,side:"from",amt:Ze,defaultLoadBalance:!0,onMaxClick:re,onInputChange:ye,onInputFocus:Re,showMaxBtn:!j&&!C,occupiedAddrs:[null!==(a=null==P?void 0:P.address)&&void 0!==a?a:""],occupiedChainId:null==P?void 0:P.chainId,fiatPriceTxt:Ee?`$${Gr({input:Ee,showDecimals:1})}`:"-",onTokenChange:Ce,readOnly:j,showChainLogo:!g,showChainName:!g,notTokenPickerModal:!0}),zt.jsx(jc,{onClick:we,disabled:Ve}),zt.jsx(Pc,{token:P,side:"to",amt:Pe,onInputChange:ve,occupiedAddrs:[null!==(s=null==A?void 0:A.address)&&void 0!==s?s:""],occupiedChainId:null==A?void 0:A.chainId,fiatPriceTxt:Me?`$${Gr({input:Me,showDecimals:1})}(${Ie}%)`:"-",onTokenChange:ke,readOnly:!0,showChainLogo:!g,showChainName:!g,notTokenPickerModal:!0}),zt.jsx(x,{sx:{py:12,display:"flex",typography:"body2",alignItems:"center",justifyContent:"center",flexWrap:"wrap"},children:Ae})]}),Be,f?"":zt.jsxs(x,{sx:{mt:13,display:"flex",typography:"h6",cursor:"pointer",justifyContent:"center",alignItems:"center",color:d.palette.text.disabled},onClick:()=>window.open("https://app.dodoex.io"),children:[zt.jsx(x,{sx:{width:18,height:18,transform:"translate(1px, 2px)","& path":{fill:d.palette.text.disabled}},component:Wt.Dodo}),zt.jsx(n,{id:"7X+IbB",message:"Powered by DODO protocol"})]})]}),zt.jsx(fc,{toToken:P,fromToken:A,fromAmount:j?de:I,toAmount:j?T:de,open:N,baseFeeAmount:me,priceImpact:Ie,additionalFeeAmount:fe,curToFiatPrice:Me,execute:()=>se(Ne),clearFromAmt:()=>ye(""),clearToAmt:()=>ve(""),curFromFiatPrice:Ee,onClose:()=>U(!1),loading:le===Ml.Loading,slippage:X}),zt.jsx(bc,{open:H,onClose:()=>D(!1),fromToken:A,toToken:P})]})}var Uc;!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"}(Uc||(Uc={}));const Hc=Pe(((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:Uc.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 Dc({sx:e,onClick:t}){const o=y();return zt.jsxs(j,{onClick:()=>{t?t():Hc.getState().back()},sx:ue({display:"inline-flex",alignItems:"center",cursor:"pointer","& > svg":{mr:10}},e),children:[zt.jsx(x,{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:zt.jsx(Wt.ArrowBack,{})}),zt.jsx(n,{id:"CKyk7Q",message:"Go back"})]})}function Yc({statuses:e,children:t,buttonProps:o}){var i;if(!e.find((e=>e.needShowTokenStatusButton))&&t)return zt.jsx(zt.Fragment,{children:t});const r=e.find((e=>e.insufficientBalance));if(r)return zt.jsx(b,{fullWidth:!0,disabled:!0,...o,children:zt.jsx(n,{id:"m6RmA/",message:"Insufficient {0} balance",values:{0:null===(i=r.token)||void 0===i?void 0:i.symbol}})});const l=e.some((e=>e.isApproving));return zt.jsx(x,{sx:{display:"flex",alignItems:"center",gap:4},children:e.map(((e,t)=>{var i,r;let a="";return e.isApproving?a=zt.jsx(n,{id:"j2Uisd",message:"Approving"}):(e.needReset||e.needApprove)&&(a=e.approveTitle),a?zt.jsx(b,{fullWidth:!0,isLoading:e.isApproving,onClick:e.submitApprove,disabled:e.insufficientBalance||l,...o,children:a},null!==(r=null===(i=e.token)||void 0===i?void 0:i.symbol)&&void 0!==r?r:t):null}))})}function zc({token:e,chainId:t,showChainLogo:o,readonly:i,showChainName:r,logoSize:l=24,chainLogoSize:a=12,side:s,occupiedToken:d,defaultLoadBalance:c,notTokenPickerModal:u,border:p,px:h=20,py:m=8,highlightDefault:f,onTokenClick:g,onTokenChange:v}){var b,j;const{onlyChainId:w}=Vr(),C=t||w,k=y(),[R,S]=G.useState(!1),I=(null==e?void 0:e.chainId)?ks.get(e.chainId):null,E=r&&!!I;return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{component:M,sx:Object.assign(Object.assign({display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,color:k.palette.text.primary,typography:E?"body2":"body1",fontWeight:600,px:h,py:m,"&:focus-visible":{opacity:.5}},!!p&&{border:`solid 1px ${k.palette.border.main}`,borderRadius:8,"&:hover":{backgroundColor:k.palette.hover.default}}),!(!f||e)&&{backgroundColor:k.palette.primary.main,color:k.palette.primary.contrastText,"&:hover":{opacity:.8}}),onClick:()=>{i||S(!0)},"data-testid":Ir,children:[!!(null==e?void 0:e.address)&&zt.jsx(Ss,{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:l,height:l,chainSize:a,logoOffset:10,marginRight:0}),zt.jsxs(x,{sx:{flex:1},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(null==e?void 0:e.address)?zt.jsx(zt.Fragment,{children:zt.jsx(x,{children:null!==(j=null==e?void 0:e.symbol)&&void 0!==j?j:"-"})}):zt.jsx(n,{id:"sIPJGT",message:"SELECT TOKEN"}),!i&&zt.jsx(x,{component:"svg",width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{flexShrink:0},children:zt.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"})})]}),!!E&&zt.jsxs(x,{sx:{display:"flex",alignItems:"center",typography:"h6",color:"text.secondary"},children:[I.name,zt.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zt.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"})})]})]})]}),zt.jsx(Ac,{value:e,open:R,side:s,chainId:C,occupiedAddrs:d?[d.address]:void 0,occupiedChainId:null==d?void 0:d.chainId,defaultLoadBalance:c,onClose:()=>{S(!1),g&&g()},onTokenChange:(e,t)=>{S(!1),setTimeout((()=>{!Array.isArray(e)&&v&&v(e,t)}),Kd)},modal:!u})]})}const Xc=G.forwardRef((function(e,t){var{sx:n}=e,o=Tr(e,["sx"]);const{isMobile:i}=Rc(),r=y();return zt.jsx(x,{className:"widget-module-container",ref:t,sx:Object.assign(Object.assign({flex:1,overflowY:"auto"},i?{padding:0,height:"100%",width:"100%",overflowX:"hidden"}:{padding:r.spacing(28,20,40,40),height:"auto"}),n),...o})})),qc="auto",Gc="0.1",_c="0.5",Jc="0.5";function Qc(e){const t=te();return J((()=>{t.current=e})),t.current}function Kc({baseToken:t,quoteToken:n,pairMintAAmount:i,pairMintBAmount:r,slippage:l,isExists:a,poolInfo:s,poolKeys:d,successBack:c,submittedBack:u}){const p=Cl(),{account:h}=Ar(),m=Ws();return e(),Ce({mutationFn:()=>Lr(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(!m)throw new Error("raydium is undefined");const e=new gt(new xt(i).mul(10**s.mintA.decimals).toFixed(0,xt.ROUND_DOWN)),f=new De(100*l*100,1e4),{execute:g}=a?yield m.cpmm.addLiquidity({poolInfo:s,poolKeys:d,inputAmount:e,slippage:f,baseIn:!0,txVersion:Ue.LEGACY}):yield m.cpmm.createPool({programId:sl,poolFeeAccount:dl,mintA:s.mintA,mintB:s.mintB,mintAAmount:e,mintBAmount:new gt(new xt(r).mul(10**s.mintB.decimals).toFixed(0,xt.ROUND_DOWN)),startTime:new gt(0),feeConfig:cl[0],associatedOnly:!1,ownerInfo:{useSOLBalance:!0},txVersion:Es});return yield p.executeCustom({brief:a?o._({id:"E6MqGy",message:"Add liquidity"}):o._({id:"L37FfW",message:"Create AMM V2 Position"}),metadata:{[a?Pr.addLiquidityAMMV2Position:Pr.createAMMV2Position]:!0},handler:e=>Lr(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 $c({pool:e,baseAmount:t,quoteAmount:n,slippage:o}){var i,r,l,a,s,d,c,u,p,h,m,f,g,x;const{account:y}=Ar(),v=Ws(),[b,j,w,C,k]=K((()=>{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 gt(new Te(o.address).toBuffer()).lte(new gt(new Te(i.address).toBuffer())),[l,a]=r?[o,i]:[i,o],[s,d]=r?[t,n]:[n,t];return[l,a,s,d,r]}),[t,e,n]),R=we({queryKey:["cpmm","poolInfo",null==e?void 0:e.address],enabled:null!=(null==e?void 0:e.address),queryFn:()=>Lr(this,void 0,void 0,(function*(){if(!(null==e?void 0:e.address)||!v)return null;const{poolInfo:t,poolKeys:n,rpcData:o}=yield v.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],l=el(t.lpAmount,t.lpMint.decimals);return{baseReserve:el(o.baseReserve.toNumber(),n.mintA.decimals),quoteReserve:el(o.quoteReserve.toNumber(),n.mintB.decimals),lpAmount:l,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:l.toNumber(),mintA:Object.assign(Object.assign({},t.mintA),{symbol:i}),mintB:Object.assign(Object.assign({},t.mintB),{symbol:r})}),rpcData:o}}))}),S=we({queryKey:["cpmm","lpBalance",null===(r=null===(i=R.data)||void 0===i?void 0:i.lpMint)||void 0===r?void 0:r.address],enabled:!!(y&&R.data&&(null===(l=R.data)||void 0===l?void 0:l.lpMint)&&(null===(s=null===(a=R.data)||void 0===a?void 0:a.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:()=>Lr(this,void 0,void 0,(function*(){var e,t,n,o,i;if(!(y&&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)&&v))return null;yield v.account.fetchWalletTokenAccounts();const r=R.data.lpMint.address,l=v.account.tokenAccounts.find((e=>e.mint.toBase58()===r));if(!l)throw new Error(`you do not have balance in pool: ${r}`);return el(l.amount.toNumber(),R.data.lpMint.decimals)}))}),I=we({queryKey:["cpmm","pairAmount",w,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)||!w),queryFn:()=>Lr(this,void 0,void 0,(function*(){var e;if(!(R.data&&(null===(e=R.data)||void 0===e?void 0:e.poolInfo)&&w&&v))return null;const t=R.data.poolInfo,n=yield v.cpmm.computePairAmount({baseReserve:R.data.rpcData.baseReserve,quoteReserve:R.data.rpcData.quoteReserve,poolInfo:t,amount:w,slippage:new De(100*o*100,1e4),baseIn:!0,epochInfo:yield v.fetchEpochInfo()});return{pairMintAAmount:w,pairMintBAmount:el(n.anotherAmount.amount.toString(),t.mintB.decimals).toString(),liquidityMinted:el(n.liquidity.toString(),t.lpMint.decimals)}}))}),[E,M,T,L]=K((()=>{if(!R.data||!S.data)return[void 0,void 0,void 0,void 0];const{baseReserve:e,quoteReserve:t,lpAmount:n}=R.data,o=S.data,i=o.div(n),r=o.multipliedBy(e).div(n),l=o.multipliedBy(t).div(n);return[o,i,r,l]}),[R.data,S.data]),O=G.useMemo((()=>R.isFetched&&null!=R.data),[R.isFetched,R.data]),[W,V]=G.useMemo((()=>{var e,o;if(O){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 ie(R.data.poolInfo.price);return[e,new ie(1).div(e)]}return[void 0,void 0]}return t&&n?[new ie(n).div(t),new ie(t).div(n)]:[void 0,void 0]}),[t,O,null===(m=null===(h=R.data)||void 0===h?void 0:h.poolInfo)||void 0===m?void 0:m.price,n]);return{isFront:k,poolInfoQuery:R,lpBalanceQuery:S,lpBalance:E,lpBalancePercentage:M,lpToAmountA:T,lpToAmountB:L,price:W,invertedPrice:V,liquidityMinted:null===(f=I.data)||void 0===f?void 0:f.liquidityMinted,pairMintAAmount:null===(g=I.data)||void 0===g?void 0:g.pairMintAAmount,pairMintBAmount:null===(x=I.data)||void 0===x?void 0:x.pairMintBAmount,isExists:O}}const eu="DODO_WIDGET_POOL_LIST_TAB",tu="DODO_WIDGET_POOLS_LIST_FILTER_CHAIN";var nu;!function(e){e.addLiquidity="add-liquidity",e.myLiquidity="my-liquidity",e.myCreated="my-created"}(nu||(nu={}));var ou=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()}},iu={"text/plain":"Text","text/html":"Url",default:"Text"};var ru=function(e,t){var n,o,i,r,l,a,s=!1;t||(t={}),n=t.debug||!1;try{if(i=ou(),r=document.createRange(),l=document.getSelection(),(a=document.createElement("span")).textContent=e,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.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=iu[t.format]||iu.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(a),r.selectNodeContents(a),l.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{l&&("function"==typeof l.removeRange?l.removeRange(r):l.removeAllRanges()),a&&document.body.removeChild(a),i()}return s},lu=Lt(ru);function au({copyText:e,size:t,sx:n,componentProps:i,onClick:r,children:l}){var a;const[s,d]=G.useState(!1);return zt.jsx(A,{title:o._({id:"6V3Ea3",message:"Copied"}),open:s,onClose:()=>d(!1),arrow:!1,children:zt.jsxs(x,{...i,component:null!==(a=null==i?void 0:i.component)&&void 0!==a?a:M,onClick:t=>{if(null==i?void 0:i.onClick)return i.onClick(t);t.stopPropagation(),e&&(lu(e),d(!0)),r&&r()},sx:Object.assign({cursor:"pointer"},null==i?void 0:i.sx),children:[zt.jsx(x,{component:Wt.Copy,sx:Object.assign({width:t||"auto",height:t||"auto"},n)}),l]})})}function su({truncate:e,address:t,disabledAddress:n,sx:o,handleOpen:i,addressHoverColor:r,addressHoverShowIcon:l}){return n?zt.jsx(x,{children:e?Oc(t):t}):zt.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:zt.jsxs(x,{onClick:e=>{null==i||i(e,"address")},sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[e?Oc(t):t,l?zt.jsx(x,{component:Wt.ArrowRight,sx:{display:"none",width:14,height:14}}):""]})})}function du({address:e,truncate:t,showCopy:n,size:o="medium",iconSize:i,iconSpace:r,sx:l,iconDarkHover:a,disabledAddress:s,addressHoverColor:d,addressHoverShowIcon:c,customChainId:u,handleOpen:p,onAddressClick:h}){const m=y(),f="medium"===o,g=a?P:j,v=e=>{let t=e?12:8;return r&&(t=r),a&&(t-=3),t},b="big"===o?"h5":f?"body1":"body2",{chainId:w}=Ar(),C=null!=u?u:w,k=(t,n)=>{p?p(t,n):C&&(t.stopPropagation(),window.open(Wc(C,e,"address")))};return zt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",typography:b,color:m.palette.text.primary,lineHeight:"normal"},l||{}),children:[zt.jsx(su,{truncate:t,address:e,disabledAddress:s,sx:l,typography:b,handleOpen:null!=h?h:k,addressHoverColor:d,addressHoverShowIcon:c}),zt.jsx(g,{sx:{display:"inline-flex",ml:v(f),cursor:"pointer"},onClick:e=>{k(e,"icon")},children:zt.jsx(x,{component:Wt.ArrowTopRightBorder,sx:{width:i||(f?16:14),height:i||(f?16:14)}})}),n?zt.jsx(au,{size:i||(f?16:14),copyText:e,componentProps:{component:g,sx:{ml:v(f)}}}):null]})}function cu(e){var{sx:t,label:n,children:o}=e,i=Tr(e,["sx","label","children"]);return zt.jsxs(x,{sx:Object.assign({display:"flex",justifyContent:"space-between"},t),...i,children:[zt.jsx(x,{children:n}),zt.jsx(x,{sx:{textAlign:"right",fontWeight:600},children:o})]})}function uu({tokens:e,width:t=24,height:n=24,gap:o=-4,cross:i,mr:r,chainId:l,showChainLogo:a,sx:s}){var d;const c=y(),{onlyChainId:u}=Vr(),p=a&&!u;if(!e||e.length<=0)return null;const h=t/2;return zt.jsxs(x,{sx:Object.assign({display:"inline-flex",alignItems:"center",mr:r,position:"relative",zIndex:0},s),children:[e.map(((e,n)=>zt.jsx(x,{sx:{display:"inline-flex",width:t,height:t,ml:n>0?o:0,borderRadius:"50%",backgroundColor:c.palette.background.default},children:"object"==typeof e?zt.jsx(Ss,{address:e.address,width:t,height:t,chainId:l,url:e.logoURI,cross:i,noShowChain:!0,noBorder:!0,marginRight:0}):zt.jsx(x,{component:"img",height:t,src:e})},n))),p&&ks.has(l)?zt.jsx(x,{component:null===(d=ks.get(l))||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 pu({baseToken:e,quoteToken:t,midPrice:n,loading:o,disabled:i}){const r=y(),[l,a]=_(!1),s=l?null==t?void 0:t.symbol:null==e?void 0:e.symbol,d=l&&n?new ie(1).div(n):n,c=l?null==e?void 0:e.symbol:null==t?void 0:t.symbol;return zt.jsxs(E,{sx:{display:"flex",alignItems:"center",fontWeight:600,overflow:"hidden"},loading:o,loadingProps:{width:50},children:[e&&t?zt.jsx(W,{title:`1 ${s} = ${d?Gr({input:d}):""} ${c}`,children:n?zt.jsx(x,{sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:`1 ${s} = ${d?Gr({input:d}):""} ${c}`}):zt.jsxs(x,{children:[`1 ${s} = `,zt.jsx(E,{loading:o,loadingProps:{width:30},component:"span",sx:{display:"inline-block"},children:"-"}),` ${c}`]})}):"-",zt.jsx(x,{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:L(r.palette.text.primary,.04)}}),onClick:()=>{i||a((e=>!e))},children:zt.jsx(x,{component:Wt.Switch,sx:{width:18,height:18}})})]})}function hu({baseToken:e,quoteToken:t,loading:o,midPrice:i,lpBalancePercentage:r,sx:l}){const a=y(),s=!e||!t;return zt.jsxs(x,{sx:Object.assign({mt:20,border:"solid 1px",borderColor:"border.main",borderRadius:8},l),children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:12,py:4,height:36,typography:"body2"},children:[zt.jsx(x,{sx:{color:"text.secondary",whiteSpace:"nowrap"},children:zt.jsx(n,{id:"kNeEXg",message:"Current Price"})}),zt.jsx(pu,{baseToken:e,quoteToken:t,loading:o,disabled:s,midPrice:i})]}),zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:12,py:4,minHeight:36,typography:"body2",borderStyle:"solid",borderWidth:a.spacing(1,0,0),borderColor:"border.main"},children:[zt.jsx(x,{sx:{display:"flex",alignItems:"center",color:"text.secondary",whiteSpace:"nowrap"},children:zt.jsx(n,{id:"SbBMxj",message:"Share of pool"})}),zt.jsx(x,{sx:{display:"flex",alignItems:"center",fontWeight:600,textAlign:"right",ml:8,overflow:"hidden"},children:zt.jsx(E,{sx:{display:"flex",alignItems:"center",fontWeight:600,overflow:"hidden"},loading:o,loadingProps:{width:50},children:r?`${ll({input:r,roundingMode:ie.ROUND_DOWN})}`:"-%"})})]})]})}function mu({open:e,onClose:t,slippage:o,baseToken:i,quoteToken:r,pairMintAAmount:l,pairMintBAmount:a,lpAmount:s,feeRate:d,price:c,lpBalancePercentage:u,pairAddress:p,createMutation:h}){const m=y(),{isMobile:f}=Rc();return zt.jsx(tc,{modal:!0,open:e,onClose:t,title:s?zt.jsx(n,{id:"AeZIvT",message:"You will receive"}):zt.jsx(n,{id:"aM1tos",message:"You are creating a pool"}),children:zt.jsxs(x,{sx:{px:20,py:24,borderTopWidth:1,width:f?"100%":420},children:[zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,typography:"h3"},children:[zt.jsx(uu,{width:24,height:24,tokens:i&&r?[i,r]:[]}),s?_r({input:s,decimals:null==i?void 0:i.decimals}):""]}),zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,fontWeight:600},children:[zt.jsx(n,{id:"syToc5",message:"{0}/{1} Pool Tokens",values:{0:null==i?void 0:i.symbol,1:null==r?void 0:r.symbol}}),zt.jsx(x,{sx:{px:4,py:2,fontSize:10,lineHeight:1,backgroundColor:L(m.palette.purple.main,.1),color:m.palette.purple.main,borderRadius:4},children:zt.jsx(n,{id:"rbsyJM",message:"AMM V2"})})]})]}),zt.jsx(x,{sx:{mt:16,typography:"h6",color:"text.secondary",textAlign:"center"},children:zt.jsx(n,{id:"rQ9c+8",message:"Output is estimated. If the price changes by more than {0} your transaction will revert.",values:{0:ll({input:o})}})}),zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:12,mt:20,p:20,typography:"body2",borderRadius:12,backgroundColor:m.palette.background.paperContrast},children:[zt.jsx(cu,{label:zt.jsx(n,{id:"YG004A",message:"{0} deposited",values:{0:null==i?void 0:i.symbol}}),children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[zt.jsx(Ss,{width:18,height:18,marginRight:4,token:i}),_r({input:l,decimals:null==i?void 0:i.decimals})]})}),zt.jsx(cu,{label:zt.jsx(n,{id:"YG004A",message:"{0} deposited",values:{0:null==r?void 0:r.symbol}}),children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(Ss,{width:18,height:18,marginRight:4,token:r}),_r({input:a,decimals:null==r?void 0:r.decimals})]})}),zt.jsx(cu,{label:zt.jsx(n,{id:"EU3wU4",message:"Fee tier"}),children:null!=d?Number(d)/1e4+"%":"-"}),zt.jsx(cu,{label:zt.jsx(n,{id:"fqDzSu",message:"Rate"}),children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(Ss,{width:18,height:18,marginRight:4,token:i}),zt.jsx(pu,{baseToken:i,quoteToken:r,midPrice:c})]})}),zt.jsx(cu,{label:zt.jsx(n,{id:"SbBMxj",message:"Share of pool"}),children:u?`${ll({input:u})}`:"-%"}),zt.jsx(cu,{label:zt.jsx(n,{id:"ESQO1L",message:"Pool address"}),children:zt.jsx(du,{showCopy:!1,address:null!=p?p:"",customChainId:null==i?void 0:i.chainId,truncate:!0,iconSpace:4,sx:{typography:"body2"}})})]}),zt.jsx(b,{fullWidth:!0,size:b.Size.big,sx:{mt:20},isLoading:h.isPending,onClick:()=>{h.mutate()},children:h.isPending?zt.jsx(n,{id:"pwUZo2",message:"Confirming..."}):zt.jsx(n,{id:"7VpPHA",message:"Confirm"})})]})})}function fu({title:e,disabled:t,children:n}){return zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:12,opacity:t?.3:void 0},children:[zt.jsx(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",fontWeight:600},children:e}),n]})}function gu({disabled:e,feeIndex:t,onChange:o,feeList:i}){const r=y(),[l,a]=G.useState(!1),{isMobile:s}=Rc(),d=e,c=i[t];return zt.jsxs(x,{sx:{opacity:e?.3:void 0,fontWeight:600},children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:20,py:12,borderWidth:1,borderRadius:12},children:[zt.jsx(n,{id:"tMMG40",message:"{0}% fee tier",values:{0:c?new ie(c.tradeFeeRate).div(1e4).toString():"-"}}),zt.jsx(M,{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||a((e=>!e))},children:l?zt.jsx(n,{id:"vLyv1R",message:"Hide"}):zt.jsx(n,{id:"ePK91l",message:"Edit"})})]}),l&&zt.jsx(zt.Fragment,{children:zt.jsx(x,{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 zt.jsxs(x,{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,"%",zt.jsx(B,{size:18,checked:i,onChange:(e,t)=>{t&&o(n)}})]},e.id)}))})})]})}function xu({chainId:e,address:t,showName:n,size:o,offset:i,rightContent:r}){const l=zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:i},children:[zt.jsx(Ss,{chainId:e,address:t,width:o,height:o,noShowChain:!0,marginRight:0}),n]});return r?zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[l,r]}):l}function yu({isExists:e,poolInfo:t,poolInfoLoading:o,lpBalanceLoading:r,lpBalance:l,lpBalancePercentage:a,lpToAmountA:s,lpToAmountB:d,sx:c}){var u,p;const h=a?`${ll({input:a,roundingMode:ie.ROUND_DOWN})}`:void 0;return e&&t?zt.jsxs(x,{sx:Object.assign({px:20,py:12,borderWidth:1,borderRadius:8},c),children:[zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"YHc3B+",message:"My Liquidity"})}),zt.jsxs(x,{sx:{mt:12,display:"flex",alignItems:"center",flexWrap:"wrap"},children:[zt.jsx(uu,{width:18,height:18,tokens:[t.mintA,t.mintB],mr:4}),zt.jsx(E,{loading:r,loadingProps:{width:50},sx:{mr:4},children:_r({input:l,decimals:t.lpMint.decimals})}),`${t.mintA.symbol}/${t.mintB.symbol} LP`,zt.jsx(W,{title:zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:10,typography:"body2",color:"text.primary"},children:[zt.jsx(xu,{address:t.mintA.address,chainId:t.mintA.chainId,showName:null!==(u=t.mintA.symbol)&&void 0!==u?u:"",size:14,offset:4,rightContent:zt.jsx(E,{loading:o,loadingProps:{width:50},children:_r({input:s,decimals:t.mintA.decimals})})}),zt.jsx(xu,{address:t.mintB.address,chainId:t.mintB.chainId,showName:null!==(p=t.mintB.symbol)&&void 0!==p?p:"",size:14,offset:4,rightContent:zt.jsx(E,{loading:o,loadingProps:{width:50},children:_r({input:d,decimals:t.mintB.decimals})})}),zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[zt.jsx(n,{id:"c4miqE",message:"Pool share"}),zt.jsx(E,{loading:o,loadingProps:{width:50},children:h})]})]}),sx:{padding:20,width:256},children:zt.jsx(j,{component:Wt.DetailBorder,sx:{ml:4,width:16,height:16,cursor:"pointer"}})}),zt.jsx(x,{component:"a",target:"_blank",rel:"noopener noreferrer",href:Wc(i.SOON_TESTNET,t.lpMint.address,"address"),sx:{ml:4,display:"inline-flex",height:16},children:zt.jsx(j,{component:Wt.ArrowTopRightBorder,sx:{width:16,height:16}})})]})]}):null}function vu({active:e,sx:t,onClick:o}){const i=y(),r="light"===i.palette.mode;let l=i.palette.primary.main,a="transparent";return e&&(l=i.palette.primary.contrastText,a=L(i.palette.primary.main,.8)),zt.jsx(x,{component:M,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 ${l}`,color:l,backgroundColor:a,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:zt.jsx(n,{id:"R9Khdg",message:"Auto"})})}function bu({sx:e,disabled:t,slippage:o,onChangeSlippage:i}){const r=y(),l=o===qc,[a,s]=_(l?"":new ie(o).times(100).toNumber());return zt.jsx(W,{disabled:t,onlyClick:!0,title:zt.jsxs(x,{sx:{backgroundColor:r.palette.background.paper,padding:r.spacing(16,20),borderRadius:16,width:375,maxWidth:"90vw",boxSizing:"border-box"},children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",typography:"body2",color:"text.primary"},children:[zt.jsx("span",{children:zt.jsx(n,{id:"lqTDfd",message:"Slippage Tolerance"})}),zt.jsxs("span",{children:[l?_c:o&&new ie(o).times(100).toNumber(),"%"]})]}),zt.jsxs(x,{sx:{mt:16,display:"flex",alignItems:"center",margin:r.spacing(16,0,0,0)},children:[zt.jsx(vu,{sx:{borderRadius:8,whiteSpace:"nowrap"},onClick:()=>{s(""),i(qc)},active:l}),zt.jsx(T,{placeholder:String(_c),value:a,onChange:e=>{const{value:t}=e.target;s(t),i(t?new ie(t).div(100).toNumber():qc)},onBlur:()=>{(!l&&new ie(o).gt(.1)||new ie(o).lte(0))&&(s(10),i(.1))},suffix:zt.jsx(x,{sx:{mr:16},children:"%"}),sx:{ml:8,"& input":{px:16,py:0,height:"39px"}}})]})]}),sx:{p:0},arrow:!1,placement:"bottom-end",children:zt.jsx(P,{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:zt.jsx(x,{component:Wt.Setting,sx:{width:18,height:18,"& path:last-child":{fill:r.palette.text.primary}}})})})}function ju(){var e,t,o;const[i,r]=G.useState(0),[l,a]=G.useState(),[s,d]=G.useState(),[c,u]=G.useState(""),[p,h]=G.useState(""),[m,f]=G.useState(qc),g=m===qc?new ie(_c).div(100).toNumber():m,{isMobile:y}=Rc(),{onlyChainId:v}=Vr(),j=G.useMemo((()=>v||(null==l?void 0:l.chainId)||(null==s?void 0:s.chainId)),[v,l,s]),{poolKeys:w,poolInfo:C,pairAddress:k,price:R,isInvalidPair:S,invertedPrice:I,poolInfoLoading:E,lpBalanceLoading:M,lpBalance:T,lpBalancePercentage:L,lpToAmountA:O,lpToAmountB:W,liquidityMinted:V,pairMintAAmount:F,pairMintBAmount:A,isExists:Z}=function({baseToken:e,quoteToken:t,baseAmount:n,quoteAmount:o,feeIndex:i,slippage:r}){var l,a,s;const[d,c]=G.useMemo((()=>{if(!e||!t||null==i)return[void 0,!0];const n=new gt(new Te(e.address).toBuffer()).lte(new gt(new Te(t.address).toBuffer())),[o,r]=n?[e,t]:[t,e],[l,a]=[new Te(o.address),new Te(r.address)];return[Ye({poolId:void 0,programId:sl,configId:new Te(cl[i].id),mintA:l,mintB:a}),l.toBase58()===a.toBase58()]}),[i,e,t]),{price:u,invertedPrice:p,poolInfoQuery:h,lpBalanceQuery:m,lpBalance:f,lpBalancePercentage:g,lpToAmountA:x,lpToAmountB:y,liquidityMinted:v,pairMintAAmount:b,pairMintBAmount:j,isExists:w}=$c({pool:e&&t&&d?{baseToken:e,quoteToken:t,address:d.poolId.toBase58()}:void 0,baseAmount:n,quoteAmount:o,slippage:r});return{poolKeys:null===(l=h.data)||void 0===l?void 0:l.poolKeys,poolInfo:null===(a=h.data)||void 0===a?void 0:a.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:m.isLoading,lpBalance:f,lpBalancePercentage:g,lpToAmountA:x,lpToAmountB:y,liquidityMinted:v,pairMintAAmount:b,pairMintBAmount:j,isExists:w}}({baseToken:l,quoteToken:s,baseAmount:c,quoteAmount:p,feeIndex:i,slippage:g}),P=Qc(R);if(R&&c&&!R.isEqualTo(null!=P?P:0)&&Z){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 B=oa(l,{amount:c}),N=oa(s,{amount:p}),[U,H]=G.useState(!1),D=!l||!s,Y=()=>{Hc.getState().push({type:Uc.Pool})},z=Kc({baseToken:l,quoteToken:s,pairMintAAmount:F,pairMintBAmount:A,isExists:Z,poolKeys:w,poolInfo:C,slippage:g,successBack:()=>{Hc.getState().push({type:Uc.Pool,params:{tab:nu.myLiquidity}})}});return zt.jsxs(Xc,{children:[zt.jsxs(x,{sx:{mx:"auto",borderRadius:y?0:16,backgroundColor:"background.paper",width:y?"100%":600,position:"relative",overflow:"hidden"},children:[y?zt.jsx(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20,pb:0},children:zt.jsx(Dc,{onClick:Y})}):zt.jsxs(x,{sx:{position:"relative",display:"flex",justifyContent:"center",alignItems:"center",px:20,py:24,typography:"caption"},children:[zt.jsx(x,{component:Wt.ArrowBack,sx:{position:"absolute",left:20,cursor:"pointer"},onClick:Y}),zt.jsx(n,{id:"E6MqGy",message:"Add liquidity"})]}),zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:20,pt:24,px:20,pb:20},children:[zt.jsx(yu,{isExists:Z,poolInfo:C,poolInfoLoading:E,lpBalanceLoading:M,lpBalance:T,lpBalancePercentage:L,lpToAmountA:O,lpToAmountB:W}),zt.jsxs(fu,{title:zt.jsx(n,{id:"nxRg31",message:"Select pair"}),children:[zt.jsxs(x,{sx:{display:"grid",gridTemplateColumns:y?"repeat(1, 1fr)":"repeat(2, 1fr)",gap:12},children:[zt.jsx(zc,{border:!0,highlightDefault:!0,chainId:j,token:l,onTokenChange:(e,t)=>{t?(a(s),d(l),u(""),h("")):(a(e),u(""))},occupiedToken:s}),zt.jsx(zc,{border:!0,highlightDefault:!0,chainId:j,token:s,onTokenChange:(e,t)=>{t?(a(s),d(l)):(d(e),h(""))},occupiedToken:l})]}),zt.jsx(gu,{feeIndex:i,onChange:r,feeList:cl,disabled:D})]}),zt.jsx(fu,{title:zt.jsx(n,{id:"MU9s7M",message:"Deposit amounts"}),disabled:D,children:zt.jsxs(x,{children:[zt.jsx(Pc,{sx:{mb:4,pb:28,minHeight:"auto"},token:l,amt:c,defaultLoadBalance:!0,onInputChange:e=>{var t;u(e);const n=Number(e);Z&&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}),zt.jsx(jc,{plus:!0}),zt.jsx(Pc,{sx:{pb:20,minHeight:"auto"},token:s,amt:p,defaultLoadBalance:!0,onInputChange:e=>{var t;h(e);const n=Number(e);Z&&I&&n&&u(I.times(e).dp(null!==(t=null==l?void 0:l.decimals)&&void 0!==t?t:18).toString())},showMaxBtn:!0,occupiedAddrs:[null!==(o=null==l?void 0:l.address)&&void 0!==o?o:""],occupiedChainId:null==l?void 0:l.chainId,notTokenPickerModal:!0,showPercentage:!0,readOnly:D}),zt.jsx(bu,{slippage:m,onChangeSlippage:f,disabled:D,sx:{mt:8}}),zt.jsx(hu,{baseToken:l,quoteToken:s,loading:E,midPrice:R,lpBalancePercentage:Z?L:100}),!!Z&&zt.jsxs(x,{sx:{mt:20,p:20,borderRadius:16,backgroundColor:"background.paperContrast",typography:"h6",textAlign:"center","& > b":{fontWeight:600,color:"primary.main"}},children:["🌟",zt.jsx("b",{children:zt.jsx(n,{id:"e38JNU",message:"Tips:"})})," ",zt.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:ll({input:cl[i].tradeFeeRate/1e4})},components:{0:zt.jsx("b",{})}})]})]})})]}),zt.jsx(x,{sx:{py:16,px:20,borderTopWidth:1},children:zt.jsx(hc,{fullWidth:!0,includeButton:!0,size:b.Size.big,disabled:D,chainId:j,children:zt.jsx(Yc,{statuses:[B,N],buttonProps:{size:b.Size.big},children:zt.jsx(b,{fullWidth:!0,size:b.Size.big,disabled:!(l&&s&&c&&p&&!S&&null!=i),onClick:()=>H(!0),children:S?zt.jsx(n,{id:"R7D79P",message:"Invalid pair"}):zt.jsx(n,{id:"bwSQI0",message:"Supply"})})})})})]}),zt.jsx(mu,{open:U,onClose:()=>H(!1),slippage:g,baseToken:l,pairMintAAmount:F,quoteToken:s,pairMintBAmount:A,feeRate:cl[i].tradeFeeRate,price:R,lpAmount:V,lpBalancePercentage:Z?L:100,pairAddress:k,createMutation:z})]})}const wu=({type:e})=>{const[t,n]=_(qc),o=K((()=>t===qc?e===u?new ie(Jc).div(100).toNumber():e===p?new ie(_c).div(100).toNumber():new ie(Gc).div(100).toNumber():t),[t,e]);return{slipper:t,setSlipper:n,slipperValue:o,resetSlipper:()=>{n(qc)}}};function Cu({type:e,disabled:t,value:o,onChange:i,sx:r}){const l=y(),a=o===qc,[s,d]=_(a?"":new ie(o).times(100).toNumber()),c=e===u?Jc:e===p?_c:Gc;return zt.jsx(W,{disabled:t,onlyClick:!0,title:zt.jsxs(x,{sx:{backgroundColor:l.palette.background.paper,padding:l.spacing(12,20),borderRadius:8,width:318,maxWidth:"90vw",boxSizing:"border-box"},children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",typography:"body2"},children:[zt.jsx("span",{children:zt.jsx(n,{id:"lqTDfd",message:"Slippage Tolerance"})}),zt.jsxs("span",{children:[a?c:o&&new ie(o).times(100).toNumber(),"%"]})]}),zt.jsxs(x,{sx:{display:"flex",alignItems:"center",margin:l.spacing(16,0,0,0)},children:[zt.jsx(vu,{sx:{borderRadius:8,whiteSpace:"nowrap"},onClick:()=>{d(""),i(qc)},active:a}),zt.jsx(T,{placeholder:String(c),value:s,onChange:e=>{const{value:t}=e.target;d(t),i(t?new ie(t).div(100).toNumber():qc)},onBlur:()=>{(!a&&new ie(o).gt(.1)||new ie(o).lte(0))&&(d(10),i(.1))},suffix:zt.jsx(x,{sx:{mr:16},children:"%"}),sx:{ml:8,"& input":{px:16,py:0,height:"39px"}}})]})]}),sx:{p:0},arrow:!1,placement:"bottom-end",children:zt.jsx(P,{sx:Object.assign({width:"max-content",alignItems:"right",margin:l.spacing(0,0,0,"auto"),p:l.spacing(4,12),borderRadius:20,backgroundColor:"background.paperDarkContrast"},r),children:zt.jsx(x,{component:Wt.Setting,sx:{width:18,height:18,"& path:last-child":{fill:l.palette.text.primary}}})})})}const ku=({chainId:e,isValid:t,errorMessage:n,setShowConfirm:i})=>zt.jsx(hc,{includeButton:!0,fullWidth:!0,chainId:e,children:zt.jsx(b,{fullWidth:!0,size:b.Size.big,onClick:()=>{i(!0)},disabled:!t,danger:!t,children:n||o._({id:"rdUucN",message:"Preview"})})}),Ru=[.25,.5,.75,1];function Su({currentValue:e,onClick:t,sx:n}){const o=y(),i="light"===o.palette.mode,{isMobile:r}=Rc(),[l,a]=_(null),s=te(0);J((()=>{e?(s.current+=1,s.current>=2&&(a(null),s.current=0)):a(null)}),[e]);const d=Qc(e);return J((()=>{d===e&&1===l&&(s.current=1)}),[e,d,l]),zt.jsx(x,{sx:Object.assign({display:"grid",gap:r?10:14,gridTemplateColumns:`repeat(${Ru.length}, 1fr)`},n),children:Ru.map((e=>{const n=e===l;return zt.jsxs(M,{sx:{typography:"h6",borderRadius:4,padding:o.spacing(4,0),width:"100%",color:"text.secondary",backgroundColor:"background.paperDarkContrast","&:hover":{color:o.palette.text.primary,backgroundColor:L(o.palette.text.primary,.2)},"&.selected, &:focus":{color:"#fff",backgroundColor:i?o.palette.primary.main:L(o.palette.text.primary,.4)}},onClick:()=>{n||(s.current=0,a(e),t(e))},className:n?"selected":void 0,children:[100*e,"%"]},e)}))})}const Iu=({value:e,onUserInput:t,maxAmount:i,balance:r,mint:l,locked:a})=>{var s,d;const c=y(),u=Q((e=>{if(!i||!l)return;const n=i.multipliedBy(e).dp(l.decimals).toString();t(n)}),[l,i,t]),p=K((()=>r?_r({input:r,decimals:null==l?void 0:l.decimals}):"-"),[null==l?void 0:l.decimals,r]);return zt.jsxs(x,{sx:{pt:12,pb:20,px:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",borderRadius:12,backgroundColor:c.palette.background.input},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,color:c.palette.text.primary,typography:"h5"},children:[(null==l?void 0:l.address)&&zt.jsx(Ss,{address:null!==(s=null==l?void 0:l.address)&&void 0!==s?s:"",chainId:null==l?void 0:l.chainId,noShowChain:!0,width:24,height:24,marginRight:0}),zt.jsx(x,{sx:{display:"flex",alignItems:"center"},children:(null==l?void 0:l.address)?zt.jsx(x,{children:null!==(d=null==l?void 0:l.symbol)&&void 0!==d?d:"-"}):zt.jsx(n,{id:"sIPJGT",message:"SELECT TOKEN"})})]}),zt.jsxs(x,{component:M,sx:{color:c.palette.text.secondary,"&:hover":{color:c.palette.text.primary},cursor:"pointer",display:"flex",flexWrap:"wrap",justifyContent:"flex-end",typography:"body2"},onClick:()=>{u(1)},children:[zt.jsxs(x,{sx:{wordBreak:"keep-all"},children:[o._({id:"fsBGk0",message:"Balance"}),": "]}),zt.jsx(x,{sx:{wordBreak:"break-all",textAlign:"right",display:"flex",alignItems:"center"},children:p})]})]}),zt.jsx(kc,{sx:{mt:4},suffix:void 0,value:e,onChange:t,readOnly:a,withClear:!a}),a?null:zt.jsx(Su,{sx:{mt:20,mb:0},onClick:u,currentValue:e})]})};var Eu,Mu;function Tu(e,t){switch(t.type){case Eu.UpdateMint1:{const n=t.payload;return Object.assign(Object.assign({},e),{mint1:n})}case Eu.UpdateDefaultMint1:{const n=t.payload;return e.mint1?e:Object.assign(Object.assign({},e),{mint1:n})}case Eu.UpdateMint2:{const n=t.payload;return Object.assign(Object.assign({},e),{mint2:n})}case Eu.UpdateDefaultMint2:{const n=t.payload;return e.mint2?e:Object.assign(Object.assign({},e),{mint2:n})}case Eu.UpdateMint1AndClearMint2:{const n=t.payload;return Object.assign(Object.assign({},e),{mint1:n,mint2:void 0})}case Eu.UpdateFeeAmount:return Object.assign(Object.assign({},e),{feeAmount:t.payload});case Eu.UpdateSelectedMintIndex:return Object.assign(Object.assign({},e),{selectedMintIndex:t.payload});case Eu.setFullRange:return Object.assign(Object.assign({},e),{leftRangeTypedValue:!0,rightRangeTypedValue:!0});case Eu.typeStartPriceInput:return Object.assign(Object.assign({},e),{startPriceTypedValue:t.payload.typedValue});case Eu.typeLeftRangeInput:return Object.assign(Object.assign({},e),{leftRangeTypedValue:t.payload.typedValue});case Eu.typeRightRangeInput:return Object.assign(Object.assign({},e),{rightRangeTypedValue:t.payload.typedValue});case Eu.typeInput:{const{payload:{field:n,typedValue:o}}=t;return Object.assign(Object.assign({},e),{independentField:n,typedValue:o})}default:throw Error("Unknown action: "+t.type)}}!function(e){e[e.UpdateMint1=0]="UpdateMint1",e[e.UpdateMint2=1]="UpdateMint2",e[e.UpdateDefaultMint1=2]="UpdateDefaultMint1",e[e.UpdateDefaultMint2=3]="UpdateDefaultMint2",e[e.UpdateMint1AndClearMint2=4]="UpdateMint1AndClearMint2",e[e.UpdateFeeAmount=5]="UpdateFeeAmount",e[e.UpdateSelectedMintIndex=6]="UpdateSelectedMintIndex",e[e.setFullRange=7]="setFullRange",e[e.typeStartPriceInput=8]="typeStartPriceInput",e[e.typeLeftRangeInput=9]="typeLeftRangeInput",e[e.typeRightRangeInput=10]="typeRightRangeInput",e[e.typeInput=11]="typeInput"}(Eu||(Eu={})),function(e){e[e.LOW=1e3]="LOW"}(Mu||(Mu={}));const Lu={[Mu.LOW]:20},Ou={[Mu.LOW]:{label:"0.1%"}},Wu=({disabled:e,feeAmount:t,dispatch:n})=>{const i=y(),{isMobile:r}=Rc(),[l,a]=_(!1);return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",justifyContent:"space-between",px:20,py:12,borderWidth:1,borderStyle:"solid",borderColor:i.palette.border.main,borderRadius:12},e?{opacity:.3}:void 0),children:[zt.jsx(x,{sx:{typography:"h5",color:i.palette.text.primary},children:t?`${Ou[t].label} ${o._({id:"fxRyGG",message:"fee tier"})}`:o._({id:"EU3wU4",message:"Fee tier"})}),zt.jsx(b,{size:b.Size.small,variant:b.Variant.outlined,disabled:e,onClick:()=>a((e=>!e)),sx:{color:i.palette.text.primary,border:`solid 1px ${i.palette.text.primary}`},children:l?o._({id:"vLyv1R",message:"Hide"}):o._({id:"ePK91l",message:"Edit"})})]}),l&&zt.jsx(x,{sx:Object.assign({},r?{display:"grid",gap:8,gridTemplateColumns:"repeat(2, 1fr)"}:{display:"flex",alignItems:"center",gap:8}),children:[Mu.LOW].map((o=>{const r=t===o;return zt.jsxs(b,{size:b.Size.middle,variant:b.Variant.outlined,disabled:e,onClick:()=>{n({type:Eu.UpdateFeeAmount,payload:o})},sx:{flexBasis:"50%",flexShrink:1,flexGrow:1,justifyContent:"space-between",px:20,color:i.palette.text.primary,borderRadius:12,borderColor:r?i.palette.primary.main:i.palette.border.main,[i.breakpoints.up("tablet")]:{flexBasis:"25%"}},children:[Ou[o].label,r?zt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[zt.jsx("rect",{x:"0.5",y:"0.5",width:"17",height:"17",rx:"8.5",stroke:i.palette.primary.main}),zt.jsx("rect",{x:"4.5",y:"4.5",width:"9",height:"9",rx:"4.5",fill:i.palette.primary.main,stroke:i.palette.primary.main})]}):zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:zt.jsx("rect",{x:"0.5",y:"0.5",width:"17",height:"17",rx:"8.5",stroke:i.palette.text.secondary})})]},o)}))})]})};var Vu,Fu,Au;!function(e){e.DEPOSIT_1="DEPOSIT_1",e.DEPOSIT_2="DEPOSIT_2"}(Vu||(Vu={})),function(e){e.LOWER="LOWER",e.UPPER="UPPER"}(Fu||(Fu={})),function(e){e.TOKEN0="TOKEN0",e.TOKEN1="TOKEN1"}(Au||(Au={}));const Zu={xs:"4px",sm:"8px",md:"12px",lg:"24px",xl:"32px"},Pu=({children:e,sx:t})=>(y(),zt.jsx(x,{sx:Object.assign({display:"flex",flexDirection:"column",gap:20,px:20,py:20,borderRadius:12},t),children:e})),Bu=({children:e,sx:t})=>{const n=y();return zt.jsx(Pu,{sx:Object.assign(Object.assign({},t),{backgroundColor:n.palette.background.paperContrast}),children:e})},Nu=({children:e})=>{const t=y();return zt.jsxs(x,{sx:{p:8,borderRadius:8,backgroundColor:L(t.palette.warning.main,.1),display:"flex",alignItems:"center",gap:8},children:[zt.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.75 16.125L9 1.875L17.25 16.125H0.75ZM14.6475 14.625L8.99998 4.86749L3.35247 14.625H14.6475ZM9.75004 12.375H8.25003V13.875H9.75004V12.375ZM8.25003 7.875H9.75004V10.875H8.25003V7.875Z",fill:t.palette.warning.main})}),zt.jsx(x,{sx:{typography:"h6",color:t.palette.warning.main,textAlign:"left"},children:e})]})};function Uu({gap:e,flex:t,children:n,style:o}){return zt.jsx(x,{sx:Object.assign(Object.assign(Object.assign({display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:e&&Zu[e]||e},t&&{flex:t}),{width:"100%",alignItems:"center"}),o),children:n})}function Hu({gap:e,justify:t,grow:n,children:o,style:i}){return zt.jsx(x,{sx:Object.assign({display:"grid",gridAutoRows:"auto",gridRowGap:e&&Zu[e]||e,justifyItems:t,flexGrow:n&&1},i),children:o})}function Du({gap:e,children:t,sx:n}){return zt.jsx(x,{sx:Object.assign({width:"100%",display:"flex",padding:0,alignItems:"center",justifyContent:"flex-start",gap:e&&Zu[e]||e},n),children:t})}function Yu({children:e,style:t}){return zt.jsx(Du,{sx:Object.assign({justifyContent:"space-between"},t),children:e})}function zu({gap:e,justify:t,children:n,sx:o}){return zt.jsx(Du,{sx:Object.assign({position:"relative",width:"fit-content",margin:`-${e}`},o),children:n})}function Xu({children:e,disabled:t,sx:n}){return zt.jsx(Du,{sx:Object.assign({display:"flex",flexDirection:"column",alignItems:"stretch",gap:12,opacity:t?.2:1,pointerEvents:t?"none":"auto"},n),children:e})}const qu={neutral1:"#222222",neutral2:"#7D7D7D",accent1:"#FC72FF",critical:"FF5F52",white:"#FFFFFF",surface3:"#22222212",opacity:{hover:.6,click:.4,disabled:.5,enabled:1}},Gu=({series:e,xScale:t,yScale:n,xValue:o,yValue:i,fill:r})=>K((()=>{var l;return zt.jsx(x,{component:"path",opacity:.5,stroke:null!=r?r:qu.accent1,fill:null!=r?r:qu.accent1,d:null!==(l=vt().curve(bt).x((e=>t(o(e)))).y1((e=>n(i(e)))).y0(n(0))(e.filter((e=>{const n=t(o(e));return n>0&&n<=window.innerWidth}))))&&void 0!==l?l:void 0})}),[r,e,t,o,n,i]),_u=({axisGenerator:e})=>zt.jsx("g",{ref:t=>{t&&wt(t).call(e).call((e=>e.select(".domain").remove()))}}),Ju=({xScale:e,innerHeight:t,offset:n=0})=>K((()=>zt.jsx(x,{component:"g",transform:`translate(0, ${t+n})`,sx:{"& line":{display:"none"},"& text":{color:qu.neutral2,transform:"translateY(5px)"}},children:zt.jsx(_u,{axisGenerator:jt(e).ticks(6)})})),[t,n,e]),Qu=e=>["M 0 0",`v ${e}`,"m 1 0","V 0","M 0 1","h 12","q 2 0, 2 2","v 22","q 0 2 -2 2","h -12","z"].join(" "),Ku=()=>["m 5 7","v 14","M 0 0","m 9 7","v 14","z"].join(" "),$u=({color:e,size:t=10,margin:n=10})=>zt.jsx("polygon",{points:`0 0, ${t} ${t}, 0 ${t}`,transform:` translate(${t+n}, ${n}) rotate(45) `,fill:e,stroke:e,strokeWidth:"4",strokeLinejoin:"round"});const ep=({color:e,d:t})=>zt.jsx(x,{component:"path",cursor:"ew-resize",pointerEvents:"none",strokeWidth:3,stroke:e,fill:e,d:t}),tp=({d:e})=>zt.jsx(x,{component:"path",cursor:"ew-resize",pointerEvents:"none",stroke:qu.white,opacity:qu.opacity.hover,d:e}),np=({visible:e,transform:t,children:n})=>zt.jsx(x,{component:"g",opacity:e?"1":"0",transform:t,sx:{transition:"opacity 300ms"},children:n}),op=({y:e,x:t,height:n,width:o,rx:i})=>zt.jsx(x,{component:"rect",fill:qu.surface3,y:e,x:t,height:n,width:o,rx:i}),ip=({y:e,transform:t,dominantBaseline:n,children:o})=>zt.jsx(x,{component:"text",y:e,textAnchor:"middle",fontSize:"13px",fill:qu.neutral1,transform:t,dominantBaseline:n,children:o}),rp=(e,t,n)=>{const o=e.map((e=>n(e).toFixed(1))),i=t.map((e=>n(e).toFixed(1)));return o.every(((e,t)=>e===i[t]))},lp=({id:e,xScale:t,interactive:n,brushLabelValue:o,brushExtent:i,setBrushExtent:r,innerWidth:l,innerHeight:a,westHandleColor:s,eastHandleColor:d})=>{const c=te(null),u=te(null),[p,h]=_(i),[m,f]=_(!1),[g,x]=_(!1),y=function(e){const t=te();return J((()=>{t.current=e}),[e]),t.current}(i),v=Q((e=>{const{type:n,selection:o,mode:l}=e;if(!o)return void h(null);const a=o.map(t.invert);"end"!==n||rp(i,a,t)||r(a,l),h(a)}),[t,i,r]);J((()=>{h(i)}),[i]),J((()=>{c.current&&(u.current=Ct().extent([[Math.max(2,t(0)),0],[l-2,a]]).handleSize(30).filter((()=>n)).on("brush end",v),u.current(wt(c.current)),y&&rp(i,y,t)&&wt(c.current).transition().call(u.current.move,i.map(t)),wt(c.current).selectAll(".selection").attr("stroke","none").attr("fill-opacity","0.1").attr("fill",`url(#${e}-gradient-selection)`))}),[i,v,e,a,l,n,y,t]),J((()=>{c.current&&u.current&&u.current.move(wt(c.current),i.map(t))}),[i,t]),J((()=>{f(!0);const e=setTimeout((()=>f(!1)),1500);return()=>clearTimeout(e)}),[p]);const b=p&&t(p[0])>20,j=p&&t(p[1])>l-20,w=p&&(t(p[0])<0||t(p[1])<0),C=p&&(t(p[0])>l||t(p[1])>l),k=p&&t(p[0])>=0&&t(p[0])<=l,R=p&&t(p[1])>=0&&t(p[1])<=l;return K((()=>zt.jsxs(zt.Fragment,{children:[zt.jsxs("defs",{children:[zt.jsxs("linearGradient",{id:`${e}-gradient-selection`,x1:"0%",y1:"100%",x2:"100%",y2:"100%",children:[zt.jsx("stop",{stopColor:s}),zt.jsx("stop",{stopColor:d,offset:"1"})]}),zt.jsx("clipPath",{id:`${e}-brush-clip`,children:zt.jsx("rect",{x:"0",y:"0",width:l,height:a})})]}),zt.jsx("g",{ref:c,clipPath:`url(#${e}-brush-clip)`,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1)}),p&&zt.jsxs(zt.Fragment,{children:[k?zt.jsxs("g",{transform:`translate(${Math.max(0,t(p[0]))}, 0), scale(${b?"-1":"1"}, 1)`,children:[zt.jsxs("g",{children:[zt.jsx(ep,{color:s,d:Qu(a)}),zt.jsx(tp,{d:Ku()})]}),zt.jsxs(np,{transform:`translate(50,0), scale(${b?"1":"-1"}, 1)`,visible:m||g,children:[zt.jsx(op,{y:"0",x:"-30",height:"30",width:"60",rx:"8"}),zt.jsx(ip,{transform:"scale(-1, 1)",y:"15",dominantBaseline:"middle",children:o("w",p[0])})]})]}):null,R?zt.jsxs("g",{transform:`translate(${t(p[1])}, 0), scale(${j?"-1":"1"}, 1)`,children:[zt.jsxs("g",{children:[zt.jsx(ep,{color:d,d:Qu(a)}),zt.jsx(tp,{d:Ku()})]}),zt.jsxs(np,{transform:`translate(50,0), scale(${j?"-1":"1"}, 1)`,visible:m||g,children:[zt.jsx(op,{y:"0",x:"-30",height:"30",width:"60",rx:"8"}),zt.jsx(ip,{y:"15",dominantBaseline:"middle",children:o("e",p[1])})]})]}):null,w&&zt.jsx($u,{color:s}),C&&zt.jsx("g",{transform:`translate(${l}, 0) scale(-1, 1)`,children:zt.jsx($u,{color:d})})]})]})),[o,d,R,j,b,g,e,a,l,p,C,m,w,s,k,t])},ap=({value:e,xScale:t,innerHeight:n})=>K((()=>zt.jsx(x,{component:"line",x1:t(e),y1:"0",x2:t(e),y2:n,sx:{opacity:.5,strokeWidth:2,stroke:qu.neutral1,fill:"none"}})),[e,t,n]);function sp({svg:e,xScale:t,setZoom:n,width:o,height:i,resetBrush:r,showResetButton:l,zoomLevels:a}){const s=te(),[d,c,u,p]=K((()=>[()=>e&&s.current&&wt(e).transition().call(s.current.scaleBy,2),()=>e&&s.current&&wt(e).transition().call(s.current.scaleBy,.5),()=>e&&s.current&&wt(e).transition().call(s.current.scaleTo,.5),()=>e&&s.current&&wt(e).call(s.current.transform,kt.translate(0,0).scale(1)).transition().call(s.current.scaleTo,.5)]),[e]);return J((()=>{e&&(s.current=Rt().scaleExtent([a.min,a.max]).extent([[0,0],[o,i]]).on("zoom",(({transform:e})=>n(e))),wt(e).call(s.current))}),[i,o,n,e,t,s,a,a.max,a.min]),J((()=>{u()}),[u,a]),zt.jsxs(x,{sx:{display:"grid",gridTemplateColumns:`repeat(${l?3:2}, 1fr)`,gridGap:"6px",position:"absolute",top:"-32px",right:0},children:[l&&zt.jsx(b,{size:b.Size.small,sx:{borderRadius:16},onClick:()=>{r(),p()},disabled:!1,children:zt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[zt.jsx("polyline",{points:"1 4 1 10 7 10"}),zt.jsx("polyline",{points:"23 20 23 14 17 14"}),zt.jsx("path",{d:"M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15"})]})}),zt.jsx(b,{size:b.Size.small,sx:{borderRadius:16},onClick:d,disabled:!1,children:zt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[zt.jsx("circle",{cx:"11",cy:"11",r:"8"}),zt.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),zt.jsx("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),zt.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),zt.jsx(b,{size:b.Size.small,sx:{borderRadius:16},onClick:c,disabled:!1,children:zt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[zt.jsx("circle",{cx:"11",cy:"11",r:"8"}),zt.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),zt.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})})]})}const dp=e=>e.price0,cp=e=>e.activeLiquidity;function up({id:e="liquidityChartRangeInput",data:{series:t,current:n},ticksAtLimit:o,styles:i,dimensions:{width:r,height:l},margins:a,interactive:s=!0,brushDomain:d,brushLabels:c,onBrushDomainChange:u,zoomLevels:p}){const h=te(null),[m,f]=_(null),[g,y]=K((()=>[l-a.top-a.bottom,r-a.left-a.right]),[r,l,a]),{xScale:v,yScale:b}=K((()=>{const e={xScale:St().domain([n*p.initialMin,n*p.initialMax]).range([0,y]),yScale:St().domain([0,It(t,cp)]).range([g,0])};if(m){const t=m.rescaleX(e.xScale);e.xScale.domain(t.domain())}return e}),[n,p.initialMin,p.initialMax,y,t,g,m]);return J((()=>{f(null)}),[p]),J((()=>{d||u(v.domain(),void 0)}),[d,u,v]),zt.jsxs(zt.Fragment,{children:[zt.jsx(sp,{svg:h.current,xScale:v,setZoom:f,width:y,height:l,resetBrush:()=>{u([n*p.initialMin,n*p.initialMax],"reset")},showResetButton:Boolean(o[Fu.LOWER]||o[Fu.UPPER]),zoomLevels:p}),zt.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${r} ${l}`,style:{overflow:"visible"},children:[zt.jsxs("defs",{children:[zt.jsx("clipPath",{id:`${e}-chart-clip`,children:zt.jsx("rect",{x:"0",y:"0",width:y,height:l})}),d&&zt.jsx("mask",{id:`${e}-chart-area-mask`,children:zt.jsx("rect",{fill:"white",x:v(d[0]),y:"0",width:v(d[1])-v(d[0]),height:g})})]}),zt.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[zt.jsxs("g",{clipPath:`url(#${e}-chart-clip)`,children:[zt.jsx(Gu,{series:t,xScale:v,yScale:b,xValue:dp,yValue:cp}),d&&zt.jsx("g",{mask:`url(#${e}-chart-area-mask)`,children:zt.jsx(Gu,{series:t,xScale:v,yScale:b,xValue:dp,yValue:cp,fill:i.area.selection})}),zt.jsx(ap,{value:n,xScale:v,innerHeight:g}),zt.jsx(Ju,{xScale:v,innerHeight:g})]}),zt.jsx(x,{component:"rect",width:y,height:l,ref:h,sx:{fill:"transparent",cursor:"grab","&:active":{cursor:"grabbing"}}}),zt.jsx(lp,{id:e,xScale:v,interactive:s,brushLabelValue:c,brushExtent:null!=d?d:v.domain(),innerWidth:y,innerHeight:g,setBrushExtent:u,westHandleColor:i.brush.handle.west,eastHandleColor:i.brush.handle.east})]})]})]})}function pp({tick:e,decimalsA:t,decimalsB:n}){if(!t||!n||"number"!=typeof e)return;const o=ze.getSqrtPriceX64FromTick(e);return new ie(ze.sqrtPriceX64ToPrice(o,t,n).toString())}var hp;function mp(e){const t=Ws(),n=we({queryKey:["clmm","getPoolInfoFromRpc",e],enabled:null!=e&&null!=t,queryFn:()=>Lr(this,void 0,void 0,(function*(){if(!t||!e)return null;try{const{poolInfo:n,poolKeys:o,computePoolInfo:i,tickData:r}=yield t.clmm.getPoolInfoFromRpc(e);return{poolInfo:n,poolKeys:o,computePoolInfo:i,tickData:r}}catch(e){return console.error("getPoolInfoFromRpc error",e),null}}))});return n.isLoading?[hp.LOADING,null,e]:n.isError?[hp.INVALID,null,e]:n.data?[hp.EXISTS,n.data,e]:[hp.NOT_EXISTS,null,e]}function fp(e,t,n,o){return mp(K((()=>{if(!e||!t||!n)return null;const i=function({chainId:e,feeAmount:t,mint1Address:n,mint2Address:o}){const[i,r]=new gt(new Te(n).toBuffer()).gt(new gt(new Te(o).toBuffer()))?[o,n]:[n,o],[l,a]=[new Te(i),new Te(r)],s=ml[e];if(!s)throw new Error("Invalid config");const d=s.config.find((e=>e.tradeFeeRate===t));if(!d)throw new Error("Invalid fee");const{publicKey:c}=Xe(s.programId,new Te(d.id),l,a);return c}({mint1Address:e,mint2Address:t,feeAmount:n,chainId:o}).toBase58();return i}),[o,n,e,t]))}!function(e){e[e.LOADING=0]="LOADING",e[e.NOT_EXISTS=1]="NOT_EXISTS",e[e.EXISTS=2]="EXISTS",e[e.INVALID=3]="INVALID"}(hp||(hp={}));const gp=8,xp=(e,t)=>e&&t?Math.floor(e/Lu[t])*Lu[t]:void 0,yp=1e3;function vp(e,t){const[n,o]=_(0),[i,r]=_([]),{data:l,error:s,isLoading:d}=function(e,t=0,n){const o=Ql().getQuery(h.graphql.AllV3TicksDocument,{skip:t,first:yp,where:{chain:n?a[n]:m.SOON_TESTNET,poolAddress:null!=e?e:"",pairType:u}});return we(Object.assign(Object.assign({},o),{enabled:!!e}))}(e,n,t),c=null==l?void 0:l.amm_getTicksData.ticks;return J((()=>{(null==c?void 0:c.length)&&(r((e=>[...e,...c])),(null==c?void 0:c.length)===yp&&o((e=>e+yp)))}),[c]),{isLoading:d||(null==c?void 0:c.length)===yp,error:s,ticks:i}}function bp({mint1:e,mint2:t,feeAmount:n}){const{isLoading:o,error:i,data:r}=function(e,t,n,o){var i,r;const{chainId:l}=Ar(),[a,s,d]=fp(null==e?void 0:e.address,null==t?void 0:t.address,n,l),c=null===(i=null==s?void 0:s.computePoolInfo)||void 0===i?void 0:i.tickCurrent,u=K((()=>xp(c,n)),[c,n]),{isLoading:p,error:h,ticks:m}=vp(d,l);return K((()=>{var n,o,i,r,l,d;if(!e||!t||void 0===u||a!==hp.EXISTS||!m||0===m.length||p)return{isLoading:p||a===hp.LOADING,error:h,activeTick:u,data:void 0};const c=m.findIndex((e=>(null==e?void 0:e.tickIdx)&&e.tickIdx>u))-1;if(c<0)return console.log("usePoolTickData","usePoolActiveLiquidity","TickData pivot not found",{mint1:e.address,mint2:t.address,chainId:e.chainId}),{isLoading:p,error:h,activeTick:u,data:void 0};const f=pp({decimalsA:e.decimals,decimalsB:t.decimals,tick:u}),g={liquidityActive:null!==(o=null===(n=null==s?void 0:s.computePoolInfo)||void 0===n?void 0:n.liquidity.toNumber())&&void 0!==o?o:0,tick:u,liquidityNet:Number(null===(i=m[c])||void 0===i?void 0:i.tickIdx)===u?Number(null!==(l=null===(r=m[c])||void 0===r?void 0:r.liquidityNet)&&void 0!==l?l:0):0,price0:null!==(d=null==f?void 0:f.toFixed(gp))&&void 0!==d?d:"",sdkPrice:f},x=[].concat(g).concat([]);return{isLoading:p,error:h,data:x}}),[u,h,p,e,t,null===(r=null==s?void 0:s.computePoolInfo)||void 0===r?void 0:r.liquidity,a,m])}(e,t,n),l=Q((()=>{if(!(null==r?void 0:r.length))return;const e=[];for(let t=0;t<r.length;t++){const n=r[t],o={activeLiquidity:parseFloat(n.liquidityActive.toString()),price0:parseFloat(n.price0)};o.activeLiquidity>0&&e.push(o)}return e}),[r]);return K((()=>({isLoading:o,error:i,formattedData:o?void 0:l()})),[o,i,l])}const jp={[Mu.LOW]:{initialMin:.999,initialMax:1.001,min:1e-5,max:1.5}};function wp({message:e,icon:t}){return zt.jsxs(Uu,{style:{height:"100%",justifyContent:"center"},children:[t,e&&zt.jsx(x,{sx:{mt:20,p:10,typography:"caption",textAlign:"center"},children:e})]})}function Cp(){return zt.jsx(E,{})}function kp({mint1:e,mint2:t,feeAmount:o,ticksAtLimit:i,price:r,priceLower:l,priceUpper:a,onLeftRangeInput:s,onRightRangeInput:d,interactive:c}){const u=!0,{isLoading:p,error:h,formattedData:m}=bp({mint1:e,mint2:t,feeAmount:o}),f=Q(((e,t)=>{let n=Number(e[0]);const o=Number(e[1]);n<=0&&(n=1/10**6),fe((()=>{(!i[Fu.LOWER]||"handle"===t||"reset"===t)&&n>0&&s(n.toFixed(6)),(!i[Fu.UPPER]||"reset"===t)&&o>0&&o<1e35&&d(o.toFixed(6))}))}),[u,s,d,i]);c=c&&Boolean(null==m?void 0:m.length);const g=K((()=>{const e=l,t=a;return e&&t?[parseFloat(null==e?void 0:e.toString()),parseFloat(null==t?void 0:t.toString())]:void 0}),[l,a]),y=Q(((e,t)=>{if(!r)return"";if("w"===e&&i[Fu.LOWER])return"0";if("e"===e&&i[Fu.UPPER])return"∞";const n=(t<r?-1:1)*((Math.max(t,r)-Math.min(t,r))/r)*100;return r?`${_r({input:n,decimals:2})}%`:""}),[u,r,i]),v=!e||!t||void 0===m&&!p&&!h;return zt.jsx(Hu,{gap:"md",style:{minHeight:"200px"},children:v?zt.jsx(wp,{message:zt.jsx(n,{id:"OZUH85",message:"Your position will appear here."}),icon:zt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:qu.neutral1,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[zt.jsx("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),zt.jsx("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"})]})}):p?zt.jsx(Cp,{}):h?zt.jsx(wp,{message:zt.jsx(n,{id:"79D0qY",message:"Liquidity data not available."}),icon:zt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:qu.neutral2,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[zt.jsx("path",{d:"M22.61 16.95A5 5 0 0 0 18 10h-1.26a8 8 0 0 0-7.05-6M5 5a8 8 0 0 0 4 15h9a5 5 0 0 0 1.7-.3"}),zt.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]})}):m&&0!==m.length&&r?zt.jsx(x,{sx:{position:"relative",width:"100%",maxHeight:"200px",justifyContent:"center",alignContent:"center"},children:zt.jsx(up,{data:{series:m,current:r},dimensions:{width:560,height:200},margins:{top:10,right:2,bottom:20,left:0},styles:{area:{selection:qu.accent1},brush:{handle:{west:qu.critical,east:qu.accent1}}},interactive:c,brushLabels:y,brushDomain:g,onBrushDomainChange:f,zoomLevels:jp[null!=o?o:Mu.LOW],ticksAtLimit:i})}):zt.jsx(wp,{message:zt.jsx(n,{id:"rH6vg9",message:"There is no liquidity data."}),icon:zt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:qu.neutral2,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[zt.jsx("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),zt.jsx("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),zt.jsx("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]})})})}const Rp=({value:e,decrement:t,increment:n,decrementDisabled:o=!1,incrementDisabled:i=!1,locked:r,onUserInput:l,title:a,perPriceText:s})=>{const d=y(),[c,u]=_(""),[p,h]=_(!1),m=Q((()=>{h(!1),l(c)}),[c,l]),f=Q((()=>{h(!1),l(t())}),[t,l]),g=Q((()=>{h(!1),l(n())}),[n,l]);return J((()=>{c===e||p||setTimeout((()=>{u(e)}),0)}),[c,p,e]),zt.jsx(x,{onFocus:()=>{h(!0)},onBlur:m,sx:{width:"100%",py:12,px:20,borderRadius:16,backgroundColor:d.palette.background.input},children:zt.jsxs(x,{sx:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:[zt.jsx(x,{sx:{typography:"body2",fontWeight:600,color:d.palette.text.primary},children:a}),zt.jsx(x,{sx:{mt:4,typography:"h6",fontWeight:500,color:d.palette.text.secondary},children:s}),zt.jsx(kc,{sx:{mt:12},value:c,onChange:e=>{u(e)},readOnly:r})]}),zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:8},children:[!r&&zt.jsx(b,{size:b.Size.small,onClick:g,disabled:i,sx:{px:4,backgroundColor:d.palette.background.paper,"&[disabled]":{cursor:"default"}},children:zt.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zt.jsx("path",{d:"M14.25 9.75H9.75V14.25H8.25V9.75H3.75V8.25H8.25V3.75H9.75V8.25H14.25V9.75Z",fill:o?d.palette.text.disabled:d.palette.text.primary})})}),!r&&zt.jsx(b,{size:b.Size.small,onClick:f,disabled:o,sx:{px:4,backgroundColor:d.palette.background.paper,"&[disabled]":{cursor:"default"}},children:zt.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zt.jsx("rect",{x:"3.75",y:"8.25",width:"10.5",height:"1.5",fill:o?d.palette.text.disabled:d.palette.text.primary})})})]})]})})},Sp=({priceLower:e,priceUpper:t,onLeftRangeInput:o,onRightRangeInput:i,getDecrementLower:r,getIncrementLower:l,getDecrementUpper:a,getIncrementUpper:s,perPriceText:d,ticksAtLimit:c})=>{var u,p;const h=e,m=t;return zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:8},children:[zt.jsx(Rp,{value:c[Fu.LOWER]?"0":null!==(u=null==h?void 0:h.dp(8).toString())&&void 0!==u?u:"",onUserInput:o,decrement:r,increment:l,decrementDisabled:void 0===h||c[Fu.LOWER],incrementDisabled:void 0===h||c[Fu.LOWER],title:zt.jsx(n,{id:"uEoBVI",message:"Low price"}),perPriceText:d}),zt.jsx(Rp,{value:c[Fu.UPPER]?"∞":null!==(p=null==m?void 0:m.dp(8).toString())&&void 0!==p?p:"",onUserInput:i,decrement:a,increment:s,incrementDisabled:void 0===m||c[Fu.UPPER],decrementDisabled:void 0===m||c[Fu.UPPER],title:zt.jsx(n,{id:"kAC8rT",message:"High price"}),perPriceText:d})]})},Ip=({mintA:e,mintB:t,selectedMintIndex:n,handleRateToggle:o,sx:i})=>{const r=y();return zt.jsx(x,{component:M,onClick:o,sx:Object.assign({display:"flex",alignItems:"center",p:1,borderRadius:8,backgroundColor:r.palette.border.main},i),children:zt.jsx(x,{sx:{display:"flex",alignItems:"center",width:"100%",[r.breakpoints.up("tablet")]:{width:"auto"}},children:[e,t].map(((e,t)=>{const o=n===t;return zt.jsx(x,{sx:Object.assign({flexGrow:1,flexShrink:1,flexBasis:"50%",px:12,py:4,borderRadius:7,textAlign:"center",typography:"h6",whiteSpace:"nowrap"},o?{color:r.palette.text.primary,backgroundColor:r.palette.background.paper}:{color:r.palette.text.secondary,backgroundColor:"transparent"}),children:e.symbol},e.address)}))})})};function Ep(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 Mp(e){var t,n,o,i;const r=null==e?void 0:e.pair;if(r)return{address:r.id,chainId:r.chainId,baseToken:Ep(r.baseToken,r.chainId),quoteToken:Ep(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 Tp(e){const t=Mp(e);if(t)return Object.assign(Object.assign({},t),{liquidityPositions:null==e?void 0:e.liquidityPositions})}function Lp(e){switch(e){case"SVM_AMMV2":return"AMM V2";case"SVM_AMMV3":return"AMM V3";default:return"PMM"}}function Op({type:e,lpFeeRate:t,mtFeeRate:n}){var o,i;return"SVM_AMMV3"===e?null!==(i=null===(o=Ou[t])||void 0===o?void 0:o.label)&&void 0!==i?i:"-":`${_r({input:new ie(null!=t?t:0).plus(null!=n?n:0).div(1e4),decimals:4})}%`}new f,new h;const Wp=({sx:e})=>{const t=y();return zt.jsx(x,{sx:Object.assign({py:4,px:8,color:t.palette.primary.main,borderRadius:4,backgroundColor:L(t.palette.primary.main,.1),typography:"h6"},e),children:o._({id:"m8r/Yx",message:"AMM V3"})})};function Vp({removed:e,inRange:t}){const n=y(),i={py:4,px:8,color:n.palette.success.main,borderRadius:4,backgroundColor:L(n.palette.success.main,.1),typography:"h6"};return e?zt.jsx(W,{title:o._({id:"MZPP7t",message:"Your position has 0 liquidity, and is not earning fees."}),children:zt.jsx(x,{sx:Object.assign(Object.assign({},i),{color:n.palette.warning.main,backgroundColor:L(n.palette.warning.main,.1)}),children:o._({id:"D87pha",message:"Closed"})})}):t?zt.jsx(W,{title:o._({id:"aIvv/z",message:"The price of this pool is within your selected range. Your position is currently earning fees."}),children:zt.jsx(x,{sx:i,children:o._({id:"vOyUlD",message:"In range"})})}):zt.jsx(W,{title:o._({id:"IwiTcw",message:"The price of this pool is outside of your selected range. Your position is not currently earning fees."}),children:zt.jsx(x,{sx:Object.assign(Object.assign({},i),{color:n.palette.error.main,backgroundColor:L(n.palette.error.main,.1)}),children:o._({id:"i3Z+/Z",message:"Out of range"})})})}function Fp({price:e,atLimit:t,direction:n}){return t[n]?n===Fu.LOWER?"0":"∞":"string"==typeof e&&"∞"===e?"∞":_r({input:e})}const Ap=({position:e,title:t,ticksAtLimit:o})=>{const{poolInfo:{mintA:i,mintB:r,feeRate:l,price:a},liquidity:s,amountA:d,amountB:c,tickLowerPrice:u,tickUpperPrice:p}=e,h=y(),[m,f]=_(i),g=K((()=>m.address===i.address?r:i),[m.address,i,r]),v=Q((()=>{f(g)}),[g]);return zt.jsxs(Hu,{gap:"md",children:[zt.jsxs(Yu,{children:[t?zt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:h.palette.text.secondary},children:t}):zt.jsx("div",{}),zt.jsx(Ip,{mintA:i,mintB:r,selectedMintIndex:0,handleRateToggle:v})]}),zt.jsxs(Yu,{children:[zt.jsxs(Bu,{sx:{width:"48%",py:12,gap:12},children:[zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:4},children:[zt.jsx(x,{sx:{color:h.palette.text.primary,typography:"body2"},children:zt.jsx(n,{id:"EQs1sJ",message:"Min price"})}),zt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:zt.jsx(n,{id:"7Z4WfS",message:"{0} per {1}",values:{0:g.symbol,1:m.symbol}})})]}),zt.jsx(x,{sx:{color:h.palette.text.primary,typography:"caption"},children:Fp({price:u,atLimit:o,direction:Fu.LOWER})}),zt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:zt.jsx(n,{id:"WgTuci",message:"Your position will be 100% composed of {0} at this price",values:{0:null==m?void 0:m.symbol}})})]}),zt.jsxs(Bu,{sx:{width:"48%",py:12,gap:12},children:[zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:4},children:[zt.jsx(x,{sx:{color:h.palette.text.primary,typography:"body2"},children:zt.jsx(n,{id:"5etEUX",message:"Max price"})}),zt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:zt.jsx(n,{id:"7Z4WfS",message:"{0} per {1}",values:{0:g.symbol,1:m.symbol}})})]}),zt.jsx(x,{sx:{color:h.palette.text.primary,typography:"caption"},children:Fp({price:p,atLimit:o,direction:Fu.UPPER})}),zt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:zt.jsx(n,{id:"WgTuci",message:"Your position will be 100% composed of {0} at this price",values:{0:null==g?void 0:g.symbol}})})]})]}),zt.jsxs(Bu,{sx:{py:12,flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[zt.jsxs(Hu,{gap:"4px",justify:"flex-start",children:[zt.jsx(x,{sx:{color:h.palette.text.primary,typography:"body2"},children:zt.jsx(n,{id:"DWd30U",message:"Current price"})}),zt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:zt.jsx(n,{id:"7Z4WfS",message:"{0} per {1}",values:{0:g.symbol,1:m.symbol}})})]}),zt.jsx(x,{sx:{color:h.palette.text.primary,typography:"caption"},children:_r({input:a})})]})]})},Zp=({position:e,title:t,inRange:o,ticksAtLimit:i})=>{Ar();const{poolInfo:{mintA:r,mintB:l,feeRate:a},liquidity:s,amountA:d,amountB:c}=e,p=s.isZero();return zt.jsxs(Hu,{gap:"md",style:{marginTop:"0.5rem"},children:[zt.jsxs(Yu,{style:{gap:4},children:[zt.jsxs(zu,{children:[zt.jsx(uu,{tokens:[{address:r.address},{address:l.address}],mr:8}),zt.jsxs(x,{sx:{typography:"h5"},children:[r.symbol," / ",l.symbol]})]}),zt.jsx(Wp,{sx:{ml:"auto"}}),zt.jsx(Vp,{removed:p,inRange:o})]}),zt.jsxs(Bu,{children:[zt.jsxs(Hu,{gap:"md",children:[zt.jsxs(Yu,{children:[zt.jsxs(zu,{children:[zt.jsx(Ss,{address:r.address,chainId:r.chainId,noShowChain:!0,width:32,height:32,marginRight:0}),zt.jsx(x,{sx:{ml:8},children:r.symbol})]}),zt.jsx(zu,{children:zt.jsx(x,{sx:{mr:8},children:_r({input:d,decimals:r.decimals})})})]}),zt.jsxs(Yu,{children:[zt.jsxs(zu,{children:[zt.jsx(Ss,{address:l.address,chainId:l.chainId,noShowChain:!0,width:32,height:32,marginRight:0}),zt.jsx(x,{ml:"8px",children:l.symbol})]}),zt.jsx(zu,{children:zt.jsx(x,{mr:"8px",children:_r({input:c,decimals:l.decimals})})})]})]}),zt.jsxs(Yu,{children:[zt.jsx(x,{children:zt.jsx(n,{id:"EU3wU4",message:"Fee tier"})}),zt.jsx(x,{children:Op({type:u,lpFeeRate:a,mtFeeRate:0})})]})]}),zt.jsx(Ap,{position:e,title:t,ticksAtLimit:i})]})},Pp=({position:e,outOfRange:t,ticksAtLimit:n,on:i,onClose:r,onConfirm:l,loading:a})=>{const{isMobile:s}=Rc();return zt.jsx(tc,{open:i,onClose:r,modal:!0,title:o._({id:"E6MqGy",message:"Add liquidity"}),height:683,children:zt.jsxs(x,{sx:{flex:1,px:20,pb:24,display:"flex",flexDirection:"column",justifyContent:"space-between",width:s?void 0:420},children:[zt.jsx(x,{sx:{pt:0,px:0},children:e?zt.jsx(Zp,{position:e,inRange:!t,ticksAtLimit:n,title:o._({id:"3VUfrF",message:"Selected Range"})}):null}),zt.jsx(b,{size:b.Size.big,fullWidth:!0,isLoading:a,sx:{mt:20},onClick:l,children:o._({id:"m16xKo",message:"Add"})})]})})};var Bp;function Np(){return Np=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},Np.apply(null,arguments)}const Up=e=>q.createElement("svg",Np({width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),Bp||(Bp=q.createElement("g",{id:"ICON/18px/arrow/\\xE6\\x94\\xB6\\xE8\\xB5\\xB7/Dark"},q.createElement("path",{id:"\\xE4\\xB8\\x89\\xE8\\xA7\\x92\\xE5\\xBD\\xA2",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"}))));function Hp({token:e,oppositeTokenAddress:t,dispatch:n,tokenSelectOnChange:i}){const r=y(),{chainId:l}=Ar(),[a,s]=_(!1);return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{component:M,sx:{flexBasis:"100%",flexGrow:1,flexShrink:1,display:"flex",alignItems:"center",px:20,py:8,borderRadius:12,borderWidth:1,borderStyle:"solid",borderColor:e?r.palette.border.main:r.palette.primary.main,color:e?r.palette.text.primary:r.palette.primary.contrastText,backgroundColor:e?"transparent":r.palette.primary.main,"&:hover":{borderColor:e?r.palette.border.main:r.palette.primary.main},[r.breakpoints.up("tablet")]:{flexBasis:"50%"}},onClick:()=>{s(!0)},children:[e?zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8},children:[zt.jsx(Ss,{address:e.address,marginRight:0,width:24,height:24,chainId:e.chainId||l,noShowChain:!0,sx:{flexShrink:0}}),zt.jsx(x,{sx:{typography:"h5",fontWeight:600,lineHeight:"32px",flexShrink:0},children:e.symbol})]}):zt.jsx(x,{sx:{typography:"h5",fontWeight:600,lineHeight:"32px",flexShrink:0},children:o._({id:"0RrIzN",message:"Select token"})}),zt.jsx(x,{component:Up,sx:{flexShrink:0,ml:"auto",width:18,height:18}})]}),zt.jsx(Ac,{value:e,open:a,chainId:l,occupiedAddrs:[t],occupiedChainId:null==e?void 0:e.chainId,onClose:()=>{s(!1)},onTokenChange:(e,t)=>{if(!Array.isArray(e)){if(t)return n({type:Eu.UpdateMint1AndClearMint2,payload:e}),void s(!1);i(e),s(!1)}},modal:!0})]})}const Dp=({mint1:e,mint2:t,dispatch:n})=>{var o,i;const r=y();return zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap",[r.breakpoints.up("tablet")]:{flexWrap:"nowrap"}},children:[zt.jsx(Hp,{token:e,oppositeTokenAddress:null!==(o=null==t?void 0:t.address)&&void 0!==o?o:"",dispatch:n,tokenSelectOnChange:e=>{n({type:Eu.UpdateMint1,payload:e})}}),zt.jsx(Hp,{token:t,oppositeTokenAddress:null!==(i=null==e?void 0:e.address)&&void 0!==i?i:"",dispatch:n,tokenSelectOnChange:e=>{n({type:Eu.UpdateMint2,payload:e})}})]})};function Yp({mint:e,chainId:t,symbol:n}){const{fetchTokenInfo:o}=fl();return we({queryKey:["token","info",t,e],queryFn:()=>Lr(this,void 0,void 0,(function*(){return yield o({mint:e,chainId:t,symbol:n})})),enabled:!!e}).data}function zp(e,t){Et(Number.isInteger(e)&&Number.isInteger(t),"INTEGERS"),Et(t>0,"TICK_SPACING"),Et(e>=qe&&e<=Ge,"TICK_BOUND");const n=Math.round(e/t)*t;return n<qe?n+t:n>Ge?n-t:n}function Xp({price:e,feeAmount:t,mintDecimalsA:n,mintDecimalsB:o,baseIn:i}){const r=new yt(e.toString()),l=i?r:new yt(1).div(r),a=_e.getTickWithPriceAndTickspacing(l,Lu[t],n,o),s=ze.getSqrtPriceX64FromTick(a),d=ze.sqrtPriceX64ToPrice(s,n,o);return i?{tick:a,price:d}:{tick:a,price:new yt(1).div(d)}}const qp=[i.MAINNET,i.ARBITRUM_ONE,i.SEPOLIA,i.TAIKO],Gp={v3CoreFactoryAddress:"0x3d2A7Bac4E8439ABe86B58324695e921a5FC0987",nonfungiblePositionManagerAddress:"0x483E5c0f309577f79b0a19cE65E332DD388aD7A8"},_p=Object.assign({},Gp),Jp=Object.assign({},Gp),Qp={v3CoreFactoryAddress:"0x3d2A7Bac4E8439ABe86B58324695e921a5FC0987",nonfungiblePositionManagerAddress:"0x483E5c0f309577f79b0a19cE65E332DD388aD7A8"},Kp={[i.MAINNET]:_p,[i.ARBITRUM_ONE]:Jp,[i.SEPOLIA]:Qp,[i.TAIKO]:Qp};var $p,eh;Object.assign({},qp.reduce(((e,t)=>(e[t]=Kp[t].v3CoreFactoryAddress,e)),{})),Object.assign({},qp.reduce(((e,t)=>{const n=Kp[t].nonfungiblePositionManagerAddress;return n&&(e[t]=n),e}),{})),function(e){e[e.EXACT_INPUT=0]="EXACT_INPUT",e[e.EXACT_OUTPUT=1]="EXACT_OUTPUT"}($p||($p={})),function(e){e[e.ROUND_DOWN=0]="ROUND_DOWN",e[e.ROUND_HALF_UP=1]="ROUND_HALF_UP",e[e.ROUND_UP=2]="ROUND_UP"}(eh||(eh={})),Mt.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const th={[eh.ROUND_DOWN]:ie.ROUND_DOWN,[eh.ROUND_HALF_UP]:ie.ROUND_HALF_UP,[eh.ROUND_UP]:ie.ROUND_UP},nh={[eh.ROUND_DOWN]:ie.ROUND_DOWN,[eh.ROUND_HALF_UP]:ie.ROUND_HALF_UP,[eh.ROUND_UP]:ie.ROUND_UP};class oh{constructor(e,t=Mt.BigInt(1)){this.numerator=Mt.BigInt(e),this.denominator=Mt.BigInt(t)}static tryParseFraction(e){if(e instanceof Mt||"number"==typeof e||"string"==typeof e)return new oh(e);if("numerator"in e&&"denominator"in e)return e;throw new Error("Could not parse fraction")}get quotient(){return Mt.divide(this.numerator,this.denominator)}get remainder(){return new oh(Mt.remainder(this.numerator,this.denominator),this.denominator)}invert(){return new oh(this.denominator,this.numerator)}add(e){const t=oh.tryParseFraction(e);return Mt.equal(this.denominator,t.denominator)?new oh(Mt.add(this.numerator,t.numerator),this.denominator):new oh(Mt.add(Mt.multiply(this.numerator,t.denominator),Mt.multiply(t.numerator,this.denominator)),Mt.multiply(this.denominator,t.denominator))}subtract(e){const t=oh.tryParseFraction(e);return Mt.equal(this.denominator,t.denominator)?new oh(Mt.subtract(this.numerator,t.numerator),this.denominator):new oh(Mt.subtract(Mt.multiply(this.numerator,t.denominator),Mt.multiply(t.numerator,this.denominator)),Mt.multiply(this.denominator,t.denominator))}lessThan(e){const t=oh.tryParseFraction(e);return Mt.lessThan(Mt.multiply(this.numerator,t.denominator),Mt.multiply(t.numerator,this.denominator))}equalTo(e){const t=oh.tryParseFraction(e);return Mt.equal(Mt.multiply(this.numerator,t.denominator),Mt.multiply(t.numerator,this.denominator))}greaterThan(e){const t=oh.tryParseFraction(e);return Mt.greaterThan(Mt.multiply(this.numerator,t.denominator),Mt.multiply(t.numerator,this.denominator))}multiply(e){const t=oh.tryParseFraction(e);return new oh(Mt.multiply(this.numerator,t.numerator),Mt.multiply(this.denominator,t.denominator))}divide(e){const t=oh.tryParseFraction(e);return new oh(Mt.multiply(this.numerator,t.denominator),Mt.multiply(this.denominator,t.numerator))}toSignificant(e,t={decimalSeparator:".",groupSeparator:"",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:"",fractionGroupSize:0},n=eh.ROUND_HALF_UP){Et(Number.isInteger(e),`${e} is not an integer.`),Et(e>0,`${e} is not positive.`);const o=th[n],i=new ie(this.numerator.toString()).div(this.denominator.toString()).precision(e,o);return i.toFormat(i.decimalPlaces(),o,t)}toFixed(e,t={decimalSeparator:".",groupSeparator:"",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:"",fractionGroupSize:0},n=eh.ROUND_HALF_UP){Et(Number.isInteger(e),`${e} is not an integer.`),Et(e>=0,`${e} is negative.`);const o=nh[n];return new ie(this.numerator.toString()).decimalPlaces(e,o).div(this.denominator.toString()).toFormat(e,o,t)}get asFraction(){return new oh(this.numerator,this.denominator)}}const ih=new oh(Mt.BigInt(100));function rh(e){return new lh(e.numerator,e.denominator)}class lh extends oh{constructor(){super(...arguments),this.isPercent=!0}add(e){return rh(super.add(e))}subtract(e){return rh(super.subtract(e))}multiply(e){return rh(super.multiply(e))}divide(e){return rh(super.divide(e))}toSignificant(e=5,t,n){return super.multiply(ih).toSignificant(e,t,n)}toFixed(e=2,t,n){return super.multiply(ih).toFixed(e,t,n)}}function ah(e){const t=new ie(e);if(t.isFinite())return t}Mt.BigInt(Number.MAX_SAFE_INTEGER),Mt.BigInt(0),Mt.BigInt(1),Mt.BigInt(2),Mt.BigInt(0);new lh(Mt.BigInt(1),1e4),new lh(1,100),new lh(3,100),new lh(5,100),new lh(10,100),new lh(15,100);const sh=new lh(0);function dh({mint:e}){const{fetchTokenBalance:t}=fl();return we({queryKey:["token","balance",null==e?void 0:e.toString()],queryFn:()=>Lr(this,void 0,void 0,(function*(){if(!e)return;return(yield t(e.toString())).amount})),enabled:!!e}).data}function ch({state:e,existingPosition:t,slipperValue:n}){const{account:i,chainId:r}=Ar(),l=Ws(),{feeAmount:a,selectedMintIndex:s,independentField:d,typedValue:c,leftRangeTypedValue:u,rightRangeTypedValue:p,startPriceTypedValue:h}=e,{mint1:m,mint2:f}=e,[g,x]=K((()=>m&&f?new gt(new Te(m.address).toBuffer()).gt(new gt(new Te(f.address).toBuffer()))?[f,m]:[m,f]:[void 0,void 0]),[m,f]),y=d===Vu.DEPOSIT_1?Vu.DEPOSIT_2:Vu.DEPOSIT_1,[v,b]=K((()=>g&&x?0==s?[g,x]:[x,g]:[void 0,void 0]),[g,x,s]),j=dh({mint:null==v?void 0:v.address}),w=dh({mint:null==b?void 0:b.address}),C=K((()=>({[Vu.DEPOSIT_1]:j,[Vu.DEPOSIT_2]:w})),[j,w]),[k,R,S]=fp(null==m?void 0:m.address,null==f?void 0:f.address,a,r),I=k===hp.NOT_EXISTS,E=K((()=>{if(!x)return;if(I){const e=ah(h);if(!e)return;return 0===s?e:new ie(1).div(e).dp(x.decimals,ie.ROUND_UP)}if(!R||null==R.poolInfo.price)return;return new ie(R.poolInfo.price)}),[x,I,R,h,s]),M=K((()=>{if(!E||null==(null==g?void 0:g.decimals)||null==(null==x?void 0:x.decimals))return!0;const e=ze.priceToSqrtPriceX64(new yt(E.toString()),null==g?void 0:g.decimals,null==x?void 0:x.decimals);return!(e&&!e.gt(Je)&&!e.lt(Qe))}),[E,g,x]),T=K((()=>{if(g&&x){if(R){return Object.assign(Object.assign({},R.poolInfo),{mintA:Object.assign(Object.assign({},R.poolInfo.mintA),{chainId:g.chainId,symbol:g.symbol}),mintB:Object.assign(Object.assign({},R.poolInfo.mintB),{chainId:x.chainId,symbol:x.symbol}),tickCurrent:R.computePoolInfo.tickCurrent})}if(a&&E&&!M&&S){const e=ml[r];if(!e)throw new Error("Invalid config");const t=e.config.find((e=>e.tradeFeeRate===a));if(!t)throw new Error("Invalid fee");const{tick:n}=Xp({mintDecimalsA:g.decimals,mintDecimalsB:x.decimals,feeAmount:a,price:E,baseIn:0===s});if(null==n)throw new Error("Invalid tick");return{type:"Concentrated",config:t,programId:e.programId.toBase58(),id:S,mintA:Object.assign(Object.assign({},Ke({address:g.address,decimals:g.decimals,programId:Ee.toBase58(),extensions:{feeConfig:void 0}})),{chainId:g.chainId,symbol:g.symbol}),mintB:Object.assign(Object.assign({},Ke({address:x.address,decimals:x.decimals,programId:Ee.toBase58(),extensions:{feeConfig:void 0}})),{chainId:x.chainId,symbol:x.symbol}),rewardDefaultInfos:[],rewardDefaultPoolInfos:"Clmm",price:E.toNumber(),tickCurrent:n,mintAmountA:0,mintAmountB:0,feeRate:t.tradeFeeRate,openTime:"",tvl:0,day:{volume:0,volumeQuote:0,volumeFee:0,feeApr:0,rewardApr:[0],apr:0,priceMax:0,priceMin:0},week:{volume:0,volumeQuote:0,volumeFee:0,feeApr:0,rewardApr:[0],apr:0,priceMax:0,priceMin:0},month:{volume:0,volumeQuote:0,volumeFee:0,feeApr:0,rewardApr:[0],apr:0,priceMax:0,priceMin:0},pooltype:[],farmUpcomingCount:0,farmOngoingCount:0,farmFinishedCount:0,burnPercent:0}}}}),[r,a,M,g,x,R,S,E,s]),L=K((()=>({[Fu.LOWER]:a?zp(qe,Lu[a]):void 0,[Fu.UPPER]:a?zp(Ge,Lu[a]):void 0})),[a]),O=K((()=>{if(t&&t.tickLower&&"number"==typeof(null==t?void 0:t.tickLower)&&t.tickUpper&&"number"==typeof(null==t?void 0:t.tickUpper))return{[Fu.LOWER]:t.tickLower,[Fu.UPPER]:t.tickUpper};if(!g||!x||!a)return{[Fu.LOWER]:void 0,[Fu.UPPER]:void 0};const e="boolean"==typeof u?void 0:ah(u),n="boolean"==typeof p?void 0:ah(p),o=0===s;return{[Fu.LOWER]:"boolean"==typeof u?L[Fu.LOWER]:e?Xp({mintDecimalsA:g.decimals,mintDecimalsB:x.decimals,feeAmount:a,price:e,baseIn:o}).tick:void 0,[Fu.UPPER]:"boolean"==typeof p?L[Fu.UPPER]:n?Xp({mintDecimalsA:g.decimals,mintDecimalsB:x.decimals,feeAmount:a,price:n,baseIn:o}).tick:void 0}}),[t,a,u,g,x,p,s,L]),{[Fu.LOWER]:W,[Fu.UPPER]:V}=O,F=K((()=>({[Fu.LOWER]:a&&W===L.LOWER,[Fu.UPPER]:a&&V===L.UPPER})),[L,W,V,a]),A=Boolean("number"==typeof W&&"number"==typeof V&&W>=V),Z=K((()=>({[Fu.LOWER]:pp({tick:L.LOWER,decimalsA:null==g?void 0:g.decimals,decimalsB:null==x?void 0:x.decimals}),[Fu.UPPER]:pp({tick:L.UPPER,decimalsA:null==g?void 0:g.decimals,decimalsB:null==x?void 0:x.decimals})})),[null==g?void 0:g.decimals,null==x?void 0:x.decimals,L.LOWER,L.UPPER]),P=K((()=>({[Fu.LOWER]:pp({tick:O[Fu.LOWER],decimalsA:null==g?void 0:g.decimals,decimalsB:null==x?void 0:x.decimals}),[Fu.UPPER]:pp({tick:O[Fu.UPPER],decimalsA:null==g?void 0:g.decimals,decimalsB:null==x?void 0:x.decimals})})),[null==g?void 0:g.decimals,null==x?void 0:x.decimals,O]),{[Fu.LOWER]:B,[Fu.UPPER]:N}=P,U=Boolean(!A&&E&&B&&N&&(E.lt(B)||E.gt(N))),H=K((()=>ah(c)),[c]),[D,Y]=_(void 0);J((()=>{let e=!0;return function(){Lr(this,void 0,void 0,(function*(){try{if(!l||!T||null==W||null==V)return;const t=yield l.fetchEpochInfo(),o=yield $e.getLiquidityAmountOutFromAmountIn({poolInfo:T,slippage:n,inputA:!0,tickLower:Math.min(W,V),tickUpper:Math.max(W,V),amount:new gt(new yt(c||"0").mul(10**T.mintA.decimals).toFixed(0)),add:!0,amountHasFee:!0,epochInfo:t});if(e){if(!o.amountSlippageB.amount)return;Y(new ie(o.amountSlippageB.amount.toString()).div(new ie(10**T.mintB.decimals)).dp(T.mintB.decimals,ie.ROUND_UP))}}catch(e){console.error("error",e)}}))}(),()=>{e=!1}}),[T,l,n,W,V,c]);const z=K((()=>({[Vu.DEPOSIT_1]:d===Vu.DEPOSIT_1?H:D,[Vu.DEPOSIT_2]:d===Vu.DEPOSIT_1?D:H})),[D,H,d]),X=Boolean("number"==typeof V&&(null==T?void 0:T.tickCurrent)&&T.tickCurrent>=V),q=Boolean("number"==typeof W&&(null==T?void 0:T.tickCurrent)&&T.tickCurrent<=W),G=A||Boolean(X&&T&&m&&new Te(T.mintA.address).equals(new Te(m.address))||q&&T&&f&&new Te(T.mintA.address).equals(new Te(f.address))),Q=A||Boolean(X&&T&&f&&new Te(T.mintA.address).equals(new Te(f.address))||q&&T&&m&&new Te(T.mintB.address).equals(new Te(m.address))),{inputTax:$,outputTax:ee}=function(){const[{inputTax:e,outputTax:t},n]=_({inputTax:sh,outputTax:sh});return{inputTax:e,outputTax:t}}(),[te,ne]=_();let oe;J((()=>{let e=!0;return function(){Lr(this,void 0,void 0,(function*(){try{if(!l||!T||null==W||null==V)return;const t=yield l.fetchEpochInfo(),o=yield $e.getLiquidityAmountOutFromAmountIn({poolInfo:T,slippage:n,inputA:!0,tickLower:Math.min(W,V),tickUpper:Math.max(W,V),amount:new gt(new yt(c||"0").mul(10**T.mintA.decimals).toFixed(0)),add:!0,amountHasFee:!0,epochInfo:t});e&&ne({poolInfo:T,tickLower:W,tickUpper:V,tickLowerPrice:B,tickUpperPrice:N,liquidity:new ie(o.liquidity.toString()),amountA:new ie(o.amountSlippageA.amount.toString()).div(new ie(10**T.mintA.decimals)).dp(T.mintA.decimals,ie.ROUND_UP),amountB:new ie(o.amountSlippageB.amount.toString()).div(new ie(10**T.mintB.decimals)).dp(T.mintB.decimals,ie.ROUND_UP)})}catch(e){console.error("error",e)}}))}(),()=>{e=!1}}),[B,T,P,l,n,W,V,c,N]),i||(oe=o._({id:"r7ScnQ",message:"Connect to a wallet"})),k===hp.INVALID&&(oe=null!=oe?oe:o._({id:"R7D79P",message:"Invalid pair"})),M&&(oe=null!=oe?oe:o._({id:"HXBqgG",message:"Invalid price input"})),(z[Vu.DEPOSIT_1]||G)&&(z[Vu.DEPOSIT_2]||Q)||(oe=null!=oe?oe:o._({id:"iPMIoT",message:"Enter an amount"}));const{[Vu.DEPOSIT_1]:re,[Vu.DEPOSIT_2]:le}=z;re&&(null==j?void 0:j.lt(re))&&(oe=o._({id:"m6RmA/",message:"Insufficient {0} balance",values:{0:null==v?void 0:v.symbol}})),le&&(null==w?void 0:w.lt(le))&&(oe=o._({id:"m6RmA/",message:"Insufficient {0} balance",values:{0:null==b?void 0:b.symbol}}));const ae=$.greaterThan(0)||ee.greaterThan(0),se=k===hp.INVALID||ae;return{mintA:g,mintB:x,dependentField:y,mints:{[Vu.DEPOSIT_1]:v,[Vu.DEPOSIT_2]:b},poolInfo:T,poolState:k,depositBalances:C,parsedAmounts:z,ticks:O,price:E,pricesAtTicks:P,pricesAtLimit:Z,position:te,poolIsNoExisted:I,errorMessage:oe,invalidPool:se,invalidRange:A,outOfRange:U,depositADisabled:G,depositBDisabled:Q,ticksAtLimit:F,isTaxed:ae,poolKeys:I||null==R?void 0:R.poolKeys}}function uh({dispatch:e}){return{onField1Input:Q((t=>{e({type:Eu.typeInput,payload:{field:Vu.DEPOSIT_1,typedValue:t}})}),[e]),onField2Input:Q((t=>{e({type:Eu.typeInput,payload:{field:Vu.DEPOSIT_2,typedValue:t}})}),[e]),onLeftRangeInput:Q((t=>{e({type:Eu.typeLeftRangeInput,payload:{typedValue:t}})}),[e]),onRightRangeInput:Q((t=>{e({type:Eu.typeRightRangeInput,payload:{typedValue:t}})}),[e]),onStartPriceInput:Q((t=>{e({type:Eu.typeStartPriceInput,payload:{typedValue:t}})}),[e])}}new lh(1);const ph=new ie(.01);function hh(e){if(e)return e.gt(ph)?e.minus(ph):new ie(0)}const mh=Buffer.from("support_mint","utf8");function fh(e,t){return ot([mh,t.toBuffer()],e)}function gh({params:e,handleGoBack:t,handleGoToPoolList:n}){var i,r,l,a,s,d;const{chainId:c,account:p}=Ar(),h=Ws(),m=y(),f=Cl(),{isMobile:g}=Rc(),v=Yp({mint:null==e?void 0:e.mint1,chainId:c}),j=Yp({mint:null==e?void 0:e.mint2,chainId:c}),[w,C]=oe(Tu,{mint1:v,mint2:j,feeAmount:(null==e?void 0:e.fee)?Number(null==e?void 0:e.fee):void 0,selectedMintIndex:0,independentField:Vu.DEPOSIT_1,typedValue:"",startPriceTypedValue:"1",leftRangeTypedValue:"",rightRangeTypedValue:""});J((()=>{v&&C({type:Eu.UpdateDefaultMint1,payload:v})}),[v]),J((()=>{j&&C({type:Eu.UpdateDefaultMint2,payload:j})}),[j]);const{independentField:k,typedValue:R,startPriceTypedValue:S}=w,{slipper:I,setSlipper:E,slipperValue:T,resetSlipper:O}=wu({type:u}),{mintA:W,mintB:V,poolInfo:F,poolKeys:A,ticks:Z,dependentField:P,price:B,pricesAtTicks:N,pricesAtLimit:U,parsedAmounts:H,depositBalances:D,position:Y,poolIsNoExisted:z,mints:X,errorMessage:q,invalidPool:G,invalidRange:K,outOfRange:$,depositADisabled:ee,depositBDisabled:te,ticksAtLimit:ne}=ch({state:w,slipperValue:T,existingPosition:void 0}),{onField1Input:re,onField2Input:le,onLeftRangeInput:ae,onRightRangeInput:se,onStartPriceInput:de}=uh({dispatch:C}),ce=!q&&!K,[ue,pe]=_(!1),he={[k]:R,[P]:null!==(r=null===(i=H[P])||void 0===i?void 0:i.toString())&&void 0!==r?r:""},me=[Vu.DEPOSIT_1,Vu.DEPOSIT_2].reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:hh(D[t])})),{}),{[Fu.LOWER]:fe,[Fu.UPPER]:ge}=Z,{[Fu.LOWER]:xe,[Fu.UPPER]:ye}=N,{getDecrementLower:ve,getIncrementLower:be,getDecrementUpper:je,getIncrementUpper:we,getSetFullRange:ke}=function({tickLower:e,tickUpper:t,poolInfo:n,state:o,dispatch:i}){var r,l;const{feeAmount:a}=o,s=null===(r=null==n?void 0:n.mintA)||void 0===r?void 0:r.decimals,d=null===(l=null==n?void 0:n.mintB)||void 0===l?void 0:l.decimals;return{getDecrementLower:Q((()=>{if(!a)return"";const t="number"==typeof e?e:null==n?void 0:n.tickCurrent;if(!t)return"";const o=pp({decimalsA:s,decimalsB:d,tick:t-Lu[a]});return o?o.dp(5,ie.ROUND_UP).toString():""}),[s,d,a,null==n?void 0:n.tickCurrent,e]),getIncrementLower:Q((()=>{if(!a)return"";const t="number"==typeof e?e:null==n?void 0:n.tickCurrent;if(!t)return"";const o=pp({decimalsA:s,decimalsB:d,tick:t+Lu[a]});return o?o.dp(5,ie.ROUND_UP).toString():""}),[s,d,a,null==n?void 0:n.tickCurrent,e]),getDecrementUpper:Q((()=>{if(!a)return"";const e="number"==typeof t?t:null==n?void 0:n.tickCurrent;if(!e)return"";const o=pp({decimalsA:s,decimalsB:d,tick:e-Lu[a]});return o?o.dp(5,ie.ROUND_UP).toString():""}),[s,d,a,null==n?void 0:n.tickCurrent,t]),getIncrementUpper:Q((()=>{if(!a)return"";const e="number"==typeof t?t:null==n?void 0:n.tickCurrent;if(!e)return"";const o=pp({decimalsA:s,decimalsB:d,tick:e+Lu[a]});return o?o.dp(5,ie.ROUND_UP).toString():""}),[s,d,a,null==n?void 0:n.tickCurrent,t]),getSetFullRange:Q((()=>{i({type:Eu.setFullRange,payload:void 0})}),[i])}}({tickLower:fe,tickUpper:ge,poolInfo:F,state:w,dispatch:C}),Re=Q((()=>{ke()}),[ke,ae,se,U]),Se=Ce({mutationFn:()=>Lr(this,void 0,void 0,(function*(){if(!p||!c)return;if(!F)throw new Error("poolInfo is undefined");if(!B)throw new Error("price is undefined");if(!h)throw new Error("raydium is undefined");const e=ml[c];if(!e)throw new Error("Invalid config");const n=h.clmm;h.clmm.scope.checkOwner();const i=new it({connection:n.scope.connection,feePayer:n.scope.ownerPubKey,cluster:n.scope.cluster,owner:n.scope.owner,blockhashCommitment:n.scope.blockhashCommitment,loopMultiTxStatus:n.scope.loopMultiTxStatus,api:n.scope.api,signAllTransactions:n.scope.signAllTransactions}),r=z?yield function(e){return Lr(this,void 0,void 0,(function*(){var t;const{programId:n,mint1:o,mint2:i,ammConfig:r,initialPrice:l,computeBudgetConfig:a,forerunCreate:s,getObserveState:d,txVersion:c,txTipConfig:u,feePayer:p,clmm:h,txBuilder:m}=e,f=(null===(t=h.scope.owner)||void 0===t?void 0:t.publicKey)||Te.default,[g,x,y]=new gt(new Te(o.address).toBuffer()).gt(new gt(new Te(i.address).toBuffer()))?[i,o,new yt(1).div(l)]:[o,i,l],v=ze.priceToSqrtPriceX64(y,g.decimals,x.decimals),b=[],j=[];g.programId===Me.toBase58()&&j.push(fh(n,new Te(g.address)).publicKey),x.programId===Me.toBase58()&&j.push(fh(n,new Te(x.address)).publicKey),(yield h.scope.connection.getMultipleAccountsInfo(j)).forEach(((e,t)=>{e&&b.push(j[t])}));const w=yield et.createPoolInstructions({connection:h.scope.connection,programId:n,owner:f,mintA:g,mintB:x,ammConfigId:r.id,initialPriceX64:v,forerunCreate:!d&&s,extendMintAccount:b});return m.addInstruction(w),{address:Object.assign(Object.assign({},w.address),{observationId:w.address.observationId.toBase58(),exBitmapAccount:w.address.exBitmapAccount.toBase58(),programId:n.toString(),id:w.address.poolId.toString(),mintA:g,mintB:x,openTime:"0",vault:{A:w.address.mintAVault.toString(),B:w.address.mintBVault.toString()},rewardInfos:[],config:{id:r.id.toString(),index:r.index,protocolFeeRate:r.protocolFeeRate,tradeFeeRate:r.tradeFeeRate,tickSpacing:r.tickSpacing,fundFeeRate:r.fundFeeRate,description:r.description,defaultRange:0,defaultRangePoint:[]}}),mockPoolInfo:Object.assign({type:"Concentrated",rewardDefaultPoolInfos:"Clmm",id:w.address.poolId.toString(),mintA:g,mintB:x,feeRate:r.tradeFeeRate,openTime:"0",programId:n.toString(),price:y.toNumber(),config:{id:r.id.toString(),index:r.index,protocolFeeRate:r.protocolFeeRate,tradeFeeRate:r.tradeFeeRate,tickSpacing:r.tickSpacing,fundFeeRate:r.fundFeeRate,description:r.description,defaultRange:0,defaultRangePoint:[]},burnPercent:0},tt),forerunCreate:s}}))}({programId:e.programId,mint1:F.mintA,mint2:F.mintB,ammConfig:Object.assign(Object.assign({},F.config),{id:new Te(F.config.id),fundOwner:"",description:""}),initialPrice:new yt(B.toString()),clmm:n,txBuilder:i}):void 0;if(!Y)throw new Error("position is undefined");const l=yield function(e){return Lr(this,arguments,void 0,(function*({poolInfo:e,poolKeys:t,ownerInfo:n,tickLower:o,tickUpper:i,base:r,baseAmount:l,otherAmountMax:a,nft2022:s,associatedOnly:d=!0,checkCreateATAOwner:c=!1,withMetadata:u="create",getEphemeralSigners:p,computeBudgetConfig:h,txTipConfig:m,txVersion:f,feePayer:g,clmm:x,txBuilder:y}){!1===x.scope.availability.addConcentratedPosition&&x.logAndCreateError("add position feature disabled in your region");let v=null,b=null;const j=n.useSOLBalance&&e.mintA.address===nt.toString(),w=n.useSOLBalance&&e.mintB.address===nt.toString(),[C,k]="MintA"===r?[l,a]:[a,l],{account:R,instructionParams:S}=yield x.scope.account.getOrCreateTokenAccount({tokenProgram:e.mintA.programId,mint:new Te(e.mintA.address),owner:x.scope.ownerPubKey,createInfo:j||C.isZero()?{payer:x.scope.ownerPubKey,amount:C}:void 0,skipCloseAccount:!j,notUseTokenAccount:j,associatedOnly:!j&&d,checkCreateATAOwner:c});R&&(v=R),y.addInstruction(S||{});const{account:I,instructionParams:E}=yield x.scope.account.getOrCreateTokenAccount({tokenProgram:e.mintB.programId,mint:new Te(e.mintB.address),owner:x.scope.ownerPubKey,createInfo:w||k.isZero()?{payer:x.scope.ownerPubKey,amount:k}:void 0,skipCloseAccount:!w,notUseTokenAccount:w,associatedOnly:!w&&d,checkCreateATAOwner:c});I&&(b=I),y.addInstruction(E||{}),v&&b||x.logAndCreateError("cannot found target token accounts","tokenAccounts",{ownerTokenAccountA:null==v?void 0:v.toBase58(),ownerTokenAccountB:null==b?void 0:b.toBase58()});const M=t||(yield x.getClmmPoolKeys(e.id)),T=yield et.openPositionFromBaseInstructions({poolInfo:e,poolKeys:M,ownerInfo:Object.assign(Object.assign({},n),{feePayer:x.scope.ownerPubKey,wallet:x.scope.ownerPubKey,tokenAccountA:v,tokenAccountB:b}),tickLower:o,tickUpper:i,base:r,baseAmount:l,otherAmountMax:a,withMetadata:u,getEphemeralSigners:p,nft2022:s});return y.addInstruction(T),Object.assign({},T.address)}))}({poolInfo:F,poolKeys:null!=A?A:null==r?void 0:r.address,tickUpper:Math.max(Y.tickLower,Y.tickUpper),tickLower:Math.min(Y.tickLower,Y.tickUpper),base:"MintA",ownerInfo:{useSOLBalance:!0},baseAmount:new gt(new yt(R||"0").mul(10**F.mintA.decimals).toFixed(0)),otherAmountMax:new gt(Y.amountB.multipliedBy(new ie(10**F.mintB.decimals)).toFixed(0)),clmm:n,txBuilder:i});i.addCustomComputeBudget({units:6e5,microLamports:1e3});const{transaction:a,signers:s}=yield i.versionBuild({txVersion:Ue.LEGACY,extInfo:l});const d=yield f.executeCustom({brief:z?o._({id:"8OiU8L",message:"Pool Creation"}):o._({id:"OBdohg",message:"Add Liquidity"}),metadata:{[z?Pr.createAMMV3Pool:Pr.addAMMV3Pool]:!0},handler:e=>Lr(this,void 0,void 0,(function*(){const{txId:t}=yield function(){return Lr(this,void 0,void 0,(function*(){var e,t,o;if(!h)throw new Error("raydium is undefined");const i=yield rt(h.connection,h.blockhashCommitment);a.recentBlockhash=i,s.length&&a.sign(...s),lt([a]);const r=yield null===(t=(e=n.scope).signAllTransactions)||void 0===t?void 0:t.call(e,[a]);if(s.length)for(const e of r);const l=null===(o=null==r?void 0:r[0])||void 0===o?void 0:o.serialize();if(!l)throw new Error("rawTransaction is undefined");return{txId:yield n.scope.connection.sendRawTransaction(l,{skipPreflight:!0}),signedTx:null==r?void 0:r[0]}}))}();e.onSuccess(t)})),successBack:()=>{t()},submittedBack:()=>{t()}});return d})),onError:e=>{console.error(e)}}),Ie=W&&V?0===w.selectedMintIndex?`${null==V?void 0:V.symbol} per ${null==W?void 0:W.symbol}`:`${null==W?void 0:W.symbol} per ${null==V?void 0:V.symbol}`:"-";return zt.jsx(Xc,{children:zt.jsxs(x,{sx:{mx:"auto",borderRadius:g?0:16,backgroundColor:"background.paper",width:g?"100%":600,display:"flex",flexDirection:"column",alignItems:"stretch"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",px:20,py:24,borderTopLeftRadius:16,borderTopRightRadius:16,backgroundColor:m.palette.background.paper},children:[zt.jsx(x,{component:M,onClick:t,sx:{flexGrow:0,flexShrink:0,display:"flex",alignItems:"center",color:m.palette.text.primary,width:24,height:24},children:zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:zt.jsx("path",{d:"M20 11.5H7.83L13.42 5.91L12 4.5L4 12.5L12 20.5L13.41 19.09L7.83 13.5H20V11.5Z",fill:"currentColor"})})}),zt.jsx(x,{sx:{flexGrow:1,textAlign:"center",typography:"caption",color:m.palette.text.primary},children:o._({id:"E6MqGy",message:"Add liquidity"})}),zt.jsx(x,{sx:{flexGrow:0,flexShrink:0,width:24,height:24}})]}),zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:20,p:20},children:[zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:12},children:[zt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:o._({id:"nxRg31",message:"Select pair"})}),zt.jsx(Dp,{mint1:w.mint1,mint2:w.mint2,dispatch:C}),zt.jsx(Wu,{disabled:!w.mint1||!w.mint2,feeAmount:w.feeAmount,dispatch:C})]}),zt.jsxs(Xu,{disabled:!w.feeAmount||G,children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[zt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:o._({id:"5CZbyC",message:"Set price range"})}),W&&V&&zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8,width:"100%",[m.breakpoints.up("tablet")]:{ml:"auto",width:"auto"}},children:[zt.jsx(b,{size:b.Size.small,variant:b.Variant.outlined,onClick:Re,sx:Object.assign({py:4,px:12,height:26,typography:"h6",fontWeight:600},g?{flexGrow:0,flexShrink:1,flexBasis:"50%"}:void 0),children:o._({id:"5IHTSS",message:"Full range"})}),zt.jsx(Ip,{mintA:W,mintB:V,selectedMintIndex:w.selectedMintIndex,handleRateToggle:()=>{C({type:Eu.UpdateSelectedMintIndex,payload:0===w.selectedMintIndex?1:0})},sx:g?{flexGrow:0,flexShrink:1,flexBasis:"50%"}:void 0})]})]}),zt.jsx(Sp,{priceLower:xe,priceUpper:ye,getDecrementLower:ve,getIncrementLower:be,getDecrementUpper:je,getIncrementUpper:we,onLeftRangeInput:ae,onRightRangeInput:se,ticksAtLimit:ne,perPriceText:Ie}),$&&zt.jsx(Nu,{children:o._({id:"b+KjnH",message:"Your position will not earn fees or be used in trades until the market price moves into your range."})}),K&&zt.jsx(Nu,{children:o._({id:"Jh223O",message:"Invalid range selected. The min price must be lower than the max price."})})]}),z?zt.jsxs(Xu,{children:[zt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:o._({id:"zeSosD",message:"Starting price"})}),zt.jsx(x,{sx:{p:8,borderRadius:8,backgroundColor:L(m.palette.primary.main,.1),typography:"h6",color:m.palette.primary.main},children:o._({id:"X6T02b",message:"This pool must be initialized before you can add liquidity. To initialize, select a starting price for the pool. Then, enter your liquidity price range and deposit amount. Gas fees will be higher than usual due to the initialization transaction."})}),zt.jsx(x,{sx:{px:16,py:12,borderRadius:8,borderWidth:1,borderColor:m.palette.border.main,borderStyle:"solid"},children:zt.jsx(kc,{sx:{backgroundColor:"transparent"},value:S,onChange:de,suffix:zt.jsx(x,{sx:{typography:"h6",color:m.palette.text.secondary},children:Ie})})})]}):zt.jsxs(Xu,{disabled:!w.feeAmount||G,children:[zt.jsxs(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:[o._({id:"DWd30U",message:"Current price"}),zt.jsxs(x,{children:[_r({input:B,decimals:9})," ",o._({id:"b2jAb+",message:"per"})," ",null!==(a=null===(l=w.mint1)||void 0===l?void 0:l.symbol)&&void 0!==a?a:""]})]}),zt.jsx(kp,{mint1:w.mint1,mint2:w.mint2,feeAmount:w.feeAmount,ticksAtLimit:ne,price:B?B.toNumber():void 0,priceLower:xe,priceUpper:ye,onLeftRangeInput:ae,onRightRangeInput:se,interactive:!0})]}),zt.jsxs(Xu,{disabled:G||K||z&&!S,children:[zt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:o._({id:"MU9s7M",message:"Deposit amounts"})}),zt.jsxs(x,{children:[zt.jsx(Iu,{value:he[Vu.DEPOSIT_1],onUserInput:re,maxAmount:me[Vu.DEPOSIT_1],balance:D[Vu.DEPOSIT_1],mint:null!==(s=X[Vu.DEPOSIT_1])&&void 0!==s?s:null,locked:ee}),zt.jsx(Zc,{}),zt.jsx(Iu,{value:he[Vu.DEPOSIT_2],onUserInput:le,maxAmount:me[Vu.DEPOSIT_2],balance:D[Vu.DEPOSIT_2],mint:null!==(d=X[Vu.DEPOSIT_2])&&void 0!==d?d:null,locked:te})]}),zt.jsx(Cu,{value:I,onChange:E,disabled:!1,type:u})]})]}),zt.jsx(x,{sx:{display:"flex",alignItems:"center",px:20,py:16,borderBottomLeftRadius:16,borderBottomRightRadius:16,backgroundColor:m.palette.background.paper},children:zt.jsx(ku,{chainId:c,isValid:ce,errorMessage:q,setShowConfirm:pe})}),zt.jsx(Pp,{position:Y,outOfRange:$,ticksAtLimit:ne,on:ue,onClose:()=>{pe(!1)},onConfirm:Se.mutate,loading:Se.isPending})]})})}function xh({title:e,desc:t,linkTo:o,LeftImage:i,sx:r}){const l=y(),a="light"===l.palette.mode;return zt.jsxs(x,{sx:Object.assign({backgroundColor:l.palette.background.paper,borderRadius:16,padding:20},r),children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:[zt.jsx(x,{sx:{backgroundColor:L(l.palette.secondary.main,.3),color:a?"#EB8D27":l.palette.secondary.main,borderRadius:6,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center"},children:zt.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",children:zt.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"})})}),zt.jsx(x,{sx:{color:l.palette.text.primary,typography:"body1",fontWeight:600,ml:4},children:zt.jsx(n,{id:"cmUrtC",message:"SEE HOW IT WORKS"})})]}),zt.jsxs(x,{sx:{mt:20,borderTopWidth:1,pt:20,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(x,{component:i,sx:{width:64,height:64,flexShrink:0}}),zt.jsxs(x,{sx:{ml:16,color:l.palette.text.primary,typography:"body1",fontWeight:600},children:[e,zt.jsx(x,{sx:{mt:4,color:l.palette.text.secondary,typography:"body2",fontWeight:500},children:t})]})]}),zt.jsx(x,{component:"a",href:o,target:"_blank",rel:"noopener noreferrer",sx:{pl:16,flexShrink:0},children:zt.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:zt.jsx("path",{d:"M7.23375 3.75L6 4.98375L10.0075 9L6 13.0162L7.23375 14.25L12.4838 9L7.23375 3.75Z",fill:l.palette.text.primary})})})]})]})}const yh=[{value:0,label:"0%"},{value:25,label:"25%"},{value:50,label:"50%"},{value:75,label:"75%"},{value:100,label:"100%"}];function vh({disabled:e,value:t,onChange:n,sx:o}){return zt.jsxs(x,{sx:Object.assign({p:20,backgroundColor:"background.input",borderRadius:12},o),children:[zt.jsx(kc,{value:String(t),onChange:e=>n(+e),readOnly:!0,readonlyShowSuffix:!0,suffix:zt.jsx(x,{sx:{typography:"h2"},children:"%"}),sx:{mt:12,"& input":{pl:0,typography:"h1"}}}),zt.jsx(x,{sx:{mt:20},children:zt.jsx(N,{marks:yh,step:1,disabled:e,value:t,onChange:(e,t)=>n(t)})})]})}const bh=50;var jh;!function(e){e[e.quantity=1]="quantity",e[e.percentage=2]="percentage"}(jh||(jh={}));const wh=({chainId:e,disabled:t,isLoading:n,onConfirm:i})=>zt.jsx(hc,{includeButton:!0,fullWidth:!0,chainId:e,children:zt.jsx(b,{fullWidth:!0,size:b.Size.big,onClick:i,disabled:t,isLoading:n,children:o._({id:"h5pjuM",message:"Collect fees"})})}),Ch=({mint:e,pooledAmount:t})=>{var n;const o=y();return zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[zt.jsx(Ss,{address:null!==(n=null==e?void 0:e.address)&&void 0!==n?n:"",chainId:null==e?void 0:e.chainId,noShowChain:!0,width:18,height:18,marginRight:0}),zt.jsxs(x,{sx:{typography:"body1",color:o.palette.text.primary},children:[_r({input:t,decimals:null==e?void 0:e.decimals})," ",null==e?void 0:e.symbol]}),zt.jsx(M,{sx:{display:"flex",alignItems:"center",color:o.palette.text.secondary,"&:hover":{color:o.palette.text.primary}},onClick:()=>{e&&window.open(Wc(e.chainId,e.address,"address"))},children:zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:zt.jsx("path",{opacity:"0.5",fillRule:"evenodd",clipRule:"evenodd",d:"M3.33333 3.33333V12.6667H12.6667V8H14V12.6667C14 13.4 13.4 14 12.6667 14H3.33333C2.59333 14 2 13.4 2 12.6667V3.33333C2 2.6 2.59333 2 3.33333 2H8V3.33333H3.33333ZM9.33333 3.33333V2H14V6.66667H12.6667V4.27333L6.11333 10.8267L5.17333 9.88667L11.7267 3.33333H9.33333Z",fill:"currentColor"})})})]})},kh=({mintA:e,mintB:t,feeAmount:i,existingPosition:r,positionInfo:l,inRange:a,removed:s})=>{const d=y();return zt.jsxs(x,{sx:{border:"solid 1px",borderColor:"border.main",borderRadius:8},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:d.spacing(12,20),borderBottomStyle:"solid",borderBottomColor:"border.main",borderBottomWidth:1},children:[zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4},children:[zt.jsxs(x,{sx:{typography:"body2",color:d.palette.text.primary},children:[o._({id:"PVa3KL",message:"Position on"})," ",null==e?void 0:e.symbol,"/",null==t?void 0:t.symbol]}),zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[zt.jsx(Vp,{removed:s,inRange:a}),zt.jsx(x,{sx:{py:4,px:8,color:d.palette.primary.main,borderRadius:4,backgroundColor:L(d.palette.primary.main,.1),typography:"h6"},children:Op({type:u,lpFeeRate:i,mtFeeRate:0})})]})]}),zt.jsxs(M,{sx:{display:"flex",alignItems:"center",gap:0,typography:"body2",color:d.palette.text.secondary,"&:hover":{color:d.palette.text.primary}},onClick:()=>{(null==e?void 0:e.chainId)&&window.open(Wc(e.chainId,null==r?void 0:r.poolId.toBase58(),"address"))},children:[o._({id:"URmyfc",message:"Details"}),zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:zt.jsx("path",{d:"M7.5 5L6.4425 6.0575L9.8775 9.5L6.4425 12.9425L7.5 14L12 9.5L7.5 5Z",fill:"currentColor"})})]})]}),zt.jsxs(x,{sx:{p:d.spacing(12,20)},children:[zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"YHc3B+",message:"My Liquidity"})}),zt.jsxs(x,{sx:{mt:12},children:[zt.jsx(Ch,{mint:e,pooledAmount:null==l?void 0:l.pooledAmountA}),zt.jsx(Ch,{mint:t,pooledAmount:null==l?void 0:l.pooledAmountB})]})]})]})},Rh=({chainId:e,disabled:t,removed:n,isLoading:i,onConfirm:r})=>zt.jsx(hc,{includeButton:!0,fullWidth:!0,chainId:e,children:zt.jsx(b,{fullWidth:!0,size:b.Size.big,onClick:r,disabled:t,isLoading:i,children:n?o._({id:"D87pha",message:"Closed"}):o._({id:"t/YqKh",message:"Remove"})})});function Sh({position:e}){const t=Ws(),[,n]=mp(e?e.poolId.toBase58():null),{data:o}=we({queryKey:["clmm","getPositionInfo",e,null==n?void 0:n.poolInfo],enabled:!!e&&!!(null==n?void 0:n.poolInfo),queryFn:()=>Lr(this,void 0,void 0,(function*(){const o=null==n?void 0:n.poolInfo;if(!o||!t||!e)return null;const i=at.getTickPrice({poolInfo:o,tick:e.tickLower,baseIn:!0}),r=at.getTickPrice({poolInfo:o,tick:e.tickUpper,baseIn:!0}),l=yield t.connection.getEpochInfo(),{amountA:a,amountB:s}=st.getAmountsFromLiquidity({poolInfo:o,ownerPosition:e,liquidity:e.liquidity,slippage:0,add:!1,epochInfo:l}),[d,c]=[new ie(a.amount.toString()).div(10**o.mintA.decimals),new ie(s.amount.toString()).div(10**o.mintB.decimals)];return{pooledAmountA:d,pooledAmountB:c,priceLower:new ie(i.price.toString()),priceUpper:new ie(r.price.toString())}}))});return{pool:n,positionInfo:null!=o?o:null}}function Ih(e){var t;const n=Ws(),o=we({queryKey:["clmm","getOwnerPositionInfo",e,null==n?void 0:n.owner],enabled:null!=e&&null!=n&&null!=n.owner,queryFn:()=>Lr(this,void 0,void 0,(function*(){if(!n||!n.owner||!e)return null;const t=ml[e];if(!t)throw new Error("Invalid config");try{const e=yield n.clmm.getOwnerPositionInfo({programId:t.programId});return e.forEach((e=>{console.log("getOwnerPositionInfo p",e.poolId.toBase58(),e.nftMint.toBase58(),e.liquidity.toString(),e.tickLower,e.tickUpper)})),{allPosition:e}}catch(e){return console.error("getOwnerPositionInfo error",e),null}}))});return{loading:o.isLoading,positions:null===(t=o.data)||void 0===t?void 0:t.allPosition}}const Eh=({mint:e,rewardAmountOwed:t})=>{var n;const o=y();return zt.jsxs(x,{sx:{py:8,display:"flex",alignItems:"center",gap:6,typography:"h5",color:o.palette.text.primary},children:[zt.jsx(Ss,{address:null!==(n=null==e?void 0:e.address)&&void 0!==n?n:"",chainId:null==e?void 0:e.chainId,noShowChain:!0,width:24,height:24,marginRight:0}),zt.jsx(x,{children:null==e?void 0:e.symbol}),zt.jsx(x,{sx:{ml:"auto"},children:_r({input:null==t?void 0:t.toString(),decimals:null==e?void 0:e.decimals})})]})},Mh=({mint1Address:e,mint2Address:t,feeAmount:n,poolId:i,nftMint:r,onClose:l})=>{const{isMobile:a}=Rc(),s=y(),d=Cl(),c=je(),{account:p,chainId:h}=Ar(),m=Ws(),{position:f}=function({chainId:e,nftMint:t,poolId:n}){const o=Ih(e);return{position:K((()=>{if(o.positions)return o.positions.find((e=>e.nftMint.equals(new Te(t))&&e.poolId.equals(new Te(n))))}),[o,t,n]),loading:o.loading}}({chainId:h,nftMint:r,poolId:i}),{positionInfo:g,pool:v}=Sh({position:f}),[b,j]=_("stake"),[w,C]=_(!1),[k,R]=_(bh),S=Yp({mint:e,chainId:h}),I=Yp({mint:t,chainId:h}),[E,M]=oe(Tu,{mint1:S,mint2:I,feeAmount:n,selectedMintIndex:0,independentField:Vu.DEPOSIT_1,typedValue:"",startPriceTypedValue:"",leftRangeTypedValue:"",rightRangeTypedValue:""});J((()=>{S&&M({type:Eu.UpdateDefaultMint1,payload:S})}),[S]),J((()=>{I&&M({type:Eu.UpdateDefaultMint2,payload:I})}),[I]);const{independentField:T,typedValue:L}=E,{slipper:O,setSlipper:W,slipperValue:V}=wu({type:u}),{mintA:F,mintB:A,dependentField:Z,parsedAmounts:P,depositBalances:B,position:N,mints:Y,errorMessage:z,invalidRange:X,outOfRange:q,depositADisabled:G,depositBDisabled:Q,ticksAtLimit:$}=ch({state:E,existingPosition:f,slipperValue:V}),ee=(null==f?void 0:f.liquidity)&&f.liquidity.eq(new gt(0)),{onField1Input:te,onField2Input:ne}=uh({dispatch:M}),re=!z&&!X,le=K((()=>{var e,t;return{[T]:L,[Z]:null!==(t=null===(e=P[Z])||void 0===e?void 0:e.toString())&&void 0!==t?t:""}}),[Z,T,P,L]),ae=[Vu.DEPOSIT_1,Vu.DEPOSIT_2].reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:hh(B[t])})),{}),se=Ce({mutationFn:()=>Lr(void 0,void 0,void 0,(function*(){if(!p)throw new Error("account is undefined");if(!m)throw new Error("raydium is undefined");if(!f)throw new Error("existingPosition is undefined");if(!(null==v?void 0:v.poolInfo))throw new Error("poolInfo is undefined");if(!N)throw new Error("position is undefined");const{execute:e}=yield m.clmm.increasePositionFromLiquidity({poolInfo:v.poolInfo,poolKeys:v.poolKeys,ownerPosition:f,ownerInfo:{useSOLBalance:!0},liquidity:new gt(new yt(N.liquidity.toString()).mul(1-V).toFixed(0)),amountMaxA:new gt(new yt(L||"0").mul(10**v.poolInfo.mintA.decimals).toFixed(0)),amountMaxB:new gt(N.amountB.multipliedBy(1+V).multipliedBy(new ie(10**v.poolInfo.mintB.decimals)).toFixed(0)),checkCreateATAOwner:!0,txVersion:Ue.LEGACY});(yield d.executeCustom({brief:o._({id:"OBdohg",message:"Add Liquidity"}),metadata:{[Pr.addAMMV3Pool]:!0},handler:t=>Lr(void 0,void 0,void 0,(function*(){const{txId:n}=yield e({sendAndConfirm:!0});t.onSuccess(n)}))}))===Br.Success&&(C(!1),setTimeout((()=>{null==l||l()}),100)),c.invalidateQueries({queryKey:["clmm"],refetchType:"all"})})),onError:e=>{console.error(e)}}),de=Ce({mutationFn:()=>Lr(void 0,void 0,void 0,(function*(){if(!p)throw new Error("account is undefined");if(!m)throw new Error("raydium is undefined");if(!f)throw new Error("existingPosition is undefined");if(!(null==v?void 0:v.poolInfo))throw new Error("poolInfo is undefined");const e=new gt(new yt(f.liquidity.toString()).mul(1-k/100).toFixed(0)),{execute:t}=yield m.clmm.decreaseLiquidity({poolInfo:v.poolInfo,poolKeys:v.poolKeys,ownerPosition:f,ownerInfo:{useSOLBalance:!0,closePosition:!1},liquidity:e,amountMinA:new gt(0),amountMinB:new gt(0),txVersion:Ue.LEGACY});(yield d.executeCustom({brief:o._({id:"3XBvkd",message:"Remove Liquidity"}),metadata:{[Pr.removeAMMV3Pool]:!0},handler:e=>Lr(void 0,void 0,void 0,(function*(){const{txId:n}=yield t({sendAndConfirm:!0});e.onSuccess(n)}))}))===Br.Success&&setTimeout((()=>{null==l||l()}),100),c.invalidateQueries({queryKey:["clmm"],refetchType:"all"})})),onError:e=>{console.error("onRemoveMutation",e)}}),ce=Ce({mutationFn:()=>Lr(void 0,void 0,void 0,(function*(){if(!m)throw new Error("raydium is undefined");if(!(null==v?void 0:v.poolInfo))throw new Error("poolInfo is undefined");const{execute:e}=yield m.clmm.collectRewards({poolInfo:v.poolInfo,ownerInfo:{useSOLBalance:!0},rewardMints:v.poolInfo.rewardDefaultInfos.map((e=>new Te(e.mint.address))),associatedOnly:!0,checkCreateATAOwner:!0,computeBudgetConfig:void 0,txTipConfig:void 0});(yield d.executeCustom({brief:o._({id:"zXCpR0",message:"Claim Rewards"}),metadata:{[Pr.claimAMMV3Pool]:!0},handler:t=>Lr(void 0,void 0,void 0,(function*(){const{txId:n}=yield e();t.onSuccess(n)}))}))===Br.Success&&setTimeout((()=>{null==l||l()}),100),c.invalidateQueries({queryKey:["clmm"],refetchType:"all"})})),onError:e=>{console.error("onClaimMutation",e)}}),ue=K((()=>{var e,t;const i=[{key:"stake",value:o._({id:"JYKRJS",message:"Stake"})},{key:"unstake",value:o._({id:"OFjZGo",message:"Unstake"})},{key:"claim",value:o._({id:"hom7qf",message:"Claim"})}];return zt.jsxs(x,{sx:{borderRadius:16,backgroundColor:s.palette.background.paper},children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:20,py:24,borderTopLeftRadius:16,borderTopRightRadius:16,backgroundColor:s.palette.background.paper},children:[zt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.primary},children:o._({id:"E6MqGy",message:"Add liquidity"})}),l?zt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24,borderRadius:"50%",borderWidth:1,color:"text.secondary",cursor:"pointer"},children:zt.jsx(x,{component:Wt.Error,sx:{width:16,height:16},onClick:()=>{l()}})}):void 0]}),zt.jsx(x,{sx:{mx:20,mb:16},children:zt.jsx(kh,{existingPosition:f,positionInfo:g,inRange:!q,removed:ee,mintA:F,mintB:A,feeAmount:n})}),zt.jsxs(U,{value:b,onChange:(e,t)=>{j(t)},children:[zt.jsx(H,{tabs:i,variant:"inPaper",tabsListSx:{mx:20}}),zt.jsxs(D,{value:"stake",children:[N&&zt.jsx(x,{sx:{mt:16,mx:20},children:zt.jsx(Ap,{position:N,title:o._({id:"3VUfrF",message:"Selected Range"}),ticksAtLimit:$})}),zt.jsxs(x,{sx:{mt:16,mx:20,display:"flex",flexDirection:"column",alignItems:"stretch",gap:12},children:[zt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.secondary,textAlign:"left"},children:o._({id:"BRi+RY",message:"Add more liquidity"})}),zt.jsxs(x,{children:[zt.jsx(Iu,{value:le[Vu.DEPOSIT_1],onUserInput:te,maxAmount:ae[Vu.DEPOSIT_1],balance:B[Vu.DEPOSIT_1],mint:null!==(e=Y[Vu.DEPOSIT_1])&&void 0!==e?e:null,locked:G}),zt.jsx(Zc,{}),zt.jsx(Iu,{value:le[Vu.DEPOSIT_2],onUserInput:ne,maxAmount:ae[Vu.DEPOSIT_2],balance:B[Vu.DEPOSIT_2],mint:null!==(t=Y[Vu.DEPOSIT_2])&&void 0!==t?t:null,locked:Q})]}),zt.jsx(Cu,{value:O,onChange:W,disabled:!1,type:u})]}),zt.jsx(x,{sx:{display:"flex",alignItems:"center",px:20,py:16,borderBottomLeftRadius:16,borderBottomRightRadius:16,backgroundColor:s.palette.background.paper},children:zt.jsx(ku,{chainId:h,isValid:re,errorMessage:z,setShowConfirm:C})}),zt.jsx(Pp,{position:N,outOfRange:q,ticksAtLimit:$,on:w,onClose:()=>{C(!1)},onConfirm:se.mutate,loading:se.isPending})]}),zt.jsxs(D,{value:"unstake",children:[zt.jsxs(x,{sx:{mt:16,mx:20,display:"flex",flexDirection:"column",alignItems:"stretch",gap:12},children:[zt.jsx(vh,{disabled:!1,value:k,onChange:e=>R(e)}),zt.jsx(Cu,{value:O,onChange:W,disabled:!1,type:u})]}),zt.jsxs(x,{sx:{mt:16,mx:20,display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[zt.jsx(x,{sx:{typography:"body2",color:s.palette.text.secondary},children:"Receive"}),zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4},children:[zt.jsxs(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.primary},children:[zt.jsx(x,{component:"span",sx:{color:s.palette.primary.main},children:(null==g?void 0:g.pooledAmountA)?_r({input:g.pooledAmountA.multipliedBy(k/100),decimals:null==F?void 0:F.decimals}):"-"})," ",null==F?void 0:F.symbol]}),zt.jsxs(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.primary},children:[zt.jsx(x,{component:"span",sx:{color:s.palette.primary.main},children:(null==g?void 0:g.pooledAmountB)?_r({input:g.pooledAmountB.multipliedBy(k/100),decimals:null==A?void 0:A.decimals}):"-"})," ",null==A?void 0:A.symbol]})]})]}),zt.jsx(x,{sx:{mt:20,display:"flex",alignItems:"center",px:20,py:16,borderBottomLeftRadius:16,borderBottomRightRadius:16,backgroundColor:s.palette.background.paper},children:zt.jsx(Rh,{chainId:h,disabled:ee||0===k,removed:ee,onConfirm:de.mutate,isLoading:de.isPending})})]}),zt.jsxs(D,{value:"claim",children:[zt.jsxs(x,{sx:{mx:20,mt:16,borderRadius:12,borderWidth:1,borderStyle:"solid",borderColor:s.palette.border.main},children:[zt.jsx(x,{sx:{py:12,px:20,typography:"body1",color:s.palette.text.primary,borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:s.palette.border.main},children:o._({id:"tu/fxg",message:"Claim fees"})}),zt.jsx(x,{sx:{p:20},children:null==v?void 0:v.poolInfo.rewardDefaultInfos.map(((e,t)=>{const n=null==f?void 0:f.rewardInfos[t].rewardAmountOwed;return zt.jsx(Eh,{mint:e.mint,rewardAmountOwed:n},e.mint.address)}))})]}),zt.jsx(x,{sx:{mx:20,mt:16,typography:"h6",color:s.palette.text.secondary},children:o._({id:"Joa5Dk",message:"*Collecting fees will withdraw currently available fees for you."})}),zt.jsx(x,{sx:{mt:20,display:"flex",alignItems:"center",px:20,py:16,borderBottomLeftRadius:16,borderBottomRightRadius:16,backgroundColor:s.palette.background.paper},children:zt.jsx(wh,{chainId:h,disabled:ce.isPending||!(null==v?void 0:v.poolInfo)||0===(null==v?void 0:v.poolInfo.rewardDefaultInfos.length),onConfirm:ce.mutate,isLoading:ce.isPending})})]})]})]})}),[h,G,Q,B,z,f,n,le,re,ae,F,A,Y,se.isPending,se.mutate,ce.isPending,ce.mutate,l,te,ne,de.isPending,de.mutate,b,q,null==v?void 0:v.poolInfo,N,g,ee,W,w,k,O,s.palette.background.paper,s.palette.border.main,s.palette.primary.main,s.palette.text.primary,s.palette.text.secondary,$]);return a?zt.jsx(tc,{open:null!=F&&null!=A,onClose:l,scope:!a,modal:void 0,id:"pool-operate",children:ue}):ue};const Th=({outOfRange:e})=>{const t=y();return zt.jsx(W,{title:e?o._({id:"i3Z+/Z",message:"Out of range"}):o._({id:"vOyUlD",message:"In range"}),children:zt.jsx(x,{sx:{display:"flex",alignItems:"center"},children:e?zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:zt.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})}):zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",children:zt.jsx("circle",{cx:"4",cy:"4",r:"4",fill:t.palette.success.main})})})})},Lh=({position:e,mintA:t,mintB:n,feeAmount:i,onClickManage:r})=>{const l=y(),{positionInfo:a,pool:s}=Sh({position:e}),d=function(e,t,n){return K((()=>({[Fu.LOWER]:e&&t?t===zp(qe,Lu[e]):void 0,[Fu.UPPER]:e&&n?n===zp(Ge,Lu[e]):void 0})),[e,t,n])}(i,e.tickLower,e.tickUpper),c=null==a?void 0:a.priceLower,u=null==a?void 0:a.priceUpper,p=!!(null==s?void 0:s.computePoolInfo)&&(s.computePoolInfo.tickCurrent<e.tickLower||s.computePoolInfo.tickCurrent>=e.tickUpper),h=null==s?void 0:s.poolInfo.price;return zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:24,px:20,py:20,pb:12,borderRadius:12,backgroundColor:l.palette.background.paperContrast},children:[zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,typography:"h5",color:l.palette.text.primary},children:[zt.jsx(x,{children:zt.jsxs(zt.Fragment,{children:[zt.jsxs("span",{children:[Fp({price:c,atLimit:d,direction:Fu.LOWER})," "]}),null==n?void 0:n.symbol]})}),zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:zt.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"})}),zt.jsx(x,{children:zt.jsxs(zt.Fragment,{children:[zt.jsxs("span",{children:[Fp({price:u,atLimit:d,direction:Fu.UPPER})," "]}),null==n?void 0:n.symbol]})})]}),zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[zt.jsx(Th,{outOfRange:p}),zt.jsxs(x,{sx:{typography:"h6",color:l.palette.text.secondary},children:["Current price: ",_r({input:h})," ",null==n?void 0:n.symbol," per ",null==t?void 0:t.symbol]})]})]}),zt.jsx(b,{variant:b.Variant.outlined,size:b.Size.small,fullWidth:!0,onClick:r,children:o._({id:"wckWOP",message:"Manage"})})]})};const Oh=({mint1Address:e,mint2Address:t,feeAmount:n,poolId:i,onClose:r,handleGoToAddLiquidityV3:l})=>{const{isMobile:a}=Rc(),s=y(),{chainId:d,account:c}=Ar(),{positions:u,loading:p}=Ih(d),{mintA:h,mintB:m}=function({mint1Address:e,mint2Address:t}){const{chainId:n}=Ar(),o=Yp({mint:e,chainId:n}),i=Yp({mint:t,chainId:n}),[r,l]=K((()=>o&&i?new gt(new Te(o.address).toBuffer()).gt(new gt(new Te(i.address).toBuffer()))?[i,o]:[o,i]:[void 0,void 0]),[o,i]);return{mintA:r,mintB:l}}({mint1Address:e,mint2Address:t}),f=K((()=>{if(void 0!==u)return u.filter((e=>e.poolId.equals(new Te(i))))}),[u,i]),[g,v]=_(null),j=K((()=>{var e;return zt.jsxs(x,{sx:{p:20,display:"flex",flexDirection:"column",gap:16,borderRadius:16,backgroundColor:s.palette.background.paper,minHeight:480},children:[zt.jsxs(x,{sx:{pb:16,borderBottomColor:s.palette.border.main,borderBottomStyle:"solid",borderBottomWidth:1,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[zt.jsxs(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.primary},children:[o._({id:"Gs02OK",message:"My Positions"})," (",null!==(e=null==f?void 0:f.length)&&void 0!==e?e:0,")"]}),r?zt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24,borderRadius:"50%",borderWidth:1,color:"text.secondary",cursor:"pointer"},children:zt.jsx(x,{component:Wt.Error,sx:{width:16,height:16},onClick:()=>{r()}})}):void 0]}),p||!f?zt.jsx(zt.Fragment,{children:zt.jsx(x,{sx:{mt:100,display:"flex",justifyContent:"center"},children:zt.jsx(Us,{})})}):f.length>0?zt.jsxs(zt.Fragment,{children:[null==f?void 0:f.map((e=>zt.jsx(Lh,{position:e,mintA:h,mintB:m,feeAmount:n,onClickManage:()=>{v(e)}},e.nftMint.toBase58()))),zt.jsxs(b,{size:b.Size.big,variant:b.Variant.second,onClick:()=>{l({mint1:null==h?void 0:h.address,mint2:null==m?void 0:m.address,fee:String(n)})},sx:{gap:8},children:[zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:zt.jsx("path",{d:"M19 13H13V19H11V13H5V11H11V5H13V11H19V13Z",fill:"currentColor"})}),o._({id:"FQ4aT9",message:"Add Position"})]})]}):zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{sx:{mt:100,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:[zt.jsx(Y,{sx:{width:60,height:60,borderRadius:24/105*60}}),zt.jsx(x,{sx:{typography:"body1",color:s.palette.text.secondary},children:o._({id:"/6L4mj",message:"Your position is empty"})})]}),zt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:zt.jsx(hc,{size:b.Size.small,includeButton:!0,children:zt.jsx(b,{size:b.Size.small,onClick:()=>{l({mint1:null==h?void 0:h.address,mint2:null==m?void 0:m.address,fee:String(n)})},children:o._({id:"FQ4aT9",message:"Add Position"})})})})]})]})}),[f,n,l,p,h,m,r,s.palette.background.paper,s.palette.border.main,s.palette.text.primary,s.palette.text.secondary]);return null!==g?zt.jsx(Mh,{mint1Address:e,mint2Address:t,feeAmount:n,poolId:g.poolId.toBase58(),nftMint:g.nftMint.toBase58(),onClose:()=>{v(null)}}):a?zt.jsx(tc,{open:null!=h&&null!=m,onClose:r,scope:!a,modal:void 0,id:"pool-operate",children:j}):j};var Wh,Vh;function Fh({message:e,onClose:t}){return zt.jsx(tc,{open:!!e,onClose:t,id:"error-message",children:zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{sx:{flex:1,textAlign:"center"},children:[zt.jsx(x,{component:Wt.ErrorWarn,sx:{mt:60,width:64,height:64,color:"error.main"}}),e?zt.jsxs(x,{sx:{textAlign:"center",mt:60},children:[zt.jsx(x,{children:zt.jsx(n,{id:"kf83Ld",message:"Something went wrong."})}),zt.jsx(x,{sx:{color:"text.secondary",mt:12,typography:"body2",wordBreak:"break-all"},children:e})]}):""]}),zt.jsx(x,{sx:{px:16,py:20},children:zt.jsx(b,{onClick:t,fullWidth:!0,children:zt.jsx(n,{id:"1QfxQT",message:"Dismiss"})})})]})})}function Ah({status:e,children:t,buttonProps:o}){return!e.needShowTokenStatusButton&&t?zt.jsx(zt.Fragment,{children:t}):e.insufficientBalance?zt.jsx(b,{fullWidth:!0,disabled:!0,...o,children:zt.jsx(n,{id:"znqB4T",message:"Insufficient balance"})}):zt.jsx(b,{fullWidth:!0,isLoading:e.isApproving,onClick:e.submitApprove,disabled:e.insufficientBalance,...o,children:e.isApproving?zt.jsx(n,{id:"j2Uisd",message:"Approving"}):e.approveTitle})}function Zh({chainId:e,baseTokenStatus:t,quoteTokenStatus:o,children:i}){const{runningRequests:r}=kl(),{account:l,chainId:a}=Ar();if(!l||e!==a)return zt.jsx(hc,{chainId:e,fullWidth:!0});const s=r.some((e=>{var t,n;return(null===(t=e.metadata)||void 0===t?void 0:t[Pr.addLiquidity])||(null===(n=e.metadata)||void 0===n?void 0:n[Pr.removeLiquidity])})),d=[];t.needShowTokenStatusButton&&d.push(zt.jsx(Ah,{status:t})),o.needShowTokenStatusButton&&!t.isApproving&&d.push(zt.jsx(Ah,{status:o}));const c=d.length;return 2===c?zt.jsx(x,{sx:{display:"flex","& > button":{flex:1,"&:last-child":{ml:8}}},children:d.map((e=>e))}):1===c?d[0]:s?zt.jsx(b,{fullWidth:!0,disabled:!0,isLoading:!0,children:zt.jsx(n,{id:"UbRKMZ",message:"Pending"})}):zt.jsx(zt.Fragment,{children:i})}function Ph({pool:e,maxBaseAmount:t,maxQuoteAmount:n,isRemove:o}){const[i,r]=G.useState(""),[l,a]=G.useState(""),[s,d]=G.useState(vr),c=s===vr?new ie(_c).div(100).toNumber():s,u=()=>{r(""),a("")},p=$c({pool:(null==e?void 0:e.baseToken)&&e.quoteToken?{baseToken:e.baseToken,quoteToken:e.quoteToken,address:e.address}:void 0,baseAmount:i,quoteAmount:l,slippage:c}),h=p.isFront?p.price:p.invertedPrice,m=h||new ie(1),f=G.useRef(m);if(!e||m.isNaN())return{baseAmount:i,quoteAmount:l,handleChangeBaseAmount:()=>{},handleChangeQuoteAmount:()=>{},reset:u,uniV2Pair:p,slippage:s,slippageNumber:c,setSlippage:d};const g=e.baseToken.decimals,x=e.quoteToken.decimals,y=e=>{if(e){let i=m.multipliedBy(e).dp(x).toString();n&&o&&(n.lte(i)||(null==t?void 0:t.lte(0)))&&(i=n.toString()),a(i)}else a(e)};f.current&&m.isEqualTo(f.current)||(f.current=m,y(i));return{baseAmount:i,quoteAmount:l,handleChangeBaseAmount:e=>{let t=Kr(e,g);null===t&&(t=i),r(t),y(t)},handleChangeQuoteAmount:e=>{let i=Kr(e,x);null===i&&(i=l),a(i),(e=>{if(e){let i=new ie(e).div(m).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:m,amountCheckedDisabled:!i||!l,uniV2Pair:p,slippage:s,slippageNumber:c,setSlippage:d}}function Bh({submittedBack:e,pool:t}){var n,i,r;const l="SVM_AMMV2"===(null==t?void 0:t.type),[a,s]=G.useState(!1),{baseAmount:d,quoteAmount:c,midPrice:u,amountCheckedDisabled:p,uniV2Pair:h,handleChangeBaseAmount:m,handleChangeQuoteAmount:f,reset:g,slippage:y,slippageNumber:v,setSlippage:j}=Ph({pool:t});G.useEffect((()=>{g()}),[t]);const w=oa(null==t?void 0:t.baseToken,{amount:d}),C=oa(null==t?void 0:t.quoteToken,{amount:c}),k=w.insufficientBalance||C.insufficientBalance,R=!t||k||!u||!!h.poolInfoQuery.isLoading||!!h.poolInfoQuery.error||p||h.poolInfoQuery.isLoading;let S=l?o._({id:"bwSQI0",message:"Supply"}):o._({id:"m16xKo",message:"Add"});k&&(S=o._({id:"znqB4T",message:"Insufficient balance"}));const I=Kc({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:v,submittedBack:()=>{g(),e&&e(),s(!1)}}),E=!(null==t?void 0:t.baseToken)||!(null==t?void 0:t.quoteToken);return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{sx:{pt:20,pb:18,px:20},children:[zt.jsx(Pc,{sx:{mb:4,pb:28,minHeight:"auto"},amt:d,token:null==t?void 0:t.baseToken,canClickBalance:!0,showPercentage:!0,onInputChange:m,readOnly:h.poolInfoQuery.isLoading}),zt.jsx(jc,{plus:!0}),zt.jsx(Pc,{sx:{pb:20,minHeight:"auto"},amt:c,token:null==t?void 0:t.quoteToken,canClickBalance:!0,showPercentage:!0,onInputChange:f,readOnly:h.poolInfoQuery.isLoading}),zt.jsx(bu,{slippage:y,onChangeSlippage:j,disabled:E,sx:{mt:8}}),zt.jsx(hu,{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})]}),zt.jsx(x,{sx:{px:20,py:16,position:"sticky",bottom:0,borderStyle:"solid",borderWidth:"1px 0 0",borderColor:"border.main",backgroundColor:"background.paper"},children:t?zt.jsx(Zh,{chainId:t.chainId,baseTokenStatus:w,quoteTokenStatus:C,children:zt.jsx(b,{fullWidth:!0,disabled:R,isLoading:I.isPending,onClick:()=>{R||s(!0)},children:S})}):zt.jsx(b,{fullWidth:!0,disabled:!0,children:S})}),zt.jsx(Fh,{message:null===(r=I.error)||void 0===r?void 0:r.message,onClose:()=>I.reset()}),l&&!!t&&zt.jsx(mu,{open:a,onClose:()=>s(!1),slippage:v,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:I})]})}function Nh({hidePoolInfo:e,pool:t,children:o}){var i,r,l,a,s;const d=y(),c=!t,u="SVM_AMMV2"===(null==t?void 0:t.type),p=t?Op({type:t.type,lpFeeRate:null!==(i=t.lpFeeRate)&&void 0!==i?i:"0",mtFeeRate:null!==(r=t.mtFeeRate)&&void 0!==r?r:"0"}):"-";return zt.jsxs(x,{sx:{mt:16,mx:20,border:"solid 1px",borderColor:"border.main",borderRadius:12},children:[e?"":zt.jsxs(x,{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:[zt.jsxs(x,{children:[zt.jsxs(E,{loading:c,loadingSx:{width:100,mb:4},sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[null===(l=null==t?void 0:t.baseToken)||void 0===l?void 0:l.symbol,"/",null===(a=null==t?void 0:t.quoteToken)||void 0===a?void 0:a.symbol,u&&zt.jsx(W,{title:zt.jsxs(x,{sx:{typography:"h6","& > b":{fontWeight:600,color:"primary.main"}},children:["🌟",zt.jsx("b",{children:zt.jsx(n,{id:"e38JNU",message:"Tips:"})})," ",zt.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:zt.jsx("b",{})}})]}),sx:{maxWidth:240},children:zt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.disabled"},children:p})})]}),zt.jsx(E,{loading:c,children:zt.jsx(du,{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?zt.jsxs(x,{component:M,sx:{typography:"body2",display:"flex",alignItems:"center",color:"text.secondary"},onClick:()=>{Hc.getState().push({type:Uc.PoolDetail,params:{chainId:t.chainId,address:t.address}})},children:[zt.jsx(n,{id:"URmyfc",message:"Details"}),zt.jsx(x,{component:Wt.ArrowRight,sx:{ml:4,position:"relative",top:1.2,width:16,height:16}})]}):""]}),zt.jsx(x,{sx:{p:d.spacing(12,20)},children:o})]})}function Uh({submittedBack:t,pool:n}){var i,r,l;const[a,s]=G.useState(""),[d,c]=G.useState(""),[u,p]=G.useState(vr),h=u===vr?new ie(_c).div(100).toNumber():u,{isFront:m,price:f,invertedPrice:g,poolInfoQuery:y,lpBalanceQuery:v,lpBalance:j,lpBalancePercentage:w,lpToAmountA:C,lpToAmountB:k,liquidityMinted:R,pairMintAAmount:S,pairMintBAmount:I,isExists:E}=$c({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:M,modeOptions:T,handleChangeMode:L,sliderPercentage:O,handleChangeSliderPercentage:W,resetPercentage:V}=function({isBase:e,pool:t,baseOverride:n,quoteOverride:i,resetAmount:r,handleChangeBaseAmount:l,handleChangeQuoteAmount:a}){const[s,d]=G.useState(jh.percentage),[c,u]=G.useState(bh),p=G.useRef(null),h=()=>{p.current&&clearTimeout(p.current)},m=()=>{h(),u(bh)};return G.useEffect((()=>h),[]),{mode:s,modeOptions:[{key:jh.percentage,value:o._({id:"x4QVeW",message:"Percentage to remove"})}],handleChangeMode:e=>{d(e),null==r||r(),m()},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=Qr(n.times(o/100),t.baseToken.decimals)),null==l||l(e)}}else if(i){let e=i.toString();r||(e=Qr(i.times(o/100),t.quoteToken.decimals)),null==a||a(e)}};r?s():p.current=setTimeout(s,100)},resetPercentage:m}}({isBase:!0,pool:n,baseOverride:C,quoteOverride:k}),F=oa(null==n?void 0:n.baseToken,{amount:a}),A=oa(null==n?void 0:n.quoteToken,{amount:d}),Z=!n||!!y.isLoading||!!y.error||!!v.error||v.isLoading,P=o._({id:"t/YqKh",message:"Remove"}),B=function({liquidityAmount:t,slippage:n,poolInfo:i,poolKeys:r,submittedBack:l}){const a=Cl(),s=Ws();return e(),Ce({mutationFn:()=>Lr(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 gt(new yt(t.toString()).mul(10**i.lpMint.decimals).toFixed(0,yt.ROUND_DOWN)),d=new De(100*n*100,1e4),{execute:c}=yield s.cpmm.withdrawLiquidity({poolInfo:i,poolKeys:r,lpAmount:e,txVersion:Ue.LEGACY,slippage:d});return yield a.executeCustom({brief:o._({id:"cJtosk",message:"Remove liquidity"}),metadata:{[Pr.removeLiqidityAMMV2Position]:!0},handler:e=>Lr(this,void 0,void 0,(function*(){const{txId:t}=yield c({sendAndConfirm:!0});e.onSuccess(t)})),submittedBack:l})}))})}({liquidityAmount:null==j?void 0:j.times(O/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()}}),N=!(null==n?void 0:n.baseToken)||!(null==n?void 0:n.quoteToken);return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{sx:{pb:18,px:20},children:[zt.jsx(x,{sx:{pt:20},children:M===jh.percentage?zt.jsx(vh,{disabled:y.isLoading||!j||j.lte(0),value:O,onChange:W}):zt.jsx(zt.Fragment,{})}),zt.jsx(bu,{slippage:u,onChangeSlippage:p,disabled:N,sx:{mt:8}}),zt.jsx(hu,{baseToken:null==n?void 0:n.baseToken,quoteToken:null==n?void 0:n.quoteToken,loading:y.isLoading,midPrice:m?f:g,lpBalancePercentage:E?w:100})]}),zt.jsx(x,{sx:{px:20,py:16,position:"sticky",bottom:0,borderStyle:"solid",borderWidth:"1px 0 0",borderColor:"border.main",backgroundColor:"background.paper"},children:n?zt.jsx(Zh,{chainId:n.chainId,baseTokenStatus:F,quoteTokenStatus:A,children:zt.jsx(b,{fullWidth:!0,disabled:Z,isLoading:B.isPending,onClick:()=>{Z||B.mutate()},children:P})}):zt.jsx(b,{fullWidth:!0,disabled:!0,children:P})}),zt.jsx(Fh,{message:null===(l=B.error)||void 0===l?void 0:l.message,onClose:()=>B.reset()})]})}function Hh({pool:t,operate:n,hidePoolInfo:o,submittedBack:i}){var r;const{operateTab:l,operateTabs:a,handleChangeTab:s}=function(t=Vh.Add){const{i18n:n}=e(),[o,i]=G.useState(t),r=G.useMemo((()=>[{key:Vh.Add,value:n._({id:"m16xKo",message:"Add"})},{key:Vh.Remove,value:n._({id:"t/YqKh",message:"Remove"})}]),[n._]);return G.useEffect((()=>{i(t)}),[t]),{operateTab:o,operateTabs:r,handleChangeTab:e=>{i(e)}}}(n);Ar();const{price:d,invertedPrice:c,poolInfoQuery:u,lpBalanceQuery:p,lpBalance:h,lpBalancePercentage:m,lpToAmountA:f,lpToAmountB:g,liquidityMinted:x,pairMintAAmount:y,pairMintBAmount:v,isExists:b}=$c({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 zt.jsxs(zt.Fragment,{children:[zt.jsx(Nh,{pool:t,hidePoolInfo:o,children:zt.jsx(yu,{isExists:b,poolInfo:null===(r=u.data)||void 0===r?void 0:r.poolInfo,poolInfoLoading:u.isLoading,lpBalanceLoading:p.isLoading,lpBalance:h,lpBalancePercentage:m,lpToAmountA:f,lpToAmountB:g,sx:{px:0,py:0,border:"none"}})}),zt.jsxs(U,{value:l,onChange:(e,t)=>{s(t)},children:[zt.jsx(H,{tabs:a,variant:"inPaper",tabsListSx:{mt:16,mx:20}}),zt.jsx(D,{value:Vh.Add,children:zt.jsx(Bh,{pool:t,submittedBack:i})}),zt.jsx(D,{value:Vh.Remove,children:zt.jsx(Uh,{pool:t,submittedBack:i})})]})]})}function Dh({onClose:t,pool:n,operate:o,hasMining:i,hidePoolInfo:r,sx:l}){const{poolOrMiningTab:a,poolOrMiningTabs:s,handleChangeTab:d}=function({hasMining:t}){const{i18n:n}=e(),[o,i]=G.useState(Wh.Liquidity);return{poolOrMiningTab:o,poolOrMiningTabs:G.useMemo((()=>{const e=[{key:Wh.Liquidity,value:n._({id:"6y2TB3",message:"Liquidity"})},{key:Wh.Mining,value:n._({id:"Sti4vy",message:"Mining"})}];return t?e:e.slice(0,1)}),[n._,t]),handleChangeTab:e=>{i(e)}}}({hasMining:i});return zt.jsx(x,{sx:l,children:zt.jsxs(U,{value:a,onChange:(e,t)=>{d(t)},sx:{display:"flex",flexDirection:"column",overflow:"hidden",height:"100%"},children:[zt.jsx(z,{tabs:s,tabsListSx:Object.assign({mx:20,justifyContent:t?"space-between":"flex-start"},{}),rightSlot:zt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",gap:12},children:t?zt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24,borderRadius:"50%",borderWidth:1,color:"text.secondary",cursor:"pointer"},children:zt.jsx(x,{component:Wt.Error,sx:{width:16,height:16},onClick:()=>{t()}})}):void 0})}),zt.jsx(D,{value:Wh.Liquidity,sx:{flex:1,overflowY:"auto"},children:zt.jsx(Hh,{pool:n,operate:o,hidePoolInfo:r,submittedBack:()=>{i&&d(Wh.Mining)}})})]})})}function Yh(e){var{modal:t}=e,n=Tr(e,["modal"]);const{isMobile:o}=Rc();return zt.jsx(tc,{open:!!n.pool,onClose:n.onClose,scope:!o,modal:t,id:"pool-operate",children:zt.jsx(Dh,{...n})})}!function(e){e[e.Liquidity=1]="Liquidity",e[e.Mining=2]="Mining"}(Wh||(Wh={})),function(e){e[e.Add=1]="Add",e[e.Remove=2]="Remove"}(Vh||(Vh={}));const zh=e=>Object.keys(new Array(e+1).join(","));var Xh,qh,Gh;function _h({sx:e,hasSearch:t,emptyText:o}){return zt.jsxs(x,{sx:Object.assign({display:"flex",flexDirection:"column",gap:12,justifyContent:"center",alignItems:"center",typography:"body2",fontWeight:500,color:"text.secondary",textAlign:"center"},e),children:[zt.jsx(Y,{hasSearch:t,sx:{width:60,height:60,borderRadius:12}}),zt.jsx(x,{children:null!=o?o:zt.jsx(n,{id:"AxPAXW",message:"No results found"})})]})}function Jh(){return Jh=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},Jh.apply(null,arguments)}!function(e){e[e.Failed=0]="Failed",e[e.Success=1]="Success",e[e.Warning=2]="Warning"}(Xh||(Xh={}));const Qh=e=>q.createElement("svg",Jh({width:60,height:60,viewBox:"0 0 60 60",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),q.createElement("g",{opacity:.5},q.createElement("mask",{id:"mask0_3521_179418",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:0,y:0,width:60,height:60},qh||(qh=q.createElement("rect",{width:60,height:60,rx:16,fill:"white"}))),Gh||(Gh=q.createElement("g",{mask:"url(#mask0_3521_179418)"},q.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}),q.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}),q.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}),q.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}),q.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}),q.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}),q.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 Kh({sx:e,refresh:t}){return zt.jsxs(x,{sx:ue({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},e),children:[zt.jsx(x,{component:Qh,sx:{display:"inline-block",width:60,height:60,mb:12}}),zt.jsx(x,{sx:{typography:"body2",width:252,textAlign:"center"},children:zt.jsx(x,{component:"span",sx:{color:"text.secondary"},children:zt.jsx(n,{id:"Vmw6BM",message:"Something went wrong…<0>Refresh again</0>",components:{0:zt.jsx(j,{component:"span",color:"primary.main",weak:!0,sx:{cursor:"pointer"},onClick:()=>{t()}})}})})})]})}function $h({loading:e,empty:t,hasSearch:n,children:o,refetch:i}){return e?zt.jsx(x,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",gap:24,px:24,height:320},children:zh(4).map(((e,t)=>zt.jsx(V,{width:"100%",height:45},t)))}):i?zt.jsx(Kh,{refresh:i,sx:{height:320}}):t?zt.jsx(_h,{hasSearch:n,sx:{height:320}}):zt.jsx(zt.Fragment,{children:o})}function em({children:e,sx:t,gap:n=20,repeatBaseForLargeScreen:o=3}){const{isMobile:i,minDevice:r}=Rc();let l={};if(i)l={display:"flex",flexDirection:"column",gap:n};else{let e=2;[1418,1761,2104].some(((t,n)=>{if(r(t))return e=o+n,!0})),l={display:"grid",gap:n,gridTemplateColumns:`repeat(${e}, 1fr)`}}return zt.jsx(x,{sx:Object.assign(Object.assign({},l),t),children:e})}function tm({address:e,chainId:t,hideName:o,sx:i}){const r=y(),l=Ql(),{onlyChainId:a}=Vr(),s=we(Object.assign({},l.getQuery(g.graphql.fetchLiquidityLpPartnerRewards,{where:{chainId:a||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,l,a,c,u,p,h,m,f,g,x,y;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===(l=null===(r=null===(i=s.data)||void 0===i?void 0:i.liquidity_getLpPartnerRewards)||void 0===r?void 0:r.partnerInfos)||void 0===l?void 0:l.find((e=>(null==e?void 0:e.partner)===n.partner));if(!e)return;d.push({partner:{name:null!==(a=null==e?void 0:e.partner)&&void 0!==a?a:"",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===(m=null==e?void 0:e.theme)||void 0===m?void 0:m[0])||void 0,color:(null===(f=null==e?void 0:e.theme)||void 0===f?void 0:f[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!==(y=null==e?void 0:e.sort)&&void 0!==y?y:Number.MAX_SAFE_INTEGER})}})))})),(null==d?void 0:d.length)?(d.sort(((e,t)=>e.sort-t.sort)),zt.jsx(x,{sx:Object.assign({display:"flex",alignItems:"center",gap:4},i),children:d.map((e=>zt.jsx(W,{leaveDelay:100,title:zt.jsxs(x,{sx:{maxWidth:240,whiteSpace:"pre-wrap"},children:[e.partner.introduction,!!e.partner.link&&zt.jsxs(x,{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:[zt.jsx(n,{id:"zwWKhA",message:"Learn more"})," ",zt.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zt.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:zt.jsxs(M,{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:[zt.jsx(x,{component:"img",src:e.partner.logo,alt:e.partner.name,sx:{width:14,height:14,borderRadius:"50%"}}),!o&&!!e.reward&&zt.jsx(x,{sx:{fontSize:"10px",fontWeight:600},children:e.reward})]})},e.partner.name+e.reward)))})):null}var nm,om;function im(){return im=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},im.apply(null,arguments)}const rm=e=>q.createElement("svg",im({width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),nm||(nm=q.createElement("circle",{cx:16,cy:16,r:16,fill:"#FFE804"})),om||(om=q.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"}))),lm="_default";function am({value:e,onChange:t,placeholder:n,options:o,sx:i,readOnly:r,valueOnlyIcon:l}){const a=y();return zt.jsx(X,{value:null!=e?e:lm,onChange:(n,o)=>{const i="number"==typeof e?Number(o):o;t(i===lm?void 0:i)},disabled:r,sx:ue({padding:a.spacing(8,12),"& .MuiSelect-select.MuiSelect-select.MuiSelect-select":{display:"flex",alignItems:"center",gap:8,padding:a.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===lm)return zt.jsx(x,{sx:{color:"text.secondary"},children:null!=n?n:""});const i=o.find((t=>t.key===e));return i?zt.jsxs(zt.Fragment,{children:[i.logo,l?"":i.value]}):null},options:[...o]})}function sm({isMobileStyle:e,chain:t,isLastItem:n,logoWidth:o,mobileLogoWidth:i,sx:r}){const l=y();return e?zt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",py:18,borderTop:`1px solid ${l.palette.border.main}`,borderBottom:n?`1px solid ${l.palette.border.main}`:"none"},r),children:[zt.jsx(x,{component:null==t?void 0:t.logo,sx:{width:i,height:i}}),zt.jsx(x,{component:"span",className:"name",sx:{marginLeft:8},children:null==t?void 0:t.name})]}):zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(x,{component:null==t?void 0:t.logo,sx:{width:o,height:o}}),zt.jsx(x,{component:"span",className:"name",sx:{marginLeft:8},children:null==t?void 0:t.name})]})}const dm=-1;function cm({chainId:t,setChainId:o,logoWidth:i=24,mobileLogoWidth:r=32,mainLogoWidth:l=24,mainMobileLogoWidth:a=18,notShowAllChain:s,valueOnlyIcon:d,sx:c}){const u=function(){const{chainId:e}=Ne();return K((()=>{const t=new Map;let n;return ks.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]=G.useState(!1),{isMobile:m}=Rc(),{i18n:f}=e(),g=G.useCallback((()=>{const e=void 0===t?u[0]:u.find((e=>e.chainId===t));if(d){if(void 0===t||!e)return"";const n=m?r:l;return zt.jsx(x,{component:null==e?void 0:e.logo,sx:{width:n,height:n}})}return void 0!==t||s?e?zt.jsx(sm,{isMobileStyle:m,chain:e,logoWidth:l,mobileLogoWidth:a}):null:zt.jsx(sm,{isMobileStyle:m,chain:{chainId:dm,logo:rm,name:f._({id:"pY/ok7",message:"All chains"})},logoWidth:l,mobileLogoWidth:a,sx:{border:"none"}})}),[t,u,s,d,m,f._]),y=G.useMemo((()=>{const e=[];return s||e.push({key:dm,value:zt.jsx(sm,{isMobileStyle:m,chain:{chainId:dm,logo:rm,name:f._({id:"pY/ok7",message:"All chains"})},logoWidth:i,mobileLogoWidth:r})}),u.forEach(((t,n)=>{e.push({key:t.chainId,value:zt.jsx(sm,{isLastItem:n===u.length-1,isMobileStyle:m,chain:t,logoWidth:i,mobileLogoWidth:r})})})),e}),[m,i,r,u,s]);return m?zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{component:M,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:[zt.jsx(x,{sx:{pr:5},children:g()}),zt.jsx(x,{component:Wt.CaretUp,sx:{width:12,height:12,transform:"rotate(180deg)"}})]}),zt.jsx(tc,{open:p,title:zt.jsx(n,{id:"lJvbHq",message:"Select Network"}),onClose:()=>h(!1),id:"select-chain",modal:!0,children:zt.jsx(x,{sx:{mb:20},children:y.map((e=>zt.jsxs(x,{onClick:()=>{const t=e.key;o(t===dm?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===dm)&&zt.jsx(x,{sx:{position:"absolute",left:0,top:24,height:20,width:2,backgroundColor:"text.primary"}})]},e.key)))})})]}):zt.jsx(am,{value:null!=t?t:dm,onChange:e=>{o(e===dm?void 0:e)},placeholder:f._({id:"lJvbHq",message:"Select Network"}),options:y,valueOnlyIcon:d,sx:Object.assign({height:32,fontWeight:600,typography:"body2"},c)})}function um({text:e,onClick:t}){const n=y();return zt.jsxs(x,{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,zt.jsx(x,{component:Wt.ArrowBack,sx:{ml:2,width:16,height:16,transform:"rotate(180deg)"}})]})}function pm({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=Ep(i.baseToken,i.chainId),l=Ep(i.quoteToken,i.chainId);return r&&l?zt.jsxs(x,{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:[zt.jsx(uu,{tokens:[r,l],chainId:r.chainId,width:20,mr:8}),r.symbol,"+",l.symbol,zt.jsx(x,{component:Wt.Error,sx:{ml:4,width:16,height:16,cursor:"pointer",color:"text.secondary",position:"relative",top:1.5},onClick:()=>t()})]}):null}function hm({tags:e,onDeleteTag:t,sx:n}){return e.length?zt.jsx(x,{sx:Object.assign({display:"inline-flex",alignItems:"center"},n),children:e.map((e=>zt.jsxs(x,{sx:{typography:"body2",display:"flex",alignItems:"center",px:8,mr:8,borderRadius:8,fontWeight:600,height:32,backgroundColor:"hover.default"},children:[zt.jsx(Ss,{address:e.address,width:20,height:20,chainId:e.chainId,url:e.logoURI,noShowChain:!0,marginRight:8}),e.symbol,zt.jsx(x,{component:Wt.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 mm({chainId:e,address:t}){const{isMobile:n}=Rc();return zt.jsx(x,{component:"button",onClick:n=>{n.stopPropagation(),Hc.getState().push({type:Uc.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:zt.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zt.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 fm(e){var{sx:t,children:o,hasMore:i,loadMore:r,loadMoreLoading:l}=e,a=Tr(e,["sx","children","hasMore","loadMore","loadMoreLoading"]);const s=y();return zt.jsxs(x,{sx:Object.assign({position:"relative",flex:1,overflowY:"auto"},t),...a,children:[zt.jsx(x,{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:`${L(s.palette.text.primary,.1)} -2px 0px 4px 0px`}}},children:o}),i&&zt.jsx(M,{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:l?zt.jsx(O,{}):zt.jsxs(zt.Fragment,{children:[zt.jsx(n,{id:"yQ2kGp",message:"Load more"}),zt.jsx(x,{component:Wt.ArrowRight,sx:{transform:"rotate(90deg)"}})]})})]})}function gm({sx:e}){return zt.jsxs(x,{sx:Object.assign({px:20,pt:20,pb:12,backgroundColor:"background.paperContrast",borderRadius:16,display:"flex",flexDirection:"column"},e),children:[zt.jsx(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(V,{variant:"circular",width:48}),zt.jsx(V,{variant:"rounded",height:28,width:100,sx:{ml:8}})]})}),zt.jsxs(x,{sx:{display:"flex",alignItems:"center",mt:44},children:[zt.jsxs(x,{children:[zt.jsx(V,{variant:"rounded",height:24,width:100}),zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"rSayea",message:"APY"})})]}),zt.jsx(x,{sx:{display:"inline-block",mx:20,height:24,width:"1px",backgroundColor:"custom.border.default"}}),zt.jsxs(x,{children:[zt.jsx(V,{variant:"rounded",height:24,width:100}),zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"FHKsZF",message:"TVL"})})]})]}),zt.jsx(V,{variant:"rounded",height:32})]})}function xm({chainId:e,baseToken:t,quoteToken:o,apy:i,hasQuote:r,hasMining:l,sx:a,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 zt.jsx(W,{children:null!=s?s:zt.jsx(j,{component:Wt.QuestionBorder,sx:Object.assign({width:15,height:15},a)}),title:zt.jsx(x,{sx:{width:236},children:d.map(((i,r)=>{var a,s,d,c;return zt.jsxs(x,{sx:{mt:0===r?0:20},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",typography:"body2",fontWeight:600,color:"text.primary"},children:[zt.jsx(x,{sx:{display:"flex",alignItems:"center"},children:i.token?zt.jsxs(zt.Fragment,{children:[zt.jsx(Ss,{width:14,height:14,marginRight:4,address:i.token.address,url:i.token.logoURI,chainId:e,noShowChain:!0}),i.token.symbol]}):zt.jsxs(zt.Fragment,{children:[zt.jsx(uu,{tokens:[t,o],width:14,mr:4,chainId:e}),t.symbol,"/",null==o?void 0:o.symbol]})}),zt.jsx(x,{children:al(new ie(null!==(d=i.transactionApy)&&void 0!==d?d:0).plus(null!==(c=i.miningApy)&&void 0!==c?c:0))})]}),zt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",typography:"h6",color:"text.secondary"},children:[zt.jsx("span",{children:zt.jsx(n,{id:"OnDEky",message:"LP Fee"})}),zt.jsx("span",{children:i.transactionApy?al(new ie(i.transactionApy)):"-"})]}),l?zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",typography:"h6",color:"text.secondary"},children:[zt.jsx("span",{children:zt.jsx(n,{id:"pSQ1lM",message:"MT Fee"})}),zt.jsx("span",{children:i.miningApy?al(new ie(i.miningApy)):"-"})]}):""]},null!==(s=null===(a=i.token)||void 0===a?void 0:a.address)&&void 0!==s?s:1)}))})})}function ym({sx:e,value:t,onChange:i,searchAddress:r}){const[l,a]=G.useState(!1),{isMobile:s}=Rc();return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{component:M,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:()=>a(!0),children:[zt.jsx(x,{component:Wt.Search,sx:{width:16,height:16,mr:8,flexShrink:0}}),zt.jsx(n,{id:"A1taO8",message:"Search"})]}),zt.jsx(Ac,{value:t,open:l,multiple:!0,title:zt.jsx(n,{id:"o8aMNm",message:"Select a liquidity pool"}),searchPlaceholder:o._({id:"4nzwq3",message:"Search by token or pool address"}),onClose:()=>{a(!1)},onTokenChange:e=>{if(Array.isArray(e)){if(e.length>2){const t=[e[0],e[2]];i(t)}else i(e);a(!1)}},searchOtherAddress:e=>r(e,(()=>a(!1))),modal:!0})]})}function vm({list:e,onClick:t}){return zt.jsx(zt.Fragment,{children:null==e?void 0:e.map((e=>{var o,i,r,l;if(!(null==e?void 0:e.pair))return null;const a=e.pair,s=Ep(a.baseToken,a.chainId),d=Ep(a.quoteToken,a.chainId),c=a.apy?al(new ie(null===(o=a.apy)||void 0===o?void 0:o.transactionBaseApy).plus(null!==(r=null===(i=a.apy)||void 0===i?void 0:i.miningBaseApy)&&void 0!==r?r:0)):void 0,u=f.utils.singleSideLp(a.type)&&a.apy?al(new ie(a.apy.transactionQuoteApy).plus(null!==(l=a.apy.miningQuoteApy)&&void 0!==l?l:0)):void 0;return s&&d?zt.jsxs(x,{onClick:t,sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:10,py:20,borderRadius:8,cursor:"pointer","&:hover":{backgroundColor:"custom.background.listHover"}},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(uu,{tokens:[s,d],chainId:a.chainId,width:24,mr:10}),zt.jsxs(x,{sx:{typography:"h5"},children:[s.symbol,"/",d.symbol]})]}),zt.jsxs(x,{children:[zt.jsxs(x,{sx:{color:"custom.status.green.default",fontWeight:600},children:[c,u?`/${u}`:""]}),zt.jsx(x,{sx:{mt:2,typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"rSayea",message:"APY"})})]})]},a.id):null}))})}function bm(){const[e,t]=G.useState([]),[n,o]=G.useState([]),[i,r]=G.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 jm({lqList:e,setOperatePool:t,supportAMM:o}){const i=y();return zt.jsx(zt.Fragment,{children:null==e?void 0:e.map((e=>{var r,l,a,s,d,c,u;if(!(null==e?void 0:e.pair))return null;const p=e.pair,h=Ep(p.baseToken,p.chainId),m=Ep(p.quoteToken,p.chainId),g=p.apy?al(new ie(null===(r=p.apy)||void 0===r?void 0:r.transactionBaseApy).plus(null!==(a=null===(l=p.apy)||void 0===l?void 0:l.miningBaseApy)&&void 0!==a?a:0)):void 0,y=f.utils.singleSideLp(p.type)&&p.apy?al(new ie(p.apy.transactionQuoteApy).plus(null!==(s=p.apy.miningQuoteApy)&&void 0!==s?s:0)):void 0,v=!!(null===(d=p.miningAddress)||void 0===d?void 0:d[0]),j=Lp(p.type);return zt.jsx(x,{sx:{p:8,borderRadius:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"border.disabled",backdropFilter:"blur(5px)"},children:zt.jsxs(x,{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||Hc.getState().push({type:Uc.PoolDetail,params:{chainId:p.chainId,address:p.id}})},children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8},children:[h&&m?zt.jsx(uu,{tokens:[h,m],width:24,mr:6,chainId:p.chainId,showChainLogo:!0}):"",zt.jsxs(x,{sx:{typography:"body2",fontWeight:600},children:[`${null==h?void 0:h.symbol}/${null==m?void 0:m.symbol}`,zt.jsx(tm,{address:p.id,chainId:p.chainId})]})]}),v?zt.jsxs(x,{sx:{p:8,typography:"h6",fontWeight:"bold",background:`linear-gradient(180deg, ${L(i.palette.secondary.main,.3)} 0%, ${L(i.palette.purple.main,.3)} 100%)`,borderRadius:8,color:"purple.main",whiteSpace:"nowrap"},children:["✨ ",zt.jsx(n,{id:"Sti4vy",message:"Mining"})]}):""]}),zt.jsxs(x,{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&&zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,whiteSpace:"nowrap"},children:[j,zt.jsx(W,{title:zt.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:zt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Op({type:p.type,lpFeeRate:null!==(c=p.lpFeeRate)&&void 0!==c?c:0,mtFeeRate:null!==(u=p.mtFeeRate)&&void 0!==u?u:0})})})]}),zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"1Qz63U",message:"Pool Type"})})]}),zt.jsxs(x,{children:[zt.jsxs(x,{sx:{typography:"h5",color:"success.main"},children:[g,y?`/${y}`:""]}),zt.jsxs(x,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:[zt.jsx(n,{id:"rSayea",message:"APY"}),zt.jsx(xm,{chainId:p.chainId,apy:p.apy,baseToken:h,quoteToken:m,hasQuote:!!y,hasMining:v,sx:{width:14,height:14}})]})]}),zt.jsxs(x,{children:[zt.jsxs(x,{sx:{typography:"h5"},children:["$",rl(new ie(p.tvl))]}),zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"FHKsZF",message:"TVL"})})]}),o&&zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:["$",Gr({input:p.volume24H||0})]}),zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"Q8W3SC",message:"Volume (1D)"})})]})]}),zt.jsxs(x,{sx:{mt:20,display:"flex",gap:"8px"},children:[zt.jsx(hc,{fullWidth:!0,size:b.Size.small,onClick:n=>{n.stopPropagation(),t({pool:Mp(e),hasMining:v})},children:zt.jsx(n,{id:"m16xKo",message:"Add"})}),o&&"PMM"===j&&zt.jsx(mm,{chainId:p.chainId,address:p.id})]})]})},p.id+p.chainId)}))})}function wm({lqList:e,operatePool:t,setOperatePool:i,hasMore:r,loadMore:l,loadMoreLoading:a,supportAMM:s}){const d=y();return zt.jsxs(fm,{hasMore:r,loadMore:l,loadMoreLoading:a,children:[zt.jsx(x,{component:"thead",children:zt.jsxs(x,{component:"tr",children:[zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"AxdOHo",message:"Pair"})}),s&&zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"1Qz63U",message:"Pool Type"})}),zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"FHKsZF",message:"TVL"})}),zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"rSayea",message:"APY"})}),s&&zt.jsx("th",{children:zt.jsx(n,{id:"Q8W3SC",message:"Volume (1D)"})}),zt.jsx(x,{component:"th",sx:{width:80}})]})}),zt.jsx(x,{component:"tbody",children:null==e?void 0:e.map((e=>{var r,l,a,c,u,p,h,m;if(!(null==e?void 0:e.pair))return null;const g=e.pair,y=Ep(g.baseToken,g.chainId),v=Ep(g.quoteToken,g.chainId),j=g.apy?al(new ie(null===(r=g.apy)||void 0===r?void 0:r.transactionBaseApy).plus(null!==(a=null===(l=g.apy)||void 0===l?void 0:l.miningBaseApy)&&void 0!==a?a:0)):void 0,w=f.utils.singleSideLp(g.type)&&g.apy?al(new ie(g.apy.transactionQuoteApy).plus(null!==(c=g.apy.miningQuoteApy)&&void 0!==c?c:0)):void 0;let C="";if((null===(u=null==t?void 0:t.pool)||void 0===u?void 0:u.address)===g.id||(null==t?void 0:t.address)===g.id)if(t.operate===Vh.Remove)C=o._({id:"0+31GV",message:"Removing"});else C=o._({id:"1yHVE+",message:"Adding"});const k=!!(null===(p=g.miningAddress)||void 0===p?void 0:p[0]),R=Lp(g.type),S=d.palette.background.tag;return zt.jsxs(x,{component:"tr",sx:{["&:hover td"+(C?", & td":"")]:{backgroundImage:`linear-gradient(${S}, ${S})`}},children:[zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[y&&v?zt.jsx(uu,{tokens:[y,v],width:24,mr:10,chainId:g.chainId,showChainLogo:!0}):"",zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[`${null==y?void 0:y.symbol}/${null==v?void 0:v.symbol}`,zt.jsx(tm,{address:g.id,chainId:g.chainId})]}),zt.jsx(du,{address:g.id,customChainId:g.chainId,truncate:!0,showCopy:!0,iconDarkHover:!0,iconSize:14,iconSpace:4,sx:{typography:"h6",color:"text.secondary"},disabledAddress:s,onAddressClick:()=>{Hc.getState().push({type:Uc.PoolDetail,params:{chainId:g.chainId,address:g.id}})}})]})]})}),s&&zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[zt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary",whiteSpace:"nowrap"},children:R}),zt.jsx(W,{title:zt.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:zt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Op({type:g.type,lpFeeRate:null!==(h=g.lpFeeRate)&&void 0!==h?h:0,mtFeeRate:null!==(m=g.mtFeeRate)&&void 0!==m?m:0})})})]})}),zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{typography:"body2"},title:g.tvl?`$${Gr({input:g.tvl})}`:void 0,children:["$",rl(new ie(g.tvl))]})}),zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[k?zt.jsx(W,{title:o._({id:"Sti4vy",message:"Mining"}),children:zt.jsxs(x,{component:"span",sx:{typography:"body2",color:"success.main"},children:["✨"," "]})}):"",zt.jsx(xm,{chainId:g.chainId,apy:g.apy,baseToken:y,quoteToken:v,hasQuote:!!w,hasMining:k,children:zt.jsxs(x,{component:"span",sx:{typography:"body2",fontWeight:600,display:"flex",alignItems:"center",width:"max-content",color:"success.main",cursor:"auto"},children:[j,w?`/${w}`:""]})})]})}),s&&zt.jsxs(x,{component:"td",children:["$",Gr({input:g.volume24H||0})]}),zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[s&&"PMM"===R&&zt.jsx(mm,{chainId:g.chainId,address:g.id}),C?zt.jsx(um,{text:C,onClick:()=>i(null)}):zt.jsx(b,{size:b.Size.small,onClick:()=>{i({pool:Mp(e),hasMining:k})},children:o._({id:"m16xKo",message:"Add"})})]})})]},g.id+g.chainId)}))})]})}function Cm({scrollParentRef:e,filterChainIds:t,activeChainId:n,handleChangeActiveChainId:o,operatePool:i,setOperatePool:r}){var l;const{onlyChainId:a,supportAMMV2:s,supportAMMV3:d,notSupportPMM:c}=Vr(),{minDevice:u,isMobile:p}=Rc(),h=je(),{filterTokens:m,filterASymbol:g,filterBSymbol:y,filterAddressLqList:v,handleDeleteToken:b,handleChangeFilterTokens:j,handleChangeFilterAddress:w}=bm(),C=[];s&&C.push("SVM_AMMV2"),d&&C.push("SVM_AMMV3");const k={chainIds:t,pageSize:p?4:8,filterState:{viewOnlyOwn:!1,filterTypes:C}},R=Ql(),S=R.getInfiniteQuery(f.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},k),{filterState:Object.assign({filterASymbol:g,filterBSymbol:y},k.filterState)})}),I=Se(Object.assign(Object.assign({},S),{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 M=!!(null==v?void 0:v.length);M?E=[...v]:null===(l=I.data)||void 0===l||l.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 T=I.hasNextPage&&!M;return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{sx:Object.assign(Object.assign({py:16,display:"flex",gap:8},u(475)?{}:{flexDirection:"column"}),p?{}:{px:20,borderBottomWidth:1}),children:[zt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",gap:8},u(475)?{}:{"& > button":{flex:1}}),children:[!a&&zt.jsx(cm,{chainId:n,setChainId:o}),zt.jsx(ym,{value:m,onChange:j,searchAddress:(e,t)=>Lr(this,void 0,void 0,(function*(){var n;const o=R.getInfiniteQuery(f.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},k),{filterState:Object.assign({address:e},k.filterState)})}),i=null===(n=(yield h.fetchQuery(o)).liquidity_list)||void 0===n?void 0:n.lqList;return(null==i?void 0:i.length)?zt.jsx(vm,{list:i,onClick:()=>{w(i),t()}}):null}))})]}),(M||!!m.length)&&zt.jsxs(x,{sx:{my:0},children:[M?zt.jsx(pm,{lqList:v,onDeleteTag:()=>w([])}):"",zt.jsx(hm,{tags:m,onDeleteTag:b})]})]}),p?zt.jsx(Tt,{hasMore:T,threshold:300,loadMore:ce((()=>{I.hasNextPage&&!I.isFetching&&I.fetchNextPage()}),500),useWindow:!1,getScrollParent:()=>e.current||null,loader:zt.jsx(gm,{sx:{mt:20}},"loader"),children:zt.jsxs(em,{gap:12,children:[I.isLoading?zt.jsx(gm,{}):"",!I.isLoading&&!(null==E?void 0:E.length)&&!I.error&&zt.jsx(_h,{sx:{mt:40},hasSearch:!!(n&&!a||g||y)}),!!I.error&&zt.jsx(Kh,{refresh:I.refetch,sx:{mt:40}}),zt.jsx(jm,{lqList:E,setOperatePool:r,supportAMM:s||d})]})}):zt.jsxs(zt.Fragment,{children:[zt.jsx(wm,{lqList:E,operatePool:i,setOperatePool:r,hasMore:T,loadMoreLoading:I.isFetchingNextPage,loadMore:()=>{I.hasNextPage&&!I.isFetching&&I.fetchNextPage()},supportAMM:s||d}),zt.jsx($h,{loading:I.isLoading,refetch:I.error?I.refetch:void 0,empty:!(null==E?void 0:E.length),hasSearch:!!(n&&!a||g||y)})]})]})}function km({onClick:e,title:t,desc:n}){const o=y();return zt.jsx(x,{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:zt.jsxs(M,{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:[zt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:o.palette.text.primary,textAlign:"left"},children:t}),zt.jsx(x,{sx:{typography:"h6",fontWeight:500,color:o.palette.text.secondary,textAlign:"left"},children:n})]})})}const Rm=e=>{const t=y(),{isMobile:o}=Rc(),{supportAMMV2:i,supportAMMV3:r,notSupportPMM:l}=Vr(),[a,s]=G.useState(!1),d={[Uc.CreatePool]:!l,[Uc.createPoolAMMV2]:!!i,[Uc.createPoolAMMV3]:!!r},c=Object.entries(d).filter((([e,t])=>!0===t)),u=1===c.length?c[0][0]:void 0;if(!u){const e=zt.jsxs(zt.Fragment,{children:[!l&&zt.jsx(km,{onClick:()=>{Hc.getState().push({type:Uc.CreatePool})},title:zt.jsx(n,{id:"Eif7f6",message:"PMM Pool"}),desc:zt.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})}),i&&zt.jsx(km,{onClick:()=>{Hc.getState().push({type:Uc.createPoolAMMV2})},title:zt.jsx(n,{id:"lNYomJ",message:"AMM V2 Position"}),desc:zt.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})}),r&&zt.jsx(km,{onClick:()=>{Hc.getState().push({type:Uc.createPoolAMMV3})},title:zt.jsx(n,{id:"sVlqoo",message:"AMM V3 Position"}),desc:zt.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})})]});return o?zt.jsxs(zt.Fragment,{children:[zt.jsxs(b,{variant:b.Variant.outlined,fullWidth:o,onClick:()=>{s(!0)},sx:{height:40},children:[zt.jsx(x,{component:Wt.Plus,sx:{mr:4}}),zt.jsx(n,{id:"p2jbcE",message:"Create Pool"})]}),zt.jsx(tc,{open:a,title:zt.jsx(n,{id:"p2jbcE",message:"Create Pool"}),onClose:()=>{s(!1)},modal:!0,children:zt.jsx(x,{sx:{mb:0},children:e})})]}):zt.jsx(W,{arrow:!1,leaveDelay:300,placement:o?"bottom":"bottom-end",sx:{p:0,backgroundColor:"background.paper"},title:zt.jsx(x,{children:e}),children:zt.jsxs(x,{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:[zt.jsx(x,{component:Wt.Plus}),zt.jsx(n,{id:"p2jbcE",message:"Create Pool"})]})})}return zt.jsxs(b,{variant:b.Variant.outlined,fullWidth:o,onClick:()=>{Hc.getState().push({type:u})},sx:{height:40},children:[zt.jsx(x,{component:Wt.Plus,sx:{mr:4}}),zt.jsx(n,{id:"p2jbcE",message:"Create Pool"})]})};const Sm=({onlyV3:e,setOnlyV3:t,sx:n})=>{const i=y(),{notSupportPMM:r}=Vr();return zt.jsx(x,{component:M,onClick:()=>t(!e),sx:Object.assign({display:"flex",alignItems:"center",p:2,borderRadius:8,backgroundColor:i.palette.border.main},n),children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center",width:"100%",[i.breakpoints.up("tablet")]:{width:194}},children:[zt.jsx(x,{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"})}),zt.jsx(x,{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 Im({account:e,lqList:t,setOperatePool:o,supportAMM:i}){const r=y();return zt.jsx(zt.Fragment,{children:null==t?void 0:t.map((t=>{var l,a,s,d,c,u,p,h,m,g,y,v,j,w;if(!(null==t?void 0:t.pair))return null;const C=t.pair,k=Ep(C.baseToken,C.chainId),R=Ep(C.quoteToken,C.chainId),S=f.utils.singleSideLp(C.type),I=C.apy?al(new ie(null===(l=C.apy)||void 0===l?void 0:l.transactionBaseApy).plus(null!==(s=null===(a=C.apy)||void 0===a?void 0:a.miningBaseApy)&&void 0!==s?s:0)):"0%",E=S&&C.apy?al(new ie(C.apy.transactionQuoteApy).plus(null!==(d=C.apy.miningQuoteApy)&&void 0!==d?d:0)):void 0;let M,T;(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 l=null===(t=e.id)||void 0===t?void 0:t.split("-");if(2===(null==l?void 0:l.length)){const t=l[1].toLocaleLowerCase();if((null===(o=null===(n=null==C?void 0:C.baseLpToken)||void 0===n?void 0:n.id)||void 0===o?void 0:o.toLocaleLowerCase())===t)return void(M=new ie(e.liquidityTokenBalance));(null===(r=null===(i=null==C?void 0:C.quoteLpToken)||void 0===i?void 0:i.id)||void 0===r?void 0:r.toLocaleLowerCase())===t&&(T=new ie(e.liquidityTokenBalance))}}}));const O=!!(null===(u=C.miningAddress)||void 0===u?void 0:u[0]),V=null===(p=t.liquidityPositions)||void 0===p?void 0:p[0],F=C.type,A=Lp(F),Z="SVM_AMMV2"===F,P="SVM_AMMV3"===F;return zt.jsx(x,{sx:{p:8,borderRadius:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"border.disabled",backdropFilter:"blur(5px)"},children:zt.jsxs(x,{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||Hc.getState().push({type:Uc.PoolDetail,params:{chainId:C.chainId,address:C.id}})},children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8},children:[k&&R?zt.jsx(uu,{tokens:[k,R],width:24,mr:6,chainId:C.chainId,showChainLogo:!0}):"",zt.jsxs(x,{sx:{typography:"body2",fontWeight:600},children:[`${null==k?void 0:k.symbol}/${null==R?void 0:R.symbol}`,zt.jsx(tm,{address:C.id,chainId:C.chainId})]})]}),O?zt.jsxs(x,{sx:{p:8,typography:"h6",fontWeight:"bold",background:`linear-gradient(180deg, ${L(r.palette.secondary.main,.3)} 0%, ${L(r.palette.purple.main,.3)} 100%)`,borderRadius:8,color:"purple.main",whiteSpace:"nowrap"},children:["✨ ",zt.jsx(n,{id:"Sti4vy",message:"Mining"})]}):""]}),zt.jsxs(x,{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&&zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,whiteSpace:"nowrap"},children:[A,zt.jsx(W,{title:zt.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:zt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Op({type:C.type,lpFeeRate:null!==(h=C.lpFeeRate)&&void 0!==h?h:0,mtFeeRate:null!==(m=C.mtFeeRate)&&void 0!==m?m:0})})})]}),zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"1Qz63U",message:"Pool Type"})})]}),P?null:zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{children:[zt.jsxs(x,{sx:{typography:"h5",color:"success.main"},children:[I,E?`/${E}`:""]}),zt.jsxs(x,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:[zt.jsx(n,{id:"rSayea",message:"APY"}),zt.jsx(xm,{chainId:C.chainId,apy:C.apy,baseToken:k,quoteToken:R,hasQuote:!!E,hasMining:O,sx:{width:14,height:14}})]})]}),zt.jsxs(x,{children:[zt.jsxs(x,{sx:{typography:"h5"},children:["$",rl(new ie(C.tvl||0))]}),zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"FHKsZF",message:"TVL"})})]})]}),Z&&zt.jsxs(x,{children:[zt.jsx(x,{sx:{typography:"h5"},children:ll({input:null===(y=null===(g=t.liquidityPositions)||void 0===g?void 0:g[0])||void 0===y?void 0:y.poolShare})}),zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"h3PbRN",message:"My Pool Share"})})]}),zt.jsxs(x,{children:[zt.jsx(x,{sx:{typography:"h5",display:"flex",alignItems:"center",fontWeight:"bold"},children:P?(null==V?void 0:V.liquidityUSD)?`$${_r({input:V.liquidityUSD,decimals:2})}`:"-":zt.jsxs(zt.Fragment,{children:[S?zt.jsx(Ss,{address:null==k?void 0:k.address,chainId:C.chainId,url:null==k?void 0:k.logoURI,width:18,height:18,sx:{mr:4}}):zt.jsx(uu,{tokens:k&&R?[k,R]:[],width:18,mr:4,showChainLogo:!1,chainId:C.chainId}),M?Gr({input:M}):"",S&&zt.jsxs(zt.Fragment,{children:[" / ",zt.jsx(Ss,{address:null==R?void 0:R.address,chainId:C.chainId,url:null==R?void 0:R.logoURI,width:18,height:18,sx:{mx:4}}),T?Gr({input:T}):"0"]})]})}),zt.jsx(x,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:zt.jsx(n,{id:"YHc3B+",message:"My Liquidity"})})]}),P&&zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,color:"text.primary"},children:[zt.jsx(Th,{outOfRange:null!==(v=null==V?void 0:V.outOfRange)&&void 0!==v&&v}),zt.jsx(x,{children:zt.jsxs(zt.Fragment,{children:[zt.jsxs("span",{children:[Fp({price:null===(j=null==V?void 0:V.priceRange)||void 0===j?void 0:j.token0LowerPrice,atLimit:{},direction:Fu.LOWER})," "]}),null==k?void 0:k.symbol]})}),zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:zt.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"})}),zt.jsx(x,{children:zt.jsxs(zt.Fragment,{children:[zt.jsxs("span",{children:[Fp({price:null===(w=null==V?void 0:V.priceRange)||void 0===w?void 0:w.token1LowerPrice,atLimit:{},direction:Fu.UPPER})," "]}),null==k?void 0:k.symbol]})})]}),zt.jsx(x,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:zt.jsx(n,{id:"YA4hwj",message:"Price Range"})})]})]}),zt.jsxs(x,{sx:{mt:20,display:"flex",gap:"8px"},children:[P?null:!!e&&zt.jsx(hc,{fullWidth:!0,variant:b.Variant.outlined,size:b.Size.small,onClick:e=>{e.stopPropagation(),o({operate:Vh.Remove,pool:Tp(t),hasMining:O})},children:zt.jsx(n,{id:"t/YqKh",message:"Remove"})}),zt.jsx(hc,{fullWidth:!0,size:b.Size.small,onClick:e=>{e.stopPropagation(),o({operate:Vh.Add,pool:Tp(t),hasMining:O})},children:zt.jsx(n,{id:"J/hVSQ",message:"{0}",values:{0:P?"Manage":"Add"}})}),i&&"PMM"===A&&zt.jsx(mm,{chainId:C.chainId,address:C.id})]})]})},P?null==V?void 0:V.id:C.id+C.chainId)}))})}function Em({account:e,lqList:t,operatePool:i,setOperatePool:r,supportAMM:l,onlyV3:a}){const s=y();return zt.jsxs(fm,{children:[zt.jsx(x,{component:"thead",children:zt.jsxs(x,{component:"tr",children:[zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"AxdOHo",message:"Pair"})}),l&&zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"1Qz63U",message:"Pool Type"})}),a?null:zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"FHKsZF",message:"TVL"})}),a?null:zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"rSayea",message:"APY"})}),zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"YHc3B+",message:"My Liquidity"})}),a?zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"YA4hwj",message:"Price Range"})}):null,zt.jsx(x,{component:"th",sx:{width:210}})]})}),zt.jsx(x,{component:"tbody",children:null==t?void 0:t.map((t=>{var d,c,u,p,h,m,g,y,v,j,w,C,k,R,S,I,E,M;if(!(null==t?void 0:t.pair))return null;const T=t.pair,L=Ep(T.baseToken,T.chainId),O=Ep(T.quoteToken,T.chainId),V=f.utils.singleSideLp(T.type),F=T.apy?al(new ie(null===(d=T.apy)||void 0===d?void 0:d.transactionBaseApy).plus(null!==(u=null===(c=T.apy)||void 0===c?void 0:c.miningBaseApy)&&void 0!==u?u:0)):void 0,A=V&&T.apy?al(new ie(T.apy.transactionQuoteApy).plus(null!==(p=T.apy.miningQuoteApy)&&void 0!==p?p:0)):void 0;let Z,P;(null===(h=t.liquidityPositions)||void 0===h?void 0:h.length)&&t.liquidityPositions.forEach((e=>{var t,n,o,i,r;if(null==e?void 0:e.liquidityTokenBalance){const l=null===(t=e.id)||void 0===t?void 0:t.split("-");if(2===(null==l?void 0:l.length)){const t=l[1].toLocaleLowerCase();if((null===(o=null===(n=null==T?void 0:T.baseLpToken)||void 0===n?void 0:n.id)||void 0===o?void 0:o.toLocaleLowerCase())===t)return void(Z=new ie(e.liquidityTokenBalance));(null===(r=null===(i=null==T?void 0:T.quoteLpToken)||void 0===i?void 0:i.id)||void 0===r?void 0:r.toLocaleLowerCase())===t&&(P=new ie(e.liquidityTokenBalance))}}}));const B=null===(m=t.liquidityPositions)||void 0===m?void 0:m[0],N=T.type,U=Lp(N),H="SVM_AMMV2"===N,D="SVM_AMMV3"===N;let Y="";if(D)(null===(v=null===(y=null===(g=null==i?void 0:i.pool)||void 0===g?void 0:g.liquidityPositions)||void 0===y?void 0:y[0])||void 0===v?void 0:v.id)===(null==B?void 0:B.id)&&(Y=o._({id:"p3607o",message:"Managing"}));else if((null===(j=null==i?void 0:i.pool)||void 0===j?void 0:j.address)===T.id||(null==i?void 0:i.address)===T.id)if(i.operate===Vh.Remove)Y=o._({id:"0+31GV",message:"Removing"});else Y=o._({id:"1yHVE+",message:"Adding"});const z=!!(null===(w=T.miningAddress)||void 0===w?void 0:w[0]),X=s.palette.background.tag;return zt.jsxs(x,{component:"tr",sx:{["&:hover td"+(Y?", & td":"")]:{backgroundImage:`linear-gradient(${X}, ${X})`}},children:[zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[L&&O?zt.jsx(uu,{tokens:[L,O],width:24,mr:10,chainId:T.chainId,showChainLogo:!0}):"",zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[`${null==L?void 0:L.symbol}/${null==O?void 0:O.symbol}`,zt.jsx(tm,{address:T.id,chainId:T.chainId})]}),zt.jsx(du,{address:T.id,customChainId:T.chainId,truncate:!0,showCopy:!0,iconDarkHover:!0,iconSize:14,iconSpace:4,disabledAddress:l,onAddressClick:()=>{Hc.getState().push({type:Uc.PoolDetail,params:{chainId:T.chainId,address:T.id}})},sx:{typography:"h6",color:"text.secondary"}})]})]})}),l&&zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[zt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary",whiteSpace:"nowrap"},children:U}),zt.jsx(W,{title:zt.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:zt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Op({type:T.type,lpFeeRate:null!==(C=T.lpFeeRate)&&void 0!==C?C:0,mtFeeRate:null!==(k=T.mtFeeRate)&&void 0!==k?k:0})})})]})}),D?null:zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{typography:"body2"},title:T.tvl?`$${Gr({input:T.tvl||0})}`:void 0,children:["$",rl(new ie(T.tvl||0))]})}),D?null:zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[z?zt.jsx(W,{title:o._({id:"Sti4vy",message:"Mining"}),children:zt.jsxs(x,{component:"span",sx:{typography:"body2",color:"success.main"},children:["✨"," "]})}):"",zt.jsx(xm,{chainId:T.chainId,apy:T.apy,baseToken:L,quoteToken:O,hasQuote:!!A,hasMining:z,children:zt.jsxs(x,{component:"span",sx:{typography:"body2",fontWeight:600,display:"flex",alignItems:"center",width:"max-content",color:"success.main",cursor:"auto"},children:[F||"0%",A?`/${A}`:""]})})]})}),zt.jsx(x,{component:"td",children:zt.jsx(x,{sx:{display:"flex",alignItems:"center"},children:D?(null==B?void 0:B.liquidityUSD)?`$${_r({input:B.liquidityUSD,decimals:2})}`:"-":zt.jsxs(zt.Fragment,{children:[V?zt.jsx(Ss,{address:null==L?void 0:L.address,chainId:T.chainId,url:null==L?void 0:L.logoURI,width:24,height:24,noShowChain:!0,sx:{mr:4}}):zt.jsx(uu,{tokens:L&&O?[L,O]:[],width:24,mr:4,showChainLogo:!1,chainId:T.chainId}),Z?Gr({input:Z}):"-",V&&zt.jsxs(zt.Fragment,{children:[" / ",zt.jsx(Ss,{address:null==O?void 0:O.address,chainId:T.chainId,url:null==O?void 0:O.logoURI,width:24,height:24,noShowChain:!0,sx:{mx:4}}),P?Gr({input:P}):"0"]}),H&&zt.jsx(W,{title:zt.jsx(n,{id:"NXZdrO",message:"My pool share"}),children:zt.jsx(x,{sx:{ml:4,px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:ll({input:null===(S=null===(R=t.liquidityPositions)||void 0===R?void 0:R[0])||void 0===S?void 0:S.poolShare})})})]})})}),a?zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,color:"text.primary"},children:[zt.jsx(Th,{outOfRange:null!==(I=null==B?void 0:B.outOfRange)&&void 0!==I&&I}),zt.jsx(x,{children:zt.jsxs(zt.Fragment,{children:[zt.jsxs("span",{children:[Fp({price:null===(E=null==B?void 0:B.priceRange)||void 0===E?void 0:E.token0LowerPrice,atLimit:{},direction:Fu.LOWER})," "]}),null==L?void 0:L.symbol]})}),zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:zt.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"})}),zt.jsx(x,{children:zt.jsxs(zt.Fragment,{children:[zt.jsxs("span",{children:[Fp({price:null===(M=null==B?void 0:B.priceRange)||void 0===M?void 0:M.token0UpperPrice,atLimit:{},direction:Fu.UPPER})," "]}),null==L?void 0:L.symbol]})})]})}):null,zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[l&&"PMM"===U&&zt.jsx(mm,{chainId:T.chainId,address:T.id}),Y?zt.jsx(um,{text:Y,onClick:()=>r(null)}):zt.jsxs(zt.Fragment,{children:[D?null:!!e&&zt.jsx(hc,{variant:b.Variant.outlined,size:b.Size.small,onClick:e=>{e.stopPropagation(),r({operate:Vh.Remove,pool:Tp(t),hasMining:z})},children:zt.jsx(n,{id:"t/YqKh",message:"Remove"})}),zt.jsx(hc,{size:b.Size.small,onClick:()=>{r({pool:Tp(t),hasMining:z})},children:D?o._({id:"wckWOP",message:"Manage"}):o._({id:"m16xKo",message:"Add"})})]})]})})]},D?null==B?void 0:B.id:T.id+T.chainId)}))})]})}function Mm({account:e,filterChainIds:t,activeChainId:n,handleChangeActiveChainId:o,operatePool:i,setOperatePool:r}){var l,a,s,d,c,u,p;y();const{minDevice:h,isMobile:m}=Rc(),g=je(),{onlyChainId:v,supportAMMV2:b,supportAMMV3:j,notSupportPMM:w}=Vr(),[C,k]=G.useState(!1),{filterTokens:R,filterASymbol:S,filterBSymbol:I,filterAddressLqList:E,handleDeleteToken:M,handleChangeFilterTokens:T,handleChangeFilterAddress:L}=bm();let O=[];b&&O.push("SVM_AMMV2"),j&&C&&(O=["SVM_AMMV3"]);const W={currentPage:1,pageSize:1e3,user:e,filterState:{viewOnlyOwn:!0,filterTypes:O}},V=Ql(),F=V.getQuery(f.graphql.fetchMyLiquidityList,{where:Object.assign(Object.assign({},W),{filterState:Object.assign({filterASymbol:S,filterBSymbol:I},W.filterState)})}),A=we(Object.assign({},F));let Z=null!==(s=null===(a=null===(l=A.data)||void 0===l?void 0:l.liquidity_list)||void 0===a?void 0:a.lqList)&&void 0!==s?s:[];const P=!!(null==E?void 0:E.length);P?Z=[...E]:t&&(Z=null!==(p=null===(u=null===(c=null===(d=A.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!==p?p:[]);return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{sx:Object.assign(Object.assign({py:16,display:"flex",gap:8},h(475)?{}:{flexDirection:"column"}),m?{}:{px:20,borderBottomWidth:1}),children:[zt.jsxs(x,{sx:Object.assign(Object.assign({display:"flex",alignItems:"center",gap:8},h(475)?{}:{"& > button":{flex:1,flexBasis:"100%"}}),m?{flexWrap:"wrap"}:{}),children:[!v&&zt.jsx(cm,{chainId:n,setChainId:o}),j&&zt.jsx(Sm,{onlyV3:C,setOnlyV3:k,sx:m?{flexGrow:1,flexBasis:"100%"}:void 0}),zt.jsx(ym,{value:R,onChange:T,searchAddress:(e,t)=>Lr(this,void 0,void 0,(function*(){var n;const o=V.getInfiniteQuery(f.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},W),{filterState:Object.assign({address:e},W.filterState)})}),i=null===(n=(yield g.fetchQuery(o)).liquidity_list)||void 0===n?void 0:n.lqList;return(null==i?void 0:i.length)?zt.jsx(vm,{list:i,onClick:()=>{L(i),t()}}):null}))})]}),(P||!!R.length)&&zt.jsxs(x,{sx:{my:0},children:[P?zt.jsx(pm,{lqList:E,onDeleteTag:()=>L([])}):"",zt.jsx(hm,{tags:R,onDeleteTag:M})]})]}),m?zt.jsxs(em,{gap:12,children:[A.isLoading?zt.jsx(gm,{}):"",!A.isLoading&&!(null==Z?void 0:Z.length)&&!A.error&&zt.jsx(_h,{sx:{mt:40},hasSearch:!!(n&&!v||S||I)}),!!A.error&&zt.jsx(Kh,{refresh:A.refetch,sx:{mt:40}}),zt.jsx(Im,{account:e,lqList:Z,setOperatePool:r,supportAMM:b||j})]}):zt.jsxs(zt.Fragment,{children:[zt.jsx(Em,{account:e,lqList:Z,operatePool:i,setOperatePool:r,supportAMM:b||j,onlyV3:C}),zt.jsx($h,{loading:A.isLoading,refetch:A.error?A.refetch:void 0,empty:!(null==Z?void 0:Z.length),hasSearch:!!(n&&!v||S||I)})]})]})}var Tm,Lm;function Om(){return Om=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},Om.apply(null,arguments)}const Wm=e=>q.createElement("svg",Om({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),Tm||(Tm=q.createElement("rect",{width:64,height:60.1342,fill:"url(#pattern0)"})),Lm||(Lm=q.createElement("defs",null,q.createElement("pattern",{id:"pattern0",patternContentUnits:"objectBoundingBox",width:1,height:1},q.createElement("use",{xlinkHref:"#image0_2465_53170",transform:"matrix(0.00671141 0 0 0.00714286 -0.503356 -0.9)"})),q.createElement("image",{id:"image0_2465_53170",width:300,height:300,xlinkHref:"data:image/png;base64,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"}))));function Vm(e){var{sx:t}=e,n=Tr(e,["sx"]);return zt.jsx(D,{...n,sx:Object.assign(Object.assign({},t),{display:"flex",flexDirection:"column",overflow:"hidden"})})}function Fm({params:t}){var n,r,l;const{isMobile:a}=Rc(),s=Vr((e=>e.noDocumentLink)),d=G.useRef(null),{account:c}=Ar(),{poolTab:u,tabs:p,handleChangePoolTab:h}=function({account:t,paramsTab:n}){const{i18n:o}=e(),[i,r]=G.useState(nu.addLiquidity),{supportAMMV2:l,supportAMMV3:a,notSupportPMM:s}=Vr(),d=G.useMemo((()=>{const e=[{key:nu.addLiquidity,value:o._({id:"OBdohg",message:"Add Liquidity"})},{key:nu.myLiquidity,value:o._({id:"YHc3B+",message:"My Liquidity"})}];return s||e.push({key:nu.myCreated,value:l||a?o._({id:"zcVtwU",message:"My Pools (PMM)"}):o._({id:"fZFkP1",message:"My Pools"})}),e}),[o._,l,a,s]),c=G.useRef(!1);G.useEffect((()=>{const e=sessionStorage.getItem(eu);t&&e&&!c.current&&(c.current=!0,r(e))}),[t]);const u=e=>{r(e),sessionStorage.setItem(eu,e)};return G.useEffect((()=>{n&&u(n)}),[n]),{poolTab:i,tabs:d,handleChangePoolTab:u}}({account:c,paramsTab:null==t?void 0:t.tab}),{activeChainId:m,filterChainIds:f,handleChangeActiveChainId:g}=function(){const{chainId:e}=Ar(),{onlyChainId:t}=Vr(),[n,o]=G.useState(t),r=G.useMemo((()=>void 0!==n?[n]:Rs(e)?void 0:Object.values(i).filter((e=>!!Number(e)))),[e,n]);return G.useEffect((()=>{const e=sessionStorage.getItem(tu);e&&o(Number(e))}),[]),{activeChainId:n,filterChainIds:r,handleChangeActiveChainId:e=>{void 0===e?sessionStorage.removeItem(tu):sessionStorage.setItem(tu,String(e)),o(e)}}}(),[y,v]=G.useState(null);return zt.jsxs(Xc,{sx:Object.assign({},a?{p:20}:{display:"flex",gap:12,flex:1}),ref:d,children:[zt.jsx(x,{sx:a?{}:{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:zt.jsxs(U,{value:u,onChange:(e,t)=>{h(t)},sx:a?{}:{display:"flex",flexDirection:"column",borderRadius:16,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"background.paper"},className:a?void 0:"gradient-card-border",children:[zt.jsxs(x,{sx:a?{}:{display:"flex",justifyContent:"space-between",p:20,borderBottomWidth:1},children:[zt.jsx(z,{tabs:p,variant:"rounded",tabsListSx:Object.assign({},a?{mb:16}:{borderBottomWidth:0,justifyContent:"space-between"}),tabSx:a?void 0:{mb:0}}),zt.jsx(Rm,{})]}),zt.jsx(Vm,{value:nu.addLiquidity,sx:{display:"flex",flexDirection:"column",overflow:"hidden"},children:zt.jsx(Cm,{account:c,filterChainIds:f,scrollParentRef:d,activeChainId:m,handleChangeActiveChainId:g,operatePool:y,setOperatePool:v})}),zt.jsx(Vm,{value:nu.myLiquidity,children:zt.jsx(Mm,{account:c,filterChainIds:f,activeChainId:m,handleChangeActiveChainId:g,operatePool:y,setOperatePool:v})})]})}),zt.jsxs(x,{sx:{position:"relative",width:s&&!y?"auto":375},children:[!s&&zt.jsx(xh,{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:Wm}),"SVM_AMMV3"===(null===(n=null==y?void 0:y.pool)||void 0===n?void 0:n.type)&&y.pool.chainId?u===nu.myLiquidity&&(null===(l=null===(r=y.pool.liquidityPositions)||void 0===r?void 0:r[0])||void 0===l?void 0:l.tokenId)?zt.jsx(Mh,{mint1Address:y.pool.baseToken.address,mint2Address:y.pool.quoteToken.address,feeAmount:Number(y.pool.lpFeeRate),poolId:y.pool.address,nftMint:y.pool.liquidityPositions[0].tokenId,onClose:()=>v(null)}):zt.jsx(Oh,{mint1Address:y.pool.baseToken.address,mint2Address:y.pool.quoteToken.address,feeAmount:Number(y.pool.lpFeeRate),poolId:y.pool.address,onClose:()=>v(null),handleGoToAddLiquidityV3:e=>{Hc.getState().push({type:Uc.createPoolAMMV3,params:e})}}):a?zt.jsx(Yh,{account:c,onClose:()=>v(null),modal:a,pool:null==y?void 0:y.pool,operate:null==y?void 0:y.operate,hasMining:!1,hidePoolInfo:!1}):!!y&&zt.jsx(Dh,{account:c,onClose:()=>v(null),pool:null==y?void 0:y.pool,operate:null==y?void 0:y.operate,hasMining:!1,hidePoolInfo:!1,sx:{width:375,height:"max-content",backgroundColor:"background.paper",borderRadius:16,overflow:"hidden"}})]})]})}function Am(){const{routerPage:e}=Vr(),t=Hc((e=>e.page)),n=null!=e?e:t;switch(null==n?void 0:n.type){case Uc.Pool:return zt.jsx(Fm,{params:n.params});case Uc.createPoolAMMV2:return zt.jsx(ju,{});case Uc.createPoolAMMV3:return zt.jsx(gh,{params:n.params,handleGoBack:()=>{Hc.getState().push({type:Uc.Pool})},handleGoToPoolList:()=>{Hc.getState().push({type:Uc.Pool})}});default:return zt.jsx(Fm,{params:null==n?void 0:n.params})}}export{ju as AMMV2Create,Mh as AMMV3PositionManage,Oh as AMMV3PositionsView,gh as AddLiquidityV3,Pr as MetadataFlag,Uc as PageType,Am as Pool,Fm as PoolList,Nc as Swap,cc as UnstyleWidget,uc as Widget,Hc as useRouterStore};
|
|
23
|
+
*/function ud(){if(Ks)return Qs;Ks=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return Qs=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,l,a=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)&&(a[d]=r[d]);if(e){l=e(r);for(var c=0;c<l.length;c++)n.call(r,l[c])&&(a[l[c]]=r[l[c]])}}return a},Qs}function pd(){if(ed)return $s;ed=1;return $s="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function hd(){return nd?td:(nd=1,td=Function.call.bind(Object.prototype.hasOwnProperty))}if("production"!==process.env.NODE_ENV){var md=cd();Xs.exports=function(){if(ld)return rd;ld=1;var e=cd(),t=ud(),n=pd(),o=hd(),i=function(){if(id)return od;id=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=pd(),n={},o=hd();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function i(i,r,l,a,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((a||"React class")+": "+l+" 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,a,l,null,t)}catch(e){c=e}if(!c||c instanceof Error||e((a||"React class")+": type specification of "+l+" `"+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 "+l+" type: "+c.message+(null!=p?p:""))}}}return i.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(n={})},od=i}(),r=function(){};function l(){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){}}),rd=function(a,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:f(l),arrayOf:function(e){return f((function(t,o,i,r,l){if("function"!=typeof e)return new m("Property `"+l+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var a=t[o];if(!Array.isArray(a))return new m("Invalid "+r+" `"+l+"` of type `"+v(a)+"` supplied to `"+i+"`, expected an array.");for(var s=0;s<a.length;s++){var d=e(a,s,i,r,l+"["+s+"]",n);if(d instanceof Error)return d}return null}))},element:f((function(e,t,n,o,i){var r=e[t];return a(r)?null:new m("Invalid "+o+" `"+i+"` of type `"+v(r)+"` supplied to `"+n+"`, expected a single ReactElement.")})),elementType:f((function(t,n,o,i,r){var l=t[n];return e.isValidElementType(l)?null:new m("Invalid "+i+" `"+r+"` of type `"+v(l)+"` supplied to `"+o+"`, expected a single ReactElement type.")})),instanceOf:function(e){return f((function(t,n,o,i,r){if(!(t[n]instanceof e)){var l=e.name||u;return new m("Invalid "+i+" `"+r+"` of type `"+((a=t[n]).constructor&&a.constructor.name?a.constructor.name:u)+"` supplied to `"+o+"`, expected instance of `"+l+"`.")}var a;return null}))},node:f((function(e,t,n,o,i){return y(e[t])?null:new m("Invalid "+o+" `"+i+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return f((function(t,i,r,l,a){if("function"!=typeof e)return new m("Property `"+a+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var s=t[i],d=v(s);if("object"!==d)return new m("Invalid "+l+" `"+a+"` of type `"+d+"` supplied to `"+r+"`, expected an object.");for(var c in s)if(o(s,c)){var u=e(s,c,r,l,a+"."+c,n);if(u instanceof Error)return u}return null}))},oneOf:function(e){return Array.isArray(e)?f((function(t,n,o,i,r){for(var l=t[n],a=0;a<e.length;a++)if(h(l,e[a]))return null;var s=JSON.stringify(e,(function(e,t){return"symbol"===b(t)?String(t):t}));return new m("Invalid "+i+" `"+r+"` of value `"+String(l)+"` 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."),l)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&r("Invalid argument supplied to oneOfType, expected an instance of array."),l;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+"."),l}return f((function(t,i,r,l,a){for(var s=[],d=0;d<e.length;d++){var c=(0,e[d])(t,i,r,l,a,n);if(null==c)return null;c.data&&o(c.data,"expectedType")&&s.push(c.data.expectedType)}return new m("Invalid "+l+" `"+a+"` supplied to `"+r+"`"+(s.length>0?", expected one of type ["+s.join(", ")+"]":"")+".")}))},shape:function(e){return f((function(t,o,i,r,l){var a=t[o],s=v(a);if("object"!==s)return new m("Invalid "+r+" `"+l+"` 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,l,d,b(c));var u=c(a,d,i,r,l+"."+d,n);if(u)return u}return null}))},exact:function(e){return f((function(i,r,l,a,s){var d=i[r],c=v(d);if("object"!==c)return new m("Invalid "+a+" `"+s+"` of type `"+c+"` supplied to `"+l+"`, 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(l,a,s,p,b(h));if(!h)return new m("Invalid "+a+" `"+s+"` key `"+p+"` supplied to `"+l+"`.\nBad object: "+JSON.stringify(i[r],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var f=h(d,p,l,a,s+"."+p,n);if(f)return f}return null}))}};function h(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function m(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function f(e){if("production"!==process.env.NODE_ENV)var t={},o=0;function i(i,l,a,d,c,p,h){if(d=d||u,p=p||a,h!==n){if(s){var f=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 f.name="Invariant Violation",f}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var g=d+":"+a;!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==l[a]?i?null===l[a]?new m("The "+c+" `"+p+"` is marked as required in `"+d+"`, but its value is `null`."):new m("The "+c+" `"+p+"` is marked as required in `"+d+"`, but its value is `undefined`."):null:e(l,a,d,c,p)}var l=i.bind(null,!1);return l.isRequired=i.bind(null,!0),l}function g(e){return f((function(t,n,o,i,r,l){var a=t[n];return v(a)!==e?new m("Invalid "+i+" `"+r+"` of type `"+b(a)+"` supplied to `"+o+"`, expected `"+e+"`.",{expectedType:e}):null}))}function x(e,t,n,o,i){return new m((e||"React class")+": "+t+" type `"+n+"."+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}function y(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(y);if(null===e||a(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(!y(n.value))return!1}else for(;!(n=o.next()).done;){var i=n.value;if(i&&!y(i[1]))return!1}return!0;default:return!1}}function v(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=v(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 m.prototype=Error.prototype,p.checkPropTypes=i,p.resetWarningCache=i.resetWarningCache,p.PropTypes=p,p},rd}()(md.isElement,!0)}else Xs.exports=function(){if(sd)return ad;sd=1;var e=pd();function t(){}function n(){}return n.resetWarningCache=t,ad=function(){function o(t,n,o,i,r,l){if(l!==e){var a=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 a.name="Invariant Violation",a}}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 fd=Lt(Xs.exports);function gd(e,t){return"production"===process.env.NODE_ENV?()=>null:function(...n){return e(...n)||t(...n)}}function xd(e,t,n,o,i){const r=e[t],l=i||t;if(null==r||"undefined"==typeof window)return null;let a;const s=r.type;return"function"!=typeof s||function(e){const{prototype:t={}}=e;return Boolean(t.isReactComponent)}(s)||(a="Did you accidentally use a plain function component for an element instead?"),void 0!==a?new Error(`Invalid ${o} \`${l}\` supplied to \`${n}\`. Expected an element that can hold a ref. ${a} For more information see https://mui.com/r/caveat-with-refs-guide`):null}const yd=gd(fd.element,xd);yd.isRequired=gd(fd.element.isRequired,xd);const vd="exact-prop: ";function bd(e){return e&&e.ownerDocument||document}const jd="undefined"!=typeof window?q.useLayoutEffect:q.useEffect;function wd(e){const t=q.useRef(e);return jd((()=>{t.current=e})),q.useRef(((...e)=>(0,t.current)(...e))).current}function Cd(...e){return q.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 kd={};const Rd=[];class Sd{static create(){return new Sd}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 Id(){const e=function(e,t){const n=q.useRef(kd);return n.current===kd&&(n.current=e(t)),n}(Sd.create).current;var t;return t=e.disposeEffect,q.useEffect(t,Rd),e}const Ed={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 Md(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=Md(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Td(){for(var e,t,n=0,o="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Md(e))&&(o&&(o+=" "),o+=t);return o}function Ld(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 Od(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 Wd(e){const{elementType:t,externalSlotProps:n,ownerState:o,skipResolvingSlotProps:i=!1,...r}=e,l=i?{}:function(e,t,n){return"function"==typeof e?e(t,n):e}(n,o),{props:a,internalRef:s}=function(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:o,externalForwardedProps:i,className:r}=e;if(!t){const e=Td(n?.className,r,i?.className,o?.className),t={...n?.style,...i?.style,...o?.style},l={...n,...i,...o};return e.length>0&&(l.className=e),Object.keys(t).length>0&&(l.style=t),{props:l,internalRef:void 0}}const l=Ld({...i,...o}),a=Od(o),s=Od(i),d=t(l),c=Td(d?.className,n?.className,r,i?.className,o?.className),u={...d?.style,...n?.style,...i?.style,...o?.style},p={...d,...n,...s,...a};return c.length>0&&(p.className=c),Object.keys(u).length>0&&(p.style=u),{props:p,internalRef:d.ref}}({...r,externalSlotProps:l}),d=function(e,t,n){return void 0===e||"string"==typeof e?t:{...t,ownerState:{...t.ownerState,...n}}}(t,{...a,ref:Cd(s,l?.ref,e.additionalProps?.ref)},o);return d}function Vd(e){return e.substring(2).toLowerCase()}function Fd(e){const{children:t,disableReactTree:n=!1,mouseEvent:o="onClick",onClickAway:i,touchEvent:r="onTouchEnd"}=e,l=q.useRef(!1),a=q.useRef(null),s=q.useRef(!1),d=q.useRef(!1);q.useEffect((()=>(setTimeout((()=>{s.current=!0}),0),()=>{s.current=!1})),[]);const c=Cd((u=t)&&q.isValidElement(u)?u.props.propertyIsEnumerable("ref")?u.props.ref:u.ref:null,a);var u;const p=wd((e=>{const t=d.current;d.current=!1;const o=bd(a.current);if(!s.current||!a.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}(e,o))return;if(l.current)return void(l.current=!1);let r;r=e.composedPath?e.composedPath().indexOf(a.current)>-1:!o.documentElement.contains(e.target)||a.current.contains(e.target),r||!n&&t||i(e)})),h=e=>n=>{d.current=!0;const o=t.props[e];o&&o(n)},m={ref:c};return!1!==r&&(m[r]=h(r)),q.useEffect((()=>{if(!1!==r){const e=Vd(r),t=bd(a.current),n=()=>{l.current=!0};return t.addEventListener(e,p),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,p),t.removeEventListener("touchmove",n)}}}),[p,r]),!1!==o&&(m[o]=h(o)),q.useEffect((()=>{if(!1!==o){const e=Vd(o),t=bd(a.current);return t.addEventListener(e,p),()=>{t.removeEventListener(e,p)}}}),[p,o]),zt.jsx(q.Fragment,{children:q.cloneElement(t,m)})}"production"!==process.env.NODE_ENV&&(Fd.propTypes={children:yd.isRequired,disableReactTree:fd.bool,mouseEvent:fd.oneOf(["onClick","onMouseDown","onMouseUp","onPointerDown","onPointerUp",!1]),onClickAway:fd.func.isRequired,touchEvent:fd.oneOf(["onTouchEnd","onTouchStart",!1])}),"production"!==process.env.NODE_ENV&&(Fd.propTypes=function(e){return"production"===process.env.NODE_ENV?e:{...e,[vd]: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}}}(Fd.propTypes));const Ad="base";function Zd(e,t){const n=Ed[t];return n?`${Ad}--${n}`:function(e,t){return`${Ad}-${e}-${t}`}(e,t)}const Pd="Snackbar";function Bd(e){return Zd(Pd,e)}!function(e,t){const n={};t.forEach((t=>{n[t]=Zd(e,t)}))}(Pd,["root"]);const Nd={disableDefaultClasses:!1},Ud=q.createContext(Nd);"production"!==process.env.NODE_ENV&&(Ud.displayName="ClassNameConfiguratorContext");const Hd=()=>function(e,t,n){const o={};for(const i in e){const r=e[i];let l="";for(let e=0;e<r.length;e+=1){const o=r[e];o&&(l+=t(o)+" ",n&&n[o]&&(l+=n[o]+" "))}o[i]=l}return o}({root:["root"]},function(e){const{disableDefaultClasses:t}=q.useContext(Ud);return n=>t?"":e(n)}(Bd)),Dd=q.forwardRef((function(e,t){const{autoHideDuration:n=null,children:o,disableWindowBlurListener:i=!1,exited:r=!0,onBlur:l,onClose:a,onFocus:s,onMouseEnter:d,onMouseLeave:c,open:u,resumeHideDuration:p,slotProps:h={},slots:m={},...f}=e,g=Hd(),{getRootProps:x,onClickAway:y}=function(e={}){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:o,open:i,resumeHideDuration:r}=e,l=Id();q.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 a=wd(((e,t)=>{o?.(e,t)})),s=wd((e=>{o&&null!=e&&l.start(e,(()=>{a(null,"timeout")}))}));q.useEffect((()=>(i&&s(t),l.clear)),[i,t,s,l]);const d=l.clear,c=q.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 q.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={...Ld(e),...Ld(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:a,open:u,resumeHideDuration:p}),v=e,b=m.root||"div",j=Wd({elementType:b,getSlotProps:x,externalForwardedProps:f,externalSlotProps:h.root,additionalProps:{ref:t},ownerState:v,className:g.root}),w=Wd({elementType:Fd,externalSlotProps:h.clickAwayListener,additionalProps:{onClickAway:y},ownerState:v});return delete w.ownerState,!u&&r?null:zt.jsx(Fd,{...w,children:zt.jsx(b,{...j,children:o})})}));function Yd({size:e,color:t,time:n,strokeWidth:o=2,sx:i}){const[r,l]=_("0 1069"),a=e/2,s=a-1;return J((()=>{l(2*Math.PI*s+" 0")}),[]),zt.jsx(x,{width:e,height:e,component:"svg",sx:Object.assign({position:"absolute",top:`-${o}`,left:`-${o}`,transform:"rotate(-90deg)"},i),children:zt.jsx(x,{component:"circle",cx:a,cy:a,r:s,strokeWidth:o,stroke:t,fill:"none",strokeDasharray:r,sx:{transition:`stroke-dasharray ${n}`}})})}"production"!==process.env.NODE_ENV&&(Dd.propTypes={autoHideDuration:fd.number,children:fd.node,disableWindowBlurListener:fd.bool,exited:fd.bool,onClose:fd.func,open:fd.bool,resumeHideDuration:fd.number,slotProps:fd.shape({clickAwayListener:fd.oneOfType([fd.func,fd.shape({children:fd.element.isRequired,disableReactTree:fd.bool,mouseEvent:fd.oneOf(["onClick","onMouseDown","onMouseUp","onPointerDown","onPointerUp",!1]),onClickAway:fd.func,touchEvent:fd.oneOf(["onTouchEnd","onTouchStart",!1])})]),root:fd.oneOfType([fd.func,fd.object])}),slots:fd.shape({root:fd.elementType})});var zd=G.memo(Yd);const Xd=Pe((e=>({notify:null,toast:t=>{e({notify:t})},close:()=>{e({notify:null})}}))),qd={entering:"translateX(0)",entered:"translateX(0)",exiting:"translateX(500px)",exited:"translateX(500px)",unmounted:"translateX(500px)"};function Gd(){const e=y(),{notify:t,close:n}=Xd(),[o,i]=G.useState(!0),r=G.useRef(null),l=null==t?void 0:t.timeout,a=!!t;let s=zt.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[zt.jsx("circle",{cx:"18",cy:"18",r:"16.5",stroke:"#2FBA90",strokeWidth:"3"}),zt.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=zt.jsxs("svg",{width:"36",height:"37",viewBox:"0 0 36 37",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[zt.jsx("circle",{cx:"18",cy:"18.5",r:"16.5",stroke:"#FF6187",strokeWidth:"3"}),zt.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=zt.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[zt.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"}),zt.jsx("path",{d:"M15.1664 7.58398H12.8331V16.9173H15.1664V7.58398Z",fill:"#B15600"}),zt.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 zt.jsx(x,{component:Dd,open:a,autoHideDuration:l,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:zt.jsx(ht,{timeout:{enter:400,exit:400},in:a,appear:!0,unmountOnExit:!0,onEnter:()=>{i(!1)},onExited:()=>{i(!0)},nodeRef:r,children:o=>zt.jsxs(x,{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:qd[o],transition:"transform 300ms ease",[e.breakpoints.up("tablet")]:{p:20,width:"auto",maxWidth:328}},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(x,{sx:{mt:7,"& > svg":{width:28,height:28},[e.breakpoints.up("tablet")]:{"& > svg":{width:36,height:36}}},children:t?s:""}),zt.jsxs(x,{sx:{ml:20},children:[zt.jsx(x,{sx:{typography:"caption"},children:null==t?void 0:t.message}),(null==t?void 0:t.link)?zt.jsxs(x,{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,zt.jsx(x,{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:zt.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)?zt.jsx(x,{sx:{mt:4,typography:"body2",color:"text.secondary"},children:t.content}):""]})]}),zt.jsxs(x,{sx:{position:"relative",top:10,ml:12,display:"flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:12,borderStyle:"solid",borderWidth:l?"2.4px":0,borderColor:e.palette.border.main,backgroundColor:l?"transparent":e.palette.background.paperDarkContrast,cursor:"pointer",boxSizing:"border-box",[e.breakpoints.up("tablet")]:{ml:28}},onClick:n,children:[l?zt.jsx(zd,{size:24,strokeWidth:"2.4px",time:`${l}ms`,color:e.palette.text.disabled}):"",zt.jsx(x,{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:zt.jsx("g",{children:zt.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 _d;function Jd(){return Jd=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},Jd.apply(null,arguments)}const Qd=e=>q.createElement("svg",Jd({width:"33px",height:"33px",viewBox:"0 0 33 33",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},e),_d||(_d=q.createElement("g",{stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},q.createElement("g",{transform:"translate(-186.000000, -375.000000)",stroke:"currentColor",strokeWidth:4},q.createElement("g",{transform:"translate(18.000000, 291.000000)"},q.createElement("g",{transform:"translate(40.000000, 83.000000)"},q.createElement("path",{d:"M159,32 C159,15.9837423 146.016258,3 130,3"}))))))),Kd=300;function $d({open:e,onClose:t,afterClose:n,title:o,rightSlot:i,canBack:r=!0,children:l,height:a,testId:s}){return zt.jsxs(x,{sx:{position:"absolute",top:e?0:"100%",transition:`all ${Kd}ms`,zIndex:20,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",backgroundColor:"background.paper",borderRadius:16,height:a},"data-testid":s,"data-active":e?"1":"0",children:[o?zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20},children:[zt.jsx(x,{sx:{display:"flex",alignItems:"center",typography:"caption"},children:o}),i,!i&&r&&zt.jsx(x,{component:Wt.Error,sx:{color:"text.secondary",cursor:"pointer"},onClick:()=>{t&&t(),setTimeout((()=>n&&n()),Kd)}})]}):"",e?l:""]})}function ec({open:e,onClose:t,afterClose:n,title:o,rightSlot:i,canBack:r=!0,children:l,height:a,testId:s}){return zt.jsx(v,{open:e,onClose:t,"data-testid":s,"data-active":e?"1":"0",children:zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",height:a},children:[o?zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20},children:[zt.jsx(x,{sx:{display:"flex",alignItems:"center",typography:"caption"},children:o}),i,!i&&r&&zt.jsx(x,{component:Wt.Error,sx:{color:"text.secondary",cursor:"pointer"},onClick:()=>{t&&t(),setTimeout((()=>n&&n()),Kd)}})]}):"",e?l:""]})})}function tc(e){var{scope:t,modal:n}=e,o=Tr(e,["scope","modal"]);const{widgetRef:i,DialogComponent:r}=Vr();if(r)return zt.jsx(r,{scope:t,...o});const l=n?ec:$d;return(null==i?void 0:i.current)&&!t?mt(zt.jsx(l,{...o}),i.current):zt.jsx(l,{...o})}const nc=6;function oc({showingDone:e,errorMessage:t}){var n;const o=y();return t?zt.jsx(x,{component:Wt.ErrorWarn,sx:{width:64,height:64,color:"error.main"}}):e?zt.jsx(x,{component:Wt.DoneBorder,sx:{width:64,height:64,color:"success.main"}}):zt.jsx(x,{sx:{mx:"auto",border:`${nc}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:zt.jsx(x,{component:Qd,sx:{position:"absolute",top:`-${nc}px`,right:`-${nc}px`,color:"primary.main"}})})}function ic({showingDone:e,showing:t}){return zt.jsxs(x,{sx:{display:"flex",alignItems:"center",flexDirection:"column"},children:[zt.jsx(x,{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)?zt.jsx(x,{sx:{mt:20,typography:"body2"},children:null==t?void 0:t.subtitle}):""]})}function rc({isStarted:e,isEnded:t,tx:o}){const[i,r]=_(0),{chainId:l}=Ar(),a=K((()=>`https://${fr[l||1]}/tx/${o}`),[o,l]),s=K((()=>{const e=Math.floor(i/60),t=i%60;return e?`${e}m ${t}s`:`${t}s`}),[i]),d=te();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]),zt.jsxs(x,{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:[zt.jsxs(x,{children:[zt.jsx(n,{id:"+Jkdiu",message:"Transaction Time:"}),s]}),zt.jsxs(j,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},component:"a",href:a,target:"_blank",rel:"noopener noreferrer",children:[zt.jsx(n,{id:"S3piC2",message:"Tx"}),zt.jsx(x,{component:Wt.ArrowTopRightBorder,sx:{width:16,height:16,ml:6}})]})]})}function lc(e){var{children:t,executionStatus:o}=e;const i=jl(Tr(e,["children","executionStatus"])),{ctxVal:r,showing:l,closeShowing:a,showingDone:s,errorMessage:d,transactionTx:c}=Object.assign(Object.assign({},i),o),u=pe(),p=Vr((e=>e.noSubmissionDialog));return zt.jsxs(wl.Provider,{value:r,children:[t,zt.jsx(tc,{open:!!l&&!p,onClose:a,id:"submission",children:zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",px:20,pb:20,flex:1,overflowY:"auto"},children:[zt.jsxs(x,{children:[zt.jsx(x,{sx:{textAlign:"center",pt:60},children:zt.jsx(oc,{showingDone:s,errorMessage:d})}),d?zt.jsxs(x,{sx:{textAlign:"center",mt:60},children:[zt.jsx(x,{children:zt.jsx(n,{id:"kf83Ld",message:"Something went wrong."})}),zt.jsx(x,{sx:{color:"text.secondary",mt:12,typography:"body2",wordBreak:"break-all"},children:d})]}):zt.jsxs(zt.Fragment,{children:[zt.jsx(ic,{showingDone:s,showing:l}),zt.jsx(rc,{isStarted:!!l,isEnded:s,tx:c})]})]}),zt.jsx(b,{fullWidth:!0,size:b.Size.big,onClick:()=>{u(Ur(Yr.Initial)),a()},sx:{mt:20},children:d?zt.jsx(n,{id:"1QfxQT",message:"Dismiss"}):zt.jsx(n,{id:"yz7wBu",message:"Close"})})]})})]})}const ac="dodo-widget-container";function sc(e){return e.noLangProvider?zt.jsx(zt.Fragment,{children:e.children}):zt.jsx(Hs,{locale:e.locale,children:zt.jsx(lc,{...e,children:e.children})})}function dc(e){!function({tokenList:e,popularTokenList:t}){const n=pe();J((()=>{(()=>{Lr(this,void 0,void 0,(function*(){let o=[];o=se(e)?e:ae(t,ia,(e=>e.address.toLowerCase()+e.chainId+e.side)),n(ra(o))}))})()}),[e,n,t]),J((()=>{n(la(null!=t?t:[]))}),[t,n])}(e),yl();const t=e.width||375,n=e.height||494,{widgetRef:o}=Vr();return e.noUI?zt.jsx(sc,{...e,children:e.children}):zt.jsx(sc,{...e,children:zt.jsx(x,{sx:{width:t,height:n,overflow:"hidden",position:"relative",display:"flex",flexDirection:"column",minWidth:335,minHeight:494,borderRadius:16,backgroundColor:"background.paper"},className:ac,ref:o,children:e.children})})}function cc(e){var t,n;const o=te(null);return zt.jsx(me,{store:Fl,children:zt.jsx(Wr,{...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:zt.jsx(Ys,{children:zt.jsx(Os,{children:zt.jsx(dc,{...e})})})})})}function uc(e){const t=w({mode:e.colorMode,theme:e.theme,lang:e.locale||Is});return e.apikey||e.apiServices||console.error("apikey and apiServices must have a."),zt.jsxs(C,{theme:t,children:[zt.jsx(k,{container:`.${ac}, .${R}, .${S}`}),zt.jsx(Re,{client:Ds,children:zt.jsxs(cc,{...e,children:[e.children,zt.jsx(Gd,{})]})})]})}function pc(e){var{sx:t}=e,n=Tr(e,["sx"]);const{width:o}=Vr(),i=K((()=>{let e="";return"number"==typeof o?e=`${o}px`:o&&(e=o),e?`calc(${e} - 40px)`:"auto"}),[o]);return zt.jsx(I,{container:document.querySelector(`.${ac}`),maxWidth:i,sx:Object.assign({cursor:"help"},t),...n})}function hc(e){var t,{chainId:o,includeButton:i}=e,r=Tr(e,["chainId","includeButton"]);const{account:l,chainId:a}=Ar(),{onConnectWalletClick:s}=Vr(),[d,c]=G.useState(!1),{setVisible:u}=pt();return!l||d||void 0===a||o&&o!==a?zt.jsx(zt.Fragment,{children:zt.jsx(b,{...r,isLoading:d,onClick:()=>Lr(this,void 0,void 0,(function*(){if(s){c(!0);const e=yield s();if(c(!1),e)return}u(!0)})),children:d?zt.jsx(n,{id:"J28zul",message:"Connecting..."}):zt.jsx(n,{id:"r7ScnQ",message:"Connect to a wallet"})})}):i?zt.jsx(zt.Fragment,{children:null!==(t=r.children)&&void 0!==t?t:null}):zt.jsx(b,{...r})}function mc({needSwitchChain:e}){return zt.jsx(zt.Fragment,{children:zt.jsx(hc,{size:b.Size.middle,fullWidth:!0,"data-testid":Rr,chainId:e})})}function fc({open:e,execute:t,onClose:o,toToken:i,fromToken:r,fromAmount:l,toAmount:a,priceImpact:s,clearFromAmt:d,clearToAmt:c,baseFeeAmount:u,curToFiatPrice:p,curFromFiatPrice:h,additionalFeeAmount:m,loading:f,slippage:g}){var v,j;const w=y(),C=pe(),k=he(Al),R=K((()=>!!s&&new ie(s).gt(br)),[s]),[S,I]=_(!1),[T,L]=_(!1);return J((()=>{k!==Yr.Pending&&o(),k===Yr.TxSuccess&&(c(),d())}),[k]),J((()=>{I(!1)}),[p]),zt.jsx(tc,{open:e,onClose:()=>{C(Ur(Yr.Initial)),o()},id:"swap-summary",title:zt.jsx(n,{id:"QR4/RH",message:"Swap summary"}),children:zt.jsxs(x,{sx:{margin:20,display:"flex",height:"100%",flexDirection:"column",borderTop:`1px solid ${w.palette.border.main}`},children:[zt.jsxs(x,{sx:{py:20,display:"flex",typography:"body2",alignItems:"center",justifyContent:"center",flexDirection:"column",borderBottom:`1px solid ${w.palette.border.main}`},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:[zt.jsx(Ss,{width:16,height:16,url:null==r?void 0:r.logoURI,address:null!==(v=null==r?void 0:r.address)&&void 0!==v?v:"",marginRight:6}),zt.jsx(x,{children:`${_r({input:l,decimals:null==r?void 0:r.decimals})} ${null==r?void 0:r.symbol}`})]}),null!==h&&zt.jsx(x,{sx:{mt:4,typography:"h6",color:w.palette.text.secondary},children:h?`$${Gr({input:h,showDecimals:1})}`:"-"})]}),zt.jsx(x,{sx:{width:16,mx:16},component:Wt.DoubleRight}),zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex"},children:[zt.jsx(Ss,{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:""}),zt.jsx(E,{loading:f,loadingProps:{width:30},children:`${_r({input:a,decimals:null==i?void 0:i.decimals})} ${null==i?void 0:i.symbol}`})]}),null!==h&&zt.jsx(E,{loading:f,loadingProps:{width:30},sx:{typography:"h6",mt:4,color:w.palette.text.secondary},children:p?`$${Gr({input:p,showDecimals:1})}(${s}%)`:"-"})]})]}),zt.jsxs(x,{sx:{mt:12,display:"flex",alignItems:"center",typography:"h6"},children:["1",null==r?void 0:r.symbol," = ",zt.jsx(E,{loading:f,loadingProps:{width:30},children:_r({input:new ie(a).dividedBy(new ie(l)),decimals:null==i?void 0:i.decimals})})," ",null==i?void 0:i.symbol]})]}),zt.jsxs(x,{sx:{py:15,typography:"body2",borderBottom:`1px solid ${w.palette.border.main}`},children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",color:w.palette.text.secondary},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(x,{sx:{width:16,mr:7},component:Wt.DetailBorder}),zt.jsx(n,{id:"XeovX3",message:"Swap Detail"})]}),zt.jsx(x,{component:M,children:zt.jsx(x,{onClick:()=>L(!T),sx:{width:10,color:"text.secondary",transform:T?"rotateX(0deg)":"rotateX(180deg)"},component:Wt.CaretUp})})]}),zt.jsxs(x,{sx:{mt:16,display:T?"initial":"none"},children:[zt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(n,{id:"93m8jT",message:"Basic Fee"}),zt.jsx(pc,{title:zt.jsx(n,{id:"8Z29ZO",message:"Estimated service provider fees"}),ml:5})]}),zt.jsx(E,{loading:f,loadingProps:{width:30},children:u?`${_r({input:u,decimals:null==i?void 0:i.decimals})} ${null==i?void 0:i.symbol}`:"0"})]}),zt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(n,{id:"J39pAJ",message:"Additional Fee"}),zt.jsx(pc,{title:zt.jsx(n,{id:"ZXvy7b",message:"Additional routing fees set by the Widget user"}),ml:5})]}),zt.jsx(E,{loading:f,loadingProps:{width:30},children:m?`${_r({input:m,decimals:null==i?void 0:i.decimals})} ${null==i?void 0:i.symbol}`:"0"})]}),!!s&&zt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(n,{id:"T+qgFw",message:"Price Impact"}),zt.jsx(pc,{title:zt.jsx(n,{id:"4kY4C4",message:"Due to the market condition, market price and estimated price may have a slight difference"}),ml:5})]}),zt.jsx(x,{children:`${s}%`})]}),zt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(n,{id:"CMHmbm",message:"Slippage"}),zt.jsx(pc,{title:zt.jsx(n,{id:"GAypnX",message:"High slippage tolerance will increase the success rate of transaction, but might not get the best quote."}),ml:5})]}),zt.jsxs(x,{children:[g,"%"]})]})]})]}),zt.jsx(x,{sx:{flex:1}}),R&&zt.jsxs(x,{sx:{mb:14,display:"flex",cursor:"pointer",justifyContent:"center",alignItems:"center",typography:"h6"},onClick:()=>I(!S),children:[zt.jsx(x,{sx:{mr:4,width:18,height:18,alignItems:"center"},children:S?zt.jsx(x,{sx:{width:"100%",height:"100%",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"secondary.main"},children:zt.jsx(x,{component:Wt.Done,sx:{width:14,color:"#1a1a1b"}})}):zt.jsx(x,{sx:{width:"100%",height:"100%",borderRadius:4,border:`1px solid ${w.palette.text.secondary}`}})}),zt.jsx(x,{children:zt.jsx(n,{components:{0:zt.jsx(x,{component:"span",sx:{color:"error.main"}})},values:{priceImpact:s},id:"Price impact reaches <0>{priceImpact}</0>%, accept the quote"})})]}),zt.jsx(b,{isLoading:k==Yr.Pending,disabled:R&&!S,fullWidth:!0,onClick:()=>{t(),C(Ur(Yr.Pending))},children:k==Yr.Pending?zt.jsx(n,{id:"P+K/3O",message:"Confirming"}):zt.jsx(n,{id:"lQ6r7x",message:"Confirm swap"})})]})})}var gc;function xc({fromToken:e,toToken:t}){const o=y(),{onlySolana:i}=Vr();_l();const{customSlippage:r,customSlippageNum:l,handleSlippageChange:a,forecastSlippage:s,forecastSlippageQuery:d,recommendSlippage:c}=Kl({fromToken:e,toToken:t}),[u,p]=G.useState(!1),[h,m]=G.useState();!h&&e&&t&&m(r?gc.custom:gc.recommend);const f=h===gc.custom;return G.useRef(null),G.useMemo((()=>h===gc.custom?l?new ie(l).div(100).toNumber():void 0:new ie(c).div(100).toNumber()),[h,c,l]),G.useCallback((e=>{f||m(gc.custom),a({slippage:new ie(e).times(100).toString(),disabled:!1,deleted:!1,recommend:String(c)})}),[f,c,a]),i?zt.jsxs(x,{sx:{pt:20,borderTop:`1px solid ${o.palette.border.main}`},children:[zt.jsxs(x,{sx:{mb:16,display:"flex",alignItems:"center"},children:[zt.jsx(n,{id:"lqTDfd",message:"Slippage Tolerance"}),zt.jsx(I,{title:zt.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})]}),zt.jsxs(x,{sx:{display:"flex",flexDirection:"column"},children:[zt.jsx(T,{placeholder:String(c),fullWidth:!0,sx:{height:36,"& input":{boxSizing:"border-box","&::placeholder":{color:"custom.input.placeholder",opacity:1}}},inputMode:"decimal",suffix:zt.jsx(x,{sx:{color:"text.disabled"},children:"%"}),value:r||"",onChange:e=>{const t=e.target.value;a({slippage:t,disabled:!1,recommend:String(c)})},onBlur:()=>{setTimeout((()=>{if(p(!1),!l)return void m(gc.recommend);const e=!l||l<0;e&&r&&a({slippage:r,disabled:e,deleted:e,recommend:String(c)})}),10)}}),Number(r)>=wr&&zt.jsx(x,{sx:{typography:"h6",mt:6,color:"error.main"},children:zt.jsx(n,{id:"Zm56FI",message:"Maximum slippage do not exceed 50%"})})]})]}):null}function yc({checked:e,onChange:t,sx:o,disabled:i}){const r=y();let l=r.palette.background.paper;return e&&(l=r.palette.secondary.main),zt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",position:"relative",borderRadius:8,backgroundColor:r.palette.background.input,opacity:i?.5:1},o),component:M,disabled:i,onClick:()=>{i||t(!e)},children:[zt.jsx(x,{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:zt.jsx(n,{id:"az8lvo",message:"Off"})}),zt.jsx(x,{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:zt.jsx(n,{id:"Z5HWHd",message:"On"})}),zt.jsx(x,{sx:{borderRadius:6,backgroundColor:l,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 vc({show:e,onClick:t}){const o=y();return zt.jsxs(j,{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 ${L("light"===o.palette.mode?"#FFF":"#000",.1)}`,cursor:"pointer",whiteSpace:"nowrap",gap:4},onClick:t,children:[zt.jsx(n,{id:"F8yRdq",message:"More trade settings"}),zt.jsx(x,{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:zt.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 bc({open:e,onClose:t,fromToken:o,toToken:i}){const r=y(),{ddl:l,disableIndirectRouting:a}=_l(),{onlySolana:s}=Vr(),d=G.useRef(null),[c,u]=G.useState(!1);return G.useEffect((()=>{const e=d.current,t=new ResizeObserver((()=>{e&&u(e.scrollHeight!==e.offsetHeight)})),n=de((()=>{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]),zt.jsx(tc,{open:e,onClose:t,id:"swap-settings",title:zt.jsx(n,{id:"Tz0i8g",message:"Settings"}),children:zt.jsxs(x,{sx:{px:20,pb:34,overflowY:"auto"},ref:d,children:[zt.jsx(xc,{fromToken:o,toToken:i}),!s&&zt.jsxs(x,{sx:{mt:24,pt:14,borderTop:`solid 1px ${r.palette.border.main}`},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",fontWeight:600},children:[zt.jsx(n,{id:"zSMRJ/",message:"Transaction Deadline"}),zt.jsx(pc,{title:zt.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})]}),zt.jsxs(x,{sx:{mt:16,display:"flex",alignItems:"center",gap:8,typography:"body2"},children:[zt.jsx(T,{sx:{width:80,height:34,lineHeight:1,typography:"body2","& input":{px:16,py:6}},placeholder:String(Cr),value:l,onChange:e=>{_l.setState({ddl:e.target.value})}}),zt.jsx(n,{id:"H9HlDe",message:"minutes"})]})]}),!s&&zt.jsx(x,{sx:{display:"flex",flexDirection:"column",gap:12,mt:24,pt:14,borderTop:`solid 1px ${r.palette.border.main}`},children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[zt.jsxs(x,{sx:{fontWeight:600},children:[zt.jsx(n,{id:"MXQodB",message:"Disable Indirect Routing"}),zt.jsx(pc,{title:zt.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})]}),zt.jsx(yc,{checked:a,onChange:e=>{_l.setState({disableIndirectRouting:e})}})]})}),zt.jsx(vc,{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 jc({onClick:e,disabled:t,plus:n}){const o=y(),i=t||n||!e;return zt.jsx(x,{sx:{width:"100%",position:"relative"},children:zt.jsx(x,{component:M,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?zt.jsx(x,{component:Wt.Plus,sx:{width:18,height:18}}):zt.jsx(x,{component:Wt.ArrowBack,sx:{width:18,height:18}})})})}!function(e){e.recommend="recommend",e.custom="custom"}(gc||(gc={}));const wc=()=>{const{requests:e,updateText:t}=Cl(),n=G.useMemo((()=>{let t={};return null==e||e.forEach((([e,n])=>{var o,i;if((n===Zr.Running||n===Zr.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=G.useMemo((()=>{let t={};return null==e||e.forEach((([e,n])=>{var o,i;if(n===Zr.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=G.useCallback(((e,n,o)=>{const i=e[n];if(!i)return!1;return!!(ie.isBigNumber(o)?o:new ie(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=G.useCallback(((e,t)=>i(n,e,t)),[n,i]),l=G.useCallback(((e,t)=>i(o,e,t)),[o,i]);return{balanceData:n,balanceDataDone:o,isTokenLoading:r,isTokenLoadingDone:l}};function Cc({onClick:e,balance:t,decimals:o,address:i,showMaxBtn:r,canClickBalance:l,loading:a,balanceText:s}){const{palette:d}=y(),c=l&&(null==t?void 0:t.gt(0))&&e;return zt.jsxs(x,{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:zt.jsx(n,{id:"0QDjxt",message:"Balance:"})," ",a?zt.jsx(O,{sx:{position:"relative",top:-2,verticalAlign:"middle"}}):zt.jsxs(zt.Fragment,{children:[i?_r({input:t,decimals:Math.min(o||4,4)}):"-",r&&t&&t.gt(0)&&e&&zt.jsx(x,{component:M,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:zt.jsx(n,{id:"CK1KXz",message:"Max"})})]})]})}const kc=ne((function({readOnly:e,sx:t,value:n,decimals:o,onChange:i,suffix:r,suffixGap:l=0,withClear:a,onFocus:s,placeholder:d,readonlyShowSuffix:c,typography:u},p){const h=y(),m=K((()=>r||(a&&n&&i?zt.jsx(x,{component:M,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:zt.jsx(x,{component:Wt.Error,sx:{width:12}})}):void 0)),[i,r,h.palette.text.primary,n,a]);return zt.jsx(T,{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)&&m,suffixGap:l,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 Rc(){const e=y(),t=Vr((e=>e.width)),[n,o]=G.useState(null!=t?t:"undefined"==typeof window?375:document.body.clientWidth);G.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:G.useMemo((()=>"number"==typeof n&&n<e.breakpoints.values.tablet),[n,e.breakpoints.values]),isTablet:G.useMemo((()=>"number"==typeof n&&n<e.breakpoints.values.tablet),[n,e.breakpoints.values]),minDevice:G.useCallback((e=>"number"==typeof n&&n>e),[n]),maxDevice:G.useCallback((e=>"number"==typeof n&&n<e),[n])}}const Sc=[.25,.5,.75,1];function Ic({value:e,onChange:t,sx:n}){const o=y(),i="light"===o.palette.mode,{isMobile:r}=Rc();return zt.jsx(x,{sx:Object.assign({display:"grid",gap:r?10:14,gridTemplateColumns:`repeat(${Sc.length}, 1fr)`},n),children:Sc.map((n=>{const r=n===e;return zt.jsxs(M,{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:L(o.palette.text.primary,.2)},"&.selected, &:focus":{color:"#fff",backgroundColor:i?o.palette.primary.main:L(o.palette.text.primary,.4)}},onClick:()=>{!r&&t&&t(n)},className:r?"selected":void 0,children:[100*n,"%"]},n)}))})}function Ec({token:e,onClick:t,showChainLogo:o,readonly:i,showChainName:r}){var l,a;const s=y(),d=(null==e?void 0:e.chainId)?ks.get(e.chainId):null,c=r&&!!d;return zt.jsxs(x,{component:M,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":Sr,children:[!!(null==e?void 0:e.address)&&zt.jsx(Ss,{url:null==e?void 0:e.logoURI,address:null!==(l=null==e?void 0:e.address)&&void 0!==l?l:"",chainId:null==e?void 0:e.chainId,noShowChain:!o,width:30,height:30,chainSize:16,logoOffset:10,marginRight:0}),zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[(null==e?void 0:e.address)?zt.jsx(zt.Fragment,{children:zt.jsx(x,{children:null!==(a=null==e?void 0:e.symbol)&&void 0!==a?a:"-"})}):zt.jsx(n,{id:"sIPJGT",message:"SELECT TOKEN"}),!i&&zt.jsx("svg",{width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 11.75L12 7.25H6L9 11.75Z",fill:"currentColor"})})]}),!!c&&zt.jsxs(x,{sx:{display:"flex",alignItems:"center",typography:"h6",color:"text.secondary"},children:[d.name,zt.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zt.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 Mc({token:e,disabled:t,style:n,balance:o,onClick:i}){const r=y(),{account:l}=Ar(),a=o?Gr({input:o}):"";return zt.jsxs(x,{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":Mr,children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(Ss,{token:e}),zt.jsxs(x,{children:[zt.jsx(x,{sx:{fontWeight:600,textAlign:"left"},children:e.symbol}),l&&zt.jsx(x,{sx:{mt:4,textAlign:"left"},children:(null==o?void 0:o.gte(0))?a:zt.jsx(x,{component:Wt.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)"}}}})})]})]}),zt.jsx(x,{sx:{color:"text.secondary",textAlign:"right"},children:e.name})]})}function Tc({chain:e,active:t,onClick:o}){return zt.jsx(W,{title:e.name,placement:"top",onlyHover:!0,children:zt.jsxs(x,{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:[zt.jsx(x,{component:e.logo,sx:{width:24,height:24}}),t?zt.jsxs(x,{sx:{ml:8},children:[zt.jsx(n,{id:"Fdp03t",message:"on"}),` ${e.name}`]}):""]})},e.chainId)}function Lc(e){try{return new Te(e),!0}catch(e){return!1}}function Oc(e){if(e.length<=10)return e;try{return new Te(e),`${e.slice(0,4)}...${e.slice(-4)}`}catch(t){return`${e.slice(0,6)}...${e.slice(-4)}`}}function Wc(e,t,n="address"){return`https://${fr[e]}${t?`/${n}/${t}`:""}`}function Vc(){return zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between"},children:[zt.jsx(V,{variant:"circular",width:32,sx:{mt:8}}),zt.jsxs(x,{sx:{ml:8,flex:"1 0 auto"},children:[zt.jsx(V,{sx:{borderRadius:4},height:24}),zt.jsx(V,{sx:{mt:4,borderRadius:4},height:19,width:137})]})]})}function Fc({chainId:e,value:t,onChange:n,occupiedAddrs:i,occupiedChainId:r,hiddenAddrs:l,showAddrs:a,visible:s,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,sx:m}){const{chainList:f,selectChainId:g,setSelectChainId:y}=function(e){const{chainId:t}=Ar(),n=he(Nl),{crossChain:o,onlyChainId:i}=Vr(),r=K((()=>{const t=new Set;return n.forEach((n=>{n.side&&e&&n.side!==e||t.add(n.chainId)})),t}),[n,e]),l=K((()=>{if(!o||i)return[];const e=new Map;let n;return ks.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]),a=K((()=>!l.length||t&&r.has(t)?t:l[0].chainId),[t,r]),[s,d]=_(a);J((()=>{void 0===s&&d(a)}),[a]);const c=K((()=>null!=s?s:a),[s,a]);return{chainList:l,selectChainId:c,setSelectChainId:d}}(d),{showTokenList:v,filter:b,setFilter:j,onSelectToken:w,popularTokenList:C,tokenInfoMap:k}=pa({value:t,onChange:n,occupiedAddrs:i,occupiedChainId:r,hiddenAddrs:l,showAddrs:a,side:d,chainId:null!=e?e:g,visible:s,defaultLoadBalance:c,multiple:u}),R=te(null),[S,I]=_(0);J((()=>{if(s&&t)if(Array.isArray(t)){const[e]=t;e&&e.chainId!==g&&y(e.chainId)}else y(t.chainId)}),[t,s]),J((()=>{let e;return s&&(e=window.setTimeout((()=>{R.current&&I(R.current.offsetHeight-16)}),300)),()=>clearTimeout(e)}),[R,s,g]);const E=we({queryKey:["token-picker-searchOtherAddress",b],queryFn:()=>h?h(b):null,enabled:Lc(b)&&!!h}),M=Q((({index:e,style:n})=>{var o;const i=v[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),zt.jsx(Mc,{token:i,disabled:r,style:n,onClick:()=>w(i),balance:null===(o=k.get(`${i.chainId}-${i.address}`))||void 0===o?void 0:o.balance},i.address+i.chainId)}),[v,C,t]);return zt.jsxs(x,{sx:Object.assign({display:"flex",flexDirection:"column",px:20,flex:1,overflow:"hidden"},m),children:[zt.jsx(F,{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&&f.length?zt.jsx(x,{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:f.map((e=>zt.jsx(Tc,{chain:e,active:e.chainId===g,onClick:()=>{y(e.chainId)}},e.chainId)))}):"",zt.jsx(x,{sx:{pb:16,flex:1,minHeight:64},ref:R,children:v.length?zt.jsx(ft,{height:S,itemCount:v.length,itemSize:52,width:"100%",className:"token-list",children:M}):zt.jsxs(x,{sx:{height:S,overflowY:"auto"},children:[E.isLoading?zt.jsx(Vc,{}):"",E.data?E.data:""]})})]})}function Ac({open:e,title:t,value:o,onClose:i,occupiedAddrs:r,hiddenAddrs:l,occupiedChainId:a,onTokenChange:s,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,chainId:m,modal:f}){const{height:g}=Vr(),{isMobile:x}=Rc();return zt.jsx(tc,{height:f?"80vh":g,open:e,onClose:i,title:null!=t?t:zt.jsx(n,{id:"T0Y2+3",message:"Select a token"}),id:"select-token",testId:Er,modal:f,children:zt.jsx(Fc,{value:o,visible:e,onChange:s,occupiedAddrs:r,occupiedChainId:a,hiddenAddrs:l,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,chainId:m,sx:f?{width:x?"100%":420,borderRadius:16}:void 0})})}function Zc(){return zt.jsx(x,{sx:{position:"relative",height:4},children:zt.jsx(x,{sx:{width:44,height:44,borderRadius:22,backgroundColor:"background.input",borderWidth:4,borderColor:"background.paper",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%,-50%) rotate(90deg)",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:zt.jsx(x,{component:Wt.Plus})})})}function Pc({sx:e,inputSx:t,amt:o,token:i,readOnly:r,showMaxBtn:l,canClickBalance:a,onMaxClick:s,fiatPriceTxt:d,occupiedAddrs:c,occupiedChainId:u,onInputFocus:p,onTokenClick:h,onInputChange:m,onTokenChange:f,side:g,showChainLogo:v,showChainName:j,defaultLoadBalance:w,overrideBalance:C,overrideBalanceLoading:k,balanceText:R,showPercentage:S,inputReadonlyTooltip:I,inputTypography:E,chainId:M,hideToken:T,checkLogBalance:L,notTokenPickerModal:O}){var W,V;const{account:F}=Ar(),Z=y(),{gotoBuyToken:P}=Vr(),[B,N]=_(!1),{fetchTokenBalance:U}=fl(),H=we({queryKey:["token","balance-allowance",null==i?void 0:i.address],queryFn:()=>Lr(this,void 0,void 0,(function*(){if(!i)return;const e=yield U(i.address);return Object.assign(Object.assign({},i),{balance:e.amount,allowance:qr})})),enabled:!!i}),D=null!==(V=null!=C?C:null===(W=H.data)||void 0===W?void 0:W.balance)&&void 0!==V?V:null,{isTokenLoading:Y}=wc();let z=null!=k?k:H.isLoading;!z&&D&&(L?z=Object.entries(L).some((([e,t])=>Y(e,t))):i&&(z=Y(i.address,D)));const[X,q]=_(0),G=te("");J((()=>{o!==G.current&&q(0)}),[o]);let Q=P&&D&&o&&D.lt(o);const K=!!m||!!I;return zt.jsxs(x,{sx:Object.assign({minHeight:K?133:"auto",padding:Z.spacing(20,20,24),borderRadius:12,overflow:"hidden",display:"flex",flexDirection:"column",justifyContent:"space-between",backgroundColor:Z.palette.background.input},e),children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4},children:[T?zt.jsx(x,{}):zt.jsx(Ec,{token:i,showChainLogo:v,showChainName:j,onClick:()=>N(!0),readonly:!f}),zt.jsx(Cc,{balance:D,balanceText:R,onClick:r||!s&&!m?void 0:e=>{s?s(e):m&&m(e),0!==X&&1!==X&&(q(1),G.current=e)},showMaxBtn:l,canClickBalance:a,address:null==i?void 0:i.address,decimals:null==i?void 0:i.decimals,loading:z})]}),K&&(r&&I?zt.jsx(A,{title:I,arrow:!1,children:zt.jsx(x,{children:zt.jsx(kc,{value:o,readOnly:!0,withClear:!0,sx:Object.assign({mt:12},t)})})}):zt.jsx(kc,{value:o,onFocus:p,onChange:m?e=>{m(e),q(0)}:void 0,readOnly:r,withClear:!0,suffix:Q?zt.jsx(b,{variant:b.Variant.tag,backgroundColor:Z.palette.background.paperDarkContrast,sx:{fontSize:12},onClick:e=>{e.stopPropagation(),null==P||P({token:i,account:F})},children:zt.jsx(n,{id:"qiOIiY",message:"Buy"})}):void 0,typography:E,sx:{mt:12}})),!r&&S?zt.jsx(Ic,{sx:{mt:16},value:X,onChange:D&&void 0!==(null==i?void 0:i.decimals)?e=>{if(D&&(null==i?void 0:i.decimals))if(q(e),1===e){const e=D.toString();s?s(e):m&&m(e),G.current=e}else if(m){const t=D.multipliedBy(e).dp(i.decimals).toString();m(t),G.current=t}}:void 0}):"",void 0!==d?zt.jsx(x,{sx:{mt:S?9:0,typography:"h6",color:Z.palette.text.secondary},children:d}):"",zt.jsx(Ac,{value:i,open:B,side:g,chainId:M,occupiedAddrs:c,occupiedChainId:u,defaultLoadBalance:w,onClose:()=>{N(!1),h&&h()},onTokenChange:(e,t)=>{N(!1),setTimeout((()=>{!Array.isArray(e)&&f&&f(e,t)}),Kd)},modal:!O})]})}function Bc({toToken:e,fromToken:t,priceStatus:o,pricePerToToken:i,pricePerFromToken:r}){const[l,a]=_("-"),[s,d]=_(null),[c,u]=_("-"),[p,h]=_(null);J((()=>{a(null==t?void 0:t.symbol),u(null==e?void 0:e.symbol),d(i),h(r)}),[t,e,i,r]);const m=Q((()=>{a(c),u(l),d(p),h(s)}),[l,s,c,p]);return zt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:{[Ml.Initial]:"-",[Ml.Loading]:zt.jsxs(zt.Fragment,{children:[zt.jsx(O,{sx:{mr:5}}),zt.jsx(n,{id:"JdNn1Y",message:"Fetching best price..."})]}),[Ml.Failed]:zt.jsxs(zt.Fragment,{children:[zt.jsx(x,{component:Wt.Warn,sx:{width:15,mr:5,color:"warning.main"}}),zt.jsx(n,{id:"NVAuTg",message:"Quote not available"})]}),[Ml.Success]:zt.jsxs(zt.Fragment,{children:[zt.jsx(x,{sx:{typography:"body2"},children:`1 ${l} = ${Gr({input:p,showDecimals:4})} ${c}`}),zt.jsx(x,{component:M,sx:{width:18,height:18,ml:6,borderRadius:"50%",backgroundColor:"border.main",display:"flex",justifyContent:"center",alignItems:"center"},children:zt.jsx(x,{sx:{width:16,color:"text.secondary"},onClick:m,component:Wt.Switch})})]})}[o]})}function Nc({getAutoSlippage:e,onPayTokenChange:t,onReceiveTokenChange:l}={}){var a,s;const d=y(),{isInflight:c}=kl(),{chainId:u,account:p}=Ar(),h=pe(),{defaultChainId:m,noPowerBy:f,onlyChainId:g,onlySolana:v}=Vr(),[j,w]=_(!1);K((()=>{var e;return null===(e=r[null!=u?u:m])||void 0===e?void 0:e.address}),[u,m]);const[C,k]=_(""),[R,S]=_(""),[I,E]=_(""),[T,L]=_(""),V=K((()=>ce((e=>E(e)),1e3)),[]),F=K((()=>ce((e=>L(e)),1e3)),[]),[A,Z]=_(null),[P,B]=_(null),[N,U]=_(!1),[H,D]=_(!1),{toFiatPrice:Y,fromFiatPrice:z}=El({toToken:P,fromToken:A});!function({token:e,fiatPrice:t}){K((()=>{var n;const o=null!==(n=null==e?void 0:e.decimals)&&void 0!==n?n:6,i=null!=t?new ie(500).div(t):new ie(0),r=$r(i,o);return(r.lt(new ie(1).times(new ie(10).pow(o-3)))?new ie(0):r).toString(10)}),[null==e?void 0:e.decimals,t])}({token:j?P:A,fiatPrice:j?Y:z}),function({fromToken:e,toToken:t,getAutoSlippage:n}){const o=pe();J((()=>{(()=>{Lr(this,void 0,void 0,(function*(){if(!n)return;const i=n({fromToken:e,toToken:t});if(void 0!==i&&"number"!=typeof i){o(Dr(!0));try{const e=yield i;o(Hr({loading:!1,value:null!=e?e:null}))}catch(e){console.error(e),o(Hr({loading:!1,value:null}))}}else o(Hr({loading:!1,value:null}))}))})()}),[e,t])}({fromToken:A,toToken:P,getAutoSlippage:e});const{slippage:X,slippageLoading:q}=Kl({fromToken:A,toToken:P}),{isApproving:G,isGetApproveLoading:$,needApprove:ee,insufficientBalance:te,submitApprove:ne,getMaxBalance:oe}=oa(A,{amount:I}),re=Q((()=>{ye(oe())}),[oe]);K((()=>!(!p||te||G||$||ee)),[p,te,G,$,ee]);const{status:le,rawBrief:ae,executeSwap:se}=Tl({toToken:P,fromToken:A,fromAmount:I,slippage:X}),{resAmount:de,priceImpact:ue,baseFeeAmount:me,additionalFeeAmount:fe,resPricePerToToken:ge,resPricePerFromToken:xe}=K((()=>{if(!ae)return{resAmount:null,priceImpact:null,baseFeeAmount:null,additionalFeeAmount:null,resPricePerToToken:null,resPricePerFromToken:null};const e=new ie(ae.inAmount).dividedBy(ae.outAmount).toNumber(),t=new ie(ae.outAmount).dividedBy(ae.inAmount).toNumber();return{resAmount:ae.resAmount,priceImpact:ae.priceImpact,baseFeeAmount:0,additionalFeeAmount:0,resPricePerToToken:e,resPricePerFromToken:t}}),[ae]),ye=Q((e=>{const t=e.toString();k(t),V(t)}),[k,V]),ve=Q((e=>{const t=e.toString();S(t),F(t)}),[S,F]),be=Q((e=>Z((n=>{var o;const i="function"==typeof e?e(n):e;return u||h(gl(null!==(o=null==i?void 0:i.chainId)&&void 0!==o?o:void 0)),t&&i&&i!==n&&t(i),i}))),[h,gl,t,u]),je=Q((e=>B((t=>{const n="function"==typeof e?e(t):e;return l&&n&&n!==t&&l(n),n}))),[l]);Dl({fromToken:A,toToken:P,setFromToken:be,setToToken:je,updateFromAmt:ye,updateToAmt:ve,setIsReverseRouting:w});const we=Q((()=>{ye(""),ve(""),be(P),je(A),yr("from",P),yr("to",A)}),[be,P,je,A,ye,ve]),Ce=Q(((e,t)=>{if(t)return we();ye(""),ve(""),be(e),yr("from",e)}),[we,ye,ve,be,yr]),ke=Q(((e,t)=>{if(t)return we();ye(""),ve(""),je(e),yr("to",e)}),[we,ye,ve,be,yr]),Re=Q((()=>{j&&ye(""),w(!1)}),[j,ye,h]);Q((()=>{j||ve(""),w(!0)}),[j,ve,h]);const Se=(e=>{const{defaultSlippage:t}=zl(void 0===e),n=he(Yl)||t;return K((()=>(void 0===e?Number(n):e)>5),[n,e])})(X),Ie=K((()=>ue?new ie(ue).multipliedBy(100).dp(4,ie.ROUND_DOWN).toString():null),[ue]),Ee=K((()=>{const e=j?de:I;return e&&z?new ie(z).multipliedBy(e):null}),[z,I,j,de]),Me=K((()=>{if(!Y)return null;const e=j?T:de;return e?new ie(Y).multipliedBy(e):null}),[Y,T,j,de]),Te=K((()=>zt.jsxs(x,{sx:{display:"flex",fontWeight:600,typography:"body2",alignItems:"center",justifyContent:"center"},children:[zt.jsx(pc,{title:zt.jsx(n,{id:"4kY4C4",message:"Due to the market condition, market price and estimated price may have a slight difference"}),mr:8}),zt.jsxs(x,{sx:{display:"flex"},children:[zt.jsx(n,{id:"6+mYrD",message:"Current price impact"}),zt.jsxs(x,{sx:{color:d.palette.error.main,ml:4},children:[Ie,"%"]})]})]})),[Ie,d.palette.error.main]),Le=K((()=>zt.jsx(Bc,{toToken:P,fromToken:A,priceStatus:le,pricePerToToken:ge,pricePerFromToken:xe})),[P,A,le,ge,xe]),Oe=K((()=>!(i[u||1]||g&&g===u)),[u]),We=K((()=>!v&&!!u&&!!(null==A?void 0:A.chainId)&&(null==A?void 0:A.chainId)!==u),[u,null==A?void 0:A.chainId,v]),Ve=function({fromToken:e,toToken:t}){const n=he(Nl);return K((()=>!(!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:A,toToken:P}),Fe=K((()=>Se&&new ie(j?T:I).gt(0)&&!te&&le===Ml.Success?zt.jsxs(x,{sx:{textAlign:"center",mb:8},children:[zt.jsx(x,{component:Wt.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:5}})]}):null),[Se,j,I,T,le]),Ae=K((()=>We?zt.jsxs(x,{sx:{textAlign:"center"},children:[zt.jsx(x,{component:Wt.Warn,sx:{position:"relative",top:2,mr:6,width:16,height:16,color:"warning.main"}}),zt.jsx(n,{id:"54ffaC",message:"The current network is inconsistent with the wallet - please switch in wallet"})]}):le===Ml.Loading?zt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:zt.jsxs(zt.Fragment,{children:[zt.jsx(O,{sx:{mr:5}}),zt.jsx(n,{id:"JdNn1Y",message:"Fetching best price..."})]})}):Oe?zt.jsxs(zt.Fragment,{children:[zt.jsx(x,{component:Wt.Warn,sx:{mr:6,width:16,color:"warning.main"}}),zt.jsx(n,{id:"udsWDJ",message:"Unsupported network - switch to trade"})]}):C&&Ie&&new ie(Ie).gt(br)?Te:zt.jsxs(zt.Fragment,{children:[Fe,Le]})),[le,Le,C,Te,Ie,Oe,We,Fe]),Ze=K((()=>j?new ie(R).gt(0)?_r({input:de,decimals:null==A?void 0:A.decimals}):"-":C),[C,R,de,A,j]),Pe=K((()=>j?R:new ie(C).gt(0)?_r({input:de,decimals:null==P?void 0:P.decimals}):"-"),[C,R,de,P,j]),Be=K((()=>{if(!p||(null==A?void 0:A.chainId)&&u!==A.chainId)return zt.jsx(mc,{needSwitchChain:null==A?void 0:A.chainId});if(c)return zt.jsx(b,{fullWidth:!0,isLoading:!0,disabled:!0,children:zt.jsx(n,{id:"FRBvjQ",message:"Transaction Pending"})});if(!A||!P)return zt.jsx(b,{fullWidth:!0,disabled:!0,"data-testid":"swap-alert-select-token-btn",children:zt.jsx(n,{id:"KlvBGJ",message:"Select Tokens"})});if(ee)return zt.jsx(b,{fullWidth:!0,disabled:G,onClick:()=>ne(),children:G?zt.jsx(n,{id:"j2Uisd",message:"Approving"}):zt.jsx(n,{id:"Z7ZXbT",message:"Approve"})});if(!new ie(j?T:I).gt(0))return zt.jsx(b,{fullWidth:!0,disabled:!0,"data-testid":"swap-alert-enter-amount-btn",children:zt.jsx(n,{id:"iPMIoT",message:"Enter an amount"})});if(le===Ml.Loading)return zt.jsx(b,{fullWidth:!0,disabled:!0,"data-testid":"swap-alert-fetch-price-btn",children:zt.jsx(n,{id:"OauUE6",message:"Fetching Price..."})});return!de||le===Ml.Failed?zt.jsx(b,{fullWidth:!0,disabled:!0,children:zt.jsx(n,{id:"NVAuTg",message:"Quote not available"})}):te?zt.jsx(b,{fullWidth:!0,disabled:!0,"data-testid":"swap-alert-insufficient-balance-btn",children:zt.jsx(n,{id:"znqB4T",message:"Insufficient balance"})}):zt.jsx(b,{fullWidth:!0,onClick:()=>U(!0),"data-testid":"swap-review-btn",children:zt.jsx(n,{id:"K/Ay/d",message:"Review Swap"})})}),[p,A,u,c,P,ee,G,j,T,I,le,de,te,ne]),Ne=K((()=>A&&P?zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(Ss,{token:A,width:16,height:16,marginRight:6,chainId:A.chainId,noShowChain:!!g}),`${_r({input:j?de:I,decimals:null==A?void 0:A.decimals})} ${null==A?void 0:A.symbol}`,zt.jsx(x,{component:Wt.DoubleRight,sx:{width:12,height:12,mx:16}}),zt.jsx(Ss,{token:P,width:16,height:16,marginRight:6,chainId:P.chainId,noShowChain:!!g}),`${_r({input:j?T:de,decimals:null==P?void 0:P.decimals})} ${null==P?void 0:P.symbol}`]}):zt.jsx(x,{})),[A,P,I,T,de,j,g]);return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",typography:"caption",margin:20},children:[zt.jsx(n,{id:"vH2C/2",message:"Swap"}),zt.jsx(W,{open:void 0,title:zt.jsx(n,{id:"NSCBTb",message:"The setting has been switched to swap mode"}),placement:"bottom-end",children:zt.jsx(x,{component:M,children:zt.jsx(x,{component:Wt.Setting,onClick:()=>D(!0),sx:{width:19,height:19,color:"text.primary",cursor:"pointer"}})})})]}),zt.jsxs(x,{sx:{flex:1,padding:"0 16px 12px",overflowY:"auto"},children:[zt.jsxs(x,{children:[zt.jsx(Pc,{sx:{mb:4},token:A,side:"from",amt:Ze,defaultLoadBalance:!0,onMaxClick:re,onInputChange:ye,onInputFocus:Re,showMaxBtn:!j&&!C,occupiedAddrs:[null!==(a=null==P?void 0:P.address)&&void 0!==a?a:""],occupiedChainId:null==P?void 0:P.chainId,fiatPriceTxt:Ee?`$${Gr({input:Ee,showDecimals:1})}`:"-",onTokenChange:Ce,readOnly:j,showChainLogo:!g,showChainName:!g,notTokenPickerModal:!0}),zt.jsx(jc,{onClick:we,disabled:Ve}),zt.jsx(Pc,{token:P,side:"to",amt:Pe,onInputChange:ve,occupiedAddrs:[null!==(s=null==A?void 0:A.address)&&void 0!==s?s:""],occupiedChainId:null==A?void 0:A.chainId,fiatPriceTxt:Me?`$${Gr({input:Me,showDecimals:1})}(${Ie}%)`:"-",onTokenChange:ke,readOnly:!0,showChainLogo:!g,showChainName:!g,notTokenPickerModal:!0}),zt.jsx(x,{sx:{py:12,display:"flex",typography:"body2",alignItems:"center",justifyContent:"center",flexWrap:"wrap"},children:Ae})]}),Be,f?"":zt.jsxs(x,{sx:{mt:13,display:"flex",typography:"h6",cursor:"pointer",justifyContent:"center",alignItems:"center",color:d.palette.text.disabled},onClick:()=>window.open("https://app.dodoex.io"),children:[zt.jsx(x,{sx:{width:18,height:18,transform:"translate(1px, 2px)","& path":{fill:d.palette.text.disabled}},component:Wt.Dodo}),zt.jsx(n,{id:"7X+IbB",message:"Powered by DODO protocol"})]})]}),zt.jsx(fc,{toToken:P,fromToken:A,fromAmount:j?de:I,toAmount:j?T:de,open:N,baseFeeAmount:me,priceImpact:Ie,additionalFeeAmount:fe,curToFiatPrice:Me,execute:()=>se(Ne),clearFromAmt:()=>ye(""),clearToAmt:()=>ve(""),curFromFiatPrice:Ee,onClose:()=>U(!1),loading:le===Ml.Loading,slippage:X}),zt.jsx(bc,{open:H,onClose:()=>D(!1),fromToken:A,toToken:P})]})}var Uc;!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"}(Uc||(Uc={}));const Hc=Pe(((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:Uc.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 Dc({sx:e,onClick:t}){const o=y();return zt.jsxs(j,{onClick:()=>{t?t():Hc.getState().back()},sx:ue({display:"inline-flex",alignItems:"center",cursor:"pointer","& > svg":{mr:10}},e),children:[zt.jsx(x,{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:zt.jsx(Wt.ArrowBack,{})}),zt.jsx(n,{id:"CKyk7Q",message:"Go back"})]})}function Yc({statuses:e,children:t,buttonProps:o}){var i;if(!e.find((e=>e.needShowTokenStatusButton))&&t)return zt.jsx(zt.Fragment,{children:t});const r=e.find((e=>e.insufficientBalance));if(r)return zt.jsx(b,{fullWidth:!0,disabled:!0,...o,children:zt.jsx(n,{id:"m6RmA/",message:"Insufficient {0} balance",values:{0:null===(i=r.token)||void 0===i?void 0:i.symbol}})});const l=e.some((e=>e.isApproving));return zt.jsx(x,{sx:{display:"flex",alignItems:"center",gap:4},children:e.map(((e,t)=>{var i,r;let a="";return e.isApproving?a=zt.jsx(n,{id:"j2Uisd",message:"Approving"}):(e.needReset||e.needApprove)&&(a=e.approveTitle),a?zt.jsx(b,{fullWidth:!0,isLoading:e.isApproving,onClick:e.submitApprove,disabled:e.insufficientBalance||l,...o,children:a},null!==(r=null===(i=e.token)||void 0===i?void 0:i.symbol)&&void 0!==r?r:t):null}))})}function zc({token:e,chainId:t,showChainLogo:o,readonly:i,showChainName:r,logoSize:l=24,chainLogoSize:a=12,side:s,occupiedToken:d,defaultLoadBalance:c,notTokenPickerModal:u,border:p,px:h=20,py:m=8,highlightDefault:f,onTokenClick:g,onTokenChange:v}){var b,j;const{onlyChainId:w}=Vr(),C=t||w,k=y(),[R,S]=G.useState(!1),I=(null==e?void 0:e.chainId)?ks.get(e.chainId):null,E=r&&!!I;return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{component:M,sx:Object.assign(Object.assign({display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,color:k.palette.text.primary,typography:E?"body2":"body1",fontWeight:600,px:h,py:m,"&:focus-visible":{opacity:.5}},!!p&&{border:`solid 1px ${k.palette.border.main}`,borderRadius:8,"&:hover":{backgroundColor:k.palette.hover.default}}),!(!f||e)&&{backgroundColor:k.palette.primary.main,color:k.palette.primary.contrastText,"&:hover":{opacity:.8}}),onClick:()=>{i||S(!0)},"data-testid":Ir,children:[!!(null==e?void 0:e.address)&&zt.jsx(Ss,{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:l,height:l,chainSize:a,logoOffset:10,marginRight:0}),zt.jsxs(x,{sx:{flex:1},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(null==e?void 0:e.address)?zt.jsx(zt.Fragment,{children:zt.jsx(x,{children:null!==(j=null==e?void 0:e.symbol)&&void 0!==j?j:"-"})}):zt.jsx(n,{id:"sIPJGT",message:"SELECT TOKEN"}),!i&&zt.jsx(x,{component:"svg",width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{flexShrink:0},children:zt.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"})})]}),!!E&&zt.jsxs(x,{sx:{display:"flex",alignItems:"center",typography:"h6",color:"text.secondary"},children:[I.name,zt.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zt.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"})})]})]})]}),zt.jsx(Ac,{value:e,open:R,side:s,chainId:C,occupiedAddrs:d?[d.address]:void 0,occupiedChainId:null==d?void 0:d.chainId,defaultLoadBalance:c,onClose:()=>{S(!1),g&&g()},onTokenChange:(e,t)=>{S(!1),setTimeout((()=>{!Array.isArray(e)&&v&&v(e,t)}),Kd)},modal:!u})]})}const Xc=G.forwardRef((function(e,t){var{sx:n}=e,o=Tr(e,["sx"]);const{isMobile:i}=Rc(),r=y();return zt.jsx(x,{className:"widget-module-container",ref:t,sx:Object.assign(Object.assign({flex:1,overflowY:"auto"},i?{padding:0,height:"100%",width:"100%",overflowX:"hidden"}:{padding:r.spacing(28,20,40,40),height:"auto"}),n),...o})})),qc="auto",Gc="0.1",_c="0.5",Jc="0.5";function Qc(e){const t=te();return J((()=>{t.current=e})),t.current}function Kc({baseToken:t,quoteToken:n,pairMintAAmount:i,pairMintBAmount:r,slippage:l,isExists:a,poolInfo:s,poolKeys:d,successBack:c,submittedBack:u}){const p=Cl(),{account:h}=Ar(),m=Ws();return e(),Ce({mutationFn:()=>Lr(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(!m)throw new Error("raydium is undefined");const e=new gt(new xt(i).mul(10**s.mintA.decimals).toFixed(0,xt.ROUND_DOWN)),f=new De(100*l*100,1e4),{execute:g}=a?yield m.cpmm.addLiquidity({poolInfo:s,poolKeys:d,inputAmount:e,slippage:f,baseIn:!0,txVersion:Ue.LEGACY}):yield m.cpmm.createPool({programId:sl,poolFeeAccount:dl,mintA:s.mintA,mintB:s.mintB,mintAAmount:e,mintBAmount:new gt(new xt(r).mul(10**s.mintB.decimals).toFixed(0,xt.ROUND_DOWN)),startTime:new gt(0),feeConfig:cl[0],associatedOnly:!1,ownerInfo:{useSOLBalance:!0},txVersion:Es});return yield p.executeCustom({brief:a?o._({id:"E6MqGy",message:"Add liquidity"}):o._({id:"L37FfW",message:"Create AMM V2 Position"}),metadata:{[a?Pr.addLiquidityAMMV2Position:Pr.createAMMV2Position]:!0},handler:e=>Lr(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 $c({pool:e,baseAmount:t,quoteAmount:n,slippage:o}){var i,r,l,a,s,d,c,u,p,h,m,f,g,x;const{account:y}=Ar(),v=Ws(),[b,j,w,C,k]=K((()=>{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 gt(new Te(o.address).toBuffer()).lte(new gt(new Te(i.address).toBuffer())),[l,a]=r?[o,i]:[i,o],[s,d]=r?[t,n]:[n,t];return[l,a,s,d,r]}),[t,e,n]),R=we({queryKey:["cpmm","poolInfo",null==e?void 0:e.address],enabled:null!=(null==e?void 0:e.address),queryFn:()=>Lr(this,void 0,void 0,(function*(){if(!(null==e?void 0:e.address)||!v)return null;const{poolInfo:t,poolKeys:n,rpcData:o}=yield v.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],l=el(t.lpAmount,t.lpMint.decimals);return{baseReserve:el(o.baseReserve.toNumber(),n.mintA.decimals),quoteReserve:el(o.quoteReserve.toNumber(),n.mintB.decimals),lpAmount:l,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:l.toNumber(),mintA:Object.assign(Object.assign({},t.mintA),{symbol:i}),mintB:Object.assign(Object.assign({},t.mintB),{symbol:r})}),rpcData:o}}))}),S=we({queryKey:["cpmm","lpBalance",null===(r=null===(i=R.data)||void 0===i?void 0:i.lpMint)||void 0===r?void 0:r.address],enabled:!!(y&&R.data&&(null===(l=R.data)||void 0===l?void 0:l.lpMint)&&(null===(s=null===(a=R.data)||void 0===a?void 0:a.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:()=>Lr(this,void 0,void 0,(function*(){var e,t,n,o,i;if(!(y&&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)&&v))return null;yield v.account.fetchWalletTokenAccounts();const r=R.data.lpMint.address,l=v.account.tokenAccounts.find((e=>e.mint.toBase58()===r));if(!l)throw new Error(`you do not have balance in pool: ${r}`);return el(l.amount.toNumber(),R.data.lpMint.decimals)}))}),I=we({queryKey:["cpmm","pairAmount",w,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)||!w),queryFn:()=>Lr(this,void 0,void 0,(function*(){var e;if(!(R.data&&(null===(e=R.data)||void 0===e?void 0:e.poolInfo)&&w&&v))return null;const t=R.data.poolInfo,n=yield v.cpmm.computePairAmount({baseReserve:R.data.rpcData.baseReserve,quoteReserve:R.data.rpcData.quoteReserve,poolInfo:t,amount:w,slippage:new De(100*o*100,1e4),baseIn:!0,epochInfo:yield v.fetchEpochInfo()});return{pairMintAAmount:w,pairMintBAmount:el(n.anotherAmount.amount.toString(),t.mintB.decimals).toString(),liquidityMinted:el(n.liquidity.toString(),t.lpMint.decimals)}}))}),[E,M,T,L]=K((()=>{if(!R.data||!S.data)return[void 0,void 0,void 0,void 0];const{baseReserve:e,quoteReserve:t,lpAmount:n}=R.data,o=S.data,i=o.div(n),r=o.multipliedBy(e).div(n),l=o.multipliedBy(t).div(n);return[o,i,r,l]}),[R.data,S.data]),O=G.useMemo((()=>R.isFetched&&null!=R.data),[R.isFetched,R.data]),[W,V]=G.useMemo((()=>{var e,o;if(O){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 ie(R.data.poolInfo.price);return[e,new ie(1).div(e)]}return[void 0,void 0]}return t&&n?[new ie(n).div(t),new ie(t).div(n)]:[void 0,void 0]}),[t,O,null===(m=null===(h=R.data)||void 0===h?void 0:h.poolInfo)||void 0===m?void 0:m.price,n]);return{isFront:k,poolInfoQuery:R,lpBalanceQuery:S,lpBalance:E,lpBalancePercentage:M,lpToAmountA:T,lpToAmountB:L,price:W,invertedPrice:V,liquidityMinted:null===(f=I.data)||void 0===f?void 0:f.liquidityMinted,pairMintAAmount:null===(g=I.data)||void 0===g?void 0:g.pairMintAAmount,pairMintBAmount:null===(x=I.data)||void 0===x?void 0:x.pairMintBAmount,isExists:O}}const eu="DODO_WIDGET_POOL_LIST_TAB",tu="DODO_WIDGET_POOLS_LIST_FILTER_CHAIN";var nu;!function(e){e.addLiquidity="add-liquidity",e.myLiquidity="my-liquidity",e.myCreated="my-created"}(nu||(nu={}));var ou=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()}},iu={"text/plain":"Text","text/html":"Url",default:"Text"};var ru=function(e,t){var n,o,i,r,l,a,s=!1;t||(t={}),n=t.debug||!1;try{if(i=ou(),r=document.createRange(),l=document.getSelection(),(a=document.createElement("span")).textContent=e,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.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=iu[t.format]||iu.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(a),r.selectNodeContents(a),l.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{l&&("function"==typeof l.removeRange?l.removeRange(r):l.removeAllRanges()),a&&document.body.removeChild(a),i()}return s},lu=Lt(ru);function au({copyText:e,size:t,sx:n,componentProps:i,onClick:r,children:l}){var a;const[s,d]=G.useState(!1);return zt.jsx(A,{title:o._({id:"6V3Ea3",message:"Copied"}),open:s,onClose:()=>d(!1),arrow:!1,children:zt.jsxs(x,{...i,component:null!==(a=null==i?void 0:i.component)&&void 0!==a?a:M,onClick:t=>{if(null==i?void 0:i.onClick)return i.onClick(t);t.stopPropagation(),e&&(lu(e),d(!0)),r&&r()},sx:Object.assign({cursor:"pointer"},null==i?void 0:i.sx),children:[zt.jsx(x,{component:Wt.Copy,sx:Object.assign({width:t||"auto",height:t||"auto"},n)}),l]})})}function su({truncate:e,address:t,disabledAddress:n,sx:o,handleOpen:i,addressHoverColor:r,addressHoverShowIcon:l}){return n?zt.jsx(x,{children:e?Oc(t):t}):zt.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:zt.jsxs(x,{onClick:e=>{null==i||i(e,"address")},sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[e?Oc(t):t,l?zt.jsx(x,{component:Wt.ArrowRight,sx:{display:"none",width:14,height:14}}):""]})})}function du({address:e,truncate:t,showCopy:n,size:o="medium",iconSize:i,iconSpace:r,sx:l,iconDarkHover:a,disabledAddress:s,addressHoverColor:d,addressHoverShowIcon:c,customChainId:u,handleOpen:p,onAddressClick:h}){const m=y(),f="medium"===o,g=a?P:j,v=e=>{let t=e?12:8;return r&&(t=r),a&&(t-=3),t},b="big"===o?"h5":f?"body1":"body2",{chainId:w}=Ar(),C=null!=u?u:w,k=(t,n)=>{p?p(t,n):C&&(t.stopPropagation(),window.open(Wc(C,e,"address")))};return zt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",typography:b,color:m.palette.text.primary,lineHeight:"normal"},l||{}),children:[zt.jsx(su,{truncate:t,address:e,disabledAddress:s,sx:l,typography:b,handleOpen:null!=h?h:k,addressHoverColor:d,addressHoverShowIcon:c}),zt.jsx(g,{sx:{display:"inline-flex",ml:v(f),cursor:"pointer"},onClick:e=>{k(e,"icon")},children:zt.jsx(x,{component:Wt.ArrowTopRightBorder,sx:{width:i||(f?16:14),height:i||(f?16:14)}})}),n?zt.jsx(au,{size:i||(f?16:14),copyText:e,componentProps:{component:g,sx:{ml:v(f)}}}):null]})}function cu(e){var{sx:t,label:n,children:o}=e,i=Tr(e,["sx","label","children"]);return zt.jsxs(x,{sx:Object.assign({display:"flex",justifyContent:"space-between"},t),...i,children:[zt.jsx(x,{children:n}),zt.jsx(x,{sx:{textAlign:"right",fontWeight:600},children:o})]})}function uu({tokens:e,width:t=24,height:n=24,gap:o=-4,cross:i,mr:r,chainId:l,showChainLogo:a,sx:s}){var d;const c=y(),{onlyChainId:u}=Vr(),p=a&&!u;if(!e||e.length<=0)return null;const h=t/2;return zt.jsxs(x,{sx:Object.assign({display:"inline-flex",alignItems:"center",mr:r,position:"relative",zIndex:0},s),children:[e.map(((e,n)=>zt.jsx(x,{sx:{display:"inline-flex",width:t,height:t,ml:n>0?o:0,borderRadius:"50%",backgroundColor:c.palette.background.default},children:"object"==typeof e?zt.jsx(Ss,{address:e.address,width:t,height:t,chainId:l,url:e.logoURI,cross:i,noShowChain:!0,noBorder:!0,marginRight:0}):zt.jsx(x,{component:"img",height:t,src:e})},n))),p&&ks.has(l)?zt.jsx(x,{component:null===(d=ks.get(l))||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 pu({baseToken:e,quoteToken:t,midPrice:n,loading:o,disabled:i}){const r=y(),[l,a]=_(!1),s=l?null==t?void 0:t.symbol:null==e?void 0:e.symbol,d=l&&n?new ie(1).div(n):n,c=l?null==e?void 0:e.symbol:null==t?void 0:t.symbol;return zt.jsxs(E,{sx:{display:"flex",alignItems:"center",fontWeight:600,overflow:"hidden"},loading:o,loadingProps:{width:50},children:[e&&t?zt.jsx(W,{title:`1 ${s} = ${d?Gr({input:d}):""} ${c}`,children:n?zt.jsx(x,{sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:`1 ${s} = ${d?Gr({input:d}):""} ${c}`}):zt.jsxs(x,{children:[`1 ${s} = `,zt.jsx(E,{loading:o,loadingProps:{width:30},component:"span",sx:{display:"inline-block"},children:"-"}),` ${c}`]})}):"-",zt.jsx(x,{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:L(r.palette.text.primary,.04)}}),onClick:()=>{i||a((e=>!e))},children:zt.jsx(x,{component:Wt.Switch,sx:{width:18,height:18}})})]})}function hu({baseToken:e,quoteToken:t,loading:o,midPrice:i,lpBalancePercentage:r,sx:l}){const a=y(),s=!e||!t;return zt.jsxs(x,{sx:Object.assign({mt:20,border:"solid 1px",borderColor:"border.main",borderRadius:8},l),children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:12,py:4,height:36,typography:"body2"},children:[zt.jsx(x,{sx:{color:"text.secondary",whiteSpace:"nowrap"},children:zt.jsx(n,{id:"kNeEXg",message:"Current Price"})}),zt.jsx(pu,{baseToken:e,quoteToken:t,loading:o,disabled:s,midPrice:i})]}),zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:12,py:4,minHeight:36,typography:"body2",borderStyle:"solid",borderWidth:a.spacing(1,0,0),borderColor:"border.main"},children:[zt.jsx(x,{sx:{display:"flex",alignItems:"center",color:"text.secondary",whiteSpace:"nowrap"},children:zt.jsx(n,{id:"SbBMxj",message:"Share of pool"})}),zt.jsx(x,{sx:{display:"flex",alignItems:"center",fontWeight:600,textAlign:"right",ml:8,overflow:"hidden"},children:zt.jsx(E,{sx:{display:"flex",alignItems:"center",fontWeight:600,overflow:"hidden"},loading:o,loadingProps:{width:50},children:r?`${ll({input:r,roundingMode:ie.ROUND_DOWN})}`:"-%"})})]})]})}function mu({open:e,onClose:t,slippage:o,baseToken:i,quoteToken:r,pairMintAAmount:l,pairMintBAmount:a,lpAmount:s,feeRate:d,price:c,lpBalancePercentage:u,pairAddress:p,createMutation:h}){const m=y(),{isMobile:f}=Rc();return zt.jsx(tc,{modal:!0,open:e,onClose:t,title:s?zt.jsx(n,{id:"AeZIvT",message:"You will receive"}):zt.jsx(n,{id:"aM1tos",message:"You are creating a pool"}),children:zt.jsxs(x,{sx:{px:20,py:24,borderTopWidth:1,width:f?"100%":420},children:[zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,typography:"h3"},children:[zt.jsx(uu,{width:24,height:24,tokens:i&&r?[i,r]:[]}),s?_r({input:s,decimals:null==i?void 0:i.decimals}):""]}),zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,fontWeight:600},children:[zt.jsx(n,{id:"syToc5",message:"{0}/{1} Pool Tokens",values:{0:null==i?void 0:i.symbol,1:null==r?void 0:r.symbol}}),zt.jsx(x,{sx:{px:4,py:2,fontSize:10,lineHeight:1,backgroundColor:L(m.palette.purple.main,.1),color:m.palette.purple.main,borderRadius:4},children:zt.jsx(n,{id:"rbsyJM",message:"AMM V2"})})]})]}),zt.jsx(x,{sx:{mt:16,typography:"h6",color:"text.secondary",textAlign:"center"},children:zt.jsx(n,{id:"rQ9c+8",message:"Output is estimated. If the price changes by more than {0} your transaction will revert.",values:{0:ll({input:o})}})}),zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:12,mt:20,p:20,typography:"body2",borderRadius:12,backgroundColor:m.palette.background.paperContrast},children:[zt.jsx(cu,{label:zt.jsx(n,{id:"YG004A",message:"{0} deposited",values:{0:null==i?void 0:i.symbol}}),children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[zt.jsx(Ss,{width:18,height:18,marginRight:4,token:i}),_r({input:l,decimals:null==i?void 0:i.decimals})]})}),zt.jsx(cu,{label:zt.jsx(n,{id:"YG004A",message:"{0} deposited",values:{0:null==r?void 0:r.symbol}}),children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(Ss,{width:18,height:18,marginRight:4,token:r}),_r({input:a,decimals:null==r?void 0:r.decimals})]})}),zt.jsx(cu,{label:zt.jsx(n,{id:"EU3wU4",message:"Fee tier"}),children:null!=d?Number(d)/1e4+"%":"-"}),zt.jsx(cu,{label:zt.jsx(n,{id:"fqDzSu",message:"Rate"}),children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(Ss,{width:18,height:18,marginRight:4,token:i}),zt.jsx(pu,{baseToken:i,quoteToken:r,midPrice:c})]})}),zt.jsx(cu,{label:zt.jsx(n,{id:"SbBMxj",message:"Share of pool"}),children:u?`${ll({input:u})}`:"-%"}),zt.jsx(cu,{label:zt.jsx(n,{id:"ESQO1L",message:"Pool address"}),children:zt.jsx(du,{showCopy:!1,address:null!=p?p:"",customChainId:null==i?void 0:i.chainId,truncate:!0,iconSpace:4,sx:{typography:"body2"}})})]}),zt.jsx(b,{fullWidth:!0,size:b.Size.big,sx:{mt:20},isLoading:h.isPending,onClick:()=>{h.mutate()},children:h.isPending?zt.jsx(n,{id:"pwUZo2",message:"Confirming..."}):zt.jsx(n,{id:"7VpPHA",message:"Confirm"})})]})})}function fu({title:e,disabled:t,children:n}){return zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:12,opacity:t?.3:void 0},children:[zt.jsx(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",fontWeight:600},children:e}),n]})}function gu({disabled:e,feeIndex:t,onChange:o,feeList:i}){const r=y(),[l,a]=G.useState(!1),{isMobile:s}=Rc(),d=e,c=i[t];return zt.jsxs(x,{sx:{opacity:e?.3:void 0,fontWeight:600},children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:20,py:12,borderWidth:1,borderRadius:12},children:[zt.jsx(n,{id:"tMMG40",message:"{0}% fee tier",values:{0:c?new ie(c.tradeFeeRate).div(1e4).toString():"-"}}),zt.jsx(M,{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||a((e=>!e))},children:l?zt.jsx(n,{id:"vLyv1R",message:"Hide"}):zt.jsx(n,{id:"ePK91l",message:"Edit"})})]}),l&&zt.jsx(zt.Fragment,{children:zt.jsx(x,{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 zt.jsxs(x,{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,"%",zt.jsx(B,{size:18,checked:i,onChange:(e,t)=>{t&&o(n)}})]},e.id)}))})})]})}function xu({chainId:e,address:t,showName:n,size:o,offset:i,rightContent:r}){const l=zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:i},children:[zt.jsx(Ss,{chainId:e,address:t,width:o,height:o,noShowChain:!0,marginRight:0}),n]});return r?zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[l,r]}):l}function yu({isExists:e,poolInfo:t,poolInfoLoading:o,lpBalanceLoading:r,lpBalance:l,lpBalancePercentage:a,lpToAmountA:s,lpToAmountB:d,sx:c}){var u,p;const h=a?`${ll({input:a,roundingMode:ie.ROUND_DOWN})}`:void 0;return e&&t?zt.jsxs(x,{sx:Object.assign({px:20,py:12,borderWidth:1,borderRadius:8},c),children:[zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"YHc3B+",message:"My Liquidity"})}),zt.jsxs(x,{sx:{mt:12,display:"flex",alignItems:"center",flexWrap:"wrap"},children:[zt.jsx(uu,{width:18,height:18,tokens:[t.mintA,t.mintB],mr:4}),zt.jsx(E,{loading:r,loadingProps:{width:50},sx:{mr:4},children:_r({input:l,decimals:t.lpMint.decimals})}),`${t.mintA.symbol}/${t.mintB.symbol} LP`,zt.jsx(W,{title:zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:10,typography:"body2",color:"text.primary"},children:[zt.jsx(xu,{address:t.mintA.address,chainId:t.mintA.chainId,showName:null!==(u=t.mintA.symbol)&&void 0!==u?u:"",size:14,offset:4,rightContent:zt.jsx(E,{loading:o,loadingProps:{width:50},children:_r({input:s,decimals:t.mintA.decimals})})}),zt.jsx(xu,{address:t.mintB.address,chainId:t.mintB.chainId,showName:null!==(p=t.mintB.symbol)&&void 0!==p?p:"",size:14,offset:4,rightContent:zt.jsx(E,{loading:o,loadingProps:{width:50},children:_r({input:d,decimals:t.mintB.decimals})})}),zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[zt.jsx(n,{id:"c4miqE",message:"Pool share"}),zt.jsx(E,{loading:o,loadingProps:{width:50},children:h})]})]}),sx:{padding:20,width:256},children:zt.jsx(j,{component:Wt.DetailBorder,sx:{ml:4,width:16,height:16,cursor:"pointer"}})}),zt.jsx(x,{component:"a",target:"_blank",rel:"noopener noreferrer",href:Wc(i.SOON_TESTNET,t.lpMint.address,"address"),sx:{ml:4,display:"inline-flex",height:16},children:zt.jsx(j,{component:Wt.ArrowTopRightBorder,sx:{width:16,height:16}})})]})]}):null}function vu({active:e,sx:t,onClick:o}){const i=y(),r="light"===i.palette.mode;let l=i.palette.primary.main,a="transparent";return e&&(l=i.palette.primary.contrastText,a=L(i.palette.primary.main,.8)),zt.jsx(x,{component:M,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 ${l}`,color:l,backgroundColor:a,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:zt.jsx(n,{id:"R9Khdg",message:"Auto"})})}function bu({sx:e,disabled:t,slippage:o,onChangeSlippage:i}){const r=y(),l=o===qc,[a,s]=_(l?"":new ie(o).times(100).toNumber());return zt.jsx(W,{disabled:t,onlyClick:!0,title:zt.jsxs(x,{sx:{backgroundColor:r.palette.background.paper,padding:r.spacing(16,20),borderRadius:16,width:375,maxWidth:"90vw",boxSizing:"border-box"},children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",typography:"body2",color:"text.primary"},children:[zt.jsx("span",{children:zt.jsx(n,{id:"lqTDfd",message:"Slippage Tolerance"})}),zt.jsxs("span",{children:[l?_c:o&&new ie(o).times(100).toNumber(),"%"]})]}),zt.jsxs(x,{sx:{mt:16,display:"flex",alignItems:"center",margin:r.spacing(16,0,0,0)},children:[zt.jsx(vu,{sx:{borderRadius:8,whiteSpace:"nowrap"},onClick:()=>{s(""),i(qc)},active:l}),zt.jsx(T,{placeholder:String(_c),value:a,onChange:e=>{const{value:t}=e.target;s(t),i(t?new ie(t).div(100).toNumber():qc)},onBlur:()=>{(!l&&new ie(o).gt(.1)||new ie(o).lte(0))&&(s(10),i(.1))},suffix:zt.jsx(x,{sx:{mr:16},children:"%"}),sx:{ml:8,"& input":{px:16,py:0,height:"39px"}}})]})]}),sx:{p:0},arrow:!1,placement:"bottom-end",children:zt.jsx(P,{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:zt.jsx(x,{component:Wt.Setting,sx:{width:18,height:18,"& path:last-child":{fill:r.palette.text.primary}}})})})}function ju(){var e,t,o;const[i,r]=G.useState(0),[l,a]=G.useState(),[s,d]=G.useState(),[c,u]=G.useState(""),[p,h]=G.useState(""),[m,f]=G.useState(qc),g=m===qc?new ie(_c).div(100).toNumber():m,{isMobile:y}=Rc(),{onlyChainId:v}=Vr(),j=G.useMemo((()=>v||(null==l?void 0:l.chainId)||(null==s?void 0:s.chainId)),[v,l,s]),{poolKeys:w,poolInfo:C,pairAddress:k,price:R,isInvalidPair:S,invertedPrice:I,poolInfoLoading:E,lpBalanceLoading:M,lpBalance:T,lpBalancePercentage:L,lpToAmountA:O,lpToAmountB:W,liquidityMinted:V,pairMintAAmount:F,pairMintBAmount:A,isExists:Z}=function({baseToken:e,quoteToken:t,baseAmount:n,quoteAmount:o,feeIndex:i,slippage:r}){var l,a,s;const[d,c]=G.useMemo((()=>{if(!e||!t||null==i)return[void 0,!0];const n=new gt(new Te(e.address).toBuffer()).lte(new gt(new Te(t.address).toBuffer())),[o,r]=n?[e,t]:[t,e],[l,a]=[new Te(o.address),new Te(r.address)];return[Ye({poolId:void 0,programId:sl,configId:new Te(cl[i].id),mintA:l,mintB:a}),l.toBase58()===a.toBase58()]}),[i,e,t]),{price:u,invertedPrice:p,poolInfoQuery:h,lpBalanceQuery:m,lpBalance:f,lpBalancePercentage:g,lpToAmountA:x,lpToAmountB:y,liquidityMinted:v,pairMintAAmount:b,pairMintBAmount:j,isExists:w}=$c({pool:e&&t&&d?{baseToken:e,quoteToken:t,address:d.poolId.toBase58()}:void 0,baseAmount:n,quoteAmount:o,slippage:r});return{poolKeys:null===(l=h.data)||void 0===l?void 0:l.poolKeys,poolInfo:null===(a=h.data)||void 0===a?void 0:a.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:m.isLoading,lpBalance:f,lpBalancePercentage:g,lpToAmountA:x,lpToAmountB:y,liquidityMinted:v,pairMintAAmount:b,pairMintBAmount:j,isExists:w}}({baseToken:l,quoteToken:s,baseAmount:c,quoteAmount:p,feeIndex:i,slippage:g}),P=Qc(R);if(R&&c&&!R.isEqualTo(null!=P?P:0)&&Z){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 B=oa(l,{amount:c}),N=oa(s,{amount:p}),[U,H]=G.useState(!1),D=!l||!s,Y=()=>{Hc.getState().push({type:Uc.Pool})},z=Kc({baseToken:l,quoteToken:s,pairMintAAmount:F,pairMintBAmount:A,isExists:Z,poolKeys:w,poolInfo:C,slippage:g,successBack:()=>{Hc.getState().push({type:Uc.Pool,params:{tab:nu.myLiquidity}})}});return zt.jsxs(Xc,{children:[zt.jsxs(x,{sx:{mx:"auto",borderRadius:y?0:16,backgroundColor:"background.paper",width:y?"100%":600,position:"relative",overflow:"hidden"},children:[y?zt.jsx(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20,pb:0},children:zt.jsx(Dc,{onClick:Y})}):zt.jsxs(x,{sx:{position:"relative",display:"flex",justifyContent:"center",alignItems:"center",px:20,py:24,typography:"caption"},children:[zt.jsx(x,{component:Wt.ArrowBack,sx:{position:"absolute",left:20,cursor:"pointer"},onClick:Y}),zt.jsx(n,{id:"E6MqGy",message:"Add liquidity"})]}),zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:20,pt:24,px:20,pb:20},children:[zt.jsx(yu,{isExists:Z,poolInfo:C,poolInfoLoading:E,lpBalanceLoading:M,lpBalance:T,lpBalancePercentage:L,lpToAmountA:O,lpToAmountB:W}),zt.jsxs(fu,{title:zt.jsx(n,{id:"nxRg31",message:"Select pair"}),children:[zt.jsxs(x,{sx:{display:"grid",gridTemplateColumns:y?"repeat(1, 1fr)":"repeat(2, 1fr)",gap:12},children:[zt.jsx(zc,{border:!0,highlightDefault:!0,chainId:j,token:l,onTokenChange:(e,t)=>{t?(a(s),d(l),u(""),h("")):(a(e),u(""))},occupiedToken:s}),zt.jsx(zc,{border:!0,highlightDefault:!0,chainId:j,token:s,onTokenChange:(e,t)=>{t?(a(s),d(l)):(d(e),h(""))},occupiedToken:l})]}),zt.jsx(gu,{feeIndex:i,onChange:r,feeList:cl,disabled:D})]}),zt.jsx(fu,{title:zt.jsx(n,{id:"MU9s7M",message:"Deposit amounts"}),disabled:D,children:zt.jsxs(x,{children:[zt.jsx(Pc,{sx:{mb:4,pb:28,minHeight:"auto"},token:l,amt:c,defaultLoadBalance:!0,onInputChange:e=>{var t;u(e);const n=Number(e);Z&&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}),zt.jsx(jc,{plus:!0}),zt.jsx(Pc,{sx:{pb:20,minHeight:"auto"},token:s,amt:p,defaultLoadBalance:!0,onInputChange:e=>{var t;h(e);const n=Number(e);Z&&I&&n&&u(I.times(e).dp(null!==(t=null==l?void 0:l.decimals)&&void 0!==t?t:18).toString())},showMaxBtn:!0,occupiedAddrs:[null!==(o=null==l?void 0:l.address)&&void 0!==o?o:""],occupiedChainId:null==l?void 0:l.chainId,notTokenPickerModal:!0,showPercentage:!0,readOnly:D}),zt.jsx(bu,{slippage:m,onChangeSlippage:f,disabled:D,sx:{mt:8}}),zt.jsx(hu,{baseToken:l,quoteToken:s,loading:E,midPrice:R,lpBalancePercentage:Z?L:100}),!!Z&&zt.jsxs(x,{sx:{mt:20,p:20,borderRadius:16,backgroundColor:"background.paperContrast",typography:"h6",textAlign:"center","& > b":{fontWeight:600,color:"primary.main"}},children:["🌟",zt.jsx("b",{children:zt.jsx(n,{id:"e38JNU",message:"Tips:"})})," ",zt.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:ll({input:cl[i].tradeFeeRate/1e4})},components:{0:zt.jsx("b",{})}})]})]})})]}),zt.jsx(x,{sx:{py:16,px:20,borderTopWidth:1},children:zt.jsx(hc,{fullWidth:!0,includeButton:!0,size:b.Size.big,disabled:D,chainId:j,children:zt.jsx(Yc,{statuses:[B,N],buttonProps:{size:b.Size.big},children:zt.jsx(b,{fullWidth:!0,size:b.Size.big,disabled:!(l&&s&&c&&p&&!S&&null!=i),onClick:()=>H(!0),children:S?zt.jsx(n,{id:"R7D79P",message:"Invalid pair"}):zt.jsx(n,{id:"bwSQI0",message:"Supply"})})})})})]}),zt.jsx(mu,{open:U,onClose:()=>H(!1),slippage:g,baseToken:l,pairMintAAmount:F,quoteToken:s,pairMintBAmount:A,feeRate:cl[i].tradeFeeRate,price:R,lpAmount:V,lpBalancePercentage:Z?L:100,pairAddress:k,createMutation:z})]})}const wu=({type:e})=>{const[t,n]=_(qc),o=K((()=>t===qc?e===u?new ie(Jc).div(100).toNumber():e===p?new ie(_c).div(100).toNumber():new ie(Gc).div(100).toNumber():t),[t,e]);return{slipper:t,setSlipper:n,slipperValue:o,resetSlipper:()=>{n(qc)}}};function Cu({type:e,disabled:t,value:o,onChange:i,sx:r}){const l=y(),a=o===qc,[s,d]=_(a?"":new ie(o).times(100).toNumber()),c=e===u?Jc:e===p?_c:Gc;return zt.jsx(W,{disabled:t,onlyClick:!0,title:zt.jsxs(x,{sx:{backgroundColor:l.palette.background.paper,padding:l.spacing(12,20),borderRadius:8,width:318,maxWidth:"90vw",boxSizing:"border-box"},children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",typography:"body2"},children:[zt.jsx("span",{children:zt.jsx(n,{id:"lqTDfd",message:"Slippage Tolerance"})}),zt.jsxs("span",{children:[a?c:o&&new ie(o).times(100).toNumber(),"%"]})]}),zt.jsxs(x,{sx:{display:"flex",alignItems:"center",margin:l.spacing(16,0,0,0)},children:[zt.jsx(vu,{sx:{borderRadius:8,whiteSpace:"nowrap"},onClick:()=>{d(""),i(qc)},active:a}),zt.jsx(T,{placeholder:String(c),value:s,onChange:e=>{const{value:t}=e.target;d(t),i(t?new ie(t).div(100).toNumber():qc)},onBlur:()=>{(!a&&new ie(o).gt(.1)||new ie(o).lte(0))&&(d(10),i(.1))},suffix:zt.jsx(x,{sx:{mr:16},children:"%"}),sx:{ml:8,"& input":{px:16,py:0,height:"39px"}}})]})]}),sx:{p:0},arrow:!1,placement:"bottom-end",children:zt.jsx(P,{sx:Object.assign({width:"max-content",alignItems:"right",margin:l.spacing(0,0,0,"auto"),p:l.spacing(4,12),borderRadius:20,backgroundColor:"background.paperDarkContrast"},r),children:zt.jsx(x,{component:Wt.Setting,sx:{width:18,height:18,"& path:last-child":{fill:l.palette.text.primary}}})})})}const ku=({chainId:e,isValid:t,errorMessage:n,setShowConfirm:i})=>zt.jsx(hc,{includeButton:!0,fullWidth:!0,chainId:e,children:zt.jsx(b,{fullWidth:!0,size:b.Size.big,onClick:()=>{i(!0)},disabled:!t,danger:!t,children:n||o._({id:"rdUucN",message:"Preview"})})}),Ru=[.25,.5,.75,1];function Su({currentValue:e,onClick:t,sx:n}){const o=y(),i="light"===o.palette.mode,{isMobile:r}=Rc(),[l,a]=_(null),s=te(0);J((()=>{e?(s.current+=1,s.current>=2&&(a(null),s.current=0)):a(null)}),[e]);const d=Qc(e);return J((()=>{d===e&&1===l&&(s.current=1)}),[e,d,l]),zt.jsx(x,{sx:Object.assign({display:"grid",gap:r?10:14,gridTemplateColumns:`repeat(${Ru.length}, 1fr)`},n),children:Ru.map((e=>{const n=e===l;return zt.jsxs(M,{sx:{typography:"h6",borderRadius:4,padding:o.spacing(4,0),width:"100%",color:"text.secondary",backgroundColor:"background.paperDarkContrast","&:hover":{color:o.palette.text.primary,backgroundColor:L(o.palette.text.primary,.2)},"&.selected, &:focus":{color:"#fff",backgroundColor:i?o.palette.primary.main:L(o.palette.text.primary,.4)}},onClick:()=>{n||(s.current=0,a(e),t(e))},className:n?"selected":void 0,children:[100*e,"%"]},e)}))})}const Iu=({value:e,onUserInput:t,maxAmount:i,balance:r,mint:l,locked:a})=>{var s,d;const c=y(),u=Q((e=>{if(!i||!l)return;const n=i.multipliedBy(e).dp(l.decimals).toString();t(n)}),[l,i,t]),p=K((()=>r?_r({input:r,decimals:null==l?void 0:l.decimals}):"-"),[null==l?void 0:l.decimals,r]);return zt.jsxs(x,{sx:{pt:12,pb:20,px:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",borderRadius:12,backgroundColor:c.palette.background.input},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,color:c.palette.text.primary,typography:"h5"},children:[(null==l?void 0:l.address)&&zt.jsx(Ss,{address:null!==(s=null==l?void 0:l.address)&&void 0!==s?s:"",chainId:null==l?void 0:l.chainId,noShowChain:!0,width:24,height:24,marginRight:0}),zt.jsx(x,{sx:{display:"flex",alignItems:"center"},children:(null==l?void 0:l.address)?zt.jsx(x,{children:null!==(d=null==l?void 0:l.symbol)&&void 0!==d?d:"-"}):zt.jsx(n,{id:"sIPJGT",message:"SELECT TOKEN"})})]}),zt.jsxs(x,{component:M,sx:{color:c.palette.text.secondary,"&:hover":{color:c.palette.text.primary},cursor:"pointer",display:"flex",flexWrap:"wrap",justifyContent:"flex-end",typography:"body2"},onClick:()=>{u(1)},children:[zt.jsxs(x,{sx:{wordBreak:"keep-all"},children:[o._({id:"fsBGk0",message:"Balance"}),": "]}),zt.jsx(x,{sx:{wordBreak:"break-all",textAlign:"right",display:"flex",alignItems:"center"},children:p})]})]}),zt.jsx(kc,{sx:{mt:4},suffix:void 0,value:e,onChange:t,readOnly:a,withClear:!a}),a?null:zt.jsx(Su,{sx:{mt:20,mb:0},onClick:u,currentValue:e})]})};var Eu,Mu;function Tu(e,t){switch(t.type){case Eu.UpdateMint1:{const n=t.payload;return Object.assign(Object.assign({},e),{mint1:n})}case Eu.UpdateDefaultMint1:{const n=t.payload;return e.mint1?e:Object.assign(Object.assign({},e),{mint1:n})}case Eu.UpdateMint2:{const n=t.payload;return Object.assign(Object.assign({},e),{mint2:n})}case Eu.UpdateDefaultMint2:{const n=t.payload;return e.mint2?e:Object.assign(Object.assign({},e),{mint2:n})}case Eu.UpdateMint1AndClearMint2:{const n=t.payload;return Object.assign(Object.assign({},e),{mint1:n,mint2:void 0})}case Eu.UpdateFeeAmount:return Object.assign(Object.assign({},e),{feeAmount:t.payload});case Eu.UpdateSelectedMintIndex:return Object.assign(Object.assign({},e),{selectedMintIndex:t.payload});case Eu.setFullRange:return Object.assign(Object.assign({},e),{leftRangeTypedValue:!0,rightRangeTypedValue:!0});case Eu.typeStartPriceInput:return Object.assign(Object.assign({},e),{startPriceTypedValue:t.payload.typedValue});case Eu.typeLeftRangeInput:return Object.assign(Object.assign({},e),{leftRangeTypedValue:t.payload.typedValue});case Eu.typeRightRangeInput:return Object.assign(Object.assign({},e),{rightRangeTypedValue:t.payload.typedValue});case Eu.typeInput:{const{payload:{field:n,typedValue:o}}=t;return Object.assign(Object.assign({},e),{independentField:n,typedValue:o})}default:throw Error("Unknown action: "+t.type)}}!function(e){e[e.UpdateMint1=0]="UpdateMint1",e[e.UpdateMint2=1]="UpdateMint2",e[e.UpdateDefaultMint1=2]="UpdateDefaultMint1",e[e.UpdateDefaultMint2=3]="UpdateDefaultMint2",e[e.UpdateMint1AndClearMint2=4]="UpdateMint1AndClearMint2",e[e.UpdateFeeAmount=5]="UpdateFeeAmount",e[e.UpdateSelectedMintIndex=6]="UpdateSelectedMintIndex",e[e.setFullRange=7]="setFullRange",e[e.typeStartPriceInput=8]="typeStartPriceInput",e[e.typeLeftRangeInput=9]="typeLeftRangeInput",e[e.typeRightRangeInput=10]="typeRightRangeInput",e[e.typeInput=11]="typeInput"}(Eu||(Eu={})),function(e){e[e.LOW=1e3]="LOW"}(Mu||(Mu={}));const Lu={[Mu.LOW]:20},Ou={[Mu.LOW]:{label:"0.1%"}},Wu=({disabled:e,feeAmount:t,dispatch:n})=>{const i=y(),{isMobile:r}=Rc(),[l,a]=_(!1);return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",justifyContent:"space-between",px:20,py:12,borderWidth:1,borderStyle:"solid",borderColor:i.palette.border.main,borderRadius:12},e?{opacity:.3}:void 0),children:[zt.jsx(x,{sx:{typography:"h5",color:i.palette.text.primary},children:t?`${Ou[t].label} ${o._({id:"fxRyGG",message:"fee tier"})}`:o._({id:"EU3wU4",message:"Fee tier"})}),zt.jsx(b,{size:b.Size.small,variant:b.Variant.outlined,disabled:e,onClick:()=>a((e=>!e)),sx:{color:i.palette.text.primary,border:`solid 1px ${i.palette.text.primary}`},children:l?o._({id:"vLyv1R",message:"Hide"}):o._({id:"ePK91l",message:"Edit"})})]}),l&&zt.jsx(x,{sx:Object.assign({},r?{display:"grid",gap:8,gridTemplateColumns:"repeat(2, 1fr)"}:{display:"flex",alignItems:"center",gap:8}),children:[Mu.LOW].map((o=>{const r=t===o;return zt.jsxs(b,{size:b.Size.middle,variant:b.Variant.outlined,disabled:e,onClick:()=>{n({type:Eu.UpdateFeeAmount,payload:o})},sx:{flexBasis:"50%",flexShrink:1,flexGrow:1,justifyContent:"space-between",px:20,color:i.palette.text.primary,borderRadius:12,borderColor:r?i.palette.primary.main:i.palette.border.main,[i.breakpoints.up("tablet")]:{flexBasis:"25%"}},children:[Ou[o].label,r?zt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[zt.jsx("rect",{x:"0.5",y:"0.5",width:"17",height:"17",rx:"8.5",stroke:i.palette.primary.main}),zt.jsx("rect",{x:"4.5",y:"4.5",width:"9",height:"9",rx:"4.5",fill:i.palette.primary.main,stroke:i.palette.primary.main})]}):zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:zt.jsx("rect",{x:"0.5",y:"0.5",width:"17",height:"17",rx:"8.5",stroke:i.palette.text.secondary})})]},o)}))})]})};var Vu,Fu,Au;!function(e){e.DEPOSIT_1="DEPOSIT_1",e.DEPOSIT_2="DEPOSIT_2"}(Vu||(Vu={})),function(e){e.LOWER="LOWER",e.UPPER="UPPER"}(Fu||(Fu={})),function(e){e.TOKEN0="TOKEN0",e.TOKEN1="TOKEN1"}(Au||(Au={}));const Zu={xs:"4px",sm:"8px",md:"12px",lg:"24px",xl:"32px"},Pu=({children:e,sx:t})=>(y(),zt.jsx(x,{sx:Object.assign({display:"flex",flexDirection:"column",gap:20,px:20,py:20,borderRadius:12},t),children:e})),Bu=({children:e,sx:t})=>{const n=y();return zt.jsx(Pu,{sx:Object.assign(Object.assign({},t),{backgroundColor:n.palette.background.paperContrast}),children:e})},Nu=({children:e})=>{const t=y();return zt.jsxs(x,{sx:{p:8,borderRadius:8,backgroundColor:L(t.palette.warning.main,.1),display:"flex",alignItems:"center",gap:8},children:[zt.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.75 16.125L9 1.875L17.25 16.125H0.75ZM14.6475 14.625L8.99998 4.86749L3.35247 14.625H14.6475ZM9.75004 12.375H8.25003V13.875H9.75004V12.375ZM8.25003 7.875H9.75004V10.875H8.25003V7.875Z",fill:t.palette.warning.main})}),zt.jsx(x,{sx:{typography:"h6",color:t.palette.warning.main,textAlign:"left"},children:e})]})};function Uu({gap:e,flex:t,children:n,style:o}){return zt.jsx(x,{sx:Object.assign(Object.assign(Object.assign({display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:e&&Zu[e]||e},t&&{flex:t}),{width:"100%",alignItems:"center"}),o),children:n})}function Hu({gap:e,justify:t,grow:n,children:o,style:i}){return zt.jsx(x,{sx:Object.assign({display:"grid",gridAutoRows:"auto",gridRowGap:e&&Zu[e]||e,justifyItems:t,flexGrow:n&&1},i),children:o})}function Du({gap:e,children:t,sx:n}){return zt.jsx(x,{sx:Object.assign({width:"100%",display:"flex",padding:0,alignItems:"center",justifyContent:"flex-start",gap:e&&Zu[e]||e},n),children:t})}function Yu({children:e,style:t}){return zt.jsx(Du,{sx:Object.assign({justifyContent:"space-between"},t),children:e})}function zu({gap:e,justify:t,children:n,sx:o}){return zt.jsx(Du,{sx:Object.assign({position:"relative",width:"fit-content",margin:`-${e}`},o),children:n})}function Xu({children:e,disabled:t,sx:n}){return zt.jsx(Du,{sx:Object.assign({display:"flex",flexDirection:"column",alignItems:"stretch",gap:12,opacity:t?.2:1,pointerEvents:t?"none":"auto"},n),children:e})}const qu={neutral1:"#222222",neutral2:"#7D7D7D",accent1:"#FC72FF",critical:"FF5F52",white:"#FFFFFF",surface3:"#22222212",opacity:{hover:.6,click:.4,disabled:.5,enabled:1}},Gu=({series:e,xScale:t,yScale:n,xValue:o,yValue:i,fill:r})=>K((()=>{var l;return zt.jsx(x,{component:"path",opacity:.5,stroke:null!=r?r:qu.accent1,fill:null!=r?r:qu.accent1,d:null!==(l=vt().curve(bt).x((e=>t(o(e)))).y1((e=>n(i(e)))).y0(n(0))(e.filter((e=>{const n=t(o(e));return n>0&&n<=window.innerWidth}))))&&void 0!==l?l:void 0})}),[r,e,t,o,n,i]),_u=({axisGenerator:e})=>zt.jsx("g",{ref:t=>{t&&wt(t).call(e).call((e=>e.select(".domain").remove()))}}),Ju=({xScale:e,innerHeight:t,offset:n=0})=>K((()=>zt.jsx(x,{component:"g",transform:`translate(0, ${t+n})`,sx:{"& line":{display:"none"},"& text":{color:qu.neutral2,transform:"translateY(5px)"}},children:zt.jsx(_u,{axisGenerator:jt(e).ticks(6)})})),[t,n,e]),Qu=e=>["M 0 0",`v ${e}`,"m 1 0","V 0","M 0 1","h 12","q 2 0, 2 2","v 22","q 0 2 -2 2","h -12","z"].join(" "),Ku=()=>["m 5 7","v 14","M 0 0","m 9 7","v 14","z"].join(" "),$u=({color:e,size:t=10,margin:n=10})=>zt.jsx("polygon",{points:`0 0, ${t} ${t}, 0 ${t}`,transform:` translate(${t+n}, ${n}) rotate(45) `,fill:e,stroke:e,strokeWidth:"4",strokeLinejoin:"round"});const ep=({color:e,d:t})=>zt.jsx(x,{component:"path",cursor:"ew-resize",pointerEvents:"none",strokeWidth:3,stroke:e,fill:e,d:t}),tp=({d:e})=>zt.jsx(x,{component:"path",cursor:"ew-resize",pointerEvents:"none",stroke:qu.white,opacity:qu.opacity.hover,d:e}),np=({visible:e,transform:t,children:n})=>zt.jsx(x,{component:"g",opacity:e?"1":"0",transform:t,sx:{transition:"opacity 300ms"},children:n}),op=({y:e,x:t,height:n,width:o,rx:i})=>zt.jsx(x,{component:"rect",fill:qu.surface3,y:e,x:t,height:n,width:o,rx:i}),ip=({y:e,transform:t,dominantBaseline:n,children:o})=>zt.jsx(x,{component:"text",y:e,textAnchor:"middle",fontSize:"13px",fill:qu.neutral1,transform:t,dominantBaseline:n,children:o}),rp=(e,t,n)=>{const o=e.map((e=>n(e).toFixed(1))),i=t.map((e=>n(e).toFixed(1)));return o.every(((e,t)=>e===i[t]))},lp=({id:e,xScale:t,interactive:n,brushLabelValue:o,brushExtent:i,setBrushExtent:r,innerWidth:l,innerHeight:a,westHandleColor:s,eastHandleColor:d})=>{const c=te(null),u=te(null),[p,h]=_(i),[m,f]=_(!1),[g,x]=_(!1),y=function(e){const t=te();return J((()=>{t.current=e}),[e]),t.current}(i),v=Q((e=>{const{type:n,selection:o,mode:l}=e;if(!o)return void h(null);const a=o.map(t.invert);"end"!==n||rp(i,a,t)||r(a,l),h(a)}),[t,i,r]);J((()=>{h(i)}),[i]),J((()=>{c.current&&(u.current=Ct().extent([[Math.max(2,t(0)),0],[l-2,a]]).handleSize(30).filter((()=>n)).on("brush end",v),u.current(wt(c.current)),y&&rp(i,y,t)&&wt(c.current).transition().call(u.current.move,i.map(t)),wt(c.current).selectAll(".selection").attr("stroke","none").attr("fill-opacity","0.1").attr("fill",`url(#${e}-gradient-selection)`))}),[i,v,e,a,l,n,y,t]),J((()=>{c.current&&u.current&&u.current.move(wt(c.current),i.map(t))}),[i,t]),J((()=>{f(!0);const e=setTimeout((()=>f(!1)),1500);return()=>clearTimeout(e)}),[p]);const b=p&&t(p[0])>20,j=p&&t(p[1])>l-20,w=p&&(t(p[0])<0||t(p[1])<0),C=p&&(t(p[0])>l||t(p[1])>l),k=p&&t(p[0])>=0&&t(p[0])<=l,R=p&&t(p[1])>=0&&t(p[1])<=l;return K((()=>zt.jsxs(zt.Fragment,{children:[zt.jsxs("defs",{children:[zt.jsxs("linearGradient",{id:`${e}-gradient-selection`,x1:"0%",y1:"100%",x2:"100%",y2:"100%",children:[zt.jsx("stop",{stopColor:s}),zt.jsx("stop",{stopColor:d,offset:"1"})]}),zt.jsx("clipPath",{id:`${e}-brush-clip`,children:zt.jsx("rect",{x:"0",y:"0",width:l,height:a})})]}),zt.jsx("g",{ref:c,clipPath:`url(#${e}-brush-clip)`,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1)}),p&&zt.jsxs(zt.Fragment,{children:[k?zt.jsxs("g",{transform:`translate(${Math.max(0,t(p[0]))}, 0), scale(${b?"-1":"1"}, 1)`,children:[zt.jsxs("g",{children:[zt.jsx(ep,{color:s,d:Qu(a)}),zt.jsx(tp,{d:Ku()})]}),zt.jsxs(np,{transform:`translate(50,0), scale(${b?"1":"-1"}, 1)`,visible:m||g,children:[zt.jsx(op,{y:"0",x:"-30",height:"30",width:"60",rx:"8"}),zt.jsx(ip,{transform:"scale(-1, 1)",y:"15",dominantBaseline:"middle",children:o("w",p[0])})]})]}):null,R?zt.jsxs("g",{transform:`translate(${t(p[1])}, 0), scale(${j?"-1":"1"}, 1)`,children:[zt.jsxs("g",{children:[zt.jsx(ep,{color:d,d:Qu(a)}),zt.jsx(tp,{d:Ku()})]}),zt.jsxs(np,{transform:`translate(50,0), scale(${j?"-1":"1"}, 1)`,visible:m||g,children:[zt.jsx(op,{y:"0",x:"-30",height:"30",width:"60",rx:"8"}),zt.jsx(ip,{y:"15",dominantBaseline:"middle",children:o("e",p[1])})]})]}):null,w&&zt.jsx($u,{color:s}),C&&zt.jsx("g",{transform:`translate(${l}, 0) scale(-1, 1)`,children:zt.jsx($u,{color:d})})]})]})),[o,d,R,j,b,g,e,a,l,p,C,m,w,s,k,t])},ap=({value:e,xScale:t,innerHeight:n})=>K((()=>zt.jsx(x,{component:"line",x1:t(e),y1:"0",x2:t(e),y2:n,sx:{opacity:.5,strokeWidth:2,stroke:qu.neutral1,fill:"none"}})),[e,t,n]);function sp({svg:e,xScale:t,setZoom:n,width:o,height:i,resetBrush:r,showResetButton:l,zoomLevels:a}){const s=te(),[d,c,u,p]=K((()=>[()=>e&&s.current&&wt(e).transition().call(s.current.scaleBy,2),()=>e&&s.current&&wt(e).transition().call(s.current.scaleBy,.5),()=>e&&s.current&&wt(e).transition().call(s.current.scaleTo,.5),()=>e&&s.current&&wt(e).call(s.current.transform,kt.translate(0,0).scale(1)).transition().call(s.current.scaleTo,.5)]),[e]);return J((()=>{e&&(s.current=Rt().scaleExtent([a.min,a.max]).extent([[0,0],[o,i]]).on("zoom",(({transform:e})=>n(e))),wt(e).call(s.current))}),[i,o,n,e,t,s,a,a.max,a.min]),J((()=>{u()}),[u,a]),zt.jsxs(x,{sx:{display:"grid",gridTemplateColumns:`repeat(${l?3:2}, 1fr)`,gridGap:"6px",position:"absolute",top:"-32px",right:0},children:[l&&zt.jsx(b,{size:b.Size.small,sx:{borderRadius:16},onClick:()=>{r(),p()},disabled:!1,children:zt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[zt.jsx("polyline",{points:"1 4 1 10 7 10"}),zt.jsx("polyline",{points:"23 20 23 14 17 14"}),zt.jsx("path",{d:"M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15"})]})}),zt.jsx(b,{size:b.Size.small,sx:{borderRadius:16},onClick:d,disabled:!1,children:zt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[zt.jsx("circle",{cx:"11",cy:"11",r:"8"}),zt.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),zt.jsx("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),zt.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),zt.jsx(b,{size:b.Size.small,sx:{borderRadius:16},onClick:c,disabled:!1,children:zt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[zt.jsx("circle",{cx:"11",cy:"11",r:"8"}),zt.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),zt.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})})]})}const dp=e=>e.price0,cp=e=>e.activeLiquidity;function up({id:e="liquidityChartRangeInput",data:{series:t,current:n},ticksAtLimit:o,styles:i,dimensions:{width:r,height:l},margins:a,interactive:s=!0,brushDomain:d,brushLabels:c,onBrushDomainChange:u,zoomLevels:p}){const h=te(null),[m,f]=_(null),[g,y]=K((()=>[l-a.top-a.bottom,r-a.left-a.right]),[r,l,a]),{xScale:v,yScale:b}=K((()=>{const e={xScale:St().domain([n*p.initialMin,n*p.initialMax]).range([0,y]),yScale:St().domain([0,It(t,cp)]).range([g,0])};if(m){const t=m.rescaleX(e.xScale);e.xScale.domain(t.domain())}return e}),[n,p.initialMin,p.initialMax,y,t,g,m]);return J((()=>{f(null)}),[p]),J((()=>{d||u(v.domain(),void 0)}),[d,u,v]),zt.jsxs(zt.Fragment,{children:[zt.jsx(sp,{svg:h.current,xScale:v,setZoom:f,width:y,height:l,resetBrush:()=>{u([n*p.initialMin,n*p.initialMax],"reset")},showResetButton:Boolean(o[Fu.LOWER]||o[Fu.UPPER]),zoomLevels:p}),zt.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${r} ${l}`,style:{overflow:"visible"},children:[zt.jsxs("defs",{children:[zt.jsx("clipPath",{id:`${e}-chart-clip`,children:zt.jsx("rect",{x:"0",y:"0",width:y,height:l})}),d&&zt.jsx("mask",{id:`${e}-chart-area-mask`,children:zt.jsx("rect",{fill:"white",x:v(d[0]),y:"0",width:v(d[1])-v(d[0]),height:g})})]}),zt.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[zt.jsxs("g",{clipPath:`url(#${e}-chart-clip)`,children:[zt.jsx(Gu,{series:t,xScale:v,yScale:b,xValue:dp,yValue:cp}),d&&zt.jsx("g",{mask:`url(#${e}-chart-area-mask)`,children:zt.jsx(Gu,{series:t,xScale:v,yScale:b,xValue:dp,yValue:cp,fill:i.area.selection})}),zt.jsx(ap,{value:n,xScale:v,innerHeight:g}),zt.jsx(Ju,{xScale:v,innerHeight:g})]}),zt.jsx(x,{component:"rect",width:y,height:l,ref:h,sx:{fill:"transparent",cursor:"grab","&:active":{cursor:"grabbing"}}}),zt.jsx(lp,{id:e,xScale:v,interactive:s,brushLabelValue:c,brushExtent:null!=d?d:v.domain(),innerWidth:y,innerHeight:g,setBrushExtent:u,westHandleColor:i.brush.handle.west,eastHandleColor:i.brush.handle.east})]})]})]})}function pp({tick:e,decimalsA:t,decimalsB:n}){if(!t||!n||"number"!=typeof e)return;const o=ze.getSqrtPriceX64FromTick(e);return new ie(ze.sqrtPriceX64ToPrice(o,t,n).toString())}var hp;function mp(e){const t=Ws(),n=we({queryKey:["clmm","getPoolInfoFromRpc",e],enabled:null!=e&&null!=t,queryFn:()=>Lr(this,void 0,void 0,(function*(){if(!t||!e)return null;try{const{poolInfo:n,poolKeys:o,computePoolInfo:i,tickData:r}=yield t.clmm.getPoolInfoFromRpc(e);return{poolInfo:n,poolKeys:o,computePoolInfo:i,tickData:r}}catch(e){return console.error("getPoolInfoFromRpc error",e),null}}))});return n.isLoading?[hp.LOADING,null,e]:n.isError?[hp.INVALID,null,e]:n.data?[hp.EXISTS,n.data,e]:[hp.NOT_EXISTS,null,e]}function fp(e,t,n,o){return mp(K((()=>{if(!e||!t||!n)return null;const i=function({chainId:e,feeAmount:t,mint1Address:n,mint2Address:o}){const[i,r]=new gt(new Te(n).toBuffer()).gt(new gt(new Te(o).toBuffer()))?[o,n]:[n,o],[l,a]=[new Te(i),new Te(r)],s=ml[e];if(!s)throw new Error("Invalid config");const d=s.config.find((e=>e.tradeFeeRate===t));if(!d)throw new Error("Invalid fee");const{publicKey:c}=Xe(s.programId,new Te(d.id),l,a);return c}({mint1Address:e,mint2Address:t,feeAmount:n,chainId:o}).toBase58();return i}),[o,n,e,t]))}!function(e){e[e.LOADING=0]="LOADING",e[e.NOT_EXISTS=1]="NOT_EXISTS",e[e.EXISTS=2]="EXISTS",e[e.INVALID=3]="INVALID"}(hp||(hp={}));const gp=8,xp=(e,t)=>e&&t?Math.floor(e/Lu[t])*Lu[t]:void 0,yp=1e3;function vp(e,t){const[n,o]=_(0),[i,r]=_([]),{data:l,error:s,isLoading:d}=function(e,t=0,n){const o=Ql().getQuery(h.graphql.AllV3TicksDocument,{skip:t,first:yp,where:{chain:n?a[n]:m.SOON_TESTNET,poolAddress:null!=e?e:"",pairType:u}});return we(Object.assign(Object.assign({},o),{enabled:!!e}))}(e,n,t),c=null==l?void 0:l.amm_getTicksData.ticks;return J((()=>{(null==c?void 0:c.length)&&(r((e=>[...e,...c])),(null==c?void 0:c.length)===yp&&o((e=>e+yp)))}),[c]),{isLoading:d||(null==c?void 0:c.length)===yp,error:s,ticks:i}}function bp({mint1:e,mint2:t,feeAmount:n}){const{isLoading:o,error:i,data:r}=function(e,t,n,o){var i,r;const{chainId:l}=Ar(),[a,s,d]=fp(null==e?void 0:e.address,null==t?void 0:t.address,n,l),c=null===(i=null==s?void 0:s.computePoolInfo)||void 0===i?void 0:i.tickCurrent,u=K((()=>xp(c,n)),[c,n]),{isLoading:p,error:h,ticks:m}=vp(d,l);return K((()=>{var n,o,i,r,l,d;if(!e||!t||void 0===u||a!==hp.EXISTS||!m||0===m.length||p)return{isLoading:p||a===hp.LOADING,error:h,activeTick:u,data:void 0};const c=m.findIndex((e=>(null==e?void 0:e.tickIdx)&&e.tickIdx>u))-1;if(c<0)return console.log("usePoolTickData","usePoolActiveLiquidity","TickData pivot not found",{mint1:e.address,mint2:t.address,chainId:e.chainId}),{isLoading:p,error:h,activeTick:u,data:void 0};const f=pp({decimalsA:e.decimals,decimalsB:t.decimals,tick:u}),g={liquidityActive:null!==(o=null===(n=null==s?void 0:s.computePoolInfo)||void 0===n?void 0:n.liquidity.toNumber())&&void 0!==o?o:0,tick:u,liquidityNet:Number(null===(i=m[c])||void 0===i?void 0:i.tickIdx)===u?Number(null!==(l=null===(r=m[c])||void 0===r?void 0:r.liquidityNet)&&void 0!==l?l:0):0,price0:null!==(d=null==f?void 0:f.toFixed(gp))&&void 0!==d?d:"",sdkPrice:f},x=[].concat(g).concat([]);return{isLoading:p,error:h,data:x}}),[u,h,p,e,t,null===(r=null==s?void 0:s.computePoolInfo)||void 0===r?void 0:r.liquidity,a,m])}(e,t,n),l=Q((()=>{if(!(null==r?void 0:r.length))return;const e=[];for(let t=0;t<r.length;t++){const n=r[t],o={activeLiquidity:parseFloat(n.liquidityActive.toString()),price0:parseFloat(n.price0)};o.activeLiquidity>0&&e.push(o)}return e}),[r]);return K((()=>({isLoading:o,error:i,formattedData:o?void 0:l()})),[o,i,l])}const jp={[Mu.LOW]:{initialMin:.999,initialMax:1.001,min:1e-5,max:1.5}};function wp({message:e,icon:t}){return zt.jsxs(Uu,{style:{height:"100%",justifyContent:"center"},children:[t,e&&zt.jsx(x,{sx:{mt:20,p:10,typography:"caption",textAlign:"center"},children:e})]})}function Cp(){return zt.jsx(E,{})}function kp({mint1:e,mint2:t,feeAmount:o,ticksAtLimit:i,price:r,priceLower:l,priceUpper:a,onLeftRangeInput:s,onRightRangeInput:d,interactive:c}){const u=!0,{isLoading:p,error:h,formattedData:m}=bp({mint1:e,mint2:t,feeAmount:o}),f=Q(((e,t)=>{let n=Number(e[0]);const o=Number(e[1]);n<=0&&(n=1/10**6),fe((()=>{(!i[Fu.LOWER]||"handle"===t||"reset"===t)&&n>0&&s(n.toFixed(6)),(!i[Fu.UPPER]||"reset"===t)&&o>0&&o<1e35&&d(o.toFixed(6))}))}),[u,s,d,i]);c=c&&Boolean(null==m?void 0:m.length);const g=K((()=>{const e=l,t=a;return e&&t?[parseFloat(null==e?void 0:e.toString()),parseFloat(null==t?void 0:t.toString())]:void 0}),[l,a]),y=Q(((e,t)=>{if(!r)return"";if("w"===e&&i[Fu.LOWER])return"0";if("e"===e&&i[Fu.UPPER])return"∞";const n=(t<r?-1:1)*((Math.max(t,r)-Math.min(t,r))/r)*100;return r?`${_r({input:n,decimals:2})}%`:""}),[u,r,i]),v=!e||!t||void 0===m&&!p&&!h;return zt.jsx(Hu,{gap:"md",style:{minHeight:"200px"},children:v?zt.jsx(wp,{message:zt.jsx(n,{id:"OZUH85",message:"Your position will appear here."}),icon:zt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:qu.neutral1,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[zt.jsx("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),zt.jsx("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"})]})}):p?zt.jsx(Cp,{}):h?zt.jsx(wp,{message:zt.jsx(n,{id:"79D0qY",message:"Liquidity data not available."}),icon:zt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:qu.neutral2,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[zt.jsx("path",{d:"M22.61 16.95A5 5 0 0 0 18 10h-1.26a8 8 0 0 0-7.05-6M5 5a8 8 0 0 0 4 15h9a5 5 0 0 0 1.7-.3"}),zt.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]})}):m&&0!==m.length&&r?zt.jsx(x,{sx:{position:"relative",width:"100%",maxHeight:"200px",justifyContent:"center",alignContent:"center"},children:zt.jsx(up,{data:{series:m,current:r},dimensions:{width:560,height:200},margins:{top:10,right:2,bottom:20,left:0},styles:{area:{selection:qu.accent1},brush:{handle:{west:qu.critical,east:qu.accent1}}},interactive:c,brushLabels:y,brushDomain:g,onBrushDomainChange:f,zoomLevels:jp[null!=o?o:Mu.LOW],ticksAtLimit:i})}):zt.jsx(wp,{message:zt.jsx(n,{id:"rH6vg9",message:"There is no liquidity data."}),icon:zt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:qu.neutral2,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[zt.jsx("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),zt.jsx("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),zt.jsx("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]})})})}const Rp=({value:e,decrement:t,increment:n,decrementDisabled:o=!1,incrementDisabled:i=!1,locked:r,onUserInput:l,title:a,perPriceText:s})=>{const d=y(),[c,u]=_(""),[p,h]=_(!1),m=Q((()=>{h(!1),l(c)}),[c,l]),f=Q((()=>{h(!1),l(t())}),[t,l]),g=Q((()=>{h(!1),l(n())}),[n,l]);return J((()=>{c===e||p||setTimeout((()=>{u(e)}),0)}),[c,p,e]),zt.jsx(x,{onFocus:()=>{h(!0)},onBlur:m,sx:{width:"100%",py:12,px:20,borderRadius:16,backgroundColor:d.palette.background.input},children:zt.jsxs(x,{sx:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:[zt.jsx(x,{sx:{typography:"body2",fontWeight:600,color:d.palette.text.primary},children:a}),zt.jsx(x,{sx:{mt:4,typography:"h6",fontWeight:500,color:d.palette.text.secondary},children:s}),zt.jsx(kc,{sx:{mt:12},value:c,onChange:e=>{u(e)},readOnly:r})]}),zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:8},children:[!r&&zt.jsx(b,{size:b.Size.small,onClick:g,disabled:i,sx:{px:4,backgroundColor:d.palette.background.paper,"&[disabled]":{cursor:"default"}},children:zt.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zt.jsx("path",{d:"M14.25 9.75H9.75V14.25H8.25V9.75H3.75V8.25H8.25V3.75H9.75V8.25H14.25V9.75Z",fill:o?d.palette.text.disabled:d.palette.text.primary})})}),!r&&zt.jsx(b,{size:b.Size.small,onClick:f,disabled:o,sx:{px:4,backgroundColor:d.palette.background.paper,"&[disabled]":{cursor:"default"}},children:zt.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zt.jsx("rect",{x:"3.75",y:"8.25",width:"10.5",height:"1.5",fill:o?d.palette.text.disabled:d.palette.text.primary})})})]})]})})},Sp=({priceLower:e,priceUpper:t,onLeftRangeInput:o,onRightRangeInput:i,getDecrementLower:r,getIncrementLower:l,getDecrementUpper:a,getIncrementUpper:s,perPriceText:d,ticksAtLimit:c})=>{var u,p;const h=e,m=t;return zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:8},children:[zt.jsx(Rp,{value:c[Fu.LOWER]?"0":null!==(u=null==h?void 0:h.dp(8).toString())&&void 0!==u?u:"",onUserInput:o,decrement:r,increment:l,decrementDisabled:void 0===h||c[Fu.LOWER],incrementDisabled:void 0===h||c[Fu.LOWER],title:zt.jsx(n,{id:"uEoBVI",message:"Low price"}),perPriceText:d}),zt.jsx(Rp,{value:c[Fu.UPPER]?"∞":null!==(p=null==m?void 0:m.dp(8).toString())&&void 0!==p?p:"",onUserInput:i,decrement:a,increment:s,incrementDisabled:void 0===m||c[Fu.UPPER],decrementDisabled:void 0===m||c[Fu.UPPER],title:zt.jsx(n,{id:"kAC8rT",message:"High price"}),perPriceText:d})]})},Ip=({mintA:e,mintB:t,selectedMintIndex:n,handleRateToggle:o,sx:i})=>{const r=y();return zt.jsx(x,{component:M,onClick:o,sx:Object.assign({display:"flex",alignItems:"center",p:1,borderRadius:8,backgroundColor:r.palette.border.main},i),children:zt.jsx(x,{sx:{display:"flex",alignItems:"center",width:"100%",[r.breakpoints.up("tablet")]:{width:"auto"}},children:[e,t].map(((e,t)=>{const o=n===t;return zt.jsx(x,{sx:Object.assign({flexGrow:1,flexShrink:1,flexBasis:"50%",px:12,py:4,borderRadius:7,textAlign:"center",typography:"h6",whiteSpace:"nowrap"},o?{color:r.palette.text.primary,backgroundColor:r.palette.background.paper}:{color:r.palette.text.secondary,backgroundColor:"transparent"}),children:e.symbol},e.address)}))})})};function Ep(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 Mp(e){var t,n,o,i;const r=null==e?void 0:e.pair;if(r)return{address:r.id,chainId:r.chainId,baseToken:Ep(r.baseToken,r.chainId),quoteToken:Ep(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 Tp(e){const t=Mp(e);if(t)return Object.assign(Object.assign({},t),{liquidityPositions:null==e?void 0:e.liquidityPositions})}function Lp(e){switch(e){case"SVM_AMMV2":return"AMM V2";case"SVM_AMMV3":return"AMM V3";default:return"PMM"}}function Op({type:e,lpFeeRate:t,mtFeeRate:n}){var o,i;return"SVM_AMMV3"===e?null!==(i=null===(o=Ou[t])||void 0===o?void 0:o.label)&&void 0!==i?i:"-":`${_r({input:new ie(null!=t?t:0).plus(null!=n?n:0).div(1e4),decimals:4})}%`}new f,new h;const Wp=({sx:e})=>{const t=y();return zt.jsx(x,{sx:Object.assign({py:4,px:8,color:t.palette.primary.main,borderRadius:4,backgroundColor:L(t.palette.primary.main,.1),typography:"h6"},e),children:o._({id:"m8r/Yx",message:"AMM V3"})})};function Vp({removed:e,inRange:t}){const n=y(),i={py:4,px:8,color:n.palette.success.main,borderRadius:4,backgroundColor:L(n.palette.success.main,.1),typography:"h6"};return e?zt.jsx(W,{title:o._({id:"MZPP7t",message:"Your position has 0 liquidity, and is not earning fees."}),children:zt.jsx(x,{sx:Object.assign(Object.assign({},i),{color:n.palette.warning.main,backgroundColor:L(n.palette.warning.main,.1)}),children:o._({id:"D87pha",message:"Closed"})})}):t?zt.jsx(W,{title:o._({id:"aIvv/z",message:"The price of this pool is within your selected range. Your position is currently earning fees."}),children:zt.jsx(x,{sx:i,children:o._({id:"vOyUlD",message:"In range"})})}):zt.jsx(W,{title:o._({id:"IwiTcw",message:"The price of this pool is outside of your selected range. Your position is not currently earning fees."}),children:zt.jsx(x,{sx:Object.assign(Object.assign({},i),{color:n.palette.error.main,backgroundColor:L(n.palette.error.main,.1)}),children:o._({id:"i3Z+/Z",message:"Out of range"})})})}function Fp({price:e,atLimit:t,direction:n}){return t[n]?n===Fu.LOWER?"0":"∞":"string"==typeof e&&"∞"===e?"∞":_r({input:e})}const Ap=({position:e,title:t,ticksAtLimit:o})=>{const{poolInfo:{mintA:i,mintB:r,feeRate:l,price:a},liquidity:s,amountA:d,amountB:c,tickLowerPrice:u,tickUpperPrice:p}=e,h=y(),[m,f]=_(i),g=K((()=>m.address===i.address?r:i),[m.address,i,r]),v=Q((()=>{f(g)}),[g]);return zt.jsxs(Hu,{gap:"md",children:[zt.jsxs(Yu,{children:[t?zt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:h.palette.text.secondary},children:t}):zt.jsx("div",{}),zt.jsx(Ip,{mintA:i,mintB:r,selectedMintIndex:0,handleRateToggle:v})]}),zt.jsxs(Yu,{children:[zt.jsxs(Bu,{sx:{width:"48%",py:12,gap:12},children:[zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:4},children:[zt.jsx(x,{sx:{color:h.palette.text.primary,typography:"body2"},children:zt.jsx(n,{id:"EQs1sJ",message:"Min price"})}),zt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:zt.jsx(n,{id:"7Z4WfS",message:"{0} per {1}",values:{0:g.symbol,1:m.symbol}})})]}),zt.jsx(x,{sx:{color:h.palette.text.primary,typography:"caption"},children:Fp({price:u,atLimit:o,direction:Fu.LOWER})}),zt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:zt.jsx(n,{id:"WgTuci",message:"Your position will be 100% composed of {0} at this price",values:{0:null==m?void 0:m.symbol}})})]}),zt.jsxs(Bu,{sx:{width:"48%",py:12,gap:12},children:[zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:4},children:[zt.jsx(x,{sx:{color:h.palette.text.primary,typography:"body2"},children:zt.jsx(n,{id:"5etEUX",message:"Max price"})}),zt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:zt.jsx(n,{id:"7Z4WfS",message:"{0} per {1}",values:{0:g.symbol,1:m.symbol}})})]}),zt.jsx(x,{sx:{color:h.palette.text.primary,typography:"caption"},children:Fp({price:p,atLimit:o,direction:Fu.UPPER})}),zt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:zt.jsx(n,{id:"WgTuci",message:"Your position will be 100% composed of {0} at this price",values:{0:null==g?void 0:g.symbol}})})]})]}),zt.jsxs(Bu,{sx:{py:12,flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[zt.jsxs(Hu,{gap:"4px",justify:"flex-start",children:[zt.jsx(x,{sx:{color:h.palette.text.primary,typography:"body2"},children:zt.jsx(n,{id:"DWd30U",message:"Current price"})}),zt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:zt.jsx(n,{id:"7Z4WfS",message:"{0} per {1}",values:{0:g.symbol,1:m.symbol}})})]}),zt.jsx(x,{sx:{color:h.palette.text.primary,typography:"caption"},children:_r({input:a})})]})]})},Zp=({position:e,title:t,inRange:o,ticksAtLimit:i})=>{Ar();const{poolInfo:{mintA:r,mintB:l,feeRate:a},liquidity:s,amountA:d,amountB:c}=e,p=s.isZero();return zt.jsxs(Hu,{gap:"md",style:{marginTop:"0.5rem"},children:[zt.jsxs(Yu,{style:{gap:4},children:[zt.jsxs(zu,{children:[zt.jsx(uu,{tokens:[{address:r.address},{address:l.address}],mr:8}),zt.jsxs(x,{sx:{typography:"h5"},children:[r.symbol," / ",l.symbol]})]}),zt.jsx(Wp,{sx:{ml:"auto"}}),zt.jsx(Vp,{removed:p,inRange:o})]}),zt.jsxs(Bu,{children:[zt.jsxs(Hu,{gap:"md",children:[zt.jsxs(Yu,{children:[zt.jsxs(zu,{children:[zt.jsx(Ss,{address:r.address,chainId:r.chainId,noShowChain:!0,width:32,height:32,marginRight:0}),zt.jsx(x,{sx:{ml:8},children:r.symbol})]}),zt.jsx(zu,{children:zt.jsx(x,{sx:{mr:8},children:_r({input:d,decimals:r.decimals})})})]}),zt.jsxs(Yu,{children:[zt.jsxs(zu,{children:[zt.jsx(Ss,{address:l.address,chainId:l.chainId,noShowChain:!0,width:32,height:32,marginRight:0}),zt.jsx(x,{ml:"8px",children:l.symbol})]}),zt.jsx(zu,{children:zt.jsx(x,{mr:"8px",children:_r({input:c,decimals:l.decimals})})})]})]}),zt.jsxs(Yu,{children:[zt.jsx(x,{children:zt.jsx(n,{id:"EU3wU4",message:"Fee tier"})}),zt.jsx(x,{children:Op({type:u,lpFeeRate:a,mtFeeRate:0})})]})]}),zt.jsx(Ap,{position:e,title:t,ticksAtLimit:i})]})},Pp=({position:e,outOfRange:t,ticksAtLimit:n,on:i,onClose:r,onConfirm:l,loading:a})=>{const{isMobile:s}=Rc();return zt.jsx(tc,{open:i,onClose:r,modal:!0,title:o._({id:"E6MqGy",message:"Add liquidity"}),height:683,children:zt.jsxs(x,{sx:{flex:1,px:20,pb:24,display:"flex",flexDirection:"column",justifyContent:"space-between",width:s?void 0:420},children:[zt.jsx(x,{sx:{pt:0,px:0},children:e?zt.jsx(Zp,{position:e,inRange:!t,ticksAtLimit:n,title:o._({id:"3VUfrF",message:"Selected Range"})}):null}),zt.jsx(b,{size:b.Size.big,fullWidth:!0,isLoading:a,sx:{mt:20},onClick:l,children:o._({id:"m16xKo",message:"Add"})})]})})};var Bp;function Np(){return Np=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},Np.apply(null,arguments)}const Up=e=>q.createElement("svg",Np({width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),Bp||(Bp=q.createElement("g",{id:"ICON/18px/arrow/\\xE6\\x94\\xB6\\xE8\\xB5\\xB7/Dark"},q.createElement("path",{id:"\\xE4\\xB8\\x89\\xE8\\xA7\\x92\\xE5\\xBD\\xA2",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"}))));function Hp({token:e,oppositeTokenAddress:t,dispatch:n,tokenSelectOnChange:i}){const r=y(),{chainId:l}=Ar(),[a,s]=_(!1);return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{component:M,sx:{flexBasis:"100%",flexGrow:1,flexShrink:1,display:"flex",alignItems:"center",px:20,py:8,borderRadius:12,borderWidth:1,borderStyle:"solid",borderColor:e?r.palette.border.main:r.palette.primary.main,color:e?r.palette.text.primary:r.palette.primary.contrastText,backgroundColor:e?"transparent":r.palette.primary.main,"&:hover":{borderColor:e?r.palette.border.main:r.palette.primary.main},[r.breakpoints.up("tablet")]:{flexBasis:"50%"}},onClick:()=>{s(!0)},children:[e?zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8},children:[zt.jsx(Ss,{address:e.address,marginRight:0,width:24,height:24,chainId:e.chainId||l,noShowChain:!0,sx:{flexShrink:0}}),zt.jsx(x,{sx:{typography:"h5",fontWeight:600,lineHeight:"32px",flexShrink:0},children:e.symbol})]}):zt.jsx(x,{sx:{typography:"h5",fontWeight:600,lineHeight:"32px",flexShrink:0},children:o._({id:"0RrIzN",message:"Select token"})}),zt.jsx(x,{component:Up,sx:{flexShrink:0,ml:"auto",width:18,height:18}})]}),zt.jsx(Ac,{value:e,open:a,chainId:l,occupiedAddrs:[t],occupiedChainId:null==e?void 0:e.chainId,onClose:()=>{s(!1)},onTokenChange:(e,t)=>{if(!Array.isArray(e)){if(t)return n({type:Eu.UpdateMint1AndClearMint2,payload:e}),void s(!1);i(e),s(!1)}},modal:!0})]})}const Dp=({mint1:e,mint2:t,dispatch:n})=>{var o,i;const r=y();return zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap",[r.breakpoints.up("tablet")]:{flexWrap:"nowrap"}},children:[zt.jsx(Hp,{token:e,oppositeTokenAddress:null!==(o=null==t?void 0:t.address)&&void 0!==o?o:"",dispatch:n,tokenSelectOnChange:e=>{n({type:Eu.UpdateMint1,payload:e})}}),zt.jsx(Hp,{token:t,oppositeTokenAddress:null!==(i=null==e?void 0:e.address)&&void 0!==i?i:"",dispatch:n,tokenSelectOnChange:e=>{n({type:Eu.UpdateMint2,payload:e})}})]})};function Yp({mint:e,chainId:t,symbol:n}){const{fetchTokenInfo:o}=fl();return we({queryKey:["token","info",t,e],queryFn:()=>Lr(this,void 0,void 0,(function*(){return yield o({mint:e,chainId:t,symbol:n})})),enabled:!!e}).data}function zp(e,t){Et(Number.isInteger(e)&&Number.isInteger(t),"INTEGERS"),Et(t>0,"TICK_SPACING"),Et(e>=qe&&e<=Ge,"TICK_BOUND");const n=Math.round(e/t)*t;return n<qe?n+t:n>Ge?n-t:n}function Xp({price:e,feeAmount:t,mintDecimalsA:n,mintDecimalsB:o,baseIn:i}){const r=new yt(e.toString()),l=i?r:new yt(1).div(r),a=_e.getTickWithPriceAndTickspacing(l,Lu[t],n,o),s=ze.getSqrtPriceX64FromTick(a),d=ze.sqrtPriceX64ToPrice(s,n,o);return i?{tick:a,price:d}:{tick:a,price:new yt(1).div(d)}}const qp=[i.MAINNET,i.ARBITRUM_ONE,i.SEPOLIA,i.TAIKO],Gp={v3CoreFactoryAddress:"0x3d2A7Bac4E8439ABe86B58324695e921a5FC0987",nonfungiblePositionManagerAddress:"0x483E5c0f309577f79b0a19cE65E332DD388aD7A8"},_p=Object.assign({},Gp),Jp=Object.assign({},Gp),Qp={v3CoreFactoryAddress:"0x3d2A7Bac4E8439ABe86B58324695e921a5FC0987",nonfungiblePositionManagerAddress:"0x483E5c0f309577f79b0a19cE65E332DD388aD7A8"},Kp={[i.MAINNET]:_p,[i.ARBITRUM_ONE]:Jp,[i.SEPOLIA]:Qp,[i.TAIKO]:Qp};var $p,eh;Object.assign({},qp.reduce(((e,t)=>(e[t]=Kp[t].v3CoreFactoryAddress,e)),{})),Object.assign({},qp.reduce(((e,t)=>{const n=Kp[t].nonfungiblePositionManagerAddress;return n&&(e[t]=n),e}),{})),function(e){e[e.EXACT_INPUT=0]="EXACT_INPUT",e[e.EXACT_OUTPUT=1]="EXACT_OUTPUT"}($p||($p={})),function(e){e[e.ROUND_DOWN=0]="ROUND_DOWN",e[e.ROUND_HALF_UP=1]="ROUND_HALF_UP",e[e.ROUND_UP=2]="ROUND_UP"}(eh||(eh={})),Mt.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const th={[eh.ROUND_DOWN]:ie.ROUND_DOWN,[eh.ROUND_HALF_UP]:ie.ROUND_HALF_UP,[eh.ROUND_UP]:ie.ROUND_UP},nh={[eh.ROUND_DOWN]:ie.ROUND_DOWN,[eh.ROUND_HALF_UP]:ie.ROUND_HALF_UP,[eh.ROUND_UP]:ie.ROUND_UP};class oh{constructor(e,t=Mt.BigInt(1)){this.numerator=Mt.BigInt(e),this.denominator=Mt.BigInt(t)}static tryParseFraction(e){if(e instanceof Mt||"number"==typeof e||"string"==typeof e)return new oh(e);if("numerator"in e&&"denominator"in e)return e;throw new Error("Could not parse fraction")}get quotient(){return Mt.divide(this.numerator,this.denominator)}get remainder(){return new oh(Mt.remainder(this.numerator,this.denominator),this.denominator)}invert(){return new oh(this.denominator,this.numerator)}add(e){const t=oh.tryParseFraction(e);return Mt.equal(this.denominator,t.denominator)?new oh(Mt.add(this.numerator,t.numerator),this.denominator):new oh(Mt.add(Mt.multiply(this.numerator,t.denominator),Mt.multiply(t.numerator,this.denominator)),Mt.multiply(this.denominator,t.denominator))}subtract(e){const t=oh.tryParseFraction(e);return Mt.equal(this.denominator,t.denominator)?new oh(Mt.subtract(this.numerator,t.numerator),this.denominator):new oh(Mt.subtract(Mt.multiply(this.numerator,t.denominator),Mt.multiply(t.numerator,this.denominator)),Mt.multiply(this.denominator,t.denominator))}lessThan(e){const t=oh.tryParseFraction(e);return Mt.lessThan(Mt.multiply(this.numerator,t.denominator),Mt.multiply(t.numerator,this.denominator))}equalTo(e){const t=oh.tryParseFraction(e);return Mt.equal(Mt.multiply(this.numerator,t.denominator),Mt.multiply(t.numerator,this.denominator))}greaterThan(e){const t=oh.tryParseFraction(e);return Mt.greaterThan(Mt.multiply(this.numerator,t.denominator),Mt.multiply(t.numerator,this.denominator))}multiply(e){const t=oh.tryParseFraction(e);return new oh(Mt.multiply(this.numerator,t.numerator),Mt.multiply(this.denominator,t.denominator))}divide(e){const t=oh.tryParseFraction(e);return new oh(Mt.multiply(this.numerator,t.denominator),Mt.multiply(this.denominator,t.numerator))}toSignificant(e,t={decimalSeparator:".",groupSeparator:"",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:"",fractionGroupSize:0},n=eh.ROUND_HALF_UP){Et(Number.isInteger(e),`${e} is not an integer.`),Et(e>0,`${e} is not positive.`);const o=th[n],i=new ie(this.numerator.toString()).div(this.denominator.toString()).precision(e,o);return i.toFormat(i.decimalPlaces(),o,t)}toFixed(e,t={decimalSeparator:".",groupSeparator:"",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:"",fractionGroupSize:0},n=eh.ROUND_HALF_UP){Et(Number.isInteger(e),`${e} is not an integer.`),Et(e>=0,`${e} is negative.`);const o=nh[n];return new ie(this.numerator.toString()).decimalPlaces(e,o).div(this.denominator.toString()).toFormat(e,o,t)}get asFraction(){return new oh(this.numerator,this.denominator)}}const ih=new oh(Mt.BigInt(100));function rh(e){return new lh(e.numerator,e.denominator)}class lh extends oh{constructor(){super(...arguments),this.isPercent=!0}add(e){return rh(super.add(e))}subtract(e){return rh(super.subtract(e))}multiply(e){return rh(super.multiply(e))}divide(e){return rh(super.divide(e))}toSignificant(e=5,t,n){return super.multiply(ih).toSignificant(e,t,n)}toFixed(e=2,t,n){return super.multiply(ih).toFixed(e,t,n)}}function ah(e){const t=new ie(e);if(t.isFinite())return t}Mt.BigInt(Number.MAX_SAFE_INTEGER),Mt.BigInt(0),Mt.BigInt(1),Mt.BigInt(2),Mt.BigInt(0);new lh(Mt.BigInt(1),1e4),new lh(1,100),new lh(3,100),new lh(5,100),new lh(10,100),new lh(15,100);const sh=new lh(0);function dh({mint:e}){const{fetchTokenBalance:t}=fl();return we({queryKey:["token","balance",null==e?void 0:e.toString()],queryFn:()=>Lr(this,void 0,void 0,(function*(){if(!e)return;return(yield t(e.toString())).amount})),enabled:!!e}).data}function ch({state:e,existingPosition:t,slipperValue:n}){const{account:i,chainId:r}=Ar(),l=Ws(),{feeAmount:a,selectedMintIndex:s,independentField:d,typedValue:c,leftRangeTypedValue:u,rightRangeTypedValue:p,startPriceTypedValue:h}=e,{mint1:m,mint2:f}=e,[g,x]=K((()=>m&&f?new gt(new Te(m.address).toBuffer()).gt(new gt(new Te(f.address).toBuffer()))?[f,m]:[m,f]:[void 0,void 0]),[m,f]),y=d===Vu.DEPOSIT_1?Vu.DEPOSIT_2:Vu.DEPOSIT_1,[v,b]=K((()=>g&&x?0==s?[g,x]:[x,g]:[void 0,void 0]),[g,x,s]),j=dh({mint:null==v?void 0:v.address}),w=dh({mint:null==b?void 0:b.address}),C=K((()=>({[Vu.DEPOSIT_1]:j,[Vu.DEPOSIT_2]:w})),[j,w]),[k,R,S]=fp(null==m?void 0:m.address,null==f?void 0:f.address,a,r),I=k===hp.NOT_EXISTS,E=K((()=>{if(!x)return;if(I){const e=ah(h);if(!e)return;return 0===s?e:new ie(1).div(e).dp(x.decimals,ie.ROUND_UP)}if(!R||null==R.poolInfo.price)return;return new ie(R.poolInfo.price)}),[x,I,R,h,s]),M=K((()=>{if(!E||null==(null==g?void 0:g.decimals)||null==(null==x?void 0:x.decimals))return!0;const e=ze.priceToSqrtPriceX64(new yt(E.toString()),null==g?void 0:g.decimals,null==x?void 0:x.decimals);return!(e&&!e.gt(Je)&&!e.lt(Qe))}),[E,g,x]),T=K((()=>{if(g&&x){if(R){return Object.assign(Object.assign({},R.poolInfo),{mintA:Object.assign(Object.assign({},R.poolInfo.mintA),{chainId:g.chainId,symbol:g.symbol}),mintB:Object.assign(Object.assign({},R.poolInfo.mintB),{chainId:x.chainId,symbol:x.symbol}),tickCurrent:R.computePoolInfo.tickCurrent})}if(a&&E&&!M&&S){const e=ml[r];if(!e)throw new Error("Invalid config");const t=e.config.find((e=>e.tradeFeeRate===a));if(!t)throw new Error("Invalid fee");const{tick:n}=Xp({mintDecimalsA:g.decimals,mintDecimalsB:x.decimals,feeAmount:a,price:E,baseIn:0===s});if(null==n)throw new Error("Invalid tick");return{type:"Concentrated",config:t,programId:e.programId.toBase58(),id:S,mintA:Object.assign(Object.assign({},Ke({address:g.address,decimals:g.decimals,programId:Ee.toBase58(),extensions:{feeConfig:void 0}})),{chainId:g.chainId,symbol:g.symbol}),mintB:Object.assign(Object.assign({},Ke({address:x.address,decimals:x.decimals,programId:Ee.toBase58(),extensions:{feeConfig:void 0}})),{chainId:x.chainId,symbol:x.symbol}),rewardDefaultInfos:[],rewardDefaultPoolInfos:"Clmm",price:E.toNumber(),tickCurrent:n,mintAmountA:0,mintAmountB:0,feeRate:t.tradeFeeRate,openTime:"",tvl:0,day:{volume:0,volumeQuote:0,volumeFee:0,feeApr:0,rewardApr:[0],apr:0,priceMax:0,priceMin:0},week:{volume:0,volumeQuote:0,volumeFee:0,feeApr:0,rewardApr:[0],apr:0,priceMax:0,priceMin:0},month:{volume:0,volumeQuote:0,volumeFee:0,feeApr:0,rewardApr:[0],apr:0,priceMax:0,priceMin:0},pooltype:[],farmUpcomingCount:0,farmOngoingCount:0,farmFinishedCount:0,burnPercent:0}}}}),[r,a,M,g,x,R,S,E,s]),L=K((()=>({[Fu.LOWER]:a?zp(qe,Lu[a]):void 0,[Fu.UPPER]:a?zp(Ge,Lu[a]):void 0})),[a]),O=K((()=>{if(t&&t.tickLower&&"number"==typeof(null==t?void 0:t.tickLower)&&t.tickUpper&&"number"==typeof(null==t?void 0:t.tickUpper))return{[Fu.LOWER]:t.tickLower,[Fu.UPPER]:t.tickUpper};if(!g||!x||!a)return{[Fu.LOWER]:void 0,[Fu.UPPER]:void 0};const e="boolean"==typeof u?void 0:ah(u),n="boolean"==typeof p?void 0:ah(p),o=0===s;return{[Fu.LOWER]:"boolean"==typeof u?L[Fu.LOWER]:e?Xp({mintDecimalsA:g.decimals,mintDecimalsB:x.decimals,feeAmount:a,price:e,baseIn:o}).tick:void 0,[Fu.UPPER]:"boolean"==typeof p?L[Fu.UPPER]:n?Xp({mintDecimalsA:g.decimals,mintDecimalsB:x.decimals,feeAmount:a,price:n,baseIn:o}).tick:void 0}}),[t,a,u,g,x,p,s,L]),{[Fu.LOWER]:W,[Fu.UPPER]:V}=O,F=K((()=>({[Fu.LOWER]:a&&W===L.LOWER,[Fu.UPPER]:a&&V===L.UPPER})),[L,W,V,a]),A=Boolean("number"==typeof W&&"number"==typeof V&&W>=V),Z=K((()=>({[Fu.LOWER]:pp({tick:L.LOWER,decimalsA:null==g?void 0:g.decimals,decimalsB:null==x?void 0:x.decimals}),[Fu.UPPER]:pp({tick:L.UPPER,decimalsA:null==g?void 0:g.decimals,decimalsB:null==x?void 0:x.decimals})})),[null==g?void 0:g.decimals,null==x?void 0:x.decimals,L.LOWER,L.UPPER]),P=K((()=>({[Fu.LOWER]:pp({tick:O[Fu.LOWER],decimalsA:null==g?void 0:g.decimals,decimalsB:null==x?void 0:x.decimals}),[Fu.UPPER]:pp({tick:O[Fu.UPPER],decimalsA:null==g?void 0:g.decimals,decimalsB:null==x?void 0:x.decimals})})),[null==g?void 0:g.decimals,null==x?void 0:x.decimals,O]),{[Fu.LOWER]:B,[Fu.UPPER]:N}=P,U=Boolean(!A&&E&&B&&N&&(E.lt(B)||E.gt(N))),H=K((()=>ah(c)),[c]),[D,Y]=_(void 0);J((()=>{let e=!0;return function(){Lr(this,void 0,void 0,(function*(){try{if(!l||!T||null==W||null==V)return;const t=yield l.fetchEpochInfo(),o=yield $e.getLiquidityAmountOutFromAmountIn({poolInfo:T,slippage:n,inputA:!0,tickLower:Math.min(W,V),tickUpper:Math.max(W,V),amount:new gt(new yt(c||"0").mul(10**T.mintA.decimals).toFixed(0)),add:!0,amountHasFee:!0,epochInfo:t});if(e){if(!o.amountSlippageB.amount)return;Y(new ie(o.amountSlippageB.amount.toString()).div(new ie(10**T.mintB.decimals)).dp(T.mintB.decimals,ie.ROUND_UP))}}catch(e){console.error("error",e)}}))}(),()=>{e=!1}}),[T,l,n,W,V,c]);const z=K((()=>({[Vu.DEPOSIT_1]:d===Vu.DEPOSIT_1?H:D,[Vu.DEPOSIT_2]:d===Vu.DEPOSIT_1?D:H})),[D,H,d]),X=Boolean("number"==typeof V&&(null==T?void 0:T.tickCurrent)&&T.tickCurrent>=V),q=Boolean("number"==typeof W&&(null==T?void 0:T.tickCurrent)&&T.tickCurrent<=W),G=A||Boolean(X&&T&&m&&new Te(T.mintA.address).equals(new Te(m.address))||q&&T&&f&&new Te(T.mintA.address).equals(new Te(f.address))),Q=A||Boolean(X&&T&&f&&new Te(T.mintA.address).equals(new Te(f.address))||q&&T&&m&&new Te(T.mintB.address).equals(new Te(m.address))),{inputTax:$,outputTax:ee}=function(){const[{inputTax:e,outputTax:t},n]=_({inputTax:sh,outputTax:sh});return{inputTax:e,outputTax:t}}(),[te,ne]=_();let oe;J((()=>{let e=!0;return function(){Lr(this,void 0,void 0,(function*(){try{if(!l||!T||null==W||null==V)return;const t=yield l.fetchEpochInfo(),o=yield $e.getLiquidityAmountOutFromAmountIn({poolInfo:T,slippage:n,inputA:!0,tickLower:Math.min(W,V),tickUpper:Math.max(W,V),amount:new gt(new yt(c||"0").mul(10**T.mintA.decimals).toFixed(0)),add:!0,amountHasFee:!0,epochInfo:t});e&&ne({poolInfo:T,tickLower:W,tickUpper:V,tickLowerPrice:B,tickUpperPrice:N,liquidity:new ie(o.liquidity.toString()),amountA:new ie(o.amountSlippageA.amount.toString()).div(new ie(10**T.mintA.decimals)).dp(T.mintA.decimals,ie.ROUND_UP),amountB:new ie(o.amountSlippageB.amount.toString()).div(new ie(10**T.mintB.decimals)).dp(T.mintB.decimals,ie.ROUND_UP)})}catch(e){console.error("error",e)}}))}(),()=>{e=!1}}),[B,T,P,l,n,W,V,c,N]),i||(oe=o._({id:"r7ScnQ",message:"Connect to a wallet"})),k===hp.INVALID&&(oe=null!=oe?oe:o._({id:"R7D79P",message:"Invalid pair"})),M&&(oe=null!=oe?oe:o._({id:"HXBqgG",message:"Invalid price input"})),(z[Vu.DEPOSIT_1]||G)&&(z[Vu.DEPOSIT_2]||Q)||(oe=null!=oe?oe:o._({id:"iPMIoT",message:"Enter an amount"}));const{[Vu.DEPOSIT_1]:re,[Vu.DEPOSIT_2]:le}=z;re&&(null==j?void 0:j.lt(re))&&(oe=o._({id:"m6RmA/",message:"Insufficient {0} balance",values:{0:null==v?void 0:v.symbol}})),le&&(null==w?void 0:w.lt(le))&&(oe=o._({id:"m6RmA/",message:"Insufficient {0} balance",values:{0:null==b?void 0:b.symbol}}));const ae=$.greaterThan(0)||ee.greaterThan(0),se=k===hp.INVALID||ae;return{mintA:g,mintB:x,dependentField:y,mints:{[Vu.DEPOSIT_1]:v,[Vu.DEPOSIT_2]:b},poolInfo:T,poolState:k,depositBalances:C,parsedAmounts:z,ticks:O,price:E,pricesAtTicks:P,pricesAtLimit:Z,position:te,poolIsNoExisted:I,errorMessage:oe,invalidPool:se,invalidRange:A,outOfRange:U,depositADisabled:G,depositBDisabled:Q,ticksAtLimit:F,isTaxed:ae,poolKeys:I||null==R?void 0:R.poolKeys}}function uh({dispatch:e}){return{onField1Input:Q((t=>{e({type:Eu.typeInput,payload:{field:Vu.DEPOSIT_1,typedValue:t}})}),[e]),onField2Input:Q((t=>{e({type:Eu.typeInput,payload:{field:Vu.DEPOSIT_2,typedValue:t}})}),[e]),onLeftRangeInput:Q((t=>{e({type:Eu.typeLeftRangeInput,payload:{typedValue:t}})}),[e]),onRightRangeInput:Q((t=>{e({type:Eu.typeRightRangeInput,payload:{typedValue:t}})}),[e]),onStartPriceInput:Q((t=>{e({type:Eu.typeStartPriceInput,payload:{typedValue:t}})}),[e])}}new lh(1);const ph=new ie(.01);function hh(e){if(e)return e.gt(ph)?e.minus(ph):new ie(0)}const mh=Buffer.from("support_mint","utf8");function fh(e,t){return ot([mh,t.toBuffer()],e)}function gh({params:e,handleGoBack:t,handleGoToPoolList:n}){var i,r,l,a,s,d;const{chainId:c,account:p}=Ar(),h=Ws(),m=y(),f=Cl(),{isMobile:g}=Rc(),v=Yp({mint:null==e?void 0:e.mint1,chainId:c}),j=Yp({mint:null==e?void 0:e.mint2,chainId:c}),[w,C]=oe(Tu,{mint1:v,mint2:j,feeAmount:(null==e?void 0:e.fee)?Number(null==e?void 0:e.fee):void 0,selectedMintIndex:0,independentField:Vu.DEPOSIT_1,typedValue:"",startPriceTypedValue:"1",leftRangeTypedValue:"",rightRangeTypedValue:""});J((()=>{v&&C({type:Eu.UpdateDefaultMint1,payload:v})}),[v]),J((()=>{j&&C({type:Eu.UpdateDefaultMint2,payload:j})}),[j]);const{independentField:k,typedValue:R,startPriceTypedValue:S}=w,{slipper:I,setSlipper:E,slipperValue:T,resetSlipper:O}=wu({type:u}),{mintA:W,mintB:V,poolInfo:F,poolKeys:A,ticks:Z,dependentField:P,price:B,pricesAtTicks:N,pricesAtLimit:U,parsedAmounts:H,depositBalances:D,position:Y,poolIsNoExisted:z,mints:X,errorMessage:q,invalidPool:G,invalidRange:K,outOfRange:$,depositADisabled:ee,depositBDisabled:te,ticksAtLimit:ne}=ch({state:w,slipperValue:T,existingPosition:void 0}),{onField1Input:re,onField2Input:le,onLeftRangeInput:ae,onRightRangeInput:se,onStartPriceInput:de}=uh({dispatch:C}),ce=!q&&!K,[ue,pe]=_(!1),he={[k]:R,[P]:null!==(r=null===(i=H[P])||void 0===i?void 0:i.toString())&&void 0!==r?r:""},me=[Vu.DEPOSIT_1,Vu.DEPOSIT_2].reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:hh(D[t])})),{}),{[Fu.LOWER]:fe,[Fu.UPPER]:ge}=Z,{[Fu.LOWER]:xe,[Fu.UPPER]:ye}=N,{getDecrementLower:ve,getIncrementLower:be,getDecrementUpper:je,getIncrementUpper:we,getSetFullRange:ke}=function({tickLower:e,tickUpper:t,poolInfo:n,state:o,dispatch:i}){var r,l;const{feeAmount:a}=o,s=null===(r=null==n?void 0:n.mintA)||void 0===r?void 0:r.decimals,d=null===(l=null==n?void 0:n.mintB)||void 0===l?void 0:l.decimals;return{getDecrementLower:Q((()=>{if(!a)return"";const t="number"==typeof e?e:null==n?void 0:n.tickCurrent;if(!t)return"";const o=pp({decimalsA:s,decimalsB:d,tick:t-Lu[a]});return o?o.dp(5,ie.ROUND_UP).toString():""}),[s,d,a,null==n?void 0:n.tickCurrent,e]),getIncrementLower:Q((()=>{if(!a)return"";const t="number"==typeof e?e:null==n?void 0:n.tickCurrent;if(!t)return"";const o=pp({decimalsA:s,decimalsB:d,tick:t+Lu[a]});return o?o.dp(5,ie.ROUND_UP).toString():""}),[s,d,a,null==n?void 0:n.tickCurrent,e]),getDecrementUpper:Q((()=>{if(!a)return"";const e="number"==typeof t?t:null==n?void 0:n.tickCurrent;if(!e)return"";const o=pp({decimalsA:s,decimalsB:d,tick:e-Lu[a]});return o?o.dp(5,ie.ROUND_UP).toString():""}),[s,d,a,null==n?void 0:n.tickCurrent,t]),getIncrementUpper:Q((()=>{if(!a)return"";const e="number"==typeof t?t:null==n?void 0:n.tickCurrent;if(!e)return"";const o=pp({decimalsA:s,decimalsB:d,tick:e+Lu[a]});return o?o.dp(5,ie.ROUND_UP).toString():""}),[s,d,a,null==n?void 0:n.tickCurrent,t]),getSetFullRange:Q((()=>{i({type:Eu.setFullRange,payload:void 0})}),[i])}}({tickLower:fe,tickUpper:ge,poolInfo:F,state:w,dispatch:C}),Re=Q((()=>{ke()}),[ke,ae,se,U]),Se=Ce({mutationFn:()=>Lr(this,void 0,void 0,(function*(){if(!p||!c)return;if(!F)throw new Error("poolInfo is undefined");if(!B)throw new Error("price is undefined");if(!h)throw new Error("raydium is undefined");const e=ml[c];if(!e)throw new Error("Invalid config");const n=h.clmm;h.clmm.scope.checkOwner();const i=new it({connection:n.scope.connection,feePayer:n.scope.ownerPubKey,cluster:n.scope.cluster,owner:n.scope.owner,blockhashCommitment:n.scope.blockhashCommitment,loopMultiTxStatus:n.scope.loopMultiTxStatus,api:n.scope.api,signAllTransactions:n.scope.signAllTransactions}),r=z?yield function(e){return Lr(this,void 0,void 0,(function*(){var t;const{programId:n,mint1:o,mint2:i,ammConfig:r,initialPrice:l,computeBudgetConfig:a,forerunCreate:s,getObserveState:d,txVersion:c,txTipConfig:u,feePayer:p,clmm:h,txBuilder:m}=e,f=(null===(t=h.scope.owner)||void 0===t?void 0:t.publicKey)||Te.default,[g,x,y]=new gt(new Te(o.address).toBuffer()).gt(new gt(new Te(i.address).toBuffer()))?[i,o,new yt(1).div(l)]:[o,i,l],v=ze.priceToSqrtPriceX64(y,g.decimals,x.decimals),b=[],j=[];g.programId===Me.toBase58()&&j.push(fh(n,new Te(g.address)).publicKey),x.programId===Me.toBase58()&&j.push(fh(n,new Te(x.address)).publicKey),(yield h.scope.connection.getMultipleAccountsInfo(j)).forEach(((e,t)=>{e&&b.push(j[t])}));const w=yield et.createPoolInstructions({connection:h.scope.connection,programId:n,owner:f,mintA:g,mintB:x,ammConfigId:r.id,initialPriceX64:v,forerunCreate:!d&&s,extendMintAccount:b});return m.addInstruction(w),{address:Object.assign(Object.assign({},w.address),{observationId:w.address.observationId.toBase58(),exBitmapAccount:w.address.exBitmapAccount.toBase58(),programId:n.toString(),id:w.address.poolId.toString(),mintA:g,mintB:x,openTime:"0",vault:{A:w.address.mintAVault.toString(),B:w.address.mintBVault.toString()},rewardInfos:[],config:{id:r.id.toString(),index:r.index,protocolFeeRate:r.protocolFeeRate,tradeFeeRate:r.tradeFeeRate,tickSpacing:r.tickSpacing,fundFeeRate:r.fundFeeRate,description:r.description,defaultRange:0,defaultRangePoint:[]}}),mockPoolInfo:Object.assign({type:"Concentrated",rewardDefaultPoolInfos:"Clmm",id:w.address.poolId.toString(),mintA:g,mintB:x,feeRate:r.tradeFeeRate,openTime:"0",programId:n.toString(),price:y.toNumber(),config:{id:r.id.toString(),index:r.index,protocolFeeRate:r.protocolFeeRate,tradeFeeRate:r.tradeFeeRate,tickSpacing:r.tickSpacing,fundFeeRate:r.fundFeeRate,description:r.description,defaultRange:0,defaultRangePoint:[]},burnPercent:0},tt),forerunCreate:s}}))}({programId:e.programId,mint1:F.mintA,mint2:F.mintB,ammConfig:Object.assign(Object.assign({},F.config),{id:new Te(F.config.id),fundOwner:"",description:""}),initialPrice:new yt(B.toString()),clmm:n,txBuilder:i}):void 0;if(!Y)throw new Error("position is undefined");const l=yield function(e){return Lr(this,arguments,void 0,(function*({poolInfo:e,poolKeys:t,ownerInfo:n,tickLower:o,tickUpper:i,base:r,baseAmount:l,otherAmountMax:a,nft2022:s,associatedOnly:d=!0,checkCreateATAOwner:c=!1,withMetadata:u="create",getEphemeralSigners:p,computeBudgetConfig:h,txTipConfig:m,txVersion:f,feePayer:g,clmm:x,txBuilder:y}){!1===x.scope.availability.addConcentratedPosition&&x.logAndCreateError("add position feature disabled in your region");let v=null,b=null;const j=n.useSOLBalance&&e.mintA.address===nt.toString(),w=n.useSOLBalance&&e.mintB.address===nt.toString(),[C,k]="MintA"===r?[l,a]:[a,l],{account:R,instructionParams:S}=yield x.scope.account.getOrCreateTokenAccount({tokenProgram:e.mintA.programId,mint:new Te(e.mintA.address),owner:x.scope.ownerPubKey,createInfo:j||C.isZero()?{payer:x.scope.ownerPubKey,amount:C}:void 0,skipCloseAccount:!j,notUseTokenAccount:j,associatedOnly:!j&&d,checkCreateATAOwner:c});R&&(v=R),y.addInstruction(S||{});const{account:I,instructionParams:E}=yield x.scope.account.getOrCreateTokenAccount({tokenProgram:e.mintB.programId,mint:new Te(e.mintB.address),owner:x.scope.ownerPubKey,createInfo:w||k.isZero()?{payer:x.scope.ownerPubKey,amount:k}:void 0,skipCloseAccount:!w,notUseTokenAccount:w,associatedOnly:!w&&d,checkCreateATAOwner:c});I&&(b=I),y.addInstruction(E||{}),v&&b||x.logAndCreateError("cannot found target token accounts","tokenAccounts",{ownerTokenAccountA:null==v?void 0:v.toBase58(),ownerTokenAccountB:null==b?void 0:b.toBase58()});const M=t||(yield x.getClmmPoolKeys(e.id)),T=yield et.openPositionFromBaseInstructions({poolInfo:e,poolKeys:M,ownerInfo:Object.assign(Object.assign({},n),{feePayer:x.scope.ownerPubKey,wallet:x.scope.ownerPubKey,tokenAccountA:v,tokenAccountB:b}),tickLower:o,tickUpper:i,base:r,baseAmount:l,otherAmountMax:a,withMetadata:u,getEphemeralSigners:p,nft2022:s});return y.addInstruction(T),Object.assign({},T.address)}))}({poolInfo:F,poolKeys:null!=A?A:null==r?void 0:r.address,tickUpper:Math.max(Y.tickLower,Y.tickUpper),tickLower:Math.min(Y.tickLower,Y.tickUpper),base:"MintA",ownerInfo:{useSOLBalance:!0},baseAmount:new gt(new yt(R||"0").mul(10**F.mintA.decimals).toFixed(0)),otherAmountMax:new gt(Y.amountB.multipliedBy(new ie(10**F.mintB.decimals)).toFixed(0)),clmm:n,txBuilder:i});i.addCustomComputeBudget({units:6e5,microLamports:1e3});const{transaction:a,signers:s}=yield i.versionBuild({txVersion:Ue.LEGACY,extInfo:l});const d=yield f.executeCustom({brief:z?o._({id:"8OiU8L",message:"Pool Creation"}):o._({id:"OBdohg",message:"Add Liquidity"}),metadata:{[z?Pr.createAMMV3Pool:Pr.addAMMV3Pool]:!0},handler:e=>Lr(this,void 0,void 0,(function*(){const{txId:t}=yield function(){return Lr(this,void 0,void 0,(function*(){var e,t,o;if(!h)throw new Error("raydium is undefined");const i=yield rt(h.connection,h.blockhashCommitment);a.recentBlockhash=i,s.length&&a.sign(...s),lt([a]);const r=yield null===(t=(e=n.scope).signAllTransactions)||void 0===t?void 0:t.call(e,[a]);if(s.length)for(const e of r);const l=null===(o=null==r?void 0:r[0])||void 0===o?void 0:o.serialize();if(!l)throw new Error("rawTransaction is undefined");return{txId:yield n.scope.connection.sendRawTransaction(l,{skipPreflight:!0}),signedTx:null==r?void 0:r[0]}}))}();e.onSuccess(t)})),successBack:()=>{t()},submittedBack:()=>{t()}});return d})),onError:e=>{console.error(e)}}),Ie=W&&V?0===w.selectedMintIndex?`${null==V?void 0:V.symbol} per ${null==W?void 0:W.symbol}`:`${null==W?void 0:W.symbol} per ${null==V?void 0:V.symbol}`:"-";return zt.jsx(Xc,{children:zt.jsxs(x,{sx:{mx:"auto",borderRadius:g?0:16,backgroundColor:"background.paper",width:g?"100%":600,display:"flex",flexDirection:"column",alignItems:"stretch"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",px:20,py:24,borderTopLeftRadius:16,borderTopRightRadius:16,backgroundColor:m.palette.background.paper},children:[zt.jsx(x,{component:M,onClick:t,sx:{flexGrow:0,flexShrink:0,display:"flex",alignItems:"center",color:m.palette.text.primary,width:24,height:24},children:zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:zt.jsx("path",{d:"M20 11.5H7.83L13.42 5.91L12 4.5L4 12.5L12 20.5L13.41 19.09L7.83 13.5H20V11.5Z",fill:"currentColor"})})}),zt.jsx(x,{sx:{flexGrow:1,textAlign:"center",typography:"caption",color:m.palette.text.primary},children:o._({id:"E6MqGy",message:"Add liquidity"})}),zt.jsx(x,{sx:{flexGrow:0,flexShrink:0,width:24,height:24}})]}),zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:20,p:20},children:[zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:12},children:[zt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:o._({id:"nxRg31",message:"Select pair"})}),zt.jsx(Dp,{mint1:w.mint1,mint2:w.mint2,dispatch:C}),zt.jsx(Wu,{disabled:!w.mint1||!w.mint2,feeAmount:w.feeAmount,dispatch:C})]}),zt.jsxs(Xu,{disabled:!w.feeAmount||G,children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[zt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:o._({id:"5CZbyC",message:"Set price range"})}),W&&V&&zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8,width:"100%",[m.breakpoints.up("tablet")]:{ml:"auto",width:"auto"}},children:[zt.jsx(b,{size:b.Size.small,variant:b.Variant.outlined,onClick:Re,sx:Object.assign({py:4,px:12,height:26,typography:"h6",fontWeight:600},g?{flexGrow:0,flexShrink:1,flexBasis:"50%"}:void 0),children:o._({id:"5IHTSS",message:"Full range"})}),zt.jsx(Ip,{mintA:W,mintB:V,selectedMintIndex:w.selectedMintIndex,handleRateToggle:()=>{C({type:Eu.UpdateSelectedMintIndex,payload:0===w.selectedMintIndex?1:0})},sx:g?{flexGrow:0,flexShrink:1,flexBasis:"50%"}:void 0})]})]}),zt.jsx(Sp,{priceLower:xe,priceUpper:ye,getDecrementLower:ve,getIncrementLower:be,getDecrementUpper:je,getIncrementUpper:we,onLeftRangeInput:ae,onRightRangeInput:se,ticksAtLimit:ne,perPriceText:Ie}),$&&zt.jsx(Nu,{children:o._({id:"b+KjnH",message:"Your position will not earn fees or be used in trades until the market price moves into your range."})}),K&&zt.jsx(Nu,{children:o._({id:"Jh223O",message:"Invalid range selected. The min price must be lower than the max price."})})]}),z?zt.jsxs(Xu,{children:[zt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:o._({id:"zeSosD",message:"Starting price"})}),zt.jsx(x,{sx:{p:8,borderRadius:8,backgroundColor:L(m.palette.primary.main,.1),typography:"h6",color:m.palette.primary.main},children:o._({id:"X6T02b",message:"This pool must be initialized before you can add liquidity. To initialize, select a starting price for the pool. Then, enter your liquidity price range and deposit amount. Gas fees will be higher than usual due to the initialization transaction."})}),zt.jsx(x,{sx:{px:16,py:12,borderRadius:8,borderWidth:1,borderColor:m.palette.border.main,borderStyle:"solid"},children:zt.jsx(kc,{sx:{backgroundColor:"transparent"},value:S,onChange:de,suffix:zt.jsx(x,{sx:{typography:"h6",color:m.palette.text.secondary},children:Ie})})})]}):zt.jsxs(Xu,{disabled:!w.feeAmount||G,children:[zt.jsxs(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:[o._({id:"DWd30U",message:"Current price"}),zt.jsxs(x,{children:[_r({input:B,decimals:9})," ",o._({id:"b2jAb+",message:"per"})," ",null!==(a=null===(l=w.mint1)||void 0===l?void 0:l.symbol)&&void 0!==a?a:""]})]}),zt.jsx(kp,{mint1:w.mint1,mint2:w.mint2,feeAmount:w.feeAmount,ticksAtLimit:ne,price:B?B.toNumber():void 0,priceLower:xe,priceUpper:ye,onLeftRangeInput:ae,onRightRangeInput:se,interactive:!0})]}),zt.jsxs(Xu,{disabled:G||K||z&&!S,children:[zt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:o._({id:"MU9s7M",message:"Deposit amounts"})}),zt.jsxs(x,{children:[zt.jsx(Iu,{value:he[Vu.DEPOSIT_1],onUserInput:re,maxAmount:me[Vu.DEPOSIT_1],balance:D[Vu.DEPOSIT_1],mint:null!==(s=X[Vu.DEPOSIT_1])&&void 0!==s?s:null,locked:ee}),zt.jsx(Zc,{}),zt.jsx(Iu,{value:he[Vu.DEPOSIT_2],onUserInput:le,maxAmount:me[Vu.DEPOSIT_2],balance:D[Vu.DEPOSIT_2],mint:null!==(d=X[Vu.DEPOSIT_2])&&void 0!==d?d:null,locked:te})]}),zt.jsx(Cu,{value:I,onChange:E,disabled:!1,type:u})]})]}),zt.jsx(x,{sx:{display:"flex",alignItems:"center",px:20,py:16,borderBottomLeftRadius:16,borderBottomRightRadius:16,backgroundColor:m.palette.background.paper},children:zt.jsx(ku,{chainId:c,isValid:ce,errorMessage:q,setShowConfirm:pe})}),zt.jsx(Pp,{position:Y,outOfRange:$,ticksAtLimit:ne,on:ue,onClose:()=>{pe(!1)},onConfirm:Se.mutate,loading:Se.isPending})]})})}function xh({title:e,desc:t,linkTo:o,LeftImage:i,sx:r}){const l=y(),a="light"===l.palette.mode;return zt.jsxs(x,{sx:Object.assign({backgroundColor:l.palette.background.paper,borderRadius:16,padding:20},r),children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:[zt.jsx(x,{sx:{backgroundColor:L(l.palette.secondary.main,.3),color:a?"#EB8D27":l.palette.secondary.main,borderRadius:6,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center"},children:zt.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",children:zt.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"})})}),zt.jsx(x,{sx:{color:l.palette.text.primary,typography:"body1",fontWeight:600,ml:4},children:zt.jsx(n,{id:"cmUrtC",message:"SEE HOW IT WORKS"})})]}),zt.jsxs(x,{sx:{mt:20,borderTopWidth:1,pt:20,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(x,{component:i,sx:{width:64,height:64,flexShrink:0}}),zt.jsxs(x,{sx:{ml:16,color:l.palette.text.primary,typography:"body1",fontWeight:600},children:[e,zt.jsx(x,{sx:{mt:4,color:l.palette.text.secondary,typography:"body2",fontWeight:500},children:t})]})]}),zt.jsx(x,{component:"a",href:o,target:"_blank",rel:"noopener noreferrer",sx:{pl:16,flexShrink:0},children:zt.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:zt.jsx("path",{d:"M7.23375 3.75L6 4.98375L10.0075 9L6 13.0162L7.23375 14.25L12.4838 9L7.23375 3.75Z",fill:l.palette.text.primary})})})]})]})}const yh=[{value:0,label:"0%"},{value:25,label:"25%"},{value:50,label:"50%"},{value:75,label:"75%"},{value:100,label:"100%"}];function vh({disabled:e,value:t,onChange:n,sx:o}){return zt.jsxs(x,{sx:Object.assign({p:20,backgroundColor:"background.input",borderRadius:12},o),children:[zt.jsx(kc,{value:String(t),onChange:e=>n(+e),readOnly:!0,readonlyShowSuffix:!0,suffix:zt.jsx(x,{sx:{typography:"h2"},children:"%"}),sx:{mt:12,"& input":{pl:0,typography:"h1"}}}),zt.jsx(x,{sx:{mt:20},children:zt.jsx(N,{marks:yh,step:1,disabled:e,value:t,onChange:(e,t)=>n(t)})})]})}const bh=50;var jh;!function(e){e[e.quantity=1]="quantity",e[e.percentage=2]="percentage"}(jh||(jh={}));const wh=({chainId:e,disabled:t,isLoading:n,onConfirm:i})=>zt.jsx(hc,{includeButton:!0,fullWidth:!0,chainId:e,children:zt.jsx(b,{fullWidth:!0,size:b.Size.big,onClick:i,disabled:t,isLoading:n,children:o._({id:"h5pjuM",message:"Collect fees"})})}),Ch=({mint:e,pooledAmount:t})=>{var n;const o=y();return zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[zt.jsx(Ss,{address:null!==(n=null==e?void 0:e.address)&&void 0!==n?n:"",chainId:null==e?void 0:e.chainId,noShowChain:!0,width:18,height:18,marginRight:0}),zt.jsxs(x,{sx:{typography:"body1",color:o.palette.text.primary},children:[_r({input:t,decimals:null==e?void 0:e.decimals})," ",null==e?void 0:e.symbol]}),zt.jsx(M,{sx:{display:"flex",alignItems:"center",color:o.palette.text.secondary,"&:hover":{color:o.palette.text.primary}},onClick:()=>{e&&window.open(Wc(e.chainId,e.address,"address"))},children:zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:zt.jsx("path",{opacity:"0.5",fillRule:"evenodd",clipRule:"evenodd",d:"M3.33333 3.33333V12.6667H12.6667V8H14V12.6667C14 13.4 13.4 14 12.6667 14H3.33333C2.59333 14 2 13.4 2 12.6667V3.33333C2 2.6 2.59333 2 3.33333 2H8V3.33333H3.33333ZM9.33333 3.33333V2H14V6.66667H12.6667V4.27333L6.11333 10.8267L5.17333 9.88667L11.7267 3.33333H9.33333Z",fill:"currentColor"})})})]})},kh=({mintA:e,mintB:t,feeAmount:i,existingPosition:r,positionInfo:l,inRange:a,removed:s})=>{const d=y();return zt.jsxs(x,{sx:{border:"solid 1px",borderColor:"border.main",borderRadius:8},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:d.spacing(12,20),borderBottomStyle:"solid",borderBottomColor:"border.main",borderBottomWidth:1},children:[zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4},children:[zt.jsxs(x,{sx:{typography:"body2",color:d.palette.text.primary},children:[o._({id:"PVa3KL",message:"Position on"})," ",null==e?void 0:e.symbol,"/",null==t?void 0:t.symbol]}),zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[zt.jsx(Vp,{removed:s,inRange:a}),zt.jsx(x,{sx:{py:4,px:8,color:d.palette.primary.main,borderRadius:4,backgroundColor:L(d.palette.primary.main,.1),typography:"h6"},children:Op({type:u,lpFeeRate:i,mtFeeRate:0})})]})]}),zt.jsxs(M,{sx:{display:"flex",alignItems:"center",gap:0,typography:"body2",color:d.palette.text.secondary,"&:hover":{color:d.palette.text.primary}},onClick:()=>{(null==e?void 0:e.chainId)&&window.open(Wc(e.chainId,null==r?void 0:r.poolId.toBase58(),"address"))},children:[o._({id:"URmyfc",message:"Details"}),zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:zt.jsx("path",{d:"M7.5 5L6.4425 6.0575L9.8775 9.5L6.4425 12.9425L7.5 14L12 9.5L7.5 5Z",fill:"currentColor"})})]})]}),zt.jsxs(x,{sx:{p:d.spacing(12,20)},children:[zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"YHc3B+",message:"My Liquidity"})}),zt.jsxs(x,{sx:{mt:12},children:[zt.jsx(Ch,{mint:e,pooledAmount:null==l?void 0:l.pooledAmountA}),zt.jsx(Ch,{mint:t,pooledAmount:null==l?void 0:l.pooledAmountB})]})]})]})},Rh=({chainId:e,disabled:t,removed:n,isLoading:i,onConfirm:r})=>zt.jsx(hc,{includeButton:!0,fullWidth:!0,chainId:e,children:zt.jsx(b,{fullWidth:!0,size:b.Size.big,onClick:r,disabled:t,isLoading:i,children:n?o._({id:"D87pha",message:"Closed"}):o._({id:"t/YqKh",message:"Remove"})})});function Sh({position:e}){const t=Ws(),[,n]=mp(e?e.poolId.toBase58():null),{data:o}=we({queryKey:["clmm","getPositionInfo",e,null==n?void 0:n.poolInfo],enabled:!!e&&!!(null==n?void 0:n.poolInfo),queryFn:()=>Lr(this,void 0,void 0,(function*(){const o=null==n?void 0:n.poolInfo;if(!o||!t||!e)return null;const i=at.getTickPrice({poolInfo:o,tick:e.tickLower,baseIn:!0}),r=at.getTickPrice({poolInfo:o,tick:e.tickUpper,baseIn:!0}),l=yield t.connection.getEpochInfo(),{amountA:a,amountB:s}=st.getAmountsFromLiquidity({poolInfo:o,ownerPosition:e,liquidity:e.liquidity,slippage:0,add:!1,epochInfo:l}),[d,c]=[new ie(a.amount.toString()).div(10**o.mintA.decimals),new ie(s.amount.toString()).div(10**o.mintB.decimals)];return{pooledAmountA:d,pooledAmountB:c,priceLower:new ie(i.price.toString()),priceUpper:new ie(r.price.toString())}}))});return{pool:n,positionInfo:null!=o?o:null}}function Ih(e){var t;const n=Ws(),o=we({queryKey:["clmm","getOwnerPositionInfo",e,null==n?void 0:n.owner],enabled:null!=e&&null!=n&&null!=n.owner,queryFn:()=>Lr(this,void 0,void 0,(function*(){if(!n||!n.owner||!e)return null;const t=ml[e];if(!t)throw new Error("Invalid config");try{const e=yield n.clmm.getOwnerPositionInfo({programId:t.programId});return e.forEach((e=>{console.log("getOwnerPositionInfo p",e.poolId.toBase58(),e.nftMint.toBase58(),e.liquidity.toString(),e.tickLower,e.tickUpper)})),{allPosition:e}}catch(e){return console.error("getOwnerPositionInfo error",e),null}}))});return{loading:o.isLoading,positions:null===(t=o.data)||void 0===t?void 0:t.allPosition}}const Eh=({mint:e,rewardAmountOwed:t})=>{var n;const o=y();return zt.jsxs(x,{sx:{py:8,display:"flex",alignItems:"center",gap:6,typography:"h5",color:o.palette.text.primary},children:[zt.jsx(Ss,{address:null!==(n=null==e?void 0:e.address)&&void 0!==n?n:"",chainId:null==e?void 0:e.chainId,noShowChain:!0,width:24,height:24,marginRight:0}),zt.jsx(x,{children:null==e?void 0:e.symbol}),zt.jsx(x,{sx:{ml:"auto"},children:_r({input:null==t?void 0:t.toString(),decimals:null==e?void 0:e.decimals})})]})},Mh=({mint1Address:e,mint2Address:t,feeAmount:n,poolId:i,nftMint:r,onClose:l})=>{const{isMobile:a}=Rc(),s=y(),d=Cl(),c=je(),{account:p,chainId:h}=Ar(),m=Ws(),{position:f}=function({chainId:e,nftMint:t,poolId:n}){const o=Ih(e);return{position:K((()=>{if(o.positions)return o.positions.find((e=>e.nftMint.equals(new Te(t))&&e.poolId.equals(new Te(n))))}),[o,t,n]),loading:o.loading}}({chainId:h,nftMint:r,poolId:i}),{positionInfo:g,pool:v}=Sh({position:f}),[b,j]=_("stake"),[w,C]=_(!1),[k,R]=_(bh),S=Yp({mint:e,chainId:h}),I=Yp({mint:t,chainId:h}),[E,M]=oe(Tu,{mint1:S,mint2:I,feeAmount:n,selectedMintIndex:0,independentField:Vu.DEPOSIT_1,typedValue:"",startPriceTypedValue:"",leftRangeTypedValue:"",rightRangeTypedValue:""});J((()=>{S&&M({type:Eu.UpdateDefaultMint1,payload:S})}),[S]),J((()=>{I&&M({type:Eu.UpdateDefaultMint2,payload:I})}),[I]);const{independentField:T,typedValue:L}=E,{slipper:O,setSlipper:W,slipperValue:V}=wu({type:u}),{mintA:F,mintB:A,dependentField:Z,parsedAmounts:P,depositBalances:B,position:N,mints:Y,errorMessage:z,invalidRange:X,outOfRange:q,depositADisabled:G,depositBDisabled:Q,ticksAtLimit:$}=ch({state:E,existingPosition:f,slipperValue:V}),ee=(null==f?void 0:f.liquidity)&&f.liquidity.eq(new gt(0)),{onField1Input:te,onField2Input:ne}=uh({dispatch:M}),re=!z&&!X,le=K((()=>{var e,t;return{[T]:L,[Z]:null!==(t=null===(e=P[Z])||void 0===e?void 0:e.toString())&&void 0!==t?t:""}}),[Z,T,P,L]),ae=[Vu.DEPOSIT_1,Vu.DEPOSIT_2].reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:hh(B[t])})),{}),se=Ce({mutationFn:()=>Lr(void 0,void 0,void 0,(function*(){if(!p)throw new Error("account is undefined");if(!m)throw new Error("raydium is undefined");if(!f)throw new Error("existingPosition is undefined");if(!(null==v?void 0:v.poolInfo))throw new Error("poolInfo is undefined");if(!N)throw new Error("position is undefined");const{execute:e}=yield m.clmm.increasePositionFromLiquidity({poolInfo:v.poolInfo,poolKeys:v.poolKeys,ownerPosition:f,ownerInfo:{useSOLBalance:!0},liquidity:new gt(new yt(N.liquidity.toString()).mul(1-V).toFixed(0)),amountMaxA:new gt(new yt(L||"0").mul(10**v.poolInfo.mintA.decimals).toFixed(0)),amountMaxB:new gt(N.amountB.multipliedBy(1+V).multipliedBy(new ie(10**v.poolInfo.mintB.decimals)).toFixed(0)),checkCreateATAOwner:!0,txVersion:Ue.LEGACY});(yield d.executeCustom({brief:o._({id:"OBdohg",message:"Add Liquidity"}),metadata:{[Pr.addAMMV3Pool]:!0},handler:t=>Lr(void 0,void 0,void 0,(function*(){const{txId:n}=yield e({sendAndConfirm:!0});t.onSuccess(n)}))}))===Br.Success&&(C(!1),setTimeout((()=>{null==l||l()}),100)),c.invalidateQueries({queryKey:["clmm"],refetchType:"all"})})),onError:e=>{console.error(e)}}),de=Ce({mutationFn:()=>Lr(void 0,void 0,void 0,(function*(){if(!p)throw new Error("account is undefined");if(!m)throw new Error("raydium is undefined");if(!f)throw new Error("existingPosition is undefined");if(!(null==v?void 0:v.poolInfo))throw new Error("poolInfo is undefined");const e=new gt(new yt(f.liquidity.toString()).mul(1-k/100).toFixed(0)),{execute:t}=yield m.clmm.decreaseLiquidity({poolInfo:v.poolInfo,poolKeys:v.poolKeys,ownerPosition:f,ownerInfo:{useSOLBalance:!0,closePosition:!1},liquidity:e,amountMinA:new gt(0),amountMinB:new gt(0),txVersion:Ue.LEGACY});(yield d.executeCustom({brief:o._({id:"3XBvkd",message:"Remove Liquidity"}),metadata:{[Pr.removeAMMV3Pool]:!0},handler:e=>Lr(void 0,void 0,void 0,(function*(){const{txId:n}=yield t({sendAndConfirm:!0});e.onSuccess(n)}))}))===Br.Success&&setTimeout((()=>{null==l||l()}),100),c.invalidateQueries({queryKey:["clmm"],refetchType:"all"})})),onError:e=>{console.error("onRemoveMutation",e)}}),ce=Ce({mutationFn:()=>Lr(void 0,void 0,void 0,(function*(){if(!m)throw new Error("raydium is undefined");if(!(null==v?void 0:v.poolInfo))throw new Error("poolInfo is undefined");const{execute:e}=yield m.clmm.collectRewards({poolInfo:v.poolInfo,ownerInfo:{useSOLBalance:!0},rewardMints:v.poolInfo.rewardDefaultInfos.map((e=>new Te(e.mint.address))),associatedOnly:!0,checkCreateATAOwner:!0,computeBudgetConfig:void 0,txTipConfig:void 0});(yield d.executeCustom({brief:o._({id:"zXCpR0",message:"Claim Rewards"}),metadata:{[Pr.claimAMMV3Pool]:!0},handler:t=>Lr(void 0,void 0,void 0,(function*(){const{txId:n}=yield e();t.onSuccess(n)}))}))===Br.Success&&setTimeout((()=>{null==l||l()}),100),c.invalidateQueries({queryKey:["clmm"],refetchType:"all"})})),onError:e=>{console.error("onClaimMutation",e)}}),ue=K((()=>{var e,t;const i=[{key:"stake",value:o._({id:"JYKRJS",message:"Stake"})},{key:"unstake",value:o._({id:"OFjZGo",message:"Unstake"})},{key:"claim",value:o._({id:"hom7qf",message:"Claim"})}];return zt.jsxs(x,{sx:{borderRadius:16,backgroundColor:s.palette.background.paper},children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:20,py:24,borderTopLeftRadius:16,borderTopRightRadius:16,backgroundColor:s.palette.background.paper},children:[zt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.primary},children:o._({id:"E6MqGy",message:"Add liquidity"})}),l?zt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24,borderRadius:"50%",borderWidth:1,color:"text.secondary",cursor:"pointer"},children:zt.jsx(x,{component:Wt.Error,sx:{width:16,height:16},onClick:()=>{l()}})}):void 0]}),zt.jsx(x,{sx:{mx:20,mb:16},children:zt.jsx(kh,{existingPosition:f,positionInfo:g,inRange:!q,removed:ee,mintA:F,mintB:A,feeAmount:n})}),zt.jsxs(U,{value:b,onChange:(e,t)=>{j(t)},children:[zt.jsx(H,{tabs:i,variant:"inPaper",tabsListSx:{mx:20}}),zt.jsxs(D,{value:"stake",children:[N&&zt.jsx(x,{sx:{mt:16,mx:20},children:zt.jsx(Ap,{position:N,title:o._({id:"3VUfrF",message:"Selected Range"}),ticksAtLimit:$})}),zt.jsxs(x,{sx:{mt:16,mx:20,display:"flex",flexDirection:"column",alignItems:"stretch",gap:12},children:[zt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.secondary,textAlign:"left"},children:o._({id:"BRi+RY",message:"Add more liquidity"})}),zt.jsxs(x,{children:[zt.jsx(Iu,{value:le[Vu.DEPOSIT_1],onUserInput:te,maxAmount:ae[Vu.DEPOSIT_1],balance:B[Vu.DEPOSIT_1],mint:null!==(e=Y[Vu.DEPOSIT_1])&&void 0!==e?e:null,locked:G}),zt.jsx(Zc,{}),zt.jsx(Iu,{value:le[Vu.DEPOSIT_2],onUserInput:ne,maxAmount:ae[Vu.DEPOSIT_2],balance:B[Vu.DEPOSIT_2],mint:null!==(t=Y[Vu.DEPOSIT_2])&&void 0!==t?t:null,locked:Q})]}),zt.jsx(Cu,{value:O,onChange:W,disabled:!1,type:u})]}),zt.jsx(x,{sx:{display:"flex",alignItems:"center",px:20,py:16,borderBottomLeftRadius:16,borderBottomRightRadius:16,backgroundColor:s.palette.background.paper},children:zt.jsx(ku,{chainId:h,isValid:re,errorMessage:z,setShowConfirm:C})}),zt.jsx(Pp,{position:N,outOfRange:q,ticksAtLimit:$,on:w,onClose:()=>{C(!1)},onConfirm:se.mutate,loading:se.isPending})]}),zt.jsxs(D,{value:"unstake",children:[zt.jsxs(x,{sx:{mt:16,mx:20,display:"flex",flexDirection:"column",alignItems:"stretch",gap:12},children:[zt.jsx(vh,{disabled:!1,value:k,onChange:e=>R(e)}),zt.jsx(Cu,{value:O,onChange:W,disabled:!1,type:u})]}),zt.jsxs(x,{sx:{mt:16,mx:20,display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[zt.jsx(x,{sx:{typography:"body2",color:s.palette.text.secondary},children:"Receive"}),zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4},children:[zt.jsxs(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.primary},children:[zt.jsx(x,{component:"span",sx:{color:s.palette.primary.main},children:(null==g?void 0:g.pooledAmountA)?_r({input:g.pooledAmountA.multipliedBy(k/100),decimals:null==F?void 0:F.decimals}):"-"})," ",null==F?void 0:F.symbol]}),zt.jsxs(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.primary},children:[zt.jsx(x,{component:"span",sx:{color:s.palette.primary.main},children:(null==g?void 0:g.pooledAmountB)?_r({input:g.pooledAmountB.multipliedBy(k/100),decimals:null==A?void 0:A.decimals}):"-"})," ",null==A?void 0:A.symbol]})]})]}),zt.jsx(x,{sx:{mt:20,display:"flex",alignItems:"center",px:20,py:16,borderBottomLeftRadius:16,borderBottomRightRadius:16,backgroundColor:s.palette.background.paper},children:zt.jsx(Rh,{chainId:h,disabled:ee||0===k,removed:ee,onConfirm:de.mutate,isLoading:de.isPending})})]}),zt.jsxs(D,{value:"claim",children:[zt.jsxs(x,{sx:{mx:20,mt:16,borderRadius:12,borderWidth:1,borderStyle:"solid",borderColor:s.palette.border.main},children:[zt.jsx(x,{sx:{py:12,px:20,typography:"body1",color:s.palette.text.primary,borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:s.palette.border.main},children:o._({id:"tu/fxg",message:"Claim fees"})}),zt.jsx(x,{sx:{p:20},children:null==v?void 0:v.poolInfo.rewardDefaultInfos.map(((e,t)=>{const n=null==f?void 0:f.rewardInfos[t].rewardAmountOwed;return zt.jsx(Eh,{mint:e.mint,rewardAmountOwed:n},e.mint.address)}))})]}),zt.jsx(x,{sx:{mx:20,mt:16,typography:"h6",color:s.palette.text.secondary},children:o._({id:"Joa5Dk",message:"*Collecting fees will withdraw currently available fees for you."})}),zt.jsx(x,{sx:{mt:20,display:"flex",alignItems:"center",px:20,py:16,borderBottomLeftRadius:16,borderBottomRightRadius:16,backgroundColor:s.palette.background.paper},children:zt.jsx(wh,{chainId:h,disabled:ce.isPending||!(null==v?void 0:v.poolInfo)||0===(null==v?void 0:v.poolInfo.rewardDefaultInfos.length),onConfirm:ce.mutate,isLoading:ce.isPending})})]})]})]})}),[h,G,Q,B,z,f,n,le,re,ae,F,A,Y,se.isPending,se.mutate,ce.isPending,ce.mutate,l,te,ne,de.isPending,de.mutate,b,q,null==v?void 0:v.poolInfo,N,g,ee,W,w,k,O,s.palette.background.paper,s.palette.border.main,s.palette.primary.main,s.palette.text.primary,s.palette.text.secondary,$]);return a?zt.jsx(tc,{open:null!=F&&null!=A,onClose:l,scope:!a,modal:void 0,id:"pool-operate",children:ue}):ue};const Th=({outOfRange:e})=>{const t=y();return zt.jsx(W,{title:e?o._({id:"i3Z+/Z",message:"Out of range"}):o._({id:"vOyUlD",message:"In range"}),children:zt.jsx(x,{sx:{display:"flex",alignItems:"center"},children:e?zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:zt.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})}):zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",children:zt.jsx("circle",{cx:"4",cy:"4",r:"4",fill:t.palette.success.main})})})})},Lh=({position:e,mintA:t,mintB:n,feeAmount:i,onClickManage:r})=>{const l=y(),{positionInfo:a,pool:s}=Sh({position:e}),d=function(e,t,n){return K((()=>({[Fu.LOWER]:e&&t?t===zp(qe,Lu[e]):void 0,[Fu.UPPER]:e&&n?n===zp(Ge,Lu[e]):void 0})),[e,t,n])}(i,e.tickLower,e.tickUpper),c=null==a?void 0:a.priceLower,u=null==a?void 0:a.priceUpper,p=!!(null==s?void 0:s.computePoolInfo)&&(s.computePoolInfo.tickCurrent<e.tickLower||s.computePoolInfo.tickCurrent>=e.tickUpper),h=null==s?void 0:s.poolInfo.price;return zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:24,px:20,py:20,pb:12,borderRadius:12,backgroundColor:l.palette.background.paperContrast},children:[zt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,typography:"h5",color:l.palette.text.primary},children:[zt.jsx(x,{children:zt.jsxs(zt.Fragment,{children:[zt.jsxs("span",{children:[Fp({price:c,atLimit:d,direction:Fu.LOWER})," "]}),null==n?void 0:n.symbol]})}),zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:zt.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"})}),zt.jsx(x,{children:zt.jsxs(zt.Fragment,{children:[zt.jsxs("span",{children:[Fp({price:u,atLimit:d,direction:Fu.UPPER})," "]}),null==n?void 0:n.symbol]})})]}),zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[zt.jsx(Th,{outOfRange:p}),zt.jsxs(x,{sx:{typography:"h6",color:l.palette.text.secondary},children:["Current price: ",_r({input:h})," ",null==n?void 0:n.symbol," per ",null==t?void 0:t.symbol]})]})]}),zt.jsx(b,{variant:b.Variant.outlined,size:b.Size.small,fullWidth:!0,onClick:r,children:o._({id:"wckWOP",message:"Manage"})})]})};const Oh=({mint1Address:e,mint2Address:t,feeAmount:n,poolId:i,onClose:r,handleGoToAddLiquidityV3:l})=>{const{isMobile:a}=Rc(),s=y(),{chainId:d,account:c}=Ar(),{positions:u,loading:p}=Ih(d),{mintA:h,mintB:m}=function({mint1Address:e,mint2Address:t}){const{chainId:n}=Ar(),o=Yp({mint:e,chainId:n}),i=Yp({mint:t,chainId:n}),[r,l]=K((()=>o&&i?new gt(new Te(o.address).toBuffer()).gt(new gt(new Te(i.address).toBuffer()))?[i,o]:[o,i]:[void 0,void 0]),[o,i]);return{mintA:r,mintB:l}}({mint1Address:e,mint2Address:t}),f=K((()=>{if(void 0!==u)return u.filter((e=>e.poolId.equals(new Te(i))))}),[u,i]),[g,v]=_(null),j=K((()=>{var e;return zt.jsxs(x,{sx:{p:20,display:"flex",flexDirection:"column",gap:16,borderRadius:16,backgroundColor:s.palette.background.paper,minHeight:480},children:[zt.jsxs(x,{sx:{pb:16,borderBottomColor:s.palette.border.main,borderBottomStyle:"solid",borderBottomWidth:1,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[zt.jsxs(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.primary},children:[o._({id:"Gs02OK",message:"My Positions"})," (",null!==(e=null==f?void 0:f.length)&&void 0!==e?e:0,")"]}),r?zt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24,borderRadius:"50%",borderWidth:1,color:"text.secondary",cursor:"pointer"},children:zt.jsx(x,{component:Wt.Error,sx:{width:16,height:16},onClick:()=>{r()}})}):void 0]}),p||!f?zt.jsx(zt.Fragment,{children:zt.jsx(x,{sx:{mt:100,display:"flex",justifyContent:"center"},children:zt.jsx(Us,{})})}):f.length>0?zt.jsxs(zt.Fragment,{children:[null==f?void 0:f.map((e=>zt.jsx(Lh,{position:e,mintA:h,mintB:m,feeAmount:n,onClickManage:()=>{v(e)}},e.nftMint.toBase58()))),zt.jsxs(b,{size:b.Size.big,variant:b.Variant.second,onClick:()=>{l({mint1:null==h?void 0:h.address,mint2:null==m?void 0:m.address,fee:String(n)})},sx:{gap:8},children:[zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:zt.jsx("path",{d:"M19 13H13V19H11V13H5V11H11V5H13V11H19V13Z",fill:"currentColor"})}),o._({id:"FQ4aT9",message:"Add Position"})]})]}):zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{sx:{mt:100,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:[zt.jsx(Y,{sx:{width:60,height:60,borderRadius:24/105*60}}),zt.jsx(x,{sx:{typography:"body1",color:s.palette.text.secondary},children:o._({id:"/6L4mj",message:"Your position is empty"})})]}),zt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:zt.jsx(hc,{size:b.Size.small,includeButton:!0,children:zt.jsx(b,{size:b.Size.small,onClick:()=>{l({mint1:null==h?void 0:h.address,mint2:null==m?void 0:m.address,fee:String(n)})},children:o._({id:"FQ4aT9",message:"Add Position"})})})})]})]})}),[f,n,l,p,h,m,r,s.palette.background.paper,s.palette.border.main,s.palette.text.primary,s.palette.text.secondary]);return null!==g?zt.jsx(Mh,{mint1Address:e,mint2Address:t,feeAmount:n,poolId:g.poolId.toBase58(),nftMint:g.nftMint.toBase58(),onClose:()=>{v(null)}}):a?zt.jsx(tc,{open:null!=h&&null!=m,onClose:r,scope:!a,modal:void 0,id:"pool-operate",children:j}):j};var Wh,Vh;function Fh({message:e,onClose:t}){return zt.jsx(tc,{open:!!e,onClose:t,id:"error-message",children:zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{sx:{flex:1,textAlign:"center"},children:[zt.jsx(x,{component:Wt.ErrorWarn,sx:{mt:60,width:64,height:64,color:"error.main"}}),e?zt.jsxs(x,{sx:{textAlign:"center",mt:60},children:[zt.jsx(x,{children:zt.jsx(n,{id:"kf83Ld",message:"Something went wrong."})}),zt.jsx(x,{sx:{color:"text.secondary",mt:12,typography:"body2",wordBreak:"break-all"},children:e})]}):""]}),zt.jsx(x,{sx:{px:16,py:20},children:zt.jsx(b,{onClick:t,fullWidth:!0,children:zt.jsx(n,{id:"1QfxQT",message:"Dismiss"})})})]})})}function Ah({status:e,children:t,buttonProps:o}){return!e.needShowTokenStatusButton&&t?zt.jsx(zt.Fragment,{children:t}):e.insufficientBalance?zt.jsx(b,{fullWidth:!0,disabled:!0,...o,children:zt.jsx(n,{id:"znqB4T",message:"Insufficient balance"})}):zt.jsx(b,{fullWidth:!0,isLoading:e.isApproving,onClick:e.submitApprove,disabled:e.insufficientBalance,...o,children:e.isApproving?zt.jsx(n,{id:"j2Uisd",message:"Approving"}):e.approveTitle})}function Zh({chainId:e,baseTokenStatus:t,quoteTokenStatus:o,children:i}){const{runningRequests:r}=kl(),{account:l,chainId:a}=Ar();if(!l||e!==a)return zt.jsx(hc,{chainId:e,fullWidth:!0});const s=r.some((e=>{var t,n;return(null===(t=e.metadata)||void 0===t?void 0:t[Pr.addLiquidity])||(null===(n=e.metadata)||void 0===n?void 0:n[Pr.removeLiquidity])})),d=[];t.needShowTokenStatusButton&&d.push(zt.jsx(Ah,{status:t})),o.needShowTokenStatusButton&&!t.isApproving&&d.push(zt.jsx(Ah,{status:o}));const c=d.length;return 2===c?zt.jsx(x,{sx:{display:"flex","& > button":{flex:1,"&:last-child":{ml:8}}},children:d.map((e=>e))}):1===c?d[0]:s?zt.jsx(b,{fullWidth:!0,disabled:!0,isLoading:!0,children:zt.jsx(n,{id:"UbRKMZ",message:"Pending"})}):zt.jsx(zt.Fragment,{children:i})}function Ph({pool:e,maxBaseAmount:t,maxQuoteAmount:n,isRemove:o}){const[i,r]=G.useState(""),[l,a]=G.useState(""),[s,d]=G.useState(vr),c=s===vr?new ie(_c).div(100).toNumber():s,u=()=>{r(""),a("")},p=$c({pool:(null==e?void 0:e.baseToken)&&e.quoteToken?{baseToken:e.baseToken,quoteToken:e.quoteToken,address:e.address}:void 0,baseAmount:i,quoteAmount:l,slippage:c}),h=p.isFront?p.price:p.invertedPrice,m=h||new ie(1),f=G.useRef(m);if(!e||m.isNaN())return{baseAmount:i,quoteAmount:l,handleChangeBaseAmount:()=>{},handleChangeQuoteAmount:()=>{},reset:u,uniV2Pair:p,slippage:s,slippageNumber:c,setSlippage:d};const g=e.baseToken.decimals,x=e.quoteToken.decimals,y=e=>{if(e){let i=m.multipliedBy(e).dp(x).toString();n&&o&&(n.lte(i)||(null==t?void 0:t.lte(0)))&&(i=n.toString()),a(i)}else a(e)};f.current&&m.isEqualTo(f.current)||(f.current=m,y(i));return{baseAmount:i,quoteAmount:l,handleChangeBaseAmount:e=>{let t=Kr(e,g);null===t&&(t=i),r(t),y(t)},handleChangeQuoteAmount:e=>{let i=Kr(e,x);null===i&&(i=l),a(i),(e=>{if(e){let i=new ie(e).div(m).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:m,amountCheckedDisabled:!i||!l,uniV2Pair:p,slippage:s,slippageNumber:c,setSlippage:d}}function Bh({submittedBack:e,pool:t}){var n,i,r;const l="SVM_AMMV2"===(null==t?void 0:t.type),[a,s]=G.useState(!1),{baseAmount:d,quoteAmount:c,midPrice:u,amountCheckedDisabled:p,uniV2Pair:h,handleChangeBaseAmount:m,handleChangeQuoteAmount:f,reset:g,slippage:y,slippageNumber:v,setSlippage:j}=Ph({pool:t});G.useEffect((()=>{g()}),[t]);const w=oa(null==t?void 0:t.baseToken,{amount:d}),C=oa(null==t?void 0:t.quoteToken,{amount:c}),k=w.insufficientBalance||C.insufficientBalance,R=!t||k||!u||!!h.poolInfoQuery.isLoading||!!h.poolInfoQuery.error||p||h.poolInfoQuery.isLoading;let S=l?o._({id:"bwSQI0",message:"Supply"}):o._({id:"m16xKo",message:"Add"});k&&(S=o._({id:"znqB4T",message:"Insufficient balance"}));const I=Kc({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:v,submittedBack:()=>{g(),e&&e(),s(!1)}}),E=!(null==t?void 0:t.baseToken)||!(null==t?void 0:t.quoteToken);return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{sx:{pt:20,pb:18,px:20},children:[zt.jsx(Pc,{sx:{mb:4,pb:28,minHeight:"auto"},amt:d,token:null==t?void 0:t.baseToken,canClickBalance:!0,showPercentage:!0,onInputChange:m,readOnly:h.poolInfoQuery.isLoading}),zt.jsx(jc,{plus:!0}),zt.jsx(Pc,{sx:{pb:20,minHeight:"auto"},amt:c,token:null==t?void 0:t.quoteToken,canClickBalance:!0,showPercentage:!0,onInputChange:f,readOnly:h.poolInfoQuery.isLoading}),zt.jsx(bu,{slippage:y,onChangeSlippage:j,disabled:E,sx:{mt:8}}),zt.jsx(hu,{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})]}),zt.jsx(x,{sx:{px:20,py:16,position:"sticky",bottom:0,borderStyle:"solid",borderWidth:"1px 0 0",borderColor:"border.main",backgroundColor:"background.paper"},children:t?zt.jsx(Zh,{chainId:t.chainId,baseTokenStatus:w,quoteTokenStatus:C,children:zt.jsx(b,{fullWidth:!0,disabled:R,isLoading:I.isPending,onClick:()=>{R||s(!0)},children:S})}):zt.jsx(b,{fullWidth:!0,disabled:!0,children:S})}),zt.jsx(Fh,{message:null===(r=I.error)||void 0===r?void 0:r.message,onClose:()=>I.reset()}),l&&!!t&&zt.jsx(mu,{open:a,onClose:()=>s(!1),slippage:v,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:I})]})}function Nh({hidePoolInfo:e,pool:t,children:o}){var i,r,l,a,s;const d=y(),c=!t,u="SVM_AMMV2"===(null==t?void 0:t.type),p=t?Op({type:t.type,lpFeeRate:null!==(i=t.lpFeeRate)&&void 0!==i?i:"0",mtFeeRate:null!==(r=t.mtFeeRate)&&void 0!==r?r:"0"}):"-";return zt.jsxs(x,{sx:{mt:16,mx:20,border:"solid 1px",borderColor:"border.main",borderRadius:12},children:[e?"":zt.jsxs(x,{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:[zt.jsxs(x,{children:[zt.jsxs(E,{loading:c,loadingSx:{width:100,mb:4},sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[null===(l=null==t?void 0:t.baseToken)||void 0===l?void 0:l.symbol,"/",null===(a=null==t?void 0:t.quoteToken)||void 0===a?void 0:a.symbol,u&&zt.jsx(W,{title:zt.jsxs(x,{sx:{typography:"h6","& > b":{fontWeight:600,color:"primary.main"}},children:["🌟",zt.jsx("b",{children:zt.jsx(n,{id:"e38JNU",message:"Tips:"})})," ",zt.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:zt.jsx("b",{})}})]}),sx:{maxWidth:240},children:zt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.disabled"},children:p})})]}),zt.jsx(E,{loading:c,children:zt.jsx(du,{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?zt.jsxs(x,{component:M,sx:{typography:"body2",display:"flex",alignItems:"center",color:"text.secondary"},onClick:()=>{Hc.getState().push({type:Uc.PoolDetail,params:{chainId:t.chainId,address:t.address}})},children:[zt.jsx(n,{id:"URmyfc",message:"Details"}),zt.jsx(x,{component:Wt.ArrowRight,sx:{ml:4,position:"relative",top:1.2,width:16,height:16}})]}):""]}),zt.jsx(x,{sx:{p:d.spacing(12,20)},children:o})]})}function Uh({submittedBack:t,pool:n}){var i,r,l;const[a,s]=G.useState(""),[d,c]=G.useState(""),[u,p]=G.useState(vr),h=u===vr?new ie(_c).div(100).toNumber():u,{isFront:m,price:f,invertedPrice:g,poolInfoQuery:y,lpBalanceQuery:v,lpBalance:j,lpBalancePercentage:w,lpToAmountA:C,lpToAmountB:k,liquidityMinted:R,pairMintAAmount:S,pairMintBAmount:I,isExists:E}=$c({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:M,modeOptions:T,handleChangeMode:L,sliderPercentage:O,handleChangeSliderPercentage:W,resetPercentage:V}=function({isBase:e,pool:t,baseOverride:n,quoteOverride:i,resetAmount:r,handleChangeBaseAmount:l,handleChangeQuoteAmount:a}){const[s,d]=G.useState(jh.percentage),[c,u]=G.useState(bh),p=G.useRef(null),h=()=>{p.current&&clearTimeout(p.current)},m=()=>{h(),u(bh)};return G.useEffect((()=>h),[]),{mode:s,modeOptions:[{key:jh.percentage,value:o._({id:"x4QVeW",message:"Percentage to remove"})}],handleChangeMode:e=>{d(e),null==r||r(),m()},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=Qr(n.times(o/100),t.baseToken.decimals)),null==l||l(e)}}else if(i){let e=i.toString();r||(e=Qr(i.times(o/100),t.quoteToken.decimals)),null==a||a(e)}};r?s():p.current=setTimeout(s,100)},resetPercentage:m}}({isBase:!0,pool:n,baseOverride:C,quoteOverride:k}),F=oa(null==n?void 0:n.baseToken,{amount:a}),A=oa(null==n?void 0:n.quoteToken,{amount:d}),Z=!n||!!y.isLoading||!!y.error||!!v.error||v.isLoading,P=o._({id:"t/YqKh",message:"Remove"}),B=function({liquidityAmount:t,slippage:n,poolInfo:i,poolKeys:r,submittedBack:l}){const a=Cl(),s=Ws();return e(),Ce({mutationFn:()=>Lr(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 gt(new yt(t.toString()).mul(10**i.lpMint.decimals).toFixed(0,yt.ROUND_DOWN)),d=new De(100*n*100,1e4),{execute:c}=yield s.cpmm.withdrawLiquidity({poolInfo:i,poolKeys:r,lpAmount:e,txVersion:Ue.LEGACY,slippage:d});return yield a.executeCustom({brief:o._({id:"cJtosk",message:"Remove liquidity"}),metadata:{[Pr.removeLiqidityAMMV2Position]:!0},handler:e=>Lr(this,void 0,void 0,(function*(){const{txId:t}=yield c({sendAndConfirm:!0});e.onSuccess(t)})),submittedBack:l})}))})}({liquidityAmount:null==j?void 0:j.times(O/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()}}),N=!(null==n?void 0:n.baseToken)||!(null==n?void 0:n.quoteToken);return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{sx:{pb:18,px:20},children:[zt.jsx(x,{sx:{pt:20},children:M===jh.percentage?zt.jsx(vh,{disabled:y.isLoading||!j||j.lte(0),value:O,onChange:W}):zt.jsx(zt.Fragment,{})}),zt.jsx(bu,{slippage:u,onChangeSlippage:p,disabled:N,sx:{mt:8}}),zt.jsx(hu,{baseToken:null==n?void 0:n.baseToken,quoteToken:null==n?void 0:n.quoteToken,loading:y.isLoading,midPrice:m?f:g,lpBalancePercentage:E?w:100})]}),zt.jsx(x,{sx:{px:20,py:16,position:"sticky",bottom:0,borderStyle:"solid",borderWidth:"1px 0 0",borderColor:"border.main",backgroundColor:"background.paper"},children:n?zt.jsx(Zh,{chainId:n.chainId,baseTokenStatus:F,quoteTokenStatus:A,children:zt.jsx(b,{fullWidth:!0,disabled:Z,isLoading:B.isPending,onClick:()=>{Z||B.mutate()},children:P})}):zt.jsx(b,{fullWidth:!0,disabled:!0,children:P})}),zt.jsx(Fh,{message:null===(l=B.error)||void 0===l?void 0:l.message,onClose:()=>B.reset()})]})}function Hh({pool:t,operate:n,hidePoolInfo:o,submittedBack:i}){var r;const{operateTab:l,operateTabs:a,handleChangeTab:s}=function(t=Vh.Add){const{i18n:n}=e(),[o,i]=G.useState(t),r=G.useMemo((()=>[{key:Vh.Add,value:n._({id:"m16xKo",message:"Add"})},{key:Vh.Remove,value:n._({id:"t/YqKh",message:"Remove"})}]),[n._]);return G.useEffect((()=>{i(t)}),[t]),{operateTab:o,operateTabs:r,handleChangeTab:e=>{i(e)}}}(n);Ar();const{price:d,invertedPrice:c,poolInfoQuery:u,lpBalanceQuery:p,lpBalance:h,lpBalancePercentage:m,lpToAmountA:f,lpToAmountB:g,liquidityMinted:x,pairMintAAmount:y,pairMintBAmount:v,isExists:b}=$c({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 zt.jsxs(zt.Fragment,{children:[zt.jsx(Nh,{pool:t,hidePoolInfo:o,children:zt.jsx(yu,{isExists:b,poolInfo:null===(r=u.data)||void 0===r?void 0:r.poolInfo,poolInfoLoading:u.isLoading,lpBalanceLoading:p.isLoading,lpBalance:h,lpBalancePercentage:m,lpToAmountA:f,lpToAmountB:g,sx:{px:0,py:0,border:"none"}})}),zt.jsxs(U,{value:l,onChange:(e,t)=>{s(t)},children:[zt.jsx(H,{tabs:a,variant:"inPaper",tabsListSx:{mt:16,mx:20}}),zt.jsx(D,{value:Vh.Add,children:zt.jsx(Bh,{pool:t,submittedBack:i})}),zt.jsx(D,{value:Vh.Remove,children:zt.jsx(Uh,{pool:t,submittedBack:i})})]})]})}function Dh({onClose:t,pool:n,operate:o,hasMining:i,hidePoolInfo:r,sx:l}){const{poolOrMiningTab:a,poolOrMiningTabs:s,handleChangeTab:d}=function({hasMining:t}){const{i18n:n}=e(),[o,i]=G.useState(Wh.Liquidity);return{poolOrMiningTab:o,poolOrMiningTabs:G.useMemo((()=>{const e=[{key:Wh.Liquidity,value:n._({id:"6y2TB3",message:"Liquidity"})},{key:Wh.Mining,value:n._({id:"Sti4vy",message:"Mining"})}];return t?e:e.slice(0,1)}),[n._,t]),handleChangeTab:e=>{i(e)}}}({hasMining:i});return zt.jsx(x,{sx:l,children:zt.jsxs(U,{value:a,onChange:(e,t)=>{d(t)},sx:{display:"flex",flexDirection:"column",overflow:"hidden",height:"100%"},children:[zt.jsx(z,{tabs:s,tabsListSx:Object.assign({mx:20,justifyContent:t?"space-between":"flex-start"},{}),rightSlot:zt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",gap:12},children:t?zt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24,borderRadius:"50%",borderWidth:1,color:"text.secondary",cursor:"pointer"},children:zt.jsx(x,{component:Wt.Error,sx:{width:16,height:16},onClick:()=>{t()}})}):void 0})}),zt.jsx(D,{value:Wh.Liquidity,sx:{flex:1,overflowY:"auto"},children:zt.jsx(Hh,{pool:n,operate:o,hidePoolInfo:r,submittedBack:()=>{i&&d(Wh.Mining)}})})]})})}function Yh(e){var{modal:t}=e,n=Tr(e,["modal"]);const{isMobile:o}=Rc();return zt.jsx(tc,{open:!!n.pool,onClose:n.onClose,scope:!o,modal:t,id:"pool-operate",children:zt.jsx(Dh,{...n})})}!function(e){e[e.Liquidity=1]="Liquidity",e[e.Mining=2]="Mining"}(Wh||(Wh={})),function(e){e[e.Add=1]="Add",e[e.Remove=2]="Remove"}(Vh||(Vh={}));const zh=e=>Object.keys(new Array(e+1).join(","));var Xh,qh,Gh;function _h({sx:e,hasSearch:t,emptyText:o}){return zt.jsxs(x,{sx:Object.assign({display:"flex",flexDirection:"column",gap:12,justifyContent:"center",alignItems:"center",typography:"body2",fontWeight:500,color:"text.secondary",textAlign:"center"},e),children:[zt.jsx(Y,{hasSearch:t,sx:{width:60,height:60,borderRadius:12}}),zt.jsx(x,{children:null!=o?o:zt.jsx(n,{id:"AxPAXW",message:"No results found"})})]})}function Jh(){return Jh=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},Jh.apply(null,arguments)}!function(e){e[e.Failed=0]="Failed",e[e.Success=1]="Success",e[e.Warning=2]="Warning"}(Xh||(Xh={}));const Qh=e=>q.createElement("svg",Jh({width:60,height:60,viewBox:"0 0 60 60",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),q.createElement("g",{opacity:.5},q.createElement("mask",{id:"mask0_3521_179418",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:0,y:0,width:60,height:60},qh||(qh=q.createElement("rect",{width:60,height:60,rx:16,fill:"white"}))),Gh||(Gh=q.createElement("g",{mask:"url(#mask0_3521_179418)"},q.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}),q.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}),q.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}),q.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}),q.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}),q.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}),q.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 Kh({sx:e,refresh:t}){return zt.jsxs(x,{sx:ue({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},e),children:[zt.jsx(x,{component:Qh,sx:{display:"inline-block",width:60,height:60,mb:12}}),zt.jsx(x,{sx:{typography:"body2",width:252,textAlign:"center"},children:zt.jsx(x,{component:"span",sx:{color:"text.secondary"},children:zt.jsx(n,{id:"Vmw6BM",message:"Something went wrong…<0>Refresh again</0>",components:{0:zt.jsx(j,{component:"span",color:"primary.main",weak:!0,sx:{cursor:"pointer"},onClick:()=>{t()}})}})})})]})}function $h({loading:e,empty:t,hasSearch:n,children:o,refetch:i}){return e?zt.jsx(x,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",gap:24,px:24,height:320},children:zh(4).map(((e,t)=>zt.jsx(V,{width:"100%",height:45},t)))}):i?zt.jsx(Kh,{refresh:i,sx:{height:320}}):t?zt.jsx(_h,{hasSearch:n,sx:{height:320}}):zt.jsx(zt.Fragment,{children:o})}function em({children:e,sx:t,gap:n=20,repeatBaseForLargeScreen:o=3}){const{isMobile:i,minDevice:r}=Rc();let l={};if(i)l={display:"flex",flexDirection:"column",gap:n};else{let e=2;[1418,1761,2104].some(((t,n)=>{if(r(t))return e=o+n,!0})),l={display:"grid",gap:n,gridTemplateColumns:`repeat(${e}, 1fr)`}}return zt.jsx(x,{sx:Object.assign(Object.assign({},l),t),children:e})}function tm({address:e,chainId:t,hideName:o,sx:i}){const r=y(),l=Ql(),{onlyChainId:a}=Vr(),s=we(Object.assign({},l.getQuery(g.graphql.fetchLiquidityLpPartnerRewards,{where:{chainId:a||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,l,a,c,u,p,h,m,f,g,x,y;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===(l=null===(r=null===(i=s.data)||void 0===i?void 0:i.liquidity_getLpPartnerRewards)||void 0===r?void 0:r.partnerInfos)||void 0===l?void 0:l.find((e=>(null==e?void 0:e.partner)===n.partner));if(!e)return;d.push({partner:{name:null!==(a=null==e?void 0:e.partner)&&void 0!==a?a:"",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===(m=null==e?void 0:e.theme)||void 0===m?void 0:m[0])||void 0,color:(null===(f=null==e?void 0:e.theme)||void 0===f?void 0:f[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!==(y=null==e?void 0:e.sort)&&void 0!==y?y:Number.MAX_SAFE_INTEGER})}})))})),(null==d?void 0:d.length)?(d.sort(((e,t)=>e.sort-t.sort)),zt.jsx(x,{sx:Object.assign({display:"flex",alignItems:"center",gap:4},i),children:d.map((e=>zt.jsx(W,{leaveDelay:100,title:zt.jsxs(x,{sx:{maxWidth:240,whiteSpace:"pre-wrap"},children:[e.partner.introduction,!!e.partner.link&&zt.jsxs(x,{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:[zt.jsx(n,{id:"zwWKhA",message:"Learn more"})," ",zt.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zt.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:zt.jsxs(M,{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:[zt.jsx(x,{component:"img",src:e.partner.logo,alt:e.partner.name,sx:{width:14,height:14,borderRadius:"50%"}}),!o&&!!e.reward&&zt.jsx(x,{sx:{fontSize:"10px",fontWeight:600},children:e.reward})]})},e.partner.name+e.reward)))})):null}var nm,om;function im(){return im=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},im.apply(null,arguments)}const rm=e=>q.createElement("svg",im({width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),nm||(nm=q.createElement("circle",{cx:16,cy:16,r:16,fill:"#FFE804"})),om||(om=q.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"}))),lm="_default";function am({value:e,onChange:t,placeholder:n,options:o,sx:i,readOnly:r,valueOnlyIcon:l}){const a=y();return zt.jsx(X,{value:null!=e?e:lm,onChange:(n,o)=>{const i="number"==typeof e?Number(o):o;t(i===lm?void 0:i)},disabled:r,sx:ue({padding:a.spacing(8,12),"& .MuiSelect-select.MuiSelect-select.MuiSelect-select":{display:"flex",alignItems:"center",gap:8,padding:a.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===lm)return zt.jsx(x,{sx:{color:"text.secondary"},children:null!=n?n:""});const i=o.find((t=>t.key===e));return i?zt.jsxs(zt.Fragment,{children:[i.logo,l?"":i.value]}):null},options:[...o]})}function sm({isMobileStyle:e,chain:t,isLastItem:n,logoWidth:o,mobileLogoWidth:i,sx:r}){const l=y();return e?zt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",py:18,borderTop:`1px solid ${l.palette.border.main}`,borderBottom:n?`1px solid ${l.palette.border.main}`:"none"},r),children:[zt.jsx(x,{component:null==t?void 0:t.logo,sx:{width:i,height:i}}),zt.jsx(x,{component:"span",className:"name",sx:{marginLeft:8},children:null==t?void 0:t.name})]}):zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(x,{component:null==t?void 0:t.logo,sx:{width:o,height:o}}),zt.jsx(x,{component:"span",className:"name",sx:{marginLeft:8},children:null==t?void 0:t.name})]})}const dm=-1;function cm({chainId:t,setChainId:o,logoWidth:i=24,mobileLogoWidth:r=32,mainLogoWidth:l=24,mainMobileLogoWidth:a=18,notShowAllChain:s,valueOnlyIcon:d,sx:c}){const u=function(){const{chainId:e}=Ne();return K((()=>{const t=new Map;let n;return ks.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]=G.useState(!1),{isMobile:m}=Rc(),{i18n:f}=e(),g=G.useCallback((()=>{const e=void 0===t?u[0]:u.find((e=>e.chainId===t));if(d){if(void 0===t||!e)return"";const n=m?r:l;return zt.jsx(x,{component:null==e?void 0:e.logo,sx:{width:n,height:n}})}return void 0!==t||s?e?zt.jsx(sm,{isMobileStyle:m,chain:e,logoWidth:l,mobileLogoWidth:a}):null:zt.jsx(sm,{isMobileStyle:m,chain:{chainId:dm,logo:rm,name:f._({id:"pY/ok7",message:"All chains"})},logoWidth:l,mobileLogoWidth:a,sx:{border:"none"}})}),[t,u,s,d,m,f._]),y=G.useMemo((()=>{const e=[];return s||e.push({key:dm,value:zt.jsx(sm,{isMobileStyle:m,chain:{chainId:dm,logo:rm,name:f._({id:"pY/ok7",message:"All chains"})},logoWidth:i,mobileLogoWidth:r})}),u.forEach(((t,n)=>{e.push({key:t.chainId,value:zt.jsx(sm,{isLastItem:n===u.length-1,isMobileStyle:m,chain:t,logoWidth:i,mobileLogoWidth:r})})})),e}),[m,i,r,u,s]);return m?zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{component:M,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:[zt.jsx(x,{sx:{pr:5},children:g()}),zt.jsx(x,{component:Wt.CaretUp,sx:{width:12,height:12,transform:"rotate(180deg)"}})]}),zt.jsx(tc,{open:p,title:zt.jsx(n,{id:"lJvbHq",message:"Select Network"}),onClose:()=>h(!1),id:"select-chain",modal:!0,children:zt.jsx(x,{sx:{mb:20},children:y.map((e=>zt.jsxs(x,{onClick:()=>{const t=e.key;o(t===dm?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===dm)&&zt.jsx(x,{sx:{position:"absolute",left:0,top:24,height:20,width:2,backgroundColor:"text.primary"}})]},e.key)))})})]}):zt.jsx(am,{value:null!=t?t:dm,onChange:e=>{o(e===dm?void 0:e)},placeholder:f._({id:"lJvbHq",message:"Select Network"}),options:y,valueOnlyIcon:d,sx:Object.assign({height:32,fontWeight:600,typography:"body2"},c)})}function um({text:e,onClick:t}){const n=y();return zt.jsxs(x,{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,zt.jsx(x,{component:Wt.ArrowBack,sx:{ml:2,width:16,height:16,transform:"rotate(180deg)"}})]})}function pm({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=Ep(i.baseToken,i.chainId),l=Ep(i.quoteToken,i.chainId);return r&&l?zt.jsxs(x,{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:[zt.jsx(uu,{tokens:[r,l],chainId:r.chainId,width:20,mr:8}),r.symbol,"+",l.symbol,zt.jsx(x,{component:Wt.Error,sx:{ml:4,width:16,height:16,cursor:"pointer",color:"text.secondary",position:"relative",top:1.5},onClick:()=>t()})]}):null}function hm({tags:e,onDeleteTag:t,sx:n}){return e.length?zt.jsx(x,{sx:Object.assign({display:"inline-flex",alignItems:"center"},n),children:e.map((e=>zt.jsxs(x,{sx:{typography:"body2",display:"flex",alignItems:"center",px:8,mr:8,borderRadius:8,fontWeight:600,height:32,backgroundColor:"hover.default"},children:[zt.jsx(Ss,{address:e.address,width:20,height:20,chainId:e.chainId,url:e.logoURI,noShowChain:!0,marginRight:8}),e.symbol,zt.jsx(x,{component:Wt.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 mm({chainId:e,address:t}){const{isMobile:n}=Rc();return zt.jsx(x,{component:"button",onClick:n=>{n.stopPropagation(),Hc.getState().push({type:Uc.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:zt.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:zt.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 fm(e){var{sx:t,children:o,hasMore:i,loadMore:r,loadMoreLoading:l}=e,a=Tr(e,["sx","children","hasMore","loadMore","loadMoreLoading"]);const s=y();return zt.jsxs(x,{sx:Object.assign({position:"relative",flex:1,overflowY:"auto"},t),...a,children:[zt.jsx(x,{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:`${L(s.palette.text.primary,.1)} -2px 0px 4px 0px`}}},children:o}),i&&zt.jsx(M,{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:l?zt.jsx(O,{}):zt.jsxs(zt.Fragment,{children:[zt.jsx(n,{id:"yQ2kGp",message:"Load more"}),zt.jsx(x,{component:Wt.ArrowRight,sx:{transform:"rotate(90deg)"}})]})})]})}function gm({sx:e}){return zt.jsxs(x,{sx:Object.assign({px:20,pt:20,pb:12,backgroundColor:"background.paperContrast",borderRadius:16,display:"flex",flexDirection:"column"},e),children:[zt.jsx(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(V,{variant:"circular",width:48}),zt.jsx(V,{variant:"rounded",height:28,width:100,sx:{ml:8}})]})}),zt.jsxs(x,{sx:{display:"flex",alignItems:"center",mt:44},children:[zt.jsxs(x,{children:[zt.jsx(V,{variant:"rounded",height:24,width:100}),zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"rSayea",message:"APY"})})]}),zt.jsx(x,{sx:{display:"inline-block",mx:20,height:24,width:"1px",backgroundColor:"custom.border.default"}}),zt.jsxs(x,{children:[zt.jsx(V,{variant:"rounded",height:24,width:100}),zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"FHKsZF",message:"TVL"})})]})]}),zt.jsx(V,{variant:"rounded",height:32})]})}function xm({chainId:e,baseToken:t,quoteToken:o,apy:i,hasQuote:r,hasMining:l,sx:a,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 zt.jsx(W,{children:null!=s?s:zt.jsx(j,{component:Wt.QuestionBorder,sx:Object.assign({width:15,height:15},a)}),title:zt.jsx(x,{sx:{width:236},children:d.map(((i,r)=>{var a,s,d,c;return zt.jsxs(x,{sx:{mt:0===r?0:20},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",typography:"body2",fontWeight:600,color:"text.primary"},children:[zt.jsx(x,{sx:{display:"flex",alignItems:"center"},children:i.token?zt.jsxs(zt.Fragment,{children:[zt.jsx(Ss,{width:14,height:14,marginRight:4,address:i.token.address,url:i.token.logoURI,chainId:e,noShowChain:!0}),i.token.symbol]}):zt.jsxs(zt.Fragment,{children:[zt.jsx(uu,{tokens:[t,o],width:14,mr:4,chainId:e}),t.symbol,"/",null==o?void 0:o.symbol]})}),zt.jsx(x,{children:al(new ie(null!==(d=i.transactionApy)&&void 0!==d?d:0).plus(null!==(c=i.miningApy)&&void 0!==c?c:0))})]}),zt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",typography:"h6",color:"text.secondary"},children:[zt.jsx("span",{children:zt.jsx(n,{id:"OnDEky",message:"LP Fee"})}),zt.jsx("span",{children:i.transactionApy?al(new ie(i.transactionApy)):"-"})]}),l?zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",typography:"h6",color:"text.secondary"},children:[zt.jsx("span",{children:zt.jsx(n,{id:"pSQ1lM",message:"MT Fee"})}),zt.jsx("span",{children:i.miningApy?al(new ie(i.miningApy)):"-"})]}):""]},null!==(s=null===(a=i.token)||void 0===a?void 0:a.address)&&void 0!==s?s:1)}))})})}function ym({sx:e,value:t,onChange:i,searchAddress:r}){const[l,a]=G.useState(!1),{isMobile:s}=Rc();return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{component:M,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:()=>a(!0),children:[zt.jsx(x,{component:Wt.Search,sx:{width:16,height:16,mr:8,flexShrink:0}}),zt.jsx(n,{id:"A1taO8",message:"Search"})]}),zt.jsx(Ac,{value:t,open:l,multiple:!0,title:zt.jsx(n,{id:"o8aMNm",message:"Select a liquidity pool"}),searchPlaceholder:o._({id:"4nzwq3",message:"Search by token or pool address"}),onClose:()=>{a(!1)},onTokenChange:e=>{if(Array.isArray(e)){if(e.length>2){const t=[e[0],e[2]];i(t)}else i(e);a(!1)}},searchOtherAddress:e=>r(e,(()=>a(!1))),modal:!0})]})}function vm({list:e,onClick:t}){return zt.jsx(zt.Fragment,{children:null==e?void 0:e.map((e=>{var o,i,r,l;if(!(null==e?void 0:e.pair))return null;const a=e.pair,s=Ep(a.baseToken,a.chainId),d=Ep(a.quoteToken,a.chainId),c=a.apy?al(new ie(null===(o=a.apy)||void 0===o?void 0:o.transactionBaseApy).plus(null!==(r=null===(i=a.apy)||void 0===i?void 0:i.miningBaseApy)&&void 0!==r?r:0)):void 0,u=f.utils.singleSideLp(a.type)&&a.apy?al(new ie(a.apy.transactionQuoteApy).plus(null!==(l=a.apy.miningQuoteApy)&&void 0!==l?l:0)):void 0;return s&&d?zt.jsxs(x,{onClick:t,sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:10,py:20,borderRadius:8,cursor:"pointer","&:hover":{backgroundColor:"custom.background.listHover"}},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[zt.jsx(uu,{tokens:[s,d],chainId:a.chainId,width:24,mr:10}),zt.jsxs(x,{sx:{typography:"h5"},children:[s.symbol,"/",d.symbol]})]}),zt.jsxs(x,{children:[zt.jsxs(x,{sx:{color:"custom.status.green.default",fontWeight:600},children:[c,u?`/${u}`:""]}),zt.jsx(x,{sx:{mt:2,typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"rSayea",message:"APY"})})]})]},a.id):null}))})}function bm(){const[e,t]=G.useState([]),[n,o]=G.useState([]),[i,r]=G.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 jm({lqList:e,setOperatePool:t,supportAMM:o}){const i=y();return zt.jsx(zt.Fragment,{children:null==e?void 0:e.map((e=>{var r,l,a,s,d,c,u;if(!(null==e?void 0:e.pair))return null;const p=e.pair,h=Ep(p.baseToken,p.chainId),m=Ep(p.quoteToken,p.chainId),g=p.apy?al(new ie(null===(r=p.apy)||void 0===r?void 0:r.transactionBaseApy).plus(null!==(a=null===(l=p.apy)||void 0===l?void 0:l.miningBaseApy)&&void 0!==a?a:0)):void 0,y=f.utils.singleSideLp(p.type)&&p.apy?al(new ie(p.apy.transactionQuoteApy).plus(null!==(s=p.apy.miningQuoteApy)&&void 0!==s?s:0)):void 0,v=!!(null===(d=p.miningAddress)||void 0===d?void 0:d[0]),j=Lp(p.type);return zt.jsx(x,{sx:{p:8,borderRadius:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"border.disabled",backdropFilter:"blur(5px)"},children:zt.jsxs(x,{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||Hc.getState().push({type:Uc.PoolDetail,params:{chainId:p.chainId,address:p.id}})},children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8},children:[h&&m?zt.jsx(uu,{tokens:[h,m],width:24,mr:6,chainId:p.chainId,showChainLogo:!0}):"",zt.jsxs(x,{sx:{typography:"body2",fontWeight:600},children:[`${null==h?void 0:h.symbol}/${null==m?void 0:m.symbol}`,zt.jsx(tm,{address:p.id,chainId:p.chainId})]})]}),v?zt.jsxs(x,{sx:{p:8,typography:"h6",fontWeight:"bold",background:`linear-gradient(180deg, ${L(i.palette.secondary.main,.3)} 0%, ${L(i.palette.purple.main,.3)} 100%)`,borderRadius:8,color:"purple.main",whiteSpace:"nowrap"},children:["✨ ",zt.jsx(n,{id:"Sti4vy",message:"Mining"})]}):""]}),zt.jsxs(x,{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&&zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,whiteSpace:"nowrap"},children:[j,zt.jsx(W,{title:zt.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:zt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Op({type:p.type,lpFeeRate:null!==(c=p.lpFeeRate)&&void 0!==c?c:0,mtFeeRate:null!==(u=p.mtFeeRate)&&void 0!==u?u:0})})})]}),zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"1Qz63U",message:"Pool Type"})})]}),zt.jsxs(x,{children:[zt.jsxs(x,{sx:{typography:"h5",color:"success.main"},children:[g,y?`/${y}`:""]}),zt.jsxs(x,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:[zt.jsx(n,{id:"rSayea",message:"APY"}),zt.jsx(xm,{chainId:p.chainId,apy:p.apy,baseToken:h,quoteToken:m,hasQuote:!!y,hasMining:v,sx:{width:14,height:14}})]})]}),zt.jsxs(x,{children:[zt.jsxs(x,{sx:{typography:"h5"},children:["$",rl(new ie(p.tvl))]}),zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"FHKsZF",message:"TVL"})})]}),o&&zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:["$",Gr({input:p.volume24H||0})]}),zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"Q8W3SC",message:"Volume (1D)"})})]})]}),zt.jsxs(x,{sx:{mt:20,display:"flex",gap:"8px"},children:[zt.jsx(hc,{fullWidth:!0,size:b.Size.small,onClick:n=>{n.stopPropagation(),t({pool:Mp(e),hasMining:v})},children:zt.jsx(n,{id:"m16xKo",message:"Add"})}),o&&"PMM"===j&&zt.jsx(mm,{chainId:p.chainId,address:p.id})]})]})},p.id+p.chainId)}))})}function wm({lqList:e,operatePool:t,setOperatePool:i,hasMore:r,loadMore:l,loadMoreLoading:a,supportAMM:s}){const d=y();return zt.jsxs(fm,{hasMore:r,loadMore:l,loadMoreLoading:a,children:[zt.jsx(x,{component:"thead",children:zt.jsxs(x,{component:"tr",children:[zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"AxdOHo",message:"Pair"})}),s&&zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"1Qz63U",message:"Pool Type"})}),zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"FHKsZF",message:"TVL"})}),zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"rSayea",message:"APY"})}),s&&zt.jsx("th",{children:zt.jsx(n,{id:"Q8W3SC",message:"Volume (1D)"})}),zt.jsx(x,{component:"th",sx:{width:80}})]})}),zt.jsx(x,{component:"tbody",children:null==e?void 0:e.map((e=>{var r,l,a,c,u,p,h,m;if(!(null==e?void 0:e.pair))return null;const g=e.pair,y=Ep(g.baseToken,g.chainId),v=Ep(g.quoteToken,g.chainId),j=g.apy?al(new ie(null===(r=g.apy)||void 0===r?void 0:r.transactionBaseApy).plus(null!==(a=null===(l=g.apy)||void 0===l?void 0:l.miningBaseApy)&&void 0!==a?a:0)):void 0,w=f.utils.singleSideLp(g.type)&&g.apy?al(new ie(g.apy.transactionQuoteApy).plus(null!==(c=g.apy.miningQuoteApy)&&void 0!==c?c:0)):void 0;let C="";if((null===(u=null==t?void 0:t.pool)||void 0===u?void 0:u.address)===g.id||(null==t?void 0:t.address)===g.id)if(t.operate===Vh.Remove)C=o._({id:"0+31GV",message:"Removing"});else C=o._({id:"1yHVE+",message:"Adding"});const k=!!(null===(p=g.miningAddress)||void 0===p?void 0:p[0]),R=Lp(g.type),S=d.palette.background.tag;return zt.jsxs(x,{component:"tr",sx:{["&:hover td"+(C?", & td":"")]:{backgroundImage:`linear-gradient(${S}, ${S})`}},children:[zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[y&&v?zt.jsx(uu,{tokens:[y,v],width:24,mr:10,chainId:g.chainId,showChainLogo:!0}):"",zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[`${null==y?void 0:y.symbol}/${null==v?void 0:v.symbol}`,zt.jsx(tm,{address:g.id,chainId:g.chainId})]}),zt.jsx(du,{address:g.id,customChainId:g.chainId,truncate:!0,showCopy:!0,iconDarkHover:!0,iconSize:14,iconSpace:4,sx:{typography:"h6",color:"text.secondary"},disabledAddress:s,onAddressClick:()=>{Hc.getState().push({type:Uc.PoolDetail,params:{chainId:g.chainId,address:g.id}})}})]})]})}),s&&zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[zt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary",whiteSpace:"nowrap"},children:R}),zt.jsx(W,{title:zt.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:zt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Op({type:g.type,lpFeeRate:null!==(h=g.lpFeeRate)&&void 0!==h?h:0,mtFeeRate:null!==(m=g.mtFeeRate)&&void 0!==m?m:0})})})]})}),zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{typography:"body2"},title:g.tvl?`$${Gr({input:g.tvl})}`:void 0,children:["$",rl(new ie(g.tvl))]})}),zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[k?zt.jsx(W,{title:o._({id:"Sti4vy",message:"Mining"}),children:zt.jsxs(x,{component:"span",sx:{typography:"body2",color:"success.main"},children:["✨"," "]})}):"",zt.jsx(xm,{chainId:g.chainId,apy:g.apy,baseToken:y,quoteToken:v,hasQuote:!!w,hasMining:k,children:zt.jsxs(x,{component:"span",sx:{typography:"body2",fontWeight:600,display:"flex",alignItems:"center",width:"max-content",color:"success.main",cursor:"auto"},children:[j,w?`/${w}`:""]})})]})}),s&&zt.jsxs(x,{component:"td",children:["$",Gr({input:g.volume24H||0})]}),zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[s&&"PMM"===R&&zt.jsx(mm,{chainId:g.chainId,address:g.id}),C?zt.jsx(um,{text:C,onClick:()=>i(null)}):zt.jsx(b,{size:b.Size.small,onClick:()=>{i({pool:Mp(e),hasMining:k})},children:o._({id:"m16xKo",message:"Add"})})]})})]},g.id+g.chainId)}))})]})}function Cm({scrollParentRef:e,filterChainIds:t,activeChainId:n,handleChangeActiveChainId:o,operatePool:i,setOperatePool:r}){var l;const{onlyChainId:a,supportAMMV2:s,supportAMMV3:d,notSupportPMM:c}=Vr(),{minDevice:u,isMobile:p}=Rc(),h=je(),{filterTokens:m,filterASymbol:g,filterBSymbol:y,filterAddressLqList:v,handleDeleteToken:b,handleChangeFilterTokens:j,handleChangeFilterAddress:w}=bm(),C=[];s&&C.push("SVM_AMMV2"),d&&C.push("SVM_AMMV3");const k={chainIds:t,pageSize:p?4:8,filterState:{viewOnlyOwn:!1,filterTypes:C}},R=Ql(),S=R.getInfiniteQuery(f.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},k),{filterState:Object.assign({filterASymbol:g,filterBSymbol:y},k.filterState)})}),I=Se(Object.assign(Object.assign({},S),{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 M=!!(null==v?void 0:v.length);M?E=[...v]:null===(l=I.data)||void 0===l||l.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 T=I.hasNextPage&&!M;return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{sx:Object.assign(Object.assign({py:16,display:"flex",gap:8},u(475)?{}:{flexDirection:"column"}),p?{}:{px:20,borderBottomWidth:1}),children:[zt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",gap:8},u(475)?{}:{"& > button":{flex:1}}),children:[!a&&zt.jsx(cm,{chainId:n,setChainId:o}),zt.jsx(ym,{value:m,onChange:j,searchAddress:(e,t)=>Lr(this,void 0,void 0,(function*(){var n;const o=R.getInfiniteQuery(f.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},k),{filterState:Object.assign({address:e},k.filterState)})}),i=null===(n=(yield h.fetchQuery(o)).liquidity_list)||void 0===n?void 0:n.lqList;return(null==i?void 0:i.length)?zt.jsx(vm,{list:i,onClick:()=>{w(i),t()}}):null}))})]}),(M||!!m.length)&&zt.jsxs(x,{sx:{my:0},children:[M?zt.jsx(pm,{lqList:v,onDeleteTag:()=>w([])}):"",zt.jsx(hm,{tags:m,onDeleteTag:b})]})]}),p?zt.jsx(Tt,{hasMore:T,threshold:300,loadMore:ce((()=>{I.hasNextPage&&!I.isFetching&&I.fetchNextPage()}),500),useWindow:!1,getScrollParent:()=>e.current||null,loader:zt.jsx(gm,{sx:{mt:20}},"loader"),children:zt.jsxs(em,{gap:12,children:[I.isLoading?zt.jsx(gm,{}):"",!I.isLoading&&!(null==E?void 0:E.length)&&!I.error&&zt.jsx(_h,{sx:{mt:40},hasSearch:!!(n&&!a||g||y)}),!!I.error&&zt.jsx(Kh,{refresh:I.refetch,sx:{mt:40}}),zt.jsx(jm,{lqList:E,setOperatePool:r,supportAMM:s||d})]})}):zt.jsxs(zt.Fragment,{children:[zt.jsx(wm,{lqList:E,operatePool:i,setOperatePool:r,hasMore:T,loadMoreLoading:I.isFetchingNextPage,loadMore:()=>{I.hasNextPage&&!I.isFetching&&I.fetchNextPage()},supportAMM:s||d}),zt.jsx($h,{loading:I.isLoading,refetch:I.error?I.refetch:void 0,empty:!(null==E?void 0:E.length),hasSearch:!!(n&&!a||g||y)})]})]})}function km({onClick:e,title:t,desc:n}){const o=y();return zt.jsx(x,{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:zt.jsxs(M,{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:[zt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:o.palette.text.primary,textAlign:"left"},children:t}),zt.jsx(x,{sx:{typography:"h6",fontWeight:500,color:o.palette.text.secondary,textAlign:"left"},children:n})]})})}const Rm=e=>{const t=y(),{isMobile:o}=Rc(),{supportAMMV2:i,supportAMMV3:r,notSupportPMM:l}=Vr(),[a,s]=G.useState(!1),d={[Uc.CreatePool]:!l,[Uc.createPoolAMMV2]:!!i,[Uc.createPoolAMMV3]:!!r},c=Object.entries(d).filter((([e,t])=>!0===t)),u=1===c.length?c[0][0]:void 0;if(!u){const e=zt.jsxs(zt.Fragment,{children:[!l&&zt.jsx(km,{onClick:()=>{Hc.getState().push({type:Uc.CreatePool})},title:zt.jsx(n,{id:"Eif7f6",message:"PMM Pool"}),desc:zt.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})}),i&&zt.jsx(km,{onClick:()=>{Hc.getState().push({type:Uc.createPoolAMMV2})},title:zt.jsx(n,{id:"lNYomJ",message:"AMM V2 Position"}),desc:zt.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})}),r&&zt.jsx(km,{onClick:()=>{Hc.getState().push({type:Uc.createPoolAMMV3})},title:zt.jsx(n,{id:"sVlqoo",message:"AMM V3 Position"}),desc:zt.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})})]});return o?zt.jsxs(zt.Fragment,{children:[zt.jsxs(b,{variant:b.Variant.outlined,fullWidth:o,onClick:()=>{s(!0)},sx:{height:40},children:[zt.jsx(x,{component:Wt.Plus,sx:{mr:4}}),zt.jsx(n,{id:"p2jbcE",message:"Create Pool"})]}),zt.jsx(tc,{open:a,title:zt.jsx(n,{id:"p2jbcE",message:"Create Pool"}),onClose:()=>{s(!1)},modal:!0,children:zt.jsx(x,{sx:{mb:0},children:e})})]}):zt.jsx(W,{arrow:!1,leaveDelay:300,placement:o?"bottom":"bottom-end",sx:{p:0,backgroundColor:"background.paper"},title:zt.jsx(x,{children:e}),children:zt.jsxs(x,{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:[zt.jsx(x,{component:Wt.Plus}),zt.jsx(n,{id:"p2jbcE",message:"Create Pool"})]})})}return zt.jsxs(b,{variant:b.Variant.outlined,fullWidth:o,onClick:()=>{Hc.getState().push({type:u})},sx:{height:40},children:[zt.jsx(x,{component:Wt.Plus,sx:{mr:4}}),zt.jsx(n,{id:"p2jbcE",message:"Create Pool"})]})};const Sm=({onlyV3:e,setOnlyV3:t,sx:n})=>{const i=y(),{notSupportPMM:r}=Vr();return zt.jsx(x,{component:M,onClick:()=>t(!e),sx:Object.assign({display:"flex",alignItems:"center",p:2,borderRadius:8,backgroundColor:i.palette.border.main},n),children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center",width:"100%",[i.breakpoints.up("tablet")]:{width:194}},children:[zt.jsx(x,{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"})}),zt.jsx(x,{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 Im({account:e,lqList:t,setOperatePool:o,supportAMM:i}){const r=y();return zt.jsx(zt.Fragment,{children:null==t?void 0:t.map((t=>{var l,a,s,d,c,u,p,h,m,g,y,v,j,w;if(!(null==t?void 0:t.pair))return null;const C=t.pair,k=Ep(C.baseToken,C.chainId),R=Ep(C.quoteToken,C.chainId),S=f.utils.singleSideLp(C.type),I=C.apy?al(new ie(null===(l=C.apy)||void 0===l?void 0:l.transactionBaseApy).plus(null!==(s=null===(a=C.apy)||void 0===a?void 0:a.miningBaseApy)&&void 0!==s?s:0)):"0%",E=S&&C.apy?al(new ie(C.apy.transactionQuoteApy).plus(null!==(d=C.apy.miningQuoteApy)&&void 0!==d?d:0)):void 0;let M,T;(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 l=null===(t=e.id)||void 0===t?void 0:t.split("-");if(2===(null==l?void 0:l.length)){const t=l[1].toLocaleLowerCase();if((null===(o=null===(n=null==C?void 0:C.baseLpToken)||void 0===n?void 0:n.id)||void 0===o?void 0:o.toLocaleLowerCase())===t)return void(M=new ie(e.liquidityTokenBalance));(null===(r=null===(i=null==C?void 0:C.quoteLpToken)||void 0===i?void 0:i.id)||void 0===r?void 0:r.toLocaleLowerCase())===t&&(T=new ie(e.liquidityTokenBalance))}}}));const O=!!(null===(u=C.miningAddress)||void 0===u?void 0:u[0]),V=null===(p=t.liquidityPositions)||void 0===p?void 0:p[0],F=C.type,A=Lp(F),Z="SVM_AMMV2"===F,P="SVM_AMMV3"===F;return zt.jsx(x,{sx:{p:8,borderRadius:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"border.disabled",backdropFilter:"blur(5px)"},children:zt.jsxs(x,{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||Hc.getState().push({type:Uc.PoolDetail,params:{chainId:C.chainId,address:C.id}})},children:[zt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap"},children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8},children:[k&&R?zt.jsx(uu,{tokens:[k,R],width:24,mr:6,chainId:C.chainId,showChainLogo:!0}):"",zt.jsxs(x,{sx:{typography:"body2",fontWeight:600},children:[`${null==k?void 0:k.symbol}/${null==R?void 0:R.symbol}`,zt.jsx(tm,{address:C.id,chainId:C.chainId})]})]}),O?zt.jsxs(x,{sx:{p:8,typography:"h6",fontWeight:"bold",background:`linear-gradient(180deg, ${L(r.palette.secondary.main,.3)} 0%, ${L(r.palette.purple.main,.3)} 100%)`,borderRadius:8,color:"purple.main",whiteSpace:"nowrap"},children:["✨ ",zt.jsx(n,{id:"Sti4vy",message:"Mining"})]}):""]}),zt.jsxs(x,{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&&zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,whiteSpace:"nowrap"},children:[A,zt.jsx(W,{title:zt.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:zt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Op({type:C.type,lpFeeRate:null!==(h=C.lpFeeRate)&&void 0!==h?h:0,mtFeeRate:null!==(m=C.mtFeeRate)&&void 0!==m?m:0})})})]}),zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"1Qz63U",message:"Pool Type"})})]}),P?null:zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{children:[zt.jsxs(x,{sx:{typography:"h5",color:"success.main"},children:[I,E?`/${E}`:""]}),zt.jsxs(x,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:[zt.jsx(n,{id:"rSayea",message:"APY"}),zt.jsx(xm,{chainId:C.chainId,apy:C.apy,baseToken:k,quoteToken:R,hasQuote:!!E,hasMining:O,sx:{width:14,height:14}})]})]}),zt.jsxs(x,{children:[zt.jsxs(x,{sx:{typography:"h5"},children:["$",rl(new ie(C.tvl||0))]}),zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"FHKsZF",message:"TVL"})})]})]}),Z&&zt.jsxs(x,{children:[zt.jsx(x,{sx:{typography:"h5"},children:ll({input:null===(y=null===(g=t.liquidityPositions)||void 0===g?void 0:g[0])||void 0===y?void 0:y.poolShare})}),zt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:zt.jsx(n,{id:"h3PbRN",message:"My Pool Share"})})]}),zt.jsxs(x,{children:[zt.jsx(x,{sx:{typography:"h5",display:"flex",alignItems:"center",fontWeight:"bold"},children:P?(null==V?void 0:V.liquidityUSD)?`$${_r({input:V.liquidityUSD,decimals:2})}`:"-":zt.jsxs(zt.Fragment,{children:[S?zt.jsx(Ss,{address:null==k?void 0:k.address,chainId:C.chainId,url:null==k?void 0:k.logoURI,width:18,height:18,sx:{mr:4}}):zt.jsx(uu,{tokens:k&&R?[k,R]:[],width:18,mr:4,showChainLogo:!1,chainId:C.chainId}),M?Gr({input:M}):"",S&&zt.jsxs(zt.Fragment,{children:[" / ",zt.jsx(Ss,{address:null==R?void 0:R.address,chainId:C.chainId,url:null==R?void 0:R.logoURI,width:18,height:18,sx:{mx:4}}),T?Gr({input:T}):"0"]})]})}),zt.jsx(x,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:zt.jsx(n,{id:"YHc3B+",message:"My Liquidity"})})]}),P&&zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,color:"text.primary"},children:[zt.jsx(Th,{outOfRange:null!==(v=null==V?void 0:V.outOfRange)&&void 0!==v&&v}),zt.jsx(x,{children:zt.jsxs(zt.Fragment,{children:[zt.jsxs("span",{children:[Fp({price:null===(j=null==V?void 0:V.priceRange)||void 0===j?void 0:j.token0LowerPrice,atLimit:{},direction:Fu.LOWER})," "]}),null==k?void 0:k.symbol]})}),zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:zt.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"})}),zt.jsx(x,{children:zt.jsxs(zt.Fragment,{children:[zt.jsxs("span",{children:[Fp({price:null===(w=null==V?void 0:V.priceRange)||void 0===w?void 0:w.token1LowerPrice,atLimit:{},direction:Fu.UPPER})," "]}),null==k?void 0:k.symbol]})})]}),zt.jsx(x,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:zt.jsx(n,{id:"YA4hwj",message:"Price Range"})})]})]}),zt.jsxs(x,{sx:{mt:20,display:"flex",gap:"8px"},children:[P?null:!!e&&zt.jsx(hc,{fullWidth:!0,variant:b.Variant.outlined,size:b.Size.small,onClick:e=>{e.stopPropagation(),o({operate:Vh.Remove,pool:Tp(t),hasMining:O})},children:zt.jsx(n,{id:"t/YqKh",message:"Remove"})}),zt.jsx(hc,{fullWidth:!0,size:b.Size.small,onClick:e=>{e.stopPropagation(),o({operate:Vh.Add,pool:Tp(t),hasMining:O})},children:zt.jsx(n,{id:"J/hVSQ",message:"{0}",values:{0:P?"Manage":"Add"}})}),i&&"PMM"===A&&zt.jsx(mm,{chainId:C.chainId,address:C.id})]})]})},P?null==V?void 0:V.id:C.id+C.chainId)}))})}function Em({account:e,lqList:t,operatePool:i,setOperatePool:r,supportAMM:l,onlyV3:a}){const s=y();return zt.jsxs(fm,{children:[zt.jsx(x,{component:"thead",children:zt.jsxs(x,{component:"tr",children:[zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"AxdOHo",message:"Pair"})}),l&&zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"1Qz63U",message:"Pool Type"})}),a?null:zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"FHKsZF",message:"TVL"})}),a?null:zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"rSayea",message:"APY"})}),zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"YHc3B+",message:"My Liquidity"})}),a?zt.jsx(x,{component:"th",children:zt.jsx(n,{id:"YA4hwj",message:"Price Range"})}):null,zt.jsx(x,{component:"th",sx:{width:210}})]})}),zt.jsx(x,{component:"tbody",children:null==t?void 0:t.map((t=>{var d,c,u,p,h,m,g,y,v,j,w,C,k,R,S,I,E,M;if(!(null==t?void 0:t.pair))return null;const T=t.pair,L=Ep(T.baseToken,T.chainId),O=Ep(T.quoteToken,T.chainId),V=f.utils.singleSideLp(T.type),F=T.apy?al(new ie(null===(d=T.apy)||void 0===d?void 0:d.transactionBaseApy).plus(null!==(u=null===(c=T.apy)||void 0===c?void 0:c.miningBaseApy)&&void 0!==u?u:0)):void 0,A=V&&T.apy?al(new ie(T.apy.transactionQuoteApy).plus(null!==(p=T.apy.miningQuoteApy)&&void 0!==p?p:0)):void 0;let Z,P;(null===(h=t.liquidityPositions)||void 0===h?void 0:h.length)&&t.liquidityPositions.forEach((e=>{var t,n,o,i,r;if(null==e?void 0:e.liquidityTokenBalance){const l=null===(t=e.id)||void 0===t?void 0:t.split("-");if(2===(null==l?void 0:l.length)){const t=l[1].toLocaleLowerCase();if((null===(o=null===(n=null==T?void 0:T.baseLpToken)||void 0===n?void 0:n.id)||void 0===o?void 0:o.toLocaleLowerCase())===t)return void(Z=new ie(e.liquidityTokenBalance));(null===(r=null===(i=null==T?void 0:T.quoteLpToken)||void 0===i?void 0:i.id)||void 0===r?void 0:r.toLocaleLowerCase())===t&&(P=new ie(e.liquidityTokenBalance))}}}));const B=null===(m=t.liquidityPositions)||void 0===m?void 0:m[0],N=T.type,U=Lp(N),H="SVM_AMMV2"===N,D="SVM_AMMV3"===N;let Y="";if(D)(null===(v=null===(y=null===(g=null==i?void 0:i.pool)||void 0===g?void 0:g.liquidityPositions)||void 0===y?void 0:y[0])||void 0===v?void 0:v.id)===(null==B?void 0:B.id)&&(Y=o._({id:"p3607o",message:"Managing"}));else if((null===(j=null==i?void 0:i.pool)||void 0===j?void 0:j.address)===T.id||(null==i?void 0:i.address)===T.id)if(i.operate===Vh.Remove)Y=o._({id:"0+31GV",message:"Removing"});else Y=o._({id:"1yHVE+",message:"Adding"});const z=!!(null===(w=T.miningAddress)||void 0===w?void 0:w[0]),X=s.palette.background.tag;return zt.jsxs(x,{component:"tr",sx:{["&:hover td"+(Y?", & td":"")]:{backgroundImage:`linear-gradient(${X}, ${X})`}},children:[zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[L&&O?zt.jsx(uu,{tokens:[L,O],width:24,mr:10,chainId:T.chainId,showChainLogo:!0}):"",zt.jsxs(x,{children:[zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[`${null==L?void 0:L.symbol}/${null==O?void 0:O.symbol}`,zt.jsx(tm,{address:T.id,chainId:T.chainId})]}),zt.jsx(du,{address:T.id,customChainId:T.chainId,truncate:!0,showCopy:!0,iconDarkHover:!0,iconSize:14,iconSpace:4,disabledAddress:l,onAddressClick:()=>{Hc.getState().push({type:Uc.PoolDetail,params:{chainId:T.chainId,address:T.id}})},sx:{typography:"h6",color:"text.secondary"}})]})]})}),l&&zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[zt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary",whiteSpace:"nowrap"},children:U}),zt.jsx(W,{title:zt.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:zt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Op({type:T.type,lpFeeRate:null!==(C=T.lpFeeRate)&&void 0!==C?C:0,mtFeeRate:null!==(k=T.mtFeeRate)&&void 0!==k?k:0})})})]})}),D?null:zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{typography:"body2"},title:T.tvl?`$${Gr({input:T.tvl||0})}`:void 0,children:["$",rl(new ie(T.tvl||0))]})}),D?null:zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[z?zt.jsx(W,{title:o._({id:"Sti4vy",message:"Mining"}),children:zt.jsxs(x,{component:"span",sx:{typography:"body2",color:"success.main"},children:["✨"," "]})}):"",zt.jsx(xm,{chainId:T.chainId,apy:T.apy,baseToken:L,quoteToken:O,hasQuote:!!A,hasMining:z,children:zt.jsxs(x,{component:"span",sx:{typography:"body2",fontWeight:600,display:"flex",alignItems:"center",width:"max-content",color:"success.main",cursor:"auto"},children:[F||"0%",A?`/${A}`:""]})})]})}),zt.jsx(x,{component:"td",children:zt.jsx(x,{sx:{display:"flex",alignItems:"center"},children:D?(null==B?void 0:B.liquidityUSD)?`$${_r({input:B.liquidityUSD,decimals:2})}`:"-":zt.jsxs(zt.Fragment,{children:[V?zt.jsx(Ss,{address:null==L?void 0:L.address,chainId:T.chainId,url:null==L?void 0:L.logoURI,width:24,height:24,noShowChain:!0,sx:{mr:4}}):zt.jsx(uu,{tokens:L&&O?[L,O]:[],width:24,mr:4,showChainLogo:!1,chainId:T.chainId}),Z?Gr({input:Z}):"-",V&&zt.jsxs(zt.Fragment,{children:[" / ",zt.jsx(Ss,{address:null==O?void 0:O.address,chainId:T.chainId,url:null==O?void 0:O.logoURI,width:24,height:24,noShowChain:!0,sx:{mx:4}}),P?Gr({input:P}):"0"]}),H&&zt.jsx(W,{title:zt.jsx(n,{id:"NXZdrO",message:"My pool share"}),children:zt.jsx(x,{sx:{ml:4,px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:ll({input:null===(S=null===(R=t.liquidityPositions)||void 0===R?void 0:R[0])||void 0===S?void 0:S.poolShare})})})]})})}),a?zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,color:"text.primary"},children:[zt.jsx(Th,{outOfRange:null!==(I=null==B?void 0:B.outOfRange)&&void 0!==I&&I}),zt.jsx(x,{children:zt.jsxs(zt.Fragment,{children:[zt.jsxs("span",{children:[Fp({price:null===(E=null==B?void 0:B.priceRange)||void 0===E?void 0:E.token0LowerPrice,atLimit:{},direction:Fu.LOWER})," "]}),null==L?void 0:L.symbol]})}),zt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:zt.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"})}),zt.jsx(x,{children:zt.jsxs(zt.Fragment,{children:[zt.jsxs("span",{children:[Fp({price:null===(M=null==B?void 0:B.priceRange)||void 0===M?void 0:M.token0UpperPrice,atLimit:{},direction:Fu.UPPER})," "]}),null==L?void 0:L.symbol]})})]})}):null,zt.jsx(x,{component:"td",children:zt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[l&&"PMM"===U&&zt.jsx(mm,{chainId:T.chainId,address:T.id}),Y?zt.jsx(um,{text:Y,onClick:()=>r(null)}):zt.jsxs(zt.Fragment,{children:[D?null:!!e&&zt.jsx(hc,{variant:b.Variant.outlined,size:b.Size.small,onClick:e=>{e.stopPropagation(),r({operate:Vh.Remove,pool:Tp(t),hasMining:z})},children:zt.jsx(n,{id:"t/YqKh",message:"Remove"})}),zt.jsx(hc,{size:b.Size.small,onClick:()=>{r({pool:Tp(t),hasMining:z})},children:D?o._({id:"wckWOP",message:"Manage"}):o._({id:"m16xKo",message:"Add"})})]})]})})]},D?null==B?void 0:B.id:T.id+T.chainId)}))})]})}function Mm({account:e,filterChainIds:t,activeChainId:n,handleChangeActiveChainId:o,operatePool:i,setOperatePool:r}){var l,a,s,d,c,u,p;y();const{minDevice:h,isMobile:m}=Rc(),g=je(),{onlyChainId:v,supportAMMV2:b,supportAMMV3:j,notSupportPMM:w}=Vr(),[C,k]=G.useState(!1),{filterTokens:R,filterASymbol:S,filterBSymbol:I,filterAddressLqList:E,handleDeleteToken:M,handleChangeFilterTokens:T,handleChangeFilterAddress:L}=bm();let O=[];b&&O.push("SVM_AMMV2"),j&&C&&(O=["SVM_AMMV3"]);const W={currentPage:1,pageSize:1e3,user:e,filterState:{viewOnlyOwn:!0,filterTypes:O}},V=Ql(),F=V.getQuery(f.graphql.fetchMyLiquidityList,{where:Object.assign(Object.assign({},W),{filterState:Object.assign({filterASymbol:S,filterBSymbol:I},W.filterState)})}),A=we(Object.assign({},F));let Z=null!==(s=null===(a=null===(l=A.data)||void 0===l?void 0:l.liquidity_list)||void 0===a?void 0:a.lqList)&&void 0!==s?s:[];const P=!!(null==E?void 0:E.length);P?Z=[...E]:t&&(Z=null!==(p=null===(u=null===(c=null===(d=A.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!==p?p:[]);return zt.jsxs(zt.Fragment,{children:[zt.jsxs(x,{sx:Object.assign(Object.assign({py:16,display:"flex",gap:8},h(475)?{}:{flexDirection:"column"}),m?{}:{px:20,borderBottomWidth:1}),children:[zt.jsxs(x,{sx:Object.assign(Object.assign({display:"flex",alignItems:"center",gap:8},h(475)?{}:{"& > button":{flex:1,flexBasis:"100%"}}),m?{flexWrap:"wrap"}:{}),children:[!v&&zt.jsx(cm,{chainId:n,setChainId:o}),j&&zt.jsx(Sm,{onlyV3:C,setOnlyV3:k,sx:m?{flexGrow:1,flexBasis:"100%"}:void 0}),zt.jsx(ym,{value:R,onChange:T,searchAddress:(e,t)=>Lr(this,void 0,void 0,(function*(){var n;const o=V.getInfiniteQuery(f.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},W),{filterState:Object.assign({address:e},W.filterState)})}),i=null===(n=(yield g.fetchQuery(o)).liquidity_list)||void 0===n?void 0:n.lqList;return(null==i?void 0:i.length)?zt.jsx(vm,{list:i,onClick:()=>{L(i),t()}}):null}))})]}),(P||!!R.length)&&zt.jsxs(x,{sx:{my:0},children:[P?zt.jsx(pm,{lqList:E,onDeleteTag:()=>L([])}):"",zt.jsx(hm,{tags:R,onDeleteTag:M})]})]}),m?zt.jsxs(em,{gap:12,children:[A.isLoading?zt.jsx(gm,{}):"",!A.isLoading&&!(null==Z?void 0:Z.length)&&!A.error&&zt.jsx(_h,{sx:{mt:40},hasSearch:!!(n&&!v||S||I)}),!!A.error&&zt.jsx(Kh,{refresh:A.refetch,sx:{mt:40}}),zt.jsx(Im,{account:e,lqList:Z,setOperatePool:r,supportAMM:b||j})]}):zt.jsxs(zt.Fragment,{children:[zt.jsx(Em,{account:e,lqList:Z,operatePool:i,setOperatePool:r,supportAMM:b||j,onlyV3:C}),zt.jsx($h,{loading:A.isLoading,refetch:A.error?A.refetch:void 0,empty:!(null==Z?void 0:Z.length),hasSearch:!!(n&&!v||S||I)})]})]})}var Tm,Lm;function Om(){return Om=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},Om.apply(null,arguments)}const Wm=e=>q.createElement("svg",Om({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),Tm||(Tm=q.createElement("rect",{width:64,height:60.1342,fill:"url(#pattern0)"})),Lm||(Lm=q.createElement("defs",null,q.createElement("pattern",{id:"pattern0",patternContentUnits:"objectBoundingBox",width:1,height:1},q.createElement("use",{xlinkHref:"#image0_2465_53170",transform:"matrix(0.00671141 0 0 0.00714286 -0.503356 -0.9)"})),q.createElement("image",{id:"image0_2465_53170",width:300,height:300,xlinkHref:"data:image/png;base64,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"}))));function Vm(e){var{sx:t}=e,n=Tr(e,["sx"]);return zt.jsx(D,{...n,sx:Object.assign(Object.assign({},t),{display:"flex",flexDirection:"column",overflow:"hidden"})})}function Fm({params:t}){var n,r,l;const{isMobile:a}=Rc(),s=Vr((e=>e.noDocumentLink)),d=G.useRef(null),{account:c}=Ar(),{poolTab:u,tabs:p,handleChangePoolTab:h}=function({account:t,paramsTab:n}){const{i18n:o}=e(),[i,r]=G.useState(nu.addLiquidity),{supportAMMV2:l,supportAMMV3:a,notSupportPMM:s}=Vr(),d=G.useMemo((()=>{const e=[{key:nu.addLiquidity,value:o._({id:"OBdohg",message:"Add Liquidity"})},{key:nu.myLiquidity,value:o._({id:"YHc3B+",message:"My Liquidity"})}];return s||e.push({key:nu.myCreated,value:l||a?o._({id:"zcVtwU",message:"My Pools (PMM)"}):o._({id:"fZFkP1",message:"My Pools"})}),e}),[o._,l,a,s]),c=G.useRef(!1);G.useEffect((()=>{const e=sessionStorage.getItem(eu);t&&e&&!c.current&&(c.current=!0,r(e))}),[t]);const u=e=>{r(e),sessionStorage.setItem(eu,e)};return G.useEffect((()=>{n&&u(n)}),[n]),{poolTab:i,tabs:d,handleChangePoolTab:u}}({account:c,paramsTab:null==t?void 0:t.tab}),{activeChainId:m,filterChainIds:f,handleChangeActiveChainId:g}=function(){const{chainId:e}=Ar(),{onlyChainId:t}=Vr(),[n,o]=G.useState(t),r=G.useMemo((()=>void 0!==n?[n]:Rs(e)?void 0:Object.values(i).filter((e=>!!Number(e)))),[e,n]);return G.useEffect((()=>{const e=sessionStorage.getItem(tu);e&&o(Number(e))}),[]),{activeChainId:n,filterChainIds:r,handleChangeActiveChainId:e=>{void 0===e?sessionStorage.removeItem(tu):sessionStorage.setItem(tu,String(e)),o(e)}}}(),[y,v]=G.useState(null);return zt.jsxs(Xc,{sx:Object.assign({},a?{p:20}:{display:"flex",gap:12,flex:1}),ref:d,children:[zt.jsx(x,{sx:a?{}:{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:zt.jsxs(U,{value:u,onChange:(e,t)=>{h(t)},sx:a?{}:{display:"flex",flexDirection:"column",borderRadius:16,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"background.paper"},className:a?void 0:"gradient-card-border",children:[zt.jsxs(x,{sx:a?{}:{display:"flex",justifyContent:"space-between",p:20,borderBottomWidth:1},children:[zt.jsx(z,{tabs:p,variant:"rounded",tabsListSx:Object.assign({},a?{mb:16}:{borderBottomWidth:0,justifyContent:"space-between"}),tabSx:a?void 0:{mb:0}}),zt.jsx(Rm,{})]}),zt.jsx(Vm,{value:nu.addLiquidity,sx:{display:"flex",flexDirection:"column",overflow:"hidden"},children:zt.jsx(Cm,{account:c,filterChainIds:f,scrollParentRef:d,activeChainId:m,handleChangeActiveChainId:g,operatePool:y,setOperatePool:v})}),zt.jsx(Vm,{value:nu.myLiquidity,children:zt.jsx(Mm,{account:c,filterChainIds:f,activeChainId:m,handleChangeActiveChainId:g,operatePool:y,setOperatePool:v})})]})}),zt.jsxs(x,{sx:{position:"relative",width:s&&!y?"auto":375},children:[!s&&zt.jsx(xh,{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:Wm}),"SVM_AMMV3"===(null===(n=null==y?void 0:y.pool)||void 0===n?void 0:n.type)&&y.pool.chainId?u===nu.myLiquidity&&(null===(l=null===(r=y.pool.liquidityPositions)||void 0===r?void 0:r[0])||void 0===l?void 0:l.nftMint)?zt.jsx(Mh,{mint1Address:y.pool.baseToken.address,mint2Address:y.pool.quoteToken.address,feeAmount:Number(y.pool.lpFeeRate),poolId:y.pool.address,nftMint:y.pool.liquidityPositions[0].nftMint,onClose:()=>v(null)}):zt.jsx(Oh,{mint1Address:y.pool.baseToken.address,mint2Address:y.pool.quoteToken.address,feeAmount:Number(y.pool.lpFeeRate),poolId:y.pool.address,onClose:()=>v(null),handleGoToAddLiquidityV3:e=>{Hc.getState().push({type:Uc.createPoolAMMV3,params:e})}}):a?zt.jsx(Yh,{account:c,onClose:()=>v(null),modal:a,pool:null==y?void 0:y.pool,operate:null==y?void 0:y.operate,hasMining:!1,hidePoolInfo:!1}):!!y&&zt.jsx(Dh,{account:c,onClose:()=>v(null),pool:null==y?void 0:y.pool,operate:null==y?void 0:y.operate,hasMining:!1,hidePoolInfo:!1,sx:{width:375,height:"max-content",backgroundColor:"background.paper",borderRadius:16,overflow:"hidden"}})]})]})}function Am(){const{routerPage:e}=Vr(),t=Hc((e=>e.page)),n=null!=e?e:t;switch(null==n?void 0:n.type){case Uc.Pool:return zt.jsx(Fm,{params:n.params});case Uc.createPoolAMMV2:return zt.jsx(ju,{});case Uc.createPoolAMMV3:return zt.jsx(gh,{params:n.params,handleGoBack:()=>{Hc.getState().push({type:Uc.Pool})},handleGoToPoolList:()=>{Hc.getState().push({type:Uc.Pool})}});default:return zt.jsx(Fm,{params:null==n?void 0:n.params})}}export{ju as AMMV2Create,Mh as AMMV3PositionManage,Oh as AMMV3PositionsView,gh as AddLiquidityV3,Pr as MetadataFlag,Uc as PageType,Am as Pool,Fm as PoolList,Nc as Swap,cc as UnstyleWidget,uc as Widget,Hc as useRouterStore};
|