1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3581],{74721:function(e,t,n){"use strict";var r=n(64836);t.Z=void 0;var a=r(n(64938)),i=n(85893),s=(0,a.default)((0,i.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"}),"Info");t.Z=s},31895:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/junction/automatic/[vaultId]",function(){return n(89110)}])},12260:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(85893),a=n(87357),i=n(15054);function s(e){let{props:t}=e;return(0,r.jsx)(a.Z,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",width:"100%",py:2},children:(0,r.jsx)(i.Z,{...t,color:"primary",shape:"rounded",showFirstButton:!0,showLastButton:!0})})}},33682:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(85893),a=n(87357),i=n(8423),s=n(21990);function o(e){let{children:t,props:n}=e;return(0,r.jsx)(a.Z,{...n,sx:(0,s.jM)([{overflow:"auto scroll","&::-webkit-scrollbar":{width:"2px"},"&::-webkit-scrollbar:horizontal":{height:2},"&::-webkit-scrollbar-thumb, &::-webkit-scrollbar-corner":{backgroundColor:(0,i._j)("#DADDE1",.4)}},null==n?void 0:n.sx]),children:t})}},12152:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(85893),a=n(61903),i=n(70811);function s(e){let{props:t}=e;return(0,r.jsx)(a.Z,{...t,InputProps:{startAdornment:(0,r.jsx)(i.Z,{sx:{color:"text.secondary"}})}})}},43954:function(e,t,n){"use strict";n.d(t,{u:function(){return u}});var r=n(6154),a=n(70794),i=n(79554),s=n(67294),o=n(91444),d=n(68987),l=n(18042),c=n(21293),x=n(84410),p=n(43408);function u(){let e=(0,c.T)(),{EOAAddress:t,smartWalletAddress:n}=(0,c.C)(e=>e.user),u=(0,c.C)(e=>e.config.chainId),m=(0,s.useCallback)(async()=>{try{if(e((0,x.bd)({travaStakingVault:"FETCHING"})),(0,i.UJ)(t)&&u>0){let n=await d.wM.get("/user/dapp?chain_id=".concat(u,"&user=").concat(t));if("message"in n)e((0,x.Gm)()),n.message.toLowerCase().includes("user not found")||o.Am.error(String(n.message)),e((0,x.Gm)()),e((0,x.bd)({travaStakingVault:"FAIL"}));else{let t=Object.values(n.dapp.travaStaking)[0],r=Object.values(t.trigger)[0];e((0,x.iv)(n)),e((0,x.mf)({subId:t.sub_id,from:parseInt(r.from),to:parseInt(r.to),compoundTime:t.compound_time,enabled:t.auto_compound})),e((0,x.bd)({travaStakingVault:"SUCCESS"}))}}else e((0,x.bd)({travaStakingVault:"INITIAL"}))}catch(t){e((0,x.Gm)()),e((0,x.bd)({travaStakingVault:"FAIL"})),r.Z.isAxiosError(t)?console.error("Axios error:",t):o.Am.error(String(t))}},[t,u,e]);return{fetchJunction:m,fetchJunctionHistory:(0,s.useCallback)(async()=>{try{if(e((0,x.bd)({history:"FETCHING"})),(0,i.UJ)(t)&&u>0){let n=await d.wM.get("/user/strategy-execution-history?chain_id=".concat(u,"&user=").concat(t));"message"in n?(n.message.toLowerCase().includes("user not found")||o.Am.error(String(n.message)),e((0,x._I)()),e((0,x.bd)({history:"FAIL"}))):(e((0,x.kT)(n)),e((0,x.bd)({history:"SUCCESS"})))}else e((0,x.bd)({history:"INITIAL"}))}catch(t){e((0,x._I)()),e((0,x.bd)({history:"FAIL"})),r.Z.isAxiosError(t)?console.error("Axios error:",t):o.Am.error(String(t))}},[t,u,e]),fetchJunctionAutoSwap:(0,s.useCallback)(async()=>{try{if(e((0,x.bd)({travaAutoSwap:"FETCHING"})),(0,i.UJ)(t)&&u>0){let n=await d.wM.get("/strategy-swap/".concat(t,"?chain_id=").concat(u));"message"in n?(n.message.toLowerCase().includes("user not found")||o.Am.error(String(n.message)),e((0,x.gS)()),e((0,x.bd)({travaAutoSwap:"FAIL"}))):(e((0,x.uJ)(n)),e((0,x.bd)({travaAutoSwap:"SUCCESS"})))}else e((0,x.bd)({travaAutoSwap:"INITIAL"}))}catch(t){e((0,x.gS)()),e((0,x.bd)({travaAutoSwap:"FAIL"})),r.Z.isAxiosError(t)?console.error("Axios error:",t):o.Am.error(String(t))}},[t,u,e]),fetchPancakeFarmData:(0,s.useCallback)(async()=>{try{if(e((0,x.bd)({pancakeFarm:"FETCHING"})),(0,i.UJ)(t)&&u>0){let r=await d.wM.get("/pancake-farm/".concat(t,"?chain_id=").concat(u));if(r){let t=r.StrategySub.map(e=>({sub_id:e.sub_id,is_enable:e.is_enable,id_farming:e.id_farming,trigger_reward:e.trigger_reward})).map(e=>{var t;let n=l.ZP.pancakeFarm.getById(u,e.id_farming),r=(0,a.Z)(e.trigger_reward).div((0,a.Z)("10").pow(null!==(t=null==n?void 0:n.rewardToken.decimal)&&void 0!==t?t:18)).toString();return n?{...e,trigger_reward:r,v2WrapperAddress:n.v2WrapperAddress,code:n.code,image:n.image}:{...e,v2WrapperAddress:"",code:"",image:""}}
1),i=await (0,p.ips)(n,u,"https://bsc-dataseed1.ninicoin.io/"),s=[];i&&(e((0,x._2)(Object.fromEntries(i))),s=t.map(e=>{let t=i.get(e.v2WrapperAddress.toLowerCase());return t?{...e,deposited:t.user.deposited,reward:t.user.rewards}:{...e,deposited:"0",reward:"0"}})),e((0,x.lJ)({StrategySub:s})),e((0,x.bd)({pancakeFarm:"SUCCESS"}))}else e((0,x.bd)({pancakeFarm:"FAIL"}))}}catch(t){e((0,x.bd)({pancakeFarm:"FAIL"})),r.Z.isAxiosError(t)?console.error("Axios error:",t):o.Am.error(String(t))}},[t,u,n,e])}}},79536:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(67294);function a(e,t){var n,a;let i=null!==(n=null==t?void 0:t.pageIndex)&&void 0!==n?n:1,s=null!==(a=null==t?void 0:t.itemPerPage)&&void 0!==a?a:10,[o,d]=(0,r.useState)(i),l=Math.ceil(e.length/s);return{next:function(){d(e=>Math.min(e+1,l))},prev:function(){d(e=>Math.max(e-1,1))},jump:function(e){d(Math.min(Math.max(1,e),l))},data:e.slice(o*s-s,o*s),currentPage:o,maxPage:l}}},97410:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(85893),a=n(2734),i=n(87357),s=n(15861),o=n(73785);function d(e){let{underlyingToken:t}=e,n=(0,a.Z)(),d={noLockBox:{display:"flex",alignItem:"center",justifyContent:"center",border:"1px solid ".concat(n.palette.text.secondary),width:"65px",height:"21px",padding:"3.5px 10px 4px 10px",borderRadius:"4px",ml:.5},rightBlock:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:2}};return(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",marginRight:"2rem",gap:"10px"},children:[(0,r.jsx)(i.Z,{sx:{mr:"0.5rem"},children:(0,r.jsx)(o.Z,{metadata:{hideSymbol:!0},size:"24px",image:t.image})}),(0,r.jsx)(s.Z,{sx:{fontSize:"18px",fontWeight:500,mt:"3px",color:"dark"==n.palette.mode?"#FFFFFF":"#000000"},children:t.symbol}),(0,r.jsx)(i.Z,{sx:d.noLockBox,children:(0,r.jsx)(s.Z,{sx:{color:"text.secondary",fontWeight:500,fontSize:"12px"},children:"No lock"})})]})}},89110:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return eP}});var r=n(85893),a=n(53156),i=n(87357),s=n(93946),o=n(15861),d=n(47621),l=n(53219),c=n(2548),x=n(21293),p=n(43954),u=n(67294),m=n(79554),h=n(11163),g=n(39332),f=n(2734),j=n(23795),b=n(90629),Z=n(72882),w=n(7906),y=n(295),C=n(53816),k=n(53252),v=n(70794),F=n(12260),T=n(20946),A=n(73785),I=n(16829),S=n(45843);let R=(0,I.Z)(S.Z)(e=>{let{theme:t}=e;return{width:36,height:20,padding:0,display:"flex","&:active":{"& .MuiSwitch-thumb":{width:19},"& .MuiSwitch-switchBase.Mui-checked":{transform:"translateX(17px)"}},"& .MuiSwitch-switchBase":{padding:2,color:"#83888C","&.Mui-checked":{transform:"translateX(16px)",color:"#FFFFFF","& + .MuiSwitch-track":{opacity:1,backgroundColor:"#7994C1"}}},"& .MuiSwitch-thumb":{boxShadow:"0 2px 4px 0 rgb(0 35 11 / 20%)",width:16,height:16,borderRadius:10,transition:t.transitions.create(["width"],{duration:200})}}});var E=n(1542),D=n(79536),_=n(18042),P=n(46053),W=n(28213);function L(){let e=(0,f.Z)(),{chainId:t}=(0,x.C)(e=>e.config),{userJunctionAutoSwap:n}=(0,x.C)(e=>e.junction),{EOAAddress:a,smartWalletAddress:s}=(0,x.C)(e=>e.user),d=(0,x.T)(),{fetchJunctionAutoSwap:l}=(0,p.u)(),{web3Sender:c}=(0,W.xo)(),{data:u,jump:m,maxPage:h,currentPage:g}=(0,D.Z)(n.filter(e=>!1==e.status),{itemPerPage:5});async function j(e,n){let r=Date.now();c&&(!0==e?await d((0,P.T4)({smartWalletAddress:s,walletAddress:a,subId:n,chainId:t,timeStamp:r,signer:c,dispatch:d})):await d((0,P.E4)({smartWalletAddress:s,walletAddress:a,subId:n,chainId:t,timeStamp:r,signer:c,dispatch:d})),await l())}return(0,r.jsxs)(b.Z,{sx:{borderRadius:"16px"},children:[(0,r.jsx)(Z.Z,{sx:{boxShadow:"none",borderRadius:"16px"},component:b.Z,children:(0,r.jsxs)(w.Z,{children:[(0,r.jsx)(E.nk,{cells:[{content:"Token In",props:{sx:{minWidth:"200px",paddingLeft:"50px"}}},{content:"Token Out",props:{sx:{minWidth:"100px"}}},{content:"Price",props:{sx:{minWidth:"250px"}}},{content:"Status Automating",props:{sx:{paddingRight:"50px"}}}]}),u&&(0,r.jsx)(y.Z,{children:u.map((n,a)=>{let s=_.ZP.token.getByAddress(t,n.information.from),d=_.ZP.token.getByAddress(t,n.information.to);return(0,r.jsxs)(C.Z,{sx:{cursor:"pointer"},children:[(0,r.jsx)(k.Z,{sx:{paddingLeft:"50px"},children:s&&(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center"},children:[(0,r.jsx)(A.Z,{image:s.image,symbol:" "}),(0,r.jsx)(o.Z,{children:"".concat((0,v.Z)(n.information.amount).div((0,v.Z)("10").pow(s.decimal).toFixed(4))," ").concat(null==s?void 0:s.symbol)})]})}),(0,r.jsx)(k.Z,{children:(0,r.jsx)(A.Z,{image:null==d?void 0:d.image})}),(0,r.jsx)(k.Z,{children:(0,r.jsx)(A.Z,{size:"30px",symbol:"= ".concat((0,v.Z)(n.information.triggerPrice).div((0,v.Z)("10").pow("18").toFixed(4))," ").concat(null==s?void 0:s.symbol,"/").concat(null==d?void 0:d.symbol),image:[null==s?void 0:s.image,null==d?void 0:d.image],isUseDefault:!0})}),(0,r.jsx)(k.Z,{sx:{paddingRight:"50px"},children:!0==n.strategySub.is_enable?(0,r.jsx)(i.Z,{sx:{display:"flex",justifyContent:"center","& .MuiSwitch-track":{borderRadius:10,opacity:1,backgroundColor:"#C2C2C2",boxSizing:"border-box"}},children:(0,r.jsx)(R,{checked:n.strategySub.is_enable,theme:e,onCh
1ange:()=>j(n.strategySub.is_enable,n.strategySub.sub_id)})}):(0,r.jsx)(i.Z,{sx:{display:"flex",justifyContent:"center"},children:(0,r.jsx)(o.Z,{fontSize:18,children:"---"})})})]},a)})})]})}),u.length>0?(0,r.jsx)(i.Z,{sx:{paddingRight:"50px"},children:(0,r.jsx)(F.Z,{props:{page:g,count:h,onChange:(e,t)=>m(t)}})}):(0,r.jsx)(i.Z,{sx:{width:"100%"},children:(0,r.jsx)(T.H,{title:"No items",props:{sx:{paddingY:"20px"}}})})]})}function B(e){let{children:t}=e,n=(0,f.Z)();return(0,r.jsx)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:"10px",width:"100%",borderRadius:"16px",backgroundColor:"dark"==n.palette.mode?"#020818":"#E6EAF2",boxShadow:"dark"==n.palette.mode?"0px 0px 8px 0px rgba(0, 0, 0, 0.78) inset":"0px 0px 8px 0px rgba(121, 148, 193, 0.47) inset",padding:"1rem"},children:t})}var N=n(96582),H=n(8251),G=n(45769),z=n(92754);function M(){var e;let t={icon:{fontSize:"35px",color:"#FFFFFF",marginRight:"0.75rem"},title:{color:"dark"==(e=(0,f.Z)()).palette.mode?"#7994C1":"#000000",fontSize:"14px",fontWeight:500},titleBox:{backgroundColor:"dark"==e.palette.mode?"#15273B":"#FFFFFF",borderTopRightRadius:"16px",borderBottomRightRadius:"16px",borderWidth:"1px",width:"calc(100% - 72px)",display:"flex",alignItems:"center",paddingLeft:"60px",paddingRight:"15px"},groupImage:{position:"absolute",borderRadius:"50%",width:"45px",height:"45px",display:"flex",alignItems:"center",justifyContent:"center",top:"50%",transform:"translateY(-50%)",left:"50px"}},n=z.gf,a=N.Vc;return(0,r.jsx)(r.Fragment,{children:n.filter(e=>"swap"===e.action).map((e,n)=>(0,r.jsxs)(i.Z,{sx:[{display:"flex",position:"relative",height:"60px",width:"100%",cursor:"pointer",borderRadius:"16px"}],children:[(0,r.jsx)(i.Z,{sx:{backgroundColor:"#1EA4AD",borderTopLeftRadius:"16px",borderBottomLeftRadius:"16px",width:"72px",display:"flex",alignItems:"center",justifyContent:"center"},children:"swap"===e.action&&(0,r.jsx)(H.o7,{sx:t.icon})}),(0,r.jsx)(i.Z,{sx:t.titleBox,children:(0,r.jsx)(o.Z,{sx:t.title,children:e.title})}),(0,r.jsx)(i.Z,{sx:t.groupImage,children:(0,r.jsx)(G.C,{img:a.metadata.image,color:a.metadata.color,props:{sx:{borderRadius:"50%",width:"100%",height:"100%"}}})})]},n))})}var O=n(22726),U=n(52408),Y=n(29135),J=n(24185),V=n(78475),K=n(21990),X=n(91444),$=n(84410),q=n(69159),Q=n(68962);class ee extends q.Z{constructor(e,t){super(Q.j.connect(t,e),Q.j.abi,t)}}class et extends q.Z{constructor(e,t){super(Q.m0.connect(t,e),Q.m0.abi,t)}}function en(){let[e,t]=(0,u.useState)("smartWallet"),[n,a]=(0,u.useState)(J.RO),[s,l]=(0,u.useState)(J.fO),[p,h]=(0,u.useState)(J.Tz),[g,j]=(0,u.useState)(""),{balance:b,smartBalance:Z}=function(e){let[t,n]=(0,u.useState)(""),[r,a]=(0,u.useState)(""),{web3Reader:i}=(0,W.xo)(),{EOAAddress:s,smartWalletAddress:o}=(0,x.C)(e=>e.user),d=(0,u.useCallback)(async()=>{try{let t=e.address;if(i&&(0,m.UJ)(t)){let r=new et(i,t),d=String(await r.fn.balanceOf(s)),l=String(await r.fn.balanceOf(o));n((0,v.Z)(d).div((0,v.Z)("10").pow(e.decimal)).toFixed(4)),a((0,v.Z)(l).div((0,v.Z)("10").pow(e.decimal)).toFixed(4))}}catch(e){console.error(e)}},[s,o,e,i]);return(0,u.useEffect)(()=>{d()},[d]),{balance:t,smartBalance:r}}(n),[w,y]=(0,u.useState)(""),C=(0,x.T)(),{getLastRate:k}=function(){let{pairTokens:e}=(0,x.C)(e=>e.token),{autoSwap:t}=(0,x.C)(e=>e.junction),n=(0,x.T)(),{web3Reader:r}=(0,W.xo)();return{getLastRate:(0,u.useCallback)(async()=>{let a="";if((0,m.UJ)(t.tokenInAddress)&&(0,m.UJ)(t.tokenOutAddress))for(let n in e)e[n].token0.address.toLowerCase()==t.tokenInAddress.toLowerCase()&&e[n].token1.address.toLowerCase()==t.tokenOutAddress.toLowerCase()?a=n:e[n].token1.address.toLowerCase()==t.tokenInAddress.toLowerCase()&&e[n].token0.address.toLowerCase()==t.tokenOutAddress.toLowerCase()&&(a=n);if(n((0,$.DY)({pairTokenAddress:a})),(0,m.UJ)(a)&&r){let e=new ee(r,a),i=await e.fn.getReserves(),s=await e.fn.token0(),o=await e.fn.token1(),d=(0,v.Z)(i._reserve0.toString()),l=(0,v.Z)(i._reserve1.toString()),c="";c=s.toLowerCase()==t.tokenInAddress.toLowerCase()?l.isGreaterThan("0")?d.div(l).toFixed(5):"0":o.toLowerCase()==t.tokenInAddress.toLowerCase()&&d.isGreaterThan("0")?l.div(d).toFixed(5):"0",n((0,$.DY)({lastRate:c}))}else n((0,$.DY)({lastRate:"pair not found"}))},[t.tokenInAddress,t.tokenOutAddress,n,e,r])}}(),{autoSwap:F}=(0,x.C)(e=>e.junction),T=(0,f.Z)(),I={root:{display:"flex",flexDirection:"column",padding:"30px",borderRadius:"16px",marginTop:"24px",backgroundColor:"dark"==T.palette.mode?"#091C34":"#FFFFFF",boxShadow:"0px 3px 6px 0px #00000014"}};return(0,u.useEffect)(()=>{C((0,$.DY)({balance:b,smartBalance:Z}))},[b,Z]),(0,u.useEffect)(()=>{C((0,$.DY)({amountIn:p.value}))},[p.value]),(0,u.useEffect)(()=>{k()},[k]),(0,u.useEffect)(()=>{(0,m.UJ)(n.address)&&(0,m.UJ)(s.address)&&y("".concat(n.symbol," / ").concat(s.symbol))},[n.address,n.symbol,s.address,s.symbol]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",mt:3,gap:"10px"},children:[(0,r.jsx)(o.Z,{variant:"h5",children:"Price Trigger"}),(0,r.jsx)(d.Z,{title:"",children:(0,r.jsx)(c.Z,{sx:{fontSize:"24px",cursor:"pointer",color:"#7994C1"}}
1)})]}),(0,r.jsx)(i.Z,{sx:I.root,children:(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1,[T.breakpoints.down("sm")]:{flexDirection:"column",gap:"25px"}},children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",width:"100%",gap:"25px",px:3,[T.breakpoints.down("sm")]:{px:3}},children:[(0,r.jsx)(O.Z,{title:"from",titleWidth:"100px",component:(0,r.jsx)(U.Z,{id:"select",selectedType:e,wallets:[{wallet:"smartWallet",balance:"0"}],metadata:{hideBalance:!0},events:{onSelectWallet:function(e){t(e.type),C((0,$.DY)({walletType:e.type}))}},props:{height:"40px",flex:1,width:"100%"}}),props:{sx:{marginTop:"1rem",gap:"15px"}}}),(0,r.jsx)(O.Z,{title:"token in",titleWidth:"100px",component:(0,r.jsx)(Y.Z,{id:"select",token:n.address,events:{onSelectToken:function(e){if(a(e),e.address==s.address){C((0,$.DY)({lastRate:"pair not found"})),X.Am.warning("Token must be different.");return}C((0,$.DY)({tokenInAddress:e.address})),C((0,$.DY)({priceTrigger:""}))}},metadata:{tags:"swap"},props:{height:"40px",flex:1,width:"100%"}}
1),props:{sx:{marginTop:"1rem",gap:"15px"}}}),(0,r.jsx)(O.Z,{title:"token out",titleWidth:"100px",component:(0,r.jsx)(Y.Z,{id:"select",token:s.address,events:{onSelectToken:function(e){if(l(e),e.address==n.address){C((0,$.DY)({lastRate:"pair not found"})),X.Am.warning("Token must be different.");return}C((0,$.DY)({tokenOutAddress:e.address})),C((0,$.DY)({priceTrigger:""}))}},metadata:{tags:"swap"},props:{height:"40px",flex:1,width:"100%"}}),props:{sx:{marginTop:"1rem",gap:"15px"}}})]}),(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",width:"100%",gap:"5px",px:5,[T.breakpoints.down("sm")]:{px:3}},children:[(0,r.jsx)(V.ZP,{maxBalance:"wallet"==e?b:Z,events:{onChange:function(e,t){h({type:"part",value:t})}},textFieldProps:{InputProps:{placeholder:"0",value:p.value,type:"number",endAdornment:(0,r.jsx)(A.Z,{symbol:n.symbol,image:n.image,isUseDefault:!0})}},props:{sx:{height:"40px",flex:1,width:"100%"}}}),(0,r.jsx)(V.$5,{maxAmount:"wallet"==e?b:Z,onAllBalance:(e,t)=>(0,K.vk)(e,t,h),checkBoxProps:{checked:"all"==p.type}}),(0,r.jsx)(V.ZP,{title:"Price Trigger",lastRate:"".concat(F.lastRate," ").concat(w),events:{onChange:function(e,t){j(t),C((0,$.DY)({priceTrigger:t}))}},textFieldProps:{InputProps:{disabled:"pair not found"==F.lastRate,placeholder:"0",value:g.toString(),type:"number",endAdornment:(0,r.jsx)(A.Z,{symbol:"".concat(n.symbol,"/").concat(s.symbol),image:[n.image,s.image],isUseDefault:!0})}},props:{sx:{height:"40px",flex:1,width:"100%"}}}),(0,r.jsxs)(i.Z,{sx:{mt:2,display:"flex",alignItems:"center",gap:"10px",justifyContent:"flex-end"},children:[(0,r.jsx)(o.Z,{variant:"body1",children:"Expected Fee"}),(0,r.jsx)(o.Z,{variant:"h6",children:"0.005"}),(0,r.jsx)(A.Z,{isUseDefault:!1})]})]})]})})]})}var er=n(11057);function ea(){let{autoSwap:e}=(0,x.C)(e=>e.junction),t=(0,x.T)(),{chainId:n}=(0,x.C)(e=>e.config),{EOAAddress:a,smartWalletAddress:s}=(0,x.C)(e=>e.user),{fetchJunctionAutoSwap:o}=(0,p.u)(),{web3Reader:d,web3Sender:l}=(0,W.xo)();async function c(){try{let r=e.smartBalance;if(0==parseFloat(e.amountIn)){X.Am.warning("Amount can' be zero");return}if(parseFloat(e.amountIn)>parseFloat(r)){X.Am.warning("Not enough balance");return}if((0,m.UJ)(e.pairTokenAddress))d&&l&&(await t((0,P.Pv)({chainId:n,walletType:e.walletType,walletAddress:a,smartWalletAddress:s,amountIn:e.amountIn,priceTrigger:e.priceTrigger,lastRate:e.lastRate,tokenInAddress:e.tokenInAddress,tokenOutAddress:e.tokenOutAddress,pairTokenAddress:e.pairTokenAddress,signer:l,provider:d,dispatch:t})),await o());else{X.Am.warning("Pair address not found");return}}catch(e){console.error(e),X.Am.error(String(e))}}return(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",mt:3,gap:"10px"},children:[(0,r.jsx)(er.Z,{variant:"outlined",disabled:!0,children:"Pause/Resume"}),(0,r.jsx)(er.Z,{variant:"contained",onClick:()=>c(),children:"Swap"})]})}var ei=n(55297);function es(e){let{boxStyle:t,warningStyle:n}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,{variant:"h5",children:"By using this feature you accept and acknowledge the following"}),(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:"20px",mt:2},children:[(0,r.jsxs)(i.Z,{sx:t,children:[(0,r.jsx)(o.Z,{children:"â¢"}),(0,r.jsx)(o.Z,{children:"Automation is a Beta feature and relies on multiple dependencies to execute properly."})]}),(0,r.jsxs)(i.Z,{sx:t,children:[(0,r.jsx)(o.Z,{children:"â¢"}),(0,r.jsx)(o.Z,{children:"Automation Protection has NOT been tested in difficult market conditions."})]}),(0,r.jsxs)(i.Z,{sx:t,children:[(0,r.jsx)(o.Z,{children:"â¢"}),(0,r.jsx)(o.Z,{children:"You understand that you are still responsible for your position and must continue to monitor it to avoid losses. By utilizing Automation you assume all risk and any losses that may occur when using this feature."})]}),(0,r.jsxs)(i.Z,{sx:t,children:[(0,r.jsx)(o.Z,{children:"â¢"}),(0,r.jsx)(o.Z,{children:"Automation Protection requires Automation Contract as authority to function. You can remove this authority at any time in the Authority panel."})]})]}),(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:"22px",mt:4},children:[(0,r.jsxs)(i.Z,{sx:n,children:[(0,r.jsx)(ei.Ke,{}),(0,r.jsx)(o.Z,{children:"Fees for using Automated Leverage Management include the transaction fee and a 0.3% service fee on the repaid/leveraged amount. There are no fees for simply keeping this automated strategy enabled and your position monitored."})]}),(0,r.jsxs)(i.Z,{sx:n,children:[(0,r.jsx)(ei.Ke,{}),(0,r.jsx)(o.Z,{children:"Your deposit too low so your reward will lower than service fee. Please deposit at least $1000."})]}),(0,r.jsxs)(i.Z,{sx:n,children:[(0,r.jsx)(ei.Ke,{}),(0,r.jsxs)(o.Z,{children:["Don","'","t keep asset in your wallet at anytime. Please send it to your wallet!"]})]})]})]})}function eo(e){let{boxStyle:t,warningStyle:n}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,{variant:"h5",children:"By using this feature you accept and acknowledge the following"}),(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:"20px",mt:2},children:[(0,r.jsxs)(i.Z,{sx:t,children:[(0,r.jsx)(o.Z,{children:"â¢"}),(0,r.jsx)(o.Z,{children:"The auto-swap feature allows you to execute an order at a specific price."})]}),(0,r.jsxs)(i.Z,{sx:t,children:[(0,r.jsx)(o.Z,{children:"â¢"}),(0,r.jsx)(o.Z,{children:"The swap action will be performed if the price equals or exceeds the set trigger price."})]}),(0,r.jsxs)(i.Z,{sx:t,children:[(0,r.jsx)(o.Z,{children:"â¢"}),(0,r.jsx)(o.Z,{children:"The action will end when the condition matches or when you turn it off."})]})]}),(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:"22px",mt:4},children:[(0,r.jsxs)(i.Z,{sx:n,children:[(0,r.jsx)(ei.Ke,{}),(0,r.jsx)(o.Z,{children:"Pancake Swap V2 does not support slippage protection, so you may
1not receive the desired output."})]}),(0,r.jsxs)(i.Z,{sx:n,children:[(0,r.jsx)(ei.Ke,{}),(0,r.jsx)(o.Z,{children:"Please note, actions are not guaranteed to be fulfilled."})]})]})]})}function ed(e){let{boxStyle:t}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,{variant:"h5",children:"By using this feature you accept and acknowledge the following"}),(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:"20px",mt:2},children:[(0,r.jsxs)(i.Z,{sx:t,children:[(0,r.jsx)(o.Z,{children:"â¢"}),(0,r.jsx)(o.Z,{children:"Automation is a Beta feature and relies on multiple dependencies to execute properly."})]}),(0,r.jsxs)(i.Z,{sx:t,children:[(0,r.jsx)(o.Z,{children:"â¢"}),(0,r.jsx)(o.Z,{children:"Automation Protection has NOT been tested in difficult market conditions."})]}),(0,r.jsxs)(i.Z,{sx:t,children:[(0,r.jsx)(o.Z,{children:"â¢"}),(0,r.jsx)(o.Z,{children:"You understand that you are still responsible for your position and must continue to monitor it to avoid losses. By utilizing Automation you assume all risk and any losses that may occur when using this feature."})]}),(0,r.jsxs)(i.Z,{sx:t,children:[(0,r.jsx)(o.Z,{children:"â¢"}),(0,r.jsx)(o.Z,{children:"Automation Protection requires Automation Contract as authority to function. You can remove this authority at any time in the Authority panel."})]})]})]})}function el(e){var t;let{type:n}=e,a={root:{display:"flex",flexDirection:"column",padding:"30px",borderRadius:"16px",border:"dark"==(t=(0,f.Z)()).palette.mode?"1px solid #132741":"1px solid #D8DFEB",marginTop:"24px",backgroundColor:"dark"==t.palette.mode?"#15273C":"#F8F8F8",boxShadow:"0px 1px 3px 0px #00000040"},box:{display:"flex",gap:"10px",ml:"10px"},warning:{display:"flex",gap:"10px",ml:"10px"}};return(0,r.jsxs)(i.Z,{sx:a.root,children:["swap"==n&&(0,r.jsx)(eo,{boxStyle:a.box,warningStyle:a.warning}),"trava"==n&&(0,r.jsx)(es,{boxStyle:a.box,warningStyle:a.warning}),"pancakeFarm"==n&&(0,r.jsx)(ed,{boxStyle:a.box,warningStyle:a.warning})]})}function ec(){let e=(0,f.Z)();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:"20px",mt:"20px"},children:[(0,r.jsx)(o.Z,{sx:{wordWrap:"break-word",maxWidth:"1015px"},children:"Protection Automation will payback any debt to return the position to the specified target health ratio upon hitting the triggering heath factor. The automation remains active until it is canceled."}),(0,r.jsxs)(o.Z,{children:["For more Information see our"," ",(0,r.jsx)(j.Z,{target:"_blank",underline:"hover",href:"#",children:"Automation Guide"})]})]}),(0,r.jsxs)(i.Z,{sx:{display:"flex",mt:5,gap:"20px",[e.breakpoints.down(1300)]:{flexDirection:"column"}},children:[(0,r.jsx)(L,{}),(0,r.jsx)(B,{children:(0,r.jsx)(M,{})})]}),(0,r.jsx)(en,{}),(0,r.jsx)(el,{type:"swap"}),(0,r.jsx)(ea,{})]})}var ex=n(98456),ep=n(61948),eu=n(45896),em=n(43408),eh=n(97410);function eg(){let{vaultsData:e}=function(e){let{web3Reader:t}=(0,W.xo)(),{EOAAddress:n,smartWalletAddress:r}=(0,x.C)(e=>e.user),{chainId:a}=(0,x.C)(e=>e.config),[i,s]=(0,u.useState)(),[o,d]=(0,u.useState)([]);async function l(){if((0,m.UJ)(n)&&(0,m.UJ)(r)&&t){let e=new em.iYh(n,r,t,a);s(e=await ep.Z.stakingVault(e,r,void 0))}}return(0,u.useEffect)(()=>
1{l();let e=setInterval(()=>{l()},6e4);return()=>clearInterval(e)},[n,r,t,a]),(0,u.useEffect)(()=>{!function(){try{if(i){let t=[];if(!e||"trava-staking"!==Object.values(e)[0])return;if(t=_.ZP.travaVault.getByTag(a,"staking")){let e=[];for(let n of t){let{tvl:t,apr:r,yourDeposit:a}=(0,eu.r)(i,n,"stake");e.push({tvl:t,apr:r,deposited:(0,K.FH)(a,2)+" "+n.underlyingToken.symbol,underlyingToken:n.underlyingToken})}e.length>0&&d(e)}}}catch(e){console.error(e)}}()},[i,a,e]),{vaultsData:o}}((0,g.useParams)()),t=(0,f.Z)(),n=(0,x.T)(),{autoCompound:a}=(0,x.C)(e=>e.junction);return(0,r.jsxs)(b.Z,{sx:{borderRadius:"16px"},children:[(0,r.jsx)(Z.Z,{sx:{boxShadow:"none",borderRadius:"16px"},component:b.Z,children:(0,r.jsxs)(w.Z,{children:[(0,r.jsx)(E.nk,{cells:[{content:"Token",props:{sx:{minWidth:"180px",paddingLeft:"50px"}}},{content:"TVL"},{content:"APR"},{content:"SW Deposited"},{content:"Status Automating",props:{sx:{paddingRight:"50px"}}}]}),e&&(0,r.jsx)(y.Z,{children:e.map((e,s)=>(0,r.jsxs)(C.Z,{sx:{cursor:"pointer"},onClick:()=>{"trava"===e.underlyingToken.symbol.toLowerCase()&&n((0,$.xd)("trava"))},children:[(0,r.jsx)(k.Z,{sx:{paddingLeft:"50px"},children:(0,r.jsx)(eh.Z,{underlyingToken:e.underlyingToken})}),(0,r.jsxs)(k.Z,{children:["$",(0,K.FH)(e.tvl,2)]}),(0,r.jsxs)(k.Z,{children:[(0,K.FH)(100*parseFloat(e.apr),2),"%"]}),(0,r.jsx)(k.Z,{children:e.deposited}),(0,r.jsx)(k.Z,{sx:{paddingRight:"50px"},children:(0,r.jsx)(i.Z,{sx:{display:"flex",justifyContent:"center","& .MuiSwitch-track":{borderRadius:10,opacity:1,backgroundColor:"#C2C2C2",boxSizing:"border-box"}},children:"trava"===e.underlyingToken.symbol.toLowerCase()?(0,r.jsx)(R,{checked:a.enabled,theme:t,onChange:()=>void(!1===a.enabled?n((0,$.mf)({enabled:!0})):n((0,$.mf)({enabled:!1})))}):(0,r.jsx)(r.Fragment,{})})})]},s))})]})}),0===e.length&&(0,r.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"200px"},children:(0,r.jsx)(ex.Z,{})})]})}var ef=n(50456),ej=n(61903),eb=n(55819),eZ=n(97090);function ew(){let e=(0,f.Z)(),t={root:{display:"flex",flexDirection:"column",padding:"30px",borderRadius:"16px",marginTop:"24px",backgroundColor:"dark"==e.palette.mode?"#091C34":"#FFFFFF",boxShadow:"0px 3px 6px 0px #00000014"},row:{minWidth:"350px",marginTop:"16px",marginBottom:"16px"},dateInput:{minWidth:"252px",marginLeft:"8px",marginRight:"8px",[e.breakpoints.down(1200)]:{minWidth:"190px"},"& .MuiOutlinedInput-input":{color:"dark"==e.palette.mode?"#FFFFFF":"#001714",borderRadius:"8px",paddingTop:"10px",paddingBottom:"10px",backgroundColor:"dark"==e.palette.mode?"#02111F":"#EFF2F8"},"& .MuiOutlinedInput-notchedOutline":{borderRadius:"8px",borderColor:"dark"==e.palette.mode?"#132741":"#E5E5E5"},'& input[type="date"]::-webkit-calendar-picker-indicator':{filter:"dark"==e.palette.mode?"invert(1)":"invert(0)"}},compoundTime:{minWidth:"209px",marginLeft:"50px",marginRight:"8px","& .MuiOutlinedInput-input":{color:"dark"==e.palette.mode?"#7994C1":"#001714",borderRadius:"8px",paddingTop:"10px",paddingBottom:"10px",backgroundColor:"dark"==e.palette.mode?"#02111F":"#EFF2F8"},"& .MuiOutlinedInput-notchedOutline":{borderRadius:"8px",borderColor:"dark"==e.palette.mode?"#132741":"#E5E5E5"}}},n=(0,x.T)(),{autoCompound:a,userJunction:s}=(0,x.C)(e=>e.junction),l=Object.values(s.dapp.travaStaking)[0];function p(e,t){if(0===e||0===t||e>t)return;let n=Math.ceil((t-e)/86400);return n>1?n+" days":1===n?n+" day":void 0}return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",mt:3,gap:"10px"},children:[(0,r.jsx)(o.Z,{variant:"h5",children:"Time Trigger"}),(0,r.jsx)(d.Z,{title:"",children:(0,r.jsx)(c.Z,{sx:{fontSize:"24px",cursor:"pointer",color:"#7994C1"}}
1)})]}),(0,r.jsxs)(i.Z,{sx:t.root,children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",marginBottom:"20px",marginTop:"20px",[e.breakpoints.down("sm")]:{flexDirection:"column"}},children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",[e.breakpoints.down("sm")]:{width:"100%",justifyContent:"space-between",mb:2}},children:[(0,r.jsx)(o.Z,{variant:"body1",sx:{fontWeight:500,color:"text.secondary",marginRight:"40px"},children:"Junction Time"}),(0,r.jsx)(ef.Z,{implementation:"css",smUp:!0,children:(0,r.jsx)(o.Z,{variant:"body1",sx:{fontWeight:500,color:"text.secondary",marginLeft:"20px"},children:p(a.from,a.to)})})]}),(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:"30px",ml:6,[e.breakpoints.down("sm")]:{flexDirection:"column"}},children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center"},children:[(0,r.jsx)(o.Z,{variant:"subtitle1",children:"From"}),(0,r.jsx)(ej.Z,{sx:t.dateInput,variant:"outlined",type:"date",value:0!==a.from?(0,K.p6)(a.from.toString()):new Date(Date.now()).toLocaleDateString(),onChange:e=>{!function(e){let t=new Date(e).getTime();if(Date.now()-432e5>t){X.Am.warning("From date can't be past");return}n((0,$.mf)({from:t/1e3}))}(e.target.value)},onKeyDown:e=>e.preventDefault()})]}),(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center"},children:[(0,r.jsx)(o.Z,{variant:"subtitle1",children:"To"}),(0,r.jsx)(ej.Z,{sx:t.dateInput,variant:"outlined",type:"date",value:0!==a.to?(0,K.p6)(a.to.toString()):new Date(Date.now()).toLocaleDateString(),onChange:e=>{!function(e,t){let r=new Date(t).getTime();if(Math.round(r/1e3)<parseInt(e)){X.Am.warning("To date can't be earlier than from date");return}n((0,$.mf)({to:r/1e3}))}(a.from.toString(),e.target.value)},onKeyDown:e=>e.preventDefault()})]}),(0,r.jsx)(ef.Z,{implementation:"css",smDown:!0,children:(0,r.jsx)(o.Z,{variant:"body1",sx:{fontWeight:500,color:"text.secondary",marginLeft:"20px"},children:p(a.from,a.to)})})]})]}),(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",[e.breakpoints.down("sm")]:{gap:"15px",flexDirection:"column"}},children:[(0,r.jsx)(o.Z,{variant:"body1",sx:{fontWeight:500,color:"text.secondary",marginRight:"40px"},children:"Compound Time"}),(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",ml:4,[e.breakpoints.down("sm")]:{flexDirection:"column",gap:"15px"}},children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center"},children:[(0,r.jsx)(o.Z,{variant:"body1",sx:{fontWeight:500},children:(0,K.fz)()}),(0,r.jsx)(ej.Z,{sx:t.compoundTime,value:a.compoundTime,variant:"outlined",select:!0,onChange:e=>{n((0,$.mf)({compoundTime:parseInt(e.target.value)}))},children:(0,r.jsx)(eb.Z,{value:3,children:"Every 3 days"})})]}),(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center"},children:[(0,r.jsx)(o.Z,{variant:"body1",sx:{fontWeight:500,color:"text.secondary",marginLeft:"20px",marginRight:"20px"},children:"Expected Fee"}),(0,r.jsxs)(i.Z,{style:{display:"flex",alignItems:"center",gap:"10px"},children:[(0,r.jsx)(o.Z,{variant:"h5",color:"text.secondary",children:l&&l.expected_fee}),(0,r.jsx)(E.Ih,{src:eZ.Z.src,sx:{height:"20px",width:"20px"}})]})]})]})]})]})]})}function ey(){let{userJunction:e,autoCompoundTXStatus:t,autoCompound:n}=(0,x.C)(e=>e.junction),a=Object.values(e.dapp.travaStaking)[0],{chainId:s}=(0,x.C)(e=>e.config),{EOAAddress:o,smartWalletAddress:d}=(0,x.C)(e=>e.user),l=_.ZP.travaVault.getById(s,"trava"),c=(0,x.T)(),{web3Reader:p,web3Sender:u}=(0,W.xo)();return(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",mt:3,gap:"10px"},children:[(0,r.jsxs)(er.Z,{variant:"outlined",disabled:""==n.subId,onClick:()=>(function(){let e=Date.now();try{!0==n.enabled&&p?c((0,P.p3)({smartWalletAddress:d,walletAddress:o,subId:a.sub_id,chainId:s,timeStamp:e,provider:p,dispatch:c})):!1==n.enabled&&p&&c((0,P.nv)({smartWalletAddress:d,walletAddress:o,subId:a.sub_id,chainId:s,timeStamp:e,provider:p,dispatch:c}))}catch(e){X.Am.error("Something wrong!")}})(),children:[("FETCHING"!==t.tx_autoCompound||"FETCHING"!==t.tx_disableAutoCompound)&&"Pause/Resume",("FETCHING"===t.tx_autoCompound||"FETCHING"===t.tx_disableAutoCompound)&&(0,r.jsx)(ex.Z,{color:"primary",size:"16px"})]}),a&&""!==a.sub_id?(0,r.jsxs)(er.Z,{variant:"contained",disabled:"FETCHING"===t.updateAutoCompound,onClick:()=>(function(){let e=Date.now();try{p&&u&&c((0,P.fS)({vault:l,timeStamp:e,signer:u,provider:p,chainId:s,walletAddress:o,smartWalletAddress:d,compoundTime:n.compoundTime,fromTime:n.from,toTime:n.to,subId:a.sub_id,dispatch:c}))}catch(e){X.Am.error("Something wrong!")}})(),children:["FETCHING"!==t.tx_updateAutoCompound&&"Update","FETCHING"===t.tx_updateAutoCompound&&
1(0,r.jsx)(ex.Z,{color:"primary",size:"16px"})]}):(0,r.jsxs)(er.Z,{variant:"contained",disabled:"FETCHING"===t.autoCompound,onClick:()=>(function(){let e=Date.now();try{if(0===n.from||0===n.to||0===n.compoundTime){X.Am.warning("You are missing junction time or compound time.");return}!function(){if(n.from>n.to){X.Am.warning("From date can't be later than to date");return}0===n.compoundTime&&X.Am.warning("Compound time can't be empty")}(),p&&u&&c((0,P.V3)({vault:l,timeStamp:e,signer:u,provider:p,chainId:s,walletAddress:o,smartWalletAddress:d,compoundTime:n.compoundTime,fromTime:n.from,toTime:n.to,dispatch:c}))}catch(e){X.Am.error("Something wrong!")}})(),children:["FETCHING"!==t.tx_autoCompound&&"Save","FETCHING"===t.tx_autoCompound&&(0,r.jsx)(ex.Z,{color:"primary",size:"16px"})]})]})}function eC(){let e=(0,f.Z)(),t={icon:{fontSize:"35px",color:"#FFFFFF",marginRight:"0.75rem"},title:{color:"dark"==e.palette.mode?"#7994C1":"#000000",fontSize:"14px",fontWeight:500},titleBox:{backgroundColor:"dark"==e.palette.mode?"#15273B":"#FFFFFF",borderTopRightRadius:"16px",borderBottomRightRadius:"16px",borderWidth:"1px",width:"calc(100% - 72px)",display:"flex",alignItems:"center",paddingLeft:"60px",paddingRight:"15px"},groupImage:{position:"absolute",backgroundColor:"#FFFFFF",borderRadius:"50%",border:"0.5px solid #B1C4DB",width:"45px",height:"45px",display:"flex",alignItems:"center",justifyContent:"center",top:"50%",transform:"translateY(-50%)",left:"50px"}},n=z.gf,{selectedVault:a}=(0,x.C)(e=>e.junction);return(0,r.jsx)(r.Fragment,{children:""===a?(0,r.jsx)(r.Fragment,{}):n.filter(e=>"swap"!==e.action).map((n,a)=>(0,r.jsxs)(i.Z,{sx:[{display:"flex",position:"relative",height:"60px",width:"100%",cursor:"pointer",borderRadius:"16px"}],children:[(0,r.jsxs)(i.Z,{sx:{backgroundColor:"dark"==e.palette.mode?"#073970":"#7994C1",borderTopLeftRadius:"16px",borderBottomLeftRadius:"16px",width:"72px",display:"flex",alignItems:"center",justifyContent:"center"},children:["claim"===n.action&&(0,r.jsx)(H.rl,{sx:t.icon}),"stake"===n.action&&(0,r.jsx)(H.$_,{sx:t.icon})]}),(0,r.jsx)(i.Z,{sx:t.titleBox,children:(0,r.jsx)(o.Z,{sx:t.title,children:n.title})}),(0,r.jsx)(i.Z,{sx:t.groupImage,children:(0,r.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",width:"28px",height:"28px",position:"relative"},children:(0,r.jsx)(ei.pR,{sx:{width:"28px",height:"28px"}})})})]},a))})}function ek(e){let{selectedVault:t}=e,n=(0,f.Z)();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:"20px",mt:"20px"},children:[(0,r.jsx)(o.Z,{sx:{wordWrap:"break-word",maxWidth:"1015px"},children:"Protection Automation will payback any debt to return the position to the specified target health ratio upon hitting the triggering heath factor. The automation remains active until it is canceled."}),(0,r.jsxs)(o.Z,{children:["For more Information see our"," ",(0,r.jsx)(j.Z,{target:"_blank",underline:"hover",href:"#",children:"Automation Guide"})]})]}),(0,r.jsxs)(i.Z,{sx:{display:"flex",mt:5,gap:"20px",[n.breakpoints.down(1300)]:{flexDirection:"column"}},children:[(0,r.jsx)(eg,{}),(0,r.jsx)(B,{children:(0,r.jsx)(eC,{})})]}),"trava"==t&&(0,r.jsx)(ew,{}),(0,r.jsx)(el,{type:"trava"}),(0,r.jsx)(ey,{})]})}var ev=n(98396),eF=n(57922),eT=n(34137),eA=n(13489);function eI(){let[e,t]=(0,u.useState)(J.JG.id),[n,a]=(0,u.useState)(""),{rewardTrigger:l}=(0,x.C)(e=>e.junction.userPancakeFarm),p=(0,x.T)(),m=(0,f.Z)(),h=(0,ev.Z)("(min-width:1150px)"),g=(0,ev.Z)("(min-width:600px)"),j={box:{display:"flex",alignItems:"center"}},b=N.Vc,Z=(0,u.useCallback)((0,K.Ds)(e=>{p((0,$.lJ)({rewardTrigger:e}))},300),[]);return(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",width:h?"45%":"80%",gap:"25px",py:3},children:[(0,r.jsx)(O.Z,{title:"Lp Token",display:g?"flex":"column",titleWidth:h?"145px":"80px",mode:"retain",component:(0,r.jsx)(eA.C,{id:"pancake-farm-select",selectedId:e,events:{onSelectPancakeFarm:function(e){t(e.id),p((0,$.lJ)({currentPancakeFarm:e}))}}}
1),props:{sx:{marginTop:"1rem",gap:"15px",width:g?"auto":"350px"}}}),(0,r.jsx)(V.ZP,{showTitle:!g,title:"Reward Trigger",inlineTitle:g?"Reward Trigger":"",inlineToolTip:(0,r.jsx)(d.Z,{title:"When your rewards reach to your expectation, auto smart staking will be activated.",children:(0,r.jsx)(s.Z,{children:(0,r.jsx)(c.Z,{sx:{color:"#7994C1",fontSize:"16px",fontWeight:400}})})}),textFieldProps:{InputProps:{disabled:!1,placeholder:"0",value:n.toString(),type:"number",endAdornment:(0,r.jsxs)(i.Z,{sx:j.box,gap:1,children:[(0,r.jsx)(G.C,{img:b.metadata.image,color:b.metadata.color,props:{sx:{borderRadius:"50%",width:"20px",height:"20px"}}}),(0,r.jsx)(o.Z,{fontWeight:400,fontSize:16,children:"Cake"})]})},sx:{ml:2}},events:{onChange:function(e,t){a(t),Z(t)}}}),1>parseFloat(l)&&(0,r.jsx)(o.Z,{color:"red",children:"Reward trigger must be equal or greater than 1"}),(0,r.jsxs)(i.Z,{sx:j.box,gap:6,children:[(0,r.jsxs)(i.Z,{sx:j.box,children:[(0,r.jsx)(o.Z,{sx:{color:"dark"==m.palette.mode?"#7994C1":"#41556B"},children:"Enable Fee"}),(0,r.jsx)(d.Z,{title:"Free enable fee in 30 days.",children:(0,r.jsx)(s.Z,{children:(0,r.jsx)(c.Z,{sx:{color:"#7994C1",fontSize:"16px",fontWeight:400}})})})]}),(0,r.jsxs)(i.Z,{sx:j.box,gap:1,children:[(0,r.jsx)(o.Z,{children:"0"}),(0,r.jsx)(A.Z,{metadata:{hideSymbol:!0}})]})]})]})}function eS(){var e,t,n;let[a,d]=(0,u.useState)(!1),{pancakeCompoundInfo:l,bonusAPR:c}=function(){let[e,t]=(0,u.useState)(z.zz),[n,r]=(0,u.useState)(0),{smartWalletAddress:a}=(0,x.C)(e=>e.user),{chainId:i}=(0,x.C)(e=>e.config),{userPancakeFarm:s}=(0,x.C)(e=>e.junction),o=(0,x.T)(),d=(0,u.useCallback)(async()=>{if((0,m.UJ)(a))try{let e=await (0,em.ips)(a,i,"https://bsc-dataseed1.ninicoin.io/");if(e){o((0,$._2)(Object.fromEntries(e)));let n=e.get(s.currentPancakeFarm.v2WrapperAddress.toLowerCase());if(n){t(n);let e=(0,em.Ct4)(s.rewardTrigger,n.user.deposited,n.farm.apr,J.zW);r(100*e)}}}catch(e){console.error(e)}},[a,i,s.currentPancakeFarm,s.rewardTrigger]);return(0,u.useEffect)(()=>{d()},[d]),{pancakeCompoundInfo:e,bonusAPR:n,getPancakeCompoundInfo:d}}(),{userPancakeFarm:p}=(0,x.C)(e=>e.junction),h={titleCell:{display:"flex",flexDirection:"column",justifyContent:"space-between",height:"52.9px"}},g=(0,ev.Z)("(min-width:1350px)"),j=(0,f.Z)(),Z=N.Vc;return(0,r.jsxs)(i.Z,{sx:{backgroundColor:"dark"==j.palette.mode?"#020818":"#E6EAF2",boxShadow:"dark"==j.palette.mode?"0px 0px 8px 0px rgba(0, 0, 0, 0.78) inset":"0px 0px 8px 0px rgba(121, 148, 193, 0.47) inset",height:"fit-content",borderRadius:"16px",mt:"10px"},component:b.Z,children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",minWidth:"100%",height:"140px",borderRadius:"16px",background:"dark"==j.palette.mode?"#0D2D56":"#FFFFFF",boxShadow:"0px 3px 6px 0px #00000014"},children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",gap:"10px",ml:"50px"},children:[(0,r.jsx)(G.C,{img:Z.metadata.image,color:Z.metadata.color,props:{sx:{borderRadius:"50%",width:"53px",height:"53px"}}}),(0,r.jsxs)(i.Z,{sx:{display:g?"flex":"none",flexDirection:"column",justifyContent:"space-between"},children:[(0,r.jsx)(o.Z,{variant:"h5",children:"PANCAKE FARM"}),(0,r.jsx)(o.Z,{sx:{fontWeight:400,fontSize:"14px",color:"#566474"},children:"on Pancake"})]})]}),(0,r.jsxs)(i.Z,{sx:{display:"flex",flex:.8,height:"60.9px",alignItems:"center",justifyContent:"space-between",overflowX:g?"auto":"scroll",gap:g?8:2,"&::-webkit-scrollbar":{display:"none"}},children:[(0,r.jsx)(E.YT,{noWrap:!0,title:"Lp Token Price",value:"$".concat((0,K.FH)(l.farm.stakedTokenPrice,2)),props:{sx:h.titleCell}}),(0,r.jsx)(E.YT,{noWrap:!0,title:"TVL",value:"$".concat((0,K.FH)(l.farm.tvl,2)),props:{sx:h.titleCell}}),(0,r.jsx)(E.YT,{noWrap:!0,title:"APR",value:(0,r.jsxs)(i.Z,{display:"flex",alignItems:"center",gap:1,children:[(0,r.jsxs)(o.Z,{children:[null!==(e=(0,K.FH)(100*parseFloat(l.farm.apr),2))&&void 0!==e?e:"no data","%"]}),(0,r.jsxs)(o.Z,{color:"#03BD9D",noWrap:!0,children:["+ ",(0,K.FH)(c,2),"%"]})]}),props:{sx:h.titleCell}}),(0,r.jsx)(E.YT,{noWrap:!0,title:"Your Deposited",value:(0,r.jsxs)(i.Z,{display:"flex",alignItems:"center",gap:1,children:[(0,r.jsx)(o.Z,{children:null!==(t=(0,K.FH)(l.user.deposited,4))&&void 0!==t?t:"no data"}),(0,r.jsx)(A.Z,{image:p.currentPancakeFarm.image,symbol:"LP"})]}),props:{sx:h.titleCell}}),(0,r.jsx)(E.YT,{noWrap:!0,title:"Your Reward",value:(0,r.jsxs)(i.Z,{display:"flex",alignItems:"center",gap:1,children:[(0,r.jsx)(o.Z,{children:null!==(n=(0,K.FH)(l.user.rewards,6))&&void 0!==n?n:"no data"}),(0,r.jsx)(G.C,{img:Z.metadata.image,color:Z.metadata.color,props:{sx:{borderRadius:"50%",width:"20px",height:"20px"}}})]}),props:{sx:h.titleCell}})]}),(0,r.jsx)(s.Z,{onClick:()=>d(!a),sx:{mr:"50px"},children:(0,r.jsx)(eT.Z,{isTransform:a,props:{color:"primary"}})})]}),(0,r.jsx)(eF.Z,{in:a,children:(0,r.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:(0,r.jsx)(eI,{})})})]})}var eR=n(74721);function eE(){let e=(0,f.Z)();return(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",height:"fit-content",gap:2,bgcolor:"dark"==e.palette.mode?"#091C34":"#EAF5FF",border:"1px solid ".concat("dark"==e.palette.mode?"#132741":"#D8DFEB"),borderRadius:"16px",padding:"16px",mt:2,boxShadow:"0px 1px 3px 0px #00000040"},children:[(0,r.jsx)(eR.Z,{sx:{color:"#7994C1"}}
1),(0,r.jsx)(o.Z,{children:"Fees for using Automated Leverage Management include the transaction fee and a 0.3% service fee on the repaid/leveraged amount. There are no fees for simply keeping this automated strategy enabled and your position monitored."})]})}function eD(){let{chainId:e}=(0,x.C)(e=>e.config),{EOAAddress:t,smartWalletAddress:n}=(0,x.C)(e=>e.user),{web3Sender:a,web3Reader:s}=(0,W.xo)(),{currentPancakeFarm:o,rewardTrigger:d,StrategySub:l}=(0,x.C)(e=>e.junction.userPancakeFarm),{autoCompoundTXStatus:c}=(0,x.C)(e=>e.junction),m=(0,x.T)(),{fetchPancakeFarmData:h}=(0,p.u)(),{subId:g}=(0,u.useMemo)(()=>{let e="";return l.length>0&&l.map(t=>{t.id_farming.toLowerCase()==o.id.toLowerCase()&&(e=t.sub_id)}),{subId:e}},[l,o.id]),{isEnable:f}=(0,u.useMemo)(()=>{let e=!1;return l.length>0&&l.map(t=>{t.id_farming.toLowerCase()==o.id.toLowerCase()&&(e=t.is_enable)}),{isEnable:e}},[l,o.id]);async function j(){try{a&&s&&await m((0,P.vl)({chainId:e,walletAddress:t,v2WrapperAddress:o.v2WrapperAddress,smartWalletAddress:n,farmId:o.id,rewardToken:o.rewardToken.address,rewardTrigger:d,pairToken:o.stakedToken.address,signer:a,provider:s,dispatch:m}))}catch(e){console.error(e)}finally{h()}}async function b(){try{a&&await m((0,P.kL)({chainId:e,subId:parseInt(g),walletAddress:t,v2WrapperAddress:o.v2WrapperAddress,smartWalletAddress:n,farmId:o.id,rewardToken:o.rewardToken.address,rewardTrigger:d,pairToken:o.stakedToken.address,signer:a,dispatch:m}))}catch(e){console.error(e)}finally{h()}}async function Z(){try{a&&await m((0,P.lG)({chainId:e,subId:parseInt(g),walletAddress:t,v2WrapperAddress:o.v2WrapperAddress,smartWalletAddress:n,farmId:o.id,rewardToken:o.rewardToken.address,rewardTrigger:d,pairToken:o.stakedToken.address,signer:a,dispatch:m}))}catch(e){console.error(e)}finally{h()}}async function w(){try{a&&await m((0,P.XJ)({chainId:e,subId:parseInt(g),walletAddress:t,smartWalletAddress:n,signer:a,dispatch:m}))}catch(e){console.error(e)}finally{h()}}return(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",mt:3,gap:"10px"},children:[""==g&&(0,r.jsx)(er.Z,{disabled:"FETCHING"==c.tx_autoPancakeFarm||"FETCHING"==c.tx_disableAutoPancakeFarm||"0"==d||1>parseFloat(d)||!d,sx:{width:"152px"},variant:"contained",onClick:j,children:"FETCHING"==c.tx_autoPancakeFarm?(0,r.jsx)(ex.Z,{color:"primary",size:"16px"}):"Enable"}),""!=g&&!0==f&&(0,r.jsx)(er.Z,{disabled:"FETCHING"==c.tx_updateAutoPancakeFarm||"FETCHING"==c.tx_disableAutoPancakeFarm||"0"==d||!d||1>parseFloat(d),sx:{width:"152px"},variant:"contained",onClick:b,children:"FETCHING"==c.tx_updateAutoPancakeFarm?(0,r.jsx)(ex.Z,{color:"primary",size:"16px"}):"Update"}),""!=g&&!1==f&&(0,r.jsx)(er.Z,{disabled:"FETCHING"==c.tx_activeAndUpdatePancakeFarm||"FETCHING"==c.tx_disableAutoPancakeFarm||"0"==d||!d||1>parseFloat(d),onClick:Z,sx:{width:"152px"},variant:"contained",children:"FETCHING"==c.tx_activeAndUpdatePancakeFarm?(0,r.jsx)(ex.Z,{color:"primary",size:"16px"}):"Active & Update"}),(0,r.jsx)(er.Z,{disabled:"FETCHING"==c.tx_autoPancakeFarm||"FETCHING"==c.tx_disableAutoPancakeFarm||"FETCHING"==c.tx_updateAutoPancakeFarm||"FETCHING"==c.tx_activeAndUpdatePancakeFarm||!g||!1==f,onClick:w,sx:{width:"110px"},variant:"outlined",children:"FETCHING"==c.tx_disableAutoPancakeFarm?(0,r.jsx)(ex.Z,{color:"primary",size:"16px"}):"Cancel"})]})}function e_(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column",gap:"20px",mt:"20px"},children:[(0,r.jsx)(o.Z,{sx:{wordWrap:"break-word",maxWidth:"1015px"},children:"Users can set a certain wallet balance number, which when exceeded, the entire amount will automatically be deposited into smart staking. Rewards Trigger brings higher APR."}),(0,r.jsxs)(o.Z,{children:["For more Information see our"," ",(0,r.jsx)(j.Z,{target:"_blank",underline:"hover",href:"#",children:"Automation Guide"})]})]}),(0,r.jsx)(eS,{}),(0,r.jsx)(eE,{}),(0,r.jsx)(el,{type:"pancakeFarm"}),(0,r.jsx)(eD,{})]})}function eP(){let[e,t]=(0,u.useState)(""),[n,f]=(0,u.useState)(""),{selectedVault:j}=(0,x.C)(e=>e.junction),{EOAAddress:b}=(0,x.C)(e=>e.user),Z=(0,g.useParams)(),w=(0,h.useRouter)(),{fetchJunction:y}=(0,p.u)();return(0,u.useEffect)(()=>
1{if(Z){t(Object.values(Z)[0]);let e=z.QL.find(e=>e.id==Object.values(Z)[0]);f(null==e?void 0:e.title)}},[Z]),(0,u.useEffect)(()=>{(0,m.UJ)(b)||w.push("/junction/automatic")},[b]),(0,u.useEffect)(()=>{y()},[y]),(0,r.jsx)(a.Z,{children:(0,r.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"column"},children:[(0,r.jsxs)(i.Z,{sx:{display:"flex",alignItems:"center",gap:"10px"},children:[(0,r.jsx)(s.Z,{onClick:()=>window.history.back(),children:(0,r.jsx)(l.Z,{viewBox:"0 0 28 28",fill:"none",children:(0,r.jsx)("path",{d:"M14 0C11.2311 0 8.52431 0.821086 6.22202 2.35943C3.91973 3.89777 2.12531 6.08427 1.06569 8.64243C0.00605965 11.2006 -0.271187 14.0155 0.269007 16.7313C0.8092 19.447 2.14257 21.9416 4.1005 23.8995C6.05844 25.8574 8.553 27.1908 11.2687 27.731C13.9845 28.2712 16.7994 27.9939 19.3576 26.9343C21.9157 25.8747 24.1022 24.0803 25.6406 21.778C27.1789 19.4757 28 16.7689 28 14C28 10.287 26.525 6.72601 23.8995 4.1005C21.274 1.475 17.713 0 14 0ZM20.549 16.483H14.001V20.483C14.001 20.6171 13.9613 20.7481 13.8869 20.8596C13.8125 20.9711 13.7066 21.058 13.5828 21.1094C13.459 21.1608 13.3227 21.1743 13.1912 21.1482C13.0597 21.1222 12.9389 21.0577 12.844 20.963L6.392 14.477C6.32893 14.4146 6.27886 14.3403 6.24469 14.2584C6.21052 14.1766 6.19292 14.0887 6.19292 14C6.19292 13.9113 6.21052 13.8234 6.24469 13.7416C6.27886 13.6597 6.32893 13.5854 6.392 13.523L12.843 7.037C12.9377 6.9418 13.0585 6.8769 13.1902 6.85056C13.3219 6.82423 13.4584 6.83764 13.5824 6.88909C13.7065 6.94055 13.8124 7.02772 13.8867 7.13953C13.9611 7.25133 14.0005 7.38273 14 7.517V11.517H20.549C20.7284 11.5175 20.9003 11.589 21.0271 11.7159C21.154 11.8427 21.2255 12.0146 21.226 12.194V15.807C21.2252 15.9862 21.1536 16.1579 21.0268 16.2845C20.9 16.4111 20.7282 16.4825 20.549 16.483Z",fill:"#7994C1"})})}),(0,r.jsx)(o.Z,{variant:"h5",children:n}),(0,r.jsx)(d.Z,{title:"",children:(0,r.jsx)(c.Z,{sx:{fontSize:"24px",cursor:"pointer",color:"#7994C1"}}
1)})]}),"swap"==e&&(0,r.jsx)(ec,{}),"trava-staking"==e&&(0,r.jsx)(ek,{selectedVault:j}),"pancake-farm"==e&&(0,r.jsx)(e_,{})]})})}}},function(e){e.O(0,[499,1903,5054,6886,9354,9723,9774,2888,179],function(){return e(e.s=31895)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.