@kodiak-finance/orderly-trading-rewards 2.8.18 → 2.8.19-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,17 +1,1861 @@
1
1
  import { Flex, cn, Box, Text, Divider, ListView, DataTable, Tooltip, usePagination } from '@kodiak-finance/orderly-ui';
2
2
  import { useTranslation } from '@kodiak-finance/orderly-i18n';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
- import O, { createContext, useState, useEffect, useMemo, useContext, useCallback } from 'react';
4
+ import React3, { createContext, useState, useEffect, useMemo, useContext, useCallback } from 'react';
5
5
  import { useMediaQuery, useTradingRewardsStatus, EpochStatus, TWType, useConfig, useGetClaimed, DistributionId, useAllBrokers, useCurEpochEstimate, useWalletRewardsHistory, useEpochInfo, useWalletConnector, useAccount, useGetEnv, ENVType, useAccountRewardsHistory } from '@kodiak-finance/orderly-hooks';
6
6
  import { useAppContext, useDataTap } from '@kodiak-finance/orderly-react-app';
7
7
  import { AccountStatusEnum, ChainNamespace } from '@kodiak-finance/orderly-types';
8
8
  import { commifyOptional, commify, Decimal, getTimestamp } from '@kodiak-finance/orderly-utils';
9
9
  import { AuthGuard, AuthGuardEmpty } from '@kodiak-finance/orderly-ui-connector';
10
- import gr from 'ramda/es/omit';
10
+ import omit from 'ramda/es/omit';
11
11
  import { Scaffold } from '@kodiak-finance/orderly-ui-scaffold';
12
12
 
