1import{c as b,r as x,t as n,b as l,j as e,x as P,U as g}from"./index-C3Qps0S4.js";import{L as p}from"./loader-circle-DohmWZz_.js";import{U as R}from"./users-DTIsUZbE.js";import{C as j}from"./copy-COsMcIJe.js";import{S as N}from"./share-2-CFvl2N1B.js";import{E as v}from"./external-link-BaKbLCyP.js";import{G as w}from"./gift-Dnnb3vap.js";function L(){const{t,lang:s}=b(),[c,d]=x.useState(""),[f,i]=x.useState(!1),{data:a,isLoading:m}=n.referral.myInfo.useQuery(),h=n.useUtils(),o=n.referral.useCode.useMutation({onSuccess:()=>{l.success(s==="th"?"à¹à¸à¹à¸£à¸«à¸±à¸ªà¹à¸à¸°à¸à¸³à¸ªà¸³à¹à¸£à¹à¸!":"Referral code applied!"),h.referral.myInfo.invalidate(),d("")},onError:r=>l.error(r.message)}),u=()=>{a?.code&&(navigator.clipboard.writeText(a.code),i(!0),l.success(s==="th"?"à¸à¸±à¸à¸¥à¸à¸à¸£à¸«à¸±à¸ªà¹à¸¥à¹à¸§!":"Code copied!"),setTimeout(()=>i(!1),2e3))};return m?e.jsx("div",{"data-loc":"client/src/pages/ReferralPage.tsx:35",className:"flex items-center justify-center py-20",children:e.jsx(p,{"data-loc":"client/src/pages/ReferralPage.tsx:36",className:"w-6 h-6 text-orange-400 animate-spin"})}):e.jsxs("div",{"data-loc":"client/src/pages/ReferralPage.tsx:42",className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/ReferralPage.tsx:44",className:"flex items-center gap-2",children:[e.jsx(R,{"data-loc":"client/src/pages/ReferralPage.tsx:45",className:"w-5 h-5 text-orange-400"}),e.jsx("h1",{"data-loc":"client/src/pages/ReferralPage.tsx:46",className:"text-xl font-bold text-gold-gradient",children:t.referral.title})]}),e.jsxs("div",{"data-loc":"client/src/pages/ReferralPage.tsx:50",className:"glass-card rounded-xl p-4",children:[e.jsx("p",{"data-loc":"client/src/pages/ReferralPage.tsx:51",className:"text-xs text-muted-foreground mb-2",children:t.referral.yourCode}),e.jsxs("div",{"data-loc":"client/src/pages/ReferralPage.tsx:52",className:"flex items-center gap-2",children:[e.jsx("div",{"data-loc":"client/src/pages/ReferralPage.tsx:53",className:"flex-1 px-3 py-2.5 rounded-lg bg-muted/50 border border-border font-mono text-lg font-bold text-foreground tracking-wider",children:a?.code||(s==="th"?"à¸à¸³à¸¥à¸±à¸à¸ªà¸£à¹à¸²à¸...":"Generating...")}),e.jsx("button",{"data-loc":"client/src/pages/ReferralPage.tsx:56",onClick:u,className:"p-2.5 rounded-lg bg-orange-500/20 border border-orange-500/30 text-orange-400 hover:bg-orange-500/30 transition-colors",children:f?e.jsx(P,{"data-loc":"client/src/pages/ReferralPage.tsx:60",className:"w-5 h-5"}):e.jsx(j,{"data-loc":"client/src/pages/ReferralPage.tsx:60",className:"w-5 h-5"})})]}),e.jsx("p",{"data-loc":"client/src/pages/ReferralPage.tsx:63",className:"text-[11px] text-muted-foreground mt-2",children:s==="th"?e.jsxs(e.Fragment,{children:["à¹à¸à¸£à¹à¸£à¸«à¸±à¸ªà¸à¸µà¹à¹à¸«à¹à¹à¸à¸·à¹à¸à¸ à¹à¸¡à¸·à¹à¸à¹à¸à¸·à¹à¸à¸à¸ªà¸¡à¸±à¸à¸£à¹à¸¥à¸°à¹à¸à¹à¸£à¸«à¸±à¸ª à¸à¸¸à¸à¸à¸°à¹à¸à¹à¸£à¸±à¸ ",e.jsxs("span",{"data-loc":"client/src/pages/ReferralPage.tsx:65",className:"text-amber-400 font-bold",children:[a?.rewardPerReferral," Point"]})," à¸à¸±à¸à¸à¸µ!"]}):e.jsxs(e.Fragment,{children:["Share this code with friends. When they sign up and use it, you'll get ",e.jsxs("span",{"data-loc":"client/src/pages/ReferralPage.tsx:66",className:"text-amber-400 font-bold",children:[a?.rewardPerReferral," Points"]})," instantly!"]})}),e.jsxs("div",{"data-loc":"client/src/pages/ReferralPage.tsx:70",className:"mt-3 pt-3 border-t border-border",children:[e.jsxs("p",{"data-loc":"client/src/pages/ReferralPage.tsx:71",className:"text-[10px] text-muted-foreground mb-2 flex items-center gap-1",children:[e.jsx(N,{"data-loc":"client/src/pages/ReferralPage.tsx:72",className:"w-3 h-3"}),s==="th"?"à¹à¸à¸£à¹à¸à¹à¸²à¸à¸à¹à¸à¸à¸à¸²à¸":"Share via"]}),e.jsxs("div",{"data-loc":"client/src/pages/ReferralPage.tsx:75",className:"flex gap-2",children:[e.jsxs("button",{"data-loc":"client/src/pages/ReferralPage.tsx:77",onClick:()=>{const r=`มาà¹à¸¥à¹à¸ MAWIN SIAM à¸à¸±à¸! à¹à¸à¹à¸£à¸«à¸±à¸ªà¹à¸à¸°à¸à¸³ ${a?.code} รัภPoint à¸à¸£à¸µ! ${window.location.origin}/register?ref=${a?.code}`;window.open(`https://www.facebook.com/sharer/sharer.php?quote=${encodeURIComponent(r)}&u=${encodeURIComponent(window.location.origin+"/register?ref="+a?.code)}`,"_blank","width=600,height=400")},className:"flex-1 flex items-center justify-center gap-1.5 py-2.5 rounded-lg bg-[#1877F2]/15 border border-[#1877F2]/30 text-[#1877F2] hover:bg-[#1877F2]/25 transition-all active:scale-[0.97]",children:[e.jsx("svg",{"data-loc":"client/src/pages/ReferralPage.tsx:84",className:"w-4 h-4",fill:"
1currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{"data-loc":"client/src/pages/ReferralPage.tsx:84",d:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"})}),e.jsx("span",{"data-loc":"client/src/pages/ReferralPage.tsx:85",className:"text-xs font-medium",children:"Facebook"})]}),e.jsxs("button",{"data-loc":"client/src/pages/ReferralPage.tsx:89",onClick:()=>{const r=`มาà¹à¸¥à¹à¸ MAWIN SIAM à¸à¸±à¸! à¹à¸à¹à¸£à¸«à¸±à¸ªà¹à¸à¸°à¸à¸³ ${a?.code} รัภPoint à¸à¸£à¸µ! ${window.location.origin}/register?ref=${a?.code}`;window.open(`https://social-plugins.line.me/lineit/share?url=${encodeURIComponent(window.location.origin+"/register?ref="+a?.code)}&text=${encodeURIComponent(r)}`,"_blank","width=600,height=400")},className:"flex-1 flex items-center justify-center gap-1.5 py-2.5 rounded-lg bg-[#06C755]/15 border border-[#06C755]/30 text-[#06C755] hover:bg-[#06C755]/25 transition-all active:scale-[0.97]",children:[e.jsx("svg",{"data-loc":"client/src/pages/ReferralPage.tsx:96",className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{"data-loc":"client/src/pages/ReferralPage.tsx:96",d:"M19.365 9.863c.349 0 .63.285.63.631 0 .345-.281.63-.63.63H17.61v1.125h1.755c.349 0 .63.283.63.63 0 .344-.281.629-.63.629h-2.386c-.345 0-.627-.285-.627-.629V8.108c0-.345.282-.63.63-.63h2.386c.346 0 .627.285.627.63 0 .349-.281.63-.63.63H17.61v1.125h1.755zm-3.855 3.016c0 .27-.174.51-.432.596-.064.021-.133.031-.199.031-.211 0-.391-.09-.51-.25l-2.443-3.317v2.94c0 .344-.279.629-.631.629-.346 0-.626-.285-.626-.629V8.108c0-.27.173-.51.43-.595.06-.023.136-.033.194-.033.195 0 .375.104.495.254l2.462 3.33V8.108c0-.345.282-.63.63-.63.345 0 .63.285.63.63v4.771zm-5.741 0c0 .344-.282.629-.631.629-.345 0-.627-.285-.627-.629V8.108c0-.345.282-.63.63-.63.346 0 .628.285.628.63v4.771zm-2.466.629H4.917c-.345 0-.63-.285-.63-.629V8.108c0-.345.285-.63.63-.63.348 0 .63.285.63.63v4.141h1.756c.348 0 .629.283.629.63 0 .344-.282.629-.629.629M24 10.314C24 4.943 18.615.572 12 .572S0 4.943 0 10.314c0 4.811 4.27 8.842 10.035 9.608.391.082.923.258 1.058.59.12.301.079.766.038 1.08l-.164 1.02c-.045.301-.24 1.186 1.049.645 1.291-.539 6.916-4.078 9.436-6.975C23.176 14.393 24 12.458 24 10.314"})}),e.jsx("span",{"data-loc":"client/src/pages/ReferralPage.tsx:97",className:"text-xs font-medium",children:"LINE"})]}),e.jsxs("button",{"data-loc":"client/src/pages/ReferralPage.tsx:101",onClick:()=>{const r=`${window.location.origin}/register?ref=${a?.code}`;navigator.clipboard.writeText(r),l.success(s==="th"?"à¸à¸±à¸à¸¥à¸à¸à¸¥à¸´à¸à¸à¹à¹à¸¥à¹à¸§!":"Link copied!")},className:"flex-1 flex items-center justify-center gap-1.5 py-2.5 rounded-lg bg-gray-500/15 border border-gray-500/30 text-gray-300 hover:bg-gray-500/25 transition-all active:scale-[0.97]",children:[e.jsx(v,{"data-loc":"client/src/pages/ReferralPage.tsx:109",className:"w-4 h-4"}),e.jsx("span",{"data-loc":"client/src/pages/ReferralPage.tsx:110",className:"text-xs font-medium",children:s==="th"?"à¸à¸±à¸à¸¥à¸à¸à¸¥à¸´à¸à¸à¹":"Copy Link"})]})]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/ReferralPage.tsx:117",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"data-loc":"client/src/pages/ReferralPage.tsx:118",className:"glass-card rounded-xl p-3 text-center",children:[e.jsx(g,{"data-loc":"client/src/pages/ReferralPage.tsx:119",className:"w-5 h-5 mx-auto text-blue-400 mb-1"}),e.jsx("p",{"data-loc":"client/src/pages/ReferralPage.tsx:120",className:"text-lg font-bold text-foreground",children:a?.count??0}),e.jsx("p",{"data-loc":"client/src/pages/ReferralPage.tsx:121",className:"text-[10px] text-muted-foreground",children:s==="th"?"à¹à¸à¸·à¹à¸à¸à¸à¸µà¹à¹à¸à¸°à¸à¸³":"Friends Referred"})]}),e.jsxs("div",{"data-loc":"client/src/pages/ReferralPage.tsx:123",className:"glass-card rounded-xl p-3 text-center",children:[e.jsx(w,{"data-loc":"client/src/pages/ReferralPage.tsx:124",className:"w-5 h-5 mx-auto text-amber-400 mb-1"}),e.jsx("p",{"data-loc":"client/src/pages/ReferralPage.tsx:125",className:"text-lg font-bold text-foreground",children:(a?.count??0)*(a?.rewardPerReferral??20)}),e.jsx("p",{"data-loc":"client/src/pages/ReferralPage.tsx:126",className:"text-[10px] text-muted-foreground",children:s==="th"?"Point à¸à¸µà¹à¹à¸à¹à¸£à¸±à¸":"Points Earned"})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/ReferralPage.tsx:131",className:"glass-card rounded-xl p-4",children:[e.jsx("p",{"data-loc":"client/src/pages/ReferralPage.tsx:132",className:"text-xs font-medium text-foreground mb-2",children:s==="th"?"มีรหัสà¹à¸à¸°à¸à¸³?":"Have a referral code?"}),e.jsxs("div",{"data-loc":"client/src/pages/ReferralPage.tsx:133",className:"flex gap-2",children:[e.jsx("input",{"data-loc":"client/src/pages/ReferralPage.tsx:134",type:"text",value:c,onChange:r=>d(r.target.value.toUpperCase()),placeholder:s==="th"?"à¸à¸£à¸à¸à¸£à¸«à¸±à¸ªà¹à¸à¸°à¸à¸³":"Enter referral code",className:"flex-1 px-3 py-2 rounded-lg bg-muted/50 border border-border text-sm text-foreground placeholder-muted-foreground focus:outline-none focus:border-orange-500"}),e.jsx("button",{"data-loc":"client/src/pages/ReferralPage.tsx:141",onClick:()=>o.mutate({code:c}),disabled:!c.trim()||o.isPending,className:"px-4 py-2 rounded-lg bg-gradient-to-r from-orange-500 to-red-500 text-white text-sm font-medium disabled:opacity-50",children:o.isPending?e.jsx(p,{"data-loc":"client/src/pages/ReferralPage.tsx:146",className:"w-4 h-4 animate-spin"}):t.referral.apply})]})]}),(a?.referrals?.length??0)>0&&e.jsxs("div",{"data-loc":"client/src/pages/ReferralPage.tsx:153",className:"glass-card rounded-xl p-4",children:[e.jsx("p",{"data-loc":"client/src/pages/ReferralPage.tsx:154",className:"text-xs font-medium text-foreground mb-3",children:t.referral.history}),e.jsx("div",{"data-loc":"client/src/pages/ReferralPage.tsx:155",className:"space-y-2",children:a?.referrals.map(r=>e.jsxs("div",{"data-loc":"client/src/pages/ReferralPage.tsx:157",className:"flex items-center justify-between py-2 border-b border-border last:border-0",children:[e.jsxs("div",{"data-loc":"client/src/pages/ReferralPage.tsx:158",className:"flex items-center gap-2",children:[e.jsx("div",{"data-loc":"client/src/pages/ReferralPage.tsx:159",className:"w-7 h-7 rounded-full bg-blue-500/20 flex items-center justify-center",children:e.jsx(g,{"data-loc":"client/src/pages/ReferralPage.tsx:160",className:"w-3.5 h-3.5 text-blue-400"})}),e.jsxs("div",{"data-loc":"client/src/pages/ReferralPage.tsx:162",children:[e.jsx("p",{"data-loc":"client/src/pages/ReferralPage.tsx:163",className:"text-xs font-medium text-foreground",children:r.referredUserName||(s==="th"?"สมาà¸à¸´à¸":"Member")}),e.jsx("p",{"data-loc":"client/src/pages/ReferralPage.tsx:164",className:"text-[10px] text-muted-foreground",children:new Date(r.createdAt).toLocaleDateString("th-TH")})]})]}),e.jsxs("span",{"data-loc":"client/src/pages/ReferralPage.tsx:169",className:"text-xs font-bold text-amber-400",children:["+",a.rewardPerReferral," ",t.home.credits]})]},r.id))})]})]})}export{L as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.