@orderly.network/affiliate 2.0.0-alpha.1

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 ADDED
@@ -0,0 +1,18 @@
1
+ import { modal, useModal, Dialog, DialogContent, DialogTitle, Divider, Input, Flex, Button, cn, toast, Box, Text, Select, CopyIcon, ListView, DataTable, Tabs, TabPanel, Pagination, DatePicker, usePagination, Statistic, TabsBase, TabsList, TabsTrigger, TabsContent, Tooltip, DialogTrigger, DialogHeader, DialogBody, TextField, inputFormatter } from '@orderly.network/ui';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { Decimal, commifyOptional } from '@orderly.network/utils';
4
+ import { createContext, useState, useRef, useEffect, useMemo, useContext } from 'react';
5
+ import { IntlProvider } from 'react-intl';
6
+ import { useMutation, cleanStringStyle, useAccount, usePrivateQuery, useDaily, useMediaQuery, useLocalStorage, useReferralRebateSummary, useRefereeInfo, useRefereeRebateSummary, useCheckReferralCode } from '@orderly.network/hooks';
7
+ import { subDays, format, toDate } from 'date-fns';
8
+ import { useAppContext } from '@orderly.network/react-app';
9
+ import { AccountStatusEnum } from '@orderly.network/types';
10
+ import { VolBarChart } from '@orderly.network/chart';
11
+ import { AuthGuardDataTable } from '@orderly.network/ui-connector';
12
+ import { Scaffold, SideBar } from '@orderly.network/ui-scaffold';
13
+
14
+ var qo=Object.defineProperty;var Xo=(e,t)=>{for(var o in t)qo(e,o,{get:t[o],enumerable:!0});};var Bo={};Xo(Bo,{AffiliatePage:()=>Se,DashboardPage:()=>ko,HomePage:()=>be,TraderPage:()=>Ae});var rt=e=>{let{size:t=16,className:o,...r}=e;return jsxs("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"#fff",fillOpacity:".98",xmlns:"http://www.w3.org/2000/svg",className:e.className,...r,children:[jsx("path",{d:"M8 1.302c-3.683 0-6.655 2.985-6.667 6.667-.013 3.676 2.987 6.68 6.666 6.687s6.674-3.037 6.667-6.687c-.007-3.682-2.985-6.667-6.667-6.667m0 1.333a5.333 5.333 0 0 1 5.333 5.334c0 1.5-.625 2.852-1.622 3.821-.49-1.062-1.545-1.821-2.753-1.821H7.04c-1.207 0-2.259.75-2.75 1.812A5.3 5.3 0 0 1 2.666 7.97a5.333 5.333 0 0 1 5.333-5.334M8 3.97a2.667 2.667 0 1 0 0 5.333A2.667 2.667 0 0 0 8 3.97"}),jsx("path",{d:"M16 12.667a3.333 3.333 0 1 1-6.667 0 3.333 3.333 0 0 1 6.667 0",fill:"#1828C3"}),jsx("path",{d:"M11.917 11.433a.917.917 0 0 0-.917.917c0 .53.302 1.031.802 1.49a4.6 4.6 0 0 0 .713.53l.068.043c.05.027.117.027.167 0l.068-.042q.08-.05.177-.115c.182-.123.366-.26.536-.416.5-.459.802-.96.802-1.49a.917.917 0 0 0-.917-.917.97.97 0 0 0-.744.386.95.95 0 0 0-.756-.386"})]})};var it=e=>{let{size:t=16,className:o,...r}=e;return jsxs("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"white",fillOpacity:"0.36",xmlns:"http://www.w3.org/2000/svg",className:e.className,...r,children:[jsx("path",{d:"M7.99929 1.30212C4.31735 1.30212 1.34509 4.28679 1.33262 7.96878C1.32015 11.6454 4.32042 14.6488 7.99929 14.6561C11.6782 14.6634 14.6726 11.6194 14.666 7.96878C14.6593 4.28679 11.6812 1.30212 7.99929 1.30212ZM7.99929 2.63546C10.9448 2.63546 13.3326 5.02345 13.3326 7.96878C13.3326 9.46878 12.7078 10.8208 11.7112 11.7901C11.2202 10.7281 10.1656 9.96878 8.95762 9.96878C8.71802 9.96878 7.28042 9.96878 7.04095 9.96878C5.83369 9.96878 4.78215 10.7188 4.29095 11.7814C3.29429 10.8121 2.66595 9.46878 2.66595 7.96878C2.66595 5.02345 5.05375 2.63546 7.99929 2.63546ZM7.99929 3.96879C6.52649 3.96879 5.33255 5.16279 5.33262 6.63545C5.33262 8.10812 6.52649 9.30212 7.99929 9.30212C9.47202 9.30212 10.666 8.10812 10.666 6.63545C10.666 5.16279 9.47202 3.96879 7.99929 3.96879Z"}),jsx("path",{d:"M16 12.6667C16 14.5076 14.5076 16 12.6666 16C10.8257 16 9.33331 14.5076 9.33331 12.6667C9.33331 10.8257 10.8257 9.33333 12.6666 9.33333C14.5076 9.33333 16 10.8257 16 12.6667Z",fill:"#005A4F"}),jsx("path",{d:"M14.3325 13.3345C14.3325 13.2918 14.3182 13.2473 14.2857 13.2147L13.6658 12.6002L13.4315 12.8345L13.7595 13.1678H11.3325C11.2405 13.1678 11.1658 13.2425 11.1658 13.3345C11.1658 13.4265 11.2405 13.5012 11.3325 13.5012H13.7595L13.4315 13.8345L13.6658 14.0688L14.2857 13.4543C14.3182 13.4217 14.3325 13.3772 14.3325 13.3345ZM14.1658 12.0012C14.1658 11.9092 14.0912 11.8345 13.9992 11.8345H11.572L11.9002 11.5012L11.6658 11.2668L11.046 11.8813C10.981 11.9465 10.981 12.0558 11.046 12.121L11.6658 12.7355L11.9002 12.5012L11.572 12.1678H13.9992C14.0912 12.1678 14.1658 12.0932 14.1658 12.0012Z",fill:"white",fillOpacity:"0.98"})]})};var q=e=>jsxs("svg",{width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e.className,children:[jsxs("g",{clipPath:"url(#a)",children:[jsx("path",{d:"M10.5 20c5.542 0 10-4.458 10-10s-4.458-10-10-10S.5 4.458.5 10s4.458 10 10 10",fill:"#2775CA"}),jsx("path",{d:"M13.5 11.473c0-1.452-.94-1.95-2.82-2.158-1.344-.166-1.613-.498-1.613-1.078s.448-.955 1.343-.955c.806 0 1.254.25 1.478.872.045.124.18.207.313.207h.717c.179 0 .313-.125.313-.29v-.042c-.179-.913-.985-1.618-2.015-1.701v-.996c0-.166-.134-.29-.358-.332h-.671c-.18 0-.314.124-.359.332v.954c-1.343.166-2.194.996-2.194 2.034 0 1.369.896 1.908 2.776 2.116 1.254.207 1.657.456 1.657 1.12s-.627 1.12-1.477 1.12c-1.165 0-1.568-.456-1.702-1.078a.32.32 0 0 0-.313-.25h-.762c-.179 0-.313.125-.313.291v.042c.179 1.037.895 1.784 2.373 1.991v.996c0 .166.134.29.358.332h.672c.18 0 .313-.124.358-.332v-.996c1.344-.207 2.239-1.079 2.239-2.199",fill:"#fff",fillOpacity:".98"}),jsx("path",{d:"M8.24 16.57c-3.458-1.215-5.23-4.986-3.945-8.324.665-1.821 2.127-3.208 3.944-3.859.178-.086.266-.216.266-.433v-.607c0-.174-.088-.304-.266-.347-.044 0-.133 0-.177.043-4.21 1.3-6.516 5.68-5.186 9.798.798 2.428 2.704 4.292 5.186 5.072.177.087.355 0 .4-.173.043-.043.043-.087.043-.173v-.608c0-.13-.133-.303-.266-.39m4.698-13.527c-.178-.086-.355 0-.4.174-.043.043-.043.086-.043.173v.607c0 .174.133.347.266.434 3.457 1.213 5.23 4.985 3.944 8.323-.664 1.821-2.127 3.209-3.944 3.859-.178.086-.266.216-.266.433v.607c0 .174.088.304.266.347.044 0 .133 0 .177-.043 4.21-1.3 6.515-5.68 5.186-9.798-.798-2.471-2.748-4.335-5.186-5.116",fill:"#fff",fillOpacity:".98"})]}),jsx("defs",{children:jsx("clipPath",{id:"a",children:jsx("path",{fill:"#fff",d:"M.5 0h20v20H.5z"})})})]});var nt=e=>jsxs(Flex,{id:"oui-affiliate-affiliate-summary",r:"2xl",p:6,width:"100%",height:"100%",gap:4,direction:"column",className:"oui-bg-base-9",children:[jsx(ei,{...e}),jsx(ti,{...e}),jsxs(Flex,{direction:"column",width:"100%",gap:2,children:[jsx(at,{title:"Referral vol. (USDC)",value:e.referralVol,dp:2,...e}),jsx(at,{title:"Referees",value:e.referees,dp:0,...e}),jsx(at,{title:"Referees that traded",value:e.refereesTades,dp:0,...e})]})]}),ei=e=>jsxs(Flex,{direction:"row",justify:"between",width:"100%",children:[jsx(Text,{className:"oui-text-lg",children:"Summary"}),jsx("div",{className:"oui-min-w-14",children:jsx(Select.options,{size:"xs",value:e.period,onValueChange:e.onPeriodChange,options:e.periodTypes})})]}),ti=e=>jsxs(Flex,{gradient:"primary",angle:180,r:"xl",py:4,px:6,width:"100%",direction:"column",gap:3,height:"100%",className:"oui-max-h-[104px]",children:[jsx(Text,{intensity:54,className:"oui-text-base 2xl:oui-text-lg",children:"Commission (USDC)"}),jsxs(Flex,{direction:"row",gap:3,className:"oui-text-xl md:oui-text-2xl xl:oui-text-3xl",children:[jsx(q,{className:"md:oui-w-[24px] md:oui-h-[24px] lg:oui-w-[28px] lg:oui-h-[28px] "}),jsx(Text,{children:commifyOptional(e.commission,{fix:2,fallback:"0"})})]})]}),at=e=>jsxs(Flex,{direction:"row",justify:"between",width:"100%",children:[jsx(Text,{intensity:54,className:"oui-text-2xs md:oui-text-xs xl:oui-text-sm",children:e.title}),jsx(Text,{className:"oui-text-xs md:oui-text-sm xl:oui-text-base",children:commifyOptional(e.value,{fix:e.dp,fallback:"0"})})]});var wr={"refferal.title":"Earn more as a {name} affiliate","refferal.subtitle":"Grow your brand | Get 40% commission | Unlock exclusive perks","refferal.linkUrl":"Learn how it works","referral.not.ref.card.title":"As an affiliate","referral.not.ref.card.subtitle":"Onboard traders to earn passive income","referral.not.ref.card.btn":"Become an affiliate","referral.not.ref.card.hint.title":"40%~60%","referral.not.ref.card.hint.subtitle":"Commission","referral.ref.card.title":"Affiliate","referral.ref.card.comission":"Commission (USDC)","referral.ref.card.enter":"Enter","referral.not.trader.card.title":"As a trader","referral.not.trader.card.subtitle":"Get fee rebates on every trade","referral.not.trader.card.btn":"Enter code","referral.not.trader.card.hint.title":"0%~20%","referral.not.trader.card.hint.subtitle":"Rebate","referral.trader.card.title":"Trader","referral.trader.card.rebate":"Rebate (USDC)","referral.trader.card.enter":"Enter","referral.step.title":"Becoming an affiliate is easy","referral.step.apply.title":"Apply","referral.step.apply.subtitle":"Fill out the application form","referral.step.share.title":"Share","referral.step.share.subtitle":"Unlock your affiliate link and share it with your community","referral.step.earn.title":"Earn","referral.step.earn.subtitle":"Get paid and receive special treatment 24/7, 365"};var ve=(o=>(o.affiliate="affiliate",o.trader="trader",o))(ve||{}),Nr=createContext({}),kl=e=>{let{onBecomeAnAffiliate:t,becomeAnAffiliateUrl:o="https://orderly.network/",bindReferralCodeState:r,onLearnAffiliate:i,learnAffiliateUrl:a="https://orderly.network/",referralLinkUrl:n="https://orderly.network/",showReferralPage:l,chartConfig:d,intl:p={messages:wr,locale:"en",defaultLocale:"en"},overwrite:s,splashPage:u}=e,{state:f}=useAccount(),{data:c,mutate:m,isLoading:x}=usePrivateQuery("/v1/referral/info",{revalidateOnFocus:!0}),[D,L]=useState(x);useEffect(()=>{L(!0);},[x]);let{data:B,mutate:F}=useDaily({startDate:subDays(new Date,1),endDate:subDays(new Date,90)}),{data:v,mutate:M}=usePrivateQuery("/v1/volume/user/stats",{revalidateOnFocus:!0}),T=useMemo(()=>(c?.referrer_info?.referral_codes?.length||0)>0,[c?.referrer_info]),H=useMemo(()=>(c?.referee_info.referer_code?.length||0)>0,[c?.referee_info]),Uo=useMemo(()=>{let W={};if(B&&B.length>0){let Fe=format(new Date,"yyyy-MM-dd"),hr=B.findIndex(Yo=>Yo.date===Fe),br=0;hr!==-1&&(br=B[hr].perp_volume),W["1d_volume"]=br;}return v&&(W["7d_volume"]=v.perp_volume_last_7_days,W["30d_volume"]=v.perp_volume_last_30_days,W.all_volume=v.perp_volume_ltd),W},[B,v]);useEffect(()=>{(T||H)&&L(!1);},[T,H]);let pr=()=>{M(),F(),m();};useEffect(()=>{let Fe=new URLSearchParams(window.location.search).get("ref");Fe&&localStorage.setItem("referral_code",Fe);},[]);let{messages:Vo,locale:Ho,defaultLocale:$o}=p,[Go,Zo]=useState("affiliate"),{wrongNetwork:Qo}=useAppContext(),gr=useRef(AccountStatusEnum.NotConnected);return useEffect(()=>{let W;return gr.current!==f.status&&(gr.current=f.status,W=setTimeout(()=>{pr();},1e3)),()=>{W&&clearTimeout(W);}},[f.status]),jsx(IntlProvider,{messages:Vo,locale:Ho,defaultLocale:$o,children:jsx(Nr.Provider,{value:{showHome:D,setShowHome:L,referralInfo:c,isAffiliate:T,isTrader:H,mutate:pr,onBecomeAnAffiliate:t,becomeAnAffiliateUrl:o,bindReferralCodeState:r,onLearnAffiliate:i,learnAffiliateUrl:a,referralLinkUrl:n,userVolume:Uo,dailyVolume:B,showReferralPage:l,chartConfig:d,overwrite:s,splashPage:u,isLoading:x,tab:Go,setTab:Zo,wrongNetwork:Qo},children:e.children})})};function y(){return useContext(Nr)}var st=()=>{let[e,t]=useState("All"),o=[{label:"All",value:"All"},{label:"1D",value:"1D"},{label:"7D",value:"7D"},{label:"30D",value:"30D"}],{referralInfo:r}=y(),i=useMemo(()=>{if(!r)return 0;switch(e){case"All":return r.referrer_info.total_referrer_rebate;case"1D":return r.referrer_info["1d_referrer_rebate"];case"7D":return r.referrer_info["7d_referrer_rebate"];case"30D":return r.referrer_info["30d_referrer_rebate"]}},[r,e]),a=useMemo(()=>{if(!r)return 0;switch(e){case"All":return r.referrer_info.total_referee_volume;case"1D":return r.referrer_info["1d_referee_volume"];case"7D":return r.referrer_info["7d_referee_volume"];case"30D":return r.referrer_info["30d_referee_volume"]}},[r,,e]),n=useMemo(()=>{if(!r)return 0;switch(e){case"All":return r.referrer_info.total_invites;case"1D":return r.referrer_info["1d_invites"];case"7D":return r.referrer_info["7d_invites"];case"30D":return r.referrer_info["30d_invites"]}},[r,,e]),l=useMemo(()=>{if(!r)return 0;switch(e){case"All":return r.referrer_info.total_traded;case"1D":return r.referrer_info["1d_traded"];case"7D":return r.referrer_info["7d_traded"];case"30D":return r.referrer_info["30d_traded"]}},[r,,e]);return {period:e,periodTypes:o,onPeriodChange:p=>{t(p);},commission:i,referralVol:a,referees:n,refereesTades:l}};var Ie=()=>{let e=st();return jsx(nt,{...e})};var Dr=e=>{let{text:t,visibleCount:o}=e,r=useRef(null),i=useRef(null),a=useRef(void 0);function n(s,u){let c=document.createElement("canvas").getContext("2d"),m=s;if(c&&m){let x=getComputedStyle(m).font;return x.length===0&&(x=[getComputedStyle(m).fontWeight,getComputedStyle(m).fontSize,getComputedStyle(m).fontFamily].join(" ")),c.font=x,c.letterSpacing=getComputedStyle(m).letterSpacing,c.measureText(u).width}}let[l,d]=useState(0);useEffect(()=>{let s=()=>{if(e.visibleCount===void 0&&r.current&&i.current){let u=r.current.clientWidth;if(u==a.current)return;a.current=u;let f=i.current,c=t,m=Math.ceil(n(f,"...")||0),x=u-m,D=0;for(;D<t.length&&!((n(f,gi(t,D++))||x)<=x););d(c.length-D);}};return a.current=void 0,s(),window.addEventListener("resize",s),()=>{a.current=void 0,window.removeEventListener("resize",s);}},[t,i]);let p=useMemo(()=>{if(l+1>=t.length)return t;let s=o||l,u=t.slice(0,Math.ceil(s/2)),f=t.slice(t.length-Math.floor(s/2),t.length);return `${u}...${f}`},[t,o,l]);return jsxs("div",{ref:r,className:cn("oui-relative oui-w-full oui-text-end",e.className),children:[jsx("div",{className:cn("oui-hidden oui-whitespace-nowrap oui-absolute oui-top-0 oui-bottom-0 oui-right-0 oui-left-0"),children:jsx("span",{ref:i,children:t})}),jsx("span",{children:p})]})},gi=(e,t)=>{let o=Math.floor(e.length/2-(t>0?t/2:1)),r=e.slice(0,o),i=e.slice(o+t);return r+i};var mt=e=>{let{texts:t,className:o}=e;return jsx("div",{className:o,children:jsx("h1",{children:t.map((r,i)=>r.gradient?jsx(Text.gradient,{color:r.gradientColor,children:r.text},i):jsx("span",{children:r.text},i))})})};var dt=e=>jsxs(Flex,{id:"oui-affiliate-affiliate-referralLink",r:"2xl",p:6,width:"100%",gap:4,direction:"column",className:"oui-bg-base-9",children:[jsx(Ri,{...e}),jsxs(Flex,{width:"100%",className:"oui-flex oui-flex-col 3xl:oui-flex-row",gap:4,children:[jsx("div",{className:"oui-w-full 3xl:oui-w-1/3",children:jsx(Ti,{...e})}),jsxs(Flex,{direction:"column",width:"100%",className:"3xl:oui-w-2/3 3xl:oui-gap-2",children:[jsx(Fr,{title:"Referral code",value:e.refCode,...e}),jsx(Fr,{title:"Referral link",value:e.refLink,...e})]})]})]}),Ri=e=>jsx(Flex,{direction:"row",justify:"between",width:"100%",children:jsx(Text,{className:"oui-text-lg",children:"Referral link"})}),Ti=e=>{let t=(o,r,i,a,n)=>{let l="oui-text-lg md:oui-text-xl lg:oui-text-2xl xl:oui-text-3xl";return jsxs(Flex,{direction:"column",itemAlign:"start",className:a,children:[jsx(Flex,{direction:"row",gap:2,children:jsx(Si,{title:o,tooltip:n})}),i?jsx(Text.gradient,{color:"brand",className:l,children:r}):jsx(Text,{className:l,children:r})]})};return jsxs(Flex,{direction:"row",width:"100%",children:[t("Earn",e.earn||"-",!0,"oui-flex-1",jsx(mt,{texts:[{text:e.earn||"-",gradient:!0,gradientColor:"brand"},{text:` ${e.brokerName} net fee that deduct Orderly fee.`}]})),t("Share",e.share||"-",!1,"oui-flex-1",jsx(mt,{texts:[{text:"Your referees get "},{text:e.share||"-",gradient:!0,gradientColor:"brand"},{text:` of their ${e.brokerName} net fee`}]}))]})},Fr=e=>{let{title:t,value:o="-"}=e;return jsxs(Flex,{r:"xl",p:3,gap:4,direction:"row",width:"100%",className:"oui-bg-base-8",children:[jsx(Text,{className:"oui-text-base-contrast-54 oui-flex-shrink oui-text-2xs md:oui-text-xs xl:oui-text-sm",children:t}),jsxs(Flex,{direction:"row",justify:"end",gap:2,className:"oui-flex-1 oui-text-xs md:oui-text-sm xl:oui-text-base",children:[jsx(Dr,{text:o}),jsx("button",{className:"oui-cursor-pointer oui-text-sm oui-flex-shrink",onClick:()=>{navigator.clipboard.writeText(o),e.onCopy?.(o);},children:jsx(CopyIcon,{size:12,color:"white",className:"oui-w-[13px] oui-h-[13px] md:oui-w-[14px] md:oui-h-[14px] xl:oui-w-4 xl:oui-h-4"})})]})]})},Si=e=>jsx(Tooltip,{content:e.tooltip,className:"oui-max-w-[200px]",children:jsx("div",{onClick:()=>{modal.alert({title:e.title,message:jsx("div",{className:"oui-text-base-contrast/30 oui-space-y-3 oui-text-xs desktop:oui-text-xs",children:e.tooltip})});},children:jsxs(Flex,{direction:"column",children:[jsx(Text,{intensity:54,className:"oui-text-2xs md:oui-text-xs xl:oui-text-sm",children:e.title}),jsx(Divider,{className:"oui-w-full",lineStyle:"dotted",intensity:16})]})})});function Me(e,t,o){let r=new URL(e),i=new URLSearchParams(r.search);return i.set(t,o),r.search=i.toString(),r.toString()}async function ct(e){try{await navigator.clipboard.writeText(e),toast.success("Copy success");}catch{toast.success("Copy failed");}}function Lr(e){if(e===void 0)return "";let t=toDate(e),o=Br(t);return format(o,"yyyy-MM-dd HH:mm:ss 'UTC'")}function Mr(e){if(e===void 0)return;let t=toDate(e),o=Br(t);return format(o,"yyyy-MM-dd")}function kr(e,t){return e&&t&&e.toISOString().substring(0,10)===t.toISOString().substring(0,10)}function Br(e){return new Date(e.toUTCString())}var xt=()=>{let e=f=>{toast.success("Copy success");},{referralInfo:t,referralLinkUrl:o,overwrite:r}=y(),[i,a]=useLocalStorage("orderly_referral_codes",[]),n=useMemo(()=>{if(!t?.referrer_info.referral_codes)return [];let f=[...t?.referrer_info.referral_codes],c=[];for(let m=0;m<i.length;m++){let x=i[m],D=f.findIndex(L=>L.code===x);D!==-1&&(c.push({...f[D]}),f.splice(D,1));}return [...c,...f]},[t?.referrer_info.referral_codes,i]),l=useMemo(()=>{if(n.length!==0)return n[0]},[n]),d=useMemo(()=>l?.code,[l]),p=useMemo(()=>l?Me(o,"ref",l.code):"",[l]),s=useMemo(()=>`${new Decimal(l?.referrer_rebate_rate||"0").mul(100).toDecimalPlaces(0,Decimal.ROUND_DOWN).toString()}%`,[l?.referrer_rebate_rate]),u=useMemo(()=>`${new Decimal(l?.referee_rebate_rate||"0").mul(100).toDecimalPlaces(0,Decimal.ROUND_DOWN).toString()}%`,[l?.referee_rebate_rate]);return {onCopy:e,refLink:p,refCode:d,share:u,earn:s,brokerName:r?.brokerName??r?.shortBrokerName}};var Be=()=>{let e=xt();return jsx(dt,{...e})};var gt=e=>jsxs(Flex,{id:"oui-affiliate-affiliate-titleStatistic",r:"2xl",p:6,width:"100%",gap:4,direction:"column",className:"oui-bg-base-9",children:[jsx(Ii,{...e}),jsx(Flex,{className:"oui-h-[170px] 2xl:oui-h-[196px] oui-w-full oui-flex oui-flex-row oui-items-stretch",children:jsx(VolBarChart,{data:e.dataSource||[],colors:{fill:"rgba(0, 180, 158, 1)"},className:"oui-w-full oui-flex-1",tooltip:{rm:Decimal.ROUND_DOWN,dp:e.volType==="Commission"?6:2}})})]}),Ii=e=>jsxs(Flex,{direction:"row",justify:"between",width:"100%",children:[jsx(Text,{className:"oui-text-lg",children:"Statistics"}),jsxs(Flex,{direction:"row",gap:2,className:"oui-min-w-14",children:[jsx(Select.options,{size:"xs",value:e.period,onValueChange:e.onPeriodChange,options:e.periodTypes}),jsx(Select.options,{size:"xs",value:e.volType,onValueChange:e.onVolTypeChange,options:e.volTypes})]})]});function Ee(e,t){let o=Date(),r=new Array(e).fill(0).map((a,n)=>({date:format(subDays(o,n+1),"yyyy-MM-dd"),volume:0,opacity:0})).reverse(),i=t?.reduce((a,n)=>(a[n.date]=n,a),{});for(let a=0;a<r.length;a++){let n=r[a],l=i?.[n.date];l&&(r[a]={...l,opacity:l.volume>0?1:0});}return r}var ht=()=>{let[e,t]=useState("7"),o=[{label:"7D",value:"7"},{label:"30D",value:"30"},{label:"90D",value:"90"}],r=u=>{t(u);},[i,a]=useState("Commission"),n=[{label:"Commission",value:"Commission"},{label:"Referral vol.",value:"ref"}],l=u=>{a(u);},d=useMemo(()=>e==="7"?{startDate:subDays(new Date,7),endDate:subDays(new Date,1)}:e==="30"?{startDate:subDays(new Date,30),endDate:subDays(new Date,1)}:e==="90"?{startDate:subDays(new Date,90),endDate:subDays(new Date,1)}:{startDate:subDays(new Date,7),endDate:subDays(new Date,1)},[e]),[p]=useReferralRebateSummary({startDate:format(d.startDate,"yyyy-MM-dd"),endDate:format(d.endDate,"yyyy-MM-dd"),size:Number(e)}),s=useMemo(()=>(p?.map(u=>({date:u.date,volume:i==="Commission"?u.referral_rebate:u.volume}))||[]).reverse(),[p,i]);return {period:e,periodTypes:o,onPeriodChange:r,volType:i,volTypes:n,onVolTypeChange:l,dataSource:Ee(Number(e),s)}};var Oe=()=>{let e=ht();return jsx(gt,{...e})};var bt=e=>jsx("button",{onClick:t=>{e?.onClick?.(!e.pinned);},children:e.pinned===!1?jsx(Ei,{size:e.size,fillOpacity:1,className:"orderly-fill-primary hover:orderly-fill-primary/80"}):jsx(zi,{size:e.size,fillOpacity:1,className:"orderly-fill-base-contrast-36 hover:orderly-fill-base-contrast"})}),zi=e=>{let{size:t=16}=e;return jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"#608CFF",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M10.008 1.302a.74.74 0 0 0-.486.215c-1.033.988-1.349 1.815-.972 2.947-.88.675-1.437.841-2.536.841-1.503 0-2.484.181-3.152.848v.021a1.583 1.583 0 0 0 0 2.249l1.867 1.881-3.181 3.18c-.26.26-.28.696-.02.956.261.26.699.26.959 0l3.193-3.193 1.87 1.86a1.585 1.585 0 0 0 2.25 0h.02c.668-.667.854-1.522.854-3.144 0-1.03.212-1.758.853-2.523 1.232.361 1.95.015 2.96-.995a.68.68 0 0 0 .188-.479c0-.234-.06-.594-.209-1.041a5.34 5.34 0 0 0-1.312-2.103A5.35 5.35 0 0 0 11.05 1.51c-.448-.149-.808-.208-1.042-.208"})})},Ei=e=>{let{size:t=16}=e;return jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"#fff",fillOpacity:".36",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M10.008 1.302a.74.74 0 0 0-.486.215c-1.033.988-1.349 1.815-.972 2.947-.88.675-1.437.841-2.536.841-1.503 0-2.484.181-3.152.848v.021a1.583 1.583 0 0 0 0 2.249l1.867 1.881-3.181 3.18c-.26.26-.28.696-.02.956.261.26.699.26.959 0l3.193-3.193 1.87 1.86a1.585 1.585 0 0 0 2.25 0h.02c.668-.667.854-1.522.854-3.144 0-1.03.212-1.758.853-2.523 1.232.361 1.95.015 2.96-.995a.68.68 0 0 0 .188-.479c0-.234-.06-.594-.209-1.041a5.34 5.34 0 0 0-1.312-2.103A5.35 5.35 0 0 0 11.05 1.51c-.448-.149-.808-.208-1.042-.208m.258 1.37c.708.131 1.421.6 1.93 1.108.507.507.94 1.13 1.119 1.944-.636.61-1.026.659-1.662.324a.67.67 0 0 0-.779.116c-1.214 1.213-1.533 2.314-1.533 3.8 0 1.293-.076 1.774-.48 2.207-.113.123-.27.104-.374 0L3.799 7.486a.24.24 0 0 1-.017-.34c.239-.29.769-.514 2.226-.514 1.742.001 2.668-.447 3.812-1.52a.67.67 0 0 0 .125-.77c-.343-.685-.29-1.046.321-1.67"})})};var yt=e=>{let{className:t,...o}=e;return jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",xmlns:"http://www.w3.org/2000/svg",fill:"white",fillOpacity:"0.36",className:t,...o,children:jsx("path",{d:"M11.9971 1.30206C11.8204 1.30206 11.6431 1.36473 11.5178 1.4894C11.1471 1.86007 9.81309 3.19408 9.51709 3.49075L3.51376 9.4941L2.84642 10.1608C2.75376 10.2541 2.70576 10.3861 2.67976 10.5154L2.01309 13.8508C1.91976 14.3174 2.3171 14.7147 2.78376 14.6221C3.2011 14.5381 5.70242 14.0381 6.11909 13.9548C6.24842 13.9288 6.38043 13.8808 6.47376 13.7881L7.14043 13.1208L13.1438 7.11742C13.4404 6.82142 14.7744 5.48673 15.1451 5.11673C15.2698 4.99139 15.3324 4.81406 15.3324 4.6374C15.3324 3.54606 15.0544 2.76606 14.4778 2.17739C13.8958 1.58339 13.1184 1.30206 11.9971 1.30206ZM12.2598 2.64805C12.8618 2.68339 13.2518 2.82142 13.5191 3.09475C13.7924 3.37342 13.9651 3.76008 14.0024 4.35008C13.6371 4.71475 13.1024 5.24139 12.6644 5.67939C12.1358 5.15072 11.4838 4.49875 10.9551 3.97008C11.3938 3.53208 11.8951 3.01272 12.2598 2.64805ZM9.99643 4.92874L11.7058 6.63809L6.66109 11.6827L4.95176 9.97343L9.99643 4.92874ZM3.99309 10.9321L5.70242 12.6414L5.63976 12.7041C5.19976 12.7921 4.3111 12.9781 3.49243 13.1421L3.93043 10.9947L3.99309 10.9321Z"})})};var Ct=e=>{let t=useMediaQuery("(max-width: 767px)");return jsxs(Flex,{r:"2xl",p:6,width:"100%",gap:4,direction:"column",className:"oui-bg-base-9 oui-tabular-nums oui-p-6 oui-h-full",children:[jsx($i,{...e}),jsxs("div",{className:"oui-w-full oui-flex oui-flex-col 2xl:oui-h-full",children:[jsx(Divider,{}),t?jsx(Gi,{...e}):jsx(Qi,{...e})]})]})},$i=e=>jsxs(Flex,{direction:"row",justify:"between",width:"100%",children:[jsx(Text,{className:"oui-text-lg",children:"Referral codes"}),jsxs("div",{className:"oui-text-2xs md:oui-text-xs xl:oui-text-sm",children:[jsx(Text,{className:"oui-text-base-contrast-54",children:"Remaining referral codes:\xA0"}),jsx(Text,{className:"oui-text-primary-light",children:e.codes?.length||"--"})]})]}),Gi=e=>jsx(ListView,{dataSource:e.codes,className:"oui-max-h-[240px] oui-w-full",renderItem:(t,o)=>jsxs(Flex,{direction:"column",children:[jsx(Zi,{data:t,editRate:e.editRate,copyLink:e.copyLink,copyCode:e.copyCode,setPinCode:e.setPinCode},o),jsx(Divider,{className:"oui-w-full oui-mt-3"})]})}),Te=e=>{let{title:t,copyable:o,value:r,align:i,className:a,editRate:n,onCopy:l}=e;return jsx(Statistic,{id:"oui-affiliate-affiliate-referralCodes",className:cn("oui-flex-1",a),label:jsx(Text,{className:"oui-text-base-contrast-36 oui-text-2xs",children:t}),align:i,children:jsxs(Flex,{direction:"row",gap:1,children:[jsx(Text.formatted,{copyable:o,onCopy:()=>{l?.();},className:"oui-text-base-contrast-80 oui-text-sm oui-mt-[6px]",children:r}),n&&jsx(yt,{className:" oui-fill-white/[.36] hover:oui-fill-white/80 oui-cursor-pointer oui-mt-[1px]",fillOpacity:1,fill:"currentColor",onClick:d=>n()})]})})},Zi=e=>{let{data:t,setPinCode:o,copyLink:r,copyCode:i,editRate:a}=e;return jsxs(Flex,{gap:3,direction:"column",className:"oui-w-full",children:[jsxs(Flex,{direction:"row",justify:"between",itemAlign:"stretch",width:"100%",children:[jsx(Te,{title:"Referral code",value:t.code,copyable:!0,onCopy:()=>{e.copyCode?.(t.code);}}),jsx(Te,{title:"You / Referee",value:Gr(t),align:"end",editRate:()=>{a(t);}}),jsx(Te,{title:"Referees / Traders",value:pe(t),align:"end",className:"oui-hidden md:oui-flex"})]}),jsxs(Flex,{direction:"row",justify:"between",itemAlign:"stretch",width:"100%",className:"md:oui-hidden",children:[jsx(Te,{title:"Referees",value:pe(t).split("/")?.[0],align:"start"}),jsx(Te,{title:"Traders",value:pe(t).split("/")?.[1],align:"end"})]}),jsxs(Flex,{direction:"row",justify:"between",itemAlign:"stretch",width:"100%",children:[jsx(bt,{pinned:t.isPined||!1,onClick:n=>{o(t.code,!n);}}),jsx(Button,{variant:"outlined",size:"xs",className:"oui-px-[20px]",onClick:n=>{r(t.code);},children:"Copy link"})]})]},t.code)},Qi=e=>{let t=useMediaQuery("(min-width: 1024px)"),o=useMemo(()=>{let r=[{title:"Referral Codes",dataIndex:"code",width:t?115:120,className:"!oui-px-0",render:(i,a)=>jsxs(Flex,{direction:"row",itemAlign:"center",gap:1,children:[jsx(bt,{size:14,pinned:a.isPined||!1,onClick:n=>{e.setPinCode(a.code,!n);}}),jsx(Text.formatted,{copyable:!0,onCopy:()=>{e.copyCode?.(a.code);},children:i})]})},{title:"You / Referee",dataIndex:"dffd",width:120,className:"oui-pr-0",render:(i,a)=>jsxs(Flex,{direction:"row",itemAlign:"center",gap:1,children:[Gr(a),jsx(yt,{className:" oui-fill-white/[.36] hover:oui-fill-white/80 oui-cursor-pointer oui-mt-[1px]",fillOpacity:1,fill:"currentColor",onClick:n=>e.editRate?.(a)})]})}];return t?(r.push({title:"Referees",dataIndex:"referee_rebate_rate",width:65,className:"oui-pr-0",render:(i,a)=>pe(a).split("/")[0]}),r.push({title:"Traders",dataIndex:"referrer_rebate_rate",width:65,className:"oui-pr-0",render:(i,a)=>pe(a).split("/")[1]})):r.push({title:"Referees / Traders ",dataIndex:"total_invites/total_traded",width:120,fixed:"left",render:(i,a)=>pe(a)}),r.push({title:"",dataIndex:"",align:"right",width:74,className:"!oui-px-0",render:(i,a)=>jsx(Button,{variant:"outlined",size:"sm",className:"oui-px-5",onClick:n=>{e?.copyLink?.(a.code);},children:"Copy link"})}),r},[t]);return jsx(DataTable,{bordered:!0,columns:o,dataSource:e.codes,scroll:{y:200},classNames:{header:"oui-text-xs oui-text-base-contrast-36 oui-bg-base-9 oui-px-0",body:"oui-text-xs oui-text-base-contrast-80",root:"2xl:oui-flex-1 2xl:oui-max-h-[230px] 3xl:oui-max-h-[300px]"}})},Gr=e=>{let t=new Decimal(e.referee_rebate_rate).mul(100).toFixed(1,Decimal.ROUND_DOWN).toString();return `${new Decimal(e.referrer_rebate_rate).mul(100).toFixed(1,Decimal.ROUND_DOWN).toString()}% / ${t}%`},pe=e=>`${e.total_invites} / ${e.total_traded}`;var Jr=modal.create(e=>{let{code:t,mutate:o}=e,{visible:r,hide:i,resolve:a,reject:n,onOpenChange:l}=useModal(),d=new Decimal(t.max_rebate_rate).mul(100),[p,s]=useState(`${new Decimal(t.referee_rebate_rate).mul(100)}`),[u,f]=useState(`${new Decimal(t.referrer_rebate_rate).mul(100)}`),[c,m]=useState(!1),x=useRef(null);useEffect(()=>{x?.current&&(x.current.focus(),x.current.setSelectionRange(x.current.value.length,x.current.value.length));},[x]),useEffect(()=>{s(`${new Decimal(t.referee_rebate_rate).mul(100)}`),f(`${new Decimal(t.referrer_rebate_rate).mul(100)}`);},[t]);let[D,{error:L,isMutating:B}]=useMutation("/v1/referral/edit_split","POST"),F=async()=>{try{let v=Number.parseFloat(p),M=Number.parseFloat(u);await D({referral_code:t.code,referee_rebate_rate:v/100,referrer_rebate_rate:M/100}),toast.success("Referral code edited"),o(),i();}catch(v){toast.error(v?.message||v||"");}};return jsx(Dialog,{open:r,onOpenChange:l,children:jsxs(DialogContent,{className:"oui-px-6 oui-max-w-[320px] oui-bg-base-8 oui-shadow-[0px_12px_20px_0px_rgba(0,0,0,0.25)]",closable:!0,children:[jsxs(DialogTitle,{children:[jsx("div",{className:"oui-my-3",children:"Settings"}),jsx(Divider,{})]}),jsxs("div",{className:"oui-mt-3 oui-h-full oui-flex oui-flex-col oui-justify-end",children:[jsx("div",{className:"oui-text-xs oui-text-base-contrast-54",children:"Set the ratio of referral rate shared with your referees"}),jsxs("div",{className:"oui-text-xs oui-text-base-contrast-80 oui-mt-2 oui-flex",children:["Your max commission rate: ",jsx("div",{className:"oui-text-warning oui-pl-1",children:`${new Decimal(t.max_rebate_rate).mul(100).toFixed(0,Decimal.ROUND_DOWN)}%`})]}),jsx("div",{className:"oui-text-2xs oui-mt-6 oui-text-base-contrast-80",children:"You receive"}),jsx(Input,{ref:x,containerClassName:"oui-h-[40px] oui-mt-3 oui-bg-base-700 oui-outline oui-outline-1 oui-outline-base-contrast-12 focus-within:oui-outline-primary",placeholder:"Enter code",type:"text",inputMode:"decimal",autoComplete:"off",value:u,onChange:v=>{let M=cleanStringStyle(v.target.value),T=Number.parseFloat(M);f(M),Number.isNaN(T)?(s(""),f("")):(s(`${Xr(new Decimal(0),d.sub(T))}`),m(d.sub(T)<new Decimal(0)));},suffix:jsx("div",{className:"oui-px-3 oui-text-base-contrast-54 oui-text-base",children:"%"}),color:c?"danger":void 0}),jsx("div",{className:"oui-text-2xs oui-mt-6 oui-text-base-contrast-80",children:"Referee receives"}),jsx(Input,{containerClassName:"oui-h-[40px] oui-mt-3 oui-bg-base-700 oui-outline oui-outline-1 oui-outline-base-contrast-12 focus-within:oui-outline-primary",placeholder:"Enter code",type:"text",inputMode:"decimal",autoComplete:"off",autoFocus:!1,value:p,onChange:v=>{let M=cleanStringStyle(v.target.value),T=Number.parseFloat(M);s(M),Number.isNaN(T)?(s(""),f("")):(f(`${Xr(new Decimal(0),d.sub(T))}`),m(d.sub(T)<new Decimal(0)));},suffix:jsx("div",{className:"oui-px-3 oui-text-base-contrast-54 oui-text-base",children:"%"}),color:c?"danger":void 0}),c&&jsx("div",{className:"oui-text-danger oui-text-xs oui-mt-8 oui-text-center oui-px-4",children:"The total commission rate must equal to your maximum commission rate limit"}),jsx(Flex,{width:"100%",justify:"center",children:jsx(Button,{id:"referral_bind_referral_code_btn",disabled:p.length===0||u.length===0||c,loading:B,className:cn("oui-mt-8 oui-mb-4 oui-w-[154px]",c&&"oui-mt-3"),onClick:v=>{v.stopPropagation(),F();},children:"Confirm"})})]})]})})});function Xr(e,t){return e>t?e:t}var vt=()=>{let{referralInfo:e,referralLinkUrl:t,mutate:o}=y(),r=s=>{ct(Me(t,"ref",s));},i=s=>{ct(s);},a=s=>{modal.show(Jr,{code:{...s},mutate:o});},[n,l]=useLocalStorage("orderly_referral_codes",[]),d=(s,u)=>{if(u){let f=n.findIndex(c=>c===s);f!==-1&&n.splice(f,1);}else n.splice(0,0,s);n.length>6&&n.splice(n.length-1,1),l([...n]);},p=useMemo(()=>{if(!e?.referrer_info.referral_codes)return;let s=[...e?.referrer_info.referral_codes],u=[];for(let f=0;f<n.length;f++){let c=n[f],m=s.findIndex(x=>x.code===c);m!==-1&&(u.push({...s[m],isPined:!0}),s.splice(m,1));}return [...u,...s]},[e?.referrer_info.referral_codes,n]);return {copyCode:i,copyLink:r,editRate:a,setPinCode:d,codes:p}};var Ve=()=>{let e=vt();return jsx(Ct,{...e})};var Rt=e=>jsx(Flex,{id:"oui-affiliate-affiliate-commissionAndReferees",r:"2xl",p:6,width:"100%",gap:4,direction:"column",className:"oui-bg-base-9 oui-tabular-nums",children:jsxs(Tabs,{defaultValue:"account",className:"oui-w-full",variant:"contained",children:[jsx(TabPanel,{value:"account",title:"Commission",children:jsx(xa,{...e})}),jsx(TabPanel,{value:"password",title:"My referees",children:jsx(pa,{...e})})]})}),K=e=>{let{title:t,value:o,align:r,className:i,rule:a,formatString:n,prefix:l}=e;return jsx(Statistic,{className:cn("oui-flex-1",i),label:jsx(Text,{className:"oui-text-base-contrast-36 oui-text-2xs",children:t}),align:r,children:jsx(Text.formatted,{rule:a||"",formatString:n,prefix:l,className:"oui-text-base-contrast-80 oui-text-sm oui-mt-[6px]",children:o})})},xa=e=>{let t=useMediaQuery("(max-width: 767px)"),o=useMemo(()=>[{title:"Commission (USDC)",dataIndex:"referral_rebate",render:a=>jsx(Text,{children:commifyOptional(a,{fix:6,fallback:"0",padEnd:!0,prefix:"$"})}),width:216},{title:"Referral vol. (USDC)",dataIndex:"volume",render:a=>jsx(Text,{children:commifyOptional(a,{fix:2,fallback:"0",padEnd:!0,prefix:"$"})}),width:216},{title:"Date",dataIndex:"date",render:a=>Mr(a),width:216}],[]),r=useMemo(()=>t?jsx(ListView,{className:"oui-w-full oui-max-h-[200px]",dataSource:e.commission.data,loadMore:e.commission.loadMore,isLoading:e.commission.isLoading,renderItem:(i,a)=>jsxs("div",{children:[jsxs(Flex,{direction:"row",width:"100%",children:[jsx(K,{title:"Commission",value:commifyOptional(i.referral_rebate,{fix:6,fallback:"0",padEnd:!0}),prefix:"$"}),jsx(K,{title:"Referral vol.",value:commifyOptional(i.volume,{fix:2,fallback:"0",padEnd:!0}),prefix:"$"}),jsx(K,{title:"Date",value:i.date,rule:"date",formatString:"yyyy-MM-dd",align:"end"})]}),jsx(Divider,{className:"oui-w-full oui-mt-3"})]})}):jsx(AuthGuardDataTable,{bordered:!0,columns:o,loading:e.commission.isLoading,ignoreLoadingCheck:!0,dataSource:e.commission.data,classNames:{header:"oui-text-xs oui-text-base-contrast-36 oui-bg-base-9",body:"oui-text-xs oui-text-base-contrast-80"},children:jsx(Pagination,{...e.commission.meta,onPageChange:e.commission.onPageChange,onPageSizeChange:e.commission.onPageSizeChange})}),[t,e.commission]);return jsxs(Flex,{direction:"column",width:"100%",justify:"start",itemAlign:"start",children:[jsx(ga,{value:e.commission.dateRange,setValue:e.commission.setDateRange}),r]})},pa=e=>{let t=useMediaQuery("(max-width: 767px)"),o=useMemo(()=>[{title:"Referee address ",dataIndex:"user_address",render:a=>jsx(Text.formatted,{rule:"address",children:a}),className:"oui-w-1/5"},{title:"Referral code ",dataIndex:"referral_code",className:"oui-w-1/5"},{title:"Total commission (USDC) ",dataIndex:"referral_rebate",render:a=>jsx(Text,{children:commifyOptional(a,{fix:6,prefix:"$",padEnd:!0})}),className:"oui-w-1/5"},{title:"Total vol. (USDC) ",dataIndex:"volume",render:a=>jsx(Text,{children:commifyOptional(a,{fix:2,prefix:"$",padEnd:!0})}),className:"oui-w-1/5"},{title:"Invication time",dataIndex:"code_binding_time",render:a=>jsx(Text.formatted,{rule:"date",formatString:"yyyy-MM-dd",children:a}),className:"oui-w-1/5"}],[]),r=useMemo(()=>t?jsx(ListView,{className:"oui-w-full oui-max-h-[200px]",dataSource:e.referees.data,loadMore:e.referees.loadMore,isLoading:e.referees.isLoading,renderItem:(i,a)=>jsxs(Flex,{direction:"column",gap:3,className:"oui-border-b-2 oui-border-line-6 oui-pb-3",children:[jsxs(Flex,{direction:"row",width:"100%",children:[jsx(K,{title:"Referral code ",value:i.referral_code}),jsx(K,{title:"Total commission",value:commifyOptional(i.referral_rebate,{fix:6,prefix:"$",padEnd:!0}),className:"oui-min-w-[102px]"}),jsx(K,{title:"Total vol.",value:commifyOptional(i.volume,{fix:2,prefix:"$",padEnd:!0}),align:"end"})]}),jsxs(Flex,{direction:"row",pt:3,gap:3,width:"100%",children:[jsx(K,{title:"Referee address ",value:i.user_address,rule:"address"}),jsx(K,{title:"Invitation Time ",value:i.code_binding_time,align:"end",rule:"date",formatString:"yyyy-MM-dd"})]})]},a)}):jsx(AuthGuardDataTable,{bordered:!0,loading:e.referees.isLoading,ignoreLoadingCheck:!0,columns:o,dataSource:e.referees.data,classNames:{header:"oui-text-xs oui-text-base-contrast-36 oui-bg-base-9",body:"oui-text-xs oui-text-base-contrast-80"},children:jsx(Pagination,{...e.referees.meta,onPageChange:e.referees.onPageChange,onPageSizeChange:e.referees.onPageSizeChange})}),[t,e.referees]);return jsx(Flex,{direction:"column",width:"100%",justify:"start",itemAlign:"start",children:r})},ga=e=>jsx(Flex,{width:"100%",height:49,className:"oui-border-b oui-border-line-6",children:jsx("div",{children:jsx(DatePicker.range,{size:"xs",value:e.value,onChange:t=>{e.setValue(t);},max:90,disabled:{after:new Date}})})});var Tt=()=>{let e=ya(),t=Ca();return {commission:e,referees:t}},ya=()=>{let[e,t]=useState({from:subDays(new Date,90),to:subDays(new Date,1)}),o=useMediaQuery("(max-width: 767px)"),{page:r,pageSize:i,setPage:a,setPageSize:n,parseMeta:l}=usePagination(),[d,{refresh:p,isLoading:s,loadMore:u,meta:f}]=useReferralRebateSummary({startDate:e?.from!==void 0?format(e.from,"yyyy-MM-dd"):void 0,endDate:e?.to!==void 0?format(e.to,"yyyy-MM-dd"):void 0,size:i,page:o?void 0:r});useEffect(()=>{p();},[e]);let c=x=>{a(x);},m=x=>{n(x);};return {data:d||void 0,meta:l(f),onPageChange:c,onPageSizeChange:m,dateRange:e,setDateRange:t,isLoading:s,loadMore:u}},Ca=()=>{let[e,t]=useState({from:subDays(new Date,90),to:subDays(new Date,1)}),o=useMediaQuery("(max-width: 767px)"),{page:r,pageSize:i,setPage:a,setPageSize:n,parseMeta:l}=usePagination(),[d,{refresh:p,isLoading:s,loadMore:u,meta:f}]=useRefereeInfo({startDate:e?.from!==void 0?format(e.from,"yyyy-MM-dd"):void 0,endDate:e?.to!==void 0?format(e.to,"yyyy-MM-dd"):void 0,size:i,page:o?void 0:r,sort:"descending_code_binding_time"});useEffect(()=>{p();},[e]);let c=x=>{a(x);},m=x=>{n(x);};return {data:d||void 0,meta:l(f),onPageChange:c,onPageSizeChange:m,dateRange:e,setDateRange:t,isLoading:s,loadMore:u}};var St=()=>{let e=Tt();return jsx(Rt,{...e})};var Se=()=>jsxs(Flex,{id:"oui-affiliate-affiliate-page",className:cn("oui-h-lvw","oui-font-semibold"),direction:"column",gap:4,children:[jsx(Ta,{}),jsx(St,{})]}),Ta=()=>useMediaQuery("(max-width: 1279px)")?jsx(Sa,{}):jsx(Na,{}),Sa=()=>jsxs(Fragment,{children:[jsxs("div",{className:"oui-flex oui-flex-col xl:oui-flex-row oui-gap-4 oui-w-full",children:[jsx(Ie,{}),jsx(Be,{})]}),jsx(Oe,{}),jsx(Ve,{})]}),Na=()=>jsxs(Flex,{direction:"row",itemAlign:"stretch",gap:4,children:[jsxs(Flex,{direction:"column",gap:4,className:"oui-flex-1 oui-w-1/2",children:[jsx("div",{className:"oui-flex-1 oui-h-full oui-w-full",children:jsx(Ie,{})}),jsx(Oe,{})]}),jsxs(Flex,{direction:"column",gap:4,className:"oui-w-1/2",children:[jsx(Be,{}),jsx("div",{className:"oui-flex-1",children:jsx(Ve,{})})]})]});var Nt=e=>jsxs(Flex,{id:"oui-affiliate-trader-summary",r:"2xl",p:6,width:"100%",height:"100%",gap:4,direction:"column",className:"oui-bg-base-9 xl:oui-flex-1",children:[jsx(_a,{...e}),jsx(so,{className:"md:oui-hidden",...e}),jsxs(Flex,{direction:"column",gap:3,width:"100%",className:"md:oui-mt-3",children:[jsx(Pa,{...e}),jsx(Ia,{...e})]}),jsx(La,{title:"Trading vol. (USDC)",...e})]}),_a=e=>jsxs(Flex,{direction:"row",width:"100%",gap:3,children:[jsxs(Flex,{direction:"row",gap:3,className:"oui-flex-1",children:[jsx(Text,{className:"oui-text-lg",children:"Your referrer"}),jsx(Button,{color:"secondary",size:"sm",className:"oui-text-primary-light oui-text-2xs md:oui-text-xs 2xl:oui-text-sm oui-bg-base-6",children:e.code})]}),jsx(so,{className:"oui-hidden md:oui-flex md:oui-flex-shrink md:oui-w-fit",...e})]}),so=e=>jsxs(Flex,{direction:"row",width:"100%",gap:2,className:e.className,children:[jsx(Text,{intensity:54,className:"oui-text-sm md:oui-text-base 2xl:oui-text-lg",children:"Rebate:"}),jsx(Text.gradient,{color:"brand",className:"oui-text-lg md:oui-text-xl 2xl:oui-text-2xl",children:e.rebateText})]}),Pa=e=>jsxs(Flex,{direction:"row",width:"100%",justify:"between",gap:3,children:[jsx(Text,{className:"oui-text-sm",children:"Summary"}),jsx("div",{children:jsx(Select.options,{size:"xs",value:e.period,onValueChange:e.onPeriodChange,options:e.periodTypes})})]}),Ia=e=>jsxs(Flex,{gradient:"success",angle:180,r:"xl",py:4,px:6,width:"100%",direction:"column",gap:3,children:[jsx(Text,{intensity:54,className:"oui-text-base 2xl:oui-text-lg",children:"Rebates (USDC)"}),jsxs(Flex,{direction:"row",gap:3,className:"oui-text-xl md:oui-text-2xl xl:oui-text-3xl",children:[jsx(q,{className:"md:oui-w-[24px] md:oui-h-[24px] lg:oui-w-[28px] lg:oui-h-[28px] "}),jsx(Text,{children:commifyOptional(e.rebates,{fix:2,fallback:"0"})})]})]}),La=e=>jsxs(Flex,{direction:"row",justify:"between",width:"100%",children:[jsx(Text,{intensity:54,className:"oui-text-2xs md:oui-text-xs xl:oui-text-sm",children:e.title}),jsx(Text,{className:"oui-text-xs md:oui-text-sm xl:oui-text-base",children:commifyOptional(e.vol,{fix:2,fallback:"0"})})]});var Dt=()=>{let[e,t]=useState("All"),o=[{label:"All",value:"All"},{label:"1D",value:"1D"},{label:"7D",value:"7D"},{label:"30D",value:"30D"}],{referralInfo:r,userVolume:i}=y(),a=useMemo(()=>{if(!r)return 0;switch(e){case"All":return r.referee_info.total_referee_rebate;case"1D":return r.referee_info["1d_referee_rebate"];case"7D":return r.referee_info["7d_referee_rebate"];case"30D":return r.referee_info["30d_referee_rebate"]}},[r,e]),n=useMemo(()=>{if(i)switch(e){case"All":return i.all_volume;case"1D":return i["1d_volume"];case"7D":return i["7d_volume"];case"30D":return i["30d_volume"]}},[i,e]),l=r?.referee_info.referer_code,d=r?.referee_info.referee_rebate_rate,p=useMemo(()=>d!==void 0?new Decimal(d).mul(100).toDecimalPlaces(2,Decimal.ROUND_DOWN).toString()+"%":"-",[d]);return {period:e,periodTypes:o,onPeriodChange:u=>{t(u);},rebates:a,vol:n,rebateText:p,code:l}};var Ft=()=>{let e=Dt();return jsx(Nt,{...e})};var Pt=e=>jsxs(Flex,{id:"oui-affiliate-trader-titleStatistic",r:"2xl",p:6,width:"100%",gap:4,direction:"column",className:"oui-bg-base-9 xl:oui-flex-1",children:[jsx(Oa,{...e}),jsx(Flex,{className:"oui-min-h-[170px] oui-h-full oui-w-full oui-flex oui-flex-row oui-items-stretch",children:jsx(VolBarChart,{data:e.dataSource,colors:{fill:"rgba(0, 180, 158, 1)"},className:"oui-w-full oui-flex-1",tooltip:{rm:Decimal.ROUND_DOWN,dp:e.volType==="volume"?2:6}})})]}),Oa=e=>jsxs(Flex,{direction:"row",justify:"between",width:"100%",children:[jsx(Text,{className:"oui-text-lg",children:"Statistics"}),jsxs(Flex,{direction:"row",gap:2,className:"oui-min-w-14",children:[jsx(Select.options,{size:"xs",value:e.period,onValueChange:e.onPeriodChange,options:e.periodTypes}),jsx(Select.options,{size:"xs",value:e.volType,onValueChange:e.onVolTypeChange,options:e.volTypes})]})]});var It=()=>{let[e,t]=useState("7"),o=[{label:"7D",value:"7"},{label:"30D",value:"30"},{label:"90D",value:"90"}],r=m=>{t(m);},[i,a]=useState("rebate"),n=[{label:"Rebate",value:"rebate"},{label:"Volume",value:"volume"}],l=m=>{a(m);},d=useMemo(()=>e==="7"?{startDate:subDays(new Date,7),endDate:subDays(new Date,1)}:e==="30"?{startDate:subDays(new Date,30),endDate:subDays(new Date,1)}:e==="90"?{startDate:subDays(new Date,90),endDate:subDays(new Date,1)}:{startDate:subDays(new Date,7),endDate:subDays(new Date,1)},[e]),{data:p,mutate:s}=useRefereeRebateSummary(d),{dailyVolume:u,chartConfig:f}=y(),c=useMemo(()=>i==="rebate"?(p||[]).map(x=>({date:x.date,volume:x.referee_rebate})).reverse():i==="volume"?u?.filter(m=>m.date>format(subDays(Date(),Number(e)+1),"yyyy-MM-dd")).map(m=>({date:m.date,volume:m.perp_volume}))||[]:[],[p,u,i]);return {period:e,periodTypes:o,onPeriodChange:r,volType:i,volTypes:n,onVolTypeChange:l,dataSource:Ee(Number(e),c)}};var Lt=()=>{let e=It();return jsx(Pt,{...e})};var kt=e=>jsxs(Flex,{id:"oui-affiliate-trader-rebates",r:"2xl",p:6,width:"100%",gap:4,direction:"column",className:"oui-bg-base-9 oui-tabular-nums",children:[jsx(qa,{...e}),jsx(Flex,{width:"100%",className:"oui-border-y-2 oui-border-line-6",height:49,direction:"row",itemAlign:"center",children:jsx("div",{children:jsx(DatePicker.range,{size:"xs",value:e.dateRange,onChange:t=>{e.setDateRange(t);},max:90,disabled:{after:new Date}})})}),jsx(Xa,{...e})]}),qa=e=>jsxs(Flex,{direction:"row",justify:"between",width:"100%",children:[jsx(Text,{className:"oui-text-lg",children:"My rebates"}),jsx(Text,{intensity:36,className:"oui-text-2xs",children:e.displayDate})]}),Xa=e=>{let t=useMediaQuery("(max-width: 767px)"),o=[{title:"Rebates (USDC)",dataIndex:"referee_rebate",render:r=>jsx(Text,{children:commifyOptional(r,{fix:6,fallback:"0",padEnd:!0,prefix:"$"})}),width:127},{title:"Trading vol. (USDC)",dataIndex:"vol",render:r=>commifyOptional(r,{fix:2,fallback:"0",padEnd:!0,prefix:"$"}),width:127},{title:"Date",dataIndex:"date",render:r=>jsx(Text.formatted,{formatString:"yyyy-MM-dd",children:r}),width:127}];return t?jsx(ListView,{dataSource:e.dataSource,className:"oui-h-[197px] oui-w-full",renderItem:(r,i)=>jsx(Ja,{item:r})}):jsx(AuthGuardDataTable,{bordered:!0,loading:e.isLoading,columns:o,dataSource:e.dataSource,ignoreLoadingCheck:!0,classNames:{header:"oui-text-xs oui-text-base-contrast-36 oui-bg-base-9",body:"oui-text-xs oui-text-base-contrast-80"},children:jsx(Pagination,{...e.meta,onPageChange:e.onPageChange,onPageSizeChange:e.onPageSizeChange})})},Ja=e=>jsxs(Flex,{direction:"column",width:"100%",children:[jsxs(Flex,{width:"100%",gap:1,children:[jsx(Statistic,{label:"Rebates (USDC)",className:"oui-text-xs oui-text-base-contrast-54 oui-flex-1 oui-min-w-[105px]",children:jsx(Text,{size:"sm",intensity:80,children:commifyOptional(e.item.referee_rebate,{fix:6,fallback:"0",padEnd:!0,prefix:"$"})})}),jsx(Statistic,{label:"Trading vol. (USDC) ",className:"oui-text-xs oui-text-base-contrast-54 oui-flex-shrink",children:jsx(Text,{size:"sm",intensity:80,children:commifyOptional(e.item.vol,{fix:2,fallback:"0",padEnd:!0,prefix:"$"})})}),jsx(Statistic,{label:"Date",className:"oui-text-xs oui-text-base-contrast-54 oui-flex-1",align:"end",children:jsx(Text.formatted,{size:"sm",intensity:80,formatString:"yyyy-MM-dd",children:e.item.date})})]}),jsx(Divider,{className:"oui-w-full oui-mt-3"})]});var zt=()=>{let[e,t]=useState({from:subDays(new Date,90),to:subDays(new Date,1)}),{data:o,mutate:r,isLoading:i}=useRefereeRebateSummary({startDate:e?.from,endDate:e?.to}),{data:a,mutate:n}=useDaily({startDate:e?.to,endDate:e?.from}),l=useMemo(()=>typeof o>"u"?[]:o.map(F=>{let v=F.date,M=a?.filter(T=>kr(toDate(v),toDate(T.date)))?.[0];return M?{...F,vol:M.perp_volume}:F}),[o,a]),d;(l?.length||0)>0&&(d=Lr(l?.[0].date));let{page:p,pageSize:s,setPage:u,setPageSize:f,parseMeta:c}=usePagination(),m=useMemo(()=>l.length,[l]),x=F=>{u(F);},D=F=>{f(F);},L=useMemo(()=>{let F=(p-1)*s,v=F+s;return l.slice(F,v)},[l,p,s]),B=c({total:m,current_page:p,records_per_page:s});return {dateRange:e,setDateRange:t,displayDate:d,dataSource:L,meta:B,onPageChange:x,onPageSizeChange:D,isLoading:i}};var Et=()=>{let e=zt();return jsx(kt,{...e})};var Ae=()=>jsxs(Flex,{id:"oui-affiliate-trader-page",className:cn("oui-h-lvw oui-w-full","oui-font-semibold"),direction:"column",gap:4,children:[jsxs(Flex,{width:"100%",gap:4,className:"oui-flex oui-flex-col xl:oui-flex-row xl:oui-items-stretch",children:[jsx(Ft,{}),jsx(Lt,{})]}),jsx(Et,{})]});var Vt=e=>typeof e.overwrite=="function"?e.overwrite?.(e.state):jsxs(Flex,{id:"oui-affiliate-home-becomeAffiliate",direction:"column",gap:6,p:6,itemAlign:"center",r:"2xl",className:"oui-bg-base-9",width:"100%",children:[jsx(Text,{children:"Becoming an affiliate is easy"}),jsxs(Flex,{className:"oui-flex oui-flex-col lg:oui-flex-row oui-gap-3 lg:oui-items-stretch lg:oui-w-full",children:[jsx(Wt,{icon:jsx(an,{}),title:"Apply",content:"Fill out the application form"}),jsx("div",{className:"oui-flex-shrink lg:-oui-rotate-90 lg:oui-flex lg:oui-flex-row lg:oui-items-center lg:oui-justify-center",children:jsx(yo,{})}),jsx(Wt,{icon:jsx(nn,{}),title:"Share",content:"Unlock your affiliate link and share it with your community"}),jsx("div",{className:"oui-flex-shrink lg:-oui-rotate-90 lg:oui-flex lg:oui-flex-row lg:oui-items-center lg:oui-justify-center",children:jsx(yo,{})}),jsx(Wt,{icon:jsx(ln,{}),title:"Earn",content:"Get paid and receive special treatment 24/7, 365"})]})]}),Wt=e=>jsxs(Flex,{className:cn("oui-flex oui-flex-row oui-gap-3","lg:oui-flex-col lg:oui-gap-[6px] lg:oui-flex-1"),width:"100%",children:[jsx("div",{className:"oui-flex-shrink-0",children:e.icon}),jsxs(Flex,{className:cn("oui-flex oui-flex-col oui-items-start oui-h-full oui-justify-between","lg:oui-items-center lg:oui-justify-start"),children:[jsx(Text,{className:"oui-text-sm md:oui-text-base 2xl:oui-text-lg lg:oui-text-center",children:e.title}),jsx(Text,{className:"oui-text-2xs md:oui-text-xs 2xl:oui-text-sm oui-text-base-contrast-36 lg:oui-text-center",children:e.content})]})]}),an=()=>jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"lg:oui-w-[64px] lg:oui-h-[64px] 2xl:oui-w-[80px] 2xl:oui-h-[80px]",children:[jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M24.941 5.4h-6.682a.6.6 0 0 0-.593.509l-.462 3a.6.6 0 0 0 .593.691h7.606a.6.6 0 0 0 .593-.691l-.462-3a.6.6 0 0 0-.593-.509m-6.682-1.8a2.4 2.4 0 0 0-2.372 2.035l-.462 3a2.4 2.4 0 0 0 2.372 2.765h7.606a2.4 2.4 0 0 0 2.372-2.765l-.462-3A2.4 2.4 0 0 0 24.941 3.6z",fill:"#fff",fillOpacity:".36"}),jsx("path",{d:"M32.721 28.2c.924-1.6 3.233-1.6 4.157 0l7.275 12.6c.924 1.6-.231 3.6-2.079 3.6H27.525c-1.848 0-3.002-2-2.078-3.6z",fill:"#335FFC"}),jsx("path",{d:"M33.492 38.12H31.56c-.252 0-.426-.276-.336-.535l1.92-5.53a.4.4 0 0 1 .132-.185.34.34 0 0 1 .204-.07h3.24c.255 0 .43.284.333.544l-1.118 3.011h2.104c.31 0 .475.4.27.656l-5.158 6.453c-.251.313-.716.041-.619-.362z",fill:"#fff",fillOpacity:".98"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.4 16.8v2.4h2.4v-2.4zM13.2 15a.6.6 0 0 0-.6.6v4.8a.6.6 0 0 0 .6.6H18a.6.6 0 0 0 .6-.6v-4.8a.6.6 0 0 0-.6-.6z",fill:"#fff",fillOpacity:".36"}),jsx("path",{d:"M20.4 16.2a.6.6 0 0 1 .6-.6h2.4a.6.6 0 0 1 .6.6v.6a.6.6 0 0 1-.6.6H21a.6.6 0 0 1-.6-.6zm0 3a.6.6 0 0 1 .6-.6h9a.6.6 0 0 1 .6.6v.6a.6.6 0 0 1-.6.6h-9a.6.6 0 0 1-.6-.6zm-7.8 5.4a.6.6 0 0 1 .6-.6H30a.6.6 0 0 1 .6.6v.6a.6.6 0 0 1-.6.6H13.2a.6.6 0 0 1-.6-.6zm0 3.6a.6.6 0 0 1 .6-.6H30a.6.6 0 0 1 .6.6v.6a.6.6 0 0 1-.6.6H13.2a.6.6 0 0 1-.6-.6zm0 3.6a.6.6 0 0 1 .6-.6h9a.6.6 0 0 1 .6.6v.6a.6.6 0 0 1-.6.6h-9a.6.6 0 0 1-.6-.6z",fill:"#fff",fillOpacity:".36"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.739 6.6H10.2A2.4 2.4 0 0 0 7.8 9v30a2.4 2.4 0 0 0 2.4 2.4h13.84l1.014-1.8H10.2a.6.6 0 0 1-.6-.6V9a.6.6 0 0 1 .6-.6h5.262zm12 1.8H33a.6.6 0 0 1 .6.6v16.47a2.8 2.8 0 0 1 1.8-.205V9A2.4 2.4 0 0 0 33 6.6h-5.538z",fill:"#fff",fillOpacity:".36"})]}),nn=()=>jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"lg:oui-w-[64px] lg:oui-h-[64px] 2xl:oui-w-[80px] 2xl:oui-h-[80px]",children:[jsx("path",{d:"M24 33a9 9 0 1 1-18 0 9 9 0 0 1 18 0",fill:"#335FFC"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 32.4a1.8 1.8 0 1 0 0-3.6 1.8 1.8 0 0 0 0 3.6m0 1.8a3.6 3.6 0 1 0 0-7.2 3.6 3.6 0 0 0 0 7.2m-6.578 4.942A4.8 4.8 0 0 1 13.2 34.8h3.6a4.8 4.8 0 0 1 4.778 4.342 9 9 0 0 1-1.778 1.473V39.6a3 3 0 0 0-3-3h-3.6a3 3 0 0 0-3 3v1.015a9 9 0 0 1-1.778-1.473",fill:"#fff",fillOpacity:".98"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.2 12a4.2 4.2 0 1 1-8.4 0 4.2 4.2 0 0 1 8.4 0m1.8 0c0 1.37-.459 2.632-1.231 3.642l2.308 2.308a7.76 7.76 0 0 1 4.023-1.7v-.764A3.602 3.602 0 0 1 24 8.4a3.6 3.6 0 0 1 .9 7.087v.764c1.48.17 2.833.754 3.942 1.633l2.326-2.326a6 6 0 1 1 1.273 1.273l-2.326 2.326a7.76 7.76 0 0 1 1.634 3.943h.764a3.602 3.602 0 0 1 7.087.9 3.6 3.6 0 0 1-7.087.9h-.764a7.76 7.76 0 0 1-1.699 4.023l2.308 2.308a6 6 0 1 1-1.25 1.295l-2.347-2.347a7.8 7.8 0 0 1-3.05 1.433 11 11 0 0 0-.377-1.76 6 6 0 1 0-7.185-7.185q-.855-.261-1.76-.379a7.8 7.8 0 0 1 1.432-3.049l-2.347-2.347A6 6 0 1 1 18 12m7.8 0a1.8 1.8 0 1 1-3.6 0 1.8 1.8 0 0 1 3.6 0M36 25.8a1.8 1.8 0 1 0 0-3.6 1.8 1.8 0 0 0 0 3.6m0-9.6a4.2 4.2 0 1 0 0-8.4 4.2 4.2 0 0 0 0 8.4M40.2 36a4.2 4.2 0 1 1-8.4 0 4.2 4.2 0 0 1 8.4 0",fill:"#fff",fillOpacity:".36"})]}),ln=()=>jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"lg:oui-w-[64px] lg:oui-h-[64px] 2xl:oui-w-[80px] 2xl:oui-h-[80px]",children:[jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M24 24a2.4 2.4 0 1 0 0-4.8 2.4 2.4 0 0 0 0 4.8m0 1.8a4.2 4.2 0 1 0 0-8.4 4.2 4.2 0 0 0 0 8.4",fill:"#fff",fillOpacity:".36"}),jsx("path",{d:"M45 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0",fill:"#335FFC"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M35.1 6.6a.9.9 0 1 1 1.8 0v.437A3 3 0 0 1 39 9.9h-1.8a1.2 1.2 0 1 0-1.2 1.2 3 3 0 0 1 .9 5.863v.437a.9.9 0 0 1-1.8 0v-.437A3 3 0 0 1 33 14.1h1.8a1.2 1.2 0 1 0 1.2-1.2 3 3 0 0 1-.9-5.863z",fill:"#fff",fillOpacity:".98"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M40.2 23.7a.9.9 0 0 1 1.8 0v.6q0 .045-.004.086c-.197 9.351-7.525 16.948-16.765 17.573l1.205 1.205a.9.9 0 1 1-1.272 1.272l-2.7-2.7a.9.9 0 0 1 0-1.272l2.7-2.7a.9.9 0 1 1 1.272 1.272l-1.11 1.11c8.325-.674 14.87-7.642 14.874-16.14zM21.564 4.836a.9.9 0 1 1 1.272-1.272l2.7 2.7a.9.9 0 0 1 0 1.272l-2.7 2.7a.9.9 0 1 1-1.272-1.272l1.11-1.11C14.347 8.528 7.8 15.5 7.8 24v.3a.9.9 0 1 1-1.8 0v-.6l.004-.086C6.201 14.263 13.53 6.666 22.77 6.042z",fill:"#fff",fillOpacity:".36"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M24 11.4q.615 0 1.213.058a11 11 0 0 0 .061 1.816Q24.647 13.2 24 13.2c-5.965 0-10.8 4.835-10.8 10.8 0 2.898 1.142 5.53 3 7.47a4.8 4.8 0 0 1 4.8-4.79h6a4.8 4.8 0 0 1 4.8 4.789c1.858-1.94 3-4.572 3-7.47q0-.647-.074-1.274a11 11 0 0 0 1.816.06q.057.6.058 1.214c0 6.959-5.641 12.6-12.6 12.6S11.4 30.959 11.4 24 17.041 11.4 24 11.4m6 21.581v-1.5a3 3 0 0 0-3-3h-6a3 3 0 0 0-3 3v1.5a10.75 10.75 0 0 0 6 1.819c2.22 0 4.284-.67 6-1.819",fill:"#fff",fillOpacity:".36"})]}),yo=()=>jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8.5048 4.00806C8.8728 4.00806 9.1708 4.30626 9.1708 4.67406C9.1708 4.99259 9.1708 8.71739 9.1708 9.71072L11.1688 7.73339L12.1055 8.67005L8.98346 11.8127C8.85346 11.9434 8.6788 12.0081 8.50413 12.0081C8.33013 12.0081 8.15612 11.9427 8.02612 11.8127L4.90413 8.67005L5.8408 7.73339L7.83881 9.71072C7.83881 8.71739 7.83881 4.99259 7.83881 4.67406C7.83881 4.30626 8.1368 4.00806 8.5048 4.00806Z",fill:"#608CFF"})});var Ht=()=>{let e=y();return {overwrite:e.overwrite?.ref?.step,state:e}};var $t=()=>{let e=Ht();return jsx(Vt,{...e})};var Zt=e=>jsxs("div",{id:"oui-affiliate-home-title",className:"oui-text-3xl md:oui-text-3xl lg:oui-text-4xl xl:oui-text-5xl oui-font-bold oui-text-center",children:[jsx("span",{dangerouslySetInnerHTML:{__html:"Earn more as a "}}),jsx("span",{dangerouslySetInnerHTML:{__html:` ${e.gradientTitle}`},className:"oui-gradient-brand oui-text-transparent oui-bg-clip-text",style:{"--oui-gradient-angle":"270deg"}}),jsx("span",{dangerouslySetInnerHTML:{__html:" affiliate"}})]});var Qt=()=>{let{overwrite:e}=y();return {gradientTitle:e?.shortBrokerName||"Orderly"}};var Yt=()=>{let e=Qt();return jsx(Zt,{...e})};var qt=e=>jsxs(Flex,{id:"oui-affiliate-home-subtitle",direction:"column",className:"oui-text-sm md:oui-text-base xl:oui-text-lg oui-text-base-contrast-80 oui-text-center",gap:3,children:[jsx(Text,{children:"Grow your brand | Get 40% commission | Unlock exclusive perks"}),jsxs(Flex,{direction:"row",gap:1,className:"oui-text-primary-light oui-fill-primary-light hover:oui-text-primary oui-cursor-pointer oui-text-2xs md:oui-text-xs xl:oui-text-sm",onClick:t=>{e.onLearnAffiliate?e.onLearnAffiliate?.():e.learnAffiliateUrl&&window.open(e.learnAffiliateUrl,"_blank");},children:[jsx(Text,{children:"Learn how it works"}),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 Xt=()=>{let e=y(),{onLearnAffiliate:t,learnAffiliateUrl:o}=e;return {onLearnAffiliate:t,learnAffiliateUrl:o}};var Jt=()=>{let e=Xt();return jsx(qt,{...e})};var Kt=e=>e.overwriteTop!==void 0?e.overwriteTop?.(e.state):jsxs(Flex,{id:"oui-affiliate-home-top",direction:"column",gap:6,children:[jsx(Yt,{}),jsx(Jt,{})]});var jt=()=>{let e=y();return {overwriteTop:e.overwrite?.ref?.top,state:e}};var er=()=>{let e=jt();return jsx(Kt,{...e})};var Ke=e=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"white",fillOpacity:"0.98",xmlns:"http://www.w3.org/2000/svg",className:e.className,children:jsx("path",{d:"M4.00806 7.9952C4.00806 7.6272 4.30626 7.3292 4.67406 7.3292C4.99259 7.3292 8.71739 7.3292 9.71072 7.3292L7.73339 5.3312L8.67005 4.39453L11.8127 7.51654C11.9434 7.64654 12.0081 7.8212 12.0081 7.99587C12.0081 8.16987 11.9427 8.34388 11.8127 8.47388L8.67005 11.5959L7.73339 10.6592L9.71072 8.66119C8.71739 8.66119 4.99259 8.66119 4.67406 8.66119C4.30626 8.66119 4.00806 8.3632 4.00806 7.9952Z"})});var tr=e=>jsxs(Flex,{id:"oui-affiliate-home-asAnAffiliate",gradient:"primary",r:"2xl",p:6,gap:6,direction:"column",angle:180,width:"100%",justify:"between",children:[jsxs(Flex,{height:80,direction:"row",gap:3,itemAlign:"start",width:"100%",justify:"between",children:[jsxs(Flex,{direction:"column",itemAlign:"start",justify:"between",className:"oui-h-full",children:[jsx(Text,{className:"oui-text-lg md:oui-text-xl lg:oui-text-2xl xl:oui-text-3xl",children:e.isAffiliate?"Affiliate":"As an affiliate"}),jsx(Text,{className:cn("oui-text-xs md:oui-text-sm 2xl:oui-text-base oui-text-base-contrast-54",e.isAffiliate&&"oui-hidden"),children:"Onboard traders to earn passive income"})]}),jsx("div",{className:"oui-flex-shrink-0",children:jsx(yn,{})})]}),jsx(Cn,{...e})]}),yn=()=>jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"xl:oui-w-[90px] xl:oui-h-[90px] ",children:[jsx("path",{d:"M35.997 5.86c-16.569 0-29.944 13.43-30 30-.056 16.545 13.445 30.06 30 30.093s30.03-13.665 30-30.093c-.03-16.57-13.432-30-30-30m0 6c13.255 0 24 10.746 24 24 0 6.75-2.812 12.834-7.297 17.196-2.209-4.78-6.955-8.196-12.39-8.196h-8.626c-5.432 0-10.164 3.375-12.375 8.157-4.485-4.362-7.312-10.407-7.312-17.157 0-13.254 10.745-24 24-24m0 6c-6.628 0-12 5.373-12 12s5.372 12 12 12c6.627 0 12-5.373 12-12s-5.373-12-12-12",fill:"#fff",fillOpacity:".2"}),jsx("path",{d:"M72 57c0 8.284-6.716 15-15 15s-15-6.716-15-15 6.716-15 15-15 15 6.716 15 15",fill:"#1828C3"}),jsx("path",{d:"M53.624 51.45a4.125 4.125 0 0 0-4.125 4.125c0 2.388 1.36 4.641 3.61 6.703a21 21 0 0 0 2.414 1.875c.287.194.556.37.797.516.147.089.243.154.304.187a.79.79 0 0 0 .75 0c.061-.033.158-.098.305-.187.24-.147.51-.322.797-.516a21 21 0 0 0 2.414-1.875c2.25-2.062 3.61-4.315 3.61-6.703a4.125 4.125 0 0 0-4.126-4.125c-1.294 0-2.557.705-3.351 1.734-.775-1.047-2.034-1.734-3.399-1.734",fill:"#fff",fillOpacity:".98"})]}),Cn=e=>jsx(Flex,{direction:"row",justify:"between",width:"100%",itemAlign:"end",children:(()=>{if(e.isAffiliate&&!e.wrongNetwork){let o=e.referralInfo?.referrer_info?.total_referrer_rebate;return jsxs(Fragment,{children:[jsxs(Flex,{direction:"column",itemAlign:"start",gap:2,children:[jsxs(Text,{className:"oui-text-2xs md:oui-text-xs xl:oui-text-sm",children:["Commission ",jsx(Text,{intensity:36,children:"(USDC)"})]}),jsxs(Flex,{direction:"row",gap:1,children:[jsx(q,{}),jsx(Text,{className:"oui-text-base md:oui-text-lg lg:oui-text-xl xl:oui-text-2xl",children:commifyOptional(o,{fix:2,fallback:"0"})})]})]}),jsxs(Flex,{direction:"row",gap:1,justify:"end",itemAlign:"center",className:"oui-cursor-pointer",onClick:r=>{e.onEnterAffiliatePage?.(e.referralInfo);},children:[jsx(Text,{className:"oui-text-sm md:oui-text-base xl:oui-text-lg",children:"Enter"}),jsx(Ke,{className:"md:oui-w-[18px] md:oui-h-[18px] lg:oui-w-[20px] lg:oui-h-[20px] xl:oui-w-[24px] xl:oui-h-[24px]"})]})]})}return jsxs(Fragment,{children:[jsx(Tooltip,{content:e.wrongNetwork?"Please switch to a supported network to continue.":"Please connect your wallet to use this function",children:jsx(Button,{variant:"contained",color:"light",onClick:e.becomeAnAffiliate,disabled:!e.isSignIn||e.wrongNetwork,children:"Become an affiliate"})}),jsxs(Flex,{direction:"column",justify:"between",className:"oui-h-full",itemAlign:"end",children:[jsx(Text,{className:"oui-text-base md:oui-text-lg lg:oui-text-xl 2xl:oui-text-2xl",children:"40%~60%"}),jsx(Text,{className:"oui-text-2xs md:oui-text-xs 2xl:oui-text-sm oui-text-base-contrast-54",children:"Commission"})]})]})})()});var rr=()=>{let{isAffiliate:e,isLoading:t,referralInfo:o,becomeAnAffiliateUrl:r,setShowHome:i,setTab:a,wrongNetwork:n}=y(),{state:l}=useAccount();return {isSignIn:l.status===AccountStatusEnum.EnableTrading,isAffiliate:e,isLoading:t,referralInfo:o,onEnterAffiliatePage:()=>{a("affiliate"),i(!1);},becomeAnAffiliate:()=>{window.open(r,"_blank");},wrongNetwork:n}};var or=()=>{let e=rr();return jsx(tr,{...e})};var ir=e=>jsxs(Flex,{id:"oui-affiliate-home-asTrader",gradient:"success",r:"2xl",p:6,gap:6,direction:"column",angle:180,width:"100%",justify:"between",children:[jsxs(Flex,{height:80,direction:"row",gap:3,itemAlign:"start",width:"100%",justify:"between",children:[jsxs(Flex,{direction:"column",itemAlign:"start",justify:"between",className:"oui-h-full",children:[jsx(Text,{className:"oui-text-lg md:oui-text-xl lg:oui-text-2xl xl:oui-text-3xl",children:e.isTrader?"Trader":"As a Trader"}),jsx(Text,{className:cn("oui-text-xs md:oui-text-sm 2xl:oui-text-base oui-text-base-contrast-54",e.isTrader&&"oui-hidden"),children:"Onboard traders to earn passive income"})]}),jsx("div",{className:"oui-flex-shrink-0",children:jsx(Bn,{})})]}),jsx(zn,{...e})]}),Bn=()=>jsxs("svg",{width:"72",height:"72",viewBox:"0 0 90 90",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"xl:oui-w-[90px] xl:oui-h-[90px] ",children:[jsx("path",{d:"M44.996 7.324c-20.71 0-37.43 16.79-37.5 37.5-.07 20.682 16.806 37.575 37.5 37.617 20.694.04 37.537-17.082 37.5-37.617-.037-20.71-16.79-37.5-37.5-37.5m0 7.5c16.569 0 30 13.433 30 30 0 8.438-3.514 16.043-9.12 21.495-2.762-5.973-8.694-10.245-15.49-10.245h-10.78c-6.791 0-12.706 4.22-15.47 10.197-5.606-5.453-9.14-13.01-9.14-21.447 0-16.567 13.431-30 30-30m0 7.5c-8.284 0-15 6.717-15 15s6.716 15 15 15 15-6.716 15-15-6.716-15-15-15",fill:"#fff",fillOpacity:".2"}),jsx("path",{d:"M90 71.25C90 81.605 81.605 90 71.25 90S52.5 81.605 52.5 71.25 60.895 52.5 71.25 52.5 90 60.895 90 71.25",fill:"#005A4F"}),jsx("path",{d:"M80.62 75.007c0-.24-.08-.49-.263-.675l-3.487-3.456-1.318 1.318 1.845 1.875H63.745a.938.938 0 0 0 0 1.875h13.652l-1.845 1.875 1.318 1.318 3.487-3.456a.95.95 0 0 0 .263-.674m-.937-7.5a.94.94 0 0 0-.938-.938H65.093l1.846-1.875-1.319-1.318-3.486 3.456a.966.966 0 0 0 0 1.349l3.486 3.456 1.319-1.318-1.846-1.875h13.652c.518 0 .938-.42.938-.937",fill:"#fff",fillOpacity:".98"})]}),zn=e=>jsx(Flex,{direction:"row",justify:"between",width:"100%",itemAlign:"end",children:(()=>{if(e.isTrader&&!e.wrongNetwork){let o=e.referralInfo?.referee_info?.total_referee_rebate;return jsxs(Fragment,{children:[jsxs(Flex,{direction:"column",itemAlign:"start",gap:2,children:[jsxs(Text,{className:"oui-text-2xs md:oui-text-xs xl:oui-text-sm",children:["Commission ",jsx(Text,{intensity:36,children:"(USDC)"})]}),jsxs(Flex,{direction:"row",gap:1,children:[jsx(q,{}),jsx(Text,{className:"oui-text-base md:oui-text-lg lg:oui-text-xl xl:oui-text-2xl",children:commifyOptional(o,{fix:2,fallback:"0"})})]})]}),jsxs(Flex,{direction:"row",gap:1,justify:"end",itemAlign:"center",className:"oui-cursor-pointer",onClick:r=>{e?.onEnterTraderPage?.();},children:[jsx(Text,{className:"oui-text-sm md:oui-text-base xl:oui-text-lg",children:"Enter"}),jsx(Ke,{className:"md:oui-w-[18px] md:oui-h-[18px] lg:oui-w-[20px] lg:oui-h-[20px] xl:oui-w-[24px] xl:oui-h-[24px]"})]})]})}return jsxs(Fragment,{children:[jsx(En,{...e}),jsxs(Flex,{direction:"column",justify:"between",className:"oui-h-full",itemAlign:"end",children:[jsx(Text,{className:"oui-text-base md:oui-text-lg lg:oui-text-xl 2xl:oui-text-2xl",children:"0%~20%"}),jsx(Text,{className:"oui-text-2xs md:oui-text-xs 2xl:oui-text-sm oui-text-base-contrast-54",children:"Rebate"})]})]})})()}),En=e=>jsxs(Dialog,{open:e.open,onOpenChange:e.setOpen,children:[jsx(DialogTrigger,{children:jsx(Tooltip,{content:e.wrongNetwork?"Please switch to a supported network to continue.":"Please connect your wallet to use this function",children:jsx(Button,{variant:"contained",color:"light",disabled:!e.isSignIn||e.wrongNetwork,children:"Enter code"})})}),jsxs(DialogContent,{className:"oui-w-[320px] oui-font-semibold",children:[jsx(DialogHeader,{children:jsx(DialogTitle,{children:"Bind a referral code"})}),jsx(Divider,{}),jsxs(DialogBody,{children:[jsx(Text,{size:"sm",intensity:54,children:"Bind a referral code to earn trading fee rebates."}),jsx(TextField,{className:"oui-w-full oui-mt-4",placeholder:"Referral code",value:e.code,onChange:t=>{e.setCode(t.target.value);},formatters:[inputFormatter.createRegexInputFormatter(/[^A-Z0-9]/g)],onClean:()=>{e.setCode("");},label:"Enter referral code",classNames:{label:"oui-text-2xs oui-text-base-contrast-54"},helpText:!e.isExist&&!e.isLoading&&e.code.length>0?"This referral code does not exist.":void 0,color:!e.isExist&&!e.isLoading&&e.code.length>0?"danger":void 0}),jsx(Flex,{itemAlign:"center",width:"100%",direction:"row",justify:"center",mt:6,children:jsx(Button,{variant:"contained",color:"primary",size:"md",className:"oui-px-[40px]",disabled:e.code.length<4||!e.isExist,onClick:t=>{t.stopPropagation(),e.onClickConfirm();},children:"Confirm"})})]})]})]});var nr=()=>{let{isTrader:e,referralInfo:t,setShowHome:o,bindReferralCodeState:r,setTab:i,mutate:a,wrongNetwork:n}=y(),{state:l}=useAccount(),d=l.status===AccountStatusEnum.EnableTrading,p=()=>{i("trader"),o(!1);},[s,u]=useState(""),[f,c]=useState(!1),{isExist:m,error:x,isLoading:D}=useCheckReferralCode(s),L=()=>{c(!1);},[B,{error:F,isMutating:v}]=useMutation("/v1/referral/bind","POST");return {isSignIn:d,isTrader:e,isLoading:D,referralInfo:t,onEnterTraderPage:p,code:s,setCode:u,open:f,setOpen:c,onClickConfirm:async()=>{try{await B({referral_code:s}),toast.success("Referral code bound"),a(),r?r(!0,null,L,{tab:1}):L();}catch(T){let H=`${T}`;"message"in T&&(H=T.message),H==="referral code not exist"&&(H="This referral code does not exist"),r?(toast.error(H),r(!1,T,L,{})):toast.error(H);}},isExist:m,wrongNetwork:n}};var lr=()=>{let e=nr();return jsx(ir,{...e})};var sr=e=>typeof e.overwrite=="function"?e.overwrite?.(e.state):jsxs(Flex,{id:"oui-affiliate-home-card",className:"oui-flex oui-flex-col xl:oui-flex-row oui-gap-6 xl:oui-gap-[36px] oui-w-full oui-items-stretch",children:[jsx(or,{}),jsx(lr,{})]});var ur=()=>{let e=y();return {overwrite:e.overwrite?.ref?.card,state:e}};var fr=()=>{let e=ur();return jsx(sr,{...e})};var be=()=>jsxs(Flex,{id:"oui-affiliate-home-page",className:cn("oui-h-lvw ","oui-font-semibold"),direction:"column",gap:4,children:[jsx(er,{}),jsx(fr,{}),jsx($t,{})]});var dr=e=>{let t=()=>{if(e.isAffiliate&&!e.isTrader)return jsxs(Button,{variant:"contained",color:"success",size:"sm",className:"oui-px-2 oui-flex oui-gap-1",style:{position:"absolute",top:"50%",right:"24px",transform:"translateY(-50%)"},onClick:o=>{e.anATrader();},children:[jsx(it,{}),jsx(Text,{children:"As a trader"})]});if(!e.isAffiliate&&e.isTrader)return jsxs(Button,{variant:"contained",color:"primary",size:"sm",className:"oui-px-2 oui-flex oui-gap-1",style:{position:"absolute",top:"50%",right:"24px",transform:"translateY(-50%)"},onClick:o=>{e.anAnAffiliate();},children:[jsx(rt,{}),jsx(Text,{children:"As an affiliate"})]})};return e.isLoading?jsx("div",{className:cn("oui-max-w-[960px]",e.classNames?.loadding),children:e.splashPage?.()||jsx(be,{})}):!e.isAffiliate&&!e.isTrader||e.showHome?jsx("div",{className:cn("oui-max-w-[960px]",e?.classNames?.home),children:jsx(be,{})}):jsxs(TabsBase,{id:"oui-affiliate-dashboard-tab",value:e.tab,onValueChange:o=>{e.setTab(o);},className:cn("oui-w-full",e.classNames?.dashboard),children:[jsxs(TabsList,{className:cn("oui-px-6 oui-flex oui-flex-row oui-justify-start oui-h-[44px] oui-relative oui-items-end","oui-text-base md:oui-text-lg","oui-rounded-xl oui-bg-base-9","oui-border oui-border-line-6",e.isAffiliate&&e.isTrader&&"oui-justify-center"),children:[e.isAffiliate&&jsx(TabsTrigger,{id:"oui-affiliate-dashboard-tab-affiliate",value:"affiliate",children:jsxs(Flex,{direction:"row",gap:1,mb:2,children:[jsx(rt,{fillOpacity:1,fill:"currentColor",className:e.tab==="affiliate"?"oui-fill-white/[.98]":"oui-fill-white/[.36]"}),jsx(Text,{children:"Affiliate"})]})}),e.isTrader&&jsx(TabsTrigger,{id:"oui-affiliate-dashboard-tab-trader",value:"trader",children:jsxs(Flex,{direction:"row",gap:1,mb:2,children:[jsx(it,{fillOpacity:1,fill:"currentColor",className:e.tab==="trader"?"oui-fill-white/[.98]":"oui-fill-white/[.36]"}),jsx(Text,{children:"Trader"})]})}),t()]}),e.isAffiliate&&jsx(TabsContent,{value:"affiliate",className:"oui-mt-4",children:jsx(Se,{})}),e.isTrader&&jsx(TabsContent,{value:"trader",className:"oui-mt-4",children:jsx(Ae,{})})]})};var cr=()=>{let{isAffiliate:e,isTrader:t,isLoading:o,becomeAnAffiliateUrl:r,onBecomeAnAffiliate:i,showReferralPage:a,splashPage:n,showHome:l,setShowHome:d,tab:p,setTab:s}=y(),u=useMemo(()=>e&&t?p:e&&!t?"affiliate":!e&&t?"trader":"affiliate",[p,e,t]);return {setTab:s,tab:u,isAffiliate:e,isTrader:t,isLoading:o,anAnAffiliate:()=>{d(!0);},anATrader:()=>{d(!0);},splashPage:n,showHome:l,setShowHome:d}};var xr=e=>{let t=cr();return jsx(dr,{classNames:e.classNames,...t})};var ko=e=>{let{classNames:t={}}=e,{root:o,...r}=t;return jsx("div",{id:"oui-affiliate-dashboard-page",className:cn("oui-w-full oui-tracking-tight",o),children:jsx(xr,{classNames:r})})};var Eo=e=>{let{...t}=e;return jsx(Scaffold,{leftSidebar:jsx(ol,{...t}),children:jsx(Box,{mx:3,my:6,children:e.children})})},ol=e=>jsx(Box,{p:4,m:3,border:!0,borderColor:8,r:"xl",children:jsx(SideBar,{...e})});var Wo=()=>{let[e,t]=useState("/");return {items:useMemo(()=>[{name:"Trading",href:"/",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",fill:"url(#a)"}),jsx("defs",{children:jsxs("linearGradient",{id:"a",x1:"17.25",y1:"9",x2:".75",y2:"9",gradientUnits:"userSpaceOnUse",children:[jsx("stop",{stopColor:"#59B0FE"}),jsx("stop",{offset:"1",stopColor:"#26FEFE"})]})})]})},{name:"Affiliate",href:"/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",fill:"#fff",fillOpacity:".54"})})}],[]),current:e,onItemSelect:r=>{t(r.href);}}};var nl=e=>{let t=Wo();return jsx(Eo,{...t,children:e.children})};
15
+
16
+ export { nl as AffiliateLayoutWidget, Bo as Dashboard, Nr as ReferralContext, kl as ReferralProvider, ve as TabTypes, y as useReferralContext };
17
+ //# sourceMappingURL=out.js.map
18
+ //# sourceMappingURL=index.mjs.map