pediatric-ai-scribe-v3/public/app/assets/Bedside-Dp0dEd6U.js
Daniel 515c57571f perf(client): code-split every heavy route via React.lazy()
Cuts the initial bundle roughly in half. Users who open Home,
Extensions, or FAQ download ~343 kB / 106 kB gz instead of 817 kB /
230 kB gz. Heavy clinical reference data (PE_DATA, Fenton LMS,
Rosner BP splines, 15 Bedside drug panels, 10 Calculator formulas,
13 Settings sub-sections, 10 Admin sub-tabs) only loads when the
user opens that route.

client/src/App.tsx
  Every route except Home / Extensions / FAQ wrapped in
  React.lazy(() => import(...)) + <Suspense fallback>. Extensions and
  FAQ stay in the main chunk because they're small (3 kB, 2 kB) and
  likely visited early. The RouteFallback component shows a single
  "Loading…" line — Vite prefetches chunks on hover so the delay is
  typically invisible.

Resulting chunks (gzipped):
  • index.js             106 kB   React + Router + Query + Layout +
                                   Home + Extensions + FAQ
  • Bedside.js            33 kB   15 clinical dosing panels
  • PeGuide.js            36 kB   PE_DATA hierarchy + scales + sounds
  • Calculators.js        42 kB   All 10 calculators + BP Rosner
                                   coefficients + Fenton + BMI LMS
  • Settings.js           10 kB   13 Settings sub-sections
  • Admin.js               7 kB   10 Admin sub-tabs
  • Learning.js            3 kB
  • Fenton chunk (shared)  3 kB   Reused between Bedside neonatal
                                   and the Growth Charts calculator
  • Note pages (each)  1-2 kB   Encounter / SOAP / Well / Sick /
                                   Hospital / Chart / Dictation / Vax /
                                   Catch-up individually chunked

Vite's 500 kB chunk-size warning is gone. No functional changes.
2026-04-24 02:28:52 +02:00

