PageSourceSearch

https://tradeintelx.com/assets/TraderProfilePage-CIIGFrNn.js

js tradeintelx.com collected 2026-09-24 14:56:54 UTC 31,529 bytes, 1 lines download raw bytes

1import{o as V}from"./rolldown-runtime-ChpBd9eV.js";import{La as Z,Ma as z,Na as K,T as Q,Ta as Y}from"./chat-page-evUfHQgD.js";import{Sc as A,Xc as E,_c as M,al as B,bc as ee,cl as U,d as se,do as te,f as ae,fc as le,g as re,gl as ne,h as ie,lc as T,lu as W,m as de,mc as ce,ml as oe,p as xe,pc as F,qc as me,sc as _,sl as R,u as he,wc as O,xc as ge}from"./market-core-DitXLvJ-.js";import{a as ue}from"./trading-charts-lGr1u8E1.js";var c=V(Z(),1),e=Y(),be=({percent:s,size:r=120,strokeWidth:t=8,color:a="green",label:l,value:n})=>{const o=(r-t)/2,d=o*2*Math.PI,m=d-s/100*d,g={green:{stroke:"stroke-green-500",text:"text-green-400",bg:"bg-green-500/20"},yellow:{stroke:"stroke-yellow-500",text:"text-yellow-400",bg:"bg-yellow-500/20"},red:{stroke:"stroke-red-500",text:"text-red-400",bg:"bg-red-500/20"},blue:{stroke:"stroke-blue-500",text:"text-blue-400",bg:"bg-blue-500/20"}},i=g[a]||g.green;return(0,e.jsxs)("div",{className:"relative flex flex-col items-center",children:[(0,e.jsxs)("svg",{width:r,height:r,className:"transform -rotate-90",children:[(0,e.jsx)("circle",{cx:r/2,cy:r/2,r:o,fill:"none",stroke:"currentColor",strokeWidth:t,className:"text-slate-700"}),(0,e.jsx)("circle",{cx:r/2,cy:r/2,r:o,fill:"none",strokeWidth:t,strokeDasharray:d,strokeDashoffset:m,strokeLinecap:"round",className:`${i.stroke} transition-all duration-500`})]}),(0,e.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[(0,e.jsx)("span",{className:`text-2xl font-bold ${i.text}`,children:n}),(0,e.jsx)("span",{className:"text-xs text-slate-400",children:l})]})]})},je=({analysis:s,orgRiskRules:r})=>{const t=()=>s.isBreached||s.isCritical?"red":s.isWarning?"yellow":"green",a=l=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(l||0);return(0,e.jsxs)("div",{className:"bg-slate-800 rounded-xl border border-slate-700 p-5",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,e.jsx)("div",{className:`p-2.5 rounded-xl ${s.isBreached?"bg-red-500/20":s.isWarning?"bg-yellow-500/20":"bg-green-500/20"}`,children:(0,e.jsx)(R,{className:`w-5 h-5 ${s.isBreached?"text-red-400":s.isWarning?"text-yellow-400":"text-green-400"}`})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"font-semibold text-white",children:"Drawdown Status"}),(0,e.jsxs)("p",{className:"text-xs text-slate-400 capitalize",children:[s.drawdownType?.replace("_"," ")," Drawdown"]})]})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,e.jsx)(be,{percent:Math.min(100,s.drawdownUsedPercent),color:t(),label:"Used",value:`${s.drawdownPercent.toFixed(1)}%`}),(0,e.jsxs)("div",{className:"flex-1 ml-6 space-y-3",children:[(0,e.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"Current Balance"}),(0,e.jsx)("span",{className:"font-semibold text-white",children:a(s.currentBalance)})]}),s.drawdownType==="trailing"&&(0,e.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"High Water Mark"}),(0,e.jsx)("span",{className:"font-semibold text-green-400",children:a(s.highWaterMark)})]}),(0,e.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"Starting Balance"}),(0,e.jsx)("span",{className:"text-slate-300",children:a(s.startingBalance)})]}),(0,e.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"Max Allowed"}),(0,e.jsxs)("span",{className:"text-slate-300",children:[s.maxDrawdownPercent,"% (",a(s.maxAllowedDrawdown),")"]})]})]})]}),s.isBreached&&(0,e.jsx)("div",{className:"p-3 bg-red-500/10 border border-red-500/30 rounded-lg",children:(0,e.jsxs)("p",{className:"text-sm text-red-400 font-medium flex items-center gap-2",children:[(0,e.jsx)(T,{className:"w-4 h-4"}),"DRAWDOWN LIMIT BREACHED - Account should be suspended"]})}),s.isWarning&&!s.isBreached&&(0,e.jsx)("div",{className:"p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:(0,e.jsxs)("p",{className:"text-sm text-yellow-400 flex items-center gap-2",children:[(0,e.jsx)(T,{className:"w-4 h-4"}),"Warning: ",s.drawdownUsedPercent.toFixed(0),"% of drawdown limit used"]})})]})},pe=({analysis:s})=>{const r=s.isConsistent;return(0,e.jsxs)("div",{className:"bg-slate-800 rounded-xl border border-slate-700 p-5",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,e.jsx)("div",{className:`p-2.5 rounded-xl ${r?"bg-green-500/20":"bg-yellow-500/20"}`,children:(0,e.jsx)(_,{className:`w-5 h-5 ${r?"text-green-400":"text-yellow-400"}`})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"font-semibold text-white",children:"Consistency Rule"}),(0,e.jsxs)("p",{className:"text-xs text-slate-400",children:["No single day > ",s.maxAllowedPercent,"% of profit"]})]}),(0,e.jsx)("div",{className:"ml-auto",children:r?(0,e.jsxs)("span",{className:"px-2 py-1 bg-green-500/20 text-green-400 text-xs font-medium rounded-lg flex items-center gap-1",children:[(0,e.jsx)(M,{className:"w-3 h-3"})," Passing"]}):(0,e.jsxs)("span",{className:"px-2 py-1 bg-yellow-500/20 text-yellow-400 text-xs font-medium rounded-lg flex items-center gap-1",children:[(0,e.jsx)(T,{className:"w-3 h-3"})," Violation"]})})]}),(0,e.jsxs)("div",{className:"grid grid-cols-3 gap-4 mb-4",children:[(0,e.jsxs)("div",{className:"text-center p-3 bg-slate-900 rounded-lg",children:[(0,e.jsx)("p",{className:"text-2xl font-bold text-white",children:s.tradingDays}),(0,e.jsx)("p",{className:"text-xs text-slate-400",children:"Trading Days"})]}),(0,e.jsxs)("div",{className:"text-center p-3 bg-slate-900 rounded-lg",children:[(0,e.jsx)("p",{className:"text-2xl font-bold text-green-400",children:s.profitableDays}),(0,e.jsx)("p",{className:"text-xs text-slate-400",children:"Profitable"})]}),(0,e.jsxs)("div",{className:"text-center p-3 bg-slate-900 rounded-lg",children:[(0,e.jsx)("p",{className:"text-2xl font-bold text-red-400",children:s.violationCount}),(0,e.jsx)("p",{className:"text-xs text-slate-400",children:"Violations"})]})]}),s.bestDay&&(0,e.jsxs)("div",{className:`p-3 rounded-lg ${s.bestDay.percentOfTotal>s.maxAllowedPercent?"bg-yellow-500/10 border border-yellow-500/30":"bg-slate-900"}`,children:[(0,e.jsxs)("p",{className:"text-xs text-slate-400 mb-1",children:["Best Day: ",s.bestDay.date]}),(0,e.jsxs)("p",{className:"text-sm font-medium text-white",children:["$",s.bestDay.profit.toLocaleStr
1ing()," (",s.bestDay.percentOfTotal.toFixed(1),"% of total)"]})]})]})},fe=({eligibility:s,onScale:r,isProcessing:t})=>s?(0,e.jsxs)("div",{className:"bg-slate-800 rounded-xl border border-slate-700 p-5",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,e.jsx)("div",{className:`p-2.5 rounded-xl ${s.eligible?"bg-green-500/20":"bg-blue-500/20"}`,children:(0,e.jsx)(le,{className:`w-5 h-5 ${s.eligible?"text-green-400":"text-blue-400"}`})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"font-semibold text-white",children:"Account Scaling"}),(0,e.jsx)("p",{className:"text-xs text-slate-400",children:s.currentTier?.label||"Unknown"})]}),s.eligible&&(0,e.jsx)("button",{onClick:r,disabled:t,className:"ml-auto px-3 py-1.5 bg-green-600 hover:bg-green-500 text-white text-sm font-medium rounded-lg flex items-center gap-2 disabled:opacity-50",children:t?(0,e.jsx)("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ne,{className:"w-4 h-4"}),"Scale Up"]})})]}),s.nextTier&&(0,e.jsxs)("div",{className:"flex items-center gap-4 p-3 bg-slate-900 rounded-lg mb-4",children:[(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("p",{className:"text-lg font-bold text-white",children:s.currentTier?.label}),(0,e.jsx)("p",{className:"text-xs text-slate-400",children:"Current"})]}),(0,e.jsx)(ge,{className:"w-5 h-5 text-slate-500"}),(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("p",{className:"text-lg font-bold text-green-400",children:s.nextTier?.label}),(0,e.jsx)("p",{className:"text-xs text-slate-400",children:"Next Tier"})]})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("p",{className:"text-xs text-slate-400 font-medium uppercase mb-2",children:"Scaling Criteria"}),s.checks&&Object.entries(s.checks).map(([a,l])=>(0,e.jsxs)("div",{className:"flex items-center justify-between p-2 bg-slate-900 rounded-lg",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[l.passed?(0,e.jsx)(M,{className:"w-4 h-4 text-green-400"}):(0,e.jsx)(oe,{className:"w-4 h-4 text-slate-500"}),(0,e.jsx)("span",{className:"text-sm text-slate-300",children:l.label})]}),(0,e.jsxs)("span",{className:`text-sm font-medium ${l.passed?"text-green-400":"text-slate-400"}`,children:[typeof l.current=="number"?`${l.current}${a.includes("Rate")||a.includes("Target")?"%":""}`:l.current," / ",l.required,a.includes("Rate")||a.includes("Target")?"%":""]})]},a))]}),!s.eligible&&(0,e.jsxs)("div",{className:"mt-3 p-3 bg-blue-500/10 border border-blue-500/30 rounded-lg",children:[(0,e.jsxs)("p",{className:"text-sm text-blue-400",children:[s.progress.toFixed(0),"% progress to scaling eligibility"]}),(0,e.jsx)("div",{className:"mt-2 h-2 bg-slate-700 rounded-full overflow-hidden",children:(0,e.jsx)("div",{className:"h-full bg-blue-500 transition-all duration-500",style:{width:`${s.progress}%`}})})]})]}):null,Ne=({phaseData:s,onReset:r,isResetting:t})=>{if(!s)return null;const a=l=>l?(l instanceof Date?l:new Date(l)).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"N/A";return(0,e.jsxs)("div",{className:"bg-slate-800 rounded-xl border border-slate-700 p-5",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,e.jsx)("div",{className:`p-2.5 rounded-xl ${s.isExpired?"bg-red-500/20":s.isExpiringSoon?"bg-yellow-500/20":"bg-blue-500/20"}`,children:(0,e.jsx)(A,{className:`w-5 h-5 ${s.isExpired?"text-red-400":s.isExpiringSoon?"text-yellow-400":"text-blue-400"}`})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"font-semibold text-white",children:"Phase Duration"}),(0,e.jsx)("p",{className:"text-xs text-slate-400 capitalize",children:s.currentPhase?.replace(/([0-9])/g," $1")})]}),s.isExpired&&(0,e.jsx)("button",{onClick:r,disabled:t,className:"ml-auto px-3 py-1.5 bg-blue-600 hover:bg-blue-500 text-white text-sm font-medium rounded-lg flex items-center gap-2 disabled:opacity-50",children:t?(0,e.jsx)("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(E,{className:"w-4 h-4"}),"Reset Phase"]})})]}),(0,e.jsxs)("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[(0,e.jsxs)("div",{className:"text-center p-3 bg-slate-900 rounded-lg",children:[(0,e.jsx)("p",{className:"text-xs text-slate-400 mb-1",children:"Started"}),(0,e.jsx)("p",{className:"text-sm font-medium text-white",children:a(s.phaseStartDate)})]}),(0,e.jsxs)("div",{className:"text-center p-3 bg-slate-900 rounded-lg",children:[(0,e.jsx)("p",{className:"text-xs text-slate-400 mb-1",children:"Expires"}),(0,e.jsx)("p",{className:"text-sm font-medium text-white",children:a(s.expirationDate)})]}),(0,e.jsxs)("div",{className:`text-center p-3 rounded-lg ${s.isExpired?"bg-red-500/20":s.daysRemaining<=5?"bg-yellow-500/20":"bg-slate-900"}`,children:[(0,e.jsx)("p",{className:"text-xs text-slate-400 mb-1",children:"Days Left"}),(0,e.jsx)("p",{className:`text-lg font-bold ${s.isExpired?"text-red-400":s.daysRemaining<=5?"text-yellow-400":"text-white"}`,children:s.isExpired?"EXPIRED":s.daysRemaining})]})]}),!s.isExpired&&(0,e.jsx)("div",{className:"h-2 bg-slate-700 rounded-full overflow-hidden",children:(0,e.jsx)("div",{className:`h-full transition-all duration-500 ${s.daysRemaining<=5?"bg-yellow-500":"bg-blue-500"}`,style:{width:`${(s.phaseDuration-s.daysRemaining)/s.phaseDuration*100}%`}})})]})},we=({traderId:s,orgId:r})=>{const{currentOrg:t,currentMembership:a}
1=W(),[l,n]=(0,c.useState)(!0),[o,d]=(0,c.useState)(!1),[m,g]=(0,c.useState)(!1),[i,y]=(0,c.useState)(null),[D,f]=(0,c.useState)(null),[j,N]=(0,c.useState)(null),[w,h]=(0,c.useState)(null),[b,v]=(0,c.useState)(null),p=r||t?.id,k=t?.riskRules||{},L=async()=>{if(!(!p||!s))try{const[u,P,H,G,J]=await Promise.all([xe(p,s,k),ae(p,s,k.maxConsistencyPercent||30),se(p,s,k),he(p,s),re(p,s)]);y(u),f(P),N(H),h(G),v(J)}catch(u){console.error("Error loading risk data:",u)}finally{n(!1),d(!1)}};(0,c.useEffect)(()=>{L()},[p,s]);const I=()=>{d(!0),L()},q=async()=>{if(window.confirm("Are you sure you want to scale this trader to the next tier?")){g(!0);try{(await de(p,s,a?.userId)).success&&L()}catch{}finally{g(!1)}}},X=async()=>{const u=window.prompt("Enter reset fee (0 for free):","0");if(u!==null){g(!0);try{(await ie(p,s,"challenge1",a?.userId,parseFloat(u)||0)).success&&L()}catch{}finally{g(!1)}}};return l?(0,e.jsx)("div",{className:"space-y-4",children:[1,2,3,4].map(u=>(0,e.jsxs)("div",{className:"bg-slate-800 rounded-xl border border-slate-700 p-5 animate-pulse",children:[(0,e.jsx)("div",{className:"h-6 bg-slate-700 rounded w-1/3 mb-4"}),(0,e.jsx)("div",{className:"h-24 bg-slate-700 rounded"})]},u))}):(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-xl font-bold text-white",children:"Risk Dashboard"}),(0,e.jsx)("p",{className:"text-sm text-slate-400",children:"Real-time risk monitoring and analytics"})]}),(0,e.jsxs)("button",{onClick:I,disabled:o,className:"px-4 py-2 bg-slate-700 hover:bg-slate-600 text-white rounded-lg flex items-center gap-2 disabled:opacity-50",children:[(0,e.jsx)(E,{className:`w-4 h-4 ${o?"animate-spin":""}`}),"Refresh"]})]}),b&&(b.violations.length>0||b.warnings.length>0)&&(0,e.jsxs)("div",{className:"space-y-2",children:[b.violations.map((u,P)=>(0,e.jsxs)("div",{className:"p-3 bg-red-500/10 border border-red-500/30 rounded-lg flex items-center gap-3",children:[(0,e.jsx)(T,{className:"w-5 h-5 text-red-400 flex-shrink-0"}),(0,e.jsx)("p",{className:"text-sm text-red-300",children:u.message})]},P)),b.warnings.map((u,P)=>(0,e.jsxs)("div",{className:"p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg flex items-center gap-3",children:[(0,e.jsx)(T,{className:"w-5 h-5 text-yellow-400 flex-shrink-0"}),(0,e.jsx)("p",{className:"text-sm text-yellow-300",children:u.message})]},P))]}),(0,e.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[i&&(0,e.jsx)(je,{analysis:i,orgRiskRules:k}),D&&(0,e.jsx)(pe,{analysis:D}),j&&k.scalingPlan&&(0,e.jsx)(fe,{eligibility:j,onScale:q,isProcessing:m}),w&&(0,e.jsx)(Ne,{phaseData:w,onReset:X,isResetting:m})]})]})},x=s=>typeof s=="number"?s:Number(s)||0,C=s=>{if(!s)return null;if(s.toDate)return s.toDate();const r=new Date(s);return isNaN(r.getTime())?null:r},$=s=>(s||"").toLowerCase().replace(/[\s_-]+/g,""),S=({label:s,value:r,icon:t,color:a="blue",subValue:l,trend:n})=>(0,e.jsxs)("div",{className:"bg-slate-800 rounded-xl p-4 border border-slate-700",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,e.jsx)("div",{className:`p-2 rounded-lg ${{blue:"bg-blue-500/20 text-blue-400",green:"bg-green-500/20 text-green-400",red:"bg-red-500/20 text-red-400",yellow:"bg-yellow-500/20 text-yellow-400",purple:"bg-purple-500/20 text-purple-400"}[a]}`,children:(0,e.jsx)(t,{className:"w-5 h-5"})}),(0,e.jsx)("span",{className:"text-sm text-slate-400",children:s})]}),(0,e.jsx)("p",{className:"text-2xl font-bold text-white",children:r}),l&&(0,e.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:l}),n!==void 0&&(0,e.jsxs)("p",{className:`text-xs mt-1 flex items-center gap-1 ${n>=0?"text-green-400":"text-red-400"}`,children:[n>=0?(0,e.jsx)(U,{className:"w-3 h-3"}):(0,e.jsx)(R,{className:"w-3 h-3"}),Math.abs(n),"% vs last period"]})]}),ve=({trader:s,orgSettings:r,currentOrg:t})=>{const a=s?.evaluationPhase||"unknown",l=x(s?.accountBalance||s?.initialBalance||0),n=r?.evaluationPhases?.find(w=>$(w.name)===$(a))||{},o=(r?.accountTiers||t?.accountTiers||[]).find(w=>w.value===l)||{},d={maxDailyLoss:o?.rules?.maxDailyLoss||n?.maxDailyLossPercent||r?.maxDailyLossPercent||5,maxDrawdown:o?.rules?.maxTotalDrawdown||n?.maxDrawdownPercent||r?.maxDrawdownPercent||10,profitTarget:o?.rules?.profitTarget||n?.profitTarget||10,minTradingDays:n?.minTradingDays||5},m=s?.stats||{},g=x(m.maxDrawdown||m.currentDrawdown||0);x(m.dailyLossUsed||0);const i=g/d.maxDrawdown,y=i>=.8?"critical":i>=.5?"warning":"safe",D={safe:{bg:"bg-green-500/20",text:"text-green-400",border:"border-green-500/30"},warning:{bg:"bg-yellow-500/20",text:"text-yellow-400",border:"border-yellow-500/30"}
1,critical:{bg:"bg-red-500/20",text:"text-red-400",border:"border-red-500/30"}},f={phase1:{label:"Phase 1",color:"text-blue-400",bg:"bg-blue-500/20"},phase2:{label:"Phase 2",color:"text-purple-400",bg:"bg-purple-500/20"},phase3:{label:"Phase 3",color:"text-teal-400",bg:"bg-teal-500/20"},funded:{label:"Funded",color:"text-green-400",bg:"bg-green-500/20"},unknown:{label:"Evaluation",color:"text-slate-400",bg:"bg-slate-500/20"}},j=f[$(a)]||f[a]||f.unknown,N=D[y];return(0,e.jsxs)("div",{className:"bg-gradient-to-r from-slate-800 to-slate-800/80 rounded-2xl p-6 border border-slate-700 mb-6",children:[(0,e.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)("div",{className:`p-4 rounded-xl ${j.bg}`,children:(0,e.jsx)(F,{className:`w-8 h-8 ${j.color}`})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm text-slate-400 mb-1",children:"Current Phase"}),(0,e.jsx)("p",{className:`text-2xl font-bold ${j.color}`,children:j.label}),n?.durationDays&&(0,e.jsxs)("p",{className:"text-xs text-slate-500 mt-1",children:[n.durationDays," day evaluation"]})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)("div",{className:"p-4 rounded-xl bg-blue-500/20",children:(0,e.jsx)(O,{className:"w-8 h-8 text-blue-400"})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm text-slate-400 mb-1",children:"Account Size"}),(0,e.jsxs)("p",{className:"text-2xl font-bold text-white",children:["$",l.toLocaleString()]}),o?.description&&(0,e.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:o.description})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)("div",{className:`p-4 rounded-xl ${N.bg}`,children:(0,e.jsx)(T,{className:`w-8 h-8 ${N.text}`})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm text-slate-400 mb-1",children:"Risk Status"}),(0,e.jsx)("p",{className:`text-2xl font-bold capitalize ${N.text}`,children:y}),(0,e.jsxs)("p",{className:"text-xs text-slate-500 mt-1",children:[g.toFixed(1),"% / ",d.maxDrawdown,"% drawdown"]})]})]})]}),(0,e.jsxs)("div",{className:"mt-6 pt-4 border-t border-slate-700/50",children:[(0,e.jsx)("p",{className:"text-xs text-slate-500 mb-3 uppercase tracking-wider",children:"Account Rules"}),(0,e.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[(0,e.jsxs)("div",{className:"bg-slate-700/30 rounded-lg p-3",children:[(0,e.jsx)("p",{className:"text-xs text-slate-400",children:"Max Daily Loss"}),(0,e.jsxs)("p",{className:"text-lg font-semibold text-white",children:[d.maxDailyLoss,"%"]})]}),(0,e.jsxs)("div",{className:"bg-slate-700/30 rounded-lg p-3",children:[(0,e.jsx)("p",{className:"text-xs text-slate-400",children:"Max Drawdown"}),(0,e.jsxs)("p",{className:"text-lg font-semibold text-white",children:[d.maxDrawdown,"%"]})]}),(0,e.jsxs)("div",{className:"bg-slate-700/30 rounded-lg p-3",children:[(0,e.jsx)("p",{className:"text-xs text-slate-400",children:"Profit Target"}),(0,e.jsxs)("p",{className:"text-lg font-semibold text-white",children:[d.profitTarget,"%"]})]}),(0,e.jsxs)("div",{className:"bg-slate-700/30 rounded-lg p-3",children:[(0,e.jsx)("p",{className:"text-xs text-slate-400",children:"Min Trading Days"}),(0,e.jsx)("p",{className:"text-lg font-semibold text-white",children:d.minTradingDays})]})]})]})]})},ye=({trader:s,orgSettings:r})=>{if(!s?.evaluationPhase||s.evaluationPhase==="funded")return(0,e.jsxs)("div",{className:"bg-slate-800 rounded-xl p-6 border border-slate-700",children:[(0,e.jsxs)("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[(0,e.jsx)(F,{className:"w-5 h-5 text-green-400"}),s?.evaluationPhase==="funded"?"Funded Trader":"Evaluation Status"]}),s?.evaluationPhase==="funded"?(0,e.jsxs)("div",{className:"text-center py-6",children:[(0,e.jsx)("div",{className:"w-16 h-16 bg-green-500/20 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,e.jsx)(F,{className:"w-8 h-8 text-green-400"})}),(0,e.jsx)("p",{className:"text-xl font-semibold text-green-400",children:"Successfully Funded"}),(0,e.jsx)("p",{className:"text-slate-400 mt-2",children:"This trader has passed all evaluation phases"})]}):(0,e.jsx)("p",{className:"text-slate-400",children:"No active evaluation"})]});const t=s.stats||{},a=r?.evaluationPhases?.find(i=>$(i.name)===$(s.evaluationPhase))||{profitTarget:1e4,maxDrawdownPercent:10,maxDailyLossPercent:5,minTradingDays:10,durationDays:30},l=x(t.totalPnl),n=x(t.maxDrawdown),o=x(t.tradingDays),d=Math.min(100,l/a.profitTarget*100),m=Math.min(100,n/a.maxDrawdownPercent*100),g=Math.min(100,o/a.minTradingDays*100);return(0,e.jsxs)("div",{className:"bg-slate-800 rounded-xl p-6 border border-slate-700",children:[(0,e.jsxs)("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[(0,e.jsx)(B,{className:"w-5 h-5 text-blue-400"}),"Evaluation Progress"]}),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex justify-between text-sm mb-1",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"Profit Target"}),(0,e.jsxs)("span",{className:l>=a.profitTarget?"text-green-400":"text-white",children:["$",l.toLocaleStr
1ing()," / $",a.profitTarget.toLocaleString()]})]}),(0,e.jsx)("div",{className:"h-2 bg-slate-700 rounded-full overflow-hidden",children:(0,e.jsx)("div",{className:`h-full rounded-full transition-all ${d>=100?"bg-green-500":"bg-blue-500"}`,style:{width:`${d}%`}})})]}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex justify-between text-sm mb-1",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"Max Drawdown Used"}),(0,e.jsxs)("span",{className:m>=100?"text-red-400":"text-white",children:[n.toFixed(1),"% / ",a.maxDrawdownPercent,"%"]})]}),(0,e.jsx)("div",{className:"h-2 bg-slate-700 rounded-full overflow-hidden",children:(0,e.jsx)("div",{className:`h-full rounded-full transition-all ${m>=80?"bg-red-500":m>=50?"bg-yellow-500":"bg-green-500"}`,style:{width:`${m}%`}})})]}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex justify-between text-sm mb-1",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"Trading Days"}),(0,e.jsxs)("span",{className:"text-white",children:[o," / ",a.minTradingDays]})]}),(0,e.jsx)("div",{className:"h-2 bg-slate-700 rounded-full overflow-hidden",children:(0,e.jsx)("div",{className:`h-full rounded-full transition-all ${g>=100?"bg-green-500":"bg-blue-500"}`,style:{width:`${g}%`}})})]})]})]})},De=({trades:s=[]})=>{const r=(0,c.useMemo)(()=>{if(!s.length)return null;let t=0;const a=s.filter(l=>l.entryTime).sort((l,n)=>{const o=C(l.entryTime),d=C(n.entryTime);return(o?.getTime()||0)-(d?.getTime()||0)}).map(l=>{t+=x(l.pnl);const n=C(l.exitTime)||C(l.entryTime);return n?{x:n,y:t}:null}).filter(Boolean);return a.length?{datasets:[{label:"Equity",data:a,borderColor:t>=0?"#22c55e":"#ef4444",backgroundColor:t>=0?"rgba(34, 197, 94, 0.1)":"rgba(239, 68, 68, 0.1)",fill:!0,tension:.4,pointRadius:0}]}:null},[s]);return r?(0,e.jsx)(ue,{data:r,options:{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{mode:"index",intersect:!1,callbacks:{label:t=>`$${t.parsed.y.toLocaleString()}`}}},scales:{x:{type:"time",time:{unit:"day"},grid:{color:"rgba(148, 163, 184, 0.1)"},ticks:{color:"#94a3b8"}},y:{grid:{color:"rgba(148, 163, 184, 0.1)"},ticks:{color:"#94a3b8",callback:t=>`$${t.toLocaleString()}`}}}}}):(0,e.jsx)("div",{className:"h-64 flex items-center justify-center text-slate-500",children:"No trade data available"})},ke=()=>{const{traderId:s}=K(),r=z(),{currentOrg:t,members:a,memberStats:l,fetchMemberStats:n}=W(),[o,d]=(0,c.useState)(!0),[m,g]=(0,c.useState)(!1),[i,y]=(0,c.useState)(null),[D,f]=(0,c.useState)([]),[j,N]=(0,c.useState)(!1);(0,c.useEffect)(()=>{a&&a.length>0&&g(!0)},[a]),(0,c.useEffect)(()=>{s&&t?.id&&n(t.id,s)},[s,t?.id,n]),(0,c.useEffect)(()=>{if(!s||!a)return;const v=a.find(p=>p.id===s);v?y({...v,stats:l?.[s]||{}}):m&&y(null),m&&d(!1)},[s,a,l,m]);const w=(0,c.useCallback)(async()=>{if(!(!s||!t?.id)){N(!0);try{f(await te(s,t.id,200)||[])}catch(v){console.error("[TraderProfilePage] Error fetching trades:",v),f([])}finally{N(!1)}}},[s,t?.id]);(0,c.useEffect)(()=>{i&&s&&t?.id&&!j&&D.length===0&&w()},[i,s,t?.id]);const h=i?.stats||{},b=v=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(x(v));return o?(0,e.jsx)(Q,{}):i?(0,e.jsxs)("div",{className:"min-h-screen overflow-y-auto theme-page bg-[var(--bg-primary)]",children:[(0,e.jsx)("div",{className:"bg-slate-800 border-b border-slate-700 px-6 py-4",children:(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)("button",{onClick:()=>r("/org/dashboard"),className:"p-2 hover:bg-slate-700 rounded-lg transition-colors",children:(0,e.jsx)(ee,{className:"w-5 h-5 text-slate-400"})}),(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)("div",{className:"w-14 h-14 rounded-xl bg-gradient-to-br from-blue-500 to-purple-500 flex items-center justify-center text-white text-xl font-bold",children:i.displayName?.charAt(0)?.toUpperCase()||"?"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h1",{className:"text-2xl font-bold text-white",children:i.displayName}),(0,e.jsx)("p",{className:"text-sm text-slate-400",children:i.email})]})]})]})}),(0,e.jsxs)("div",{className:"p-6",children:[(0,e.jsx)(ve,{trader:i,orgSettings:t?.settings,currentOrg:t}),(0,e.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4 mb-6",children:[(0,e.jsx)(S,{label:"Total P&L",value:b(x(h.totalPnl)),icon:O,color:x(h.totalPnl)>=0?"green":"red"}),(0,e.jsx)(S,{label:"Win Rate",value:`${x(h.winRate).toFixed(1)}%`,icon:B,color:"blue"}),(0,e.jsx)(S,{label:"Total Trades",value:x(h.totalTrades),icon:_,color:"purple"}),(0,e.jsx)(S,{label:"Profit Factor",value:x(h.profitFactor).toFixed(2),icon:ce,color:"yellow"}),(0,e.jsx)(S,{label:"Max Drawdown",value:`${x(h.maxDrawdown).toFixed(1)}%`,icon:R,color:"red"}),(0,e.jsx)(S,{label:"Avg Trade",value:b(x(h.avgTrade)),icon:me,color:"blue"})]}),(0,e.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(0,e.jsxs)("div",{className:"lg:col-span-2 bg-slate-800 rounded-xl p-6 border border-slate-700",children:[(0,e.jsxs)("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[(0,e.jsx)(U,{className:"w-5 h-5 text-blue-400"}),"Equity Curve",j&&(0,e.jsx)("span",{className:"ml-2 text-xs text-slate-400 animate-pulse",children:"Loading..."})]}),(0,e.jsx)("div",{className:"h-64",children:j?(0,e.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,e.jsx)("div",{className:"w-6 h-6 border-2 border-blue-500/30 border-t-blue-500 rounded-full animate-spin"})}):(0,e.jsx)(De,{trades:D})})]}),(0,e.jsx)("div",{className:"lg:col-span-1",children:(0,e.jsx)(ye,{trader:i,orgSettings:t?.settings})})]}),(0,e.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mt-6",children:[(0,e.jsxs)("div",{className:"bg-slate-800 rounded-xl p-6 border border-slate-700",children:[(0,e.jsx)("h3",{className:"text-lg font-semibold text-white mb-4",children:"Performance Summary"}),(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex justify-between",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"Winning Trades"}),(0,e.jsx)("span",{className:"text-green-400 font-medium",children:x(h.winningTrades)})]}),(0,e.jsxs)("div",{className:"flex justify-between",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"Losing Trades"}),(0,e.jsx)("span",{className:"text-red-400 font-medium",children:x(h.losingTrades)})]}),(0,e.jsxs)("div",{className:"flex justify-between",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"Average Win"}),(0,e.jsx)("span",{className:"text-green-400 font-medium",children:b(h.avgWin)})]}),(0,e.jsxs)("div",{className:"flex justify-between",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"Average Loss"}),(0,e.jsx)("span",{className:"text-red-400 font-medium",children:b(h.avgLoss)})]}),(0,e.jsxs)("div",{className:"flex justify-between",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"Largest Win"}),(0,e.jsx)("span",{className:"text-green-400 font-medium",children:b(h.largestWin)})]}),(0,e.jsxs)("div",{className:"flex justify-between",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"Largest Loss"}),(0,e.jsx)("span",{className:"text-red-400 font-medium",children:b(h.largestLoss)})]})]})]}),(0,e.jsxs)("div",{className:"bg-slate-800 rounded-xl p-6 border border-slate-700",children:[(0,e.jsxs)("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[(0,e.jsx)(A,{className:"w-5 h-5 text-blue-400"}),"Activity"]}),(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex justify-between",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"Last Trade"}),(0,e.jsx)("span",{className:"text-white",children:C(h.lastTradeDate)?.toLocaleDateString()||"N/A"})]}),(0,e.jsxs)("div",{className:"flex justify-between",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"Trading Days"}),(0,e.jsxs)("span",{className:"text-white",children:[x(h.tradingDays)," days"]})]}),(0,e.jsxs)("div",{className:"flex justify-between",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"Joined"}),(0,e.jsx)("span",{className:"text-white",children:C(i.joinedAt)?.toLocaleDateString()||"N/A"})]}),(0,e.jsxs)("div",{className:"flex justify-between",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"Status"}),(0,e.jsx)("span",{className:`font-medium ${i.isActive?"text-green-400":"text-red-400"}`,children:i.isActive?"Active":"Suspended"})]})]})]})]}),t?.type==="prop_firm"&&s&&(0,e.jsx)("div",{className:"mt-6",children:(0,e.jsx)(we,{traderId:s,orgId:t.id})})]})]}):(0,e.jsx)("div",{className:"min-h-screen theme-page bg-[var(--bg-primary)] flex items-center justify-center p-8",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)(T,{className:"w-16 h-16 text-yellow-400 mx-auto mb-4"}),(0,e.jsx)("h1",{className:"text-2xl font-bold text-[var(--text-primary)] mb-2",children:"Trader Not Found"}),(0,e.jsx)("p",{className:"text-[var(--text-secondary)] mb-6",children:"The trader you're looking for doesn't exist."}),(0,e.jsx)("button",{onClick:()=>
1r("/org/dashboard"),className:"px-6 py-3 bg-blue-600 hover:bg-blue-500 text-white rounded-xl font-medium",children:"Back to Dashboard"})]})})};export{ke 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.