@eka-care/medical-records-ui 1.2.28 → 1.2.30

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.js CHANGED
@@ -2238,6 +2238,7 @@ function labResultRow(obs) {
2238
2238
  unit: _nullishCoalesce(quantityUnit(obs.valueQuantity), () => ( "")),
2239
2239
  reference_range: referenceRangeText(obs),
2240
2240
  out_of_range: _nullishCoalesce(_nullishCoalesce(INTERPRETATION[code], () => ( conceptDisplay(interpretation))), () => ( "")),
2241
+ remark: _nullishCoalesce(noteText(obs.note), () => ( "")),
2241
2242
  ...date ? { date } : {},
2242
2243
  ...entityCodes(obs.code)
2243
2244
  };
@@ -2406,21 +2407,22 @@ function labInvestigationRow(sr) {
2406
2407
  const investigation = conceptDisplay(sr.code);
2407
2408
  if (!investigation) return null;
2408
2409
  const codes = entityCodes(sr.code);
2409
- const [testOn, repeatOn] = _nullishCoalesce(_optionalChain([sr, 'access', _191 => _191.occurrenceTiming, 'optionalAccess', _192 => _192.event]), () => ( []));
2410
+ const [timingTestOn, repeatOn] = _nullishCoalesce(_optionalChain([sr, 'access', _191 => _191.occurrenceTiming, 'optionalAccess', _192 => _192.event]), () => ( []));
2411
+ const testOn = _nullishCoalesce(_nullishCoalesce(timingTestOn, () => ( sr.occurrenceDateTime)), () => ( _optionalChain([sr, 'access', _193 => _193.occurrencePeriod, 'optionalAccess', _194 => _194.start])));
2410
2412
  return { investigation, investigationId: codes.eka_code, ekaId: codes.eka_code, ...codes, test_on: _nullishCoalesce(isoToDisplayDate(testOn), () => ( "")), repeat_on: _nullishCoalesce(isoToDisplayDate(repeatOn), () => ( "")), remarks: _nullishCoalesce(noteText(sr.note), () => ( "")) };
2411
2413
  }
2412
2414
  function procedureRow(sr) {
2413
2415
  const procedure_name = conceptDisplay(sr.code);
2414
2416
  if (!procedure_name) return null;
2415
- const date = isoToDisplayDate(_nullishCoalesce(_nullishCoalesce(sr.occurrenceDateTime, () => ( _optionalChain([sr, 'access', _193 => _193.occurrenceTiming, 'optionalAccess', _194 => _194.event, 'optionalAccess', _195 => _195[0]]))), () => ( _optionalChain([sr, 'access', _196 => _196.occurrencePeriod, 'optionalAccess', _197 => _197.start]))));
2417
+ const date = isoToDisplayDate(_nullishCoalesce(_nullishCoalesce(sr.occurrenceDateTime, () => ( _optionalChain([sr, 'access', _195 => _195.occurrenceTiming, 'optionalAccess', _196 => _196.event, 'optionalAccess', _197 => _197[0]]))), () => ( _optionalChain([sr, 'access', _198 => _198.occurrencePeriod, 'optionalAccess', _199 => _199.start]))));
2416
2418
  return { procedure_name, timing: "", note: _nullishCoalesce(noteText(sr.note), () => ( "")), ...date ? { date } : {}, ...entityCodes(sr.code) };
2417
2419
  }
2418
2420
  function performerName(sr) {
2419
- const performer = _optionalChain([sr, 'access', _198 => _198.performer, 'optionalAccess', _199 => _199.find, 'call', _200 => _200((p) => _optionalChain([p, 'optionalAccess', _201 => _201.display, 'optionalAccess', _202 => _202.trim, 'call', _203 => _203()]) && (!p.reference || p.reference.startsWith("Practitioner/")))]);
2420
- return _optionalChain([performer, 'optionalAccess', _204 => _204.display, 'optionalAccess', _205 => _205.trim, 'call', _206 => _206()]) || null;
2421
+ const performer = _optionalChain([sr, 'access', _200 => _200.performer, 'optionalAccess', _201 => _201.find, 'call', _202 => _202((p) => _optionalChain([p, 'optionalAccess', _203 => _203.display, 'optionalAccess', _204 => _204.trim, 'call', _205 => _205()]) && (!p.reference || p.reference.startsWith("Practitioner/")))]);
2422
+ return _optionalChain([performer, 'optionalAccess', _206 => _206.display, 'optionalAccess', _207 => _207.trim, 'call', _208 => _208()]) || null;
2421
2423
  }
2422
2424
  function referralRow(sr) {
2423
- const referred_to = _optionalChain([sr, 'access', _207 => _207.code, 'optionalAccess', _208 => _208.text, 'optionalAccess', _209 => _209.trim, 'call', _210 => _210()]) || conceptDisplay(sr.code) || performerName(sr);
2425
+ const referred_to = _optionalChain([sr, 'access', _209 => _209.code, 'optionalAccess', _210 => _210.text, 'optionalAccess', _211 => _211.trim, 'call', _212 => _212()]) || conceptDisplay(sr.code) || performerName(sr);
2424
2426
  if (!referred_to) return null;
2425
2427
  return { referred_to, specialty: "", phone: "", hospital: "", notes: _nullishCoalesce(noteText(sr.note), () => ( "")), ...entityCodes(sr.code) };
2426
2428
  }
