pediatric-ai-scribe-v3/public/app/assets/fenton-9EKyvVkL.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
6.5 KiB
JavaScript

function e(e){if(e==null)return null;let t=String(e).toLowerCase().trim();if(!t)return null;if(/^[\d.]+$/.test(t)){let e=Number.parseFloat(t);return Number.isNaN(e)?null:e}let n=0,r=!1,i=t.match(/([\d.]+)\s*(?:years|year|yrs|yr|y)(?![a-z])/);i&&(n+=Number.parseFloat(i[1])*12,r=!0);let a=t.match(/([\d.]+)\s*(?:months|month|mos|mo|m)(?![a-z])/);a&&(n+=Number.parseFloat(a[1]),r=!0);let o=t.match(/([\d.]+)\s*(?:weeks|week|wks|wk|w)(?![a-z])/);o&&(n+=Number.parseFloat(o[1])*7/30.4375,r=!0);let s=t.match(/([\d.]+)\s*(?:days|day|d)(?![a-z])/);return s&&(n+=Number.parseFloat(s[1])/30.4375,r=!0),r?n:null}function t(e){if(e<1){let t=Math.round(e*30.4375);return`${t} day${t===1?``:`s`} (${e.toFixed(2)} mo)`}if(e<24)return`${n(e,1)} months`;let t=Math.floor(e/12),r=Math.round(e-t*12);return r===12&&(t+=1,r=0),`${t} yr${r?` ${r} mo`:``} (${Math.round(e)} mo total)`}function n(e,t){let n=10**t;return Math.round(e*n)/n}function r(e){if(e==null||Number.isNaN(e)||e<0)return null;let t=e/12,r;r=e<12?.5*e+4:t<=5?2*t+8:3*t+7;let i;i=e<12?(e+9)/2:t<=5?2*(t+5):4*t;let a;return a=t<13?e<12?`APLS 0-12 mo`:t<=5?`APLS 1-5 yr`:`APLS 6-12 yr`:`Best Guess 5-14 yr`,{weight:Math.max(.3,n(t<13?r:i,1)),formulaLabel:a,all:{apls:n(r,1),bestGuess:n(i,1)}}}function i(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?null:Math.sqrt(t*e/3600)}function a(e){let t=e.frequencyPerDay??1,n=e.maxSingleDoseMg??0,r=e.concentrationMgPerMl??0;if(!Number.isFinite(e.weightKg)||!Number.isFinite(e.dosePerKg)||!Number.isFinite(t)||e.weightKg<=0||e.dosePerKg<=0||t<=0)return null;let i=e.weightKg*e.dosePerKg,a=!1;return n>0&&i>n&&(i=n,a=!0),{singleDoseMg:i,dailyDoseMg:i*t,frequencyPerDay:t,capped:a,volumeMl:r>0?i/r:null}}function o(e,t,n,r=`mg`){let i=e*t,a=Math.round(i*100)/100,o=n!=null&&n>0,s=o&&a>n,c=s?n:a,l=`(${t} ${r}/kg`;return o&&(l+=`, max ${n} ${r}`),s&&(l+=` · capped`),l+=`)`,{value:c,unit:r,capped:s,perKg:t,max:o?n:null,label:`${c} ${r} ${l}`}}function s(e,t,n){if(!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(n)||e<1||e>4||t<1||t>5||n<1||n>6)return null;let r=e+t+n,i;return i=r<=8?`Severe (Coma)`:r<=12?`Moderate`:`Mild`,{total:r,severity:i}}var c={male:{22:{L:.21,M:496,S:.17},24:{L:.21,M:660,S:.17},26:{L:.21,M:870,S:.16},28:{L:.2,M:1124,S:.15},30:{L:.18,M:1430,S:.14},32:{L:.15,M:1795,S:.14},34:{L:.12,M:2230,S:.13},36:{L:.08,M:2710,S:.13},38:{L:.04,M:3195,S:.12},40:{L:.01,M:3530,S:.12},42:{L:-.02,M:3820,S:.12},44:{L:-.04,M:4200,S:.12},46:{L:-.06,M:4680,S:.12},48:{L:-.07,M:5200,S:.12},50:{L:-.08,M:5760,S:.12}},female:{22:{L:.23,M:474,S:.17},24:{L:.22,M:610,S:.17},26:{L:.22,M:810,S:.16},28:{L:.21,M:1040,S:.15},30:{L:.19,M:1330,S:.14},32:{L:.16,M:1680,S:.14},34:{L:.12,M:2090,S:.13},36:{L:.08,M:2540,S:.13},38:{L:.04,M:3e3,S:.12},40:{L:.01,M:3340,S:.12},42:{L:-.02,M:3630,S:.12},44:{L:-.04,M:4010,S:.12},46:{L:-.06,M:4470,S:.12},48:{L:-.07,M:4970,S:.12},50:{L:-.08,M:5510,S:.12}}};function l(e,t){let n=Object.keys(e).map(Number).sort((e,t)=>e-t);if(t<=n[0])return e[n[0]];if(t>=n[n.length-1])return e[n[n.length-1]];for(let r=0;r<n.length-1;r++)if(t>=n[r]&&t<=n[r+1]){let i=(t-n[r])/(n[r+1]-n[r]),a=e[n[r]],o=e[n[r+1]];return{L:a.L+i*(o.L-a.L),M:a.M+i*(o.M-a.M),S:a.S+i*(o.S-a.S)}}return e[n[0]]}function u(e,t,n,r){return t===0?Math.log(e/n)/r:((e/n)**+t-1)/(t*r)}function d(e){let t=1/(1+.2316419*Math.abs(e)),n=.3989423*Math.exp(-e*e/2)*t*(.3193815+t*(-.3565638+t*(1.781478+t*(-1.821256+t*1.330274))));return e>0&&(n=1-n),n*100}function f(e,t,n){let r=l(c[n],e),i=u(t,r.L,r.M,r.S),a=d(i);return{L:r.L,M:r.M,S:r.S,z:i,percentile:a}}function p(e){return e<10?`SGA`:e>90?`LGA`:`AGA`}var m={male:{22:{L:.5885,M:496,S:.12802},23:{L:.7565,M:571,S:.14547},24:{L:.9128,M:651,S:.16235},25:{L:1.0544,M:741,S:.17765},26:{L:1.1862,M:841,S:.19029},27:{L:1.3051,M:953,S:.19989},28:{L:1.3699,M:1079,S:.20777},29:{L:1.4165,M:1223,S:.21163},30:{L:1.4172,M:1388,S:.21185},31:{L:1.3755,M:1578,S:.20785},32:{L:1.2952,M:1790,S:.20112},33:{L:1.1974,M:2018,S:.19143},34:{L:1.0743,M:2255,S:.18119},35:{L:.9583,M:2493,S:.16992},36:{L:.846,M:2726,S:.16001},37:{L:.7543,M:2947,S:.15072},38:{L:.665,M:3156,S:.14304},39:{L:.5881,M:3360,S:.13641},40:{L:.5237,M:3568,S:.13173},41:{L:.4691,M:3785,S:.12863},42:{L:.4216,M:4014,S:.12735}},female:{22:{L:-.0868,M:481,S:.13605},23:{L:.2119,M:537,S:.14635},24:{L:.5281,M:606,S:.16134},25:{L:.8258,M:694,S:.18077},26:{L:1.0501,M:792,S:.19889},27:{L:1.2084,M:899,S:.21323},28:{L:1.2599,M:1017,S:.22437},29:{L:1.2539,M:1152,S:.22982},30:{L:1.2262,M:1306,S:.23082},31:{L:1.1223,M:1482,S:.22733},32:{L:1.0122,M:1681,S:.21846},33:{L:.8746,M:1897,S:.20681},34:{L:.7299,M:2126,S:.19407},35:{L:.5929,M:2362,S:.18059},36:{L:.4534,M:2602,S:.17028},37:{L:.3462,M:2835,S:.16139},38:{L:.2636,M:3050,S:.15513},39:{L:.2069,M:3239,S:.15004},40:{L:.167,M:3415,S:.14649},41:{L:.1517,M:3596,S:.14359},42:{L:.1308,M:3787,S:.14127}}};function h(e,t,n,r){return Math.abs(t)<.001?Math.log(e/n)/r:((e/n)**+t-1)/(t*r)}function g(e){let t=e<0?-1:1,n=Math.abs(e)/Math.sqrt(2),r=1/(1+.3275911*n),i=1-((((1.061405429*r+-1.453152027)*r+1.421413741)*r+-.284496736)*r+.254829592)*r*Math.exp(-n*n);return Math.round((1+t*i)/2*1e3)/10}function _(e,t=0){let n=e+t/7;return n<28?{label:`Extremely Preterm`,color:`#dc2626`,icon:`triangle-exclamation`}:n<32?{label:`Very Preterm`,color:`#ea580c`,icon:`triangle-exclamation`}:n<34?{label:`Moderate Preterm`,color:`#d97706`,icon:`circle-exclamation`}:n<37?{label:`Late Preterm`,color:`#ca8a04`,icon:`circle-info`}:n<39?{label:`Early Term`,color:`#2563eb`,icon:`circle-info`}:n<41?{label:`Full Term`,color:`#16a34a`,icon:`circle-check`}:n<42?{label:`Late Term`,color:`#d97706`,icon:`circle-info`}:{label:`Post Term`,color:`#dc2626`,icon:`triangle-exclamation`}}function v(e){return e<1e3?{label:`Extremely Low Birth Weight (ELBW)`,color:`#dc2626`}:e<1500?{label:`Very Low Birth Weight (VLBW)`,color:`#ea580c`}:e<2500?{label:`Low Birth Weight (LBW)`,color:`#d97706`}:e<=4e3?{label:`Normal Birth Weight`,color:`#16a34a`}:{label:`Macrosomia (>4000g)`,color:`#ea580c`}}function y(e){return e<3?{label:`Severely SGA`,color:`#dc2626`,detail:`<3rd percentile`}:e<10?{label:`SGA`,color:`#ea580c`,detail:`<10th percentile`}:e>97?{label:`Severely LGA`,color:`#dc2626`,detail:`>97th percentile`}:e>90?{label:`LGA`,color:`#ea580c`,detail:`>90th percentile`}:{label:`AGA`,color:`#16a34a`,detail:`10th-90th percentile`}}function b(e,t,n,r){let i=e+t/7,a=l(m[r],i),o=h(n,a.L,a.M,a.S),s=g(o);return{gaDecimal:i,gaClass:_(e,t),bwClass:v(n),weightClass:y(s),expectedWeight:Math.round(a.M),z:o,percentile:s,L:a.L,M:a.M,S:a.S}}export{s as a,r as c,e as d,b as i,t as l,f as n,i as o,l as r,a as s,p as t,o as u};