1import{r as e,j as s,R as a}from"./react-vendor-BR2bEzcq.js";import{C as r,A as t,B as l,D as n,a as d,b as c,e as i,p as o,d as m}from"./charts-D40XXgWa.js";import{C as x}from"./index-CPMAuWS8.js";import{a as p}from"./useClassColorsAPI-MhLQD34u.js";import{W as g}from"./wowSpecs-B2PKipr6.js";import{S as h}from"./shuffle-DPacWZQ3.js";import{M as j,Q as b,g as u,i as y}from"./index-CpSDEIFT.js";import{H as f}from"./heart-Df9HZ-_i.js";import{C as N}from"./circle-check-REcAsX_P.js";import"./axios-ClGXtqae.js";r.register(t,l,n,d,c,i,o,m);const v={Tank:"#3b82f6",Healer:"#22c55e",DPS:"#ef4444",Flex:"#a855f7"},w={Tank:b,Healer:f,DPS:j,Flex:h},C={Tank:2,Healer:4,DPS:14,Flex:0},k=Object.keys(g),S=({roster:r})=>{const t=r?.composition,l=r?.members||[],n=e.useMemo(()=>[...new Set(l.map(e=>{const s=e.primaryCharacter||e.character;return s?.class}).filter(Boolean))],[l]),{getColor:d}=p(n),c=t?.byRole||{},i=t?.byClass||{},o=t?.total||l.length||0,m=e.useMemo(()=>{const e={},s={Tank:1,Healer:2,DPS:3,Flex:4};for(const a of l){const s=a.primaryCharacter||a.character;if(!s?.class||!a.role)continue;const r=`${s.class}|${a.role}`;if(!e[r]){const t=g[s.class]||[],l="Flex"===a.role?t:t.filter(e=>"Tank"===a.role?"Tank"===e.role:"Healer"===a.role?"Healer"===e.role:"DPS"===e.role||"Support DPS"===e.role);e[r]={className:s.class,role:a.role,possibleSpecs:l.map(e=>e.name),count:0,specCounts:{},unknownCount:0}}e[r].count++;const t=s.spec||s.activeSpec;t&&e[r].possibleSpecs.includes(t)?e[r].specCounts[t]=(e[r].specCounts[t]||0)+1:e[r].unknownCount++}return Object.values(e).sort((e,a)=>{const r=(s[e.role]||99)-(s[a.role]||99);return 0!==r?r:e.className.localeCompare(a.className)})},[l]),h=e.useMemo(()=>k.filter(e=>!i[e]||0===i[e]),[i]),j=e.useMemo(()=>Object.entries(C).filter(([,e])=>e>0).map(([e,s])=>({role:e,current:c[e]||0,ideal:s,delta:(c[e]||0)-s})),[c]),b=e.useMemo(()=>({melee:t?.byDamageType?.melee||0,ranged:t?.byDamageType?.ranged||0}),[t]),f={labels:Object.keys(c).filter(e=>(c[e]||0)>0),datasets:[{data:Object.keys(c).filter(e=>(c[e]||0)>0).map(e=>c[e]),backgroundColor:Object.keys(c).filter(e=>(c[e]||0)>0).map(e=>v[e]||"#6b7280"),borderWidth:0,hoverOffset:6}]},S=Object.entries(i).sort((e,s)=>s[1]-e[1]),M={labels:S.map(([e])=>e),datasets:[{data:S.map(([,e])=>e),backgroundColor:S.map(([e])=>d(e)),borderWidth:0,borderRadius:4,barThickness:22}]},D={labels:["Melee","Ranged"],datasets:[{data:[b.melee,b.ranged],backgroundColor:["#f97316","#8b5cf6"],borderWidth:0,hoverOffset:4}]},P={responsive:!0,maintainAspectRatio:!1,cutout:"65%",plugins:{legend:{display:!1},tooltip:{backgroundColor:"#1f2937",titleColor:"#f3f4f6",bodyColor:"#d1d5db",borderColor:"#374151",borderWidth:1,cornerRadius:8,padding:10}}};return t||0!==l.length?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[s.jsxs("div",{className:"bg-gray-900/50 border border-gray-700 rounded-lg p-4",children:[s.jsx("h4",{className:"text-sm font-semibold text-gray-200 mb-3",children:"Role Distribution"}),s.jsxs("div",{className:"relative h-48 flex items-center justify-center",children:[s.jsx(x,{type:"doughnut",data:f,options:P}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-gray-100",children:o}),s.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider",children:"members"})]})})]}),s.jsx("div",{className:"grid grid-cols-2 gap-2 mt-3",children:["Tank","Healer","DPS","Flex"].map(e=>{const a=w[e],r=c[e]||0;return s.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[s.jsx(a,{className:"h-3 w-3",style:{color:v[e]}}),s.jsx("span",{className:"text-gray-400",children:e}),s.jsx("span",{className:"text-gray-200 font-medium ml-auto",children:r})]},e)})})]}),s.jsxs("div",{className:"bg-gray-900/50 border border-gray-700 rounded-lg p-4",children:[s.jsx("h4",{className:"text-sm font-semibold text-gray-200 mb-3",children:"DPS Breakdown"}),b.melee+b.ranged>0?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative h-36 flex items-center justify-center",children:[s.jsx(x,{type:"doughnut",data:D,options:P}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-lg font-bold text-gray-100",children:b.melee+b.ranged}),s.jsx("div",{className:"text-[10px] text-gray-500",children:"DPS"})]})})]}),s.jsxs("div",{className:"flex justify-center gap-6 mt-3",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[s.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-orange-500"}),s.jsx("span",{className:"text-gray-400",children:"Melee"}),s.jsx("span",{className:"text-gray-200 font-medium",children:b.melee})]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[s.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-violet-500"}),s.jsx("span",{className:"text-gray-400",children:"Ranged"}),s.jsx("span",{className:"text-gray-200 font-medium",children:b.ranged})]})]})]}):s.jsx("div",{className:"text-gray-500 text-sm text-center py-8",children:"No DPS data"})]}),s.jsxs("div",{className:"bg-gray-900/50 border border-gray-700 rounded-lg p-4",children:[s.jsx("h4",{className:"text-sm font-semibold text-gray-200 mb-3",children:"Mythic Ideal (20-man)"}),s.jsx("div",{className:"space-y-3",children:j.map(({role:e,current:a,ideal:r,delta:t})=>{const l=w[e],n=r>0?Math.min(a/r*100,100):0,d=t>0,c=t<0,i=0===t;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(l,{className:"h-3 w-3",style:{color:v[e]}}),s.jsx("span",{className:"text-gray-300",children:e})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-gray-200 font-medium",children:a}),s.jsx("span",{className:"text-gray-600",children:"/"}),s.jsx("span",{className:"text-gray-500",children:r}),c&&s.jsxs("span",{className:"text-red-400 text-[10px] font-medium",children:["(",t,")"]}),d&&s.jsxs("span",{className:"text-yellow-400 text-[10px] font-medium",children:["(+",t,")"]}),i&&s.jsx(N,{className:"h-3 w-3 text-green-500"})]})]}),s.jsx("div",{className:"h-1.5 bg-gray-700 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${n}%`,backgroundColor:i?"#22c55e":c?"#ef4444":v[e]}})})]},e)})}),s.jsx("div",{className:"mt-4 pt-3 border-t border-gray-700",children:s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-gray-400",children:"Avg Item Level"}),s.jsx("span",{className:"text-lg font-bold text-primary",children:t?.averageItemLevel?Math.round(Number(t.averageItemLevel)):"N/A"})]})})]})]}),s.jsxs("div",{className:"bg-gray-900/50 border border-gray-700 rounded-lg p-4",children:[s.jsx("h4",{className:"text-sm font-semibold text-gray-200 mb-3",children:"Class Distribution"}),S.length>0?s.jsx("div",{style:{height:Math.max(32*S.length,120)},children:s.jsx(x,{type:"bar",data:M,options:{responsive:!0,maintainAspectRatio:!1,indexAxis:"y",plugins:{legend:{dis
1play:!1},tooltip:{backgroundColor:"#1f2937",titleColor:"#f3f4f6",bodyColor:"#d1d5db",borderColor:"#374151",borderWidth:1,cornerRadius:8,padding:10}},scales:{x:{beginAtZero:!0,ticks:{color:"#9ca3af",stepSize:1},grid:{color:"#374151",drawBorder:!1}},y:{ticks:{color:"#d1d5db",font:{size:11}},grid:{display:!1}}}}})}):s.jsx("div",{className:"text-gray-500 text-sm text-center py-4",children:"No class data"})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"bg-gray-900/50 border border-gray-700 rounded-lg p-4",children:[s.jsx("h4",{className:"text-sm font-semibold text-gray-200 mb-3",children:"Spec Breakdown"}),m.length>0?s.jsx("div",{className:"space-y-2 max-h-72 overflow-y-auto pr-1",children:m.map(({className:e,role:r,possibleSpecs:t,count:l,specCounts:n,unknownCount:c})=>{const i=d(e),o=1===t.length,m=[...t].sort((e,s)=>{const a=n[e]||0,r=n[s]||0;return r!==a?r-a:e.localeCompare(s)});return s.jsxs("div",{className:"py-1",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[s.jsx("div",{className:"w-1 h-4 rounded-full shrink-0",style:{backgroundColor:i}}),s.jsx("span",{className:"text-xs font-medium",style:{color:i},children:e}),s.jsx("span",{className:"text-[10px] px-1.5 py-px rounded-sm border font-medium",style:{color:v[r],borderColor:`${v[r]}40`,backgroundColor:`${v[r]}15`},children:r}),s.jsxs("span",{className:"text-[11px] text-gray-500 ml-auto",children:["Ã",l]})]}),s.jsxs("div",{className:"ml-3 flex flex-wrap items-center gap-x-1 gap-y-0.5 text-[11px]",children:[o?s.jsx("span",{className:"text-gray-200 font-medium",children:m[0]}):m.map((e,r)=>{const t=n[e]||0,d=t>0;return s.jsxs(a.Fragment,{children:[r>0&&s.jsx("span",{className:"text-gray-700",children:"/"}),s.jsxs("span",{className:d?"text-gray-100 font-semibold":"text-gray-500",children:[e,d&&l>1&&s.jsxs("span",{className:"text-gray-400 font-normal ml-0.5",children:["(",t,")"]})]})]},e)}),c>0&&s.jsxs("span",{className:"text-yellow-500/70 text-[10px] ml-1",title:"Members whose current spec doesn't match their assigned role",children:["(",c," unconfirmed)"]})]})]},`${e}-${r}`)})}):s.jsx("div",{className:"text-gray-500 text-sm text-center py-4",children:"No spec data"})]}),s.jsxs("div",{className:"bg-gray-900/50 border border-gray-700 rounded-lg p-4",children:[s.jsx("h4",{className:"text-sm font-semibold text-gray-200 mb-3",children:"Coverage Gaps"}),s.jsxs("div",{className:"space-y-3",children:[j.filter(e=>e.delta<0).map(({role:e,current:a,ideal:r,delta:t})=>s.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-red-500/10 border border-red-500/20",children:[s.jsx(u,{className:"h-4 w-4 text-red-400 shrink-0"}),s.jsxs("div",{className:"text-xs",children:[s.jsxs("span",{className:"text-red-300 font-medium",children:["Need ",Math.abs(t)," more ",e,Math.abs(t)>1?"s":""]}),s.jsxs("span",{className:"text-gray-500 ml-1",children:["(",a,"/",r,")"]})]})]},`missing-${e}`)),j.filter(e=>e.delta>0).map(({role:e,current:a,ideal:r,delta:t})=>s.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-yellow-500/10 border border-yellow-500/20",children:[s.jsx(u,{className:"h-4 w-4 text-yellow-400 shrink-0"}),s.jsxs("div",{className:"text-xs",children:[s.jsxs("span",{className:"text-yellow-300 font-medium",children:[t," extra ",e,t>1?"s":""]}),s.jsxs("span",{className:"text-gray-500 ml-1",children:["(",a,"/",r,")"]})]})]},`over-${e}`)),j.every(e=>e.delta>=0)&&s.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-green-500/10 border border-green-500/20",children:[s.jsx(N,{className:"h-4 w-4 text-green-400 shrink-0"}),s.jsx("span",{className:"text-xs text-green-300 font-medium",children:"All roles filled"})]}),h.length>0&&s.jsxs("div",{className:"mt-2",children:[s.jsx("div",{className:"text-[11px] text-gray-500 uppercase tracking-wider mb-2",children:"Missing Classes"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:h.map(e=>s.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-sm text-[11px] border border-gray-700 text-gray-400 bg-gray-800/50",children:[s.jsx(y,{className:"h-3 w-3 text-gray-600"}),e]},e))})]}),0===h.length&&s.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-green-500/10 border border-green-500/20",children:[s.jsx(N,{className:"h-4 w-4 text-green-400 shrink-0"}),s.jsx("span",{className:"text-xs text-green-300 font-medium",children:"All classes represented"})]})]})]})]})]}):s.jsx("div",{className:"text-gray-500 text-center py-8",children:"No composition data available"})};export{S 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.