1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1564],{14442:(e,r,n)=>{n.d(r,{a:()=>d});var t=n(37876),a=n(14232),o=n(58725),s=n(29053),i=n(91971);let l={roadmap_alignment:"Roadmap alignment",customer_weight:"Customer weight",churn_risk:"Churn risk",implementation_complexity:"Implementation complexity",evidence_strength:"Evidence strength",strategic_urgency:"Strategic urgency",confidence:"Confidence"};function c(e){return l[e]||e.replace(/_/g," ")}function d(e){let{label:r,score:n,rawScore:l,reasoning:d,details:u,className:p,defaultOpen:m=!1}=e,[g,x]=(0,a.useState)(m),y=(0,a.useMemo)(()=>{let e=u&&"object"==typeof u?u:null,r="string"==typeof(null==e?void 0:e.summary)&&e.summary.trim()||d||null,t=(null==e?void 0:e.factors)&&"object"==typeof e.factors?Object.entries(e.factors).map(e=>{let[r,n]=e,t=n&&"object"==typeof n?n:{};return{key:r,score:"number"==typeof t.score?t.score:null,weight:"number"==typeof t.weight?t.weight:null,status:"string"==typeof t.status?t.status:null,reasoning:"string"==typeof t.reasoning?t.reasoning:null}}).sort((e,r)=>{var n,t;return(null!=(n=r.weight)?n:0)-(null!=(t=e.weight)?t:0)}):[],a=(null==e?void 0:e.policy)&&"object"==typeof e.policy?e.policy:null,o=Array.isArray(null==a?void 0:a.dimensions)?a.dimensions.map((e,r)=>{let n=e&&"object"==typeof e?e:{},t="string"==typeof n.key&&n.key.trim()?n.key:"dimension_".concat(r+1);return{key:t,label:"string"==typeof n.label&&n.label.trim()?n.label:c(t),score:"number"==typeof n.score?n.score:null,effectiveScore:"number"==typeof n.effective_score?n.effective_score:null,weight:"number"==typeof n.weight?n.weight:null,status:"string"==typeof n.status?n.status:null,reasoning:"string"==typeof n.reasoning?n.reasoning:null,unknownBehavior:"string"==typeof n.unknown_behavior?n.unknown_behavior:null,unknownScore:"number"==typeof n.unknown_score?n.unknown_score:null,imputed:!0===n.imputed}}).sort((e,r)=>{var n,t;return(null!=(n=r.weight)?n:0)-(null!=(t=e.weight)?t:0)}):[],s=Array.isArray(null==e?void 0:e.comparables)?e.comparables:[],i="string"==typeof(null==e?void 0:e.calibration_summary)&&e.calibration_summary.trim()?e.calibration_summary:null,p="number"==typeof(null==e?void 0:e.final_score)?e.final_score:"number"==typeof n?n:null,m="number"==typeof(null==e?void 0:e.raw_score)?e.raw_score:"number"==typeof l?l:null;return{summary:r,factors:o.length>0?[]:t,policyDimensions:o,policyName:"string"==typeof(null==a?void 0:a.name)&&a.name.trim()?a.name:null,policySource:"string"==typeof(null==a?void 0:a.source)&&a.source.trim()?a.source:null,policyCoverage:"number"==typeof(null==a?void 0:a.coverage)?Math.max(0,Math.min(1,a.coverage)):null,policyProvisional:(null==a?void 0:a.provisional)===!0,comparables:s,calibrationSummary:i,finalScore:p,rawScore:m}},[u,d,n,l]),b=y.policyDimensions.length>0||y.factors.length>0||y.comparables.length>0||!!y.calibrationSummary;return y.summary||b||r||"number"==typeof y.finalScore?(0,t.jsxs)("div",{className:(0,i.cn)("rounded-md border border-border/60 bg-muted/20 px-3 py-2 space-y-2",p),children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[r?(0,t.jsxs)("span",{className:(0,i.cn)("inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11px] font-medium capitalize",function(e){switch((e||"").toLowerCase()){case"critical":return"text-red-700 bg-red-50 border-red-200 dark:text-red-300 dark:bg-red-950/30 dark:border-red-900";case"high":return"text-orange-700 bg-orange-50 border-orange-200 dark:text-orange-300 dark:bg-orange-950/30 dark:border-orange-900";case"medium":return"text-amber-700 bg-amber-50 border-amber-200 dark:text-amber-300 dark:bg-amber-950/30 dark:border-amber-900";default:return"text-blue-700 bg-blue-50 border-blue-200 dark:text-blue-300 dark:bg-blue-950/30 dark:border-blue-900"}}(r)),children:[(0,t.jsx)("span",{children:r}),"number"==typeof y.finalScore?(0,t.jsx)("span",{className:"opacity-80",children:Math.round(y.finalScore)}):null]}):null,"number"==typeof y.rawScore?(0,t.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:["Raw ",Math.round(y.rawScore)]}):null,y.policyProvisional?(0,t.jsxs)("span",{className:"inline-flex items-center rounded-md border border-amber-200 bg-amber-50 px-2 py-1 text-[11px] font-medium text-amber-700 dark:border-amber-900 dark:bg-amber-950/30 dark:text-amber-300",children:["Provisional","number"==typeof y.policyCoverage?" \xb7 ".concat(Math.round(100*y.policyCoverage),"% verified"):""]}):null,"number"==typeof y.finalScore&&"number"==typeof y.rawScore&&Math.round(y.finalScore)!==Math.round(y.rawScore)?(0,t.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:["Final ",Math.round(y.finalScore)]}):null]}),y.summary?(0,t.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:y.summary}):null]}),b?(0,t.jsxs)("button",{type:"button",onClick:()=>x(e=>!e),className:"inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors shrink-0",children:[g?(0,t.jsx)(o.A,{className:"h-3 w-3"}):(0,t.jsx)(s.A,{className:"h-3 w-3"}),(0,t.jsxs)("span",{children:[g?"Hide":"Show"," breakdown"]})]}):null]}),g&&b?(0,t.jsxs)("div",{className:"space-y-3 border-t border-border/60 pt-3",children:[y.policyDimensions.length>0?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground
1/70",children:"Scoring policy"}),y.policyName||y.policySource?(0,t.jsx)("div",{className:"text-[11px] text-muted-foreground",children:[y.policyName,y.policySource].filter(Boolean).join(" \xb7 ")}):null]}),(0,t.jsx)("div",{className:"space-y-2",children:y.policyDimensions.map(e=>{var r,n;let a="exclude_and_renormalize"===e.unknownBehavior?"unknown \xb7 excluded":"unknown â ".concat(Math.round(null!=(n=null!=(r=e.unknownScore)?r:e.effectiveScore)?n:0)," prior");return(0,t.jsxs)("div",{className:"rounded-md bg-background/70 px-2.5 py-2 border border-border/50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs",children:[(0,t.jsx)("span",{className:"font-medium text-foreground/85",children:e.label}),(0,t.jsxs)("span",{className:"text-muted-foreground",children:["unknown"===e.status||e.imputed?a:"number"==typeof e.score?"".concat(e.score.toFixed(0),"/100"):"â","number"==typeof e.weight?" \xb7 ".concat((100*e.weight).toFixed(0),"%"):""]})]}),e.reasoning?(0,t.jsx)("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e.reasoning}):null]},e.key)})})]}):null,y.factors.length>0?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground/70",children:"Factors"}),(0,t.jsx)("div",{className:"space-y-2",children:y.factors.map(e=>(0,t.jsxs)("div",{className:"rounded-md bg-background/70 px-2.5 py-2 border border-border/50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs",children:[(0,t.jsx)("span",{className:"font-medium text-foreground/85",children:c(e.key)}),(0,t.jsxs)("span",{className:"text-muted-foreground",children:["unknown"===e.status?"unknown":"number"==typeof e.score?"".concat(e.score.toFixed(1),"/5"):"â","number"==typeof e.weight?" \xb7 ".concat((100*e.weight).toFixed(0),"%"):""]})]}),e.reasoning?(0,t.jsx)("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e.reasoning}):null]},e.key))})]}):null,y.calibrationSummary?(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground/70",children:"Calibration"}),(0,t.jsx)("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:y.calibrationSummary})]}):null,y.comparables.length>0?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground/70",children:"Comparables"}),(0,t.jsx)("div",{className:"space-y-2",children:y.comparables.map((e,r)=>(0,t.jsxs)("div",{className:"rounded-md bg-background/70 px-2.5 py-2 border border-border/50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs",children:[(0,t.jsxs)("span",{className:"font-medium text-foreground/85",children:[function(e){switch(e){case"higher_than":return"Higher than";case"lower_than":return"Lower than";case"similar_to":return"Similar to";default:return"Comparable to"}}(e.relationship)," ",e.name||e.entity_id]}),"number"==typeof e.existing_score?(0,t.jsx)("span",{className:"text-muted-foreground",children:Math.round(e.existing_score)}):null]}),e.reasoning?(0,t.jsx)("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:e.reasoning}):null]},"".concat(e.entity_id||"comparable","-").concat(r)))})]}):null]}):null]}):null}},36961:(e,r,n)=>{n.d(r,{P:()=>i,h:()=>l});var t=n(67768),a=n(40097),o=n(31472),s=n(74131);async function i(e,r){let{data:{session:n}}=await s.y.getSession(),t={"Content-Type":"application/json",...null==r?void 0:r.headers};(null==n?void 0:n.access_token)&&(t.Authorization="Bearer ".concat(n.access_token));let a=await fetch(e,{cache:"no-store",...r,headers:t}),o=await a.json().catch(()=>null);if(!a.ok||(null==o?void 0:o.success)===!1){let e=Array.isArray(null==o?void 0:o.errors)?o.errors.filter(Boolean):[];throw Error((null==o?void 0:o.userMessage)||(null==o?void 0:o.message)||e[0]||(null==o?void 0:o.error)||"Request failed with status ".concat(a.status))}return o}function l(e){let{toast:r}=(0,o.dj)(),n=(0,t.jE)(),s=()=>
1{n.invalidateQueries({queryKey:["/api/workspaces/".concat(e,"/proposed-changes")]}),n.invalidateQueries({queryKey:["/api/roadmaps"]})},l=(0,a.n)({mutationFn:async r=>i("/api/workspaces/".concat(e,"/proposed-changes"),{method:"POST",body:JSON.stringify({action:"approve",changeId:r})}),onSuccess:()=>{s(),r({title:"Success",description:"Proposal approved and executed"})},onError:e=>{r({title:"Error",description:e.message||"Failed to approve",variant:"destructive"})}}),c=(0,a.n)({mutationFn:async r=>{let{changeId:n,reason:t}=r;return i("/api/workspaces/".concat(e,"/proposed-changes"),{method:"POST",body:JSON.stringify({action:"reject",changeId:n,reason:t})})},onSuccess:()=>{s(),r({title:"Success",description:"Proposal rejected"})},onError:e=>{r({title:"Error",description:e.message||"Failed to reject",variant:"destructive"})}}),d=(0,a.n)({mutationFn:async r=>{let{changeId:n,overrideReason:t}="string"==typeof r?{changeId:r,overrideReason:void 0}:r;return i("/api/workspaces/".concat(e,"/proposed-changes"),{method:"POST",body:JSON.stringify({action:"cascade_approve",changeId:n,...t?{override_reason:t}:{}})})},onSuccess:e=>{var n;s(),r({title:"Success",description:"Approved ".concat((null==(n=e.approved)?void 0:n.length)||0," proposals in cascade")})},onError:e=>{r({title:"Error",description:e.message||"Failed to cascade approve",variant:"destructive"})}}),u=(0,a.n)({mutationFn:async r=>{let{changeIds:n,overrideReason:t}=Array.isArray(r)?{changeIds:r,overrideReason:void 0}:null!=r?r:{};return i("/api/workspaces/".concat(e,"/proposed-changes"),{method:"POST",body:JSON.stringify({action:"bulk_approve",...n&&n.length>0?{changeIds:n}:{},...t?{override_reason:t}:{}})})},onSuccess:e=>{var n;s(),r({title:"Success",description:"Approved ".concat((null==(n=e.approved)?void 0:n.length)||0," proposals")})},onError:e=>{r({title:"Error",description:e.message||"Failed to bulk approve",variant:"destructive"})}});return{approve:l.mutate,approveAsync:l.mutateAsync,reject:(e,r)=>c.mutate({changeId:e,reason:r}),rejectAsync:(e,r)=>c.mutateAsync({changeId:e,reason:r}),cascadeApprove:d.mutate,cascadeApproveAsync:d.mutateAsync,bulkApprove:()=>u.mutate(void 0),bulkApproveAsync:u.mutateAsync,isMutating:l.isPending||c.isPending||d.isPending||u.isPending}}}}]);
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.