formanitor 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -419,6 +419,26 @@ var FormStore = class {
419
419
  result[field.id] = raw?.text ?? null;
420
420
  return;
421
421
  }
422
+ if (field.type === "ophthal_diagnosis") {
423
+ const raw = values[field.id];
424
+ const formatEye = (eyeData, eyeLabel) => {
425
+ if (!eyeData || typeof eyeData !== "object") return "";
426
+ const entries = Object.entries(eyeData).filter(([, value]) => typeof value === "string" && value.trim()).map(([key, value]) => `${key}: ${value.trim()}`);
427
+ if (entries.length === 0) return "";
428
+ return [eyeLabel, ...entries].join("\n");
429
+ };
430
+ const rightEyeText = formatEye(
431
+ raw?.right_eye ?? raw?.rightEye,
432
+ "Right Eye"
433
+ );
434
+ const leftEyeText = formatEye(
435
+ raw?.left_eye ?? raw?.leftEye,
436
+ "Left Eye"
437
+ );
438
+ const parts = [rightEyeText, leftEyeText].filter(Boolean);
439
+ result[field.id] = parts.length > 0 ? parts.join("\n\n") : null;
440
+ return;
441
+ }
422
442
  if (field.type === "image_upload" || field.type === "signature") {
423
443
  const raw = values[field.id];
424
444
  if (raw !== void 0 && raw !== null && raw !== "") {
@@ -5010,6 +5030,1343 @@ var ObstetricHistoryWidget = ({ fieldId }) => {
5010
5030
  ] })
5011
5031
  ] });
5012
5032
  };