1 line
No EOL
131 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";import{c as r,d as i,i as a,l as o,u as s}from"./fenton-9EKyvVkL.js";var c=e(t(),1),l=n(),u=`rounded-lg border border-border bg-card p-5 space-y-3`,d=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring`,f=`block text-xs font-medium text-muted-foreground`,p=`text-left px-2 py-1.5 border-b border-border font-semibold uppercase tracking-wide text-[10px] text-muted-foreground`,m=`px-2 py-1.5 border-b border-border align-top text-sm`;function h({label:e}){let t=e.indexOf(`(`);return t<0?(0,l.jsx)(`span`,{className:`font-semibold`,children:e}):(0,l.jsxs)(`span`,{children:[(0,l.jsx)(`span`,{className:`font-semibold`,children:e.slice(0,t).trim()}),` `,(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.slice(t)})]})}function g({children:e,notes:t=!0}){return(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:p,children:`Drug`}),(0,l.jsx)(`th`,{className:p,children:`Dose`}),(0,l.jsx)(`th`,{className:p,children:`Route`}),t&&(0,l.jsx)(`th`,{className:p,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:e})]})})}function _({name:e,dose:t,route:n,notes:r}){return(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:m+` font-semibold`,dangerouslySetInnerHTML:{__html:e}}),(0,l.jsx)(`td`,{className:m,children:t}),(0,l.jsx)(`td`,{className:m+` text-xs`,children:n}),r!==void 0&&(0,l.jsx)(`td`,{className:m+` text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:r}})]})}function v(){let[e,t]=(0,c.useState)(``),[n,r]=(0,c.useState)(`0`),[i,o]=(0,c.useState)(``),[s,p]=(0,c.useState)(`male`),[m,v]=(0,c.useState)(``),[y,b]=(0,c.useState)({appearance:2,pulse:2,grimace:2,activity:2,respiration:2}),x=Number.parseInt(e,10),S=Number.parseInt(n,10)||0,C=Number.parseFloat(i),w=Number.isFinite(x)&&x>=22&&x<=44&&Number.isFinite(C)&&C>0?a(x,S,C,s):null,T=Number.parseFloat(m),E=Number.isFinite(T)&&T>0,D=E?Math.round(T*.01*100)/100:0,O=E?Math.round(T*.03*100)/100:0,k=E?Math.round(T*.05*100)/100:0,A=E?Math.round(T*.1*100)/100:0,j=E?Math.round(T*10):0,M=E?Math.round(T*2*10)/10:0,N=Object.values(y).reduce((e,t)=>e+t,0),P=N>=7?`Reassuring`:N>=4?`Moderately depressed`:`Severely depressed`,F=N>=7?`text-green-600 bg-green-50`:N>=4?`text-amber-600 bg-amber-50`:`text-destructive bg-red-50`,I=N>=7?`Routine newborn care. Continue reassessment. Repeat at 5 min.`:N>=4?`Stimulate, clear airway, warm. Give O₂ if cyanotic. Ventilate with PPV if HR <100 or apneic/gasping. Reassess q30 sec.`:`Full NRP pathway — PPV immediately. Intubate if PPV ineffective. Chest compressions if HR <60. Epinephrine and volume per NRP.`;return(0,l.jsxs)(`section`,{className:u,"data-testid":`bedside-panel-neonatal`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Neonatal Assessment + NRP + Apgar`}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Gestational age + size assessment (Fenton 2013)`}),(0,l.jsxs)(`div`,{className:`grid gap-2 grid-cols-2 sm:grid-cols-4 max-w-xl`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`GA weeks`}),(0,l.jsx)(`input`,{type:`number`,min:`22`,max:`44`,className:d,value:e,onChange:e=>t(e.target.value),"data-testid":`neo-weeks`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`GA days (0-6)`}),(0,l.jsx)(`input`,{type:`number`,min:`0`,max:`6`,className:d,value:n,onChange:e=>r(e.target.value),"data-testid":`neo-days`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Birth wt (g)`}),(0,l.jsx)(`input`,{type:`number`,min:`200`,max:`7000`,className:d,value:i,onChange:e=>o(e.target.value),"data-testid":`neo-weight`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Sex`}),(0,l.jsxs)(`select`,{className:d,value:s,onChange:e=>p(e.target.value),"data-testid":`neo-sex`,children:[(0,l.jsx)(`option`,{value:`male`,children:`Male`}),(0,l.jsx)(`option`,{value:`female`,children:`Female`})]})]})]}),w&&(0,l.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,"data-testid":`neo-result`,children:[(0,l.jsxs)(`div`,{className:`rounded-md border p-3`,style:{borderColor:w.gaClass.color+`55`,background:w.gaClass.color+`10`},children:[(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Gestational Age`}),(0,l.jsx)(`div`,{className:`text-base font-bold`,style:{color:w.gaClass.color},children:w.gaClass.label}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[x,` wk `,S,` d (`,w.gaDecimal.toFixed(1),` wk)`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border p-3`,style:{borderColor:w.weightClass.color+`55`,background:w.weightClass.color+`10`},children:[(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Weight for Gestational Age`}),(0,l.jsx)(`div`,{className:`text-base font-bold`,style:{color:w.weightClass.color},children:w.weightClass.label}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[w.percentile.toFixed(1),`th percentile · `,w.weightClass.detail]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border p-3`,style:{borderColor:w.bwClass.color+`55`,background:w.bwClass.color+`10`},children:[(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Birth Weight Category`}),(0,l.jsx)(`div`,{className:`text-base font-bold`,style:{color:w.bwClass.color},children:w.bwClass.label}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[C,` g (`,(C/1e3).toFixed(2),` kg)`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/40 p-3 text-xs`,children:[(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground uppercase tracking-wide`,children:[`Fenton (`,s,`)`]}),(0,l.jsxs)(`div`,{className:`space-y-0.5 mt-1`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Expected weight (M):`}),` `,w.expectedWeight,` g`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Z-score:`}),` `,w.z.toFixed(2)]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Percentile:`}),` `,w.percentile.toFixed(1),`%`]})]})]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`NRP pathway (AHA/AAP 8th ed 2020)`}),(0,l.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`BIRTH — ASSESS (first 30 sec)`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Term? Tone? Breathing/crying? All yes → routine care. Any no → warm, dry, stimulate, clear airway PRN, evaluate HR + resp.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-purple-500 bg-purple-50 dark:bg-purple-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`HR <100 OR apneic/gasping (60 s)`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,l.jsx)(`strong`,{children:`Start PPV`}),` 40-60 breaths/min, room air for term / 21-30% for preterm. Attach SpO₂ (right hand) ± ECG. MR SOPA if ineffective.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-amber-500 bg-amber-50 dark:bg-amber-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`HR <100 after 30 s effective PPV`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Reassess ventilation — ensure chest rise. Consider increasing FiO₂, intubation, or LMA. Continue PPV.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-red-500 bg-red-50 dark:bg-red-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`HR <60 after 30 s effective PPV`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,l.jsx)(`strong`,{children:`Intubate + chest compressions`}),` — 3:1 ratio (90 compressions + 30 breaths/min), FiO₂ 100%, lower 1/3 sternum, depth 1/3 AP chest.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-destructive bg-red-100 dark:bg-red-950/40 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`HR <60 despite compressions + PPV × 60 s`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,l.jsx)(`strong`,{children:`Epinephrine 1:10,000 (0.1 mg/mL):`}),` IV/IO 0.01-0.03 mg/kg (0.1-0.3 mL/kg) — preferred. ETT 0.05-0.1 mg/kg. Repeat q3-5 min. Hypovolemia: `,(0,l.jsx)(`strong`,{children:`NS 10 mL/kg IV/IO over 5-10 min`}),`.`]})]})]}),(0,l.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-2 text-xs`,children:[(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,l.jsx)(`strong`,{children:`Target SpO₂ (preductal):`}),(0,l.jsx)(`br`,{}),`1 min 60-65% · 2 min 65-70% · 3 min 70-75% · 4 min 75-80% · 5 min 80-85% · 10 min 85-95%`]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,l.jsx)(`strong`,{children:`Initial ETT size:`}),(0,l.jsx)(`br`,{}),`<1 kg / <28 wk: 2.5 · 1-2 kg / 28-34 wk: 3.0 · 2-3 kg / 34-38 wk: 3.5 · >3 kg / >38 wk: 3.5-4.0`]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,l.jsx)(`strong`,{children:`ETT depth (lip):`}),` ~6 + weight(kg) cm`]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`NRP drug doses`}),(0,l.jsxs)(`div`,{className:`max-w-xs`,children:[(0,l.jsx)(`label`,{className:f,children:`Weight (kg)`}),(0,l.jsx)(`input`,{type:`number`,min:`0.3`,step:`0.1`,className:d,value:m,onChange:e=>v(e.target.value),"data-testid":`nrp-weight`})]}),E?(0,l.jsxs)(g,{children:[(0,l.jsx)(_,{name:`Epinephrine 1:10,000`,dose:(0,l.jsx)(h,{label:`${D}-${O} mg, ${Math.round(D*10)/10}-${Math.round(O*10)/10} mL (0.01-0.03 mg/kg = 0.1-0.3 mL/kg)`}),route:`IV / IO`,notes:`Preferred route. Repeat q3-5 min.`}),(0,l.jsx)(_,{name:`Epinephrine 1:10,000`,dose:(0,l.jsx)(h,{label:`${k}-${A} mg, ${Math.round(k*10)/10}-${Math.round(A*10)/10} mL (0.05-0.1 mg/kg = 0.5-1 mL/kg)`}),route:`ETT`,notes:`While IV being placed.`}),(0,l.jsx)(_,{name:`Normal saline`,dose:(0,l.jsx)(h,{label:`${j} mL (10 mL/kg)`}),route:`IV / IO`,notes:`Over 5-10 min for volume. Repeat PRN.`}),(0,l.jsx)(_,{name:`Dextrose 10%`,dose:(0,l.jsx)(h,{label:`${M} mL (2 mL/kg = 0.2 g/kg)`}),route:`IV slow push`,notes:`For documented hypoglycemia. Then D10 infusion 4-6 mg/kg/min.`})]}):(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see NRP doses.`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Concentration note:`}),` NRP uses epinephrine `,(0,l.jsx)(`strong`,{children:`1:10,000`}),` (0.1 mg/mL). NOT 1:1000 (1 mg/mL) — that is IM for anaphylaxis / older patients.`]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Apgar score`}),(0,l.jsx)(`div`,{className:`grid gap-2 grid-cols-1 sm:grid-cols-5 text-xs`,children:[[`appearance`,`Appearance`,[`Blue/pale`,`Body pink, extremities blue`,`All pink`]],[`pulse`,`Pulse`,[`Absent`,`<100 bpm`,`≥100 bpm`]],[`grimace`,`Grimace`,[`No response`,`Grimace`,`Cough/sneeze`]],[`activity`,`Activity`,[`Limp`,`Some flexion`,`Active motion`]],[`respiration`,`Respiration`,[`Absent`,`Slow/irregular`,`Good/crying`]]].map(([e,t,n])=>(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:t}),(0,l.jsx)(`select`,{className:d,value:y[e],onChange:t=>b({...y,[e]:Number(t.target.value)}),"data-testid":`apgar-`+e,children:n.map((e,t)=>(0,l.jsxs)(`option`,{value:t,children:[t,``,e]},t))})]},e))}),(0,l.jsxs)(`div`,{className:`rounded-md p-3 `+F,"data-testid":`apgar-result`,children:[(0,l.jsxs)(`div`,{className:`text-base font-bold`,children:[`Apgar: `,N,`/10 — `,P]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:I})]}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground italic`,children:[`Fenton TR, Kim JH. BMC Pediatr 2013;13:59 · NRP 8th ed (AHA/AAP 2020) · Apgar is a description of status — `,(0,l.jsx)(`strong`,{children:`never`}),` delay resuscitation while scoring.`]})]})}function y(){let[e,t]=(0,c.useState)(`asthma`),[n,r]=(0,c.useState)(``),i=Number.parseFloat(n),a=Number.isFinite(i)&&i>0,o=(e,t,n=`mg`)=>a?s(i,e,t,n):null,[p,m]=(0,c.useState)(null),[v,y]=(0,c.useState)({spo2:0,retractions:0,scalene:0,air:0,wheeze:0}),b=Object.values(v).reduce((e,t)=>e+t,0),x=b<=3?`Mild`:b<=7?`Moderate`:`Severe`,S=b<=3?`text-green-600 bg-green-50`:b<=7?`text-amber-600 bg-amber-50`:`text-destructive bg-red-50`,[C,w]=(0,c.useState)({conscious:0,cyanosis:0,stridor:0,air:0,retractions:0}),T=Object.values(C).reduce((e,t)=>e+t,0),E=T<=2?`Mild`:T<=5?`Moderate`:T<=11?`Severe`:`Impending Respiratory Failure`,D=T<=2?`text-green-600 bg-green-50`:T<=5?`text-amber-600 bg-amber-50`:T<=11?`text-destructive bg-red-50`:`text-red-900 bg-red-100`,[O,k]=(0,c.useState)({age:`gte12w`,spo2:`ok`,hydration:`ok`,distress:`mild`}),A=O.distress===`severe`||O.spo2===`low`||O.hydration===`poor`||O.age===`lt12w`;return(0,l.jsxs)(`section`,{className:u,"data-testid":`bedside-panel-respiratory`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Respiratory`}),(0,l.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:[`asthma`,`pram`,`croup`,`bronch`].map(n=>(0,l.jsx)(`button`,{type:`button`,onClick:()=>t(n),className:`px-3 py-1 rounded-full text-xs font-medium border `+(e===n?`bg-primary text-primary-foreground border-primary`:`bg-muted border-border`),"data-testid":`resp-mode-`+n,children:n===`asthma`?`Asthma`:n===`pram`?`PRAM`:n===`croup`?`Croup (Westley)`:`Bronchiolitis`},n))}),e!==`pram`&&e!==`bronch`&&(0,l.jsxs)(`div`,{className:`max-w-xs`,children:[(0,l.jsx)(`label`,{className:f,children:`Weight (kg)`}),(0,l.jsx)(`input`,{type:`number`,min:`0.3`,step:`0.1`,className:d,value:n,onChange:e=>r(e.target.value),"data-testid":`resp-weight`})]}),e===`asthma`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`flex gap-2`,children:[`mild`,`moderate`,`severe`].map(e=>(0,l.jsx)(`button`,{type:`button`,onClick:()=>m(e),className:`px-3 py-1 rounded text-xs font-medium border `+(p===e?e===`mild`?`bg-green-600 text-white`:e===`moderate`?`bg-amber-500 text-white`:`bg-destructive text-white`:`bg-muted`),children:e.charAt(0).toUpperCase()+e.slice(1)},e))}),p&&!a&&(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`}),p===`mild`&&a&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Speaks in sentences, no accessory muscle use, SpO₂ ≥94%`}),(0,l.jsxs)(g,{children:[(0,l.jsx)(_,{name:`Albuterol (MDI)`,dose:`4-8 puffs via spacer`,route:`Inhaled`,notes:`q20min × 3 doses, then q1-4h`}),(0,l.jsx)(_,{name:`Albuterol (neb)`,dose:(0,l.jsx)(h,{label:`${o(.15,5,`mg`).label} (min 2.5 mg)`}),route:`Nebulized`,notes:`q20min × 3 doses`}),(0,l.jsx)(_,{name:`Dexamethasone`,dose:(0,l.jsx)(h,{label:o(.6,16).label}),route:`PO/IV`,notes:`Single dose, or 2 days`}),(0,l.jsx)(_,{name:`Prednisolone`,dose:(0,l.jsx)(h,{label:`${o(1,60).label}/day`}),route:`PO`,notes:`Alternative: 3-5 day course`})]})]}),p===`moderate`&&a&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Speaks in phrases, some accessory muscle use, SpO₂ 90-93%`}),(0,l.jsxs)(g,{children:[(0,l.jsx)(_,{name:`Albuterol (neb)`,dose:(0,l.jsx)(h,{label:`${o(.15,5,`mg`).label} (min 2.5 mg)`}),route:`Nebulized`,notes:`q20min × 3 doses, then continuous if needed`}),(0,l.jsx)(_,{name:`Ipratropium`,dose:i<20?`250 mcg`:`500 mcg`,route:`Nebulized`,notes:`q20min × 3 doses with albuterol`}),(0,l.jsx)(_,{name:`Dexamethasone`,dose:(0,l.jsx)(h,{label:o(.6,16).label}),route:`PO/IV/IM`,notes:`Single dose`}),(0,l.jsx)(_,{name:`O₂ supplemental`,dose:`Target SpO₂ ≥94%`,route:`NC/mask`,notes:`Titrate to effect`})]})]}),p===`severe`&&a&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Speaks in words only, significant accessory muscle use, SpO₂ <90%. Consider ICU.`}),(0,l.jsxs)(g,{children:[(0,l.jsx)(_,{name:`Albuterol continuous`,dose:(0,l.jsx)(h,{label:`${o(.5,20,`mg`).label}/hr`}),route:`Continuous neb`,notes:`Or 0.15-0.3 mg/kg q20min`}),(0,l.jsx)(_,{name:`Ipratropium`,dose:i<20?`250 mcg`:`500 mcg`,route:`Nebulized`,notes:`q20min × 3 doses with albuterol`}),(0,l.jsx)(_,{name:`Dexamethasone`,dose:(0,l.jsx)(h,{label:o(.6,16).label}),route:`IV`,notes:`Or methylprednisolone 2 mg/kg IV (max 60 mg)`}),(0,l.jsx)(_,{name:`Magnesium sulfate`,dose:(0,l.jsx)(h,{label:`${o(50,2e3).label} IV over 20 min`}),route:`IV`,notes:`Single dose, monitor BP`}),(0,l.jsx)(_,{name:`Epinephrine (IM)`,dose:(0,l.jsx)(h,{label:`${o(.01,.5).label} (1:1000)`}),route:`IM`,notes:`If impending arrest / no IV access`}),(0,l.jsx)(_,{name:`Terbutaline`,dose:(0,l.jsx)(h,{label:`${o(.01,.4).label} SC/IV`}),route:`SC/IV`,notes:`Then 0.1-10 mcg/kg/min infusion`}),(0,l.jsx)(_,{name:`O₂ supplemental`,dose:`Target SpO₂ ≥94%`,route:`High flow / NIPPV`,notes:`Consider BiPAP/CPAP`})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-xs text-red-900 dark:text-red-100`,children:[(0,l.jsx)(`strong`,{children:`Continuous monitoring.`}),` Consider ICU admission. If no response to magnesium → terbutaline infusion. If impending respiratory failure → intubation (ketamine preferred induction agent).`]})]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`NAEPP/GINA guidelines. Always use clinical judgment.`})]}),e===`pram`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pediatric Respiratory Assessment Measure (PRAM) — for asthma exacerbation severity (0-12).`}),(0,l.jsx)(`div`,{className:`grid gap-2 grid-cols-1 sm:grid-cols-2`,children:[[`spo2`,`SpO₂`,[`≥95% (0)`,`92-94% (1)`,`<92% (2)`]],[`retractions`,`Suprasternal retractions`,[`Absent (0)`,`Present (2)`]],[`scalene`,`Scalene muscle use`,[`Absent (0)`,`Present (2)`]],[`air`,`Air entry`,[`Normal (0)`,`Mild ↓ at bases (1)`,`Widespread ↓ (2)`,`Absent/minimal (3)`]],[`wheeze`,`Wheezing`,[`Absent (0)`,`Expiratory only (1)`,`Ins+exp (2)`,`Audible without stethoscope/silent chest (3)`]]].map(([e,t,n])=>(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:t}),(0,l.jsx)(`select`,{className:d,value:v[e],onChange:t=>y({...v,[e]:Number(t.target.value)}),"data-testid":`pram-`+e,children:n.map((e,t)=>(0,l.jsx)(`option`,{value:t,children:e},t))})]},e))}),(0,l.jsxs)(`div`,{className:`rounded-md p-3 `+S,"data-testid":`pram-result`,children:[(0,l.jsxs)(`div`,{className:`text-base font-bold`,children:[`PRAM Score: `,b,`/12 — `,x]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Mild (0-3): outpatient management. Moderate (4-7): consider oral steroids + frequent bronchodilators. Severe (8-12): aggressive treatment, consider ICU.`})]})]}),e===`croup`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Westley croup score (0-17).`}),(0,l.jsx)(`div`,{className:`grid gap-2 grid-cols-1 sm:grid-cols-2`,children:[[`conscious`,`Level of consciousness`,[`Normal (0)`,`Disoriented (5)`]],[`cyanosis`,`Cyanosis`,[`None (0)`,`With agitation (4)`,`At rest (5)`]],[`stridor`,`Stridor`,[`None (0)`,`With agitation (1)`,`At rest (2)`]],[`air`,`Air entry`,[`Normal (0)`,`Decreased (1)`,`Severely decreased (2)`]],[`retractions`,`Retractions`,[`None (0)`,`Mild (1)`,`Moderate (2)`,`Severe (3)`]]].map(([e,t,n])=>(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:t}),(0,l.jsx)(`select`,{className:d,value:C[e],onChange:t=>w({...C,[e]:Number(t.target.value)}),"data-testid":`croup-`+e,children:n.map((e,t)=>(0,l.jsx)(`option`,{value:t,children:e},t))})]},e))}),(0,l.jsxs)(`div`,{className:`rounded-md p-3 `+D,"data-testid":`croup-result`,children:[(0,l.jsxs)(`div`,{className:`text-base font-bold`,children:[`Westley: `,T,`/17 — `,E]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Mild ≤2 · Moderate 3-5 · Severe 6-11 · Impending failure ≥12.`})]}),a&&(0,l.jsxs)(g,{children:[(0,l.jsx)(_,{name:`Dexamethasone`,dose:(0,l.jsx)(h,{label:o(.6,16).label}),route:T<=2?`PO`:T<=5?`PO/IM`:`IV/IM`,notes:`Preferred corticosteroid; single dose`}),T>2&&(0,l.jsx)(_,{name:`Racemic epinephrine`,dose:`0.5 mL of 2.25% solution`,route:`Nebulized`,notes:`May repeat q15-20min, observe 2-4 h`}),T>2&&(0,l.jsx)(_,{name:`Nebulized epinephrine`,dose:`0.5 mL/kg of 1:1000 (max 5 mL)`,route:`Nebulized`,notes:`Alternative to racemic`}),T>5&&(0,l.jsx)(_,{name:`Heliox`,dose:`70:30 or 80:20`,route:`Face mask`,notes:`Consider if not responding`})]})]}),e===`bronch`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`grid gap-2 grid-cols-1 sm:grid-cols-2 max-w-xl`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Age`}),(0,l.jsxs)(`select`,{className:d,value:O.age,onChange:e=>k({...O,age:e.target.value}),children:[(0,l.jsx)(`option`,{value:`lt12w`,children:`<12 weeks (high risk)`}),(0,l.jsx)(`option`,{value:`gte12w`,children:`≥12 weeks`})]})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`SpO₂`}),(0,l.jsxs)(`select`,{className:d,value:O.spo2,onChange:e=>k({...O,spo2:e.target.value}),children:[(0,l.jsx)(`option`,{value:`ok`,children:`≥90%`}),(0,l.jsx)(`option`,{value:`low`,children:`<90%`})]})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Hydration`}),(0,l.jsxs)(`select`,{className:d,value:O.hydration,onChange:e=>k({...O,hydration:e.target.value}),children:[(0,l.jsx)(`option`,{value:`ok`,children:`Adequate`}),(0,l.jsx)(`option`,{value:`poor`,children:`Poor oral intake`})]})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Distress`}),(0,l.jsxs)(`select`,{className:d,value:O.distress,onChange:e=>k({...O,distress:e.target.value}),children:[(0,l.jsx)(`option`,{value:`mild`,children:`Mild`}),(0,l.jsx)(`option`,{value:`moderate`,children:`Moderate`}),(0,l.jsx)(`option`,{value:`severe`,children:`Severe`})]})]})]}),(0,l.jsxs)(`div`,{className:`rounded-md p-3 `+(A?`text-destructive bg-red-50`:`text-green-600 bg-green-50`),"data-testid":`bronch-result`,children:[(0,l.jsx)(`div`,{className:`text-base font-bold`,children:A?`Admit / Observe`:`Likely Safe for Discharge`}),O.age===`lt12w`&&(0,l.jsx)(`div`,{className:`text-xs text-destructive mt-1`,children:`⚠ Age <12 weeks — high risk for apnea. Monitor closely.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`NOT recommended (AAP 2014/2023):`}),` Albuterol/salbutamol (no benefit), epinephrine (no evidence), systemic corticosteroids (no benefit), antibiotics (unless bacterial co-infection), chest physiotherapy.`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AAP Clinical Practice Guideline: Management of Bronchiolitis in Infants and Children (2014, reaffirmed 2023). RSV most common (50-80%).`})]})]})}function b(){let[e,t]=(0,c.useState)(``),[n,r]=(0,c.useState)(``),i=Number.parseFloat(e),a=Number.parseFloat(n),o=Number.isFinite(i)&&i>0,s=o?Math.round(i*1*10)/10:0,p=o?Math.round(i*2*10)/10:0,m=o?Math.round(i*6*10)/10:0,h=o?Math.round(i*8*10)/10:0,v=Number.isFinite(a)&&a>=0?a<.1?`30-40`:a<1?`25-35`:a<5?`20-25`:a<12?`16-20`:`12-16`:``;return(0,l.jsxs)(`section`,{className:u,"data-testid":`bedside-panel-ventilation`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`O₂ & Ventilation`}),(0,l.jsxs)(`div`,{className:`grid gap-2 grid-cols-2 max-w-md`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Weight (kg)`}),(0,l.jsx)(`input`,{type:`number`,min:`0.3`,step:`0.1`,className:d,value:e,onChange:e=>t(e.target.value),"data-testid":`vent-weight`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Age (years)`}),(0,l.jsx)(`input`,{type:`number`,min:`0`,step:`0.5`,className:d,value:n,onChange:e=>r(e.target.value),"data-testid":`vent-age`})]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Target SpO₂`}),(0,l.jsxs)(g,{notes:!0,children:[(0,l.jsx)(_,{name:`Most children`,dose:`94-98%`,route:``,notes:`Normal`}),(0,l.jsx)(_,{name:`Bronchiolitis (AAP 2014/2023)`,dose:`≥90%`,route:``,notes:`Don't chase higher saturations`}),(0,l.jsx)(_,{name:`Chronic lung disease / CF`,dose:`90-94%`,route:``,notes:`Avoid hyperoxia in CO₂ retainers`}),(0,l.jsx)(_,{name:`Preterm neonate`,dose:`90-95%`,route:``,notes:`Minimize ROP risk`}),(0,l.jsx)(_,{name:`Term neonate (min of life)`,dose:`Per NRP ladder`,route:``,notes:`1 min 60-65% · 10 min 85-95%`})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Escalation ladder`}),(0,l.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-green-500 bg-green-50 dark:bg-green-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`1. Nasal cannula (low-flow)`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,l.jsx)(`strong`,{children:`0.5-6 L/min`}),` · FiO₂ ~24-40% · comfortable, no humidification. Good for mild hypoxia.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`2. Simple face mask`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,l.jsx)(`strong`,{children:`6-10 L/min`}),` · FiO₂ 35-60%. Must keep flow >6 L/min to flush CO₂.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-purple-500 bg-purple-50 dark:bg-purple-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`3. Non-rebreather mask`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,l.jsx)(`strong`,{children:`10-15 L/min`}),` · FiO₂ 60-90%. Reservoir bag must stay inflated.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-amber-500 bg-amber-50 dark:bg-amber-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`4. High-flow nasal cannula (HFNC)`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,l.jsx)(`strong`,{children:o?`1-2 L/kg/min = ${s}-${p} L/min`:`1-2 L/kg/min`}),` · heated + humidified · FiO₂ 30-100% titratable · generates ~2-5 cmH₂O PEEP. Reassess at 1-2 h.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-red-500 bg-red-50 dark:bg-red-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`5. Non-invasive (CPAP / BiPAP)`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`CPAP 5-10 cmH₂O · BiPAP IPAP 10-14 / EPAP 5. Needs cooperative patient, intact airway reflexes, no copious secretions.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-destructive bg-red-100 dark:bg-red-950/40 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`6. Intubate + mechanical ventilation`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`When NIV fails, airway compromised, apnea, or GCS ≤8. See Airway tab for RSI drugs.`})]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Bag-Valve-Mask (BVM)`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-xs space-y-1`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`When:`}),` apnea, bradycardia (HR <60 neonate; inadequate breathing at any age), during resuscitation.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Rate:`}),` Newborn 40-60/min · Infant-child 20-30/min · Adolescent 10-12/min (1 breath q5-6 sec).`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Tidal volume:`}),` 6-8 mL/kg — gentle chest rise only. Avoid over-ventilation.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Technique:`}),` head tilt / jaw thrust, E-C or 2-thumb mask seal, squeeze 1 sec, release fully.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Not ventilating?`}),` MR SOPA — Mask reseal, Reposition airway, Suction, Open mouth, Pressure ↑, Alternative airway.`]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Mechanical vent — starting settings`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs space-y-1`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Mode:`}),` Volume-control OR Pressure-control. PRVC / SIMV-PS hybrids.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Tidal volume:`}),` `,(0,l.jsx)(`strong`,{children:o?`${m}-${h} mL`:`6-8 mL/kg`}),` (6-8 mL/kg). Use 4-6 mL/kg for ARDS.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Rate:`}),` `,v?`${v}/min (age ${a} yr)`:`Newborn 30-40 · Infant 25-35 · Child 16-20 · Adolescent 12-16`,`.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`PEEP:`}),` start 5 cmH₂O. Increase to 8-12+ for refractory hypoxia.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`FiO₂:`}),` start 100%, wean rapidly to lowest that maintains target SpO₂.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`I:E ratio:`}),` 1:2 normally; 1:3-4 for obstructive disease.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Plateau pressure:`}),` keep <30 cmH₂O (ideally <28).`]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Adjusting for gas exchange`}),(0,l.jsxs)(g,{notes:!0,children:[(0,l.jsx)(_,{name:`Low SpO₂ (oxygenation)`,dose:`↑ FiO₂`,route:``,notes:`Then ↑ PEEP (recruits collapsed alveoli)`}),(0,l.jsx)(_,{name:`↑ PCO₂ (ventilation)`,dose:`↑ Rate`,route:``,notes:`Then ↑ Tidal volume`}),(0,l.jsx)(_,{name:`↓ PCO₂ (over-ventilating)`,dose:`↓ Rate`,route:``,notes:`Then ↓ Tidal volume`}),(0,l.jsx)(_,{name:`High peak pressure`,dose:`Check tube / compliance`,route:``,notes:`Suction, bronchodilator, lower TV`}),(0,l.jsx)(_,{name:`Auto-PEEP (asthma, bronch)`,dose:`↓ Rate, ↑ Te`,route:``,notes:`Disconnect + bag briefly if critical`})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-green-50 dark:bg-green-950/30 p-3 text-xs text-green-900 dark:text-green-100`,children:[(0,l.jsx)(`strong`,{children:`Mental model:`}),` Oxygenation is mostly `,(0,l.jsx)(`strong`,{children:`FiO₂ + PEEP`}),`. Ventilation (CO₂) is mostly `,(0,l.jsx)(`strong`,{children:`rate + tidal volume`}),`. Obstructive (asthma, bronchiolitis) → long expiratory time, permissive hypercapnia. Restrictive (ARDS) → low TV, high PEEP, permissive hypercapnia + hypoxia.`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AAP / PALS / AARC guidance.`})]})}function x(){let[e,t]=(0,c.useState)(``),[n,r]=(0,c.useState)(`child`),i=Number.parseFloat(e),a=Number.isFinite(i)&&i>0,o=(e,t,n=`mg`)=>a?s(i,e,t,n):null,p=n===`neonate`?`Neonate (0-28 d)`:n===`infant`?`Young infant (29 d - 3 mo)`:`Older child / adolescent`,m=a?Math.round(i*20):null;return(0,l.jsxs)(`section`,{className:u,"data-testid":`bedside-panel-sepsis`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Sepsis & Fever`}),(0,l.jsxs)(`div`,{className:`grid gap-2 grid-cols-1 sm:grid-cols-2 max-w-md`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Weight (kg)`}),(0,l.jsx)(`input`,{type:`number`,min:`0.3`,step:`0.1`,className:d,value:e,onChange:e=>t(e.target.value),"data-testid":`sepsis-weight`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Age band`}),(0,l.jsxs)(`select`,{className:d,value:n,onChange:e=>r(e.target.value),"data-testid":`sepsis-age`,children:[(0,l.jsx)(`option`,{value:`neonate`,children:`Neonate (0-28 d)`}),(0,l.jsx)(`option`,{value:`infant`,children:`Infant (29 d - 3 mo)`}),(0,l.jsx)(`option`,{value:`child`,children:`Older child / adolescent`})]})]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-destructive bg-red-50 dark:bg-red-950/30 p-3 text-sm font-semibold text-destructive`,children:[`Sepsis approach — `,p,a?`, ${i} kg`:``]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Definition — Phoenix Sepsis Criteria (JAMA 2024)`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs space-y-1`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Sepsis`}),` = suspected or confirmed infection + Phoenix Score ≥2 (organ dysfunction across respiratory, cardiovascular, coagulation, neurological).`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Septic shock`}),` = sepsis + cardiovascular dysfunction (vasoactive support, or ↑lactate ≥5, or ↓MAP for age).`]}),(0,l.jsx)(`div`,{className:`text-muted-foreground italic`,children:`Previous SIRS-based criteria (Goldstein 2005) are now superseded.`})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Red flags`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-xs text-red-900 dark:text-red-100`,children:[`Abnormal behavior / mentation · Fever + ill-appearance · Tachycardia out of proportion to fever · Prolonged cap refill (>3 s) · Cold/mottled extremities · Weak pulses or wide pulse pressure ("warm shock") · Hypotension is a `,(0,l.jsx)(`strong`,{children:`LATE`}),` sign · Any immune compromise / indwelling line.`]}),(0,l.jsxs)(`h3`,{className:`text-sm font-semibold mt-2`,children:[`Empirical therapy — `,p]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs`,children:[n===`neonate`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:`Workup (full sepsis eval):`}),` CBC+diff, CRP, blood culture, UA+urine culture (cath), `,(0,l.jsx)(`strong`,{children:`LP`}),` (CSF+HSV PCR), CXR if respiratory sx, procalcitonin. `,(0,l.jsx)(`strong`,{children:`Early-onset`}),` (<72 h): GBS, E. coli, Listeria. `,(0,l.jsx)(`strong`,{children:`Late-onset`}),` (>72 h): CoNS, S. aureus, gram-negs, Candida.`]}),n===`infant`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:`Workup:`}),` Use validated rules — PECARN, Aronson, Rochester, Step-by-Step. CBC+ANC, procalcitonin/CRP, blood culture, UA+urine culture. Many warrant LP + admission + empiric abx. `,(0,l.jsx)(`strong`,{children:`Coverage:`}),` GBS, E. coli, Listeria (up to ~6 wk), S. pneumo, N. meningitidis, H. flu, Salmonella.`]}),n===`child`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:`Recognition:`}),` Phoenix score or clinical concern + suspected infection. `,(0,l.jsx)(`strong`,{children:`Workup:`}),` CBC, CRP, procalcitonin, blood cx (+site-specific), lactate, blood gas, glucose, electrolytes, coags, LP if CNS concern. Source-directed imaging.`]})]}),a&&(0,l.jsxs)(g,{children:[n===`neonate`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(_,{name:`Ampicillin`,dose:(0,l.jsx)(h,{label:o(100,2e3).label}),route:`IV`,notes:`q8-12h. Covers GBS, Listeria, Enterococcus.`}),(0,l.jsx)(_,{name:`Gentamicin`,dose:(0,l.jsx)(h,{label:o(4,120).label}),route:`IV`,notes:`q24-48h. Monitor levels.`}),(0,l.jsx)(_,{name:`Cefotaxime (add)`,dose:(0,l.jsx)(h,{label:o(50,2e3).label}),route:`IV`,notes:`If meningitis or gram-neg concern.`}),(0,l.jsx)(_,{name:`Acyclovir`,dose:(0,l.jsx)(h,{label:o(20,1200).label}),route:`IV q8h`,notes:`HSV risk: maternal lesions, vesicles, seizures, CSF pleocytosis.`})]}),n===`infant`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(_,{name:`Ceftriaxone`,dose:(0,l.jsx)(h,{label:o(75,2e3).label}),route:`IV / IM`,notes:`q24h (100 mg/kg/day divided q12h for meningitis). <strong>Avoid <28 d</strong> if hyperbilirubinemia.`}),(0,l.jsx)(_,{name:`Ampicillin`,dose:(0,l.jsx)(h,{label:o(100,2e3).label}),route:`IV`,notes:`If <6 wk: add for Listeria coverage.`}),(0,l.jsx)(_,{name:`Vancomycin`,dose:(0,l.jsx)(h,{label:o(15,1e3).label}),route:`IV`,notes:`If severe / MRSA risk / meningitis.`}),(0,l.jsx)(_,{name:`Acyclovir`,dose:(0,l.jsx)(h,{label:o(20,1200).label}),route:`IV q8h`,notes:`<6 wk with suspicion of HSV.`})]}),n===`child`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(_,{name:`Ceftriaxone`,dose:(0,l.jsx)(h,{label:o(50,2e3).label}),route:`IV`,notes:`q24h (100 mg/kg/day divided for meningitis).`}),(0,l.jsx)(_,{name:`Vancomycin`,dose:(0,l.jsx)(h,{label:o(15,1e3).label}),route:`IV`,notes:`q6h. If severe, indwelling line, or MRSA prevalence >10%.`}),(0,l.jsx)(_,{name:`Piperacillin-tazobactam`,dose:(0,l.jsx)(h,{label:o(100,4500).label}),route:`IV`,notes:`If intra-abdominal / neutropenic.`}),(0,l.jsx)(_,{name:`Clindamycin`,dose:(0,l.jsx)(h,{label:o(10,900).label}),route:`IV`,notes:`Adjunct for toxic shock syndrome (toxin suppression).`}),(0,l.jsx)(_,{name:`Acyclovir`,dose:(0,l.jsx)(h,{label:o(20,1200).label}),route:`IV q8h`,notes:`If HSV CNS concern.`})]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`First-hour bundle (SSC Peds 2020)`}),(0,l.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`0-5 min — Recognize`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Screen, sepsis huddle/activation, ABCs, O₂ to SpO₂ >94%, warm.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-purple-500 bg-purple-50 dark:bg-purple-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`5-15 min — Access & labs`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Two IVs or IO. Draw blood cx (ideally before abx), lactate, CBC, CMP, coags, blood gas, glucose. UA + culture. Source-specific cultures.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-amber-500 bg-amber-50 dark:bg-amber-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`15-30 min — Fluids`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[a?(0,l.jsxs)(l.Fragment,{children:[`NS or LR `,(0,l.jsxs)(`strong`,{children:[m,` mL`]}),` bolus (20 mL/kg) over 5-10 min.`]}):(0,l.jsx)(l.Fragment,{children:`NS/LR 10-20 mL/kg bolus over 5-10 min.`}),` Reassess HR, perfusion, lungs, liver. Repeat up to 40-60 mL/kg; stop if crackles/hepatomegaly.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-green-500 bg-green-50 dark:bg-green-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`30-60 min — Antibiotics + reassess`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Broad-spectrum empiric abx within 1 hour (≤1 h in septic shock). Recheck lactate, perfusion.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-destructive bg-red-50 dark:bg-red-950/30 p-3`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`>60 min — Fluid-refractory shock`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Start vasoactive (`,(0,l.jsx)(`strong`,{children:`epinephrine 0.05-0.3 mcg/kg/min`}),` cold / `,(0,l.jsx)(`strong`,{children:`norepinephrine 0.05-0.3 mcg/kg/min`}),` warm). Central/IO access. Stress-dose hydrocortisone `,a?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`strong`,{children:[o(2,100).value,` mg`]}),` IV (2 mg/kg, max 100 mg)`]}):`2 mg/kg IV (max 100 mg)`,` if catecholamine-resistant. ICU.`]})]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Resuscitation targets`}),(0,l.jsx)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs`,children:`Normal mentation · Cap refill ≤2 s · Warm extremities · Strong peripheral pulses · UOP ≥1 mL/kg/hr · MAP ≥5th %ile for age (>65 mmHg adolescent) · SpO₂ ≥94% · Lactate trending down.`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Phoenix Sepsis Criteria (Schlapbach et al., JAMA 2024) · Surviving Sepsis Campaign Pediatric 2020 · AAP pediatric sepsis guidance.`})]})}var S=[{key:`head`,label:`Head`,vals:[18,13,11,9,7],ageSensitive:!0},{key:`neck`,label:`Neck`,vals:[2,2,2,2,2]},{key:`ant_trunk`,label:`Anterior trunk`,vals:[13,13,13,13,13]},{key:`post_trunk`,label:`Posterior trunk`,vals:[13,13,13,13,13]},{key:`r_buttock`,label:`Right buttock`,vals:[2.5,2.5,2.5,2.5,2.5]},{key:`l_buttock`,label:`Left buttock`,vals:[2.5,2.5,2.5,2.5,2.5]},{key:`genital`,label:`Genitalia`,vals:[1,1,1,1,1]},{key:`r_uparm`,label:`R upper arm`,vals:[4,4,4,4,4]},{key:`l_uparm`,label:`L upper arm`,vals:[4,4,4,4,4]},{key:`r_forearm`,label:`R forearm`,vals:[3,3,3,3,3]},{key:`l_forearm`,label:`L forearm`,vals:[3,3,3,3,3]},{key:`r_hand`,label:`R hand`,vals:[2.5,2.5,2.5,2.5,2.5]},{key:`l_hand`,label:`L hand`,vals:[2.5,2.5,2.5,2.5,2.5]},{key:`r_thigh`,label:`R thigh`,vals:[5.5,8,8.5,9,9.5],ageSensitive:!0},{key:`l_thigh`,label:`L thigh`,vals:[5.5,8,8.5,9,9.5],ageSensitive:!0},{key:`r_leg`,label:`R lower leg`,vals:[5,5.5,6,6.5,7],ageSensitive:!0},{key:`l_leg`,label:`L lower leg`,vals:[5,5.5,6,6.5,7],ageSensitive:!0},{key:`r_foot`,label:`R foot`,vals:[3.5,3.5,3.5,3.5,3.5]},{key:`l_foot`,label:`L foot`,vals:[3.5,3.5,3.5,3.5,3.5]}],C=[{id:`infant`,label:`Infant (<1 y)`},{id:`young`,label:`Young child (1-5 y)`},{id:`child`,label:`Child (5-10 y)`},{id:`adol`,label:`Adolescent (10-15 y)`},{id:`adult`,label:`Adult (>15 y)`}];function w(){let[e,t]=(0,c.useState)(``),[n,r]=(0,c.useState)(`young`),[i,a]=(0,c.useState)(``),[o,s]=(0,c.useState)({}),p=C.findIndex(e=>e.id===n),m=S.reduce((e,t)=>e+t.vals[p]*Math.min(100,Math.max(0,o[t.key]??0))/100,0),h=i.trim()?Number(i):Math.round(m*10)/10,g=Number.parseFloat(e),_=Number.isFinite(g)&&g>0,v=Number.isFinite(h)&&h>0,y=_&&v?Math.round(4*g*h):0,b=Math.round(y/2),x=Math.round(b/8),w=y-b,T=Math.round(w/16),E=_?Math.round(g<=10?g*4:g<=20?40+(g-10)*2:60+(g-20)):0;return(0,l.jsxs)(`section`,{className:u,"data-testid":`bedside-panel-burns`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Burns — Lund-Browder + Parkland`}),(0,l.jsxs)(`div`,{className:`grid gap-2 grid-cols-1 sm:grid-cols-3 max-w-xl`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Weight (kg)`}),(0,l.jsx)(`input`,{type:`number`,min:`0.3`,step:`0.1`,className:d,value:e,onChange:e=>t(e.target.value),"data-testid":`burn-weight`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`Age band`}),(0,l.jsx)(`select`,{className:d,value:n,onChange:e=>r(e.target.value),"data-testid":`burn-age`,children:C.map(e=>(0,l.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:f,children:`TBSA override (%)`}),(0,l.jsx)(`input`,{type:`number`,min:`0`,max:`100`,step:`1`,className:d,value:i,onChange:e=>a(e.target.value),placeholder:v?String(h):`auto`,"data-testid":`burn-tbsa`})]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Body parts — % of each region burned (2° or deeper)`}),(0,l.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-2`,children:S.map(e=>{let t=e.vals[p];return(0,l.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/30 rounded p-2`,children:[(0,l.jsxs)(`label`,{className:`flex-1 text-xs`,children:[e.label,` `,(0,l.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,t,`%`,e.ageSensitive?`*`:``,`)`]})]}),(0,l.jsx)(`input`,{type:`number`,min:`0`,max:`100`,step:`5`,className:`w-16 rounded border border-input bg-background px-2 py-1 text-xs text-right`,value:o[e.key]??0,onChange:t=>s({...o,[e.key]:Number(t.target.value)}),"data-testid":`burn-region-`+e.key}),(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`%`})]},e.key)})}),v&&(0,l.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[`Computed TBSA: `,(0,l.jsxs)(`strong`,{children:[h,`%`]})]}),!_&&(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see Parkland + maintenance fluids.`}),!v&&_&&(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter % per region or override TBSA to compute fluids.`}),_&&v&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-destructive bg-red-50 dark:bg-red-950/30 p-3 text-sm font-semibold text-destructive`,"data-testid":`burn-result`,children:[`Burn fluid resuscitation — `,g,` kg, `,h,`% TBSA (2° or deeper)`]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-sm space-y-1`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Parkland formula:`}),` 4 mL × kg × %TBSA = `,(0,l.jsxs)(`strong`,{children:[y,` mL LR over 24 hours`]})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`First 8 h`}),` (from time of burn): `,b,` mL (~`,(0,l.jsxs)(`strong`,{children:[x,` mL/hr`]}),`)`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Next 16 h:`}),` `,w,` mL (~`,(0,l.jsxs)(`strong`,{children:[T,` mL/hr`]}),`)`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-sm`,children:[(0,l.jsx)(`strong`,{children:`Plus maintenance (4-2-1):`}),` `,E,` mL/hr (D5 ½NS ± 20 mEq KCl/L once UOP established). Consider dextrose in children <30 kg.`]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-sm`,children:[(0,l.jsx)(`strong`,{children:`Titrate to UOP:`}),` target 1-2 mL/kg/hr (infants / children), 0.5-1 mL/kg/hr (adolescents). `,(0,l.jsx)(`strong`,{children:`Clinical response trumps formula.`})]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Other pearls`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs space-y-1`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Rule of palm:`}),` Patient's palm + fingers ≈ 1% TBSA — good for scattered burns.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`First-degree burns DO NOT count`}),` toward TBSA or Parkland.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Analgesia:`}),` Morphine 0.05-0.1 mg/kg IV q2h, or fentanyl 1-2 mcg/kg IV q30-60 min.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Tetanus`}),` prophylaxis if indicated. Tdap/Td ± TIG.`]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Burn center referral (ABA)`}),(0,l.jsx)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:`Partial-thickness >10% TBSA · any full-thickness · face/hands/feet/genital/perineum/major joints · electrical/chemical/inhalation · associated trauma · significant comorbidities · pediatric burns in non-pediatric center.`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`ABA Advanced Burn Life Support 2018 · Parkland formula: Baxter 1968 · Lund-Browder 1944.`})]})}var T=`rounded-lg border border-border bg-card p-5 space-y-3`,E=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring`,D=`block text-xs font-medium text-muted-foreground`,O=`text-left px-2 py-1.5 border-b border-border font-semibold uppercase tracking-wide text-[10px] text-muted-foreground`,k=`px-2 py-1.5 border-b border-border align-top text-sm`;function A({id:e,value:t,onChange:n,testid:r}){return(0,l.jsxs)(`div`,{className:`max-w-xs`,children:[(0,l.jsx)(`label`,{htmlFor:e,className:D,children:`Weight (kg)`}),(0,l.jsx)(`input`,{id:e,type:`number`,min:`0.3`,step:`0.1`,className:E,value:t,onChange:e=>n(e.target.value),"data-testid":r})]})}function j({label:e}){let t=e.indexOf(`(`);if(t<0)return(0,l.jsx)(`span`,{className:`font-semibold`,children:e});let n=e.slice(0,t).trim(),r=e.slice(t);return(0,l.jsxs)(`span`,{children:[(0,l.jsx)(`span`,{className:`font-semibold`,children:n}),` `,(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r})]})}var M={epi:{perKg:.01,max:.5,unit:`mg`},fluids:{perKg:20,max:null,unit:`mL`},dph:{perKg:1.25,max:50,unit:`mg`},ranitidine:{perKg:1,max:50,unit:`mg`},dex:{perKg:.6,max:16,unit:`mg`},mpn:{perKg:2,max:125,unit:`mg`},glucagon:{perKg:.02,max:1,unit:`mg`}};function N(){let[e,t]=(0,c.useState)(``),n=Number.parseFloat(e);if(!Number.isFinite(n)||n<=0)return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-anaphylaxis`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Anaphylaxis`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Emergency management. Epinephrine IM is the immediate and only proven lifesaving step.`}),(0,l.jsx)(A,{id:`anaph-wt`,value:e,onChange:t,testid:`anaph-weight`}),(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]});let r=s(n,M.epi.perKg,M.epi.max,M.epi.unit),i=Math.round(r.value*10)/10,a=n<10?`Draw up manually`:n<=25?`EpiPen Jr / Auvi-Q 0.15 mg`:`EpiPen / Auvi-Q 0.3 mg`,o=s(n,M.fluids.perKg,M.fluids.max,M.fluids.unit),u=s(n,M.dph.perKg,M.dph.max),d=s(n,M.ranitidine.perKg,M.ranitidine.max),f=s(n,M.dex.perKg,M.dex.max),p=s(n,M.mpn.perKg,M.mpn.max),m=s(n,M.glucagon.perKg,M.glucagon.max),h=[[`STEP 2`,`Position`,`Supine + legs elevated`,``,`If dyspneic: sitting position. If vomiting: recovery position`],[`STEP 3`,`O₂`,`High flow 10-15 L/min`,`Face mask`,`100% O₂. Prepare for airway management`],[`STEP 4`,`IV fluids`,`NS ${o.label} bolus`,`IV/IO`,`Repeat up to 60 mL/kg for hypotension`],[`STEP 5`,`Diphenhydramine`,u.label,`IV/IM/PO`,`H1 blocker. NOT first-line — adjunct only`],[``,`Ranitidine`,d.label,`IV over 5 min`,`H2 blocker. Optional adjunct`],[`STEP 6`,`Dexamethasone`,f.label,`IV/IM/PO`,`Prevents biphasic reaction (4-6 hrs later)`],[``,`Methylprednisolone`,p.label,`IV`,`Alternative steroid`],[`REFRACTORY`,`Epinephrine gtt`,`0.1-1 mcg/kg/min`,`IV infusion`,`For persistent hypotension despite fluids + IM epi`],[``,`Glucagon`,m.label,`IV/IM`,`For patients on beta-blockers not responding to epi`]];return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-anaphylaxis`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Anaphylaxis`}),(0,l.jsx)(A,{id:`anaph-wt`,value:e,onChange:t,testid:`anaph-weight`}),(0,l.jsxs)(`div`,{className:`rounded-lg border-2 border-destructive bg-red-50 dark:bg-red-950/30 p-4 space-y-1`,children:[(0,l.jsx)(`div`,{className:`text-base font-bold text-destructive`,children:`STEP 1: Epinephrine IM — GIVE IMMEDIATELY`}),(0,l.jsxs)(`div`,{className:`text-sm font-semibold`,children:[`Epinephrine 1:1000 (1 mg/mL): `,(0,l.jsxs)(`span`,{className:`text-destructive`,children:[r.value,` mg (`,i,` mL)`]}),` IM to lateral thigh`]}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[M.epi.perKg,` mg/kg (max `,M.epi.max,` mg) · Auto-injector: `,a]}),(0,l.jsx)(`div`,{className:`text-xs text-destructive`,children:`May repeat every 5-15 minutes if symptoms persist. No contraindications in anaphylaxis.`})]}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,"data-testid":`anaph-table`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Step`}),(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:h.map((e,t)=>(0,l.jsxs)(`tr`,{className:e[0]===`REFRACTORY`||t>0&&h[t-1][0]===`REFRACTORY`&&e[0]===``?`bg-amber-50 dark:bg-amber-950/30`:``,children:[(0,l.jsx)(`td`,{className:k+` font-semibold text-primary text-xs`,children:e[0]}),(0,l.jsx)(`td`,{className:k+` font-semibold`,children:e[1]}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:e[2]})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:e[3]}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:e[4]})]},t))})]})}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Observe minimum 4-6 hours`}),` after last dose of epinephrine (biphasic reactions occur in 5-20% of cases). Discharge with EpiPen prescription and anaphylaxis action plan. Refer to allergist.`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`ASCIA Anaphylaxis Guidelines 2021 · WAO Anaphylaxis Guidance 2020 · AAP/ACAAI Practice Parameters.`})]})}function P(){let[e,t]=(0,c.useState)(``),[n,r]=(0,c.useState)(`general`),i=Number.parseFloat(e),a=Number.isFinite(i)&&i>0,o=(e,t,n=`mg`)=>a?s(i,e,t,n):null,u=[{id:`general`,label:`PALS General`},{id:`asystole`,label:`Asystole / PEA`},{id:`brady`,label:`Bradycardia`},{id:`svt`,label:`SVT`},{id:`vfib`,label:`VF / Pulseless VT`},{id:`vt`,label:`Stable VT`}];function d({name:e,dose:t,route:n,notes:r}){return(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:e}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:t})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:n}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:r})]})}function f({children:e}){return(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:e})]})})}function p(){if(!a)return null;let e=o(.01,1,`mg`),t=o(.1,10,`mL`),n=o(.1,2.5,`mg`),r=o(5,300,`mg`),i=o(1,100,`mg`),s=o(.02,.5,`mg`),c=o(.1,6,`mg`),u=o(.2,12,`mg`),p=o(1,50,`mEq`),m=o(20,1e3,`mg`),h=o(.2,10,`mL`),g=o(60,3e3,`mg`),_=o(.6,30,`mL`),v=o(50,2e3,`mg`),y=o(2,null,`mL`);return(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{name:`Epinephrine 1:10,000`,dose:`${e.label} (${t.label})`,route:`IV / IO`,notes:`0.01 mg/kg = 0.1 mL/kg of 1:10,000. Max single dose 1 mg. Repeat q3-5 min.`}),(0,l.jsx)(d,{name:`Epinephrine ET`,dose:n.label,route:`ETT`,notes:`0.1 mg/kg (1 mL/kg of 1:10,000) if no IV/IO`}),(0,l.jsx)(d,{name:`Amiodarone`,dose:r.label,route:`IV / IO bolus`,notes:`5 mg/kg for arrest. Max 300 mg. Repeat up to 2 times (max 15 mg/kg/day).`}),(0,l.jsx)(d,{name:`Lidocaine`,dose:i.label,route:`IV / IO bolus`,notes:`1 mg/kg. Alternative to amiodarone for VF/VT.`}),(0,l.jsx)(d,{name:`Atropine`,dose:`${s.label} (min 0.1 mg)`,route:`IV / IO`,notes:`0.02 mg/kg. Bradycardia from ↑vagal tone or AV block.`}),(0,l.jsx)(d,{name:`Adenosine (1st)`,dose:c.label,route:`IV push + flush`,notes:`0.1 mg/kg (max 6 mg). For SVT. Rapid push, double flush.`}),(0,l.jsx)(d,{name:`Adenosine (2nd)`,dose:u.label,route:`IV push + flush`,notes:`0.2 mg/kg (max 12 mg). Second dose if first unsuccessful.`}),(0,l.jsx)(d,{name:`Sodium bicarb 8.4%`,dose:p.label,route:`IV / IO`,notes:`1 mEq/kg. ONLY if severe metabolic acidosis, hyperK, or TCA OD. Not routine.`}),(0,l.jsx)(d,{name:`Calcium chloride 10%`,dose:`${m.label} (${h.label})`,route:`IV / IO (central preferred)`,notes:`For hyperK, hypoCa, Mg OD, CCB OD. 20 mg/kg = 0.2 mL/kg.`}),(0,l.jsx)(d,{name:`Calcium gluconate 10%`,dose:`${g.label} (${_.label})`,route:`IV / IO (peripheral OK)`,notes:`60 mg/kg = 0.6 mL/kg. Preferred peripherally.`}),(0,l.jsx)(d,{name:`Magnesium sulfate`,dose:v.label,route:`IV over 10-20 min`,notes:`25-50 mg/kg. Torsades, severe asthma. Max 2 g.`}),(0,l.jsx)(d,{name:`Dextrose 10%`,dose:`${y.label} (0.2 g/kg)`,route:`IV push`,notes:`For documented hypoglycemia`}),(0,l.jsx)(d,{name:`Defibrillation`,dose:`2 J/kg → 4 J/kg → 10 J/kg (max 10 J/kg or adult dose)`,route:`Pad`,notes:`For VF/pulseless VT. Resume CPR immediately after shock.`}),(0,l.jsx)(d,{name:`Cardioversion (sync)`,dose:`0.5-1 J/kg → 2 J/kg`,route:`Pad`,notes:`For unstable SVT/VT. Sedate if possible.`})]})}function m(){if(!a)return null;let e=o(.01,1,`mg`),t=o(.1,2.5,`mg`);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{name:`CPR`,dose:`100-120/min, depth 1/3 AP`,route:``,notes:`15:2 (2 rescuer) or 30:2 (single). Rotate every 2 min.`}),(0,l.jsx)(d,{name:`Epinephrine`,dose:e.label,route:`IV / IO`,notes:`0.01 mg/kg 1:10,000 = 0.1 mL/kg. Q3-5 min. Start early.`}),(0,l.jsx)(d,{name:`Epinephrine ETT`,dose:t.label,route:`ETT`,notes:`0.1 mg/kg if no IV access`})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Reversible causes (H's & T's)`}),(0,l.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2 text-xs`,children:[(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,l.jsx)(`strong`,{children:`H's`}),` — Hypoxia, Hypovolemia, H+ (acidosis), Hypo/hyperK, Hypoglycemia, Hypothermia`]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,l.jsx)(`strong`,{children:`T's`}),` — Tension PTX, Tamponade, Toxins, Thrombosis (MI/PE), Trauma`]})]})]})}function h(){if(!a)return null;let e=o(.01,1,`mg`),t=o(.02,.5,`mg`);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-amber-500 bg-amber-50 dark:bg-amber-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-amber-800 dark:text-amber-200`,children:`Bradycardia with poor perfusion (HR < 60)`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Start CPR if HR < 60 with poor perfusion despite oxygenation and ventilation.`})]}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{name:`Epinephrine`,dose:e.label,route:`IV / IO`,notes:`First-line. Q3-5 min.`}),(0,l.jsx)(d,{name:`Atropine`,dose:`${t.label} (min 0.1 mg)`,route:`IV / IO`,notes:`If ↑ vagal tone or AV block. Max 1 mg child / 0.5 mg infant.`}),(0,l.jsx)(d,{name:`Transcutaneous pacing`,dose:``,route:`Pad`,notes:`For refractory bradycardia not responsive to drugs.`}),(0,l.jsx)(d,{name:`Consider`,dose:``,route:``,notes:`Hypoxia, tension pneumothorax, ↑ICP, toxic ingestion (organo, CCB, BB), heart block`})]})]})}function g(){if(!a)return null;let e=o(.1,6,`mg`),t=o(.2,12,`mg`);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-blue-800 dark:text-blue-200`,children:`SVT — narrow complex, rate usually >220 infant / >180 child`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Differentiate from sinus tach: abrupt onset/offset, no P waves or abnormal P axis, HR minimally variable.`})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold`,children:`If STABLE`}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{name:`Vagal maneuvers`,dose:`Ice to face, blow into syringe, Valsalva`,route:``,notes:`Try first in stable patient`}),(0,l.jsx)(d,{name:`Adenosine (1st)`,dose:e.label,route:`IV push (proximal) + flush`,notes:`Rapid push, 3-way stopcock with NS flush`}),(0,l.jsx)(d,{name:`Adenosine (2nd)`,dose:t.label,route:`IV push + flush`,notes:`If first dose unsuccessful`}),(0,l.jsx)(d,{name:`Procainamide`,dose:`15 mg/kg over 30-60 min`,route:`IV`,notes:`Expert consult. Avoid with amiodarone.`}),(0,l.jsx)(d,{name:`Amiodarone`,dose:`5 mg/kg over 20-60 min`,route:`IV`,notes:`Expert consult.`})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold`,children:`If UNSTABLE`}),(0,l.jsx)(f,{children:(0,l.jsx)(d,{name:`Synchronized cardioversion`,dose:`0.5-1 J/kg → 2 J/kg`,route:`Pad`,notes:`Sedate if possible. Pre-treat with adenosine if IV available.`})})]})}function _(){if(!a)return null;let e=o(.01,1,`mg`),t=o(5,300,`mg`),n=o(1,100,`mg`),r=o(50,2e3,`mg`);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-destructive bg-red-50 dark:bg-red-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-destructive`,children:`VF / Pulseless VT`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`High-quality CPR + defibrillation are key. Minimize interruptions.`})]}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{name:`Defibrillation (1st)`,dose:`2 J/kg`,route:`Pad`,notes:`Resume CPR immediately after shock.`}),(0,l.jsx)(d,{name:`Defibrillation (2nd)`,dose:`4 J/kg`,route:`Pad`,notes:`After 2 min CPR.`}),(0,l.jsx)(d,{name:`Defibrillation (3rd+)`,dose:`≥4 J/kg (max 10 J/kg or adult dose)`,route:`Pad`,notes:``}),(0,l.jsx)(d,{name:`Epinephrine`,dose:e.label,route:`IV / IO`,notes:`After 2nd shock. Q3-5 min.`}),(0,l.jsx)(d,{name:`Amiodarone`,dose:t.label,route:`IV / IO bolus`,notes:`Refractory VF/VT. Max 15 mg/kg/day.`}),(0,l.jsx)(d,{name:`Lidocaine`,dose:n.label,route:`IV / IO`,notes:`Alternative to amiodarone. Then 20-50 mcg/kg/min gtt.`}),(0,l.jsx)(d,{name:`Mg sulfate`,dose:r.label,route:`IV over 1-2 min`,notes:`For torsades or hypoMg.`})]})]})}function v(){if(!a)return null;let e=o(5,300,`mg`);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-amber-500 bg-amber-50 dark:bg-amber-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-amber-800 dark:text-amber-200`,children:`Stable monomorphic VT`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Expert consult. Avoid combining QT-prolonging agents.`})]}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{name:`Amiodarone`,dose:`5 mg/kg over 20-60 min = ${e.value} mg over 20-60 min`,route:`IV`,notes:``}),(0,l.jsx)(d,{name:`Procainamide`,dose:`15 mg/kg over 30-60 min`,route:`IV`,notes:`Do not combine with amiodarone`}),(0,l.jsx)(d,{name:`Sync cardioversion`,dose:`0.5-1 → 2 J/kg`,route:`Pad`,notes:`If becomes unstable. Sedate.`})]})]})}return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-cardiac`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Cardiac Arrest / PALS`}),(0,l.jsx)(A,{id:`cardiac-wt`,value:e,onChange:t,testid:`cardiac-weight`}),(0,l.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:u.map(e=>(0,l.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:`px-3 py-1.5 rounded-full text-xs font-medium border `+(n===e.id?`bg-primary text-primary-foreground border-primary`:`bg-muted hover:bg-muted/80 border-border`),"data-testid":`cardiac-view-`+e.id,children:e.label},e.id))}),a?(0,l.jsxs)(`div`,{className:`space-y-3`,children:[(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-destructive bg-red-50 dark:bg-red-950/30 p-3 text-sm font-semibold text-destructive`,children:[u.find(e=>e.id===n)?.label,``,i,` kg`]}),n===`general`&&(0,l.jsx)(p,{}),n===`asystole`&&(0,l.jsx)(m,{}),n===`brady`&&(0,l.jsx)(h,{}),n===`svt`&&(0,l.jsx)(g,{}),n===`vfib`&&(0,l.jsx)(_,{}),n===`vt`&&(0,l.jsx)(v,{}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Concentrations:`}),` Epi 1:10,000 (0.1 mg/mL) for IV arrest. 1:1000 (1 mg/mL) for IM anaphylaxis. Atropine <0.1 mg can cause paradoxical bradycardia.`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AHA PALS Guidelines 2020 · Always verify against institutional protocols.`})]}):(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}var F={lorazepam:{perKg:.1,max:4,unit:`mg`,route:`IV / IO`,note:`Slow push over 1-2 min.`,suffix:` (IV preferred)`},midazolam:{perKg:.2,max:10,unit:`mg`,route:`IM / IN / buccal`,note:`Use 5 mg/mL concentrate for IN; split between nares.`},diazepam:{perKg:.5,max:20,unit:`mg`,route:`PR`,note:`Only if no IV/IM/IN access.`},levetiracetam:{perKg:60,max:4500,unit:`mg`,route:`IV over 5-15 min`,note:`Best tolerability. No ECG monitoring needed.`,suffix:` (preferred)`},fosphenytoin:{perKg:20,max:1500,unit:`mg PE`,route:`IV over 10 min`,note:`Max rate 3 mg PE/kg/min. Monitor ECG, BP. Avoid if cardiac dysrhythmia.`},valproate:{perKg:40,max:3e3,unit:`mg`,route:`IV over 10 min`,note:`Avoid <2 yr, hepatic / mitochondrial disease, pregnancy.`},phenobarb:{perKg:20,max:1e3,unit:`mg`,route:`IV over 20 min`,note:`Last-choice 2nd line. High risk of resp depression + hypotension.`},midazGttBolus:{perKg:.2,max:10,unit:`mg`},midazGttLow:{perKg:.05,max:2,unit:`mg/hr`},midazGttHigh:{perKg:.5,max:18,unit:`mg/hr`},pentobarbBolus:{perKg:5,max:200,unit:`mg`},pentobarbGttLow:{perKg:1,max:null,unit:`mg/hr`},pentobarbGttHigh:{perKg:5,max:null,unit:`mg/hr`},propofolBolus:{perKg:2,max:100,unit:`mg`},propofolGttLow:{perKg:2,max:null,unit:`mg/hr`},propofolGttHigh:{perKg:5,max:null,unit:`mg/hr`},ketamineBolus:{perKg:2,max:100,unit:`mg`},ketamineGttLow:{perKg:1,max:null,unit:`mg/hr`},ketamineGttHigh:{perKg:5,max:null,unit:`mg/hr`}};function I(){let[e,t]=(0,c.useState)(``),n=Number.parseFloat(e),r=Number.isFinite(n)&&n>0,i=(e,t,i=`mg`)=>r?s(n,e,t,i):null,a=r?Math.round(n*2*10)/10:0,o=r?Math.round(n*5*10)/10:0;function u({time:e,color:t,title:n,children:r,last:i=!1}){return(0,l.jsxs)(`div`,{className:`flex gap-3`,children:[(0,l.jsxs)(`div`,{className:`flex flex-col items-center flex-shrink-0`,children:[(0,l.jsx)(`div`,{className:`w-16 py-1.5 rounded-full text-white text-xs font-bold text-center ${t}`,children:e}),!i&&(0,l.jsx)(`div`,{className:`w-0.5 flex-1 bg-border mt-1`})]}),(0,l.jsxs)(`div`,{className:`flex-1 rounded-r-md border-l-4 p-3 bg-muted/30`,style:{borderLeftColor:`currentColor`},children:[(0,l.jsx)(`div`,{className:`text-xs font-bold uppercase tracking-wide mb-2`,children:n}),(0,l.jsx)(`div`,{className:`text-sm space-y-2`,children:r})]})]})}function d({name:e,f:t,route:n,notes:r,suffix:i}){return(0,l.jsxs)(`tr`,{children:[(0,l.jsxs)(`td`,{className:k+` font-semibold`,children:[e,i&&(0,l.jsx)(`span`,{className:`text-xs text-green-700 ml-1`,children:i})]}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:t.label})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:n}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:r}})]})}return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-seizure`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Seizures — Status Epilepticus Pathway`}),(0,l.jsx)(A,{id:`seizure-wt`,value:e,onChange:t,testid:`seizure-weight`}),r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-destructive bg-red-50 dark:bg-red-950/30 p-3`,children:[(0,l.jsxs)(`div`,{className:`font-bold text-destructive text-sm`,children:[`Status Epilepticus Pathway — `,n,` kg`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Time = 0 at seizure onset. Do not pause between steps for benzo to take effect — act on the clock.`})]}),(0,l.jsxs)(`div`,{className:`space-y-0`,children:[(0,l.jsxs)(u,{time:`0 min`,color:`bg-blue-500 text-white`,title:`Stabilize`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`ABCs`}),` — position, 100% O₂ via NC / NRB, suction. `,(0,l.jsx)(`strong`,{children:`IV or IO`}),` × 2. Continuous SpO₂, ECG, BP.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`POC glucose`}),` — if <60 mg/dL: `,(0,l.jsxs)(`strong`,{children:[`D10W `,a,`-`,o,` mL IV`]}),` (2-5 mL/kg).`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Labs`}),`: CBC, CMP, Mg, Ca, Phos, VBG, lactate, AED levels, toxicology if unclear etiology.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Consider pyridoxine`}),` 100 mg IV in infants <18 mo or INH ingestion. Temperature: treat hyperthermia aggressively.`]})]}),(0,l.jsx)(u,{time:`5 min`,color:`bg-purple-500 text-white`,title:`1st benzodiazepine (give once, pick by access)`,children:(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsxs)(`tbody`,{children:[(0,l.jsx)(d,{name:`Lorazepam`,f:i(F.lorazepam.perKg,F.lorazepam.max),route:`IV / IO`,notes:`Slow push over 1-2 min.`,suffix:` (IV preferred)`}),(0,l.jsx)(d,{name:`Midazolam`,f:i(F.midazolam.perKg,F.midazolam.max),route:`IM / IN / buccal`,notes:`Use 5 mg/mL concentrate for IN; split between nares.`}),(0,l.jsx)(d,{name:`Diazepam`,f:i(F.diazepam.perKg,F.diazepam.max),route:`PR`,notes:`Only if no IV/IM/IN access.`})]})]})})}),(0,l.jsxs)(u,{time:`10 min`,color:`bg-violet-500 text-white`,title:`2nd benzodiazepine — if still seizing`,children:[`Repeat same agent + dose `,(0,l.jsx)(`strong`,{children:`once`}),`. Prepare 2nd-line now (don't wait to see if benzo works). If apnea/airway compromise: BVM, consider advanced airway.`]}),(0,l.jsx)(u,{time:`20 min`,color:`bg-amber-500 text-white`,title:`2nd-line anti-epileptic — pick one (ESETT: equivalent efficacy)`,children:(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsxs)(`tbody`,{children:[(0,l.jsx)(d,{name:`Levetiracetam`,f:i(F.levetiracetam.perKg,F.levetiracetam.max),route:`IV over 5-15 min`,notes:`Best tolerability. No ECG monitoring needed.`,suffix:` (preferred)`}),(0,l.jsx)(d,{name:`Fosphenytoin`,f:i(F.fosphenytoin.perKg,F.fosphenytoin.max,`mg PE`),route:`IV over 10 min`,notes:`Max rate 3 mg PE/kg/min. Monitor ECG, BP. Avoid if cardiac dysrhythmia.`}),(0,l.jsx)(d,{name:`Valproic acid`,f:i(F.valproate.perKg,F.valproate.max),route:`IV over 10 min`,notes:`<strong>Avoid <2 yr, hepatic / mitochondrial disease, pregnancy.</strong>`}),(0,l.jsx)(d,{name:`Phenobarbital`,f:i(F.phenobarb.perKg,F.phenobarb.max),route:`IV over 20 min`,notes:`Last-choice 2nd line. High risk of resp depression + hypotension.`})]})]})})}),(0,l.jsxs)(u,{time:`30 min`,color:`bg-red-500 text-white`,title:`Still seizing? Consider 2nd agent from 2nd-line OR proceed to refractory`,children:[`If the first 2nd-line drug failed, give a different 2nd-line agent `,(0,l.jsx)(`strong`,{children:`OR`}),` move directly to refractory therapy. Activate ICU, prepare for intubation. Confirm etiology not reversible (electrolytes, glucose, fever, toxin).`]}),(0,l.jsxs)(u,{time:`40 min`,color:`bg-destructive text-white`,title:`Refractory status — intubate + continuous infusion + continuous EEG`,last:!0,children:[(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsxs)(`tbody`,{children:[(0,l.jsxs)(`tr`,{children:[(0,l.jsxs)(`td`,{className:k+` font-semibold`,children:[`Midazolam `,(0,l.jsx)(`span`,{className:`text-xs text-green-700`,children:`(1st-line infusion)`})]}),(0,l.jsxs)(`td`,{className:k+` text-sm`,children:[`Bolus `,i(F.midazGttBolus.perKg,F.midazGttBolus.max).value,` mg → gtt `,i(F.midazGttLow.perKg,F.midazGttLow.max,`mg/hr`).value,``,i(F.midazGttHigh.perKg,F.midazGttHigh.max,`mg/hr`).value,` mg/hr `,(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`(bolus 0.2 mg/kg, gtt 0.05-0.5 mg/kg/hr)`})]}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`IV`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`Titrate to seizure control / burst suppression.`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Pentobarbital`}),(0,l.jsxs)(`td`,{className:k+` text-sm`,children:[`Bolus `,i(F.pentobarbBolus.perKg,F.pentobarbBolus.max).value,` mg → gtt `,i(F.pentobarbGttLow.perKg,null,`mg/hr`).value,``,i(F.pentobarbGttHigh.perKg,null,`mg/hr`).value,` mg/hr `,(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`(bolus 5 mg/kg, gtt 1-5 mg/kg/hr)`})]}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`IV`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`Causes hypotension — often need pressors.`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Propofol`}),(0,l.jsxs)(`td`,{className:k+` text-sm`,children:[`Bolus `,i(F.propofolBolus.perKg,F.propofolBolus.max).value,` mg → gtt `,i(F.propofolGttLow.perKg,null,`mg/hr`).value,``,i(F.propofolGttHigh.perKg,null,`mg/hr`).value,` mg/hr `,(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`(bolus 2 mg/kg, gtt 2-5 mg/kg/hr)`})]}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`IV`}),(0,l.jsxs)(`td`,{className:k+` text-xs text-muted-foreground`,children:[(0,l.jsx)(`strong`,{children:`PRIS risk in children`}),` — limit to <4 mg/kg/hr and duration <48 h.`]})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Ketamine`}),(0,l.jsxs)(`td`,{className:k+` text-sm`,children:[`Bolus `,i(F.ketamineBolus.perKg,F.ketamineBolus.max).value,` mg → gtt `,i(F.ketamineGttLow.perKg,null,`mg/hr`).value,``,i(F.ketamineGttHigh.perKg,null,`mg/hr`).value,` mg/hr `,(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`(bolus 2 mg/kg, gtt 1-5 mg/kg/hr)`})]}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`IV`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`NMDA antagonist — rescue. Good BP profile; useful if refractory to GABAergics.`})]})]})]})}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-2`,children:[(0,l.jsx)(`strong`,{children:`Continuous EEG within 1 h`}),` — target electrographic seizure suppression × 24-48 h, then wean. Reassess etiology: CNS imaging, LP, expanded workup.`]})]})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100 space-y-1`,children:[(0,l.jsx)(`div`,{className:`font-semibold`,children:`Key points`}),(0,l.jsxs)(`div`,{children:[`• Do `,(0,l.jsx)(`strong`,{children:`NOT`}),` wait for benzo response before starting the 2nd-line — parallel preparation.`]}),(0,l.jsxs)(`div`,{children:[`• Maximum `,(0,l.jsx)(`strong`,{children:`2 benzo doses`}),` total (1 pre-hospital + 1 in ED, or 2 in ED).`]}),(0,l.jsx)(`div`,{children:`• Respiratory depression is common — have BVM, airway equipment, naloxone, flumazenil accessible (but avoid flumazenil here).`}),(0,l.jsx)(`div`,{children:`• ESETT trial: levetiracetam = fosphenytoin = valproate for efficacy. Pick by tolerability / contraindications.`}),(0,l.jsx)(`div`,{children:`• Always reassess: ongoing seizure? Non-convulsive status? Pseudo-seizure? → continuous EEG if any doubt.`})]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Based on AES Guidelines 2016 and ESETT (Kapur et al., NEJM 2019). Verify all doses against institutional protocols.`})]}):(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}function L(){let[e,t]=(0,c.useState)(``),[n,r]=(0,c.useState)(``),i=Number.parseFloat(e),a=Number.parseFloat(n),o=Number.isFinite(i)&&i>0,u=(e,t,n=`mg`)=>o?s(i,e,t,n):null,d=Number.isFinite(a)&&a>=0,f=d?Math.round((a/4+4)*2)/2:null,p=d?Math.round((a/4+3.5)*2)/2:null,m=f?Math.round(f*3*10)/10:null,h=d?a<1?`Miller 0-1`:a<2?`Miller 1 / Mac 1`:a<8?`Miller 2 / Mac 2`:`Miller/Mac 3`:``,g=o?i<5?`1`:i<10?`1.5`:i<20?`2`:i<30?`2.5`:i<50?`3`:i<70?`4`:`5`:``,_=o&&i<10?2:1.5,v=u(6,null,`mL`),y=u(8,null,`mL`);function b({title:e,rows:t}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:e}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:t.map((e,t)=>(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:e[0]}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:e[1]})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:e[2]}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:e[3]})]},t))})]})})]})}return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-airway`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Airway / RSI`}),(0,l.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 max-w-md`,children:[(0,l.jsx)(A,{id:`airway-wt`,value:e,onChange:t,testid:`airway-weight`}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`airway-age`,className:D,children:`Age (years)`}),(0,l.jsx)(`input`,{id:`airway-age`,type:`number`,min:`0`,step:`0.5`,className:E,value:n,onChange:e=>r(e.target.value),"data-testid":`airway-age`})]})]}),o?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold text-blue-900 dark:text-blue-100`,children:[`RSI doses & equipment — `,i,` kg`,d?`, ~${a} yr`:``]}),(0,l.jsx)(b,{title:`Pre-medication (optional)`,rows:[[`Atropine`,`${u(.02,1,`mg`).label} (min 0.1 mg)`,`IV`,`Consider <1 yr or if using succinylcholine, or bradycardia risk`],[`Lidocaine 2%`,u(1.5,100,`mg`).label,`IV over 1 min`,`For ↑ICP, asthma; give 2-3 min pre-induction`],[`Fentanyl`,`${u(2,150,`mcg`).label} (2-3 mcg/kg)`,`IV over 1 min`,`Blunts sympathetic response; avoid if hypotensive`]]}),(0,l.jsx)(b,{title:`Induction`,rows:[[`Ketamine`,`${u(1.5,150,`mg`).label} (1-2 mg/kg)`,`IV`,`Preserves BP. First-line for shock, asthma, sepsis`],[`Etomidate`,u(.3,30,`mg`).label,`IV`,`Hemodynamically neutral. Avoid in septic shock (adrenal suppression)`],[`Propofol`,`${u(2,200,`mg`).label} (1-2 mg/kg)`,`IV`,`Causes hypotension. Avoid in shock`],[`Midazolam`,u(.2,10,`mg`).label,`IV`,`Less optimal induction — slower onset`]]}),(0,l.jsx)(b,{title:`Paralytics`,rows:[[`Rocuronium`,`${u(1.2,100,`mg`).label} (1-1.2 mg/kg)`,`IV`,`30-60 sec onset; 30-45 min duration. First-line non-depolarizing.`],[`Succinylcholine`,u(_,150,`mg`).label,`IV`,`<10kg: 2 mg/kg; ≥10kg: 1.5 mg/kg. Avoid in burns/crush/hyperK/MH/NM dz. IM option: 4 mg/kg.`],[`Vecuronium`,u(.1,10,`mg`).label,`IV`,`2-3 min onset; longer duration than roc`]]}),(0,l.jsx)(b,{title:`Maintenance sedation / analgesia`,rows:[[`Midazolam gtt`,`${u(.05,2,`mg`).label}${u(.2,10,`mg`).label}/hr`,`IV infusion`,`0.05-0.2 mg/kg/hr`],[`Fentanyl gtt`,`${u(1,100,`mcg`).label}${u(4,200,`mcg`).label}/hr`,`IV infusion`,`1-4 mcg/kg/hr`],[`Ketamine gtt`,`${u(.5,30,`mg`).label}${u(2,100,`mg`).label}/hr`,`IV infusion`,`0.5-2 mg/kg/hr. Good for asthma`],[`Dexmedetomidine gtt`,`0.2-1.4 mcg/kg/hr`,`IV infusion`,`No resp depression; causes bradycardia + hypotension`],[`Rocuronium gtt`,`10-12 mcg/kg/min`,`IV infusion`,`If continued paralysis needed — only with adequate sedation`]]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Equipment sizing`}),(0,l.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3 text-xs`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:d?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`ETT (uncuffed):`}),` `,f,` mm`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`ETT (cuffed):`}),` `,p,` mm`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Depth at lip:`}),` ~`,m,` cm`]})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{children:(0,l.jsx)(`em`,{children:`Enter age for ETT / blade sizing.`})}),(0,l.jsx)(`div`,{children:`ETT (uncuffed) = (age/4) + 4`}),(0,l.jsx)(`div`,{children:`ETT (cuffed) = (age/4) + 3.5`}),(0,l.jsx)(`div`,{children:`Depth = ETT size × 3`})]})}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Laryngoscope blade:`}),` `,h]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`LMA size:`}),` `,g]}),(0,l.jsx)(`div`,{children:`OPA = corner mouth → angle mandible`}),(0,l.jsx)(`div`,{children:`NPA = tip nose → tragus`})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 md:col-span-2`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Suction catheter (Fr):`}),` ETT size × 2`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`NG tube:`}),` ETT × 2`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Chest tube:`}),` 4 × ETT`]})]})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Ventilator — starting settings`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-xs space-y-1`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Mode:`}),` Volume or pressure control`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Tidal volume:`}),` 6-8 mL/kg (= `,v.value,`-`,y.value,` mL). Use lower (4-6 mL/kg) for ARDS.`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`Rate:`}),` Infant 25-30, Child 15-25, Adolescent 12-16`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`PEEP:`}),` 5 cmH₂O (↑ for oxygenation problems)`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`FiO₂:`}),` Start 100%, wean to SpO₂ 92-97%`]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`strong`,{children:`I:E ratio:`}),` 1:2 (1:3-4 for obstructive disease)`]})]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Harriet Lane Handbook 23rd ed · PALS 2020. Always confirm doses against institutional protocols.`})]}):(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}function R(){let[e,t]=(0,c.useState)(``),n=Number.parseFloat(e),r=Number.isFinite(n)&&n>0;function i(e,t,n,r){return(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:e}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:t})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:n}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:r}})]})}let a=r?[i(`Lorazepam`,s(n,.05,2).label,`PO`,`0.05 mg/kg. May repeat in 30 min.`),i(`Midazolam`,s(n,.5,10).label,`PO`,`0.5 mg/kg (max 10 mg)`),i(`Midazolam`,s(n,.3,10).label,`IN (5 mg/mL)`,`0.3 mg/kg split between nares (max 10 mg)`),i(`Olanzapine (ODT)`,n<30?`2.5-5 mg`:`5-10 mg`,`PO / ODT`,`Age ≥6 yr. Avoid IM + benzo combo (risk of resp depression).`),i(`Diphenhydramine`,s(n,1,50).label,`PO`,`1 mg/kg. Adjunct only; sedating.`)]:null,o=r?[i(`Midazolam`,s(n,.1,5).label,`IV / IM`,`0.05-0.1 mg/kg IV, 0.1-0.15 mg/kg IM (max 10 mg)`),i(`Lorazepam`,s(n,.1,4).label,`IV / IM`,`0.05-0.1 mg/kg (max 4 mg). May cause resp depression.`),i(`Haloperidol`,n<40?`0.025-0.075 mg/kg = ${Math.round(n*.05*100)/100} mg`:`2.5-5 mg`,`IM / IV`,`Avoid &lt;3 yr. Risk: QT, EPS, NMS. ECG if repeated.`),i(`Olanzapine`,n<40?`2.5-5 mg`:`5-10 mg`,`IM`,`Avoid benzo co-administration (resp depression, hypotension)`),i(`Ketamine`,s(n,4,500).label,`IM`,`4-5 mg/kg IM (rescue for severe excited delirium). Monitor airway.`),i(`Droperidol`,`0.03-0.07 mg/kg = ${Math.round(n*.05*100)/100} mg`,`IM / IV`,`Effective but QT concern — get ECG.`)]:null;return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-agitation`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Agitation`}),(0,l.jsx)(A,{id:`agit-wt`,value:e,onChange:t,testid:`agit-weight`}),r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-purple-500 bg-purple-50 dark:bg-purple-950/30 p-3 text-sm font-semibold text-purple-900 dark:text-purple-100`,children:[`Agitation management — `,n,` kg`]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-green-500 bg-green-50 dark:bg-green-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-green-800 dark:text-green-200`,children:`Step 1 — Non-pharmacologic`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Dim lights, quiet room, familiar caregiver present, reduce stimulation. Rule out hypoglycemia, hypoxia, pain, ↑ICP, toxic ingestion, infection.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-blue-800 dark:text-blue-200`,children:`Step 2 — Oral / intranasal (cooperative)`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`First-line for moderate agitation if the patient will accept PO/IN.`})]}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:a})]})}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-amber-500 bg-amber-50 dark:bg-amber-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-amber-800 dark:text-amber-200`,children:`Step 3 — IM / IV (severe, uncooperative, or safety risk)`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Require continuous monitoring. Consider restraints only as last resort.`})]}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:o})]})}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Monitoring:`}),` Continuous SpO₂ + HR after parenteral sedation. Have airway equipment, flumazenil, naloxone, and IV access ready.`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AAP Clinical Report on Pediatric Agitation · ACEP Guidelines for Acute Agitation.`})]}):(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}function z(){let[e,t]=(0,c.useState)(``),n=Number.parseFloat(e),r=Number.isFinite(n)&&n>0,i=(e,t,i=`mg`)=>r?s(n,e,t,i):null,a=r?n<15?`2 mg`:n<30?`4 mg`:`8 mg`:null;return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-antiemetics`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Antiemetics`}),(0,l.jsx)(A,{id:`emet-wt`,value:e,onChange:t,testid:`emet-weight`}),r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold text-blue-900 dark:text-blue-100`,children:[`Antiemetic doses — `,n,` kg`]}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsxs)(`tbody`,{children:[(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Ondansetron`}),(0,l.jsxs)(`td`,{className:k+` text-xs`,children:[a,` (weight band) OR `,(0,l.jsx)(j,{label:i(.15,8).label})]}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`PO / ODT / IV`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`First-line. Max single 8 mg. Repeat q8h. QT prolongation — avoid with other QT drugs. <6 mo: limited data.`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Metoclopramide`}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:i(.15,10).label})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`IV / IM / PO`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`0.1-0.15 mg/kg (max 10 mg). Give with diphenhydramine to prevent EPS / dystonia.`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Dimenhydrinate`}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:i(1.25,50).label})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`PO / IV / IM / PR`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`1.25 mg/kg (max 50 mg) q6h. ≥2 yr.`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Diphenhydramine`}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:i(1,50).label})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`PO / IV / IM`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`1 mg/kg (max 50 mg) q6h. Adjunct, sedating.`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Promethazine`}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:i(.25,25).label})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`PO / IV / IM`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:`0.25-1 mg/kg. <strong>CONTRAINDICATED &lt;2 yr</strong> (resp depression). Tissue injury if IV extrav.`}})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Dexamethasone`}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:i(.15,10).label})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`IV / PO`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`Adjunct, esp. chemo-induced. 0.15 mg/kg (max 10 mg).`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Scopolamine patch`}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`1.5 mg patch`}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`Transdermal`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`≥12 yr. Motion sickness. Apply 4h before exposure.`})]})]})]})}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Pearls:`}),` Ondansetron is first-line in ED for acute gastroenteritis vomiting — single PO/ODT dose increases oral rehydration success. Avoid anticholinergics + opioid combinations. Check QTc if stacking ondansetron + other QT drugs.`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AAP gastroenteritis guidance · WHO essential medicines · Lexicomp.`})]}):(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}var B={neonate:{sepsis:{first:`Ampicillin + gentamicin`,alt:`Add cefotaxime if meningitis suspected or gram-neg concern`,duration:`7-10 days; 21 days if confirmed meningitis`,notes:`Cover GBS, E. coli, Listeria. Add acyclovir if HSV risk (maternal lesions, vesicles, seizures).`},meningitis:{first:`Ampicillin + cefotaxime (or gentamicin) + acyclovir`,alt:`Add vancomycin if gram-positive cocci`,duration:`14-21 days depending on organism`,notes:`HSV coverage essential. LP + HSV PCR.`},pna:{first:`Ampicillin + gentamicin`,alt:`Add cefotaxime for gram-neg`,duration:`7-10 days`,notes:`Same as sepsis coverage.`},uti:{first:`Ampicillin + gentamicin`,alt:`Cefotaxime if sensitivities known`,duration:`10-14 days`,notes:`Evaluate for sepsis. Renal US and VCUG workup.`},skin:{first:`Ampicillin + gentamicin`,alt:`Add vancomycin if MRSA risk`,duration:`7-10 days`,notes:`Omphalitis, mastitis — broad coverage.`},ent:{first:`Discuss with infectious diseases`,alt:``,duration:``,notes:`Rare in neonates. Any ear/throat infection warrants sepsis eval.`},neutropenic:{first:`Cefepime or piperacillin-tazobactam`,alt:`Add vancomycin if indwelling line, severe mucositis, or MRSA`,duration:`Until ANC recovery + afebrile ≥48h`,notes:`Oncology/ID consult.`},ic:{first:`Ampicillin + gentamicin + metronidazole`,alt:`Or piperacillin-tazobactam`,duration:`7-14 days`,notes:`NEC: add metronidazole/clindamycin for anaerobes.`},bone:{first:`Ampicillin + gentamicin`,alt:`Vancomycin if MRSA risk`,duration:`3-6 weeks (IV then PO)`,notes:`Usually hematogenous. S. aureus, GBS, E. coli.`}},infant:{sepsis:{first:`Ampicillin + ceftriaxone (or gentamicin)`,alt:`+ vancomycin if MRSA / severe`,duration:`7-10 days`,notes:`Add acyclovir if HSV suspected (<6 wks). Fever in <90 days requires workup.`},meningitis:{first:`Ceftriaxone + vancomycin (± ampicillin if <6 wks for Listeria)`,alt:`+ acyclovir if HSV`,duration:`10-14 days (longer for Listeria/gram-neg)`,notes:`Dexamethasone if H. influenzae suspected.`},pna:{first:`Ampicillin (or ceftriaxone)`,alt:`Add azithromycin if atypical`,duration:`7-10 days`,notes:`S. pneumoniae most common. RSV/viral often primary.`},uti:{first:`Ceftriaxone or cefotaxime`,alt:`Ampicillin + gentamicin`,duration:`10-14 days`,notes:`US kidney/bladder if first febrile UTI.`},skin:{first:`Cefazolin or clindamycin`,alt:`Vancomycin if MRSA risk`,duration:`7-10 days`,notes:`Consider MRSA if purulent or local resistance >10%.`},ent:{first:`Amoxicillin (90 mg/kg/day) for AOM`,alt:`Amox-clav if recent abx/treatment failure`,duration:`AOM 10 days <2 yr; 7 days ≥2 yr`,notes:`Observe mild AOM if >6 mo and no severe features.`},neutropenic:{first:`Cefepime or piperacillin-tazobactam`,alt:`+ vancomycin for severe/mucositis/line`,duration:`Until ANC recovery + afebrile`,notes:`Oncology/ID consult.`},ic:{first:`Ceftriaxone + metronidazole`,alt:`Piperacillin-tazobactam`,duration:`5-7 days (uncomplicated), longer for complicated`,notes:`Appendicitis — surgical consult.`},bone:{first:`Cefazolin ± vancomycin`,alt:`Clindamycin`,duration:`3-4 weeks (IV then PO transition)`,notes:`S. aureus most common. Kingella in <4 yr.`}},child:{sepsis:{first:`Ceftriaxone + vancomycin`,alt:`Piperacillin-tazobactam if intra-abdominal`,duration:`7-14 days`,notes:`Expand if specific source. Add antifungal if prolonged neutropenia.`},meningitis:{first:`Ceftriaxone + vancomycin`,alt:`+ dexamethasone (Hib coverage)`,duration:`10-14 days`,notes:`Lumbar puncture. Dexamethasone 0.15 mg/kg q6h x 4 days.`},pna:{first:`Ampicillin OR amoxicillin (high dose)`,alt:`Ceftriaxone if hospitalized; add azithromycin for atypical`,duration:`5-7 days (uncomplicated)`,notes:`Mycoplasma if >5 yr. Consider viral causes.`},uti:{first:`Cephalexin or TMP-SMX (PO)`,alt:`Ceftriaxone if ill`,duration:`7-10 days (10-14 if pyelo)`,notes:`Culture-guided de-escalation.`},skin:{first:`Cephalexin or clindamycin`,alt:`TMP-SMX or doxycycline if MRSA`,duration:`5-10 days`,notes:`Abscess — incision & drainage primary tx.`},ent:{first:`Amoxicillin 90 mg/kg/day (AOM); Penicillin V for strep pharyngitis`,alt:`Amox-clav; cephalexin if non-anaphylactic PCN allergy`,duration:`AOM 5-10 days; strep 10 days`,notes:`Strep pharyngitis dose: PCN V 250 mg BID-TID (<27 kg) or 500 mg BID (≥27 kg).`},neutropenic:{first:`Cefepime OR piperacillin-tazobactam`,alt:`+ vancomycin`,duration:`Until ANC recovery + afebrile`,notes:`Add empiric antifungal if fever >4-7 days.`},ic:{first:`Ceftriaxone + metronidazole`,alt:`Piperacillin-tazobactam`,duration:`5-7 days (uncomplicated appendicitis)`,notes:`Surgical consult.`},bone:{first:`Cefazolin ± vancomycin`,alt:`Clindamycin`,duration:`3-4 weeks total`,notes:`S. aureus, group A strep. Consider MRSA if severe.`}}},V={neonate:`Neonate (0-28 d)`,infant:`Infant (1-3 mo)`,child:`Child (>3 mo)`},H=[[`sepsis`,`Sepsis / bacteremia`],[`meningitis`,`Meningitis`],[`pna`,`Pneumonia`],[`uti`,`Urinary tract infection`],[`skin`,`Skin / soft tissue`],[`ent`,`Ear / throat (ENT)`],[`neutropenic`,`Febrile neutropenia`],[`ic`,`Intra-abdominal`],[`bone`,`Bone / joint`]];function U(){let[e,t]=(0,c.useState)(`child`),[n,r]=(0,c.useState)(`sepsis`),i=B[e][n];return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-antimicrobials`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Antimicrobials (empirical)`}),(0,l.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 max-w-xl`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`abx-age`,className:D,children:`Age band`}),(0,l.jsx)(`select`,{id:`abx-age`,className:E,value:e,onChange:e=>t(e.target.value),"data-testid":`abx-age`,children:Object.entries(V).map(([e,t])=>(0,l.jsx)(`option`,{value:e,children:t},e))})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`abx-infection`,className:D,children:`Infection`}),(0,l.jsx)(`select`,{id:`abx-infection`,className:E,value:n,onChange:e=>r(e.target.value),"data-testid":`abx-infection`,children:H.map(([e,t])=>(0,l.jsx)(`option`,{value:e,children:t},e))})]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold text-blue-900 dark:text-blue-100`,children:[V[e],``,H.find(([e])=>e===n)?.[1]]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-green-50 dark:bg-green-950/30 p-3 text-sm`,children:[(0,l.jsx)(`strong`,{className:`text-green-800 dark:text-green-200`,children:`First-line:`}),` `,i.first]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-sm`,children:[(0,l.jsx)(`strong`,{children:`Alternative / add:`}),` `,i.alt]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-sm`,children:[(0,l.jsx)(`strong`,{children:`Duration:`}),` `,i.duration]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Notes:`}),` `,i.notes]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AAP Red Book · IDSA guidelines · Harriet Lane. Always tailor to local resistance patterns and culture results.`})]})}function W(){let[e,t]=(0,c.useState)(``),n=Number.parseFloat(e),r=Number.isFinite(n)&&n>0,i=r?Math.round(n*20):null;return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-trauma`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Trauma — primary survey + MTP`}),(0,l.jsx)(A,{id:`trauma-wt`,value:e,onChange:t,testid:`trauma-weight`}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-2`,children:`Primary Survey — ABCDE`}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-destructive bg-red-50 dark:bg-red-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-destructive`,children:`A — Airway + c-spine`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[`Maintain airway (jaw thrust, suction). `,(0,l.jsx)(`strong`,{children:`Manual inline stabilization`}),`; apply collar. Intubate if GCS ≤8, inadequate airway, or impending compromise. Avoid succinylcholine if burn/crush/prolonged immobilization.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-amber-500 bg-amber-50 dark:bg-amber-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-amber-800 dark:text-amber-200`,children:`B — Breathing`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`SpO₂, bilateral breath sounds, chest wall integrity. Identify tension PTX (needle decompression), open PTX (3-sided dressing), flail chest, massive hemothorax.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-green-500 bg-green-50 dark:bg-green-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-green-800 dark:text-green-200`,children:`C — Circulation`}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[`Two large-bore IVs / IO. Control hemorrhage (direct pressure, tourniquet, pelvic binder).`,` `,r?(0,l.jsxs)(l.Fragment,{children:[`NS or LR 20 mL/kg = `,(0,l.jsxs)(`strong`,{children:[i,` mL`]}),` bolus.`]}):(0,l.jsx)(l.Fragment,{children:`NS/LR 20 mL/kg bolus.`}),` `,`Consider blood after 40-60 mL/kg crystalloid or in Class III shock.`]})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-blue-500 bg-blue-50 dark:bg-blue-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-blue-800 dark:text-blue-200`,children:`D — Disability`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`GCS, pupils, glucose, gross motor. Consider ↑ICP (head up 30°, mannitol 0.5-1 g/kg or hypertonic saline 3% 3-5 mL/kg).`})]}),(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 border-violet-500 bg-violet-50 dark:bg-violet-950/30 p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-violet-800 dark:text-violet-200`,children:`E — Exposure + environment`}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`Fully expose; prevent hypothermia (warm blankets, fluids).`})]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Massive Transfusion Protocol (MTP)`}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsxs)(`tbody`,{children:[(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Ratio`}),(0,l.jsx)(`td`,{className:k,children:`1:1:1 (pRBC : FFP : platelets)`}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:``}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`Activate early if ≥40 mL/kg transfused or ongoing hemorrhage. Avoid excessive crystalloid.`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Tranexamic acid (TXA)`}),(0,l.jsx)(`td`,{className:k,children:`15 mg/kg IV (max 1 g) over 10 min → 2 mg/kg/hr × 8h`}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`IV`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`Within 3 hr of injury. CRASH-2 / MATIC.`})]}),(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:`Calcium`}),(0,l.jsx)(`td`,{className:k,children:`20 mg/kg CaCl or 60 mg/kg Ca-gluconate IV per unit citrated blood`}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:`IV`}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:`Citrated blood chelates calcium.`})]})]})]})}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`C-spine clearance (NEXUS / CCR)`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs`,children:[`Pediatric c-spine decision tools are imperfect. `,(0,l.jsx)(`strong`,{children:`Imaging if any:`}),` focal neurologic deficit, altered mental status, neck pain / tenderness, torticollis, substantial torso injury, high-risk mechanism (diving, MVC >55 mph, fall >10 ft). Plain films + CT if positive or equivocal.`]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Pediatric shock — signs`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-red-50 dark:bg-red-950/30 p-3 text-xs text-red-900 dark:text-red-200`,children:[`Children compensate well — `,(0,l.jsx)(`strong`,{children:`hypotension is a late finding`}),`. Early signs: tachycardia, cool extremities, weak peripheral pulses, prolonged cap refill (>3 sec), narrowed pulse pressure, altered mentation. Minimum SBP = 70 + (2 × age in years) for ages 1-10.`]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold mt-3`,children:`Secondary survey — AMPLE + head-to-toe`}),(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs`,children:[(0,l.jsx)(`strong`,{children:`AMPLE:`}),` Allergies, Medications, Past history, Last meal, Events of injury. Head-to-toe exam; log-roll for back; digital rectal; neurovascular checks of all extremities.`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`ATLS 10th ed · PALS 2020 · PECARN c-spine rule · CRASH-2 trial (TXA).`})]})}var G=[{name:`Ketamine IV`,display:`Ketamine`,perKgLow:1.5,perKgHigh:2,maxLow:100,maxHigh:150,unit:`mg`,route:`IV`,onset:`1 min`,duration:`15-30 min`,notes:`Dissociative. Preserves airway reflexes.`},{name:`Ketamine IM`,display:null,perKgLow:4,perKgHigh:5,maxLow:300,maxHigh:400,unit:`mg`,route:`IM`,onset:`3-5 min`,duration:`30-60 min`,notes:`Give atropine 0.01 mg/kg to reduce secretions.`},{name:`Midazolam IV`,display:`Midazolam`,perKgLow:.05,perKgHigh:.1,maxLow:2,maxHigh:5,unit:`mg`,route:`IV`,onset:`2-3 min`,duration:`30-60 min`,notes:`Anxiolysis. Titrate q3-5 min.`},{name:`Midazolam IN/PO`,display:null,perKg:.5,max:20,unit:`mg`,route:`IN/PO`,onset:`10-15 min`,duration:`30-60 min`,notes:`IN (max 10 mg / naris) or PO (max 20 mg).`},{name:`Propofol`,display:`Propofol`,perKg:1,max:40,unit:`mg`,route:`IV`,onset:`30 sec`,duration:`5-10 min`,notes:`Short procedures. Causes apnea — manage airway.`},{name:`Fentanyl IV`,display:`Fentanyl`,perKg:1,max:100,unit:`mcg`,route:`IV`,onset:`2-3 min`,duration:`30-60 min`,notes:`Analgesic. Often combined with midazolam.`},{name:`Fentanyl IN`,display:null,perKg:2,max:100,unit:`mcg`,route:`IN`,onset:`5-10 min`,duration:`30-60 min`,notes:`Intranasal.`},{name:`Nitrous oxide`,display:`Nitrous oxide`,doseDisplay:`50:50 or 70:30 mix`,unit:`mix`,route:`Inhaled`,onset:`2-5 min`,duration:`5 min off`,notes:`Self-administered via demand valve. Anxiolysis + mild analgesia.`},{name:`Dexmedetomidine IN`,display:`Dexmedetomidine`,perKgLow:2,perKgHigh:3,maxLow:100,maxHigh:null,unit:`mcg`,route:`IN`,onset:`15-30 min`,duration:`60-90 min`,notes:`Intranasal. No respiratory depression. Good for imaging.`},{name:`Naloxone`,display:`Naloxone`,perKg:.1,max:2,unit:`mg`,route:`IV/IM/IN`,reverses:`Opioids (fentanyl, morphine)`,notes:`Max 2 mg. Repeat q2-3 min. Duration shorter than opioids — monitor for re-sedation.`},{name:`Flumazenil`,display:`Flumazenil`,perKg:.01,max:.2,unit:`mg`,route:`IV`,reverses:`Benzodiazepines (midazolam)`,notes:`Max 0.2 mg single dose. Repeat q1 min to max 1 mg total. Risk of seizures — use cautiously.`}];function K(e,t){if(t.doseDisplay)return t.doseDisplay;let n=t.unit===`mcg`?` mcg`:t.unit===`mix`?``:` mg`,r=t.unit===`mcg`?`mcg`:`mg`;if(t.perKgLow!=null){let i=s(e,t.perKgLow,t.maxLow??null).value;return t.perKgHigh==null?`${i}${n} (${t.perKgLow} ${r}/kg)`:`${i}-${s(e,t.perKgHigh,t.maxHigh??null).value}${n} (${t.perKgLow}-${t.perKgHigh} ${r}/kg)`}return t.perKg==null?``:`${s(e,t.perKg,t.max??null).value}${n} (${t.perKg} ${r}/kg)`}function q(){let[e,t]=(0,c.useState)(``),n=Number.parseFloat(e),r=Number.isFinite(n)&&n>0,i=G.filter(e=>!e.reverses),a=G.filter(e=>e.reverses);function o({dg:e}){return(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:e.display??``}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:K(n,e)})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:e.route}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:e.onset??``}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:e.duration??``}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:e.notes})]})}function s({dg:e}){return(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:e.display}),(0,l.jsx)(`td`,{className:k,children:(0,l.jsx)(j,{label:K(n,e)})}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:e.route}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:e.reverses}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,children:e.notes})]})}return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-sedation`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Procedural Sedation`}),(0,l.jsx)(A,{id:`sed-wt`,value:e,onChange:t,testid:`sed-weight`}),r?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-purple-500 bg-purple-50 dark:bg-purple-950/30 p-3 text-sm font-semibold text-purple-900 dark:text-purple-100`,children:[`Procedural Sedation — `,n,` kg patient`]}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Sedation Agents`}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Onset`}),(0,l.jsx)(`th`,{className:O,children:`Duration`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:i.map(e=>(0,l.jsx)(o,{dg:e},e.name))})]})}),(0,l.jsx)(`h3`,{className:`text-sm font-semibold text-destructive`,children:`Reversal Agents`}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{className:`bg-red-50 dark:bg-red-950/30`,children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Reverses`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:a.map(e=>(0,l.jsx)(s,{dg:e},e.name))})]})}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Pre-sedation checklist:`}),` NPO status (2h clear liquids, 6h solids), consent, monitoring equipment (pulse ox, capnography, BP), resuscitation equipment at bedside, suction ready, IV access. Minimum monitoring: continuous SpO₂, HR, capnography. Provider capable of managing airway must be present.`]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`AAP Guidelines for Monitoring and Management of Pediatric Patients Before, During, and After Sedation · ASA Practice Guidelines for Sedation and Analgesia by Non-Anesthesiologists.`})]}):(0,l.jsx)(`p`,{className:`text-xs text-destructive`,children:`Enter weight (kg) to see doses.`})]})}var J=[[`approach`,`General approach (stabilize → toxidrome → decon → antidote)`],[`acetaminophen`,`Acetaminophen overdose`],[`opioids`,`Opioid overdose`],[`iron`,`Iron overdose`],[`tca`,`Tricyclic antidepressant (TCA) overdose`],[`bbccb`,`β-blocker / CCB overdose`],[`benzo`,`Benzodiazepine overdose`],[`organo`,`Organophosphate / carbamate poisoning`],[`salicylate`,`Salicylate overdose`],[`etoh`,`Toxic alcohols (methanol / ethylene glycol)`],[`dialyzable`,`Dialyzable drugs (ISTUMBLE)`]];function Y(){let[e,t]=(0,c.useState)(``),[n,r]=(0,c.useState)(`approach`),i=Number.parseFloat(e),a=Number.isFinite(i)&&i>0,o=(e,t,n=`mg`)=>a?s(i,e,t,n).value:null;function u({color:e,title:t,body:n}){return(0,l.jsxs)(`div`,{className:`rounded-md border-l-4 ${e} p-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold mb-1`,children:t}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:n})]})}function d({drug:e,dose:t,route:n,notes:r}){return(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{className:k+` font-semibold`,children:e}),(0,l.jsx)(`td`,{className:k,children:t}),(0,l.jsx)(`td`,{className:k+` text-xs`,children:n}),(0,l.jsx)(`td`,{className:k+` text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:r}})]})}function f({children:e}){return(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:O,children:`Drug`}),(0,l.jsx)(`th`,{className:O,children:`Dose`}),(0,l.jsx)(`th`,{className:O,children:`Route`}),(0,l.jsx)(`th`,{className:O,children:`Notes`})]})}),(0,l.jsx)(`tbody`,{children:e})]})})}return(0,l.jsxs)(`section`,{className:T,"data-testid":`bedside-panel-toxicology`,children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Toxicology`}),(0,l.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 max-w-xl`,children:[(0,l.jsx)(A,{id:`tox-wt`,value:e,onChange:t,testid:`tox-weight`}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`tox-topic`,className:D,children:`Topic`}),(0,l.jsx)(`select`,{id:`tox-topic`,className:E,value:n,onChange:e=>r(e.target.value),"data-testid":`tox-topic`,children:J.map(([e,t])=>(0,l.jsx)(`option`,{value:e,children:t},e))})]})]}),n===`approach`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(u,{color:`border-blue-500 bg-blue-50 dark:bg-blue-950/30`,title:`1. Stabilize (ABCDE)`,body:(0,l.jsx)(l.Fragment,{children:`Airway, breathing, circulation, disability (glucose, pupils, GCS), exposure. Naloxone if depressed LOC + resp depression. Dextrose if hypoglycemic. Thiamine in select cases.`})}),(0,l.jsx)(u,{color:`border-purple-500 bg-purple-50 dark:bg-purple-950/30`,title:`2. Identify toxidrome`,body:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:`Sympathomimetic:`}),` HTN, tachy, mydriasis, diaphoresis (cocaine, meth). `,(0,l.jsx)(`strong`,{children:`Anticholinergic:`}),` hot/dry, mydriasis, tachy, delirium (antihistamines, TCAs). `,(0,l.jsx)(`strong`,{children:`Cholinergic:`}),` SLUDGE-M, miosis (organophosphates). `,(0,l.jsx)(`strong`,{children:`Opioid:`}),` miosis, resp depression, ↓LOC. `,(0,l.jsx)(`strong`,{children:`Sedative-hypnotic:`}),` ↓LOC, normal/low vitals.`]})}),(0,l.jsx)(u,{color:`border-amber-500 bg-amber-50 dark:bg-amber-950/30`,title:`3. Decontamination`,body:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:`Activated charcoal`}),` 1 g/kg PO (max 50 g): within 1h of ingestion, intact airway, ingestion adsorbed (not Li, metals, alcohols). Avoid caustics/hydrocarbons. `,(0,l.jsx)(`strong`,{children:`Whole bowel irrigation:`}),` PEG for metals/iron/lithium/sustained release. `,(0,l.jsx)(`strong`,{children:`Gastric lavage:`}),` rarely indicated. `,(0,l.jsx)(`strong`,{children:`Ipecac:`}),` no longer recommended.`]})}),(0,l.jsx)(u,{color:`border-green-500 bg-green-50 dark:bg-green-950/30`,title:`4. Enhance elimination`,body:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`strong`,{children:`Urinary alkalinization`}),` (salicylates, phenobarbital). `,(0,l.jsx)(`strong`,{children:`Hemodialysis`}),` (see ISTUMBLE). `,(0,l.jsx)(`strong`,{children:`Lipid emulsion`}),` for lipid-soluble drug toxicity (LA, CCB, TCA).`]})}),(0,l.jsx)(u,{color:`border-destructive bg-red-50 dark:bg-red-950/30`,title:`5. Antidotes`,body:(0,l.jsxs)(l.Fragment,{children:[`See topic list. `,(0,l.jsx)(`strong`,{children:`Contact Poison Center`}),` (US: 1-800-222-1222) early for any significant exposure.`]})})]}),n===`acetaminophen`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Acetaminophen overdose`}),(0,l.jsx)(`p`,{className:`text-sm`,children:`Acute toxic dose: >150 mg/kg (or 7.5 g total) single ingestion. Hepatotoxic after 24h; AST/ALT peak day 3-4.`}),(0,l.jsxs)(`p`,{className:`text-sm`,children:[(0,l.jsx)(`strong`,{children:`Diagnosis:`}),` Draw level at 4h post-ingestion (or on arrival if >4h). Plot on `,(0,l.jsx)(`strong`,{children:`Rumack-Matthew nomogram`}),` (treatment line at 150 mcg/mL at 4h).`]}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{drug:`N-acetylcysteine (NAC) — IV`,dose:`150 mg/kg over 1h → 50 mg/kg over 4h → 100 mg/kg over 16h (21h total)`,route:`IV`,notes:`Total 300 mg/kg. Most effective if started <8h post-ingestion.`}),(0,l.jsx)(d,{drug:`N-acetylcysteine — PO`,dose:`140 mg/kg load, then 70 mg/kg q4h × 17 doses`,route:`PO`,notes:`Alternative to IV. Unpleasant taste — often with juice.`}),(0,l.jsx)(d,{drug:`Activated charcoal`,dose:`1 g/kg (max 50 g)`,route:`PO`,notes:`If within 1-2h of ingestion and airway protected.`})]}),a&&(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-3 text-xs`,children:[(0,l.jsxs)(`strong`,{children:[`For `,i,` kg:`]}),` IV loading = `,o(150,null),` mg over 1h `,(0,l.jsx)(`span`,{className:`text-muted-foreground`,children:`(150 mg/kg)`}),`; 2nd bag = `,o(50,null),` mg over 4h `,(0,l.jsx)(`span`,{className:`text-muted-foreground`,children:`(50 mg/kg)`}),`; 3rd bag = `,o(100,null),` mg over 16h `,(0,l.jsx)(`span`,{className:`text-muted-foreground`,children:`(100 mg/kg)`}),`. `,(0,l.jsx)(`em`,{children:`Total 300 mg/kg.`})]})]}),n===`opioids`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Opioid overdose`}),(0,l.jsxs)(`p`,{className:`text-sm`,children:[`Triad: `,(0,l.jsx)(`strong`,{children:`miosis + respiratory depression + ↓ LOC`}),`. Fentanyl / synthetics may require repeated/higher doses.`]}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{drug:`Naloxone (initial)`,dose:a?`0.01-0.1 mg/kg = ${o(.01,null)}-${o(.1,null)} mg`:`0.01-0.1 mg/kg`,route:`IV / IM / IN / IO`,notes:`Start low if chronic opioid use (avoid withdrawal). Titrate to respiratory effort, not consciousness.`}),(0,l.jsx)(d,{drug:`Naloxone (full reversal)`,dose:`2 mg IV/IM/IN`,route:`IV / IM / IN`,notes:`If no chronic use and severe resp depression. Repeat q2-3 min.`}),(0,l.jsx)(d,{drug:`Naloxone infusion`,dose:`2/3 of effective bolus per hour`,route:`IV`,notes:`For long-acting opioids (methadone, fentanyl patch, sustained release)`})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[`Observe ≥4h after last dose; longer for long-acting agents. Duration of naloxone (30-90 min) is shorter than most opioids — `,(0,l.jsx)(`strong`,{children:`re-sedation is common`}),`.`]})]}),n===`iron`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Iron overdose`}),(0,l.jsxs)(`p`,{className:`text-sm`,children:[`Toxic dose: elemental Fe ≥20 mg/kg. Severe ≥60 mg/kg. `,(0,l.jsx)(`strong`,{children:`Charcoal does NOT bind iron.`})]}),(0,l.jsxs)(`p`,{className:`text-sm`,children:[(0,l.jsx)(`strong`,{children:`Stages:`}),` 1) GI (0-6h: vomiting, bloody diarrhea); 2) Latent (6-24h); 3) Shock/metabolic acidosis (12-24h); 4) Hepatotoxicity (2-5d); 5) Gastric scarring (2-8 wk).`]}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{drug:`Whole bowel irrigation`,dose:`PEG-ES 25-40 mL/kg/hr`,route:`NG`,notes:`For radiopaque pills on KUB or ingested sustained-release iron.`}),(0,l.jsx)(d,{drug:`Deferoxamine`,dose:`15 mg/kg/hr IV infusion`,route:`IV`,notes:`Max 6-8 g/day. Indications: shock, metabolic acidosis, Fe >500 mcg/dL, or severe symptoms. Urine turns 'vin rosé' color.`})]}),(0,l.jsx)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:`Iron level at 4-6h. <350 usually asymptomatic; 350-500 mild; >500 severe. Consider KUB for radiopaque pills.`})]}),n===`tca`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`TCA overdose`}),(0,l.jsxs)(`p`,{className:`text-sm`,children:[`Anticholinergic + Na-channel blockade. `,(0,l.jsx)(`strong`,{children:`Risks:`}),` seizure, VT/VF, hypotension, coma. ECG: QRS >100 ms or R in aVR >3 mm predicts toxicity.`]}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{drug:`Sodium bicarbonate 8.4%`,dose:`1-2 mEq/kg IV bolus → infusion`,route:`IV`,notes:`Goal pH 7.45-7.55 and narrowing QRS. Repeat bolus for QRS widening, hypotension, or arrhythmia.`}),(0,l.jsx)(d,{drug:`Mg sulfate`,dose:a?`${o(50,2e3)} mg`:`25-50 mg/kg (max 2 g)`,route:`IV over 10 min`,notes:`For torsades.`}),(0,l.jsx)(d,{drug:`IV lipid emulsion 20%`,dose:`1.5 mL/kg bolus → 0.25 mL/kg/min × 30-60 min`,route:`IV`,notes:`If refractory shock/arrest. Consult toxicology.`})]}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Avoid`}),` Class IA/IC antiarrhythmics, beta-blockers, physostigmine (risk of asystole with TCAs).`]})]}),n===`bbccb`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`β-blocker / Calcium-channel blocker overdose`}),(0,l.jsx)(`p`,{className:`text-sm`,children:`Bradycardia + hypotension. CCBs (esp. verapamil, diltiazem, amlodipine) can be lethal in small pediatric doses.`}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{drug:`IV fluids`,dose:`20 mL/kg NS bolus`,route:`IV`,notes:`Cautious — avoid volume overload`}),(0,l.jsx)(d,{drug:`Calcium chloride 10% or gluconate`,dose:`CaCl 20 mg/kg / Ca-glu 60 mg/kg`,route:`IV`,notes:`First-line for CCB. Repeat q15-20 min.`}),(0,l.jsx)(d,{drug:`Glucagon`,dose:`50 mcg/kg IV bolus → 50-150 mcg/kg/hr`,route:`IV`,notes:`β-blocker antidote. GI side effects common.`}),(0,l.jsx)(d,{drug:`High-dose insulin (HIE)`,dose:`Regular insulin 1 U/kg bolus → 0.5-2 U/kg/hr + D25% infusion`,route:`IV`,notes:`Hyperinsulinemic euglycemia therapy. Monitor K+ and glucose closely.`}),(0,l.jsx)(d,{drug:`Vasopressors`,dose:`Epi / norepi infusion`,route:`IV`,notes:`Titrate to MAP.`}),(0,l.jsx)(d,{drug:`Lipid emulsion 20%`,dose:`1.5 mL/kg → 0.25 mL/kg/min`,route:`IV`,notes:`For lipid-soluble CCBs (verapamil) if refractory.`}),(0,l.jsx)(d,{drug:`Methylene blue / ECMO`,dose:``,route:``,notes:`Rescue therapy — toxicology/ICU consult.`})]})]}),n===`benzo`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Benzodiazepine overdose`}),(0,l.jsxs)(`p`,{className:`text-sm`,children:[`Sedation + resp depression. Usually supportive — intubation rarely needed alone. `,(0,l.jsx)(`strong`,{children:`Flumazenil caution.`})]}),(0,l.jsx)(f,{children:(0,l.jsx)(d,{drug:`Flumazenil`,dose:`0.01 mg/kg (max 0.2 mg) IV, may repeat q1 min to max 1 mg`,route:`IV`,notes:`Only for iatrogenic reversal in a benzo-naive patient with no TCAs, seizure disorder, or chronic benzo use. <strong>Can precipitate seizures.</strong>`})}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[`In real-world ingestion, `,(0,l.jsx)(`strong`,{children:`supportive care (airway, monitoring)`}),` is usually safer than flumazenil.`]})]}),n===`organo`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Organophosphate / carbamate poisoning`}),(0,l.jsxs)(`p`,{className:`text-sm`,children:[`Cholinergic toxidrome: `,(0,l.jsx)(`strong`,{children:`SLUDGE-M`}),` (salivation, lacrimation, urination, defecation, GI distress, emesis, miosis) + muscle fasciculation, bradycardia, bronchorrhea. Decontamination critical (PPE for providers).`]}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{drug:`Atropine`,dose:`0.05 mg/kg IV, double q3-5 min until bronchial secretions dry`,route:`IV`,notes:`Endpoint = dry lungs, not dry mouth or heart rate. Can require huge doses.`}),(0,l.jsx)(d,{drug:`Pralidoxime (2-PAM)`,dose:`25-50 mg/kg IV over 30 min (max 2 g) → 10-20 mg/kg/hr`,route:`IV`,notes:`Only for organophosphates (not carbamates). Regenerates acetylcholinesterase.`}),(0,l.jsx)(d,{drug:`Diazepam / midazolam`,dose:`Standard seizure doses`,route:`IV`,notes:`For seizures or severe fasciculations.`})]})]}),n===`salicylate`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Salicylate overdose`}),(0,l.jsx)(`p`,{className:`text-sm`,children:`Mixed respiratory alkalosis + anion gap metabolic acidosis. Tinnitus, tachypnea, diaphoresis, hyperthermia. Severe: CNS depression, seizures, pulmonary edema, cerebral edema.`}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{drug:`Fluids`,dose:`Aggressive resuscitation`,route:`IV`,notes:`Dehydration common. Avoid fluid overload (risk of pulmonary edema).`}),(0,l.jsx)(d,{drug:`Sodium bicarb`,dose:`1-2 mEq/kg IV bolus → drip`,route:`IV`,notes:`Urinary alkalinization (goal urine pH >7.5). Prevents CNS entry.`}),(0,l.jsx)(d,{drug:`Glucose`,dose:`Maintain euglycemia even if BG normal`,route:`IV`,notes:`CNS hypoglycemia despite normal serum glucose.`}),(0,l.jsx)(d,{drug:`Hemodialysis`,dose:``,route:``,notes:`For severe: altered MS, pulmonary edema, renal failure, refractory acidosis, or level >100 mg/dL acute / >60 chronic.`})]})]}),n===`etoh`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Toxic alcohols (methanol / ethylene glycol)`}),(0,l.jsx)(`p`,{className:`text-sm`,children:`Anion gap metabolic acidosis + osmolar gap. Methanol → visual changes, blindness. Ethylene glycol → calcium oxalate crystals in urine, renal failure.`}),(0,l.jsxs)(f,{children:[(0,l.jsx)(d,{drug:`Fomepizole`,dose:`15 mg/kg IV load → 10 mg/kg q12h × 4 → 15 mg/kg q12h`,route:`IV`,notes:`First-line. Inhibits alcohol dehydrogenase.`}),(0,l.jsx)(d,{drug:`Ethanol (alternative)`,dose:`Load 600 mg/kg → maintain level 100-150 mg/dL`,route:`IV / PO`,notes:`If fomepizole unavailable. Monitor closely.`}),(0,l.jsx)(d,{drug:`Hemodialysis`,dose:``,route:``,notes:`For severe acidosis, end-organ damage, or high levels.`}),(0,l.jsx)(d,{drug:`Folate / thiamine / pyridoxine`,dose:`Standard doses`,route:`IV`,notes:`Methanol: folate. EG: thiamine + pyridoxine (divert to non-toxic metabolites).`})]})]}),n===`dialyzable`&&(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`div`,{className:`rounded-md bg-blue-50 dark:bg-blue-950/30 p-3 text-sm font-semibold`,children:`Dialyzable drugs (ISTUMBLE)`}),(0,l.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2 text-sm`,children:[[`I`,`Isopropyl alcohol, INH`],[`S`,`Salicylates`],[`T`,`Theophylline, Toxic alcohols`],[`U`,`Uremia-related drugs`],[`M`,`Methanol, Metformin, Methotrexate`],[`B`,`Barbiturates (long-acting)`],[`L`,`Lithium`],[`E`,`Ethylene glycol`]].map(([e,t])=>(0,l.jsxs)(`div`,{className:`rounded-md bg-muted/40 p-2`,children:[(0,l.jsxs)(`strong`,{children:[e,`:`]}),` `,t]},e))}),(0,l.jsxs)(`div`,{className:`rounded-md bg-amber-50 dark:bg-amber-950/30 p-3 text-xs text-amber-900 dark:text-amber-100`,children:[(0,l.jsx)(`strong`,{children:`Poor candidates for HD:`}),` Large Vd (TCAs, digoxin, BBs), highly protein-bound (benzos, CCBs), lipid-soluble (opioids, phenothiazines). EXTRIP recommendations are evidence-based — consult toxicology.`]})]}),(0,l.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Call Poison Control early: 1-800-222-1222 (US) · Refs: Goldfrank's Toxicologic Emergencies · EXTRIP workgroup.`})]})}function ee(e){switch(e){case`anaphylaxis`:return(0,l.jsx)(N,{});case`cardiac`:return(0,l.jsx)(P,{});case`seizure`:return(0,l.jsx)(I,{});case`airway`:return(0,l.jsx)(L,{});case`agitation`:return(0,l.jsx)(R,{});case`antiemetics`:return(0,l.jsx)(z,{});case`antimicrobials`:return(0,l.jsx)(U,{});case`trauma`:return(0,l.jsx)(W,{});case`sedation`:return(0,l.jsx)(q,{});case`toxicology`:return(0,l.jsx)(Y,{});case`neonatal`:return(0,l.jsx)(v,{});case`respiratory`:return(0,l.jsx)(y,{});case`ventilation`:return(0,l.jsx)(b,{});case`sepsis`:return(0,l.jsx)(x,{});case`burns`:return(0,l.jsx)(w,{});default:return null}}var te=new Set([`anaphylaxis`,`cardiac`,`seizure`,`airway`,`agitation`,`antiemetics`,`antimicrobials`,`trauma`,`sedation`,`toxicology`,`neonatal`,`respiratory`,`ventilation`,`sepsis`,`burns`]),X=`rounded-lg border border-border bg-card p-5 space-y-3`,ne=`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium`,re=`rounded-md border border-border bg-background px-4 py-2 text-sm font-medium hover:bg-muted`,Z=`block text-xs font-medium text-muted-foreground`,Q=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring`,$=[{id:`neonatal`,label:`Neonatal`,icon:`👶`,summary:`GA classification, AGA/SGA/LGA, prematurity category (Fenton 2013 / WHO).`},{id:`airway`,label:`Airway / RSI`,icon:`💨`,summary:`ETT size + depth, RSI induction + paralytic dosing by weight.`},{id:`cardiac`,label:`Cardiac Arrest`,icon:`❤️`,summary:`PALS dosing (epinephrine, amiodarone, lidocaine), defibrillation J/kg.`},{id:`respiratory`,label:`Respiratory`,icon:`🫁`,summary:`Asthma, bronchiolitis, croup severity + dosing.`},{id:`ventilation`,label:`O₂ & Ventilation`,icon:`🌀`,summary:`NC / HFNC / CPAP / BiPAP flow + FiO₂ targets by age.`},{id:`seizure`,label:`Seizures`,icon:`🧠`,summary:`Benzodiazepine + second/third-line weight-based dosing.`},{id:`sepsis`,label:`Sepsis & Fever`,icon:`🦠`,summary:`Empirical antibiotics + fluid bolus dosing by weight.`},{id:`anaphylaxis`,label:`Anaphylaxis`,icon:`💉`,summary:`Epinephrine IM, IV infusion, steroid + antihistamine dosing.`},{id:`sedation`,label:`Sedation`,icon:`🛌`,summary:`Procedural sedation regimens — ketamine, propofol, midazolam.`},{id:`agitation`,label:`Agitation`,icon:`😤`,summary:`Weight-based haloperidol, olanzapine, lorazepam.`},{id:`antiemetics`,label:`Antiemetics`,icon:`💊`,summary:`Ondansetron, metoclopramide, promethazine dosing.`},{id:`antimicrobials`,label:`Antimicrobials`,icon:`🧫`,summary:`Common empirical regimens keyed to syndrome + weight.`},{id:`burns`,label:`Burns`,icon:`🔥`,summary:`TBSA % (Lund-Browder, Rule of Nines-children), Parkland fluids.`},{id:`toxicology`,label:`Toxicology`,icon:`☠️`,summary:`Common toxidromes + antidotes + decontamination windows.`},{id:`trauma`,label:`Trauma`,icon:`🩹`,summary:`PECARN, c-spine, blood-product dosing, TXA.`}];function ie(){let[e,t]=(0,c.useState)(``),[n,a]=(0,c.useState)(`apls`),[s,u]=(0,c.useState)(``),d=i(e),f=d==null?null:r(d),p=f?n===`bestguess`?f.all.bestGuess:f.all.apls:null,m=s.trim()||(p==null?``:String(p));function h(){t(``),a(`apls`),u(``)}return(0,l.jsxs)(`section`,{className:X,"data-testid":`bedside-weight-estimator`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Age → Weight Estimator`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Shared starting point for Bedside dosing. Uses the same APLS and Best Guess formulas as the legacy app.`})]}),(0,l.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[1.2fr_1fr_1fr_auto] md:items-end`,children:[(0,l.jsxs)(`div`,{className:`space-y-1`,children:[(0,l.jsx)(`label`,{htmlFor:`bedside-react-age`,className:Z,children:`Age`}),(0,l.jsx)(`input`,{id:`bedside-react-age`,value:e,onChange:e=>t(e.target.value),placeholder:`e.g. "18m", "3y", "2y5m"`,className:Q,"data-testid":`bedside-age-input`})]}),(0,l.jsxs)(`div`,{className:`space-y-1`,children:[(0,l.jsx)(`label`,{htmlFor:`bedside-react-formula`,className:Z,children:`Formula`}),(0,l.jsxs)(`select`,{id:`bedside-react-formula`,value:n,onChange:e=>{a(e.target.value),u(``)},className:Q,"data-testid":`bedside-formula-select`,children:[(0,l.jsx)(`option`,{value:`apls`,children:`APLS`}),(0,l.jsx)(`option`,{value:`bestguess`,children:`Best Guess`})]})]}),(0,l.jsxs)(`div`,{className:`space-y-1`,children:[(0,l.jsx)(`label`,{htmlFor:`bedside-react-weight`,className:Z,children:`Weight (kg)`}),(0,l.jsx)(`input`,{id:`bedside-react-weight`,type:`number`,min:`0.3`,step:`0.1`,value:m,onChange:e=>u(e.target.value),className:Q,"data-testid":`bedside-weight-input`})]}),(0,l.jsx)(`button`,{type:`button`,onClick:h,className:re,children:`Clear`})]}),e.trim()&&d==null?(0,l.jsx)(`div`,{className:`rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:bg-red-950/30 dark:text-red-200`,children:`Could not parse age. Try "3y", "18 months", or "15 days".`}):null,f&&p!=null?(0,l.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/40 p-4 text-sm`,"data-testid":`bedside-estimate-result`,children:[(0,l.jsxs)(`div`,{className:`font-semibold`,children:[p,` kg estimated from `,o(d??0)]}),(0,l.jsxs)(`div`,{className:`text-muted-foreground`,children:[`APLS: `,f.all.apls,` kg · Best Guess: `,f.all.bestGuess,` kg. You can override the weight field.`]})]}):null]})}function ae({pill:e}){return(0,l.jsxs)(`section`,{className:X,"data-testid":`bedside-panel-`+e.id,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,l.jsx)(`span`,{className:`text-2xl`,"aria-hidden":!0,children:e.icon}),(0,l.jsx)(`h2`,{className:`text-lg font-semibold`,children:e.label})]}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.summary}),(0,l.jsx)(`div`,{className:`rounded-md border border-amber-300 bg-amber-50 dark:bg-amber-950/30 p-3 text-sm space-y-2`,children:(0,l.jsx)(`p`,{className:`text-amber-900 dark:text-amber-100`,children:`Weight-based calculators for this module run in the legacy viewer while the clinical data is verified for a direct React port. Open the legacy Bedside tab to use the full dosing flow.`})}),(0,l.jsx)(`a`,{href:`/#bedside`,className:ne+` inline-block`,children:`Open in legacy viewer`})]})}function oe(){let[e,t]=(0,c.useState)($[0].id),n=$.find(t=>t.id===e)??$[0];return(0,l.jsxs)(`div`,{className:`max-w-5xl mx-auto p-6 space-y-4`,children:[(0,l.jsxs)(`header`,{children:[(0,l.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Bedside`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Emergency and rapid-reference pediatric tools. Weight-based dosing throughout — always verify against institutional protocols.`})]}),(0,l.jsx)(`div`,{className:`flex flex-wrap gap-2`,"data-testid":`bedside-subnav`,children:$.map(n=>(0,l.jsxs)(`button`,{type:`button`,onClick:()=>t(n.id),className:`px-3 py-1.5 rounded-full text-xs font-medium border transition-colors `+(e===n.id?`bg-primary text-primary-foreground border-primary`:`bg-muted hover:bg-muted/80 border-border`),"data-testid":`bedside-pill-`+n.id,children:[(0,l.jsx)(`span`,{className:`mr-1`,"aria-hidden":!0,children:n.icon}),n.label]},n.id))}),(0,l.jsx)(ie,{}),te.has(n.id)?ee(n.id):(0,l.jsx)(ae,{pill:n})]})}export{oe as default};