PageSourceSearch

https://www.shieldra.ai/assets/risk-prioritization.page-BkrL7om2.js

js shieldra.ai collected 2026-10-05 13:58:12 UTC 16,337 bytes, 1 lines download raw bytes

1import{r as O,j as e,p as v,v as W,l as Q}from"./vendor-react-BBWSWmGs.js";import{u as U,D as $}from"./data-table-pagination-BdIGt_6F.js";import{P as M,B as F,a1 as X,a2 as Y,a3 as _,a4 as R,a as N,C as c,b as l,c as d,d as o,k as C,i as P}from"./index-wOQ1qYka.js";import{T as J,a as V,b as L,c as j,d as Z,e as g}from"./table-BYUnt8dq.js";import{F as ee}from"./FeedbackAffordance-DJ97Xcj5.js";import{R as S,x as f,aK as m,T as p,c as T,$ as se,d as B}from"./vendor-icons-DVMne4jX.js";import{R as A,B as re,X as K,Y as G,T as E,L as H,e as q,f as te,g as I}from"./vendor-charts-CJ2ekmFy.js";import"./select-9eRL3UR3.js";import"./vendor-ui-BreKxShT.js";import"./vendor-utils-Lnjz4V8o.js";import"./use-permission-Db5SbPUX.js";import"./learning-engine-WSyVwCbV.js";import"./switch-BqXTBt_n.js";function u(s){return s.toLocaleString("en-US")}function ae(s){switch(s.toLowerCase()){case"critical":return"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200";case"high":return"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200";case"medium":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200";case"low":return"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200";default:return"bg-muted text-muted-foreground"}}function ie(s){const a=typeof s=="number"?s:parseInt(s,10);return a<=3?"bg-red-600 text-white":a<=10?"bg-orange-500 text-white":a<=25?"bg-yellow-500 text-yellow-950":"bg-blue-500 text-white"}function ne(){return v({queryKey:["risk-prioritization","scores"],queryFn:async()=>{const{data:s}=await N.get("/risk-prioritization/scores");return(Array.isArray(s)?s:s.items??[]).map(r=>{var t,i,h,x;return{id:r.id,requirement:((t=r.finding)==null?void 0:t.title)??r.requirement_id??"Unknown",requirement_id:r.requirement_id,category:(i=r.finding)==null?void 0:i.category,risk_score:r.final_risk_score??0,severity:((h=r.finding)==null?void 0:h.severity)??"medium",effort_hours:r.effort_estimate_hours??0,roi_score:r.roi_score??0,priority:r.recommended_priority??0,breach_probability_reduction:r.risk_reduction_pct,description:(x=r.finding)==null?void 0:x.cfr_reference}})}})}function ce(){return v({queryKey:["risk-prioritization","roadmap"],queryFn:async()=>{const{data:s}=await N.get("/risk-prioritization/roadmap");return s}})}function le(){return v({queryKey:["risk-prioritization","breach-intelligence"],queryFn:async()=>{const{data:s}=await N.get("/risk-prioritization/breach-intelligence");return Array.isArray(s)?s:s.items??[]}})}function de(){return v({queryKey:["risk-prioritization","trends"],queryFn:async()=>{const{data:s}=await N.get("/risk-prioritization/trends");return Array.isArray(s)?s:s.items??[]}})}function oe(){const s=W();return Q({mutationFn:async()=>{const{data:a}=await N.post("/risk-prioritization/calculate");return a},onSuccess:()=>{s.invalidateQueries({queryKey:["risk-prioritization"]})}})}function b({rows:s=3}){return e.jsx("div",{className:"space-y-4",children:Array.from({length:s}).map((a,r)=>e.jsxs("div",{className:"animate-pulse space-y-3",children:[e.jsx("div",{className:"h-4 w-3/4 rounded bg-muted"}),e.jsx("div",{className:"h-3 w-1/2 rounded bg-muted"})]},r))})}function w({icon:s,title:a,description:r}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx(s,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:a}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:r})]})}function xe({roadmap:s,isLoading:a,onCalculate:r,isCalculating:t}){if(a)return e.jsx(c,{className:"border-primary/20 bg-brand-50 dark:bg-brand-950/30",children:e.jsx(l,{className:"p-8",children:e.jsx(b,{rows:2})})});const i=(s==null?void 0:s.items_selected)??0,h=(s==null?void 0:s.cumulative_risk_reduction_pct)??0,x=(s==null?void 0:s.total_effort_hours)??0;return e.jsx(c,{className:"border-primary/20 bg-brand-50 dark:bg-brand-950/30",children:e.jsxs(l,{className:"p-8",children:[e.jsxs("div",{className:"flex flex-col gap-6 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{className:"h-6 w-6 text-primary"}),e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Risk-Weighted Prioritization"})]}),i>0?e.jsxs("p",{className:"text-lg text-muted-foreground",children:["Fix these"," ",e.jsxs("span",{className:"font-semibold text-foreground",children:[u(i)," items"]})," ","to reduce breach probability by"," ",e.jsxs("span",{className:"font-semibold text-green-600 dark:text-green-400",children:[h.toFixed(1),"%"]})]}):e.jsx("p",{className:"text-lg text-muted-foreground",children:"Calculate priorities to see your optimized remediation roadmap."}),x>0&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(T,{className:"h-4 w-4"}),e.jsxs("span",{children:["Estimated effort:"," ",e.jsxs("span",{className:"font-medium text-foreground",children:[u(x)," hours"]})]})]})]}),e.jsx("div",{children:e.jsxs(F,{size:"lg",onClick:r,disabled:t,className:"gap-2",children:[t?e.jsx(S,{className:"h-4 w-4 animate-spin"}):e.jsx(se,{className:"h-4 w-4"}),t?"Calculating...":"Calculate Priorities"]})})]}),i>0&&e.jsxs("div",{className:"mt-6 grid gap-4 md:grid-cols-3",children:[e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-red-100 dark:bg-red-900",children:e.jsx(p,{className:"h-5 w-5 text-red-600 dark:text-red-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:u(i)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Prioritized Gaps"})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-green-100 dark:bg-green-900",children:e.jsx(m,{className:"h-5 w-5 text-green-600 dark:text-green-400"})}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-2xl font-bold",children:[h.toFixed(1),"%"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Breach Probability Reduction"})]})]})}),e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-blue-100 dar
1k:bg-blue-900",children:e.jsx(T,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-2xl font-bold",children:[u(x),"h"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Effort"})]})]})})]})]})})}function me({scores:s,isLoading:a}){const{page:r,pageSize:t,setPage:i,setPageSize:h}=U({key:"rankedGaps"}),x=s.slice((r-1)*t,r*t);return a?e.jsxs(c,{children:[e.jsx(d,{children:e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(f,{className:"h-5 w-5"}),"Ranked Gaps"]})}),e.jsx(l,{children:e.jsx(b,{rows:5})})]}):s.length===0?e.jsxs(c,{children:[e.jsx(d,{children:e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(f,{className:"h-5 w-5"}),"Ranked Gaps"]})}),e.jsx(l,{children:e.jsx(w,{icon:B,title:"No prioritized gaps",description:"Click 'Calculate Priorities' to analyze your compliance gaps and generate a risk-ranked remediation list."})})]}):e.jsxs(c,{children:[e.jsx(d,{children:e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(f,{className:"h-5 w-5"}),"Ranked Gaps (",u(s.length),")"]})}),e.jsxs(l,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(J,{children:[e.jsx(V,{children:e.jsxs(L,{children:[e.jsx(j,{className:"w-12",children:"#"}),e.jsx(j,{children:"Requirement"}),e.jsx(j,{className:"text-center",children:"Risk Score"}),e.jsx(j,{className:"text-center",children:"Severity"}),e.jsx(j,{className:"text-center",children:"Effort (hrs)"}),e.jsx(j,{className:"text-center",children:"ROI Score"}),e.jsx(j,{className:"text-center",children:"Priority"})]})}),e.jsx(Z,{children:x.map((n,y)=>e.jsxs(L,{children:[e.jsx(g,{className:"font-medium text-muted-foreground",children:(r-1)*t+y+1}),e.jsx(g,{children:e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:n.requirement}),n.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1 mt-0.5",children:n.description}),n.category&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:n.category})]})}),e.jsx(g,{className:"text-center",children:e.jsxs("div",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:"font-semibold",children:n.risk_score.toFixed(1)}),e.jsx(ee,{entityType:"finding",entityId:n.id,aiJudgment:{field:"risk_score",value:n.risk_score},requirementId:n.requirement_id,placement:"inline-subtle",size:"xs"})]})}),e.jsx(g,{className:"text-center",children:e.jsx(C,{className:P("text-xs",ae(n.severity)),children:n.severity})}),e.jsx(g,{className:"text-center text-sm",children:u(n.effort_hours)}),e.jsx(g,{className:"text-center",children:e.jsx("span",{className:"font-semibold",children:n.roi_score.toFixed(1)})}),e.jsx(g,{className:"text-center",children:e.jsxs(C,{className:P("text-xs",ie(n.priority)),children:["#",n.priority]})})]},n.id??y))})]})}),e.jsx($,{page:r,pageSize:t,total:s.length,onPageChange:i,onPageSizeChange:h,itemLabel:"gaps"})]})]})}function he({scores:s,isLoading:a}){if(a)return e.jsxs(c,{children:[e.jsx(d,{children:e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(m,{className:"h-5 w-5"}),"Risk Reduction per Item"]})}),e.jsx(l,{children:e.jsx(b,{rows:4})})]});const r=s.slice(0,15).map((t,i)=>({name:t.requirement.length>30?t.requirement.substring(0,30)+"...":t.requirement,risk_score:t.risk_score,roi_score:t.roi_score,index:i+1}));return r.length===0?e.jsxs(c,{children:[e.jsx(d,{children:e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(m,{className:"h-5 w-5"}),"Risk Reduction per Item"]})}),e.jsx(l,{children:e.jsx(w,{icon:m,title:"No chart data",description:"Calculate priorities to visualize risk reduction by item."})})]}):e.jsxs(c,{children:[e.jsx(d,{children:e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(m,{className:"h-5 w-5"}),"Risk Reduction per Item (Top ",r.length,")"]})}),e.jsx(l,{children:e.jsx("div",{className:"h-[380px]",children:e.jsx(A,{width:"100%",height:"100%",children:e.jsxs(re,{data:r,margin:{top:10,right:30,left:0,bottom:60},children:[e.jsx(K,{dataKey:"index",tick:{fontSize:12},label:{value:"Priority Rank",position:"insideBottom",offset:-5,fontSize:12}}),e.jsx(G,{tick:{fontSize:12}}),e.jsx(E,{contentStyle:{borderRadius:"8px",border:"1px solid hsl(var(--border))",backgroundColor:"hsl(var(--card))",color:"hsl(var(--card-foreground))"},formatter:(t,i)=>[t.toFixed(1),i==="risk_score"?"Risk Score":"ROI Score"],labelFormatter:t=>{const i=r[Number(t)-1];return(i==null?void 0:i.name)??`Item #${t}`}}),e.jsx(H,{formatter:t=>t==="risk_score"?"Risk Score":"ROI Score"}
1),e.jsx(q,{dataKey:"risk_score",fill:"hsl(0, 84%, 60%)",radius:[4,4,0,0]}),e.jsx(q,{dataKey:"roi_score",fill:"hsl(142, 71%, 45%)",radius:[4,4,0,0]})]})})})})]})}function ue({breaches:s,isLoading:a}){return a?e.jsxs(c,{children:[e.jsx(d,{children:e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(p,{className:"h-5 w-5"}),"Breach Intelligence Feed"]})}),e.jsx(l,{children:e.jsx(b,{rows:4})})]}):s.length===0?e.jsxs(c,{children:[e.jsx(d,{children:e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(p,{className:"h-5 w-5"}),"Breach Intelligence Feed"]})}),e.jsx(l,{children:e.jsx(w,{icon:B,title:"No breach data",description:"Breach intelligence records will appear here once available."})})]}):e.jsxs(c,{children:[e.jsx(d,{children:e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(p,{className:"h-5 w-5"}),"Breach Intelligence Feed (",u(s.length),")"]})}),e.jsx(l,{children:e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:s.map(r=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 hover:shadow-md transition-shadow",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:"font-semibold text-sm leading-tight",children:r.breach_entity}),r.breach_type&&e.jsx(C,{variant:"outline",className:"text-xs shrink-0",children:r.breach_type})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(T,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:r.breach_date})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(p,{className:"h-3.5 w-3.5 text-red-500"}),e.jsxs("span",{className:"font-medium",children:[u(r.individuals_affected)," individuals affected"]})]}),r.location_type&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Location: ",r.location_type]}),r.state&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["State: ",r.state]})]}),r.penalty_amount!=null&&r.penalty_amount>0&&e.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400 pt-1 border-t font-medium",children:["Penalty: $",u(r.penalty_amount)]})]},r.id))})})]})}function je({trends:s,isLoading:a}){return a?e.jsxs(c,{children:[e.jsx(d,{children:e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(m,{className:"h-5 w-5"}),"Risk Score Trend"]})}),e.jsx(l,{children:e.jsx(b,{rows:4})})]}):s.length===0?e.jsxs(c,{children:[e.jsx(d,{children:e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(m,{className:"h-5 w-5"}),"Risk Score Trend"]})}),e.jsx(l,{children:e.jsx(w,{icon:m,title:"No trend data",description:"Trend data will appear here as risk scores are calculated over time."})})]}):e.jsxs(c,{children:[e.jsx(d,{children:e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(m,{className:"h-5 w-5"}),"Risk Score Trend"]})}),e.jsx(l,{children:e.jsx("div",{className:"h-[320px]",children:e.jsx(A,{width:"100%",height:"100%",children:e.jsxs(te,{data:s,margin:{top:10,right:30,left:0,bottom:10},children:[e.jsx(K,{dataKey:"date",tick:{fontSize:12}}),e.jsx(G,{tick:{fontSize:12}}),e.jsx(E,{contentStyle:{borderRadius:"8px",border:"1px solid hsl(var(--border))",backgroundColor:"hsl(var(--card))",color:"hsl(var(--card-foreground))"},formatter:(r,t)=>[r.toFixed(1),t==="risk_score"?"Risk Score":"Items Resolved"]}),e.jsx(H,{formatter:r=>r==="risk_score"?"Risk Score":"Items Resolved"}),e.jsx(I,{type:"monotone",dataKey:"risk_score",stroke:"hsl(0, 84%, 60%)",strokeWidth:2,dot:{r:4,fill:"hsl(0, 84%, 60%)"},activeDot:{r:6}}),e.jsx(I,{type:"monotone",dataKey:"items_resolved",stroke:"hsl(142, 71%, 45%)",strokeWidth:2,dot:{r:4,fill:"hsl(142, 71%, 45%)"},activeDot:{r:6}})]})})})})]})}function Te(){const[s,a]=O.useState("overview"),{data:r=[],isLoading:t}=ne(),{data:i,isLoading:h}=ce(),{data:x=[],isLoading:n}=le(),{data:y=[],isLoading:D}=de(),k=oe(),z=()=>{k.mutate()};return e.jsxs("div",{className:"space-y-6",children:[e.jsx(M,{title:"Risk-Weighted Prioritization",description:"AI-driven prioritization of compliance gaps by breach probability, impact, and remediation ROI",actions:e.jsxs(F,{variant:"outline",onClick:z,disabled:k.isPending,className:"gap-2",children:[k.isPending?e.jsx(S,{className:"h-4 w-4 animate-spin"}):e.jsx(S,{className:"h-4 w-4"}),"Recalculate"]})}),e.jsx(xe,{roadmap:i,isLoading:h,onCalculate:z,isCalculating:k.isPending}),e.jsxs(X,{value:s,onValueChange:a,children:[e.jsxs(Y,{children:[e.jsxs(_,{value:"overview",className:"gap-1.5",children:[e.jsx(f,{className:"h-4 w-4"}),"Prioritized Gaps"]}),e.jsxs(_,{value:"charts",className:"gap-1.5",children:[e.jsx(m,{className:"h-4 w-4"}),"Analytics"]}),e.jsxs(_,{value:"breaches",className:"gap-1.5",children:[e.jsx(p,{className:"h-4 w-4"}),"Breach Intelligence"]})]}),e.jsx(R,{value:"overview",className:"space-y-6",children:e.jsx(me,{scores:r,isLoading:t})}),e.jsx(R,{value:"charts",className:"space-y-6",children:e.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[e.jsx(he,{scores:r,isLoading:t}),e.jsx(je,{trends:y,isLoading:D})]})}),e.jsx(R,{value:"breaches",className:"space-y-6",children:e.jsx(ue,{breaches:x,isLoading:n})})]})]})}export{Te 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.