1import{j as e,C as ke,u as ne}from"./vendor-three-Bmn2g83e.js";import{u as Se,r as d,H as Ce,L as I}from"./vendor-react-kRHgybFd.js";import{u as Re}from"./main-D9e5nRIT.js";import{b as Te,P as O,s as Le}from"./brainBattleUtils-C1KA7W8Z.js";import{a as ee,d as te,ar as Me,a1 as Ae,Z as Be,aS as se,T as Ee,bt as _e,A as Pe,ag as $e,aX as ae,c as re,X as Ie,aR as Oe}from"./vendor-misc-DSUDoLcJ.js";function Xe({position:s,color:o,speed:r}){const i=d.useRef(),c=d.useMemo(()=>Math.random()*Math.PI*2,[]);return ne(({clock:p})=>{if(!i.current)return;const m=p.getElapsedTime()*r+c;i.current.position.y=s[1]+Math.sin(m*.5)*.8,i.current.position.x=s[0]+Math.cos(m*.35)*.4,i.current.rotation.x=m*.4,i.current.rotation.y=m*.6}),e.jsxs("mesh",{ref:i,position:s,children:[e.jsx("icosahedronGeometry",{args:[.18+Math.random()*.25,0]}),e.jsx("meshBasicMaterial",{color:o,wireframe:!0})]})}const le=["#7c3aed","#6366f1","#a855f7","#06b6d4","#22c55e","#f59e0b","#ec4899"];function qe(){const s=d.useRef();ne(({clock:r})=>{s.current&&(s.current.rotation.y=r.getElapsedTime()*.012)});const o=d.useMemo(()=>Array.from({length:22},(r,i)=>({id:i,pos:[(Math.random()-.5)*28,(Math.random()-.5)*14,(Math.random()-.5)*8-4],color:le[i%le.length],speed:.2+Math.random()*.55})),[]);return e.jsx("group",{ref:s,children:o.map(r=>e.jsx(Xe,{position:r.pos,color:r.color,speed:r.speed},r.id))})}function Fe(){return e.jsx(ke,{gl:{antialias:!0,alpha:!0,powerPreference:"low-power"},dpr:[1,1.5],camera:{fov:60,near:.1,far:80,position:[0,0,12]},style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:0},children:e.jsx(qe,{})})}const oe=[{name:"Unranked",badge:"â",min:0,color:"#6b7280"},{name:"Bronze",badge:"ð¥",min:150,color:"#b45309"},{name:"Silver",badge:"ð¥",min:1200,color:"#9ca3af"},{name:"Gold",badge:"ð",min:4500,color:"#eab308"},{name:"Platinum",badge:"ð ",min:12e3,color:"#06b6d4"},{name:"Diamond",badge:"ð",min:25e3,color:"#8b5cf6"},{name:"Master",badge:"ð¥",min:4e4,color:"#ef4444"},{name:"Legend",badge:"â¡",min:6e4,color:"#a855f7"}],k=[0,100,250,500,900,1400,2100,3e3,4200,5700,7500,9800,12500,15800,19800,24800,30800,38e3,47e3,58e3];function Ge(s){let o=oe[0];for(const r of oe)if(s>=r.min)o=r;else break;return o}function ce(s){let o=1;for(let r=0;r<k.length&&s>=k[r];r++)o=r+1;return o}function We(s){const o=ce(s),r=k[o-1]||0,i=k[o]||k[k.length-1]+1e4;return{lo:r,hi:i,pct:Math.min(100,(s-r)/(i-r)*100)}}const ze=[{p:0,badge:"",color:"#6b7280"},{p:1,badge:"â",color:"#eab308"},{p:2,badge:"ââ",color:"#f97316"},{p:3,badge:"ð«",color:"#a855f7"},{p:4,badge:"ð",color:"#06b6d4"},{p:5,badge:"ð",color:"#ec4899"}];function w(s,o){try{const r=localStorage.getItem(s);return r!=null?JSON.parse(r):o}catch{return o}}function Ue(){return w("sq_rating",1200)}function He(){return w("sq_best_streak",0)}function De(){try{return parseInt(localStorage.getItem("sq_prestige")||"0",10)}catch{return 0}}const u=[{id:"science",label:"Science",emoji:"ð¬"},{id:"math",label:"Math",emoji:"ð"},{id:"history",label:"History",emoji:"ð"},{id:"language",label:"Language",emoji:"ð"},{id:"tech",label:"Tech",emoji:"ð»"},{id:"general",label:"General",emoji:"ð"}],ie=[{name:"Novice",min:0,color:"#6b7280"},{name:"Learner",min:10,color:"#22c55e"},{name:"Adept",min:30,color:"#3b82f6"},{name:"Expert",min:60,color:"#a855f7"},{name:"Master",min:100,color:"#f59e0b"},{name:"Grandmaster",min:200,color:"#ec4899"}];function Ye(s){let o=ie[0];for(const r of ie)if(s>=r.min)o=r;else break;return o}function Ve({mastery:s}){const c=u.length,p=l=>l*2*Math.PI/c-Math.PI/2,m=(l,n)=>({x:90+Math.cos(p(l))*62*n,y:90+Math.sin(p(l))*62*n}),S=200,f=u.map(l=>Math.min((s[l.id]?.correct||0)/S,1)),b=f.map((l,n)=>m(n,Math.max(l,.04))),C=b.map((l,n)=>`${n===0?"M":"L"} ${l.x.toFixed(1)} ${l.y.toFixed(1)}`).join(" ")+" Z",j=[.25,.5,.75,1].map(l=>u.map((n,x)=>m(x,l)).map((n,x)=>`${x===0?"M":"L"} ${n.x.toFixed(1)} ${n.y.toFixed(1)}`).join(" ")+" Z");return e.jsxs("svg",{viewBox:"0 0 180 180",className:"w-full max-w-[200px] mx-auto",children:[j.map((l,n)=>e.jsx("path",{d:l,fill:"none",stroke:"rgba(255,255,255,0.05)",strokeWidth:"1"},n)),u.map((l,n)=>{const x=m(n,1);return e.jsx("line",{x1:90,y1:90,x2:x.x.toFixed(1),y2:x.y.toFixed(1),stroke:"rgba(255,255,255,0.07)",strokeWidth:"1"},n)}),e.jsx("path",{d:C,fill:"rgba(168,85,247,0.18)",stroke:"#a855f7",strokeWidth:"1.5",strokeLinejoin:"round"}),b.map((l,n)=>f[n]>.05&&e.jsx("circle",{cx:l.x.toFixed(1),cy:l.y.toFixed(1),r:"3",fill:"#a85
15f7"},n)),u.map((l,n)=>{const x=90+Math.cos(p(n))*80,N=90+Math.sin(p(n))*80;return e.jsx("text",{x:x.toFixed(1),y:N.toFixed(1),textAnchor:"middle",dominantBaseline:"middle",fontSize:"10",fill:"rgba(255,255,255,0.4)",children:l.emoji},n)})]})}function Ke({history:s}){const o=s.slice(0,20).reverse();return o.length===0?e.jsx("div",{className:"text-white/25 text-xs text-center py-4",children:"No battles yet"}):(100/Math.max(o.length,1),e.jsx("svg",{viewBox:`0 0 ${Math.max(o.length*12,80)} 36`,preserveAspectRatio:"none",className:"w-full h-9",children:o.map((r,i)=>{const c=r.result==="W",p=c?28:18,m=i*12;return e.jsxs("g",{children:[e.jsx("rect",{x:m+1,y:36-p,width:10,height:p,fill:c?"rgba(34,197,94,0.5)":"rgba(239,68,68,0.4)",rx:"2"}),r.achievements?.length>0&&e.jsx("circle",{cx:m+6,cy:36-p-4,r:"2.5",fill:"#eab308",opacity:"0.8"})]},i)})}))}const _=[{id:"SPEED_DEMON",emoji:"ð",name:"Speed Demon",color:"#06b6d4"},{id:"ON_FIRE",emoji:"ð¥",name:"On Fire",color:"#f97316"},{id:"LEGENDARY",emoji:"ð",name:"Legendary",color:"#a855f7",rare:!0},{id:"BOSS_SLAYER",emoji:"âï¸",name:"Boss Slayer",color:"#ef4444",rare:!0},{id:"SURGE_RIDER",emoji:"ðªï¸",name:"Surge Rider",color:"#f59e0b",rare:!0},{id:"CARD_SHARK",emoji:"ð",name:"Card Shark",color:"#8b5cf6"},{id:"DOMINATOR",emoji:"ð§©",name:"Dominator",color:"#fbbf24",rare:!0},{id:"PERFECT",emoji:"ð",name:"Perfect Game",color:"#10b981",rare:!0},{id:"CLUTCH",emoji:"â¡",name:"Clutch",color:"#eab308",rare:!0},{id:"COMEBACK",emoji:"ðª",name:"Comeback Kid",color:"#22c55e",rare:!0},{id:"UNSTOPPABLE",emoji:"ð",name:"Unstoppable",color:"#dc2626",rare:!0},{id:"HIGH_ROLLER",emoji:"ð°",name:"High Roller",color:"#f59e0b"},{id:"TURF_KING",emoji:"ðï¸",name:"Turf King",color:"#22c55e"},{id:"NEMESIS_SLAIN",emoji:"âï¸",name:"Nemesis Slayer",color:"#ef4444",rare:!0},{id:"SURVIVOR_20",emoji:"ð",name:"Survivor",color:"#7c3aed"},{id:"SURVIVOR_50",emoji:"ð±",name:"Apex Survivor",color:"#ec4899",rare:!0}];function Je(s){return s>=1600?"#ec4899":s>=1400?"#a855f7":s>=1250?"#06b6d4":s>=1100?"#22c55e":"#9ca3af"}function Ze(s){return s>=1600?"Grandmaster":s>=1400?"Elite":s>=1250?"Skilled":s>=1100?"Rising":"Novice"}function rt(){const{user:s,isAuthenticated:o}=Re(),r=Se(),i=w("sq_xp",0),c=Ge(i),p=ce(i),m=We(i),S=De(),f=ze[Math.min(S,5)],b=Ue(),C=He(),j=w("sq_mastery",{}),l=w("sq_unlocked_achievements",[]),n=w("sq_survival_best",0),x=w("sq_history",[]),N=x.filter(t=>t.result==="W").length,X=x.filter(t=>t.result==="L").length,R=x.length,P=R>0?Math.round(N/R*100):0;x.reduce((t,a)=>t+(a.xpGained||0),0);const de=R>0?Math.round(x.reduce((t,a)=>t+(a.score||0),0)/R):0,q=u.reduce((t,a)=>(j[a.id]?.correct||0)>(j[t.id]?.correct||0)?a:t,u[0]),$=u.some(t=>j[t.id]?.correct>0),M=Je(b),F=Ze(b),xe=["#6366f1","#8b5cf6","#ec4899","#f43f5e","#f97316","#eab308","#22c55e","#14b8a6","#0ea5e9","#fbbf24"],[T,me]=d.useState(()=>{try{return localStorage.getItem("sq_bio")||""}catch{return""}}),[v,he]=d.useState(()=>{try{return localStorage.getItem("sq_accent")||"#6366f1"}catch{return"#6366f1"}}),[G,W]=d.useState(!1),[pe,A]=d.useState(""),be=d.useCallback(async()=>{W(!0),A("");try{const t=localStorage.getItem("token");t&&await ee.post("/api/gamification/v2/profile/customize",{bio:T,accentColor:v},{headers:{Authorization:`Bearer ${t}`}}),localStorage.setItem("sq_bio",T),localStorage.setItem("sq_accent",v),A("Saved!"),setTimeout(()=>A(""),2e3)}catch{A("Save failed.")}finally{W(!1)}},[T,v]),[y,ue]=d.useState(()=>{try{return JSON.parse(localStorage.getItem("sq_showcase")||"[]")}catch{return[]}}),[B,z]=d.useState(!1),[U,H]=d.useState(!1),D=d.useCallback(async t=>{H(!0);try{const a=localStorage.getItem("token");a&&await ee.post("/api/gamification/v2/showcase/set",{achievements:t},{headers:{Authorization:`Bearer ${a}`}}),localStorage.setItem("sq_showcase",JSON.stringify(t)),ue(t)}catch{}finally{H(!1),z(!1)}},[]),[ge,E]=d.useState(!1),[fe,Y]=d.useState(!1),L=`ð§ Brain Battle Stats on ScholarNet! 2ð ${N}W / ${X}L (${P}% win rate) 3â¡ ${i.toLocaleString()} XP · ${c.badge} ${c.name} 4ð¥ Best Streak: ${C} 5 6Challenge me â https://scholar.0xpi.com/brain-battles`,je=d.useCallback(()=>{navigator.clipboard.writeText(L).then(()=>{Y(!0),setTimeout(()=>Y(!1),2e3)})},[L]),ve=d.useCallback(()=>{const t=`https://twitter.com/intent/tweet?text=${encodeURIComponent(L)}`;window.open(t,"_blank","noopener,noreferrer")},[L]),[V,we]=d.useState(()=>{try{return localStorage.getItem("sq_active_title")||"newcomer"}catch{return"newcomer"}}),[K,J]=d.useState(!1),Z=Te(),Ne=t=>{Le(t),we(t),J(!1)},Q=O.find(t=>
6t.id===V)||O[0],ye=[{icon:te,label:"Wins",value:N,color:"text-yellow-400"},{icon:Me,label:"Losses",value:X,color:"text-red-400"},{icon:Ae,label:"Win Rate",value:`${P}%`,color:"text-emerald-400"},{icon:Be,label:"Total XP",value:i.toLocaleString(),color:"text-purple-400"},{icon:se,label:"Best Streak",value:`${C}ð¥`,color:"text-orange-400"},{icon:Ee,label:"Avg Score",value:de,color:"text-blue-400"},{icon:_e,label:"Battles",value:R,color:"text-white/70"},{icon:Pe,label:"Rating",value:b,color:"text-pink-400"}];return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-purple-950 to-slate-900 relative",style:{background:"linear-gradient(135deg, #0f172a 0%, #1e1040 50%, #0f172a 100%)"},children:[e.jsxs(Ce,{children:[e.jsx("title",{children:"Brain Battle Stats â Track Your Quiz Performance | ScholarNet AI"}),e.jsx("meta",{name:"description",content:"View your Brain Battle statistics: win rate, XP, level, subject mastery, and achievement history. Free AI-powered quiz game for students."}),e.jsx("link",{rel:"canonical",href:"https://scholar.0xpi.com/brain-battles/stats"}),e.jsx("meta",{property:"og:title",content:"Brain Battle Stats | ScholarNet AI"}),e.jsx("meta",{property:"og:description",content:"Track your quiz performance, XP, and subject mastery in Brain Battles."}),e.jsx("meta",{property:"og:url",content:"https://scholar.0xpi.com/brain-battles/stats"}),e.jsx("meta",{property:"og:type",content:"website"}),e.jsx("meta",{property:"og:image",content:"https://scholar.0xpi.com/og-image.jpg"}),e.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),e.jsx("meta",{name:"twitter:title",content:"Brain Battle Stats | ScholarNet AI"}),e.jsx("meta",{name:"twitter:description",content:"Track your quiz performance and XP in Brain Battles."})]}),e.jsx(Fe,{}),e.jsxs("div",{className:"relative z-10 max-w-2xl mx-auto px-4 py-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("button",{onClick:()=>r("/brain-battles"),className:"p-2 bg-slate-700/40 border border-white/25 rounded-xl text-white/50 hover:text-white hover:bg-slate-800/80 transition-all",children:e.jsx($e,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h1",{className:"text-white font-black text-xl",children:"Battle Stats"}),e.jsx("p",{className:"text-white/60 text-xs mt-0.5",children:"Your complete battle profile"})]}),e.jsx("button",{onClick:()=>E(!0),className:"flex items-center gap-1.5 px-3 py-2 bg-slate-700/40 border border-white/25 text-white/50 text-sm font-bold rounded-xl hover:bg-slate-800/80 hover:text-white/80 transition-all",children:e.jsx(ae,{className:"w-3.5 h-3.5"})}),e.jsxs(I,{to:"/brain-battles",className:"flex items-center gap-1.5 px-4 py-2 bg-purple-600/30 border border-purple-500/40 text-purple-300 text-sm font-bold rounded-xl hover:bg-purple-600/50 transition-all",children:[e.jsx(re,{className:"w-3.5 h-3.5"})," Battle"]})]}),e.jsx("div",{className:"bg-slate-800/25 border border-white/25 rounded-2xl p-5 mb-4",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center text-2xl flex-shrink-0",style:{background:`${c.color}18`,border:`1.5px solid ${c.color}40`},children:c.badge}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-white font-black text-lg",children:s?.firstName||s?.username||"Warrior"}),S>0&&e.jsxs("span",{className:"text-xs px-1.5 py-0.5 rounded-full font-bold",style:{background:`${f.color}18`,border:`1px solid ${f.color}40`,color:f.color},children:[f.badge," Prestige ",S]}),c.name!=="Unranked"&&e.jsxs("span",{className:"text-xs px-1.5 py-0.5 rounded-full font-bold",style:{background:`${c.color}18`,border:`1px solid ${c.color}40`,color:c.color},children:[c.badge," ",c.name]})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 flex-wrap",children:[e.jsxs("span",{className:"text-white/50 text-xs",children:["Lv.",p]}),e.jsx("span",{className:"text-white/60 text-xs",children:"·"}),e.jsxs("span",{className:"text-white/50 text-xs",children:[i.toLocaleStr
6ing()," XP"]}),e.jsx("span",{className:"text-white/60 text-xs",children:"·"}),e.jsxs("span",{className:"text-xs font-bold",style:{color:M},children:[b," (",F,")"]})]}),e.jsx("div",{className:"mt-2 h-1.5 bg-slate-800/40 rounded-full overflow-hidden w-full max-w-xs",children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${m.pct}%`,background:c.color}})}),e.jsxs("div",{className:"text-white/25 text-[10px] mt-0.5",children:[i-m.lo," / ",m.hi-m.lo," XP to Lv.",p+1]})]})]})}),e.jsxs("div",{className:"bg-slate-800/20 border border-white/25 rounded-2xl p-4 mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{style:{color:Q.color},className:"font-black text-sm",children:["⦠",Q.label]}),e.jsx("span",{className:"text-white/25 text-xs",children:"· Active Title"})]}),e.jsx("button",{onClick:()=>J(t=>!t),className:"text-xs text-white/60 hover:text-white border border-white/25 hover:border-white/20 px-2.5 py-1 rounded-lg transition-colors",children:K?"Close":`Change (${Z.length} unlocked)`})]}),K&&e.jsx("div",{className:"grid grid-cols-2 gap-1.5 max-h-48 overflow-y-auto pr-1",children:O.map(t=>{const a=!!Z.find(g=>g.id===t.id),h=t.id===V;return e.jsxs("button",{disabled:!a,onClick:()=>Ne(t.id),className:`text-left px-3 py-2 rounded-xl text-xs font-semibold transition-all border ${h?"border-white/30 bg-slate-800/80":a?"border-white/8 bg-slate-800/15 hover:bg-slate-700/50":"border-white/4 bg-slate-800/10 opacity-35 cursor-not-allowed"}`,style:{color:a?t.color:"#ffffff30"},title:a?"":"Locked",children:[h&&"â ",t.label,!a&&e.jsx("span",{className:"text-white/50 ml-1",children:"ð"})]},t.id)})})]}),e.jsx("div",{className:"grid grid-cols-4 gap-2 mb-4",children:ye.map(({icon:t,label:a,value:h,color:g})=>e.jsxs("div",{className:"bg-slate-800/20 border border-white/8 rounded-xl p-2.5 text-center",children:[e.jsx(t,{className:`w-3.5 h-3.5 mx-auto mb-1 ${g}`}),e.jsx("div",{className:`font-black text-sm ${g}`,children:h}),e.jsx("div",{className:"text-white/60 text-[9px]",children:a})]},a))}),x.length>0&&e.jsxs("div",{className:"bg-slate-800/20 border border-white/8 rounded-2xl p-4 mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"text-white/60 text-xs font-semibold uppercase tracking-wider",children:"Battle History"}),e.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[e.jsxs("span",{className:"flex items-center gap-1 text-emerald-400/80",children:[e.jsx("span",{className:"w-2.5 h-2.5 bg-emerald-500/50 rounded-sm inline-block"})," Win"]}),e.jsxs("span",{className:"flex items-center gap-1 text-red-400/80",children:[e.jsx("span",{className:"w-2.5 h-2.5 bg-red-500/40 rounded-sm inline-block"})," Loss"]}),e.jsx("span",{className:"flex items-center gap-1 text-yellow-400/60",children:"â Ach"})]})]}),e.jsx(Ke,{history:x}),e.jsxs("div",{className:"flex justify-between mt-2 text-[10px] text-white/25",children:[e.jsx("span",{children:"Oldest"}),e.jsx("span",{children:"Latest"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[e.jsxs("div",{className:"bg-slate-800/20 border border-white/8 rounded-2xl p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("div",{className:"text-white/60 text-xs font-semibold uppercase tracking-wider",children:"Mastery"}),$&&e.jsxs("div",{className:"text-white/60 text-[10px]",children:[q.emoji," ",q.label]})]}),$?e.jsx(Ve,{mastery:j}):e.jsx("div",{className:"text-white/25 text-xs text-center py-4",children:"Play battles to build mastery"}),$&&e.jsx("div",{className:"grid grid-cols-3 gap-1 mt-1",children:u.map(t=>{const a=j[t.id]?.correct||0,h=Ye(a);return e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-[8px] text-white/25 truncate",children:t.label}),e.jsx("div",{className:"text-[8px] font-bold",style:{color:h.color},children:h.name})]},t.id)})})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"bg-slate-800/20 border border-white/8 rounded-2xl p-4 flex-1",children:[e.jsx("div",{className:"text-white/60 text-xs font-semibold uppercase tracking-wider mb-3",children:"Ranked Rating"}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-5xl font-black mb-1",style:{color:M},children:b}),e.jsx("div",{className:"text-xs font-bold mb-3",style:{color:M},children:F}),e.jsx("div",{className:"h-1.5 bg-slate-800/40 rounded-full overflow-hidden mb-1",children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Math.min(100,Math.max(0,(b-1e3)/10))}%`,background:M}})}),e.jsx("div",{className:"text-white/25 text-[9px]",children:"1000 · · · · · 2000"})]})]}),n>0&&e.jsxs("div",{className:"bg-purple-900/20 border border-purple-500/20 rounded-2xl p-3",children:[e.jsx("div",{className:"text-white/50 text-[10px] uppercase tracking-wider mb-1",children:"Survival Record"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl",children:"ð"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white font-black text-xl",children:n}),e.jsx("div",{className:"text-white/35 text-[10px]",children:"questions survived"})]})]})]})]})]}),e.jsxs("div",{className:"bg-slate-800/20 border border-white/8 rounded-2xl p-4 mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"text-white/60 text-xs font-semibold uppercase tracking-wider",children:"Achievements"}),e.jsxs("div",{className:"text-white/60 text-xs",children:[l.length,"/",_.length]})]}),l.length===0?e.jsx("p",{className:"text-white/25 text-xs text-center py-2",children:"Battle to earn achievements"}):e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[..._].sort((t,a)=>{const h=l.includes(t.id),g=l.includes(a.id);return h===g?0:h?-1:1}).map(t=>{const a=l.includes(t.id);return e.jsxs("div",{className:`flex items-center gap-1 px-2 py-1 rounded-lg text-[10px] font-bold ${a?"opacity-100":"opacity-40 grayscale"}`,style:a?{background:`${t.color}18`,border:`1px solid ${t.color}40`,color:t.color}:{background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.08)",color:"rgba(255,255,255,0.3)"},children:[t.emoji," ",t.name,t.rare&&a&&e.jsx("span",{className:"text-yellow-400 text-[7px] ml-0.5",children:"â¨"})]},t.id)})})]}),e.jsxs("div",{className:"bg-slate-800/20 border border-white/8 rounded-2xl p-4 mb-4",children:[e.jsx("div",{className:"text-white/60 text-xs font-semibold uppercase tracking-wider mb-3",children:"ð¨ Profile Customization"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-white/60 text-[10px] uppercase tracking-wider block mb-1",children:"Bio"}),e.jsx("textarea",{value:T,onChange:t=>me(t.target.value.slice(0,160)),placeholder:"Tell the community about yourself...",rows:2,className:"w-full px-3 py-2 bg-black/30 border border-white/25 rounded-xl text-white/80 text-xs placeholder-white/50 focus:outline-none focus:border-white/20 resize-none"}),e.jsxs("p",{className:"text-white/50 text-[9px] mt-0.5 text-right",children:[T.length,"/160"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-white/60 text-[10px] uppercase tracking-wider block mb-2",children:"Accent Color"}),e.jsx("div",{className:"flex gap-1.5 flex-wrap",children:xe.map(t=>e.jsx("button",{onClick:()=>he(t),className:"w-7 h-7 rounded-full border-2 transition-all hover:scale-110",style:{background:t,borderColor:v===t?"#fff":"transparent"}},t))})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-xs font-bold px-3 py-1.5 rounded-lg",style:{background:v+"25",color:v,border:`1px solid ${v}40`},children:"Preview"}),e.jsx("button",{onClick:be,disabled:G,className:"px-4 py-1.5 bg-slate-800/80 hover:bg-slate-800/60 text-white text-xs font-bold rounded-xl transition-all disabled:opacity-50",children:G?"Saving...":pe||"Save Profile"})]})]})]}),l.length>0&&e.jsxs("div",{className:"bg-slate-800/20 border border-purple-500/20 rounded-2xl p-4 mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"text-purple-300/70 text-xs font-semibold uppercase tracking-wider",children:"ð Showcase (pinned to profile)"}),e.jsx("button",{onClick:()=>z(t=>!t),className:"text-purple-400/60 hover:text-purple-400 text-xs font-bold transition-colors",children:B?"Done":"Edit"})]}),e.jsxs("div",{className:"flex gap-2 flex-wrap mb-2",children:[y.length===0&&!B&&e.jsx("p",{className:"text-white/50 text-xs",children:"No achievements pinned â click Edit to choose up to 3"}),y.map(t=>{const a=_.find(h=>h.id===t);return a?e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-xs font-bold",style:{background:`${a.color}18`,border:`1px solid ${a.color}40`,color:a.color},children:[a.emoji," ",a.name,B&&e.jsx("button",{onClick:()=>D(y.filter(h=>h!==t)),className:"ml-1 text-white/60 hover:text-white/70",children:"Ã"})]},t):null})]}),B&&e.jsxs("div",{className:"mt-2 max-h-40 overflow-y-auto space-y-1 pr-1",children:[e.jsx("p",{className:"text-white/60 text-[10px] mb-2",children:"Pick up to 3 earned achievements to pin:"}),_.filter(t=>l.includes(t.id)&&!y.includes(t.id)).map(t=>e.jsxs("button",{disabled:y.length>=3||U,onClick:()=>D([...y,t.id]),className:"flex items-center gap-2 w-full px-2 py-1.5 rounded-lg text-xs font-bold transition-all hover:opacity-80 disabled:opacity-50",style:{background:`${t.color}12`,border:`1px solid ${t.color}30`,color:t.color},children:[t.emoji," ",t.name,t.rare&&e.jsx("span",{className:"text-yellow-400 text-[7px]",children:"⨠RARE"})]},t.id)),U&&e.jsx("p",{className:"text-white/60 text-xs text-center",children:"Saving..."})]})]}),x.length>0&&e.jsxs("div",{className:"bg-slate-800/20 border border-white/8 rounded-2xl p-4 mb-6",children:[e.jsx("div",{className:"text-white/60 text-xs font-semibold uppercase tracking-wider mb-3",children:"Recent Battles"}),e.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto pr-1",children:x.slice(0,15).map((t,a)=>e.jsxs("div",{className:`flex items-center gap-2.5 px-3 py-2 rounded-xl text-xs ${t.result==="W"?"bg-emerald-500/8 border border-emerald-500/15":"bg-red-500/6 border border-red-500/12"}`,children:[e.jsx("span",{className:`text-sm font-black flex-shrink-0 ${t.result==="W"?"text-emerald-400":"text-red-400"}`,children:t.result}),e.jsx("span",{className:"text-white/50 flex-shrink-0",children:t.subject||"General"}),e.jsx("span",{className:"flex-1"}),e.jsxs("span",{className:"text-white/60",children:[t.score?.toLocaleStr
6ing()," pts"]}),t.xpGained>0&&e.jsxs("span",{className:"text-purple-400 flex-shrink-0",children:["+",t.xpGained,"XP"]}),e.jsx("div",{className:"flex gap-0.5 flex-shrink-0",children:(t.achievements||[]).map((h,g)=>e.jsx("span",{className:"text-xs",children:h},g))})]},a))})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 justify-center",children:[e.jsxs(I,{to:"/brain-battles",className:"flex items-center gap-2 px-6 py-3 bg-gradient-to-r from-purple-600 to-blue-600 text-white font-bold rounded-xl hover:scale-105 transition-all",children:[e.jsx(re,{className:"w-4 h-4"})," Find a Battle"]}),e.jsxs(I,{to:"/brain-battles/leaderboard",className:"flex items-center gap-2 px-6 py-3 bg-slate-800/40 border border-white/25 text-white/70 font-bold rounded-xl hover:bg-slate-700/60 transition-all",children:[e.jsx(te,{className:"w-4 h-4"})," Leaderboard"]}),e.jsxs("button",{onClick:()=>E(!0),className:"flex items-center gap-2 px-6 py-3 bg-slate-800/30 border border-white/25 text-white/60 font-bold rounded-xl hover:bg-slate-800/80 hover:text-white/80 transition-all",children:[e.jsx(ae,{className:"w-4 h-4"})," Share"]})]})]}),ge&&e.jsx("div",{className:"fixed inset-0 bg-black/70 z-50 flex items-center justify-center p-4",onClick:t=>{t.target===t.currentTarget&&E(!1)},children:e.jsxs("div",{className:"relative w-full max-w-sm bg-gradient-to-br from-slate-900 via-purple-950 to-slate-900 border border-purple-500/30 rounded-2xl p-6 shadow-2xl",children:[e.jsx("button",{onClick:()=>E(!1),className:"absolute top-4 right-4 p-1.5 bg-slate-700/40 hover:bg-slate-800/80 rounded-lg text-white/60 hover:text-white/70 transition-all",children:e.jsx(Ie,{className:"w-4 h-4"})}),e.jsx("h3",{className:"text-white font-black text-lg mb-1",children:"Share Your Stats"}),e.jsx("p",{className:"text-white/60 text-xs mb-5",children:"Challenge others or show off your rank"}),e.jsxs("div",{className:"bg-black/40 border border-purple-500/20 rounded-2xl p-4 mb-5 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center text-2xl flex-shrink-0",style:{background:`${c.color}18`,border:`1.5px solid ${c.color}40`},children:c.badge}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white font-black text-base",children:c.name}),e.jsxs("div",{className:"text-white/60 text-xs",children:[i.toLocaleString()," XP total"]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-emerald-400 text-lg font-black",children:N}),e.jsx("div",{className:"text-white/60 text-[10px]",children:"Wins"})]}),e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"text-yellow-400 text-lg font-black",children:[P,"%"]}),e.jsx("div",{className:"text-white/60 text-[10px]",children:"Win Rate"})]}),e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"text-orange-400 text-lg font-black",children:[C,"ð¥"]}),e.jsx("div",{className:"text-white/60 text-[10px]",children:"Best Streak"})]})]}),e.jsx("div",{className:"text-white/50 text-[10px] text-center border-t border-white/20 pt-2",children:"scholar.0xpi.com/brain-battles"})]}),e.jsx("div",{className:"bg-slate-800/15 border border-white/8 rounded-xl p-3 mb-4 text-white/60 text-xs font-mono leading-relaxed whitespace-pre-wrap",children:L}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:je,className:"flex-1 flex items-center justify-center gap-2 px-4 py-2.5 bg-slate-800/40 hover:bg-slate-700/60 border border-white/25 text-white/70 text-sm font-bold rounded-xl transition-all",children:[e.jsx(Oe,{className:"w-3.5 h-3.5"}),fe?"Copied!":"Copy"]}),e.jsxs("button",{onClick:ve,className:"flex-1 flex items-center justify-center gap-2 px-4 py-2.5 bg-sky-500/20 hover:bg-sky-500/30 border border-sky-500/30 text-sky-300 text-sm font-bold rounded-xl transition-all",children:[e.jsx(se,{className:"w-3.5 h-3.5"}),"Tweet"]})]})]})})]})}export{rt 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.