13
- var Gt=Object.defineProperty;var c=(e,t)=>()=>(e&&(t=e(e=0)),t);var V=(e,t)=>{for(var o in t)Gt(e,o,{get:t[o],enumerable:true});};var le,Jt,Te=c(()=>{le=e=>{let{title:t,subtitle:o,content:i,docOpenOptions:a}=e,{t:r}=useTranslation();return jsxs(Flex,{id:"oui-tradingRewards-home-title",p:6,direction:"column",itemAlign:"start",gap:4,className:"oui-bg-base-9 oui-font-semibold",r:"2xl",width:"100%",children:[t||jsx(Text,{size:"lg",children:r("common.tradingRewards")}),jsx(Divider,{intensity:8,className:"oui-w-full"}),jsxs(Flex,{direction:"column",itemAlign:"start",gap:1,children:[o||jsx(Text,{size:"base",children:r("tradingRewards.subtitle",{brokerName:e.brokerName})}),i||jsx(Jt,{docOpenOptions:a})]})]})},Jt=e=>{let{t}=useTranslation();return jsxs("div",{className:"oui-text-sm oui-text-base-contrast-54 oui-font-normal oui-flex oui-gap-1 oui-items-center hover:oui-text-primary-darken oui-text-primary-light oui-cursor-pointer",onClick:()=>[window.open(e.docOpenOptions?.url,e.docOpenOptions?.target,e.docOpenOptions?.features)],children:[jsx("span",{className:"oui-text-primary-light hover:oui-text-primary-darken oui-cursor-pointer",children:t("tradingRewards.learnMore")}),jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M4.008 7.995c0-.368.298-.666.666-.666H9.71L7.733 5.331l.937-.936 3.143 3.122c.13.13.195.304.195.479a.67.67 0 0 1-.195.478L8.67 11.596l-.937-.937 1.978-1.998H4.674a.666.666 0 0 1-.666-.666"})})]})};});var it,ce,E,H=c(()=>{it=createContext({}),ce=e=>{let{type:t=TWType.normal,showEpochPauseCountdown:o,titleConfig:i={docOpenOptions:{url:"https://orderly.network/docs/introduction/tokenomics/trading-rewards",target:"_blank"}},children:a}=e,r=useConfig("brokerId"),{statusInfo:n}=useTradingRewardsStatus(t===TWType.mm),d=useGetClaimed(t===TWType.mm?DistributionId.mmOrder:DistributionId.order),g=useGetClaimed(t===TWType.mm?DistributionId.mmEsOrder:DistributionId.esORder),[u]=useAllBrokers(),[w]=useCurEpochEstimate(t),f=useWalletRewardsHistory(t),C=useEpochInfo(t),b=useMemo(()=>u?.[r],[r,u]),L=useMemo(()=>({type:t,totalOrderClaimedReward:d,totalEsOrderClaimedReward:g,epochList:C,curEpochEstimate:w,walletRewardsHistory:f,titleConfig:i,brokerId:r,brokerName:b,brokers:u,statusInfo:n,showEpochPauseCountdown:o??false}),[t,d,g,C,w,f,i,r,b,u,n,o]);return jsx(it.Provider,{value:L,children:a})},E=()=>useContext(it);});var at,st=c(()=>{H();at=()=>{let{titleConfig:e}=E();return e};});var nt={};V(nt,{TitleWidget:()=>ye});var ye,Ne=c(()=>{st();Te();ye=()=>{let e=at();return jsx(le,{...e})};});var Y,Se=c(()=>{H();Y=()=>{let{epochList:e,curEpochEstimate:t,brokerId:o,brokerName:i,statusInfo:a,showEpochPauseCountdown:r}=E(),{wrongNetwork:n,disabledConnect:d}=useAppContext(),{connect:g}=useWalletConnector(),{state:u}=useAccount(),w=useMemo(()=>u.status<=AccountStatusEnum.SignedIn||n||d,[u,n,d]),f=useMemo(()=>u.status<=AccountStatusEnum.SignedIn||d,[u,d]),C=useMemo(()=>{if(typeof t>"u"||t===null)return;let b=t.rows.filter(S=>S.broker_id!==o).reduce((S,_)=>S+_.est_r_account,0),L=Number(t.est_r_wallet)-b;return {brokerName:i,curRewards:L,otherRewards:b}},[o,i,t]);return {epochList:e,estimate:t,hideData:w,notConnected:f,connect:g,rewardsTooltip:w?void 0:C,statusInfo:a,showEpochPauseCountdown:r}};});var k,K=c(()=>{k=e=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e.className,children:[jsxs("g",{clipPath:"url(#clip0_862_2449)",children:[jsx("path",{d:"M10.0249 19.9361C15.5202 19.9361 19.9751 15.4813 19.9751 9.98589C19.9751 4.49052 15.5202 0.0356445 10.0249 0.0356445C4.52949 0.0356445 0.0746155 4.49052 0.0746155 9.98589C0.0746155 15.4813 4.52949 19.9361 10.0249 19.9361Z",fill:"url(#paint0_linear_862_2449)"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.0992 5.0347C14.1824 5.0347 14.2202 4.93253 14.1556 4.88017C13.0272 3.96625 11.59 3.41876 10.0249 3.41876C8.4598 3.41876 7.02258 3.96625 5.89428 4.88017C5.82963 4.93253 5.86743 5.0347 5.95063 5.0347H14.0992ZM7.2658 11.6648C7.34763 11.6648 7.42329 11.707 7.47028 11.7739C8.03421 12.5781 8.96819 13.1038 10.025 13.1038C11.0817 13.1038 12.0156 12.5781 12.5796 11.7739C12.6266 11.707 12.7022 11.6648 12.7841 11.6648H16.2198C16.2985 11.6648 16.3559 11.7395 16.334 11.8151C15.5419 14.5521 13.0171 16.5531 10.0249 16.5531C7.03275 16.5531 4.50795 14.5521 3.71578 11.8151C3.6939 11.7395 3.75127 11.6648 3.83 11.6648H7.2658ZM12.335 7.8919C12.3825 7.94426 12.4493 7.97581 12.5199 7.97581H16.114C16.1955 7.97581 16.2533 7.89653 16.2264 7.81972C15.9727 7.0936 15.5951 6.42564 15.119 5.84118C15.0743 5.78631 15.007 5.75526 14.9361 5.75526H5.11354C5.04279 5.75526 4.97543 5.78631 4.93075 5.84118C4.4546 6.42564 4.07701 7.0936 3.82337 7.81972C3.79653 7.89653 3.8543 7.97581 3.93567 7.97581H7.52983C7.60053 7.97581 7.66725 7.94426 7.71477 7.8919C8.28522 7.263 9.10892 6.86807 10.0249 6.86807C10.9408 6.86807 11.7646 7.263 12.335 7.8919ZM13.028 10.8273C13.0114 10.8862 13.0549 10.9458 13.116 10.9458H16.4447C16.4894 10.9458 16.5273 10.913 16.5333 10.8688C16.572 10.5798 16.5921 10.285 16.5921 9.98539C16.5921 9.56935 16.5534 9.1623 16.4795 8.76771C16.4716 8.72551 16.4345 8.6952 16.3916 8.6952H13.0042C12.9388 8.6952 12.895 8.763 12.9195 8.82377C13.0636 9.18276 13.1429 9.57477 13.1429 9.98529C13.1429 10.277 13.1029 10.5595 13.028 10.8273ZM6.9338 10.9458C6.99492 10.9458 7.03829 10.8862 7.02183 10.8273C6.94688 10.5595 6.90682 10.277 6.90682 9.98529C6.90682 9.57477 6.98617 9.18276 7.13037 8.82377C7.15477 8.763 7.11101 8.6952 7.04553 8.6952H3.65817C3.61522 8.6952 3.5782 8.72551 3.5703 8.76771C3.49631 9.1623 3.45761 9.56935 3.45761 9.98539C3.45761 10.285 3.47767 10.5798 3.51651 10.8688C3.52246 10.913 3.56045 10.9458 3.60511 10.9458H6.9338Z",fill:"url(#paint1_linear_862_2449)"})]}),jsxs("defs",{children:[jsxs("linearGradient",{id:"paint0_linear_862_2449",x1:"10.0249",y1:"-2.24058",x2:"10.0249",y2:"21.2774",gradientUnits:"userSpaceOnUse",children:[jsx("stop",{stopColor:"white"}),jsx("stop",{offset:"1",stopColor:"#EDE9F4"})]}),jsxs("linearGradient",{id:"paint1_linear_862_2449",x1:"10.0249",y1:"3.41876",x2:"10.0249",y2:"16.5531",gradientUnits:"userSpaceOnUse",children:[jsx("stop",{stopColor:"#C750FF"}),jsx("stop",{offset:"1",stopColor:"#5800E8"})]}),jsx("clipPath",{id:"clip0_862_2449",children:jsx("rect",{width:"20",height:"20",fill:"white"})})]})]});});var F,X=c(()=>{F=e=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e.className,children:[jsxs("g",{clipPath:"url(#clip0_862_2443)",children:[jsx("path",{d:"M10.0249 19.9491C15.5202 19.9491 19.9751 15.4942 19.9751 9.99883C19.9751 4.50346 15.5202 0.048584 10.0249 0.048584C4.52949 0.048584 0.0746155 4.50346 0.0746155 9.99883C0.0746155 15.4942 4.52949 19.9491 10.0249 19.9491Z",fill:"url(#paint0_linear_862_2443)"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.1556 4.8931C14.2202 4.94547 14.1824 5.04764 14.0992 5.04764H5.95063C5.86743 5.04764 5.82963 4.94547 5.89428 4.8931C7.02258 3.97918 8.4598 3.4317 10.0249 3.4317C11.59 3.4317 13.0272 3.97918 14.1556 4.8931Z",fill:"white"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.47028 11.7869C7.4233 11.7199 7.34764 11.6777 7.26581 11.6777H3.83C3.75128 11.6777 3.69391 11.7525 3.71579 11.8281C4.50796 14.565 7.03275 16.566 10.0249 16.566C13.0171 16.566 15.5419 14.565 16.334 11.8281C16.3559 11.7525 16.2985 11.6777 16.2198 11.6777H12.7841C12.7022 11.6777 12.6266 11.7199 12.5796 11.7869C12.0156 12.5911 11.0817 13.1167 10.025 13.1167C8.96818 13.1167 8.03421 12.5911 7.47028 11.7869Z",fill:"white"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.335 7.90476C12.3825 7.95713 12.4493 7.98867 12.5199 7.98867H16.114C16.1955 7.98867 16.2533 7.9094 16.2264 7.83259C15.9727 7.10647 15.5951 6.43851 15.119 5.85405C15.0743 5.79918 15.007 5.76813 14.9361 5.76813H5.11354C5.04278 5.76813 4.97543 5.79918 4.93074 5.85405C4.45459 6.43851 4.07701 7.10647 3.82337 7.83259C3.79652 7.9094 3.85428 7.98867 3.93567 7.98867H7.52982C7.60052 7.98867 7.66725 7.95713 7.71475 7.90476C8.28522 7.27587 9.10892 6.88093 10.0249 6.88093C10.9408 6.88093 11.7646 7.27587 12.335 7.90476Z",fill:"white"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.116 10.9587C13.0549 10.9587 13.0114 10.8991 13.028 10.8402C13.1029 10.5723 13.1429 10.29 13.1429 9.99822C13.1429 9.5877 13.0636 9.19568 12.9195 8.83669C12.895 8.77593 12.9388 8.70813 13.0042 8.70813H16.3916C16.4345 8.70813 16.4716 8.73843 16.4795 8.78064C16.5534 9.17523 16.5921 9.58228 16.5921 9.99832C16.5921 10.2979 16.572 10.5927 16.5333 10.8816C16.5273 10.9259 16.4894 10.9587 16.4447 10.9587H13.116ZM7.02183 10.8402C7.03829 10.8991 6.99492 10.9587 6.93381 10.9587H3.60511C3.56045 10.9587 3.52246 10.9259 3.51651 10.8816C3.47767 10.5927 3.45761 10.2979 3.45761 9.99832C3.45761 9.58228 3.49631 9.17523 3.5703 8.78064C3.5782 8.73843 3.61523 8.70813 3.65817 8.70813H7.04553C7.11101 8.70813 7.15477 8.77593 7.13037 8.83669C6.98617 9.19568 6.90682 9.5877 6.90682 9.99822C6.90682 10.29 6.94688 10.5723 7.02183 10.8402Z",fill:"white"})]}),jsxs("defs",{children:[jsxs("linearGradient",{id:"paint0_linear_862_2443",x1:"10.0249",y1:"0.0486119",x2:"10.0249",y2:"19.9491",gradientUnits:"userSpaceOnUse",children:[jsx("stop",{stopColor:"#C750FF"}),jsx("stop",{offset:"1",stopColor:"#5800E8"})]}),jsx("clipPath",{id:"clip0_862_2443",children:jsx("rect",{width:"20",height:"20",fill:"white"})})]})]});});var j,Fe=c(()=>{j=e=>{let[t,o]=useState(false),{t:i}=useTranslation();return jsx(Tooltip,{content:jsxs(Flex,{direction:"column",className:"oui-leading-[1.5] oui-text-2xs oui-text-base-contrast-80 oui-min-w-[204px]",gap:1,children:[jsxs(Flex,{gap:1,width:"100%",children:[jsx(Text,{className:"oui-flex-1",children:e.rewardsTooltip?.brokerName}),jsx(Text,{children:commifyOptional(e.rewardsTooltip?.curRewards,{fix:2})})]}),jsxs(Flex,{gap:1,width:"100%",children:[jsx(Text,{className:"oui-flex-1",children:i("tradingRewards.otherOrderlyDex")}),jsx(Text,{children:commifyOptional(e.rewardsTooltip?.otherRewards,{fix:2})})]})]}),align:e.align,className:e.className,open:t,onOpenChange:o,arrow:{className:e.arrowClassName},delayDuration:100,children:e.children?O.cloneElement(e.children,{onClick:r=>{r.preventDefault(),o(!t);}}):jsx("svg",{width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"oui-cursor-pointer",onClick:r=>{r.preventDefault(),o(!t);},children:jsx("path",{d:"M10.5 1.678a8.333 8.333 0 1 0-.001 16.667 8.333 8.333 0 0 0 0-16.667m0 4.167a.833.833 0 1 1-.001 1.667.833.833 0 0 1 0-1.667m0 2.5c.46 0 .832.373.832.833v4.167a.833.833 0 0 1-1.666 0V9.178c0-.46.373-.833.833-.833",fill:"#fff",fillOpacity:".36"})})})};});var te,wo,ct,mt,pt,ho,Co,Oe=c(()=>{K();X();Fe();te=e=>{let{t}=useTranslation(),o=e,i=o.epochList?.[1].curEpochInfo,a=o.epochList?.[0],r=i?.start_time,n=i?.end_time,d=i?.epoch_id,g=i?.max_reward_amount,u=i?.epoch_token,w=i?`${i?.epoch_token}`.toLowerCase()==="order":void 0,f=useMemo(()=>{if(!e.showEpochPauseCountdown||!a||e.statusInfo?.epochStatus!==EpochStatus.paused)return;let b=e.statusInfo?.lastCompletedEpoch;if(b===void 0)return;let L=b+1;return a.find(_=>_.epoch_id===L)?.start_time},[e.statusInfo?.epochStatus,a]),C=useMemo(()=>e.statusInfo?.epochStatus===EpochStatus.paused&&f,[e.statusInfo?.epochStatus,f]);return e.statusInfo?.epochStatus!==EpochStatus.active?jsx(Flex,{id:"oui-tradingRewards-home-currentEpoch",r:"2xl",className:"oui-bg-base-9 oui-font-semibold oui-p-10",width:"100%",height:"100%",direction:"column",itemAlign:"stretch",children:jsxs(Flex,{gap:2,direction:"column",justify:"center",itemAlign:"center",className:"oui-size-full",children:[C?jsxs(Flex,{gap:2,direction:"column",justify:"center",itemAlign:"center",children:[jsx(Text,{className:"oui-text-base-contrast-54 oui-text-sm",children:t("tradingRewards.epochPauseCountdown.title")}),jsx(mt,{targetTimestamp:f,isStandalone:true})]}):jsx(Flex,{className:"oui-text-base-contrast-54 oui-text-sm oui-text-center",justify:"center",itemAlign:"center",children:e.statusInfo?.epochStatus===EpochStatus.paused?t("tradingRewards.eopchStatus.pause"):t("tradingRewards.eopchStatus.ended")}),e.statusInfo?.epochStatus===EpochStatus.paused&&jsx("div",{className:cn("oui-w-full",C?"oui-mt-2":"oui-mt-0"),children:jsx(Co,{})})]})}):jsxs(Flex,{id:"oui-tradingRewards-home-currentEpoch",r:"2xl",className:"oui-bg-base-9 oui-font-semibold",width:"100%",height:"100%",direction:"column",itemAlign:"stretch",children:[jsx(mt,{targetTimestamp:n}),jsxs(Flex,{p:6,direction:"column",gap:4,className:"oui-h-full",children:[jsxs(Flex,{direction:"row",gap:3,width:"100%",justify:"around",children:[jsx(ct,{title:t("tradingRewards.epoch"),highLight:d?`${d}`:"--",text:r&&n?`${pt(r)} - ${pt(n)}`:""}),jsx(ct,{title:t("tradingRewards.epochRewards"),highLight:commifyOptional(g,{fix:0}),text:u})]}),jsx(wo,{isOrder:w,direction:o.notConnected?"row":"column",justify:o.notConnected?"between":"center",hideData:o.hideData,estRewards:o.hideData?"--":e.estimate?.est_r_wallet,rewardsTooltip:e.rewardsTooltip,background:o.notConnected?"linear-gradient(28.29deg, #1B1D22 21.6%, #26292E 83.23%)":"linear-gradient(0deg, #2D0061 2.62%, #BD6BED 86.5%)"}),jsx("div",{className:"oui-w-full",children:jsx(AuthGuard,{status:AccountStatusEnum.SignedIn,buttonProps:{fullWidth:true},children:jsx(Fragment,{})})})]})]})},wo=e=>{let{t}=useTranslation();return jsxs(Flex,{direction:e.direction,gap:2,py:4,px:6,width:"100%",r:"xl",itemAlign:"center",justify:e.justify,style:{background:e.background},className:"oui-flex-1 oui-h-full",children:[jsx(Text,{className:"oui-text-base xl:oui-text-lg oui-text-base-contrast-54",children:t("tradingRewards.myEstRewards")}),jsxs(Flex,{direction:"row",gap:3,children:[e.isOrder==true&&jsx(F,{className:"oui-w-5 oui-h-5 md:oui-w-6 md:oui-h-6 lg:oui-w-7 lg:oui-h-7 xl:oui-w-8 xl:oui-h-8"}),e.isOrder==false&&jsx(k,{className:"oui-w-5 oui-h-5 md:oui-w-6 md:oui-h-6 lg:oui-w-7 lg:oui-h-7 xl:oui-w-8 xl:oui-h-8"}),jsx(Text,{children:commifyOptional(e.estRewards,{fix:2}),className:"oui-text-xl md:oui-text-2xl xl:oui-text-[32px]"}),e.rewardsTooltip&&jsx(j,{rewardsTooltip:e.rewardsTooltip})]})]})},ct=e=>{let{title:t,highLight:o,text:i}=e;return jsxs(Flex,{py:2,justify:"between",direction:"column",className:"flex-1",gap:2,children:[jsx(Text,{className:cn("oui-text-base-contrast-54","oui-text-xs md:oui-text-sm xl:oui-text-base","oui-leading-[20px] xl:oui-leading-[24px]"),children:t}),jsxs(Flex,{direction:"row",gap:1,itemAlign:"end",justify:"center",children:[jsx(Text.gradient,{color:"brand",angle:90,className:"oui-text-base md:oui-text-lg lg:oui-text-xl xl:oui-text-2xl",children:o}),jsx(Text,{intensity:80,className:"oui-mb-[3px] oui-text-2xs md:oui-text-xs xl:oui-text-sm",children:i})]})]})},mt=e=>{let{targetTimestamp:t,isStandalone:o}=e,{t:i}=useTranslation(),[a,r]=useState({days:0,hours:0,minutes:0,seconds:0});useEffect(()=>{let d=setInterval(()=>{if(typeof t>"u")return;let g=new Date().getTime(),u=t-g;if(u<0)clearInterval(d),r({days:0,hours:0,minutes:0,seconds:0});else {let w=Math.floor(u/864e5),f=Math.floor(u%(1e3*60*60*24)/(1e3*60*60)),C=Math.floor(u%(1e3*60*60)/(1e3*60)),b=Math.floor(u%(1e3*60)/1e3);r({days:w,hours:f,minutes:C,seconds:b});}},1e3);return ()=>clearInterval(d)},[t]);let n=d=>jsx(Text,{className:"oui-text-sm oui-text-base-contrast md:oui-text-base lg:oui-text-lg ",children:d});return jsx(Box,{className:"oui-rounded-t-2xl oui-font-semibold oui-text-base-contrast-54",gradient:o?void 0:"neutral",angle:180,width:"full",children:jsxs(Flex,{justify:"center",gap:1,children:[o?null:jsx("span",{children:`${i("common.countdown")}: `}),jsxs(Flex,{direction:"row",itemAlign:"end",gap:1,className:cn("oui-text-2xs md:oui-text-xs lg:oui-text-sm",o?"oui-py-0":"oui-py-[13px]"),children:[n(`${a.days}`.padStart(2,"0")),jsx("span",{children:"D"}),n(`${a.hours}`.padStart(2,"0")),jsx("span",{children:"H"}),n(`${a.minutes}`.padStart(2,"0")),jsx("span",{children:"M"}),n(`${a.seconds}`.padStart(2,"0")),jsx("span",{children:"S"})]})]})})},pt=e=>{if(!e)return "";let t=new Date(e),i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getUTCMonth()],a=t.getUTCDate();return `${i}. ${a}`},ho=e=>jsxs("svg",{width:"21",height:"20",viewBox:"0 0 21 20",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[jsx("mask",{id:"mask0_1997_45723",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"21",height:"20",children:jsx("rect",{x:"0.5",width:"20",height:"20",fill:"#D9D9D9"})}),jsx("g",{mask:"url(#mask0_1997_45723)",children:jsx("path",{d:"M12.0384 14.7111L11.1603 13.8073L14.343 10.6246H4.25V9.37463H14.343L11.1603 6.19192L12.0384 5.28809L16.75 9.99961L12.0384 14.7111Z"})})]}),Co=()=>{let{t:e}=useTranslation();return jsxs(Flex,{gap:1,itemAlign:"center",justify:"center",className:"oui-group oui-cursor-pointer oui-fill-base-contrast-36 oui-text-sm oui-text-base-contrast-36 group-hover:oui-text-base-contrast-80",onClick:()=>window.open("https://x.com/OrderlyNetwork"),children:[jsx("div",{className:"oui-cursor-pointer oui-fill-base-contrast-36 oui-text-sm oui-text-base-contrast-36 group-hover:oui-text-base-contrast-80",children:e("tradingRewards.eopchStatus.linkDescription")}),jsx(ho,{className:"oui-text-fill-base-contrast-36 oui-fill-base-contrast-36 group-hover:oui-fill-base-contrast-80"})]})};});var Pe,xt=c(()=>{Se();Oe();Pe=()=>{let e=Y();return jsx(te,{...e})};});var gt={};V(gt,{CurEpoch:()=>te,CurEpochWidget:()=>Pe,useCurEpochScript:()=>Y});var Ie=c(()=>{xt();Oe();Se();});var bt,Rt=c(()=>{H();bt=()=>{let{totalOrderClaimedReward:e,walletRewardsHistory:t,totalEsOrderClaimedReward:o}=E(),[i]=e,[a]=o,{namespace:r}=useWalletConnector(),[n]=t,d=useMemo(()=>r===ChainNamespace.evm?n?.wallet_lifetime_trading_rewards_order:n?.wallet_pending_trading_rewards_order,[r,n]),g=useMemo(()=>r===ChainNamespace.evm?n?.wallet_lifetime_trading_rewards_escrow:n?.wallet_pending_trading_rewards_escrow,[n,r]),u=useGetEnv(),w=_=>{let $=`https://${u!==ENVType.prod?`${u}-`:""}app.orderly.network/tradingRewards`;window.open($,"_blank");},f=useCallback((_,$)=>{if(typeof $<"u"&&typeof _<"u"){let h=new Decimal(_).sub($).toFixed(18,Decimal.ROUND_DOWN);return Number(h)}},[]),C=useMemo(()=>f(d,i),[d,i,f]),b=useMemo(()=>f(g,a),[g,a,f]),L=useDataTap(C),S=useDataTap(b);return {order:L??void 0,esOrder:S??void 0,goToClaim:w}};});var ge,Le=c(()=>{ge=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:jsx("path",{d:"M11.3275 13.9938C12.8001 13.9938 13.9941 12.7998 13.9941 11.3272V4.66049C13.9941 3.18782 12.8001 1.99382 11.3275 1.99382H4.66081C3.18814 1.99382 1.99414 3.18782 1.99414 4.66049V11.3272C1.99414 12.7998 3.18814 13.9938 4.66081 13.9938H11.3275ZM5.99414 10.6605C5.82347 10.6605 5.64548 10.6031 5.51481 10.4732C5.25481 10.2125 5.25481 9.77516 5.51481 9.51449L8.18148 6.84782L6.66081 5.32715H10.6608V9.32715L9.14014 7.80648L6.47347 10.4732C6.34347 10.6031 6.16481 10.6605 5.99414 10.6605Z"})});});var oe,yt,He=c(()=>{Le();K();X();oe=e=>{let{t}=useTranslation();return jsxs(Flex,{id:"oui-tradingRewards-home-availableToClaim",p:6,r:"2xl",direction:"column",gap:4,width:"100%",className:" oui-font-semibold oui-bg-base-9 ",children:[jsxs(Flex,{direction:"row",justify:"between",width:"100%",children:[jsx(Text,{className:"oui-text-lg",children:t("tradingRewards.availableClaim")}),jsxs(Flex,{direction:"row",gap:1,onClick:e.goToClaim,className:"oui-cursor-pointer oui-text-primary-light",children:[jsx(Text,{size:"sm",children:t("tradingRewards.claim")}),jsx(ge,{})]})]}),jsxs(Flex,{direction:"row",gap:3,width:"100%",children:[jsx(yt,{title:"ORDER",value:e.order}),jsx(yt,{title:"esORDER",value:e.esOrder,isEsOrder:true})]})]})},yt=e=>{let{value:t}=e;return jsxs(Flex,{className:"oui-flex-1 oui-bg-base-8 oui-py-[11px]",direction:"column",gap:2,r:"xl",gradient:"neutral",angle:180,border:true,borderColor:6,children:[jsx(Text,{className:"oui-text-xs xl:oui-text-sm oui-text-base-contrast-54",children:e.title}),jsxs(Flex,{direction:"row",gap:1,children:[e.isEsOrder?jsx(k,{}):jsx(F,{}),jsx(Text,{className:"oui-text-sm xl:oui-text-base",children:commifyOptional(t,{fix:2})})]})]})};});var Me,Nt=c(()=>{Rt();He();Me=()=>{let e=bt();return jsx(oe,{...e})};});var vt={};V(vt,{AvailableToClaim:()=>oe,AvailableToClaimWidget:()=>Me});var Ae=c(()=>{Nt();He();});var St,_t=c(()=>{H();St=()=>{let{curEpochEstimate:e}=E(),t=useGetEnv(),o=r=>{let n=`https://${t!==ENVType.prod?`${t}-`:""}app.orderly.network/staking`;window.open(n,"_blank");},i=useDataTap(e),a=useMemo(()=>{let r=e?.est_stake_boost;if(!(typeof r>"u"||r===null))return r===0?r:new Decimal(r).div(new Decimal(10).pow(.15)).toDecimalPlaces(2,Decimal.ROUND_DOWN).toString()},[e?.est_stake_boost]);return {curEpochEstimate:i??void 0,stakeNow:o,booster:a}};});var Ft,Et=c(()=>{Ft=()=>jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M14.439 10.5672C14.0868 10.9198 13.7025 11.2403 13.3183 11.5287C13.1902 11.6248 13.1261 11.721 13.0941 11.8812C12.7739 13.1952 12.1015 14.4451 11.0448 15.5027C10.5645 15.9835 10.0522 16.3681 9.47584 16.7206C8.99553 17.009 8.41917 16.5283 8.61129 15.9835C8.93149 15.1502 9.05957 14.2528 9.05957 13.3234C8.99553 13.3234 8.89947 13.3555 8.83543 13.3555C8.06695 12.7145 7.3625 12.0415 6.65805 11.3364C5.95361 10.6313 5.28118 9.89421 4.64078 9.15708C4.64078 9.09299 4.6728 8.99684 4.6728 8.93274C3.74421 8.93274 2.84764 9.09299 2.01512 9.38143C1.50279 9.57372 0.990469 8.99684 1.27865 8.51611C1.63087 7.93923 2.01512 7.42645 2.49542 6.94572C3.55209 5.88811 4.80088 5.21508 6.11371 4.89459C6.24179 4.86255 6.36987 4.7664 6.46593 4.67025C6.75412 4.25362 7.07432 3.90108 7.42654 3.54855C9.92412 1.04874 13.4143 0.183422 16.6484 0.920545C16.8725 0.984642 17.0326 1.14489 17.0967 1.36923C17.8011 4.57411 16.9366 8.06742 14.439 10.5672ZM13.0301 4.95869C12.2616 4.18952 10.9808 4.18952 10.2123 4.95869C9.44382 5.72786 9.44382 7.00982 10.2123 7.77899C10.9808 8.54816 12.2616 8.54816 13.0301 7.77899C13.8306 6.97777 13.8306 5.72786 13.0301 4.95869ZM5.88957 14.7656C5.28118 15.3745 1.53481 17.9385 0.798348 17.2013C0.0618817 16.4642 2.6235 12.7145 3.23189 12.1056C3.84027 11.4966 4.92896 11.5928 5.66543 12.3299C6.40189 13.067 6.49795 14.1567 5.88957 14.7656Z",fill:"url(#paint0_linear_88_1748)"}),jsx("defs",{children:jsxs("linearGradient",{id:"paint0_linear_88_1748",x1:"17.3331",y1:"8.99996",x2:"0.666504",y2:"8.99996",gradientUnits:"userSpaceOnUse",children:[jsx("stop",{stopColor:"rgb(var(--oui-gradient-brand-end))"}),jsx("stop",{offset:"1",stopColor:"rgb(var(--oui-gradient-brand-start))"})]})})]});});var ie,Ot,Be=c(()=>{Le();K();X();Et();ie=e=>{let{t}=useTranslation();return jsxs(Flex,{id:"oui-tradingRewards-home-stakeBooster",p:6,r:"2xl",direction:"column",gap:4,width:"100%",className:" oui-font-semibold oui-bg-base-9 ",children:[jsxs(Flex,{direction:"row",justify:"between",width:"100%",children:[jsx(Text,{className:"oui-text-lg",children:t("tradingRewards.stakeBooster")}),jsxs(Flex,{direction:"row",gap:1,onClick:e.stakeNow,className:"oui-cursor-pointer oui-text-primary-light",children:[jsx(Text,{size:"sm",children:t("tradingRewards.stake")}),jsx(ge,{})]})]}),jsxs(Flex,{direction:"row",gap:3,width:"100%",children:[jsx(Ot,{title:t("tradingRewards.avgStakedAmount"),value:e.curEpochEstimate?.est_avg_stake,icon:jsxs("div",{className:"oui-flex oui-w-[32px] oui-h-[20px] oui-relative",children:[jsx("div",{className:"oui-absolute oui-right-0 oui-top-0",children:jsx(k,{})}),jsx("div",{className:"oui-absolute oui-left-0 oui-top-0 ",children:jsx(F,{})})]})}),jsx(Ot,{title:t("tradingRewards.booster"),value:e.booster,icon:jsx(Ft,{}),gradient:true})]})]})},Ot=e=>{let t=commify(e.value||"--",2);return jsxs(Flex,{className:"oui-flex-1 oui-bg-base-8 oui-py-[11px]",direction:"column",gap:2,r:"xl",gradient:"neutral",angle:180,border:true,borderColor:6,children:[jsx(Text,{className:"oui-text-xs xl:oui-text-sm oui-text-base-contrast-54",children:e.title}),jsxs(Flex,{direction:"row",gap:1,children:[e.icon,e.gradient?jsx(Text.gradient,{className:"oui-text-sm xl:oui-text-base",color:"brand",angle:90,children:t+(t==="--"?"":"x")}):jsx(Text,{className:"oui-text-sm xl:oui-text-base",children:commifyOptional(e.value,{fix:2})})]})]})};});var We,Pt=c(()=>{_t();Be();We=()=>{let e=St();return jsx(ie,{...e})};});var It={};V(It,{StakeBooster:()=>ie,StakeBoosterWidget:()=>We});var ze=c(()=>{Pt();Be();});function A(e){if(typeof e>"u")return {firstPart:"-",secondPart:""};let t=new Date(e),i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getUTCMonth()],a=t.getUTCDate().toString().padStart(2,"0"),r=t.getUTCFullYear(),n=t.getUTCHours(),d=t.getUTCMinutes(),g=n>=12?"PM":"AM",u=(n%12).toString().padStart(2,"0"),w=d.toString().padStart(2,"0");return {firstPart:`${i} ${a}, ${r}`,secondPart:`${u}:${w} ${g}`}}var ae,Uo,Go,Zo,Ve=c(()=>{K();X();Fe();ae=e=>{let{t}=useTranslation();return jsxs(Flex,{id:"oui-tradingRewards-home-rewardHistory",py:4,px:3,direction:"column",gap:2,itemAlign:"start",r:"2xl",className:"oui-bg-base-9 oui-w-full oui-font-semibold oui-tabular-nums",children:[jsx(Text,{className:"oui-text-lg oui-px-3",children:t("tradingRewards.rewardHistory")}),jsx("div",{className:"oui-border-t-2 oui-border-line-4 oui-w-full",children:jsx(Uo,{...e})})]})},Uo=e=>useMediaQuery("(max-width: 767px)")?jsx(ListView,{dataSource:e.originalData,renderItem:(o,i)=>jsx(Go,{data:o}),className:"oui-mt-3 oui-max-h-[356px]"}):jsx(Box,{px:3,children:jsx(Zo,{...e})}),Go=e=>{let{data:t}=e,{t:o}=useTranslation(),i=`${t?.info?.epoch_token||t.epoch_token}`.toLowerCase()==="order",a=commifyOptional(t.info?.r_wallet,{fix:2});return jsxs(Flex,{direction:"column",px:4,pt:0,gap:3,className:"oui-text-base-contrast-80",children:[jsxs(Flex,{direction:"row",width:"100%",children:[jsxs(Flex,{direction:"column",className:"oui-gap-[6px] oui-flex-1",itemAlign:"start",children:[jsx(Text,{className:"oui-text-base-contrast-36 oui-text-2xs",children:o("tradingRewards.epoch")}),jsx(Text,{className:"oui-text-sm",children:`Epoch ${t.epoch_id}`})]}),jsxs(Flex,{direction:"column",className:"oui-gap-[6px] oui-flex-1",itemAlign:"start",children:[jsxs(Text,{className:"oui-text-base-contrast-36 oui-text-2xs",children:[o("tradingRewards.epochRewards")," "]}),jsxs(Flex,{gap:1,children:[i?jsx(F,{}):jsx(k,{}),jsx(Text,{className:"oui-text-sm",children:commifyOptional(t.max_reward_amount,{fix:2})})]})]}),jsxs(Flex,{direction:"column",className:"oui-gap-[6px] oui-flex-1",itemAlign:"end",children:[jsxs(Text,{className:"oui-text-base-contrast-36 oui-text-2xs",children:[o("tradingRewards.rewardsEarned")," "]}),jsxs(Flex,{gap:1,children:[a!=="--"&&(i?jsx(F,{}):jsx(k,{})),t.rewardsTooltip?jsx(j,{rewardsTooltip:t.rewardsTooltip,children:jsx(Text,{className:"oui-text-sm oui-underline oui-decoration-dashed oui-cursor-pointer oui-underline-offset-4 oui-decoration-line-16",children:a}),align:"center",className:"oui-bg-base-5",arrowClassName:"oui-fill-base-5"}):jsx(Text,{className:"oui-text-sm",children:a})]})]})]}),jsxs(Flex,{direction:"row",width:"100%",children:[jsxs(Flex,{direction:"column",className:"oui-gap-[6px] oui-flex-1",itemAlign:"start",children:[jsx(Text,{className:"oui-text-base-contrast-36 oui-text-2xs",children:o("tradingRewards.rewardHistory.column.startDate")}),jsxs(Flex,{direction:"row",children:[jsxs(Text,{className:"oui-text-sm",children:[A(t.start_time).firstPart,"\xA0"]}),jsx(Text,{className:"oui-text-2xs oui-text-base-contrast-36",children:A(t.start_time).secondPart})]})]}),jsxs(Flex,{direction:"column",className:"oui-gap-[6px] oui-flex-1",itemAlign:"end",children:[jsx(Text,{className:"oui-text-base-contrast-36 oui-text-2xs",children:o("tradingRewards.rewardHistory.column.endDate")}),jsxs(Flex,{direction:"row",children:[jsxs(Text,{className:"oui-text-sm",children:[A(t.end_time).firstPart,"\xA0"]}),jsx(Text,{className:"oui-text-2xs oui-text-base-contrast-36",children:A(t.end_time).secondPart})]})]})]}),jsx(Divider,{className:"oui-w-full"})]},t.epoch_id)},Zo=e=>{let{data:t}=e,{t:o}=useTranslation(),i=[{title:o("tradingRewards.epoch"),dataIndex:"epoch_id",className:"oui-w-1/4 oui-pl-0 oui-pr-0",render:a=>jsx(Text,{children:`${o("tradingRewards.epoch")} ${a}`})},{title:o("tradingRewards.rewardHistory.column.start&EndDate"),dataIndex:"time",className:"oui-w-1/4 oui-pl-0 oui-pr-0",render:(a,r)=>jsxs(Flex,{direction:"column",className:"oui-gap-[2px]",justify:"start",itemAlign:"start",children:[jsxs(Flex,{direction:"row",gap:1,children:[jsx(Text,{children:A(r.start_time).firstPart}),jsx(Text,{className:"oui-text-base-contrast-54",children:A(r.start_time).secondPart})]}),jsxs(Flex,{direction:"row",gap:1,children:[jsx(Text,{children:A(r.end_time).firstPart}),jsx(Text,{className:"oui-text-base-contrast-54",children:A(r.end_time).secondPart})]})]})},{title:o("tradingRewards.epochRewards"),dataIndex:"max_reward_amount",className:"oui-w-1/4 oui-pl-0 oui-pr-0",render:(a,r)=>{let n=`${r?.info?.epoch_token||r.epoch_token}`.toLowerCase()==="order";return jsxs(Flex,{direction:"row",gap:1,children:[n?jsx(F,{}):jsx(k,{}),jsx(Text,{children:commifyOptional(a)})]})}},{title:o("tradingRewards.rewardsEarned"),dataIndex:"earned",className:"oui-w-1/4 oui-pl-0 oui-pr-0",render:(a,r)=>{let n=`${r?.info?.epoch_token||r.epoch_token}`.toLowerCase()==="order",d=jsx(Text,{className:r.rewardsTooltip?"oui-underline oui-decoration-dashed oui-cursor-pointer oui-underline-offset-4 oui-decoration-line-16":"",children:commifyOptional(r.info?.r_wallet,{fix:2})});return r.rewardsTooltip&&(d=jsx(j,{rewardsTooltip:r.rewardsTooltip,children:d,align:"center",className:"oui-bg-base-5",arrowClassName:"oui-fill-base-5"})),jsxs(Flex,{direction:"row",gap:1,children:[n?jsx(F,{}):jsx(k,{}),d]})}}];return jsx(DataTable,{bordered:true,columns:i,loading:e.isLoading,dataSource:t,emptyView:jsx(AuthGuardEmpty,{status:AccountStatusEnum.SignedIn}),onRow:a=>({className:"oui-h-[59px]"}),pagination:e.pagination})};});var Lt,Ht=c(()=>{H();Lt=()=>{let{account:e}=useAccount(),{epochList:t,walletRewardsHistory:o,totalOrderClaimedReward:i,brokerId:a,brokerName:r}=E(),n=t?.[0],{isNotStared:d}=t?.[1],[g]=o,{wrongNetwork:u,disabledConnect:w}=useAppContext(),{data:f}=useAccountRewardsHistory(e.address),C=useMemo(()=>{if(d||w)return [];let S=[...n||[]].map(h=>{let R=h.epoch_id,Q=g?.rows.findIndex(se=>R===se.epoch_id),qe;if(Q!==-1&&!u){let se=g?.rows?.[Q],be=f?.findIndex(ne=>ne?.epoch_id===h.epoch_id);if(f!==void 0&&be!==void 0&&be!==-1){let ne=f[be].broker,Ke=ne.findIndex(Ut=>Ut.broker_id===a),Xe=(Ke!==-1?ne[Ke]:void 0)?.r_account??0,Vt=Math.max(0,(se?.r_wallet??0)-Xe);qe={brokerName:r,curRewards:Xe,otherRewards:Vt};}return {...h,info:se,rewardsTooltip:qe}}return {...h}});S.sort((h,R)=>h.epoch_id-R.epoch_id);let[_]=i;if(typeof _<"u")for(let h=0;h<S.length;h++){let R=S[h];if(typeof R?.info>"u"){R.state="Null";continue}let Q=R.info?.reward_status;Q==="Confirmed"?(_-R.info?.r_wallet>=0?R.state="Claimed":R.state="Claimable",_-=R.info?.r_wallet):Q==="Pending"&&(R.state="Processing");}S.sort((h,R)=>R.epoch_id-h.epoch_id);let $=getTimestamp();return S.filter(h=>h.end_time<=$)},[g,n,i,d,u,f,w]),{pagination:b}=usePagination();return {data:C,originalData:C,pagination:b,isLoading:t[1].isLoading}};});var Ue,Mt=c(()=>{Ht();Ve();Ue=()=>{let e=Lt();return jsx(ae,{...e})};});var At={};V(At,{RewardHistory:()=>ae,RewardsHistoryWidget:()=>Ue});var Ge=c(()=>{Ve();Mt();});var Bt={};V(Bt,{AvailableToClaim:()=>oe,AvailableToClaimWidget:()=>Me,CurEpoch:()=>te,CurEpochWidget:()=>Pe,HomePage:()=>Dt,RewardHistory:()=>ae,RewardsHistoryWidget:()=>Ue,StakeBooster:()=>ie,StakeBoosterWidget:()=>We,Title:()=>le,TitleWidget:()=>ye,TradingRewardsProvider:()=>ce,useCurEpochScript:()=>Y});Te();Ne();Ie();Ae();ze();Ge();H();H();var ar=O.lazy(()=>Promise.resolve().then(()=>(Ne(),nt)).then(e=>({default:e.TitleWidget}))),sr=O.lazy(()=>Promise.resolve().then(()=>(Ie(),gt)).then(e=>({default:e.CurEpochWidget}))),nr=O.lazy(()=>Promise.resolve().then(()=>(Ae(),vt)).then(e=>({default:e.AvailableToClaimWidget}))),lr=O.lazy(()=>Promise.resolve().then(()=>(ze(),It)).then(e=>({default:e.StakeBoosterWidget}))),dr=O.lazy(()=>Promise.resolve().then(()=>(Ge(),At)).then(e=>({default:e.RewardsHistoryWidget}))),ur=()=>{let{statusInfo:e}=useTradingRewardsStatus(false);return useMemo(()=>e?.epochStatus===EpochStatus.active,[e?.epochStatus])?jsx(O.Suspense,{fallback:null,children:jsx(lr,{})}):null},Dt=e=>jsx(ce,{titleConfig:e.titleConfig,showEpochPauseCountdown:e.showEpochPauseCountdown,children:jsxs(Flex,{id:"oui-tradingRewards-home-page",className:cn("oui-h-lvw oui-w-full",e.className),direction:"column",gap:4,children:[jsx(O.Suspense,{fallback:null,children:jsx(ar,{})}),jsxs(Flex,{className:"oui-flex oui-size-full oui-flex-col oui-gap-4 2xl:oui-flex-row 2xl:oui-items-stretch",children:[jsx(Box,{className:"oui-w-full 2xl:oui-size-auto 2xl:oui-flex-1",children:jsx(O.Suspense,{fallback:null,children:jsx(sr,{})})}),jsxs(Flex,{className:"oui-flex oui-w-full oui-flex-col oui-gap-4 lg:oui-flex-row 2xl:oui-flex-1 2xl:oui-flex-col",children:[jsx(O.Suspense,{fallback:null,children:jsx(nr,{})}),jsx(ur,{})]})]}),jsx(O.Suspense,{fallback:null,children:jsx(dr,{})})]})});var zt=(o=>(o.Trading="/rewards/trading",o.Affiliate="/rewards/affiliate",o))(zt||{}),Qe=e=>{let{t}=useTranslation(),[o,i]=useState(e.current||"/rewards/affiliate");useEffect(()=>{e.current&&i(e.current);},[e.current]);let a=useMemo(()=>[{name:t("common.trading"),href:"/rewards/trading",icon:jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M4.883 1.5c-.166.01-.393.076-.515.173a2 2 0 0 0-.18.173L.918 6.553a.86.86 0 0 0-.168.475c0 .339.232.543.232.543l7.374 8.633c.005.006.269.301.644.296s.64-.29.644-.296l7.402-8.663s.204-.269.204-.513-.196-.517-.196-.517L13.82 1.848c-.023-.032-.076-.021-.103-.049-.033-.038-.037-.091-.077-.124-.123-.097-.267-.106-.413-.123-.04-.005-.063-.049-.103-.049h-.078zm1.745 1.582h4.744L9 5.795zm-1.675.542 2.294 2.615H3.122zm8.094 0 1.831 2.615h-4.125zM3.328 7.818h4.847v5.672zm6.497 0h4.847c-1.151 1.345-3.422 4.007-4.847 5.672z",className:"oui-fill-current group-data-[actived=true]:oui-fill-[url(#side-menu-gradient)]"}),jsx("defs",{children:jsxs("linearGradient",{id:"a",x1:"17.25",y1:"9",x2:".75",y2:"9",gradientUnits:"userSpaceOnUse",children:[jsx("stop",{stopColor:"rgb(var(--oui-gradient-brand-end))"}),jsx("stop",{offset:"1",stopColor:"rgb(var(--oui-gradient-brand-start))"})]})})]})},{name:t("common.affiliate"),href:"/rewards/affiliate",icon:jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.625 4.95c0-.746.604-1.35 1.35-1.35h4.05c.746 0 1.35.604 1.35 1.35v4.62L9 12.195 5.625 9.57zm8.624 3.163-.524.407v-.96l.074.05c.193.128.346.302.45.502m-4.42 5.148L14.4 9.705v3.345a1.35 1.35 0 0 1-1.35 1.35h-8.1a1.35 1.35 0 0 1-1.35-1.35V9.705l4.571 3.556c.488.379 1.17.379 1.658 0M4.275 8.52l-.524-.407c.104-.2.257-.374.45-.503l.074-.049zm0-2.581V4.95a2.7 2.7 0 0 1 2.7-2.7h4.05a2.7 2.7 0 0 1 2.7 2.7v.989l.823.548a2.7 2.7 0 0 1 1.202 2.247v4.316a2.7 2.7 0 0 1-2.7 2.7h-8.1a2.7 2.7 0 0 1-2.7-2.7V8.734a2.7 2.7 0 0 1 1.202-2.247zM9 6.089l.111-.118.005-.005a1.08 1.08 0 0 1 1.58.004 1.223 1.223 0 0 1 0 1.668l-1.515 1.62-.004.004c-.1.102-.26.1-.358-.004l-1.516-1.62a1.223 1.223 0 0 1 0-1.668l.004-.004a1.08 1.08 0 0 1 1.58.004z",className:"oui-fill-current group-data-[actived=true]:oui-fill-[url(#side-menu-gradient)]"})})}],[t]),r=useMediaQuery("(max-width: 768px)");return {items:a,current:o,hideSideBar:r,onItemSelect:n=>{i(n.href);}}};var Ye=e=>{let{children:t,classNames:o,...i}=e;return jsx(Scaffold,{leftSidebar:null,routerAdapter:e.routerAdapter,classNames:{...o,content:o?.content,topNavbar:cn("oui-bg-base-9",o?.topNavbar),leftSidebar:cn("oui-rounded-xl oui-bg-base-9","oui-m-3 oui-p-4","oui-border oui-border-line",o?.leftSidebar)},...gr(["leftSideProps"],i),children:t})};var Cr=e=>{let t=Qe({current:e.leftSideProps?.current});return jsx(Ye,{...t,...e,children:e.children})};
13
+ var __defProp = Object.defineProperty;
14
+ var __getOwnPropNames = Object.getOwnPropertyNames;
15
+ var __esm = (fn, res) => function __init() {
16
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
17
+ };
18
+ var __export = (target, all) => {
19
+ for (var name in all)
20
+ __defProp(target, name, { get: all[name], enumerable: true });
21
+ };
22
+ var Title, MultiLineText;
23
+ var init_title_ui = __esm({
24
+ "src/pages/index/title/title.ui.tsx"() {
25
+ Title = (props) => {
26
+ const { title, subtitle, content, docOpenOptions } = props;
27
+ const { t } = useTranslation();
28
+ return /* @__PURE__ */ jsxs(
29
+ Flex,
30
+ {
31
+ id: "oui-tradingRewards-home-title",
32
+ p: 6,
33
+ direction: "column",
34
+ itemAlign: "start",
35
+ gap: 4,
36
+ className: "oui-bg-base-9 oui-font-semibold",
37
+ r: "2xl",
38
+ width: "100%",
39
+ children: [
40
+ title || /* @__PURE__ */ jsx(Text, { size: "lg", children: t("common.tradingRewards") }),
41
+ /* @__PURE__ */ jsx(Divider, { intensity: 8, className: "oui-w-full" }),
42
+ /* @__PURE__ */ jsxs(Flex, { direction: "column", itemAlign: "start", gap: 1, children: [
43
+ subtitle || /* @__PURE__ */ jsx(Text, { size: "base", children: t("tradingRewards.subtitle", {
44
+ brokerName: props.brokerName
45
+ }) }),
46
+ content || /* @__PURE__ */ jsx(MultiLineText, { docOpenOptions })
47
+ ] })
48
+ ]
49
+ }
50
+ );
51
+ };
52
+ MultiLineText = (props) => {
53
+ const { t } = useTranslation();
54
+ return /* @__PURE__ */ jsxs(
55
+ "div",
56
+ {
57
+ className: "oui-text-sm oui-text-base-contrast-54 oui-font-normal oui-flex oui-gap-1 oui-items-center hover:oui-text-primary-darken oui-text-primary-light oui-cursor-pointer",
58
+ onClick: () => [
59
+ window.open(
60
+ props.docOpenOptions?.url,
61
+ props.docOpenOptions?.target,
62
+ props.docOpenOptions?.features
63
+ )
64
+ ],
65
+ children: [
66
+ /* @__PURE__ */ jsx("span", { className: "oui-text-primary-light hover:oui-text-primary-darken oui-cursor-pointer", children: t("tradingRewards.learnMore") }),
67
+ /* @__PURE__ */ jsx(
68
+ "svg",
69
+ {
70
+ width: "16",
71
+ height: "16",
72
+ viewBox: "0 0 16 16",
73
+ fill: "currentColor",
74
+ xmlns: "http://www.w3.org/2000/svg",
75
+ children: /* @__PURE__ */ jsx("path", { d: "M4.008 7.995c0-.368.298-.666.666-.666H9.71L7.733 5.331l.937-.936 3.143 3.122c.13.13.195.304.195.479a.67.67 0 0 1-.195.478L8.67 11.596l-.937-.937 1.978-1.998H4.674a.666.666 0 0 1-.666-.666" })
76
+ }
77
+ )
78
+ ]
79
+ }
80
+ );
81
+ };
82
+ }
83
+ });
84
+ var TradingRewardsContext, TradingRewardsProvider, useTradingRewardsContext;
85
+ var init_provider = __esm({
86
+ "src/pages/index/provider.tsx"() {
87
+ TradingRewardsContext = createContext(
88
+ {}
89
+ );
90
+ TradingRewardsProvider = (props) => {
91
+ const {
92
+ type = TWType.normal,
93
+ showEpochPauseCountdown,
94
+ titleConfig = {
95
+ docOpenOptions: {
96
+ url: "https://orderly.network/docs/introduction/tokenomics/trading-rewards",
97
+ target: "_blank"
98
+ }
99
+ },
100
+ children
101
+ } = props;
102
+ const brokerId = useConfig("brokerId");
103
+ const { statusInfo } = useTradingRewardsStatus(type === TWType.mm);
104
+ const totalOrderClaimedReward = useGetClaimed(
105
+ type === TWType.mm ? DistributionId.mmOrder : DistributionId.order
106
+ );
107
+ const totalEsOrderClaimedReward = useGetClaimed(
108
+ type === TWType.mm ? DistributionId.mmEsOrder : DistributionId.esORder
109
+ );
110
+ const [brokers] = useAllBrokers();
111
+ const [curEpochEstimate] = useCurEpochEstimate(type);
112
+ const walletRewardsHistory = useWalletRewardsHistory(type);
113
+ const epochList = useEpochInfo(type);
114
+ const brokerName = useMemo(() => {
115
+ return brokers?.[brokerId];
116
+ }, [brokerId, brokers]);
117
+ const memoizedValue = useMemo(() => {
118
+ return {
119
+ type,
120
+ totalOrderClaimedReward,
121
+ totalEsOrderClaimedReward,
122
+ epochList,
123
+ curEpochEstimate,
124
+ walletRewardsHistory,
125
+ titleConfig,
126
+ brokerId,
127
+ brokerName,
128
+ brokers,
129
+ statusInfo,
130
+ showEpochPauseCountdown: showEpochPauseCountdown ?? false
131
+ };
132
+ }, [
133
+ type,
134
+ totalOrderClaimedReward,
135
+ totalEsOrderClaimedReward,
136
+ epochList,
137
+ curEpochEstimate,
138
+ walletRewardsHistory,
139
+ titleConfig,
140
+ brokerId,
141
+ brokerName,
142
+ brokers,
143
+ statusInfo,
144
+ showEpochPauseCountdown
145
+ ]);
146
+ return /* @__PURE__ */ jsx(TradingRewardsContext.Provider, { value: memoizedValue, children });
147
+ };
148
+ useTradingRewardsContext = () => {
149
+ return useContext(TradingRewardsContext);
150
+ };
151
+ }
152
+ });
14
153
 
15
- export { Bt as TradingRewards, Ye as TradingRewardsLayout, Cr as TradingRewardsLayoutWidget, zt as TradingRewardsLeftSidebarPath, Qe as useTradingRewardsLayoutScript };
154
+ // src/pages/index/title/title.script.tsx
155
+ var useTitleScript;
156
+ var init_title_script = __esm({
157
+ "src/pages/index/title/title.script.tsx"() {
158
+ init_provider();
159
+ useTitleScript = () => {
160
+ const { titleConfig } = useTradingRewardsContext();
161
+ return titleConfig;
162
+ };
163
+ }
164
+ });
165
+
166
+ // src/pages/index/title/title.widget.tsx
167
+ var title_widget_exports = {};
168
+ __export(title_widget_exports, {
169
+ TitleWidget: () => TitleWidget
170
+ });
171
+ var TitleWidget;
172
+ var init_title_widget = __esm({
173
+ "src/pages/index/title/title.widget.tsx"() {
174
+ init_title_script();
175
+ init_title_ui();
176
+ TitleWidget = () => {
177
+ const state = useTitleScript();
178
+ return /* @__PURE__ */ jsx(Title, { ...state });
179
+ };
180
+ }
181
+ });
182
+ var useCurEpochScript;
183
+ var init_curEpoch_script = __esm({
184
+ "src/pages/index/curEpoch/curEpoch.script.tsx"() {
185
+ init_provider();
186
+ useCurEpochScript = () => {
187
+ const {
188
+ epochList,
189
+ curEpochEstimate: estimate,
190
+ brokerId,
191
+ brokerName,
192
+ statusInfo,
193
+ showEpochPauseCountdown
194
+ } = useTradingRewardsContext();
195
+ const { wrongNetwork, disabledConnect } = useAppContext();
196
+ const { connect } = useWalletConnector();
197
+ const { state } = useAccount();
198
+ const hideData = useMemo(() => {
199
+ return state.status <= AccountStatusEnum.SignedIn || wrongNetwork || disabledConnect;
200
+ }, [state, wrongNetwork, disabledConnect]);
201
+ const notConnected = useMemo(() => {
202
+ return state.status <= AccountStatusEnum.SignedIn || disabledConnect;
203
+ }, [state, disabledConnect]);
204
+ const rewardsTooltip = useMemo(() => {
205
+ if (typeof estimate === "undefined" || estimate === null)
206
+ return void 0;
207
+ const otherRewards = estimate.rows.filter((item) => item.broker_id !== brokerId).reduce((a, b) => a + b.est_r_account, 0);
208
+ const curRewards = Number(estimate.est_r_wallet) - otherRewards;
209
+ return {
210
+ brokerName,
211
+ curRewards,
212
+ otherRewards
213
+ };
214
+ }, [brokerId, brokerName, estimate]);
215
+ return {
216
+ epochList,
217
+ estimate,
218
+ hideData,
219
+ notConnected,
220
+ connect,
221
+ rewardsTooltip: hideData ? void 0 : rewardsTooltip,
222
+ statusInfo,
223
+ showEpochPauseCountdown
224
+ };
225
+ };
226
+ }
227
+ });
228
+ var EsOrderlyIcon;
229
+ var init_esOrderlyIcon = __esm({
230
+ "src/pages/index/components/esOrderlyIcon.tsx"() {
231
+ EsOrderlyIcon = (props) => {
232
+ return /* @__PURE__ */ jsxs(
233
+ "svg",
234
+ {
235
+ width: "20",
236
+ height: "20",
237
+ viewBox: "0 0 20 20",
238
+ fill: "none",
239
+ xmlns: "http://www.w3.org/2000/svg",
240
+ className: props.className,
241
+ children: [
242
+ /* @__PURE__ */ jsxs("g", { clipPath: "url(#clip0_862_2449)", children: [
243
+ /* @__PURE__ */ jsx(
244
+ "path",
245
+ {
246
+ d: "M10.0249 19.9361C15.5202 19.9361 19.9751 15.4813 19.9751 9.98589C19.9751 4.49052 15.5202 0.0356445 10.0249 0.0356445C4.52949 0.0356445 0.0746155 4.49052 0.0746155 9.98589C0.0746155 15.4813 4.52949 19.9361 10.0249 19.9361Z",
247
+ fill: "url(#paint0_linear_862_2449)"
248
+ }
249
+ ),
250
+ /* @__PURE__ */ jsx(
251
+ "path",
252
+ {
253
+ fillRule: "evenodd",
254
+ clipRule: "evenodd",
255
+ d: "M14.0992 5.0347C14.1824 5.0347 14.2202 4.93253 14.1556 4.88017C13.0272 3.96625 11.59 3.41876 10.0249 3.41876C8.4598 3.41876 7.02258 3.96625 5.89428 4.88017C5.82963 4.93253 5.86743 5.0347 5.95063 5.0347H14.0992ZM7.2658 11.6648C7.34763 11.6648 7.42329 11.707 7.47028 11.7739C8.03421 12.5781 8.96819 13.1038 10.025 13.1038C11.0817 13.1038 12.0156 12.5781 12.5796 11.7739C12.6266 11.707 12.7022 11.6648 12.7841 11.6648H16.2198C16.2985 11.6648 16.3559 11.7395 16.334 11.8151C15.5419 14.5521 13.0171 16.5531 10.0249 16.5531C7.03275 16.5531 4.50795 14.5521 3.71578 11.8151C3.6939 11.7395 3.75127 11.6648 3.83 11.6648H7.2658ZM12.335 7.8919C12.3825 7.94426 12.4493 7.97581 12.5199 7.97581H16.114C16.1955 7.97581 16.2533 7.89653 16.2264 7.81972C15.9727 7.0936 15.5951 6.42564 15.119 5.84118C15.0743 5.78631 15.007 5.75526 14.9361 5.75526H5.11354C5.04279 5.75526 4.97543 5.78631 4.93075 5.84118C4.4546 6.42564 4.07701 7.0936 3.82337 7.81972C3.79653 7.89653 3.8543 7.97581 3.93567 7.97581H7.52983C7.60053 7.97581 7.66725 7.94426 7.71477 7.8919C8.28522 7.263 9.10892 6.86807 10.0249 6.86807C10.9408 6.86807 11.7646 7.263 12.335 7.8919ZM13.028 10.8273C13.0114 10.8862 13.0549 10.9458 13.116 10.9458H16.4447C16.4894 10.9458 16.5273 10.913 16.5333 10.8688C16.572 10.5798 16.5921 10.285 16.5921 9.98539C16.5921 9.56935 16.5534 9.1623 16.4795 8.76771C16.4716 8.72551 16.4345 8.6952 16.3916 8.6952H13.0042C12.9388 8.6952 12.895 8.763 12.9195 8.82377C13.0636 9.18276 13.1429 9.57477 13.1429 9.98529C13.1429 10.277 13.1029 10.5595 13.028 10.8273ZM6.9338 10.9458C6.99492 10.9458 7.03829 10.8862 7.02183 10.8273C6.94688 10.5595 6.90682 10.277 6.90682 9.98529C6.90682 9.57477 6.98617 9.18276 7.13037 8.82377C7.15477 8.763 7.11101 8.6952 7.04553 8.6952H3.65817C3.61522 8.6952 3.5782 8.72551 3.5703 8.76771C3.49631 9.1623 3.45761 9.56935 3.45761 9.98539C3.45761 10.285 3.47767 10.5798 3.51651 10.8688C3.52246 10.913 3.56045 10.9458 3.60511 10.9458H6.9338Z",
256
+ fill: "url(#paint1_linear_862_2449)"
257
+ }
258
+ )
259
+ ] }),
260
+ /* @__PURE__ */ jsxs("defs", { children: [
261
+ /* @__PURE__ */ jsxs(
262
+ "linearGradient",
263
+ {
264
+ id: "paint0_linear_862_2449",
265
+ x1: "10.0249",
266
+ y1: "-2.24058",
267
+ x2: "10.0249",
268
+ y2: "21.2774",
269
+ gradientUnits: "userSpaceOnUse",
270
+ children: [
271
+ /* @__PURE__ */ jsx("stop", { stopColor: "white" }),
272
+ /* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "#EDE9F4" })
273
+ ]
274
+ }
275
+ ),
276
+ /* @__PURE__ */ jsxs(
277
+ "linearGradient",
278
+ {
279
+ id: "paint1_linear_862_2449",
280
+ x1: "10.0249",
281
+ y1: "3.41876",
282
+ x2: "10.0249",
283
+ y2: "16.5531",
284
+ gradientUnits: "userSpaceOnUse",
285
+ children: [
286
+ /* @__PURE__ */ jsx("stop", { stopColor: "#C750FF" }),
287
+ /* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "#5800E8" })
288
+ ]
289
+ }
290
+ ),
291
+ /* @__PURE__ */ jsx("clipPath", { id: "clip0_862_2449", children: /* @__PURE__ */ jsx("rect", { width: "20", height: "20", fill: "white" }) })
292
+ ] })
293
+ ]
294
+ }
295
+ );
296
+ };
297
+ }
298
+ });
299
+ var OrderlyIcon;
300
+ var init_orderlyIcon = __esm({
301
+ "src/pages/index/components/orderlyIcon.tsx"() {
302
+ OrderlyIcon = (props) => {
303
+ return /* @__PURE__ */ jsxs(
304
+ "svg",
305
+ {
306
+ width: "20",
307
+ height: "20",
308
+ viewBox: "0 0 20 20",
309
+ fill: "none",
310
+ xmlns: "http://www.w3.org/2000/svg",
311
+ className: props.className,
312
+ children: [
313
+ /* @__PURE__ */ jsxs("g", { clipPath: "url(#clip0_862_2443)", children: [
314
+ /* @__PURE__ */ jsx(
315
+ "path",
316
+ {
317
+ d: "M10.0249 19.9491C15.5202 19.9491 19.9751 15.4942 19.9751 9.99883C19.9751 4.50346 15.5202 0.048584 10.0249 0.048584C4.52949 0.048584 0.0746155 4.50346 0.0746155 9.99883C0.0746155 15.4942 4.52949 19.9491 10.0249 19.9491Z",
318
+ fill: "url(#paint0_linear_862_2443)"
319
+ }
320
+ ),
321
+ /* @__PURE__ */ jsx(
322
+ "path",
323
+ {
324
+ fillRule: "evenodd",
325
+ clipRule: "evenodd",
326
+ d: "M14.1556 4.8931C14.2202 4.94547 14.1824 5.04764 14.0992 5.04764H5.95063C5.86743 5.04764 5.82963 4.94547 5.89428 4.8931C7.02258 3.97918 8.4598 3.4317 10.0249 3.4317C11.59 3.4317 13.0272 3.97918 14.1556 4.8931Z",
327
+ fill: "white"
328
+ }
329
+ ),
330
+ /* @__PURE__ */ jsx(
331
+ "path",
332
+ {
333
+ fillRule: "evenodd",
334
+ clipRule: "evenodd",
335
+ d: "M7.47028 11.7869C7.4233 11.7199 7.34764 11.6777 7.26581 11.6777H3.83C3.75128 11.6777 3.69391 11.7525 3.71579 11.8281C4.50796 14.565 7.03275 16.566 10.0249 16.566C13.0171 16.566 15.5419 14.565 16.334 11.8281C16.3559 11.7525 16.2985 11.6777 16.2198 11.6777H12.7841C12.7022 11.6777 12.6266 11.7199 12.5796 11.7869C12.0156 12.5911 11.0817 13.1167 10.025 13.1167C8.96818 13.1167 8.03421 12.5911 7.47028 11.7869Z",
336
+ fill: "white"
337
+ }
338
+ ),
339
+ /* @__PURE__ */ jsx(
340
+ "path",
341
+ {
342
+ fillRule: "evenodd",
343
+ clipRule: "evenodd",
344
+ d: "M12.335 7.90476C12.3825 7.95713 12.4493 7.98867 12.5199 7.98867H16.114C16.1955 7.98867 16.2533 7.9094 16.2264 7.83259C15.9727 7.10647 15.5951 6.43851 15.119 5.85405C15.0743 5.79918 15.007 5.76813 14.9361 5.76813H5.11354C5.04278 5.76813 4.97543 5.79918 4.93074 5.85405C4.45459 6.43851 4.07701 7.10647 3.82337 7.83259C3.79652 7.9094 3.85428 7.98867 3.93567 7.98867H7.52982C7.60052 7.98867 7.66725 7.95713 7.71475 7.90476C8.28522 7.27587 9.10892 6.88093 10.0249 6.88093C10.9408 6.88093 11.7646 7.27587 12.335 7.90476Z",
345
+ fill: "white"
346
+ }
347
+ ),
348
+ /* @__PURE__ */ jsx(
349
+ "path",
350
+ {
351
+ fillRule: "evenodd",
352
+ clipRule: "evenodd",
353
+ d: "M13.116 10.9587C13.0549 10.9587 13.0114 10.8991 13.028 10.8402C13.1029 10.5723 13.1429 10.29 13.1429 9.99822C13.1429 9.5877 13.0636 9.19568 12.9195 8.83669C12.895 8.77593 12.9388 8.70813 13.0042 8.70813H16.3916C16.4345 8.70813 16.4716 8.73843 16.4795 8.78064C16.5534 9.17523 16.5921 9.58228 16.5921 9.99832C16.5921 10.2979 16.572 10.5927 16.5333 10.8816C16.5273 10.9259 16.4894 10.9587 16.4447 10.9587H13.116ZM7.02183 10.8402C7.03829 10.8991 6.99492 10.9587 6.93381 10.9587H3.60511C3.56045 10.9587 3.52246 10.9259 3.51651 10.8816C3.47767 10.5927 3.45761 10.2979 3.45761 9.99832C3.45761 9.58228 3.49631 9.17523 3.5703 8.78064C3.5782 8.73843 3.61523 8.70813 3.65817 8.70813H7.04553C7.11101 8.70813 7.15477 8.77593 7.13037 8.83669C6.98617 9.19568 6.90682 9.5877 6.90682 9.99822C6.90682 10.29 6.94688 10.5723 7.02183 10.8402Z",
354
+ fill: "white"
355
+ }
356
+ )
357
+ ] }),
358
+ /* @__PURE__ */ jsxs("defs", { children: [
359
+ /* @__PURE__ */ jsxs(
360
+ "linearGradient",
361
+ {
362
+ id: "paint0_linear_862_2443",
363
+ x1: "10.0249",
364
+ y1: "0.0486119",
365
+ x2: "10.0249",
366
+ y2: "19.9491",
367
+ gradientUnits: "userSpaceOnUse",
368
+ children: [
369
+ /* @__PURE__ */ jsx("stop", { stopColor: "#C750FF" }),
370
+ /* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "#5800E8" })
371
+ ]
372
+ }
373
+ ),
374
+ /* @__PURE__ */ jsx("clipPath", { id: "clip0_862_2443", children: /* @__PURE__ */ jsx("rect", { width: "20", height: "20", fill: "white" }) })
375
+ ] })
376
+ ]
377
+ }
378
+ );
379
+ };
380
+ }
381
+ });
382
+ var RewardsTooltip;
383
+ var init_rewardsTooltip = __esm({
384
+ "src/pages/index/curEpoch/rewardsTooltip.tsx"() {
385
+ RewardsTooltip = (props) => {
386
+ const [open, setOpen] = useState(false);
387
+ const { t } = useTranslation();
388
+ const content = () => {
389
+ return /* @__PURE__ */ jsxs(
390
+ Flex,
391
+ {
392
+ direction: "column",
393
+ className: "oui-leading-[1.5] oui-text-2xs oui-text-base-contrast-80 oui-min-w-[204px]",
394
+ gap: 1,
395
+ children: [
396
+ /* @__PURE__ */ jsxs(Flex, { gap: 1, width: "100%", children: [
397
+ /* @__PURE__ */ jsx(Text, { className: "oui-flex-1", children: props.rewardsTooltip?.brokerName }),
398
+ /* @__PURE__ */ jsx(Text, { children: commifyOptional(props.rewardsTooltip?.curRewards, { fix: 2 }) })
399
+ ] }),
400
+ /* @__PURE__ */ jsxs(Flex, { gap: 1, width: "100%", children: [
401
+ /* @__PURE__ */ jsx(Text, { className: "oui-flex-1", children: t("tradingRewards.otherOrderlyDex") }),
402
+ /* @__PURE__ */ jsx(Text, { children: commifyOptional(props.rewardsTooltip?.otherRewards, { fix: 2 }) })
403
+ ] })
404
+ ]
405
+ }
406
+ );
407
+ };
408
+ return /* @__PURE__ */ jsx(
409
+ Tooltip,
410
+ {
411
+ content: content(),
412
+ align: props.align,
413
+ className: props.className,
414
+ open,
415
+ onOpenChange: setOpen,
416
+ arrow: {
417
+ className: props.arrowClassName
418
+ },
419
+ delayDuration: 100,
420
+ children: !!props.children ? React3.cloneElement(props.children, {
421
+ onClick: (e) => {
422
+ e.preventDefault();
423
+ setOpen(!open);
424
+ }
425
+ }) : /* @__PURE__ */ jsx(
426
+ "svg",
427
+ {
428
+ width: "21",
429
+ height: "20",
430
+ viewBox: "0 0 21 20",
431
+ fill: "none",
432
+ xmlns: "http://www.w3.org/2000/svg",
433
+ className: "oui-cursor-pointer",
434
+ onClick: (e) => {
435
+ e.preventDefault();
436
+ setOpen(!open);
437
+ },
438
+ children: /* @__PURE__ */ jsx(
439
+ "path",
440
+ {
441
+ d: "M10.5 1.678a8.333 8.333 0 1 0-.001 16.667 8.333 8.333 0 0 0 0-16.667m0 4.167a.833.833 0 1 1-.001 1.667.833.833 0 0 1 0-1.667m0 2.5c.46 0 .832.373.832.833v4.167a.833.833 0 0 1-1.666 0V9.178c0-.46.373-.833.833-.833",
442
+ fill: "#fff",
443
+ fillOpacity: ".36"
444
+ }
445
+ )
446
+ }
447
+ )
448
+ }
449
+ );
450
+ };
451
+ }
452
+ });
453
+ var CurEpoch, EstRewards, Statics, Countdown, getDate, ArrowRightIcon, TwitterLInk;
454
+ var init_curEpoch_ui = __esm({
455
+ "src/pages/index/curEpoch/curEpoch.ui.tsx"() {
456
+ init_esOrderlyIcon();
457
+ init_orderlyIcon();
458
+ init_rewardsTooltip();
459
+ CurEpoch = (props) => {
460
+ const { t } = useTranslation();
461
+ const state = props;
462
+ const curEpochInfo = state.epochList?.[1].curEpochInfo;
463
+ const epochList = state.epochList?.[0];
464
+ const startTime = curEpochInfo?.start_time;
465
+ const endTime = curEpochInfo?.end_time;
466
+ const curEpochId = curEpochInfo?.epoch_id;
467
+ const max_reward_amount = curEpochInfo?.max_reward_amount;
468
+ const token = curEpochInfo?.epoch_token;
469
+ const isOrder = curEpochInfo ? `${curEpochInfo?.epoch_token}`.toLowerCase() === "order" : void 0;
470
+ const pausedEpochTimeDown = useMemo(() => {
471
+ if (!props.showEpochPauseCountdown) {
472
+ return void 0;
473
+ }
474
+ if (!epochList || props.statusInfo?.epochStatus !== EpochStatus.paused) {
475
+ return void 0;
476
+ }
477
+ const lastCompletedEpoch = props.statusInfo?.lastCompletedEpoch;
478
+ if (lastCompletedEpoch === void 0) {
479
+ return void 0;
480
+ }
481
+ const nextEpoch = lastCompletedEpoch + 1;
482
+ const epoch = epochList.find((item) => item.epoch_id === nextEpoch);
483
+ return epoch?.start_time;
484
+ }, [props.statusInfo?.epochStatus, epochList]);
485
+ const showPauseCountdown = useMemo(() => {
486
+ return props.statusInfo?.epochStatus === EpochStatus.paused && pausedEpochTimeDown;
487
+ }, [props.statusInfo?.epochStatus, pausedEpochTimeDown]);
488
+ if (props.statusInfo?.epochStatus !== EpochStatus.active) {
489
+ return /* @__PURE__ */ jsx(
490
+ Flex,
491
+ {
492
+ id: "oui-tradingRewards-home-currentEpoch",
493
+ r: "2xl",
494
+ className: "oui-bg-base-9 oui-font-semibold oui-p-10",
495
+ width: "100%",
496
+ height: "100%",
497
+ direction: "column",
498
+ itemAlign: "stretch",
499
+ children: /* @__PURE__ */ jsxs(
500
+ Flex,
501
+ {
502
+ gap: 2,
503
+ direction: "column",
504
+ justify: "center",
505
+ itemAlign: "center",
506
+ className: "oui-size-full",
507
+ children: [
508
+ showPauseCountdown ? /* @__PURE__ */ jsxs(
509
+ Flex,
510
+ {
511
+ gap: 2,
512
+ direction: "column",
513
+ justify: "center",
514
+ itemAlign: "center",
515
+ children: [
516
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-base-contrast-54 oui-text-sm", children: t("tradingRewards.epochPauseCountdown.title") }),
517
+ /* @__PURE__ */ jsx(Countdown, { targetTimestamp: pausedEpochTimeDown, isStandalone: true })
518
+ ]
519
+ }
520
+ ) : /* @__PURE__ */ jsx(
521
+ Flex,
522
+ {
523
+ className: "oui-text-base-contrast-54 oui-text-sm oui-text-center",
524
+ justify: "center",
525
+ itemAlign: "center",
526
+ children: props.statusInfo?.epochStatus === EpochStatus.paused ? t("tradingRewards.eopchStatus.pause") : t("tradingRewards.eopchStatus.ended")
527
+ }
528
+ ),
529
+ props.statusInfo?.epochStatus === EpochStatus.paused && /* @__PURE__ */ jsx(
530
+ "div",
531
+ {
532
+ className: cn(
533
+ "oui-w-full",
534
+ showPauseCountdown ? "oui-mt-2" : "oui-mt-0"
535
+ ),
536
+ children: /* @__PURE__ */ jsx(TwitterLInk, {})
537
+ }
538
+ )
539
+ ]
540
+ }
541
+ )
542
+ }
543
+ );
544
+ }
545
+ return /* @__PURE__ */ jsxs(
546
+ Flex,
547
+ {
548
+ id: "oui-tradingRewards-home-currentEpoch",
549
+ r: "2xl",
550
+ className: "oui-bg-base-9 oui-font-semibold",
551
+ width: "100%",
552
+ height: "100%",
553
+ direction: "column",
554
+ itemAlign: "stretch",
555
+ children: [
556
+ /* @__PURE__ */ jsx(Countdown, { targetTimestamp: endTime }),
557
+ /* @__PURE__ */ jsxs(Flex, { p: 6, direction: "column", gap: 4, className: "oui-h-full", children: [
558
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: 3, width: "100%", justify: "around", children: [
559
+ /* @__PURE__ */ jsx(
560
+ Statics,
561
+ {
562
+ title: t("tradingRewards.epoch"),
563
+ highLight: curEpochId ? `${curEpochId}` : "--",
564
+ text: startTime && endTime ? `${getDate(startTime)} - ${getDate(endTime)}` : ""
565
+ }
566
+ ),
567
+ /* @__PURE__ */ jsx(
568
+ Statics,
569
+ {
570
+ title: t("tradingRewards.epochRewards"),
571
+ highLight: commifyOptional(max_reward_amount, { fix: 0 }),
572
+ text: token
573
+ }
574
+ )
575
+ ] }),
576
+ /* @__PURE__ */ jsx(
577
+ EstRewards,
578
+ {
579
+ isOrder,
580
+ direction: state.notConnected ? "row" : "column",
581
+ justify: state.notConnected ? "between" : "center",
582
+ hideData: state.hideData,
583
+ estRewards: state.hideData ? "--" : props.estimate?.est_r_wallet,
584
+ rewardsTooltip: props.rewardsTooltip,
585
+ background: state.notConnected ? "linear-gradient(28.29deg, #1B1D22 21.6%, #26292E 83.23%)" : "linear-gradient(0deg, #2D0061 2.62%, #BD6BED 86.5%)"
586
+ }
587
+ ),
588
+ /* @__PURE__ */ jsx("div", { className: "oui-w-full", children: /* @__PURE__ */ jsx(
589
+ AuthGuard,
590
+ {
591
+ status: AccountStatusEnum.SignedIn,
592
+ buttonProps: { fullWidth: true },
593
+ children: /* @__PURE__ */ jsx(Fragment, {})
594
+ }
595
+ ) })
596
+ ] })
597
+ ]
598
+ }
599
+ );
600
+ };
601
+ EstRewards = (props) => {
602
+ const { t } = useTranslation();
603
+ return /* @__PURE__ */ jsxs(
604
+ Flex,
605
+ {
606
+ direction: props.direction,
607
+ gap: 2,
608
+ py: 4,
609
+ px: 6,
610
+ width: "100%",
611
+ r: "xl",
612
+ itemAlign: "center",
613
+ justify: props.justify,
614
+ style: {
615
+ background: props.background
616
+ },
617
+ className: "oui-flex-1 oui-h-full",
618
+ children: [
619
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-base xl:oui-text-lg oui-text-base-contrast-54", children: t("tradingRewards.myEstRewards") }),
620
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: 3, children: [
621
+ props.isOrder == true && /* @__PURE__ */ jsx(OrderlyIcon, { className: "oui-w-5 oui-h-5 md:oui-w-6 md:oui-h-6 lg:oui-w-7 lg:oui-h-7 xl:oui-w-8 xl:oui-h-8" }),
622
+ props.isOrder == false && /* @__PURE__ */ jsx(EsOrderlyIcon, { className: "oui-w-5 oui-h-5 md:oui-w-6 md:oui-h-6 lg:oui-w-7 lg:oui-h-7 xl:oui-w-8 xl:oui-h-8" }),
623
+ /* @__PURE__ */ jsx(
624
+ Text,
625
+ {
626
+ children: commifyOptional(props.estRewards, { fix: 2 }),
627
+ className: "oui-text-xl md:oui-text-2xl xl:oui-text-[32px]"
628
+ }
629
+ ),
630
+ props.rewardsTooltip && /* @__PURE__ */ jsx(RewardsTooltip, { rewardsTooltip: props.rewardsTooltip })
631
+ ] })
632
+ ]
633
+ }
634
+ );
635
+ };
636
+ Statics = (props) => {
637
+ const { title, highLight, text } = props;
638
+ return /* @__PURE__ */ jsxs(
639
+ Flex,
640
+ {
641
+ py: 2,
642
+ justify: "between",
643
+ direction: "column",
644
+ className: "flex-1",
645
+ gap: 2,
646
+ children: [
647
+ /* @__PURE__ */ jsx(
648
+ Text,
649
+ {
650
+ className: cn(
651
+ "oui-text-base-contrast-54",
652
+ // font size
653
+ "oui-text-xs md:oui-text-sm xl:oui-text-base",
654
+ /// leading
655
+ "oui-leading-[20px] xl:oui-leading-[24px]"
656
+ ),
657
+ children: title
658
+ }
659
+ ),
660
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: 1, itemAlign: "end", justify: "center", children: [
661
+ /* @__PURE__ */ jsx(
662
+ Text.gradient,
663
+ {
664
+ color: "brand",
665
+ angle: 90,
666
+ className: "oui-text-base md:oui-text-lg lg:oui-text-xl xl:oui-text-2xl",
667
+ children: highLight
668
+ }
669
+ ),
670
+ /* @__PURE__ */ jsx(
671
+ Text,
672
+ {
673
+ intensity: 80,
674
+ className: "oui-mb-[3px] oui-text-2xs md:oui-text-xs xl:oui-text-sm",
675
+ children: text
676
+ }
677
+ )
678
+ ] })
679
+ ]
680
+ }
681
+ );
682
+ };
683
+ Countdown = (props) => {
684
+ const { targetTimestamp, isStandalone } = props;
685
+ const { t } = useTranslation();
686
+ const [timeLeft, setTimeLeft] = useState({
687
+ days: 0,
688
+ hours: 0,
689
+ minutes: 0,
690
+ seconds: 0
691
+ });
692
+ useEffect(() => {
693
+ const intervalId = setInterval(() => {
694
+ if (typeof targetTimestamp === "undefined")
695
+ return;
696
+ const now = (/* @__PURE__ */ new Date()).getTime();
697
+ const distance = targetTimestamp - now;
698
+ if (distance < 0) {
699
+ clearInterval(intervalId);
700
+ setTimeLeft({
701
+ days: 0,
702
+ hours: 0,
703
+ minutes: 0,
704
+ seconds: 0
705
+ });
706
+ } else {
707
+ const days = Math.floor(distance / (1e3 * 60 * 60 * 24));
708
+ const hours = Math.floor(
709
+ distance % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60)
710
+ );
711
+ const minutes = Math.floor(distance % (1e3 * 60 * 60) / (1e3 * 60));
712
+ const seconds = Math.floor(distance % (1e3 * 60) / 1e3);
713
+ setTimeLeft({ days, hours, minutes, seconds });
714
+ }
715
+ }, 1e3);
716
+ return () => clearInterval(intervalId);
717
+ }, [targetTimestamp]);
718
+ const num = (value) => {
719
+ return /* @__PURE__ */ jsx(Text, { className: "oui-text-sm oui-text-base-contrast md:oui-text-base lg:oui-text-lg ", children: value });
720
+ };
721
+ return /* @__PURE__ */ jsx(
722
+ Box,
723
+ {
724
+ className: "oui-rounded-t-2xl oui-font-semibold oui-text-base-contrast-54",
725
+ gradient: isStandalone ? void 0 : "neutral",
726
+ angle: 180,
727
+ width: "full",
728
+ children: /* @__PURE__ */ jsxs(Flex, { justify: "center", gap: 1, children: [
729
+ isStandalone ? null : /* @__PURE__ */ jsx("span", { children: `${t("common.countdown")}: ` }),
730
+ /* @__PURE__ */ jsxs(
731
+ Flex,
732
+ {
733
+ direction: "row",
734
+ itemAlign: "end",
735
+ gap: 1,
736
+ className: cn(
737
+ "oui-text-2xs md:oui-text-xs lg:oui-text-sm",
738
+ isStandalone ? "oui-py-0" : "oui-py-[13px]"
739
+ ),
740
+ children: [
741
+ num(`${timeLeft.days}`.padStart(2, "0")),
742
+ /* @__PURE__ */ jsx("span", { children: "D" }),
743
+ num(`${timeLeft.hours}`.padStart(2, "0")),
744
+ /* @__PURE__ */ jsx("span", { children: "H" }),
745
+ num(`${timeLeft.minutes}`.padStart(2, "0")),
746
+ /* @__PURE__ */ jsx("span", { children: "M" }),
747
+ num(`${timeLeft.seconds}`.padStart(2, "0")),
748
+ /* @__PURE__ */ jsx("span", { children: "S" })
749
+ ]
750
+ }
751
+ )
752
+ ] })
753
+ }
754
+ );
755
+ };
756
+ getDate = (timestamp) => {
757
+ if (!timestamp)
758
+ return "";
759
+ const date = new Date(timestamp);
760
+ const monthNames = [
761
+ "Jan",
762
+ "Feb",
763
+ "Mar",
764
+ "Apr",
765
+ "May",
766
+ "Jun",
767
+ "Jul",
768
+ "Aug",
769
+ "Sep",
770
+ "Oct",
771
+ "Nov",
772
+ "Dec"
773
+ ];
774
+ const month = monthNames[date.getUTCMonth()];
775
+ const day = date.getUTCDate();
776
+ return `${month}. ${day}`;
777
+ };
778
+ ArrowRightIcon = (props) => /* @__PURE__ */ jsxs(
779
+ "svg",
780
+ {
781
+ width: "21",
782
+ height: "20",
783
+ viewBox: "0 0 21 20",
784
+ fill: "currentColor",
785
+ xmlns: "http://www.w3.org/2000/svg",
786
+ ...props,
787
+ children: [
788
+ /* @__PURE__ */ jsx(
789
+ "mask",
790
+ {
791
+ id: "mask0_1997_45723",
792
+ style: { maskType: "alpha" },
793
+ maskUnits: "userSpaceOnUse",
794
+ x: "0",
795
+ y: "0",
796
+ width: "21",
797
+ height: "20",
798
+ children: /* @__PURE__ */ jsx("rect", { x: "0.5", width: "20", height: "20", fill: "#D9D9D9" })
799
+ }
800
+ ),
801
+ /* @__PURE__ */ jsx("g", { mask: "url(#mask0_1997_45723)", children: /* @__PURE__ */ jsx(
802
+ "path",
803
+ {
804
+ d: "M12.0384 14.7111L11.1603 13.8073L14.343 10.6246H4.25V9.37463H14.343L11.1603 6.19192L12.0384 5.28809L16.75 9.99961L12.0384 14.7111Z"
805
+ }
806
+ ) })
807
+ ]
808
+ }
809
+ );
810
+ TwitterLInk = () => {
811
+ const { t } = useTranslation();
812
+ return /* @__PURE__ */ jsxs(
813
+ Flex,
814
+ {
815
+ gap: 1,
816
+ itemAlign: "center",
817
+ justify: "center",
818
+ className: "oui-group oui-cursor-pointer oui-fill-base-contrast-36 oui-text-sm oui-text-base-contrast-36 group-hover:oui-text-base-contrast-80",
819
+ onClick: () => window.open("https://x.com/OrderlyNetwork"),
820
+ children: [
821
+ /* @__PURE__ */ jsx("div", { className: "oui-cursor-pointer oui-fill-base-contrast-36 oui-text-sm oui-text-base-contrast-36 group-hover:oui-text-base-contrast-80", children: t("tradingRewards.eopchStatus.linkDescription") }),
822
+ /* @__PURE__ */ jsx(ArrowRightIcon, { className: "oui-text-fill-base-contrast-36 oui-fill-base-contrast-36 group-hover:oui-fill-base-contrast-80" })
823
+ ]
824
+ }
825
+ );
826
+ };
827
+ }
828
+ });
829
+ var CurEpochWidget;
830
+ var init_curEpoch_widget = __esm({
831
+ "src/pages/index/curEpoch/curEpoch.widget.tsx"() {
832
+ init_curEpoch_script();
833
+ init_curEpoch_ui();
834
+ CurEpochWidget = () => {
835
+ const state = useCurEpochScript();
836
+ return /* @__PURE__ */ jsx(CurEpoch, { ...state });
837
+ };
838
+ }
839
+ });
840
+
841
+ // src/pages/index/curEpoch/index.ts
842
+ var curEpoch_exports = {};
843
+ __export(curEpoch_exports, {
844
+ CurEpoch: () => CurEpoch,
845
+ CurEpochWidget: () => CurEpochWidget,
846
+ useCurEpochScript: () => useCurEpochScript
847
+ });
848
+ var init_curEpoch = __esm({
849
+ "src/pages/index/curEpoch/index.ts"() {
850
+ init_curEpoch_widget();
851
+ init_curEpoch_ui();
852
+ init_curEpoch_script();
853
+ }
854
+ });
855
+ var useAvailableScript;
856
+ var init_availableToClaim_script = __esm({
857
+ "src/pages/index/availableToClaim/availableToClaim.script.tsx"() {
858
+ init_provider();
859
+ useAvailableScript = () => {
860
+ const {
861
+ totalOrderClaimedReward,
862
+ walletRewardsHistory,
863
+ totalEsOrderClaimedReward
864
+ } = useTradingRewardsContext();
865
+ const [orderClaimedRewardData] = totalOrderClaimedReward;
866
+ const [esOrderClaimedRewardData] = totalEsOrderClaimedReward;
867
+ const { namespace } = useWalletConnector();
868
+ const [data] = walletRewardsHistory;
869
+ const lifetimeOrderReward = useMemo(() => {
870
+ if (namespace === ChainNamespace.evm) {
871
+ return data?.wallet_lifetime_trading_rewards_order;
872
+ }
873
+ return data?.wallet_pending_trading_rewards_order;
874
+ }, [namespace, data]);
875
+ const lifetimeEsOrderReward = useMemo(() => {
876
+ if (namespace === ChainNamespace.evm) {
877
+ return data?.wallet_lifetime_trading_rewards_escrow;
878
+ }
879
+ return data?.wallet_pending_trading_rewards_escrow;
880
+ }, [data, namespace]);
881
+ const env = useGetEnv();
882
+ const goToClaim = (e) => {
883
+ const url = `https://${env !== ENVType.prod ? `${env}-` : ""}app.orderly.network/tradingRewards`;
884
+ window.open(url, "_blank");
885
+ };
886
+ const calculateRemainingReward = useCallback(
887
+ (totalReward, claimedReward) => {
888
+ if (typeof claimedReward !== "undefined" && typeof totalReward !== "undefined") {
889
+ const remainingReward = new Decimal(totalReward).sub(claimedReward).toFixed(18, Decimal.ROUND_DOWN);
890
+ return Number(remainingReward);
891
+ }
892
+ return void 0;
893
+ },
894
+ []
895
+ );
896
+ const availableOrder = useMemo(
897
+ () => calculateRemainingReward(lifetimeOrderReward, orderClaimedRewardData),
898
+ [lifetimeOrderReward, orderClaimedRewardData, calculateRemainingReward]
899
+ );
900
+ const availableEsOrder = useMemo(
901
+ () => calculateRemainingReward(lifetimeEsOrderReward, esOrderClaimedRewardData),
902
+ [lifetimeEsOrderReward, esOrderClaimedRewardData, calculateRemainingReward]
903
+ );
904
+ const orderValue = useDataTap(availableOrder);
905
+ const esorderValue = useDataTap(availableEsOrder);
906
+ return {
907
+ order: orderValue ?? void 0,
908
+ esOrder: esorderValue ?? void 0,
909
+ goToClaim
910
+ };
911
+ };
912
+ }
913
+ });
914
+ var JumpIcon;
915
+ var init_jumpIcon = __esm({
916
+ "src/pages/index/components/jumpIcon.tsx"() {
917
+ JumpIcon = () => {
918
+ return /* @__PURE__ */ jsx(
919
+ "svg",
920
+ {
921
+ width: "16",
922
+ height: "16",
923
+ viewBox: "0 0 16 16",
924
+ xmlns: "http://www.w3.org/2000/svg",
925
+ fill: "currentColor",
926
+ children: /* @__PURE__ */ jsx(
927
+ "path",
928
+ {
929
+ d: "M11.3275 13.9938C12.8001 13.9938 13.9941 12.7998 13.9941 11.3272V4.66049C13.9941 3.18782 12.8001 1.99382 11.3275 1.99382H4.66081C3.18814 1.99382 1.99414 3.18782 1.99414 4.66049V11.3272C1.99414 12.7998 3.18814 13.9938 4.66081 13.9938H11.3275ZM5.99414 10.6605C5.82347 10.6605 5.64548 10.6031 5.51481 10.4732C5.25481 10.2125 5.25481 9.77516 5.51481 9.51449L8.18148 6.84782L6.66081 5.32715H10.6608V9.32715L9.14014 7.80648L6.47347 10.4732C6.34347 10.6031 6.16481 10.6605 5.99414 10.6605Z"
930
+ }
931
+ )
932
+ }
933
+ );
934
+ };
935
+ }
936
+ });
937
+ var AvailableToClaim, Statics2;
938
+ var init_availableToClaim_ui = __esm({
939
+ "src/pages/index/availableToClaim/availableToClaim.ui.tsx"() {
940
+ init_jumpIcon();
941
+ init_esOrderlyIcon();
942
+ init_orderlyIcon();
943
+ AvailableToClaim = (props) => {
944
+ const { t } = useTranslation();
945
+ return /* @__PURE__ */ jsxs(
946
+ Flex,
947
+ {
948
+ id: "oui-tradingRewards-home-availableToClaim",
949
+ p: 6,
950
+ r: "2xl",
951
+ direction: "column",
952
+ gap: 4,
953
+ width: "100%",
954
+ className: " oui-font-semibold oui-bg-base-9 ",
955
+ children: [
956
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", justify: "between", width: "100%", children: [
957
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-lg", children: t("tradingRewards.availableClaim") }),
958
+ /* @__PURE__ */ jsxs(
959
+ Flex,
960
+ {
961
+ direction: "row",
962
+ gap: 1,
963
+ onClick: props.goToClaim,
964
+ className: "oui-cursor-pointer oui-text-primary-light",
965
+ children: [
966
+ /* @__PURE__ */ jsx(Text, { size: "sm", children: t("tradingRewards.claim") }),
967
+ /* @__PURE__ */ jsx(JumpIcon, {})
968
+ ]
969
+ }
970
+ )
971
+ ] }),
972
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: 3, width: "100%", children: [
973
+ /* @__PURE__ */ jsx(Statics2, { title: "ORDER", value: props.order }),
974
+ /* @__PURE__ */ jsx(Statics2, { title: "esORDER", value: props.esOrder, isEsOrder: true })
975
+ ] })
976
+ ]
977
+ }
978
+ );
979
+ };
980
+ Statics2 = (props) => {
981
+ const { value } = props;
982
+ return /* @__PURE__ */ jsxs(
983
+ Flex,
984
+ {
985
+ className: "oui-flex-1 oui-bg-base-8 oui-py-[11px]",
986
+ direction: "column",
987
+ gap: 2,
988
+ r: "xl",
989
+ gradient: "neutral",
990
+ angle: 180,
991
+ border: true,
992
+ borderColor: 6,
993
+ children: [
994
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-xs xl:oui-text-sm oui-text-base-contrast-54", children: props.title }),
995
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: 1, children: [
996
+ props.isEsOrder ? /* @__PURE__ */ jsx(EsOrderlyIcon, {}) : /* @__PURE__ */ jsx(OrderlyIcon, {}),
997
+ /* @__PURE__ */ jsx(
998
+ Text,
999
+ {
1000
+ className: "oui-text-sm xl:oui-text-base",
1001
+ children: commifyOptional(value, { fix: 2 })
1002
+ }
1003
+ )
1004
+ ] })
1005
+ ]
1006
+ }
1007
+ );
1008
+ };
1009
+ }
1010
+ });
1011
+ var AvailableToClaimWidget;
1012
+ var init_availableToClaim_widget = __esm({
1013
+ "src/pages/index/availableToClaim/availableToClaim.widget.tsx"() {
1014
+ init_availableToClaim_script();
1015
+ init_availableToClaim_ui();
1016
+ AvailableToClaimWidget = () => {
1017
+ const state = useAvailableScript();
1018
+ return /* @__PURE__ */ jsx(AvailableToClaim, { ...state });
1019
+ };
1020
+ }
1021
+ });
1022
+
1023
+ // src/pages/index/availableToClaim/index.ts
1024
+ var availableToClaim_exports = {};
1025
+ __export(availableToClaim_exports, {
1026
+ AvailableToClaim: () => AvailableToClaim,
1027
+ AvailableToClaimWidget: () => AvailableToClaimWidget
1028
+ });
1029
+ var init_availableToClaim = __esm({
1030
+ "src/pages/index/availableToClaim/index.ts"() {
1031
+ init_availableToClaim_widget();
1032
+ init_availableToClaim_ui();
1033
+ }
1034
+ });
1035
+ var useStakeBoosterScript;
1036
+ var init_stakeBooster_script = __esm({
1037
+ "src/pages/index/stakeBooster/stakeBooster.script.tsx"() {
1038
+ init_provider();
1039
+ useStakeBoosterScript = () => {
1040
+ const { curEpochEstimate } = useTradingRewardsContext();
1041
+ const env = useGetEnv();
1042
+ const stakeNow = (e) => {
1043
+ const url = `https://${env !== ENVType.prod ? `${env}-` : ""}app.orderly.network/staking`;
1044
+ window.open(url, "_blank");
1045
+ };
1046
+ const estimateValue = useDataTap(curEpochEstimate);
1047
+ const booster = useMemo(() => {
1048
+ const estStakeBoost = curEpochEstimate?.est_stake_boost;
1049
+ if (typeof estStakeBoost === "undefined" || estStakeBoost === null) {
1050
+ return void 0;
1051
+ }
1052
+ if (estStakeBoost === 0)
1053
+ return estStakeBoost;
1054
+ return new Decimal(estStakeBoost).div(new Decimal(10).pow(0.15)).toDecimalPlaces(2, Decimal.ROUND_DOWN).toString();
1055
+ }, [curEpochEstimate?.est_stake_boost]);
1056
+ return {
1057
+ curEpochEstimate: estimateValue ?? void 0,
1058
+ stakeNow,
1059
+ booster
1060
+ };
1061
+ };
1062
+ }
1063
+ });
1064
+ var RocketIcon;
1065
+ var init_rocket = __esm({
1066
+ "src/pages/index/components/rocket.tsx"() {
1067
+ RocketIcon = () => {
1068
+ return /* @__PURE__ */ jsxs(
1069
+ "svg",
1070
+ {
1071
+ width: "18",
1072
+ height: "18",
1073
+ viewBox: "0 0 18 18",
1074
+ fill: "none",
1075
+ xmlns: "http://www.w3.org/2000/svg",
1076
+ children: [
1077
+ /* @__PURE__ */ jsx(
1078
+ "path",
1079
+ {
1080
+ d: "M14.439 10.5672C14.0868 10.9198 13.7025 11.2403 13.3183 11.5287C13.1902 11.6248 13.1261 11.721 13.0941 11.8812C12.7739 13.1952 12.1015 14.4451 11.0448 15.5027C10.5645 15.9835 10.0522 16.3681 9.47584 16.7206C8.99553 17.009 8.41917 16.5283 8.61129 15.9835C8.93149 15.1502 9.05957 14.2528 9.05957 13.3234C8.99553 13.3234 8.89947 13.3555 8.83543 13.3555C8.06695 12.7145 7.3625 12.0415 6.65805 11.3364C5.95361 10.6313 5.28118 9.89421 4.64078 9.15708C4.64078 9.09299 4.6728 8.99684 4.6728 8.93274C3.74421 8.93274 2.84764 9.09299 2.01512 9.38143C1.50279 9.57372 0.990469 8.99684 1.27865 8.51611C1.63087 7.93923 2.01512 7.42645 2.49542 6.94572C3.55209 5.88811 4.80088 5.21508 6.11371 4.89459C6.24179 4.86255 6.36987 4.7664 6.46593 4.67025C6.75412 4.25362 7.07432 3.90108 7.42654 3.54855C9.92412 1.04874 13.4143 0.183422 16.6484 0.920545C16.8725 0.984642 17.0326 1.14489 17.0967 1.36923C17.8011 4.57411 16.9366 8.06742 14.439 10.5672ZM13.0301 4.95869C12.2616 4.18952 10.9808 4.18952 10.2123 4.95869C9.44382 5.72786 9.44382 7.00982 10.2123 7.77899C10.9808 8.54816 12.2616 8.54816 13.0301 7.77899C13.8306 6.97777 13.8306 5.72786 13.0301 4.95869ZM5.88957 14.7656C5.28118 15.3745 1.53481 17.9385 0.798348 17.2013C0.0618817 16.4642 2.6235 12.7145 3.23189 12.1056C3.84027 11.4966 4.92896 11.5928 5.66543 12.3299C6.40189 13.067 6.49795 14.1567 5.88957 14.7656Z",
1081
+ fill: "url(#paint0_linear_88_1748)"
1082
+ }
1083
+ ),
1084
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
1085
+ "linearGradient",
1086
+ {
1087
+ id: "paint0_linear_88_1748",
1088
+ x1: "17.3331",
1089
+ y1: "8.99996",
1090
+ x2: "0.666504",
1091
+ y2: "8.99996",
1092
+ gradientUnits: "userSpaceOnUse",
1093
+ children: [
1094
+ /* @__PURE__ */ jsx("stop", { stopColor: "rgb(var(--oui-gradient-brand-end))" }),
1095
+ /* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "rgb(var(--oui-gradient-brand-start))" })
1096
+ ]
1097
+ }
1098
+ ) })
1099
+ ]
1100
+ }
1101
+ );
1102
+ };
1103
+ }
1104
+ });
1105
+ var StakeBooster, Statics3;
1106
+ var init_stakeBooster_ui = __esm({
1107
+ "src/pages/index/stakeBooster/stakeBooster.ui.tsx"() {
1108
+ init_jumpIcon();
1109
+ init_esOrderlyIcon();
1110
+ init_orderlyIcon();
1111
+ init_rocket();
1112
+ StakeBooster = (props) => {
1113
+ const { t } = useTranslation();
1114
+ return /* @__PURE__ */ jsxs(
1115
+ Flex,
1116
+ {
1117
+ id: "oui-tradingRewards-home-stakeBooster",
1118
+ p: 6,
1119
+ r: "2xl",
1120
+ direction: "column",
1121
+ gap: 4,
1122
+ width: "100%",
1123
+ className: " oui-font-semibold oui-bg-base-9 ",
1124
+ children: [
1125
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", justify: "between", width: "100%", children: [
1126
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-lg", children: t("tradingRewards.stakeBooster") }),
1127
+ /* @__PURE__ */ jsxs(
1128
+ Flex,
1129
+ {
1130
+ direction: "row",
1131
+ gap: 1,
1132
+ onClick: props.stakeNow,
1133
+ className: "oui-cursor-pointer oui-text-primary-light",
1134
+ children: [
1135
+ /* @__PURE__ */ jsx(Text, { size: "sm", children: t("tradingRewards.stake") }),
1136
+ /* @__PURE__ */ jsx(JumpIcon, {})
1137
+ ]
1138
+ }
1139
+ )
1140
+ ] }),
1141
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: 3, width: "100%", children: [
1142
+ /* @__PURE__ */ jsx(
1143
+ Statics3,
1144
+ {
1145
+ title: t("tradingRewards.avgStakedAmount"),
1146
+ value: props.curEpochEstimate?.est_avg_stake,
1147
+ icon: /* @__PURE__ */ jsxs("div", { className: "oui-flex oui-w-[32px] oui-h-[20px] oui-relative", children: [
1148
+ /* @__PURE__ */ jsx("div", { className: "oui-absolute oui-right-0 oui-top-0", children: /* @__PURE__ */ jsx(EsOrderlyIcon, {}) }),
1149
+ /* @__PURE__ */ jsx("div", { className: "oui-absolute oui-left-0 oui-top-0 ", children: /* @__PURE__ */ jsx(OrderlyIcon, {}) })
1150
+ ] })
1151
+ }
1152
+ ),
1153
+ /* @__PURE__ */ jsx(
1154
+ Statics3,
1155
+ {
1156
+ title: t("tradingRewards.booster"),
1157
+ value: props.booster,
1158
+ icon: /* @__PURE__ */ jsx(RocketIcon, {}),
1159
+ gradient: true
1160
+ }
1161
+ )
1162
+ ] })
1163
+ ]
1164
+ }
1165
+ );
1166
+ };
1167
+ Statics3 = (props) => {
1168
+ const calcValue = commify(props.value || "--", 2);
1169
+ return /* @__PURE__ */ jsxs(
1170
+ Flex,
1171
+ {
1172
+ className: "oui-flex-1 oui-bg-base-8 oui-py-[11px]",
1173
+ direction: "column",
1174
+ gap: 2,
1175
+ r: "xl",
1176
+ gradient: "neutral",
1177
+ angle: 180,
1178
+ border: true,
1179
+ borderColor: 6,
1180
+ children: [
1181
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-xs xl:oui-text-sm oui-text-base-contrast-54", children: props.title }),
1182
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: 1, children: [
1183
+ props.icon,
1184
+ props.gradient ? /* @__PURE__ */ jsx(
1185
+ Text.gradient,
1186
+ {
1187
+ className: "oui-text-sm xl:oui-text-base",
1188
+ color: "brand",
1189
+ angle: 90,
1190
+ children: calcValue + (calcValue === "--" ? "" : "x")
1191
+ }
1192
+ ) : /* @__PURE__ */ jsx(Text, { className: "oui-text-sm xl:oui-text-base", children: commifyOptional(props.value, { fix: 2 }) })
1193
+ ] })
1194
+ ]
1195
+ }
1196
+ );
1197
+ };
1198
+ }
1199
+ });
1200
+ var StakeBoosterWidget;
1201
+ var init_stakeBooster_widget = __esm({
1202
+ "src/pages/index/stakeBooster/stakeBooster.widget.tsx"() {
1203
+ init_stakeBooster_script();
1204
+ init_stakeBooster_ui();
1205
+ StakeBoosterWidget = () => {
1206
+ const state = useStakeBoosterScript();
1207
+ return /* @__PURE__ */ jsx(StakeBooster, { ...state });
1208
+ };
1209
+ }
1210
+ });
1211
+
1212
+ // src/pages/index/stakeBooster/index.ts
1213
+ var stakeBooster_exports = {};
1214
+ __export(stakeBooster_exports, {
1215
+ StakeBooster: () => StakeBooster,
1216
+ StakeBoosterWidget: () => StakeBoosterWidget
1217
+ });
1218
+ var init_stakeBooster = __esm({
1219
+ "src/pages/index/stakeBooster/index.ts"() {
1220
+ init_stakeBooster_widget();
1221
+ init_stakeBooster_ui();
1222
+ }
1223
+ });
1224
+ function formatTimestamp(timestamp) {
1225
+ if (typeof timestamp === "undefined")
1226
+ return {
1227
+ firstPart: "-",
1228
+ secondPart: ""
1229
+ };
1230
+ const date = new Date(timestamp);
1231
+ const monthNames = [
1232
+ "Jan",
1233
+ "Feb",
1234
+ "Mar",
1235
+ "Apr",
1236
+ "May",
1237
+ "Jun",
1238
+ "Jul",
1239
+ "Aug",
1240
+ "Sep",
1241
+ "Oct",
1242
+ "Nov",
1243
+ "Dec"
1244
+ ];
1245
+ const month = monthNames[date.getUTCMonth()];
1246
+ const day = date.getUTCDate().toString().padStart(2, "0");
1247
+ const year = date.getUTCFullYear();
1248
+ const hours = date.getUTCHours();
1249
+ const minutes = date.getUTCMinutes();
1250
+ const amPm = hours >= 12 ? "PM" : "AM";
1251
+ const formattedHours = (hours % 12).toString().padStart(2, "0");
1252
+ const formattedMinutes = minutes.toString().padStart(2, "0");
1253
+ return {
1254
+ firstPart: `${month} ${day}, ${year}`,
1255
+ secondPart: `${formattedHours}:${formattedMinutes} ${amPm}`
1256
+ };
1257
+ }
1258
+ var RewardHistory, List, MobileCell, DesktopList;
1259
+ var init_rewardsHistory_ui = __esm({
1260
+ "src/pages/index/rewardHistory/rewardsHistory.ui.tsx"() {
1261
+ init_esOrderlyIcon();
1262
+ init_orderlyIcon();
1263
+ init_rewardsTooltip();
1264
+ RewardHistory = (props) => {
1265
+ const { t } = useTranslation();
1266
+ return /* @__PURE__ */ jsxs(
1267
+ Flex,
1268
+ {
1269
+ id: "oui-tradingRewards-home-rewardHistory",
1270
+ py: 4,
1271
+ px: 3,
1272
+ direction: "column",
1273
+ gap: 2,
1274
+ itemAlign: "start",
1275
+ r: "2xl",
1276
+ className: "oui-bg-base-9 oui-w-full oui-font-semibold oui-tabular-nums",
1277
+ children: [
1278
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-lg oui-px-3", children: t("tradingRewards.rewardHistory") }),
1279
+ /* @__PURE__ */ jsx("div", { className: "oui-border-t-2 oui-border-line-4 oui-w-full", children: /* @__PURE__ */ jsx(List, { ...props }) })
1280
+ ]
1281
+ }
1282
+ );
1283
+ };
1284
+ List = (props) => {
1285
+ const isMobile = useMediaQuery("(max-width: 767px)");
1286
+ return isMobile ? /* @__PURE__ */ jsx(
1287
+ ListView,
1288
+ {
1289
+ dataSource: props.originalData,
1290
+ renderItem: (item, index) => {
1291
+ return /* @__PURE__ */ jsx(MobileCell, { data: item });
1292
+ },
1293
+ className: "oui-mt-3 oui-max-h-[356px]"
1294
+ }
1295
+ ) : /* @__PURE__ */ jsx(Box, { px: 3, children: /* @__PURE__ */ jsx(DesktopList, { ...props }) });
1296
+ };
1297
+ MobileCell = (props) => {
1298
+ const { data } = props;
1299
+ const { t } = useTranslation();
1300
+ const isOrder = `${data?.info?.epoch_token || data.epoch_token}`.toLowerCase() === "order";
1301
+ const r_warret = commifyOptional(data.info?.r_wallet, { fix: 2 });
1302
+ return /* @__PURE__ */ jsxs(
1303
+ Flex,
1304
+ {
1305
+ direction: "column",
1306
+ px: 4,
1307
+ pt: 0,
1308
+ gap: 3,
1309
+ className: "oui-text-base-contrast-80",
1310
+ children: [
1311
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", width: "100%", children: [
1312
+ /* @__PURE__ */ jsxs(
1313
+ Flex,
1314
+ {
1315
+ direction: "column",
1316
+ className: "oui-gap-[6px] oui-flex-1",
1317
+ itemAlign: "start",
1318
+ children: [
1319
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-base-contrast-36 oui-text-2xs", children: t("tradingRewards.epoch") }),
1320
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-sm", children: `Epoch ${data.epoch_id}` })
1321
+ ]
1322
+ }
1323
+ ),
1324
+ /* @__PURE__ */ jsxs(
1325
+ Flex,
1326
+ {
1327
+ direction: "column",
1328
+ className: "oui-gap-[6px] oui-flex-1",
1329
+ itemAlign: "start",
1330
+ children: [
1331
+ /* @__PURE__ */ jsxs(Text, { className: "oui-text-base-contrast-36 oui-text-2xs", children: [
1332
+ t("tradingRewards.epochRewards"),
1333
+ " "
1334
+ ] }),
1335
+ /* @__PURE__ */ jsxs(Flex, { gap: 1, children: [
1336
+ isOrder ? /* @__PURE__ */ jsx(OrderlyIcon, {}) : /* @__PURE__ */ jsx(EsOrderlyIcon, {}),
1337
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-sm", children: commifyOptional(data.max_reward_amount, { fix: 2 }) })
1338
+ ] })
1339
+ ]
1340
+ }
1341
+ ),
1342
+ /* @__PURE__ */ jsxs(
1343
+ Flex,
1344
+ {
1345
+ direction: "column",
1346
+ className: "oui-gap-[6px] oui-flex-1",
1347
+ itemAlign: "end",
1348
+ children: [
1349
+ /* @__PURE__ */ jsxs(Text, { className: "oui-text-base-contrast-36 oui-text-2xs", children: [
1350
+ t("tradingRewards.rewardsEarned"),
1351
+ " "
1352
+ ] }),
1353
+ /* @__PURE__ */ jsxs(Flex, { gap: 1, children: [
1354
+ r_warret !== "--" && (isOrder ? /* @__PURE__ */ jsx(OrderlyIcon, {}) : /* @__PURE__ */ jsx(EsOrderlyIcon, {})),
1355
+ !!data.rewardsTooltip ? /* @__PURE__ */ jsx(
1356
+ RewardsTooltip,
1357
+ {
1358
+ rewardsTooltip: data.rewardsTooltip,
1359
+ children: /* @__PURE__ */ jsx(Text, { className: "oui-text-sm oui-underline oui-decoration-dashed oui-cursor-pointer oui-underline-offset-4 oui-decoration-line-16", children: r_warret }),
1360
+ align: "center",
1361
+ className: "oui-bg-base-5",
1362
+ arrowClassName: "oui-fill-base-5"
1363
+ }
1364
+ ) : /* @__PURE__ */ jsx(Text, { className: "oui-text-sm", children: r_warret })
1365
+ ] })
1366
+ ]
1367
+ }
1368
+ )
1369
+ ] }),
1370
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", width: "100%", children: [
1371
+ /* @__PURE__ */ jsxs(
1372
+ Flex,
1373
+ {
1374
+ direction: "column",
1375
+ className: "oui-gap-[6px] oui-flex-1",
1376
+ itemAlign: "start",
1377
+ children: [
1378
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-base-contrast-36 oui-text-2xs", children: t("tradingRewards.rewardHistory.column.startDate") }),
1379
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", children: [
1380
+ /* @__PURE__ */ jsxs(Text, { className: "oui-text-sm", children: [
1381
+ formatTimestamp(data.start_time).firstPart,
1382
+ "\xA0"
1383
+ ] }),
1384
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-2xs oui-text-base-contrast-36", children: formatTimestamp(data.start_time).secondPart })
1385
+ ] })
1386
+ ]
1387
+ }
1388
+ ),
1389
+ /* @__PURE__ */ jsxs(
1390
+ Flex,
1391
+ {
1392
+ direction: "column",
1393
+ className: "oui-gap-[6px] oui-flex-1",
1394
+ itemAlign: "end",
1395
+ children: [
1396
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-base-contrast-36 oui-text-2xs", children: t("tradingRewards.rewardHistory.column.endDate") }),
1397
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", children: [
1398
+ /* @__PURE__ */ jsxs(Text, { className: "oui-text-sm", children: [
1399
+ formatTimestamp(data.end_time).firstPart,
1400
+ "\xA0"
1401
+ ] }),
1402
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-2xs oui-text-base-contrast-36", children: formatTimestamp(data.end_time).secondPart })
1403
+ ] })
1404
+ ]
1405
+ }
1406
+ )
1407
+ ] }),
1408
+ /* @__PURE__ */ jsx(Divider, { className: "oui-w-full" })
1409
+ ]
1410
+ },
1411
+ data.epoch_id
1412
+ );
1413
+ };
1414
+ DesktopList = (props) => {
1415
+ const { data } = props;
1416
+ const { t } = useTranslation();
1417
+ const columns = [
1418
+ {
1419
+ title: t("tradingRewards.epoch"),
1420
+ dataIndex: "epoch_id",
1421
+ className: "oui-w-1/4 oui-pl-0 oui-pr-0",
1422
+ render: (value) => {
1423
+ return /* @__PURE__ */ jsx(Text, { children: `${t("tradingRewards.epoch")} ${value}` });
1424
+ }
1425
+ },
1426
+ {
1427
+ title: t("tradingRewards.rewardHistory.column.start&EndDate"),
1428
+ dataIndex: "time",
1429
+ className: "oui-w-1/4 oui-pl-0 oui-pr-0",
1430
+ render: (value, record) => {
1431
+ return /* @__PURE__ */ jsxs(
1432
+ Flex,
1433
+ {
1434
+ direction: "column",
1435
+ className: "oui-gap-[2px]",
1436
+ justify: "start",
1437
+ itemAlign: "start",
1438
+ children: [
1439
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: 1, children: [
1440
+ /* @__PURE__ */ jsx(Text, { children: formatTimestamp(record.start_time).firstPart }),
1441
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-base-contrast-54", children: formatTimestamp(record.start_time).secondPart })
1442
+ ] }),
1443
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: 1, children: [
1444
+ /* @__PURE__ */ jsx(Text, { children: formatTimestamp(record.end_time).firstPart }),
1445
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-base-contrast-54", children: formatTimestamp(record.end_time).secondPart })
1446
+ ] })
1447
+ ]
1448
+ }
1449
+ );
1450
+ }
1451
+ },
1452
+ {
1453
+ title: t("tradingRewards.epochRewards"),
1454
+ dataIndex: "max_reward_amount",
1455
+ className: "oui-w-1/4 oui-pl-0 oui-pr-0",
1456
+ render: (value, record) => {
1457
+ const isOrder = `${record?.info?.epoch_token || record.epoch_token}`.toLowerCase() === "order";
1458
+ return /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: 1, children: [
1459
+ isOrder ? /* @__PURE__ */ jsx(OrderlyIcon, {}) : /* @__PURE__ */ jsx(EsOrderlyIcon, {}),
1460
+ /* @__PURE__ */ jsx(Text, { children: commifyOptional(value) })
1461
+ ] });
1462
+ }
1463
+ },
1464
+ {
1465
+ title: t("tradingRewards.rewardsEarned"),
1466
+ dataIndex: "earned",
1467
+ className: "oui-w-1/4 oui-pl-0 oui-pr-0",
1468
+ render: (value, record) => {
1469
+ const isOrder = `${record?.info?.epoch_token || record.epoch_token}`.toLowerCase() === "order";
1470
+ let children = /* @__PURE__ */ jsx(
1471
+ Text,
1472
+ {
1473
+ className: record.rewardsTooltip ? "oui-underline oui-decoration-dashed oui-cursor-pointer oui-underline-offset-4 oui-decoration-line-16" : "",
1474
+ children: commifyOptional(record.info?.r_wallet, { fix: 2 })
1475
+ }
1476
+ );
1477
+ if (record.rewardsTooltip) {
1478
+ children = /* @__PURE__ */ jsx(
1479
+ RewardsTooltip,
1480
+ {
1481
+ rewardsTooltip: record.rewardsTooltip,
1482
+ children,
1483
+ align: "center",
1484
+ className: "oui-bg-base-5",
1485
+ arrowClassName: "oui-fill-base-5"
1486
+ }
1487
+ );
1488
+ }
1489
+ return /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: 1, children: [
1490
+ isOrder ? /* @__PURE__ */ jsx(OrderlyIcon, {}) : /* @__PURE__ */ jsx(EsOrderlyIcon, {}),
1491
+ children
1492
+ ] });
1493
+ }
1494
+ }
1495
+ ];
1496
+ return /* @__PURE__ */ jsx(
1497
+ DataTable,
1498
+ {
1499
+ bordered: true,
1500
+ columns,
1501
+ loading: props.isLoading,
1502
+ dataSource: data,
1503
+ emptyView: /* @__PURE__ */ jsx(AuthGuardEmpty, { status: AccountStatusEnum.SignedIn }),
1504
+ onRow: (record) => {
1505
+ return {
1506
+ className: "oui-h-[59px]"
1507
+ };
1508
+ },
1509
+ pagination: props.pagination
1510
+ }
1511
+ );
1512
+ };
1513
+ }
1514
+ });
1515
+ var useRewardsHistoryScript;
1516
+ var init_rewardsHistory_script = __esm({
1517
+ "src/pages/index/rewardHistory/rewardsHistory.script.tsx"() {
1518
+ init_provider();
1519
+ useRewardsHistoryScript = () => {
1520
+ const { account } = useAccount();
1521
+ const {
1522
+ epochList,
1523
+ walletRewardsHistory,
1524
+ totalOrderClaimedReward,
1525
+ brokerId,
1526
+ brokerName
1527
+ } = useTradingRewardsContext();
1528
+ const epochInfos = epochList?.[0];
1529
+ const { isNotStared } = epochList?.[1];
1530
+ const [history] = walletRewardsHistory;
1531
+ const { wrongNetwork, disabledConnect } = useAppContext();
1532
+ const { data: accountHistory } = useAccountRewardsHistory(account.address);
1533
+ const data = useMemo(() => {
1534
+ if (isNotStared || disabledConnect) {
1535
+ return [];
1536
+ }
1537
+ const list = [...epochInfos || []];
1538
+ const combineData = list.map((e) => {
1539
+ const id = e.epoch_id;
1540
+ const index = history?.rows.findIndex((info) => id === info.epoch_id);
1541
+ let rewardsTooltip = void 0;
1542
+ if (index !== -1 && !wrongNetwork) {
1543
+ const info = history?.rows?.[index];
1544
+ const _findIndex = accountHistory?.findIndex((item) => {
1545
+ return item?.epoch_id === e.epoch_id;
1546
+ });
1547
+ if (accountHistory !== void 0 && _findIndex !== void 0 && _findIndex !== -1) {
1548
+ const brokerList = accountHistory[_findIndex].broker;
1549
+ const curBrokerIndex = brokerList.findIndex(
1550
+ (item) => item.broker_id === brokerId
1551
+ );
1552
+ const curBroker = curBrokerIndex !== -1 ? brokerList[curBrokerIndex] : void 0;
1553
+ const curRewards = curBroker?.r_account ?? 0;
1554
+ const otherRewards = Math.max(0, (info?.r_wallet ?? 0) - curRewards);
1555
+ rewardsTooltip = {
1556
+ brokerName,
1557
+ curRewards,
1558
+ otherRewards
1559
+ };
1560
+ }
1561
+ return {
1562
+ ...e,
1563
+ info,
1564
+ rewardsTooltip
1565
+ };
1566
+ }
1567
+ return {
1568
+ ...e
1569
+ };
1570
+ });
1571
+ combineData.sort((a, b) => a.epoch_id - b.epoch_id);
1572
+ let [claimedReward] = totalOrderClaimedReward;
1573
+ if (typeof claimedReward !== "undefined") {
1574
+ for (let i = 0; i < combineData.length; i++) {
1575
+ const element = combineData[i];
1576
+ if (typeof element?.info === "undefined") {
1577
+ element.state = "Null";
1578
+ continue;
1579
+ }
1580
+ const status = element.info?.reward_status;
1581
+ if (status === "Confirmed") {
1582
+ if (claimedReward - element.info?.r_wallet >= 0) {
1583
+ element.state = "Claimed";
1584
+ } else {
1585
+ element.state = "Claimable";
1586
+ }
1587
+ claimedReward -= element.info?.r_wallet;
1588
+ } else if (status === "Pending") {
1589
+ element.state = "Processing";
1590
+ }
1591
+ }
1592
+ }
1593
+ combineData.sort((a, b) => b.epoch_id - a.epoch_id);
1594
+ const curDate = getTimestamp();
1595
+ return combineData.filter((item) => item.end_time <= curDate);
1596
+ }, [
1597
+ history,
1598
+ epochInfos,
1599
+ totalOrderClaimedReward,
1600
+ isNotStared,
1601
+ wrongNetwork,
1602
+ accountHistory,
1603
+ disabledConnect
1604
+ ]);
1605
+ const { pagination } = usePagination();
1606
+ return {
1607
+ data,
1608
+ originalData: data,
1609
+ pagination,
1610
+ isLoading: epochList[1].isLoading
1611
+ };
1612
+ };
1613
+ }
1614
+ });
1615
+ var RewardsHistoryWidget;
1616
+ var init_rewardsHistory_widget = __esm({
1617
+ "src/pages/index/rewardHistory/rewardsHistory.widget.tsx"() {
1618
+ init_rewardsHistory_script();
1619
+ init_rewardsHistory_ui();
1620
+ RewardsHistoryWidget = () => {
1621
+ const state = useRewardsHistoryScript();
1622
+ return /* @__PURE__ */ jsx(RewardHistory, { ...state });
1623
+ };
1624
+ }
1625
+ });
1626
+
1627
+ // src/pages/index/rewardHistory/index.ts
1628
+ var rewardHistory_exports = {};
1629
+ __export(rewardHistory_exports, {
1630
+ RewardHistory: () => RewardHistory,
1631
+ RewardsHistoryWidget: () => RewardsHistoryWidget
1632
+ });
1633
+ var init_rewardHistory = __esm({
1634
+ "src/pages/index/rewardHistory/index.ts"() {
1635
+ init_rewardsHistory_ui();
1636
+ init_rewardsHistory_widget();
1637
+ }
1638
+ });
1639
+
1640
+ // src/pages/index/index.tsx
1641
+ var index_exports = {};
1642
+ __export(index_exports, {
1643
+ AvailableToClaim: () => AvailableToClaim,
1644
+ AvailableToClaimWidget: () => AvailableToClaimWidget,
1645
+ CurEpoch: () => CurEpoch,
1646
+ CurEpochWidget: () => CurEpochWidget,
1647
+ HomePage: () => HomePage,
1648
+ RewardHistory: () => RewardHistory,
1649
+ RewardsHistoryWidget: () => RewardsHistoryWidget,
1650
+ StakeBooster: () => StakeBooster,
1651
+ StakeBoosterWidget: () => StakeBoosterWidget,
1652
+ Title: () => Title,
1653
+ TitleWidget: () => TitleWidget,
1654
+ TradingRewardsProvider: () => TradingRewardsProvider,
1655
+ useCurEpochScript: () => useCurEpochScript
1656
+ });
1657
+
1658
+ // src/pages/index/title/index.ts
1659
+ init_title_ui();
1660
+ init_title_widget();
1661
+
1662
+ // src/pages/index/index.tsx
1663
+ init_curEpoch();
1664
+ init_availableToClaim();
1665
+ init_stakeBooster();
1666
+ init_rewardHistory();
1667
+ init_provider();
1668
+
1669
+ // src/pages/index/page.tsx
1670
+ init_provider();
1671
+ var LazyTitleWidget = React3.lazy(
1672
+ () => Promise.resolve().then(() => (init_title_widget(), title_widget_exports)).then((mod) => {
1673
+ return { default: mod.TitleWidget };
1674
+ })
1675
+ );
1676
+ var LazyCurEpochWidget = React3.lazy(
1677
+ () => Promise.resolve().then(() => (init_curEpoch(), curEpoch_exports)).then((mod) => {
1678
+ return { default: mod.CurEpochWidget };
1679
+ })
1680
+ );
1681
+ var LazyAvailableToClaimWidget = React3.lazy(
1682
+ () => Promise.resolve().then(() => (init_availableToClaim(), availableToClaim_exports)).then((mod) => {
1683
+ return { default: mod.AvailableToClaimWidget };
1684
+ })
1685
+ );
1686
+ var LazyStakeBoosterWidget = React3.lazy(
1687
+ () => Promise.resolve().then(() => (init_stakeBooster(), stakeBooster_exports)).then((mod) => {
1688
+ return { default: mod.StakeBoosterWidget };
1689
+ })
1690
+ );
1691
+ var LazyRewardsHistoryWidget = React3.lazy(
1692
+ () => Promise.resolve().then(() => (init_rewardHistory(), rewardHistory_exports)).then((mod) => {
1693
+ return { default: mod.RewardsHistoryWidget };
1694
+ })
1695
+ );
1696
+ var StakeBooster2 = () => {
1697
+ const { statusInfo } = useTradingRewardsStatus(false);
1698
+ const isStakeBoosterVisible = useMemo(() => {
1699
+ return statusInfo?.epochStatus === EpochStatus.active;
1700
+ }, [statusInfo?.epochStatus]);
1701
+ return isStakeBoosterVisible ? /* @__PURE__ */ jsx(React3.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyStakeBoosterWidget, {}) }) : null;
1702
+ };
1703
+ var HomePage = (props) => {
1704
+ return /* @__PURE__ */ jsx(
1705
+ TradingRewardsProvider,
1706
+ {
1707
+ titleConfig: props.titleConfig,
1708
+ showEpochPauseCountdown: props.showEpochPauseCountdown,
1709
+ children: /* @__PURE__ */ jsxs(
1710
+ Flex,
1711
+ {
1712
+ id: "oui-tradingRewards-home-page",
1713
+ className: cn("oui-h-lvw oui-w-full", props.className),
1714
+ direction: "column",
1715
+ gap: 4,
1716
+ children: [
1717
+ /* @__PURE__ */ jsx(React3.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyTitleWidget, {}) }),
1718
+ /* @__PURE__ */ jsxs(Flex, { className: "oui-flex oui-size-full oui-flex-col oui-gap-4 2xl:oui-flex-row 2xl:oui-items-stretch", children: [
1719
+ /* @__PURE__ */ jsx(Box, { className: "oui-w-full 2xl:oui-size-auto 2xl:oui-flex-1", children: /* @__PURE__ */ jsx(React3.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyCurEpochWidget, {}) }) }),
1720
+ /* @__PURE__ */ jsxs(Flex, { className: "oui-flex oui-w-full oui-flex-col oui-gap-4 lg:oui-flex-row 2xl:oui-flex-1 2xl:oui-flex-col", children: [
1721
+ /* @__PURE__ */ jsx(React3.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyAvailableToClaimWidget, {}) }),
1722
+ /* @__PURE__ */ jsx(StakeBooster2, {})
1723
+ ] })
1724
+ ] }),
1725
+ /* @__PURE__ */ jsx(React3.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyRewardsHistoryWidget, {}) })
1726
+ ]
1727
+ }
1728
+ )
1729
+ }
1730
+ );
1731
+ };
1732
+ var TradingRewardsLeftSidebarPath = /* @__PURE__ */ ((TradingRewardsLeftSidebarPath2) => {
1733
+ TradingRewardsLeftSidebarPath2["Trading"] = "/rewards/trading";
1734
+ TradingRewardsLeftSidebarPath2["Affiliate"] = "/rewards/affiliate";
1735
+ return TradingRewardsLeftSidebarPath2;
1736
+ })(TradingRewardsLeftSidebarPath || {});
1737
+ var useTradingRewardsLayoutScript = (props) => {
1738
+ const { t } = useTranslation();
1739
+ const [current, setCurrent] = useState(props.current || "/rewards/affiliate");
1740
+ useEffect(() => {
1741
+ if (props.current)
1742
+ setCurrent(props.current);
1743
+ }, [props.current]);
1744
+ const items = useMemo(() => {
1745
+ return [
1746
+ {
1747
+ name: t("common.trading"),
1748
+ href: "/rewards/trading" /* Trading */,
1749
+ icon: /* @__PURE__ */ jsxs(
1750
+ "svg",
1751
+ {
1752
+ width: "18",
1753
+ height: "18",
1754
+ viewBox: "0 0 18 18",
1755
+ fill: "none",
1756
+ xmlns: "http://www.w3.org/2000/svg",
1757
+ children: [
1758
+ /* @__PURE__ */ jsx(
1759
+ "path",
1760
+ {
1761
+ d: "M4.883 1.5c-.166.01-.393.076-.515.173a2 2 0 0 0-.18.173L.918 6.553a.86.86 0 0 0-.168.475c0 .339.232.543.232.543l7.374 8.633c.005.006.269.301.644.296s.64-.29.644-.296l7.402-8.663s.204-.269.204-.513-.196-.517-.196-.517L13.82 1.848c-.023-.032-.076-.021-.103-.049-.033-.038-.037-.091-.077-.124-.123-.097-.267-.106-.413-.123-.04-.005-.063-.049-.103-.049h-.078zm1.745 1.582h4.744L9 5.795zm-1.675.542 2.294 2.615H3.122zm8.094 0 1.831 2.615h-4.125zM3.328 7.818h4.847v5.672zm6.497 0h4.847c-1.151 1.345-3.422 4.007-4.847 5.672z",
1762
+ className: "oui-fill-current group-data-[actived=true]:oui-fill-[url(#side-menu-gradient)]"
1763
+ }
1764
+ ),
1765
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
1766
+ "linearGradient",
1767
+ {
1768
+ id: "a",
1769
+ x1: "17.25",
1770
+ y1: "9",
1771
+ x2: ".75",
1772
+ y2: "9",
1773
+ gradientUnits: "userSpaceOnUse",
1774
+ children: [
1775
+ /* @__PURE__ */ jsx("stop", { stopColor: "rgb(var(--oui-gradient-brand-end))" }),
1776
+ /* @__PURE__ */ jsx(
1777
+ "stop",
1778
+ {
1779
+ offset: "1",
1780
+ stopColor: "rgb(var(--oui-gradient-brand-start))"
1781
+ }
1782
+ )
1783
+ ]
1784
+ }
1785
+ ) })
1786
+ ]
1787
+ }
1788
+ )
1789
+ },
1790
+ {
1791
+ name: t("common.affiliate"),
1792
+ href: "/rewards/affiliate" /* Affiliate */,
1793
+ icon: /* @__PURE__ */ jsx(
1794
+ "svg",
1795
+ {
1796
+ width: "18",
1797
+ height: "18",
1798
+ viewBox: "0 0 18 18",
1799
+ fill: "none",
1800
+ xmlns: "http://www.w3.org/2000/svg",
1801
+ children: /* @__PURE__ */ jsx(
1802
+ "path",
1803
+ {
1804
+ fillRule: "evenodd",
1805
+ clipRule: "evenodd",
1806
+ d: "M5.625 4.95c0-.746.604-1.35 1.35-1.35h4.05c.746 0 1.35.604 1.35 1.35v4.62L9 12.195 5.625 9.57zm8.624 3.163-.524.407v-.96l.074.05c.193.128.346.302.45.502m-4.42 5.148L14.4 9.705v3.345a1.35 1.35 0 0 1-1.35 1.35h-8.1a1.35 1.35 0 0 1-1.35-1.35V9.705l4.571 3.556c.488.379 1.17.379 1.658 0M4.275 8.52l-.524-.407c.104-.2.257-.374.45-.503l.074-.049zm0-2.581V4.95a2.7 2.7 0 0 1 2.7-2.7h4.05a2.7 2.7 0 0 1 2.7 2.7v.989l.823.548a2.7 2.7 0 0 1 1.202 2.247v4.316a2.7 2.7 0 0 1-2.7 2.7h-8.1a2.7 2.7 0 0 1-2.7-2.7V8.734a2.7 2.7 0 0 1 1.202-2.247zM9 6.089l.111-.118.005-.005a1.08 1.08 0 0 1 1.58.004 1.223 1.223 0 0 1 0 1.668l-1.515 1.62-.004.004c-.1.102-.26.1-.358-.004l-1.516-1.62a1.223 1.223 0 0 1 0-1.668l.004-.004a1.08 1.08 0 0 1 1.58.004z",
1807
+ className: "oui-fill-current group-data-[actived=true]:oui-fill-[url(#side-menu-gradient)]"
1808
+ }
1809
+ )
1810
+ }
1811
+ )
1812
+ }
1813
+ ];
1814
+ }, [t]);
1815
+ const hideSideBar = useMediaQuery("(max-width: 768px)");
1816
+ return {
1817
+ items,
1818
+ current,
1819
+ hideSideBar,
1820
+ // open: sideOpen,
1821
+ // onOpenChange(open) {
1822
+ // setSideOpen(open);
1823
+ // },
1824
+ onItemSelect: (item) => {
1825
+ setCurrent(item.href);
1826
+ }
1827
+ };
1828
+ };
1829
+ var TradingRewardsLayout = (props) => {
1830
+ const { children, classNames, ...rest } = props;
1831
+ return /* @__PURE__ */ jsx(
1832
+ Scaffold,
1833
+ {
1834
+ leftSidebar: null,
1835
+ routerAdapter: props.routerAdapter,
1836
+ classNames: {
1837
+ ...classNames,
1838
+ content: classNames?.content,
1839
+ topNavbar: cn("oui-bg-base-9", classNames?.topNavbar),
1840
+ leftSidebar: cn(
1841
+ "oui-rounded-xl oui-bg-base-9",
1842
+ "oui-m-3 oui-p-4",
1843
+ "oui-border oui-border-line",
1844
+ classNames?.leftSidebar
1845
+ )
1846
+ },
1847
+ ...omit(["leftSideProps"], rest),
1848
+ children
1849
+ }
1850
+ );
1851
+ };
1852
+ var TradingRewardsLayoutWidget = (props) => {
1853
+ const state = useTradingRewardsLayoutScript({
1854
+ current: props.leftSideProps?.current
1855
+ });
1856
+ return /* @__PURE__ */ jsx(TradingRewardsLayout, { ...state, ...props, children: props.children });
1857
+ };
1858
+
1859
+ export { index_exports as TradingRewards, TradingRewardsLayout, TradingRewardsLayoutWidget, TradingRewardsLeftSidebarPath, useTradingRewardsLayoutScript };
16
1860
  //# sourceMappingURL=out.js.map
17
1861
  //# sourceMappingURL=index.mjs.map