{if(!i._listeners)return;let s=i._listeners.length;for(;s-- >0;)i._listeners[s](o);i._listeners=null}),this.promise.then=o=>{let s;const a=new Promise(l=>{i.subscribe(l),s=l}).then(o);return a.cancel=function(){i.unsubscribe(s)},a},n(function(s,a,l){i.reason||(i.reason=new wi(s,a,l),r(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(n){if(this.reason){n(this.reason);return}this._listeners?this._listeners.push(n):this._listeners=[n]}unsubscribe(n){if(!this._listeners)return;const r=this._listeners.indexOf(n);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const n=new AbortController,r=i=>{n.abort(i)};return this.subscribe(r),n.signal.unsubscribe=()=>this.unsubscribe(r),n.signal}static source(){let n;return{token:new l0(function(o){n=o}),cancel:n}}};function hb(e){return function(r){return e.apply(null,r)}}function pb(e){return I.isObject(e)&&e.isAxiosError===!0}const ic={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ic).forEach(([e,n])=>{ic[n]=e});function u0(e){const n=new mr(e),r=Ly(mr.prototype.request,n);return I.extend(r,mr.prototype,n,{allOwnKeys:!0}),I.extend(r,n,null,{allOwnKeys:!0}),r.create=function(o){return u0(kr(e,o))},r}const Se=u0(Wo);Se.Axios=mr;Se.CanceledError=wi;Se.CancelToken=db;Se.isCancel=t0;Se.VERSION=a0;Se.toFormData=sl;Se.AxiosError=Z;Se.Cancel=Se.CanceledError;Se.all=function(n){return Promise.all(n)};Se.spread=hb;Se.isAxiosError=pb;Se.mergeConfig=kr;Se.AxiosHeaders=ot;Se.formToJSON=e=>e0(I.isHTMLForm(e)?new FormData(e):e);Se.getAdapter=s0.getAdapter;Se.HttpStatusCode=ic;Se.default=Se;const{Axios:lP,AxiosError:uP,CanceledError:cP,isCancel:fP,CancelToken:dP,VERSION:hP,all:pP,Cancel:mP,isAxiosError:gP,spread:yP,toFormData:vP,AxiosHeaders:xP,HttpStatusCode:_P,formToJSON:wP,getAdapter:bP,mergeConfig:kP}=Se,Ar="/api",Ne=Se.create({baseURL:Ar,headers:{"Content-Type":"application/json"}}),mb=async e=>(await Ne.get("/data/entities",{params:e})).data,gb=async e=>(await Ne.get("/data/money-flows",{params:e})).data,yb=async e=>(await Ne.get("/data/awards",{params:e})).data,c0=async e=>(await Ne.get("/data/foia-targets",{params:e})).data,vb=async()=>(await Ne.get("/data/stats")).data,xb=async()=>(await Ne.get("/analysis/graph/entities")).data,_b=async()=>(await Ne.get("/analysis/financial/flows")).data,wb=async()=>(await Ne.get("/analysis/timeline")).data,bb=async e=>(await Ne.get("/analysis/sankey",{params:e})).data,kb=async()=>(await Ne.get("/analysis/intel-stack/pyramid")).data,f0=async e=>(await Ne.get("/analysis/intel-stack/hierarchy",{params:{entity_id:e}})).data,jb=async e=>(await Ne.get(`/analysis/intel-stack/entity/${encodeURIComponent(e)}/detail`)).data,Sb=async(e,n=20)=>(await Ne.get("/analysis/intel-stack/search",{params:{q:e,limit:n}})).data,Nb=async()=>(await Ne.get("/data/version")).data,Cb=async()=>(await Ne.post("/data/refresh")).data,Eb=async(e,n,r)=>(await Ne.get("/search",{params:{q:e,types:n,limit:r}})).data,Tb=()=>{window.open(`${Ar}/export/csv/entities`,"_blank")},Ab=()=>{window.open(`${Ar}/export/csv/money-flows`,"_blank")},Pb=()=>{window.open(`${Ar}/export/csv/awards`,"_blank")},Rb=()=>{window.open(`${Ar}/export/csv/foia-targets`,"_blank")},Mb=()=>{window.open(`${Ar}/export/json/entities`,"_blank")},Ob=()=>{window.open(`${Ar}/export/pdf/summary`,"_blank")},zb=async(e,n)=>(await Ne.post("/contribute/entity",e,{headers:{"X-GitHub-Token":n}})).data,Fb=async(e,n)=>(await Ne.post("/contribute/money-flow",e,{headers:{"X-GitHub-Token":n}})).data,$b=async(e,n)=>(await Ne.post("/contribute/award",e,{headers:{"X-GitHub-Token":n}})).data,Db=async(e,n)=>(await Ne.post("/contribute/foia-target",e,{headers:{"X-GitHub-Token":n}})).data,Ib=async e=>(await Ne.get("/contribute/validate-token",{headers:{"X-GitHub-Token":e}})).data;function so({type:e="line",count:n=1,width:r,height:i}){return e==="card"?u.jsxs("div",{className:"skeleton-card",children:[u.jsx("div",{className:"skeleton-line",style:{width:"60%",height:"24px",marginBottom:"16px"}}),u.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"16px",marginBottom:"8px"}}),u.jsx("div",{className:"skeleton-line",style:{width:"80%",height:"16px"}})]}):e==="table"?u.jsxs("div",{className:"skeleton-table",children:[u.jsx("div",{className:"skeleton-table-header",children:[1,2,3,4,5].map(o=>u.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"20px"}},o))}),[1,2,3,4,5,6,7,8].map(o=>u.jsx("div",{className:"skeleton-table-row",children:[1,2,3,4,5].map(s=>u.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"16px"}},s))},o))]}):e==="stat"?u.jsxs("div",{className:"skeleton-stat",children:[u.jsx("div",{className:"skeleton-line",style:{width:"70%",height:"14px",marginBottom:"12px"}}),u.jsx("div",{className:"skeleton-line",style:{width:"50%",height:"32px"}})]}):u.jsx(u.Fragment,{children:Array.from({length:n}).map((o,s)=>u.jsx("div",{className:"skeleton-line",style:{width:r||"100%",height:i||"16px",marginBottom:s d($=>$+1),className:"btn btn-sm",children:"Next →"})]})]})]}),u.jsx("div",{className:"card",children:f?u.jsx(h0,{}):u.jsxs("div",{className:"fade-in",role:"tabpanel",children:[o==="entities"&&u.jsx(u.Fragment,{children:we.entities.length===0?u.jsx(qi,{icon:"🔍",title:"No entities found",description:"Try adjusting your search or filters, or browse all entities.",action:u.jsx("button",{className:"btn btn-primary",onClick:sn,children:"Clear Filters"})}):u.jsx("div",{className:"data-table-wrapper",children:u.jsxs("table",{className:"data-table",role:"table","aria-label":"Entities table",children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx(ke,{column:"display_name",label:"Display Name"}),u.jsx(ke,{column:"entity_type",label:"Type"}),u.jsx(ke,{column:"intel_stack_level",label:"Intel Level"}),u.jsx("th",{children:"Actions"})]})}),u.jsx("tbody",{children:we.entities.map($=>{var J;return u.jsxs("tr",{id:`row-entity-${$.entity_id}`,className:"clickable-row",children:[u.jsx("td",{children:u.jsx(nr,{text:$.display_name,highlight:G})}),u.jsx("td",{children:u.jsx("span",{className:`type-badge type-${(J=$.entity_type)==null?void 0:J.toLowerCase().replace(/\s+/g,"-")}`,children:$.entity_type||"Unknown"})}),u.jsx("td",{children:$.intel_stack_level?u.jsxs("span",{className:`intel-badge level-${$.intel_stack_level}`,children:["L",$.intel_stack_level]}):"-"}),u.jsxs("td",{className:"actions-cell",children:[u.jsx("button",{className:"btn btn-sm btn-outline",onClick:()=>r(`/analysis/network?highlight=${$.entity_id}`),children:"View Network"}),$.intel_stack_level!=null&&u.jsx(Pe,{to:`/analysis/pyramid?entity_id=${encodeURIComponent($.entity_id)}`,className:"browse-pyramid-link",title:"View on Pyramid","aria-label":`View ${$.display_name} on Intelligence Stack Pyramid`,children:u.jsx(Iy,{size:18})})]})]},$.entity_id)})})]})})}),o==="money-flows"&&u.jsx(u.Fragment,{children:we.moneyFlows.length===0?u.jsx(qi,{icon:"💰",title:"No money flows found",description:"Try adjusting your search or amount filters.",action:u.jsx("button",{className:"btn btn-primary",onClick:sn,children:"Clear Filters"})}):u.jsx("div",{className:"data-table-wrapper",children:u.jsxs("table",{className:"data-table",role:"table","aria-label":"Money flows table",children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx(ke,{column:"source",label:"Source"}),u.jsx(ke,{column:"target",label:"Target"}),u.jsx(ke,{column:"relationship",label:"Relationship"}),u.jsx(ke,{column:"amount_usd",label:"Amount"}),u.jsx(ke,{column:"start_date",label:"Date"})]})}),u.jsx("tbody",{children:we.moneyFlows.map($=>u.jsxs("tr",{id:`row-flow-${$.id}`,children:[u.jsx("td",{children:u.jsx(nr,{text:$.source,highlight:G})}),u.jsx("td",{children:u.jsx(nr,{text:$.target,highlight:G})}),u.jsx("td",{children:u.jsx("span",{className:"relationship-badge",children:$.relationship||"N/A"})}),u.jsx("td",{className:"amount-cell",children:Pr($.amount_usd)}),u.jsx("td",{children:$.start_date||"N/A"})]},$.id))})]})})}),o==="awards"&&u.jsx(u.Fragment,{children:we.awards.length===0?u.jsx(qi,{icon:"🏆",title:"No awards found",description:"Try adjusting your search, agency, or amount filters.",action:u.jsx("button",{className:"btn btn-primary",onClick:sn,children:"Clear Filters"})}):u.jsx("div",{className:"data-table-wrapper",children:u.jsxs("table",{className:"data-table",role:"table","aria-label":"Awards table",children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx(ke,{column:"piid",label:"PIID"}),u.jsx(ke,{column:"recipient_name",label:"Recipient"}),u.jsx(ke,{column:"awarding_agency",label:"Agency"}),u.jsx(ke,{column:"award_amount",label:"Amount"}),u.jsx(ke,{column:"action_date",label:"Date"})]})}),u.jsx("tbody",{children:we.awards.map($=>u.jsxs("tr",{id:`row-award-${$.id}`,children:[u.jsx("td",{className:"piid-cell",children:$.piid||"N/A"}),u.jsx("td",{children:u.jsx(nr,{text:$.recipient_name||"",highlight:G})}),u.jsx("td",{children:u.jsx(nr,{text:$.awarding_agency||"",highlight:G})}),u.jsx("td",{className:"amount-cell",children:Pr($.award_amount)}),u.jsx("td",{children:$.action_date||"N/A"})]},$.id))})]})})}),o==="foia"&&u.jsx(u.Fragment,{children:we.foiaTargets.length===0?u.jsx(qi,{icon:"📋",title:"No FOIA targets found",description:"Try adjusting your search or agency filter.",action:u.jsx("button",{className:"btn btn-primary",onClick:sn,children:"Clear Filters"})}):u.jsx("div",{className:"data-table-wrapper",children:u.jsxs("table",{className:"data-table",role:"table","aria-label":"FOIA targets table",children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx(ke,{column:"agency",label:"Agency"}),u.jsx(ke,{column:"record_request",label:"Record Request"}),u.jsx(ke,{column:"timeframe",label:"Timeframe"}),u.jsx(ke,{column:"priority_score",label:"Priority"}),u.jsx(ke,{column:"specificity_score",label:"Specificity"}),u.jsx(ke,{column:"likelihood_score",label:"Likelihood"})]})}),u.jsx("tbody",{children:we.foiaTargets.map($=>u.jsxs("tr",{id:`row-foia-${$.id}`,children:[u.jsx("td",{children:u.jsx(nr,{text:$.agency,highlight:G})}),u.jsx("td",{className:"record-request-cell",children:u.jsx(nr,{text:$.record_request,highlight:G})}),u.jsx("td",{children:$.timeframe||"N/A"}),u.jsx("td",{children:u.jsx(ei,{score:$.priority_score,type:"priority"})}),u.jsx("td",{children:u.jsx(ei,{score:$.specificity_score,type:"specificity"})}),u.jsx("td",{children:u.jsx(ei,{score:$.likelihood_score,type:"likelihood"})})]},$.id))})]})})})]})})]})}function Ws(e,n){return e==null||n==null?NaN:e [1,2,3].includes(y))||2,h()},c.strength=function(d){return arguments.length?(a=typeof d=="function"?d:yn(+d),h(),c):a},c.radius=function(d){return arguments.length?(e=typeof d=="function"?d:yn(+d),h(),c):e},c.x=function(d){return arguments.length?(n=+d,c):n},c.y=function(d){return arguments.length?(r=+d,c):r},c.z=function(d){return arguments.length?(i=+d,c):i},c}const{abs:Fi,cos:cn,sin:Mr,acos:$T,atan2:$i,sqrt:Pn,pow:_t}=Math;function Di(e){return e<0?-_t(-e,1/3):_t(e,1/3)}const Nv=Math.PI,Es=2*Nv,Rn=Nv/2,DT=1e-6,eu=Number.MAX_SAFE_INTEGER||9007199254740991,tu=Number.MIN_SAFE_INTEGER||-9007199254740991,IT={x:0,y:0,z:0},V={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,n){const r=n(e);let i=r.x*r.x+r.y*r.y;return typeof r.z<"u"&&(i+=r.z*r.z),Pn(i)},compute:function(e,n,r){if(e===0)return n[0].t=0,n[0];const i=n.length-1;if(e===1)return n[i].t=1,n[i];const o=1-e;let s=n;if(i===0)return n[0].t=e,n[0];if(i===1){const l={x:o*s[0].x+e*s[1].x,y:o*s[0].y+e*s[1].y,t:e};return r&&(l.z=o*s[0].z+e*s[1].z),l}if(i<4){let l=o*o,f=e*e,c,h,d,p=0;i===2?(s=[s[0],s[1],s[2],IT],c=l,h=o*e*2,d=f):i===3&&(c=l*o,h=l*e*3,d=o*f*3,p=e*f);const y={x:c*s[0].x+h*s[1].x+d*s[2].x+p*s[3].x,y:c*s[0].y+h*s[1].y+d*s[2].y+p*s[3].y,t:e};return r&&(y.z=c*s[0].z+h*s[1].z+d*s[2].z+p*s[3].z),y}const a=JSON.parse(JSON.stringify(n));for(;a.length>1;){for(let l=0;l "u"&&(o=.5),o===0)return new fe(r,r,i);if(o===1)return new fe(n,r,r);const s=fe.getABC(2,n,r,i,o);return new fe(n,s.A,i)}static cubicFromPoints(n,r,i,o,s){typeof o>"u"&&(o=.5);const a=fe.getABC(3,n,r,i,o);typeof s>"u"&&(s=V.dist(r,a.C));const l=s*(1-o)/o,f=V.dist(n,i),c=(i.x-n.x)/f,h=(i.y-n.y)/f,d=s*c,p=s*h,y=l*c,g=l*h,x={x:r.x-d,y:r.y-p},_={x:r.x+y,y:r.y+g},m=a.A,v={x:m.x+(x.x-m.x)/(1-o),y:m.y+(x.y-m.y)/(1-o)},w={x:m.x+(_.x-m.x)/o,y:m.y+(_.y-m.y)/o},b={x:n.x+(v.x-n.x)/o,y:n.y+(v.y-n.y)/o},k={x:i.x+(w.x-i.x)/(1-o),y:i.y+(w.y-i.y)/(1-o)};return new fe(n,b,k,i)}static getUtils(){return V}getUtils(){return fe.getUtils()}static get PolyBezier(){return lo}valueOf(){return this.toString()}toString(){return V.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const n=this.points,r=n[0].x,i=n[0].y,o=["M",r,i,this.order===2?"Q":"C"];for(let s=1,a=n.length;s0}length(){return V.length(this.derivative.bind(this))}static getABC(n=2,r,i,o,s=.5){const a=V.projectionratio(s,n),l=1-a,f={x:a*r.x+l*o.x,y:a*r.y+l*o.y},c=V.abcratio(s,n);return{A:{x:i.x+(i.x-f.x)/c,y:i.y+(i.y-f.y)/c},B:i,C:f,S:r,E:o}}getABC(n,r){r=r||this.get(n);let i=this.points[0],o=this.points[this.order];return fe.getABC(this.order,i,r,o,n)}getLUT(n){if(this.verify(),n=n||100,this._lut.length===n+1)return this._lut;this._lut=[],n++,this._lut=[];for(let r=0,i,o;r {if(!i._listeners)return;let a=i._listeners.length;for(;a-- >0;)i._listeners[a](o);i._listeners=null}),this.promise.then=o=>{let a;const s=new Promise(l=>{i.subscribe(l),a=l}).then(o);return s.cancel=function(){i.unsubscribe(a)},s},n(function(a,s,l){i.reason||(i.reason=new vi(a,s,l),r(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(n){if(this.reason){n(this.reason);return}this._listeners?this._listeners.push(n):this._listeners=[n]}unsubscribe(n){if(!this._listeners)return;const r=this._listeners.indexOf(n);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const n=new AbortController,r=i=>{n.abort(i)};return this.subscribe(r),n.signal.unsubscribe=()=>this.unsubscribe(r),n.signal}static source(){let n;return{token:new r0(function(o){n=o}),cancel:n}}};function eb(e){return function(r){return e.apply(null,r)}}function tb(e){return I.isObject(e)&&e.isAxiosError===!0}const tc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(tc).forEach(([e,n])=>{tc[n]=e});function i0(e){const n=new pr(e),r=zy(pr.prototype.request,n);return I.extend(r,pr.prototype,n,{allOwnKeys:!0}),I.extend(r,n,null,{allOwnKeys:!0}),r.create=function(o){return i0(br(e,o))},r}const Se=i0(Bo);Se.Axios=pr;Se.CanceledError=vi;Se.CancelToken=Z2;Se.isCancel=Qy;Se.VERSION=n0;Se.toFormData=rl;Se.AxiosError=Z;Se.Cancel=Se.CanceledError;Se.all=function(n){return Promise.all(n)};Se.spread=eb;Se.isAxiosError=tb;Se.mergeConfig=br;Se.AxiosHeaders=it;Se.formToJSON=e=>Yy(I.isHTMLForm(e)?new FormData(e):e);Se.getAdapter=t0.getAdapter;Se.HttpStatusCode=tc;Se.default=Se;const{Axios:qA,AxiosError:GA,CanceledError:XA,isCancel:YA,CancelToken:QA,VERSION:KA,all:JA,Cancel:ZA,isAxiosError:eP,spread:tP,toFormData:nP,AxiosHeaders:rP,HttpStatusCode:iP,formToJSON:oP,getAdapter:aP,mergeConfig:sP}=Se,xi="/api",je=Se.create({baseURL:xi,headers:{"Content-Type":"application/json"}}),nb=async e=>(await je.get("/data/entities",{params:e})).data,rb=async e=>(await je.get("/data/money-flows",{params:e})).data,ib=async e=>(await je.get("/data/awards",{params:e})).data,ob=async e=>(await je.get("/data/foia-targets",{params:e})).data,ab=async()=>(await je.get("/data/stats")).data,sb=async()=>(await je.get("/analysis/graph/entities")).data,lb=async()=>(await je.get("/analysis/financial/flows")).data,ub=async()=>(await je.get("/analysis/timeline")).data,cb=async e=>(await je.get("/analysis/sankey",{params:e})).data,fb=async()=>(await je.get("/analysis/intel-stack/pyramid")).data,o0=async e=>(await je.get("/analysis/intel-stack/hierarchy",{params:{entity_id:e}})).data,db=async e=>(await je.get(`/analysis/intel-stack/entity/${encodeURIComponent(e)}/detail`)).data,hb=async(e,n=20)=>(await je.get("/analysis/intel-stack/search",{params:{q:e,limit:n}})).data,pb=async()=>(await je.get("/data/version")).data,mb=async()=>(await je.post("/data/refresh")).data,gb=async(e,n,r)=>(await je.get("/search",{params:{q:e,types:n,limit:r}})).data,yb=()=>{window.open(`${xi}/export/csv/entities`,"_blank")},vb=()=>{window.open(`${xi}/export/csv/money-flows`,"_blank")},xb=()=>{window.open(`${xi}/export/csv/awards`,"_blank")},_b=()=>{window.open(`${xi}/export/json/entities`,"_blank")},wb=()=>{window.open(`${xi}/export/pdf/summary`,"_blank")},bb=async(e,n)=>(await je.post("/contribute/entity",e,{headers:{"X-GitHub-Token":n}})).data,kb=async(e,n)=>(await je.post("/contribute/money-flow",e,{headers:{"X-GitHub-Token":n}})).data,Sb=async(e,n)=>(await je.post("/contribute/award",e,{headers:{"X-GitHub-Token":n}})).data,jb=async(e,n)=>(await je.post("/contribute/foia-target",e,{headers:{"X-GitHub-Token":n}})).data,Nb=async e=>(await je.get("/contribute/validate-token",{headers:{"X-GitHub-Token":e}})).data;function ro({type:e="line",count:n=1,width:r,height:i}){return e==="card"?c.jsxs("div",{className:"skeleton-card",children:[c.jsx("div",{className:"skeleton-line",style:{width:"60%",height:"24px",marginBottom:"16px"}}),c.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"16px",marginBottom:"8px"}}),c.jsx("div",{className:"skeleton-line",style:{width:"80%",height:"16px"}})]}):e==="table"?c.jsxs("div",{className:"skeleton-table",children:[c.jsx("div",{className:"skeleton-table-header",children:[1,2,3,4,5].map(o=>c.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"20px"}},o))}),[1,2,3,4,5,6,7,8].map(o=>c.jsx("div",{className:"skeleton-table-row",children:[1,2,3,4,5].map(a=>c.jsx("div",{className:"skeleton-line",style:{width:"100%",height:"16px"}},a))},o))]}):e==="stat"?c.jsxs("div",{className:"skeleton-stat",children:[c.jsx("div",{className:"skeleton-line",style:{width:"70%",height:"14px",marginBottom:"12px"}}),c.jsx("div",{className:"skeleton-line",style:{width:"50%",height:"32px"}})]}):c.jsx(c.Fragment,{children:Array.from({length:n}).map((o,a)=>c.jsx("div",{className:"skeleton-line",style:{width:r||"100%",height:i||"16px",marginBottom:a d(F=>F+1),className:"btn btn-sm",children:"Next →"})]})]})]}),c.jsx("div",{className:"card",children:f?c.jsx(ro,{type:"table"}):c.jsxs("div",{className:"fade-in",role:"tabpanel",children:[o==="entities"&&c.jsx(c.Fragment,{children:_e.entities.length===0?c.jsxs("div",{className:"empty-state",children:[c.jsx("div",{className:"empty-icon",children:"🔍"}),c.jsx("h3",{children:"No entities found"}),c.jsx("p",{children:"Try adjusting your search or filters, or browse all entities."}),c.jsx("button",{className:"btn btn-primary",onClick:on,children:"Clear Filters"})]}):c.jsx("div",{className:"data-table-wrapper",children:c.jsxs("table",{className:"data-table",role:"table","aria-label":"Entities table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx(be,{column:"display_name",label:"Display Name"}),c.jsx(be,{column:"entity_type",label:"Type"}),c.jsx(be,{column:"intel_stack_level",label:"Intel Level"}),c.jsx("th",{children:"Actions"})]})}),c.jsx("tbody",{children:_e.entities.map(F=>{var J;return c.jsxs("tr",{id:`row-entity-${F.entity_id}`,className:"clickable-row",children:[c.jsx("td",{children:c.jsx(tr,{text:F.display_name,highlight:G})}),c.jsx("td",{children:c.jsx("span",{className:`type-badge type-${(J=F.entity_type)==null?void 0:J.toLowerCase().replace(/\s+/g,"-")}`,children:F.entity_type||"Unknown"})}),c.jsx("td",{children:F.intel_stack_level?c.jsxs("span",{className:`intel-badge level-${F.intel_stack_level}`,children:["L",F.intel_stack_level]}):"-"}),c.jsxs("td",{children:[c.jsx("button",{className:"btn btn-sm btn-outline",onClick:()=>r(`/analysis/network?highlight=${F.entity_id}`),children:"View Network"}),F.intel_stack_level!=null&&c.jsx(kt,{to:`/analysis/pyramid?entity_id=${encodeURIComponent(F.entity_id)}`,className:"browse-pyramid-link",title:"View on Pyramid","aria-label":`View ${F.display_name} on Intelligence Stack Pyramid`,children:c.jsx(Oy,{size:18})})]})]},F.entity_id)})})]})})}),o==="money-flows"&&c.jsx(c.Fragment,{children:_e.moneyFlows.length===0?c.jsxs("div",{className:"empty-state",children:[c.jsx("div",{className:"empty-icon",children:"💰"}),c.jsx("h3",{children:"No money flows found"}),c.jsx("p",{children:"Try adjusting your search or amount filters."}),c.jsx("button",{className:"btn btn-primary",onClick:on,children:"Clear Filters"})]}):c.jsx("div",{className:"data-table-wrapper",children:c.jsxs("table",{className:"data-table",role:"table","aria-label":"Money flows table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx(be,{column:"source",label:"Source"}),c.jsx(be,{column:"target",label:"Target"}),c.jsx(be,{column:"relationship",label:"Relationship"}),c.jsx(be,{column:"amount_usd",label:"Amount"}),c.jsx(be,{column:"start_date",label:"Date"})]})}),c.jsx("tbody",{children:_e.moneyFlows.map(F=>c.jsxs("tr",{id:`row-flow-${F.id}`,children:[c.jsx("td",{children:c.jsx(tr,{text:F.source,highlight:G})}),c.jsx("td",{children:c.jsx(tr,{text:F.target,highlight:G})}),c.jsx("td",{children:c.jsx("span",{className:"relationship-badge",children:F.relationship||"N/A"})}),c.jsx("td",{className:"amount-cell",children:Tr(F.amount_usd)}),c.jsx("td",{children:F.start_date||"N/A"})]},F.id))})]})})}),o==="awards"&&c.jsx(c.Fragment,{children:_e.awards.length===0?c.jsxs("div",{className:"empty-state",children:[c.jsx("div",{className:"empty-icon",children:"🏆"}),c.jsx("h3",{children:"No awards found"}),c.jsx("p",{children:"Try adjusting your search, agency, or amount filters."}),c.jsx("button",{className:"btn btn-primary",onClick:on,children:"Clear Filters"})]}):c.jsx("div",{className:"data-table-wrapper",children:c.jsxs("table",{className:"data-table",role:"table","aria-label":"Awards table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx(be,{column:"piid",label:"PIID"}),c.jsx(be,{column:"recipient_name",label:"Recipient"}),c.jsx(be,{column:"awarding_agency",label:"Agency"}),c.jsx(be,{column:"award_amount",label:"Amount"}),c.jsx(be,{column:"action_date",label:"Date"})]})}),c.jsx("tbody",{children:_e.awards.map(F=>c.jsxs("tr",{id:`row-award-${F.id}`,children:[c.jsx("td",{className:"piid-cell",children:F.piid||"N/A"}),c.jsx("td",{children:c.jsx(tr,{text:F.recipient_name||"",highlight:G})}),c.jsx("td",{children:c.jsx(tr,{text:F.awarding_agency||"",highlight:G})}),c.jsx("td",{className:"amount-cell",children:Tr(F.award_amount)}),c.jsx("td",{children:F.action_date||"N/A"})]},F.id))})]})})}),o==="foia"&&c.jsx(c.Fragment,{children:_e.foiaTargets.length===0?c.jsxs("div",{className:"empty-state",children:[c.jsx("div",{className:"empty-icon",children:"📋"}),c.jsx("h3",{children:"No FOIA targets found"}),c.jsx("p",{children:"Try adjusting your search or agency filter."}),c.jsx("button",{className:"btn btn-primary",onClick:on,children:"Clear Filters"})]}):c.jsx("div",{className:"data-table-wrapper",children:c.jsxs("table",{className:"data-table",role:"table","aria-label":"FOIA targets table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx(be,{column:"agency",label:"Agency"}),c.jsx(be,{column:"record_request",label:"Record Request"}),c.jsx(be,{column:"timeframe",label:"Timeframe"}),c.jsx(be,{column:"priority_score",label:"Priority"}),c.jsx(be,{column:"specificity_score",label:"Specificity"}),c.jsx(be,{column:"likelihood_score",label:"Likelihood"})]})}),c.jsx("tbody",{children:_e.foiaTargets.map(F=>c.jsxs("tr",{id:`row-foia-${F.id}`,children:[c.jsx("td",{children:c.jsx(tr,{text:F.agency,highlight:G})}),c.jsx("td",{className:"record-request-cell",children:c.jsx(tr,{text:F.record_request,highlight:G})}),c.jsx("td",{children:F.timeframe||"N/A"}),c.jsx("td",{children:F.priority_score!==null&&F.priority_score!==void 0?c.jsxs("span",{className:`score-badge ${F.priority_score>=.7?"high":F.priority_score>=.4?"medium":"low"}`,children:[(F.priority_score*100).toFixed(0),"%"]}):"N/A"}),c.jsx("td",{children:F.specificity_score!==null&&F.specificity_score!==void 0?c.jsxs("span",{className:`score-badge ${F.specificity_score>=.7?"high":F.specificity_score>=.4?"medium":"low"}`,children:[(F.specificity_score*100).toFixed(0),"%"]}):"N/A"}),c.jsx("td",{children:F.likelihood_score!==null&&F.likelihood_score!==void 0?c.jsxs("span",{className:`score-badge ${F.likelihood_score>=.6?"high":F.likelihood_score>=.3?"medium":"low"}`,children:[(F.likelihood_score*100).toFixed(0),"%"]}):"N/A"})]},F.id))})]})})})]})})]})}function Ba(e,n){return e==null||n==null?NaN:esr)if(!(Math.abs(d*f-c*h)>sr)||!s)this._append`L${this._x1=n},${this._y1=r}`;else{let y=i-a,g=o-l,x=f*f+c*c,_=y*y+g*g,m=Math.sqrt(x),v=Math.sqrt(p),w=s*Math.tan((pc-Math.acos((x+p-_)/(2*m*v)))/2),b=w/v,k=w/m;Math.abs(b-1)>sr&&this._append`L${n+b*h},${r+b*d}`,this._append`A${s},${s},0,0,${+(d*y>h*g)},${this._x1=n+k*f},${this._y1=r+k*c}`}}arc(n,r,i,o,s,a){if(n=+n,r=+r,i=+i,a=!!a,i<0)throw new Error(`negative radius: ${i}`);let l=i*Math.cos(o),f=i*Math.sin(o),c=n+l,h=r+f,d=1^a,p=a?o-s:s-o;this._x1===null?this._append`M${c},${h}`:(Math.abs(this._x1-c)>sr||Math.abs(this._y1-h)>sr)&&this._append`L${c},${h}`,i&&(p<0&&(p=p%mc+mc),p>zN?this._append`A${i},${i},0,1,${d},${n-l},${r-f}A${i},${i},0,1,${d},${this._x1=c},${this._y1=h}`:p>sr&&this._append`A${i},${i},0,${+(p>=pc)},${d},${this._x1=n+i*Math.cos(s)},${this._y1=r+i*Math.sin(s)}`)}rect(n,r,i,o){this._append`M${this._x0=this._x1=+n},${this._y0=this._y1=+r}h${i=+i}v${+o}h${-i}Z`}toString(){return this._}}function H0(){return new B0}H0.prototype=B0.prototype;function $N(e){const n=+this._x.call(null,e),r=+this._y.call(null,e);return V0(this.cover(n,r),n,r,e)}function V0(e,n,r,i){if(isNaN(n)||isNaN(r))return e;var o,s=e._root,a={data:i},l=e._x0,f=e._y0,c=e._x1,h=e._y1,d,p,y,g,x,_,m,v;if(!s)return e._root=a,e;for(;s.length;)if((x=n>=(d=(l+c)/2))?l=d:c=d,(_=r>=(p=(f+h)/2))?f=p:h=p,o=s,!(s=s[m=_<<1|x]))return o[m]=a,e;if(y=+e._x.call(null,s.data),g=+e._y.call(null,s.data),n===y&&r===g)return a.next=s,o?o[m]=a:e._root=a,e;do o=o?o[m]=new Array(4):e._root=new Array(4),(x=n>=(d=(l+c)/2))?l=d:c=d,(_=r>=(p=(f+h)/2))?f=p:h=p;while((m=_<<1|x)===(v=(g>=p)<<1|y>=d));return o[v]=s,o[m]=a,e}function DN(e){var n,r,i=e.length,o,s,a=new Array(i),l=new Array(i),f=1/0,c=1/0,h=-1/0,d=-1/0;for(r=0;rh&&(h=o),sg||(c=w.y0)>x||(h=w.z0)>_||(d=w.x1)=C)<<2|(n>=j)<<1|e>=k)&&(w=m[m.length-1],m[m.length-1]=m[m.length-1-b],m[m.length-1-b]=w)}else{var T=e-+this._x.call(null,v.data),F=n-+this._y.call(null,v.data),A=r-+this._z.call(null,v.data),O=T*T+F*F+A*A;if(OMath.sqrt((e-i)**2+(n-o)**2+(r-s)**2);function dT(e,n,r,i){const o=[],s=e-i,a=n-i,l=r-i,f=e+i,c=n+i,h=r+i;return this.visit((d,p,y,g,x,_,m)=>{if(!d.length)do{const v=d.data;fT(e,n,r,this._x(v),this._y(v),this._z(v))<=i&&o.push(v)}while(d=d.next);return p>f||y>c||g>h||x=(x=(a+c)/2))?a=x:c=x,(w=y>=(_=(l+h)/2))?l=_:h=_,(b=g>=(m=(f+d)/2))?f=m:d=m,n=r,!(r=r[k=b<<2|w<<1|v]))return this;if(!r.length)break;(n[k+1&7]||n[k+2&7]||n[k+3&7]||n[k+4&7]||n[k+5&7]||n[k+6&7]||n[k+7&7])&&(i=n,j=k)}for(;r.data!==e;)if(o=r,!(r=r.next))return this;return(s=r.next)&&delete r.next,o?(s?o.next=s:delete o.next,this):n?(s?n[k]=s:delete n[k],(r=n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]||n[7])&&r===(n[7]||n[6]||n[5]||n[4]||n[3]||n[2]||n[1]||n[0])&&!r.length&&(i?i[j]=r:this._root=r),this):(this._root=s,this)}function pT(e){for(var n=0,r=e.length;n1&&(b.fy==null?b.y+=b.vy*=f:(b.y=b.fy,b.vy=0)),r>2&&(b.fz==null?b.z+=b.vz*=f:(b.z=b.fz,b.vz=0));return i}function x(){for(var m=0,v=e.length,w;m"u")e=.5;else if(e===0||e===1)return e;const r=_t(e,n)+_t(1-e,n),i=r-1;return Fi(i/r)},projectionratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const r=_t(1-e,n),i=_t(e,n)+r;return r/i},lli8:function(e,n,r,i,o,s,a,l){const f=(e*i-n*r)*(o-a)-(e-r)*(o*l-s*a),c=(e*i-n*r)*(s-l)-(n-i)*(o*l-s*a),h=(e-r)*(s-l)-(n-i)*(o-a);return h==0?!1:{x:f/h,y:c/h}},lli4:function(e,n,r,i){const o=e.x,s=e.y,a=n.x,l=n.y,f=r.x,c=r.y,h=i.x,d=i.y;return V.lli8(o,s,a,l,f,c,h,d)},lli:function(e,n){return V.lli4(e,e.c,n,n.c)},makeline:function(e,n){return new fe(e.x,e.y,(e.x+n.x)/2,(e.y+n.y)/2,n.x,n.y)},findbbox:function(e){let n=eu,r=eu,i=tu,o=tu;return e.forEach(function(s){const a=s.bbox();n>a.x.min&&(n=a.x.min),r>a.y.min&&(r=a.y.min),iy+Ii(g.y),0)0&&!P(z)&&!L.has(z.id))),B=new Set(R.map(z=>z.id)),D=[];l.links.forEach(z=>{const U=Ke(z.source),q=Ke(z.target);!o&&z.label&&(z.label.includes("Co-Recipient")||z.label.includes("Same Industry")||z.label.includes("Award Recipient"))||B.has(U)&&B.has(q)&&D.push({source:U,target:q,label:z.label,value:z.value,count:z.count})}),h({nodes:R,links:D})},[l,o,s,e]);const C=E.useMemo(()=>c.nodes.map(N=>({name:N.name||N.id,connections:N._connections||0,type:N.type||"Unknown"})).sort((N,P)=>P.connections-N.connections),[c.nodes]);E.useEffect(()=>{const N=c.links.filter(P=>{var S,L,R;return((S=P.label)==null?void 0:S.includes("Co-Recipient"))||((L=P.label)==null?void 0:L.includes("Same Industry"))||((R=P.label)==null?void 0:R.includes("Award Recipient"))}).length;a==null||a({nodeCount:c.nodes.length,linkCount:c.links.length,inferredCount:N,nodeIndex:C,rawLinks:c.links,totalRawLinks:l.links.length})},[c,C,l.links.length]);const T=E.useMemo(()=>{const N=Math.max(1,...c.nodes.map(P=>P._connections||1));return Q0().exponent(.5).domain([1,N]).range([4,40]).clamp(!0)},[c.nodes]),{selectedNeighbors:F,selectedLinkSet:A}=E.useMemo(()=>{if(!n)return{selectedNeighbors:new Set,selectedLinkSet:new Set};const N=new Set,P=new Set;return c.links.forEach(S=>{const L=Ke(S.source),R=Ke(S.target);(L===n||R===n)&&(N.add(L),N.add(R),P.add(`${L}|||${R}`),P.add(`${R}|||${L}`))}),{selectedNeighbors:N,selectedLinkSet:P}},[n,c.links]),O=E.useCallback(N=>i==="proximity"&&n?N.id===n||N.name===n?"#dc2626":F.has(N.id)||F.has(N.name||"")?"#f59e0b":"hsl(120, 40%, 45%)":Ac[N.type||"default"]||Ac.default,[i,n,F]);return E.useEffect(()=>{var L,R,B;if(!w.current||c.nodes.length===0)return;const N=w.current,S=c.nodes.length>100?-250:-350;(L=N.d3Force("charge"))==null||L.strength(S).distanceMax(300),(R=N.d3Force("link"))==null||R.distance(60).strength(.7),N.d3Force("collision",tC().radius(D=>T(D._connections||1)+6).strength(.8)),N.d3Force("radial",nC(D=>(50-Math.min(D._connections||0,50))*12+60,0,0).strength(.3)),(B=N.d3Force("center"))==null||B.strength(.05),N.d3ReheatSimulation()},[c,T]),E.useEffect(()=>(c.nodes.length>0&&!x&&w.current&&(k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{var N;(N=w.current)==null||N.zoomToFit(600,40),_(!0)},2500)),()=>{k.current&&clearTimeout(k.current)}),[c,x]),E.useEffect(()=>{if(!n||!w.current)return;const N=c.nodes.find(P=>P.id===n||P.name===n);N&&N.x!==void 0&&N.y!==void 0&&(w.current.centerAt(N.x,N.y,800),w.current.zoom(2.5,800))},[n]),d?u.jsx("div",{className:"network-graph-container",children:u.jsxs("div",{className:"loading",children:[u.jsx(Dy,{size:32,className:"loading-spinner"}),u.jsx("span",{children:"Loading network graph..."})]})}):y?u.jsx("div",{className:"network-graph-container",children:u.jsxs("div",{className:"error",children:[y,u.jsx("button",{onClick:j,style:{marginTop:12},children:"Retry"})]})}):c.nodes.length===0?u.jsx("div",{className:"network-graph-container",children:u.jsx("div",{className:"empty",children:"No network data available"})}):u.jsxs("div",{className:"network-graph-container",ref:b,children:[u.jsx(td,{ref:w,graphData:c,backgroundColor:"#030712",d3AlphaDecay:.025,d3VelocityDecay:.4,warmupTicks:200,cooldownTicks:300,cooldownTime:8e3,minZoom:.01,maxZoom:10,nodeVal:N=>T(N._connections||1),nodeCanvasObject:(N,P,S)=>{const L=T(N._connections||1),R=N.name||N.id||"",B=n&&(N.id===n||N.name===n),D=n&&(F.has(N.id)||F.has(N.name||"")),z=n&&!B&&!D;if(P.beginPath(),P.arc(N.x,N.y,L,0,2*Math.PI),P.fillStyle=z?"rgba(100,100,100,0.25)":O(N),P.fill(),B?(P.strokeStyle="#06b6d4",P.lineWidth=3):(P.strokeStyle=z?"rgba(255,255,255,0.1)":"rgba(255,255,255,0.6)",P.lineWidth=1),P.stroke(),S>.4||B||D&&S>.25){const U=Math.max(3,Math.min(11,12/S));P.font=`${B?"bold ":""}${U}px Sans-Serif`,P.textAlign="center",P.textBaseline="top";const q=N.y+L+2;z||(P.fillStyle="rgba(255,255,255,0.92)",P.fillText(R,N.x,q))}},linkColor:N=>{if(!n){const R=N.label||"";return R.includes("Money Flow")||R.includes("$")?"rgba(91, 79, 255, 0.35)":R.includes("Award")?"rgba(250, 204, 21, 0.3)":"rgba(255,255,255,0.12)"}const P=Ke(N.source),S=Ke(N.target),L=`${P}|||${S}`;return A.has(L)?"#06b6d4":"rgba(255,255,255,0.04)"},linkWidth:N=>{if(!n)return(N.count||1)>1?2:1;const P=Ke(N.source),S=Ke(N.target);return A.has(`${P}|||${S}`)?2.5:.3},linkDirectionalParticles:N=>{if(!n)return 0;const P=Ke(N.source),S=Ke(N.target);return A.has(`${P}|||${S}`)?3:0},linkDirectionalParticleWidth:2,linkDirectionalParticleSpeed:.008,onNodeClick:N=>{const P=N.name||N.id;r(n===P?null:P)},onNodeHover:(N,P)=>{document.body.style.cursor=N?"pointer":"default",v(N||null)},onBackgroundClick:()=>r(null)}),m&&u.jsx("div",{className:"graph-tooltip",style:{position:"absolute",pointerEvents:"none",left:0,top:0}}),u.jsxs("div",{className:"graph-instructions-bar",children:[u.jsx("span",{children:"Click nodes to explore relationships"}),u.jsx("span",{className:"separator",children:"•"}),u.jsx("span",{children:"Scroll to zoom"}),u.jsx("span",{className:"separator",children:"•"}),u.jsx("span",{children:"Drag to pan"})]})]})}const Ui=[{level:1,name:"Control Group",color:"#FF1744",description:"MITRE/JASON, NSC, Executive Branch"},{level:2,name:"Administrators",color:"#FF6B35",description:"NRO, NGA, CIA DS&T, DIA, NSA, OUSD, SAF-AQ"},{level:3,name:"FFRDCs",color:"#FF9800",description:"MITRE, Battelle, Sandia, LANL, LLNL, Oak Ridge"},{level:4,name:"Prime Contractors",color:"#5B4FFF",description:"Lockheed Martin, Northrop Grumman, Raytheon"},{level:5,name:"Facilities",color:"#4CAF50",description:"Area 51, S4, Edwards AFB, Tonopah, Dugway"},{level:6,name:"Programs",color:"#E91E63",description:"Immaculate Constellation, Kona Blue, etc."}];function nd({activeLevels:e,onChange:n,showAll:r=!0,compact:i=!1}){const o=f=>{e.includes(f)?n(e.filter(c=>c!==f)):n([...e,f].sort())},s=()=>{e.length===Ui.length?n([]):n(Ui.map(f=>f.level))},a=e.length===Ui.length,l=e.length===0;return u.jsxs("div",{className:`intel-stack-filter ${i?"compact":""}`,children:[u.jsxs("div",{className:"intel-stack-header",children:[u.jsx("h4",{children:"Intelligence Stack"}),r&&u.jsx("button",{className:`select-all-btn ${a?"all-selected":""}`,onClick:s,title:a?"Deselect All":"Select All",children:a?"Clear":"All"})]}),u.jsx("div",{className:"intel-stack-pyramid",children:Ui.map(f=>{const c=e.includes(f.level)||l;return u.jsxs("button",{className:`stack-level ${c?"active":"inactive"}`,onClick:()=>o(f.level),style:{"--stack-color":f.color,"--stack-width":`${100-(f.level-1)*10}%`},title:f.description,"aria-pressed":c,children:[u.jsx("span",{className:"stack-indicator",style:{backgroundColor:f.color}}),u.jsx("span",{className:"stack-name",children:f.name}),!i&&u.jsxs("span",{className:"stack-level-num",children:["L",f.level]})]},f.level)})}),!i&&u.jsx("div",{className:"intel-stack-info",children:u.jsx("small",{children:l?"Showing all levels":`Showing ${e.length} of ${Ui.length} levels`})})]})}function PA({nodeCount:e,linkCount:n,inferredCount:r,selectedActor:i,onClearActor:o,onSelectActor:s,nodeIndex:a,showInferred:l,onShowInferredChange:f,minConnections:c,onMinConnectionsChange:h,colorMode:d,onColorModeChange:p,filterLevels:y,onFilterLevelsChange:g,colorMap:x,uniqueTypes:_}){const[m,v]=E.useState(""),[w,b]=E.useState(!1),[k,j]=E.useState(!0),[C,T]=E.useState(!1),[F,A]=E.useState(!1),O=E.useRef(null);E.useEffect(()=>{const S=L=>{O.current&&!O.current.contains(L.target)&&b(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);const N=E.useMemo(()=>{if(!m.trim())return[];const S=m.toLowerCase();return a.filter(L=>L.name.toLowerCase().includes(S)).sort((L,R)=>R.connections-L.connections).slice(0,20)},[m,a]),P=S=>{s(S),v(""),b(!1)};return u.jsxs("aside",{className:"graph-sidebar",children:[u.jsxs("div",{className:"graph-sidebar-header",children:[u.jsxs(Pe,{to:"/analysis",className:"back-link",children:[u.jsx(Tf,{size:14}),u.jsx("span",{children:"Back to Analysis"})]}),u.jsx("h2",{children:"Entity Network"})]}),u.jsxs("div",{className:"graph-sidebar-stats",children:[u.jsxs("div",{className:"stat-row",children:[u.jsx("span",{className:"stat-label",children:"Entities:"}),u.jsx("span",{className:"stat-value",children:e.toLocaleString()})]}),u.jsxs("div",{className:"stat-row",children:[u.jsx("span",{className:"stat-label",children:"Connections:"}),u.jsx("span",{className:"stat-value",children:n.toLocaleString()})]}),r>0&&u.jsxs("div",{className:"stat-row",children:[u.jsx("span",{className:"stat-label",children:"Inferred:"}),u.jsx("span",{className:"stat-value",style:{color:"#facc15"},children:r.toLocaleString()})]})]}),i&&u.jsxs("div",{className:"graph-sidebar-selected",children:[u.jsxs("div",{className:"selected-actor-header",children:[u.jsx("span",{className:"actor-label",children:"Selected actor:"}),u.jsx("button",{className:"clear-actor-btn",onClick:o,children:"Clear"})]}),u.jsx("div",{className:"selected-actor-name",children:i})]}),u.jsxs("div",{className:"graph-search-container",ref:O,children:[u.jsx("label",{children:"Search entities:"}),u.jsx("input",{className:"graph-search-input",type:"text",placeholder:"e.g., Lockheed Martin",value:m,onChange:S=>{v(S.target.value),b(!0)},onFocus:()=>{m.trim()&&b(!0)}}),w&&N.length>0&&u.jsx("div",{className:"search-results-dropdown",role:"listbox",children:N.map(S=>u.jsxs("button",{className:"search-result-item",role:"option",type:"button",onClick:()=>P(S.name),children:[u.jsx("span",{className:"result-name",children:S.name}),u.jsxs("span",{className:"result-count",children:[S.connections," conn."]})]},S.name))})]}),u.jsxs("div",{className:"sidebar-section",children:[u.jsxs("button",{className:"section-toggle",onClick:()=>j(!k),children:[u.jsx("span",{children:"Filters"}),u.jsx("span",{className:"toggle-arrow",children:k?"▼":"▶"})]}),k&&u.jsxs("div",{className:"section-content",children:[u.jsx("div",{className:"filter-row",children:u.jsxs("label",{children:[u.jsx("input",{type:"checkbox",checked:l,onChange:S=>f(S.target.checked)}),"Show inferred"]})}),u.jsx("div",{className:"filter-row",children:u.jsxs("label",{children:["Min connections:",u.jsx("input",{type:"number",min:0,max:20,value:c,onChange:S=>h(parseInt(S.target.value)||0)})]})}),u.jsxs("div",{style:{marginTop:8},children:[u.jsx("span",{style:{fontSize:"0.75rem",color:"#94a3b8"},children:"Color by:"}),u.jsxs("div",{className:"color-mode-toggle",children:[u.jsx("button",{className:`color-mode-btn ${d==="type"?"active":""}`,onClick:()=>p("type"),children:"Entity Type"}),u.jsx("button",{className:`color-mode-btn ${d==="proximity"?"active":""}`,onClick:()=>p("proximity"),children:"Proximity"})]})]})]})]}),u.jsxs("div",{className:"sidebar-section",children:[u.jsxs("button",{className:"section-toggle",onClick:()=>A(!F),children:[u.jsx("span",{children:"Intel Stack"}),u.jsx("span",{className:"toggle-arrow",children:F?"▼":"▶"})]}),F&&u.jsx("div",{className:"section-content",children:u.jsx(nd,{activeLevels:y,onChange:g,compact:!0})})]}),u.jsxs("div",{className:"sidebar-section",children:[u.jsxs("button",{className:"section-toggle",onClick:()=>T(!C),children:[u.jsx("span",{children:"Legend"}),u.jsx("span",{className:"toggle-arrow",children:C?"▼":"▶"})]}),C&&u.jsx("div",{className:"section-content",children:u.jsx("div",{className:"sidebar-legend-items",children:_.map(S=>u.jsxs("div",{className:"sidebar-legend-item",children:[u.jsx("span",{className:"sidebar-legend-color",style:{backgroundColor:x[S]||"#9B9B9B"}}),u.jsx("span",{children:S})]},S))})})]})]})}function RA(e){if(!e)return{cls:"relationship",text:"RELATED"};const n=e.toLowerCase();return n.includes("money flow")||n.includes("$")||n.includes("financial")?{cls:"financial",text:"FINANCIAL"}:n.includes("award")||n.includes("contract")?{cls:"award",text:"AWARD"}:n.includes("co-recipient")||n.includes("same industry")||n.includes("inferred")?{cls:"inferred",text:"INFERRED"}:{cls:"relationship",text:"RELATED"}}function MA(e){return!e||e<=0?null:e>=1e9?`$${(e/1e9).toFixed(2)}B`:e>=1e6?`$${(e/1e6).toFixed(2)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toLocaleString()}`}function OA({actorName:e,links:n,totalLinks:r,onClose:i,onSelectActor:o}){const[s,a]=E.useState(""),l=E.useMemo(()=>n.filter(c=>{var p,y;const h=typeof c.source=="string"?c.source:((p=c.source)==null?void 0:p.id)||"",d=typeof c.target=="string"?c.target:((y=c.target)==null?void 0:y.id)||"";return h===e||d===e}),[n,e]),f=E.useMemo(()=>{if(!s.trim())return l;const c=s.toLowerCase();return l.filter(h=>{var g,x;const d=typeof h.source=="string"?h.source:((g=h.source)==null?void 0:g.id)||"",p=typeof h.target=="string"?h.target:((x=h.target)==null?void 0:x.id)||"";return(d===e?p:d).toLowerCase().includes(c)})},[l,s,e]);return u.jsxs("div",{className:"relationship-timeline",children:[u.jsxs("div",{className:"timeline-header",children:[u.jsxs("div",{className:"timeline-header-top",children:[u.jsx("h3",{children:"Timeline"}),u.jsx("button",{className:"timeline-close-btn",onClick:i,title:"Close panel",children:"✕"})]}),u.jsx("div",{className:"timeline-actor-name",children:e}),u.jsxs("div",{className:"timeline-subtitle",children:["Showing ",f.length," of ",r," relationships"]})]}),u.jsxs("div",{className:"timeline-filter",children:[u.jsx("label",{children:"Filter by entity:"}),u.jsx("input",{className:"timeline-filter-input",type:"text",placeholder:"e.g., Boeing",value:s,onChange:c=>a(c.target.value)})]}),u.jsx("div",{className:"timeline-entries",children:f.length===0?u.jsx("div",{className:"timeline-empty",children:"No interactions found"}):f.map((c,h)=>{var m,v;const d=typeof c.source=="string"?c.source:((m=c.source)==null?void 0:m.id)||"",p=typeof c.target=="string"?c.target:((v=c.target)==null?void 0:v.id)||"",y=d===e?p:d,g=d===e,x=RA(c.label||""),_=MA(c.value);return u.jsxs("div",{className:"timeline-entry",children:[u.jsx("span",{className:`timeline-entry-type ${x.cls}`,children:x.text}),c.count&&c.count>1&&u.jsxs("span",{style:{fontSize:"0.68rem",color:"#64748b",marginLeft:6},children:["x",c.count]}),u.jsxs("div",{className:"timeline-entry-actors",children:[u.jsx("span",{className:"actor-source",onClick:()=>o(g?e:y),children:g?e:y}),u.jsxs("span",{className:"actor-action",children:[" ",c.label||"related to"," "]}),u.jsx("span",{className:"actor-target",onClick:()=>o(g?y:e),children:g?y:e})]}),_&&u.jsx("div",{className:"timeline-entry-amount",children:_})]},`${d}-${p}-${h}`)})}),u.jsxs(Pe,{to:`/browse?search=${encodeURIComponent(e)}&highlight=${encodeURIComponent(e)}`,className:"timeline-browse-link",children:["View ",e," in Browse"]})]})}function zA(){const[e,n]=E.useState([]),[r,i]=E.useState(null),[o,s]=E.useState("type"),[a,l]=E.useState(!0),[f,c]=E.useState(0),[h,d]=E.useState({nodeCount:0,linkCount:0,inferredCount:0,nodeIndex:[],rawLinks:[],totalRawLinks:0}),p=E.useCallback(g=>{d(g)},[]),y=h.nodeIndex.reduce((g,x)=>(g.includes(x.type)||g.push(x.type),g),[]).sort();return u.jsxs("div",{className:"network-page-layout",role:"main","aria-label":"Entity Network Graph",children:[u.jsx(PA,{nodeCount:h.nodeCount,linkCount:h.linkCount,inferredCount:h.inferredCount,selectedActor:r,onClearActor:()=>i(null),onSelectActor:g=>i(g),nodeIndex:h.nodeIndex,showInferred:a,onShowInferredChange:l,minConnections:f,onMinConnectionsChange:c,colorMode:o,onColorModeChange:s,filterLevels:e,onFilterLevelsChange:n,colorMap:Ac,uniqueTypes:y}),u.jsx("div",{className:"network-page-center",children:u.jsx(AA,{filterLevels:e,selectedActor:r,onSelectActor:i,colorMode:o,showInferred:a,minConnections:f,onDataReady:p})}),r&&u.jsx(OA,{actorName:r,links:h.rawLinks,totalLinks:h.totalRawLinks,onClose:()=>i(null),onSelectActor:g=>i(g)}),u.jsx("style",{children:`
+ .network-page-layout {
+ display: flex;
+ height: calc(100vh - 60px);
+ width: 100%;
+ overflow: hidden;
+ background: #030712;
+ }
+
+ .network-page-center {
+ flex: 1;
+ min-width: 280px;
+ height: 100%;
+ position: relative;
+ }
+
+ @media (max-width: 700px) {
+ .network-page-layout {
+ flex-direction: column;
+ height: calc(100vh - 50px);
+ }
+ .network-page-center {
+ flex: 1;
+ }
+ }
+ `})]})}function ru(e){return e>=1e12?`$${(e/1e12).toFixed(2)}T`:e>=1e9?`$${(e/1e9).toFixed(2)}B`:e>=1e6?`$${(e/1e6).toFixed(2)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}const em=14;function FA({data:e,x:n,y:r}){if(!e)return null;const i={left:n+em,top:r+em};return u.jsxs("div",{className:"pyramid-tooltip",style:i,role:"tooltip",children:[e.kind==="tier"&&u.jsxs("div",{className:"pyramid-tooltip-tier",children:[u.jsxs("div",{className:"pyramid-tooltip-title",style:{color:e.tier.color},children:["L",e.tier.level,": ",e.tier.name]}),u.jsxs("div",{className:"pyramid-tooltip-meta",children:[e.tier.entity_count," entities · ",ru(e.tier.total_money_flow_usd)," flow"]}),e.topEntities.length>0&&u.jsx("div",{className:"pyramid-tooltip-list",children:e.topEntities.slice(0,3).map(o=>u.jsx("span",{className:"pyramid-tooltip-item",children:o},o))})]}),e.kind==="entity"&&u.jsxs("div",{className:"pyramid-tooltip-entity",children:[u.jsx("div",{className:"pyramid-tooltip-title",children:e.entity.display_name}),u.jsxs("div",{className:"pyramid-tooltip-meta",children:[e.entity.entity_type??"Unknown"," · L",e.level," ",e.levelName]}),e.entity.description&&u.jsx("p",{className:"pyramid-tooltip-desc",children:e.entity.description}),u.jsxs("div",{className:"pyramid-tooltip-meta",children:[e.entity.relationship_count??0," relationships · ",ru(e.entity.money_flow_total_usd??0)," flow"]}),e.entity.key_connections&&e.entity.key_connections.length>0&&u.jsxs("div",{className:"pyramid-tooltip-list",children:[u.jsx("span",{className:"pyramid-tooltip-label",children:"Key connections:"}),e.entity.key_connections.slice(0,3).map(o=>u.jsx("span",{className:"pyramid-tooltip-item",children:o},o))]})]}),e.kind==="flow"&&u.jsxs("div",{className:"pyramid-tooltip-flow",children:[u.jsxs("div",{className:"pyramid-tooltip-title",children:[e.fromName," → ",e.toName]}),u.jsxs("div",{className:"pyramid-tooltip-meta",children:[ru(e.flow.total_usd)," · ",e.flow.flow_count," flow(s)"]})]})]})}const gl=600,tm=420,$A=44,DA=90,Gt=gl/2,Ts=.12*gl,nm=.42*gl;function IA(e){return e>=1e12?`$${(e/1e12).toFixed(2)}T`:e>=1e9?`$${(e/1e9).toFixed(2)}B`:e>=1e6?`$${(e/1e6).toFixed(2)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}const rm={Corporation:"#5B4FFF","Government Agency":"#FF6B35","Research Institution":"#FF9800",Facility:"#4CAF50",Program:"#E91E63",Individual:"#2196F3",Organization:"#00BCD4","Investment Firm":"#E91E63",Unknown:"#9E9E9E"};function im(e){return e&&rm[e]||rm.Unknown}const LA=8,om=10;function UA(e){return e.length<=om?e:e.slice(0,om-1)+"…"}function sm(e){return[...e].sort((n,r)=>{const i=(r.relationship_count??0)-(n.relationship_count??0);return i!==0?i:(r.money_flow_total_usd??0)-(n.money_flow_total_usd??0)})}function BA(e){const{data:n,loading:r=!1,highlightedEntityId:i=null,onEntityClick:o,showFlowLines:s=!0,activeLevels:a=[1,2,3,4,5,6],chainEntityIds:l}=e,f=j=>!l||l.size===0||l.has(j),[c,h]=E.useState(null),[d,p]=E.useState(null),[y,g]=E.useState(null),x=E.useCallback((j,C)=>{p(j.level);const T=sm(j.entities).slice(0,3).map(F=>F.display_name);g({data:{kind:"tier",tier:j,topEntities:T},x:C.clientX,y:C.clientY})},[]),_=E.useCallback(()=>{p(null),g(null)},[]),m=E.useCallback(()=>g(null),[]),v=(n==null?void 0:n.levels)??[],w=(n==null?void 0:n.cross_level_flows)??[],b=E.useMemo(()=>{const j=new Set(a.length?a:[1,2,3,4,5,6]);return v.filter(C=>j.has(C.level))},[v,a]),k=E.useMemo(()=>{const j=b.reduce((F,A)=>F+Math.max(A.entity_count,1),0)||1;let C=20;const T=[];for(let F=0;F0)for(var r=new Array(o),i=0,o,a;i