1import{cy as ie,c7 as f,bN as re,cl as le,cs as oe,bY as Y,bk as E,bI as e,p as q,M as U,N as K,Q as G,R as I,x as ce,a3 as de,as as me,t as pe,bV as M}from"./index-Cr7AdIBs.js";import{A as V}from"./AsPageHeader-hSPdR5HK.js";import{B as d}from"./badge-BgPQ-ROF.js";import{C as u,c as O,d as W,a as _}from"./card-YCIWu6CA.js";import{P as w}from"./progress-JIs1-sVc.js";import{S as F}from"./separator-B8d2H9CC.js";import{S as C}from"./skeleton-bhek64gt.js";import{C as X,b as Z,a as ee}from"./collapsible-BbaetC1Q.js";import{d as xe,c as he,a as ge,f as ue,e as fe,g as _e,b as je}from"./practiceUtils-DfOTwIKu.js";import{b as J}from"./patientSessionData-QK_Bu543.js";import{f as be,g as ve}from"./sessionOrder-CJb6ab0J.js";import{S as Ne}from"./sparkles-BNF7olU9.js";import{C as se}from"./chevron-right-Bkm9N71g.js";import{F as ye}from"./file-text-CaUb7pup.js";import{T as Se}from"./target-CfUWcX6R.js";import{L as we}from"./lock-BkzdQ1Vb.js";import{U as Ae}from"./user-D7ORoCSN.js";const Pe=a=>ie({queryKey:["session-detail",a],queryFn:async()=>{if(!a)return null;const{data:n,error:x}=await f.from("sessions").select(` 2 id, 3 event_id, 4 relationship_id, 5 is_first_session, 6 calendar_event:calendar_events!event_id ( 7 starts_at, 8 ends_at 9 ), 10 calendar_patient_relationships ( 11 patient_id, 12 calendar_id, 13 calendars ( 14 therapist_id 15 ) 16 ), 17 session_summary!session_summary_session_id_fkey ( 18 session_focus, 19 progress_eval, 20 behaviour_changes, 21 anxiety_rating, 22 depression_rating, 23 progress_rating, 24 engagement_rating, 25 relationship_rating, 26 emotion_reg_rating, 27 insight_rating, 28 behaviour_rating, 29 risk_rating 30 ), 31 session_topics ( 32 topic_title, 33 topic_text, 34 topic_number 35 ), 36 session_symptoms!session_symptoms_session_id_fkey ( 37 symptom, 38 rate 39 ), 40 session_preparation!session_preparation_session_id_fkey ( 41 general, 42 sleep_quality, 43 mood, 44 relaxed, 45 energy_level, 46 rested_level, 47 daily_activities, 48 stress_level_gad, 49 concerns_control_gad, 50 worry_level_gad, 51 relax_dificulties_gad, 52 agitaded_level_gad, 53 borred_ease_gad, 54 fright_level_gad, 55 interested_level_phq, 56 depressed_level_phq, 57 sleep_dificulty_phq, 58 tiredness_level_phq, 59 appetite_level_phq, 60 self_being_level_phq, 61 focus_level_phq, 62 physical_level_phq, 63 auto_mutilation_level_phq, 64 created_at 65 ), 66 patient_post_session_eval ( 67 mood, 68 rating_comfort, 69 rating_heard, 70 rating_helpful, 71 rating_clarity, 72 rating_pace, 73 rating_topics, 74 note_id, 75 created_at 76 ) 77 `).eq("id",a).maybeSingle();if(x)throw x;if(!n)return null;const l=n.calendar_event,s=n.calendar_patient_relationships,h=s?.patient_id,A=l?.starts_at;let P=1;if(n.relationship_id){const t=await be(n.relationship_id);P=ve(t,n.id,A)}let b=[];if(h){const{data:t}=await f.from("patient_practices").select("id, title, description, frequency, times_done, type, url, target_count, due_date, created_at").eq("patient_id",h);b=t||[]}const k=b.map(t=>t.id);let v={};if(k.length>0){const{data:t}=await f.from("practice_logs").select("*").in("practice_id",k).order("created_at",{ascending:!1});t&&t.forEach(i=>{v[i.practice_id]||(v[i.practice_id]=[]),v[i.practice_id].push(i)})}const r=s?.calendars?.therapist_id;let m=null,N=null;if(r&&h){const{data:t}=await f.from("notes").select("content, is_shared").eq("session_id",a).eq("note_type","post_eval");if(t&&t.length>0){const i=t.find(g=>g.is_shared===!0),p=t.find(g=>g.is_shared===!1);m=i?.content||null,N=p?.content||null}else if(A){const{data:i}=await f.from("notes").select("content, is_shared").eq("author_id",r).eq("subject_id",h).eq("note_type","post_eval").is("session_id",null).gt("created_at",A).order("created_at",{ascending:!0}).limit(10);if(i){const p=i.find(S=>S.is_shared===!0),g=i.find(S=>S.is_shared===!1);m=p?.content||null,N=g?.content||null}}}const y=n.session_preparation,D=Array.isArray(y)?y[0]:y;let H=null;if(D){const t=xe(D),i=he(D),p=ge(D),{data:g}=await f.from("notes").select("content").eq("session_id",a).eq("note_type","pre_session").limit(1);H={gad7Score:i,gad7Severity:_e(i),phq9Score:p,phq9Severity:fe(p),wellbeingNormalized:t,wellbeingSeverity:ue
77(t),patientConcerns:g?.[0]?.content||null,completedAt:new Date(D.created_at||new Date)}}let L=null,R=null,$,z;const T=n.patient_post_session_eval,o=Array.isArray(T)?T[0]:T;if(o){R="post_session";let t;if(o.note_id){const{data:i}=await f.from("notes").select("content").eq("id",o.note_id).maybeSingle();t=i?.content||void 0}L={mood:o.mood||3,moodLabel:J(o.mood||3),ratings:{comfort:o.rating_comfort||0,heard:o.rating_heard||0,helpful:o.rating_helpful||0,clarity:o.rating_clarity||0,pace:o.rating_pace||0,topics:o.rating_topics||0},personalNotes:t,completedAt:o.created_at?new Date(o.created_at):void 0}}else{const{data:t}=await f.from("patient_first_session_eval").select("mood, rating_comfort, rating_understanding, rating_can_help, rating_style_fit, rating_session_useful, rating_expectations, rating_understand_next, continue_decision, note_id, created_at").eq("session_id",a).maybeSingle();if(t){R="first_session",z=t.continue_decision;let i;if(t.note_id){const{data:p}=await f.from("notes").select("content").eq("id",t.note_id).maybeSingle();i=p?.content||void 0}$={comfort:t.rating_comfort||0,understanding:t.rating_understanding||0,canHelp:t.rating_can_help||0,styleFit:t.rating_style_fit||0,sessionUseful:t.rating_session_useful||0,expectations:t.rating_expectations||0,understandNext:t.rating_understand_next||0},L={mood:t.mood||3,moodLabel:J(t.mood||3),ratings:{comfort:t.rating_comfort||0,heard:t.rating_understanding||0,helpful:t.rating_can_help||0,clarity:t.rating_session_useful||0,pace:t.rating_style_fit||0,topics:t.rating_expectations||0},personalNotes:i,completedAt:t.created_at?new Date(t.created_at):void 0}}}const c=n.session_summary,te=b.map(t=>{const i=v[t.id]||[],p=t.times_done||0,g=je(t.frequency||"once",t.target_count||1,t.created_at,t.due_date),S=g!=null?Math.min(Math.round(p/g*100),100):null,ne=p>=1?"completed":p>0?"in-progress":"pending";return{id:t.id,name:t.title,type:t.type||null,frequency:t.frequency||"daily",therapistDescription:t.description,completion:S??0,completionPercentage:S,patientNotes:i.map(Q=>({createdAt:new Date(Q.created_at),content:Q.notes||""})),status:ne}}),ae=(n.session_topics||[]).sort((t,i)=>(t.topic_number||0)-(i.topic_number||0)).map(t=>({title:t.topic_title,content:t.topic_text||void 0}));let B=50;if(l){const t=new Date(l.starts_at),i=new Date(l.ends_at);B=Math.round((i.getTime()-t.getTime())/(1e3*60))}return re.log("Symptoms data:",n.session_symptoms),{id:n.id,sessionNumber:P,date:l?new Date(l.starts_at):new Date,duration:`${B} min`,relationshipId:n.relationship_id||void 0,preSessionAssessment:H,patientPostSessionEvaluation:L,sessionFocus:c?.session_focus||null,topics:ae,anxietyLevel:c?.anxiety_rating||0,depressionLevel:c?.depression_rating||0,generalProgress:c?.progress_rating||0,patientEngagement:c?.engagement_rating||0,therapeuticRelationship:c?.relationship_rating||0,emotionalRegulation:c?.emotion_reg_rating||0,insightAwareness:c?.insight_rating||0,behavioralChangeLevel:c?.behaviour_rating||0,progressAssessment:c?.progress_eval||null,sessionProgressAssessment:c?.progress_eval||null,symptoms:(n.session_symptoms||[]).map(t=>({name:t.symptom,severity:t.rate})),behavioralChanges:c?.behaviour_changes||null,practices:te,homework:[],sharedNotes:m,privateNotes:N,riskAssessment:c?.risk_rating||0,isFirstSession:n.is_first_session===!0,evaluationKind:R,firstSessionRatings:$,continueDecision:z}},enabled:!!a}),ke={exercise:"ð",reading:"ð",mindfulness:"ð§",breathing:"ð¬ï¸",sleep:"ð´",food:"ð",journalling:"ð",social:"ð¥",other:"â¨"},De={once:"Uma vez",daily:"Diariamente",weekly:"Semanalmente",biweekly:"Quinzenalmente",monthly:"Mensalmente",quarterly:"A cada 3 meses"},j=({label:a,value:n,max:x=7})=>e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm font-medium",children:a}),e.jsxs(d,{variant:"outline",children:[n,"/",x]})]}),e.jsx(w,{value:n/x*100,className:"h-2"})]}),qe=a=>a<=2?"bg-green-100 text-green-700 border-green-200":a<=4?"bg-yellow-100 text-yellow-700 border-yellow-200":a<=6?"bg-orange-100 text-orange-700 border-orange-200":"bg-red-100 text-red-700 border-red-200",Ce=({open:a,onOpenChange:n,sessionId:x,asPage:l=!1})=>{const{data:s,isLoading:h}=Pe(x),A=le(),P=oe(),b=a&&!l&&A;if(Y.useEffect(()=>{b&&(P(`/therapist/session/${x}/detail`),n(!1))},[b,P,x,n]),b)return null;
77const k=s?`Sessão #${s.sessionNumber} - ${E(s.date,"d MMM yyyy",{locale:M})} (${s.duration})`:"Detalhe da sessão";if(h||!s){const r=h?e.jsxs("div",{className:"space-y-6 p-4",children:[e.jsx(C,{className:"h-32 w-full"}),e.jsx(C,{className:"h-48 w-full"}),e.jsx(C,{className:"h-32 w-full"})]}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:e.jsx("p",{children:"Não foi possÃvel carregar os detalhes desta sessão."})});return l?e.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[e.jsx(V,{title:h?"A carregar...":"Sessão não encontrada",onBack:()=>n(!1),icon:e.jsx(q,{className:"h-5 w-5 text-primary"})}),e.jsx("div",{className:"flex-1 px-4 pb-20 pt-4",children:r})]}):e.jsx(U,{open:a,onOpenChange:n,children:e.jsxs(K,{className:"max-w-4xl max-h-[90vh]",children:[e.jsx(G,{children:e.jsxs(I,{className:"flex items-center gap-2",children:[e.jsx(q,{className:"h-5 w-5 text-primary"}),h?e.jsx(C,{className:"h-6 w-48"}):"Sessão não encontrada"]})}),r]})})}const v=e.jsxs("div",{className:"space-y-6",children:[s.preSessionAssessment&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-primary",children:[e.jsx(ce,{className:"h-5 w-5"}),"ð Auto-Avaliação Pré-Sessão do Paciente"]}),e.jsxs(u,{className:"border-primary/30 bg-primary/5",children:[e.jsx(O,{className:"pb-3",children:e.jsxs(W,{className:"text-sm flex items-center justify-between",children:[e.jsx("span",{children:"Avaliação do Paciente"}),e.jsx(d,{variant:"outline",className:"text-xs",children:E(s.preSessionAssessment.completedAt,"d MMM, HH:mm",{locale:M})})]})}),e.jsxs(_,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsx(u,{className:"bg-background",children:e.jsxs(_,{className:"p-4 space-y-2",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Bem-Estar"}),e.jsxs("p",{className:"text-2xl font-bold",children:[s.preSessionAssessment.wellbeingNormalized.toFixed(1),"/10"]}),e.jsx(d,{variant:"outline",className:`mt-2 ${s.preSessionAssessment.wellbeingNormalized>=7?"bg-green-100 text-green-700":s.preSessionAssessment.wellbeingNormalized>=4?"bg-yellow-100 text-yellow-700":"bg-orange-100 text-orange-700"}`,children:s.preSessionAssessment.wellbeingSeverity})]}),e.jsx(w,{value:s.preSessionAssessment.wellbeingNormalized*10,className:"h-2"})]})}),e.jsx(u,{className:"bg-background",children:e.jsxs(_,{className:"p-4 space-y-2",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"GAD-7"}),e.jsxs("p",{className:"text-2xl font-bold",children:[s.preSessionAssessment.gad7Score,"/21"]}),e.jsx(d,{variant:"outline",className:`mt-2 ${s.preSessionAssessment.gad7Score<=4?"bg-green-100 text-green-700":s.preSessionAssessment.gad7Score<=9?"bg-yellow-100 text-yellow-700":s.preSessionAssessment.gad7Score<=14?"bg-orange-100 text-orange-700":"bg-red-100 text-red-700"}`,children:s.preSessionAssessment.gad7Severity})]}),e.jsx(w,{value:s.preSessionAssessment.gad7Score/21*100,className:"h-2"})]})}),e.jsx(u,{className:"bg-background",children:e.jsxs(_,{className:"p-4 space-y-2",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"PHQ-9"}),e.jsxs("p",{className:"text-2xl font-bold",children:[s.preSessionAssessment.phq9Score,"/27"]}),e.jsx(d,{variant:"outline",className:`mt-2 ${s.preSessionAssessment.phq9Score<=4?"bg-green-100 text-green-700":s.preSessionAssessment.phq9Score<=9?"bg-yellow-100 text-yellow-700":s.preSessionAssessment.phq9Score<=14?"bg-orange-100 text-orange-700":"bg-red-100 text-red-700"}`,children:s.preSessionAssessment.phq9Severity})]}),e.jsx(w,{value:s.preSessionAssessment.phq9Score/27*100,className:"h-2"})]})})]}),s.preSessionAssessment.patientConcerns&&e.jsxs("div",{className:"pt-3 border-t",children:[e.jsx("h4",{className:"text-xs font-medium mb-1.5 text-muted-foreground",children:"ð¬ Notas para a Sessão:"}),e.jsx("p",{className:"text-sm bg-background p-3 rounded-md border",children:s.preSessionAssessment.patientConcerns})]})]})]})]}),e.jsx(F,{})]}),s.patientPostSessionEvaluation&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-emerald-700",children:[e.jsx(Ne,{className:"h-5 w-5"}),s.evaluationKind==="first_session"?"â Feedback da Primeira Sessão":"⨠Feedback Pós-Sessão do Paciente"]}),e.jsxs(u,{className:"border-emerald-200 bg-emerald-50/50",children:[e.jsx(O,{className:"pb-3",children:e.jsxs(W,{className:"text-sm flex items-center justify-between",children:[e.jsx("span",{children:"Avaliação do Paciente"}),s.patientPostSessionEvaluation.completedAt&&e.jsx(d,{variant:"outline",className:"text-xs",children:E(s.patientPostSessionEvaluation.completedAt,"d MMM, HH:mm",{locale:M})})]})}),e.jsxs(_,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Como se sentiu:"}),e.jsxs(d,{variant:"outline",className:"bg-background",children:[s.patientPostSessionEvaluation.mood===1?"ð¢":s.patientPostSessionEvaluation.mood===2?"ð":s.patientPostSessionEvaluation.mood===3?"ð":s.patientPostSessionEvaluation.mood===4?"ð":"ð"," ",s.patientPostSessionEvaluation.moodLabel]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-medium mb-3 text-muted-foreground",children:"Avaliações:"}),e.jsx(u,{className:"bg-background",children:e.jsx(_,{className:"p-3 space-y-2",children:(s.evaluationKind==="first_session"?[{key:"c
77omfort",label:"Conforto"},{key:"heard",label:"Compreensão"},{key:"helpful",label:"Pode Ajudar"},{key:"pace",label:"Estilo"},{key:"clarity",label:"Utilidade da Sessão"},{key:"topics",label:"Expectativas"}]:[{key:"comfort",label:"Conforto"},{key:"heard",label:"Compreensão"},{key:"helpful",label:"Utilidade"},{key:"clarity",label:"Clareza"},{key:"pace",label:"Ritmo"},{key:"topics",label:"Tópicos"}]).map(({key:r,label:m})=>{const N=s.patientPostSessionEvaluation.ratings[r];return e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:m}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(y=>e.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${y<=N?"bg-emerald-500":"bg-muted"}`},y))}),e.jsxs("span",{className:"text-xs text-muted-foreground w-8",children:[N,"/5"]})]})]},r)})})})]}),s.evaluationKind==="first_session"&&s.continueDecision&&e.jsxs("div",{className:"pt-3 border-t",children:[e.jsx("h4",{className:"text-xs font-medium mb-1.5 text-muted-foreground",children:"Decisão de continuidade:"}),e.jsx(d,{variant:"outline",className:s.continueDecision==="yes"?"bg-green-100 text-green-700":"bg-red-100 text-red-700",children:s.continueDecision==="yes"?"â
Sim, deseja continuar":"â Não deseja continuar"})]}),s.patientPostSessionEvaluation.personalNotes&&e.jsxs("div",{className:"pt-3 border-t",children:[e.jsxs("h4",{className:"text-xs font-medium mb-1.5 text-muted-foreground flex items-center gap-1",children:[e.jsx(de,{className:"h-3 w-3"}),"Notas do Paciente:"]}),e.jsxs("p",{className:"text-sm bg-background p-3 rounded-md border italic",children:['"',s.patientPostSessionEvaluation.personalNotes,'"']})]})]})]})]}),e.jsx(F,{})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 flex-wrap",children:["Detalhes da sessão e avaliação contÃnua",e.jsx("span",{className:"text-sm font-normal text-muted-foreground/60 italic",children:"(visÃvel apenas para o/a PSM)"})]}),e.jsx(u,{children:e.jsxs(_,{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"Avaliação Rápida:"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(j,{label:"Ansiedade",value:s.anxietyLevel}),e.jsx(j,{label:"Depressão",value:s.depressionLevel}),e.jsx(j,{label:"Progresso Geral",value:s.generalProgress}),e.jsx(j,{label:"Envolvimento",value:s.patientEngagement}),e.jsx(j,{label:"Rel. Terapêutica",value:s.therapeuticRelationship}),e.jsx(j,{label:"Reg. Emocional",value:s.emotionalRegulation}),e.jsx(j,{label:"Insight",value:s.insightAwareness}),e.jsx(j,{label:"Mud. Comport.",value:s.behavioralChangeLevel})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-2",children:"Foco da Sessão:"}),e.jsx("p",{className:"text-sm bg-muted/50 p-3 rounded-md",children:s.sessionFocus||"Não definido"})]}),s.topics.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-2",children:"Principais Tópicos Abordados:"}),e.jsx("div",{className:"space-y-2",children:s.topics.map((r,m)=>e.jsx(X,{className:"group/topic",children:e.jsxs(u,{className:"border",children:[e.jsx(Z,{asChild:!0,children:e.jsxs("button",{className:"w-full text-left p-3 hover:bg-muted/50 transition-colors flex items-start gap-2",children:[e.jsx(se,{className:"h-4 w-4 mt-0.5 transition-transform duration-200 group-data-[state=open]/topic:rotate-90 text-muted-foreground"}),e.jsx("div",{className:"flex-1",children:e.jsxs("span",{className:"text-sm font-medium",children:[m+1,". ",r.title]})})]})}),r.content&&e.jsx(ee,{className:"px-3 pb-3",children:e.jsx("div",{className:"pl-6 pt-2 border-t",children:e.jsxs("p",{className:"text-sm text-muted-foreground italic",children:['"',r.content,'"']})})})]})},m))})]}),s.symptoms.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-2",children:"Sintomas:"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.symptoms.map((r,m)=>e.jsxs(d,{variant:"outline",className:qe(r.severity),children:[r.name," (Sev: ",r.severity,")"]},m))})]}),s.behavioralChanges&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-2",children:"Mudanças Comportamentais Observadas:"}),e.jsx("p",{className:"text-sm text-muted-foreground bg-muted/50 p-3 rounded-md",children:s.behavioralChanges})]}),s.sessionProgressAssessment&&e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium text-sm mb-2 flex items-center gap-2",children:[e.jsx(ye,{className:"h-4 w-4 text-primary"}),"Avaliação de Sessão e Progresso:"]}),e.jsx("div",{className:"bg-primary/5 border border-primary/20 rounded-lg p-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:s.sessionProgressAssessment})})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-2",children:"Perceção de Risco:"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(w,{value:s.riskAssessment/7*100,className:"h-2 flex-1"}),e.jsxs(d,{variant:s.riskAssessment<=2?"outline":s.riskAssessment<=4?"secondary":"destructive",children:["NÃvel ",s.riskAssessment,"/7"]}
77)]})]})]})})]}),e.jsx(F,{}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[e.jsx(Se,{className:"h-5 w-5 text-primary"}),"Jornada de acompanhamento"]}),e.jsx(u,{className:"bg-primary/5 border-primary/20",children:e.jsxs(_,{className:"p-4 space-y-4",children:[s.practices&&s.practices.length>0?e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-3",children:"ð Práticas:"}),e.jsx("div",{className:"space-y-3",children:s.practices.map(r=>e.jsx(Ee,{practice:r},r.id))})]}):s.homework.length>0?e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-sm mb-2",children:"ð Práticas:"}),e.jsx("ul",{className:"list-disc list-inside space-y-1",children:s.homework.map((r,m)=>e.jsx("li",{className:"text-sm",children:r},m))})]}):null,e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[s.privateNotes&&e.jsxs("div",{className:"rounded-lg border overflow-hidden flex flex-col bg-purple-50 border-purple-200",children:[e.jsxs("div",{className:"px-3 py-2 flex items-center justify-between bg-purple-100",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(we,{className:"w-3.5 h-3.5 text-purple-600"}),e.jsx("span",{className:"text-xs font-semibold text-purple-700",children:"PRIVADA"})]}),e.jsx(d,{variant:"outline",className:"text-xs bg-purple-100 text-purple-700 border-purple-300",children:"Apenas para si"})]}),e.jsx("div",{className:"p-3 flex-1",children:e.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.privateNotes})})]}),s.sharedNotes&&e.jsxs("div",{className:"rounded-lg border overflow-hidden flex flex-col bg-green-50 border-green-200",children:[e.jsxs("div",{className:"px-3 py-2 flex items-center justify-between bg-green-100",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Ae,{className:"w-3.5 h-3.5 text-green-600"}),e.jsx("span",{className:"text-xs font-semibold text-green-700",children:"PARTILHADA"})]}),e.jsx(d,{variant:"outline",className:"text-xs bg-green-100 text-green-700 border-green-300",children:"VisÃvel para o Paciente"})]}),e.jsx("div",{className:"p-3 flex-1",children:e.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.sharedNotes})})]})]})]})})]})]});return l?e.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[e.jsx(V,{title:k,onBack:()=>n(!1),icon:e.jsx(q,{className:"h-5 w-5 text-primary"}),containerClassName:"max-w-4xl mx-auto"}),e.jsx("div",{className:"flex-1 px-4 pb-20 pt-4",children:e.jsx("div",{className:"mx-auto max-w-4xl",children:v})})]}):e.jsx(U,{open:a,onOpenChange:n,children:e.jsxs(K,{className:"max-w-4xl max-h-[90vh]",children:[e.jsx(G,{children:e.jsxs(I,{className:"flex items-center gap-2 pr-8",children:[e.jsx(q,{className:"h-5 w-5 shrink-0 text-primary"}),k]})}),e.jsx(me,{className:"h-[calc(90vh-8rem)] pr-4",children:e.jsx("div",{className:"px-1",children:v})})]})})},Ee=({practice:a})=>{const[n,x]=Y.useState(!1),l=a.completionPercentage??a.completion;return e.jsx(X,{open:n,onOpenChange:x,children:e.jsx(u,{className:`border-l-4 bg-background ${a.status==="completed"?"border-l-green-500":a.status==="in-progress"?"border-l-blue-500":"border-l-gray-300"}`,children:e.jsxs(_,{className:"p-4",children:[e.jsx(Z,{className:"w-full",children:e.jsxs("div",{className:"flex items-center gap-3 text-left",children:[e.jsx("span",{className:"text-2xl",children:ke[a.type||""]||"â¨"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("p",{className:"font-medium text-sm",children:a.name}),a.completionPercentage!=null&&e.jsxs(d,{variant:"outline",className:"text-xs",children:[l,"%"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a.completionPercentage!=null&&e.jsx(w,{value:l,className:"h-2 flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:De[a.frequency]||a.frequency})]})]}),n?e.jsx(pe,{className:"h-4 w-4 text-muted-foreground shrink-0"}):e.jsx(se,{className:"h-4 w-4 text-muted-foreground shrink-0"})]})}),e.jsxs(ee,{className:"mt-3 space-y-3",children:[a.therapistDescription&&e.jsxs("div",{className:"border-t pt-3",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Descrição do/a PSM:"}),e.jsx("div",{className:"bg-muted/50 p-3 rounded-md border text-sm",children:a.therapistDescription})]}),a.patientNotes.length>0&&e.jsxs("div",{className:"border-t pt-3",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Notas do Paciente:"}),e.jsx("div",{className:"space-y-2",children:a.patientNotes.map((s,h)=>e.jsxs("div",{className:"bg-primary/5 p-3 rounded-md border border-primary/20",children:[e.jsxs("p",{className:"text-xs text-primary font-medium mb-1",children:["ð ",E(s.createdAt,"d MMM",{locale:M})]}),e.jsx("p",{className:"text-sm",children:s.content})]},h))})]})]})]})})})},Je=Object.freeze(Object.defineProperty({__proto__:null,SessionDetailDialog:Ce},Symbol.toStringTag,{value:"Module"}));
77export{Ce as S,Je as a,Pe as u};
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.