1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8661],{32659:function(e,r,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/pipeline",function(){return s(77334)}])},25234:function(e,r,s){"use strict";s.d(r,{b:function(){return i}});var n=s(85893);s(67294);var t=s(71073);let l={info:"border-l-accent bg-accent-wash",success:"border-l-ok bg-ok-wash",warning:"border-l-warn bg-warn-wash",error:"border-l-err bg-err-wash"},a={info:"text-accent",success:"text-ok",warning:"text-warn",error:"text-err"};function i(e){let{variant:r="info",title:s,children:i,className:d,...c}=e;return(0,n.jsxs)("div",{className:(0,t.cn)("rounded-1 border-l-[3px] p-4 text-sm text-ink",l[r],d),...c,children:[s&&(0,n.jsx)("p",{className:(0,t.cn)("mb-1 font-mono text-[11px] font-medium uppercase tracking-wider",a[r]),children:s}),(0,n.jsx)("div",{className:"text-ink",children:i})]})}},17981:function(e,r,s){"use strict";s.d(r,{C:function(){return i}});var n=s(85893);s(67294);var t=s(12003),l=s(71073);let a=(0,t.j)("inline-flex items-center rounded-1 border px-1.5 py-0.5 font-mono text-[11px] font-medium uppercase tracking-wider",{variants:{variant:{default:"text-accent border-accent bg-transparent",secondary:"text-ink-2 border-line-strong bg-transparent",destructive:"text-err border-err bg-err-wash",outline:"text-ink-2 border-line-strong",success:"text-ok border-ok bg-ok-wash",warning:"text-warn border-warn bg-warn-wash"}},defaultVariants:{variant:"default"}});function i(e){let{className:r,variant:s,...t}=e;return(0,n.jsx)("div",{className:(0,l.cn)(a({variant:s}),r),...t})}},61612:function(e,r,s){"use strict";s.d(r,{Ol:function(){return i},Zb:function(){return a},aY:function(){return c},ll:function(){return d}});var n=s(85893),t=s(67294),l=s(71073);let a=t.forwardRef((e,r)=>{let{className:s,...t}=e;return(0,n.jsx)("div",{ref:r,className:(0,l.cn)("rounded-2 border border-line bg-surface text-card-foreground",s),...t})});a.displayName="Card";let i=t.forwardRef((e,r)=>{let{className:s,...t}=e;return(0,n.jsx)("div",{ref:r,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",s),...t})});i.displayName="CardHeader";let d=t.forwardRef((e,r)=>{let{className:s,...t}=e;return(0,n.jsx)("h3",{ref:r,className:(0,l.cn)("text-lg font-semibold leading-none tracking-tight",s),...t})});d.displayName="CardTitle",t.forwardRef((e,r)=>{let{className:s,...t}=e;return(0,n.jsx)("p",{ref:r,className:(0,l.cn)("text-sm text-muted-foreground",s),...t})}).displayName="CardDescription";let c=t.forwardRef((e,r)=>{let{className:s,...t}=e;return(0,n.jsx)("div",{ref:r,className:(0,l.cn)("p-6 pt-0",s),...t})});c.displayName="CardContent",t.forwardRef((e,r)=>{let{className:s,...t}=e;return(0,n.jsx)("div",{ref:r,className:(0,l.cn)("flex items-center p-6 pt-0",s),...t})}).displayName="CardFooter"},78204:function(e,r,s){"use strict";s.d(r,{O:function(){return l}});var n=s(85893),t=s(71073);function l(e){let{className:r,...s}=e;return(0,n.jsx)("div",{className:(0,t.cn)("animate-pulse rounded-1 bg-surface-muted",r),...s})}},91414:function(e,r,s){"use strict";s.d(r,{RM:function(){return d},SC:function(){return c},iA:function(){return a},pj:function(){return x},ss:function(){return o},xD:function(){return i}});var n=s(85893),t=s(67294),l=s(71073);let a=t.forwardRef((e,r)=>{let{className:s,...t}=e;return(0,n.jsx)("div",{className:"relative w-full overflow-auto",children:(0,n.jsx)("table",{ref:r,className:(0,l.cn)("w-full caption-bottom text-sm [font-variant-numeric:tabular-nums]",s),...t})})});a.displayName="Table";let i=t.forwardRef((e,r)=>{let{className:s,...t}=e;return(0,n.jsx)("thead",{ref:r,className:(0,l.cn)("[&_tr]:border-b [&_tr]:border-line-strong",s),...t})});i.displayName="TableHeader";let d=t.forwardRef((e,r)=>{let{className:s,...t}=e;return(0,n.jsx)("tbody",{ref:r,className:(0,l.cn)("[&_tr:last-child]:border-0",s),...t})});d.displayName="TableBody",t.forwardRef((e,r)=>{let{className:s,...t}=e;return(0,n.jsx)("tfoot",{ref:r,className:(0,l.cn)("border-t-2 border-ink font-semibold [&>tr]:last:border-b-0",s),...t})}).displayName="TableFooter";let c=t.forwardRef((e,r)=>{let{className:s,...t}=e;return(0,n.jsx)("tr",{ref:r,className:(0,l.cn)("border-b border-line-hairline transition-colors hover:bg-surface-muted/50 data-[state=selected]:bg-surface-muted",s),...t})});c.displayName="TableRow";let o=t.forwardRef((e,r)=>{let{className:s,...t}=e;return(0,n.jsx)("th",{ref:r,className:(0,l.cn)("h-10 px-4 text-left align-middle font-mono text-[11px] font-medium uppercase tracking-wider text-ink-2 [&:has([role=checkbox])]:pr-0",s),...t})});o.displayName="TableHead";let x=t.forwardRef((e,r)=>{let{className:s,...t}=e;return(0,n.jsx)("td",{ref:r,className:(0,l.cn)("px-4 py-2.5 align-middle [&:has([role=checkbox])]:pr-0",s),...t})});x.displayName="TableCell",t.forwardRef((e,r)=>{let{className:s,...t}=e;return(0,n.jsx)("caption",{ref:r,className:(0,l.cn)("mt-4 text-sm text-ink-2",s),...t})}).displayName="TableCaption"}
1,77334:function(e,r,s){"use strict";s.r(r),s.d(r,{default:function(){return w}});var n=s(85893),t=s(67294),l=s(9008),a=s.n(l),i=s(16976),d=s(97355),c=s(61612),o=s(17981),x=s(25234),u=s(78204),j=s(91414),m=s(20569),f=s(80261),h=s(71073);let p=async e=>{let r=await fetch(e);if(!r.ok)throw Error("Failed to fetch");return r.json()},b={"Blueprint-Verified":"success","High Confidence":"default",Standard:"warning","Needs Attention":"destructive"};function v(e){var r;let{grade:s,className:t}=e;return(0,n.jsx)(o.C,{variant:null!==(r=b[s])&&void 0!==r?r:"secondary",className:t,children:s})}let g=[7,30,90,365];function N(e){let{label:r,value:s,valueClassName:t}=e;return(0,n.jsx)(c.Zb,{children:(0,n.jsxs)(c.aY,{className:"p-6",children:[(0,n.jsx)("p",{className:"font-mono text-[11px] uppercase tracking-wider text-ink-2",children:r}),(0,n.jsx)("p",{className:(0,h.cn)("mt-1 text-2xl font-semibold text-ink [font-variant-numeric:tabular-nums]",t),children:s})]})})}function w(){var e,r,s,l,o,b,w,k,_,y,C,R,S;let[A,T]=t.useState(30),{data:M,error:Z,isLoading:F}=(0,i.ZP)("/api/admin/pipeline/data?days=".concat(A),p,{refreshInterval:6e4}),I=null!==(C=null==M?void 0:null===(e=M.flagged_jobs)||void 0===e?void 0:e.length)&&void 0!==C?C:0,O=null!==(R=null==M?void 0:null===(s=M.grade_mix)||void 0===s?void 0:null===(r=s.find(e=>"Blueprint-Verified"===e.grade))||void 0===r?void 0:r.pct)&&void 0!==R?R:0,D=null!==(S=null==M?void 0:null===(o=M.grade_mix)||void 0===o?void 0:null===(l=o.find(e=>"Needs Attention"===e.grade))||void 0===l?void 0:l.count)&&void 0!==S?S:0;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a(),{children:(0,n.jsx)("title",{children:"HVAC IQ - Admin - AutoHVAC"})}),(0,n.jsxs)(d.Z,{title:"HVAC IQ Scorecard",description:"Pipeline quality KPIs from every scored report",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[g.map(e=>(0,n.jsxs)(m.z,{variant:e===A?"default":"outline",size:"sm",onClick:()=>T(e),children:[e,"d"]},e)),M&&(0,n.jsxs)("span",{className:"text-sm text-ink-2 ml-2",children:[M.jobs_scored," scored jobs"]})]}),F?(0,n.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-4",children:[void 0,void 0,void 0,void 0,void 0].map((e,r)=>(0,n.jsx)(c.Zb,{children:(0,n.jsxs)(c.aY,{className:"p-6",children:[(0,n.jsx)(u.O,{className:"h-3 w-1/2 mb-4"}),(0,n.jsx)(u.O,{className:"h-7 w-3/4"})]})},r))}):Z||(null==M?void 0:M.error)?(0,n.jsx)(x.b,{variant:"error",title:"Error",children:"Failed to load scorecard. Please try again."}):(null==M?void 0:M.jobs_scored)?(0,n.jsxs)("div",{className:"space-y-8",children:[(0,n.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-4",children:[(0,n.jsx)(N,{label:"Mean IQ Score",value:M.mean_score}),(0,n.jsx)(N,{label:"Median IQ",value:M.median_score}),(0,n.jsx)(N,{label:"Blueprint-Verified",value:"".concat(O,"%"),valueClassName:"text-ok"}),(0,n.jsx)(N,{label:"Needs Attention",value:D,valueClassName:D?"text-err":"text-ok"}),(0,n.jsx)(N,{label:"Flagged for Review",value:I,valueClassName:I?"text-err":"text-ok"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,n.jsxs)(c.Zb,{children:[(0,n.jsx)(c.Ol,{children:(0,n.jsx)(c.ll,{children:"Grade Mix"})}),(0,n.jsx)(c.aY,{className:"space-y-3",children:null===(b=M.grade_mix)||void 0===b?void 0:b.map(e=>(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)(v,{grade:e.grade,className:"w-40 justify-center"}),(0,n.jsx)("div",{className:"flex-1 bg-surface-muted rounded-1 h-2",children:(0,n.jsx)("div",{className:"bg-accent h-2 rounded-1",style:{width:"".concat(e.pct,"%")}})}),(0,n.jsxs)("span",{className:"text-sm text-ink-2 w-20 text-right [font-variant-numeric:tabular-nums]",children:[e.count," (",e.pct,"%)"]})]},e.grade))})]}),(0,n.jsxs)(c.Zb,{children:[(0,n.jsx)(c.Ol,{children:(0,n.jsx)(c.ll,{children:"Weekly Mean IQ"})}),(0,n.jsx)(c.aY,{children:(0,n.jsxs)(j.iA,{children:[(0,n.jsx)(j.xD,{children:(0,n.jsxs)(j.SC,{children:[(0,n.jsx)(j.ss,{children:"Week"}),(0,n.jsx)(j.ss,{children:"Jobs"}),(0,n.jsx)(j.ss,{children:"Mean IQ"}),(0,n.jsx)(j.ss,{})]})}),(0,n.jsx)(j.RM,{children:null===(w=M.weekly_trend)||void 0===w?void 0:w.map(e=>(0,n.jsxs)(j.SC,{children:[(0,n.jsx)(j.pj,{className:"font-medium",children:e.week}),(0,n.jsx)(j.pj,{children:e.jobs}),(0,n.jsx)(j.pj,{children:e.mean_score}),(0,n.jsx)(j.pj,{className:"w-32",children:(0,n.jsx)("div",{className:"bg-surface-muted rounded-1 h-1.5",children:(0,n.jsx)("div",{className:(0,h.cn)("h-1.5 rounded-1",e.mean_score>=90?"bg-ok":e.mean_score>=80?"bg-warn":"bg-err"),style:{width:"".concat(e.mean_score,"%")}})})})]},e.week))})]})})]})]}),(0,n.jsxs)(c.Zb,{children:[(0,n.jsxs)(c.Ol,{children:[(0,n.jsx)(c.ll,{children:"Factor Scorecard"}),(0,n.jsx)("p",{className:"text-sm text-ink-2",children:"Where IQ points are lost. A factor losing points on ~100% of jobs is a scorer or pipeline bug, not a data-quality signal."})]}),(0,n.jsx)(c.aY,{children:(0,n.jsxs)(j.iA,{children:[(0,n.jsx)(j.xD,{children:(0,n.jsxs)(j.SC,{children:[(0,n.jsx)(j.ss,{children:"Factor"}),(0,n.jsx)(j.ss,{children:"Max"}),(0,n.jsx)(j.ss,{children:"Avg pts"}),(0,n.jsx)(j.ss,{children:"Full credit"}),(0,n.jsx)(j.ss,{children:"Total pts lost"})]})}),(0,n.jsx)(j.RM,{children:null===(k=M.factors)||void 0===k?void 0:k.map(e=>(0,n.jsxs)(j.SC,{children:[(0,n.jsx)(j.pj,{className:"font-medium font-mono text-xs",children:e.field}),(0,n.jsx)(j.pj,{children:e.max}),(0,n.jsx)(j.pj,{children:e.avg_points}),(0,n.jsx)(j.pj,{children:(0,n.jsxs)("span",{className:(0,h.cn)("font-semibold",e.full_credit_pct<40?"text-err":e.full_credit_pct<80?"text-warn":"text-ok"),children:[e.full_credit_pct,"%"]})}),(0,n.jsx)(j.pj,{children:e.points_lost})]},e.field))})]})})]}),(0,n.jsxs)(c.Zb,{children:[(0,n.jsxs)(c.Ol,{children:[(0,n.jsx)(c.ll,{children:"Input Sources"}),(0,n.jsx)("p",{className:"text-sm text-ink-2",children:"Every % in the Default column is a job where we fell back to zone defaults â the KPI for extraction work (plan item P3)."})]}),(0,n.jsx)(c.aY,{children:(0,n.jsxs)(j.iA,{children:[(0,n.jsx)(j.xD,{children:(0,n.jsxs)(j.SC,{children:[(0,n.jsx)(j.ss,{children:"Field"}),(0,n.jsx)(j.ss,{children:"User-provided"}),(0,n.jsx)(j.ss,{children:"Extracted"}),(0,n.jsx)(j.ss,{children:"Default"})]})}),(0,n.jsx)(j.RM,{children:null===(_=M.input_sources)||void 0===_?void 0:_.map(e=>(0,n.jsxs)(j.SC,{children:[(0,n.jsx)(j.pj,{className:"font-medium font-mono text-xs",children:e.field}),(0,n.jsxs)(j.pj,{children:[e.user_pct,"%"]}),(0,n.jsxs)(j.pj,{children:[e.extracted_pct,"%"]}),(0,n.jsxs)(j.pj,{className:(0,h.cn)(e.default_pct>=40&&"text-err font-semibold"),children:[e.default_pct,"%"]})]},e.field))})]})})]}),I>0&&(0,n.jsxs)(c.Zb,{className:"border-err",children:[(0,n.jsxs)(c.Ol,{children:[(0,n.jsxs)(c.ll,{className:"flex items-center gap-2",children:[(0,n.jsx)(f.Z,{className:"h-[18px] w-[18px] text-err"}),"Flagged Jobs"]}),(0,n.jsx)("p",{className:"text-sm text-ink-2",children:"Physically incoherent results or scores under 70 â review before a customer relies on them."})]}),(0,n.jsx)(c.aY,{children:(0,n.jsxs)(j.iA,{children:[(0,n.jsx)(j.xD,{children:(0,n.jsxs)(j.SC,{children:[(0,n.jsx)(j.ss,{children:"Date"}),(0,n.jsx)(j.ss,{children:"Job"}),(0,n.jsx)(j.ss,{children:"User"}),(0,n.jsx)(j.ss,{children:"Score"}),(0,n.jsx)(j.ss,{children:"Grade"})]})}),(0,n.jsx)(j.RM,{children:null===(y=M.flagged_jobs)||void 0===y?void 0:y.map(e=>(0,n.jsxs)(j.SC,{children:[(0,n.jsx)(j.pj,{children:e.created_at?e.created_at.slice(0,16).replace("T"," "):"?"}),(0,n.jsxs)(j.pj,{className:"font-mono text-xs",children:[e.id.slice(0,8),"â¦"]}),(0,n.jsx)(j.pj,{className:"text-sm",children:e.email||"â"}),(0,n.jsx)(j.pj,{className:"font-semibold",children:Math.round(e.score)}),(0,n.jsx)(j.pj,{children:(0,n.jsx)(v,{grade:e.grade})})]},e.id))})]})})]})]}):(0,n.jsx)(c.Zb,{children:(0,n.jsxs)(c.aY,{className:"p-6 text-ink-2",children:["No scored jobs in the last ",A," days."]})})]})]})}}},function(e){e.O(0,[1216,7355,2888,179],function(){return e(e.s=32659)}),_N_E=e.O()}]);
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.