1import{r as T,j as e,B as Pe}from"./react-vendor-B6uJvzsX.js";import{L as ue,C as Le,a as Re,b as Fe,f as ze,g as Be,p as Ie,d as _e,e as Ve,i as Oe}from"./charts-CAVT_6yZ.js";import{c as fe,e as We,M as Ye,C as He,D as qe,a as Ge}from"./assessment-report-export-Bqs_zczU.js";import{S as be}from"./skeleton-B4nqra2C.js";import{a as Y,i as Ke,w as J,fj as ge,B as Ue,cP as Ze}from"./index-gkeVEBTu.js";import{b as he}from"./client-service-CD_EUeHe.js";import{S as Q}from"./SegmentedChips-D7FB4TFf.js";import{a as G,b as K,g as I,S as H,D as R,w as F,r as B,c as Je,d as Qe}from"./dass-severity-bTtfMGqb.js";import{T as te}from"./trending-down-BeiqLZ3z.js";import{T as se}from"./trending-up-B8anmjal.js";import{M as je}from"./minus-CVDuNgZN.js";import{u as ye}from"./useAsyncAction-BPL62Zqa.js";import{F as Xe}from"./file-text-Bk5uTi78.js";import{B as ve}from"./InsightTab-ZPHZNqYc.js";import"./runtime-compat-DMWlq7eb.js";import"./BaseModal-DXmdA1It.js";import"./purify.es-D7ZLfefD.js";import"./scroll-area-7qa9TnpP.js";import"./motion-DaBtJYF3.js";import"./util-BtFFn6_p.js";import"./document-export-D5WvqlWe.js";import"./full-antsa-logo-Dcuzi9hc.js";import"./pdf-download-QUV3q4lU.js";import"./phone-core-Djh2MZdz.js";import"./checkbox-Cmthdbyb.js";import"./check-B_BN2AYp.js";import"./table-Coahs4nx.js";import"./Pagination-538jhJ10.js";import"./chevron-left-7DjxbFre.js";import"./chevron-right-Cgp6CtZq.js";import"./inbox-DiFh-cUX.js";import"./tabs-BMfUGgtW.js";import"./proxy-DX09rRTf.js";import"./index-Bk2xL2KZ.js";import"./index-9EBbqBgc.js";import"./index-H7z60iES.js";import"./activity-XIHpJ0MS.js";import"./chart-column-HL7AOgVt.js";const et=["Depression","Anxiety","Stress"];function tt(u,a){var h,x,v;if(!((h=u==null?void 0:u.data)!=null&&h.length))return[];const f=[];let D=null;for(const S of u.data){const C=(v=(x=S.summary)==null?void 0:x[a])==null?void 0:v.score;typeof C=="number"&&(f.push({date:S.createdAt,score:C,delta:D===null?null:C-D}),D=C)}return f}const st=({data:u,version:a})=>{const[f,D]=T.useState("Depression"),h=T.useMemo(()=>tt(u,f),[u,f]),x=h[h.length-1],v=a==="DASS-21"?G(f):K(f),S=x?I(x.score,f,a):null,C=S?v.findIndex(l=>l.category===S.category):-1;return x?e.jsxs("section",{className:"grid gap-4",children:[e.jsxs("header",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("h3",{className:"text-[10px] font-bold uppercase tracking-[0.12em] text-muted-foreground/60",children:[a," â current severity"]}),e.jsx("div",{className:"inline-flex items-center gap-1 rounded-full bg-[var(--color-bg-muted)] p-0.5",children:et.map(l=>e.jsx("button",{type:"button",onClick:()=>D(l),className:Y("px-3 py-1 text-[12px] font-medium rounded-full transition-colors",f===l?"bg-card text-[var(--color-text-primary)] shadow-[var(--shadow-xs)]":"text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)]"),children:l},l))})]}),e.jsxs("div",{className:"rounded-[var(--radius-xl)] border border-[var(--color-border-hairline)] bg-card shadow-[var(--shadow-card)] p-5",children:[e.jsxs("div",{className:"flex items-baseline gap-3 flex-wrap",children:[e.jsx("span",{className:"text-[36px] font-bold leading-none tracking-tight tabular-nums text-[var(--color-text-primary)]",children:x.score}),e.jsx("span",{className:"text-[13px] font-semibold text-[var(--color-text-secondary)] uppercase tracking-[0.08em]",children:S==null?void 0:S.category}),x.delta!==null&&x.delta!==0&&e.jsxs("span",{className:Y("inline-flex items-center gap-1 text-[12.5px] font-semibold tabular-nums",x.delta<0?"text-[var(--color-green-700)]":"text-[var(--color-red-700)]"),children:[x.delta<0?e.jsx(te,{className:"size-3.5"}):e.jsx(se,{className:"size-3.5"}),x.delta>0?"+":"",x.delta," vs. previous"]})]}),e.jsx("div",{className:"mt-4",children:e.jsx("div",{className:"grid grid-cols-5 gap-1",children:v.map((l,n)=>e.jsxs("div",{children:[e.jsx("div",{className:Y("h-2 rounded-full transition-opacity",C===n?"opacity-100":"opacity-30"),style:{backgroundColor:l.color},"aria-hidden":"true"}),e.jsx("div",{className:Y("mt-1.5 text-center text-[10px] font-semibold uppercase tracking-[0.06em]",C===n?"text-[var(--color-text-primary)]":"text-[var(--color-text-tertiary)]"),children:l.category})]},l.category))})}),h.length>
11&&e.jsxs("div",{className:"mt-5 -mx-5 -mb-5 border-t border-[var(--color-border-hairline)]",children:[e.jsx("div",{className:"px-5 pt-3 pb-2 text-[10px] font-bold uppercase tracking-[0.12em] text-muted-foreground/60",children:"Submission history"}),e.jsx("div",{role:"table",className:"px-5 pb-4",children:h.slice().reverse().slice(0,6).map((l,n)=>{const _=Ke(l.date).format("MMM D, YYYY"),k=l.delta===null||l.delta===0?"flat":l.delta<0?"down":"up";return e.jsxs("div",{role:"row",className:"grid grid-cols-[1fr_auto_auto] items-center gap-3 py-2 text-[13px] border-b last:border-b-0 border-[var(--color-border-hairline)]",children:[e.jsx("div",{role:"cell",className:"text-[var(--color-text-secondary)] tabular-nums",children:_}),e.jsx("div",{role:"cell",className:"font-semibold tabular-nums",children:l.score}),e.jsxs("div",{role:"cell",className:Y("inline-flex items-center gap-1 min-w-[64px] justify-end tabular-nums text-[12px] font-semibold",k==="down"?"text-[var(--color-green-700)]":k==="up"?"text-[var(--color-red-700)]":"text-[var(--color-text-tertiary)]"),children:[k==="down"?e.jsx(te,{className:"size-3"}):k==="up"?e.jsx(se,{className:"size-3"}):e.jsx(je,{className:"size-3"}),l.delta===null?"â":`${l.delta>0?"+":""}${l.delta}`]})]},`${l.date}-${n}`)})})]})]})]}):null},X=({title:u,metrics:a,version:f})=>{const D=I(a.current,u,f),h=a.trend==="improving"?te:a.trend==="worsening"?se:je,x=a.trend==="improving"?"Improving":a.trend==="worsening"?"Worsening":"Stable",v=a.trend==="improving"?"text-success bg-success/10":a.trend==="worsening"?"text-destructive bg-destructive/10":"text-muted-foreground bg-muted";return e.jsxs("div",{className:"rounded-2xl border border-[var(--color-border-hairline)] bg-card p-5 transition-[box-shadow,border-color] duration-200 hover:shadow-md hover:border-border",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-[0.12em] text-muted-foreground/60",children:u}),a.trend&&e.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium ${v}`,children:[e.jsx(h,{className:"size-3"}),x]})]}),e.jsxs("div",{className:"flex flex-col items-center mb-4",children:[e.jsx("span",{className:"text-[36px] font-bold tracking-tight text-foreground leading-none tabular-nums",children:a.current}),e.jsx("span",{className:"mt-2 inline-flex rounded-full px-3 py-0.5 text-xs font-medium capitalize text-primary-foreground",style:{backgroundColor:D.color},children:D.category})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 pt-3 border-t border-border/30",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-[0.12em] text-muted-foreground/60",children:"Min"}),e.jsx("p",{className:"text-sm font-semibold text-foreground tabular-nums mt-0.5",children:a.min})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-[0.12em] text-muted-foreground/60",children:"Avg"}),e.jsx("p",{className:"text-sm font-semibold text-foreground tabular-nums mt-0.5",children:a.average})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-[0.12em] text-muted-foreground/60",children:"Max"}),e.jsx("p",{className:"text-sm font-semibold text-foreground tabular-nums mt-0.5",children:a.max})]})]})]})};Le.register(Re,Fe,ze,Be,Ie,_e,Ve,Oe,Ge);const ee=Je(),Ne=u=>{const a=Qe(u);return{category:a.category,color:a.color}},q="Inter, system-ui, -apple-system, sans-serif",Se=u=>{const{viewMode:a,version:f,annotations:D,yMin:h,yMax:x}=u,v=B("--color-text-secondary","#64748B"),S=B("--color-text-tertiary","#8490A0"),C=F(B("--color-border-hairline","#E8EBF0"),.9),l=B("--color-card","#FFFFFF"),n=B("--color-border-default","#E2E5EA"),_=B("--color-text-primary","#1E293B");return{responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{backgroundColor:l,borderColor:n,borderWidth:1,titleColor:_,bodyColor:v,titleFont:{family:q,weight:600,size:12}
1,bodyFont:{family:q,size:12},padding:10,cornerRadius:8,boxPadding:4,callbacks:{label:k=>{const P=k.parsed.y,$=String(k.dataset.label);if(P==null)return"";if(a==="scores"){const V=I(P,$,f);return`${$}: ${P} - ${V.category}`}const U=Ne(P);return`${$}: ${P}% - ${U.category}`}}},annotation:{annotations:D}},scales:{x:{type:"category",grid:{display:!1},ticks:{font:{family:q,size:12},color:v,autoSkip:!0,maxRotation:45,minRotation:0}},y:{type:"linear",beginAtZero:!0,min:h,max:x,grid:{color:C},ticks:{font:{family:q,size:12},color:v},title:{display:!0,text:a==="scores"?"Score":"Percentile (%)",color:S,font:{family:q,size:12,weight:500}}}}}},Vt=()=>{var ie,ce,de,me,xe;const u=Pe(),a=(u==null?void 0:u.clientId)||"",[f,D]=T.useState(null),[h,x]=T.useState(null),[v,S]=T.useState(!1),[C,l]=T.useState(!0),[n,_]=T.useState("scores"),[k,P]=T.useState("separate"),[$,U]=T.useState({dass21:null,dass42:null}),[V,De]=T.useState({depression:!0,anxiety:!0,stress:!0}),{execute:we}=ye(async()=>{l(!0);const[s,t]=await Promise.all([he(a,ge.DASS21),he(a,ge.DASS42)]);U({dass21:s,dass42:t})},{showErrorToast:!1,onError:s=>{J(s.message)},onFinally:()=>{l(!1)}});T.useEffect(()=>{we()},[]);const Ae=s=>s.map(b=>{var i,y,c,w,A,g,j,d,M;return{date:new Date(b.createdAt).toLocaleDateString(),depression:((y=(i=b.summary)==null?void 0:i.Depression)==null?void 0:y.score)||0,anxiety:((w=(c=b.summary)==null?void 0:c.Anxiety)==null?void 0:w.score)||0,stress:((g=(A=b.summary)==null?void 0:A.Stress)==null?void 0:g.score)||0,depressionPercentile:((j=b.percentiles)==null?void 0:j.Depression)||0,anxietyPercentile:((d=b.percentiles)==null?void 0:d.Anxiety)||0,stressPercentile:((M=b.percentiles)==null?void 0:M.Stress)||0}}),Ce=s=>{De(t=>({...t,[s]:!t[s]}))},re=(s,t)=>{const b=s==="DASS-21"?G(t):K(t),p={};return b.forEach(i=>{p[`${t}-${i.category}`]={type:"box",yMin:i.from,yMax:i.to===1/0?100:i.to,backgroundColor:F(i.color,.15),borderWidth:0}}),p},oe=()=>{const s={};return ee.forEach(t=>{s[`percentile-${t.category}`]={type:"box",yMin:t.from,yMax:t.to,backgroundColor:F(t.color,.15),borderWidth:0}}),s},ae=()=>e.jsxs("div",{className:"mt-3 flex flex-col gap-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-[0.12em] text-muted-foreground/60",children:"Severity ranges"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Object.keys(H).map(s=>e.jsxs("div",{className:"inline-flex items-center gap-1.5 rounded-full border border-border/40 bg-card px-2.5 py-1",children:[e.jsx("span",{className:"size-2 rounded-full",style:{backgroundColor:H[s]}}),e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s})]},s))})]}),Z=(s,t,b,p,i)=>{const y=n==="scores"?t:`${t}Percentile`,c=Ze(t),w=R[t];let A=i;n==="scores"?p==="DASS-21"?A=[0,21]:A=[0,42]:A=[0,100];const g=s.length>0?s[s.length-1]:null,j=g?n==="scores"?g[t]:g[`${t}Percentile`]:0,d=n==="scores"&&g?I(g[t],c,p):n==="percentiles"&&g&&g[`${t}Percentile`]?Ne(Number(g[`${t}Percentile`])):null,M=n==="scores"?p==="DASS-21"?G(c):K(c):ee;return e.jsxs("div",{className:"rounded-2xl border border-border/50 bg-card p-5 flex flex-col transition-shadow duration-200 hover:shadow-md min-h-[44px]",children:[e.jsx("p",{className:"text-[14px] font-semibold text-center mb-3 text-foreground",children:c}),e.jsx("div",{className:"my-5 h-[250px]",children:e.jsx(ue,{data:{labels:s.map(r=>r.date),datasets:[{label:c,data:s.map(r=>{const m=r[y];return Number(m)||0}
1),borderColor:w,backgroundColor:F(w,.1),pointBackgroundColor:w,pointBorderColor:"#fff",pointBorderWidth:2,pointRadius:5,pointHoverRadius:7,tension:s.length===1?0:.4,fill:!1}]},options:Se({viewMode:n,version:p,annotations:n==="scores"?re(p,c):oe(),yMin:A[0],yMax:A[1]})})}),d&&e.jsxs("div",{className:"mt-4 flex flex-col gap-3",children:[e.jsxs("div",{className:"text-center text-sm text-muted-foreground",children:["Current:"," ",e.jsx("span",{className:"font-bold",style:{color:w},children:j})]}),e.jsx("div",{className:"flex gap-1",children:["Normal","Mild","Moderate","Severe","Extremely Severe"].map(r=>{const m=d.category===r;return e.jsx("div",{className:`flex-1 py-1.5 text-[10px] text-center rounded-lg border whitespace-nowrap overflow-hidden text-ellipsis transition-[background-color,color,transform,box-shadow,border-color] duration-200 focus-visible:ring-2 focus-visible:ring-white/80 ${m?"text-white font-semibold scale-[1.03] shadow-sm relative z-[1]":"text-muted-foreground/70 font-medium"}`,style:{backgroundColor:m?H[r]:"transparent",borderColor:m?H[r]:"hsl(var(--border) / 0.4)"},children:r},r)})})]}),n==="percentiles"&&!d&&g&&e.jsxs("div",{className:"mt-[15px] text-center text-sm p-2 bg-muted rounded",children:[e.jsxs("span",{style:{fontWeight:"bold",color:w},children:[Math.round(Number(j)),"%"]})," of patients score below this"]}),n==="scores"&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-4 justify-center",children:M.map(r=>e.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-medium",style:{color:r.color,borderColor:F(r.color,.25)},children:[e.jsx("span",{className:"size-1.5 rounded-full",style:{backgroundColor:r.color}}),r.category,": ",r.from,"-",r.to===1/0?"+":r.to]},`${t}-range-${r.category}`))}),n==="percentiles"&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-4 justify-center",children:ee.map(r=>e.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-medium",style:{color:r.color,borderColor:F(r.color,.25)},children:[e.jsx("span",{className:"size-1.5 rounded-full",style:{backgroundColor:r.color}}),r.category,": ",r.from,"-",r.to,"%"]},`percentile-range-${r.category}`))})]})},ke=(s,t)=>{if(!s)return e.jsxs("div",{className:"rounded-2xl border border-border/50 bg-card p-6",children:[e.jsx("p",{className:"text-base font-semibold text-center mb-4 text-foreground",children:t}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx("div",{className:"flex size-14 items-center justify-center rounded-2xl bg-muted/50 mb-3",children:e.jsx(ve,{className:"size-6 text-muted-foreground/40"})}),e.jsx("p",{className:"text-sm font-medium text-foreground/70 mb-1",children:"No data available"}),e.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Assessment data will appear here after completion."})]})]});if(!s.data.length)return e.jsxs("div",{className:"rounded-2xl border border-border/50 bg-card p-6",children:[e.jsx("p",{className:"text-base font-semibold text-center mb-4 text-foreground",children:t}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx("div",{className:"flex size-14 items-center justify-center rounded-2xl bg-muted/50 mb-3",children:e.jsx(ve,{className:"size-6 text-muted-foreground/40"})}),e.jsx("p",{className:"text-sm font-medium text-foreground/70 mb-1",children:"No assessments completed yet"}),e.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Results will be displayed after the first assessment."})]})]});const b=[...s.data].sort((d,M)=>new Date(M.createdAt).getTime()-new Date(d.createdAt).getTime()),p=b.length?b[0].createdAt:"",i=Ae(s.data),y=fe(s.data),c=t.includes("DASS-21")?"DASS-21":"DASS-42",w=n==="scores"?c==="DASS-21"?21:42:100,A=i.flatMap(d=>n==="scores"?[Number(d.depression),Number(d.anxiety),Number(d.stress)]:[Number(d.depressionPercentile),Number(d.anxietyPercentile),Number(d.stressPercentile)]),g=n==="scores"?Math.max(...A,Math.ceil(w*.75)):100,j=n==="scores"?[0,Math.ceil(g*1.1)]:[0,105];return e.jsxs("div",{className:"rounded-2xl border border-border/50 bg-card p-6",children:[e.jsx("p",{className:"text-base font-semibold text-center mb-5 text-foreground",children:t}),e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-5 gap-y-2 mb-5",children:[e.jsx(Q,{label:"View",value:n,onChange:_,options:[{value:"scores",label:"Scores"},{value:"percentiles",label:"Percentiles"}]}),e.jsx(Q,{label:"Layout",value:k,onChange:P,options:[{value:"combined",label:"Combined"},{value:"separate",label:"Separate"}]})]}),p&&e.jsx("div",{className:"flex justify-center mb-4",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-muted/50 px-3 py-1 text-xs font-medium text-muted-foreground",children:["Latest test: ",new Date(p).toLocaleDateString()]})}),e.jsxs("div",{className:"grid gap-4 mb-6",style:{gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))"},children:[e.jsx(X,{title:"Depression",metrics:y.depression,color:R.depression,version:c}
1),e.jsx(X,{title:"Anxiety",metrics:y.anxiety,color:R.anxiety,version:c}),e.jsx(X,{title:"Stress",metrics:y.stress,color:R.stress,version:c})]}),k==="combined"?(()=>{const d=[],M=[{key:"depression",label:"Depression",color:R.depression},{key:"anxiety",label:"Anxiety",color:R.anxiety},{key:"stress",label:"Stress",color:R.stress}];for(const m of M)if(V[m.key]){const W=n==="scores"?m.key:`${m.key}Percentile`;d.push({label:m.label,data:i.map(o=>{const N=o[W];return Number(N)||0}),borderColor:m.color,backgroundColor:F(m.color,.1),pointBackgroundColor:m.color,pointBorderColor:"#fff",pointBorderWidth:2,pointRadius:5,pointHoverRadius:7,tension:i.length===1?0:.4,fill:!1})}let r={};if(n==="percentiles")r=oe();else{const m=M.find(W=>V[W.key]);m&&(r=re(c,m.label))}return e.jsx("div",{className:"my-5 h-[400px]",style:{height:"400px"},children:e.jsx(ue,{data:{labels:i.map(m=>m.date),datasets:d},options:Se({viewMode:n,version:c,annotations:r,yMin:j[0],yMax:j[1]})})})})():e.jsxs("div",{className:"grid gap-5 my-5",style:{gridTemplateColumns:"repeat(auto-fit, minmax(300px, 1fr))"},children:[Z(i,"depression",t,c,j),Z(i,"anxiety",t,c,j),Z(i,"stress",t,c,j)]}),k==="combined"&&e.jsx(He,{items:qe,visibleLines:V,onToggle:Ce}),n==="scores"&&ae(),n==="percentiles"&&ae(),e.jsxs("div",{className:"flex justify-center mt-5 flex-col items-center gap-2.5",children:[e.jsx("button",{className:"bg-none border-none text-primary cursor-pointer underline px-2 py-1 hover:text-primary/80 bg-transparent",onClick:()=>{D(s),S(!0)},children:"View Severity Ranges"}),i.length===1&&e.jsx("span",{className:"text-xs text-muted-foreground text-center",children:"Only one assessment completed. Complete more assessments to track changes over time."})]})]})},{execute:Me}=ye(async(s,t)=>{const p=[...t.data].sort((o,N)=>new Date(N.createdAt).getTime()-new Date(o.createdAt).getTime())[0],i=fe(t.data),y=["Depression","Anxiety","Stress"],c=o=>{switch(o){case"Normal":return"Normal levels";case"Mild":return"Mild symptoms, may benefit from monitoring";case"Moderate":return"Moderate symptoms, may benefit from intervention";case"Severe":return"Severe symptoms, requires intervention";default:return"Extremely severe symptoms, requires immediate intervention"}},w=y.map(o=>{var pe;const N=o.toLowerCase(),E=i[N].current,L=I(E,o,s);return{label:o,score:E,percentile:((pe=p==null?void 0:p.percentiles)==null?void 0:pe[o])??0,severity:{label:L.category,color:L.color}}}),A=y.map(o=>{const N=o.toLowerCase(),E=i[N].current,L=I(E,o,s);return`${o} (${L.category}): Score ${E} â ${c(L.category)}`}),g=o=>o==="improving"?"â improving":o==="worsening"?"â worsening":"â stable",j=t.data.length>1?[`The client has completed ${t.data.length} assessments.`,...y.map(o=>{const N=o.toLowerCase();return`${o}: ${g(i[N].trend)}`})]:[],d=o=>s==="DASS-42"?K(o):G(o),M=(o,N)=>{const E=d(o).find(L=>L.category===N);return E?E.to===1/0?`${E.from}+`:`${E.from}-${E.to}`:null},r=["Normal","Mild","Moderate","Severe","Extremely Severe"],m={columns:[...y],rows:r.map(o=>({level:o,color:H[o],ranges:y.map(N=>M(N,o))}))},W=[`The Depression Anxiety Stress Scales (${s}) is a self-report instrument designed to measure the negative emotional states of depression, anxiety, and stress. The scale uses a 4-point severity/frequency scale to rate the extent to which clients have experienced each state over the past week.`,s==="DASS-21"?"The DASS-21 is a shortened version of the DASS-42, with 7 items per scale. Scores from the DASS-21 are multiplied by 2 to make them comparable to the DASS-42 scores.":"The DASS-42 consists of 42 items, with 14 items per scale (Depression, Anxiety, Stress)."];await We({assessmentName:s,clientLabel:a,latestAssessmentDate:(p==null?void 0:p.createdAt)??null,assessmentsCount:t.data.length,summaryRows:w,overviewLines:A,trendLines:j,severityTable:m,aboutParagraphs:W})},{showErrorToast:!1,onError:()=>{J("Failed to generate PDF report")}}),Ee=async(s,t)=>{if(!t||!t.data.length){J("No data available to export");return}await Me(s,t)},Te=(s,t)=>!s||!s.data.length?null:e.jsxs(Ue,{variant:"outline",onClick:()=>Ee(t,s),className:"flex items-center gap-2 whitespace-nowrap",children:[e.jsx(Xe,{className:"mr-2 size-4"}),"Export ",t," Report"]});if(C)return e.jsxs("div",{className:"space-y-4 p-6",children:[e.jsx("div",{className:"grid grid-cols-3 gap-4",children:[...Array(3)].map((s,t)=>e.jsx(be,{className:"h-[160px] rounded-2xl"},t))}),e.jsx(be,{className:"h-[300px] rounded-2xl"})]});const ne=s=>{var t;return(t=s==null?void 0:s.data)!=null&&t.length?Math.max(...s.data.map(b=>new Date(b.createdAt).getTime())):-1/0},le=[...(ce=(ie=$.dass21)==null?void 0:ie.data)!=null&&ce.length?["DASS-21"]:[],...(me=(de=$.dass42)==null?void 0:de.data)!=null&&me.length?["DASS-42"]:[]],$e=ne($.dass42)>
1ne($.dass21)?"DASS-42":"DASS-21",O=h&&le.includes(h)?h:$e,z=O==="DASS-21"?$.dass21:$.dass42;return e.jsxs("div",{className:"flex flex-col gap-6 px-6 pt-3 pb-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[le.length>1?e.jsx(Q,{value:O,onChange:x,options:[{value:"DASS-21",label:"DASS-21"},{value:"DASS-42",label:"DASS-42"}]}):e.jsx("div",{}),Te(z,O)]}),(xe=z==null?void 0:z.data)!=null&&xe.length?e.jsx(st,{data:z,version:O}):null,ke(z,O),e.jsx(Ye,{open:v,data:f==null?void 0:f.severity,onCancel:()=>S(!1)})]})};export{Vt 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.