1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3986],{3986:function(e,s,l){l.r(s),l.d(s,{RankPnLMobileWidget:function(){return RankPnLMobileWidget},default:function(){return CampaignLiquidationWidgetS4}});var a=l(5893),n=l(7294),t=l(5675),i=l.n(t),d=l(7017),c=l(9522),r=l(4936),o=l(2130),x=l(7685),m=l(2973),f=l(6427),h=l(1731),u=l(4855),g=l(8645),j=l(2302),p=l(7705),N=l(881),b=l(3182);function CampaignLiquidationWidgetS4(e){let{setLoading:s,totalTrades:l,totalVol:t}=e,{account:v}=(0,f.Os)(),[w,y]=(0,n.useState)(0),[k,P]=(0,n.useState)(1),[S,L]=(0,n.useState)([]),[C,A]=(0,n.useState)([]),[R,D]=(0,n.useState)(!0),{priceDatas:T,error:F}=(0,r.dv)(),[M,W]=(0,n.useState)(0),[E,q]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(T&&T.length>0){let e=T.find(e=>"APT"===e.tokenSymbol);W(Number(null==e?void 0:e.price))}},[T]),(0,n.useEffect)(()=>{if(S&&S.length>0){let e=(k-1)*20,s=e+20,l=S.slice(e,s);A(l),y(Math.ceil(S.length/20))}},[S,k]);let fetchLiquidationRank=async()=>{try{s(!0),D(!0);let e=await (0,d.yV)();if(e){let s=null==e?void 0:e.data,l=s.map((e,s)=>((null==v?void 0:v.address)===e.owner&&q({...e,rankIndex:s+1}),{...e,reward:(0,p.getRewardByRank)(s+1,p.LIQUIDATION_REWARDS)}));L(l)}}catch(e){console.log("\uD83D\uDE80 ~ fetchTradingPnl ~ error:",e)}finally{s(!1),D(!1)}};(0,n.useEffect)(()=>{fetchLiquidationRank()},[]);let handlePageClick=e=>{P(e)},Z=[o.Z,x.Z,m.Z],$=window.innerWidth<768;return(0,a.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 mt-2 md:flex-row md:items-center",children:[(0,a.jsx)("span",{className:"text-xl font-bold",children:"Leaderboard"}),(0,a.jsx)("div",{className:"flex flex-row gap-2.5 md:gap-1 items-center w-full",children:(0,a.jsxs)("span",{className:"flex flex-row items-center w-full text-xs md:text-sm md:gap-1",children:[(0,a.jsx)("span",{className:"hidden md:inline",children:"("}),(0,a.jsxs)("div",{className:"flex flex-col md:flex-row md:gap-1",children:["Total Volume:"," ",(0,a.jsx)("span",{className:"text-white",children:null==t?void 0:t.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})})]}),(0,a.jsx)("div",{className:"border-l border-[#ffffff2b] h-5 mx-2"}),(0,a.jsxs)("div",{className:"flex flex-col md:flex-row md:gap-1",children:["Total Trades: ",(0,a.jsx)("span",{className:"text-white",children:l})]}),(0,a.jsx)("span",{className:"hidden md:inline",children:")"})]})})]}),(0,a.jsxs)(h.Zb,{className:"md:flex justify-between items-center rounded-[10px]",children:[(0,a.jsxs)("div",{className:"flex flex-row items-center text-xs md:text-base",children:[(0,a.jsx)(j.Z,{icon:"noto:trophy",className:"p-0 ml-[-8px] md:ml-0"}),(0,a.jsxs)("span",{className:"flex flex-col md:flex-row md:gap-1",children:["Total Rewards:"," ",(0,a.jsx)("span",{className:"font-bold text-transparent bg-clip-text bg-custom-gradient",children:"1,300 APT & 1,000,000 AGPoints"})]})]}),(0,a.jsxs)("div",{className:"flex flex-row gap-2.5 md:gap-1 items-center mt-2 md:mt-0",children:[(0,a.jsx)(i(),{src:"/totalVolume.svg",alt:"sth",width:26,height:26,className:"p-0.5 hidden md:flex"}),(0,a.jsx)(i(),{src:"/totalVolume.svg",alt:"sth",width:23,height:23,className:"p-0.5 flex md:hidden"}),(0,a.jsxs)("span",{className:"flex flex-col text-xs md:text-base md:flex-row md:gap-1",children:["Your Liquidation:"," ",E?(0,a.jsx)("span",{className:"font-bold text-transparent bg-clip-text bg-custom-gradient",children:"$".concat(Number((0,c.PC)(Number((null==E?void 0:E.pnl)||0),18)).toLocaleString(void 0,{minimumFractionDigits:6,maximumFractionDigits:6}))}):(0,a.jsx)("span",{className:"font-bold text-transparent bg-clip-text bg-custom-gradient",children:"-"})]}),(0,a.jsx)("div",{className:"border-l border-[#ffffff2b] h-5 mx-1"}),(0,a.jsxs)("span",{className:"flex flex-col text-xs md:text-base md:flex-row md:gap-1",children:["Your Rank:"," ",E?(0,a.jsx)("span",{className:"font-bold text-transparent bg-clip-text bg-custom-gradient",children:null==E?void 0:E.rankIndex}):(0,a.jsx)("span",{className:"font-bold text-transparent bg-clip-text bg-custom-gradient",children:"-"})]})]})]}),(0,a.jsxs)(h.Zb,{className:"flex flex-col w-full h-auto py-5 rounded-lg",children:[(0,a.jsx)("div",{className:"hidden md:block",children:(0,a.jsxs)(g.iA,{className:"mt-1 overflow-hidden",children:[(0,a.jsx)(g.xD,{children:(0,a.jsxs)(g.SC,{className:"h-12",children:[(0,a.jsx)(g.ss,{className:"w-[7%] font-bold text-left",children:"Rank"}),(0,a.jsx)(g.ss,{className:"w-1/2 font-bold",children:"Address"}),(0,a.jsx)(g.ss,{className:"w-[13%] font-bold",children:"Liquidation"}),(0,a.jsx)(g.ss,{className:"w-[13%] font-bold text-right",children:"AGPoints Rewards"}),(0,a.jsx)(g.ss,{className:"w-1/4 font-bold text-right",children:"APT Rewards"})]})}),(0,a.jsxs)(g.RM,{className:"h-[500px] overflow-auto",children:[R||!C?Array.from({length:20}).map((e,s)=>(0,a.jsx)(N.default,{},s)):0===C.length?(0,a.jsx)(g.SC,{className:"h-12",children:(0,a.jsx)(g.pj,{colSpan:5,className:"py-4 text-center text-gray-400",children:"No data available"})}):C.map((e,s)=>{var l,n,t,d,r;return(0,a.jsxs)(g.SC,{className:"h-12 border-b-2 border-[#ffffff08] ".concat(s%2==0?"bg-[#ffffff08]":"bg-[#ffffff00]"),children:[(0,a.jsx)(g.pj,{className:"flex items-center justify-start mt-2 md:mt-0",children:s+(k-1)*20<3?(0,a.jsx)(i(),{src:Z[s],alt:"icon-".concat(s+1),width:24,height:24}):"".concat(s+1+(k-1)*20)}),(0,a.jsxs)(g.pj,{className:"font-medium text-gray-400 border-none",children:[(0,a.jsx)("span",{className:"block md:hidden",children:"".concat(null==e?void 0:null===(l=e.owner)||void 0===l?void 0:l.slice(0,6),"...").concat(null==e?void 0:null===(n=e.owner)||void 0===n?void 0:n.slice(-6))}),(0,a.jsx)("span",{className:"hidden md:block",children:null==e?void 0:e.owner})]}),(0,a.jsx)(g.pj,{className:"font-medium text-gray-400 border-none",children:"$".concat(Number((0,c.PC)(Number((null==e?void 0:e.pnl)||0),18)).toLocaleStr
1ing(void 0,{minimumFractionDigits:6,maximumFractionDigits:6}))}),(0,a.jsx)(g.pj,{className:"font-medium text-right text-gray-400 border-none",children:"".concat(null==e?void 0:null===(t=e.reward)||void 0===t?void 0:t.agPoints.toLocaleString())}),(0,a.jsx)(g.pj,{className:"font-medium text-right text-gray-400 border-none",children:"".concat(null==e?void 0:null===(d=e.reward)||void 0===d?void 0:d.apt," APT ($").concat(((null==e?void 0:null===(r=e.reward)||void 0===r?void 0:r.apt)*M).toLocaleString(),")")})]},s)}),C.length<20&&!R&&C&&Array.from({length:20-C.length}).map((e,s)=>(0,a.jsx)(g.SC,{className:"h-12 border-none border-[#ffffff08]",children:(0,a.jsx)(g.pj,{colSpan:5,className:"border-none"})},"empty-".concat(s)))]}),(0,a.jsx)(g.yt,{children:(0,a.jsx)(g.SC,{})})]})}),(0,a.jsx)("div",{className:"mt-4 space-y-3 md:hidden",children:R||!C?Array.from({length:10}).map((e,s)=>(0,a.jsx)(b.default,{},s)):C.map((e,s)=>(0,a.jsx)(RankPnLMobileWidget,{item:e,index:s,icons:Z,currentPage:k,pageCount:20,aptPrice:M},s))}),(0,a.jsx)(u.tl,{className:"mt-5",children:(0,a.jsxs)(u.ng,{className:"flex flex-row items-center justify-center",children:[(0,a.jsx)(u.nt,{children:(0,a.jsx)(u.dN,{onClick:()=>k>1&&handlePageClick(k-1)})}),$?(0,a.jsx)(u.nt,{children:(0,a.jsx)("span",{className:"px-3 py-1 text-white rounded bg-agdexMain",children:k})}):Array.from({length:w},(e,s)=>(0,a.jsx)(u.nt,{children:(0,a.jsx)(u.kN,{onClick:()=>handlePageClick(s+1),className:"px-3 py-1 rounded cursor-pointer ".concat(k===s+1?"bg-agdexMain text-white":""),children:s+1})},s)),(0,a.jsx)(u.nt,{children:(0,a.jsx)(u.$0,{className:"cursor-pointer",onClick:()=>k<w&&handlePageClick(k+1)})})]})})]})]})}function RankPnLMobileWidget(e){var s,l,n,t,d;let{item:r,index:o,icons:x,currentPage:m,pageCount:f,aptPrice:h}=e;return(0,a.jsxs)("div",{className:"w-full p-4 mb-3 rounded-lg bg-[#1a1a1a] border border-[#2c2c2c] text-sm text-white",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("span",{className:"text-gray-400",children:"Rank"}),(0,a.jsx)("span",{className:"font-bold",children:o+(m-1)*f<3?(0,a.jsx)(i(),{src:x[o],alt:"icon-".concat(o+1),width:24,height:24}):"#".concat(o+1+(m-1)*f)})]}),(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsx)("span",{className:"block text-gray-400",children:"Address"}),(0,a.jsx)("span",{className:"block font-mono",children:"".concat(null==r?void 0:null===(s=r.owner)||void 0===s?void 0:s.slice(0,6),"...").concat(null==r?void 0:null===(l=r.owner)||void 0===l?void 0:l.slice(-6))})]}),(0,a.jsxs)("div",{className:"flex justify-between mt-2",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"text-gray-400",children:"PnL"}),(0,a.jsx)("span",{children:"$".concat(Number((0,c.PC)(Number((null==r?void 0:r.pnl)||0),18)).toLocaleString(void 0,{minimumFractionDigits:6,maximumFractionDigits:6}))})]}),(0,a.jsxs)("div",{className:"flex flex-col text-right",children:[(0,a.jsx)("span",{className:"text-gray-400",children:"AGPoints"}),(0,a.jsx)("span",{children:null==r?void 0:null===(n=r.reward)||void 0===n?void 0:n.agPoints.toLocaleString()})]})]}),(0,a.jsxs)("div",{className:"flex justify-between mt-2",children:[(0,a.jsx)("span",{className:"text-gray-400",children:"APT Rewards"}),(0,a.jsx)("span",{children:"".concat(null==r?void 0:null===(t=r.reward)||void 0===t?void 0:t.apt," APT ($").concat(((null==r?void 0:null===(d=r.reward)||void 0===d?void 0:d.apt)*h).toLocaleString(),")")})]})]})}}}]);
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.