@@ -2447,16 +2449,16 @@ function durationText(repeat) {
2447
2449
  function frequencyText(dosage) {
2448
2450
  const written = Array.isArray(dosage.additionalInstruction) ? conceptDisplay(dosage.additionalInstruction[0]) : null;
2449
2451
  if (written) return written;
2450
- const f = _optionalChain([dosage, 'access', _211 => _211.timing, 'optionalAccess', _212 => _212.repeat, 'optionalAccess', _213 => _213.frequency]);
2452
+ const f = _optionalChain([dosage, 'access', _213 => _213.timing, 'optionalAccess', _214 => _214.repeat, 'optionalAccess', _215 => _215.frequency]);
2451
2453
  return typeof f === "number" ? `${f} time${f === 1 ? "" : "s"} a day` : "";
2452
2454
  }
2453
2455
  function dosageColumns(dosage) {
2454
- const doseQuantity = Array.isArray(dosage.doseAndRate) ? _optionalChain([dosage, 'access', _214 => _214.doseAndRate, 'access', _215 => _215[0], 'optionalAccess', _216 => _216.doseQuantity]) : void 0;
2456
+ const doseQuantity = Array.isArray(dosage.doseAndRate) ? _optionalChain([dosage, 'access', _216 => _216.doseAndRate, 'access', _217 => _217[0], 'optionalAccess', _218 => _218.doseQuantity]) : void 0;
2455
2457
  return {
2456
2458
  dosage: _nullishCoalesce(quantityText(doseQuantity), () => ( "")),
2457
2459
  frequency: frequencyText(dosage),
2458
- timing: _nullishCoalesce(conceptDisplay(_optionalChain([dosage, 'access', _217 => _217.timing, 'optionalAccess', _218 => _218.code])), () => ( "")),
2459
- duration: durationText(_optionalChain([dosage, 'access', _219 => _219.timing, 'optionalAccess', _220 => _220.repeat])),
2460
+ timing: _nullishCoalesce(conceptDisplay(_optionalChain([dosage, 'access', _219 => _219.timing, 'optionalAccess', _220 => _220.code])), () => ( "")),
2461
+ duration: durationText(_optionalChain([dosage, 'access', _221 => _221.timing, 'optionalAccess', _222 => _222.repeat])),
2460
2462
  route: _nullishCoalesce(conceptDisplay(dosage.route), () => ( ""))
2461
2463
  };
2462
2464
  }
@@ -2466,10 +2468,10 @@ function medicationRow(mr) {
2466
2468
  const dosage = Array.isArray(mr.dosageInstruction) ? _nullishCoalesce(mr.dosageInstruction[0], () => ( {})) : {};
2467
2469
  return {
2468
2470
  drug_name,
2469
- medication_id: _nullishCoalesce(_nullishCoalesce(ekaCode(mr.medicationCodeableConcept), () => ( _optionalChain([codings, 'call', _221 => _221(mr.medicationCodeableConcept), 'access', _222 => _222[0], 'optionalAccess', _223 => _223.code]))), () => ( "")),
2471
+ medication_id: _nullishCoalesce(_nullishCoalesce(ekaCode(mr.medicationCodeableConcept), () => ( _optionalChain([codings, 'call', _223 => _223(mr.medicationCodeableConcept), 'access', _224 => _224[0], 'optionalAccess', _225 => _225.code]))), () => ( "")),
2470
2472
  ...entityCodes(mr.medicationCodeableConcept),
2471
2473
  ...dosageColumns(dosage),
2472
- quantity: _nullishCoalesce(quantityText(_optionalChain([mr, 'access', _224 => _224.dispenseRequest, 'optionalAccess', _225 => _225.quantity])), () => ( "")),
2474
+ quantity: _nullishCoalesce(quantityText(_optionalChain([mr, 'access', _226 => _226.dispenseRequest, 'optionalAccess', _227 => _227.quantity])), () => ( "")),
2473
2475
  notes: (_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(dosage.text, () => ( dosage.patientInstruction)), () => ( noteText(mr.note))), () => ( ""))).trim()
2474
2476
  };
2475
2477
  }
