1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c5864032-e342-4bd7-8a89-d993d6d6e7e1",e._sentryDebugIdIdentifier="sentry-dbid-c5864032-e342-4bd7-8a89-d993d6d6e7e1")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5301],{75301:(e,t,s)=>{s.d(t,{A:()=>x});var n=s(95155),i=s(12115),l=s(83553),a=s(71243),r=s(83657);function c(e,t){return e.userA===t?e.userB:e.userA}let d=["#6366f1","#8b5cf6","#ec4899","#06b6d4","#10b981","#f59e0b","#ef4444"];function o(e){let{id:t,handle:s}=e,i=s?s[0].toUpperCase():t.slice(-2).toUpperCase();return(0,n.jsx)("div",{className:"w-9 h-9 rounded-full flex items-center justify-center text-sm font-bold text-white shrink-0",style:{background:function(e){let t=0;for(let s=0;s<e.length;s++)t=(t<<5)-t+e.charCodeAt(s);return d[Math.abs(t)%d.length]}(t)},children:i})}function x(e){var t,s;let{inPanel:d=!1}=e,{token:x,userId:h}=(0,l.As)(),m=null!=h?String(h):null,[u,p]=(0,i.useState)(null),[f,j]=(0,i.useState)(""),[w,g]=(0,i.useState)(""),[b,v]=(0,i.useState)(!1),[N,y]=(0,i.useState)(!1),[k,C]=(0,i.useState)(""),[S,M]=(0,i.useState)([]),[I,_]=(0,i.useState)(!1),[E,L]=(0,i.useState)({incoming:[],outgoing:[]}),[F,B]=(0,i.useState)({items:[],total:0,page:1,limit:20,totalPages:0}),[A,z]=(0,i.useState)(new Map),[P,D]=(0,i.useState)(""),[W,H]=(0,i.useState)(!0),[R,T]=(0,i.useState)(null),[K,U]=(0,i.useState)(null),[q,X]=(0,i.useState)(!1),G=(0,i.useCallback)(async()=>{if(!x)return;let[e,t,s]=await Promise.all([(0,a.Rn)(x),(0,a.sC)(x),(0,a.iR)(1,20,x)]);p(e),L(t),B(s)},[x]);async function J(){if(x&&f.trim()){g(""),v(!0);try{let e=await (0,a.RK)(f.trim(),x);p(e),j("")}catch(e){g(e instanceof Error?e.message:"Failed to claim handle")}finally{v(!1)}}}async function Q(){x&&!(k.trim().length<2)&&(_(!0),M((await (0,a.IJ)(k.trim(),x)).filter(e=>e.userId!==m)),_(!1))}async function V(e){if(x){D("");try{await (0,a.sendFriendRequest)(e,x),M([]),C(""),await G()}catch(e){D(e instanceof Error?e.message:"Failed to send request")}}}async function Y(e,t){if(x){D("");try{await (0,a.KK)(e,t,x),await G()}catch(e){D(e instanceof Error?e.message:"Failed to respond")}}}async function O(e){if(x)try{await (0,a.eY)(e,x),await G()}catch(e){}}async function Z(e){if(x)try{await (0,a.zb)(e,x),await G()}catch(e){}}async function $(e,t){T({userId:e,handle:t}),U(null),X(!0),U(await (0,r.kQ)(e,x)),X(!1)}return((0,i.useEffect)(()=>{H(!0),G().finally(()=>H(!1))},[G]),(0,i.useEffect)(()=>{x&&0!==F.items.length&&m&&Promise.all(F.items.map(e=>c(e,m)).map(async e=>{let t=await (0,a.getHandleByUserId)(e,x);return[e,null==t?void 0:t.handle]})).then(e=>{z(t=>{let s=new Map(t);return e.forEach(e=>{let[t,n]=e;n&&s.set(t,n)}),s})})},[F.items,x,m]),(0,i.useEffect)(()=>{x&&0!==E.incoming.length&&Promise.all(E.incoming.map(async e=>{let t=await (0,a.getHandleByUserId)(e.initiatorId,x);return[e.initiatorId,null==t?void 0:t.handle]})).then(e=>{z(t=>{let s=new Map(t);return e.forEach(e=>{let[t,n]=e;n&&s.set(t,n)}),s})})},[E.incoming,x]),W)?(0,n.jsx)("div",{className:"flex flex-col text-white items-center justify-center ".concat(d?"flex-1":"min-h-screen bg-[#0d0f18]"),children:(0,n.jsx)("div",{className:"w-5 h-5 rounded-full border-2 border-white/20 border-t-white/60 animate-spin"})}):(0,n.jsxs)("div",{className:"flex flex-col text-white ".concat(d?"pb-4":"min-h-screen bg-[#0d0f18] pb-24"),children:[(0,n.jsx)("div",{className:"px-4 pt-6 pb-4",children:(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:"w-9 h-9 rounded-2xl bg-violet-500/20 flex items-center justify-center shrink-0",children:(0,n.jsxs)("svg",{className:"h-5 w-5 text-violet-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),(0,n.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,n.jsx)("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),(0,n.jsx)("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-lg font-bold leading-tight",children:"Friends"}),(0,n.jsx)("p",{className:"text-white/40 text-xs",children:F.total>0?"".concat(F.total," connected"):"Connect with others"})]})]})}),(0,n.jsx)("section",{className:"mx-4 mb-3",children:(0,n.jsxs)("div",{className:"bg-white/5 border border-white/[0.08] rounded-2xl p-4",children:[(0,n.jsx)("p",{className:"text-[11px] font-semibold text-white/40 uppercase tracking-wider mb-3",children:"My Handle"}),u?(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,n.jsx)(o,{id:null!=m?m:"",handle:u.handle}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsxs)("p",{className:"font-mono font-semibold text-white truncate",children:["@",u.handle]}),(0,n.jsx)("p",{className:"text-white/30 text-xs mt-0.5",children:"Share so others can find you"})]})]}),(0,n.jsx)("button",{onClick:function(){u&&(navigator.clipboard.writeText("@".concat(u.handle)),y(!0),setTimeout(()=>y(!1),2e3))},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-white/[0.08] hover:bg-white/[0.12] text-xs text-white/60 hover:text-white transition-colors shrink-0",children:N?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("svg",{className:"h-3.5 w-3.5 text-green-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"M20 6L9 17l-5-5"})}),(0,n.jsx)("span",{className:"text-green-400",children:"Copied"})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,n.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy"]})})]}):(0,n.jsxs)("div",{className:"space-y-2.5",children:[(0,n.jsx)("p",{className:"text-white/50 text-xs",children:"Claim a handle so others can find and add you."}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)("div",{className:"relative flex-1",children:[(0,n.jsx)("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-white/30 text-sm font-mono pointer-events-none",children:"@"}),(0,n.jsx)("input",{type:"text",value:f,onChange:e=>j(e.target.value.toLowerCase().replace(/[^a-z0-9_]/g,"")),onKeyDown:e=>"Enter"===e.key&&J(),placeholder:"your_handle",className:"w-full bg-white/[0.08] rounded-xl pl-7 pr-3 py-2 text-sm text-white placeholder-white/25 outline-none focus:ring-1 focus:ring-violet-500/50 font-mono"})]}),(0,n.jsx)("button",{onClick:J,disabled:b||!f.trim(),className:"px-4 py-2 rounded-xl bg-violet-600 hover:bg-violet-500 disabled:opacity-40 text-sm font-semibold transition-colors shrink-0",children:b?"...":"Claim"})]}),w&&(0,n.jsx)("p",{className:"text-red-400 text-xs",children:w})]})]})}),(0,n.jsx)("section",{className:"mx-4 mb-3",children:(0,n.jsxs)("div",{className:"bg-white/5 border border-white/[0.08] rounded-2xl p-4",children:[(0,n.jsx)("p",{className:"text-[11px] font-semibold text-white/40 uppercase tracking-wider mb-3",children:"Add Friend"}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)("div",{className:"relative flex-1",children:[(0,n.jsx)("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-white/30 text-sm pointer-events-none",children:"@"}),(0,n.jsx)("input",{type:"text",value:k,onChange:e=>C(e.target.value),onKeyDown:e=>"Enter"===e.key&&Q(),placeholder:"search handle...",className:"w-full bg-white/[0.08] rounded-xl pl-7 pr-3 py-2 text-sm text-white placeholder-white/25 outline-none focus:ring-1 focus:ring-violet-500/50"})]}),(0,n.jsx)("button",{onClick:Q,disabled:I||k.trim().length<2,className:"px-3 py-2 rounded-xl bg-white/[0.08] hover:bg-white/[0.12] disabled:opacity-40 transition-colors shrink-0",children:I?(0,n.jsx)("div",{className:"w-4 h-4 rounded-full border-2 border-white/20 border-t-white/60 animate-spin"}):(0,n.jsxs)("svg",{className:"h-4 w-4 text-white/60",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,n.jsx)("path",{d:"M21 21l-4.35-4.35"})]})})]}),S.length>0&&(0,n.jsx)("div",{className:"mt-3 space-y-2",children:S.map(e=>(0,n.jsxs)("div",{className:"flex items-center justify-between bg-white/5 rounded-xl px-3 py-2.5",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,n.jsx)(o,{id:e.userId,handle:e.handle}),(0,n.jsxs)("span",{className:"font-mono text-sm text-white",children:["@",e.handle]})]}),(0,n.jsxs)("button",{onClick:()=>V(e.handle),className:"flex items-center gap-1 text-xs px-3 py-1.5 rounded-xl bg-violet-600 hover:bg-violet-500 font-medium transition-colors",children:[(0,n.jsx)("svg",{className:"h-3 w-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:(0,n.jsx)("path",{d:"M12 5v14M5 12h14"})}),"Add"]})]}
1,e.userId))}),P&&(0,n.jsx)("p",{className:"text-red-400 text-xs mt-2",children:P})]})}),(E.incoming.length>0||E.outgoing.length>0)&&(0,n.jsx)("section",{className:"mx-4 mb-3",children:(0,n.jsxs)("div",{className:"bg-white/5 border border-white/[0.08] rounded-2xl p-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,n.jsx)("p",{className:"text-[11px] font-semibold text-white/40 uppercase tracking-wider",children:"Requests"}),E.incoming.length>0&&(0,n.jsx)("span",{className:"bg-violet-600 text-white text-[10px] font-bold px-1.5 py-0.5 rounded-full leading-none",children:E.incoming.length})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[E.incoming.map(e=>{let t=A.get(e.initiatorId);return(0,n.jsxs)("div",{className:"flex items-center justify-between bg-white/5 rounded-xl px-3 py-2.5",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,n.jsx)(o,{id:e.initiatorId,handle:t}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"text-sm font-medium truncate",children:t?"@".concat(t):"#".concat(e.initiatorId.slice(-6))}),(0,n.jsx)("p",{className:"text-[11px] text-white/30",children:"wants to connect"})]})]}),(0,n.jsxs)("div",{className:"flex gap-1.5 shrink-0",children:[(0,n.jsx)("button",{onClick:()=>Y(e._id,"accept"),className:"text-xs px-3 py-1.5 rounded-xl bg-green-600 hover:bg-green-500 font-medium transition-colors",children:"Accept"}),(0,n.jsx)("button",{onClick:()=>Y(e._id,"reject"),className:"text-xs px-3 py-1.5 rounded-xl bg-white/[0.08] hover:bg-white/[0.12] transition-colors",children:"Decline"})]})]},e._id)}),E.outgoing.map(e=>{let t=m===e.userA?e.userB:e.userA,s=A.get(t);return(0,n.jsxs)("div",{className:"flex items-center justify-between bg-white/5 rounded-xl px-3 py-2.5",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,n.jsx)(o,{id:t,handle:s}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-white/70 truncate",children:s?"@".concat(s):"#".concat(t.slice(-6))}),(0,n.jsx)("p",{className:"text-[11px] text-white/30",children:"request sent"})]})]}),(0,n.jsx)("button",{onClick:()=>O(e._id),className:"text-xs px-3 py-1.5 rounded-xl bg-white/[0.08] hover:bg-red-900/40 hover:text-red-400 transition-colors shrink-0",children:"Cancel"})]},e._id)})]})]})}),R&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"fixed inset-0 z-50 bg-black/60",onClick:()=>T(null)}),(0,n.jsxs)("div",{className:"fixed inset-x-4 top-1/2 -translate-y-1/2 z-50 rounded-2xl bg-[#181920] border border-white/[0.08] p-5 max-w-sm mx-auto",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:"h-10 w-10 rounded-full bg-violet-500/20 flex items-center justify-center text-violet-300 font-bold text-lg",children:null!=(s=null==(t=R.handle[0])?void 0:t.toUpperCase())?s:"?"}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("p",{className:"text-white font-bold",children:["@",R.handle]}),K&&(0,n.jsxs)("p",{className:"text-white/40 text-xs",children:[K.totalGames," games played"]})]})]}),(0,n.jsx)("button",{onClick:()=>T(null),className:"text-white/30 hover:text-white/60 text-xl",children:"\xd7"})]}),q?(0,n.jsx)("div",{className:"flex justify-center py-6",children:(0,n.jsx)("div",{className:"h-5 w-5 rounded-full border-2 border-violet-400 border-t-transparent animate-spin"})}):K?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 rounded-xl bg-white/[0.04] mb-3",children:[(0,n.jsx)("span",{className:"text-white/50 text-sm",children:"Total XP"}),(0,n.jsxs)("span",{className:"text-violet-400 font-bold",children:[K.totalXp," XP"]})]}),(0,n.jsx)("div",{className:"grid grid-cols-2 gap-2",children:[{type:"trivia",label:"\uD83E\uDDE0 Trivia"},{type:"word",label:"\uD83D\uDCDD Word"},{type:"memory",label:"\uD83C\uDCCF Memory"},{type:"puzzle",label:"\uD83E\uDDE9 Puzzle"}].map(e=>{let t=K.perGame[e.type];return(0,n.jsxs)("div",{className:"px-3 py-2.5 rounded-xl bg-white/[0.04]",children:[(0,n.jsx)("p",{className:"text-white/40 text-xs mb-0.5",children:e.label}),t?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("p",{className:"text-white text-sm font-semibold",children:[t.score," pts"]}),(0,n.jsxs)("p",{className:"text-white/30 text-xs",children:[t.gamesPlayed," played"]})]}):(0,n.jsx)("p",{className:"text-white/20 text-xs",children:"No games yet"})]},e.type)})})]}):(0,n.jsx)("p",{className:"text-center text-white/30 text-sm py-4",children:"No stats yet"})]})]}),(0,n.jsx)("section",{className:"mx-4 mb-3",children:(0,n.jsxs)("div",{className:"bg-white/5 border border-white/[0.08] rounded-2xl p-4",children:[(0,n.jsxs)("p",{className:"text-[11px] font-semibold text-white/40 uppercase tracking-wider mb-3",children:["Friends ",F.total>0&&(0,n.jsxs)("span",{className:"text-white/25 normal-case font-normal",children:["\xb7 ",F.total]})]}),0===F.items.length?(0,n.jsxs)("div",{className:"text-center py-6",children:[(0,n.jsx)("div",{className:"w-12 h-12 rounded-full bg-white/5 flex items-center justify-center mx-auto mb-3",children:(0,n.jsxs)("svg",{className:"h-6 w-6 text-white/20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),(0,n.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,n.jsx)("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75"})]})}),(0,n.jsx)("p",{className:"text-white/30 text-sm",children:"No friends yet"}),(0,n.jsx)("p",{className:"text-white/20 text-xs mt-1",children:"Search by handle above to connect"})]}):(0,n.jsx)("div",{className:"space-y-2",children:F.items.map(e=>{let t=m?c(e,m):e.userB,s=A.get(t);return(0,n.jsxs)("div",{className:"flex items-center justify-between bg-white/5 rounded-xl px-3 py-2.5",children:[(0,n.jsxs)("button",{className:"flex items-center gap-2.5 min-w-0 flex-1 text-left",onClick:()=>$(t,null!=s?s:t),children:[(0,n.jsx)(o,{id:t,handle:s}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"text-sm font-medium truncate",children:s?"@".concat(s):"#".concat(t.slice(-6))}),(0,n.jsx)("p",{className:"text-[11px] text-white/30",children:"friend"})]})]}),(0,n.jsx)("button",{onClick:()=>Z(t),className:"text-xs px-2.5 py-1.5 rounded-xl text-white/25 hover:text-red-400 hover:bg-red-900/20 transition-colors shrink-0",children:"Remove"})]},e._id)})})]})})]})}}}]);
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.