1import{r as a,j as e,L as m,I as o,m as u}from"./index-pyc-rVim.js";import{C as y}from"./Card-DyWpcozy.js";import{B as k}from"./TransparencyRoutes-DItLE8d4.js";import{S as x}from"./StatCard-BzHDOLJA.js";import{j as C}from"./useAnalytics-NbUvTgQV.js";const S=[{key:"all",label:"All",icon:"mdi:view-grid",types:null},{key:"departments",label:"Departments",icon:"mdi:bank",types:["department","institution"]},{key:"organizations",label:"Organizations",icon:"mdi:domain",types:["corporation","organization"]},{key:"individuals",label:"Individuals",icon:"mdi:account-group",types:["director"]}];function E(){const[l,g]=a.useState(""),[d,j]=a.useState("all"),[p,b]=a.useState(50),f=d==="all"?null:d,{data:r,isLoading:v}=C(p,f),n=a.useMemo(()=>(Array.isArray(r)?r:(r==null?void 0:r.data)||(r==null?void 0:r.items)||[]).map(t=>({id:t.entity_id||t.id,name:t.entity_name||t.name,type:t.entity_type||t.type,score:t.pagerank||t.score||t.power_score||0,degree:t.degree||0,connections:t.connections||0})),[r]),i=a.useMemo(()=>{if(!n.length)return[];if(!l)return n;const s=l.toLowerCase();return n.filter(t=>(t.name||"").toLowerCase().includes(s)||(t.type||"").toLowerCase().includes(s))},[n,l]),c=a.useMemo(()=>i.length?Math.max(...i.map(s=>s.score)):1,[i]);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-heading font-light text-ink",children:"Power Broker Index"}),e.jsx("p",{className:"text-steel mt-1",children:"Composite ranking of the most connected and influential entities across all datasets."})]}),e.jsxs(m,{to:"/transparency/organizations",className:"flex items-center gap-2 text-sm text-crimson hover:text-crimson/80 transition-colors",children:[e.jsx(o,{icon:"mdi:office-building",className:"text-base"}),"All Organizations"]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsx(x,{label:"Ranked Entities",value:n.length,icon:e.jsx(o,{icon:"mdi:trophy"}),format:"number"}),e.jsx(x,{label:"Avg Score",value:n.length?(n.reduce((s,t)=>s+t.score,0)/n.length).toFixed(4):0,icon:e.jsx(o,{icon:"mdi:chart-line"}),color:"blue"}),e.jsx(x,{label:"Top Score",value:c>0?c.toFixed(4):0,icon:e.jsx(o,{icon:"mdi:star"}),color:"green"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:S.map(s=>e.jsxs("button",{onClick:()=>j(s.key),className:`flex items-center gap-2 px-4 py-2 text-sm rounded-lg border transition-colors ${d===s.key?"bg-crimson/10 text-crimson border-crimson/30":"bg-warm-white text-steel border-rule/40 hover:bg-parchment/60"}`,children:[e.jsx(o,{icon:s.icon,className:"text-base"}),s.label]},s.key))}),e.jsx(y,{children:e.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-[200px] max-w-sm",children:[e.jsx("label",{className:"block text-xs font-medium text-steel uppercase tracking-wider mb-1",children:"Search"}),e.jsx("input",{type:"text",value:l,onChange:s=>g(s.target.value),placeholder:"Search entities...",className:"bg-white border border-rule/40 text-ink text-sm rounded-lg px-4 py-2 outline-none focus:border-crimson/30 w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-steel uppercase tracking-wider mb-1",children:"Show top"}),e.jsxs("select",{value:p,onChange:s=>b(Number(s.target.value)),className:"bg-white border border-rule/40 text-ink text-sm rounded-lg px-3 py-2 outline-none focus:border-crimson/30",children:[e.jsx("option",{value:25,children:"25"}),e.jsx("option",{value:50,children:"50"}),e.jsx("option",{value:100,children:"100"})]})]})]})}),v?e.jsx("div",{className:"text-center py-12 text-steel",children:"Loading power broker data..."}):i.length===0?e.jsx("div",{className:"text-center py-12 text-steel/60",children:"No results found"}):e.jsx("div",{className:"space-y-2",children:i.map((s,t)=>{const N=c>0?s.score/c*100:0,h=t<3;return e.jsx(u.div,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{delay:t*.015},className:`bg-warm-white rounded border p-4 transition-shadow hover:shadow-md ${h?"border-crimson/30":"border-rule"}`,children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center text-sm font-heading font-medium shrink-0 ${h?"bg-crimson/10 text-crimson":"bg-parchment text-steel"}`,children:t+1}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[e.jsx(m,{to:s.type==="corporation"?`/trans
1parency/corporations/${s.id}`:s.type==="organization"?`/transparency/organizations/${s.id}`:s.type==="director"?`/transparency/directors?search=${encodeURIComponent(s.name)}`:`/transparency/organizations?search=${encodeURIComponent(s.name)}`,className:"text-ink font-medium hover:text-crimson transition-colors truncate",children:s.name}),s.type&&e.jsx(k,{color:"gray",children:s.type}),e.jsx(m,{to:`/transparency/explore/graph?search=${encodeURIComponent(s.name)}&type=${s.type}`,className:"text-steel/40 hover:text-crimson transition-colors",title:"Explore in graph",onClick:w=>w.stopPropagation(),children:e.jsx(o,{icon:"mdi:graph-outline",className:"text-base"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-0.5 text-xs text-steel",children:[s.connections>0&&e.jsxs("span",{children:[s.connections," connections"]}),s.degree>0&&s.degree!==s.connections&&e.jsxs("span",{children:["degree: ",s.degree]})]})]}),e.jsxs("div",{className:"w-32 shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs text-steel/60",children:"PageRank"}),e.jsx("span",{className:"text-sm font-heading text-crimson font-medium",children:s.score.toFixed(4)})]}),e.jsx("div",{className:"w-full h-1.5 bg-rule/30 rounded-full overflow-hidden",children:e.jsx(u.div,{initial:{width:0},animate:{width:`${N}%`},transition:{delay:t*.015+.2,duration:.5},className:"h-full bg-crimson rounded-full"})})]})]})},s.id||s.name||t)})})]})}export{E 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.