2 lines
4 KiB
JavaScript
2 lines
4 KiB
JavaScript
|
|
import{r,j as e}from"./0-vendor-react-DWOJpYrt.js";import{u as I,L as A}from"./page-herramientas-DcKR8MlC.js";import{B as x}from"./page-ajustes-DgawOEJM.js";import{C as f,c as g,d as j,e as b,I as E}from"./page-comunicacion-DmHQUHoW.js";import{f as u,C as D,g as T,a as _}from"./timers-DtW-cs9v.js";import"./1-vendor-utils-Delnuc0l.js";import"./2-vendor-markdown-BQlHAcA7.js";const K=[{id:"access",title:"Acceso vascular de gran calibre",description:"Canalizar vía periférica (o alternativa) y preparar perfusión."},{id:"fluids",title:"Fluidoterapia 30 ml/kg",description:"Administrar cristaloides en bolo según peso.",hasFluidCalculator:!0},{id:"cultures",title:"Hemocultivos antes de antibióticos",description:"Tomar cultivos según protocolo local."},{id:"antibiotics",title:"Antibiótico en < 1 hora",description:"Iniciar antibiótico de amplio espectro.",hasAntibioticDeadline:!0},{id:"vasopressors",title:"Evaluar vasopresores",description:"Si MAP < 65 tras fluidos, considerar noradrenalina."},{id:"source",title:"Buscar foco infeccioso",description:"Exploración dirigida y reevaluación clínica."}],w="sepsis_checklist_v1",M=30,P=3600,o={startedAt:null,completed:{},manualWeightKg:void 0},R=()=>{if(typeof window>"u")return o;try{const i=window.localStorage.getItem(w);if(!i)return o;const m=JSON.parse(i);return{...o,...m}}catch{return o}},B=i=>{if(!(typeof window>"u"))try{window.localStorage.setItem(w,JSON.stringify(i))}catch{}},J=()=>{const{patient:i,hasPatientProperty:m}=I(),[n,c]=r.useState(o),[F,v]=r.useState(Date.now());r.useEffect(()=>{c(R())},[]),r.useEffect(()=>{B(n)},[n]),r.useEffect(()=>{const t=window.setInterval(()=>v(Date.now()),1e3);return()=>window.clearInterval(t)},[]);const a=n.startedAt,N=T(a),p=_(a,P),l=m("weight")&&i.weight?i.weight:n.manualWeightKg,h=r.useMemo(()=>l?Math.round(l*M):null,[l]),S=(t,s)=>{c(d=>({...d,completed:{...d.completed,[t]:s}}))},C=()=>{a||c(t=>({...t,startedAt:Date.now()}))},y=()=>{c(o)},k=t=>{const s=Number(t);c(d=>({...d,manualWeightKg:Number.isFinite(s)?s:void 0}))};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("header",{className:"space-y-2",children:[e.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"Checklist Código Sepsis"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Checklist interactiva con temporizador y cálculo de fluidos."})]}),e.jsxs(f,{children:[e.jsxs(g,{className:"flex flex-row items-center justify-between space-y-0",children:[e.jsx(j,{className:"text-base",children:"Temporizador"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:a?`Tiempo: ${u(N)}`:"Sin iniciar"})]}),e.jsxs(b,{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[e.jsx("div",{className:"text-sm",children:a?`Antibiótico < 1h: ${u(p)}`:"Inicia para contar el tiempo crítico."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(x,{onClick:C,disabled:!!a,children:"Iniciar"}),e.jsx(x,{variant:"outline",onClick:y,children:"Reiniciar"})]})]})]}),K.map(t=>e.jsxs(f,{children:[e.jsx(g,{className:"flex flex-row items-center justify-between space-y-0",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(D,{checked:!!n.completed[t.id],onCheckedChange:s=>S(t.id,!!s)}),e.jsx(j,{className:"text-base",children:t.title})]})}),e.jsxs(b,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),t.hasFluidCalculator&&e.jsxs("div",{className:"rounded-md border border-border/60 bg-muted/30 p-3 space-y-2",children:[e.jsx(A,{children:"Peso (kg)"}),e.jsx(E,{type:"number",inputMode:"numeric",value:l??"",onChange:s=>k(s.target.value),placeholder:"Ej: 70"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:h?`Volumen recomendado: ${h} ml`:"Introduce el peso para calcular 30 ml/kg."})]}),t.hasAntibioticDeadline&&e.jsx("div",{className:"rounded-md border border-border/60 bg-muted/30 p-3 text-sm text-muted-foreground",children:a?`Tiempo restante: ${u(p)}`:"Inicia el temporizador para activar la cuenta atrás."})]})]},t.id))]})};export{
|