5033
+ var UCVA_OPTIONS = ["", "6/6", "6/9", "6/12", "6/18", "6/24", "6/36", "6/60", "CF", "PL"];
5034
+ var NEAR_VA_OPTIONS = ["", "N4", "N5", "N6", "N8", "N10", "N12", "N14", "N18", "N24", "N36", "<N36"];
5035
+ var PINHOLE_OPTIONS = [
5036
+ "",
5037
+ "PL\u2212",
5038
+ "PL+",
5039
+ "FL",
5040
+ "HM",
5041
+ "CCFCF",
5042
+ "FC",
5043
+ "1/60",
5044
+ "2/60",
5045
+ "3/60",
5046
+ "4/60",
5047
+ "5/60",
5048
+ "6/60",
5049
+ "6/36",
5050
+ "6/24",
5051
+ "6/18",
5052
+ "6/12",
5053
+ "6/9",
5054
+ "6/7.5",
5055
+ "6/6"
5056
+ ];
5057
+ var VA_OPTIONS = UCVA_OPTIONS;
5058
+ var IOP_METHOD_OPTIONS = ["", "NCT", "Goldmann", "Tonopen", "iCare"];
5059
+ function parseFloatOrNull(value) {
5060
+ const trimmed = value.trim();
5061
+ if (!trimmed) return null;
5062
+ const parsed = Number.parseFloat(trimmed);
5063
+ return Number.isFinite(parsed) ? parsed : null;
5064
+ }
5065
+ function parseIntOrNull(value) {
5066
+ const trimmed = value.trim();
5067
+ if (!trimmed) return null;
5068
+ const parsed = Number.parseInt(trimmed, 10);
5069
+ return Number.isFinite(parsed) ? parsed : null;
5070
+ }
5071
+ function ensureRefractionEye(raw) {
5072
+ return {
5073
+ sph: raw?.sph ?? null,
5074
+ cyl: raw?.cyl ?? null,
5075
+ axis: raw?.axis ?? null,
5076
+ va: raw?.va ?? "",
5077
+ pd: raw?.pd ?? null,
5078
+ prism: raw?.prism ?? null
5079
+ };
5080
+ }
5081
+ function ensureAddPowers(raw) {
5082
+ return {
5083
+ right: raw?.right ?? null,
5084
+ left: raw?.left ?? null
5085
+ };
5086
+ }
5087
+ function ensureRefraction(raw) {
5088
+ return {
5089
+ right_eye: ensureRefractionEye(raw?.right_eye),
5090
+ left_eye: ensureRefractionEye(raw?.left_eye),
5091
+ add: ensureAddPowers(raw?.add)
5092
+ };
5093
+ }
5094
+ function ensureUnaidedEyeVa(raw) {
5095
+ return {
5096
+ ucva: raw?.ucva ?? "",
5097
+ pinhole_va: raw?.pinhole_va ?? "",
5098
+ nv: raw?.nv ?? ""
5099
+ };
5100
+ }
5101
+ function ensureIopEye(raw) {
5102
+ return {
5103
+ iop: raw?.iop ?? null,
5104
+ cct: raw?.cct ?? null
5105
+ };
5106
+ }
5107
+ function ensureValue(raw) {
5108
+ const v = raw || {};
5109
+ return {
5110
+ patient_information: {
5111
+ systemic_history: v.patient_information?.systemic_history ?? "",
5112
+ ocular_history: v.patient_information?.ocular_history ?? "",
5113
+ chief_complaints: v.patient_information?.chief_complaints ?? ""
5114
+ },
5115
+ unaided_visual_acuity: {
5116
+ right_eye: ensureUnaidedEyeVa(v.unaided_visual_acuity?.right_eye),
5117
+ left_eye: ensureUnaidedEyeVa(v.unaided_visual_acuity?.left_eye)
5118
+ },
5119
+ current_glass_prescription: ensureRefraction(v.current_glass_prescription),
5120
+ iop_pachy_cct: {
5121
+ method: v.iop_pachy_cct?.method ?? "",
5122
+ time: v.iop_pachy_cct?.time ?? "",
5123
+ right_eye: ensureIopEye(v.iop_pachy_cct?.right_eye),
5124
+ left_eye: ensureIopEye(v.iop_pachy_cct?.left_eye)
5125
+ },
5126
+ refraction: ensureRefraction(v.refraction),
5127
+ dilated_refraction: ensureRefraction(v.dilated_refraction),
5128
+ glass_power_prescription: ensureRefraction(v.glass_power_prescription),
5129
+ notes: v.notes ?? ""
5130
+ };
5131
+ }
5132
+ var sectionWrapperClass = "rounded-md overflow-hidden flex flex-col border border-[#D0D0D0] bg-white";
5133
+ var sectionHeaderClass = "rounded-t-md bg-[#FEE8EC] px-3 py-1 text-sm shrink-0 z-[1] text-slate-600 font-medium";
5134
+ var sectionBodyClass = "rounded-b-md border-t border-[#D0D0D0] bg-white p-3 space-y-3";
5135
+ var tableBaseClass = "w-full border-collapse text-xs";
5136
+ var tableHeaderCellClass = "border border-[#E0E0E0] bg-[#F7F7F7] px-2 py-1 text-center font-semibold";
5137
+ var tableCellClass = "border border-[#E0E0E0] px-1.5 py-1 text-center align-middle";
5138
+ var selectClass = "w-full border border-[#D0D0D0] rounded-md bg-white px-2 py-1 text-xs focus-visible:outline-none focus-visible:ring-0";
5139
+ var numberInputClass = "w-full border border-[#D0D0D0] rounded-md bg-white px-2 py-1 text-xs text-right focus-visible:outline-none focus-visible:ring-0";
5140
+ var textInputClass = "w-full border border-[#D0D0D0] rounded-md bg-white px-2 py-1 text-xs focus-visible:outline-none focus-visible:ring-0";
5141
+ var OphthalmologyWidget = ({ fieldId }) => {
5142
+ const { fieldDef, value, setValue, disabled } = useField(fieldId);
5143
+ const safe = React11.useMemo(() => ensureValue(value), [value]);
5144
+ const label = fieldDef?.label || "";
5145
+ const update = (updater) => {
5146
+ if (disabled) return;
5147
+ setValue(updater(ensureValue(value)));
5148
+ };
5149
+ const setPatientInfo = (key, next) => {
5150
+ update((current) => ({
5151
+ ...current,
5152
+ patient_information: { ...current.patient_information, [key]: next }
5153
+ }));
5154
+ };
5155
+ const setUnaided = (side, key, next) => {
5156
+ update((current) => ({
5157
+ ...current,
5158
+ unaided_visual_acuity: {
5159
+ ...current.unaided_visual_acuity,
5160
+ [side]: { ...current.unaided_visual_acuity[side], [key]: next }
5161
+ }
5162
+ }));
5163
+ };
5164
+ const setRefractionField = (section, side, key, next, mode) => {
5165
+ update((current) => {
5166
+ const base = current[section];
5167
+ const eye = base[side];
5168
+ let val;
5169
+ if (mode === "select") {
5170
+ val = next;
5171
+ } else if (mode === "float") {
5172
+ val = parseFloatOrNull(next);
5173
+ } else {
5174
+ val = parseIntOrNull(next);
5175
+ }
5176
+ return {
5177
+ ...current,
5178
+ [section]: {
5179
+ ...base,
5180
+ [side]: {
5181
+ ...eye,
5182
+ [key]: val
5183
+ }
5184
+ }
5185
+ };
5186
+ });
5187
+ };
5188
+ const setRefractionAdd = (section, side, next) => {
5189
+ update((current) => {
5190
+ const base = current[section];
5191
+ const add = base.add;
5192
+ const val = parseFloatOrNull(next);
5193
+ return {
5194
+ ...current,
5195
+ [section]: {
5196
+ ...base,
5197
+ add: {
5198
+ ...add,
5199
+ [side]: val
5200
+ }
5201
+ }
5202
+ };
5203
+ });
5204
+ };
5205
+ const setIopField = (side, key, next) => {
5206
+ update((current) => {
5207
+ const base = current.iop_pachy_cct;
5208
+ const eye = base[side];
5209
+ const val = parseIntOrNull(next);
5210
+ return {
5211
+ ...current,
5212
+ iop_pachy_cct: {
5213
+ ...base,
5214
+ [side]: {
5215
+ ...eye,
5216
+ [key]: val
5217
+ }
5218
+ }
5219
+ };
5220
+ });
5221
+ };
5222
+ const setIopMeta = (key, next) => {
5223
+ update((current) => ({
5224
+ ...current,
5225
+ iop_pachy_cct: {
5226
+ ...current.iop_pachy_cct,
5227
+ [key]: next
5228
+ }
5229
+ }));
5230
+ };
5231
+ const setNotes = (next) => {
5232
+ update((current) => ({
5233
+ ...current,
5234
+ notes: next
5235
+ }));
5236
+ };
5237
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-4", disabled && "opacity-70 pointer-events-none"), children: [
5238
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-base font-semibold text-slate-800", children: label }),
5239
+ /* @__PURE__ */ jsxRuntime.jsxs("section", { className: sectionWrapperClass, children: [
5240
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Patient Information" }) }),
5241
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(sectionBodyClass, "grid gap-3 md:grid-cols-3"), children: [
5242
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
5243
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-slate-700", children: "Systemic History" }),
5244
+ /* @__PURE__ */ jsxRuntime.jsx(
5245
+ Textarea,
5246
+ {
5247
+ disabled,
5248
+ rows: 4,
5249
+ className: "min-h-[100px] text-xs",
5250
+ value: safe.patient_information.systemic_history,
5251
+ onChange: (e) => setPatientInfo("systemic_history", e.target.value),
5252
+ placeholder: "Enter systemic history..."
5253
+ }
5254
+ )
5255
+ ] }),
5256
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
5257
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-slate-700", children: "Ocular History" }),
5258
+ /* @__PURE__ */ jsxRuntime.jsx(
5259
+ Textarea,
5260
+ {
5261
+ disabled,
5262
+ rows: 4,
5263
+ className: "min-h-[100px] text-xs",
5264
+ value: safe.patient_information.ocular_history,
5265
+ onChange: (e) => setPatientInfo("ocular_history", e.target.value),
5266
+ placeholder: "Enter ocular history..."
5267
+ }
5268
+ )
5269
+ ] }),
5270
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
5271
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-slate-700", children: "Chief Complaints" }),
5272
+ /* @__PURE__ */ jsxRuntime.jsx(
5273
+ Textarea,
5274
+ {
5275
+ disabled,
5276
+ rows: 4,
5277
+ className: "min-h-[100px] text-xs",
5278
+ value: safe.patient_information.chief_complaints,
5279
+ onChange: (e) => setPatientInfo("chief_complaints", e.target.value),
5280
+ placeholder: "Enter chief complaints..."
5281
+ }
5282
+ )
5283
+ ] })
5284
+ ] })
5285
+ ] }),
5286
+ /* @__PURE__ */ jsxRuntime.jsxs("section", { className: sectionWrapperClass, children: [
5287
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Unaided Visual Acuity" }) }),
5288
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: tableBaseClass, children: [
5289
+ /* @__PURE__ */ jsxRuntime.jsxs("thead", { children: [
5290
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
5291
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
5292
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 3, children: "Right Eye" }),
5293
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 3, children: "Left Eye" })
5294
+ ] }),
5295
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
5296
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
5297
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "UCVA" }),
5298
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Pinhole V/A" }),
5299
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "N/V" }),
5300
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "UCVA" }),
5301
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Pinhole V/A" }),
5302
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "N/V" })
5303
+ ] })
5304
+ ] }),
5305
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
5306
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Unaided" }),
5307
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5308
+ "select",
5309
+ {
5310
+ disabled,
5311
+ className: selectClass,
5312
+ value: safe.unaided_visual_acuity.right_eye.ucva,
5313
+ onChange: (e) => setUnaided("right_eye", "ucva", e.target.value),
5314
+ children: UCVA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
5315
+ }
5316
+ ) }),
5317
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5318
+ "select",
5319
+ {
5320
+ disabled,
5321
+ className: selectClass,
5322
+ value: safe.unaided_visual_acuity.right_eye.pinhole_va,
5323
+ onChange: (e) => setUnaided("right_eye", "pinhole_va", e.target.value),
5324
+ children: PINHOLE_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
5325
+ }
5326
+ ) }),
5327
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5328
+ "select",
5329
+ {
5330
+ disabled,
5331
+ className: selectClass,
5332
+ value: safe.unaided_visual_acuity.right_eye.nv,
5333
+ onChange: (e) => setUnaided("right_eye", "nv", e.target.value),
5334
+ children: NEAR_VA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
5335
+ }
5336
+ ) }),
5337
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5338
+ "select",
5339
+ {
5340
+ disabled,
5341
+ className: selectClass,
5342
+ value: safe.unaided_visual_acuity.left_eye.ucva,
5343
+ onChange: (e) => setUnaided("left_eye", "ucva", e.target.value),
5344
+ children: UCVA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
5345
+ }
5346
+ ) }),
5347
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5348
+ "select",
5349
+ {
5350
+ disabled,
5351
+ className: selectClass,
5352
+ value: safe.unaided_visual_acuity.left_eye.pinhole_va,
5353
+ onChange: (e) => setUnaided("left_eye", "pinhole_va", e.target.value),
5354
+ children: PINHOLE_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
5355
+ }
5356
+ ) }),
5357
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5358
+ "select",
5359
+ {
5360
+ disabled,
5361
+ className: selectClass,
5362
+ value: safe.unaided_visual_acuity.left_eye.nv,
5363
+ onChange: (e) => setUnaided("left_eye", "nv", e.target.value),
5364
+ children: NEAR_VA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
5365
+ }
5366
+ ) })
5367
+ ] }) })
5368
+ ] }) })
5369
+ ] }),
5370
+ /* @__PURE__ */ jsxRuntime.jsxs("section", { className: sectionWrapperClass, children: [
5371
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Current Glass Prescription" }) }),
5372
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: tableBaseClass, children: [
5373
+ /* @__PURE__ */ jsxRuntime.jsxs("thead", { children: [
5374
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
5375
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
5376
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 4, children: "Right Eye" }),
5377
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 4, children: "Left Eye" })
5378
+ ] }),
5379
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
5380
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
5381
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5382
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5383
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5384
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
5385
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5386
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5387
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5388
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "V/A" })
5389
+ ] })
5390
+ ] }),
5391
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
5392
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Current Glass" }),
5393
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5394
+ Input,
5395
+ {
5396
+ disabled,
5397
+ type: "number",
5398
+ step: "0.25",
5399
+ className: numberInputClass,
5400
+ value: safe.current_glass_prescription.right_eye.sph ?? "",
5401
+ onChange: (e) => setRefractionField(
5402
+ "current_glass_prescription",
5403
+ "right_eye",
5404
+ "sph",
5405
+ e.target.value,
5406
+ "float"
5407
+ )
5408
+ }
5409
+ ) }),
5410
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5411
+ Input,
5412
+ {
5413
+ disabled,
5414
+ type: "number",
5415
+ step: "0.25",
5416
+ className: numberInputClass,
5417
+ value: safe.current_glass_prescription.right_eye.cyl ?? "",
5418
+ onChange: (e) => setRefractionField(
5419
+ "current_glass_prescription",
5420
+ "right_eye",
5421
+ "cyl",
5422
+ e.target.value,
5423
+ "float"
5424
+ )
5425
+ }
5426
+ ) }),
5427
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5428
+ Input,
5429
+ {
5430
+ disabled,
5431
+ type: "number",
5432
+ className: numberInputClass,
5433
+ value: safe.current_glass_prescription.right_eye.axis ?? "",
5434
+ onChange: (e) => setRefractionField(
5435
+ "current_glass_prescription",
5436
+ "right_eye",
5437
+ "axis",
5438
+ e.target.value,
5439
+ "int"
5440
+ )
5441
+ }
5442
+ ) }),
5443
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5444
+ "select",
5445
+ {
5446
+ disabled,
5447
+ className: selectClass,
5448
+ value: safe.current_glass_prescription.right_eye.va,
5449
+ onChange: (e) => setRefractionField(
5450
+ "current_glass_prescription",
5451
+ "right_eye",
5452
+ "va",
5453
+ e.target.value,
5454
+ "select"
5455
+ ),
5456
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
5457
+ }
5458
+ ) }),
5459
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5460
+ Input,
5461
+ {
5462
+ disabled,
5463
+ type: "number",
5464
+ step: "0.25",
5465
+ className: numberInputClass,
5466
+ value: safe.current_glass_prescription.left_eye.sph ?? "",
5467
+ onChange: (e) => setRefractionField(
5468
+ "current_glass_prescription",
5469
+ "left_eye",
5470
+ "sph",
5471
+ e.target.value,
5472
+ "float"
5473
+ )
5474
+ }
5475
+ ) }),
5476
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5477
+ Input,
5478
+ {
5479
+ disabled,
5480
+ type: "number",
5481
+ step: "0.25",
5482
+ className: numberInputClass,
5483
+ value: safe.current_glass_prescription.left_eye.cyl ?? "",
5484
+ onChange: (e) => setRefractionField(
5485
+ "current_glass_prescription",
5486
+ "left_eye",
5487
+ "cyl",
5488
+ e.target.value,
5489
+ "float"
5490
+ )
5491
+ }
5492
+ ) }),
5493
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5494
+ Input,
5495
+ {
5496
+ disabled,
5497
+ type: "number",
5498
+ className: numberInputClass,
5499
+ value: safe.current_glass_prescription.left_eye.axis ?? "",
5500
+ onChange: (e) => setRefractionField(
5501
+ "current_glass_prescription",
5502
+ "left_eye",
5503
+ "axis",
5504
+ e.target.value,
5505
+ "int"
5506
+ )
5507
+ }
5508
+ ) }),
5509
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5510
+ "select",
5511
+ {
5512
+ disabled,
5513
+ className: selectClass,
5514
+ value: safe.current_glass_prescription.left_eye.va,
5515
+ onChange: (e) => setRefractionField(
5516
+ "current_glass_prescription",
5517
+ "left_eye",
5518
+ "va",
5519
+ e.target.value,
5520
+ "select"
5521
+ ),
5522
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
5523
+ }
5524
+ ) })
5525
+ ] }) })
5526
+ ] }) })
5527
+ ] }),
5528
+ /* @__PURE__ */ jsxRuntime.jsxs("section", { className: sectionWrapperClass, children: [
5529
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "IOP / Pachy / CCT Detail" }) }),
5530
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: sectionBodyClass, children: [
5531
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-3 md:grid-cols-[2fr,1fr] mb-3", children: [
5532
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
5533
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-slate-700", children: "Method" }),
5534
+ /* @__PURE__ */ jsxRuntime.jsx(
5535
+ "select",
5536
+ {
5537
+ disabled,
5538
+ className: selectClass,
5539
+ value: safe.iop_pachy_cct.method,
5540
+ onChange: (e) => setIopMeta("method", e.target.value),
5541
+ children: IOP_METHOD_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt || "Select Method" }, opt || "blank"))
5542
+ }
5543
+ )
5544
+ ] }),
5545
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
5546
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-slate-700", children: "Time" }),
5547
+ /* @__PURE__ */ jsxRuntime.jsx(
5548
+ Input,
5549
+ {
5550
+ disabled,
5551
+ placeholder: "HH:MM",
5552
+ className: textInputClass,
5553
+ value: safe.iop_pachy_cct.time,
5554
+ onChange: (e) => setIopMeta("time", e.target.value)
5555
+ }
5556
+ )
5557
+ ] })
5558
+ ] }),
5559
+ /* @__PURE__ */ jsxRuntime.jsxs("table", { className: tableBaseClass, children: [
5560
+ /* @__PURE__ */ jsxRuntime.jsxs("thead", { children: [
5561
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
5562
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
5563
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 2, children: "Right Eye" }),
5564
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 2, children: "Left Eye" })
5565
+ ] }),
5566
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
5567
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
5568
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "IOP" }),
5569
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "CCT" }),
5570
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "IOP" }),
5571
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "CCT" })
5572
+ ] })
5573
+ ] }),
5574
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
5575
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Values" }),
5576
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5577
+ Input,
5578
+ {
5579
+ disabled,
5580
+ type: "number",
5581
+ className: numberInputClass,
5582
+ value: safe.iop_pachy_cct.right_eye.iop ?? "",
5583
+ onChange: (e) => setIopField("right_eye", "iop", e.target.value)
5584
+ }
5585
+ ) }),
5586
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5587
+ Input,
5588
+ {
5589
+ disabled,
5590
+ type: "number",
5591
+ className: numberInputClass,
5592
+ value: safe.iop_pachy_cct.right_eye.cct ?? "",
5593
+ onChange: (e) => setIopField("right_eye", "cct", e.target.value)
5594
+ }
5595
+ ) }),
5596
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5597
+ Input,
5598
+ {
5599
+ disabled,
5600
+ type: "number",
5601
+ className: numberInputClass,
5602
+ value: safe.iop_pachy_cct.left_eye.iop ?? "",
5603
+ onChange: (e) => setIopField("left_eye", "iop", e.target.value)
5604
+ }
5605
+ ) }),
5606
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5607
+ Input,
5608
+ {
5609
+ disabled,
5610
+ type: "number",
5611
+ className: numberInputClass,
5612
+ value: safe.iop_pachy_cct.left_eye.cct ?? "",
5613
+ onChange: (e) => setIopField("left_eye", "cct", e.target.value)
5614
+ }
5615
+ ) })
5616
+ ] }) })
5617
+ ] })
5618
+ ] })
5619
+ ] }),
5620
+ /* @__PURE__ */ jsxRuntime.jsxs("section", { className: sectionWrapperClass, children: [
5621
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Refraction (Distance)" }) }),
5622
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: tableBaseClass, children: [
5623
+ /* @__PURE__ */ jsxRuntime.jsxs("thead", { children: [
5624
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
5625
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
5626
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Right Eye" }),
5627
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Left Eye" })
5628
+ ] }),
5629
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
5630
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
5631
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5632
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5633
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5634
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
5635
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "P/D" }),
5636
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5637
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5638
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5639
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
5640
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "P/D" })
5641
+ ] })
5642
+ ] }),
5643
+ /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
5644
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
5645
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Distance" }),
5646
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5647
+ Input,
5648
+ {
5649
+ disabled,
5650
+ type: "number",
5651
+ step: "0.25",
5652
+ className: numberInputClass,
5653
+ value: safe.refraction.right_eye.sph ?? "",
5654
+ onChange: (e) => setRefractionField(
5655
+ "refraction",
5656
+ "right_eye",
5657
+ "sph",
5658
+ e.target.value,
5659
+ "float"
5660
+ )
5661
+ }
5662
+ ) }),
5663
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5664
+ Input,
5665
+ {
5666
+ disabled,
5667
+ type: "number",
5668
+ step: "0.25",
5669
+ className: numberInputClass,
5670
+ value: safe.refraction.right_eye.cyl ?? "",
5671
+ onChange: (e) => setRefractionField(
5672
+ "refraction",
5673
+ "right_eye",
5674
+ "cyl",
5675
+ e.target.value,
5676
+ "float"
5677
+ )
5678
+ }
5679
+ ) }),
5680
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5681
+ Input,
5682
+ {
5683
+ disabled,
5684
+ type: "number",
5685
+ className: numberInputClass,
5686
+ value: safe.refraction.right_eye.axis ?? "",
5687
+ onChange: (e) => setRefractionField(
5688
+ "refraction",
5689
+ "right_eye",
5690
+ "axis",
5691
+ e.target.value,
5692
+ "int"
5693
+ )
5694
+ }
5695
+ ) }),
5696
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5697
+ "select",
5698
+ {
5699
+ disabled,
5700
+ className: selectClass,
5701
+ value: safe.refraction.right_eye.va,
5702
+ onChange: (e) => setRefractionField(
5703
+ "refraction",
5704
+ "right_eye",
5705
+ "va",
5706
+ e.target.value,
5707
+ "select"
5708
+ ),
5709
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
5710
+ }
5711
+ ) }),
5712
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5713
+ Input,
5714
+ {
5715
+ disabled,
5716
+ type: "number",
5717
+ min: 10,
5718
+ max: 45,
5719
+ step: "1",
5720
+ className: numberInputClass,
5721
+ value: safe.refraction.right_eye.pd ?? "",
5722
+ onChange: (e) => setRefractionField("refraction", "right_eye", "pd", e.target.value, "int")
5723
+ }
5724
+ ) }),
5725
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5726
+ Input,
5727
+ {
5728
+ disabled,
5729
+ type: "number",
5730
+ step: "0.25",
5731
+ className: numberInputClass,
5732
+ value: safe.refraction.left_eye.sph ?? "",
5733
+ onChange: (e) => setRefractionField(
5734
+ "refraction",
5735
+ "left_eye",
5736
+ "sph",
5737
+ e.target.value,
5738
+ "float"
5739
+ )
5740
+ }
5741
+ ) }),
5742
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5743
+ Input,
5744
+ {
5745
+ disabled,
5746
+ type: "number",
5747
+ step: "0.25",
5748
+ className: numberInputClass,
5749
+ value: safe.refraction.left_eye.cyl ?? "",
5750
+ onChange: (e) => setRefractionField(
5751
+ "refraction",
5752
+ "left_eye",
5753
+ "cyl",
5754
+ e.target.value,
5755
+ "float"
5756
+ )
5757
+ }
5758
+ ) }),
5759
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5760
+ Input,
5761
+ {
5762
+ disabled,
5763
+ type: "number",
5764
+ className: numberInputClass,
5765
+ value: safe.refraction.left_eye.axis ?? "",
5766
+ onChange: (e) => setRefractionField(
5767
+ "refraction",
5768
+ "left_eye",
5769
+ "axis",
5770
+ e.target.value,
5771
+ "int"
5772
+ )
5773
+ }
5774
+ ) }),
5775
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5776
+ "select",
5777
+ {
5778
+ disabled,
5779
+ className: selectClass,
5780
+ value: safe.refraction.left_eye.va,
5781
+ onChange: (e) => setRefractionField(
5782
+ "refraction",
5783
+ "left_eye",
5784
+ "va",
5785
+ e.target.value,
5786
+ "select"
5787
+ ),
5788
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
5789
+ }
5790
+ ) }),
5791
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5792
+ Input,
5793
+ {
5794
+ disabled,
5795
+ type: "number",
5796
+ min: 10,
5797
+ max: 45,
5798
+ step: "1",
5799
+ className: numberInputClass,
5800
+ value: safe.refraction.left_eye.pd ?? "",
5801
+ onChange: (e) => setRefractionField("refraction", "left_eye", "pd", e.target.value, "int")
5802
+ }
5803
+ ) })
5804
+ ] }),
5805
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
5806
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Add" }),
5807
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
5808
+ Input,
5809
+ {
5810
+ disabled,
5811
+ type: "number",
5812
+ step: "0.25",
5813
+ className: numberInputClass,
5814
+ value: safe.refraction.add.right ?? "",
5815
+ onChange: (e) => setRefractionAdd("refraction", "right", e.target.value)
5816
+ }
5817
+ ) }),
5818
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
5819
+ Input,
5820
+ {
5821
+ disabled,
5822
+ type: "number",
5823
+ step: "0.25",
5824
+ className: numberInputClass,
5825
+ value: safe.refraction.add.left ?? "",
5826
+ onChange: (e) => setRefractionAdd("refraction", "left", e.target.value)
5827
+ }
5828
+ ) })
5829
+ ] })
5830
+ ] })
5831
+ ] }) })
5832
+ ] }),
5833
+ /* @__PURE__ */ jsxRuntime.jsxs("section", { className: sectionWrapperClass, children: [
5834
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Dilated Refraction" }) }),
5835
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: tableBaseClass, children: [
5836
+ /* @__PURE__ */ jsxRuntime.jsxs("thead", { children: [
5837
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
5838
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
5839
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Right Eye" }),
5840
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Left Eye" })
5841
+ ] }),
5842
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
5843
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
5844
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5845
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5846
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5847
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Prism" }),
5848
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
5849
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5850
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5851
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5852
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Prism" }),
5853
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "V/A" })
5854
+ ] })
5855
+ ] }),
5856
+ /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
5857
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
5858
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Dilated" }),
5859
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5860
+ Input,
5861
+ {
5862
+ disabled,
5863
+ type: "number",
5864
+ step: "0.25",
5865
+ className: numberInputClass,
5866
+ value: safe.dilated_refraction.right_eye.sph ?? "",
5867
+ onChange: (e) => setRefractionField(
5868
+ "dilated_refraction",
5869
+ "right_eye",
5870
+ "sph",
5871
+ e.target.value,
5872
+ "float"
5873
+ )
5874
+ }
5875
+ ) }),
5876
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5877
+ Input,
5878
+ {
5879
+ disabled,
5880
+ type: "number",
5881
+ step: "0.25",
5882
+ className: numberInputClass,
5883
+ value: safe.dilated_refraction.right_eye.cyl ?? "",
5884
+ onChange: (e) => setRefractionField(
5885
+ "dilated_refraction",
5886
+ "right_eye",
5887
+ "cyl",
5888
+ e.target.value,
5889
+ "float"
5890
+ )
5891
+ }
5892
+ ) }),
5893
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5894
+ Input,
5895
+ {
5896
+ disabled,
5897
+ type: "number",
5898
+ className: numberInputClass,
5899
+ value: safe.dilated_refraction.right_eye.axis ?? "",
5900
+ onChange: (e) => setRefractionField(
5901
+ "dilated_refraction",
5902
+ "right_eye",
5903
+ "axis",
5904
+ e.target.value,
5905
+ "int"
5906
+ )
5907
+ }
5908
+ ) }),
5909
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5910
+ Input,
5911
+ {
5912
+ disabled,
5913
+ type: "number",
5914
+ step: "0.25",
5915
+ className: numberInputClass,
5916
+ value: safe.dilated_refraction.right_eye.prism ?? "",
5917
+ onChange: (e) => setRefractionField(
5918
+ "dilated_refraction",
5919
+ "right_eye",
5920
+ "prism",
5921
+ e.target.value,
5922
+ "float"
5923
+ )
5924
+ }
5925
+ ) }),
5926
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5927
+ "select",
5928
+ {
5929
+ disabled,
5930
+ className: selectClass,
5931
+ value: safe.dilated_refraction.right_eye.va,
5932
+ onChange: (e) => setRefractionField(
5933
+ "dilated_refraction",
5934
+ "right_eye",
5935
+ "va",
5936
+ e.target.value,
5937
+ "select"
5938
+ ),
5939
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
5940
+ }
5941
+ ) }),
5942
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5943
+ Input,
5944
+ {
5945
+ disabled,
5946
+ type: "number",
5947
+ step: "0.25",
5948
+ className: numberInputClass,
5949
+ value: safe.dilated_refraction.left_eye.sph ?? "",
5950
+ onChange: (e) => setRefractionField(
5951
+ "dilated_refraction",
5952
+ "left_eye",
5953
+ "sph",
5954
+ e.target.value,
5955
+ "float"
5956
+ )
5957
+ }
5958
+ ) }),
5959
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5960
+ Input,
5961
+ {
5962
+ disabled,
5963
+ type: "number",
5964
+ step: "0.25",
5965
+ className: numberInputClass,
5966
+ value: safe.dilated_refraction.left_eye.cyl ?? "",
5967
+ onChange: (e) => setRefractionField(
5968
+ "dilated_refraction",
5969
+ "left_eye",
5970
+ "cyl",
5971
+ e.target.value,
5972
+ "float"
5973
+ )
5974
+ }
5975
+ ) }),
5976
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5977
+ Input,
5978
+ {
5979
+ disabled,
5980
+ type: "number",
5981
+ className: numberInputClass,
5982
+ value: safe.dilated_refraction.left_eye.axis ?? "",
5983
+ onChange: (e) => setRefractionField(
5984
+ "dilated_refraction",
5985
+ "left_eye",
5986
+ "axis",
5987
+ e.target.value,
5988
+ "int"
5989
+ )
5990
+ }
5991
+ ) }),
5992
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
5993
+ Input,
5994
+ {
5995
+ disabled,
5996
+ type: "number",
5997
+ step: "0.25",
5998
+ className: numberInputClass,
5999
+ value: safe.dilated_refraction.left_eye.prism ?? "",
6000
+ onChange: (e) => setRefractionField(
6001
+ "dilated_refraction",
6002
+ "left_eye",
6003
+ "prism",
6004
+ e.target.value,
6005
+ "float"
6006
+ )
6007
+ }
6008
+ ) }),
6009
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6010
+ "select",
6011
+ {
6012
+ disabled,
6013
+ className: selectClass,
6014
+ value: safe.dilated_refraction.left_eye.va,
6015
+ onChange: (e) => setRefractionField(
6016
+ "dilated_refraction",
6017
+ "left_eye",
6018
+ "va",
6019
+ e.target.value,
6020
+ "select"
6021
+ ),
6022
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
6023
+ }
6024
+ ) })
6025
+ ] }),
6026
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6027
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Add" }),
6028
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
6029
+ Input,
6030
+ {
6031
+ disabled,
6032
+ type: "number",
6033
+ step: "0.25",
6034
+ className: numberInputClass,
6035
+ value: safe.dilated_refraction.add.right ?? "",
6036
+ onChange: (e) => setRefractionAdd("dilated_refraction", "right", e.target.value)
6037
+ }
6038
+ ) }),
6039
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
6040
+ Input,
6041
+ {
6042
+ disabled,
6043
+ type: "number",
6044
+ step: "0.25",
6045
+ className: numberInputClass,
6046
+ value: safe.dilated_refraction.add.left ?? "",
6047
+ onChange: (e) => setRefractionAdd("dilated_refraction", "left", e.target.value)
6048
+ }
6049
+ ) })
6050
+ ] })
6051
+ ] })
6052
+ ] }) })
6053
+ ] }),
6054
+ /* @__PURE__ */ jsxRuntime.jsxs("section", { className: sectionWrapperClass, children: [
6055
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Glass Power Prescription" }) }),
6056
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: tableBaseClass, children: [
6057
+ /* @__PURE__ */ jsxRuntime.jsxs("thead", { children: [
6058
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6059
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
6060
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Right Eye" }),
6061
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Left Eye" })
6062
+ ] }),
6063
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6064
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass }),
6065
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
6066
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
6067
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
6068
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Prism" }),
6069
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
6070
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
6071
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
6072
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
6073
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "Prism" }),
6074
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: tableHeaderCellClass, children: "V/A" })
6075
+ ] })
6076
+ ] }),
6077
+ /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
6078
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6079
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Glass Power" }),
6080
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6081
+ Input,
6082
+ {
6083
+ disabled,
6084
+ type: "number",
6085
+ step: "0.25",
6086
+ className: numberInputClass,
6087
+ value: safe.glass_power_prescription.right_eye.sph ?? "",
6088
+ onChange: (e) => setRefractionField(
6089
+ "glass_power_prescription",
6090
+ "right_eye",
6091
+ "sph",
6092
+ e.target.value,
6093
+ "float"
6094
+ )
6095
+ }
6096
+ ) }),
6097
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6098
+ Input,
6099
+ {
6100
+ disabled,
6101
+ type: "number",
6102
+ step: "0.25",
6103
+ className: numberInputClass,
6104
+ value: safe.glass_power_prescription.right_eye.cyl ?? "",
6105
+ onChange: (e) => setRefractionField(
6106
+ "glass_power_prescription",
6107
+ "right_eye",
6108
+ "cyl",
6109
+ e.target.value,
6110
+ "float"
6111
+ )
6112
+ }
6113
+ ) }),
6114
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6115
+ Input,
6116
+ {
6117
+ disabled,
6118
+ type: "number",
6119
+ className: numberInputClass,
6120
+ value: safe.glass_power_prescription.right_eye.axis ?? "",
6121
+ onChange: (e) => setRefractionField(
6122
+ "glass_power_prescription",
6123
+ "right_eye",
6124
+ "axis",
6125
+ e.target.value,
6126
+ "int"
6127
+ )
6128
+ }
6129
+ ) }),
6130
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6131
+ Input,
6132
+ {
6133
+ disabled,
6134
+ type: "number",
6135
+ step: "0.25",
6136
+ className: numberInputClass,
6137
+ value: safe.glass_power_prescription.right_eye.prism ?? "",
6138
+ onChange: (e) => setRefractionField(
6139
+ "glass_power_prescription",
6140
+ "right_eye",
6141
+ "prism",
6142
+ e.target.value,
6143
+ "float"
6144
+ )
6145
+ }
6146
+ ) }),
6147
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6148
+ "select",
6149
+ {
6150
+ disabled,
6151
+ className: selectClass,
6152
+ value: safe.glass_power_prescription.right_eye.va,
6153
+ onChange: (e) => setRefractionField(
6154
+ "glass_power_prescription",
6155
+ "right_eye",
6156
+ "va",
6157
+ e.target.value,
6158
+ "select"
6159
+ ),
6160
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
6161
+ }
6162
+ ) }),
6163
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6164
+ Input,
6165
+ {
6166
+ disabled,
6167
+ type: "number",
6168
+ step: "0.25",
6169
+ className: numberInputClass,
6170
+ value: safe.glass_power_prescription.left_eye.sph ?? "",
6171
+ onChange: (e) => setRefractionField(
6172
+ "glass_power_prescription",
6173
+ "left_eye",
6174
+ "sph",
6175
+ e.target.value,
6176
+ "float"
6177
+ )
6178
+ }
6179
+ ) }),
6180
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6181
+ Input,
6182
+ {
6183
+ disabled,
6184
+ type: "number",
6185
+ step: "0.25",
6186
+ className: numberInputClass,
6187
+ value: safe.glass_power_prescription.left_eye.cyl ?? "",
6188
+ onChange: (e) => setRefractionField(
6189
+ "glass_power_prescription",
6190
+ "left_eye",
6191
+ "cyl",
6192
+ e.target.value,
6193
+ "float"
6194
+ )
6195
+ }
6196
+ ) }),
6197
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6198
+ Input,
6199
+ {
6200
+ disabled,
6201
+ type: "number",
6202
+ className: numberInputClass,
6203
+ value: safe.glass_power_prescription.left_eye.axis ?? "",
6204
+ onChange: (e) => setRefractionField(
6205
+ "glass_power_prescription",
6206
+ "left_eye",
6207
+ "axis",
6208
+ e.target.value,
6209
+ "int"
6210
+ )
6211
+ }
6212
+ ) }),
6213
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6214
+ Input,
6215
+ {
6216
+ disabled,
6217
+ type: "number",
6218
+ step: "0.25",
6219
+ className: numberInputClass,
6220
+ value: safe.glass_power_prescription.left_eye.prism ?? "",
6221
+ onChange: (e) => setRefractionField(
6222
+ "glass_power_prescription",
6223
+ "left_eye",
6224
+ "prism",
6225
+ e.target.value,
6226
+ "float"
6227
+ )
6228
+ }
6229
+ ) }),
6230
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6231
+ "select",
6232
+ {
6233
+ disabled,
6234
+ className: selectClass,
6235
+ value: safe.glass_power_prescription.left_eye.va,
6236
+ onChange: (e) => setRefractionField(
6237
+ "glass_power_prescription",
6238
+ "left_eye",
6239
+ "va",
6240
+ e.target.value,
6241
+ "select"
6242
+ ),
6243
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt || "blank"))
6244
+ }
6245
+ ) })
6246
+ ] }),
6247
+ /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6248
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Add" }),
6249
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
6250
+ Input,
6251
+ {
6252
+ disabled,
6253
+ type: "number",
6254
+ step: "0.25",
6255
+ className: numberInputClass,
6256
+ value: safe.glass_power_prescription.add.right ?? "",
6257
+ onChange: (e) => setRefractionAdd("glass_power_prescription", "right", e.target.value)
6258
+ }
6259
+ ) }),
6260
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
6261
+ Input,
6262
+ {
6263
+ disabled,
6264
+ type: "number",
6265
+ step: "0.25",
6266
+ className: numberInputClass,
6267
+ value: safe.glass_power_prescription.add.left ?? "",
6268
+ onChange: (e) => setRefractionAdd("glass_power_prescription", "left", e.target.value)
6269
+ }
6270
+ ) })
6271
+ ] })
6272
+ ] })
6273
+ ] }) })
6274
+ ] }),
6275
+ /* @__PURE__ */ jsxRuntime.jsxs("section", { className: sectionWrapperClass, children: [
6276
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Notes" }) }),
6277
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6278
+ Textarea,
6279
+ {
6280
+ disabled,
6281
+ rows: 4,
6282
+ className: "w-full text-xs min-h-[100px]",
6283
+ placeholder: "Enter additional notes...",
6284
+ value: safe.notes,
6285
+ onChange: (e) => setNotes(e.target.value)
6286
+ }
6287
+ ) })
6288
+ ] })
6289
+ ] });
6290
+ };
6291
+ var DIAGNOSIS_FIELDS = [
6292
+ "INJURY",
6293
+ "APPENDAGES",
6294
+ "CONJUNCTIVA",
6295
+ "SCLERA",
6296
+ "CORNEA",
6297
+ "ANTERIOR CHAMBER (AC)",
6298
+ "PUPIL",
6299
+ "IRIS",
6300
+ "LENS",
6301
+ "EXTRAOCULAR MOVEMENTS & SQUINT",
6302
+ "INTRAOCULAR PRESSURE (IOP)",
6303
+ "GONIOSCOPY",
6304
+ "FUNDUS"
6305
+ ];
6306
+ function ensureValue2(raw) {
6307
+ const v = raw || {};
6308
+ return {
6309
+ right_eye: v.right_eye ?? {},
6310
+ left_eye: v.left_eye ?? {}
6311
+ };
6312
+ }
6313
+ var containerClass = "rounded-md bg-white overflow-hidden flex flex-col";
6314
+ var headerClass = "px-3 py-2 text-sm font-medium text-slate-800 border-b border-slate-200";
6315
+ var tableClass = "w-full text-xs";
6316
+ var headerCellClass = "border border-slate-200 px-2 py-1 text-center font-semibold align-middle";
6317
+ var cellClass = "border border-slate-200 px-2 py-1 align-top";
6318
+ var OphthalDiagnosisWidget = ({ fieldId }) => {
6319
+ const { fieldDef, value, setValue, disabled } = useField(fieldId);
6320
+ const safe = React11.useMemo(() => ensureValue2(value), [value]);
6321
+ const label = fieldDef?.label || "";
6322
+ const updateEyeField = (eye, fieldLabel, next) => {
6323
+ if (disabled) return;
6324
+ const prev = ensureValue2(value);
6325
+ setValue({
6326
+ ...prev,
6327
+ [eye]: {
6328
+ ...prev[eye],
6329
+ [fieldLabel]: next
6330
+ }
6331
+ });
6332
+ };
6333
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-2", disabled && "opacity-70 pointer-events-none"), children: [
6334
+ label && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-base font-semibold text-slate-800", children: label }),
6335
+ /* @__PURE__ */ jsxRuntime.jsxs("section", { className: containerClass, children: [
6336
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: headerClass, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: "Diagnosis" }) }),
6337
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: tableClass, children: [
6338
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6339
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: cn(headerCellClass, "text-left px-3"), children: "Field" }),
6340
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: headerCellClass, children: "Right Eye" }),
6341
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: headerCellClass, children: "Left Eye" })
6342
+ ] }) }),
6343
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: DIAGNOSIS_FIELDS.map((fieldLabel) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
6344
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(cellClass, "text-left font-semibold px-3"), children: fieldLabel }),
6345
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: cellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6346
+ Textarea,
6347
+ {
6348
+ disabled,
6349
+ rows: 2,
6350
+ className: "w-full text-xs min-h-[60px] resize-none",
6351
+ value: safe.right_eye[fieldLabel] ?? "",
6352
+ onChange: (e) => updateEyeField("right_eye", fieldLabel, e.target.value)
6353
+ }
6354
+ ) }),
6355
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: cellClass, children: /* @__PURE__ */ jsxRuntime.jsx(
6356
+ Textarea,
6357
+ {
6358
+ disabled,
6359
+ rows: 2,
6360
+ className: "w-full text-xs min-h-[60px] resize-none",
6361
+ value: safe.left_eye[fieldLabel] ?? "",
6362
+ onChange: (e) => updateEyeField("left_eye", fieldLabel, e.target.value)
6363
+ }
6364
+ ) })
6365
+ ] }, fieldLabel)) })
6366
+ ] }) })
6367
+ ] })
6368
+ ] });
6369
+ };
5013
6370
  var FieldRenderer = ({ fieldId }) => {
5014
6371
  const { fieldDef, visible } = useField(fieldId);
5015
6372
  if (!visible || !fieldDef) {
@@ -5060,6 +6417,10 @@ var FieldRenderer = ({ fieldId }) => {
5060
6417
  return /* @__PURE__ */ jsxRuntime.jsx(SmartTextareaWidget, { fieldId });
5061
6418
  case "obstetric_history":
5062
6419
  return /* @__PURE__ */ jsxRuntime.jsx(ObstetricHistoryWidget, { fieldId });
6420
+ case "eye_prescription":
6421
+ return /* @__PURE__ */ jsxRuntime.jsx(OphthalmologyWidget, { fieldId });
6422
+ case "ophthal_diagnosis":
6423
+ return /* @__PURE__ */ jsxRuntime.jsx(OphthalDiagnosisWidget, { fieldId });
5063
6424
  case "static_text": {
5064
6425
  const def = fieldDef;
5065
6426
  const size = def.size ?? "regular";