@@ -2480,7 +2482,7 @@ function currentMedicationRow(ms) {
2480
2482
  const columns = dosageColumns(dosage);
2481
2483
  return {
2482
2484
  drug_name,
2483
- medication_id: _nullishCoalesce(_nullishCoalesce(ekaCode(ms.medicationCodeableConcept), () => ( _optionalChain([codings, 'call', _226 => _226(ms.medicationCodeableConcept), 'access', _227 => _227[0], 'optionalAccess', _228 => _228.code]))), () => ( "")),
2485
+ medication_id: _nullishCoalesce(_nullishCoalesce(ekaCode(ms.medicationCodeableConcept), () => ( _optionalChain([codings, 'call', _228 => _228(ms.medicationCodeableConcept), 'access', _229 => _229[0], 'optionalAccess', _230 => _230.code]))), () => ( "")),
2484
2486
  ...entityCodes(ms.medicationCodeableConcept),
2485
2487
  ...columns,
2486
2488
  frequency: columns.frequency || (_nullishCoalesce(dosage.text, () => ( ""))).trim(),
@@ -2492,7 +2494,7 @@ function currentMedicationRow(ms) {
2492
2494
  // src/prescription/mappers/follow-up.ts
2493
2495
  var DAY_MS = 864e5;
2494
2496
  function followUpPayload(appt, visitDate) {
2495
- const date = (_nullishCoalesce(_nullishCoalesce(appt.start, () => ( _optionalChain([appt, 'access', _229 => _229.requestedPeriod, 'optionalAccess', _230 => _230[0], 'optionalAccess', _231 => _231.start]))), () => ( ""))).trim();
2497
+ const date = (_nullishCoalesce(_nullishCoalesce(appt.start, () => ( _optionalChain([appt, 'access', _231 => _231.requestedPeriod, 'optionalAccess', _232 => _232[0], 'optionalAccess', _233 => _233.start]))), () => ( ""))).trim();
2496
2498
  if (!date) return null;
2497
2499
  const written = (_nullishCoalesce(appt.description, () => ( ""))).trim();
2498
2500
  let interval = written && written !== date ? written : "";
@@ -2591,6 +2593,9 @@ function foldedRow(target, key, value) {
2591
2593
  function withDateColumn(headers, rows) {
2592
2594
  return rows.some((r) => r.date) ? [...headers, col("date", "Date")] : headers;
2593
2595
  }
2596
+ function withRemarkColumn(headers, rows) {
2597
+ return rows.some((r) => r.remark) ? [...headers, col("remark", "Remark")] : headers;
2598
+ }
2594
2599
  function diagnosisHeaders(rows) {
2595
2600
  return [col("diagnosis", "Diagnosis"), col("status", "Status"), ...DIAGNOSIS_OPTIONAL.filter((c) => rows.some((r) => r[c.key]))];
2596
2601
  }
@@ -2609,7 +2614,7 @@ function unmappedReason(r) {
2609
2614
  case "CarePlan":
2610
2615
  return `CarePlan has no recognised category or intent (${categoryTexts(r.category).join(", ") || "none"})`;
2611
2616
  case "Appointment": {
2612
- const type = _nullishCoalesce(_optionalChain([codings, 'call', _232 => _232(r.appointmentType), 'access', _233 => _233[0], 'optionalAccess', _234 => _234.code]), () => ( "none"));
2617
+ const type = _nullishCoalesce(_optionalChain([codings, 'call', _234 => _234(r.appointmentType), 'access', _235 => _235[0], 'optionalAccess', _236 => _236.code]), () => ( "none"));
2613
2618
  return `Appointment type "${type}" is not a follow-up`;
2614
2619
  }
2615
2620
  default:
@@ -2618,8 +2623,8 @@ function unmappedReason(r) {
2618
2623
  }
2619
2624
  function convertPrescriptionBundle(bundle, options = {}) {
2620
2625
  const showCustomSections = _nullishCoalesce(options.showCustomSections, () => ( SHOW_CUSTOM_SECTIONS));
2621
- const entries = Array.isArray(_optionalChain([bundle, 'optionalAccess', _235 => _235.entry])) ? bundle.entry : [];
2622
- const resources = entries.map((e) => _optionalChain([e, 'optionalAccess', _236 => _236.resource])).filter((r) => !!r && typeof r === "object" && typeof r.resourceType === "string").map(stripHtmlDeep);
2626
+ const entries = Array.isArray(_optionalChain([bundle, 'optionalAccess', _237 => _237.entry])) ? bundle.entry : [];
2627
+ const resources = entries.map((e) => _optionalChain([e, 'optionalAccess', _238 => _238.resource])).filter((r) => !!r && typeof r === "object" && typeof r.resourceType === "string").map(stripHtmlDeep);
2623
2628
  const header = buildHeader(resources);
2624
2629
  const sectionOf = compositionSectionMap(resources);
2625
2630
  const diagnostics = [];
@@ -2782,7 +2787,7 @@ function convertPrescriptionBundle(bundle, options = {}) {
2782
2787
  else order++;
2783
2788
  if (labInvestigations.length) add("lab_investigations", "Lab Investigations", "LAB_INVESTIGATIONS", { headers: LAB_HEADERS, rows: labInvestigations });
2784
2789
  else order++;
2785
- if (labResults.length) add("lab_results", "Lab Results", "LAB_RESULTS", { headers: withDateColumn(LAB_RESULT_HEADERS, labResults), rows: labResults });
2790
+ if (labResults.length) add("lab_results", "Lab Results", "LAB_RESULTS", { headers: withDateColumn(withRemarkColumn(LAB_RESULT_HEADERS, labResults), labResults), rows: labResults });
2786
2791
  else order++;
2787
2792
  if (procedures.length) add("procedures", "Procedures", "PROCEDURES", { headers: withDateColumn(PROCEDURE_HEADERS, procedures), rows: procedures });
2788
2793
  else order++;
@@ -2830,7 +2835,7 @@ function cellText(kind, key, value) {
2830
2835
  return value;
2831
2836
  }
2832
2837
  function visibleColumns(headers, rows) {
2833
- return headers.filter((h, i) => !HIDDEN_COLUMNS.has(h.key) && (i === 0 || rows.some((r) => _optionalChain([r, 'access', _237 => _237[h.key], 'optionalAccess', _238 => _238.trim, 'call', _239 => _239()]))));
2838
+ return headers.filter((h, i) => !HIDDEN_COLUMNS.has(h.key) && (i === 0 || rows.some((r) => _optionalChain([r, 'access', _239 => _239[h.key], 'optionalAccess', _240 => _240.trim, 'call', _241 => _241()]))));
2834
2839
  }
2835
2840
  var ALLERGIES_SECTION_KEY = "allergies";
2836
2841
  var ALLERGY_CATEGORY_COLUMN = "category";
@@ -2957,7 +2962,7 @@ function markdownToText(markdown) {
2957
2962
  function tableLines(section) {
2958
2963
  const payload = section.payload;
2959
2964
  const columns = visibleColumns(payload.headers, payload.rows);
2960
- const nameKey = _nullishCoalesce(_optionalChain([columns, 'access', _240 => _240[0], 'optionalAccess', _241 => _241.key]), () => ( ""));
2965
+ const nameKey = _nullishCoalesce(_optionalChain([columns, 'access', _242 => _242[0], 'optionalAccess', _243 => _243.key]), () => ( ""));
2961
2966
  return payload.rows.map((row) => {
2962
2967
  const name = cellText(section.kind, nameKey, _nullishCoalesce(row[nameKey], () => ( ""))).trim();
2963
2968
  const details = columns.slice(1).map((c) => ({ label: c.label, value: cellText(section.kind, c.key, _nullishCoalesce(row[c.key], () => ( ""))).trim() })).filter((d) => d.value).map((d) => `${d.label}: ${d.value}`);
@@ -3054,7 +3059,7 @@ function SectionFieldRows({ fields }) {
3054
3059
  var MIN_COLUMN_PX = 60;
3055
3060
  function SectionTable({ kind, payload }) {
3056
3061
  const columns = visibleColumns(payload.headers, payload.rows);
3057
- const nameKey = _nullishCoalesce(_optionalChain([columns, 'access', _242 => _242[0], 'optionalAccess', _243 => _243.key]), () => ( ""));
3062
+ const nameKey = _nullishCoalesce(_optionalChain([columns, 'access', _244 => _244[0], 'optionalAccess', _245 => _245.key]), () => ( ""));
3058
3063
  if (columns.length <= 1) {
3059
3064
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ol", { className: "mr-rx-list", children: payload.rows.map((r, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { children: _nullishCoalesce(r[nameKey], () => ( "")) }, i)) });
3060
3065
  }
@@ -3110,7 +3115,7 @@ function PrescriptionSectionBody({ section }) {
3110
3115
  case "LIST": {
3111
3116
  const payload = section.payload;
3112
3117
  if (payload.entries) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LineItemList, { entries: payload.entries });
3113
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ol", { className: "mr-rx-list", children: payload.items.map((item, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ListItemText, { item, lead: _optionalChain([payload, 'access', _244 => _244.leads, 'optionalAccess', _245 => _245[i]]), since: _optionalChain([payload, 'access', _246 => _246.since, 'optionalAccess', _247 => _247[i]]) }) }, i)) });
3118
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ol", { className: "mr-rx-list", children: payload.items.map((item, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ListItemText, { item, lead: _optionalChain([payload, 'access', _246 => _246.leads, 'optionalAccess', _247 => _247[i]]), since: _optionalChain([payload, 'access', _248 => _248.since, 'optionalAccess', _249 => _249[i]]) }) }, i)) });
3114
3119
  }
3115
3120
  case "KEY_VALUE":
3116
3121
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FieldRows, { fields: sectionFields(section) });
@@ -3136,14 +3141,14 @@ var PrescriptionSectionCard = _react.memo.call(void 0, function PrescriptionSect
3136
3141
  const copyResetRef = _react.useRef.call(void 0, void 0);
3137
3142
  _react.useEffect.call(void 0, () => () => clearTimeout(copyResetRef.current), []);
3138
3143
  const handleCardClick = _react.useCallback.call(void 0, () => {
3139
- if (_optionalChain([window, 'access', _248 => _248.getSelection, 'call', _249 => _249(), 'optionalAccess', _250 => _250.toString, 'call', _251 => _251()])) return;
3140
- _optionalChain([onToggle, 'optionalCall', _252 => _252(section.key)]);
3144
+ if (_optionalChain([window, 'access', _250 => _250.getSelection, 'call', _251 => _251(), 'optionalAccess', _252 => _252.toString, 'call', _253 => _253()])) return;
3145
+ _optionalChain([onToggle, 'optionalCall', _254 => _254(section.key)]);
3141
3146
  }, [onToggle, section.key]);
3142
3147
  const handleCheckKeyDown = _react.useCallback.call(void 0,
3143
3148
  (e) => {
3144
3149
  if (e.key !== " " && e.key !== "Enter") return;
3145
3150
  e.preventDefault();
3146
- _optionalChain([onToggle, 'optionalCall', _253 => _253(section.key)]);
3151
+ _optionalChain([onToggle, 'optionalCall', _255 => _255(section.key)]);
3147
3152
  },
3148
3153
  [onToggle, section.key]
3149
3154
  );
@@ -3267,7 +3272,7 @@ function PrescriptionPanel({ conversion, typeCode, source, onBack, onViewOrigina
3267
3272
  [onCopySections, selectedKeys, sections]
3268
3273
  );
3269
3274
  const handleAddToContext = _react.useCallback.call(void 0, () => {
3270
- _optionalChain([onAttach, 'optionalCall', _254 => _254(date ? `Prescription \xB7 ${date}` : "Prescription")]);
3275
+ _optionalChain([onAttach, 'optionalCall', _256 => _256(date ? `Prescription \xB7 ${date}` : "Prescription")]);
3271
3276
  }, [onAttach, date]);
3272
3277
  const canCopy = !!onCopySections && !isEmpty;
3273
3278
  const canAttach = !!onAttach && !isEmpty;
@@ -3342,7 +3347,7 @@ function ScribeDocumentPanel({
3342
3347
  const handleCopyFooter = _react.useCallback.call(void 0,
3343
3348
  (e) => {
3344
3349
  const rect = e.currentTarget.getBoundingClientRect();
3345
- void _optionalChain([copyState, 'optionalAccess', _255 => _255.copy, 'call', _256 => _256({ x: rect.left + rect.width / 2, y: rect.bottom })]);
3350
+ void _optionalChain([copyState, 'optionalAccess', _257 => _257.copy, 'call', _258 => _258({ x: rect.left + rect.width / 2, y: rect.bottom })]);
3346
3351
  },
3347
3352
  [copyState]
3348
3353
  );
@@ -3387,7 +3392,7 @@ function RecordPanel({ recordId, caseId, onBack }) {
3387
3392
  const record = _zustand.useStore.call(void 0, store, (s) => s.records.byId[recordId]);
3388
3393
  const { openOriginal, attachToContext, onCopyPrescriptionSections, renderScribeDocument } = _chunk5ZLBJMCKjs.useSmartRecordsActions.call(void 0, );
3389
3394
  const preview = _chunk5ZLBJMCKjs.useRecordPreview.call(void 0, recordId);
3390
- const source = _nullishCoalesce(_optionalChain([record, 'optionalAccess', _257 => _257.source]), () => ( preview.source));
3395
+ const source = _nullishCoalesce(_optionalChain([record, 'optionalAccess', _259 => _259.source]), () => ( preview.source));
3391
3396
  const [unavailableFor, setUnavailableFor] = _react.useState.call(void 0, null);
3392
3397
  _react.useEffect.call(void 0, () => setUnavailableFor(null), [recordId]);
3393
3398
  const handleScribeUnavailable = _react.useCallback.call(void 0, () => setUnavailableFor(recordId), [recordId]);
@@ -3401,7 +3406,7 @@ function RecordPanel({ recordId, caseId, onBack }) {
3401
3406
  [openOriginal, recordId, caseId]
3402
3407
  );
3403
3408
  const handleAttach = _react.useCallback.call(void 0,
3404
- (name) => void _optionalChain([attachToContext, 'optionalCall', _258 => _258(recordId, name, recordId)]),
3409
+ (name) => void _optionalChain([attachToContext, 'optionalCall', _260 => _260(recordId, name, recordId)]),
3405
3410
  [attachToContext, recordId]
3406
3411
  );
3407
3412
  if (preview.status === "loading") {
@@ -3420,9 +3425,9 @@ function RecordPanel({ recordId, caseId, onBack }) {
3420
3425
  {
3421
3426
  documentId,
3422
3427
  recordId,
3423
- title: _nullishCoalesce(_optionalChain([record, 'optionalAccess', _259 => _259.title]), () => ( "Prescription")),
3428
+ title: _nullishCoalesce(_optionalChain([record, 'optionalAccess', _261 => _261.title]), () => ( "Prescription")),
3424
3429
  date: record ? _chunkNTFOVMHNjs.epochToDisplay.call(void 0, record.createdAtEpoch) : "",
3425
- typeCode: _optionalChain([record, 'optionalAccess', _260 => _260.typeCode]),
3430
+ typeCode: _optionalChain([record, 'optionalAccess', _262 => _262.typeCode]),
3426
3431
  source: _nullishCoalesce(source, () => ( void 0)),
3427
3432
  renderDocument: renderScribeDocument,
3428
3433
  onUnavailable: handleScribeUnavailable,
@@ -3436,7 +3441,7 @@ function RecordPanel({ recordId, caseId, onBack }) {
3436
3441
  PrescriptionPanel,
3437
3442
  {
3438
3443
  conversion,
3439
- typeCode: _optionalChain([record, 'optionalAccess', _261 => _261.typeCode]),
3444
+ typeCode: _optionalChain([record, 'optionalAccess', _263 => _263.typeCode]),
3440
3445
  source: _nullishCoalesce(source, () => ( void 0)),
3441
3446
  onBack,
3442
3447
  onViewOriginal: preview.files.length > 0 ? handleViewOriginal : void 0,
@@ -3446,7 +3451,7 @@ function RecordPanel({ recordId, caseId, onBack }) {
3446
3451
  recordId
3447
3452
  );
3448
3453
  }
3449
- if (_optionalChain([record, 'optionalAccess', _262 => _262.isSmart])) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SmartRecordSmartPanel, { recordId, caseId, onBack });
3454
+ if (_optionalChain([record, 'optionalAccess', _264 => _264.isSmart])) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SmartRecordSmartPanel, { recordId, caseId, onBack });
3450
3455
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SmartRecordPreviewPanel, { recordId, preview, onBack });
3451
3456
  }
3452
3457
 
@@ -3465,7 +3470,7 @@ function useJumpToSelected(activeId, listKey) {
3465
3470
  }, []);
3466
3471
  const [state, setState] = _react.useState.call(void 0, HIDDEN);
3467
3472
  const evaluate = _react.useCallback.call(void 0, () => {
3468
- const active = _nullishCoalesce(_optionalChain([body, 'optionalAccess', _263 => _263.querySelector, 'call', _264 => _264(".mr-sv__record-item--active")]), () => ( null));
3473
+ const active = _nullishCoalesce(_optionalChain([body, 'optionalAccess', _265 => _265.querySelector, 'call', _266 => _266(".mr-sv__record-item--active")]), () => ( null));
3469
3474
  if (!body || !active) {
3470
3475
  setState((s) => s.visible ? HIDDEN : s);
3471
3476
  return;
@@ -3493,7 +3498,7 @@ function useJumpToSelected(activeId, listKey) {
3493
3498
  evaluate();
3494
3499
  }, [evaluate, listKey]);
3495
3500
  const jumpToSelected = _react.useCallback.call(void 0, () => {
3496
- _optionalChain([body, 'optionalAccess', _265 => _265.querySelector, 'call', _266 => _266(".mr-sv__record-item--active"), 'optionalAccess', _267 => _267.scrollIntoView, 'call', _268 => _268({ behavior: "smooth", block: "center" })]);
3501
+ _optionalChain([body, 'optionalAccess', _267 => _267.querySelector, 'call', _268 => _268(".mr-sv__record-item--active"), 'optionalAccess', _269 => _269.scrollIntoView, 'call', _270 => _270({ behavior: "smooth", block: "center" })]);
3497
3502
  }, [body]);
3498
3503
  return {
3499
3504
  scrollBodyRef,
@@ -3545,10 +3550,10 @@ function toCollectionFilter(filters) {
3545
3550
  // src/views/hooks/smart-records/searchCollection.ts
3546
3551
  var isRecord = (item) => "document_id" in item.data;
3547
3552
  function recordText(data, labelOf) {
3548
- return [_nullishCoalesce(_optionalChain([data, 'access', _269 => _269.metadata, 'optionalAccess', _270 => _270.title]), () => ( "")), labelOf(_nullishCoalesce(data.document_type, () => ( ""))), ..._nullishCoalesce(_optionalChain([data, 'access', _271 => _271.metadata, 'optionalAccess', _272 => _272.tags]), () => ( []))];
3553
+ return [_nullishCoalesce(_optionalChain([data, 'access', _271 => _271.metadata, 'optionalAccess', _272 => _272.title]), () => ( "")), labelOf(_nullishCoalesce(data.document_type, () => ( ""))), ..._nullishCoalesce(_optionalChain([data, 'access', _273 => _273.metadata, 'optionalAccess', _274 => _274.tags]), () => ( []))];
3549
3554
  }
3550
3555
  function caseText(item) {
3551
- return [_nullishCoalesce(_nullishCoalesce(item.title, () => ( _optionalChain([item, 'access', _273 => _273.data, 'access', _274 => _274.item, 'optionalAccess', _275 => _275.display_name]))), () => ( ""))];
3556
+ return [_nullishCoalesce(_nullishCoalesce(item.title, () => ( _optionalChain([item, 'access', _275 => _275.data, 'access', _276 => _276.item, 'optionalAccess', _277 => _277.display_name]))), () => ( ""))];
3552
3557
  }
3553
3558
  function searchCollection(groups, query, labelOf) {
3554
3559
  const q = query.trim().toLowerCase();
@@ -3634,10 +3639,10 @@ function buildSidebarRows(groups, labelOf) {
3634
3639
  kind: ROW_KIND.Case,
3635
3640
  id: item.id,
3636
3641
  date: _nullishCoalesce(newest, () => ( item.date)),
3637
- title: item.title || _optionalChain([data, 'access', _276 => _276.item, 'optionalAccess', _277 => _277.display_name]) || "Untitled case",
3642
+ title: item.title || _optionalChain([data, 'access', _278 => _278.item, 'optionalAccess', _279 => _279.display_name]) || "Untitled case",
3638
3643
  typeCode: "",
3639
3644
  isSmart: false,
3640
- caseTypeCode: _nullishCoalesce(_optionalChain([data, 'access', _278 => _278.item, 'optionalAccess', _279 => _279.type]), () => ( "")),
3645
+ caseTypeCode: _nullishCoalesce(_optionalChain([data, 'access', _280 => _280.item, 'optionalAccess', _281 => _281.type]), () => ( "")),
3641
3646
  recordCount: linked.length,
3642
3647
  ...matched2 ? { matchCount: matched2.length } : {}
3643
3648
  };
@@ -3690,7 +3695,7 @@ function useSidebarCollection({ limit } = {}) {
3690
3695
  return {
3691
3696
  rows,
3692
3697
  months,
3693
- latestId: _nullishCoalesce(_optionalChain([rows, 'access', _280 => _280[0], 'optionalAccess', _281 => _281.id]), () => ( null)),
3698
+ latestId: _nullishCoalesce(_optionalChain([rows, 'access', _282 => _282[0], 'optionalAccess', _283 => _283.id]), () => ( null)),
3694
3699
  matchingRecordCount: _react.useMemo.call(void 0, () => countRecordItems(searched), [searched]),
3695
3700
  hasActiveFilter: hasSidebarFilter(filters),
3696
3701
  search: filters.search
@@ -3868,7 +3873,7 @@ function resolveContentType(file) {
3868
3873
  if (t === "image/jpeg" || t === "image/jpg" || t === "image/png" || t === "application/pdf") {
3869
3874
  return t;
3870
3875
  }
3871
- const ext = _optionalChain([file, 'access', _282 => _282.name, 'access', _283 => _283.split, 'call', _284 => _284("."), 'access', _285 => _285.pop, 'call', _286 => _286(), 'optionalAccess', _287 => _287.toLowerCase, 'call', _288 => _288()]);
3876
+ const ext = _optionalChain([file, 'access', _284 => _284.name, 'access', _285 => _285.split, 'call', _286 => _286("."), 'access', _287 => _287.pop, 'call', _288 => _288(), 'optionalAccess', _289 => _289.toLowerCase, 'call', _290 => _290()]);
3872
3877
  if (ext === "pdf") return "application/pdf";
3873
3878
  if (ext === "png") return "image/png";
3874
3879
  if (ext === "jpg" || ext === "jpeg") return "image/jpeg";
@@ -3907,12 +3912,12 @@ function useUploadConnection() {
3907
3912
  patientId
3908
3913
  });
3909
3914
  const queue2 = store.getState().uploadQueue;
3910
- if (res.message === "queued_offline" || !_optionalChain([res, 'access', _289 => _289.batch_response, 'optionalAccess', _290 => _290.length])) {
3915
+ if (res.message === "queued_offline" || !_optionalChain([res, 'access', _291 => _291.batch_response, 'optionalAccess', _292 => _292.length])) {
3911
3916
  throw new Error("No internet connection. Your upload will retry automatically when you're back online.");
3912
3917
  }
3913
3918
  localIds.forEach((id, i) => {
3914
- const documentId = _nullishCoalesce(_optionalChain([res, 'access', _291 => _291.batch_response, 'optionalAccess', _292 => _292[i], 'optionalAccess', _293 => _293.document_id]), () => ( ""));
3915
- const errorDetails = _optionalChain([res, 'access', _294 => _294.batch_response, 'optionalAccess', _295 => _295[i], 'optionalAccess', _296 => _296.error_details]);
3919
+ const documentId = _nullishCoalesce(_optionalChain([res, 'access', _293 => _293.batch_response, 'optionalAccess', _294 => _294[i], 'optionalAccess', _295 => _295.document_id]), () => ( ""));
3920
+ const errorDetails = _optionalChain([res, 'access', _296 => _296.batch_response, 'optionalAccess', _297 => _297[i], 'optionalAccess', _298 => _298.error_details]);
3916
3921
  if (errorDetails) {
3917
3922
  queue2.markFailed(id);
3918
3923
  } else {
@@ -4055,7 +4060,7 @@ function useFilteredRecordIds2() {
4055
4060
 
4056
4061
 
4057
4062
  var HighlightedText = _react.memo.call(void 0, function HighlightedText2({ text, query }) {
4058
- const q = _nullishCoalesce(_optionalChain([query, 'optionalAccess', _297 => _297.trim, 'call', _298 => _298(), 'access', _299 => _299.toLowerCase, 'call', _300 => _300()]), () => ( ""));
4063
+ const q = _nullishCoalesce(_optionalChain([query, 'optionalAccess', _299 => _299.trim, 'call', _300 => _300(), 'access', _301 => _301.toLowerCase, 'call', _302 => _302()]), () => ( ""));
4059
4064
  const start = q ? text.toLowerCase().indexOf(q) : -1;
4060
4065
  if (start < 0) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: text });
4061
4066
  const end = start + q.length;
@@ -4230,7 +4235,7 @@ var SidebarSearchField = _react.memo.call(void 0, function SidebarSearchField2({
4230
4235
  function summarize(options, value) {
4231
4236
  if (value.length === 0) return "All";
4232
4237
  if (value.length > 2) return `${value.length} types`;
4233
- return value.map((id) => _nullishCoalesce(_optionalChain([options, 'access', _301 => _301.find, 'call', _302 => _302((o) => o.id === id), 'optionalAccess', _303 => _303.display_name]), () => ( id))).join(", ");
4238
+ return value.map((id) => _nullishCoalesce(_optionalChain([options, 'access', _303 => _303.find, 'call', _304 => _304((o) => o.id === id), 'optionalAccess', _305 => _305.display_name]), () => ( id))).join(", ");
4234
4239
  }
4235
4240
  function SidebarTypeSelect({ options, value, onChange }) {
4236
4241
  const [open, setOpen] = _react.useState.call(void 0, false);
@@ -4239,7 +4244,7 @@ function SidebarTypeSelect({ options, value, onChange }) {
4239
4244
  _react.useEffect.call(void 0, () => {
4240
4245
  if (!open) return;
4241
4246
  const onMouseDown = (e) => {
4242
- if (!_optionalChain([rootRef, 'access', _304 => _304.current, 'optionalAccess', _305 => _305.contains, 'call', _306 => _306(e.target)])) setOpen(false);
4247
+ if (!_optionalChain([rootRef, 'access', _306 => _306.current, 'optionalAccess', _307 => _307.contains, 'call', _308 => _308(e.target)])) setOpen(false);
4243
4248
  };
4244
4249
  document.addEventListener("mousedown", onMouseDown);
4245
4250
  return () => document.removeEventListener("mousedown", onMouseDown);
@@ -4313,7 +4318,7 @@ function SidebarFilterPopover({ containerRef, onClose }) {
4313
4318
  }));
4314
4319
  _react.useEffect.call(void 0, () => {
4315
4320
  const handler = (e) => {
4316
- if (_optionalChain([containerRef, 'access', _307 => _307.current, 'optionalAccess', _308 => _308.contains, 'call', _309 => _309(e.target)])) return;
4321
+ if (_optionalChain([containerRef, 'access', _309 => _309.current, 'optionalAccess', _310 => _310.contains, 'call', _311 => _311(e.target)])) return;
4317
4322
  onClose();
4318
4323
  };
4319
4324
  document.addEventListener("mousedown", handler);
@@ -4719,32 +4724,32 @@ function SmartRecordsViewInner({
4719
4724
  onViewChangeRef.current = onViewChange;
4720
4725
  renderScribeDocumentRef.current = renderScribeDocument;
4721
4726
  _react.useEffect.call(void 0, () => {
4722
- _optionalChain([onViewChangeRef, 'access', _310 => _310.current, 'optionalCall', _311 => _311(mainView)]);
4727
+ _optionalChain([onViewChangeRef, 'access', _312 => _312.current, 'optionalCall', _313 => _313(mainView)]);
4723
4728
  }, [mainView]);
4724
4729
  const [selectedCaseId, setSelectedCaseId] = _react.useState.call(void 0, null);
4725
4730
  const [uploadOpen, setUploadOpen] = _react.useState.call(void 0, false);
4726
4731
  const stableCopyToNote = _react.useCallback.call(void 0,
4727
- (text, anchor, vitalsRows) => _optionalChain([onCopyToNoteRef, 'access', _312 => _312.current, 'optionalCall', _313 => _313(text, anchor, vitalsRows)]),
4732
+ (text, anchor, vitalsRows) => _optionalChain([onCopyToNoteRef, 'access', _314 => _314.current, 'optionalCall', _315 => _315(text, anchor, vitalsRows)]),
4728
4733
  []
4729
4734
  );
4730
4735
  const stableCopyPrescriptionSections = _react.useCallback.call(void 0,
4731
- (sections, anchor) => _optionalChain([onCopyPrescriptionSectionsRef, 'access', _314 => _314.current, 'optionalCall', _315 => _315(sections, anchor)]),
4736
+ (sections, anchor) => _optionalChain([onCopyPrescriptionSectionsRef, 'access', _316 => _316.current, 'optionalCall', _317 => _317(sections, anchor)]),
4732
4737
  []
4733
4738
  );
4734
4739
  const stableCopyVitalsToNote = _react.useCallback.call(void 0,
4735
- (text) => _optionalChain([onCopyVitalsToNoteRef, 'access', _316 => _316.current, 'optionalCall', _317 => _317(text)]),
4740
+ (text) => _optionalChain([onCopyVitalsToNoteRef, 'access', _318 => _318.current, 'optionalCall', _319 => _319(text)]),
4736
4741
  []
4737
4742
  );
4738
4743
  const stableToast = _react.useCallback.call(void 0,
4739
- (message, type) => _optionalChain([onToastRef, 'access', _318 => _318.current, 'optionalCall', _319 => _319(message, type)]),
4744
+ (message, type) => _optionalChain([onToastRef, 'access', _320 => _320.current, 'optionalCall', _321 => _321(message, type)]),
4740
4745
  []
4741
4746
  );
4742
4747
  const stableRenderScribeDocument = _react.useCallback.call(void 0,
4743
- (args) => _nullishCoalesce(_optionalChain([renderScribeDocumentRef, 'access', _320 => _320.current, 'optionalCall', _321 => _321(args)]), () => ( null)),
4748
+ (args) => _nullishCoalesce(_optionalChain([renderScribeDocumentRef, 'access', _322 => _322.current, 'optionalCall', _323 => _323(args)]), () => ( null)),
4744
4749
  []
4745
4750
  );
4746
4751
  const attachToContext = _react.useCallback.call(void 0, (documentId, name, visitId) => {
4747
- void _optionalChain([onAddToContextRef, 'access', _322 => _322.current, 'optionalCall', _323 => _323([visitId ? { documentId, name, visitId } : { documentId, name }])]);
4752
+ void _optionalChain([onAddToContextRef, 'access', _324 => _324.current, 'optionalCall', _325 => _325([visitId ? { documentId, name, visitId } : { documentId, name }])]);
4748
4753
  }, []);
4749
4754
  const handleSelectCase = _react.useCallback.call(void 0,
4750
4755
  (caseId) => {