@cetusprotocol/terminal 1.0.1 → 1.0.2
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/cetus-swap.cjs.js +2 -2
- package/dist/cetus-swap.cjs.js.gz +0 -0
- package/dist/cetus-swap.es.js +25 -17
- package/dist/cetus-swap.es.js.gz +0 -0
- package/dist/cetus-swap.umd.js +2 -2
- package/dist/cetus-swap.umd.js.gz +0 -0
- package/dist/hooks/useSuiClient.d.ts +2 -1
- package/dist/types/config.d.ts +2 -0
- package/package.json +1 -1
package/dist/cetus-swap.cjs.js
CHANGED
|
@@ -99,7 +99,7 @@ body { background-color: var(--color-page-background); }
|
|
|
99
99
|
`)},nm=function(){var e=parseInt(document.body.getAttribute(xo)||"0",10);return isFinite(e)?e:0},yI=function(){R.useEffect(function(){return document.body.setAttribute(xo,(nm()+1).toString()),function(){var e=nm()-1;e<=0?document.body.removeAttribute(xo):document.body.setAttribute(xo,e.toString())}},[])},wI=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;yI();var s=R.useMemo(function(){return gI(i)},[i]);return R.createElement(bI,{styles:vI(s,!t,i,r?"":"!important")})},bf=!1;if(typeof window<"u")try{var pc=Object.defineProperty({},"passive",{get:function(){return bf=!0,!0}});window.addEventListener("test",pc,pc),window.removeEventListener("test",pc,pc)}catch{bf=!1}var io=bf?{passive:!1}:!1,xI=function(e){return e.tagName==="TEXTAREA"},gy=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!xI(e)&&r[t]==="visible")},SI=function(e){return gy(e,"overflowY")},_I=function(e){return gy(e,"overflowX")},im=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=by(e,n);if(i){var s=vy(e,n),o=s[1],a=s[2];if(o>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},EI=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},CI=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},by=function(e,t){return e==="v"?SI(t):_I(t)},vy=function(e,t){return e==="v"?EI(t):CI(t)},TI=function(e,t){return e==="h"&&t==="rtl"?-1:1},MI=function(e,t,r,n,i){var s=TI(e,window.getComputedStyle(t).direction),o=s*n,a=r.target,c=t.contains(a),l=!1,u=o>0,f=0,p=0;do{var y=vy(e,a),x=y[0],v=y[1],C=y[2],I=v-C-s*x;(x||I)&&by(e,a)&&(f+=I,p+=x),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(u&&(i&&Math.abs(f)<1||!i&&o>f)||!u&&(i&&Math.abs(p)<1||!i&&-o>p))&&(l=!0),l},mc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},sm=function(e){return[e.deltaX,e.deltaY]},om=function(e){return e&&"current"in e?e.current:e},AI=function(e,t){return e[0]===t[0]&&e[1]===t[1]},II=function(e){return`
|
|
100
100
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
101
101
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
102
|
-
`)},OI=0,so=[];function RI(e){var t=R.useRef([]),r=R.useRef([0,0]),n=R.useRef(),i=R.useState(OI++)[0],s=R.useState(my)[0],o=R.useRef(e);R.useEffect(function(){o.current=e},[e]),R.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var v=ZA([e.lockRef.current],(e.shards||[]).map(om),!0).filter(Boolean);return v.forEach(function(C){return C.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),v.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=R.useCallback(function(v,C){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var I=mc(v),O=r.current,j="deltaX"in v?v.deltaX:O[0]-I[0],U="deltaY"in v?v.deltaY:O[1]-I[1],D,H=v.target,q=Math.abs(j)>Math.abs(U)?"h":"v";if("touches"in v&&q==="h"&&H.type==="range")return!1;var G=im(q,H);if(!G)return!0;if(G?D=q:(D=q==="v"?"h":"v",G=im(q,H)),!G)return!1;if(!n.current&&"changedTouches"in v&&(j||U)&&(n.current=D),!D)return!0;var re=n.current||D;return MI(re,C,v,re==="h"?j:U,!0)},[]),c=R.useCallback(function(v){var C=v;if(!(!so.length||so[so.length-1]!==s)){var I="deltaY"in C?sm(C):mc(C),O=t.current.filter(function(D){return D.name===C.type&&(D.target===C.target||C.target===D.shadowParent)&&AI(D.delta,I)})[0];if(O&&O.should){C.cancelable&&C.preventDefault();return}if(!O){var j=(o.current.shards||[]).map(om).filter(Boolean).filter(function(D){return D.contains(C.target)}),U=j.length>0?a(C,j[0]):!o.current.noIsolation;U&&C.cancelable&&C.preventDefault()}}},[]),l=R.useCallback(function(v,C,I,O){var j={name:v,delta:C,target:I,should:O,shadowParent:PI(I)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(U){return U!==j})},1)},[]),u=R.useCallback(function(v){r.current=mc(v),n.current=void 0},[]),f=R.useCallback(function(v){l(v.type,sm(v),v.target,a(v,e.lockRef.current))},[]),p=R.useCallback(function(v){l(v.type,mc(v),v.target,a(v,e.lockRef.current))},[]);R.useEffect(function(){return so.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,io),document.addEventListener("touchmove",c,io),document.addEventListener("touchstart",u,io),function(){so=so.filter(function(v){return v!==s}),document.removeEventListener("wheel",c,io),document.removeEventListener("touchmove",c,io),document.removeEventListener("touchstart",u,io)}},[]);var y=e.removeScrollBar,x=e.inert;return R.createElement(R.Fragment,null,x?R.createElement(s,{styles:II(i)}):null,y?R.createElement(wI,{gapMode:e.gapMode}):null)}function PI(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const jI=aI(py,RI);var yy=R.forwardRef(function(e,t){return R.createElement(cu,ei({},e,{ref:t,sideCar:jI}))});yy.classNames=cu.classNames;const NI=yy;function kI(e,t){return R.useReducer((r,n)=>t[r][n]??r,e)}var W0="ScrollArea",[wy,LU]=Vi(W0),[DI,xn]=wy(W0),xy=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=e,[a,c]=R.useState(null),[l,u]=R.useState(null),[f,p]=R.useState(null),[y,x]=R.useState(null),[v,C]=R.useState(null),[I,O]=R.useState(0),[j,U]=R.useState(0),[D,H]=R.useState(!1),[q,G]=R.useState(!1),re=Kt(t,ne=>c(ne)),ae=$0(i);return w.jsx(DI,{scope:r,type:n,dir:ae,scrollHideDelay:s,scrollArea:a,viewport:l,onViewportChange:u,content:f,onContentChange:p,scrollbarX:y,onScrollbarXChange:x,scrollbarXEnabled:D,onScrollbarXEnabledChange:H,scrollbarY:v,onScrollbarYChange:C,scrollbarYEnabled:q,onScrollbarYEnabledChange:G,onCornerWidthChange:O,onCornerHeightChange:U,children:w.jsx(Yt.div,{dir:ae,...o,ref:re,style:{position:"relative","--radix-scroll-area-corner-width":I+"px","--radix-scroll-area-corner-height":j+"px",...e.style}})})});xy.displayName=W0;var Sy="ScrollAreaViewport",_y=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=e,o=xn(Sy,r),a=R.useRef(null),c=Kt(t,a,o.onViewportChange);return w.jsxs(w.Fragment,{children:[w.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),w.jsx(Yt.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:w.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});_y.displayName=Sy;var di="ScrollAreaScrollbar",Ey=R.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=xn(di,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=e.orientation==="horizontal";return R.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?w.jsx(LI,{...n,ref:t,forceMount:r}):i.type==="scroll"?w.jsx(BI,{...n,ref:t,forceMount:r}):i.type==="auto"?w.jsx(Cy,{...n,ref:t,forceMount:r}):i.type==="always"?w.jsx(H0,{...n,ref:t}):null});Ey.displayName=di;var LI=R.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=xn(di,e.__scopeScrollArea),[s,o]=R.useState(!1);return R.useEffect(()=>{const a=i.scrollArea;let c=0;if(a){const l=()=>{window.clearTimeout(c),o(!0)},u=()=>{c=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",l),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",l),a.removeEventListener("pointerleave",u)}}},[i.scrollArea,i.scrollHideDelay]),w.jsx($n,{present:r||s,children:w.jsx(Cy,{"data-state":s?"visible":"hidden",...n,ref:t})})}),BI=R.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=xn(di,e.__scopeScrollArea),s=e.orientation==="horizontal",o=uu(()=>c("SCROLL_END"),100),[a,c]=kI("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return R.useEffect(()=>{if(a==="idle"){const l=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(l)}},[a,i.scrollHideDelay,c]),R.useEffect(()=>{const l=i.viewport,u=s?"scrollLeft":"scrollTop";if(l){let f=l[u];const p=()=>{const y=l[u];f!==y&&(c("SCROLL"),o()),f=y};return l.addEventListener("scroll",p),()=>l.removeEventListener("scroll",p)}},[i.viewport,s,c,o]),w.jsx($n,{present:r||a!=="hidden",children:w.jsx(H0,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:tt(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:tt(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Cy=R.forwardRef((e,t)=>{const r=xn(di,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,o]=R.useState(!1),a=e.orientation==="horizontal",c=uu(()=>{if(r.viewport){const l=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?l:u)}},10);return Oo(r.viewport,c),Oo(r.content,c),w.jsx($n,{present:n||s,children:w.jsx(H0,{"data-state":s?"visible":"hidden",...i,ref:t})})}),H0=R.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=xn(di,e.__scopeScrollArea),s=R.useRef(null),o=R.useRef(0),[a,c]=R.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=Oy(a.viewport,a.content),u={...n,sizes:a,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:p=>o.current=p};function f(p,y){return qI(p,o.current,a,y)}return r==="horizontal"?w.jsx(UI,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollLeft,y=am(p,a,i.dir);s.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollLeft=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollLeft=f(p,i.dir))}}):r==="vertical"?w.jsx(FI,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollTop,y=am(p,a);s.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollTop=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollTop=f(p))}}):null}),UI=R.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=xn(di,e.__scopeScrollArea),[o,a]=R.useState(),c=R.useRef(null),l=Kt(t,c,s.onScrollbarXChange);return R.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),w.jsx(My,{"data-orientation":"horizontal",...i,ref:l,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":lu(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,f)=>{if(s.viewport){const p=s.viewport.scrollLeft+u.deltaX;e.onWheelScroll(p),Py(p,f)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:fl(o.paddingLeft),paddingEnd:fl(o.paddingRight)}})}})}),FI=R.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=xn(di,e.__scopeScrollArea),[o,a]=R.useState(),c=R.useRef(null),l=Kt(t,c,s.onScrollbarYChange);return R.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),w.jsx(My,{"data-orientation":"vertical",...i,ref:l,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":lu(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,f)=>{if(s.viewport){const p=s.viewport.scrollTop+u.deltaY;e.onWheelScroll(p),Py(p,f)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:fl(o.paddingTop),paddingEnd:fl(o.paddingBottom)}})}})}),[$I,Ty]=wy(di),My=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:f,...p}=e,y=xn(di,r),[x,v]=R.useState(null),C=Kt(t,re=>v(re)),I=R.useRef(null),O=R.useRef(""),j=y.viewport,U=n.content-n.viewport,D=Mr(u),H=Mr(c),q=uu(f,10);function G(re){if(I.current){const ae=re.clientX-I.current.left,ne=re.clientY-I.current.top;l({x:ae,y:ne})}}return R.useEffect(()=>{const re=ae=>{const ne=ae.target;(x==null?void 0:x.contains(ne))&&D(ae,U)};return document.addEventListener("wheel",re,{passive:!1}),()=>document.removeEventListener("wheel",re,{passive:!1})},[j,x,U,D]),R.useEffect(H,[n,H]),Oo(x,q),Oo(y.content,q),w.jsx($I,{scope:r,scrollbar:x,hasThumb:i,onThumbChange:Mr(s),onThumbPointerUp:Mr(o),onThumbPositionChange:H,onThumbPointerDown:Mr(a),children:w.jsx(Yt.div,{...p,ref:C,style:{position:"absolute",...p.style},onPointerDown:tt(e.onPointerDown,re=>{re.button===0&&(re.target.setPointerCapture(re.pointerId),I.current=x.getBoundingClientRect(),O.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),G(re))}),onPointerMove:tt(e.onPointerMove,G),onPointerUp:tt(e.onPointerUp,re=>{const ae=re.target;ae.hasPointerCapture(re.pointerId)&&ae.releasePointerCapture(re.pointerId),document.body.style.webkitUserSelect=O.current,y.viewport&&(y.viewport.style.scrollBehavior=""),I.current=null})})})}),dl="ScrollAreaThumb",Ay=R.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=Ty(dl,e.__scopeScrollArea);return w.jsx($n,{present:r||i.hasThumb,children:w.jsx(VI,{ref:t,...n})})}),VI=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,s=xn(dl,r),o=Ty(dl,r),{onThumbPositionChange:a}=o,c=Kt(t,f=>o.onThumbChange(f)),l=R.useRef(void 0),u=uu(()=>{l.current&&(l.current(),l.current=void 0)},100);return R.useEffect(()=>{const f=s.viewport;if(f){const p=()=>{if(u(),!l.current){const y=WI(f,a);l.current=y,a()}};return a(),f.addEventListener("scroll",p),()=>f.removeEventListener("scroll",p)}},[s.viewport,u,a]),w.jsx(Yt.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:tt(e.onPointerDownCapture,f=>{const y=f.target.getBoundingClientRect(),x=f.clientX-y.left,v=f.clientY-y.top;o.onThumbPointerDown({x,y:v})}),onPointerUp:tt(e.onPointerUp,o.onThumbPointerUp)})});Ay.displayName=dl;var G0="ScrollAreaCorner",Iy=R.forwardRef((e,t)=>{const r=xn(G0,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?w.jsx(zI,{...e,ref:t}):null});Iy.displayName=G0;var zI=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=xn(G0,r),[s,o]=R.useState(0),[a,c]=R.useState(0),l=!!(s&&a);return Oo(i.scrollbarX,()=>{var f;const u=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(u),c(u)}),Oo(i.scrollbarY,()=>{var f;const u=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(u),o(u)}),l?w.jsx(Yt.div,{...n,ref:t,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function fl(e){return e?parseInt(e,10):0}function Oy(e,t){const r=e/t;return isNaN(r)?0:r}function lu(e){const t=Oy(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function qI(e,t,r,n="ltr"){const i=lu(r),s=i/2,o=t||s,a=i-o,c=r.scrollbar.paddingStart+o,l=r.scrollbar.size-r.scrollbar.paddingEnd-a,u=r.content-r.viewport,f=n==="ltr"?[0,u]:[u*-1,0];return Ry([c,l],f)(e)}function am(e,t,r="ltr"){const n=lu(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-i,o=t.content-t.viewport,a=s-n,c=r==="ltr"?[0,o]:[o*-1,0],l=UA(e,c);return Ry([0,o],[0,a])(l)}function Ry(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function Py(e,t){return e>0&&e<t}var WI=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function i(){const s={left:e.scrollLeft,top:e.scrollTop},o=r.left!==s.left,a=r.top!==s.top;(o||a)&&t(),r=s,n=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(n)};function uu(e,t){const r=Mr(e),n=R.useRef(0);return R.useEffect(()=>()=>window.clearTimeout(n.current),[]),R.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Oo(e,t){const r=Mr(t);Li(()=>{let n=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return i.observe(e),()=>{window.cancelAnimationFrame(n),i.unobserve(e)}}},[e,r])}var HI=xy,GI=_y,cm=Ey,lm=Ay,KI=Iy,du="Switch",[YI,BU]=Vi(du),[JI,XI]=YI(du),jy=R.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:c="on",onCheckedChange:l,form:u,...f}=e,[p,y]=R.useState(null),x=Kt(t,j=>y(j)),v=R.useRef(!1),C=p?u||!!p.closest("form"):!0,[I,O]=Ha({prop:i,defaultProp:s??!1,onChange:l,caller:du});return w.jsxs(JI,{scope:r,checked:I,disabled:a,children:[w.jsx(Yt.button,{type:"button",role:"switch","aria-checked":I,"aria-required":o,"data-state":Ly(I),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:x,onClick:tt(e.onClick,j=>{O(U=>!U),C&&(v.current=j.isPropagationStopped(),v.current||j.stopPropagation())})}),C&&w.jsx(Dy,{control:p,bubbles:!v.current,name:n,value:c,checked:I,required:o,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});jy.displayName=du;var Ny="SwitchThumb",ky=R.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=XI(Ny,r);return w.jsx(Yt.span,{"data-state":Ly(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});ky.displayName=Ny;var ZI="SwitchBubbleInput",Dy=R.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...i},s)=>{const o=R.useRef(null),a=Kt(o,s),c=H2(r),l=L0(t);return R.useEffect(()=>{const u=o.current;if(!u)return;const f=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==r&&y){const x=new Event("click",{bubbles:n});y.call(u,r),u.dispatchEvent(x)}},[c,r,n]),w.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:a,style:{...i.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Dy.displayName=ZI;function Ly(e){return e?"checked":"unchecked"}var QI=jy,eO=ky;const tO=["1","2","3"],rO=["classic","surface","soft"],Xo={size:{type:"enum",values:tO,default:"2",responsive:!0},variant:{type:"enum",values:rO,default:"surface"},color:Ga,highContrast:iu,radius:z0},By=R.forwardRef((e,t)=>{const{rest:r,...n}=Ka(e),{className:i,style:s,size:o=Xo.size.default,variant:a=Xo.variant.default,color:c=Xo.color.default,highContrast:l=Xo.highContrast.default,radius:u=Xo.radius.default,...f}=r;return R.createElement("span",{"data-radius":u,className:ir("rt-SwitchRoot",i,Gr(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":l},Ya(n)),style:s},R.createElement(QI,{"data-accent-color":c,...f,ref:t,className:ir("rt-reset","rt-SwitchButton",{"rt-high-contrast":l})},R.createElement(eO,{className:ir("rt-SwitchThumb",{"rt-high-contrast":l})})))});By.displayName="Switch";var vf=["Enter"," "],nO=["ArrowDown","PageUp","Home"],Uy=["ArrowUp","PageDown","End"],iO=[...nO,...Uy],sO={ltr:[...vf,"ArrowRight"],rtl:[...vf,"ArrowLeft"]},oO={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Xa="Menu",[Ma,aO,cO]=ry(Xa),[Js,Fy]=Vi(Xa,[cO,eu,iy]),Za=eu(),$y=iy(),[Vy,vs]=Js(Xa),[lO,Qa]=Js(Xa),zy=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=e,a=Za(t),[c,l]=R.useState(null),u=R.useRef(!1),f=Mr(s),p=$0(i);return R.useEffect(()=>{const y=()=>{u.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>u.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),w.jsx(R2,{...a,children:w.jsx(Vy,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:l,children:w.jsx(lO,{scope:t,onClose:R.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:p,modal:o,children:n})})})};zy.displayName=Xa;var uO="MenuAnchor",K0=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Za(r);return w.jsx(P2,{...i,...n,ref:t})});K0.displayName=uO;var Y0="MenuPortal",[dO,qy]=Js(Y0,{forceMount:void 0}),Wy=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,s=vs(Y0,t);return w.jsx(dO,{scope:t,forceMount:r,children:w.jsx($n,{present:r||s.open,children:w.jsx(k2,{asChild:!0,container:i,children:n})})})};Wy.displayName=Y0;var wn="MenuContent",[fO,J0]=Js(wn),Hy=R.forwardRef((e,t)=>{const r=qy(wn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=vs(wn,e.__scopeMenu),o=Qa(wn,e.__scopeMenu);return w.jsx(Ma.Provider,{scope:e.__scopeMenu,children:w.jsx($n,{present:n||s.open,children:w.jsx(Ma.Slot,{scope:e.__scopeMenu,children:o.modal?w.jsx(hO,{...i,ref:t}):w.jsx(pO,{...i,ref:t})})})})}),hO=R.forwardRef((e,t)=>{const r=vs(wn,e.__scopeMenu),n=R.useRef(null),i=Kt(t,n);return R.useEffect(()=>{const s=n.current;if(s)return XA(s)},[]),w.jsx(X0,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:tt(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),pO=R.forwardRef((e,t)=>{const r=vs(wn,e.__scopeMenu);return w.jsx(X0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),mO=_a("MenuContent.ScrollLock"),X0=R.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:p,onDismiss:y,disableOutsideScroll:x,...v}=e,C=vs(wn,r),I=Qa(wn,r),O=Za(r),j=$y(r),U=aO(r),[D,H]=R.useState(null),q=R.useRef(null),G=Kt(t,q,C.onContentChange),re=R.useRef(0),ae=R.useRef(""),ne=R.useRef(0),V=R.useRef(null),N=R.useRef("right"),h=R.useRef(0),d=x?NI:R.Fragment,m=x?{as:mO,allowPinchZoom:!0}:void 0,S=M=>{var le,xe;const P=ae.current+M,A=U().filter(Se=>!Se.disabled),g=document.activeElement,b=(le=A.find(Se=>Se.ref.current===g))==null?void 0:le.textValue,B=A.map(Se=>Se.textValue),se=MO(B,P,b),te=(xe=A.find(Se=>Se.textValue===se))==null?void 0:xe.ref.current;(function Se(Ee){ae.current=Ee,window.clearTimeout(re.current),Ee!==""&&(re.current=window.setTimeout(()=>Se(""),1e3))})(P),te&&setTimeout(()=>te.focus())};R.useEffect(()=>()=>window.clearTimeout(re.current),[]),FA();const E=R.useCallback(M=>{var A,g;return N.current===((A=V.current)==null?void 0:A.side)&&IO(M,(g=V.current)==null?void 0:g.area)},[]);return w.jsx(fO,{scope:r,searchRef:ae,onItemEnter:R.useCallback(M=>{E(M)&&M.preventDefault()},[E]),onItemLeave:R.useCallback(M=>{var P;E(M)||((P=q.current)==null||P.focus(),H(null))},[E]),onTriggerLeave:R.useCallback(M=>{E(M)&&M.preventDefault()},[E]),pointerGraceTimerRef:ne,onPointerGraceIntentChange:R.useCallback(M=>{V.current=M},[]),children:w.jsx(d,{...m,children:w.jsx(ly,{asChild:!0,trapped:i,onMountAutoFocus:tt(s,M=>{var P;M.preventDefault(),(P=q.current)==null||P.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:w.jsx(I0,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:p,onDismiss:y,children:w.jsx(LA,{asChild:!0,...j,dir:I.dir,orientation:"vertical",loop:n,currentTabStopId:D,onCurrentTabStopIdChange:H,onEntryFocus:tt(c,M=>{I.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:w.jsx(j2,{role:"menu","aria-orientation":"vertical","data-state":lw(C.open),"data-radix-menu-content":"",dir:I.dir,...O,...v,ref:G,style:{outline:"none",...v.style},onKeyDown:tt(v.onKeyDown,M=>{const A=M.target.closest("[data-radix-menu-content]")===M.currentTarget,g=M.ctrlKey||M.altKey||M.metaKey,b=M.key.length===1;A&&(M.key==="Tab"&&M.preventDefault(),!g&&b&&S(M.key));const B=q.current;if(M.target!==B||!iO.includes(M.key))return;M.preventDefault();const te=U().filter(le=>!le.disabled).map(le=>le.ref.current);Uy.includes(M.key)&&te.reverse(),CO(te)}),onBlur:tt(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout(re.current),ae.current="")}),onPointerMove:tt(e.onPointerMove,Aa(M=>{const P=M.target,A=h.current!==M.clientX;if(M.currentTarget.contains(P)&&A){const g=M.clientX>h.current?"right":"left";N.current=g,h.current=M.clientX}}))})})})})})})});Hy.displayName=wn;var gO="MenuGroup",Z0=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return w.jsx(Yt.div,{role:"group",...n,ref:t})});Z0.displayName=gO;var bO="MenuLabel",Gy=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return w.jsx(Yt.div,{...n,ref:t})});Gy.displayName=bO;var hl="MenuItem",um="menu.itemSelect",fu=R.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,s=R.useRef(null),o=Qa(hl,e.__scopeMenu),a=J0(hl,e.__scopeMenu),c=Kt(t,s),l=R.useRef(!1),u=()=>{const f=s.current;if(!r&&f){const p=new CustomEvent(um,{bubbles:!0,cancelable:!0});f.addEventListener(um,y=>n==null?void 0:n(y),{once:!0}),c2(f,p),p.defaultPrevented?l.current=!1:o.onClose()}};return w.jsx(Ky,{...i,ref:c,disabled:r,onClick:tt(e.onClick,u),onPointerDown:f=>{var p;(p=e.onPointerDown)==null||p.call(e,f),l.current=!0},onPointerUp:tt(e.onPointerUp,f=>{var p;l.current||(p=f.currentTarget)==null||p.click()}),onKeyDown:tt(e.onKeyDown,f=>{const p=a.searchRef.current!=="";r||p&&f.key===" "||vf.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});fu.displayName=hl;var Ky=R.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,o=J0(hl,r),a=$y(r),c=R.useRef(null),l=Kt(t,c),[u,f]=R.useState(!1),[p,y]=R.useState("");return R.useEffect(()=>{const x=c.current;x&&y((x.textContent??"").trim())},[s.children]),w.jsx(Ma.ItemSlot,{scope:r,disabled:n,textValue:i??p,children:w.jsx(BA,{asChild:!0,...a,focusable:!n,children:w.jsx(Yt.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:l,onPointerMove:tt(e.onPointerMove,Aa(x=>{n?o.onItemLeave(x):(o.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:tt(e.onPointerLeave,Aa(x=>o.onItemLeave(x))),onFocus:tt(e.onFocus,()=>f(!0)),onBlur:tt(e.onBlur,()=>f(!1))})})})}),vO="MenuCheckboxItem",Yy=R.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return w.jsx(ew,{scope:e.__scopeMenu,checked:r,children:w.jsx(fu,{role:"menuitemcheckbox","aria-checked":pl(r)?"mixed":r,...i,ref:t,"data-state":th(r),onSelect:tt(i.onSelect,()=>n==null?void 0:n(pl(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Yy.displayName=vO;var Jy="MenuRadioGroup",[yO,wO]=Js(Jy,{value:void 0,onValueChange:()=>{}}),Xy=R.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,s=Mr(n);return w.jsx(yO,{scope:e.__scopeMenu,value:r,onValueChange:s,children:w.jsx(Z0,{...i,ref:t})})});Xy.displayName=Jy;var Zy="MenuRadioItem",Qy=R.forwardRef((e,t)=>{const{value:r,...n}=e,i=wO(Zy,e.__scopeMenu),s=r===i.value;return w.jsx(ew,{scope:e.__scopeMenu,checked:s,children:w.jsx(fu,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":th(s),onSelect:tt(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});Qy.displayName=Zy;var Q0="MenuItemIndicator",[ew,xO]=Js(Q0,{checked:!1}),tw=R.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,s=xO(Q0,r);return w.jsx($n,{present:n||pl(s.checked)||s.checked===!0,children:w.jsx(Yt.span,{...i,ref:t,"data-state":th(s.checked)})})});tw.displayName=Q0;var SO="MenuSeparator",rw=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return w.jsx(Yt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});rw.displayName=SO;var _O="MenuArrow",nw=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Za(r);return w.jsx(N2,{...i,...n,ref:t})});nw.displayName=_O;var eh="MenuSub",[EO,iw]=Js(eh),sw=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,s=vs(eh,t),o=Za(t),[a,c]=R.useState(null),[l,u]=R.useState(null),f=Mr(i);return R.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),w.jsx(R2,{...o,children:w.jsx(Vy,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:u,children:w.jsx(EO,{scope:t,contentId:Ea(),triggerId:Ea(),trigger:a,onTriggerChange:c,children:r})})})};sw.displayName=eh;var ia="MenuSubTrigger",ow=R.forwardRef((e,t)=>{const r=vs(ia,e.__scopeMenu),n=Qa(ia,e.__scopeMenu),i=iw(ia,e.__scopeMenu),s=J0(ia,e.__scopeMenu),o=R.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,l={__scopeMenu:e.__scopeMenu},u=R.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return R.useEffect(()=>u,[u]),R.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),w.jsx(K0,{asChild:!0,...l,children:w.jsx(Ky,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":lw(r.open),...e,ref:M0(t,i.onTriggerChange),onClick:f=>{var p;(p=e.onClick)==null||p.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:tt(e.onPointerMove,Aa(f=>{s.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!r.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),u()},100))})),onPointerLeave:tt(e.onPointerLeave,Aa(f=>{var y,x;u();const p=(y=r.content)==null?void 0:y.getBoundingClientRect();if(p){const v=(x=r.content)==null?void 0:x.dataset.side,C=v==="right",I=C?-5:5,O=p[C?"left":"right"],j=p[C?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+I,y:f.clientY},{x:O,y:p.top},{x:j,y:p.top},{x:j,y:p.bottom},{x:O,y:p.bottom}],side:v}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(f),f.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:tt(e.onKeyDown,f=>{var y;const p=s.searchRef.current!=="";e.disabled||p&&f.key===" "||sO[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});ow.displayName=ia;var aw="MenuSubContent",cw=R.forwardRef((e,t)=>{const r=qy(wn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=vs(wn,e.__scopeMenu),o=Qa(wn,e.__scopeMenu),a=iw(aw,e.__scopeMenu),c=R.useRef(null),l=Kt(t,c);return w.jsx(Ma.Provider,{scope:e.__scopeMenu,children:w.jsx($n,{present:n||s.open,children:w.jsx(Ma.Slot,{scope:e.__scopeMenu,children:w.jsx(X0,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:l,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var f;o.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:tt(e.onFocusOutside,u=>{u.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:tt(e.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:tt(e.onKeyDown,u=>{var y;const f=u.currentTarget.contains(u.target),p=oO[o.dir].includes(u.key);f&&p&&(s.onOpenChange(!1),(y=a.trigger)==null||y.focus(),u.preventDefault())})})})})})});cw.displayName=aw;function lw(e){return e?"open":"closed"}function pl(e){return e==="indeterminate"}function th(e){return pl(e)?"indeterminate":e?"checked":"unchecked"}function CO(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function TO(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function MO(e,t,r){const i=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,s=r?e.indexOf(r):-1;let o=TO(e,Math.max(s,0));i.length===1&&(o=o.filter(l=>l!==r));const c=o.find(l=>l.toLowerCase().startsWith(i.toLowerCase()));return c!==r?c:void 0}function AO(e,t){const{x:r,y:n}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],c=t[o],l=a.x,u=a.y,f=c.x,p=c.y;u>n!=p>n&&r<(f-l)*(n-u)/(p-u)+l&&(i=!i)}return i}function IO(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return AO(r,t)}function Aa(e){return t=>t.pointerType==="mouse"?e(t):void 0}var OO=zy,RO=K0,PO=Wy,jO=Hy,NO=Z0,kO=Gy,DO=fu,LO=Yy,BO=Xy,UO=Qy,FO=tw,$O=rw,VO=nw,zO=sw,qO=ow,WO=cw,hu="DropdownMenu",[HO,UU]=Vi(hu,[Fy]),Ur=Fy(),[GO,uw]=HO(hu),dw=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,c=Ur(t),l=R.useRef(null),[u,f]=Ha({prop:i,defaultProp:s??!1,onChange:o,caller:hu});return w.jsx(GO,{scope:t,triggerId:Ea(),triggerRef:l,contentId:Ea(),open:u,onOpenChange:f,onOpenToggle:R.useCallback(()=>f(p=>!p),[f]),modal:a,children:w.jsx(OO,{...c,open:u,onOpenChange:f,dir:n,modal:a,children:r})})};dw.displayName=hu;var fw="DropdownMenuTrigger",hw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=uw(fw,r),o=Ur(r);return w.jsx(RO,{asChild:!0,...o,children:w.jsx(Yt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...i,ref:M0(t,s.triggerRef),onPointerDown:tt(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:tt(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});hw.displayName=fw;var KO="DropdownMenuPortal",pw=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Ur(t);return w.jsx(PO,{...n,...r})};pw.displayName=KO;var mw="DropdownMenuContent",gw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=uw(mw,r),s=Ur(r),o=R.useRef(!1);return w.jsx(jO,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...n,ref:t,onCloseAutoFocus:tt(e.onCloseAutoFocus,a=>{var c;o.current||(c=i.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:tt(e.onInteractOutside,a=>{const c=a.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,u=c.button===2||l;(!i.modal||u)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});gw.displayName=mw;var YO="DropdownMenuGroup",bw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(NO,{...i,...n,ref:t})});bw.displayName=YO;var JO="DropdownMenuLabel",vw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(kO,{...i,...n,ref:t})});vw.displayName=JO;var XO="DropdownMenuItem",yw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(DO,{...i,...n,ref:t})});yw.displayName=XO;var ZO="DropdownMenuCheckboxItem",ww=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(LO,{...i,...n,ref:t})});ww.displayName=ZO;var QO="DropdownMenuRadioGroup",xw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(BO,{...i,...n,ref:t})});xw.displayName=QO;var eR="DropdownMenuRadioItem",Sw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(UO,{...i,...n,ref:t})});Sw.displayName=eR;var tR="DropdownMenuItemIndicator",_w=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(FO,{...i,...n,ref:t})});_w.displayName=tR;var rR="DropdownMenuSeparator",Ew=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx($O,{...i,...n,ref:t})});Ew.displayName=rR;var nR="DropdownMenuArrow",iR=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(VO,{...i,...n,ref:t})});iR.displayName=nR;var sR=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:s}=e,o=Ur(t),[a,c]=Ha({prop:n,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return w.jsx(zO,{...o,open:a,onOpenChange:c,children:r})},oR="DropdownMenuSubTrigger",Cw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(qO,{...i,...n,ref:t})});Cw.displayName=oR;var aR="DropdownMenuSubContent",Tw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(WO,{...i,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Tw.displayName=aR;var cR=dw,lR=hw,Mw=pw,uR=gw,dR=bw,fR=vw,hR=yw,pR=ww,mR=xw,gR=Sw,Aw=_w,bR=Ew,vR=sR,yR=Cw,wR=Tw;const xR=["1","2","3"],SR=["vertical","horizontal","both"],md={size:{type:"enum",values:xR,default:"1",responsive:!0},radius:z0,scrollbars:{type:"enum",values:SR,default:"both"}},rh=R.forwardRef((e,t)=>{const{rest:r,...n}=Ka(e),{className:i,style:s,type:o,scrollHideDelay:a=o!=="scroll"?0:void 0,dir:c,size:l=md.size.default,radius:u=md.radius.default,scrollbars:f=md.scrollbars.default,...p}=r;return R.createElement(HI,{type:o,scrollHideDelay:a,className:ir("rt-ScrollAreaRoot",i,Ya(n)),style:s},R.createElement(GI,{...p,ref:t,className:"rt-ScrollAreaViewport"}),R.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),f!=="vertical"?R.createElement(cm,{"data-radius":u,orientation:"horizontal",className:ir("rt-ScrollAreaScrollbar",Gr(l,"rt-r-size"))},R.createElement(lm,{className:"rt-ScrollAreaThumb"})):null,f!=="horizontal"?R.createElement(cm,{"data-radius":u,orientation:"vertical",className:ir("rt-ScrollAreaScrollbar",Gr(l,"rt-r-size"))},R.createElement(lm,{className:"rt-ScrollAreaThumb"})):null,f==="both"?R.createElement(KI,{className:"rt-ScrollAreaCorner"}):null)});rh.displayName="ScrollArea";const _R=["1","2"],ER=["solid","soft"],gd={size:{type:"enum",values:_R,default:"2",responsive:!0},variant:{type:"enum",values:ER,default:"solid"},color:Ga,highContrast:iu},Iw={color:Ga,shortcut:{type:"string",default:void 0}},Ow=e=>R.createElement(cR,{...e});Ow.displayName="DropdownMenuRoot";const Rw=R.forwardRef((e,t)=>R.createElement(lR,{...e,ref:t,asChild:!0}));Rw.displayName="DropdownMenuTrigger";const Pw=R.createContext({}),jw=R.forwardRef((e,t)=>{const r=bA(),{className:n,children:i,size:s=gd.size.default,variant:o=gd.variant.default,highContrast:a=gd.highContrast.default,color:c=Iw.color.default,container:l,forceMount:u,...f}=e,p=c??r.accentColor;return R.createElement(Mw,{container:l,forceMount:u},R.createElement(nu,{asChild:!0},R.createElement(uR,{"data-accent-color":p,align:"start",sideOffset:4,collisionPadding:10,...f,ref:t,className:ir("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,Gr(s,"rt-r-size"),`rt-variant-${o}`,{"rt-high-contrast":a})},R.createElement(rh,{type:"auto"},R.createElement("div",{className:ir("rt-BaseMenuViewport","rt-DropdownMenuViewport")},R.createElement(Pw.Provider,{value:R.useMemo(()=>({size:s,variant:o,color:p,highContrast:a}),[s,o,p,a])},i))))))});jw.displayName="DropdownMenuContent";const Nw=R.forwardRef((e,t)=>R.createElement(fR,{...e,ref:t,className:ir("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));Nw.displayName="DropdownMenuLabel";const kw=R.forwardRef((e,t)=>{const{className:r,children:n,color:i=Iw.color.default,shortcut:s,...o}=e;return R.createElement(hR,{"data-accent-color":i,...o,ref:t,className:ir("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},R.createElement(Jl,null,n),s&&R.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s))});kw.displayName="DropdownMenuItem";const Dw=R.forwardRef((e,t)=>R.createElement(dR,{...e,ref:t,className:ir("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));Dw.displayName="DropdownMenuGroup";const Lw=R.forwardRef((e,t)=>R.createElement(mR,{...e,ref:t,className:ir("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));Lw.displayName="DropdownMenuRadioGroup";const Bw=R.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return R.createElement(gR,{...i,ref:t,className:ir("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},R.createElement(Jl,null,r),R.createElement(Aw,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},R.createElement(ou,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});Bw.displayName="DropdownMenuRadioItem";const Uw=R.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...s}=e;return R.createElement(pR,{...s,ref:t,className:ir("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},R.createElement(Jl,null,r),R.createElement(Aw,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},R.createElement(ou,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&R.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});Uw.displayName="DropdownMenuCheckboxItem";const Fw=e=>R.createElement(vR,{...e});Fw.displayName="DropdownMenuSub";const $w=R.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return R.createElement(yR,{...i,ref:t,className:ir("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},R.createElement(Jl,null,n),R.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},R.createElement(ty,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});$w.displayName="DropdownMenuSubTrigger";const Vw=R.forwardRef((e,t)=>{const{className:r,children:n,container:i,forceMount:s,...o}=e,{size:a,variant:c,color:l,highContrast:u}=R.useContext(Pw);return R.createElement(Mw,{container:i,forceMount:s},R.createElement(nu,{asChild:!0},R.createElement(wR,{"data-accent-color":l,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...o,ref:t,className:ir("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,Gr(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":u})},R.createElement(rh,{type:"auto"},R.createElement("div",{className:ir("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});Vw.displayName="DropdownMenuSubContent";const zw=R.forwardRef((e,t)=>R.createElement(bR,{...e,ref:t,className:ir("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));zw.displayName="DropdownMenuSeparator";const Pi=Object.assign({},{Root:Ow,Trigger:Rw,Content:jw,Label:Nw,Item:kw,Group:Dw,RadioGroup:Lw,RadioItem:Bw,CheckboxItem:Uw,Sub:Fw,SubTrigger:$w,SubContent:Vw,Separator:zw}),CR=["1","2","3","4"],TR=["classic","solid","soft","surface","outline","ghost"],Zo={size:{type:"enum",values:CR,default:"2",responsive:!0},variant:{type:"enum",values:TR,default:"solid"},color:Ga,highContrast:iu,radius:z0},qw=R.forwardRef((e,t)=>{const{rest:r,...n}=Ka(e),{className:i,asChild:s=!1,size:o=Zo.size.default,variant:a=Zo.variant.default,color:c=Zo.color.default,highContrast:l=Zo.highContrast.default,radius:u=Zo.radius.default,...f}=r,p=s?A0:"button";return R.createElement(p,{"data-disabled":f.disabled||void 0,"data-accent-color":c,"data-radius":u,...f,ref:t,className:ir("rt-reset","rt-BaseButton",i,Gr(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":l},Ya(n))})});qw.displayName="BaseButton";const Ww=R.forwardRef((e,t)=>R.createElement(qw,{...e,ref:t,className:ir("rt-Button",e.className)}));Ww.displayName="Button";const MR={loading:{type:"boolean",default:!0}},$o=R.forwardRef((e,t)=>{const{rest:r,...n}=Ka(e),{className:i,children:s,loading:o=MR.loading.default,...a}=r;if(!o)return R.createElement(R.Fragment,null,s);const c=R.isValidElement(s)?A0:"span";return R.createElement(c,{ref:t,"aria-hidden":!0,className:ir("rt-Skeleton",i,Ya(n)),"data-inline-skeleton":R.isValidElement(s)?void 0:!0,tabIndex:-1,inert:"",...a},s)});$o.displayName="Skeleton";function nh(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,s=()=>{r&&r()};return w.jsx(Ww,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:s,children:t})}function $s({content:e,children:t,position:r="top",marginTop:n="0px",borderRadius:i="8px",delay:s=0,backgroundColor:o="var(--cs-bg-primary)"}){const[a,c]=Z.useState(!1),[l,u]=Z.useState(!1),f=Z.useRef(null),p=()=>{f.current&&(clearTimeout(f.current),f.current=null),c(!0)};Z.useEffect(()=>()=>{a||f.current&&(clearTimeout(f.current),f.current=null)},[a]);const y=()=>{f.current=setTimeout(()=>{l||(c(!1),f.current&&(clearTimeout(f.current),f.current=null))},0)},x=()=>{switch(r){case"top":return{transform:"translateX(-50%)"};case"bottom":return{transform:"translateX(-50%)",marginTop:"0px"};case"left":return{transform:"translateY(-50%)",marginRight:"8px"};case"right":return{transform:"translateY(-50%)"};default:return{}}},v=Z.useRef(null),[C,I]=Z.useState({left:void 0,top:void 0});return Z.useEffect(()=>{var O;if(a&&v.current){const j=(O=v.current)==null?void 0:O.getBoundingClientRect();let U,D;r==="top"?(U=`${window.scrollX+j.left+j.width/2}px`,D=`${window.scrollY+j.top-2*j.height-8}px`):r==="bottom"?(U=`${window.scrollX+j.left+j.width/2}px`,D=`${window.scrollY+j.bottom}px`):r==="left"?(U=`${window.scrollX+j.left-8}px`,D=`${window.scrollY+j.top+j.height/2}px`):r==="right"?(U=`${window.scrollX+j.right+8}px`,D=`${window.scrollY+j.top+j.height/2}px`):(U=`${window.scrollX+j.left+j.width/2}px`,D=`${window.scrollY+j.top+j.height/2}px`),I({left:U,top:D})}},[a]),w.jsxs("div",{ref:v,style:{position:"relative",display:"inline-block"},onMouseEnter:p,onMouseLeave:y,children:[t,a&&vl.createPortal(w.jsx("div",{style:{transition:"opacity 0.3s ease",opacity:a?1:0,position:"absolute",zIndex:9e3,padding:"8px 12px",backgroundColor:o,color:"var(--cs-text-secondary)",borderRadius:i,fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)",...x(),...C,marginTop:n},onMouseEnter:()=>u(!0),onMouseLeave:()=>{f.current&&(clearTimeout(f.current),f.current=null),u(!1),c(!1)},children:e}),document.body)]})}const bd=[{label:"Default"},{label:"Fast Mode",beforeIcon:{xlinkHref:"#icon-icon_flash",fontSize:"16px",activeColor:"var(--cs-primary)",activeHoverColor:"var(--cs-primary)"}}],AR=e=>{const{transactionMode:t,setTransactionMode:r,maxCapForGas:n,setMaxCapForGas:i,customGasPrice:s,setCustomGasPrice:o,suiBalance:a,themeType:c}=e,l=c=="Light"?Mt("/images/icon_shio_light@2x.png"):Mt("/images/icon_shio@2x.png"),u=Z.useMemo(()=>{var O;return(O=bd.filter(j=>(j==null?void 0:j.label)===t))==null?void 0:O[0]},[t,bd]),f=O=>{const j=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,9})?).*$");O.target.value=O.target.value.replace(j,"$1"),i(O.target.value)},p=O=>{const j=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,9})?).*$");O.target.value=O.target.value.replace(j,"$1");const U=Me(O.target.value).gt(0)?Me(O.target.value).div(Math.pow(10,9)).toString():"0";Me(U).gt(n)&&i(U),o(O.target.value)},y=Z.useMemo(()=>!n||Number(n)==0?"Please enter a value higher than 0":n&&Number(n)>5?"Only allow up to 5 SUI":Me(n).gt(a)?"Insufficient SUI balance ":Me(n).lt(Me(s).div(Math.pow(10,9)))?"Max cap cannot be less than custom gas.":"",[n]),x=Z.useMemo(()=>n&&Number(n)>0&&Number(n)<2e-6?"Your current maximum fee is below the market rate. Please raise it to ensure your transactions are processed.":"",[n]),v=Z.useMemo(()=>!s||Number(s)==0?"Please enter a value higher than 0":"",[s]),C=Z.useMemo(()=>s&&Number(s)>0&&Me(s).lt(750)?"Your current maximum fee is below the market rate. Please raise it to ensure your transactions are processed.":"",[s]),I=Z.useMemo(()=>!s||s==="0"?"0":Me(s).div(Math.pow(10,9)).toString(),[s]);return w.jsxs("div",{className:"transaction-mode-container",children:[w.jsxs("div",{className:"transaction-mode-header",children:[w.jsxs("div",{className:"transaction-mode-label",children:[w.jsx("svg",{children:w.jsx("use",{xlinkHref:"#icon-icon_mode"})}),w.jsx("span",{className:"caption-text",children:"Transaction Mode"})]}),w.jsx("div",{className:"slippage-tab-list",children:bd.map(O=>w.jsxs("div",{className:O.label===u.label?"active slippage-tab":"slippage-tab",children:[O.label!=="Default"&&w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-icon_flash"})}),w.jsx("span",{onClick:()=>{r(O.label)},children:O.label})]},O.label))})]}),w.jsx("p",{className:"transaction-description",children:t==="Default"?"Standard gas based on real-time network conditions":"Land your transaction earlier and avoid congestion with a higher gas price. MEV protection is on by default in Fast Mode."}),t==="Fast Mode"&&w.jsxs("div",{className:"fast-mode-section",children:[w.jsxs("div",{className:"input-card",children:[w.jsxs("div",{className:"input-label",children:[w.jsx("span",{children:"Custom Gas Price"}),w.jsx($s,{position:"bottom",content:w.jsx("div",{className:"tooltip-content",children:"The total gas depends on the gas price and actual gas units consumed."}),children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-tips"})})})]}),w.jsxs("div",{className:"input-right",children:[w.jsxs("div",{className:"input-field",children:[w.jsx("input",{value:s,onChange:p,placeholder:"0.0"}),w.jsx("span",{className:"caption-text",children:"MIST"})]}),w.jsxs("div",{className:"unit-text",children:[w.jsx("span",{children:I}),"SUI"]})]})]}),v&&w.jsx(gc,{text:v,type:"error"}),C&&w.jsx(gc,{text:C,type:"warn"}),w.jsxs("div",{className:"input-card",children:[w.jsxs("div",{className:"input-label",children:[w.jsx("span",{children:"Set Max Cap for Gas"}),w.jsx($s,{position:"bottom",content:w.jsx("div",{className:"tooltip-content",children:"Set a max cap for your gas to prevent overpaying"}),children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-tips"})})})]}),w.jsx("div",{className:"input-right",children:w.jsxs("div",{className:"input-field",children:[w.jsx("input",{value:n,onChange:f,placeholder:"0.0"}),w.jsx("span",{className:"caption-text",children:"SUI"})]})})]}),y&&w.jsx(gc,{text:y,type:"error"}),x&&w.jsx(gc,{text:x,type:"warn"}),w.jsxs("div",{className:"powered-by",children:[w.jsx("span",{children:"Powered by"}),w.jsx("img",{src:l,alt:"shio"})]})]})]})},gc=e=>{const{text:t,type:r}=e;return w.jsx("div",{style:{width:"100%",padding:"4px 16px",borderRadius:"8px",background:r==="warn"?"var(--cs-warning-10)":"var(--cs-error-10)",display:"flex",alignItems:"center",justifyContent:"center"},children:w.jsx("span",{style:{color:r==="warn"?"var(--cs-warning)":"var(--cs-error)",fontSize:"12px",lineHeight:"16px"},children:t})})},IR={id:"0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3",coin_type:"0x2::sui::SUI",decimals:9,description:"",name:"Sui",symbol:"SUI",logo_url:"https://archive.cetus.zone/assets/image/sui/sui.png",is_verified:!0,extensions:{rank:"880"}};function OR({themeType:e}){const{setIsOpenSlippageDialog:t,isOpenSlippageDialog:r,slippage:n}=zr();return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"slippage-button",onClick:()=>t(!0),children:[w.jsxs("span",{children:[n,"%"]}),w.jsx("div",{className:"svg-box",children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-verticalslider"})})})]}),r&&w.jsx(RR,{themeType:e,onClose:()=>t(!1)})]})}function RR({onClose:e,themeType:t}){const{transactionMode:r,maxCapForGas:n,customGasPrice:i,setMaxCapForGas:s,setCustomGasPrice:o,setTransctionMode:a,mevProtect:c,setMevProtect:l}=zr(),{balanceInfo:u}=Sa(IR),[f,p]=Z.useState(r),[y,x]=Z.useState(n),[v,C]=Z.useState(i),[I,O]=Z.useState(c),{slippage:j,setSlippage:U}=zr(),[D,H]=Z.useState(j),q=ne=>{H(ne.display)},G=ne=>{const V=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,2})?).*$");ne.target.value=ne.target.value.replace(V,"$1"),H(ne.target.value)},re=()=>{D&&U(D),f==="Fast Mode"&&(s(y),o(v)),a(f),l(I),e()};Z.useEffect(()=>{f==="Fast Mode"&&O(!0)},[f]);const ae=Z.useMemo(()=>f==="Fast Mode"&&(!y||Number(y)===0||Number(y)>5||!v||Number(v)===0||Me(y).gt((u==null?void 0:u.totalBalanceFormat)||"0")||Me(y).lt(Me(v).div(Math.pow(10,9))))||!+D?!0:Number(D)>50||Number(D)<.01,[D,f,y,v,u]);return w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"dialog-mask",style:{zIndex:"100"}}),w.jsx("div",{className:"slippage-settings-dialog",style:{zIndex:"100"},children:w.jsxs("div",{className:"slippage-settings",children:[w.jsxs("div",{className:"slippage-settings-header",children:[w.jsx("div",{className:"title",children:"Settings"}),w.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:w.jsx("use",{xlinkHref:"#icon-close"})})]}),w.jsxs("div",{className:"title",children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-verticalslider"})}),w.jsx("span",{children:"Slippage Tolerance"})]}),w.jsxs("div",{className:"form-box",children:[w.jsx("div",{className:"slippage-tab-list",children:NC.map(ne=>w.jsxs("span",{className:ne.display===D?"active":"",onClick:()=>q(ne),children:[ne.display," %"]},ne.display))}),w.jsxs("div",{className:"input-box",children:[w.jsx("span",{children:"Custom"}),w.jsx("input",{className:"cs-input",placeholder:"0.0",value:D,onChange:G}),w.jsx("div",{style:{fontSize:"14px",color:"var(--cs-text-primary)"},children:"%"})]})]}),Number(D)<=.05&&w.jsx("div",{className:"tips warning",children:"Slippage is low. Your transaction may fail."}),Number(D)<=50&&Number(D)>1&&w.jsx("div",{className:"tips warning",children:"Your transaction may frontrun"}),Number(D)>50&&w.jsx("div",{className:"tips error",children:" Enter a valid slippage percentage"}),w.jsx(AR,{transactionMode:f,setTransactionMode:p,maxCapForGas:y,setMaxCapForGas:x,customGasPrice:v,setCustomGasPrice:C,suiBalance:(u==null?void 0:u.totalBalanceFormat)||"0",themeType:t}),w.jsx(PR,{mevProtect:I,setMevProtect:O,disabled:f==="Fast Mode"}),w.jsx(nh,{text:"Save",btnIsDisabled:ae,className:"slippage-save-btn",onClick:re})]})})]})}const PR=e=>{const{mevProtect:t,disabled:r,setMevProtect:n}=e;return w.jsxs("div",{className:"mev-settings-box",children:[w.jsx("div",{className:"mev-setting-title",children:w.jsxs("div",{className:"name",children:[w.jsx("svg",{"aria-hidden":"true",cursor:"pointer",fill:"var(--cs-icon-fill)",children:w.jsx("use",{xlinkHref:"#icon-icon_mev"})}),w.jsx("span",{children:"MEV Protect"})]})}),w.jsxs("div",{className:"mev-setting-Switch",children:[w.jsxs("div",{className:"label",children:[w.jsx("span",{children:"Enable MEV Protection"}),w.jsx($s,{position:"bottom",marginTop:"-118px",content:w.jsx("div",{className:"mev-tips",style:{width:"310px",whiteSpace:"wrap",color:"var(--cs-text-primary)"},children:"By enabling this, your txn will be submitted via 3rd party MEV service provider. MEV value retained will be redistributed to all users who successfully execute their trades with Shio through its point campaign."}),children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer"},children:w.jsx("use",{xlinkHref:"#icon-tips"})})})]}),w.jsx(By,{checked:t,disabled:r,className:"cs-switch",onClick:()=>{n(!t)}})]})]})};function jR({handleRefresh:e,themeType:t}){return w.jsx(w.Fragment,{children:w.jsxs("div",{className:"swap-header",children:[w.jsx("h3",{className:"swap-title",children:"Swap"}),w.jsxs("div",{className:"right",children:[w.jsx(OR,{themeType:t}),w.jsx(nT,{onClick:e})]})]})})}function NR(){const[e,t]=Z.useState(!1);return w.jsxs(Pi.Root,{open:e,onOpenChange:t,children:[w.jsx(Pi.Trigger,{children:w.jsx("div",{className:"cs-settings-btn",children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-settings"})})})}),w.jsx(Pi.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"var(--cs-primary-10)"},side:"bottom",align:"end",children:w.jsxs("div",{className:"cs-settings-box",children:[w.jsx("h3",{children:"Settings"}),w.jsx(kR,{}),w.jsx(LR,{onClose:()=>{t(!1)}})]})})]})}function kR(){const{currentExplorer:e,setCurrentExplorer:t,currentRpc:r,setCurrentRpc:n}=zr(),i=s=>{t(s)};return w.jsxs("div",{className:"settings-card",style:{marginTop:"12px"},children:[w.jsxs("h3",{className:"card-title",children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-plorer"})}),w.jsx("span",{children:"Preferred Explorer"})]}),w.jsx("div",{className:"explorer-checkbox-group",children:Kl.map(s=>w.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(s.link),children:[w.jsx(au,{color:"indigo",checked:s.link===e,variant:"soft",className:"cs-checkbox cs-allow-change-checkbox"}),w.jsx("img",{src:s.img}),w.jsx("span",{children:s.name})]},s.link))})]})}const DR=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function LR({onClose:e}){const{addTxToast:t}=Bo(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:s,rpcList:o}=zr(),[a,c]=Z.useState(i),[l,u]=Z.useState(r),f=v=>{t({id:0,status:"success",buildShowInfo:()=>({toastTitleText:"RPC update",toastDescriptionContent:`RPC is currently set to ${v}`})})},p=v=>{u(v),v.isCustom||(n(v),f(v.link),e())},y=v=>{c(v.target.value)},x=()=>{if(a){const v={name:"Custom RPC URL",link:a,isCustom:!0};s(a),n(v),f(a),e()}};return w.jsxs("div",{className:"settings-card rpc-settings-card",children:[w.jsxs("h3",{className:"card-title",children:[w.jsx("svg",{className:"cs-icon rpc-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-rpc"})}),w.jsx("span",{children:"RPC Node"})]}),w.jsxs("div",{className:"rpc-checkbox-group",children:[o.map(v=>w.jsxs("div",{className:"rpc-item",onClick:()=>p(v),children:[w.jsx(au,{color:"indigo",checked:l.name===v.name,variant:"soft",className:"cs-checkbox cs-allow-change-checkbox"}),w.jsx("span",{children:v.name})]},v.name)),l.isCustom&&w.jsxs("div",{className:"custom-rpc-input-box",children:[w.jsx("input",{className:"cs-input",placeholder:"Custom RPC URL",onChange:y,value:a}),w.jsx(nh,{btnIsDisabled:DR(a),text:"Save",onClick:x})]})]})]})}function Hw(){const{suiClient:e}=gs(),{setAccountServiceNameObj:t,accountServiceNameObj:r}=qr(),n=async s=>{if(!((s==null?void 0:s.length)<1))try{const o=s.map(async l=>{var f;const u=await e.resolveNameServiceNames({address:l});return{address:l,name:((f=u==null?void 0:u.data)==null?void 0:f[0])||""}}),a=await Promise.all(o),c=Object.fromEntries(a==null?void 0:a.map(l=>[l.address,l.name]));t(c)}catch{}};return{fetchServiceNames:n,getServiceNames:async s=>{const o=[];s==null||s.forEach(a=>{const c=a==null?void 0:a.address;r!=null&&r[c]||o.push(c)}),(o==null?void 0:o.length)>0&&n(o)}}}var BR=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||r.forEach(function(i){e.addRange(i)}),t&&t.focus()}},UR=BR,dm={"text/plain":"Text","text/html":"Url",default:"Text"},FR="Copy to clipboard: #{key}, Enter";function $R(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function VR(e,t){var r,n,i,s,o,a,c=!1;t||(t={}),r=t.debug||!1;try{i=UR(),s=document.createRange(),o=document.getSelection(),a=document.createElement("span"),a.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(u){if(u.stopPropagation(),t.format)if(u.preventDefault(),typeof u.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=dm[t.format]||dm.default;window.clipboardData.setData(f,e)}else u.clipboardData.clearData(),u.clipboardData.setData(t.format,e);t.onCopy&&(u.preventDefault(),t.onCopy(u.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),o.addRange(s);var l=document.execCommand("copy");if(!l)throw new Error("copy command was unsuccessful");c=!0}catch(u){r&&console.error("unable to copy using execCommand: ",u),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(f){r&&console.error("unable to copy using clipboardData: ",f),r&&console.error("falling back to prompt"),n=$R("message"in t?t.message:FR),window.prompt(n,e)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var zR=VR;const Gw=ka(zR);function qR({currentAccount:e}){const{mutate:t}=Kr.useSwitchAccount(),r=Kr.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i,accountServiceNameObj:s}=qr(),{getServiceNames:o}=Hw(),a=Z.useCallback(()=>{n||o(r),i(!n)},[n,r]);Z.useEffect(()=>()=>{i(!1)},[]);const c=Z.useMemo(()=>r.filter(u=>u.address!==e),[r,e]);Z.useEffect(()=>{},[c]);const l=u=>{t({account:u},{onSuccess:()=>{}})};return w.jsxs("div",{className:"cs-account-switch",children:[w.jsxs("div",{className:"account",onClick:a,children:[w.jsx("span",{children:e&&(s==null?void 0:s[e])||Us(e)}),(c==null?void 0:c.length)>0&&w.jsx("svg",{className:`cs-icon ${n?"open":"close"}`,"aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-unfold"})})]}),w.jsx("div",{className:`account-list ${n?"open":"close"}`,children:c.map(u=>{var f,p,y,x;return w.jsxs("div",{className:"account-item",children:[w.jsxs("div",{className:"left",children:[w.jsxs("div",{className:"label",children:[((f=u==null?void 0:u.label)==null?void 0:f.length)>16?((p=u==null?void 0:u.label)==null?void 0:p.substring(0,6))+"..."+((x=u==null?void 0:u.label)==null?void 0:x.substring(((y=u==null?void 0:u.label)==null?void 0:y.length)-10)):u==null?void 0:u.label," "]}),w.jsx("div",{className:"address",children:(s==null?void 0:s[u==null?void 0:u.address])||Us(u==null?void 0:u.address)})]}),w.jsx("button",{className:"cs-outline-btn",onClick:()=>l(u),children:"Switch"})]},u==null?void 0:u.address)})})]})}const WR=Z.forwardRef(({connect:e,isSimulate:t=!1})=>{const r=Kr.useCurrentAccount();return w.jsx("div",{children:r?w.jsx(HR,{isSimulate:t}):w.jsx(nh,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})});function HR({isSimulate:e}){const{mutate:t}=Kr.useDisconnectWallet(),r=Kr.useCurrentAccount(),{currentWallet:n}=Kr.useCurrentWallet(),{addCommonToast:i}=Bo(),{getExplorerUrl:s}=Do(),{accountServiceNameObj:o}=qr(),a=()=>{r&&(Gw(r.address||"",{debug:!1,message:"message"}),i("Copied"))},c=()=>{r&&window.open(s(r.address,"account"),"_blank")};return Z.useEffect(()=>{},[n]),w.jsxs(Pi.Root,{children:[w.jsx(Pi.Trigger,{children:w.jsxs("div",{className:"cs-connected-button",children:[w.jsx("img",{src:n==null?void 0:n.icon,style:{width:"20px",height:"20px"}}),w.jsx("span",{style:{color:e?"#fff":"var(--cs-text-primary)"},children:(r==null?void 0:r.address)&&(o==null?void 0:o[r==null?void 0:r.address])||Us(r==null?void 0:r.address)})]})}),w.jsx(Pi.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"var(--cs-primary-10)"},side:"bottom",align:"end",children:w.jsxs("div",{className:"account-op-box",children:[w.jsx("span",{style:{fontSize:"14px",color:"var(--cs-text-secondary)",marginBottom:"6px"},children:r==null?void 0:r.label}),w.jsx(qR,{currentAccount:r==null?void 0:r.address}),w.jsxs("div",{className:"account-op-item",onClick:a,style:{marginTop:"12px"},children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-icon_copy"})}),w.jsx("span",{children:"Copy address"})]}),w.jsxs("div",{className:"account-op-item",onClick:c,children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-icon_link"})}),w.jsx("span",{children:"Open explorer"})]}),w.jsxs("div",{className:"account-op-item",onClick:()=>t(),children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-icon_disconnect"})}),w.jsx("span",{children:"Disconnect"})]})]})})]})}function GR({isSimulate:e=!1}){const{fetchServiceNames:t}=Hw(),r=Kr.useCurrentAccount();Kr.useCurrentWallet();const{isOpenWalletModal:n,onWalletModal:i,saveCurrentAccount:s}=qr();return Kr.useWallets(),Z.useEffect(()=>{r!=null&&r.address&&t([r==null?void 0:r.address])},[r==null?void 0:r.address]),w.jsx(w.Fragment,{children:w.jsx(Kr.ConnectModal,{trigger:w.jsx(WR,{connect:i,isSimulate:e}),open:n,onOpenChange:o=>i(o)})})}function KR({independentWallet:e,customWallet:t,logo:r}){return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"widget-header",children:[w.jsx("img",{src:r,className:"cetus-logo"}),w.jsxs("div",{className:"right",children:[e&&w.jsx(GR,{}),w.jsx(NR,{})]})]}),w.jsx("div",{style:{marginTop:"12px"}})]})}const Kw=()=>{const e=Z.useRef(null);Z.useEffect(()=>{if(e.current){const n=e.current.style;n.setProperty("--size-loader","50px"),n.setProperty("--size-orbe","10px")}},[]);const t=n=>({position:"absolute",width:"100%",height:"100%",animation:`webLoading ease-in-out 1.5s calc(${n} * 0.1s) infinite`,opacity:`calc(1 - calc(0.2 * ${n}))`}),r={position:"absolute",content:"''",top:0,left:0,width:"var(--size-orbe)",height:"var(--size-orbe)",backgroundColor:"var(--cs-primary)",boxShadow:"0px 0px 20px 2px var(--cs-primary)",borderRadius:"50%"};return w.jsx("div",{style:{width:"100%",height:"100%",position:"absolute",zIndex:100},children:w.jsx("div",{ref:e,style:{width:"var(--size-loader)",height:"var(--size-loader)",position:"absolute",top:"50%",left:"50%",marginTop:"-25px",marginLeft:"-25px",transform:"rotate(45deg)"},children:[...Array(5)].map((n,i)=>w.jsx("div",{style:t(i),children:w.jsx("div",{style:r})},i))})})};function YR({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,s=Z.useMemo(()=>{if(n&&r)return n(r)},[r]);return w.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&w.jsx(JR,{info:s,status:r}),(r==="success"||r==="rejected")&&w.jsx(XR,{info:s,status:r,tx:i,onClose:e})]})}function JR({info:e,status:t}){return w.jsxs("div",{className:"progress-dialog",children:[w.jsx("div",{className:"title",children:t==="confirmation"?"Waiting for Confirmation":"Transaction in progress"}),w.jsx("div",{className:"loading-box",children:w.jsx(Kw,{})}),w.jsxs("div",{className:"ts-content",children:[e==null?void 0:e.modalDescriptionText," "]}),w.jsxs("p",{className:"ts-desc",children:[" ",t==="confirmation"?"Confirm this transaction in your wallet.":"Confirmation is in progress."]})]})}function XR({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=Do();return w.jsxs("div",{className:"finally-status-dialog",children:[w.jsxs("div",{className:"center-content",children:[w.jsxs("div",{className:t==="success"?"status-box is-success":"status-box is-error",children:[w.jsx("div",{className:"status-icon-box",children:w.jsx("div",{className:"status-icon",children:w.jsx("svg",{className:"icon","aria-hidden":"true",children:t==="success"?w.jsx("use",{xlinkHref:"#icon-sel"}):w.jsx("use",{xlinkHref:"#icon-caution"})})})}),t==="success"?w.jsx("span",{children:"Swap Success"}):w.jsx("span",{children:"Swap failed"})]}),w.jsx("div",{className:"ts-content",children:e==null?void 0:e.modalDescriptionText}),r&&w.jsxs("div",{className:"view-transaction",children:[w.jsx("span",{children:"View Transaction"}),Kl.map(s=>w.jsx("a",{href:i(r,"tx",s.link),target:"_blank",children:w.jsx("img",{src:s.img})},s.link))]})]}),w.jsx("button",{className:"cs-solid-btn swap-more-btn",onClick:n,children:t==="success"?"Swap More":"Retry"})]})}function ZR(){const{fetchByApi:e}=Yl(),{setProviders:t}=zr();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v2/status","GET"),{providers:i}=n;i&&t(i)}catch{}}}}function QR({interval:e,callback:t}){const r=Z.useRef(),n=Z.useRef(null);Z.useEffect(()=>{r.current=t},[t]);const i=Z.useCallback(()=>{n.current&&clearInterval(n.current),e>0&&(n.current=setInterval(()=>{r.current&&r.current(Date.now())},e))},[e]),s=Z.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return Z.useEffect(()=>(i(),()=>s()),[]),{startTimer:i,stopTimer:s}}const eP=(e,t)=>({coinPriceObj:{},setPriceObj:r=>{const n=t().coinPriceObj;e({coinPriceObj:{...n,...r}})},clearPriceObj:r=>{const n=t().coinPriceObj;r.forEach(i=>{delete n[ur(i).full_address]}),e({coinPriceObj:{...n}})}}),Yw=$i(eP);function tP(e,t){const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}function ec(){const{fetchByApi:e}=Yl(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=Yw(),i=async a=>{const l=tP(a,10);try{const f=(await Promise.all(l.map(p=>e("/v3/sui/market_price","GET",{base_symbol_address:p.map(y=>Di(y,!1))})))).map(p=>p.prices).flat();if(f){const p={};f.forEach(y=>{p[ur(y.base_symbol).full_address]=y}),r(p)}return f}catch{return n(a),null}},s=Z.useCallback(a=>{if(!a)return;const c=t[ur(a).full_address];if(c)return c},[t]),o=Z.useCallback((a,c,l)=>{const u=Number(c)==0||!l?"0":l;if(c&&a&&+c){const f=s(a);if(f)return Me(c).mul(f.price).toString()}return u},[t]);return{fetchTokenPrices:i,getTokenPrice:s,getTokenAmountValue:o}}function rP(){const{tokenBalanceObj:e}=qr(),{fetchTokenPrices:t}=ec(),{isOpenTokensDialog:r}=en(),n=Z.useCallback(()=>{if(OC(e)){const i=Object.keys(e);t(i)}},[e]);return Z.useEffect(()=>{r&&n()},[r]),{getMyAssetsPrice:n}}const nP={id:"0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3",coin_type:"0x2::sui::SUI",decimals:9,description:"",name:"Sui",symbol:"SUI",logo_url:"https://imagedelivery.net/cBNDGgkrsEA-b_ixIp9SkQ/sui-coin.svg/public",is_trusted:!0,extensions:{rank:"880"}},iP={id:"0x69b7a7c3c200439c1b5f3b19d7d495d5966d5f08de66c69276152f8db3992ec6",coin_type:"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",decimals:6,description:"",name:"USDC",symbol:"USDC",logo_url:"https://circle.com/usdc-icon",is_trusted:!0,extensions:{rank:"1000"}},Jw=iP,Xw=nP;function sP(e,t){const{fetchTokenInfo:r}=bs(),{setFromCoin:n,setToCoin:i,setDefaultCoin:s,fromCoin:o,toCoin:a}=en(),{setSlippage:c,setRpcList:l,setCurrentRpc:u}=zr(),{tokenMapIsInit:f}=Lo(),p=Z.useRef({}),y=async(v,C)=>{if(!C&&!v&&(o||a))return;const I=v?await r(v):Jw,O=C?await r(C):Xw;n(I),i(O),s(I==null?void 0:I.coin_type,O==null?void 0:O.coin_type)},x=(v=[],C)=>{let I=[],O=ua[0],j=ua[0];v.forEach(U=>{const D={name:U,link:U,isCustom:!1};I.push(D),U===C&&(j=D)}),C&&v.includes(C)?I=[j,O,...I.filter(U=>U.link!==C)]:I.unshift(ua[0]),l([...I,{name:"Custom RPC URL",link:"",isCustom:!0}]),u(j)};return Z.useEffect(()=>{if(f&&!C0(e,p.current)){const{defaultFromToken:v,defaultToToken:C,defaultSlippage:I,customRpcList:O,defaultRpc:j}=e;y(v,C),I&&c(I),x(O||[],j),p.current=e}},[e,f]),{handleSetDefaultPair:y}}function oP(){const{currentRpc:e}=zr(),{setSuiClient:t,setAggregatorSDK:r}=gs(),{currentAccount:n}=qr();Z.useEffect(()=>{if(e){const i=new Ls({url:e.link});t(i)}},[e]),Z.useEffect(()=>{if(e){const i=new Nv({endpoint:yo.aggregatorUrl,signer:(n==null?void 0:n.address)||"",client:new Ls({url:e.link}),env:_0.Mainnet});r(i)}},[e.link,n==null?void 0:n.address])}const ih=$i((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),Tr=[];for(let e=0;e<256;++e)Tr.push((e+256).toString(16).slice(1));function aP(e,t=0){return(Tr[e[t+0]]+Tr[e[t+1]]+Tr[e[t+2]]+Tr[e[t+3]]+"-"+Tr[e[t+4]]+Tr[e[t+5]]+"-"+Tr[e[t+6]]+Tr[e[t+7]]+"-"+Tr[e[t+8]]+Tr[e[t+9]]+"-"+Tr[e[t+10]]+Tr[e[t+11]]+Tr[e[t+12]]+Tr[e[t+13]]+Tr[e[t+14]]+Tr[e[t+15]]).toLowerCase()}let vd;const cP=new Uint8Array(16);function lP(){if(!vd){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");vd=crypto.getRandomValues.bind(crypto)}return vd(cP)}const uP=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),fm={randomUUID:uP};function hm(e,t,r){var i;if(fm.randomUUID&&!t&&!e)return fm.randomUUID();e=e||{};const n=e.random??((i=e.rng)==null?void 0:i.call(e))??lP();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let s=0;s<16;++s)t[r+s]=n[s];return t}return aP(n)}var Ns=(e=>(e[e.CalculateError=1e4]="CalculateError",e[e.NumberTooLarge=10001]="NumberTooLarge",e[e.NoRouter=10002]="NoRouter",e[e.InsufficientLiquidity=10003]="InsufficientLiquidity",e[e.HoneyPot=10004]="HoneyPot",e))(Ns||{});const dP=new Ls({url:w1("mainnet")}),fP=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],hP=["deny_list","DenyList","DenyCap","create_regulated_currency"],pP={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},mP=async e=>{let t=!1;if(fP.includes(e))return t;const r=e.split("::"),n=r[0]&&Lt(r[0]),i=r[1],s=await dP.getObject({id:n,options:pP}),o="disassembled"in s.data.content?s.data.content.disassembled[i]:null;return o&&typeof o=="string"&&new RegExp(hP.join("|"),"i").test(o)&&(t=!0),t},gP=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>Di(i,!1)))==null?void 0:n.join(",")};function bP(){const{fetchByApi:e}=Yl(),t=async s=>{try{const o={...s},a=gP(s==null?void 0:s.coin_type);a&&(o.coin_type=a);const c=await e("/v2/sui/stats_pools","GET",o);if(c!=null&&c.lp_list)return{list:(c==null?void 0:c.lp_list)||[],total:c==null?void 0:c.total}}catch(o){return console.error("getPoolList ~ Error:",o),await r(s)}return{list:[],total:0}},r=async s=>{var o,a,c,l;try{const u=Mt("/data/pools.json"),f=await fetch(u).then(p=>p.json());if((o=f==null?void 0:f.data)!=null&&o.lp_list){const p=(a=f==null?void 0:f.data)==null?void 0:a.lp_list;let y=p;if(s!=null&&s.coin_type){const v=(l=(c=s==null?void 0:s.coin_type)==null?void 0:c.split(","))==null?void 0:l.map(C=>on(C).source_address);y=p==null?void 0:p.filter(C=>{var j,U;const I=on((j=C==null?void 0:C.coin_a)==null?void 0:j.address).source_address,O=on((U=C==null?void 0:C.coin_b)==null?void 0:U.address).source_address;return(v==null?void 0:v.length)>1&&v.includes(I)&&v.includes(O)?!0:!!((v==null?void 0:v.length)===1&&(v.includes(I)||v.includes(O)))})}s!=null&&s.is_vaults&&(y=p==null?void 0:p.filter(v=>v==null?void 0:v.is_vaults)),s!=null&&s.has_farming&&!(s!=null&&s.is_vaults)&&!(s!=null&&s.has_mining)&&!(s!=null&&s.no_incentives)&&(y=p==null?void 0:p.filter(v=>v==null?void 0:v.has_farming));const x=y;return{list:x,total:(x==null?void 0:x.length)||0}}}catch(u){console.error("getLocalJsonPoolList Error:",u)}return{list:[],total:0}},n=s=>kp(s)==="0x2::sui::SUI"?"0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI":kp(s);return{getPoolList:t,getLocalJsonPoolList:r,getLocalJsonPoolAddress:async(s,o)=>{try{const a=n(s),c=n(o),l=await fetch("/data/all-pools.json").then(u=>u.json());if(l)return l[`${a.toLocaleLowerCase()}-${c.toLocaleLowerCase()}`]||l[`${c.toLocaleLowerCase()}-${a.toLocaleLowerCase()}`]}catch(a){console.error("getLocalJsonPoolAddress Error:",a)}return[]}}}function vP(e=!0){const{poolApiMap:t,setPoolApiMap:r}=zr(),{getPoolList:n,getLocalJsonPoolList:i,getLocalJsonPoolAddress:s}=bP();return{getPoolListByCoinType:async(c,l)=>{if(c&&l){const u=[c,l].sort(),f=`${u[0]}_${u[1]}`,p=t[f];if(p)return p;const y={coin_type:`${c},${l}`,display_all_pools:!0,offset:0,limit:100,order_by:"-tvl",no_incentives:!0,has_farming:!0,has_mining:!0};let x=e?await i(y):void 0;(x===void 0||x.list.length===0)&&(x=await n(y));const v=x.list;if(v.length>0)return t[f]=v,r(f,v),v}return[]},getPoolAddressByCoinType:async(c,l)=>{if(c&&l){const u=[c,l].sort(),f=`${u[0]}_${u[1]}`;if(e){const x=await s(c,l);if(!x||x.length===0){const v=t[f];if(v)return v.map(C=>C.poolAddress)}else return x}const p={coin_type:`${c},${l}`,display_all_pools:!0,offset:0,limit:100,order_by:"-tvl",no_incentives:!0,has_farming:!0,has_mining:!0},y=await n(p);if(y){const x=y.list;if(x.length>0)return t[f]=x,r(f,x),x.map(v=>v.poolAddress)}}return[]}}}function yP(e){const{routerData:t}=en();return{priceAcceptRouterData:Z.useMemo(()=>{if(t&&e){if(e.byAmountIn){if(!Me(e.toAmountUi).eq(t.toAmountUi||"0"))return t}else if(!Me(e.fromAmountUi).eq(t.fromAmountUi||"0"))return t;return}},[t,e])}}function Zw(e,t){return{amountLimit:Z.useMemo(()=>{if(t&&t.routerData){const{byAmountIn:n,fromAmountUi:i,toAmountUi:s}=t;return n?Me(s).mul(Me(1).sub(Me(e).div(100))).toString():Me(i).mul(Me(1).add(Me(e).div(100))).toString()}},[e,t])}}function wP(e){const{getTokenInfo:t,fetchTokenInfo:r}=bs();return{formatSwapRouter:Z.useMemo(()=>{if(e&&e.routerData){const i=[],s=e.byAmountIn?e.routerData.amountIn.toString():e.routerData.amountOut.toString(),o=[],a=[];let c=Me(0);if(e.routerData.routes.forEach((u,f)=>{const p={},y=e.byAmountIn?u.amountIn.toString():u.amountOut.toString();f===e.routerData.routes.length-1?p.percentage=Me(1).sub(c).toFixed(2):p.percentage=Me(y).div(s).toFixed(2),c=Me(c).add(p.percentage);const x=[];u.path.forEach(v=>{i.includes(v.provider)||i.push(v.provider);const C=ur(v.from).full_address,I=ur(v.target).full_address,O=t(C),j=t(I);O||a.includes(C)&&a.push(C),j||a.includes(I)&&a.push(I);const U=v.provider===da.SCALLOP||v.provider===da.FLOWX||v.provider===da.FLOWXV3;x.push({from_type:C,to_type:I,pool_address:U?"":v.id,fee_rate:v.feeRate,provider:v.provider})}),p.paths=x,o.push(p)}),a.length>0)for(const u in a)r(u);return{router_summery:`${e.routerData.routes.length} Streams`,providers:i,routers:o}}},[e])}}function xP(){const{fromCoin:e,toCoin:t}=en(),{getPoolAddressByCoinType:r}=vP(!0);return{getSwapPoolAddress:async()=>e&&t?await r(e.coin_type,t.coin_type):[]}}function Qw(e,t,r){return Z.useMemo(()=>t&&r&&+t&&+r?e?Me(r).div(t).toString():Me(t).div(r).toString():"0",[t,r,e])}function pm(e){const[t,r]=Z.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await mP(i.coin_type)}catch{}return!1};return Z.useEffect(()=>{r(void 0),e&&n(e).then(i=>{r(i)})},[e==null?void 0:e.coin_type]),{isScamsCoin:t}}function SP(e,t){const{defaultFromCoinType:r,defaultToCoinCoinType:n}=en(),{getTokenInfo:i}=bs(),{ignoreWarnTokenMap:s}=zr(),o=i(e),a=i(t),c=Z.useMemo(()=>!oc(r,Jw.coin_type)||!oc(n,Xw.coin_type),[r,n]),l=Z.useCallback(f=>f&&!s[Di(f.coin_type)]&&(oc(r,f.coin_type)||oc(n,f.coin_type))?!f.is_trusted:!1,[r,n,s]),u=Z.useMemo(()=>{const f=[];return c&&(o&&l(o)&&f.push({...o}),a&&l(a)&&f.push({...a})),f},[o==null?void 0:o.coin_type,a==null?void 0:a.coin_type,c,s]);return{isCustomMode:c,customWarnTokenList:u}}function _P(){const{aggregatorSDK:e}=gs(),{getSwapPoolAddress:t}=xP(),r=s=>s&&s.error?s.error.code===Ns.InsufficientLiquidity||Ns.HoneyPot||Ns.NumberTooLarge:!1,n=async s=>{const{fromToken:o,toToken:a,amount:c,providersKeys:l,by_amount_in:u,uuid:f}=s;try{const p={from:o.coin_type,target:a.coin_type,amount:new $h(c),byAmountIn:u,depth:3,splitAlgorithm:void 0,splitFactor:void 0,splitCount:void 0,providers:l},y=await e.findRouters(p);if(y&&r(y))return i(!1,u,f,o,a,y);if(!y||y.routes.length===0)throw Error("not find router");return i(!1,u,f,o,a,y)}catch{const y=await t(),x={from:o.coin_type,target:a.coin_type,amount:new $h(c),byAmountIn:u,pools:y};try{const v=await e.swapInPools(x);return!v||!v.routeData?i(!0,u,f,o,a):i(!0,u,f,o,a,v.routeData)}catch{return{uuid:f,byAmountIn:u,isDegrade:!0}}}},i=(s,o,a,c,l,u)=>{var f;if(u){const p=u.error!==void 0,y=cf(u.amountIn.toString(),c.decimals).toString(),x=cf(u.amountOut.toString(),l.decimals).toString();return{routerData:p?void 0:u,fromAmountUi:p?o?y:"":y,toAmountUi:p&&o?"":x,uuid:a,byAmountIn:o,isDegrade:s,errorCode:(f=u.error)==null?void 0:f.code}}else return{uuid:a,byAmountIn:o,isDegrade:s}};return{findBestRouters:n}}function oo(e){const t=Z.useRef(e);return Z.useEffect(()=>{t.current=e},[e]),t}function EP(e){try{return e&&e.toString().includes("Rejected from user")}catch{return!1}}function CP(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function TP(e){return!!String(e).includes("Could not find the referenced transaction")}function MP(e){return!!String(e).includes("Max cap reached.")}function AP(e){return!!String(e).includes("Fast Mode service error")}function IP(e){return EP(e)?"User rejected the request":CP(e)?"Exceeded price slippage":TP(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":MP(e)?"Max cap reached. This is to prevent your txn from overpaying. You can choose to edit your gas max cap in settings if needed.":AP(e)?"Fast Mode service error, please switch to the Default Transaction Mode or try again later.":"Transaction failed"}var sh={},OP=Ar&&Ar.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(sh,"__esModule",{value:!0});var RP=sh.executeAuction=e6;const PP=OP(hb),jP="https://rpc.getshio.com",NP=500,kP=300;function e6(e,t,r=NP){const n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise((i,s)=>{setTimeout(i,r),PP.default.post(jP,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(o=>{setTimeout(i,kP)}).catch(s)})}sh.default={executeAuction:e6};const DP="0x2::sui::SUI",LP="https://rpc.getshio.com/fast",BP="0x1889977f0fb56ae730e7bda8e8e32859ce78874458c74910d36121a81a615123",mm=[{objectId:"0xc32ce42eac951759666cbc993646b72387ec2708a2917c2c6fb7d21f00108c18",version:72869622},{objectId:"0x0289acae0edcdf1fe3aedc2e886bc23064d41c359e0179a18152a64d1c1c2b3e",version:327637282},{objectId:"0x03132160e8c2c45208abf3ccf165e82edcc42fee2e614afe54582f9740a808b8",version:327637282},{objectId:"0x072ae7307459e535379f422995a0d10132f12a3450298f8cf0cc07bd164f9999",version:327637282},{objectId:"0x1c1a96a2f4a34ea09ab15b8ff98f4b6b4338ce89f4158eb7d3eb2cd4dcbd6d86",version:327637282},{objectId:"0x20d76f37ad9f2421a9e6afaf3bb204250b1c2241c50e8a955e86a1a48767d06f",version:327637282},{objectId:"0x213ed368233cc7480fcb6336e70c5ae7ee106b2317ba02ccb5d0478e45bcc046",version:327637282},{objectId:"0x22ce1e80937354eba5549fed2937dc6e2b24026d03505bb51a3e4a64aa4142f6",version:327637282},{objectId:"0x26188cb7ce5ae633279f440f66081cb65cc585e428de18e194f8843e866f799f",version:327637282},{objectId:"0x38642f01422480128388d3e2948d3dc1b2680f9914077edb6bd3451ae1c5bcf0",version:327637282},{objectId:"0x3dd85b6424aea1cae9eff6e55456ca783e056226325f1362106eca8b3ed04ca0",version:327637282},{objectId:"0x42f8adc490542369d9c3b95e9f6eb70b2583102900feb7e103072ed49ba7fc3d",version:327637282},{objectId:"0x46b8158c82fa6bda7230d31a127d934c7295a0042083b4900f3096e9191f6f3f",version:327637282},{objectId:"0x6ebac88a8c3f7a4a9fb05ea49d188a1fe8520ae59ee736e0473004d3033512a4",version:327637282},{objectId:"0x6f55ad6cb40cfc124c11b11c19be0a80237b104acd955e7b52ccb7bf9046fe33",version:327637282},{objectId:"0x71aafb8bac986e82e5f78846bf3b36c2a82505585625207324140227a27ff279",version:327637282},{objectId:"0x7fe9b08680d4179de5672f213b863525b21f10604ca161538075e9338d1d2324",version:327637282},{objectId:"0x81538ef2909a3e0dd3d7f38bcbee191509bae4e8666272938ced295672e2ee8d",version:327637282},{objectId:"0x828eb6b3354ad68a23dd792313a16a0d888b7ea4fdb884bb22bd569f8e61319e",version:327637282},{objectId:"0x9705a332b8c1650dd7fe687ef9f9a9638afb51c30c0b34db150d60b920bc07eb",version:327637282},{objectId:"0x9918f73797a9390e9888b55454f2b31bc01de1a4634acab08f80641c4248e8a5",version:327637282},{objectId:"0x9cd4c08bdf2e132ec2cc77b0f03be60a94951e046d8e82ed5494f44e609edd2f",version:327637282},{objectId:"0xac8ce2033571140509788337c8a1f3aa8941a320ecd7047acda310d39cad9e03",version:327637282},{objectId:"0xbcd4527035265461a9a7b4f1e57c63ea7a6bdf0dc223c66033c218d880f928b1",version:327637282},{objectId:"0xbfdb691b8cc0b3c3a3b7a654f6682f3e53b164d9ee00b9582cdb4d0a353440a9",version:327637282},{objectId:"0xc2559d5c52ae04837ddf943a8c2cd53a5a0b512cee615d30d3abe25aa339465e",version:327637282},{objectId:"0xc56db634d02511e66d7ca1254312b71c60d64dc44bf67ea46b922c52d8aebba6",version:327637282},{objectId:"0xc84545cbff1b36b874ab2b69d11a3d108f23562e87550588c0bda335b27101e0",version:327637282},{objectId:"0xcc141659b5885043f9bfcfe470064819ab9ac667953bcedd1000e0652e90ee76",version:327637282},{objectId:"0xef6bf4952968d25d3e79f7e4db1dc38f2e9d99d61ad38f3829acb4100fe6383a",version:327637282},{objectId:"0xf2ed8d00ef829de5c4a3c5adf2d6b0f41f7fec005fb9c88e5616b98173b2fd66",version:327637282},{objectId:"0xfce73f3c32c3f56ddb924a04cabd44dd870b72954bbe7c3d7767c3b8c25c4326",version:327637282}];async function UP(e){const t=e.client,r=await e.transaction.build({client:t,onlyTransactionKind:!0});let n=e.sender??e.transaction.getData().sender;if(!n)throw new Error("Sender need to be either set in options or in transaction data");return await t.call("shio_estimateFastModeFee",[n,e.transaction.getData().gasData.price,Kc.from(r).toString("base64")])}function FP(){return mm[Math.floor(Math.random()*mm.length)]}async function $P(e,t,r){return await e.executeTransactionBlock({transactionBlock:t.bytes,signature:t.signature,options:r})}async function VP(e,t,r){let n=e.moveCall({package:"0x2",module:"coin",function:"into_balance",typeArguments:[DP],arguments:[t]});return zP(e,n,r)}async function zP(e,t,r){let n=FP();e.moveCall({package:BP,module:"auctioneer",function:"submit_bid",arguments:[e.sharedObjectRef({objectId:n.objectId,mutable:!0,initialSharedVersion:n.version}),e.pure.u64(r),t]})}const yf="CoinWithBalance",qP=Ie({type:xt(),balance:Sl()});async function WP(e,t,r){var l,u;const n=new Set,i=new Map;if(!e.sender)throw new Error("Sender must be set to resolve CoinWithBalance");for(const f of e.commands)if(f.$kind==="$Intent"&&f.$Intent.name===yf){const{type:p,balance:y}=or(qP,f.$Intent.data);p!=="gas"&&y>0n&&n.add(p),i.set(p,(i.get(p)??0n)+y)}const s=new Set;for(const f of e.inputs)(l=f.Object)!=null&&l.ImmOrOwnedObject&&s.add(f.Object.ImmOrOwnedObject.objectId),(u=f.UnresolvedObject)!=null&&u.objectId&&s.add(f.UnresolvedObject.objectId);const o=new Map,a=t.client;await Promise.all([...n].map(async f=>{o.set(f,await HP({coinType:f,balance:i.get(f),client:a,owner:e.sender,usedIds:s}))}));const c=new Map;c.set("gas",{$kind:"GasCoin",GasCoin:!0});for(const[f,p]of e.commands.entries()){if(p.$kind!=="$Intent"||p.$Intent.name!==yf)continue;const{type:y,balance:x}=p.$Intent.data;if(x===0n&&y!=="gas"){e.replaceCommand(f,Xn.MoveCall({target:"0x2::coin::zero",typeArguments:[y]}));continue}const v=[];if(!c.has(y)){const[C,...I]=o.get(y).map(O=>e.addInput("object",Rn.ObjectRef({objectId:O.coinObjectId,digest:O.digest,version:O.version})));I.length>0&&v.push(Xn.MergeCoins(C,I)),c.set(y,C)}v.push(Xn.SplitCoins(c.get(y),[e.addInput("pure",Rn.Pure(dv.bcs.u64().serialize(x)))])),e.replaceCommand(f,v),e.mapArguments(C=>C.$kind==="Result"&&C.Result===f?{$kind:"NestedResult",NestedResult:[f+v.length-1,0]}:C)}return r()}async function HP({coinType:e,balance:t,client:r,owner:n,usedIds:i}){let s=t;const o=[];return a();async function a(c=null){const{data:l,hasNextPage:u,nextCursor:f}=await r.getCoins({owner:n,coinType:e,cursor:c}),p=l.sort((y,x)=>Number(BigInt(x.balance)-BigInt(y.balance)));for(const y of p){if(i.has(y.coinObjectId))continue;const x=BigInt(y.balance);if(o.push(y),s-=x,s<=0)return o}if(u)return a(f);throw new Error(`Not enough coins of type ${e} to satisfy requested balance`)}}function t6(){const{suiClient:e}=gs(),{currentAccount:t}=qr(),{mutateAsync:r}=Kr.useSignTransaction(),{mutate:n}=Kr.useSignAndExecuteTransaction({execute:async({bytes:c,signature:l})=>await s(c,l)}),i=Z.useMemo(()=>"sui:mainnet",[t]),s=async(c,l,u=!1)=>{var p,y;if(u){const x=await e.devInspectTransactionBlock({transactionBlock:rs.from(_r(c)),sender:t.address});if(!x||((p=x.effects)==null?void 0:p.status.status)==="failure")throw Error((y=x.effects)==null?void 0:y.status.error)}return await e.executeTransactionBlock({transactionBlock:c,signature:l,options:{showEvents:!0,showRawEffects:!0,showEffects:!0,showBalanceChanges:!0,showObjectChanges:!0,showInput:!0}})};return{signAndExecuteTransactionBlock:async(c,l=!1)=>{var f,p;let u;if(typeof c=="string"?u=rs.from(c):u=c,l){const y=await e.devInspectTransactionBlock({transactionBlock:c,sender:t.address});if(!y||((f=y.effects)==null?void 0:f.status.status)==="failure")throw Error((p=y.effects)==null?void 0:p.status.error)}return u.setGasBudget(1e8),new Promise((y,x)=>{n({transaction:u,chain:i},{onSuccess:v=>{y(v)},onError:v=>{console.error("signAndExecuteTransactionBlock transaction failed",v),x(v)}})})},signTransactionBlock:async c=>(c instanceof Uint8Array&&(c=rs.from(c)),typeof c=="string"&&(c=rs.from(_r(c))),new Promise((l,u)=>{r({transaction:c,chain:i},{onSuccess:f=>{l(f)},onError:f=>{console.error("signTransactionBlock failed",f),u(f)},onSettled:(f,p,y,x)=>{console.error("signTransactionBlock onSettled",{data:f,error:p,variables:y})}})})),executeTransactionBlock:s}}function GP(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=t6(),{currentAccount:n}=qr();return{getFastModeTx:async(s,o,a)=>{let c,l,u;try{const f=new Ls({url:LP});s.setSender(n==null?void 0:n.address),s.setGasPrice(Number(a));const p=rs.from(s);p.addIntentResolver(yf,WP);const y=await UP({transaction:p,client:f}),x=Me(o).mul(Math.pow(10,9)).toString();if(Me(y.gasBudget).gt(x))throw Error("Max cap reached. This is to prevent your txn from overpaying. You can choose to edit your gas max cap in settings if needed.");s.setGasBudget(y.gasBudget);const v=s.splitCoins(s.gas,[y.tipAmount]);VP(s,v[0],y.tipAmount);const C=await s.build({client:f}),I=await e(C),{bytes:O,signature:j}=I;u=O,l=new Date().getTime(),c=await $P(f,I,{showEffects:!0,showEvents:!0})}catch(f){throw String(f).includes("Failed to fetch")?Error("Fast Mode service error"):f}return{result:c,startExecuteTime:l,transactionBlockBytes:u}}}}function KP(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=t6(),{currentAccount:n}=qr(),{suiClient:i}=gs(),{setTransactionData:s}=ih(),{addTxToast:o,removeToast:a}=Bo(),{getFastModeTx:c}=GP(),l=5,u=2e3;async function f(x,v=1){try{let C;try{C=await i.getTransactionBlock({digest:x,options:{showEvents:!0,showEffects:!0,showBalanceChanges:!0,showInput:!0,showRawInput:!0,showObjectChanges:!0}})}catch{C=await i.getTransactionBlock({digest:x,options:{showEvents:!0,showEffects:!0}})}if(C)return C;throw new Error("Empty response")}catch(C){if(console.error(`Attempt ${v} failed:`,C),v>=l)throw new Error("Failed to fetch transaction status after maximum retries.");return await jp(u),f(x,v+1)}}const p=async(x,v,C={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock",useFastMode:!1,maxCapForGas:"",customGasPrice:""})=>{var re,ae,ne;const{useDevInspect:I=!1,useMev:O,txAction:j="signTransactionBlock",useFastMode:U=!1,maxCapForGas:D="",customGasPrice:H=""}=C;let q;v.status="confirmation",s(v);let G="";try{let V,N,h;typeof x=="function"?h=await x():h=x,h.setSender(n.address);let d;if(U&&D&&H){const S=await c(h,D,H);V=S.result,d=S.startExecuteTime,N=S.transactionBlockBytes}else if(j==="signTransactionBlock"){const S=await e(h),{bytes:E,signature:M}=S;if(O)try{const P=await RP(E,M,500)}catch{}V=await t(E,M,I)}else V=await r(h,I);v.status="submitted",s({...v}),v.tx=V.digest,q=o(v),await jp(u),G=V==null?void 0:V.digest;let m;if(((re=V==null?void 0:V.effects)==null?void 0:re.status.status)==="success"?m=V:m=await f(G,0),!m||((ae=m.effects)==null?void 0:ae.status.status)==="failure")y(v,(ne=m.effects)==null?void 0:ne.status.error);else{const S=IC(m,n==null?void 0:n.address,!1);if(v.buildShowInfo){const E=v.buildShowInfo("success",S);v.buildShowInfo=M=>E}a(q),v.status="success",s({...v})}return m}catch(V){y(v,V)}},y=(x,v)=>{const C=IP(v);if(x.buildShowInfo){const I=x.buildShowInfo("confirmation");x.buildShowInfo=O=>(I.toastDescriptionContent=C,I.modalDescriptionText=C,I),x.status="rejected",s({...x})}else x.buildShowInfo=I=>{const O={};return O.toastDescriptionContent=C,O.modalDescriptionText=C,O},x.status="rejected",s({...x})};return{signAndExecuteTransaction:p}}function oh(e,t=1e3){const r=Z.useRef(),n=Z.useCallback((...i)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...i)},t)},[e,t]);return Z.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),n}function YP(){const{aggregatorSDK:e}=gs(),{findBestRouters:t}=_P(),{getTokenAmountValue:r,fetchTokenPrices:n}=ec(),{providers:i,slippage:s,mevProtect:o,maxCapForGas:a,transactionMode:c,customGasPrice:l}=zr(),{signAndExecuteTransaction:u}=KP(),{setTransactionData:f}=ih(),{addTxToast:p}=Bo(),{fromCoin:y,toCoin:x,setFromCoin:v,setToCoin:C,setToAmount:I,fromAmount:O,toAmount:j,setFromAmount:U,setFindRouterLoading:D,setRouterData:H,setByAmountIn:q,byAmountIn:G}=en(),[re,ae]=Z.useState(""),ne=oo(re),V=oo(G),N=oo(O),h=oo(j),d=oo(y),m=oo(x),{balanceInfo:S,getOwnerCoinBalances:E}=Sa(y),{balanceInfo:M}=Sa(x),P=r(y==null?void 0:y.coin_type,O),A=r(x==null?void 0:x.coin_type,j),b=oh(async(Oe,Xe,Ne)=>{if(d.current&&m.current&&+Oe){(+N.current||+h.current)&&D(!0);const pt=TC(Oe,Xe?d.current.decimals:m.current.decimals),be=await t({fromToken:d.current,toToken:m.current,amount:pt.toString(),providersKeys:i,by_amount_in:Xe,uuid:Ne});D(!1),ne.current===Ne&&(Xe?+N.current?(I(be.toAmountUi||""),H(be)):I(""):+h.current?(U(be.fromAmountUi||"ß"),H(be)):U(""))}else te(!Xe)},500),B=(Oe,Xe,Ne=!1)=>{if(q(Xe),Xe?(U(Oe),Ne&&I("")):(I(Oe),Ne&&U("")),+Oe){const pt=hm();ae(pt),b(Oe,Xe,pt)}else D(!1),H(void 0),te(!Xe)},se=(Oe,Xe=!0)=>{te(),Xe?((Oe==null?void 0:Oe.coin_type)===(x==null?void 0:x.coin_type)&&C(y),v(Oe)):((Oe==null?void 0:Oe.coin_type)===(y==null?void 0:y.coin_type)&&v(x),C(Oe))},te=Oe=>{Oe===void 0?(U(""),I("")):Oe?U(""):I(""),D(!1),H(void 0)},le=()=>{const Oe=V.current?N.current:h.current;if(+Oe){const Xe=hm();ae(Xe),b(Oe,V.current,Xe)}},xe=async(Oe,Xe)=>{const{routerData:Ne,byAmountIn:pt,fromAmountUi:be,toAmountUi:he}=Oe,Ce=new rs,qe={routers:Ne,slippage:Number(s)/100,txb:Ce,partner:Xe||LC};try{const Be={status:"confirmation",buildShowInfo:(Fe,ft)=>{const mt=`Swap ${Dr(be,y==null?void 0:y.decimals)} ${y==null?void 0:y.symbol} for ${Dr(he,x==null?void 0:x.decimals)} ${x==null?void 0:x.symbol}`,$e={modalDescriptionText:mt,toastTitleText:mt};if(Fe==="success"){let At=be,wt=he;ft&&(At=Np(ft,y)||be,wt=Np(ft,x)||he);const Ke=`Swapped ${Dr(At,y==null?void 0:y.decimals)} ${y==null?void 0:y.symbol} for ${Dr(wt,x==null?void 0:x.decimals)} ${x==null?void 0:x.symbol}`;$e.toastTitleText=Ke,$e.modalDescriptionText=Ke}return $e},id:0};f(Be),await u(async()=>(await e.fastRouterSwap(qe),Ce),Be,{useMev:o,useFastMode:c==="Fast Mode",maxCapForGas:a,customGasPrice:l})?(te(),E()):le()}catch(Be){String(Be).includes("TypeError: Failed to fetch")&&p({id:0,status:"rejected",buildShowInfo(Ae,Re){return{toastTitleText:"RPC loading failed",toastDescriptionContent:"Try resubmission. Or to check your network and switch an RPC in settings to try again."}}})}};Z.useEffect(()=>{Se(),te()},[y==null?void 0:y.coin_type,x==null?void 0:x.coin_type]);const Se=()=>{const Oe=[];y&&Oe.push(y.coin_type),x&&Oe.push(x.coin_type),Oe.length>0&&n(Oe)},{isScamsCoin:Ee}=pm(y),{isScamsCoin:Ye}=pm(x),De=Z.useMemo(()=>{if(!(!Ee&&!Ye)){if(Ee&&Ye)return`${y==null?void 0:y.symbol} and ${x==null?void 0:x.symbol} are`;if(Ee)return`${y==null?void 0:y.symbol} token is `;if(Ye)return`${x==null?void 0:x.symbol} token is `}},[Ee,Ye]);return{handleAmountChange:B,handleSelectToken:se,fromBalanceInfo:S,toBalanceInfo:M,fromAmountValue:P,toAmountValue:A,doSwapAction:xe,reCalculateRouteData:le,refreshMarketPrice:Se,scamsText:De}}function JP(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:s}=en(),{currentAccount:o}=qr(),a=Z.useMemo(()=>{const c={text:"Swap",disabled:!1};if(!(o!=null&&o.address))return c.text="Connect Wallet",c.disabled=!1,c;if(!t||!r)return c.text="Select a token",c.disabled=!0,c;if(!+n&&!+i)return c.text="Enter an amount",c.disabled=!0,c;if(s&&s.errorCode){if(s.errorCode===Ns.InsufficientLiquidity)return c.text="Insufficient liquidity for this trade",c.disabled=!0,c;if(s.errorCode===Ns.NoRouter||s.errorCode===Ns.HoneyPot)return c.text="No Available Route",c.disabled=!0,c}return+n&&Me(n).gt(e||0)?(c.disabled=!0,c.text=`Insufficient ${yn(t==null?void 0:t.symbol)} Balance`,c):((!+n||!+i)&&(c.disabled=!0),c)},[o==null?void 0:o.address,n,i,e,s==null?void 0:s.errorCode,t,r]);return{btnText:a.text,btnDisabled:a.disabled}}function XP({themeType:e}){const t=e=="Light"?Mt("/images/logo_light@2x.png"):Mt("/images/logo@2x.png");return w.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",marginTop:"16px"},children:[w.jsx("span",{style:{fontSize:"12px",color:"var(--cs-text-primary)",fontWeight:"500",marginRight:"8px"},children:"Powered by"}),w.jsx("img",{style:{height:"20px"},src:t})]})}function ah({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i,fontSize:s="14px"}){const[o,a]=Z.useState(!0),c=Qw(o,r,n);return w.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{a(!o)},children:[w.jsx(Pr,{src:o?e==null?void 0:e.logo_url:t==null?void 0:t.logo_url,token:o?e:t,showWarnSize:"10px"}),w.jsxs("span",{style:{display:"flex",alignItems:"center",color:"var(--cs-text-primary)",fontSize:s,maxWidth:"80%"},children:["1"," ",yn(o?e==null?void 0:e.symbol:t==null?void 0:t.symbol)," ","="," ",i?w.jsx($o,{className:"custom-skeleton",style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):Dr(c,t==null?void 0:t.decimals)," ",yn(o?t==null?void 0:t.symbol:e==null?void 0:e.symbol)]}),w.jsx(Pr,{src:o?t==null?void 0:t.logo_url:e==null?void 0:e.logo_url,token:o?t:e,showWarnSize:"8px"}),w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-swap"})})]})}function pu(){const[e,t]=Z.useState(window.innerWidth),r=oh(()=>{t(window.innerWidth)},300);Z.useEffect(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[]);const n=Z.useMemo(()=>e<810,[e]);return{windowWidth:e,isApp:n}}function r6(e,t,r,n){const{getTokenPrice:i}=ec(),s=i(e==null?void 0:e.coin_type),o=i(t==null?void 0:t.coin_type),a=Qw(!0,r,n),c=Z.useMemo(()=>{if(o&&s)return Me(s.price).div(o.price).toString()},[s==null?void 0:s.price,o==null?void 0:o.price]),l=Z.useMemo(()=>{if(c&&+a)return Me(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),u=Z.useMemo(()=>{const v=[];return s&&v.push(s.market),o&&!v.includes(o.market)&&v.push(o.market),v},[s==null?void 0:s.market,o==null?void 0:o.market]),f=Z.useMemo(()=>!s||!o||s.market==="cetus"||o.market==="cetus",[s,o]),p=Z.useMemo(()=>f?!1:l&&Me(l).lt(0)?Me(l).abs().gt(5):!1,[l,f]),y=Z.useMemo(()=>f?!1:l&&Me(l).lt(0)?Me(l).abs().gt(10):!1,[l,f]),x=Z.useMemo(()=>{let v,C="yellow";if(f)return{priceImpactText:void 0,textColor:"yellow"};if(l)if(Me(l).gt(0))C="green",Me(l).lt(.1)?v="< 0.1% cheaper than":v=`${Dr(l,2,!0,Vr.ROUND_UP)}% cheaper than`;else if(Me(l).eq(0))v="0%",C="green";else{const I=Me(l).abs();I.lte(5)?(C="green",v=`Within ${Dr(I.toString(),2,!0,Vr.ROUND_UP)}%`):I.lte(10)?(C="yellow",v=`${Dr(I.toString(),2,!0,Vr.ROUND_UP)}% more than`):I.lte(100)?(C="red",v=`${Dr(I.toString(),2,!0,Vr.ROUND_UP)}% more than`):(C="red",v="> 100% more than")}return{priceImpactText:v,textColor:C}},[l,f]);return{swapPrice:a,marketPrice:c,priceImpact:l,sources:u,showPriceImpactTips:p,showPriceImpactWarn:y,priceImpactTextInfo:x,showIncalculable:f}}function n6({content:e,children:t,position:r,autoSwitchTooltip:n=!1,borderRadius:i="8px"}){const{isApp:s}=pu();return s&&n?w.jsxs(Pi.Root,{children:[w.jsx(Pi.Trigger,{children:w.jsx("button",{style:{background:"none",border:"none",padding:"0",margin:"0",outline:"none",boxShadow:"none",color:"inherit",font:"inherit",textAlign:"inherit"},children:t})}),w.jsx(Pi.Content,{variant:"soft",style:{transition:"opacity 0.3s ease",display:"block",zIndex:9e3,padding:"8px 12px",backgroundColor:"var(--cs-bg-primary)",color:"var(--cs-text-secondary)",borderRadius:i,fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)"},side:r,align:"center",children:e})]}):w.jsx($s,{content:e,position:r,borderRadius:i,children:t})}function i6({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=en();pu();const{priceImpact:a,sources:c,marketPrice:l,priceImpactTextInfo:u,showIncalculable:f}=r6(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi);return w.jsxs(w.Fragment,{children:[!r&&Me(a).lte(-30)&&!f&&w.jsx("div",{className:"price-impact-tips red",children:"High price difference. Be cautious before submitting your order."}),w.jsxs("div",{className:"price-impact-block",children:[w.jsxs("div",{className:"left",children:[w.jsx("span",{style:{color:"var(--cs-text-secondary)"},children:"Price Difference"}),w.jsx(n6,{autoSwitchTooltip:!0,position:"top",content:w.jsx(ZP,{fromToken:n,toToken:i,sources:c,baseAmount:"1",quoteAmount:l,showIncalculable:f}),children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:w.jsx("use",{xlinkHref:"#icon-tips"})})})]}),w.jsxs("div",{children:[e&&w.jsx($o,{className:"custom-skeleton",style:{width:"80px",height:"20px"}}),!e&&w.jsxs("div",{className:"right",children:[w.jsx("span",{className:u==null?void 0:u.textColor,children:u.priceImpactText&&!f?u==null?void 0:u.priceImpactText:"Incalculable"}),u.priceImpactText&&!f&&w.jsx("div",{className:"platforms",children:c.map(p=>w.jsx($s,{content:w.jsx("span",{style:{fontSize:"12px",color:"var(--cs-text-primary)"},children:r2[p]}),position:"top",delay:300,children:w.jsx(Pr,{src:VC[p],haveBorder:!1,style:{width:"16px",height:"16px"}})},p))})]})]})]})]})}function ZP({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i,showIncalculable:s}){const{isApp:o}=pu();return w.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[w.jsx("p",{style:{color:"var(--cs-text-secondary)",fontSize:"12px",lineHeight:"18px",width:o?"200px":"300px",textAlign:"start",whiteSpace:"normal"},children:"The difference between the market price and estimated price due to trade size."}),!s&&w.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[w.jsx("p",{style:{fontSize:"12px",color:"var(--cs-text-primary)"},children:"Market price sources:"}),r&&n?w.jsx(ah,{baseToken:e,quoteToken:t,baseAmount:"1",quoteAmount:n,loading:!1,fontSize:"12px"}):w.jsx("p",{style:{color:"var(--cs-text-primary)",fontSize:"12px"},children:"Price is unknown"})]}),!s&&w.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[w.jsx("p",{style:{color:"var(--cs-text-secondary)",fontSize:"12px",whiteSpace:"pre"},children:"Market price sources:"}),w.jsx("p",{style:{color:"var(--cs-text-secondary)",fontSize:"12px",whiteSpace:"pre"},children:i.map(a=>r2[a]+" ").join("")})]})]})}function s6({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:s,byAmountIn:o}=en();return w.jsxs("div",{className:"swap-info-between",style:{paddingLeft:t,paddingRight:e},children:[w.jsx("div",{className:"left",children:o?"Minimum Received":"Maximum Sold"}),n?w.jsx($o,{className:"custom-skeleton",style:{height:"18px",width:"80px"}}):w.jsxs("div",{className:"right",children:[Dr(r,o?s==null?void 0:s.decimals:i==null?void 0:i.decimals,!1,Vr.ROUND_DOWN)," ",yn(o?(s==null?void 0:s.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function QP({scamsText:e}){return w.jsxs("div",{style:{marginTop:"16px",borderRadius:"8px",border:"1px solid var(--cs-border)",paddingTop:"12px",width:"100%",backgroundColor:"var(--cs-bg-secondary-common)"},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"0 12px",justifyContent:"center",textAlign:"center"},children:[w.jsx("svg",{className:"cs-icon",style:{width:"20px",height:"20px",fill:"var(--cs-warning)"},"aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-alert"})}),w.jsx("span",{style:{color:"var(--cs-warning)",marginLeft:"4px"},children:"Alert"})]}),w.jsx("div",{style:{borderRadius:"8px",padding:"11px",margin:"-1px",marginTop:"14px",border:"1px solid var(--cs-border)",lineHeight:"1"},children:w.jsx(i2,{text:`${e} detected to have Deny List feature. It's an optional feature on Sui designed for regulated coins (learn more). However, it could be misused by HoneyPot scams, which may restrict users from selling the tokens after buying. Please be cautious.`,keywords:["learn more"],onKeywordClick:t=>{window.open("https://docs.sui.io/guides/developer/coin/regulated","_blank")}})})]})}function ej({onClick:e}){return w.jsxs("div",{className:"cs-icon-button cs-back-button",onClick:t=>{t.stopPropagation(),e()},children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-back"})}),w.jsx("span",{children:"Back"})]})}function ch({title:e,backClick:t}){return w.jsxs("div",{className:"cs-have-back-header",children:[w.jsx(ej,{onClick:t}),w.jsx("span",{className:"title",children:e})]})}const bc=globalThis||void 0||self;var tj=typeof bc=="object"&&bc&&bc.Object===Object&&bc;const o6=tj;var rj=typeof self=="object"&&self&&self.Object===Object&&self,nj=o6||rj||Function("return this")();const fi=nj;var ij=fi.Symbol;const li=ij;var a6=Object.prototype,sj=a6.hasOwnProperty,oj=a6.toString,Qo=li?li.toStringTag:void 0;function aj(e){var t=sj.call(e,Qo),r=e[Qo];try{e[Qo]=void 0;var n=!0}catch{}var i=oj.call(e);return n&&(t?e[Qo]=r:delete e[Qo]),i}var cj=Object.prototype,lj=cj.toString;function uj(e){return lj.call(e)}var dj="[object Null]",fj="[object Undefined]",gm=li?li.toStringTag:void 0;function Vo(e){return e==null?e===void 0?fj:dj:gm&&gm in Object(e)?aj(e):uj(e)}function hs(e){return e!=null&&typeof e=="object"}var hj="[object Symbol]";function Ia(e){return typeof e=="symbol"||hs(e)&&Vo(e)==hj}function Lc(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var pj=Array.isArray;const Qr=pj;var mj=1/0,bm=li?li.prototype:void 0,vm=bm?bm.toString:void 0;function c6(e){if(typeof e=="string")return e;if(Qr(e))return Lc(e,c6)+"";if(Ia(e))return vm?vm.call(e):"";var t=e+"";return t=="0"&&1/e==-mj?"-0":t}function zo(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function l6(e){return e}var gj="[object AsyncFunction]",bj="[object Function]",vj="[object GeneratorFunction]",yj="[object Proxy]";function u6(e){if(!zo(e))return!1;var t=Vo(e);return t==bj||t==vj||t==gj||t==yj}var wj=fi["__core-js_shared__"];const yd=wj;var ym=function(){var e=/[^.]+$/.exec(yd&&yd.keys&&yd.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function xj(e){return!!ym&&ym in e}var Sj=Function.prototype,_j=Sj.toString;function Xs(e){if(e!=null){try{return _j.call(e)}catch{}try{return e+""}catch{}}return""}var Ej=/[\\^$.*+?()[\]{}|]/g,Cj=/^\[object .+?Constructor\]$/,Tj=Function.prototype,Mj=Object.prototype,Aj=Tj.toString,Ij=Mj.hasOwnProperty,Oj=RegExp("^"+Aj.call(Ij).replace(Ej,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Rj(e){if(!zo(e)||xj(e))return!1;var t=u6(e)?Oj:Cj;return t.test(Xs(e))}function Pj(e,t){return e==null?void 0:e[t]}function Zs(e,t){var r=Pj(e,t);return Rj(r)?r:void 0}var jj=Zs(fi,"WeakMap");const wf=jj;var wm=Object.create,Nj=function(){function e(){}return function(t){if(!zo(t))return{};if(wm)return wm(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const kj=Nj;function Dj(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var Lj=function(){try{var e=Zs(Object,"defineProperty");return e({},"",{}),e}catch{}}();const xm=Lj;function Bj(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var Uj=9007199254740991,Fj=/^(?:0|[1-9]\d*)$/;function d6(e,t){var r=typeof e;return t=t??Uj,!!t&&(r=="number"||r!="symbol"&&Fj.test(e))&&e>-1&&e%1==0&&e<t}function f6(e,t,r){t=="__proto__"&&xm?xm(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function lh(e,t){return e===t||e!==e&&t!==t}var $j=Object.prototype,Vj=$j.hasOwnProperty;function h6(e,t,r){var n=e[t];(!(Vj.call(e,t)&&lh(n,r))||r===void 0&&!(t in e))&&f6(e,t,r)}function mu(e,t,r,n){var i=!r;r||(r={});for(var s=-1,o=t.length;++s<o;){var a=t[s],c=n?n(r[a],e[a],a,r,e):void 0;c===void 0&&(c=e[a]),i?f6(r,a,c):h6(r,a,c)}return r}var zj=9007199254740991;function uh(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=zj}function gu(e){return e!=null&&uh(e.length)&&!u6(e)}var qj=Object.prototype;function dh(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||qj;return e===r}function Wj(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var Hj="[object Arguments]";function Sm(e){return hs(e)&&Vo(e)==Hj}var p6=Object.prototype,Gj=p6.hasOwnProperty,Kj=p6.propertyIsEnumerable,Yj=Sm(function(){return arguments}())?Sm:function(e){return hs(e)&&Gj.call(e,"callee")&&!Kj.call(e,"callee")};const m6=Yj;function Jj(){return!1}var g6=typeof exports=="object"&&exports&&!exports.nodeType&&exports,_m=g6&&typeof module=="object"&&module&&!module.nodeType&&module,Xj=_m&&_m.exports===g6,Em=Xj?fi.Buffer:void 0,Zj=Em?Em.isBuffer:void 0,Qj=Zj||Jj;const ml=Qj;var eN="[object Arguments]",tN="[object Array]",rN="[object Boolean]",nN="[object Date]",iN="[object Error]",sN="[object Function]",oN="[object Map]",aN="[object Number]",cN="[object Object]",lN="[object RegExp]",uN="[object Set]",dN="[object String]",fN="[object WeakMap]",hN="[object ArrayBuffer]",pN="[object DataView]",mN="[object Float32Array]",gN="[object Float64Array]",bN="[object Int8Array]",vN="[object Int16Array]",yN="[object Int32Array]",wN="[object Uint8Array]",xN="[object Uint8ClampedArray]",SN="[object Uint16Array]",_N="[object Uint32Array]",er={};er[mN]=er[gN]=er[bN]=er[vN]=er[yN]=er[wN]=er[xN]=er[SN]=er[_N]=!0;er[eN]=er[tN]=er[hN]=er[rN]=er[pN]=er[nN]=er[iN]=er[sN]=er[oN]=er[aN]=er[cN]=er[lN]=er[uN]=er[dN]=er[fN]=!1;function EN(e){return hs(e)&&uh(e.length)&&!!er[Vo(e)]}function bu(e){return function(t){return e(t)}}var b6=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fa=b6&&typeof module=="object"&&module&&!module.nodeType&&module,CN=fa&&fa.exports===b6,wd=CN&&o6.process,TN=function(){try{var e=fa&&fa.require&&fa.require("util").types;return e||wd&&wd.binding&&wd.binding("util")}catch{}}();const Ro=TN;var Cm=Ro&&Ro.isTypedArray,MN=Cm?bu(Cm):EN;const v6=MN;var AN=Object.prototype,IN=AN.hasOwnProperty;function y6(e,t){var r=Qr(e),n=!r&&m6(e),i=!r&&!n&&ml(e),s=!r&&!n&&!i&&v6(e),o=r||n||i||s,a=o?Wj(e.length,String):[],c=a.length;for(var l in e)(t||IN.call(e,l))&&!(o&&(l=="length"||i&&(l=="offset"||l=="parent")||s&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||d6(l,c)))&&a.push(l);return a}function w6(e,t){return function(r){return e(t(r))}}var ON=w6(Object.keys,Object);const RN=ON;var PN=Object.prototype,jN=PN.hasOwnProperty;function NN(e){if(!dh(e))return RN(e);var t=[];for(var r in Object(e))jN.call(e,r)&&r!="constructor"&&t.push(r);return t}function tc(e){return gu(e)?y6(e):NN(e)}function kN(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var DN=Object.prototype,LN=DN.hasOwnProperty;function BN(e){if(!zo(e))return kN(e);var t=dh(e),r=[];for(var n in e)n=="constructor"&&(t||!LN.call(e,n))||r.push(n);return r}function fh(e){return gu(e)?y6(e,!0):BN(e)}var UN=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,FN=/^\w*$/;function hh(e,t){if(Qr(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Ia(e)?!0:FN.test(e)||!UN.test(e)||t!=null&&e in Object(t)}var $N=Zs(Object,"create");const Oa=$N;function VN(){this.__data__=Oa?Oa(null):{},this.size=0}function zN(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var qN="__lodash_hash_undefined__",WN=Object.prototype,HN=WN.hasOwnProperty;function GN(e){var t=this.__data__;if(Oa){var r=t[e];return r===qN?void 0:r}return HN.call(t,e)?t[e]:void 0}var KN=Object.prototype,YN=KN.hasOwnProperty;function JN(e){var t=this.__data__;return Oa?t[e]!==void 0:YN.call(t,e)}var XN="__lodash_hash_undefined__";function ZN(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Oa&&t===void 0?XN:t,this}function Vs(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Vs.prototype.clear=VN;Vs.prototype.delete=zN;Vs.prototype.get=GN;Vs.prototype.has=JN;Vs.prototype.set=ZN;function QN(){this.__data__=[],this.size=0}function vu(e,t){for(var r=e.length;r--;)if(lh(e[r][0],t))return r;return-1}var ek=Array.prototype,tk=ek.splice;function rk(e){var t=this.__data__,r=vu(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():tk.call(t,r,1),--this.size,!0}function nk(e){var t=this.__data__,r=vu(t,e);return r<0?void 0:t[r][1]}function ik(e){return vu(this.__data__,e)>-1}function sk(e,t){var r=this.__data__,n=vu(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function zi(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}zi.prototype.clear=QN;zi.prototype.delete=rk;zi.prototype.get=nk;zi.prototype.has=ik;zi.prototype.set=sk;var ok=Zs(fi,"Map");const Ra=ok;function ak(){this.size=0,this.__data__={hash:new Vs,map:new(Ra||zi),string:new Vs}}function ck(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function yu(e,t){var r=e.__data__;return ck(t)?r[typeof t=="string"?"string":"hash"]:r.map}function lk(e){var t=yu(this,e).delete(e);return this.size-=t?1:0,t}function uk(e){return yu(this,e).get(e)}function dk(e){return yu(this,e).has(e)}function fk(e,t){var r=yu(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function qi(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}qi.prototype.clear=ak;qi.prototype.delete=lk;qi.prototype.get=uk;qi.prototype.has=dk;qi.prototype.set=fk;var hk="Expected a function";function ph(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(hk);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=e.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(ph.Cache||qi),r}ph.Cache=qi;var pk=500;function mk(e){var t=ph(e,function(n){return r.size===pk&&r.clear(),n}),r=t.cache;return t}var gk=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bk=/\\(\\)?/g,vk=mk(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(gk,function(r,n,i,s){t.push(i?s.replace(bk,"$1"):n||r)}),t});const yk=vk;function wk(e){return e==null?"":c6(e)}function x6(e,t){return Qr(e)?e:hh(e,t)?[e]:yk(wk(e))}var xk=1/0;function wu(e){if(typeof e=="string"||Ia(e))return e;var t=e+"";return t=="0"&&1/e==-xk?"-0":t}function mh(e,t){t=x6(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[wu(t[r++])];return r&&r==n?e:void 0}function Sk(e,t,r){var n=e==null?void 0:mh(e,t);return n===void 0?r:n}function S6(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var _k=w6(Object.getPrototypeOf,Object);const _6=_k;function Ek(){this.__data__=new zi,this.size=0}function Ck(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function Tk(e){return this.__data__.get(e)}function Mk(e){return this.__data__.has(e)}var Ak=200;function Ik(e,t){var r=this.__data__;if(r instanceof zi){var n=r.__data__;if(!Ra||n.length<Ak-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new qi(n)}return r.set(e,t),this.size=r.size,this}function si(e){var t=this.__data__=new zi(e);this.size=t.size}si.prototype.clear=Ek;si.prototype.delete=Ck;si.prototype.get=Tk;si.prototype.has=Mk;si.prototype.set=Ik;function Ok(e,t){return e&&mu(t,tc(t),e)}function Rk(e,t){return e&&mu(t,fh(t),e)}var E6=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Tm=E6&&typeof module=="object"&&module&&!module.nodeType&&module,Pk=Tm&&Tm.exports===E6,Mm=Pk?fi.Buffer:void 0,Am=Mm?Mm.allocUnsafe:void 0;function jk(e,t){if(t)return e.slice();var r=e.length,n=Am?Am(r):new e.constructor(r);return e.copy(n),n}function C6(e,t){for(var r=-1,n=e==null?0:e.length,i=0,s=[];++r<n;){var o=e[r];t(o,r,e)&&(s[i++]=o)}return s}function T6(){return[]}var Nk=Object.prototype,kk=Nk.propertyIsEnumerable,Im=Object.getOwnPropertySymbols,Dk=Im?function(e){return e==null?[]:(e=Object(e),C6(Im(e),function(t){return kk.call(e,t)}))}:T6;const gh=Dk;function Lk(e,t){return mu(e,gh(e),t)}var Bk=Object.getOwnPropertySymbols,Uk=Bk?function(e){for(var t=[];e;)S6(t,gh(e)),e=_6(e);return t}:T6;const M6=Uk;function Fk(e,t){return mu(e,M6(e),t)}function A6(e,t,r){var n=t(e);return Qr(e)?n:S6(n,r(e))}function xf(e){return A6(e,tc,gh)}function $k(e){return A6(e,fh,M6)}var Vk=Zs(fi,"DataView");const Sf=Vk;var zk=Zs(fi,"Promise");const _f=zk;var qk=Zs(fi,"Set");const Ef=qk;var Om="[object Map]",Wk="[object Object]",Rm="[object Promise]",Pm="[object Set]",jm="[object WeakMap]",Nm="[object DataView]",Hk=Xs(Sf),Gk=Xs(Ra),Kk=Xs(_f),Yk=Xs(Ef),Jk=Xs(wf),Es=Vo;(Sf&&Es(new Sf(new ArrayBuffer(1)))!=Nm||Ra&&Es(new Ra)!=Om||_f&&Es(_f.resolve())!=Rm||Ef&&Es(new Ef)!=Pm||wf&&Es(new wf)!=jm)&&(Es=function(e){var t=Vo(e),r=t==Wk?e.constructor:void 0,n=r?Xs(r):"";if(n)switch(n){case Hk:return Nm;case Gk:return Om;case Kk:return Rm;case Yk:return Pm;case Jk:return jm}return t});const Pa=Es;var Xk=Object.prototype,Zk=Xk.hasOwnProperty;function Qk(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&Zk.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var eD=fi.Uint8Array;const gl=eD;function bh(e){var t=new e.constructor(e.byteLength);return new gl(t).set(new gl(e)),t}function tD(e,t){var r=t?bh(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var rD=/\w*$/;function nD(e){var t=new e.constructor(e.source,rD.exec(e));return t.lastIndex=e.lastIndex,t}var km=li?li.prototype:void 0,Dm=km?km.valueOf:void 0;function iD(e){return Dm?Object(Dm.call(e)):{}}function sD(e,t){var r=t?bh(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var oD="[object Boolean]",aD="[object Date]",cD="[object Map]",lD="[object Number]",uD="[object RegExp]",dD="[object Set]",fD="[object String]",hD="[object Symbol]",pD="[object ArrayBuffer]",mD="[object DataView]",gD="[object Float32Array]",bD="[object Float64Array]",vD="[object Int8Array]",yD="[object Int16Array]",wD="[object Int32Array]",xD="[object Uint8Array]",SD="[object Uint8ClampedArray]",_D="[object Uint16Array]",ED="[object Uint32Array]";function CD(e,t,r){var n=e.constructor;switch(t){case pD:return bh(e);case oD:case aD:return new n(+e);case mD:return tD(e,r);case gD:case bD:case vD:case yD:case wD:case xD:case SD:case _D:case ED:return sD(e,r);case cD:return new n;case lD:case fD:return new n(e);case uD:return nD(e);case dD:return new n;case hD:return iD(e)}}function TD(e){return typeof e.constructor=="function"&&!dh(e)?kj(_6(e)):{}}var MD="[object Map]";function AD(e){return hs(e)&&Pa(e)==MD}var Lm=Ro&&Ro.isMap,ID=Lm?bu(Lm):AD;const OD=ID;var RD="[object Set]";function PD(e){return hs(e)&&Pa(e)==RD}var Bm=Ro&&Ro.isSet,jD=Bm?bu(Bm):PD;const ND=jD;var kD=1,DD=2,LD=4,I6="[object Arguments]",BD="[object Array]",UD="[object Boolean]",FD="[object Date]",$D="[object Error]",O6="[object Function]",VD="[object GeneratorFunction]",zD="[object Map]",qD="[object Number]",R6="[object Object]",WD="[object RegExp]",HD="[object Set]",GD="[object String]",KD="[object Symbol]",YD="[object WeakMap]",JD="[object ArrayBuffer]",XD="[object DataView]",ZD="[object Float32Array]",QD="[object Float64Array]",eL="[object Int8Array]",tL="[object Int16Array]",rL="[object Int32Array]",nL="[object Uint8Array]",iL="[object Uint8ClampedArray]",sL="[object Uint16Array]",oL="[object Uint32Array]",Jt={};Jt[I6]=Jt[BD]=Jt[JD]=Jt[XD]=Jt[UD]=Jt[FD]=Jt[ZD]=Jt[QD]=Jt[eL]=Jt[tL]=Jt[rL]=Jt[zD]=Jt[qD]=Jt[R6]=Jt[WD]=Jt[HD]=Jt[GD]=Jt[KD]=Jt[nL]=Jt[iL]=Jt[sL]=Jt[oL]=!0;Jt[$D]=Jt[O6]=Jt[YD]=!1;function Bc(e,t,r,n,i,s){var o,a=t&kD,c=t&DD,l=t&LD;if(r&&(o=i?r(e,n,i,s):r(e)),o!==void 0)return o;if(!zo(e))return e;var u=Qr(e);if(u){if(o=Qk(e),!a)return Dj(e,o)}else{var f=Pa(e),p=f==O6||f==VD;if(ml(e))return jk(e,a);if(f==R6||f==I6||p&&!i){if(o=c||p?{}:TD(e),!a)return c?Fk(e,Rk(o,e)):Lk(e,Ok(o,e))}else{if(!Jt[f])return i?e:{};o=CD(e,f,a)}}s||(s=new si);var y=s.get(e);if(y)return y;s.set(e,o),ND(e)?e.forEach(function(C){o.add(Bc(C,t,r,C,e,s))}):OD(e)&&e.forEach(function(C,I){o.set(I,Bc(C,t,r,I,e,s))});var x=l?c?$k:xf:c?fh:tc,v=u?void 0:x(e);return Bj(v||e,function(C,I){v&&(I=C,C=e[I]),h6(o,I,Bc(C,t,r,I,e,s))}),o}var aL=1,cL=4;function lL(e){return Bc(e,aL|cL)}var uL="__lodash_hash_undefined__";function dL(e){return this.__data__.set(e,uL),this}function fL(e){return this.__data__.has(e)}function bl(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new qi;++t<r;)this.add(e[t])}bl.prototype.add=bl.prototype.push=dL;bl.prototype.has=fL;function hL(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function pL(e,t){return e.has(t)}var mL=1,gL=2;function P6(e,t,r,n,i,s){var o=r&mL,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var l=s.get(e),u=s.get(t);if(l&&u)return l==t&&u==e;var f=-1,p=!0,y=r&gL?new bl:void 0;for(s.set(e,t),s.set(t,e);++f<a;){var x=e[f],v=t[f];if(n)var C=o?n(v,x,f,t,e,s):n(x,v,f,e,t,s);if(C!==void 0){if(C)continue;p=!1;break}if(y){if(!hL(t,function(I,O){if(!pL(y,O)&&(x===I||i(x,I,r,n,s)))return y.push(O)})){p=!1;break}}else if(!(x===v||i(x,v,r,n,s))){p=!1;break}}return s.delete(e),s.delete(t),p}function bL(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function vL(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var yL=1,wL=2,xL="[object Boolean]",SL="[object Date]",_L="[object Error]",EL="[object Map]",CL="[object Number]",TL="[object RegExp]",ML="[object Set]",AL="[object String]",IL="[object Symbol]",OL="[object ArrayBuffer]",RL="[object DataView]",Um=li?li.prototype:void 0,xd=Um?Um.valueOf:void 0;function PL(e,t,r,n,i,s,o){switch(r){case RL:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case OL:return!(e.byteLength!=t.byteLength||!s(new gl(e),new gl(t)));case xL:case SL:case CL:return lh(+e,+t);case _L:return e.name==t.name&&e.message==t.message;case TL:case AL:return e==t+"";case EL:var a=bL;case ML:var c=n&yL;if(a||(a=vL),e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;n|=wL,o.set(e,t);var u=P6(a(e),a(t),n,i,s,o);return o.delete(e),u;case IL:if(xd)return xd.call(e)==xd.call(t)}return!1}var jL=1,NL=Object.prototype,kL=NL.hasOwnProperty;function DL(e,t,r,n,i,s){var o=r&jL,a=xf(e),c=a.length,l=xf(t),u=l.length;if(c!=u&&!o)return!1;for(var f=c;f--;){var p=a[f];if(!(o?p in t:kL.call(t,p)))return!1}var y=s.get(e),x=s.get(t);if(y&&x)return y==t&&x==e;var v=!0;s.set(e,t),s.set(t,e);for(var C=o;++f<c;){p=a[f];var I=e[p],O=t[p];if(n)var j=o?n(O,I,p,t,e,s):n(I,O,p,e,t,s);if(!(j===void 0?I===O||i(I,O,r,n,s):j)){v=!1;break}C||(C=p=="constructor")}if(v&&!C){var U=e.constructor,D=t.constructor;U!=D&&"constructor"in e&&"constructor"in t&&!(typeof U=="function"&&U instanceof U&&typeof D=="function"&&D instanceof D)&&(v=!1)}return s.delete(e),s.delete(t),v}var LL=1,Fm="[object Arguments]",$m="[object Array]",vc="[object Object]",BL=Object.prototype,Vm=BL.hasOwnProperty;function UL(e,t,r,n,i,s){var o=Qr(e),a=Qr(t),c=o?$m:Pa(e),l=a?$m:Pa(t);c=c==Fm?vc:c,l=l==Fm?vc:l;var u=c==vc,f=l==vc,p=c==l;if(p&&ml(e)){if(!ml(t))return!1;o=!0,u=!1}if(p&&!u)return s||(s=new si),o||v6(e)?P6(e,t,r,n,i,s):PL(e,t,c,r,n,i,s);if(!(r&LL)){var y=u&&Vm.call(e,"__wrapped__"),x=f&&Vm.call(t,"__wrapped__");if(y||x){var v=y?e.value():e,C=x?t.value():t;return s||(s=new si),i(v,C,r,n,s)}}return p?(s||(s=new si),DL(e,t,r,n,i,s)):!1}function xu(e,t,r,n,i){return e===t?!0:e==null||t==null||!hs(e)&&!hs(t)?e!==e&&t!==t:UL(e,t,r,n,xu,i)}var FL=1,$L=2;function VL(e,t,r,n){var i=r.length,s=i,o=!n;if(e==null)return!s;for(e=Object(e);i--;){var a=r[i];if(o&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<s;){a=r[i];var c=a[0],l=e[c],u=a[1];if(o&&a[2]){if(l===void 0&&!(c in e))return!1}else{var f=new si;if(n)var p=n(l,u,c,e,t,f);if(!(p===void 0?xu(u,l,FL|$L,n,f):p))return!1}}return!0}function j6(e){return e===e&&!zo(e)}function zL(e){for(var t=tc(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,j6(i)]}return t}function N6(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function qL(e){var t=zL(e);return t.length==1&&t[0][2]?N6(t[0][0],t[0][1]):function(r){return r===e||VL(r,e,t)}}function WL(e,t){return e!=null&&t in Object(e)}function HL(e,t,r){t=x6(t,e);for(var n=-1,i=t.length,s=!1;++n<i;){var o=wu(t[n]);if(!(s=e!=null&&r(e,o)))break;e=e[o]}return s||++n!=i?s:(i=e==null?0:e.length,!!i&&uh(i)&&d6(o,i)&&(Qr(e)||m6(e)))}function GL(e,t){return e!=null&&HL(e,t,WL)}var KL=1,YL=2;function JL(e,t){return hh(e)&&j6(t)?N6(wu(e),t):function(r){var n=Sk(r,e);return n===void 0&&n===t?GL(r,e):xu(t,n,KL|YL)}}function XL(e){return function(t){return t==null?void 0:t[e]}}function ZL(e){return function(t){return mh(t,e)}}function QL(e){return hh(e)?XL(wu(e)):ZL(e)}function k6(e){return typeof e=="function"?e:e==null?l6:typeof e=="object"?Qr(e)?JL(e[0],e[1]):qL(e):QL(e)}function eB(e){return function(t,r,n){for(var i=-1,s=Object(t),o=n(t),a=o.length;a--;){var c=o[e?a:++i];if(r(s[c],c,s)===!1)break}return t}}var tB=eB();const rB=tB;function nB(e,t){return e&&rB(e,t,tc)}function iB(e,t){return function(r,n){if(r==null)return r;if(!gu(r))return e(r,n);for(var i=r.length,s=t?i:-1,o=Object(r);(t?s--:++s<i)&&n(o[s],s,o)!==!1;);return r}}var sB=iB(nB);const D6=sB;function oB(e,t){var r=[];return D6(e,function(n,i,s){t(n,i,s)&&r.push(n)}),r}function aB(e,t){var r=Qr(e)?C6:oB;return r(e,k6(t))}function cB(e,t){var r=-1,n=gu(e)?Array(e.length):[];return D6(e,function(i,s,o){n[++r]=t(i,s,o)}),n}function lB(e,t){return xu(e,t)}function uB(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function dB(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,s=Ia(e),o=t!==void 0,a=t===null,c=t===t,l=Ia(t);if(!a&&!l&&!s&&e>t||s&&o&&c&&!a&&!l||n&&o&&c||!r&&c||!i)return 1;if(!n&&!s&&!l&&e<t||l&&r&&i&&!n&&!s||a&&r&&i||!o&&i||!c)return-1}return 0}function fB(e,t,r){for(var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;++n<o;){var c=dB(i[n],s[n]);if(c){if(n>=a)return c;var l=r[n];return c*(l=="desc"?-1:1)}}return e.index-t.index}function hB(e,t,r){t.length?t=Lc(t,function(s){return Qr(s)?function(o){return mh(o,s.length===1?s[0]:s)}:s}):t=[l6];var n=-1;t=Lc(t,bu(k6));var i=cB(e,function(s,o,a){var c=Lc(t,function(l){return l(s)});return{criteria:c,index:++n,value:s}});return uB(i,function(s,o){return fB(s,o,r)})}function pB(e,t,r,n){return e==null?[]:(Qr(t)||(t=t==null?[]:[t]),r=n?void 0:r,Qr(r)||(r=r==null?[]:[r]),hB(e,t,r))}function mB({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=en(),s=Z.useRef(!1),{slippage:o}=zr(),[a,c]=Z.useState(r),{fromAmountUi:l,toAmountUi:u,byAmountIn:f}=a,{amountLimit:p}=Zw(o,a),{showPriceImpactTips:y,showPriceImpactWarn:x}=r6(n,i,l,u),{priceAcceptRouterData:v}=yP(a),[C,I]=Z.useState(!1),[O,j]=Z.useState(!1);Z.useMemo(()=>f?i:n,[f]);const U=Z.useMemo(()=>v!==void 0,[v]),D=()=>{if(v){if(s.current)return;s.current=!0;const q=lL(v);c(q),setTimeout(()=>{s.current=!1},300)}},H=Z.useMemo(()=>C?!1:!!x,[C,x]);return w.jsxs("div",{className:"secondary-dialog",children:[w.jsx(ch,{title:"Review your order",backClick:e}),w.jsxs("div",{className:"secondary-content",children:[w.jsxs("div",{className:"trade-info",children:[w.jsxs("div",{className:"amount-info",children:[w.jsx("span",{className:"amount",children:Mo(l||"")}),w.jsx(Pr,{src:n==null?void 0:n.logo_url,token:n,style:{width:"28px",height:"28px"}}),w.jsx("span",{className:"symbol",children:yn((n==null?void 0:n.symbol)||"")})]}),w.jsx("div",{className:"dividing-line",children:w.jsx("div",{className:"swap-icon",children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-trade"})})})}),w.jsxs("div",{className:"amount-info",children:[w.jsx("span",{className:"amount",children:Mo(u||"")}),w.jsx(Pr,{src:i==null?void 0:i.logo_url,token:i,style:{width:"28px",height:"28px"}}),w.jsx("span",{className:"symbol",children:yn((i==null?void 0:i.symbol)||"")})]})]}),w.jsxs("div",{className:"current-price-tips-box yellow",style:{fontSize:"12px",marginTop:"8px",flexDirection:"column",justifyContent:"start",gap:"10px"},children:[w.jsx("div",{className:"current-price-box",style:{backgroundColor:"var(--cs-bg-primary)",marginTop:"-1px"},children:w.jsx(ah,{baseToken:n,quoteToken:i,baseAmount:l||"0",quoteAmount:u||"0",loading:!1})}),y&&w.jsx("div",{style:{paddingLeft:"8px",paddingBottom:"10px",color:"var(--cs-warning)"},children:"High price difference. Be cautious before submitting your order."})]}),w.jsxs("div",{className:"swap-info-between",style:{marginTop:"16px"},children:[w.jsx("div",{className:"left",children:"Slippage Tolerance"}),w.jsxs("div",{className:"right",children:[o,"%"]})]}),w.jsx(s6,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:p}),w.jsx(i6,{isLoading:!1,routerData:a,noTips:!0}),x&&w.jsxs("div",{style:{width:"100%",marginTop:"8px",gap:"1px"},children:[w.jsx("div",{style:{width:"100%",gap:"8px",fontSize:"12px",backgroundColor:"var(--cs-error-10)",paddingLeft:"16px",paddingRight:"16px",paddingTop:"8px",paddingBottom:"8px",borderRadius:"12px",color:"var(--cs-error)"},children:"The exchange rate of this order deviates from the market price by a large percentage. Are you sure you want to continue the swap?"}),w.jsxs("div",{style:{width:"100%",gap:"16px",display:"flex",flexDirection:"row",marginTop:"-10px"},children:[w.jsx("button",{className:C?"swap-btn cs-outline-btn secondary-btn ignorePriceImpact-btn":"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",flex:1,color:C?"var(--cs-primary)":"var(--cs-btn-disabled-text)"},onClick:()=>{I(!0)},children:"Yes, please continue."}),w.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",color:"var(--cs-btn-disabled-text)",flex:1},onClick:()=>e(),children:"No,cancel it."})]})]})]}),!U&&w.jsx("button",{disabled:H||O,className:"swap-btn cs-solid-btn",style:{marginTop:"16px"},onClick:()=>{O||(j(!0),t(a))},children:O?w.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:w.jsx(T0,{})}):"Confirm Swap"}),U&&w.jsxs("div",{className:"price-update",children:[w.jsxs("div",{className:"left",children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-alert"})}),w.jsx("span",{children:"Price update"})]}),w.jsx("div",{className:"right",children:w.jsx("button",{className:"cs-solid-btn",onClick:D,children:"Accept"})})]})]})}function Su(e){const{text:t,type:r,classType:n=""}=e,[i,s]=Z.useState(!1),{addCommonToast:o}=Bo(),a=c=>{i||(Gl(c),Gw(t,{debug:!1,message:"message"}),o("Copied"),s(!i))};return Z.useEffect(()=>{i&&setTimeout(()=>{s(!1)},2e3)},[i]),w.jsx(w.Fragment,{children:r==="btn"?w.jsxs("div",{className:n?`${n} copy-btn`:"copy-btn",onClick:a,children:[w.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:i?"#icon-sel":"#icon-icon_copy"})}),w.jsx("span",{children:"Copy"})]}):w.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",onClick:a,children:w.jsx("use",{xlinkHref:i?"#icon-sel":"#icon-icon_copy"})})})}function gB({toBack:e,data:t,isLoading:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=en(),{fetchTokenInfo:a}=bs(),[c,l]=Z.useState([]),u=async()=>{var p;return await Promise.all(((p=t==null?void 0:t.routers)==null?void 0:p.map(async y=>({...y,paths:await Promise.all(y.paths.map(async x=>({...x,fromToken:await a(x.from_type),toToken:await a(x.to_type)})))})))||[])};return Z.useEffect(()=>{u().then(f=>{l(f)})},[t]),w.jsxs("div",{className:"route-dialog",children:[w.jsx(ch,{title:"Route",backClick:e}),w.jsxs("div",{className:"route-dialog-content",children:[w.jsx("div",{className:"simple-router-box",children:w.jsx(L6,{hasSubMenu:!1,isLoading:r,formatSwapRouter:t})}),w.jsxs("div",{className:"center",style:{flexDirection:"column",gap:"0px"},children:[w.jsxs("div",{className:"center",style:{gap:"4px",marginTop:"16px"},children:[w.jsx(Pr,{src:n==null?void 0:n.logo_url,token:n,style:{width:"26px",height:"26px",borderRadius:"100%"}}),w.jsx("span",{className:"amount",style:{color:"var(--cs-text-primary)"},children:Dr(s,n==null?void 0:n.decimals)}),w.jsx("span",{className:"symbol",style:{color:"var(--cs-text-secondary)"},children:n==null?void 0:n.symbol})]}),w.jsx("div",{className:"route-box-h5 center",children:w.jsx("div",{style:{width:"100%",gap:"32px",border:"1px dashed var(--cs-border)",borderRadius:"8px",display:"flex",flexDirection:"column",paddingTop:"20px",paddingBottom:"20px",overflowY:"auto",maxHeight:"280px",position:"relative"},children:c==null?void 0:c.map((f,p)=>w.jsxs("div",{className:"route-item-box-h5",children:[w.jsxs("div",{className:"percent",children:[Me(f.percentage).mul(100).toString(),"%"]}),w.jsx("div",{className:f.paths.length>1?"route-two-h5":"",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"},children:f.paths.map(y=>w.jsx("div",{className:"route-path-item",children:w.jsx(n6,{autoSwitchTooltip:!0,position:"bottom",borderRadius:"12px",content:w.jsxs("div",{className:"router-pool-tip-con",style:{display:"flex",flexDirection:"column",minWidth:"220px"},children:[w.jsx(vB,{poolAddress:y.pool_address}),w.jsx(zm,{token:y.fromToken}),w.jsx(zm,{token:y.toToken})]}),children:w.jsx(bB,{path:y})})},y.to_type))})]},p))})}),w.jsxs("div",{className:"center",style:{gap:"4px"},children:[w.jsx(Pr,{src:i==null?void 0:i.logo_url,token:i,style:{width:"26px",height:"26px",borderRadius:"100%"}}),w.jsx("span",{className:"amount",style:{color:"var(--cs-text-primary)"},children:Dr(o,i==null?void 0:i.decimals)}),w.jsx("span",{className:"symbol",style:{color:"var(--cs-text-secondary)"},children:i==null?void 0:i.symbol})]})]})]})]})}function bB({path:e}){var t,r,n;return w.jsxs("div",{role:"button",style:{display:"flex",flexDirection:"row",gap:"0px",zIndex:3},children:[w.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[w.jsx(Pr,{src:(t=e.fromToken)==null?void 0:t.logo_url,token:e.fromToken,style:{width:"24px",height:"24px",minWidth:"24px",minHeight:"24px",borderRadius:"100%"}}),w.jsx(Pr,{src:(r=e.toToken)==null?void 0:r.logo_url,token:e.toToken,style:{width:"24px",height:"24px",minWidth:"24px",minHeight:"24px",borderRadius:"100%"}})]}),w.jsxs("span",{className:"provider",style:{color:"var(--cs-text-primary)"},children:[(n=n2[e.provider])==null?void 0:n.name," "]}),!!+e.fee_rate&&w.jsxs("div",{className:"fee-tier",children:[" ",Me(e.fee_rate).mul(100).toString(),"%"]})]})}function zm({token:e}){const{getExplorerUrl:t}=Do();return w.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"12px",margin:"8px 0 4px",gap:"12px"},children:[w.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexShrink:0},children:[w.jsx(Pr,{src:e==null?void 0:e.logo_url,token:e,showWarnSize:"12px",style:{width:"20px",height:"20px",borderRadius:"100%"}}),w.jsx("span",{style:{color:"var(--cs-text-primary)",fontSize:"12px"},children:yn((e==null?void 0:e.symbol)||"")})]}),w.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[w.jsx("a",{onClick:Gl,href:t(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{textDecoration:"none",color:"var(--cs-text-secondary)",marginRight:"4px"},children:Us(e==null?void 0:e.coin_type)}),w.jsx(Su,{text:(e==null?void 0:e.coin_type)||""})]})]})}function vB({poolAddress:e}){const{getExplorerUrl:t}=Do();return w.jsxs(w.Fragment,{children:[e&&w.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",fontSize:"12px",gap:"12px"},children:[w.jsx("span",{style:{color:"var(--cs-text-primary)",fontSize:"12px"},children:"Pool"}),w.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[w.jsx("a",{style:{color:"var(--cs-text-primary)",textDecoration:"none",marginRight:"4px"},onClick:Gl,href:t(e,"poolAddress"),target:"_blank",children:Us(e)}),w.jsx(Su,{text:e})]})]}),e&&w.jsx("div",{style:{width:"100%",height:"1px",marginTop:"8px",backgroundColor:"var(--cs-border)"}})]})}function L6({hasSubMenu:e,isLoading:t,formatSwapRouter:r}){var f;const[n,i]=Z.useState(!1),{isApp:s}=pu(),{fetchTokenInfo:o}=bs(),a=Z.useMemo(()=>(r==null?void 0:r.routers.length)===1,[r==null?void 0:r.routers.length]),[c,l]=Z.useState(""),u=async()=>{var v,C;const p=[],y=((C=(v=r==null?void 0:r.routers)==null?void 0:v[0])==null?void 0:C.paths)||[];for(let I=0;I<y.length;I++){const O=y[I],j=await o(O==null?void 0:O.to_type);if(I===0){const U=await o(O==null?void 0:O.from_type);p.push(`${U==null?void 0:U.symbol} > ${j==null?void 0:j.symbol}`)}else p.push(j==null?void 0:j.symbol)}const x=p.join(" > ");l(x)};return Z.useEffect(()=>{a&&u()},[a]),w.jsxs("div",{className:"simple-router-block",style:{paddingLeft:e?"8px":"0px",paddingRight:e?"8px":"0px"},children:[w.jsx("div",{className:"left",style:{whiteSpace:"nowrap",color:e?"var(--cs-text-secondary)":"var(--cs-text-primary)",paddingRight:"8px"},children:e?"Auto Router":"Route"}),t?w.jsx($o,{className:"custom-skeleton",style:{width:"80px",height:"18px"}}):w.jsxs("div",{className:"right",onClick:()=>{i(!0)},children:[w.jsx("span",{style:{textAlign:"right",color:"var(--cs-text-primary)"},children:a?c:r==null?void 0:r.router_summery}),w.jsxs("div",{className:"providers",children:[(f=r==null?void 0:r.providers)==null?void 0:f.map((p,y)=>{var x;return s?w.jsx(Pr,{src:Qt[p],style:{width:"16px",height:"16px"},haveBorder:!1}):w.jsx($s,{content:w.jsx("div",{style:{color:"var(--cs-text-primary)"},children:((x=n2[p])==null?void 0:x.name)||p}),position:"top",delay:300,children:w.jsx(Pr,{src:Qt[p],style:{width:"16px",height:"16px"},haveBorder:!1})},p)}),e&&w.jsx("svg",{className:"cs-icon spread-icon","aria-hidden":"true",style:{width:"16px",height:"16px",flexShrink:0},children:w.jsx("use",{xlinkHref:"#icon-spread"})})]})]}),n&&e&&w.jsx(gB,{data:r,isLoading:t,toBack:()=>i(!1)})]})}function B6(){const{setCollectTokenMap:e,collectTokenMap:t}=Ys(),r=i=>{const s=new Map(t);s.get(i.coin_type)?s.delete(i.coin_type):s.set(i.coin_type,i),e(s)},n=Z.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function yB(e){const{trustedTokenList:t}=Lo(),{tokenBalanceObj:r,currentAccount:n}=qr(),{coinPriceObj:i}=Yw(),{getTokenAmountValue:s}=ec(),{fetchTokenInfo:o}=bs(),{currentTypeTab:a,showTokenList:c,setShowTokenList:l,combineTokenList:u,importTokenList:f,setComBineTokenList:p,setImportToken:y,setCurrentImportTokenData:x,setImportTokenIsLoading:v,currentImportTokenData:C,searchInput:I,setSearchInput:O,importTokenIsLoading:j,showTokenListIsLoading:U,setCurrentTypeTab:D,setCurrentPlatformTab:H}=Ys(),[q,G]=Z.useState(!1);Z.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&G(!0)},[t]);const[re,ae]=Z.useState(!1);Z.useEffect(()=>{Pp(i)||ae(!0)},[i]);const ne=Z.useRef({}),[V,N]=Z.useState(!1);Z.useEffect(()=>{(!Pp(r)||!C0(ne.current,r))&&(ne.current=r,N(!0))},[r]);const h=Z.useMemo(()=>(f==null?void 0:f.length)>1?f==null?void 0:f.map(se=>{const te=jc(r==null?void 0:r[se==null?void 0:se.coin_type],se),le=te==null?void 0:te.totalBalanceFormat,xe=Me(le).gt("0")?s(se==null?void 0:se.coin_type,le):"0";return{...se,balance:le,rate:xe}}):f,[f,r,i]),d=(se,te)=>{const le=te&&te.toLocaleLowerCase().trim(),xe=se.map(Ee=>{let Ye=0,De=0;Ee.symbol.toLowerCase()===le||Ee.name.toLowerCase()===le||Ee.coin_type.toLowerCase()===le?(Ye=1e3,De=2):Ee.symbol.toLowerCase().indexOf(le)>-1?(Ye=100,De=0):Ee.name.toLowerCase().indexOf(le)>-1?(Ye=10,De=0):Ee.coin_type.toLowerCase().indexOf(le)>-1?(Ye=1,De=0):Ee.coin_type.toLowerCase()=="0x2::sui::sui"&&(De=1);let Oe=Array.isArray(Ee==null?void 0:Ee.coin_priority)?Number(Ee.coin_priority[0])||0:Number(Ee==null?void 0:Ee.coin_priority)||0;return e===Ee.coin_type&&!te&&(De=12,Ye=1e3,Oe=1e4),{...Ee,mark:Ye,sort:De,coin_priority_sort:Oe,rateNumber:Number((Ee==null?void 0:Ee.rate)||"0"),balanceNumber:Number((Ee==null?void 0:Ee.balance)||"0")}});return pB(xe,[Ee=>!te&&e===Ee.coin_type?1:0,"rateNumber","balanceNumber","sort","mark","coin_priority_sort"],["desc","desc","desc","desc","desc","desc"])},m=(se,te=!1)=>{const le=te?se.trim():se.toLowerCase().trim(),xe=["symbol","name","coin_type"];return aB(le.length===0?u:[...u,...h],Ee=>xe.some(Ye=>{const De=Ee[Ye];if(typeof De=="string"){const Oe=te?De:De.toLowerCase();return Ye==="coin_type"?Oe.includes(le)||Di(Oe,!0).includes(Di(le,!0)):Oe.includes(le)}return!1}))},S=se=>{se||x(void 0);const te=m(se);if((te==null?void 0:te.length)===0){E(se);return}else{const le=d(te,se);l(le)}},E=async se=>{v(!0);try{if(Xv(se)){const te=se.trim(),le=ur(te).full_address,xe=await o(le);if(!xe){l([]);return}const Se=jc(r==null?void 0:r[le],xe),Ee=(Se==null?void 0:Se.totalBalanceFormat)||"0",Ye=Me(Ee).gt("0")?s(te,Ee):"0",De={...xe,balance:Ee,rate:Ye};l([De]),x(De)}else{l([]);return}}catch{x(void 0),l([]);return}finally{v(!1)}},M=se=>{if(se==="Default")g("All"),H("All");else{const te=d(h,I);l(te)}},P=()=>{if(C){const se=y(C,!0),te=d(se,I);l(te),x(void 0),O("")}},A=se=>{const te=y(se,!1),le=d(te,I);l(le)},g=se=>{const te=se==="All"?[...u]:u.filter(xe=>se=="Native"?!xe.labels||xe.labels.length==0||xe.labels=="Native":xe.labels&&xe.labels.length>0&&xe.labels[0].toLowerCase()==se.toLowerCase()),le=d(te,I);l(le)};Z.useEffect(()=>{if(!q||!(t!=null&&t.length)){p([]);return}if(!(n!=null&&n.address))p(t);else if(n!=null&&n.address){const se=[];for(const te of t){const le=r==null?void 0:r[te==null?void 0:te.coin_type],xe=jc(le,te),Se=(xe==null?void 0:xe.totalBalanceFormat)||"0",Ee=(xe==null?void 0:xe.displayBalance)||"0",Ye=Me(Se).gt("0")?s(te==null?void 0:te.coin_type,Se):"0";se.push({...te,balance:Ee,rate:Dr(Ye,4,!0)})}p(se)}},[q,re,V,n==null?void 0:n.address,i]);const b=Z.useRef([]);Z.useEffect(()=>{if((u==null?void 0:u.length)>0&&!lB(b.current,u)){b.current=u;const se=d(u);e?h.find(le=>le.coin_type===e)!==void 0||a!=="Default"?(D("Imported"),M("Imported")):l(C?[C]:se):l(se)}},[u,e]);const B=Z.useMemo(()=>{if(a==="Default"){if(!U&&(c==null?void 0:c.length)===0)return!0}else if((c==null?void 0:c.length)===0&&!j)return!0;return!1},[I,c,C,j,U]);return{showTokenList:c,handleSearch:S,handleChangePlatform:g,currentImportTokenData:C,handleChangeType:M,handleImportClick:P,handleDeleteImportClick:A,isNoData:B}}function wB({tokenList:e,onHandleTokenAction:t}){return w.jsx("div",{className:"token-collect-list",children:e.map(r=>w.jsx(xB,{token:r,onHandleTokenAction:t},r.coin_type))})}function xB({token:e,onHandleTokenAction:t}){return w.jsxs("div",{className:"token-collect-item",onClick:()=>{t(e,"select_token")},children:[w.jsx(Pr,{src:e==null?void 0:e.logo_url,token:e,style:{width:"20px",height:"20px"}}),w.jsx("span",{style:{marginLeft:"4px"},children:e.symbol}),w.jsx("i",{children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:r=>{r.stopPropagation(),t(e,"un_collect")},children:w.jsx("use",{xlinkHref:"#icon-close"})})})]})}function SB(e){const{img:t="",text:r,width:n="100%",height:i="100%",padding:s="20px",subItem:o}=e;return w.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:n,height:i,padding:s,boxSizing:"border-box",textAlign:"center"},children:[t&&w.jsx("img",{src:t,alt:"No Data",style:{width:"160px",height:"160px"}}),r&&w.jsx("div",{style:{color:"var(--cs-text-primary)",fontSize:"14px"},children:r}),o&&o]})}function _B({tabList:e,currentTab:t,changeTab:r}){return w.jsx("div",{className:"platform-tabs",children:e.map(n=>w.jsx("div",{className:t===n?"platform-tab-item active":"platform-tab-item",onClick:()=>{r(n)},children:n},n))})}var qm=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function EB(e,t){return!!(e===t||qm(e)&&qm(t))}function CB(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!EB(e[r],t[r]))return!1;return!0}function TB(e,t){t===void 0&&(t=CB);var r=null;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(r&&r.lastThis===this&&t(i,r.lastArgs))return r.lastResult;var o=e.apply(this,i);return r={lastResult:o,lastArgs:i,lastThis:this},o}return n.clear=function(){r=null},n}function Cf(){return Cf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Cf.apply(null,arguments)}function Wm(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Tf(e,t){return Tf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Tf(e,t)}function MB(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Tf(e,t)}var Hm=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function AB(e,t){return!!(e===t||Hm(e)&&Hm(t))}function IB(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!AB(e[r],t[r]))return!1;return!0}function Sd(e,t){t===void 0&&(t=IB);var r,n=[],i,s=!1;function o(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return s&&r===this&&t(a,n)||(i=e.apply(this,a),s=!0,r=this,n=a),i}return o}function Gm(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var OB=typeof performance=="object"&&typeof performance.now=="function",Km=OB?function(){return performance.now()}:function(){return Date.now()};function Ym(e){cancelAnimationFrame(e.id)}function RB(e,t){var r=Km();function n(){Km()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var _d=-1;function Jm(e){if(e===void 0&&(e=!1),_d===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),_d=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return _d}var ao=null;function Xm(e){if(e===void 0&&(e=!1),ao===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),i=n.style;return i.width="100px",i.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?ao="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?ao="negative":ao="positive-ascending"),document.body.removeChild(t),ao}return ao}jn.env.NODE_ENV;var PB=150,jB=function(t,r){return t},Uc=null,Fc=null;jn.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(Uc=new WeakSet,Fc=new WeakSet);function NB(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,i=e.getItemSize,s=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,l=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return t=function(f){MB(p,f);function p(x){var v;return v=f.call(this,x)||this,v._instanceProps=c(v.props,Wm(v)),v._outerRef=void 0,v._resetIsScrollingTimeoutId=null,v.state={instance:Wm(v),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof v.props.initialScrollOffset=="number"?v.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},v._callOnItemsRendered=void 0,v._callOnItemsRendered=Sd(function(C,I,O,j){return v.props.onItemsRendered({overscanStartIndex:C,overscanStopIndex:I,visibleStartIndex:O,visibleStopIndex:j})}),v._callOnScroll=void 0,v._callOnScroll=Sd(function(C,I,O){return v.props.onScroll({scrollDirection:C,scrollOffset:I,scrollUpdateWasRequested:O})}),v._getItemStyle=void 0,v._getItemStyle=function(C){var I=v.props,O=I.direction,j=I.itemSize,U=I.layout,D=v._getItemStyleCache(l&&j,l&&U,l&&O),H;if(D.hasOwnProperty(C))H=D[C];else{var q=r(v.props,C,v._instanceProps),G=i(v.props,C,v._instanceProps),re=O==="horizontal"||U==="horizontal",ae=O==="rtl",ne=re?q:0;D[C]=H={position:"absolute",left:ae?void 0:ne,right:ae?ne:void 0,top:re?0:q,height:re?"100%":G,width:re?G:"100%"}}return H},v._getItemStyleCache=void 0,v._getItemStyleCache=Sd(function(C,I,O){return{}}),v._onScrollHorizontal=function(C){var I=C.currentTarget,O=I.clientWidth,j=I.scrollLeft,U=I.scrollWidth;v.setState(function(D){if(D.scrollOffset===j)return null;var H=v.props.direction,q=j;if(H==="rtl")switch(Xm()){case"negative":q=-j;break;case"positive-descending":q=U-O-j;break}return q=Math.max(0,Math.min(q,U-O)),{isScrolling:!0,scrollDirection:D.scrollOffset<q?"forward":"backward",scrollOffset:q,scrollUpdateWasRequested:!1}},v._resetIsScrollingDebounced)},v._onScrollVertical=function(C){var I=C.currentTarget,O=I.clientHeight,j=I.scrollHeight,U=I.scrollTop;v.setState(function(D){if(D.scrollOffset===U)return null;var H=Math.max(0,Math.min(U,j-O));return{isScrolling:!0,scrollDirection:D.scrollOffset<H?"forward":"backward",scrollOffset:H,scrollUpdateWasRequested:!1}},v._resetIsScrollingDebounced)},v._outerRefSetter=function(C){var I=v.props.outerRef;v._outerRef=C,typeof I=="function"?I(C):I!=null&&typeof I=="object"&&I.hasOwnProperty("current")&&(I.current=C)},v._resetIsScrollingDebounced=function(){v._resetIsScrollingTimeoutId!==null&&Ym(v._resetIsScrollingTimeoutId),v._resetIsScrollingTimeoutId=RB(v._resetIsScrolling,PB)},v._resetIsScrolling=function(){v._resetIsScrollingTimeoutId=null,v.setState({isScrolling:!1},function(){v._getItemStyleCache(-1,null)})},v}p.getDerivedStateFromProps=function(v,C){return kB(v,C),u(v),null};var y=p.prototype;return y.scrollTo=function(v){v=Math.max(0,v),this.setState(function(C){return C.scrollOffset===v?null:{scrollDirection:C.scrollOffset<v?"forward":"backward",scrollOffset:v,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},y.scrollToItem=function(v,C){C===void 0&&(C="auto");var I=this.props,O=I.itemCount,j=I.layout,U=this.state.scrollOffset;v=Math.max(0,Math.min(v,O-1));var D=0;if(this._outerRef){var H=this._outerRef;j==="vertical"?D=H.scrollWidth>H.clientWidth?Jm():0:D=H.scrollHeight>H.clientHeight?Jm():0}this.scrollTo(s(this.props,v,C,U,this._instanceProps,D))},y.componentDidMount=function(){var v=this.props,C=v.direction,I=v.initialScrollOffset,O=v.layout;if(typeof I=="number"&&this._outerRef!=null){var j=this._outerRef;C==="horizontal"||O==="horizontal"?j.scrollLeft=I:j.scrollTop=I}this._callPropsCallbacks()},y.componentDidUpdate=function(){var v=this.props,C=v.direction,I=v.layout,O=this.state,j=O.scrollOffset,U=O.scrollUpdateWasRequested;if(U&&this._outerRef!=null){var D=this._outerRef;if(C==="horizontal"||I==="horizontal")if(C==="rtl")switch(Xm()){case"negative":D.scrollLeft=-j;break;case"positive-ascending":D.scrollLeft=j;break;default:var H=D.clientWidth,q=D.scrollWidth;D.scrollLeft=q-H-j;break}else D.scrollLeft=j;else D.scrollTop=j}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Ym(this._resetIsScrollingTimeoutId)},y.render=function(){var v=this.props,C=v.children,I=v.className,O=v.direction,j=v.height,U=v.innerRef,D=v.innerElementType,H=v.innerTagName,q=v.itemCount,G=v.itemData,re=v.itemKey,ae=re===void 0?jB:re,ne=v.layout,V=v.outerElementType,N=v.outerTagName,h=v.style,d=v.useIsScrolling,m=v.width,S=this.state.isScrolling,E=O==="horizontal"||ne==="horizontal",M=E?this._onScrollHorizontal:this._onScrollVertical,P=this._getRangeToRender(),A=P[0],g=P[1],b=[];if(q>0)for(var B=A;B<=g;B++)b.push(Z.createElement(C,{data:G,key:ae(B,G),index:B,isScrolling:d?S:void 0,style:this._getItemStyle(B)}));var se=n(this.props,this._instanceProps);return Z.createElement(V||N||"div",{className:I,onScroll:M,ref:this._outerRefSetter,style:Cf({position:"relative",height:j,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:O},h)},Z.createElement(D||H||"div",{children:b,ref:U,style:{height:E?"100%":se,pointerEvents:S?"none":void 0,width:E?se:"100%"}}))},y._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var v=this.props.itemCount;if(v>0){var C=this._getRangeToRender(),I=C[0],O=C[1],j=C[2],U=C[3];this._callOnItemsRendered(I,O,j,U)}}if(typeof this.props.onScroll=="function"){var D=this.state,H=D.scrollDirection,q=D.scrollOffset,G=D.scrollUpdateWasRequested;this._callOnScroll(H,q,G)}},y._getRangeToRender=function(){var v=this.props,C=v.itemCount,I=v.overscanCount,O=this.state,j=O.isScrolling,U=O.scrollDirection,D=O.scrollOffset;if(C===0)return[0,0,0,0];var H=o(this.props,D,this._instanceProps),q=a(this.props,H,D,this._instanceProps),G=!j||U==="backward"?Math.max(1,I):1,re=!j||U==="forward"?Math.max(1,I):1;return[Math.max(0,H-G),Math.max(0,Math.min(C-1,q+re)),H,q]},p}(Z.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var kB=function(t,r){var n=t.children,i=t.direction,s=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,l=t.width,u=r.instance;if(jn.env.NODE_ENV!=="production"){(a!=null||c!=null)&&Fc&&!Fc.has(u)&&(Fc.add(u),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=i==="horizontal"||o==="horizontal";switch(i){case"horizontal":case"vertical":Uc&&!Uc.has(u)&&(Uc.add(u),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+i+'" was specified.'))}switch(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof l!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(l===null?"null":typeof l)+'" was specified.'));if(!f&&typeof s!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(s===null?"null":typeof s)+'" was specified.'))}},DB=NB({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,i,s,o){var a=t.direction,c=t.height,l=t.itemCount,u=t.itemSize,f=t.layout,p=t.width,y=a==="horizontal"||f==="horizontal",x=y?p:c,v=Math.max(0,l*u-x),C=Math.min(v,r*u),I=Math.max(0,r*u-x+u+o);switch(n==="smart"&&(i>=I-x&&i<=C+x?n="auto":n="center"),n){case"start":return C;case"end":return I;case"center":{var O=Math.round(I+(C-I)/2);return O<Math.ceil(x/2)?0:O>v+Math.floor(x/2)?v:O}case"auto":default:return i>=I&&i<=C?i:i<I?I:C}},getStartIndexForOffset:function(t,r){var n=t.itemCount,i=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/i)))},getStopIndexForStartIndex:function(t,r,n){var i=t.direction,s=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,l=t.width,u=i==="horizontal"||c==="horizontal",f=r*a,p=u?l:s,y=Math.ceil((p+n-f)/a);return Math.max(0,Math.min(o-1,r+y-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(jn.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function Zm(e,t){for(var r in e)if(!(r in t))return!0;for(var n in t)if(e[n]!==t[n])return!0;return!1}var LB=["style"],BB=["style"];function UB(e,t){var r=e.style,n=Gm(e,LB),i=t.style,s=Gm(t,BB);return!Zm(r,i)&&!Zm(n,s)}const FB=Z.memo(({data:e,index:t,style:r})=>{const{items:n,onHandleTokenAction:i,showCollect:s,showDelete:o}=e,a=n[t];return w.jsx("div",{style:r,children:w.jsx(zB,{data:a,onHandleTokenAction:i,showCollect:s,showDelete:o})})},UB),$B=TB((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function VB({showTokenList:e,onHandleTokenAction:t,showCollect:r=!0,showDelete:n=!1}){const i=Z.useRef(null);Z.useEffect(()=>{i.current&&i.current.scrollTo(0)},[e.length]);const s=$B(e,t,r,n);return w.jsx("div",{className:"token-list",children:w.jsx(DB,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:360,itemCount:e.length,itemData:s,itemSize:72,width:"100%",children:FB})})}function zB({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=B6(),{getExplorerUrl:s}=Do();return ec(),w.jsxs("div",{className:"token-list-item",onClick:o=>{t&&(o.stopPropagation(),n(e,"select_token"))},children:[w.jsx(Pr,{className:"token-img",src:e==null?void 0:e.logo_url,token:e,showWarnSize:"16px",showWarn:!t}),w.jsxs("div",{className:"token-info",children:[w.jsx("h4",{className:"token-symbol",children:w.jsx("span",{children:yn(e.symbol)})}),w.jsx("p",{className:"token-name",children:yn(e==null?void 0:e.name,20)}),w.jsxs("div",{className:"copy",children:[w.jsx("a",{onClick:Gl,href:s(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{fontSize:"12px"},children:Us(e==null?void 0:e.coin_type)}),w.jsx(Su,{text:e==null?void 0:e.coin_type})]})]}),w.jsxs("div",{className:"token-balance",children:[w.jsxs("div",{className:"balance",children:[w.jsx("h4",{children:e==null?void 0:e.balance}),w.jsx("p",{children:e!=null&&e.rate?Yv(e==null?void 0:e.rate,2):""})]}),r&&w.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"delete_import")},children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-icon_del1"})})}),t&&w.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"collect_token")},children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:i(e)?"#icon-star_sel":"#icon-star"})})})]})]},e==null?void 0:e.coin_type)}function qB({currentType:e,changeTab:t}){const r=["Default","Imported"];return w.jsx("div",{className:"type-tabs",children:r.map(n=>w.jsx("div",{className:e===n?"type-tab-item active":"type-tab-item",onClick:()=>t(n),children:n},n))})}function WB({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:s,handleChangePlatform:o,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:l}=yB(r==null?void 0:r.coin_type),{importTokenList:u,currentTypeTab:f,setCurrentTypeTab:p,currentPlatformTab:y,setCurrentPlatformTab:x,platformList:v,isOpenImportDialog:C,setIsOpenImportDialog:I,setSearchInput:O,searchInput:j,importTokenIsLoading:U,currentImportTokenData:D,setCurrentImportTokenData:H}=Ys();Z.useEffect(()=>()=>{O(""),x("All"),p("Default"),H(void 0)},[]);const{handleCollectToken:q,collectTokenMap:G}=B6(),re=m=>{p(m),a(m)},ae=m=>{x(m),o(m)},ne=()=>{c(),I(!1)},V=m=>{let S=m.replace(/[^a-zA-Z0-9\s]+$/g,"").trim();O(S),S?N(S):(N(""),re("Default"))},N=oh(m=>{Xv(m)?s(Di(m,!0)):s(m)},300),h=(m,S)=>{if(S==="delete_import"){l(m);return}if(S==="collect_token"||S==="un_collect"){q(m);return}S==="select_token"&&(t(m),e())},d=Z.useMemo(()=>Array.from(G.values()),[G]);return w.jsxs("div",{className:"token-select-modal",children:[w.jsx(ch,{backClick:e,title:"Select Token"}),w.jsxs("div",{className:"token-select-content",style:{position:"relative"},children:[w.jsxs("div",{className:"center-content",children:[w.jsxs("div",{className:"search-input",style:{position:"relative"},children:[w.jsx("input",{className:"token-search-input",placeholder:"Search by token or address",value:j,onChange:m=>V(m.target.value),style:{paddingRight:"40px"}}),j.length>0&&w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"20px",height:"20px",cursor:"pointer",position:"absolute",top:"50%",transform:"translateY(-50%)",right:"12px"},onClick:m=>{V("")},children:w.jsx("use",{xlinkHref:"#icon-close"})})]}),d.length>0&&w.jsx(wB,{tokenList:d,onHandleTokenAction:h}),j.length===0&&w.jsx(qB,{currentType:f,changeTab:re}),j.length===0&&f==="Default"&&w.jsx(_B,{tabList:v,currentTab:y,changeTab:ae})]}),i&&w.jsx(HB,{showTooltip:j.length>0,text:j.length>0||D===void 0?"No tokens found":"No Imported Tokens"}),U&&w.jsx(Kw,{}),D&&w.jsx("div",{style:{width:"93%",marginLeft:"16px",backgroundColor:"var(--cs-warning-10)",borderRadius:"12px",padding:"16px",fontSize:"12px",marginTop:"16px",color:" var(--cs-warning)"},children:"The token is not on the Frequently Traded List. Please note that anyone can create a token on Sui blockchain with any name, including creating fake versions of existing tokens or tokens that claim to represent projects that do not have a token. Always conduct your own research before trading."}),n.length>0&&w.jsxs("div",{style:{position:"relative"},children:[w.jsx(VB,{showTokenList:n,showCollect:!D,showDelete:!D&&f==="Imported",onHandleTokenAction:h}),D&&w.jsx("div",{className:"center",style:{position:"absolute",top:"100px",left:"50%",transform:"translateX(-50%)"},children:w.jsx("button",{className:"cs-solid-btn swap-btn",style:{height:"32px",width:"140px",fontSize:"14px",borderRadius:"8px",fontFamily:"Inter, Inter",fontWeight:500},onClick:()=>{ne(),h(D,"select_token")},children:"Import"})})]})]})]})}function HB({showTooltip:e,text:t}){return w.jsx("div",{style:{height:"360px"},children:w.jsx(SB,{text:t,subItem:e?w.jsx("div",{children:w.jsx($s,{position:"bottom",content:w.jsx("div",{style:{color:"var(--cs-text-primary)"},children:"The unique id of coin"}),children:w.jsxs("div",{style:{fontSize:"12px",color:"var(--cs-text-secondary)",display:"flex",flexDirection:"row"},children:["Or you can enter Coin Type",w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:w.jsx("use",{xlinkHref:"#icon-tips"})})]})})}):void 0})})}function GB({onClose:e,tokenList:t,onSureClick:r}){const[n,i]=Z.useState(!1),{setIgnoreWarnToken:s}=zr();return w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"dialog-mask",onClick:e}),w.jsxs("div",{className:"import-dialog",children:[w.jsxs("div",{className:"cs-dialog-header",children:[w.jsx("div",{className:"title",children:"Tips"}),w.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:w.jsx("use",{xlinkHref:"#icon-close"})})]}),w.jsxs("div",{className:"import-content",children:[w.jsx("div",{className:"tip-text-box",children:w.jsx("p",{className:"tips-text",children:"The default trading pair given in this swap widget contains a community imported token that is imported by the integrator. Please acknowledge the risk and conduct your own research before interacting."})}),t.map(o=>w.jsxs("div",{className:"import-token-info",children:[w.jsx(Pr,{style:{width:"30px",height:"30px",borderRadius:"36px"},token:o,showWarnSize:"16px",src:o.logo_url}),w.jsxs("div",{className:"info",children:[w.jsx("div",{className:"name",children:w.jsxs("span",{children:[" ",o.symbol," "]})}),w.jsxs("div",{className:"address",children:[w.jsx("span",{children:Us(o.coin_type)}),w.jsx(Su,{text:o.coin_type})]})]})]},o.coin_type)),w.jsxs("div",{className:"risk-checkbox ",children:[w.jsx(au,{color:"indigo",checked:n,variant:"soft",className:"cs-checkbox cs-allow-change-checkbox",onClick:()=>{i(!n)}}),w.jsx("span",{children:"I acknowledge the risk"})]}),w.jsxs("div",{className:"button-block",children:[w.jsx("button",{className:"cs-outline-btn",onClick:e,children:"Cancel"}),w.jsx("button",{className:"cs-solid-btn",disabled:!n,onClick:()=>{r(),t.forEach(o=>{s(o.coin_type)})},children:"Confirm"})]})]})]})]})}function U6(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}var ja;(function(e){e.event="event",e.props="prop"})(ja||(ja={}));function ts(){}function KB(e){var t,r=void 0;return function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t&&n.length===t.length&&n.every(function(s,o){return s===t[o]})||(t=n,r=e.apply(void 0,n)),r}}function Na(e){return!!(e||"").match(/\d/)}function So(e){return e==null}function YB(e){return typeof e=="number"&&isNaN(e)}function F6(e){return So(e)||YB(e)||typeof e=="number"&&!isFinite(e)}function $6(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function JB(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function XB(e,t,r){var n=JB(r),i=e.search(/[1-9]/);return i=i===-1?e.length:i,e.substring(0,i)+e.substring(i,e.length).replace(n,"$1"+t)}function ZB(e){var t=Z.useRef(e);t.current=e;var r=Z.useRef(function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t.current.apply(t,n)});return r.current}function vh(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var i=e.split("."),s=i[0],o=i[1]||"";return{beforeDecimal:s,afterDecimal:o,hasNegation:r,addNegation:n}}function QB(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",i=r[1]||"";return(t?"-":"")+n+(i?"."+i:"")}function V6(e,t,r){for(var n="",i=r?"0":"",s=0;s<=t-1;s++)n+=e[s]||i;return n}function Qm(e,t){return Array(t+1).join(e)}function z6(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),i=n[0],s=n[1];if(s=Number(s),!s)return r+i;i=i.replace(".","");var o=1+s,a=i.length;return o<0?i="0."+Qm("0",Math.abs(o))+i:o>=a?i=i+Qm("0",o-a):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function e1(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=vh(e),s=i.beforeDecimal,o=i.afterDecimal,a=i.hasNegation,c=parseFloat("0."+(o||"0")),l=o.length<=t?"0."+o:c.toFixed(t),u=l.split("."),f=s;s&&Number(u[0])&&(f=s.split("").reverse().reduce(function(v,C,I){return v.length>I?(Number(v[0])+Number(C)).toString()+v.substring(1,v.length):C+v},u[0]));var p=V6(u[1]||"",t,r),y=a?"-":"",x=n?".":"";return""+y+f+x+p}function Ts(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var q6=KB(function(e,t){for(var r=0,n=0,i=e.length,s=t.length;e[r]===t[r]&&r<i;)r++;for(;e[i-1-n]===t[s-1-n]&&s-n>r&&i-n>r;)n++;return{from:{start:r,end:i-n},to:{start:r,end:s-n}}}),eU=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function tU(e,t,r){return Math.min(Math.max(e,t),r)}function Ed(e){return Math.max(e.selectionStart,e.selectionEnd)}function rU(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function nU(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function iU(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function sU(e,t,r,n,i,s,o){o===void 0&&(o=iU);var a=i.findIndex(function(U){return U}),c=e.slice(0,a);!t&&!r.startsWith(c)&&(t=c,r=c+r,n=n+c.length);for(var l=r.length,u=e.length,f={},p=new Array(l),y=0;y<l;y++){p[y]=-1;for(var x=0,v=u;x<v;x++){var C=o({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:x});if(C&&f[x]!==!0){p[y]=x,f[x]=!0;break}}}for(var I=n;I<l&&(p[I]===-1||!s(r[I]));)I++;var O=I===l||p[I]===-1?u:p[I];for(I=n-1;I>0&&p[I]===-1;)I--;var j=I===-1||p[I]===-1?0:p[I]+1;return j>O?O:n-j<O-n?j:O}function t1(e,t,r,n){var i=e.length;if(t=tU(t,0,i),n==="left"){for(;t>=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=i&&!r[t];)t++;t>i&&(t=r.lastIndexOf(!0))}return t===-1&&(t=i),t}function oU(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(Na(e[r])||Na(e[r-1]));return t}function W6(e,t,r,n,i,s){s===void 0&&(s=ts);var o=ZB(function(x,v){var C,I;return F6(x)?(I="",C=""):typeof x=="number"||v?(I=typeof x=="number"?z6(x):x,C=n(I)):(I=i(x,void 0),C=n(I)),{formattedValue:C,numAsString:I}}),a=Z.useState(function(){return o(So(e)?t:e,r)}),c=a[0],l=a[1],u=function(x,v){x.formattedValue!==c.formattedValue&&l({formattedValue:x.formattedValue,numAsString:x.value}),s(x,v)},f=e,p=r;So(e)&&(f=c.numAsString,p=!0);var y=o(f,p);return Z.useMemo(function(){l(y)},[y.formattedValue]),[c,u]}function aU(e){return e.replace(/[^0-9]/g,"")}function cU(e){return e}function lU(e){var t=e.type;t===void 0&&(t="text");var r=e.displayType;r===void 0&&(r="input");var n=e.customInput,i=e.renderText,s=e.getInputRef,o=e.format;o===void 0&&(o=cU);var a=e.removeFormatting;a===void 0&&(a=aU);var c=e.defaultValue,l=e.valueIsNumericString,u=e.onValueChange,f=e.isAllowed,p=e.onChange;p===void 0&&(p=ts);var y=e.onKeyDown;y===void 0&&(y=ts);var x=e.onMouseUp;x===void 0&&(x=ts);var v=e.onFocus;v===void 0&&(v=ts);var C=e.onBlur;C===void 0&&(C=ts);var I=e.value,O=e.getCaretBoundary;O===void 0&&(O=oU);var j=e.isValidInputCharacter;j===void 0&&(j=Na);var U=e.isCharacterSame,D=U6(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),H=W6(I,c,!!l,o,a,u),q=H[0],G=q.formattedValue,re=q.numAsString,ae=H[1],ne=Z.useRef(),V=Z.useRef({formattedValue:G,numAsString:re}),N=function(be,he){V.current={formattedValue:be.formattedValue,numAsString:be.value},ae(be,he)},h=Z.useState(!1),d=h[0],m=h[1],S=Z.useRef(null),E=Z.useRef({setCaretTimeout:null,focusTimeout:null});Z.useEffect(function(){return m(!0),function(){clearTimeout(E.current.setCaretTimeout),clearTimeout(E.current.focusTimeout)}},[]);var M=o,P=function(be,he){var Ce=parseFloat(he);return{formattedValue:be,value:he,floatValue:isNaN(Ce)?void 0:Ce}},A=function(be,he,Ce){be.selectionStart===0&&be.selectionEnd===be.value.length||(Ts(be,he),E.current.setCaretTimeout=setTimeout(function(){be.value===Ce&&be.selectionStart!==he&&Ts(be,he)},0))},g=function(be,he,Ce){return t1(be,he,O(be),Ce)},b=function(be,he,Ce){var qe=O(he),Be=sU(he,G,be,Ce,qe,j,U);return Be=t1(he,Be,qe),Be},B=function(be){var he=be.formattedValue;he===void 0&&(he="");var Ce=be.input,qe=be.source,Be=be.event,Ae=be.numAsString,Re;if(Ce){var Fe=be.inputValue||Ce.value,ft=Ed(Ce);Ce.value=he,Re=b(Fe,he,ft),Re!==void 0&&A(Ce,Re,he)}he!==G&&N(P(he,Ae),{event:Be,source:qe})};Z.useEffect(function(){var be=V.current,he=be.formattedValue,Ce=be.numAsString;(G!==he||re!==Ce)&&N(P(G,re),{event:void 0,source:ja.props})},[G,re]);var se=S.current?Ed(S.current):void 0,te=typeof window<"u"?Z.useLayoutEffect:Z.useEffect;te(function(){var be=S.current;if(G!==V.current.formattedValue&&be){var he=b(V.current.formattedValue,G,se);be.value=G,A(be,he,G)}},[G]);var le=function(be,he,Ce){var qe=he.target,Be=ne.current?eU(ne.current,qe.selectionEnd):q6(G,be),Ae=Object.assign(Object.assign({},Be),{lastValue:G}),Re=a(be,Ae),Fe=M(Re);if(Re=a(Fe,void 0),f&&!f(P(Fe,Re))){var ft=he.target,mt=Ed(ft),$e=b(be,G,mt);return ft.value=G,A(ft,$e,G),!1}return B({formattedValue:Fe,numAsString:Re,inputValue:be,event:he,source:Ce,input:he.target}),!0},xe=function(be,he){he===void 0&&(he=0);var Ce=be.selectionStart,qe=be.selectionEnd;ne.current={selectionStart:Ce,selectionEnd:qe+he}},Se=function(be){var he=be.target,Ce=he.value,qe=le(Ce,be,ja.event);qe&&p(be),ne.current=void 0},Ee=function(be){var he=be.target,Ce=be.key,qe=he.selectionStart,Be=he.selectionEnd,Ae=he.value;Ae===void 0&&(Ae="");var Re;Ce==="ArrowLeft"||Ce==="Backspace"?Re=Math.max(qe-1,0):Ce==="ArrowRight"?Re=Math.min(qe+1,Ae.length):Ce==="Delete"&&(Re=qe);var Fe=0;Ce==="Delete"&&qe===Be&&(Fe=1);var ft=Ce==="ArrowLeft"||Ce==="ArrowRight";if(Re===void 0||qe!==Be&&!ft){y(be),xe(he,Fe);return}var mt=Re;if(ft){var $e=Ce==="ArrowLeft"?"left":"right";mt=g(Ae,Re,$e),mt!==Re&&be.preventDefault()}else Ce==="Delete"&&!j(Ae[Re])?mt=g(Ae,Re,"right"):Ce==="Backspace"&&!j(Ae[Re])&&(mt=g(Ae,Re,"left"));mt!==Re&&A(he,mt,Ae),y(be),xe(he,Fe)},Ye=function(be){var he=be.target,Ce=function(){var qe=he.selectionStart,Be=he.selectionEnd,Ae=he.value;if(Ae===void 0&&(Ae=""),qe===Be){var Re=g(Ae,qe);Re!==qe&&A(he,Re,Ae)}};Ce(),requestAnimationFrame(function(){Ce()}),x(be),xe(he)},De=function(be){be.persist&&be.persist();var he=be.target,Ce=be.currentTarget;S.current=he,E.current.focusTimeout=setTimeout(function(){var qe=he.selectionStart,Be=he.selectionEnd,Ae=he.value;Ae===void 0&&(Ae="");var Re=g(Ae,qe);Re!==qe&&!(qe===0&&Be===Ae.length)&&A(he,Re,Ae),v(Object.assign(Object.assign({},be),{currentTarget:Ce}))},0)},Oe=function(be){S.current=null,clearTimeout(E.current.focusTimeout),clearTimeout(E.current.setCaretTimeout),C(be)},Xe=d&&rU()?"numeric":void 0,Ne=Object.assign({inputMode:Xe},D,{type:t,value:G,onChange:Se,onKeyDown:Ee,onMouseUp:Ye,onFocus:De,onBlur:Oe});if(r==="text")return i?Z.createElement(Z.Fragment,null,i(G,D)||null):Z.createElement("span",Object.assign({},D,{ref:s}),G);if(n){var pt=n;return Z.createElement(pt,Object.assign({},Ne,{ref:s}))}return Z.createElement("input",Object.assign({},Ne,{ref:s}))}function r1(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,i=t.prefix;i===void 0&&(i="");var s=t.suffix;s===void 0&&(s="");var o=t.allowNegative,a=t.thousandsGroupStyle;if(a===void 0&&(a="thousand"),e===""||e==="-")return e;var c=_u(t),l=c.thousandSeparator,u=c.decimalSeparator,f=r!==0&&e.indexOf(".")!==-1||r&&n,p=vh(e,o),y=p.beforeDecimal,x=p.afterDecimal,v=p.addNegation;return r!==void 0&&(x=V6(x,r,!!n)),l&&(y=XB(y,l,a)),i&&(y=i+y),s&&(x=x+s),v&&(y="-"+y),e=y+(f&&u||"")+x,e}function _u(e){var t=e.decimalSeparator;t===void 0&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return r===!0&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function uU(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),i=r.test(e),s=n.test(e);return e=e.replace(/-/g,""),i&&!s&&t&&(e="-"+e),e}function dU(e,t){return new RegExp("(^-)|[0-9]|"+$6(e),t?"g":void 0)}function fU(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function hU(e,t,r){var n;t===void 0&&(t=nU(e));var i=r.allowNegative,s=r.prefix;s===void 0&&(s="");var o=r.suffix;o===void 0&&(o="");var a=r.decimalScale,c=t.from,l=t.to,u=l.start,f=l.end,p=_u(r),y=p.allowedDecimalSeparators,x=p.decimalSeparator,v=e[f]===x;if(Na(e)&&(e===s||e===o)&&t.lastValue==="")return e;if(f-u===1&&y.indexOf(e[u])!==-1){var C=a===0?"":x;e=e.substring(0,u)+C+e.substring(u+1,e.length)}var I=function(S,E,M){var P=!1,A=!1;s.startsWith("-")?P=!1:S.startsWith("--")?(P=!1,A=!0):o.startsWith("-")&&S.length===o.length?P=!1:S[0]==="-"&&(P=!0);var g=P?1:0;return A&&(g=2),g&&(S=S.substring(g),E-=g,M-=g),{value:S,start:E,end:M,hasNegation:P}},O=I(e,u,f),j=O.hasNegation;n=O,e=n.value,u=n.start,f=n.end;var U=I(t.lastValue,c.start,c.end),D=U.start,H=U.end,q=U.value,G=e.substring(u,f);e.length&&q.length&&(D>q.length-o.length||H<s.length)&&!(G&&o.startsWith(G))&&(e=q);var re=0;e.startsWith(s)?re+=s.length:u<s.length&&(re=u),e=e.substring(re),f-=re;var ae=e.length,ne=e.length-o.length;e.endsWith(o)?ae=ne:(f>ne||f>e.length-o.length)&&(ae=f),e=e.substring(0,ae),e=uU(j?"-"+e:e,i),e=(e.match(dU(x,!0))||[]).join("");var V=e.indexOf(x);e=e.replace(new RegExp($6(x),"g"),function(S,E){return E===V?".":""});var N=vh(e,i),h=N.beforeDecimal,d=N.afterDecimal,m=N.addNegation;return l.end-l.start<c.end-c.start&&h===""&&v&&!parseFloat(d)&&(e=m?"-":""),e}function pU(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var i=Array.from({length:e.length+1}).map(function(){return!0}),s=e[0]==="-";i.fill(!1,0,r.length+(s?1:0));var o=e.length;return i.fill(!1,o-n.length+1,o+1),i}function mU(e){var t=_u(e),r=t.thousandSeparator,n=t.decimalSeparator,i=e.prefix;i===void 0&&(i="");var s=e.allowNegative;if(s===void 0&&(s=!0),r===n)throw new Error(`
|
|
102
|
+
`)},OI=0,so=[];function RI(e){var t=R.useRef([]),r=R.useRef([0,0]),n=R.useRef(),i=R.useState(OI++)[0],s=R.useState(my)[0],o=R.useRef(e);R.useEffect(function(){o.current=e},[e]),R.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var v=ZA([e.lockRef.current],(e.shards||[]).map(om),!0).filter(Boolean);return v.forEach(function(C){return C.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),v.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=R.useCallback(function(v,C){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var I=mc(v),O=r.current,j="deltaX"in v?v.deltaX:O[0]-I[0],U="deltaY"in v?v.deltaY:O[1]-I[1],D,H=v.target,q=Math.abs(j)>Math.abs(U)?"h":"v";if("touches"in v&&q==="h"&&H.type==="range")return!1;var G=im(q,H);if(!G)return!0;if(G?D=q:(D=q==="v"?"h":"v",G=im(q,H)),!G)return!1;if(!n.current&&"changedTouches"in v&&(j||U)&&(n.current=D),!D)return!0;var re=n.current||D;return MI(re,C,v,re==="h"?j:U,!0)},[]),c=R.useCallback(function(v){var C=v;if(!(!so.length||so[so.length-1]!==s)){var I="deltaY"in C?sm(C):mc(C),O=t.current.filter(function(D){return D.name===C.type&&(D.target===C.target||C.target===D.shadowParent)&&AI(D.delta,I)})[0];if(O&&O.should){C.cancelable&&C.preventDefault();return}if(!O){var j=(o.current.shards||[]).map(om).filter(Boolean).filter(function(D){return D.contains(C.target)}),U=j.length>0?a(C,j[0]):!o.current.noIsolation;U&&C.cancelable&&C.preventDefault()}}},[]),l=R.useCallback(function(v,C,I,O){var j={name:v,delta:C,target:I,should:O,shadowParent:PI(I)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(U){return U!==j})},1)},[]),u=R.useCallback(function(v){r.current=mc(v),n.current=void 0},[]),f=R.useCallback(function(v){l(v.type,sm(v),v.target,a(v,e.lockRef.current))},[]),p=R.useCallback(function(v){l(v.type,mc(v),v.target,a(v,e.lockRef.current))},[]);R.useEffect(function(){return so.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,io),document.addEventListener("touchmove",c,io),document.addEventListener("touchstart",u,io),function(){so=so.filter(function(v){return v!==s}),document.removeEventListener("wheel",c,io),document.removeEventListener("touchmove",c,io),document.removeEventListener("touchstart",u,io)}},[]);var y=e.removeScrollBar,x=e.inert;return R.createElement(R.Fragment,null,x?R.createElement(s,{styles:II(i)}):null,y?R.createElement(wI,{gapMode:e.gapMode}):null)}function PI(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const jI=aI(py,RI);var yy=R.forwardRef(function(e,t){return R.createElement(cu,ei({},e,{ref:t,sideCar:jI}))});yy.classNames=cu.classNames;const NI=yy;function kI(e,t){return R.useReducer((r,n)=>t[r][n]??r,e)}var W0="ScrollArea",[wy,LU]=Vi(W0),[DI,xn]=wy(W0),xy=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=e,[a,c]=R.useState(null),[l,u]=R.useState(null),[f,p]=R.useState(null),[y,x]=R.useState(null),[v,C]=R.useState(null),[I,O]=R.useState(0),[j,U]=R.useState(0),[D,H]=R.useState(!1),[q,G]=R.useState(!1),re=Kt(t,ne=>c(ne)),ae=$0(i);return w.jsx(DI,{scope:r,type:n,dir:ae,scrollHideDelay:s,scrollArea:a,viewport:l,onViewportChange:u,content:f,onContentChange:p,scrollbarX:y,onScrollbarXChange:x,scrollbarXEnabled:D,onScrollbarXEnabledChange:H,scrollbarY:v,onScrollbarYChange:C,scrollbarYEnabled:q,onScrollbarYEnabledChange:G,onCornerWidthChange:O,onCornerHeightChange:U,children:w.jsx(Yt.div,{dir:ae,...o,ref:re,style:{position:"relative","--radix-scroll-area-corner-width":I+"px","--radix-scroll-area-corner-height":j+"px",...e.style}})})});xy.displayName=W0;var Sy="ScrollAreaViewport",_y=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=e,o=xn(Sy,r),a=R.useRef(null),c=Kt(t,a,o.onViewportChange);return w.jsxs(w.Fragment,{children:[w.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),w.jsx(Yt.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:w.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});_y.displayName=Sy;var di="ScrollAreaScrollbar",Ey=R.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=xn(di,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=e.orientation==="horizontal";return R.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?w.jsx(LI,{...n,ref:t,forceMount:r}):i.type==="scroll"?w.jsx(BI,{...n,ref:t,forceMount:r}):i.type==="auto"?w.jsx(Cy,{...n,ref:t,forceMount:r}):i.type==="always"?w.jsx(H0,{...n,ref:t}):null});Ey.displayName=di;var LI=R.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=xn(di,e.__scopeScrollArea),[s,o]=R.useState(!1);return R.useEffect(()=>{const a=i.scrollArea;let c=0;if(a){const l=()=>{window.clearTimeout(c),o(!0)},u=()=>{c=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",l),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",l),a.removeEventListener("pointerleave",u)}}},[i.scrollArea,i.scrollHideDelay]),w.jsx($n,{present:r||s,children:w.jsx(Cy,{"data-state":s?"visible":"hidden",...n,ref:t})})}),BI=R.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=xn(di,e.__scopeScrollArea),s=e.orientation==="horizontal",o=uu(()=>c("SCROLL_END"),100),[a,c]=kI("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return R.useEffect(()=>{if(a==="idle"){const l=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(l)}},[a,i.scrollHideDelay,c]),R.useEffect(()=>{const l=i.viewport,u=s?"scrollLeft":"scrollTop";if(l){let f=l[u];const p=()=>{const y=l[u];f!==y&&(c("SCROLL"),o()),f=y};return l.addEventListener("scroll",p),()=>l.removeEventListener("scroll",p)}},[i.viewport,s,c,o]),w.jsx($n,{present:r||a!=="hidden",children:w.jsx(H0,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:tt(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:tt(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Cy=R.forwardRef((e,t)=>{const r=xn(di,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,o]=R.useState(!1),a=e.orientation==="horizontal",c=uu(()=>{if(r.viewport){const l=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?l:u)}},10);return Oo(r.viewport,c),Oo(r.content,c),w.jsx($n,{present:n||s,children:w.jsx(H0,{"data-state":s?"visible":"hidden",...i,ref:t})})}),H0=R.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=xn(di,e.__scopeScrollArea),s=R.useRef(null),o=R.useRef(0),[a,c]=R.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=Oy(a.viewport,a.content),u={...n,sizes:a,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:p=>o.current=p};function f(p,y){return qI(p,o.current,a,y)}return r==="horizontal"?w.jsx(UI,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollLeft,y=am(p,a,i.dir);s.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollLeft=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollLeft=f(p,i.dir))}}):r==="vertical"?w.jsx(FI,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollTop,y=am(p,a);s.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollTop=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollTop=f(p))}}):null}),UI=R.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=xn(di,e.__scopeScrollArea),[o,a]=R.useState(),c=R.useRef(null),l=Kt(t,c,s.onScrollbarXChange);return R.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),w.jsx(My,{"data-orientation":"horizontal",...i,ref:l,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":lu(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,f)=>{if(s.viewport){const p=s.viewport.scrollLeft+u.deltaX;e.onWheelScroll(p),Py(p,f)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:fl(o.paddingLeft),paddingEnd:fl(o.paddingRight)}})}})}),FI=R.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=xn(di,e.__scopeScrollArea),[o,a]=R.useState(),c=R.useRef(null),l=Kt(t,c,s.onScrollbarYChange);return R.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),w.jsx(My,{"data-orientation":"vertical",...i,ref:l,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":lu(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,f)=>{if(s.viewport){const p=s.viewport.scrollTop+u.deltaY;e.onWheelScroll(p),Py(p,f)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:fl(o.paddingTop),paddingEnd:fl(o.paddingBottom)}})}})}),[$I,Ty]=wy(di),My=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:f,...p}=e,y=xn(di,r),[x,v]=R.useState(null),C=Kt(t,re=>v(re)),I=R.useRef(null),O=R.useRef(""),j=y.viewport,U=n.content-n.viewport,D=Mr(u),H=Mr(c),q=uu(f,10);function G(re){if(I.current){const ae=re.clientX-I.current.left,ne=re.clientY-I.current.top;l({x:ae,y:ne})}}return R.useEffect(()=>{const re=ae=>{const ne=ae.target;(x==null?void 0:x.contains(ne))&&D(ae,U)};return document.addEventListener("wheel",re,{passive:!1}),()=>document.removeEventListener("wheel",re,{passive:!1})},[j,x,U,D]),R.useEffect(H,[n,H]),Oo(x,q),Oo(y.content,q),w.jsx($I,{scope:r,scrollbar:x,hasThumb:i,onThumbChange:Mr(s),onThumbPointerUp:Mr(o),onThumbPositionChange:H,onThumbPointerDown:Mr(a),children:w.jsx(Yt.div,{...p,ref:C,style:{position:"absolute",...p.style},onPointerDown:tt(e.onPointerDown,re=>{re.button===0&&(re.target.setPointerCapture(re.pointerId),I.current=x.getBoundingClientRect(),O.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),G(re))}),onPointerMove:tt(e.onPointerMove,G),onPointerUp:tt(e.onPointerUp,re=>{const ae=re.target;ae.hasPointerCapture(re.pointerId)&&ae.releasePointerCapture(re.pointerId),document.body.style.webkitUserSelect=O.current,y.viewport&&(y.viewport.style.scrollBehavior=""),I.current=null})})})}),dl="ScrollAreaThumb",Ay=R.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=Ty(dl,e.__scopeScrollArea);return w.jsx($n,{present:r||i.hasThumb,children:w.jsx(VI,{ref:t,...n})})}),VI=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,s=xn(dl,r),o=Ty(dl,r),{onThumbPositionChange:a}=o,c=Kt(t,f=>o.onThumbChange(f)),l=R.useRef(void 0),u=uu(()=>{l.current&&(l.current(),l.current=void 0)},100);return R.useEffect(()=>{const f=s.viewport;if(f){const p=()=>{if(u(),!l.current){const y=WI(f,a);l.current=y,a()}};return a(),f.addEventListener("scroll",p),()=>f.removeEventListener("scroll",p)}},[s.viewport,u,a]),w.jsx(Yt.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:tt(e.onPointerDownCapture,f=>{const y=f.target.getBoundingClientRect(),x=f.clientX-y.left,v=f.clientY-y.top;o.onThumbPointerDown({x,y:v})}),onPointerUp:tt(e.onPointerUp,o.onThumbPointerUp)})});Ay.displayName=dl;var G0="ScrollAreaCorner",Iy=R.forwardRef((e,t)=>{const r=xn(G0,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?w.jsx(zI,{...e,ref:t}):null});Iy.displayName=G0;var zI=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=xn(G0,r),[s,o]=R.useState(0),[a,c]=R.useState(0),l=!!(s&&a);return Oo(i.scrollbarX,()=>{var f;const u=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(u),c(u)}),Oo(i.scrollbarY,()=>{var f;const u=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(u),o(u)}),l?w.jsx(Yt.div,{...n,ref:t,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function fl(e){return e?parseInt(e,10):0}function Oy(e,t){const r=e/t;return isNaN(r)?0:r}function lu(e){const t=Oy(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function qI(e,t,r,n="ltr"){const i=lu(r),s=i/2,o=t||s,a=i-o,c=r.scrollbar.paddingStart+o,l=r.scrollbar.size-r.scrollbar.paddingEnd-a,u=r.content-r.viewport,f=n==="ltr"?[0,u]:[u*-1,0];return Ry([c,l],f)(e)}function am(e,t,r="ltr"){const n=lu(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-i,o=t.content-t.viewport,a=s-n,c=r==="ltr"?[0,o]:[o*-1,0],l=UA(e,c);return Ry([0,o],[0,a])(l)}function Ry(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function Py(e,t){return e>0&&e<t}var WI=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function i(){const s={left:e.scrollLeft,top:e.scrollTop},o=r.left!==s.left,a=r.top!==s.top;(o||a)&&t(),r=s,n=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(n)};function uu(e,t){const r=Mr(e),n=R.useRef(0);return R.useEffect(()=>()=>window.clearTimeout(n.current),[]),R.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Oo(e,t){const r=Mr(t);Li(()=>{let n=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return i.observe(e),()=>{window.cancelAnimationFrame(n),i.unobserve(e)}}},[e,r])}var HI=xy,GI=_y,cm=Ey,lm=Ay,KI=Iy,du="Switch",[YI,BU]=Vi(du),[JI,XI]=YI(du),jy=R.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:c="on",onCheckedChange:l,form:u,...f}=e,[p,y]=R.useState(null),x=Kt(t,j=>y(j)),v=R.useRef(!1),C=p?u||!!p.closest("form"):!0,[I,O]=Ha({prop:i,defaultProp:s??!1,onChange:l,caller:du});return w.jsxs(JI,{scope:r,checked:I,disabled:a,children:[w.jsx(Yt.button,{type:"button",role:"switch","aria-checked":I,"aria-required":o,"data-state":Ly(I),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:x,onClick:tt(e.onClick,j=>{O(U=>!U),C&&(v.current=j.isPropagationStopped(),v.current||j.stopPropagation())})}),C&&w.jsx(Dy,{control:p,bubbles:!v.current,name:n,value:c,checked:I,required:o,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});jy.displayName=du;var Ny="SwitchThumb",ky=R.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=XI(Ny,r);return w.jsx(Yt.span,{"data-state":Ly(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});ky.displayName=Ny;var ZI="SwitchBubbleInput",Dy=R.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...i},s)=>{const o=R.useRef(null),a=Kt(o,s),c=H2(r),l=L0(t);return R.useEffect(()=>{const u=o.current;if(!u)return;const f=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==r&&y){const x=new Event("click",{bubbles:n});y.call(u,r),u.dispatchEvent(x)}},[c,r,n]),w.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:a,style:{...i.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Dy.displayName=ZI;function Ly(e){return e?"checked":"unchecked"}var QI=jy,eO=ky;const tO=["1","2","3"],rO=["classic","surface","soft"],Xo={size:{type:"enum",values:tO,default:"2",responsive:!0},variant:{type:"enum",values:rO,default:"surface"},color:Ga,highContrast:iu,radius:z0},By=R.forwardRef((e,t)=>{const{rest:r,...n}=Ka(e),{className:i,style:s,size:o=Xo.size.default,variant:a=Xo.variant.default,color:c=Xo.color.default,highContrast:l=Xo.highContrast.default,radius:u=Xo.radius.default,...f}=r;return R.createElement("span",{"data-radius":u,className:ir("rt-SwitchRoot",i,Gr(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":l},Ya(n)),style:s},R.createElement(QI,{"data-accent-color":c,...f,ref:t,className:ir("rt-reset","rt-SwitchButton",{"rt-high-contrast":l})},R.createElement(eO,{className:ir("rt-SwitchThumb",{"rt-high-contrast":l})})))});By.displayName="Switch";var vf=["Enter"," "],nO=["ArrowDown","PageUp","Home"],Uy=["ArrowUp","PageDown","End"],iO=[...nO,...Uy],sO={ltr:[...vf,"ArrowRight"],rtl:[...vf,"ArrowLeft"]},oO={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Xa="Menu",[Ma,aO,cO]=ry(Xa),[Js,Fy]=Vi(Xa,[cO,eu,iy]),Za=eu(),$y=iy(),[Vy,vs]=Js(Xa),[lO,Qa]=Js(Xa),zy=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=e,a=Za(t),[c,l]=R.useState(null),u=R.useRef(!1),f=Mr(s),p=$0(i);return R.useEffect(()=>{const y=()=>{u.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>u.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),w.jsx(R2,{...a,children:w.jsx(Vy,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:l,children:w.jsx(lO,{scope:t,onClose:R.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:p,modal:o,children:n})})})};zy.displayName=Xa;var uO="MenuAnchor",K0=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Za(r);return w.jsx(P2,{...i,...n,ref:t})});K0.displayName=uO;var Y0="MenuPortal",[dO,qy]=Js(Y0,{forceMount:void 0}),Wy=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,s=vs(Y0,t);return w.jsx(dO,{scope:t,forceMount:r,children:w.jsx($n,{present:r||s.open,children:w.jsx(k2,{asChild:!0,container:i,children:n})})})};Wy.displayName=Y0;var wn="MenuContent",[fO,J0]=Js(wn),Hy=R.forwardRef((e,t)=>{const r=qy(wn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=vs(wn,e.__scopeMenu),o=Qa(wn,e.__scopeMenu);return w.jsx(Ma.Provider,{scope:e.__scopeMenu,children:w.jsx($n,{present:n||s.open,children:w.jsx(Ma.Slot,{scope:e.__scopeMenu,children:o.modal?w.jsx(hO,{...i,ref:t}):w.jsx(pO,{...i,ref:t})})})})}),hO=R.forwardRef((e,t)=>{const r=vs(wn,e.__scopeMenu),n=R.useRef(null),i=Kt(t,n);return R.useEffect(()=>{const s=n.current;if(s)return XA(s)},[]),w.jsx(X0,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:tt(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),pO=R.forwardRef((e,t)=>{const r=vs(wn,e.__scopeMenu);return w.jsx(X0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),mO=_a("MenuContent.ScrollLock"),X0=R.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:p,onDismiss:y,disableOutsideScroll:x,...v}=e,C=vs(wn,r),I=Qa(wn,r),O=Za(r),j=$y(r),U=aO(r),[D,H]=R.useState(null),q=R.useRef(null),G=Kt(t,q,C.onContentChange),re=R.useRef(0),ae=R.useRef(""),ne=R.useRef(0),V=R.useRef(null),N=R.useRef("right"),h=R.useRef(0),d=x?NI:R.Fragment,m=x?{as:mO,allowPinchZoom:!0}:void 0,S=M=>{var le,xe;const P=ae.current+M,A=U().filter(Se=>!Se.disabled),g=document.activeElement,b=(le=A.find(Se=>Se.ref.current===g))==null?void 0:le.textValue,B=A.map(Se=>Se.textValue),se=MO(B,P,b),te=(xe=A.find(Se=>Se.textValue===se))==null?void 0:xe.ref.current;(function Se(Ee){ae.current=Ee,window.clearTimeout(re.current),Ee!==""&&(re.current=window.setTimeout(()=>Se(""),1e3))})(P),te&&setTimeout(()=>te.focus())};R.useEffect(()=>()=>window.clearTimeout(re.current),[]),FA();const E=R.useCallback(M=>{var A,g;return N.current===((A=V.current)==null?void 0:A.side)&&IO(M,(g=V.current)==null?void 0:g.area)},[]);return w.jsx(fO,{scope:r,searchRef:ae,onItemEnter:R.useCallback(M=>{E(M)&&M.preventDefault()},[E]),onItemLeave:R.useCallback(M=>{var P;E(M)||((P=q.current)==null||P.focus(),H(null))},[E]),onTriggerLeave:R.useCallback(M=>{E(M)&&M.preventDefault()},[E]),pointerGraceTimerRef:ne,onPointerGraceIntentChange:R.useCallback(M=>{V.current=M},[]),children:w.jsx(d,{...m,children:w.jsx(ly,{asChild:!0,trapped:i,onMountAutoFocus:tt(s,M=>{var P;M.preventDefault(),(P=q.current)==null||P.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:w.jsx(I0,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:p,onDismiss:y,children:w.jsx(LA,{asChild:!0,...j,dir:I.dir,orientation:"vertical",loop:n,currentTabStopId:D,onCurrentTabStopIdChange:H,onEntryFocus:tt(c,M=>{I.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:w.jsx(j2,{role:"menu","aria-orientation":"vertical","data-state":lw(C.open),"data-radix-menu-content":"",dir:I.dir,...O,...v,ref:G,style:{outline:"none",...v.style},onKeyDown:tt(v.onKeyDown,M=>{const A=M.target.closest("[data-radix-menu-content]")===M.currentTarget,g=M.ctrlKey||M.altKey||M.metaKey,b=M.key.length===1;A&&(M.key==="Tab"&&M.preventDefault(),!g&&b&&S(M.key));const B=q.current;if(M.target!==B||!iO.includes(M.key))return;M.preventDefault();const te=U().filter(le=>!le.disabled).map(le=>le.ref.current);Uy.includes(M.key)&&te.reverse(),CO(te)}),onBlur:tt(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout(re.current),ae.current="")}),onPointerMove:tt(e.onPointerMove,Aa(M=>{const P=M.target,A=h.current!==M.clientX;if(M.currentTarget.contains(P)&&A){const g=M.clientX>h.current?"right":"left";N.current=g,h.current=M.clientX}}))})})})})})})});Hy.displayName=wn;var gO="MenuGroup",Z0=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return w.jsx(Yt.div,{role:"group",...n,ref:t})});Z0.displayName=gO;var bO="MenuLabel",Gy=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return w.jsx(Yt.div,{...n,ref:t})});Gy.displayName=bO;var hl="MenuItem",um="menu.itemSelect",fu=R.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,s=R.useRef(null),o=Qa(hl,e.__scopeMenu),a=J0(hl,e.__scopeMenu),c=Kt(t,s),l=R.useRef(!1),u=()=>{const f=s.current;if(!r&&f){const p=new CustomEvent(um,{bubbles:!0,cancelable:!0});f.addEventListener(um,y=>n==null?void 0:n(y),{once:!0}),c2(f,p),p.defaultPrevented?l.current=!1:o.onClose()}};return w.jsx(Ky,{...i,ref:c,disabled:r,onClick:tt(e.onClick,u),onPointerDown:f=>{var p;(p=e.onPointerDown)==null||p.call(e,f),l.current=!0},onPointerUp:tt(e.onPointerUp,f=>{var p;l.current||(p=f.currentTarget)==null||p.click()}),onKeyDown:tt(e.onKeyDown,f=>{const p=a.searchRef.current!=="";r||p&&f.key===" "||vf.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});fu.displayName=hl;var Ky=R.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,o=J0(hl,r),a=$y(r),c=R.useRef(null),l=Kt(t,c),[u,f]=R.useState(!1),[p,y]=R.useState("");return R.useEffect(()=>{const x=c.current;x&&y((x.textContent??"").trim())},[s.children]),w.jsx(Ma.ItemSlot,{scope:r,disabled:n,textValue:i??p,children:w.jsx(BA,{asChild:!0,...a,focusable:!n,children:w.jsx(Yt.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:l,onPointerMove:tt(e.onPointerMove,Aa(x=>{n?o.onItemLeave(x):(o.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:tt(e.onPointerLeave,Aa(x=>o.onItemLeave(x))),onFocus:tt(e.onFocus,()=>f(!0)),onBlur:tt(e.onBlur,()=>f(!1))})})})}),vO="MenuCheckboxItem",Yy=R.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return w.jsx(ew,{scope:e.__scopeMenu,checked:r,children:w.jsx(fu,{role:"menuitemcheckbox","aria-checked":pl(r)?"mixed":r,...i,ref:t,"data-state":th(r),onSelect:tt(i.onSelect,()=>n==null?void 0:n(pl(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Yy.displayName=vO;var Jy="MenuRadioGroup",[yO,wO]=Js(Jy,{value:void 0,onValueChange:()=>{}}),Xy=R.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,s=Mr(n);return w.jsx(yO,{scope:e.__scopeMenu,value:r,onValueChange:s,children:w.jsx(Z0,{...i,ref:t})})});Xy.displayName=Jy;var Zy="MenuRadioItem",Qy=R.forwardRef((e,t)=>{const{value:r,...n}=e,i=wO(Zy,e.__scopeMenu),s=r===i.value;return w.jsx(ew,{scope:e.__scopeMenu,checked:s,children:w.jsx(fu,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":th(s),onSelect:tt(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});Qy.displayName=Zy;var Q0="MenuItemIndicator",[ew,xO]=Js(Q0,{checked:!1}),tw=R.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,s=xO(Q0,r);return w.jsx($n,{present:n||pl(s.checked)||s.checked===!0,children:w.jsx(Yt.span,{...i,ref:t,"data-state":th(s.checked)})})});tw.displayName=Q0;var SO="MenuSeparator",rw=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return w.jsx(Yt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});rw.displayName=SO;var _O="MenuArrow",nw=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Za(r);return w.jsx(N2,{...i,...n,ref:t})});nw.displayName=_O;var eh="MenuSub",[EO,iw]=Js(eh),sw=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,s=vs(eh,t),o=Za(t),[a,c]=R.useState(null),[l,u]=R.useState(null),f=Mr(i);return R.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),w.jsx(R2,{...o,children:w.jsx(Vy,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:u,children:w.jsx(EO,{scope:t,contentId:Ea(),triggerId:Ea(),trigger:a,onTriggerChange:c,children:r})})})};sw.displayName=eh;var ia="MenuSubTrigger",ow=R.forwardRef((e,t)=>{const r=vs(ia,e.__scopeMenu),n=Qa(ia,e.__scopeMenu),i=iw(ia,e.__scopeMenu),s=J0(ia,e.__scopeMenu),o=R.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,l={__scopeMenu:e.__scopeMenu},u=R.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return R.useEffect(()=>u,[u]),R.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),w.jsx(K0,{asChild:!0,...l,children:w.jsx(Ky,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":lw(r.open),...e,ref:M0(t,i.onTriggerChange),onClick:f=>{var p;(p=e.onClick)==null||p.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:tt(e.onPointerMove,Aa(f=>{s.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!r.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),u()},100))})),onPointerLeave:tt(e.onPointerLeave,Aa(f=>{var y,x;u();const p=(y=r.content)==null?void 0:y.getBoundingClientRect();if(p){const v=(x=r.content)==null?void 0:x.dataset.side,C=v==="right",I=C?-5:5,O=p[C?"left":"right"],j=p[C?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+I,y:f.clientY},{x:O,y:p.top},{x:j,y:p.top},{x:j,y:p.bottom},{x:O,y:p.bottom}],side:v}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(f),f.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:tt(e.onKeyDown,f=>{var y;const p=s.searchRef.current!=="";e.disabled||p&&f.key===" "||sO[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});ow.displayName=ia;var aw="MenuSubContent",cw=R.forwardRef((e,t)=>{const r=qy(wn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=vs(wn,e.__scopeMenu),o=Qa(wn,e.__scopeMenu),a=iw(aw,e.__scopeMenu),c=R.useRef(null),l=Kt(t,c);return w.jsx(Ma.Provider,{scope:e.__scopeMenu,children:w.jsx($n,{present:n||s.open,children:w.jsx(Ma.Slot,{scope:e.__scopeMenu,children:w.jsx(X0,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:l,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var f;o.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:tt(e.onFocusOutside,u=>{u.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:tt(e.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:tt(e.onKeyDown,u=>{var y;const f=u.currentTarget.contains(u.target),p=oO[o.dir].includes(u.key);f&&p&&(s.onOpenChange(!1),(y=a.trigger)==null||y.focus(),u.preventDefault())})})})})})});cw.displayName=aw;function lw(e){return e?"open":"closed"}function pl(e){return e==="indeterminate"}function th(e){return pl(e)?"indeterminate":e?"checked":"unchecked"}function CO(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function TO(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function MO(e,t,r){const i=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,s=r?e.indexOf(r):-1;let o=TO(e,Math.max(s,0));i.length===1&&(o=o.filter(l=>l!==r));const c=o.find(l=>l.toLowerCase().startsWith(i.toLowerCase()));return c!==r?c:void 0}function AO(e,t){const{x:r,y:n}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],c=t[o],l=a.x,u=a.y,f=c.x,p=c.y;u>n!=p>n&&r<(f-l)*(n-u)/(p-u)+l&&(i=!i)}return i}function IO(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return AO(r,t)}function Aa(e){return t=>t.pointerType==="mouse"?e(t):void 0}var OO=zy,RO=K0,PO=Wy,jO=Hy,NO=Z0,kO=Gy,DO=fu,LO=Yy,BO=Xy,UO=Qy,FO=tw,$O=rw,VO=nw,zO=sw,qO=ow,WO=cw,hu="DropdownMenu",[HO,UU]=Vi(hu,[Fy]),Ur=Fy(),[GO,uw]=HO(hu),dw=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,c=Ur(t),l=R.useRef(null),[u,f]=Ha({prop:i,defaultProp:s??!1,onChange:o,caller:hu});return w.jsx(GO,{scope:t,triggerId:Ea(),triggerRef:l,contentId:Ea(),open:u,onOpenChange:f,onOpenToggle:R.useCallback(()=>f(p=>!p),[f]),modal:a,children:w.jsx(OO,{...c,open:u,onOpenChange:f,dir:n,modal:a,children:r})})};dw.displayName=hu;var fw="DropdownMenuTrigger",hw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=uw(fw,r),o=Ur(r);return w.jsx(RO,{asChild:!0,...o,children:w.jsx(Yt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...i,ref:M0(t,s.triggerRef),onPointerDown:tt(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:tt(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});hw.displayName=fw;var KO="DropdownMenuPortal",pw=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Ur(t);return w.jsx(PO,{...n,...r})};pw.displayName=KO;var mw="DropdownMenuContent",gw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=uw(mw,r),s=Ur(r),o=R.useRef(!1);return w.jsx(jO,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...n,ref:t,onCloseAutoFocus:tt(e.onCloseAutoFocus,a=>{var c;o.current||(c=i.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:tt(e.onInteractOutside,a=>{const c=a.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,u=c.button===2||l;(!i.modal||u)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});gw.displayName=mw;var YO="DropdownMenuGroup",bw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(NO,{...i,...n,ref:t})});bw.displayName=YO;var JO="DropdownMenuLabel",vw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(kO,{...i,...n,ref:t})});vw.displayName=JO;var XO="DropdownMenuItem",yw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(DO,{...i,...n,ref:t})});yw.displayName=XO;var ZO="DropdownMenuCheckboxItem",ww=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(LO,{...i,...n,ref:t})});ww.displayName=ZO;var QO="DropdownMenuRadioGroup",xw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(BO,{...i,...n,ref:t})});xw.displayName=QO;var eR="DropdownMenuRadioItem",Sw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(UO,{...i,...n,ref:t})});Sw.displayName=eR;var tR="DropdownMenuItemIndicator",_w=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(FO,{...i,...n,ref:t})});_w.displayName=tR;var rR="DropdownMenuSeparator",Ew=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx($O,{...i,...n,ref:t})});Ew.displayName=rR;var nR="DropdownMenuArrow",iR=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(VO,{...i,...n,ref:t})});iR.displayName=nR;var sR=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:s}=e,o=Ur(t),[a,c]=Ha({prop:n,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return w.jsx(zO,{...o,open:a,onOpenChange:c,children:r})},oR="DropdownMenuSubTrigger",Cw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(qO,{...i,...n,ref:t})});Cw.displayName=oR;var aR="DropdownMenuSubContent",Tw=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Ur(r);return w.jsx(WO,{...i,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Tw.displayName=aR;var cR=dw,lR=hw,Mw=pw,uR=gw,dR=bw,fR=vw,hR=yw,pR=ww,mR=xw,gR=Sw,Aw=_w,bR=Ew,vR=sR,yR=Cw,wR=Tw;const xR=["1","2","3"],SR=["vertical","horizontal","both"],md={size:{type:"enum",values:xR,default:"1",responsive:!0},radius:z0,scrollbars:{type:"enum",values:SR,default:"both"}},rh=R.forwardRef((e,t)=>{const{rest:r,...n}=Ka(e),{className:i,style:s,type:o,scrollHideDelay:a=o!=="scroll"?0:void 0,dir:c,size:l=md.size.default,radius:u=md.radius.default,scrollbars:f=md.scrollbars.default,...p}=r;return R.createElement(HI,{type:o,scrollHideDelay:a,className:ir("rt-ScrollAreaRoot",i,Ya(n)),style:s},R.createElement(GI,{...p,ref:t,className:"rt-ScrollAreaViewport"}),R.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),f!=="vertical"?R.createElement(cm,{"data-radius":u,orientation:"horizontal",className:ir("rt-ScrollAreaScrollbar",Gr(l,"rt-r-size"))},R.createElement(lm,{className:"rt-ScrollAreaThumb"})):null,f!=="horizontal"?R.createElement(cm,{"data-radius":u,orientation:"vertical",className:ir("rt-ScrollAreaScrollbar",Gr(l,"rt-r-size"))},R.createElement(lm,{className:"rt-ScrollAreaThumb"})):null,f==="both"?R.createElement(KI,{className:"rt-ScrollAreaCorner"}):null)});rh.displayName="ScrollArea";const _R=["1","2"],ER=["solid","soft"],gd={size:{type:"enum",values:_R,default:"2",responsive:!0},variant:{type:"enum",values:ER,default:"solid"},color:Ga,highContrast:iu},Iw={color:Ga,shortcut:{type:"string",default:void 0}},Ow=e=>R.createElement(cR,{...e});Ow.displayName="DropdownMenuRoot";const Rw=R.forwardRef((e,t)=>R.createElement(lR,{...e,ref:t,asChild:!0}));Rw.displayName="DropdownMenuTrigger";const Pw=R.createContext({}),jw=R.forwardRef((e,t)=>{const r=bA(),{className:n,children:i,size:s=gd.size.default,variant:o=gd.variant.default,highContrast:a=gd.highContrast.default,color:c=Iw.color.default,container:l,forceMount:u,...f}=e,p=c??r.accentColor;return R.createElement(Mw,{container:l,forceMount:u},R.createElement(nu,{asChild:!0},R.createElement(uR,{"data-accent-color":p,align:"start",sideOffset:4,collisionPadding:10,...f,ref:t,className:ir("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,Gr(s,"rt-r-size"),`rt-variant-${o}`,{"rt-high-contrast":a})},R.createElement(rh,{type:"auto"},R.createElement("div",{className:ir("rt-BaseMenuViewport","rt-DropdownMenuViewport")},R.createElement(Pw.Provider,{value:R.useMemo(()=>({size:s,variant:o,color:p,highContrast:a}),[s,o,p,a])},i))))))});jw.displayName="DropdownMenuContent";const Nw=R.forwardRef((e,t)=>R.createElement(fR,{...e,ref:t,className:ir("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));Nw.displayName="DropdownMenuLabel";const kw=R.forwardRef((e,t)=>{const{className:r,children:n,color:i=Iw.color.default,shortcut:s,...o}=e;return R.createElement(hR,{"data-accent-color":i,...o,ref:t,className:ir("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},R.createElement(Jl,null,n),s&&R.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s))});kw.displayName="DropdownMenuItem";const Dw=R.forwardRef((e,t)=>R.createElement(dR,{...e,ref:t,className:ir("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));Dw.displayName="DropdownMenuGroup";const Lw=R.forwardRef((e,t)=>R.createElement(mR,{...e,ref:t,className:ir("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));Lw.displayName="DropdownMenuRadioGroup";const Bw=R.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return R.createElement(gR,{...i,ref:t,className:ir("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},R.createElement(Jl,null,r),R.createElement(Aw,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},R.createElement(ou,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});Bw.displayName="DropdownMenuRadioItem";const Uw=R.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...s}=e;return R.createElement(pR,{...s,ref:t,className:ir("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},R.createElement(Jl,null,r),R.createElement(Aw,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},R.createElement(ou,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&R.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});Uw.displayName="DropdownMenuCheckboxItem";const Fw=e=>R.createElement(vR,{...e});Fw.displayName="DropdownMenuSub";const $w=R.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return R.createElement(yR,{...i,ref:t,className:ir("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},R.createElement(Jl,null,n),R.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},R.createElement(ty,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});$w.displayName="DropdownMenuSubTrigger";const Vw=R.forwardRef((e,t)=>{const{className:r,children:n,container:i,forceMount:s,...o}=e,{size:a,variant:c,color:l,highContrast:u}=R.useContext(Pw);return R.createElement(Mw,{container:i,forceMount:s},R.createElement(nu,{asChild:!0},R.createElement(wR,{"data-accent-color":l,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...o,ref:t,className:ir("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,Gr(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":u})},R.createElement(rh,{type:"auto"},R.createElement("div",{className:ir("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});Vw.displayName="DropdownMenuSubContent";const zw=R.forwardRef((e,t)=>R.createElement(bR,{...e,ref:t,className:ir("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));zw.displayName="DropdownMenuSeparator";const Pi=Object.assign({},{Root:Ow,Trigger:Rw,Content:jw,Label:Nw,Item:kw,Group:Dw,RadioGroup:Lw,RadioItem:Bw,CheckboxItem:Uw,Sub:Fw,SubTrigger:$w,SubContent:Vw,Separator:zw}),CR=["1","2","3","4"],TR=["classic","solid","soft","surface","outline","ghost"],Zo={size:{type:"enum",values:CR,default:"2",responsive:!0},variant:{type:"enum",values:TR,default:"solid"},color:Ga,highContrast:iu,radius:z0},qw=R.forwardRef((e,t)=>{const{rest:r,...n}=Ka(e),{className:i,asChild:s=!1,size:o=Zo.size.default,variant:a=Zo.variant.default,color:c=Zo.color.default,highContrast:l=Zo.highContrast.default,radius:u=Zo.radius.default,...f}=r,p=s?A0:"button";return R.createElement(p,{"data-disabled":f.disabled||void 0,"data-accent-color":c,"data-radius":u,...f,ref:t,className:ir("rt-reset","rt-BaseButton",i,Gr(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":l},Ya(n))})});qw.displayName="BaseButton";const Ww=R.forwardRef((e,t)=>R.createElement(qw,{...e,ref:t,className:ir("rt-Button",e.className)}));Ww.displayName="Button";const MR={loading:{type:"boolean",default:!0}},$o=R.forwardRef((e,t)=>{const{rest:r,...n}=Ka(e),{className:i,children:s,loading:o=MR.loading.default,...a}=r;if(!o)return R.createElement(R.Fragment,null,s);const c=R.isValidElement(s)?A0:"span";return R.createElement(c,{ref:t,"aria-hidden":!0,className:ir("rt-Skeleton",i,Ya(n)),"data-inline-skeleton":R.isValidElement(s)?void 0:!0,tabIndex:-1,inert:"",...a},s)});$o.displayName="Skeleton";function nh(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,s=()=>{r&&r()};return w.jsx(Ww,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:s,children:t})}function $s({content:e,children:t,position:r="top",marginTop:n="0px",borderRadius:i="8px",delay:s=0,backgroundColor:o="var(--cs-bg-primary)"}){const[a,c]=Z.useState(!1),[l,u]=Z.useState(!1),f=Z.useRef(null),p=()=>{f.current&&(clearTimeout(f.current),f.current=null),c(!0)};Z.useEffect(()=>()=>{a||f.current&&(clearTimeout(f.current),f.current=null)},[a]);const y=()=>{f.current=setTimeout(()=>{l||(c(!1),f.current&&(clearTimeout(f.current),f.current=null))},0)},x=()=>{switch(r){case"top":return{transform:"translateX(-50%)"};case"bottom":return{transform:"translateX(-50%)",marginTop:"0px"};case"left":return{transform:"translateY(-50%)",marginRight:"8px"};case"right":return{transform:"translateY(-50%)"};default:return{}}},v=Z.useRef(null),[C,I]=Z.useState({left:void 0,top:void 0});return Z.useEffect(()=>{var O;if(a&&v.current){const j=(O=v.current)==null?void 0:O.getBoundingClientRect();let U,D;r==="top"?(U=`${window.scrollX+j.left+j.width/2}px`,D=`${window.scrollY+j.top-2*j.height-8}px`):r==="bottom"?(U=`${window.scrollX+j.left+j.width/2}px`,D=`${window.scrollY+j.bottom}px`):r==="left"?(U=`${window.scrollX+j.left-8}px`,D=`${window.scrollY+j.top+j.height/2}px`):r==="right"?(U=`${window.scrollX+j.right+8}px`,D=`${window.scrollY+j.top+j.height/2}px`):(U=`${window.scrollX+j.left+j.width/2}px`,D=`${window.scrollY+j.top+j.height/2}px`),I({left:U,top:D})}},[a]),w.jsxs("div",{ref:v,style:{position:"relative",display:"inline-block"},onMouseEnter:p,onMouseLeave:y,children:[t,a&&vl.createPortal(w.jsx("div",{style:{transition:"opacity 0.3s ease",opacity:a?1:0,position:"absolute",zIndex:9e3,padding:"8px 12px",backgroundColor:o,color:"var(--cs-text-secondary)",borderRadius:i,fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)",...x(),...C,marginTop:n},onMouseEnter:()=>u(!0),onMouseLeave:()=>{f.current&&(clearTimeout(f.current),f.current=null),u(!1),c(!1)},children:e}),document.body)]})}const bd=[{label:"Default"},{label:"Fast Mode",beforeIcon:{xlinkHref:"#icon-icon_flash",fontSize:"16px",activeColor:"var(--cs-primary)",activeHoverColor:"var(--cs-primary)"}}],AR=e=>{const{transactionMode:t,setTransactionMode:r,maxCapForGas:n,setMaxCapForGas:i,customGasPrice:s,setCustomGasPrice:o,suiBalance:a,themeType:c}=e,l=c=="Light"?Mt("/images/icon_shio_light@2x.png"):Mt("/images/icon_shio@2x.png"),u=Z.useMemo(()=>{var O;return(O=bd.filter(j=>(j==null?void 0:j.label)===t))==null?void 0:O[0]},[t,bd]),f=O=>{const j=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,9})?).*$");O.target.value=O.target.value.replace(j,"$1"),i(O.target.value)},p=O=>{const j=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,9})?).*$");O.target.value=O.target.value.replace(j,"$1");const U=Me(O.target.value).gt(0)?Me(O.target.value).div(Math.pow(10,9)).toString():"0";Me(U).gt(n)&&i(U),o(O.target.value)},y=Z.useMemo(()=>!n||Number(n)==0?"Please enter a value higher than 0":n&&Number(n)>5?"Only allow up to 5 SUI":Me(n).gt(a)?"Insufficient SUI balance ":Me(n).lt(Me(s).div(Math.pow(10,9)))?"Max cap cannot be less than custom gas.":"",[n]),x=Z.useMemo(()=>n&&Number(n)>0&&Number(n)<2e-6?"Your current maximum fee is below the market rate. Please raise it to ensure your transactions are processed.":"",[n]),v=Z.useMemo(()=>!s||Number(s)==0?"Please enter a value higher than 0":"",[s]),C=Z.useMemo(()=>s&&Number(s)>0&&Me(s).lt(750)?"Your current maximum fee is below the market rate. Please raise it to ensure your transactions are processed.":"",[s]),I=Z.useMemo(()=>!s||s==="0"?"0":Me(s).div(Math.pow(10,9)).toString(),[s]);return w.jsxs("div",{className:"transaction-mode-container",children:[w.jsxs("div",{className:"transaction-mode-header",children:[w.jsxs("div",{className:"transaction-mode-label",children:[w.jsx("svg",{children:w.jsx("use",{xlinkHref:"#icon-icon_mode"})}),w.jsx("span",{className:"caption-text",children:"Transaction Mode"})]}),w.jsx("div",{className:"slippage-tab-list",children:bd.map(O=>w.jsxs("div",{className:O.label===u.label?"active slippage-tab":"slippage-tab",children:[O.label!=="Default"&&w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-icon_flash"})}),w.jsx("span",{onClick:()=>{r(O.label)},children:O.label})]},O.label))})]}),w.jsx("p",{className:"transaction-description",children:t==="Default"?"Standard gas based on real-time network conditions":"Land your transaction earlier and avoid congestion with a higher gas price. MEV protection is on by default in Fast Mode."}),t==="Fast Mode"&&w.jsxs("div",{className:"fast-mode-section",children:[w.jsxs("div",{className:"input-card",children:[w.jsxs("div",{className:"input-label",children:[w.jsx("span",{children:"Custom Gas Price"}),w.jsx($s,{position:"bottom",content:w.jsx("div",{className:"tooltip-content",children:"The total gas depends on the gas price and actual gas units consumed."}),children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-tips"})})})]}),w.jsxs("div",{className:"input-right",children:[w.jsxs("div",{className:"input-field",children:[w.jsx("input",{value:s,onChange:p,placeholder:"0.0"}),w.jsx("span",{className:"caption-text",children:"MIST"})]}),w.jsxs("div",{className:"unit-text",children:[w.jsx("span",{children:I}),"SUI"]})]})]}),v&&w.jsx(gc,{text:v,type:"error"}),C&&w.jsx(gc,{text:C,type:"warn"}),w.jsxs("div",{className:"input-card",children:[w.jsxs("div",{className:"input-label",children:[w.jsx("span",{children:"Set Max Cap for Gas"}),w.jsx($s,{position:"bottom",content:w.jsx("div",{className:"tooltip-content",children:"Set a max cap for your gas to prevent overpaying"}),children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-tips"})})})]}),w.jsx("div",{className:"input-right",children:w.jsxs("div",{className:"input-field",children:[w.jsx("input",{value:n,onChange:f,placeholder:"0.0"}),w.jsx("span",{className:"caption-text",children:"SUI"})]})})]}),y&&w.jsx(gc,{text:y,type:"error"}),x&&w.jsx(gc,{text:x,type:"warn"}),w.jsxs("div",{className:"powered-by",children:[w.jsx("span",{children:"Powered by"}),w.jsx("img",{src:l,alt:"shio"})]})]})]})},gc=e=>{const{text:t,type:r}=e;return w.jsx("div",{style:{width:"100%",padding:"4px 16px",borderRadius:"8px",background:r==="warn"?"var(--cs-warning-10)":"var(--cs-error-10)",display:"flex",alignItems:"center",justifyContent:"center"},children:w.jsx("span",{style:{color:r==="warn"?"var(--cs-warning)":"var(--cs-error)",fontSize:"12px",lineHeight:"16px"},children:t})})},IR={id:"0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3",coin_type:"0x2::sui::SUI",decimals:9,description:"",name:"Sui",symbol:"SUI",logo_url:"https://archive.cetus.zone/assets/image/sui/sui.png",is_verified:!0,extensions:{rank:"880"}};function OR({themeType:e}){const{setIsOpenSlippageDialog:t,isOpenSlippageDialog:r,slippage:n}=zr();return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"slippage-button",onClick:()=>t(!0),children:[w.jsxs("span",{children:[n,"%"]}),w.jsx("div",{className:"svg-box",children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-verticalslider"})})})]}),r&&w.jsx(RR,{themeType:e,onClose:()=>t(!1)})]})}function RR({onClose:e,themeType:t}){const{transactionMode:r,maxCapForGas:n,customGasPrice:i,setMaxCapForGas:s,setCustomGasPrice:o,setTransctionMode:a,mevProtect:c,setMevProtect:l}=zr(),{balanceInfo:u}=Sa(IR),[f,p]=Z.useState(r),[y,x]=Z.useState(n),[v,C]=Z.useState(i),[I,O]=Z.useState(c),{slippage:j,setSlippage:U}=zr(),[D,H]=Z.useState(j),q=ne=>{H(ne.display)},G=ne=>{const V=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,2})?).*$");ne.target.value=ne.target.value.replace(V,"$1"),H(ne.target.value)},re=()=>{D&&U(D),f==="Fast Mode"&&(s(y),o(v)),a(f),l(I),e()};Z.useEffect(()=>{f==="Fast Mode"&&O(!0)},[f]);const ae=Z.useMemo(()=>f==="Fast Mode"&&(!y||Number(y)===0||Number(y)>5||!v||Number(v)===0||Me(y).gt((u==null?void 0:u.totalBalanceFormat)||"0")||Me(y).lt(Me(v).div(Math.pow(10,9))))||!+D?!0:Number(D)>50||Number(D)<.01,[D,f,y,v,u]);return w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"dialog-mask",style:{zIndex:"100"}}),w.jsx("div",{className:"slippage-settings-dialog",style:{zIndex:"100"},children:w.jsxs("div",{className:"slippage-settings",children:[w.jsxs("div",{className:"slippage-settings-header",children:[w.jsx("div",{className:"title",children:"Settings"}),w.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:w.jsx("use",{xlinkHref:"#icon-close"})})]}),w.jsxs("div",{className:"title",children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-verticalslider"})}),w.jsx("span",{children:"Slippage Tolerance"})]}),w.jsxs("div",{className:"form-box",children:[w.jsx("div",{className:"slippage-tab-list",children:NC.map(ne=>w.jsxs("span",{className:ne.display===D?"active":"",onClick:()=>q(ne),children:[ne.display," %"]},ne.display))}),w.jsxs("div",{className:"input-box",children:[w.jsx("span",{children:"Custom"}),w.jsx("input",{className:"cs-input",placeholder:"0.0",value:D,onChange:G}),w.jsx("div",{style:{fontSize:"14px",color:"var(--cs-text-primary)"},children:"%"})]})]}),Number(D)<=.05&&w.jsx("div",{className:"tips warning",children:"Slippage is low. Your transaction may fail."}),Number(D)<=50&&Number(D)>1&&w.jsx("div",{className:"tips warning",children:"Your transaction may frontrun"}),Number(D)>50&&w.jsx("div",{className:"tips error",children:" Enter a valid slippage percentage"}),w.jsx(AR,{transactionMode:f,setTransactionMode:p,maxCapForGas:y,setMaxCapForGas:x,customGasPrice:v,setCustomGasPrice:C,suiBalance:(u==null?void 0:u.totalBalanceFormat)||"0",themeType:t}),w.jsx(PR,{mevProtect:I,setMevProtect:O,disabled:f==="Fast Mode"}),w.jsx(nh,{text:"Save",btnIsDisabled:ae,className:"slippage-save-btn",onClick:re})]})})]})}const PR=e=>{const{mevProtect:t,disabled:r,setMevProtect:n}=e;return w.jsxs("div",{className:"mev-settings-box",children:[w.jsx("div",{className:"mev-setting-title",children:w.jsxs("div",{className:"name",children:[w.jsx("svg",{"aria-hidden":"true",cursor:"pointer",fill:"var(--cs-icon-fill)",children:w.jsx("use",{xlinkHref:"#icon-icon_mev"})}),w.jsx("span",{children:"MEV Protect"})]})}),w.jsxs("div",{className:"mev-setting-Switch",children:[w.jsxs("div",{className:"label",children:[w.jsx("span",{children:"Enable MEV Protection"}),w.jsx($s,{position:"bottom",marginTop:"-118px",content:w.jsx("div",{className:"mev-tips",style:{width:"310px",whiteSpace:"wrap",color:"var(--cs-text-primary)"},children:"By enabling this, your txn will be submitted via 3rd party MEV service provider. MEV value retained will be redistributed to all users who successfully execute their trades with Shio through its point campaign."}),children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer"},children:w.jsx("use",{xlinkHref:"#icon-tips"})})})]}),w.jsx(By,{checked:t,disabled:r,className:"cs-switch",onClick:()=>{n(!t)}})]})]})};function jR({handleRefresh:e,themeType:t}){return w.jsx(w.Fragment,{children:w.jsxs("div",{className:"swap-header",children:[w.jsx("h3",{className:"swap-title",children:"Swap"}),w.jsxs("div",{className:"right",children:[w.jsx(OR,{themeType:t}),w.jsx(nT,{onClick:e})]})]})})}function NR(){const[e,t]=Z.useState(!1);return w.jsxs(Pi.Root,{open:e,onOpenChange:t,children:[w.jsx(Pi.Trigger,{children:w.jsx("div",{className:"cs-settings-btn",children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-settings"})})})}),w.jsx(Pi.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"var(--cs-primary-10)"},side:"bottom",align:"end",children:w.jsxs("div",{className:"cs-settings-box",children:[w.jsx("h3",{children:"Settings"}),w.jsx(kR,{}),w.jsx(LR,{onClose:()=>{t(!1)}})]})})]})}function kR(){const{currentExplorer:e,setCurrentExplorer:t,currentRpc:r,setCurrentRpc:n}=zr(),i=s=>{t(s)};return w.jsxs("div",{className:"settings-card",style:{marginTop:"12px"},children:[w.jsxs("h3",{className:"card-title",children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-plorer"})}),w.jsx("span",{children:"Preferred Explorer"})]}),w.jsx("div",{className:"explorer-checkbox-group",children:Kl.map(s=>w.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(s.link),children:[w.jsx(au,{color:"indigo",checked:s.link===e,variant:"soft",className:"cs-checkbox cs-allow-change-checkbox"}),w.jsx("img",{src:s.img}),w.jsx("span",{children:s.name})]},s.link))})]})}const DR=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function LR({onClose:e}){const{addTxToast:t}=Bo(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:s,rpcList:o}=zr(),[a,c]=Z.useState(i),[l,u]=Z.useState(r),f=v=>{t({id:0,status:"success",buildShowInfo:()=>({toastTitleText:"RPC update",toastDescriptionContent:`RPC is currently set to ${v}`})})},p=v=>{u(v),v.isCustom||(n(v),f(v.link),e())},y=v=>{c(v.target.value)},x=()=>{if(a){const v={name:"Custom RPC URL",link:a,isCustom:!0};s(a),n(v),f(a),e()}};return w.jsxs("div",{className:"settings-card rpc-settings-card",children:[w.jsxs("h3",{className:"card-title",children:[w.jsx("svg",{className:"cs-icon rpc-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-rpc"})}),w.jsx("span",{children:"RPC Node"})]}),w.jsxs("div",{className:"rpc-checkbox-group",children:[o.map(v=>w.jsxs("div",{className:"rpc-item",onClick:()=>p(v),children:[w.jsx(au,{color:"indigo",checked:l.name===v.name,variant:"soft",className:"cs-checkbox cs-allow-change-checkbox"}),w.jsx("span",{children:v.name})]},v.name)),l.isCustom&&w.jsxs("div",{className:"custom-rpc-input-box",children:[w.jsx("input",{className:"cs-input",placeholder:"Custom RPC URL",onChange:y,value:a}),w.jsx(nh,{btnIsDisabled:DR(a),text:"Save",onClick:x})]})]})]})}function Hw(){const{suiClient:e}=gs(),{setAccountServiceNameObj:t,accountServiceNameObj:r}=qr(),n=async s=>{if(!((s==null?void 0:s.length)<1))try{const o=s.map(async l=>{var f;const u=await e.resolveNameServiceNames({address:l});return{address:l,name:((f=u==null?void 0:u.data)==null?void 0:f[0])||""}}),a=await Promise.all(o),c=Object.fromEntries(a==null?void 0:a.map(l=>[l.address,l.name]));t(c)}catch{}};return{fetchServiceNames:n,getServiceNames:async s=>{const o=[];s==null||s.forEach(a=>{const c=a==null?void 0:a.address;r!=null&&r[c]||o.push(c)}),(o==null?void 0:o.length)>0&&n(o)}}}var BR=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||r.forEach(function(i){e.addRange(i)}),t&&t.focus()}},UR=BR,dm={"text/plain":"Text","text/html":"Url",default:"Text"},FR="Copy to clipboard: #{key}, Enter";function $R(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function VR(e,t){var r,n,i,s,o,a,c=!1;t||(t={}),r=t.debug||!1;try{i=UR(),s=document.createRange(),o=document.getSelection(),a=document.createElement("span"),a.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(u){if(u.stopPropagation(),t.format)if(u.preventDefault(),typeof u.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=dm[t.format]||dm.default;window.clipboardData.setData(f,e)}else u.clipboardData.clearData(),u.clipboardData.setData(t.format,e);t.onCopy&&(u.preventDefault(),t.onCopy(u.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),o.addRange(s);var l=document.execCommand("copy");if(!l)throw new Error("copy command was unsuccessful");c=!0}catch(u){r&&console.error("unable to copy using execCommand: ",u),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(f){r&&console.error("unable to copy using clipboardData: ",f),r&&console.error("falling back to prompt"),n=$R("message"in t?t.message:FR),window.prompt(n,e)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var zR=VR;const Gw=ka(zR);function qR({currentAccount:e}){const{mutate:t}=Kr.useSwitchAccount(),r=Kr.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i,accountServiceNameObj:s}=qr(),{getServiceNames:o}=Hw(),a=Z.useCallback(()=>{n||o(r),i(!n)},[n,r]);Z.useEffect(()=>()=>{i(!1)},[]);const c=Z.useMemo(()=>r.filter(u=>u.address!==e),[r,e]);Z.useEffect(()=>{},[c]);const l=u=>{t({account:u},{onSuccess:()=>{}})};return w.jsxs("div",{className:"cs-account-switch",children:[w.jsxs("div",{className:"account",onClick:a,children:[w.jsx("span",{children:e&&(s==null?void 0:s[e])||Us(e)}),(c==null?void 0:c.length)>0&&w.jsx("svg",{className:`cs-icon ${n?"open":"close"}`,"aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-unfold"})})]}),w.jsx("div",{className:`account-list ${n?"open":"close"}`,children:c.map(u=>{var f,p,y,x;return w.jsxs("div",{className:"account-item",children:[w.jsxs("div",{className:"left",children:[w.jsxs("div",{className:"label",children:[((f=u==null?void 0:u.label)==null?void 0:f.length)>16?((p=u==null?void 0:u.label)==null?void 0:p.substring(0,6))+"..."+((x=u==null?void 0:u.label)==null?void 0:x.substring(((y=u==null?void 0:u.label)==null?void 0:y.length)-10)):u==null?void 0:u.label," "]}),w.jsx("div",{className:"address",children:(s==null?void 0:s[u==null?void 0:u.address])||Us(u==null?void 0:u.address)})]}),w.jsx("button",{className:"cs-outline-btn",onClick:()=>l(u),children:"Switch"})]},u==null?void 0:u.address)})})]})}const WR=Z.forwardRef(({connect:e,isSimulate:t=!1})=>{const r=Kr.useCurrentAccount();return w.jsx("div",{children:r?w.jsx(HR,{isSimulate:t}):w.jsx(nh,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})});function HR({isSimulate:e}){const{mutate:t}=Kr.useDisconnectWallet(),r=Kr.useCurrentAccount(),{currentWallet:n}=Kr.useCurrentWallet(),{addCommonToast:i}=Bo(),{getExplorerUrl:s}=Do(),{accountServiceNameObj:o}=qr(),a=()=>{r&&(Gw(r.address||"",{debug:!1,message:"message"}),i("Copied"))},c=()=>{r&&window.open(s(r.address,"account"),"_blank")};return Z.useEffect(()=>{},[n]),w.jsxs(Pi.Root,{children:[w.jsx(Pi.Trigger,{children:w.jsxs("div",{className:"cs-connected-button",children:[w.jsx("img",{src:n==null?void 0:n.icon,style:{width:"20px",height:"20px"}}),w.jsx("span",{style:{color:e?"#fff":"var(--cs-text-primary)"},children:(r==null?void 0:r.address)&&(o==null?void 0:o[r==null?void 0:r.address])||Us(r==null?void 0:r.address)})]})}),w.jsx(Pi.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"var(--cs-primary-10)"},side:"bottom",align:"end",children:w.jsxs("div",{className:"account-op-box",children:[w.jsx("span",{style:{fontSize:"14px",color:"var(--cs-text-secondary)",marginBottom:"6px"},children:r==null?void 0:r.label}),w.jsx(qR,{currentAccount:r==null?void 0:r.address}),w.jsxs("div",{className:"account-op-item",onClick:a,style:{marginTop:"12px"},children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-icon_copy"})}),w.jsx("span",{children:"Copy address"})]}),w.jsxs("div",{className:"account-op-item",onClick:c,children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-icon_link"})}),w.jsx("span",{children:"Open explorer"})]}),w.jsxs("div",{className:"account-op-item",onClick:()=>t(),children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-icon_disconnect"})}),w.jsx("span",{children:"Disconnect"})]})]})})]})}function GR({isSimulate:e=!1}){const{fetchServiceNames:t}=Hw(),r=Kr.useCurrentAccount();Kr.useCurrentWallet();const{isOpenWalletModal:n,onWalletModal:i,saveCurrentAccount:s}=qr();return Kr.useWallets(),Z.useEffect(()=>{r!=null&&r.address&&t([r==null?void 0:r.address])},[r==null?void 0:r.address]),w.jsx(w.Fragment,{children:w.jsx(Kr.ConnectModal,{trigger:w.jsx(WR,{connect:i,isSimulate:e}),open:n,onOpenChange:o=>i(o)})})}function KR({independentWallet:e,customWallet:t,logo:r}){return w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"widget-header",children:[w.jsx("img",{src:r,className:"cetus-logo"}),w.jsxs("div",{className:"right",children:[e&&w.jsx(GR,{}),w.jsx(NR,{})]})]}),w.jsx("div",{style:{marginTop:"12px"}})]})}const Kw=()=>{const e=Z.useRef(null);Z.useEffect(()=>{if(e.current){const n=e.current.style;n.setProperty("--size-loader","50px"),n.setProperty("--size-orbe","10px")}},[]);const t=n=>({position:"absolute",width:"100%",height:"100%",animation:`webLoading ease-in-out 1.5s calc(${n} * 0.1s) infinite`,opacity:`calc(1 - calc(0.2 * ${n}))`}),r={position:"absolute",content:"''",top:0,left:0,width:"var(--size-orbe)",height:"var(--size-orbe)",backgroundColor:"var(--cs-primary)",boxShadow:"0px 0px 20px 2px var(--cs-primary)",borderRadius:"50%"};return w.jsx("div",{style:{width:"100%",height:"100%",position:"absolute",zIndex:100},children:w.jsx("div",{ref:e,style:{width:"var(--size-loader)",height:"var(--size-loader)",position:"absolute",top:"50%",left:"50%",marginTop:"-25px",marginLeft:"-25px",transform:"rotate(45deg)"},children:[...Array(5)].map((n,i)=>w.jsx("div",{style:t(i),children:w.jsx("div",{style:r})},i))})})};function YR({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,s=Z.useMemo(()=>{if(n&&r)return n(r)},[r]);return w.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&w.jsx(JR,{info:s,status:r}),(r==="success"||r==="rejected")&&w.jsx(XR,{info:s,status:r,tx:i,onClose:e})]})}function JR({info:e,status:t}){return w.jsxs("div",{className:"progress-dialog",children:[w.jsx("div",{className:"title",children:t==="confirmation"?"Waiting for Confirmation":"Transaction in progress"}),w.jsx("div",{className:"loading-box",children:w.jsx(Kw,{})}),w.jsxs("div",{className:"ts-content",children:[e==null?void 0:e.modalDescriptionText," "]}),w.jsxs("p",{className:"ts-desc",children:[" ",t==="confirmation"?"Confirm this transaction in your wallet.":"Confirmation is in progress."]})]})}function XR({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=Do();return w.jsxs("div",{className:"finally-status-dialog",children:[w.jsxs("div",{className:"center-content",children:[w.jsxs("div",{className:t==="success"?"status-box is-success":"status-box is-error",children:[w.jsx("div",{className:"status-icon-box",children:w.jsx("div",{className:"status-icon",children:w.jsx("svg",{className:"icon","aria-hidden":"true",children:t==="success"?w.jsx("use",{xlinkHref:"#icon-sel"}):w.jsx("use",{xlinkHref:"#icon-caution"})})})}),t==="success"?w.jsx("span",{children:"Swap Success"}):w.jsx("span",{children:"Swap failed"})]}),w.jsx("div",{className:"ts-content",children:e==null?void 0:e.modalDescriptionText}),r&&w.jsxs("div",{className:"view-transaction",children:[w.jsx("span",{children:"View Transaction"}),Kl.map(s=>w.jsx("a",{href:i(r,"tx",s.link),target:"_blank",children:w.jsx("img",{src:s.img})},s.link))]})]}),w.jsx("button",{className:"cs-solid-btn swap-more-btn",onClick:n,children:t==="success"?"Swap More":"Retry"})]})}function ZR(){const{fetchByApi:e}=Yl(),{setProviders:t}=zr();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v2/status","GET"),{providers:i}=n;i&&t(i)}catch{}}}}function QR({interval:e,callback:t}){const r=Z.useRef(),n=Z.useRef(null);Z.useEffect(()=>{r.current=t},[t]);const i=Z.useCallback(()=>{n.current&&clearInterval(n.current),e>0&&(n.current=setInterval(()=>{r.current&&r.current(Date.now())},e))},[e]),s=Z.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return Z.useEffect(()=>(i(),()=>s()),[]),{startTimer:i,stopTimer:s}}const eP=(e,t)=>({coinPriceObj:{},setPriceObj:r=>{const n=t().coinPriceObj;e({coinPriceObj:{...n,...r}})},clearPriceObj:r=>{const n=t().coinPriceObj;r.forEach(i=>{delete n[ur(i).full_address]}),e({coinPriceObj:{...n}})}}),Yw=$i(eP);function tP(e,t){const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}function ec(){const{fetchByApi:e}=Yl(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=Yw(),i=async a=>{const l=tP(a,10);try{const f=(await Promise.all(l.map(p=>e("/v3/sui/market_price","GET",{base_symbol_address:p.map(y=>Di(y,!1))})))).map(p=>p.prices).flat();if(f){const p={};f.forEach(y=>{p[ur(y.base_symbol).full_address]=y}),r(p)}return f}catch{return n(a),null}},s=Z.useCallback(a=>{if(!a)return;const c=t[ur(a).full_address];if(c)return c},[t]),o=Z.useCallback((a,c,l)=>{const u=Number(c)==0||!l?"0":l;if(c&&a&&+c){const f=s(a);if(f)return Me(c).mul(f.price).toString()}return u},[t]);return{fetchTokenPrices:i,getTokenPrice:s,getTokenAmountValue:o}}function rP(){const{tokenBalanceObj:e}=qr(),{fetchTokenPrices:t}=ec(),{isOpenTokensDialog:r}=en(),n=Z.useCallback(()=>{if(OC(e)){const i=Object.keys(e);t(i)}},[e]);return Z.useEffect(()=>{r&&n()},[r]),{getMyAssetsPrice:n}}const nP={id:"0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3",coin_type:"0x2::sui::SUI",decimals:9,description:"",name:"Sui",symbol:"SUI",logo_url:"https://imagedelivery.net/cBNDGgkrsEA-b_ixIp9SkQ/sui-coin.svg/public",is_trusted:!0,extensions:{rank:"880"}},iP={id:"0x69b7a7c3c200439c1b5f3b19d7d495d5966d5f08de66c69276152f8db3992ec6",coin_type:"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",decimals:6,description:"",name:"USDC",symbol:"USDC",logo_url:"https://circle.com/usdc-icon",is_trusted:!0,extensions:{rank:"1000"}},Jw=iP,Xw=nP;function sP(e,t){const{fetchTokenInfo:r}=bs(),{setFromCoin:n,setToCoin:i,setDefaultCoin:s,fromCoin:o,toCoin:a}=en(),{setSlippage:c,setRpcList:l,setCurrentRpc:u}=zr(),{tokenMapIsInit:f}=Lo(),p=Z.useRef({}),y=async(v,C)=>{if(!C&&!v&&(o||a))return;const I=v?await r(v):Jw,O=C?await r(C):Xw;n(I),i(O),s(I==null?void 0:I.coin_type,O==null?void 0:O.coin_type)},x=(v=[],C)=>{let I=[],O=ua[0],j=ua[0];v.forEach(U=>{const D={name:U,link:U,isCustom:!1};I.push(D),U===C&&(j=D)}),C&&v.includes(C)?I=[j,O,...I.filter(U=>U.link!==C)]:I.unshift(ua[0]),l([...I,{name:"Custom RPC URL",link:"",isCustom:!0}]),u(j)};return Z.useEffect(()=>{if(f&&!C0(e,p.current)){const{defaultFromToken:v,defaultToToken:C,defaultSlippage:I,customRpcList:O,defaultRpc:j}=e;y(v,C),I&&c(I),x(O||[],j),p.current=e}},[e,f]),{handleSetDefaultPair:y}}function oP(e){const{currentRpc:t}=zr(),{setSuiClient:r,setAggregatorSDK:n}=gs(),{currentAccount:i}=qr();Z.useEffect(()=>{if(t){const o=new Ls({url:t.link});r(o)}},[t]);const s=()=>{const o={endpoint:yo.aggregatorUrl,signer:(i==null?void 0:i.address)||"",client:new Ls({url:t.link}),env:_0.Mainnet,overlayFeeRate:(e==null?void 0:e.overlayFeeRate)||void 0,overlayFeeReceiver:(e==null?void 0:e.overlayFeeReceiver)||void 0},a=new Nv(o);n(a)};Z.useEffect(()=>{t&&s()},[t.link,i==null?void 0:i.address]),Z.useEffect(()=>{e!=null&&e.overlayFeeRate&&(e!=null&&e.overlayFeeReceiver)&&s()},[e==null?void 0:e.overlayFeeRate,e==null?void 0:e.overlayFeeReceiver])}const ih=$i((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),Tr=[];for(let e=0;e<256;++e)Tr.push((e+256).toString(16).slice(1));function aP(e,t=0){return(Tr[e[t+0]]+Tr[e[t+1]]+Tr[e[t+2]]+Tr[e[t+3]]+"-"+Tr[e[t+4]]+Tr[e[t+5]]+"-"+Tr[e[t+6]]+Tr[e[t+7]]+"-"+Tr[e[t+8]]+Tr[e[t+9]]+"-"+Tr[e[t+10]]+Tr[e[t+11]]+Tr[e[t+12]]+Tr[e[t+13]]+Tr[e[t+14]]+Tr[e[t+15]]).toLowerCase()}let vd;const cP=new Uint8Array(16);function lP(){if(!vd){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");vd=crypto.getRandomValues.bind(crypto)}return vd(cP)}const uP=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),fm={randomUUID:uP};function hm(e,t,r){var i;if(fm.randomUUID&&!t&&!e)return fm.randomUUID();e=e||{};const n=e.random??((i=e.rng)==null?void 0:i.call(e))??lP();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let s=0;s<16;++s)t[r+s]=n[s];return t}return aP(n)}var Ns=(e=>(e[e.CalculateError=1e4]="CalculateError",e[e.NumberTooLarge=10001]="NumberTooLarge",e[e.NoRouter=10002]="NoRouter",e[e.InsufficientLiquidity=10003]="InsufficientLiquidity",e[e.HoneyPot=10004]="HoneyPot",e))(Ns||{});const dP=new Ls({url:w1("mainnet")}),fP=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],hP=["deny_list","DenyList","DenyCap","create_regulated_currency"],pP={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},mP=async e=>{let t=!1;if(fP.includes(e))return t;const r=e.split("::"),n=r[0]&&Lt(r[0]),i=r[1],s=await dP.getObject({id:n,options:pP}),o="disassembled"in s.data.content?s.data.content.disassembled[i]:null;return o&&typeof o=="string"&&new RegExp(hP.join("|"),"i").test(o)&&(t=!0),t},gP=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>Di(i,!1)))==null?void 0:n.join(",")};function bP(){const{fetchByApi:e}=Yl(),t=async s=>{try{const o={...s},a=gP(s==null?void 0:s.coin_type);a&&(o.coin_type=a);const c=await e("/v2/sui/stats_pools","GET",o);if(c!=null&&c.lp_list)return{list:(c==null?void 0:c.lp_list)||[],total:c==null?void 0:c.total}}catch(o){return console.error("getPoolList ~ Error:",o),await r(s)}return{list:[],total:0}},r=async s=>{var o,a,c,l;try{const u=Mt("/data/pools.json"),f=await fetch(u).then(p=>p.json());if((o=f==null?void 0:f.data)!=null&&o.lp_list){const p=(a=f==null?void 0:f.data)==null?void 0:a.lp_list;let y=p;if(s!=null&&s.coin_type){const v=(l=(c=s==null?void 0:s.coin_type)==null?void 0:c.split(","))==null?void 0:l.map(C=>on(C).source_address);y=p==null?void 0:p.filter(C=>{var j,U;const I=on((j=C==null?void 0:C.coin_a)==null?void 0:j.address).source_address,O=on((U=C==null?void 0:C.coin_b)==null?void 0:U.address).source_address;return(v==null?void 0:v.length)>1&&v.includes(I)&&v.includes(O)?!0:!!((v==null?void 0:v.length)===1&&(v.includes(I)||v.includes(O)))})}s!=null&&s.is_vaults&&(y=p==null?void 0:p.filter(v=>v==null?void 0:v.is_vaults)),s!=null&&s.has_farming&&!(s!=null&&s.is_vaults)&&!(s!=null&&s.has_mining)&&!(s!=null&&s.no_incentives)&&(y=p==null?void 0:p.filter(v=>v==null?void 0:v.has_farming));const x=y;return{list:x,total:(x==null?void 0:x.length)||0}}}catch(u){console.error("getLocalJsonPoolList Error:",u)}return{list:[],total:0}},n=s=>kp(s)==="0x2::sui::SUI"?"0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI":kp(s);return{getPoolList:t,getLocalJsonPoolList:r,getLocalJsonPoolAddress:async(s,o)=>{try{const a=n(s),c=n(o),l=await fetch("/data/all-pools.json").then(u=>u.json());if(l)return l[`${a.toLocaleLowerCase()}-${c.toLocaleLowerCase()}`]||l[`${c.toLocaleLowerCase()}-${a.toLocaleLowerCase()}`]}catch(a){console.error("getLocalJsonPoolAddress Error:",a)}return[]}}}function vP(e=!0){const{poolApiMap:t,setPoolApiMap:r}=zr(),{getPoolList:n,getLocalJsonPoolList:i,getLocalJsonPoolAddress:s}=bP();return{getPoolListByCoinType:async(c,l)=>{if(c&&l){const u=[c,l].sort(),f=`${u[0]}_${u[1]}`,p=t[f];if(p)return p;const y={coin_type:`${c},${l}`,display_all_pools:!0,offset:0,limit:100,order_by:"-tvl",no_incentives:!0,has_farming:!0,has_mining:!0};let x=e?await i(y):void 0;(x===void 0||x.list.length===0)&&(x=await n(y));const v=x.list;if(v.length>0)return t[f]=v,r(f,v),v}return[]},getPoolAddressByCoinType:async(c,l)=>{if(c&&l){const u=[c,l].sort(),f=`${u[0]}_${u[1]}`;if(e){const x=await s(c,l);if(!x||x.length===0){const v=t[f];if(v)return v.map(C=>C.poolAddress)}else return x}const p={coin_type:`${c},${l}`,display_all_pools:!0,offset:0,limit:100,order_by:"-tvl",no_incentives:!0,has_farming:!0,has_mining:!0},y=await n(p);if(y){const x=y.list;if(x.length>0)return t[f]=x,r(f,x),x.map(v=>v.poolAddress)}}return[]}}}function yP(e){const{routerData:t}=en();return{priceAcceptRouterData:Z.useMemo(()=>{if(t&&e){if(e.byAmountIn){if(!Me(e.toAmountUi).eq(t.toAmountUi||"0"))return t}else if(!Me(e.fromAmountUi).eq(t.fromAmountUi||"0"))return t;return}},[t,e])}}function Zw(e,t){return{amountLimit:Z.useMemo(()=>{if(t&&t.routerData){const{byAmountIn:n,fromAmountUi:i,toAmountUi:s}=t;return n?Me(s).mul(Me(1).sub(Me(e).div(100))).toString():Me(i).mul(Me(1).add(Me(e).div(100))).toString()}},[e,t])}}function wP(e){const{getTokenInfo:t,fetchTokenInfo:r}=bs();return{formatSwapRouter:Z.useMemo(()=>{if(e&&e.routerData){const i=[],s=e.byAmountIn?e.routerData.amountIn.toString():e.routerData.amountOut.toString(),o=[],a=[];let c=Me(0);if(e.routerData.routes.forEach((u,f)=>{const p={},y=e.byAmountIn?u.amountIn.toString():u.amountOut.toString();f===e.routerData.routes.length-1?p.percentage=Me(1).sub(c).toFixed(2):p.percentage=Me(y).div(s).toFixed(2),c=Me(c).add(p.percentage);const x=[];u.path.forEach(v=>{i.includes(v.provider)||i.push(v.provider);const C=ur(v.from).full_address,I=ur(v.target).full_address,O=t(C),j=t(I);O||a.includes(C)&&a.push(C),j||a.includes(I)&&a.push(I);const U=v.provider===da.SCALLOP||v.provider===da.FLOWX||v.provider===da.FLOWXV3;x.push({from_type:C,to_type:I,pool_address:U?"":v.id,fee_rate:v.feeRate,provider:v.provider})}),p.paths=x,o.push(p)}),a.length>0)for(const u in a)r(u);return{router_summery:`${e.routerData.routes.length} Streams`,providers:i,routers:o}}},[e])}}function xP(){const{fromCoin:e,toCoin:t}=en(),{getPoolAddressByCoinType:r}=vP(!0);return{getSwapPoolAddress:async()=>e&&t?await r(e.coin_type,t.coin_type):[]}}function Qw(e,t,r){return Z.useMemo(()=>t&&r&&+t&&+r?e?Me(r).div(t).toString():Me(t).div(r).toString():"0",[t,r,e])}function pm(e){const[t,r]=Z.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await mP(i.coin_type)}catch{}return!1};return Z.useEffect(()=>{r(void 0),e&&n(e).then(i=>{r(i)})},[e==null?void 0:e.coin_type]),{isScamsCoin:t}}function SP(e,t){const{defaultFromCoinType:r,defaultToCoinCoinType:n}=en(),{getTokenInfo:i}=bs(),{ignoreWarnTokenMap:s}=zr(),o=i(e),a=i(t),c=Z.useMemo(()=>!oc(r,Jw.coin_type)||!oc(n,Xw.coin_type),[r,n]),l=Z.useCallback(f=>f&&!s[Di(f.coin_type)]&&(oc(r,f.coin_type)||oc(n,f.coin_type))?!f.is_trusted:!1,[r,n,s]),u=Z.useMemo(()=>{const f=[];return c&&(o&&l(o)&&f.push({...o}),a&&l(a)&&f.push({...a})),f},[o==null?void 0:o.coin_type,a==null?void 0:a.coin_type,c,s]);return{isCustomMode:c,customWarnTokenList:u}}function _P(){const{aggregatorSDK:e}=gs(),{getSwapPoolAddress:t}=xP(),r=s=>s&&s.error?s.error.code===Ns.InsufficientLiquidity||Ns.HoneyPot||Ns.NumberTooLarge:!1,n=async s=>{const{fromToken:o,toToken:a,amount:c,providersKeys:l,by_amount_in:u,uuid:f}=s;try{const p={from:o.coin_type,target:a.coin_type,amount:new $h(c),byAmountIn:u,depth:3,splitAlgorithm:void 0,splitFactor:void 0,splitCount:void 0,providers:l},y=await e.findRouters(p);if(y&&r(y))return i(!1,u,f,o,a,y);if(!y||y.routes.length===0)throw Error("not find router");return i(!1,u,f,o,a,y)}catch{const y=await t(),x={from:o.coin_type,target:a.coin_type,amount:new $h(c),byAmountIn:u,pools:y};try{const v=await e.swapInPools(x);return!v||!v.routeData?i(!0,u,f,o,a):i(!0,u,f,o,a,v.routeData)}catch{return{uuid:f,byAmountIn:u,isDegrade:!0}}}},i=(s,o,a,c,l,u)=>{var f;if(u){const p=u.error!==void 0,y=cf(u.amountIn.toString(),c.decimals).toString(),x=cf(u.amountOut.toString(),l.decimals).toString();return{routerData:p?void 0:u,fromAmountUi:p?o?y:"":y,toAmountUi:p&&o?"":x,uuid:a,byAmountIn:o,isDegrade:s,errorCode:(f=u.error)==null?void 0:f.code}}else return{uuid:a,byAmountIn:o,isDegrade:s}};return{findBestRouters:n}}function oo(e){const t=Z.useRef(e);return Z.useEffect(()=>{t.current=e},[e]),t}function EP(e){try{return e&&e.toString().includes("Rejected from user")}catch{return!1}}function CP(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function TP(e){return!!String(e).includes("Could not find the referenced transaction")}function MP(e){return!!String(e).includes("Max cap reached.")}function AP(e){return!!String(e).includes("Fast Mode service error")}function IP(e){return EP(e)?"User rejected the request":CP(e)?"Exceeded price slippage":TP(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":MP(e)?"Max cap reached. This is to prevent your txn from overpaying. You can choose to edit your gas max cap in settings if needed.":AP(e)?"Fast Mode service error, please switch to the Default Transaction Mode or try again later.":"Transaction failed"}var sh={},OP=Ar&&Ar.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(sh,"__esModule",{value:!0});var RP=sh.executeAuction=e6;const PP=OP(hb),jP="https://rpc.getshio.com",NP=500,kP=300;function e6(e,t,r=NP){const n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise((i,s)=>{setTimeout(i,r),PP.default.post(jP,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(o=>{setTimeout(i,kP)}).catch(s)})}sh.default={executeAuction:e6};const DP="0x2::sui::SUI",LP="https://rpc.getshio.com/fast",BP="0x1889977f0fb56ae730e7bda8e8e32859ce78874458c74910d36121a81a615123",mm=[{objectId:"0xc32ce42eac951759666cbc993646b72387ec2708a2917c2c6fb7d21f00108c18",version:72869622},{objectId:"0x0289acae0edcdf1fe3aedc2e886bc23064d41c359e0179a18152a64d1c1c2b3e",version:327637282},{objectId:"0x03132160e8c2c45208abf3ccf165e82edcc42fee2e614afe54582f9740a808b8",version:327637282},{objectId:"0x072ae7307459e535379f422995a0d10132f12a3450298f8cf0cc07bd164f9999",version:327637282},{objectId:"0x1c1a96a2f4a34ea09ab15b8ff98f4b6b4338ce89f4158eb7d3eb2cd4dcbd6d86",version:327637282},{objectId:"0x20d76f37ad9f2421a9e6afaf3bb204250b1c2241c50e8a955e86a1a48767d06f",version:327637282},{objectId:"0x213ed368233cc7480fcb6336e70c5ae7ee106b2317ba02ccb5d0478e45bcc046",version:327637282},{objectId:"0x22ce1e80937354eba5549fed2937dc6e2b24026d03505bb51a3e4a64aa4142f6",version:327637282},{objectId:"0x26188cb7ce5ae633279f440f66081cb65cc585e428de18e194f8843e866f799f",version:327637282},{objectId:"0x38642f01422480128388d3e2948d3dc1b2680f9914077edb6bd3451ae1c5bcf0",version:327637282},{objectId:"0x3dd85b6424aea1cae9eff6e55456ca783e056226325f1362106eca8b3ed04ca0",version:327637282},{objectId:"0x42f8adc490542369d9c3b95e9f6eb70b2583102900feb7e103072ed49ba7fc3d",version:327637282},{objectId:"0x46b8158c82fa6bda7230d31a127d934c7295a0042083b4900f3096e9191f6f3f",version:327637282},{objectId:"0x6ebac88a8c3f7a4a9fb05ea49d188a1fe8520ae59ee736e0473004d3033512a4",version:327637282},{objectId:"0x6f55ad6cb40cfc124c11b11c19be0a80237b104acd955e7b52ccb7bf9046fe33",version:327637282},{objectId:"0x71aafb8bac986e82e5f78846bf3b36c2a82505585625207324140227a27ff279",version:327637282},{objectId:"0x7fe9b08680d4179de5672f213b863525b21f10604ca161538075e9338d1d2324",version:327637282},{objectId:"0x81538ef2909a3e0dd3d7f38bcbee191509bae4e8666272938ced295672e2ee8d",version:327637282},{objectId:"0x828eb6b3354ad68a23dd792313a16a0d888b7ea4fdb884bb22bd569f8e61319e",version:327637282},{objectId:"0x9705a332b8c1650dd7fe687ef9f9a9638afb51c30c0b34db150d60b920bc07eb",version:327637282},{objectId:"0x9918f73797a9390e9888b55454f2b31bc01de1a4634acab08f80641c4248e8a5",version:327637282},{objectId:"0x9cd4c08bdf2e132ec2cc77b0f03be60a94951e046d8e82ed5494f44e609edd2f",version:327637282},{objectId:"0xac8ce2033571140509788337c8a1f3aa8941a320ecd7047acda310d39cad9e03",version:327637282},{objectId:"0xbcd4527035265461a9a7b4f1e57c63ea7a6bdf0dc223c66033c218d880f928b1",version:327637282},{objectId:"0xbfdb691b8cc0b3c3a3b7a654f6682f3e53b164d9ee00b9582cdb4d0a353440a9",version:327637282},{objectId:"0xc2559d5c52ae04837ddf943a8c2cd53a5a0b512cee615d30d3abe25aa339465e",version:327637282},{objectId:"0xc56db634d02511e66d7ca1254312b71c60d64dc44bf67ea46b922c52d8aebba6",version:327637282},{objectId:"0xc84545cbff1b36b874ab2b69d11a3d108f23562e87550588c0bda335b27101e0",version:327637282},{objectId:"0xcc141659b5885043f9bfcfe470064819ab9ac667953bcedd1000e0652e90ee76",version:327637282},{objectId:"0xef6bf4952968d25d3e79f7e4db1dc38f2e9d99d61ad38f3829acb4100fe6383a",version:327637282},{objectId:"0xf2ed8d00ef829de5c4a3c5adf2d6b0f41f7fec005fb9c88e5616b98173b2fd66",version:327637282},{objectId:"0xfce73f3c32c3f56ddb924a04cabd44dd870b72954bbe7c3d7767c3b8c25c4326",version:327637282}];async function UP(e){const t=e.client,r=await e.transaction.build({client:t,onlyTransactionKind:!0});let n=e.sender??e.transaction.getData().sender;if(!n)throw new Error("Sender need to be either set in options or in transaction data");return await t.call("shio_estimateFastModeFee",[n,e.transaction.getData().gasData.price,Kc.from(r).toString("base64")])}function FP(){return mm[Math.floor(Math.random()*mm.length)]}async function $P(e,t,r){return await e.executeTransactionBlock({transactionBlock:t.bytes,signature:t.signature,options:r})}async function VP(e,t,r){let n=e.moveCall({package:"0x2",module:"coin",function:"into_balance",typeArguments:[DP],arguments:[t]});return zP(e,n,r)}async function zP(e,t,r){let n=FP();e.moveCall({package:BP,module:"auctioneer",function:"submit_bid",arguments:[e.sharedObjectRef({objectId:n.objectId,mutable:!0,initialSharedVersion:n.version}),e.pure.u64(r),t]})}const yf="CoinWithBalance",qP=Ie({type:xt(),balance:Sl()});async function WP(e,t,r){var l,u;const n=new Set,i=new Map;if(!e.sender)throw new Error("Sender must be set to resolve CoinWithBalance");for(const f of e.commands)if(f.$kind==="$Intent"&&f.$Intent.name===yf){const{type:p,balance:y}=or(qP,f.$Intent.data);p!=="gas"&&y>0n&&n.add(p),i.set(p,(i.get(p)??0n)+y)}const s=new Set;for(const f of e.inputs)(l=f.Object)!=null&&l.ImmOrOwnedObject&&s.add(f.Object.ImmOrOwnedObject.objectId),(u=f.UnresolvedObject)!=null&&u.objectId&&s.add(f.UnresolvedObject.objectId);const o=new Map,a=t.client;await Promise.all([...n].map(async f=>{o.set(f,await HP({coinType:f,balance:i.get(f),client:a,owner:e.sender,usedIds:s}))}));const c=new Map;c.set("gas",{$kind:"GasCoin",GasCoin:!0});for(const[f,p]of e.commands.entries()){if(p.$kind!=="$Intent"||p.$Intent.name!==yf)continue;const{type:y,balance:x}=p.$Intent.data;if(x===0n&&y!=="gas"){e.replaceCommand(f,Xn.MoveCall({target:"0x2::coin::zero",typeArguments:[y]}));continue}const v=[];if(!c.has(y)){const[C,...I]=o.get(y).map(O=>e.addInput("object",Rn.ObjectRef({objectId:O.coinObjectId,digest:O.digest,version:O.version})));I.length>0&&v.push(Xn.MergeCoins(C,I)),c.set(y,C)}v.push(Xn.SplitCoins(c.get(y),[e.addInput("pure",Rn.Pure(dv.bcs.u64().serialize(x)))])),e.replaceCommand(f,v),e.mapArguments(C=>C.$kind==="Result"&&C.Result===f?{$kind:"NestedResult",NestedResult:[f+v.length-1,0]}:C)}return r()}async function HP({coinType:e,balance:t,client:r,owner:n,usedIds:i}){let s=t;const o=[];return a();async function a(c=null){const{data:l,hasNextPage:u,nextCursor:f}=await r.getCoins({owner:n,coinType:e,cursor:c}),p=l.sort((y,x)=>Number(BigInt(x.balance)-BigInt(y.balance)));for(const y of p){if(i.has(y.coinObjectId))continue;const x=BigInt(y.balance);if(o.push(y),s-=x,s<=0)return o}if(u)return a(f);throw new Error(`Not enough coins of type ${e} to satisfy requested balance`)}}function t6(){const{suiClient:e}=gs(),{currentAccount:t}=qr(),{mutateAsync:r}=Kr.useSignTransaction(),{mutate:n}=Kr.useSignAndExecuteTransaction({execute:async({bytes:c,signature:l})=>await s(c,l)}),i=Z.useMemo(()=>"sui:mainnet",[t]),s=async(c,l,u=!1)=>{var p,y;if(u){const x=await e.devInspectTransactionBlock({transactionBlock:rs.from(_r(c)),sender:t.address});if(!x||((p=x.effects)==null?void 0:p.status.status)==="failure")throw Error((y=x.effects)==null?void 0:y.status.error)}return await e.executeTransactionBlock({transactionBlock:c,signature:l,options:{showEvents:!0,showRawEffects:!0,showEffects:!0,showBalanceChanges:!0,showObjectChanges:!0,showInput:!0}})};return{signAndExecuteTransactionBlock:async(c,l=!1)=>{var f,p;let u;if(typeof c=="string"?u=rs.from(c):u=c,l){const y=await e.devInspectTransactionBlock({transactionBlock:c,sender:t.address});if(!y||((f=y.effects)==null?void 0:f.status.status)==="failure")throw Error((p=y.effects)==null?void 0:p.status.error)}return u.setGasBudget(1e8),new Promise((y,x)=>{n({transaction:u,chain:i},{onSuccess:v=>{y(v)},onError:v=>{console.error("signAndExecuteTransactionBlock transaction failed",v),x(v)}})})},signTransactionBlock:async c=>(c instanceof Uint8Array&&(c=rs.from(c)),typeof c=="string"&&(c=rs.from(_r(c))),new Promise((l,u)=>{r({transaction:c,chain:i},{onSuccess:f=>{l(f)},onError:f=>{console.error("signTransactionBlock failed",f),u(f)},onSettled:(f,p,y,x)=>{console.error("signTransactionBlock onSettled",{data:f,error:p,variables:y})}})})),executeTransactionBlock:s}}function GP(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=t6(),{currentAccount:n}=qr();return{getFastModeTx:async(s,o,a)=>{let c,l,u;try{const f=new Ls({url:LP});s.setSender(n==null?void 0:n.address),s.setGasPrice(Number(a));const p=rs.from(s);p.addIntentResolver(yf,WP);const y=await UP({transaction:p,client:f}),x=Me(o).mul(Math.pow(10,9)).toString();if(Me(y.gasBudget).gt(x))throw Error("Max cap reached. This is to prevent your txn from overpaying. You can choose to edit your gas max cap in settings if needed.");s.setGasBudget(y.gasBudget);const v=s.splitCoins(s.gas,[y.tipAmount]);VP(s,v[0],y.tipAmount);const C=await s.build({client:f}),I=await e(C),{bytes:O,signature:j}=I;u=O,l=new Date().getTime(),c=await $P(f,I,{showEffects:!0,showEvents:!0})}catch(f){throw String(f).includes("Failed to fetch")?Error("Fast Mode service error"):f}return{result:c,startExecuteTime:l,transactionBlockBytes:u}}}}function KP(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=t6(),{currentAccount:n}=qr(),{suiClient:i}=gs(),{setTransactionData:s}=ih(),{addTxToast:o,removeToast:a}=Bo(),{getFastModeTx:c}=GP(),l=5,u=2e3;async function f(x,v=1){try{let C;try{C=await i.getTransactionBlock({digest:x,options:{showEvents:!0,showEffects:!0,showBalanceChanges:!0,showInput:!0,showRawInput:!0,showObjectChanges:!0}})}catch{C=await i.getTransactionBlock({digest:x,options:{showEvents:!0,showEffects:!0}})}if(C)return C;throw new Error("Empty response")}catch(C){if(console.error(`Attempt ${v} failed:`,C),v>=l)throw new Error("Failed to fetch transaction status after maximum retries.");return await jp(u),f(x,v+1)}}const p=async(x,v,C={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock",useFastMode:!1,maxCapForGas:"",customGasPrice:""})=>{var re,ae,ne;const{useDevInspect:I=!1,useMev:O,txAction:j="signTransactionBlock",useFastMode:U=!1,maxCapForGas:D="",customGasPrice:H=""}=C;let q;v.status="confirmation",s(v);let G="";try{let V,N,h;typeof x=="function"?h=await x():h=x,h.setSender(n.address);let d;if(U&&D&&H){const S=await c(h,D,H);V=S.result,d=S.startExecuteTime,N=S.transactionBlockBytes}else if(j==="signTransactionBlock"){const S=await e(h),{bytes:E,signature:M}=S;if(O)try{const P=await RP(E,M,500)}catch{}V=await t(E,M,I)}else V=await r(h,I);v.status="submitted",s({...v}),v.tx=V.digest,q=o(v),await jp(u),G=V==null?void 0:V.digest;let m;if(((re=V==null?void 0:V.effects)==null?void 0:re.status.status)==="success"?m=V:m=await f(G,0),!m||((ae=m.effects)==null?void 0:ae.status.status)==="failure")y(v,(ne=m.effects)==null?void 0:ne.status.error);else{const S=IC(m,n==null?void 0:n.address,!1);if(v.buildShowInfo){const E=v.buildShowInfo("success",S);v.buildShowInfo=M=>E}a(q),v.status="success",s({...v})}return m}catch(V){y(v,V)}},y=(x,v)=>{const C=IP(v);if(x.buildShowInfo){const I=x.buildShowInfo("confirmation");x.buildShowInfo=O=>(I.toastDescriptionContent=C,I.modalDescriptionText=C,I),x.status="rejected",s({...x})}else x.buildShowInfo=I=>{const O={};return O.toastDescriptionContent=C,O.modalDescriptionText=C,O},x.status="rejected",s({...x})};return{signAndExecuteTransaction:p}}function oh(e,t=1e3){const r=Z.useRef(),n=Z.useCallback((...i)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...i)},t)},[e,t]);return Z.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),n}function YP(){const{aggregatorSDK:e}=gs(),{findBestRouters:t}=_P(),{getTokenAmountValue:r,fetchTokenPrices:n}=ec(),{providers:i,slippage:s,mevProtect:o,maxCapForGas:a,transactionMode:c,customGasPrice:l}=zr(),{signAndExecuteTransaction:u}=KP(),{setTransactionData:f}=ih(),{addTxToast:p}=Bo(),{fromCoin:y,toCoin:x,setFromCoin:v,setToCoin:C,setToAmount:I,fromAmount:O,toAmount:j,setFromAmount:U,setFindRouterLoading:D,setRouterData:H,setByAmountIn:q,byAmountIn:G}=en(),[re,ae]=Z.useState(""),ne=oo(re),V=oo(G),N=oo(O),h=oo(j),d=oo(y),m=oo(x),{balanceInfo:S,getOwnerCoinBalances:E}=Sa(y),{balanceInfo:M}=Sa(x),P=r(y==null?void 0:y.coin_type,O),A=r(x==null?void 0:x.coin_type,j),b=oh(async(Oe,Xe,Ne)=>{if(d.current&&m.current&&+Oe){(+N.current||+h.current)&&D(!0);const pt=TC(Oe,Xe?d.current.decimals:m.current.decimals),be=await t({fromToken:d.current,toToken:m.current,amount:pt.toString(),providersKeys:i,by_amount_in:Xe,uuid:Ne});D(!1),ne.current===Ne&&(Xe?+N.current?(I(be.toAmountUi||""),H(be)):I(""):+h.current?(U(be.fromAmountUi||"ß"),H(be)):U(""))}else te(!Xe)},500),B=(Oe,Xe,Ne=!1)=>{if(q(Xe),Xe?(U(Oe),Ne&&I("")):(I(Oe),Ne&&U("")),+Oe){const pt=hm();ae(pt),b(Oe,Xe,pt)}else D(!1),H(void 0),te(!Xe)},se=(Oe,Xe=!0)=>{te(),Xe?((Oe==null?void 0:Oe.coin_type)===(x==null?void 0:x.coin_type)&&C(y),v(Oe)):((Oe==null?void 0:Oe.coin_type)===(y==null?void 0:y.coin_type)&&v(x),C(Oe))},te=Oe=>{Oe===void 0?(U(""),I("")):Oe?U(""):I(""),D(!1),H(void 0)},le=()=>{const Oe=V.current?N.current:h.current;if(+Oe){const Xe=hm();ae(Xe),b(Oe,V.current,Xe)}},xe=async(Oe,Xe)=>{const{routerData:Ne,byAmountIn:pt,fromAmountUi:be,toAmountUi:he}=Oe,Ce=new rs,qe={routers:Ne,slippage:Number(s)/100,txb:Ce,partner:Xe||LC};try{const Be={status:"confirmation",buildShowInfo:(Fe,ft)=>{const mt=`Swap ${Dr(be,y==null?void 0:y.decimals)} ${y==null?void 0:y.symbol} for ${Dr(he,x==null?void 0:x.decimals)} ${x==null?void 0:x.symbol}`,$e={modalDescriptionText:mt,toastTitleText:mt};if(Fe==="success"){let At=be,wt=he;ft&&(At=Np(ft,y)||be,wt=Np(ft,x)||he);const Ke=`Swapped ${Dr(At,y==null?void 0:y.decimals)} ${y==null?void 0:y.symbol} for ${Dr(wt,x==null?void 0:x.decimals)} ${x==null?void 0:x.symbol}`;$e.toastTitleText=Ke,$e.modalDescriptionText=Ke}return $e},id:0};f(Be),await u(async()=>(await e.fastRouterSwap(qe),Ce),Be,{useMev:o,useFastMode:c==="Fast Mode",maxCapForGas:a,customGasPrice:l})?(te(),E()):le()}catch(Be){String(Be).includes("TypeError: Failed to fetch")&&p({id:0,status:"rejected",buildShowInfo(Ae,Re){return{toastTitleText:"RPC loading failed",toastDescriptionContent:"Try resubmission. Or to check your network and switch an RPC in settings to try again."}}})}};Z.useEffect(()=>{Se(),te()},[y==null?void 0:y.coin_type,x==null?void 0:x.coin_type]);const Se=()=>{const Oe=[];y&&Oe.push(y.coin_type),x&&Oe.push(x.coin_type),Oe.length>0&&n(Oe)},{isScamsCoin:Ee}=pm(y),{isScamsCoin:Ye}=pm(x),De=Z.useMemo(()=>{if(!(!Ee&&!Ye)){if(Ee&&Ye)return`${y==null?void 0:y.symbol} and ${x==null?void 0:x.symbol} are`;if(Ee)return`${y==null?void 0:y.symbol} token is `;if(Ye)return`${x==null?void 0:x.symbol} token is `}},[Ee,Ye]);return{handleAmountChange:B,handleSelectToken:se,fromBalanceInfo:S,toBalanceInfo:M,fromAmountValue:P,toAmountValue:A,doSwapAction:xe,reCalculateRouteData:le,refreshMarketPrice:Se,scamsText:De}}function JP(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:s}=en(),{currentAccount:o}=qr(),a=Z.useMemo(()=>{const c={text:"Swap",disabled:!1};if(!(o!=null&&o.address))return c.text="Connect Wallet",c.disabled=!1,c;if(!t||!r)return c.text="Select a token",c.disabled=!0,c;if(!+n&&!+i)return c.text="Enter an amount",c.disabled=!0,c;if(s&&s.errorCode){if(s.errorCode===Ns.InsufficientLiquidity)return c.text="Insufficient liquidity for this trade",c.disabled=!0,c;if(s.errorCode===Ns.NoRouter||s.errorCode===Ns.HoneyPot)return c.text="No Available Route",c.disabled=!0,c}return+n&&Me(n).gt(e||0)?(c.disabled=!0,c.text=`Insufficient ${yn(t==null?void 0:t.symbol)} Balance`,c):((!+n||!+i)&&(c.disabled=!0),c)},[o==null?void 0:o.address,n,i,e,s==null?void 0:s.errorCode,t,r]);return{btnText:a.text,btnDisabled:a.disabled}}function XP({themeType:e}){const t=e=="Light"?Mt("/images/logo_light@2x.png"):Mt("/images/logo@2x.png");return w.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",marginTop:"16px"},children:[w.jsx("span",{style:{fontSize:"12px",color:"var(--cs-text-primary)",fontWeight:"500",marginRight:"8px"},children:"Powered by"}),w.jsx("img",{style:{height:"20px"},src:t})]})}function ah({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i,fontSize:s="14px"}){const[o,a]=Z.useState(!0),c=Qw(o,r,n);return w.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{a(!o)},children:[w.jsx(Pr,{src:o?e==null?void 0:e.logo_url:t==null?void 0:t.logo_url,token:o?e:t,showWarnSize:"10px"}),w.jsxs("span",{style:{display:"flex",alignItems:"center",color:"var(--cs-text-primary)",fontSize:s,maxWidth:"80%"},children:["1"," ",yn(o?e==null?void 0:e.symbol:t==null?void 0:t.symbol)," ","="," ",i?w.jsx($o,{className:"custom-skeleton",style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):Dr(c,t==null?void 0:t.decimals)," ",yn(o?t==null?void 0:t.symbol:e==null?void 0:e.symbol)]}),w.jsx(Pr,{src:o?t==null?void 0:t.logo_url:e==null?void 0:e.logo_url,token:o?t:e,showWarnSize:"8px"}),w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-swap"})})]})}function pu(){const[e,t]=Z.useState(window.innerWidth),r=oh(()=>{t(window.innerWidth)},300);Z.useEffect(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[]);const n=Z.useMemo(()=>e<810,[e]);return{windowWidth:e,isApp:n}}function r6(e,t,r,n){const{getTokenPrice:i}=ec(),s=i(e==null?void 0:e.coin_type),o=i(t==null?void 0:t.coin_type),a=Qw(!0,r,n),c=Z.useMemo(()=>{if(o&&s)return Me(s.price).div(o.price).toString()},[s==null?void 0:s.price,o==null?void 0:o.price]),l=Z.useMemo(()=>{if(c&&+a)return Me(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),u=Z.useMemo(()=>{const v=[];return s&&v.push(s.market),o&&!v.includes(o.market)&&v.push(o.market),v},[s==null?void 0:s.market,o==null?void 0:o.market]),f=Z.useMemo(()=>!s||!o||s.market==="cetus"||o.market==="cetus",[s,o]),p=Z.useMemo(()=>f?!1:l&&Me(l).lt(0)?Me(l).abs().gt(5):!1,[l,f]),y=Z.useMemo(()=>f?!1:l&&Me(l).lt(0)?Me(l).abs().gt(10):!1,[l,f]),x=Z.useMemo(()=>{let v,C="yellow";if(f)return{priceImpactText:void 0,textColor:"yellow"};if(l)if(Me(l).gt(0))C="green",Me(l).lt(.1)?v="< 0.1% cheaper than":v=`${Dr(l,2,!0,Vr.ROUND_UP)}% cheaper than`;else if(Me(l).eq(0))v="0%",C="green";else{const I=Me(l).abs();I.lte(5)?(C="green",v=`Within ${Dr(I.toString(),2,!0,Vr.ROUND_UP)}%`):I.lte(10)?(C="yellow",v=`${Dr(I.toString(),2,!0,Vr.ROUND_UP)}% more than`):I.lte(100)?(C="red",v=`${Dr(I.toString(),2,!0,Vr.ROUND_UP)}% more than`):(C="red",v="> 100% more than")}return{priceImpactText:v,textColor:C}},[l,f]);return{swapPrice:a,marketPrice:c,priceImpact:l,sources:u,showPriceImpactTips:p,showPriceImpactWarn:y,priceImpactTextInfo:x,showIncalculable:f}}function n6({content:e,children:t,position:r,autoSwitchTooltip:n=!1,borderRadius:i="8px"}){const{isApp:s}=pu();return s&&n?w.jsxs(Pi.Root,{children:[w.jsx(Pi.Trigger,{children:w.jsx("button",{style:{background:"none",border:"none",padding:"0",margin:"0",outline:"none",boxShadow:"none",color:"inherit",font:"inherit",textAlign:"inherit"},children:t})}),w.jsx(Pi.Content,{variant:"soft",style:{transition:"opacity 0.3s ease",display:"block",zIndex:9e3,padding:"8px 12px",backgroundColor:"var(--cs-bg-primary)",color:"var(--cs-text-secondary)",borderRadius:i,fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)"},side:r,align:"center",children:e})]}):w.jsx($s,{content:e,position:r,borderRadius:i,children:t})}function i6({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=en();pu();const{priceImpact:a,sources:c,marketPrice:l,priceImpactTextInfo:u,showIncalculable:f}=r6(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi);return w.jsxs(w.Fragment,{children:[!r&&Me(a).lte(-30)&&!f&&w.jsx("div",{className:"price-impact-tips red",children:"High price difference. Be cautious before submitting your order."}),w.jsxs("div",{className:"price-impact-block",children:[w.jsxs("div",{className:"left",children:[w.jsx("span",{style:{color:"var(--cs-text-secondary)"},children:"Price Difference"}),w.jsx(n6,{autoSwitchTooltip:!0,position:"top",content:w.jsx(ZP,{fromToken:n,toToken:i,sources:c,baseAmount:"1",quoteAmount:l,showIncalculable:f}),children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:w.jsx("use",{xlinkHref:"#icon-tips"})})})]}),w.jsxs("div",{children:[e&&w.jsx($o,{className:"custom-skeleton",style:{width:"80px",height:"20px"}}),!e&&w.jsxs("div",{className:"right",children:[w.jsx("span",{className:u==null?void 0:u.textColor,children:u.priceImpactText&&!f?u==null?void 0:u.priceImpactText:"Incalculable"}),u.priceImpactText&&!f&&w.jsx("div",{className:"platforms",children:c.map(p=>w.jsx($s,{content:w.jsx("span",{style:{fontSize:"12px",color:"var(--cs-text-primary)"},children:r2[p]}),position:"top",delay:300,children:w.jsx(Pr,{src:VC[p],haveBorder:!1,style:{width:"16px",height:"16px"}})},p))})]})]})]})]})}function ZP({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i,showIncalculable:s}){const{isApp:o}=pu();return w.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[w.jsx("p",{style:{color:"var(--cs-text-secondary)",fontSize:"12px",lineHeight:"18px",width:o?"200px":"300px",textAlign:"start",whiteSpace:"normal"},children:"The difference between the market price and estimated price due to trade size."}),!s&&w.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[w.jsx("p",{style:{fontSize:"12px",color:"var(--cs-text-primary)"},children:"Market price sources:"}),r&&n?w.jsx(ah,{baseToken:e,quoteToken:t,baseAmount:"1",quoteAmount:n,loading:!1,fontSize:"12px"}):w.jsx("p",{style:{color:"var(--cs-text-primary)",fontSize:"12px"},children:"Price is unknown"})]}),!s&&w.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[w.jsx("p",{style:{color:"var(--cs-text-secondary)",fontSize:"12px",whiteSpace:"pre"},children:"Market price sources:"}),w.jsx("p",{style:{color:"var(--cs-text-secondary)",fontSize:"12px",whiteSpace:"pre"},children:i.map(a=>r2[a]+" ").join("")})]})]})}function s6({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:s,byAmountIn:o}=en();return w.jsxs("div",{className:"swap-info-between",style:{paddingLeft:t,paddingRight:e},children:[w.jsx("div",{className:"left",children:o?"Minimum Received":"Maximum Sold"}),n?w.jsx($o,{className:"custom-skeleton",style:{height:"18px",width:"80px"}}):w.jsxs("div",{className:"right",children:[Dr(r,o?s==null?void 0:s.decimals:i==null?void 0:i.decimals,!1,Vr.ROUND_DOWN)," ",yn(o?(s==null?void 0:s.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function QP({scamsText:e}){return w.jsxs("div",{style:{marginTop:"16px",borderRadius:"8px",border:"1px solid var(--cs-border)",paddingTop:"12px",width:"100%",backgroundColor:"var(--cs-bg-secondary-common)"},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"0 12px",justifyContent:"center",textAlign:"center"},children:[w.jsx("svg",{className:"cs-icon",style:{width:"20px",height:"20px",fill:"var(--cs-warning)"},"aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-alert"})}),w.jsx("span",{style:{color:"var(--cs-warning)",marginLeft:"4px"},children:"Alert"})]}),w.jsx("div",{style:{borderRadius:"8px",padding:"11px",margin:"-1px",marginTop:"14px",border:"1px solid var(--cs-border)",lineHeight:"1"},children:w.jsx(i2,{text:`${e} detected to have Deny List feature. It's an optional feature on Sui designed for regulated coins (learn more). However, it could be misused by HoneyPot scams, which may restrict users from selling the tokens after buying. Please be cautious.`,keywords:["learn more"],onKeywordClick:t=>{window.open("https://docs.sui.io/guides/developer/coin/regulated","_blank")}})})]})}function ej({onClick:e}){return w.jsxs("div",{className:"cs-icon-button cs-back-button",onClick:t=>{t.stopPropagation(),e()},children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-back"})}),w.jsx("span",{children:"Back"})]})}function ch({title:e,backClick:t}){return w.jsxs("div",{className:"cs-have-back-header",children:[w.jsx(ej,{onClick:t}),w.jsx("span",{className:"title",children:e})]})}const bc=globalThis||void 0||self;var tj=typeof bc=="object"&&bc&&bc.Object===Object&&bc;const o6=tj;var rj=typeof self=="object"&&self&&self.Object===Object&&self,nj=o6||rj||Function("return this")();const fi=nj;var ij=fi.Symbol;const li=ij;var a6=Object.prototype,sj=a6.hasOwnProperty,oj=a6.toString,Qo=li?li.toStringTag:void 0;function aj(e){var t=sj.call(e,Qo),r=e[Qo];try{e[Qo]=void 0;var n=!0}catch{}var i=oj.call(e);return n&&(t?e[Qo]=r:delete e[Qo]),i}var cj=Object.prototype,lj=cj.toString;function uj(e){return lj.call(e)}var dj="[object Null]",fj="[object Undefined]",gm=li?li.toStringTag:void 0;function Vo(e){return e==null?e===void 0?fj:dj:gm&&gm in Object(e)?aj(e):uj(e)}function hs(e){return e!=null&&typeof e=="object"}var hj="[object Symbol]";function Ia(e){return typeof e=="symbol"||hs(e)&&Vo(e)==hj}function Lc(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var pj=Array.isArray;const Qr=pj;var mj=1/0,bm=li?li.prototype:void 0,vm=bm?bm.toString:void 0;function c6(e){if(typeof e=="string")return e;if(Qr(e))return Lc(e,c6)+"";if(Ia(e))return vm?vm.call(e):"";var t=e+"";return t=="0"&&1/e==-mj?"-0":t}function zo(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function l6(e){return e}var gj="[object AsyncFunction]",bj="[object Function]",vj="[object GeneratorFunction]",yj="[object Proxy]";function u6(e){if(!zo(e))return!1;var t=Vo(e);return t==bj||t==vj||t==gj||t==yj}var wj=fi["__core-js_shared__"];const yd=wj;var ym=function(){var e=/[^.]+$/.exec(yd&&yd.keys&&yd.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function xj(e){return!!ym&&ym in e}var Sj=Function.prototype,_j=Sj.toString;function Xs(e){if(e!=null){try{return _j.call(e)}catch{}try{return e+""}catch{}}return""}var Ej=/[\\^$.*+?()[\]{}|]/g,Cj=/^\[object .+?Constructor\]$/,Tj=Function.prototype,Mj=Object.prototype,Aj=Tj.toString,Ij=Mj.hasOwnProperty,Oj=RegExp("^"+Aj.call(Ij).replace(Ej,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Rj(e){if(!zo(e)||xj(e))return!1;var t=u6(e)?Oj:Cj;return t.test(Xs(e))}function Pj(e,t){return e==null?void 0:e[t]}function Zs(e,t){var r=Pj(e,t);return Rj(r)?r:void 0}var jj=Zs(fi,"WeakMap");const wf=jj;var wm=Object.create,Nj=function(){function e(){}return function(t){if(!zo(t))return{};if(wm)return wm(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const kj=Nj;function Dj(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var Lj=function(){try{var e=Zs(Object,"defineProperty");return e({},"",{}),e}catch{}}();const xm=Lj;function Bj(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var Uj=9007199254740991,Fj=/^(?:0|[1-9]\d*)$/;function d6(e,t){var r=typeof e;return t=t??Uj,!!t&&(r=="number"||r!="symbol"&&Fj.test(e))&&e>-1&&e%1==0&&e<t}function f6(e,t,r){t=="__proto__"&&xm?xm(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function lh(e,t){return e===t||e!==e&&t!==t}var $j=Object.prototype,Vj=$j.hasOwnProperty;function h6(e,t,r){var n=e[t];(!(Vj.call(e,t)&&lh(n,r))||r===void 0&&!(t in e))&&f6(e,t,r)}function mu(e,t,r,n){var i=!r;r||(r={});for(var s=-1,o=t.length;++s<o;){var a=t[s],c=n?n(r[a],e[a],a,r,e):void 0;c===void 0&&(c=e[a]),i?f6(r,a,c):h6(r,a,c)}return r}var zj=9007199254740991;function uh(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=zj}function gu(e){return e!=null&&uh(e.length)&&!u6(e)}var qj=Object.prototype;function dh(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||qj;return e===r}function Wj(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var Hj="[object Arguments]";function Sm(e){return hs(e)&&Vo(e)==Hj}var p6=Object.prototype,Gj=p6.hasOwnProperty,Kj=p6.propertyIsEnumerable,Yj=Sm(function(){return arguments}())?Sm:function(e){return hs(e)&&Gj.call(e,"callee")&&!Kj.call(e,"callee")};const m6=Yj;function Jj(){return!1}var g6=typeof exports=="object"&&exports&&!exports.nodeType&&exports,_m=g6&&typeof module=="object"&&module&&!module.nodeType&&module,Xj=_m&&_m.exports===g6,Em=Xj?fi.Buffer:void 0,Zj=Em?Em.isBuffer:void 0,Qj=Zj||Jj;const ml=Qj;var eN="[object Arguments]",tN="[object Array]",rN="[object Boolean]",nN="[object Date]",iN="[object Error]",sN="[object Function]",oN="[object Map]",aN="[object Number]",cN="[object Object]",lN="[object RegExp]",uN="[object Set]",dN="[object String]",fN="[object WeakMap]",hN="[object ArrayBuffer]",pN="[object DataView]",mN="[object Float32Array]",gN="[object Float64Array]",bN="[object Int8Array]",vN="[object Int16Array]",yN="[object Int32Array]",wN="[object Uint8Array]",xN="[object Uint8ClampedArray]",SN="[object Uint16Array]",_N="[object Uint32Array]",er={};er[mN]=er[gN]=er[bN]=er[vN]=er[yN]=er[wN]=er[xN]=er[SN]=er[_N]=!0;er[eN]=er[tN]=er[hN]=er[rN]=er[pN]=er[nN]=er[iN]=er[sN]=er[oN]=er[aN]=er[cN]=er[lN]=er[uN]=er[dN]=er[fN]=!1;function EN(e){return hs(e)&&uh(e.length)&&!!er[Vo(e)]}function bu(e){return function(t){return e(t)}}var b6=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fa=b6&&typeof module=="object"&&module&&!module.nodeType&&module,CN=fa&&fa.exports===b6,wd=CN&&o6.process,TN=function(){try{var e=fa&&fa.require&&fa.require("util").types;return e||wd&&wd.binding&&wd.binding("util")}catch{}}();const Ro=TN;var Cm=Ro&&Ro.isTypedArray,MN=Cm?bu(Cm):EN;const v6=MN;var AN=Object.prototype,IN=AN.hasOwnProperty;function y6(e,t){var r=Qr(e),n=!r&&m6(e),i=!r&&!n&&ml(e),s=!r&&!n&&!i&&v6(e),o=r||n||i||s,a=o?Wj(e.length,String):[],c=a.length;for(var l in e)(t||IN.call(e,l))&&!(o&&(l=="length"||i&&(l=="offset"||l=="parent")||s&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||d6(l,c)))&&a.push(l);return a}function w6(e,t){return function(r){return e(t(r))}}var ON=w6(Object.keys,Object);const RN=ON;var PN=Object.prototype,jN=PN.hasOwnProperty;function NN(e){if(!dh(e))return RN(e);var t=[];for(var r in Object(e))jN.call(e,r)&&r!="constructor"&&t.push(r);return t}function tc(e){return gu(e)?y6(e):NN(e)}function kN(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var DN=Object.prototype,LN=DN.hasOwnProperty;function BN(e){if(!zo(e))return kN(e);var t=dh(e),r=[];for(var n in e)n=="constructor"&&(t||!LN.call(e,n))||r.push(n);return r}function fh(e){return gu(e)?y6(e,!0):BN(e)}var UN=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,FN=/^\w*$/;function hh(e,t){if(Qr(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Ia(e)?!0:FN.test(e)||!UN.test(e)||t!=null&&e in Object(t)}var $N=Zs(Object,"create");const Oa=$N;function VN(){this.__data__=Oa?Oa(null):{},this.size=0}function zN(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var qN="__lodash_hash_undefined__",WN=Object.prototype,HN=WN.hasOwnProperty;function GN(e){var t=this.__data__;if(Oa){var r=t[e];return r===qN?void 0:r}return HN.call(t,e)?t[e]:void 0}var KN=Object.prototype,YN=KN.hasOwnProperty;function JN(e){var t=this.__data__;return Oa?t[e]!==void 0:YN.call(t,e)}var XN="__lodash_hash_undefined__";function ZN(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Oa&&t===void 0?XN:t,this}function Vs(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Vs.prototype.clear=VN;Vs.prototype.delete=zN;Vs.prototype.get=GN;Vs.prototype.has=JN;Vs.prototype.set=ZN;function QN(){this.__data__=[],this.size=0}function vu(e,t){for(var r=e.length;r--;)if(lh(e[r][0],t))return r;return-1}var ek=Array.prototype,tk=ek.splice;function rk(e){var t=this.__data__,r=vu(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():tk.call(t,r,1),--this.size,!0}function nk(e){var t=this.__data__,r=vu(t,e);return r<0?void 0:t[r][1]}function ik(e){return vu(this.__data__,e)>-1}function sk(e,t){var r=this.__data__,n=vu(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function zi(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}zi.prototype.clear=QN;zi.prototype.delete=rk;zi.prototype.get=nk;zi.prototype.has=ik;zi.prototype.set=sk;var ok=Zs(fi,"Map");const Ra=ok;function ak(){this.size=0,this.__data__={hash:new Vs,map:new(Ra||zi),string:new Vs}}function ck(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function yu(e,t){var r=e.__data__;return ck(t)?r[typeof t=="string"?"string":"hash"]:r.map}function lk(e){var t=yu(this,e).delete(e);return this.size-=t?1:0,t}function uk(e){return yu(this,e).get(e)}function dk(e){return yu(this,e).has(e)}function fk(e,t){var r=yu(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function qi(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}qi.prototype.clear=ak;qi.prototype.delete=lk;qi.prototype.get=uk;qi.prototype.has=dk;qi.prototype.set=fk;var hk="Expected a function";function ph(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(hk);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=e.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(ph.Cache||qi),r}ph.Cache=qi;var pk=500;function mk(e){var t=ph(e,function(n){return r.size===pk&&r.clear(),n}),r=t.cache;return t}var gk=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bk=/\\(\\)?/g,vk=mk(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(gk,function(r,n,i,s){t.push(i?s.replace(bk,"$1"):n||r)}),t});const yk=vk;function wk(e){return e==null?"":c6(e)}function x6(e,t){return Qr(e)?e:hh(e,t)?[e]:yk(wk(e))}var xk=1/0;function wu(e){if(typeof e=="string"||Ia(e))return e;var t=e+"";return t=="0"&&1/e==-xk?"-0":t}function mh(e,t){t=x6(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[wu(t[r++])];return r&&r==n?e:void 0}function Sk(e,t,r){var n=e==null?void 0:mh(e,t);return n===void 0?r:n}function S6(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var _k=w6(Object.getPrototypeOf,Object);const _6=_k;function Ek(){this.__data__=new zi,this.size=0}function Ck(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function Tk(e){return this.__data__.get(e)}function Mk(e){return this.__data__.has(e)}var Ak=200;function Ik(e,t){var r=this.__data__;if(r instanceof zi){var n=r.__data__;if(!Ra||n.length<Ak-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new qi(n)}return r.set(e,t),this.size=r.size,this}function si(e){var t=this.__data__=new zi(e);this.size=t.size}si.prototype.clear=Ek;si.prototype.delete=Ck;si.prototype.get=Tk;si.prototype.has=Mk;si.prototype.set=Ik;function Ok(e,t){return e&&mu(t,tc(t),e)}function Rk(e,t){return e&&mu(t,fh(t),e)}var E6=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Tm=E6&&typeof module=="object"&&module&&!module.nodeType&&module,Pk=Tm&&Tm.exports===E6,Mm=Pk?fi.Buffer:void 0,Am=Mm?Mm.allocUnsafe:void 0;function jk(e,t){if(t)return e.slice();var r=e.length,n=Am?Am(r):new e.constructor(r);return e.copy(n),n}function C6(e,t){for(var r=-1,n=e==null?0:e.length,i=0,s=[];++r<n;){var o=e[r];t(o,r,e)&&(s[i++]=o)}return s}function T6(){return[]}var Nk=Object.prototype,kk=Nk.propertyIsEnumerable,Im=Object.getOwnPropertySymbols,Dk=Im?function(e){return e==null?[]:(e=Object(e),C6(Im(e),function(t){return kk.call(e,t)}))}:T6;const gh=Dk;function Lk(e,t){return mu(e,gh(e),t)}var Bk=Object.getOwnPropertySymbols,Uk=Bk?function(e){for(var t=[];e;)S6(t,gh(e)),e=_6(e);return t}:T6;const M6=Uk;function Fk(e,t){return mu(e,M6(e),t)}function A6(e,t,r){var n=t(e);return Qr(e)?n:S6(n,r(e))}function xf(e){return A6(e,tc,gh)}function $k(e){return A6(e,fh,M6)}var Vk=Zs(fi,"DataView");const Sf=Vk;var zk=Zs(fi,"Promise");const _f=zk;var qk=Zs(fi,"Set");const Ef=qk;var Om="[object Map]",Wk="[object Object]",Rm="[object Promise]",Pm="[object Set]",jm="[object WeakMap]",Nm="[object DataView]",Hk=Xs(Sf),Gk=Xs(Ra),Kk=Xs(_f),Yk=Xs(Ef),Jk=Xs(wf),Es=Vo;(Sf&&Es(new Sf(new ArrayBuffer(1)))!=Nm||Ra&&Es(new Ra)!=Om||_f&&Es(_f.resolve())!=Rm||Ef&&Es(new Ef)!=Pm||wf&&Es(new wf)!=jm)&&(Es=function(e){var t=Vo(e),r=t==Wk?e.constructor:void 0,n=r?Xs(r):"";if(n)switch(n){case Hk:return Nm;case Gk:return Om;case Kk:return Rm;case Yk:return Pm;case Jk:return jm}return t});const Pa=Es;var Xk=Object.prototype,Zk=Xk.hasOwnProperty;function Qk(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&Zk.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var eD=fi.Uint8Array;const gl=eD;function bh(e){var t=new e.constructor(e.byteLength);return new gl(t).set(new gl(e)),t}function tD(e,t){var r=t?bh(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var rD=/\w*$/;function nD(e){var t=new e.constructor(e.source,rD.exec(e));return t.lastIndex=e.lastIndex,t}var km=li?li.prototype:void 0,Dm=km?km.valueOf:void 0;function iD(e){return Dm?Object(Dm.call(e)):{}}function sD(e,t){var r=t?bh(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var oD="[object Boolean]",aD="[object Date]",cD="[object Map]",lD="[object Number]",uD="[object RegExp]",dD="[object Set]",fD="[object String]",hD="[object Symbol]",pD="[object ArrayBuffer]",mD="[object DataView]",gD="[object Float32Array]",bD="[object Float64Array]",vD="[object Int8Array]",yD="[object Int16Array]",wD="[object Int32Array]",xD="[object Uint8Array]",SD="[object Uint8ClampedArray]",_D="[object Uint16Array]",ED="[object Uint32Array]";function CD(e,t,r){var n=e.constructor;switch(t){case pD:return bh(e);case oD:case aD:return new n(+e);case mD:return tD(e,r);case gD:case bD:case vD:case yD:case wD:case xD:case SD:case _D:case ED:return sD(e,r);case cD:return new n;case lD:case fD:return new n(e);case uD:return nD(e);case dD:return new n;case hD:return iD(e)}}function TD(e){return typeof e.constructor=="function"&&!dh(e)?kj(_6(e)):{}}var MD="[object Map]";function AD(e){return hs(e)&&Pa(e)==MD}var Lm=Ro&&Ro.isMap,ID=Lm?bu(Lm):AD;const OD=ID;var RD="[object Set]";function PD(e){return hs(e)&&Pa(e)==RD}var Bm=Ro&&Ro.isSet,jD=Bm?bu(Bm):PD;const ND=jD;var kD=1,DD=2,LD=4,I6="[object Arguments]",BD="[object Array]",UD="[object Boolean]",FD="[object Date]",$D="[object Error]",O6="[object Function]",VD="[object GeneratorFunction]",zD="[object Map]",qD="[object Number]",R6="[object Object]",WD="[object RegExp]",HD="[object Set]",GD="[object String]",KD="[object Symbol]",YD="[object WeakMap]",JD="[object ArrayBuffer]",XD="[object DataView]",ZD="[object Float32Array]",QD="[object Float64Array]",eL="[object Int8Array]",tL="[object Int16Array]",rL="[object Int32Array]",nL="[object Uint8Array]",iL="[object Uint8ClampedArray]",sL="[object Uint16Array]",oL="[object Uint32Array]",Jt={};Jt[I6]=Jt[BD]=Jt[JD]=Jt[XD]=Jt[UD]=Jt[FD]=Jt[ZD]=Jt[QD]=Jt[eL]=Jt[tL]=Jt[rL]=Jt[zD]=Jt[qD]=Jt[R6]=Jt[WD]=Jt[HD]=Jt[GD]=Jt[KD]=Jt[nL]=Jt[iL]=Jt[sL]=Jt[oL]=!0;Jt[$D]=Jt[O6]=Jt[YD]=!1;function Bc(e,t,r,n,i,s){var o,a=t&kD,c=t&DD,l=t&LD;if(r&&(o=i?r(e,n,i,s):r(e)),o!==void 0)return o;if(!zo(e))return e;var u=Qr(e);if(u){if(o=Qk(e),!a)return Dj(e,o)}else{var f=Pa(e),p=f==O6||f==VD;if(ml(e))return jk(e,a);if(f==R6||f==I6||p&&!i){if(o=c||p?{}:TD(e),!a)return c?Fk(e,Rk(o,e)):Lk(e,Ok(o,e))}else{if(!Jt[f])return i?e:{};o=CD(e,f,a)}}s||(s=new si);var y=s.get(e);if(y)return y;s.set(e,o),ND(e)?e.forEach(function(C){o.add(Bc(C,t,r,C,e,s))}):OD(e)&&e.forEach(function(C,I){o.set(I,Bc(C,t,r,I,e,s))});var x=l?c?$k:xf:c?fh:tc,v=u?void 0:x(e);return Bj(v||e,function(C,I){v&&(I=C,C=e[I]),h6(o,I,Bc(C,t,r,I,e,s))}),o}var aL=1,cL=4;function lL(e){return Bc(e,aL|cL)}var uL="__lodash_hash_undefined__";function dL(e){return this.__data__.set(e,uL),this}function fL(e){return this.__data__.has(e)}function bl(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new qi;++t<r;)this.add(e[t])}bl.prototype.add=bl.prototype.push=dL;bl.prototype.has=fL;function hL(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function pL(e,t){return e.has(t)}var mL=1,gL=2;function P6(e,t,r,n,i,s){var o=r&mL,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var l=s.get(e),u=s.get(t);if(l&&u)return l==t&&u==e;var f=-1,p=!0,y=r&gL?new bl:void 0;for(s.set(e,t),s.set(t,e);++f<a;){var x=e[f],v=t[f];if(n)var C=o?n(v,x,f,t,e,s):n(x,v,f,e,t,s);if(C!==void 0){if(C)continue;p=!1;break}if(y){if(!hL(t,function(I,O){if(!pL(y,O)&&(x===I||i(x,I,r,n,s)))return y.push(O)})){p=!1;break}}else if(!(x===v||i(x,v,r,n,s))){p=!1;break}}return s.delete(e),s.delete(t),p}function bL(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function vL(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var yL=1,wL=2,xL="[object Boolean]",SL="[object Date]",_L="[object Error]",EL="[object Map]",CL="[object Number]",TL="[object RegExp]",ML="[object Set]",AL="[object String]",IL="[object Symbol]",OL="[object ArrayBuffer]",RL="[object DataView]",Um=li?li.prototype:void 0,xd=Um?Um.valueOf:void 0;function PL(e,t,r,n,i,s,o){switch(r){case RL:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case OL:return!(e.byteLength!=t.byteLength||!s(new gl(e),new gl(t)));case xL:case SL:case CL:return lh(+e,+t);case _L:return e.name==t.name&&e.message==t.message;case TL:case AL:return e==t+"";case EL:var a=bL;case ML:var c=n&yL;if(a||(a=vL),e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;n|=wL,o.set(e,t);var u=P6(a(e),a(t),n,i,s,o);return o.delete(e),u;case IL:if(xd)return xd.call(e)==xd.call(t)}return!1}var jL=1,NL=Object.prototype,kL=NL.hasOwnProperty;function DL(e,t,r,n,i,s){var o=r&jL,a=xf(e),c=a.length,l=xf(t),u=l.length;if(c!=u&&!o)return!1;for(var f=c;f--;){var p=a[f];if(!(o?p in t:kL.call(t,p)))return!1}var y=s.get(e),x=s.get(t);if(y&&x)return y==t&&x==e;var v=!0;s.set(e,t),s.set(t,e);for(var C=o;++f<c;){p=a[f];var I=e[p],O=t[p];if(n)var j=o?n(O,I,p,t,e,s):n(I,O,p,e,t,s);if(!(j===void 0?I===O||i(I,O,r,n,s):j)){v=!1;break}C||(C=p=="constructor")}if(v&&!C){var U=e.constructor,D=t.constructor;U!=D&&"constructor"in e&&"constructor"in t&&!(typeof U=="function"&&U instanceof U&&typeof D=="function"&&D instanceof D)&&(v=!1)}return s.delete(e),s.delete(t),v}var LL=1,Fm="[object Arguments]",$m="[object Array]",vc="[object Object]",BL=Object.prototype,Vm=BL.hasOwnProperty;function UL(e,t,r,n,i,s){var o=Qr(e),a=Qr(t),c=o?$m:Pa(e),l=a?$m:Pa(t);c=c==Fm?vc:c,l=l==Fm?vc:l;var u=c==vc,f=l==vc,p=c==l;if(p&&ml(e)){if(!ml(t))return!1;o=!0,u=!1}if(p&&!u)return s||(s=new si),o||v6(e)?P6(e,t,r,n,i,s):PL(e,t,c,r,n,i,s);if(!(r&LL)){var y=u&&Vm.call(e,"__wrapped__"),x=f&&Vm.call(t,"__wrapped__");if(y||x){var v=y?e.value():e,C=x?t.value():t;return s||(s=new si),i(v,C,r,n,s)}}return p?(s||(s=new si),DL(e,t,r,n,i,s)):!1}function xu(e,t,r,n,i){return e===t?!0:e==null||t==null||!hs(e)&&!hs(t)?e!==e&&t!==t:UL(e,t,r,n,xu,i)}var FL=1,$L=2;function VL(e,t,r,n){var i=r.length,s=i,o=!n;if(e==null)return!s;for(e=Object(e);i--;){var a=r[i];if(o&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<s;){a=r[i];var c=a[0],l=e[c],u=a[1];if(o&&a[2]){if(l===void 0&&!(c in e))return!1}else{var f=new si;if(n)var p=n(l,u,c,e,t,f);if(!(p===void 0?xu(u,l,FL|$L,n,f):p))return!1}}return!0}function j6(e){return e===e&&!zo(e)}function zL(e){for(var t=tc(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,j6(i)]}return t}function N6(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function qL(e){var t=zL(e);return t.length==1&&t[0][2]?N6(t[0][0],t[0][1]):function(r){return r===e||VL(r,e,t)}}function WL(e,t){return e!=null&&t in Object(e)}function HL(e,t,r){t=x6(t,e);for(var n=-1,i=t.length,s=!1;++n<i;){var o=wu(t[n]);if(!(s=e!=null&&r(e,o)))break;e=e[o]}return s||++n!=i?s:(i=e==null?0:e.length,!!i&&uh(i)&&d6(o,i)&&(Qr(e)||m6(e)))}function GL(e,t){return e!=null&&HL(e,t,WL)}var KL=1,YL=2;function JL(e,t){return hh(e)&&j6(t)?N6(wu(e),t):function(r){var n=Sk(r,e);return n===void 0&&n===t?GL(r,e):xu(t,n,KL|YL)}}function XL(e){return function(t){return t==null?void 0:t[e]}}function ZL(e){return function(t){return mh(t,e)}}function QL(e){return hh(e)?XL(wu(e)):ZL(e)}function k6(e){return typeof e=="function"?e:e==null?l6:typeof e=="object"?Qr(e)?JL(e[0],e[1]):qL(e):QL(e)}function eB(e){return function(t,r,n){for(var i=-1,s=Object(t),o=n(t),a=o.length;a--;){var c=o[e?a:++i];if(r(s[c],c,s)===!1)break}return t}}var tB=eB();const rB=tB;function nB(e,t){return e&&rB(e,t,tc)}function iB(e,t){return function(r,n){if(r==null)return r;if(!gu(r))return e(r,n);for(var i=r.length,s=t?i:-1,o=Object(r);(t?s--:++s<i)&&n(o[s],s,o)!==!1;);return r}}var sB=iB(nB);const D6=sB;function oB(e,t){var r=[];return D6(e,function(n,i,s){t(n,i,s)&&r.push(n)}),r}function aB(e,t){var r=Qr(e)?C6:oB;return r(e,k6(t))}function cB(e,t){var r=-1,n=gu(e)?Array(e.length):[];return D6(e,function(i,s,o){n[++r]=t(i,s,o)}),n}function lB(e,t){return xu(e,t)}function uB(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function dB(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,s=Ia(e),o=t!==void 0,a=t===null,c=t===t,l=Ia(t);if(!a&&!l&&!s&&e>t||s&&o&&c&&!a&&!l||n&&o&&c||!r&&c||!i)return 1;if(!n&&!s&&!l&&e<t||l&&r&&i&&!n&&!s||a&&r&&i||!o&&i||!c)return-1}return 0}function fB(e,t,r){for(var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;++n<o;){var c=dB(i[n],s[n]);if(c){if(n>=a)return c;var l=r[n];return c*(l=="desc"?-1:1)}}return e.index-t.index}function hB(e,t,r){t.length?t=Lc(t,function(s){return Qr(s)?function(o){return mh(o,s.length===1?s[0]:s)}:s}):t=[l6];var n=-1;t=Lc(t,bu(k6));var i=cB(e,function(s,o,a){var c=Lc(t,function(l){return l(s)});return{criteria:c,index:++n,value:s}});return uB(i,function(s,o){return fB(s,o,r)})}function pB(e,t,r,n){return e==null?[]:(Qr(t)||(t=t==null?[]:[t]),r=n?void 0:r,Qr(r)||(r=r==null?[]:[r]),hB(e,t,r))}function mB({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=en(),s=Z.useRef(!1),{slippage:o}=zr(),[a,c]=Z.useState(r),{fromAmountUi:l,toAmountUi:u,byAmountIn:f}=a,{amountLimit:p}=Zw(o,a),{showPriceImpactTips:y,showPriceImpactWarn:x}=r6(n,i,l,u),{priceAcceptRouterData:v}=yP(a),[C,I]=Z.useState(!1),[O,j]=Z.useState(!1);Z.useMemo(()=>f?i:n,[f]);const U=Z.useMemo(()=>v!==void 0,[v]),D=()=>{if(v){if(s.current)return;s.current=!0;const q=lL(v);c(q),setTimeout(()=>{s.current=!1},300)}},H=Z.useMemo(()=>C?!1:!!x,[C,x]);return w.jsxs("div",{className:"secondary-dialog",children:[w.jsx(ch,{title:"Review your order",backClick:e}),w.jsxs("div",{className:"secondary-content",children:[w.jsxs("div",{className:"trade-info",children:[w.jsxs("div",{className:"amount-info",children:[w.jsx("span",{className:"amount",children:Mo(l||"")}),w.jsx(Pr,{src:n==null?void 0:n.logo_url,token:n,style:{width:"28px",height:"28px"}}),w.jsx("span",{className:"symbol",children:yn((n==null?void 0:n.symbol)||"")})]}),w.jsx("div",{className:"dividing-line",children:w.jsx("div",{className:"swap-icon",children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-trade"})})})}),w.jsxs("div",{className:"amount-info",children:[w.jsx("span",{className:"amount",children:Mo(u||"")}),w.jsx(Pr,{src:i==null?void 0:i.logo_url,token:i,style:{width:"28px",height:"28px"}}),w.jsx("span",{className:"symbol",children:yn((i==null?void 0:i.symbol)||"")})]})]}),w.jsxs("div",{className:"current-price-tips-box yellow",style:{fontSize:"12px",marginTop:"8px",flexDirection:"column",justifyContent:"start",gap:"10px"},children:[w.jsx("div",{className:"current-price-box",style:{backgroundColor:"var(--cs-bg-primary)",marginTop:"-1px"},children:w.jsx(ah,{baseToken:n,quoteToken:i,baseAmount:l||"0",quoteAmount:u||"0",loading:!1})}),y&&w.jsx("div",{style:{paddingLeft:"8px",paddingBottom:"10px",color:"var(--cs-warning)"},children:"High price difference. Be cautious before submitting your order."})]}),w.jsxs("div",{className:"swap-info-between",style:{marginTop:"16px"},children:[w.jsx("div",{className:"left",children:"Slippage Tolerance"}),w.jsxs("div",{className:"right",children:[o,"%"]})]}),w.jsx(s6,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:p}),w.jsx(i6,{isLoading:!1,routerData:a,noTips:!0}),x&&w.jsxs("div",{style:{width:"100%",marginTop:"8px",gap:"1px"},children:[w.jsx("div",{style:{width:"100%",gap:"8px",fontSize:"12px",backgroundColor:"var(--cs-error-10)",paddingLeft:"16px",paddingRight:"16px",paddingTop:"8px",paddingBottom:"8px",borderRadius:"12px",color:"var(--cs-error)"},children:"The exchange rate of this order deviates from the market price by a large percentage. Are you sure you want to continue the swap?"}),w.jsxs("div",{style:{width:"100%",gap:"16px",display:"flex",flexDirection:"row",marginTop:"-10px"},children:[w.jsx("button",{className:C?"swap-btn cs-outline-btn secondary-btn ignorePriceImpact-btn":"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",flex:1,color:C?"var(--cs-primary)":"var(--cs-btn-disabled-text)"},onClick:()=>{I(!0)},children:"Yes, please continue."}),w.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",color:"var(--cs-btn-disabled-text)",flex:1},onClick:()=>e(),children:"No,cancel it."})]})]})]}),!U&&w.jsx("button",{disabled:H||O,className:"swap-btn cs-solid-btn",style:{marginTop:"16px"},onClick:()=>{O||(j(!0),t(a))},children:O?w.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:w.jsx(T0,{})}):"Confirm Swap"}),U&&w.jsxs("div",{className:"price-update",children:[w.jsxs("div",{className:"left",children:[w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-alert"})}),w.jsx("span",{children:"Price update"})]}),w.jsx("div",{className:"right",children:w.jsx("button",{className:"cs-solid-btn",onClick:D,children:"Accept"})})]})]})}function Su(e){const{text:t,type:r,classType:n=""}=e,[i,s]=Z.useState(!1),{addCommonToast:o}=Bo(),a=c=>{i||(Gl(c),Gw(t,{debug:!1,message:"message"}),o("Copied"),s(!i))};return Z.useEffect(()=>{i&&setTimeout(()=>{s(!1)},2e3)},[i]),w.jsx(w.Fragment,{children:r==="btn"?w.jsxs("div",{className:n?`${n} copy-btn`:"copy-btn",onClick:a,children:[w.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:i?"#icon-sel":"#icon-icon_copy"})}),w.jsx("span",{children:"Copy"})]}):w.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",onClick:a,children:w.jsx("use",{xlinkHref:i?"#icon-sel":"#icon-icon_copy"})})})}function gB({toBack:e,data:t,isLoading:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=en(),{fetchTokenInfo:a}=bs(),[c,l]=Z.useState([]),u=async()=>{var p;return await Promise.all(((p=t==null?void 0:t.routers)==null?void 0:p.map(async y=>({...y,paths:await Promise.all(y.paths.map(async x=>({...x,fromToken:await a(x.from_type),toToken:await a(x.to_type)})))})))||[])};return Z.useEffect(()=>{u().then(f=>{l(f)})},[t]),w.jsxs("div",{className:"route-dialog",children:[w.jsx(ch,{title:"Route",backClick:e}),w.jsxs("div",{className:"route-dialog-content",children:[w.jsx("div",{className:"simple-router-box",children:w.jsx(L6,{hasSubMenu:!1,isLoading:r,formatSwapRouter:t})}),w.jsxs("div",{className:"center",style:{flexDirection:"column",gap:"0px"},children:[w.jsxs("div",{className:"center",style:{gap:"4px",marginTop:"16px"},children:[w.jsx(Pr,{src:n==null?void 0:n.logo_url,token:n,style:{width:"26px",height:"26px",borderRadius:"100%"}}),w.jsx("span",{className:"amount",style:{color:"var(--cs-text-primary)"},children:Dr(s,n==null?void 0:n.decimals)}),w.jsx("span",{className:"symbol",style:{color:"var(--cs-text-secondary)"},children:n==null?void 0:n.symbol})]}),w.jsx("div",{className:"route-box-h5 center",children:w.jsx("div",{style:{width:"100%",gap:"32px",border:"1px dashed var(--cs-border)",borderRadius:"8px",display:"flex",flexDirection:"column",paddingTop:"20px",paddingBottom:"20px",overflowY:"auto",maxHeight:"280px",position:"relative"},children:c==null?void 0:c.map((f,p)=>w.jsxs("div",{className:"route-item-box-h5",children:[w.jsxs("div",{className:"percent",children:[Me(f.percentage).mul(100).toString(),"%"]}),w.jsx("div",{className:f.paths.length>1?"route-two-h5":"",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"},children:f.paths.map(y=>w.jsx("div",{className:"route-path-item",children:w.jsx(n6,{autoSwitchTooltip:!0,position:"bottom",borderRadius:"12px",content:w.jsxs("div",{className:"router-pool-tip-con",style:{display:"flex",flexDirection:"column",minWidth:"220px"},children:[w.jsx(vB,{poolAddress:y.pool_address}),w.jsx(zm,{token:y.fromToken}),w.jsx(zm,{token:y.toToken})]}),children:w.jsx(bB,{path:y})})},y.to_type))})]},p))})}),w.jsxs("div",{className:"center",style:{gap:"4px"},children:[w.jsx(Pr,{src:i==null?void 0:i.logo_url,token:i,style:{width:"26px",height:"26px",borderRadius:"100%"}}),w.jsx("span",{className:"amount",style:{color:"var(--cs-text-primary)"},children:Dr(o,i==null?void 0:i.decimals)}),w.jsx("span",{className:"symbol",style:{color:"var(--cs-text-secondary)"},children:i==null?void 0:i.symbol})]})]})]})]})}function bB({path:e}){var t,r,n;return w.jsxs("div",{role:"button",style:{display:"flex",flexDirection:"row",gap:"0px",zIndex:3},children:[w.jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[w.jsx(Pr,{src:(t=e.fromToken)==null?void 0:t.logo_url,token:e.fromToken,style:{width:"24px",height:"24px",minWidth:"24px",minHeight:"24px",borderRadius:"100%"}}),w.jsx(Pr,{src:(r=e.toToken)==null?void 0:r.logo_url,token:e.toToken,style:{width:"24px",height:"24px",minWidth:"24px",minHeight:"24px",borderRadius:"100%"}})]}),w.jsxs("span",{className:"provider",style:{color:"var(--cs-text-primary)"},children:[(n=n2[e.provider])==null?void 0:n.name," "]}),!!+e.fee_rate&&w.jsxs("div",{className:"fee-tier",children:[" ",Me(e.fee_rate).mul(100).toString(),"%"]})]})}function zm({token:e}){const{getExplorerUrl:t}=Do();return w.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"12px",margin:"8px 0 4px",gap:"12px"},children:[w.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexShrink:0},children:[w.jsx(Pr,{src:e==null?void 0:e.logo_url,token:e,showWarnSize:"12px",style:{width:"20px",height:"20px",borderRadius:"100%"}}),w.jsx("span",{style:{color:"var(--cs-text-primary)",fontSize:"12px"},children:yn((e==null?void 0:e.symbol)||"")})]}),w.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[w.jsx("a",{onClick:Gl,href:t(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{textDecoration:"none",color:"var(--cs-text-secondary)",marginRight:"4px"},children:Us(e==null?void 0:e.coin_type)}),w.jsx(Su,{text:(e==null?void 0:e.coin_type)||""})]})]})}function vB({poolAddress:e}){const{getExplorerUrl:t}=Do();return w.jsxs(w.Fragment,{children:[e&&w.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",fontSize:"12px",gap:"12px"},children:[w.jsx("span",{style:{color:"var(--cs-text-primary)",fontSize:"12px"},children:"Pool"}),w.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[w.jsx("a",{style:{color:"var(--cs-text-primary)",textDecoration:"none",marginRight:"4px"},onClick:Gl,href:t(e,"poolAddress"),target:"_blank",children:Us(e)}),w.jsx(Su,{text:e})]})]}),e&&w.jsx("div",{style:{width:"100%",height:"1px",marginTop:"8px",backgroundColor:"var(--cs-border)"}})]})}function L6({hasSubMenu:e,isLoading:t,formatSwapRouter:r}){var f;const[n,i]=Z.useState(!1),{isApp:s}=pu(),{fetchTokenInfo:o}=bs(),a=Z.useMemo(()=>(r==null?void 0:r.routers.length)===1,[r==null?void 0:r.routers.length]),[c,l]=Z.useState(""),u=async()=>{var v,C;const p=[],y=((C=(v=r==null?void 0:r.routers)==null?void 0:v[0])==null?void 0:C.paths)||[];for(let I=0;I<y.length;I++){const O=y[I],j=await o(O==null?void 0:O.to_type);if(I===0){const U=await o(O==null?void 0:O.from_type);p.push(`${U==null?void 0:U.symbol} > ${j==null?void 0:j.symbol}`)}else p.push(j==null?void 0:j.symbol)}const x=p.join(" > ");l(x)};return Z.useEffect(()=>{a&&u()},[a]),w.jsxs("div",{className:"simple-router-block",style:{paddingLeft:e?"8px":"0px",paddingRight:e?"8px":"0px"},children:[w.jsx("div",{className:"left",style:{whiteSpace:"nowrap",color:e?"var(--cs-text-secondary)":"var(--cs-text-primary)",paddingRight:"8px"},children:e?"Auto Router":"Route"}),t?w.jsx($o,{className:"custom-skeleton",style:{width:"80px",height:"18px"}}):w.jsxs("div",{className:"right",onClick:()=>{i(!0)},children:[w.jsx("span",{style:{textAlign:"right",color:"var(--cs-text-primary)"},children:a?c:r==null?void 0:r.router_summery}),w.jsxs("div",{className:"providers",children:[(f=r==null?void 0:r.providers)==null?void 0:f.map((p,y)=>{var x;return s?w.jsx(Pr,{src:Qt[p],style:{width:"16px",height:"16px"},haveBorder:!1}):w.jsx($s,{content:w.jsx("div",{style:{color:"var(--cs-text-primary)"},children:((x=n2[p])==null?void 0:x.name)||p}),position:"top",delay:300,children:w.jsx(Pr,{src:Qt[p],style:{width:"16px",height:"16px"},haveBorder:!1})},p)}),e&&w.jsx("svg",{className:"cs-icon spread-icon","aria-hidden":"true",style:{width:"16px",height:"16px",flexShrink:0},children:w.jsx("use",{xlinkHref:"#icon-spread"})})]})]}),n&&e&&w.jsx(gB,{data:r,isLoading:t,toBack:()=>i(!1)})]})}function B6(){const{setCollectTokenMap:e,collectTokenMap:t}=Ys(),r=i=>{const s=new Map(t);s.get(i.coin_type)?s.delete(i.coin_type):s.set(i.coin_type,i),e(s)},n=Z.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function yB(e){const{trustedTokenList:t}=Lo(),{tokenBalanceObj:r,currentAccount:n}=qr(),{coinPriceObj:i}=Yw(),{getTokenAmountValue:s}=ec(),{fetchTokenInfo:o}=bs(),{currentTypeTab:a,showTokenList:c,setShowTokenList:l,combineTokenList:u,importTokenList:f,setComBineTokenList:p,setImportToken:y,setCurrentImportTokenData:x,setImportTokenIsLoading:v,currentImportTokenData:C,searchInput:I,setSearchInput:O,importTokenIsLoading:j,showTokenListIsLoading:U,setCurrentTypeTab:D,setCurrentPlatformTab:H}=Ys(),[q,G]=Z.useState(!1);Z.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&G(!0)},[t]);const[re,ae]=Z.useState(!1);Z.useEffect(()=>{Pp(i)||ae(!0)},[i]);const ne=Z.useRef({}),[V,N]=Z.useState(!1);Z.useEffect(()=>{(!Pp(r)||!C0(ne.current,r))&&(ne.current=r,N(!0))},[r]);const h=Z.useMemo(()=>(f==null?void 0:f.length)>1?f==null?void 0:f.map(se=>{const te=jc(r==null?void 0:r[se==null?void 0:se.coin_type],se),le=te==null?void 0:te.totalBalanceFormat,xe=Me(le).gt("0")?s(se==null?void 0:se.coin_type,le):"0";return{...se,balance:le,rate:xe}}):f,[f,r,i]),d=(se,te)=>{const le=te&&te.toLocaleLowerCase().trim(),xe=se.map(Ee=>{let Ye=0,De=0;Ee.symbol.toLowerCase()===le||Ee.name.toLowerCase()===le||Ee.coin_type.toLowerCase()===le?(Ye=1e3,De=2):Ee.symbol.toLowerCase().indexOf(le)>-1?(Ye=100,De=0):Ee.name.toLowerCase().indexOf(le)>-1?(Ye=10,De=0):Ee.coin_type.toLowerCase().indexOf(le)>-1?(Ye=1,De=0):Ee.coin_type.toLowerCase()=="0x2::sui::sui"&&(De=1);let Oe=Array.isArray(Ee==null?void 0:Ee.coin_priority)?Number(Ee.coin_priority[0])||0:Number(Ee==null?void 0:Ee.coin_priority)||0;return e===Ee.coin_type&&!te&&(De=12,Ye=1e3,Oe=1e4),{...Ee,mark:Ye,sort:De,coin_priority_sort:Oe,rateNumber:Number((Ee==null?void 0:Ee.rate)||"0"),balanceNumber:Number((Ee==null?void 0:Ee.balance)||"0")}});return pB(xe,[Ee=>!te&&e===Ee.coin_type?1:0,"rateNumber","balanceNumber","sort","mark","coin_priority_sort"],["desc","desc","desc","desc","desc","desc"])},m=(se,te=!1)=>{const le=te?se.trim():se.toLowerCase().trim(),xe=["symbol","name","coin_type"];return aB(le.length===0?u:[...u,...h],Ee=>xe.some(Ye=>{const De=Ee[Ye];if(typeof De=="string"){const Oe=te?De:De.toLowerCase();return Ye==="coin_type"?Oe.includes(le)||Di(Oe,!0).includes(Di(le,!0)):Oe.includes(le)}return!1}))},S=se=>{se||x(void 0);const te=m(se);if((te==null?void 0:te.length)===0){E(se);return}else{const le=d(te,se);l(le)}},E=async se=>{v(!0);try{if(Xv(se)){const te=se.trim(),le=ur(te).full_address,xe=await o(le);if(!xe){l([]);return}const Se=jc(r==null?void 0:r[le],xe),Ee=(Se==null?void 0:Se.totalBalanceFormat)||"0",Ye=Me(Ee).gt("0")?s(te,Ee):"0",De={...xe,balance:Ee,rate:Ye};l([De]),x(De)}else{l([]);return}}catch{x(void 0),l([]);return}finally{v(!1)}},M=se=>{if(se==="Default")g("All"),H("All");else{const te=d(h,I);l(te)}},P=()=>{if(C){const se=y(C,!0),te=d(se,I);l(te),x(void 0),O("")}},A=se=>{const te=y(se,!1),le=d(te,I);l(le)},g=se=>{const te=se==="All"?[...u]:u.filter(xe=>se=="Native"?!xe.labels||xe.labels.length==0||xe.labels=="Native":xe.labels&&xe.labels.length>0&&xe.labels[0].toLowerCase()==se.toLowerCase()),le=d(te,I);l(le)};Z.useEffect(()=>{if(!q||!(t!=null&&t.length)){p([]);return}if(!(n!=null&&n.address))p(t);else if(n!=null&&n.address){const se=[];for(const te of t){const le=r==null?void 0:r[te==null?void 0:te.coin_type],xe=jc(le,te),Se=(xe==null?void 0:xe.totalBalanceFormat)||"0",Ee=(xe==null?void 0:xe.displayBalance)||"0",Ye=Me(Se).gt("0")?s(te==null?void 0:te.coin_type,Se):"0";se.push({...te,balance:Ee,rate:Dr(Ye,4,!0)})}p(se)}},[q,re,V,n==null?void 0:n.address,i]);const b=Z.useRef([]);Z.useEffect(()=>{if((u==null?void 0:u.length)>0&&!lB(b.current,u)){b.current=u;const se=d(u);e?h.find(le=>le.coin_type===e)!==void 0||a!=="Default"?(D("Imported"),M("Imported")):l(C?[C]:se):l(se)}},[u,e]);const B=Z.useMemo(()=>{if(a==="Default"){if(!U&&(c==null?void 0:c.length)===0)return!0}else if((c==null?void 0:c.length)===0&&!j)return!0;return!1},[I,c,C,j,U]);return{showTokenList:c,handleSearch:S,handleChangePlatform:g,currentImportTokenData:C,handleChangeType:M,handleImportClick:P,handleDeleteImportClick:A,isNoData:B}}function wB({tokenList:e,onHandleTokenAction:t}){return w.jsx("div",{className:"token-collect-list",children:e.map(r=>w.jsx(xB,{token:r,onHandleTokenAction:t},r.coin_type))})}function xB({token:e,onHandleTokenAction:t}){return w.jsxs("div",{className:"token-collect-item",onClick:()=>{t(e,"select_token")},children:[w.jsx(Pr,{src:e==null?void 0:e.logo_url,token:e,style:{width:"20px",height:"20px"}}),w.jsx("span",{style:{marginLeft:"4px"},children:e.symbol}),w.jsx("i",{children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:r=>{r.stopPropagation(),t(e,"un_collect")},children:w.jsx("use",{xlinkHref:"#icon-close"})})})]})}function SB(e){const{img:t="",text:r,width:n="100%",height:i="100%",padding:s="20px",subItem:o}=e;return w.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:n,height:i,padding:s,boxSizing:"border-box",textAlign:"center"},children:[t&&w.jsx("img",{src:t,alt:"No Data",style:{width:"160px",height:"160px"}}),r&&w.jsx("div",{style:{color:"var(--cs-text-primary)",fontSize:"14px"},children:r}),o&&o]})}function _B({tabList:e,currentTab:t,changeTab:r}){return w.jsx("div",{className:"platform-tabs",children:e.map(n=>w.jsx("div",{className:t===n?"platform-tab-item active":"platform-tab-item",onClick:()=>{r(n)},children:n},n))})}var qm=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function EB(e,t){return!!(e===t||qm(e)&&qm(t))}function CB(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!EB(e[r],t[r]))return!1;return!0}function TB(e,t){t===void 0&&(t=CB);var r=null;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(r&&r.lastThis===this&&t(i,r.lastArgs))return r.lastResult;var o=e.apply(this,i);return r={lastResult:o,lastArgs:i,lastThis:this},o}return n.clear=function(){r=null},n}function Cf(){return Cf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Cf.apply(null,arguments)}function Wm(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Tf(e,t){return Tf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Tf(e,t)}function MB(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Tf(e,t)}var Hm=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function AB(e,t){return!!(e===t||Hm(e)&&Hm(t))}function IB(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!AB(e[r],t[r]))return!1;return!0}function Sd(e,t){t===void 0&&(t=IB);var r,n=[],i,s=!1;function o(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return s&&r===this&&t(a,n)||(i=e.apply(this,a),s=!0,r=this,n=a),i}return o}function Gm(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var OB=typeof performance=="object"&&typeof performance.now=="function",Km=OB?function(){return performance.now()}:function(){return Date.now()};function Ym(e){cancelAnimationFrame(e.id)}function RB(e,t){var r=Km();function n(){Km()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var _d=-1;function Jm(e){if(e===void 0&&(e=!1),_d===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),_d=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return _d}var ao=null;function Xm(e){if(e===void 0&&(e=!1),ao===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),i=n.style;return i.width="100px",i.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?ao="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?ao="negative":ao="positive-ascending"),document.body.removeChild(t),ao}return ao}jn.env.NODE_ENV;var PB=150,jB=function(t,r){return t},Uc=null,Fc=null;jn.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(Uc=new WeakSet,Fc=new WeakSet);function NB(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,i=e.getItemSize,s=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,l=e.shouldResetStyleCacheOnItemSizeChange,u=e.validateProps;return t=function(f){MB(p,f);function p(x){var v;return v=f.call(this,x)||this,v._instanceProps=c(v.props,Wm(v)),v._outerRef=void 0,v._resetIsScrollingTimeoutId=null,v.state={instance:Wm(v),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof v.props.initialScrollOffset=="number"?v.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},v._callOnItemsRendered=void 0,v._callOnItemsRendered=Sd(function(C,I,O,j){return v.props.onItemsRendered({overscanStartIndex:C,overscanStopIndex:I,visibleStartIndex:O,visibleStopIndex:j})}),v._callOnScroll=void 0,v._callOnScroll=Sd(function(C,I,O){return v.props.onScroll({scrollDirection:C,scrollOffset:I,scrollUpdateWasRequested:O})}),v._getItemStyle=void 0,v._getItemStyle=function(C){var I=v.props,O=I.direction,j=I.itemSize,U=I.layout,D=v._getItemStyleCache(l&&j,l&&U,l&&O),H;if(D.hasOwnProperty(C))H=D[C];else{var q=r(v.props,C,v._instanceProps),G=i(v.props,C,v._instanceProps),re=O==="horizontal"||U==="horizontal",ae=O==="rtl",ne=re?q:0;D[C]=H={position:"absolute",left:ae?void 0:ne,right:ae?ne:void 0,top:re?0:q,height:re?"100%":G,width:re?G:"100%"}}return H},v._getItemStyleCache=void 0,v._getItemStyleCache=Sd(function(C,I,O){return{}}),v._onScrollHorizontal=function(C){var I=C.currentTarget,O=I.clientWidth,j=I.scrollLeft,U=I.scrollWidth;v.setState(function(D){if(D.scrollOffset===j)return null;var H=v.props.direction,q=j;if(H==="rtl")switch(Xm()){case"negative":q=-j;break;case"positive-descending":q=U-O-j;break}return q=Math.max(0,Math.min(q,U-O)),{isScrolling:!0,scrollDirection:D.scrollOffset<q?"forward":"backward",scrollOffset:q,scrollUpdateWasRequested:!1}},v._resetIsScrollingDebounced)},v._onScrollVertical=function(C){var I=C.currentTarget,O=I.clientHeight,j=I.scrollHeight,U=I.scrollTop;v.setState(function(D){if(D.scrollOffset===U)return null;var H=Math.max(0,Math.min(U,j-O));return{isScrolling:!0,scrollDirection:D.scrollOffset<H?"forward":"backward",scrollOffset:H,scrollUpdateWasRequested:!1}},v._resetIsScrollingDebounced)},v._outerRefSetter=function(C){var I=v.props.outerRef;v._outerRef=C,typeof I=="function"?I(C):I!=null&&typeof I=="object"&&I.hasOwnProperty("current")&&(I.current=C)},v._resetIsScrollingDebounced=function(){v._resetIsScrollingTimeoutId!==null&&Ym(v._resetIsScrollingTimeoutId),v._resetIsScrollingTimeoutId=RB(v._resetIsScrolling,PB)},v._resetIsScrolling=function(){v._resetIsScrollingTimeoutId=null,v.setState({isScrolling:!1},function(){v._getItemStyleCache(-1,null)})},v}p.getDerivedStateFromProps=function(v,C){return kB(v,C),u(v),null};var y=p.prototype;return y.scrollTo=function(v){v=Math.max(0,v),this.setState(function(C){return C.scrollOffset===v?null:{scrollDirection:C.scrollOffset<v?"forward":"backward",scrollOffset:v,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},y.scrollToItem=function(v,C){C===void 0&&(C="auto");var I=this.props,O=I.itemCount,j=I.layout,U=this.state.scrollOffset;v=Math.max(0,Math.min(v,O-1));var D=0;if(this._outerRef){var H=this._outerRef;j==="vertical"?D=H.scrollWidth>H.clientWidth?Jm():0:D=H.scrollHeight>H.clientHeight?Jm():0}this.scrollTo(s(this.props,v,C,U,this._instanceProps,D))},y.componentDidMount=function(){var v=this.props,C=v.direction,I=v.initialScrollOffset,O=v.layout;if(typeof I=="number"&&this._outerRef!=null){var j=this._outerRef;C==="horizontal"||O==="horizontal"?j.scrollLeft=I:j.scrollTop=I}this._callPropsCallbacks()},y.componentDidUpdate=function(){var v=this.props,C=v.direction,I=v.layout,O=this.state,j=O.scrollOffset,U=O.scrollUpdateWasRequested;if(U&&this._outerRef!=null){var D=this._outerRef;if(C==="horizontal"||I==="horizontal")if(C==="rtl")switch(Xm()){case"negative":D.scrollLeft=-j;break;case"positive-ascending":D.scrollLeft=j;break;default:var H=D.clientWidth,q=D.scrollWidth;D.scrollLeft=q-H-j;break}else D.scrollLeft=j;else D.scrollTop=j}this._callPropsCallbacks()},y.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Ym(this._resetIsScrollingTimeoutId)},y.render=function(){var v=this.props,C=v.children,I=v.className,O=v.direction,j=v.height,U=v.innerRef,D=v.innerElementType,H=v.innerTagName,q=v.itemCount,G=v.itemData,re=v.itemKey,ae=re===void 0?jB:re,ne=v.layout,V=v.outerElementType,N=v.outerTagName,h=v.style,d=v.useIsScrolling,m=v.width,S=this.state.isScrolling,E=O==="horizontal"||ne==="horizontal",M=E?this._onScrollHorizontal:this._onScrollVertical,P=this._getRangeToRender(),A=P[0],g=P[1],b=[];if(q>0)for(var B=A;B<=g;B++)b.push(Z.createElement(C,{data:G,key:ae(B,G),index:B,isScrolling:d?S:void 0,style:this._getItemStyle(B)}));var se=n(this.props,this._instanceProps);return Z.createElement(V||N||"div",{className:I,onScroll:M,ref:this._outerRefSetter,style:Cf({position:"relative",height:j,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:O},h)},Z.createElement(D||H||"div",{children:b,ref:U,style:{height:E?"100%":se,pointerEvents:S?"none":void 0,width:E?se:"100%"}}))},y._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var v=this.props.itemCount;if(v>0){var C=this._getRangeToRender(),I=C[0],O=C[1],j=C[2],U=C[3];this._callOnItemsRendered(I,O,j,U)}}if(typeof this.props.onScroll=="function"){var D=this.state,H=D.scrollDirection,q=D.scrollOffset,G=D.scrollUpdateWasRequested;this._callOnScroll(H,q,G)}},y._getRangeToRender=function(){var v=this.props,C=v.itemCount,I=v.overscanCount,O=this.state,j=O.isScrolling,U=O.scrollDirection,D=O.scrollOffset;if(C===0)return[0,0,0,0];var H=o(this.props,D,this._instanceProps),q=a(this.props,H,D,this._instanceProps),G=!j||U==="backward"?Math.max(1,I):1,re=!j||U==="forward"?Math.max(1,I):1;return[Math.max(0,H-G),Math.max(0,Math.min(C-1,q+re)),H,q]},p}(Z.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var kB=function(t,r){var n=t.children,i=t.direction,s=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,l=t.width,u=r.instance;if(jn.env.NODE_ENV!=="production"){(a!=null||c!=null)&&Fc&&!Fc.has(u)&&(Fc.add(u),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=i==="horizontal"||o==="horizontal";switch(i){case"horizontal":case"vertical":Uc&&!Uc.has(u)&&(Uc.add(u),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+i+'" was specified.'))}switch(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof l!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(l===null?"null":typeof l)+'" was specified.'));if(!f&&typeof s!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(s===null?"null":typeof s)+'" was specified.'))}},DB=NB({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,i,s,o){var a=t.direction,c=t.height,l=t.itemCount,u=t.itemSize,f=t.layout,p=t.width,y=a==="horizontal"||f==="horizontal",x=y?p:c,v=Math.max(0,l*u-x),C=Math.min(v,r*u),I=Math.max(0,r*u-x+u+o);switch(n==="smart"&&(i>=I-x&&i<=C+x?n="auto":n="center"),n){case"start":return C;case"end":return I;case"center":{var O=Math.round(I+(C-I)/2);return O<Math.ceil(x/2)?0:O>v+Math.floor(x/2)?v:O}case"auto":default:return i>=I&&i<=C?i:i<I?I:C}},getStartIndexForOffset:function(t,r){var n=t.itemCount,i=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/i)))},getStopIndexForStartIndex:function(t,r,n){var i=t.direction,s=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,l=t.width,u=i==="horizontal"||c==="horizontal",f=r*a,p=u?l:s,y=Math.ceil((p+n-f)/a);return Math.max(0,Math.min(o-1,r+y-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(jn.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function Zm(e,t){for(var r in e)if(!(r in t))return!0;for(var n in t)if(e[n]!==t[n])return!0;return!1}var LB=["style"],BB=["style"];function UB(e,t){var r=e.style,n=Gm(e,LB),i=t.style,s=Gm(t,BB);return!Zm(r,i)&&!Zm(n,s)}const FB=Z.memo(({data:e,index:t,style:r})=>{const{items:n,onHandleTokenAction:i,showCollect:s,showDelete:o}=e,a=n[t];return w.jsx("div",{style:r,children:w.jsx(zB,{data:a,onHandleTokenAction:i,showCollect:s,showDelete:o})})},UB),$B=TB((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function VB({showTokenList:e,onHandleTokenAction:t,showCollect:r=!0,showDelete:n=!1}){const i=Z.useRef(null);Z.useEffect(()=>{i.current&&i.current.scrollTo(0)},[e.length]);const s=$B(e,t,r,n);return w.jsx("div",{className:"token-list",children:w.jsx(DB,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:360,itemCount:e.length,itemData:s,itemSize:72,width:"100%",children:FB})})}function zB({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=B6(),{getExplorerUrl:s}=Do();return ec(),w.jsxs("div",{className:"token-list-item",onClick:o=>{t&&(o.stopPropagation(),n(e,"select_token"))},children:[w.jsx(Pr,{className:"token-img",src:e==null?void 0:e.logo_url,token:e,showWarnSize:"16px",showWarn:!t}),w.jsxs("div",{className:"token-info",children:[w.jsx("h4",{className:"token-symbol",children:w.jsx("span",{children:yn(e.symbol)})}),w.jsx("p",{className:"token-name",children:yn(e==null?void 0:e.name,20)}),w.jsxs("div",{className:"copy",children:[w.jsx("a",{onClick:Gl,href:s(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{fontSize:"12px"},children:Us(e==null?void 0:e.coin_type)}),w.jsx(Su,{text:e==null?void 0:e.coin_type})]})]}),w.jsxs("div",{className:"token-balance",children:[w.jsxs("div",{className:"balance",children:[w.jsx("h4",{children:e==null?void 0:e.balance}),w.jsx("p",{children:e!=null&&e.rate?Yv(e==null?void 0:e.rate,2):""})]}),r&&w.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"delete_import")},children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-icon_del1"})})}),t&&w.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"collect_token")},children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:i(e)?"#icon-star_sel":"#icon-star"})})})]})]},e==null?void 0:e.coin_type)}function qB({currentType:e,changeTab:t}){const r=["Default","Imported"];return w.jsx("div",{className:"type-tabs",children:r.map(n=>w.jsx("div",{className:e===n?"type-tab-item active":"type-tab-item",onClick:()=>t(n),children:n},n))})}function WB({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:s,handleChangePlatform:o,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:l}=yB(r==null?void 0:r.coin_type),{importTokenList:u,currentTypeTab:f,setCurrentTypeTab:p,currentPlatformTab:y,setCurrentPlatformTab:x,platformList:v,isOpenImportDialog:C,setIsOpenImportDialog:I,setSearchInput:O,searchInput:j,importTokenIsLoading:U,currentImportTokenData:D,setCurrentImportTokenData:H}=Ys();Z.useEffect(()=>()=>{O(""),x("All"),p("Default"),H(void 0)},[]);const{handleCollectToken:q,collectTokenMap:G}=B6(),re=m=>{p(m),a(m)},ae=m=>{x(m),o(m)},ne=()=>{c(),I(!1)},V=m=>{let S=m.replace(/[^a-zA-Z0-9\s]+$/g,"").trim();O(S),S?N(S):(N(""),re("Default"))},N=oh(m=>{Xv(m)?s(Di(m,!0)):s(m)},300),h=(m,S)=>{if(S==="delete_import"){l(m);return}if(S==="collect_token"||S==="un_collect"){q(m);return}S==="select_token"&&(t(m),e())},d=Z.useMemo(()=>Array.from(G.values()),[G]);return w.jsxs("div",{className:"token-select-modal",children:[w.jsx(ch,{backClick:e,title:"Select Token"}),w.jsxs("div",{className:"token-select-content",style:{position:"relative"},children:[w.jsxs("div",{className:"center-content",children:[w.jsxs("div",{className:"search-input",style:{position:"relative"},children:[w.jsx("input",{className:"token-search-input",placeholder:"Search by token or address",value:j,onChange:m=>V(m.target.value),style:{paddingRight:"40px"}}),j.length>0&&w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"20px",height:"20px",cursor:"pointer",position:"absolute",top:"50%",transform:"translateY(-50%)",right:"12px"},onClick:m=>{V("")},children:w.jsx("use",{xlinkHref:"#icon-close"})})]}),d.length>0&&w.jsx(wB,{tokenList:d,onHandleTokenAction:h}),j.length===0&&w.jsx(qB,{currentType:f,changeTab:re}),j.length===0&&f==="Default"&&w.jsx(_B,{tabList:v,currentTab:y,changeTab:ae})]}),i&&w.jsx(HB,{showTooltip:j.length>0,text:j.length>0||D===void 0?"No tokens found":"No Imported Tokens"}),U&&w.jsx(Kw,{}),D&&w.jsx("div",{style:{width:"93%",marginLeft:"16px",backgroundColor:"var(--cs-warning-10)",borderRadius:"12px",padding:"16px",fontSize:"12px",marginTop:"16px",color:" var(--cs-warning)"},children:"The token is not on the Frequently Traded List. Please note that anyone can create a token on Sui blockchain with any name, including creating fake versions of existing tokens or tokens that claim to represent projects that do not have a token. Always conduct your own research before trading."}),n.length>0&&w.jsxs("div",{style:{position:"relative"},children:[w.jsx(VB,{showTokenList:n,showCollect:!D,showDelete:!D&&f==="Imported",onHandleTokenAction:h}),D&&w.jsx("div",{className:"center",style:{position:"absolute",top:"100px",left:"50%",transform:"translateX(-50%)"},children:w.jsx("button",{className:"cs-solid-btn swap-btn",style:{height:"32px",width:"140px",fontSize:"14px",borderRadius:"8px",fontFamily:"Inter, Inter",fontWeight:500},onClick:()=>{ne(),h(D,"select_token")},children:"Import"})})]})]})]})}function HB({showTooltip:e,text:t}){return w.jsx("div",{style:{height:"360px"},children:w.jsx(SB,{text:t,subItem:e?w.jsx("div",{children:w.jsx($s,{position:"bottom",content:w.jsx("div",{style:{color:"var(--cs-text-primary)"},children:"The unique id of coin"}),children:w.jsxs("div",{style:{fontSize:"12px",color:"var(--cs-text-secondary)",display:"flex",flexDirection:"row"},children:["Or you can enter Coin Type",w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:w.jsx("use",{xlinkHref:"#icon-tips"})})]})})}):void 0})})}function GB({onClose:e,tokenList:t,onSureClick:r}){const[n,i]=Z.useState(!1),{setIgnoreWarnToken:s}=zr();return w.jsxs(w.Fragment,{children:[w.jsx("div",{className:"dialog-mask",onClick:e}),w.jsxs("div",{className:"import-dialog",children:[w.jsxs("div",{className:"cs-dialog-header",children:[w.jsx("div",{className:"title",children:"Tips"}),w.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:w.jsx("use",{xlinkHref:"#icon-close"})})]}),w.jsxs("div",{className:"import-content",children:[w.jsx("div",{className:"tip-text-box",children:w.jsx("p",{className:"tips-text",children:"The default trading pair given in this swap widget contains a community imported token that is imported by the integrator. Please acknowledge the risk and conduct your own research before interacting."})}),t.map(o=>w.jsxs("div",{className:"import-token-info",children:[w.jsx(Pr,{style:{width:"30px",height:"30px",borderRadius:"36px"},token:o,showWarnSize:"16px",src:o.logo_url}),w.jsxs("div",{className:"info",children:[w.jsx("div",{className:"name",children:w.jsxs("span",{children:[" ",o.symbol," "]})}),w.jsxs("div",{className:"address",children:[w.jsx("span",{children:Us(o.coin_type)}),w.jsx(Su,{text:o.coin_type})]})]})]},o.coin_type)),w.jsxs("div",{className:"risk-checkbox ",children:[w.jsx(au,{color:"indigo",checked:n,variant:"soft",className:"cs-checkbox cs-allow-change-checkbox",onClick:()=>{i(!n)}}),w.jsx("span",{children:"I acknowledge the risk"})]}),w.jsxs("div",{className:"button-block",children:[w.jsx("button",{className:"cs-outline-btn",onClick:e,children:"Cancel"}),w.jsx("button",{className:"cs-solid-btn",disabled:!n,onClick:()=>{r(),t.forEach(o=>{s(o.coin_type)})},children:"Confirm"})]})]})]})]})}function U6(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}var ja;(function(e){e.event="event",e.props="prop"})(ja||(ja={}));function ts(){}function KB(e){var t,r=void 0;return function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t&&n.length===t.length&&n.every(function(s,o){return s===t[o]})||(t=n,r=e.apply(void 0,n)),r}}function Na(e){return!!(e||"").match(/\d/)}function So(e){return e==null}function YB(e){return typeof e=="number"&&isNaN(e)}function F6(e){return So(e)||YB(e)||typeof e=="number"&&!isFinite(e)}function $6(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function JB(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function XB(e,t,r){var n=JB(r),i=e.search(/[1-9]/);return i=i===-1?e.length:i,e.substring(0,i)+e.substring(i,e.length).replace(n,"$1"+t)}function ZB(e){var t=Z.useRef(e);t.current=e;var r=Z.useRef(function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t.current.apply(t,n)});return r.current}function vh(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var i=e.split("."),s=i[0],o=i[1]||"";return{beforeDecimal:s,afterDecimal:o,hasNegation:r,addNegation:n}}function QB(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",i=r[1]||"";return(t?"-":"")+n+(i?"."+i:"")}function V6(e,t,r){for(var n="",i=r?"0":"",s=0;s<=t-1;s++)n+=e[s]||i;return n}function Qm(e,t){return Array(t+1).join(e)}function z6(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),i=n[0],s=n[1];if(s=Number(s),!s)return r+i;i=i.replace(".","");var o=1+s,a=i.length;return o<0?i="0."+Qm("0",Math.abs(o))+i:o>=a?i=i+Qm("0",o-a):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function e1(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=vh(e),s=i.beforeDecimal,o=i.afterDecimal,a=i.hasNegation,c=parseFloat("0."+(o||"0")),l=o.length<=t?"0."+o:c.toFixed(t),u=l.split("."),f=s;s&&Number(u[0])&&(f=s.split("").reverse().reduce(function(v,C,I){return v.length>I?(Number(v[0])+Number(C)).toString()+v.substring(1,v.length):C+v},u[0]));var p=V6(u[1]||"",t,r),y=a?"-":"",x=n?".":"";return""+y+f+x+p}function Ts(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var q6=KB(function(e,t){for(var r=0,n=0,i=e.length,s=t.length;e[r]===t[r]&&r<i;)r++;for(;e[i-1-n]===t[s-1-n]&&s-n>r&&i-n>r;)n++;return{from:{start:r,end:i-n},to:{start:r,end:s-n}}}),eU=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function tU(e,t,r){return Math.min(Math.max(e,t),r)}function Ed(e){return Math.max(e.selectionStart,e.selectionEnd)}function rU(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function nU(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function iU(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function sU(e,t,r,n,i,s,o){o===void 0&&(o=iU);var a=i.findIndex(function(U){return U}),c=e.slice(0,a);!t&&!r.startsWith(c)&&(t=c,r=c+r,n=n+c.length);for(var l=r.length,u=e.length,f={},p=new Array(l),y=0;y<l;y++){p[y]=-1;for(var x=0,v=u;x<v;x++){var C=o({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:x});if(C&&f[x]!==!0){p[y]=x,f[x]=!0;break}}}for(var I=n;I<l&&(p[I]===-1||!s(r[I]));)I++;var O=I===l||p[I]===-1?u:p[I];for(I=n-1;I>0&&p[I]===-1;)I--;var j=I===-1||p[I]===-1?0:p[I]+1;return j>O?O:n-j<O-n?j:O}function t1(e,t,r,n){var i=e.length;if(t=tU(t,0,i),n==="left"){for(;t>=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=i&&!r[t];)t++;t>i&&(t=r.lastIndexOf(!0))}return t===-1&&(t=i),t}function oU(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(Na(e[r])||Na(e[r-1]));return t}function W6(e,t,r,n,i,s){s===void 0&&(s=ts);var o=ZB(function(x,v){var C,I;return F6(x)?(I="",C=""):typeof x=="number"||v?(I=typeof x=="number"?z6(x):x,C=n(I)):(I=i(x,void 0),C=n(I)),{formattedValue:C,numAsString:I}}),a=Z.useState(function(){return o(So(e)?t:e,r)}),c=a[0],l=a[1],u=function(x,v){x.formattedValue!==c.formattedValue&&l({formattedValue:x.formattedValue,numAsString:x.value}),s(x,v)},f=e,p=r;So(e)&&(f=c.numAsString,p=!0);var y=o(f,p);return Z.useMemo(function(){l(y)},[y.formattedValue]),[c,u]}function aU(e){return e.replace(/[^0-9]/g,"")}function cU(e){return e}function lU(e){var t=e.type;t===void 0&&(t="text");var r=e.displayType;r===void 0&&(r="input");var n=e.customInput,i=e.renderText,s=e.getInputRef,o=e.format;o===void 0&&(o=cU);var a=e.removeFormatting;a===void 0&&(a=aU);var c=e.defaultValue,l=e.valueIsNumericString,u=e.onValueChange,f=e.isAllowed,p=e.onChange;p===void 0&&(p=ts);var y=e.onKeyDown;y===void 0&&(y=ts);var x=e.onMouseUp;x===void 0&&(x=ts);var v=e.onFocus;v===void 0&&(v=ts);var C=e.onBlur;C===void 0&&(C=ts);var I=e.value,O=e.getCaretBoundary;O===void 0&&(O=oU);var j=e.isValidInputCharacter;j===void 0&&(j=Na);var U=e.isCharacterSame,D=U6(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),H=W6(I,c,!!l,o,a,u),q=H[0],G=q.formattedValue,re=q.numAsString,ae=H[1],ne=Z.useRef(),V=Z.useRef({formattedValue:G,numAsString:re}),N=function(be,he){V.current={formattedValue:be.formattedValue,numAsString:be.value},ae(be,he)},h=Z.useState(!1),d=h[0],m=h[1],S=Z.useRef(null),E=Z.useRef({setCaretTimeout:null,focusTimeout:null});Z.useEffect(function(){return m(!0),function(){clearTimeout(E.current.setCaretTimeout),clearTimeout(E.current.focusTimeout)}},[]);var M=o,P=function(be,he){var Ce=parseFloat(he);return{formattedValue:be,value:he,floatValue:isNaN(Ce)?void 0:Ce}},A=function(be,he,Ce){be.selectionStart===0&&be.selectionEnd===be.value.length||(Ts(be,he),E.current.setCaretTimeout=setTimeout(function(){be.value===Ce&&be.selectionStart!==he&&Ts(be,he)},0))},g=function(be,he,Ce){return t1(be,he,O(be),Ce)},b=function(be,he,Ce){var qe=O(he),Be=sU(he,G,be,Ce,qe,j,U);return Be=t1(he,Be,qe),Be},B=function(be){var he=be.formattedValue;he===void 0&&(he="");var Ce=be.input,qe=be.source,Be=be.event,Ae=be.numAsString,Re;if(Ce){var Fe=be.inputValue||Ce.value,ft=Ed(Ce);Ce.value=he,Re=b(Fe,he,ft),Re!==void 0&&A(Ce,Re,he)}he!==G&&N(P(he,Ae),{event:Be,source:qe})};Z.useEffect(function(){var be=V.current,he=be.formattedValue,Ce=be.numAsString;(G!==he||re!==Ce)&&N(P(G,re),{event:void 0,source:ja.props})},[G,re]);var se=S.current?Ed(S.current):void 0,te=typeof window<"u"?Z.useLayoutEffect:Z.useEffect;te(function(){var be=S.current;if(G!==V.current.formattedValue&&be){var he=b(V.current.formattedValue,G,se);be.value=G,A(be,he,G)}},[G]);var le=function(be,he,Ce){var qe=he.target,Be=ne.current?eU(ne.current,qe.selectionEnd):q6(G,be),Ae=Object.assign(Object.assign({},Be),{lastValue:G}),Re=a(be,Ae),Fe=M(Re);if(Re=a(Fe,void 0),f&&!f(P(Fe,Re))){var ft=he.target,mt=Ed(ft),$e=b(be,G,mt);return ft.value=G,A(ft,$e,G),!1}return B({formattedValue:Fe,numAsString:Re,inputValue:be,event:he,source:Ce,input:he.target}),!0},xe=function(be,he){he===void 0&&(he=0);var Ce=be.selectionStart,qe=be.selectionEnd;ne.current={selectionStart:Ce,selectionEnd:qe+he}},Se=function(be){var he=be.target,Ce=he.value,qe=le(Ce,be,ja.event);qe&&p(be),ne.current=void 0},Ee=function(be){var he=be.target,Ce=be.key,qe=he.selectionStart,Be=he.selectionEnd,Ae=he.value;Ae===void 0&&(Ae="");var Re;Ce==="ArrowLeft"||Ce==="Backspace"?Re=Math.max(qe-1,0):Ce==="ArrowRight"?Re=Math.min(qe+1,Ae.length):Ce==="Delete"&&(Re=qe);var Fe=0;Ce==="Delete"&&qe===Be&&(Fe=1);var ft=Ce==="ArrowLeft"||Ce==="ArrowRight";if(Re===void 0||qe!==Be&&!ft){y(be),xe(he,Fe);return}var mt=Re;if(ft){var $e=Ce==="ArrowLeft"?"left":"right";mt=g(Ae,Re,$e),mt!==Re&&be.preventDefault()}else Ce==="Delete"&&!j(Ae[Re])?mt=g(Ae,Re,"right"):Ce==="Backspace"&&!j(Ae[Re])&&(mt=g(Ae,Re,"left"));mt!==Re&&A(he,mt,Ae),y(be),xe(he,Fe)},Ye=function(be){var he=be.target,Ce=function(){var qe=he.selectionStart,Be=he.selectionEnd,Ae=he.value;if(Ae===void 0&&(Ae=""),qe===Be){var Re=g(Ae,qe);Re!==qe&&A(he,Re,Ae)}};Ce(),requestAnimationFrame(function(){Ce()}),x(be),xe(he)},De=function(be){be.persist&&be.persist();var he=be.target,Ce=be.currentTarget;S.current=he,E.current.focusTimeout=setTimeout(function(){var qe=he.selectionStart,Be=he.selectionEnd,Ae=he.value;Ae===void 0&&(Ae="");var Re=g(Ae,qe);Re!==qe&&!(qe===0&&Be===Ae.length)&&A(he,Re,Ae),v(Object.assign(Object.assign({},be),{currentTarget:Ce}))},0)},Oe=function(be){S.current=null,clearTimeout(E.current.focusTimeout),clearTimeout(E.current.setCaretTimeout),C(be)},Xe=d&&rU()?"numeric":void 0,Ne=Object.assign({inputMode:Xe},D,{type:t,value:G,onChange:Se,onKeyDown:Ee,onMouseUp:Ye,onFocus:De,onBlur:Oe});if(r==="text")return i?Z.createElement(Z.Fragment,null,i(G,D)||null):Z.createElement("span",Object.assign({},D,{ref:s}),G);if(n){var pt=n;return Z.createElement(pt,Object.assign({},Ne,{ref:s}))}return Z.createElement("input",Object.assign({},Ne,{ref:s}))}function r1(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,i=t.prefix;i===void 0&&(i="");var s=t.suffix;s===void 0&&(s="");var o=t.allowNegative,a=t.thousandsGroupStyle;if(a===void 0&&(a="thousand"),e===""||e==="-")return e;var c=_u(t),l=c.thousandSeparator,u=c.decimalSeparator,f=r!==0&&e.indexOf(".")!==-1||r&&n,p=vh(e,o),y=p.beforeDecimal,x=p.afterDecimal,v=p.addNegation;return r!==void 0&&(x=V6(x,r,!!n)),l&&(y=XB(y,l,a)),i&&(y=i+y),s&&(x=x+s),v&&(y="-"+y),e=y+(f&&u||"")+x,e}function _u(e){var t=e.decimalSeparator;t===void 0&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return r===!0&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function uU(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),i=r.test(e),s=n.test(e);return e=e.replace(/-/g,""),i&&!s&&t&&(e="-"+e),e}function dU(e,t){return new RegExp("(^-)|[0-9]|"+$6(e),t?"g":void 0)}function fU(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function hU(e,t,r){var n;t===void 0&&(t=nU(e));var i=r.allowNegative,s=r.prefix;s===void 0&&(s="");var o=r.suffix;o===void 0&&(o="");var a=r.decimalScale,c=t.from,l=t.to,u=l.start,f=l.end,p=_u(r),y=p.allowedDecimalSeparators,x=p.decimalSeparator,v=e[f]===x;if(Na(e)&&(e===s||e===o)&&t.lastValue==="")return e;if(f-u===1&&y.indexOf(e[u])!==-1){var C=a===0?"":x;e=e.substring(0,u)+C+e.substring(u+1,e.length)}var I=function(S,E,M){var P=!1,A=!1;s.startsWith("-")?P=!1:S.startsWith("--")?(P=!1,A=!0):o.startsWith("-")&&S.length===o.length?P=!1:S[0]==="-"&&(P=!0);var g=P?1:0;return A&&(g=2),g&&(S=S.substring(g),E-=g,M-=g),{value:S,start:E,end:M,hasNegation:P}},O=I(e,u,f),j=O.hasNegation;n=O,e=n.value,u=n.start,f=n.end;var U=I(t.lastValue,c.start,c.end),D=U.start,H=U.end,q=U.value,G=e.substring(u,f);e.length&&q.length&&(D>q.length-o.length||H<s.length)&&!(G&&o.startsWith(G))&&(e=q);var re=0;e.startsWith(s)?re+=s.length:u<s.length&&(re=u),e=e.substring(re),f-=re;var ae=e.length,ne=e.length-o.length;e.endsWith(o)?ae=ne:(f>ne||f>e.length-o.length)&&(ae=f),e=e.substring(0,ae),e=uU(j?"-"+e:e,i),e=(e.match(dU(x,!0))||[]).join("");var V=e.indexOf(x);e=e.replace(new RegExp($6(x),"g"),function(S,E){return E===V?".":""});var N=vh(e,i),h=N.beforeDecimal,d=N.afterDecimal,m=N.addNegation;return l.end-l.start<c.end-c.start&&h===""&&v&&!parseFloat(d)&&(e=m?"-":""),e}function pU(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var i=Array.from({length:e.length+1}).map(function(){return!0}),s=e[0]==="-";i.fill(!1,0,r.length+(s?1:0));var o=e.length;return i.fill(!1,o-n.length+1,o+1),i}function mU(e){var t=_u(e),r=t.thousandSeparator,n=t.decimalSeparator,i=e.prefix;i===void 0&&(i="");var s=e.allowNegative;if(s===void 0&&(s=!0),r===n)throw new Error(`
|
|
103
103
|
Decimal separator can't be same as thousand separator.
|
|
104
104
|
thousandSeparator: `+r+` (thousandSeparator = {true} is same as thousandSeparator = ",")
|
|
105
105
|
decimalSeparator: `+n+` (default value for decimalSeparator is .)
|
|
@@ -107,4 +107,4 @@ body { background-color: var(--color-page-background); }
|
|
|
107
107
|
Prefix can't start with '-' when allowNegative is true.
|
|
108
108
|
prefix: `+i+`
|
|
109
109
|
allowNegative: `+s+`
|
|
110
|
-
`),s=!1),Object.assign(Object.assign({},e),{allowNegative:s})}function gU(e){e=mU(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=ts);var s=e.onBlur;s===void 0&&(s=ts);var o=e.thousandSeparator,a=e.decimalScale,c=e.fixedDecimalScale,l=e.prefix;l===void 0&&(l="");var u=e.defaultValue,f=e.value,p=e.valueIsNumericString,y=e.onValueChange,x=U6(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),v=_u(e),C=v.decimalSeparator,I=v.allowedDecimalSeparators,O=function(m){return r1(m,e)},j=function(m,S){return hU(m,S,e)},U=So(f)?u:f,D=p??fU(U,l,t);So(f)?So(u)||(D=D||typeof u=="number"):D=D||typeof f=="number";var H=function(m){return F6(m)?m:(typeof m=="number"&&(m=z6(m)),D&&typeof a=="number"?e1(m,a,!!c):m)},q=W6(H(f),H(u),!!D,O,j,y),G=q[0],re=G.numAsString,ae=G.formattedValue,ne=q[1],V=function(m){var S=m.target,E=m.key,M=S.selectionStart,P=S.selectionEnd,A=S.value;if(A===void 0&&(A=""),(E==="Backspace"||E==="Delete")&&P<l.length){m.preventDefault();return}if(M!==P){i(m);return}E==="Backspace"&&A[0]==="-"&&M===l.length+1&&r&&Ts(S,1),a&&c&&(E==="Backspace"&&A[M-1]===C?(Ts(S,M-1),m.preventDefault()):E==="Delete"&&A[M]===C&&m.preventDefault()),I!=null&&I.includes(E)&&A[M]===C&&Ts(S,M+1);var g=o===!0?",":o;E==="Backspace"&&A[M-1]===g&&Ts(S,M-1),E==="Delete"&&A[M]===g&&Ts(S,M+1),i(m)},N=function(m){var S=re;if(S.match(/\d/g)||(S=""),n||(S=QB(S)),c&&a&&(S=e1(S,a,c)),S!==re){var E=r1(S,e);ne({formattedValue:E,value:S,floatValue:parseFloat(S)},{event:m,source:ja.event})}s(m)},h=function(m){return m===C?!0:Na(m)},d=function(m){var S=m.currentValue,E=m.lastValue,M=m.formattedValue,P=m.currentValueIndex,A=m.formattedValueIndex,g=S[P],b=M[A],B=q6(E,S),se=B.to,te=function(le){return j(le).indexOf(".")+l.length};return f===0&&c&&a&&S[se.start]===C&&te(S)<P&&te(M)>A?!1:P>=se.start&&P<se.end&&I&&I.includes(g)&&b===C?!0:g===b};return Object.assign(Object.assign({},x),{value:ae,valueIsNumericString:!1,isValidInputCharacter:h,isCharacterSame:d,onValueChange:ne,format:O,removeFormatting:j,getCaretBoundary:function(m){return pU(m,e)},onKeyDown:V,onBlur:N})}function bU(e){var t=gU(e);return Z.createElement(lU,Object.assign({},t))}function vU(e){const{className:t,value:r,decimals:n,placeholder:i,style:s,onChange:o,maxValue:a,minValue:c=0,inputAllowed:l=!0,prefix:u,...f}=e,p=y=>{var C;const x=((C=y==null?void 0:y.target)==null?void 0:C.value)||"";let v=x;if(x.startsWith("0")&&x!=="0"&&!x.startsWith("0.")&&(v=x.replace(/^0+/,"")),v){if(v.startsWith(".")){o(v.slice(1,v.length));return}let I=String(v).replace(/,/g,"");if(I.startsWith("-")){o("");return}u&&(I=I.replace(u,"")),a!==void 0&&Me(I).gt(a)?I=a.toString():c!==void 0&&Me(I).lt(c)&&(I=c.toString()),o(String(I))}else o("")};return w.jsx(bU,{className:t,value:r,disabled:!l,placeholder:i,decimalScale:n,prefix:u,allowLeadingZeros:!0,thousandSeparator:",",isAllowed:y=>!y.value.startsWith("-"),onChange:p,...f,style:{...s,cursor:l?"pointer":"not-allowed",fontFamily:"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji",fontFeatureSettings:"tnum",fontVariant:"tabular-nums"}})}function yU(e){const{token:t,handleTokenSelectClick:r}=e;return w.jsxs("div",{className:"token-select-block",onClick:()=>{r&&r()},children:[w.jsx("div",{className:"token-img-box",children:w.jsx(Pr,{src:t==null?void 0:t.logo_url,token:t,showWarnSize:"16px"})},t==null?void 0:t.coin_type),w.jsx("div",{className:"name",children:w.jsxs("h4",{className:"truncate-text",children:[" ",(t==null?void 0:t.symbol)||"Select"]})}),w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-arrow"})})]})}function n1({label:e,amount:t,amountValue:r,balance:n,onInputChange:i,handleTokenSelectClick:s,token:o,loading:a=!1,showMax:c=!0,showHalf:l=!0,inputAllowed:u=!0,marginTop:f}){const[p,y]=Z.useState(!1),{currentAccount:x}=qr(),v=()=>{const I=Me((n==null?void 0:n.totalBalanceFormat)||"0").div(2),O=Dr(I.toString(),o==null?void 0:o.decimals,!0).toString();t&&Me(O).eq(t)||i(O)},C=()=>{const I=Me((n==null?void 0:n.totalBalanceFormat)||0),O=ur((o==null?void 0:o.coin_type)||"").full_address===El,j=.05;let U=I;O&&Me(I).gt(j)&&(U=U.sub(j)),!(t&&Me(U).eq(t))&&Me(U).gte(0)&&i(U.toString())};return w.jsxs("div",{className:p?"active trade-input-box":"trade-input-box",style:{backgroundColor:u?"var(--cs-input-bg-normal)":"var(--cs-input-disabled-bg)",marginTop:f},children:[w.jsxs("div",{className:"title",children:[" ",e," "]}),w.jsxs("div",{className:"token-input",children:[a?w.jsxs("div",{style:{flex:1},children:[" ",w.jsx($o,{className:"custom-skeleton",style:{width:"150px",height:"28px",flex:1}})," "]}):w.jsx(vU,{inputAllowed:u,value:t,decimals:(o==null?void 0:o.decimals)||9,placeholder:"0.0",className:"input",onChange:i,onFocus:()=>y(!0),onBlur:()=>y(!1)}),w.jsx(yU,{token:o,handleTokenSelectClick:s})]}),w.jsxs("div",{className:"info-box",children:[!a&&r&&Me(r).gt(0)?w.jsx("div",{className:"input-rate",style:{marginTop:"8px"},children:Yv(r,2)}):w.jsx("div",{}),x&&o&&w.jsxs("div",{style:{display:"flex",flexDirection:"row",marginTop:"8px"},children:[w.jsxs("div",{className:"token-balance",children:[w.jsx("svg",{className:"icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-wallet"})}),w.jsx("span",{children:(n==null?void 0:n.displayBalance)||0})]}),w.jsxs("div",{className:"btn-box",children:[l&&w.jsx("button",{className:"cs-outline-btn",onClick:v,children:"HALF"}),c&&w.jsx("button",{className:"cs-outline-btn",onClick:C,children:"MAX"})]})]})]})]})}function wU({refreshCount:e,customWallet:t,initProps:r}){const{currentAccount:n,onWalletModal:i}=qr(),{getOwnerCoinBalances:s}=Sa(),{fromCoin:o,toCoin:a,fromAmount:c,toAmount:l,findRouterLoading:u,byAmountIn:f,routerData:p,isOpenSecondary:y,setIsOpenSecondary:x,isOpenTokensDialog:v,setIsOpenTokensDialog:C}=en(),{handleAmountChange:I,handleSelectToken:O,fromBalanceInfo:j,toBalanceInfo:U,fromAmountValue:D,toAmountValue:H,doSwapAction:q,reCalculateRouteData:G,refreshMarketPrice:re,scamsText:ae}=YP(),{slippage:ne}=zr(),{isCustomMode:V,customWarnTokenList:N}=SP(o==null?void 0:o.coin_type,a==null?void 0:a.coin_type),{amountLimit:h}=Zw(ne,p),{formatSwapRouter:d}=wP(p),[m,S]=Z.useState(!1),{btnText:E,btnDisabled:M}=JP(j==null?void 0:j.totalBalanceFormat),[P,A]=Z.useState(!1),[g,b]=Z.useState(!1);Z.useEffect(()=>{y?e>=5&&B():e>=20&&B()},[e]);const B=()=>{G(),n&&s(),re()},se=()=>({...p}),te=async()=>{a&&O(a,!0)};return w.jsxs("div",{className:"swap-trade-box",children:[w.jsxs("div",{className:"trade-form",style:{flexDirection:"column"},children:[w.jsx(n1,{loading:!f&&u,balance:j,amountValue:D,handleTokenSelectClick:()=>{A(!0),C(!0)},onInputChange:le=>{I(le,!0)},amount:c,token:o}),w.jsx("div",{onClick:te,className:"swap-icon",onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),style:{cursor:"pointer"},children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{transform:m?"rotate(90deg)":"none",width:m?"16px":"14px",height:m?"16px":"14px"},children:w.jsx("use",{xlinkHref:m?"#icon-swap":"#icon-trade"})})}),w.jsx(n1,{marginTop:"-20px",loading:f&&u,balance:U,showHalf:!1,showMax:!1,amountValue:H,handleTokenSelectClick:()=>{A(!1),C(!0)},onInputChange:le=>{I(le,!1)},inputAllowed:!1,amount:l,token:a})]}),ae&&w.jsx(QP,{scamsText:ae}),w.jsxs("div",{className:"swap-bottom-block",style:{border:M?"0px solid var(--cs-border)":"1px solid var(--cs-border)"},children:[w.jsx("button",{className:"cs-solid-btn swap-btn",style:{marginTop:"0px"},disabled:M||u,onClick:()=>{n?V&&N.length>0?b(!0):x(!0):t!=null&&t.connect?t.connect():i(!0)},children:u?w.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:w.jsx(T0,{})}):E}),c&&l&&Me(c).gt(0)&&Me(l).gt(0)&&w.jsxs("div",{className:"content",children:[w.jsxs("div",{className:"price-related-info",children:[p&&!(p!=null&&p.errorCode)&&w.jsx(ah,{baseToken:o,quoteToken:a,baseAmount:p.fromAmountUi||"",quoteAmount:p.toAmountUi||"",loading:u}),w.jsx(i6,{isLoading:u,routerData:p})]}),w.jsx(s6,{isLoading:u,amountLimit:h}),w.jsx(L6,{hasSubMenu:!0,formatSwapRouter:d,isLoading:u})]})]}),w.jsx(XP,{themeType:r==null?void 0:r.themeType}),y&&w.jsx(mB,{data:se(),toBack:()=>x(!1),onSubmitClick:async le=>{try{await q(le,r==null?void 0:r.partner)}finally{x(!1)}}}),v&&w.jsx(WB,{currToken:P?o:a,backClick:()=>C(!1),onSelectToken:le=>{O(le,P),C(!1)}}),g&&N.length>0&&w.jsx(GB,{onClose:()=>{b(!1)},tokenList:N,onSureClick:()=>{b(!1),x(!0)}})]})}const xU=(e,t)=>{const r={...e};return r.primary_10=Fr(e.primary,.1),r.primary_20=Fr(e.primary,.2),r.primary_50=Fr(e.primary,.5),r.primary_80=Fr(e.primary,.8),r.btn_disabled_bg=Fr(e.primary,.2),r["btn-hover-bg"]=Fr(e.primary,.8),r.success_10=Fr(e.success,.1),r.warning_10=Fr(e.warning,.1),r.error_10=Fr(e.error,.1),t==="Light"?(r.bg_secondary="#72C1F7",r.bg_secondary_common=Fr(e.primary,.1),r.input_bg_normal=Fr(e.primary,.1),r.border="rgba(0,0,0,0.1)",r.icon_fill=Fr(e.text_secondary,1),r.text_placeholder="rgba(0,0,0,0.5)",r.btn_disabled_text=Fr(e.text_primary,.5)):(r.bg_secondary="#000",r.bg_secondary_common="rgba(0, 0, 0,0.2)",r.input_bg_normal="rgba(0, 0, 0,0.3)",r.border="rgba(255,255,255,0.1)",r.icon_fill=Fr(e.text_secondary,1),r.text_placeholder="rgba(255,255,255,0.5)",r.btn_disabled_text=Fr(e.text_primary,.5)),r},Fr=(e,t)=>{const r=e.replace("#",""),n=parseInt(r.substring(0,2),16),i=parseInt(r.substring(2,4),16),s=parseInt(r.substring(4,6),16);return`rgba(${n}, ${i}, ${s}, ${t})`},SU=(e,t)=>{let r=":root {";const n=xU(e,t);return Object.entries(n).forEach(([i,s])=>{s&&(r+=`--cs-${i.split("_").join("-")}: ${s};`)}),r+="}",r},i1=e=>{const t=document.createElement("style");t.id="dynamic-theme",t.textContent=e;const r=document.getElementById("dynamic-theme");r&&r.remove(),document.head.appendChild(t)},_U=({theme:e,children:t,themeType:r})=>(Z.useEffect(()=>{if(!e||!r)return;const n=SU(e,r);if("adoptedStyleSheets"in document){const i=new CSSStyleSheet;try{return i.replaceSync(n),document.adoptedStyleSheets=[...document.adoptedStyleSheets,i],()=>{document.adoptedStyleSheets=document.adoptedStyleSheets.filter(s=>s!==i)}}catch(s){console.warn("CSSStyleSheet error:",s),i1(n)}}else i1(n)},[e,r]),w.jsx(w.Fragment,{children:t}));function EU({initProps:e={},customWallet:t}){oP();const{ToastContainer:r}=Bo(),{fetchRouterConfig:n}=ZR(),{getTrustTokens:i}=bs(),{transactionData:s,setTransactionData:o}=ih(),{isOpenSecondary:a,fromCoin:c,toAmount:l,toCoin:u,fromAmount:f}=en(),[p,y]=Z.useState(0),x=Z.useRef(p);sP(e),Z.useEffect(()=>{i(),n()},[]),Z.useEffect(()=>{x.current=0},[c==null?void 0:c.coin_type,u==null?void 0:u.coin_type,f,l]),QR({interval:1e3,callback:()=>{x.current=x.current+1,a?x.current>=5&&v():x.current>=20&&v()}});const v=()=>{x.current=20,y(20),setTimeout(()=>{x.current=0,y(0)},20)};return w.jsx(w.Fragment,{children:w.jsxs("div",{className:"cs-swap-container",id:"cs-swap-widget",children:[w.jsx(KR,{independentWallet:!!(e!=null&&e.independentWallet),customWallet:t,logo:e==null?void 0:e.logo}),w.jsx(jR,{handleRefresh:v,themeType:e==null?void 0:e.themeType}),w.jsx(wU,{refreshCount:p,customWallet:t,initProps:e}),s&&w.jsx(YR,{transactionData:s,onClose:()=>{o(void 0)}}),w.jsx(r,{})]})})}function yh({initProps:e={},customWallet:t}){var o;rP();const{getOwnerCoinBalances:r}=Sa(),n=Kr.useCurrentAccount(),{saveCurrentAccount:i}=qr(),{mutate:s}=Kr.useConnectWallet();return Z.useEffect(()=>{i(n||void 0),r(n==null?void 0:n.address)},[n]),Z.useEffect(()=>{var a;t&&((a=t==null?void 0:t.currentAccount)==null?void 0:a.address)!==(n==null?void 0:n.address)&&s({wallet:t==null?void 0:t.currentWallet},{onSuccess:()=>{}})},[(o=t==null?void 0:t.currentAccount)==null?void 0:o.address,n==null?void 0:n.address]),w.jsx(_U,{theme:e.theme,themeType:e.themeType,children:w.jsx(EU,{initProps:e,customWallet:t})})}function CU({initProps:e,customWallet:t}){const[r,n]=Z.useState(!0);return w.jsxs("div",{className:r?"export-modal-container":"export-modal-container none",children:[r&&w.jsx("div",{className:"swap-modal-box",children:w.jsx(yh,{initProps:e,customWallet:t})}),w.jsx("div",{className:"swap-modal-mask",onClick:()=>n(!1)})]})}function TU({size:e,direction:t,initProps:r,customWallet:n}){const[i,s]=Z.useState(!1),o=()=>{s(!i)};return w.jsxs("div",{className:"widget-btn-box",children:[w.jsx("div",{className:`img-btn ${e} ${t}`,onClick:o,children:i?w.jsx("svg",{className:"icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-unfold"})}):w.jsx("img",{src:Mt("/images/img-logo@2x.png")})}),i&&w.jsx("div",{className:`widget-modal ${t} ${e}`,children:w.jsx(yh,{initProps:r,customWallet:n})})]})}function MU({initProps:e={},customWallet:t}){const{displayMode:r,widgetBtnDirection:n,widgetBtnSize:i}=e;return w.jsxs(nu,{appearance:"dark",children:[r==="Integrated"&&w.jsx(yh,{initProps:e,customWallet:t}),r==="Widget"&&w.jsx(TU,{initProps:e,customWallet:t,direction:n||"right-bottom",size:i||"Default"}),(!r||r==="Modal")&&w.jsx(CU,{initProps:e,customWallet:t})]})}const AU=MU;exports.CetusSwap=AU;
|
|
110
|
+
`),s=!1),Object.assign(Object.assign({},e),{allowNegative:s})}function gU(e){e=mU(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=ts);var s=e.onBlur;s===void 0&&(s=ts);var o=e.thousandSeparator,a=e.decimalScale,c=e.fixedDecimalScale,l=e.prefix;l===void 0&&(l="");var u=e.defaultValue,f=e.value,p=e.valueIsNumericString,y=e.onValueChange,x=U6(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),v=_u(e),C=v.decimalSeparator,I=v.allowedDecimalSeparators,O=function(m){return r1(m,e)},j=function(m,S){return hU(m,S,e)},U=So(f)?u:f,D=p??fU(U,l,t);So(f)?So(u)||(D=D||typeof u=="number"):D=D||typeof f=="number";var H=function(m){return F6(m)?m:(typeof m=="number"&&(m=z6(m)),D&&typeof a=="number"?e1(m,a,!!c):m)},q=W6(H(f),H(u),!!D,O,j,y),G=q[0],re=G.numAsString,ae=G.formattedValue,ne=q[1],V=function(m){var S=m.target,E=m.key,M=S.selectionStart,P=S.selectionEnd,A=S.value;if(A===void 0&&(A=""),(E==="Backspace"||E==="Delete")&&P<l.length){m.preventDefault();return}if(M!==P){i(m);return}E==="Backspace"&&A[0]==="-"&&M===l.length+1&&r&&Ts(S,1),a&&c&&(E==="Backspace"&&A[M-1]===C?(Ts(S,M-1),m.preventDefault()):E==="Delete"&&A[M]===C&&m.preventDefault()),I!=null&&I.includes(E)&&A[M]===C&&Ts(S,M+1);var g=o===!0?",":o;E==="Backspace"&&A[M-1]===g&&Ts(S,M-1),E==="Delete"&&A[M]===g&&Ts(S,M+1),i(m)},N=function(m){var S=re;if(S.match(/\d/g)||(S=""),n||(S=QB(S)),c&&a&&(S=e1(S,a,c)),S!==re){var E=r1(S,e);ne({formattedValue:E,value:S,floatValue:parseFloat(S)},{event:m,source:ja.event})}s(m)},h=function(m){return m===C?!0:Na(m)},d=function(m){var S=m.currentValue,E=m.lastValue,M=m.formattedValue,P=m.currentValueIndex,A=m.formattedValueIndex,g=S[P],b=M[A],B=q6(E,S),se=B.to,te=function(le){return j(le).indexOf(".")+l.length};return f===0&&c&&a&&S[se.start]===C&&te(S)<P&&te(M)>A?!1:P>=se.start&&P<se.end&&I&&I.includes(g)&&b===C?!0:g===b};return Object.assign(Object.assign({},x),{value:ae,valueIsNumericString:!1,isValidInputCharacter:h,isCharacterSame:d,onValueChange:ne,format:O,removeFormatting:j,getCaretBoundary:function(m){return pU(m,e)},onKeyDown:V,onBlur:N})}function bU(e){var t=gU(e);return Z.createElement(lU,Object.assign({},t))}function vU(e){const{className:t,value:r,decimals:n,placeholder:i,style:s,onChange:o,maxValue:a,minValue:c=0,inputAllowed:l=!0,prefix:u,...f}=e,p=y=>{var C;const x=((C=y==null?void 0:y.target)==null?void 0:C.value)||"";let v=x;if(x.startsWith("0")&&x!=="0"&&!x.startsWith("0.")&&(v=x.replace(/^0+/,"")),v){if(v.startsWith(".")){o(v.slice(1,v.length));return}let I=String(v).replace(/,/g,"");if(I.startsWith("-")){o("");return}u&&(I=I.replace(u,"")),a!==void 0&&Me(I).gt(a)?I=a.toString():c!==void 0&&Me(I).lt(c)&&(I=c.toString()),o(String(I))}else o("")};return w.jsx(bU,{className:t,value:r,disabled:!l,placeholder:i,decimalScale:n,prefix:u,allowLeadingZeros:!0,thousandSeparator:",",isAllowed:y=>!y.value.startsWith("-"),onChange:p,...f,style:{...s,cursor:l?"pointer":"not-allowed",fontFamily:"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji",fontFeatureSettings:"tnum",fontVariant:"tabular-nums"}})}function yU(e){const{token:t,handleTokenSelectClick:r}=e;return w.jsxs("div",{className:"token-select-block",onClick:()=>{r&&r()},children:[w.jsx("div",{className:"token-img-box",children:w.jsx(Pr,{src:t==null?void 0:t.logo_url,token:t,showWarnSize:"16px"})},t==null?void 0:t.coin_type),w.jsx("div",{className:"name",children:w.jsxs("h4",{className:"truncate-text",children:[" ",(t==null?void 0:t.symbol)||"Select"]})}),w.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-arrow"})})]})}function n1({label:e,amount:t,amountValue:r,balance:n,onInputChange:i,handleTokenSelectClick:s,token:o,loading:a=!1,showMax:c=!0,showHalf:l=!0,inputAllowed:u=!0,marginTop:f}){const[p,y]=Z.useState(!1),{currentAccount:x}=qr(),v=()=>{const I=Me((n==null?void 0:n.totalBalanceFormat)||"0").div(2),O=Dr(I.toString(),o==null?void 0:o.decimals,!0).toString();t&&Me(O).eq(t)||i(O)},C=()=>{const I=Me((n==null?void 0:n.totalBalanceFormat)||0),O=ur((o==null?void 0:o.coin_type)||"").full_address===El,j=.05;let U=I;O&&Me(I).gt(j)&&(U=U.sub(j)),!(t&&Me(U).eq(t))&&Me(U).gte(0)&&i(U.toString())};return w.jsxs("div",{className:p?"active trade-input-box":"trade-input-box",style:{backgroundColor:u?"var(--cs-input-bg-normal)":"var(--cs-input-disabled-bg)",marginTop:f},children:[w.jsxs("div",{className:"title",children:[" ",e," "]}),w.jsxs("div",{className:"token-input",children:[a?w.jsxs("div",{style:{flex:1},children:[" ",w.jsx($o,{className:"custom-skeleton",style:{width:"150px",height:"28px",flex:1}})," "]}):w.jsx(vU,{inputAllowed:u,value:t,decimals:(o==null?void 0:o.decimals)||9,placeholder:"0.0",className:"input",onChange:i,onFocus:()=>y(!0),onBlur:()=>y(!1)}),w.jsx(yU,{token:o,handleTokenSelectClick:s})]}),w.jsxs("div",{className:"info-box",children:[!a&&r&&Me(r).gt(0)?w.jsx("div",{className:"input-rate",style:{marginTop:"8px"},children:Yv(r,2)}):w.jsx("div",{}),x&&o&&w.jsxs("div",{style:{display:"flex",flexDirection:"row",marginTop:"8px"},children:[w.jsxs("div",{className:"token-balance",children:[w.jsx("svg",{className:"icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-wallet"})}),w.jsx("span",{children:(n==null?void 0:n.displayBalance)||0})]}),w.jsxs("div",{className:"btn-box",children:[l&&w.jsx("button",{className:"cs-outline-btn",onClick:v,children:"HALF"}),c&&w.jsx("button",{className:"cs-outline-btn",onClick:C,children:"MAX"})]})]})]})]})}function wU({refreshCount:e,customWallet:t,initProps:r}){const{currentAccount:n,onWalletModal:i}=qr(),{getOwnerCoinBalances:s}=Sa(),{fromCoin:o,toCoin:a,fromAmount:c,toAmount:l,findRouterLoading:u,byAmountIn:f,routerData:p,isOpenSecondary:y,setIsOpenSecondary:x,isOpenTokensDialog:v,setIsOpenTokensDialog:C}=en(),{handleAmountChange:I,handleSelectToken:O,fromBalanceInfo:j,toBalanceInfo:U,fromAmountValue:D,toAmountValue:H,doSwapAction:q,reCalculateRouteData:G,refreshMarketPrice:re,scamsText:ae}=YP(),{slippage:ne}=zr(),{isCustomMode:V,customWarnTokenList:N}=SP(o==null?void 0:o.coin_type,a==null?void 0:a.coin_type),{amountLimit:h}=Zw(ne,p),{formatSwapRouter:d}=wP(p),[m,S]=Z.useState(!1),{btnText:E,btnDisabled:M}=JP(j==null?void 0:j.totalBalanceFormat),[P,A]=Z.useState(!1),[g,b]=Z.useState(!1);Z.useEffect(()=>{y?e>=5&&B():e>=20&&B()},[e]);const B=()=>{G(),n&&s(),re()},se=()=>({...p}),te=async()=>{a&&O(a,!0)};return w.jsxs("div",{className:"swap-trade-box",children:[w.jsxs("div",{className:"trade-form",style:{flexDirection:"column"},children:[w.jsx(n1,{loading:!f&&u,balance:j,amountValue:D,handleTokenSelectClick:()=>{A(!0),C(!0)},onInputChange:le=>{I(le,!0)},amount:c,token:o}),w.jsx("div",{onClick:te,className:"swap-icon",onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),style:{cursor:"pointer"},children:w.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{transform:m?"rotate(90deg)":"none",width:m?"16px":"14px",height:m?"16px":"14px"},children:w.jsx("use",{xlinkHref:m?"#icon-swap":"#icon-trade"})})}),w.jsx(n1,{marginTop:"-20px",loading:f&&u,balance:U,showHalf:!1,showMax:!1,amountValue:H,handleTokenSelectClick:()=>{A(!1),C(!0)},onInputChange:le=>{I(le,!1)},inputAllowed:!1,amount:l,token:a})]}),ae&&w.jsx(QP,{scamsText:ae}),w.jsxs("div",{className:"swap-bottom-block",style:{border:M?"0px solid var(--cs-border)":"1px solid var(--cs-border)"},children:[w.jsx("button",{className:"cs-solid-btn swap-btn",style:{marginTop:"0px"},disabled:M||u,onClick:()=>{n?V&&N.length>0?b(!0):x(!0):t!=null&&t.connect?t.connect():i(!0)},children:u?w.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:w.jsx(T0,{})}):E}),c&&l&&Me(c).gt(0)&&Me(l).gt(0)&&w.jsxs("div",{className:"content",children:[w.jsxs("div",{className:"price-related-info",children:[p&&!(p!=null&&p.errorCode)&&w.jsx(ah,{baseToken:o,quoteToken:a,baseAmount:p.fromAmountUi||"",quoteAmount:p.toAmountUi||"",loading:u}),w.jsx(i6,{isLoading:u,routerData:p})]}),w.jsx(s6,{isLoading:u,amountLimit:h}),w.jsx(L6,{hasSubMenu:!0,formatSwapRouter:d,isLoading:u})]})]}),w.jsx(XP,{themeType:r==null?void 0:r.themeType}),y&&w.jsx(mB,{data:se(),toBack:()=>x(!1),onSubmitClick:async le=>{try{await q(le,r==null?void 0:r.partner)}finally{x(!1)}}}),v&&w.jsx(WB,{currToken:P?o:a,backClick:()=>C(!1),onSelectToken:le=>{O(le,P),C(!1)}}),g&&N.length>0&&w.jsx(GB,{onClose:()=>{b(!1)},tokenList:N,onSureClick:()=>{b(!1),x(!0)}})]})}const xU=(e,t)=>{const r={...e};return r.primary_10=Fr(e.primary,.1),r.primary_20=Fr(e.primary,.2),r.primary_50=Fr(e.primary,.5),r.primary_80=Fr(e.primary,.8),r.btn_disabled_bg=Fr(e.primary,.2),r["btn-hover-bg"]=Fr(e.primary,.8),r.success_10=Fr(e.success,.1),r.warning_10=Fr(e.warning,.1),r.error_10=Fr(e.error,.1),t==="Light"?(r.bg_secondary="#72C1F7",r.bg_secondary_common=Fr(e.primary,.1),r.input_bg_normal=Fr(e.primary,.1),r.border="rgba(0,0,0,0.1)",r.icon_fill=Fr(e.text_secondary,1),r.text_placeholder="rgba(0,0,0,0.5)",r.btn_disabled_text=Fr(e.text_primary,.5)):(r.bg_secondary="#000",r.bg_secondary_common="rgba(0, 0, 0,0.2)",r.input_bg_normal="rgba(0, 0, 0,0.3)",r.border="rgba(255,255,255,0.1)",r.icon_fill=Fr(e.text_secondary,1),r.text_placeholder="rgba(255,255,255,0.5)",r.btn_disabled_text=Fr(e.text_primary,.5)),r},Fr=(e,t)=>{const r=e.replace("#",""),n=parseInt(r.substring(0,2),16),i=parseInt(r.substring(2,4),16),s=parseInt(r.substring(4,6),16);return`rgba(${n}, ${i}, ${s}, ${t})`},SU=(e,t)=>{let r=":root {";const n=xU(e,t);return Object.entries(n).forEach(([i,s])=>{s&&(r+=`--cs-${i.split("_").join("-")}: ${s};`)}),r+="}",r},i1=e=>{const t=document.createElement("style");t.id="dynamic-theme",t.textContent=e;const r=document.getElementById("dynamic-theme");r&&r.remove(),document.head.appendChild(t)},_U=({theme:e,children:t,themeType:r})=>(Z.useEffect(()=>{if(!e||!r)return;const n=SU(e,r);if("adoptedStyleSheets"in document){const i=new CSSStyleSheet;try{return i.replaceSync(n),document.adoptedStyleSheets=[...document.adoptedStyleSheets,i],()=>{document.adoptedStyleSheets=document.adoptedStyleSheets.filter(s=>s!==i)}}catch(s){console.warn("CSSStyleSheet error:",s),i1(n)}}else i1(n)},[e,r]),w.jsx(w.Fragment,{children:t}));function EU({initProps:e={},customWallet:t}){oP(e);const{ToastContainer:r}=Bo(),{fetchRouterConfig:n}=ZR(),{getTrustTokens:i}=bs(),{transactionData:s,setTransactionData:o}=ih(),{isOpenSecondary:a,fromCoin:c,toAmount:l,toCoin:u,fromAmount:f}=en(),[p,y]=Z.useState(0),x=Z.useRef(p);sP(e),Z.useEffect(()=>{i(),n()},[]),Z.useEffect(()=>{x.current=0},[c==null?void 0:c.coin_type,u==null?void 0:u.coin_type,f,l]),QR({interval:1e3,callback:()=>{x.current=x.current+1,a?x.current>=5&&v():x.current>=20&&v()}});const v=()=>{x.current=20,y(20),setTimeout(()=>{x.current=0,y(0)},20)};return w.jsx(w.Fragment,{children:w.jsxs("div",{className:"cs-swap-container",id:"cs-swap-widget",children:[w.jsx(KR,{independentWallet:!!(e!=null&&e.independentWallet),customWallet:t,logo:e==null?void 0:e.logo}),w.jsx(jR,{handleRefresh:v,themeType:e==null?void 0:e.themeType}),w.jsx(wU,{refreshCount:p,customWallet:t,initProps:e}),s&&w.jsx(YR,{transactionData:s,onClose:()=>{o(void 0)}}),w.jsx(r,{})]})})}function yh({initProps:e={},customWallet:t}){var o;rP();const{getOwnerCoinBalances:r}=Sa(),n=Kr.useCurrentAccount(),{saveCurrentAccount:i}=qr(),{mutate:s}=Kr.useConnectWallet();return Z.useEffect(()=>{i(n||void 0),r(n==null?void 0:n.address)},[n]),Z.useEffect(()=>{var a;t&&((a=t==null?void 0:t.currentAccount)==null?void 0:a.address)!==(n==null?void 0:n.address)&&s({wallet:t==null?void 0:t.currentWallet},{onSuccess:()=>{}})},[(o=t==null?void 0:t.currentAccount)==null?void 0:o.address,n==null?void 0:n.address]),w.jsx(_U,{theme:e.theme,themeType:e.themeType,children:w.jsx(EU,{initProps:e,customWallet:t})})}function CU({initProps:e,customWallet:t}){const[r,n]=Z.useState(!0);return w.jsxs("div",{className:r?"export-modal-container":"export-modal-container none",children:[r&&w.jsx("div",{className:"swap-modal-box",children:w.jsx(yh,{initProps:e,customWallet:t})}),w.jsx("div",{className:"swap-modal-mask",onClick:()=>n(!1)})]})}function TU({size:e,direction:t,initProps:r,customWallet:n}){const[i,s]=Z.useState(!1),o=()=>{s(!i)};return w.jsxs("div",{className:"widget-btn-box",children:[w.jsx("div",{className:`img-btn ${e} ${t}`,onClick:o,children:i?w.jsx("svg",{className:"icon","aria-hidden":"true",children:w.jsx("use",{xlinkHref:"#icon-unfold"})}):w.jsx("img",{src:Mt("/images/img-logo@2x.png")})}),i&&w.jsx("div",{className:`widget-modal ${t} ${e}`,children:w.jsx(yh,{initProps:r,customWallet:n})})]})}function MU({initProps:e={},customWallet:t}){const{displayMode:r,widgetBtnDirection:n,widgetBtnSize:i}=e;return w.jsxs(nu,{appearance:"dark",children:[r==="Integrated"&&w.jsx(yh,{initProps:e,customWallet:t}),r==="Widget"&&w.jsx(TU,{initProps:e,customWallet:t,direction:n||"right-bottom",size:i||"Default"}),(!r||r==="Modal")&&w.jsx(CU,{initProps:e,customWallet:t})]})}const AU=MU;exports.CetusSwap=AU;
|