@mindbill/react 0.77.35 → 0.77.37

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
@@ -10049,14 +10049,14 @@ function RfaLink({ href, children, onSelect }) {
10049
10049
  }
10050
10050
 
10051
10051
  // src/rfa-task-board.tsx
10052
- import { useEffect as useEffect14, useMemo as useMemo7, useRef as useRef13, useState as useState17 } from "react";
10052
+ import { useEffect as useEffect15, useMemo as useMemo7, useRef as useRef13, useState as useState18 } from "react";
10053
10053
  import { createRfaClient, createRfaLifecycleClient } from "@mindbill/browser";
10054
10054
 
10055
10055
  // src/rfa-delivery-panel.tsx
10056
- import { useEffect as useEffect13, useRef as useRef11, useState as useState15 } from "react";
10056
+ import { useEffect as useEffect14, useRef as useRef11, useState as useState16 } from "react";
10057
10057
 
10058
10058
  // src/rfa-authorization-destination.tsx
10059
- import { useEffect as useEffect12, useRef as useRef10, useState as useState14 } from "react";
10059
+ import { useEffect as useEffect13, useRef as useRef10, useState as useState15 } from "react";
10060
10060
 
10061
10061
  // src/rfa-identity-select.tsx
10062
10062
  import { useId as useId5, useRef as useRef9, useState as useState13 } from "react";
@@ -10120,28 +10120,131 @@ function RfaIdentitySelect({ label: label5, placeholder, searchPlaceholder, quer
10120
10120
  ] });
10121
10121
  }
10122
10122
 
10123
+ // src/rfa-official-fields.tsx
10124
+ import { useEffect as useEffect12, useState as useState14 } from "react";
10125
+ import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
10126
+ var formDate = (value) => {
10127
+ const match = /^(\d{4})-(\d{2})-(\d{2})/.exec(value ?? "");
10128
+ return match ? `${match[2]}/${match[3]}/${match[1]}` : value ?? "";
10129
+ };
10130
+ function RfaRequired() {
10131
+ return /* @__PURE__ */ jsx23("span", { className: "mbrfa-req", title: "Required", children: " *" });
10132
+ }
10133
+ function RfaPicker({ label: label5, children, required: required2 }) {
10134
+ return /* @__PURE__ */ jsxs21("div", { className: "mbrfa-picker", children: [
10135
+ /* @__PURE__ */ jsxs21("span", { children: [
10136
+ label5,
10137
+ required2 ? /* @__PURE__ */ jsx23(RfaRequired, {}) : null
10138
+ ] }),
10139
+ children
10140
+ ] });
10141
+ }
10142
+ function RfaSavedField({ label: label5, value, span }) {
10143
+ return /* @__PURE__ */ jsxs21("div", { className: `mbrfa-s${span} mbrfa-saved`, children: [
10144
+ /* @__PURE__ */ jsx23("span", { children: label5 }),
10145
+ /* @__PURE__ */ jsx23("strong", { children: value || "\u2014" })
10146
+ ] });
10147
+ }
10148
+ function RfaEmployeeFields({ name, dateOfInjury, claimNumber, details }) {
10149
+ return /* @__PURE__ */ jsxs21("div", { className: "mbrfa-form-grid", children: [
10150
+ /* @__PURE__ */ jsx23(RfaSavedField, { span: 6, label: "Name (Last, First, Middle)", value: details?.formName || name }),
10151
+ /* @__PURE__ */ jsx23(RfaSavedField, { span: 3, label: "Date of Injury (MM/DD/YYYY)", value: formDate(dateOfInjury) }),
10152
+ /* @__PURE__ */ jsx23(RfaSavedField, { span: 3, label: "Date of Birth (MM/DD/YYYY)", value: formDate(details?.dateOfBirth) }),
10153
+ /* @__PURE__ */ jsx23(RfaSavedField, { span: 3, label: "Claim Number", value: claimNumber }),
10154
+ /* @__PURE__ */ jsx23(RfaSavedField, { span: 3, label: "Employer", value: details?.employer })
10155
+ ] });
10156
+ }
10157
+ function formatRfaPhone(value) {
10158
+ const raw = value ?? "";
10159
+ if (/[^\d\s().+-]/.test(raw)) return raw;
10160
+ let digits = raw.replace(/\D/g, "");
10161
+ if (digits.length === 11 && digits.startsWith("1")) digits = digits.slice(1);
10162
+ if (digits.length > 10) return raw;
10163
+ if (digits.length < 4) return digits;
10164
+ return digits.length < 7 ? `(${digits.slice(0, 3)}) ${digits.slice(3)}` : `(${digits.slice(0, 3)}) ${digits.slice(3, 6)}-${digits.slice(6)}`;
10165
+ }
10166
+ var contactRows = [
10167
+ ["address", "Address", 500, 3],
10168
+ ["city", "City", 100, 2],
10169
+ ["state", "State", 2, 1],
10170
+ ["zip", "Zip Code", 20, 2],
10171
+ ["phone", "Phone", 30, 2],
10172
+ ["fax", "Fax Number", 30, 2]
10173
+ ];
10174
+ function RfaOfficialContactFields({ nameLabel, value, onChange, before, beforeEmail, required: required2 = [], editable = true }) {
10175
+ const dial = (key2) => key2 === "phone" || key2 === "fax";
10176
+ const mark = (key2) => required2.includes(key2) ? /* @__PURE__ */ jsx23(RfaRequired, {}) : null;
10177
+ const field = (key2, label5, max, span) => editable ? /* @__PURE__ */ jsxs21("label", { className: `mbrfa-s${span}`, children: [
10178
+ /* @__PURE__ */ jsxs21("span", { children: [
10179
+ label5,
10180
+ mark(key2)
10181
+ ] }),
10182
+ /* @__PURE__ */ jsx23("input", { type: key2 === "email" ? "email" : key2 === "phone" || key2 === "fax" ? "tel" : "text", maxLength: max, value: dial(key2) ? formatRfaPhone(value?.[key2]) : value?.[key2] ?? "", onChange: (event) => onChange({ ...value, [key2]: dial(key2) ? formatRfaPhone(event.target.value) : event.target.value }) })
10183
+ ] }, key2) : /* @__PURE__ */ jsxs21("div", { className: `mbrfa-s${span} mbrfa-saved`, children: [
10184
+ /* @__PURE__ */ jsxs21("span", { children: [
10185
+ label5,
10186
+ mark(key2)
10187
+ ] }),
10188
+ /* @__PURE__ */ jsx23("strong", { children: (dial(key2) ? formatRfaPhone(value?.[key2]) : value?.[key2])?.trim() || "\u2014" })
10189
+ ] }, key2);
10190
+ return /* @__PURE__ */ jsxs21("div", { className: "mbrfa-form-grid mbrfa-contact-grid", children: [
10191
+ before,
10192
+ field("name", nameLabel, 200, 3),
10193
+ field("contactName", "Contact Name", 200, 3),
10194
+ contactRows.map(([key2, label5, max, span]) => field(key2, label5, max, span)),
10195
+ beforeEmail,
10196
+ field("email", "E-mail Address", 254, 6)
10197
+ ] });
10198
+ }
10199
+ function RfaManualToggle({ manual, onChange, disabled }) {
10200
+ return /* @__PURE__ */ jsxs21("div", { className: "mbrfa-section-actions", children: [
10201
+ /* @__PURE__ */ jsx23("button", { type: "button", className: manual ? "mbtd-primary" : void 0, disabled, "aria-pressed": manual, onClick: () => onChange(!manual), children: manual ? "Save" : "Edit manually" }),
10202
+ manual ? /* @__PURE__ */ jsx23("span", { children: "Applies to this request only. The saved record is not changed." }) : null
10203
+ ] });
10204
+ }
10205
+ function useRfaFormDetails(client, claimId, renderingProviderId, enabled) {
10206
+ const [details, setDetails] = useState14();
10207
+ useEffect12(() => {
10208
+ let active = true;
10209
+ setDetails(void 0);
10210
+ if (!enabled || !claimId) return;
10211
+ void client.getCreationContext({ claimId, renderingProviderId, limit: 1 }).then((context) => {
10212
+ if (!active) return;
10213
+ const claim = context.claims.find((value) => value.claimId === claimId), provider = context.renderingProviders.find((value) => value.id === renderingProviderId);
10214
+ setDetails({ ...context.returnFax ? { returnFax: context.returnFax } : {}, ...context.returnEmail ? { returnEmail: context.returnEmail } : {}, ...claim ? { employee: { formName: claim.employeeFormName, dateOfBirth: claim.dateOfBirth, employer: claim.employer } } : {}, ...provider ? { physician: { specialty: provider.specialty } } : {} });
10215
+ }).catch(() => void 0);
10216
+ return () => {
10217
+ active = false;
10218
+ };
10219
+ }, [client, claimId, renderingProviderId, enabled]);
10220
+ return details;
10221
+ }
10222
+
10123
10223
  // src/rfa-authorization-destination.tsx
10124
10224
  import { normalizeRfaFax, rfaAuthorizationDestinations, rfaAuthorizationGuidance as rfaAuthorizationGuidance2 } from "@mindbill/browser";
10125
- import { Fragment as Fragment13, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
10126
- function RfaAuthorizationDestination({ contextKey, directory, savedContact, loading = false, error, disabled = false, onChange, onSelectionStart, compact = false, onManualEntry }) {
10225
+ import { Fragment as Fragment13, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
10226
+ function RfaAuthorizationDestination({ contextKey, directory, savedContact, loading = false, error, disabled = false, onChange, onSelectionStart, compact = false, onManualEntry, autoSelectSingle = false }) {
10127
10227
  const options = loading || error ? [] : rfaAuthorizationDestinations(directory);
10128
10228
  const fax = savedContact?.fax ? normalizeRfaFax(savedContact.fax) : null;
10129
10229
  const savedLabel = savedContact?.contactName || savedContact?.name || "Saved request contact";
10130
10230
  if (fax && !options.some((option) => option.method === "fax" && option.destination === fax)) options.unshift({ method: "fax", destination: fax, label: savedLabel, ...savedContact?.contactName ? { recipientName: savedContact.contactName } : {} });
10131
10231
  if (savedContact?.email?.trim() && !options.some((option) => option.method === "email" && option.destination === savedContact.email?.trim())) options.unshift({ method: "email", destination: savedContact.email.trim(), label: savedLabel, ...savedContact?.contactName ? { recipientName: savedContact.contactName } : {} });
10132
10232
  const signature = JSON.stringify([contextKey, directory?.authorizationStatus, options, loading, error]);
10133
- const [selection, setSelection] = useState14("");
10134
- const [manual, setManual] = useState14("");
10135
- const [query, setQuery] = useState14("");
10136
- const [contactName, setContactName] = useState14("");
10233
+ const [selection, setSelection] = useState15("");
10234
+ const [manual, setManual] = useState15("");
10235
+ const [query, setQuery] = useState15("");
10236
+ const [contactName, setContactName] = useState15("");
10137
10237
  const needsAdjuster = directory?.authorizationStatus === "adjuster_specific_required";
10138
10238
  const callback = useRef10(onChange);
10139
10239
  callback.current = onChange;
10140
- useEffect12(() => {
10141
- setSelection("");
10240
+ const auto = useRef10(autoSelectSingle);
10241
+ auto.current = autoSelectSingle;
10242
+ useEffect13(() => {
10142
10243
  setManual("");
10143
- setContactName("");
10144
- callback.current(null);
10244
+ const only = auto.current && !needsAdjuster && options.length === 1 ? options[0] : void 0;
10245
+ setSelection(only ? "0" : "");
10246
+ setContactName(only?.recipientName ?? "");
10247
+ callback.current(only ?? null);
10145
10248
  }, [signature]);
10146
10249
  const chosen = selection !== "" ? options[Number(selection)] : void 0;
10147
10250
  const emit = (nextSelection, value, name) => {
@@ -10164,16 +10267,16 @@ function RfaAuthorizationDestination({ contextKey, directory, savedContact, load
10164
10267
  setContactName(name);
10165
10268
  emit(value, "", name);
10166
10269
  };
10167
- const guidance = /* @__PURE__ */ jsxs21(Fragment13, { children: [
10168
- /* @__PURE__ */ jsx23("p", { style: { margin: 0 }, children: loading ? "Loading authorization contacts\u2026" : error ? "Directory details are unavailable. Confirm a destination with the handling adjuster." : rfaAuthorizationGuidance2(directory) }),
10169
- directory?.authorizationNotice ? /* @__PURE__ */ jsx23("p", { style: { margin: 0 }, children: directory.authorizationNotice }) : null
10270
+ const guidance = /* @__PURE__ */ jsxs22(Fragment13, { children: [
10271
+ /* @__PURE__ */ jsx24("p", { style: { margin: 0 }, children: loading ? "Loading authorization contacts\u2026" : error ? "Directory details are unavailable. Confirm a destination with the handling adjuster." : rfaAuthorizationGuidance2(directory) }),
10272
+ directory?.authorizationNotice ? /* @__PURE__ */ jsx24("p", { style: { margin: 0 }, children: directory.authorizationNotice }) : null
10170
10273
  ] });
10171
- return /* @__PURE__ */ jsxs21("fieldset", { className: compact ? "mb-rfa-destination mbrfa-plain" : "mb-rfa-destination", disabled: disabled || loading, style: compact ? { display: "grid", gap: 8, minWidth: 0, overflowWrap: "anywhere" } : { border: "1px solid var(--mb-border, #d7e0df)", borderRadius: 10, padding: 16, display: "grid", gap: 12, minWidth: 0, overflowWrap: "anywhere" }, children: [
10172
- compact ? null : /* @__PURE__ */ jsxs21(Fragment13, { children: [
10173
- /* @__PURE__ */ jsx23("legend", { children: "Authorization destination" }),
10274
+ return /* @__PURE__ */ jsxs22("fieldset", { className: compact ? "mb-rfa-destination mbrfa-plain" : "mb-rfa-destination", disabled: disabled || loading, style: compact ? { display: "grid", gap: 8, minWidth: 0, overflowWrap: "anywhere" } : { border: "1px solid var(--mb-border, #d7e0df)", borderRadius: 10, padding: 16, display: "grid", gap: 12, minWidth: 0, overflowWrap: "anywhere" }, children: [
10275
+ compact ? null : /* @__PURE__ */ jsxs22(Fragment13, { children: [
10276
+ /* @__PURE__ */ jsx24("legend", { children: "Authorization destination" }),
10174
10277
  guidance
10175
10278
  ] }),
10176
- compact ? /* @__PURE__ */ jsx23(
10279
+ compact ? /* @__PURE__ */ jsx24(
10177
10280
  RfaIdentitySelect,
10178
10281
  {
10179
10282
  label: directory?.authorizationStatus === "claim_handling_location_routes" ? "Claim-handling office" : "Authorization contact",
@@ -10184,7 +10287,7 @@ function RfaAuthorizationDestination({ contextKey, directory, savedContact, load
10184
10287
  searchable: true,
10185
10288
  disabled: disabled || loading,
10186
10289
  value: selection,
10187
- options: [...options.map((option, index) => ({ id: String(index), label: option.label, detail: `${option.method === "fax" ? "Fax" : "E-mail"} ${option.destination}` })), ...onManualEntry ? [{ id: "manual-entry", label: needsAdjuster ? "Enter the handling adjuster\u2019s contact manually" : "Enter a different contact manually" }] : [{ id: "manual", label: needsAdjuster ? "Enter the handling adjuster\u2019s fax" : "Enter another confirmed authorization fax" }, { id: "manual-email", label: "Enter a confirmed authorization e-mail" }]].filter((option) => option.id === selection || `${option.label} ${"detail" in option ? option.detail : ""}`.toLowerCase().includes(query.trim().toLowerCase())),
10290
+ options: [...options.map((option, index) => ({ id: String(index), .../[a-z]/i.test(option.label) ? { label: option.label, detail: option.method === "fax" ? `Fax ${formatRfaPhone(option.destination)}` : option.destination } : { label: option.method === "fax" ? "Authorization fax" : "Authorization e-mail", detail: option.method === "fax" ? formatRfaPhone(option.destination) : option.destination } })), ...onManualEntry ? [{ id: "manual-entry", label: needsAdjuster ? "Enter the handling adjuster\u2019s contact manually" : "Enter a different contact manually" }] : [{ id: "manual", label: needsAdjuster ? "Enter the handling adjuster\u2019s fax" : "Enter another confirmed authorization fax" }, { id: "manual-email", label: "Enter a confirmed authorization e-mail" }]].filter((option) => option.id === selection || `${option.label} ${"detail" in option ? option.detail : ""}`.toLowerCase().includes(query.trim().toLowerCase())),
10188
10291
  onSelect: (value) => {
10189
10292
  setQuery("");
10190
10293
  if (value === "manual-entry") {
@@ -10194,115 +10297,115 @@ function RfaAuthorizationDestination({ contextKey, directory, savedContact, load
10194
10297
  pick(value);
10195
10298
  }
10196
10299
  }
10197
- ) : /* @__PURE__ */ jsxs21("label", { style: { display: "grid", gap: 6, minWidth: 0 }, children: [
10300
+ ) : /* @__PURE__ */ jsxs22("label", { style: { display: "grid", gap: 6, minWidth: 0 }, children: [
10198
10301
  directory?.authorizationStatus === "claim_handling_location_routes" ? "Claim-handling office" : "Authorization contact",
10199
- /* @__PURE__ */ jsxs21("select", { value: selection, onChange: (event) => pick(event.target.value), style: { padding: 10, width: "100%", minWidth: 0, maxWidth: "100%", font: "inherit" }, children: [
10200
- /* @__PURE__ */ jsx23("option", { value: "", children: "Choose a destination\u2026" }),
10201
- options.map((option, index) => /* @__PURE__ */ jsxs21("option", { value: String(index), children: [
10302
+ /* @__PURE__ */ jsxs22("select", { value: selection, onChange: (event) => pick(event.target.value), style: { padding: 10, width: "100%", minWidth: 0, maxWidth: "100%", font: "inherit" }, children: [
10303
+ /* @__PURE__ */ jsx24("option", { value: "", children: "Choose a destination\u2026" }),
10304
+ options.map((option, index) => /* @__PURE__ */ jsxs22("option", { value: String(index), children: [
10202
10305
  option.label,
10203
10306
  " \xB7 ",
10204
10307
  option.method === "fax" ? "Fax" : "Email",
10205
10308
  ": ",
10206
10309
  option.destination
10207
10310
  ] }, `${option.method}:${option.destination}:${index}`)),
10208
- /* @__PURE__ */ jsx23("option", { value: "manual", children: needsAdjuster ? "Enter the handling adjuster\u2019s fax" : "Enter another confirmed authorization fax" }),
10209
- /* @__PURE__ */ jsx23("option", { value: "manual-email", children: "Enter a confirmed authorization email" })
10311
+ /* @__PURE__ */ jsx24("option", { value: "manual", children: needsAdjuster ? "Enter the handling adjuster\u2019s fax" : "Enter another confirmed authorization fax" }),
10312
+ /* @__PURE__ */ jsx24("option", { value: "manual-email", children: "Enter a confirmed authorization email" })
10210
10313
  ] })
10211
10314
  ] }),
10212
- selection !== "" && (needsAdjuster || selection === "manual" || selection === "manual-email") ? /* @__PURE__ */ jsxs21("label", { style: { display: "grid", gap: 6 }, children: [
10315
+ selection !== "" && (needsAdjuster || selection === "manual" || selection === "manual-email") ? /* @__PURE__ */ jsxs22("label", { style: { display: "grid", gap: 6 }, children: [
10213
10316
  needsAdjuster ? "Handling adjuster name (required)" : "Recipient / attention (optional)",
10214
- /* @__PURE__ */ jsx23("input", { value: contactName, maxLength: 200, required: needsAdjuster, onChange: (event) => {
10317
+ /* @__PURE__ */ jsx24("input", { value: contactName, maxLength: 200, required: needsAdjuster, onChange: (event) => {
10215
10318
  setContactName(event.target.value);
10216
10319
  emit(selection, manual, event.target.value);
10217
10320
  } })
10218
10321
  ] }) : null,
10219
- selection === "manual-email" ? /* @__PURE__ */ jsxs21("label", { children: [
10322
+ selection === "manual-email" ? /* @__PURE__ */ jsxs22("label", { children: [
10220
10323
  "Authorization email address",
10221
- /* @__PURE__ */ jsx23("input", { type: "email", value: manual, onChange: (event) => {
10324
+ /* @__PURE__ */ jsx24("input", { type: "email", value: manual, onChange: (event) => {
10222
10325
  const value = event.target.value;
10223
10326
  setManual(value);
10224
10327
  emit(selection, value, contactName);
10225
10328
  } })
10226
- ] }) : selection === "manual" ? /* @__PURE__ */ jsxs21("label", { style: { display: "grid", gap: 6, minWidth: 0 }, children: [
10329
+ ] }) : selection === "manual" ? /* @__PURE__ */ jsxs22("label", { style: { display: "grid", gap: 6, minWidth: 0 }, children: [
10227
10330
  "Authorization fax number",
10228
- /* @__PURE__ */ jsx23("input", { type: "tel", value: manual, onChange: (event) => {
10331
+ /* @__PURE__ */ jsx24("input", { type: "tel", value: manual, onChange: (event) => {
10229
10332
  const value = event.target.value;
10230
10333
  setManual(value);
10231
10334
  emit(selection, value, contactName);
10232
10335
  }, style: { padding: 10, width: "100%", minWidth: 0, boxSizing: "border-box", font: "inherit" } })
10233
- ] }) : selection !== "" && chosen ? /* @__PURE__ */ jsxs21(Fragment13, { children: [
10234
- chosen.method === "email" ? /* @__PURE__ */ jsxs21("p", { style: { margin: 0, overflowWrap: "anywhere" }, children: [
10336
+ ] }) : selection !== "" && chosen ? /* @__PURE__ */ jsxs22(Fragment13, { children: [
10337
+ chosen.method === "email" ? /* @__PURE__ */ jsxs22("p", { style: { margin: 0, overflowWrap: "anywhere" }, children: [
10235
10338
  "Email: ",
10236
10339
  chosen.destination,
10237
10340
  ". Review this recipient before preparing and sending the packet."
10238
10341
  ] }) : null,
10239
- chosen.phone ? /* @__PURE__ */ jsxs21("small", { children: [
10342
+ chosen.phone ? /* @__PURE__ */ jsxs22("small", { children: [
10240
10343
  "Telephone for questions: ",
10241
- chosen.phone
10344
+ formatRfaPhone(chosen.phone)
10242
10345
  ] }) : null
10243
10346
  ] }) : null,
10244
- compact ? /* @__PURE__ */ jsx23("small", { className: "mbrfa-guidance", children: guidance }) : null
10347
+ compact ? /* @__PURE__ */ jsx24("small", { className: "mbrfa-guidance", children: guidance }) : null
10245
10348
  ] });
10246
10349
  }
10247
10350
 
10248
10351
  // src/rfa-delivery-panel.tsx
10249
- import { Fragment as Fragment14, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
10352
+ import { Fragment as Fragment14, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
10250
10353
  function RfaPdfReview({ blob, title }) {
10251
- const [url, setUrl] = useState15("");
10252
- useEffect13(() => {
10354
+ const [url, setUrl] = useState16("");
10355
+ useEffect14(() => {
10253
10356
  const next = URL.createObjectURL(blob);
10254
10357
  setUrl(next);
10255
10358
  return () => URL.revokeObjectURL(next);
10256
10359
  }, [blob]);
10257
- return /* @__PURE__ */ jsx24("div", { children: url ? /* @__PURE__ */ jsxs22(Fragment14, { children: [
10258
- /* @__PURE__ */ jsxs22("div", { className: "mbtd-actions", children: [
10259
- /* @__PURE__ */ jsxs22("a", { href: url, target: "_blank", rel: "noopener noreferrer", children: [
10360
+ return /* @__PURE__ */ jsx25("div", { children: url ? /* @__PURE__ */ jsxs23(Fragment14, { children: [
10361
+ /* @__PURE__ */ jsxs23("div", { className: "mbtd-actions", children: [
10362
+ /* @__PURE__ */ jsxs23("a", { href: url, target: "_blank", rel: "noopener noreferrer", children: [
10260
10363
  "Open ",
10261
10364
  title,
10262
10365
  " PDF"
10263
10366
  ] }),
10264
- /* @__PURE__ */ jsx24("a", { href: url, download: "authorization-packet.pdf", children: "Download PDF" })
10367
+ /* @__PURE__ */ jsx25("a", { href: url, download: "authorization-packet.pdf", children: "Download PDF" })
10265
10368
  ] }),
10266
- /* @__PURE__ */ jsx24("iframe", { title, src: url, style: { width: "100%", height: 420, border: "1px solid var(--mb-border)", marginTop: 10 } })
10369
+ /* @__PURE__ */ jsx25("iframe", { title, src: url, style: { width: "100%", height: 420, border: "1px solid var(--mb-border)", marginTop: 10 } })
10267
10370
  ] }) : null });
10268
10371
  }
10269
10372
  function RfaDeliveryPanel({ rfa, client, documentIds, directory, directoryLoading, directoryError, locked, environment, canSend, run, onUpdated }) {
10270
- const [mode, setMode] = useState15("send");
10271
- const [destination, setDestination] = useState15(null);
10272
- const [message, setMessage] = useState15("");
10273
- const [prepared, setPrepared] = useState15(null);
10274
- const [reviewed, setReviewed] = useState15(false);
10275
- const [confirmed, setConfirmed] = useState15(false);
10373
+ const [mode, setMode] = useState16("send");
10374
+ const [destination, setDestination] = useState16(null);
10375
+ const [message, setMessage] = useState16("");
10376
+ const [prepared, setPrepared] = useState16(null);
10377
+ const [reviewed, setReviewed] = useState16(false);
10378
+ const [confirmed, setConfirmed] = useState16(false);
10276
10379
  const keys = useRef11(/* @__PURE__ */ new Map());
10277
10380
  const fingerprint = JSON.stringify([rfa.id, rfa.contentRevision, documentIds, mode, destination?.method, destination?.destination, destination?.recipientName, message.trim()]);
10278
10381
  const current = useRef11(fingerprint);
10279
10382
  current.current = fingerprint;
10280
- useEffect13(() => {
10383
+ useEffect14(() => {
10281
10384
  setPrepared(null);
10282
10385
  setReviewed(false);
10283
10386
  setConfirmed(false);
10284
10387
  }, [fingerprint]);
10285
10388
  const packet = prepared?.fingerprint === fingerprint ? prepared : null;
10286
- return /* @__PURE__ */ jsxs22("fieldset", { children: [
10287
- /* @__PURE__ */ jsx24("legend", { children: "Review packet and send" }),
10288
- !rfa.readiness.ready ? /* @__PURE__ */ jsxs22("p", { children: [
10389
+ return /* @__PURE__ */ jsxs23("fieldset", { children: [
10390
+ /* @__PURE__ */ jsx25("legend", { children: "Review packet and send" }),
10391
+ !rfa.readiness.ready ? /* @__PURE__ */ jsxs23("p", { children: [
10289
10392
  "Still needed: ",
10290
10393
  rfa.readiness.missing.map((value) => value === "signedAt" ? "physician signature" : value.replace(/([a-z])([A-Z])/g, "$1 $2").replaceAll("_", " ").toLowerCase()).join(", ") || "Complete the request details",
10291
10394
  "."
10292
10395
  ] }) : null,
10293
- /* @__PURE__ */ jsxs22("label", { children: [
10396
+ /* @__PURE__ */ jsxs23("label", { children: [
10294
10397
  "Delivery method",
10295
- /* @__PURE__ */ jsxs22("select", { disabled: locked, value: mode, onChange: (event) => setMode(event.target.value), children: [
10296
- /* @__PURE__ */ jsx24("option", { value: "send", children: "Send to claims administrator" }),
10297
- /* @__PURE__ */ jsx24("option", { value: "download", children: "Download for manual submission" })
10398
+ /* @__PURE__ */ jsxs23("select", { disabled: locked, value: mode, onChange: (event) => setMode(event.target.value), children: [
10399
+ /* @__PURE__ */ jsx25("option", { value: "send", children: "Send to claims administrator" }),
10400
+ /* @__PURE__ */ jsx25("option", { value: "download", children: "Download for manual submission" })
10298
10401
  ] })
10299
10402
  ] }),
10300
- mode === "send" ? /* @__PURE__ */ jsx24(RfaAuthorizationDestination, { contextKey: `${rfa.id}:${rfa.claimsAdminId ?? "manual"}`, directory, savedContact: rfa.authorizationContact, loading: directoryLoading, error: directoryError, disabled: locked, onChange: setDestination }) : /* @__PURE__ */ jsx24("p", { children: "Downloading does not mark this request as sent. Keep proof of any submission made outside this dashboard." }),
10301
- /* @__PURE__ */ jsxs22("label", { children: [
10403
+ mode === "send" ? /* @__PURE__ */ jsx25(RfaAuthorizationDestination, { contextKey: `${rfa.id}:${rfa.claimsAdminId ?? "manual"}`, directory, savedContact: rfa.authorizationContact, loading: directoryLoading, error: directoryError, disabled: locked, onChange: setDestination }) : /* @__PURE__ */ jsx25("p", { children: "Downloading does not mark this request as sent. Keep proof of any submission made outside this dashboard." }),
10404
+ /* @__PURE__ */ jsxs23("label", { children: [
10302
10405
  destination?.method === "email" && mode === "send" ? "Email message (optional)" : "Fax cover sheet message (optional)",
10303
- /* @__PURE__ */ jsx24("textarea", { disabled: locked, maxLength: 1e3, rows: 3, value: message, onChange: (event) => setMessage(event.target.value) })
10406
+ /* @__PURE__ */ jsx25("textarea", { disabled: locked, maxLength: 1e3, rows: 3, value: message, onChange: (event) => setMessage(event.target.value) })
10304
10407
  ] }),
10305
- /* @__PURE__ */ jsx24("button", { type: "button", disabled: locked || !rfa.signedAt || documentIds.length < 2 || mode === "send" && !destination, onClick: () => void run(async () => {
10408
+ /* @__PURE__ */ jsx25("button", { type: "button", disabled: locked || !rfa.signedAt || documentIds.length < 2 || mode === "send" && !destination, onClick: () => void run(async () => {
10306
10409
  const requestFingerprint = fingerprint;
10307
10410
  const preview = await client.prepareDelivery(rfa.id, { documentIds, channel: mode === "download" ? "download" : destination.method, ...mode === "send" ? { to: destination.destination, ...destination.recipientName ? { recipientName: destination.recipientName } : {} } : {}, ...message.trim() ? { message: message.trim() } : {} });
10308
10411
  const blob = await client.getPacket(rfa.id, preview.packetId);
@@ -10312,25 +10415,25 @@ function RfaDeliveryPanel({ rfa, client, documentIds, directory, directoryLoadin
10312
10415
  setConfirmed(false);
10313
10416
  }
10314
10417
  }), children: "Prepare packet with cover sheet" }),
10315
- packet ? /* @__PURE__ */ jsxs22(Fragment14, { children: [
10316
- /* @__PURE__ */ jsx24(RfaPdfReview, { blob: packet.blob, title: "RFA submission packet" }),
10317
- /* @__PURE__ */ jsxs22("label", { className: "mbrfa-check", children: [
10318
- /* @__PURE__ */ jsx24("input", { type: "checkbox", disabled: locked, checked: reviewed, onChange: (event) => {
10418
+ packet ? /* @__PURE__ */ jsxs23(Fragment14, { children: [
10419
+ /* @__PURE__ */ jsx25(RfaPdfReview, { blob: packet.blob, title: "RFA submission packet" }),
10420
+ /* @__PURE__ */ jsxs23("label", { className: "mbrfa-check", children: [
10421
+ /* @__PURE__ */ jsx25("input", { type: "checkbox", disabled: locked, checked: reviewed, onChange: (event) => {
10319
10422
  setReviewed(event.target.checked);
10320
10423
  setConfirmed(false);
10321
10424
  } }),
10322
10425
  "I reviewed the assembled packet, including the cover sheet and clinical documents."
10323
10426
  ] })
10324
10427
  ] }) : null,
10325
- mode === "send" ? environment !== "live" ? /* @__PURE__ */ jsx24("p", { className: "mbtd-note", children: "Sandbox: review and prepare the packet here. External fax delivery is disabled. Email sending is also disabled." }) : !canSend ? /* @__PURE__ */ jsx24("p", { children: "Sending requires permission from your organization." }) : /* @__PURE__ */ jsxs22(Fragment14, { children: [
10326
- /* @__PURE__ */ jsxs22("label", { className: "mbrfa-check", children: [
10327
- /* @__PURE__ */ jsx24("input", { type: "checkbox", disabled: locked || !packet || !reviewed || !destination, checked: confirmed && !!packet, onChange: (event) => setConfirmed(event.target.checked) }),
10428
+ mode === "send" ? environment !== "live" ? /* @__PURE__ */ jsx25("p", { className: "mbtd-note", children: "Sandbox: review and prepare the packet here. External fax delivery is disabled. Email sending is also disabled." }) : !canSend ? /* @__PURE__ */ jsx25("p", { children: "Sending requires permission from your organization." }) : /* @__PURE__ */ jsxs23(Fragment14, { children: [
10429
+ /* @__PURE__ */ jsxs23("label", { className: "mbrfa-check", children: [
10430
+ /* @__PURE__ */ jsx25("input", { type: "checkbox", disabled: locked || !packet || !reviewed || !destination, checked: confirmed && !!packet, onChange: (event) => setConfirmed(event.target.checked) }),
10328
10431
  "Send this reviewed packet to ",
10329
10432
  destination?.recipientName ? `${destination.recipientName} at ` : "",
10330
10433
  destination?.destination || "the selected authorization recipient",
10331
10434
  ". I verified the recipient for this claim."
10332
10435
  ] }),
10333
- /* @__PURE__ */ jsx24("button", { type: "button", className: "mbtd-primary", disabled: locked || !confirmed || !reviewed || !packet || !destination || !rfa.readiness.ready || !!rfa.submittedAt, onClick: () => void run(async () => {
10436
+ /* @__PURE__ */ jsx25("button", { type: "button", className: "mbtd-primary", disabled: locked || !confirmed || !reviewed || !packet || !destination || !rfa.readiness.ready || !!rfa.submittedAt, onClick: () => void run(async () => {
10334
10437
  if (!packet || !destination || !confirmed || !reviewed) return;
10335
10438
  const body = { packetId: packet.preview.packetId, sha256: packet.preview.sha256, channel: destination.method, to: destination.destination, ...destination.recipientName ? { recipientName: destination.recipientName } : {}, ...message.trim() ? { message: message.trim() } : {} };
10336
10439
  const signature = JSON.stringify(body);
@@ -10346,13 +10449,13 @@ function RfaDeliveryPanel({ rfa, client, documentIds, directory, directoryLoadin
10346
10449
  }
10347
10450
 
10348
10451
  // src/treatment-draft-shared.tsx
10349
- import { useRef as useRef12, useState as useState16 } from "react";
10350
- import { Fragment as Fragment15, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
10452
+ import { useRef as useRef12, useState as useState17 } from "react";
10453
+ import { Fragment as Fragment15, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
10351
10454
  function useDraftSave(onSave) {
10352
10455
  const pending = useRef12(false);
10353
- const [busy, setBusy] = useState16(false);
10354
- const [message, setMessage] = useState16("");
10355
- const [error, setError] = useState16(null);
10456
+ const [busy, setBusy] = useState17(false);
10457
+ const [message, setMessage] = useState17("");
10458
+ const [error, setError] = useState17(null);
10356
10459
  const clear = () => {
10357
10460
  setMessage("");
10358
10461
  setError(null);
@@ -10379,8 +10482,8 @@ function useDraftSave(onSave) {
10379
10482
  return { busy, message, error, clear, save };
10380
10483
  }
10381
10484
  function TreatmentDraftShell({ title, description, children, hideHeading = false, appearance, className = "", style }) {
10382
- return /* @__PURE__ */ jsxs23("section", { className: `mbtd ${className}`.trim(), "aria-label": title, style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
10383
- /* @__PURE__ */ jsx25("style", { children: `.mbtd{font:14px/1.5 ui-sans-serif,system-ui,sans-serif;color:var(--mb-text);min-width:0}.mbtd *{box-sizing:border-box}.mbtd h2{font-size:22px;margin:0 0 6px}.mbtd p{margin:6px 0 16px;color:var(--mb-muted)}.mbtd form{display:grid;gap:16px}.mbtd fieldset{margin:0;padding:16px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);min-width:0}.mbtd legend{font-weight:600;padding:0 6px}.mbtd .mbtd-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.mbtd label{display:grid;gap:5px;font-size:13px;min-width:0}.mbtd input,.mbtd select,.mbtd textarea,.mbtd button{font:inherit;max-width:100%;min-width:0;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);padding:9px 11px;color:var(--mb-text);background:var(--mb-input);min-height:40px}.mbtd .mbrfa-check{display:flex;align-items:flex-start;gap:8px}.mbtd .mbrfa-check input[type=checkbox]{width:16px;height:16px;min-height:16px;margin:2px 0 0;padding:0;flex-shrink:0}
10485
+ return /* @__PURE__ */ jsxs24("section", { className: `mbtd ${className}`.trim(), "aria-label": title, style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
10486
+ /* @__PURE__ */ jsx26("style", { children: `.mbtd{font:14px/1.5 ui-sans-serif,system-ui,sans-serif;color:var(--mb-text);min-width:0}.mbtd *{box-sizing:border-box}.mbtd h2{font-size:22px;margin:0 0 6px}.mbtd p{margin:6px 0 16px;color:var(--mb-muted)}.mbtd form{display:grid;gap:16px}.mbtd fieldset{margin:0;padding:16px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);min-width:0}.mbtd legend{font-weight:600;padding:0 6px}.mbtd .mbtd-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.mbtd label{display:grid;gap:5px;font-size:13px;min-width:0}.mbtd input,.mbtd select,.mbtd textarea,.mbtd button{font:inherit;max-width:100%;min-width:0;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);padding:9px 11px;color:var(--mb-text);background:var(--mb-input);min-height:40px}.mbtd .mbrfa-check{display:flex;align-items:flex-start;gap:8px}.mbtd .mbrfa-check input[type=checkbox]{width:16px;height:16px;min-height:16px;margin:2px 0 0;padding:0;flex-shrink:0}
10384
10487
  .mbtd .mbrfa-request-details>.mbtd-grid{display:flex;flex-direction:column;gap:12px}
10385
10488
  .mbtd .mbrfa-request-types{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding-bottom:12px;border-bottom:1px solid var(--mb-border)}
10386
10489
  .mbtd .mbrfa-request-details .mbrfa-check{min-height:44px;align-items:flex-start;gap:10px;line-height:20px;cursor:pointer}
@@ -10402,6 +10505,8 @@ function TreatmentDraftShell({ title, description, children, hideHeading = false
10402
10505
  .mbtd .mbrfa-picker p,.mbtd .mbrfa-guidance p{margin:0;font-size:12px}.mbtd .mbrfa-guidance{display:grid;gap:4px}
10403
10506
  .mbtd .mbrfa-section-actions{display:flex;gap:12px;align-items:center;margin-top:14px;font-size:12px;color:var(--mb-muted)}
10404
10507
  .mbtd .mbrfa-field-hint{font-size:12px;color:var(--mb-muted);font-weight:400}
10508
+ .mbtd .mbrfa-req{color:var(--mb-danger,#c0392b);font-weight:700}
10509
+ .mbtd .mbrfa-contact-grid{grid-template-columns:repeat(4,minmax(0,1fr))}.mbtd .mbrfa-contact-grid>.mbrfa-s3{grid-column:span 2}.mbtd .mbrfa-contact-grid>:is(.mbrfa-s1,.mbrfa-s2){grid-column:span 1}
10405
10510
  .mbtd .mbrfa-link-out{color:var(--mb-muted)!important;text-decoration:none}.mbtd .mbrfa-link-out:hover{text-decoration:underline}.mbtd .mbrfa-picker-links a{text-decoration:none}
10406
10511
  .mbtd button.mbrfa-link.mbrfa-link{border:0;background:none;padding:0;min-height:0;color:var(--mb-accent);font-size:12px;text-decoration:none}.mbtd button.mbrfa-link.mbrfa-link:hover,.mbtd .mbrfa-picker-links a:hover{text-decoration:underline}
10407
10512
  .mbtd fieldset.mbrfa-plain.mbrfa-plain{border:0;padding:0;margin:0;background:none;border-radius:0;min-width:0}
@@ -10422,6 +10527,7 @@ function TreatmentDraftShell({ title, description, children, hideHeading = false
10422
10527
  .mbtd form.mbrfa-official .mbrfa-request-types input[type=radio]:not(:checked){border-color:var(--mb-muted)}
10423
10528
  .mbtd form.mbrfa-official .mbrfa-request-details .mbrfa-check{min-height:32px;font-size:13px}
10424
10529
  .mbtd form.mbrfa-official .mbrfa-section-actions{margin-top:16px;padding-top:12px;border-top:1px dashed var(--mb-border)}
10530
+ .mbtd .mbrfa-section-actions>button{min-height:36px;padding:7px 14px;font-size:13px;font-weight:600}
10425
10531
  .mbtd form.mbrfa-official>div:has(>button:only-child)>button{border-style:dashed;color:var(--mb-accent);font-weight:500}
10426
10532
  .mbtd form.mbrfa-official>.mbtd-actions:last-child{position:sticky;bottom:12px;z-index:5;justify-content:flex-end;flex-direction:row-reverse;margin-top:0;padding:10px 14px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:color-mix(in srgb,var(--mb-surface) 92%,transparent);backdrop-filter:blur(6px);box-shadow:0 6px 20px #00000014}
10427
10533
  .mbtd form.mbrfa-official>.mbtd-actions:last-child>[role=status]{margin-right:auto;order:9}
@@ -10430,9 +10536,9 @@ function TreatmentDraftShell({ title, description, children, hideHeading = false
10430
10536
  @media(max-width:640px){.mbtd .mbrfa-request-types{grid-template-columns:1fr;gap:4px}}
10431
10537
  @media(forced-colors:active){.mbtd .mbrfa-request-types input[type=radio]{appearance:auto}.mbtd .mbrfa-request-types input[type=radio]::after{display:none}}
10432
10538
  .mbtd textarea{resize:vertical;min-height:76px}.mbtd button{cursor:pointer;background:var(--mb-surface)}.mbtd button:disabled{opacity:.55;cursor:default}.mbtd .mbtd-primary{background:var(--mb-accent);color:var(--mb-accent-contrast);border-color:var(--mb-accent)}.mbtd .mbtd-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:12px}.mbtd .mbtd-wide{grid-column:1/-1}.mbtd [role=alert]{color:var(--mb-danger)}.mbtd [role=status]{margin:0}.mbtd :is(input,select,textarea,button):focus-visible{outline:2px solid var(--mb-accent);outline-offset:2px}.mbtd .mbtd-note{padding:12px;background:var(--mb-soft);border-radius:var(--mb-control-radius)}.mbtd a{color:var(--mb-accent)}@media(max-width:520px){.mbtd .mbtd-grid{grid-template-columns:minmax(0,1fr)}.mbtd fieldset{padding:12px}}` }),
10433
- !hideHeading ? /* @__PURE__ */ jsxs23(Fragment15, { children: [
10434
- /* @__PURE__ */ jsx25("h2", { children: title }),
10435
- /* @__PURE__ */ jsx25("p", { children: description })
10539
+ !hideHeading ? /* @__PURE__ */ jsxs24(Fragment15, { children: [
10540
+ /* @__PURE__ */ jsx26("h2", { children: title }),
10541
+ /* @__PURE__ */ jsx26("p", { children: description })
10436
10542
  ] }) : null,
10437
10543
  children
10438
10544
  ] });
@@ -10442,7 +10548,7 @@ function isDraftDate(value) {
10442
10548
  }
10443
10549
 
10444
10550
  // src/rfa-task-board.tsx
10445
- import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
10551
+ import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
10446
10552
  function rfaTaskState(task, now = Date.now()) {
10447
10553
  if (task.status === "resolved" || task.resolvedAt) return "Completed";
10448
10554
  return Date.parse(task.snoozedUntil ?? task.dueAt) > now ? "Scheduled" : "Due";
@@ -10484,37 +10590,37 @@ var date3 = (value) => new Date(value).toLocaleString();
10484
10590
  function RfaTaskBoard({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride, ...props }) {
10485
10591
  const options = useMemo7(() => ({ ...sessionEndpoint ? { sessionEndpoint } : {}, ...getSession ? { getSession } : {}, ...apiBaseUrl ? { apiBaseUrl } : {}, ...fetchOverride ? { fetch: fetchOverride } : {} }), [sessionEndpoint, getSession, apiBaseUrl, fetchOverride]);
10486
10592
  const identity = useMemo7(() => crypto.randomUUID(), [options]);
10487
- return /* @__PURE__ */ jsx26(TaskBoardContent, { ...props, options }, `${identity}:${props.patientId ?? ""}:${props.claimId ?? ""}:${props.renderingProviderId ?? ""}`);
10593
+ return /* @__PURE__ */ jsx27(TaskBoardContent, { ...props, options }, `${identity}:${props.patientId ?? ""}:${props.claimId ?? ""}:${props.renderingProviderId ?? ""}`);
10488
10594
  }
10489
10595
  function TaskBoardContent({ options, patientId, claimId, renderingProviderId, permissions = [], onSelect, embedded = false, presentation = "dashboard", query, getTaskHref, onNavigate, renderTaskIdentity, ...appearance }) {
10490
10596
  const client = useMemo7(() => createRfaLifecycleClient(options), [options]);
10491
10597
  const requests = useMemo7(() => createRfaClient(options), [options]);
10492
- const [requestIdentities, setRequestIdentities] = useState17({});
10493
- const [tasks, setTasks] = useState17([]);
10494
- const [error, setError] = useState17("");
10495
- const [loading, setLoading] = useState17(true);
10496
- const [now, setNow] = useState17(Date.now);
10497
- const [inboxCount, setInboxCount] = useState17(null);
10498
- useEffect14(() => {
10598
+ const [requestIdentities, setRequestIdentities] = useState18({});
10599
+ const [tasks, setTasks] = useState18([]);
10600
+ const [error, setError] = useState18("");
10601
+ const [loading, setLoading] = useState18(true);
10602
+ const [now, setNow] = useState18(Date.now);
10603
+ const [inboxCount, setInboxCount] = useState18(null);
10604
+ useEffect15(() => {
10499
10605
  const timer = setInterval(() => setNow(Date.now()), 6e4);
10500
10606
  return () => clearInterval(timer);
10501
10607
  }, []);
10502
- const [view, setView] = useState17(query?.state ?? "Due");
10503
- const [selection, setSelection] = useState17(null);
10608
+ const [view, setView] = useState18(query?.state ?? "Due");
10609
+ const [selection, setSelection] = useState18(null);
10504
10610
  const list3 = presentation === "list";
10505
- useEffect14(() => {
10611
+ useEffect15(() => {
10506
10612
  setView(query?.state ?? "Due");
10507
10613
  setSelection(null);
10508
10614
  }, [query]);
10509
10615
  const activeSelection = list3 ? query ?? {} : selection;
10510
10616
  const drilldown = useRef13(null);
10511
- useEffect14(() => {
10617
+ useEffect15(() => {
10512
10618
  if (selection) {
10513
10619
  drilldown.current?.scrollIntoView?.({ block: "nearest" });
10514
10620
  drilldown.current?.focus({ preventScroll: true });
10515
10621
  }
10516
10622
  }, [selection]);
10517
- useEffect14(() => {
10623
+ useEffect15(() => {
10518
10624
  let active = true;
10519
10625
  let pending = false;
10520
10626
  const load = async (background = false) => {
@@ -10564,7 +10670,7 @@ function TaskBoardContent({ options, patientId, claimId, renderingProviderId, pe
10564
10670
  const stateTasks = tasks.filter((task) => rfaTaskState(task, now) === view);
10565
10671
  const filtered = stateTasks.filter((task) => (!activeSelection?.kind || task.kind === activeSelection.kind) && (!activeSelection?.kinds || activeSelection.kinds.includes(task.kind)) && (!activeSelection?.bucket || rfaTaskAgeBucket(task.createdAt, now) === activeSelection.bucket));
10566
10672
  const visibleRequests = JSON.stringify(list3 && !renderTaskIdentity ? [...new Map(filtered.map((task) => [task.rfaId, task.claimId])).entries()].sort(([a], [b]) => a.localeCompare(b)) : []);
10567
- useEffect14(() => {
10673
+ useEffect15(() => {
10568
10674
  let active = true;
10569
10675
  setRequestIdentities({});
10570
10676
  const load = async () => {
@@ -10590,15 +10696,15 @@ function TaskBoardContent({ options, patientId, claimId, renderingProviderId, pe
10590
10696
  if (renderTaskIdentity) return renderTaskIdentity(task);
10591
10697
  if (!list3) return null;
10592
10698
  const record2 = requestIdentities[task.rfaId];
10593
- return record2 ? /* @__PURE__ */ jsxs24("div", { className: "mbrfa-task-identity", children: [
10594
- /* @__PURE__ */ jsx26("span", { children: record2.employeeName }),
10595
- /* @__PURE__ */ jsxs24("small", { children: [
10699
+ return record2 ? /* @__PURE__ */ jsxs25("div", { className: "mbrfa-task-identity", children: [
10700
+ /* @__PURE__ */ jsx27("span", { children: record2.employeeName }),
10701
+ /* @__PURE__ */ jsxs25("small", { children: [
10596
10702
  "Claim ",
10597
10703
  record2.claimNumber || record2.claimId,
10598
10704
  record2.displayReference ? ` \xB7 ${record2.displayReference}` : ""
10599
10705
  ] }),
10600
- /* @__PURE__ */ jsx26("small", { children: record2.items?.map((item) => item.serviceDescription).filter(Boolean).join("; ") || "Request for authorization" })
10601
- ] }) : /* @__PURE__ */ jsxs24("small", { children: [
10706
+ /* @__PURE__ */ jsx27("small", { children: record2.items?.map((item) => item.serviceDescription).filter(Boolean).join("; ") || "Request for authorization" })
10707
+ ] }) : /* @__PURE__ */ jsxs25("small", { children: [
10602
10708
  "Request ",
10603
10709
  task.rfaId,
10604
10710
  " \xB7 Claim ",
@@ -10610,19 +10716,19 @@ function TaskBoardContent({ options, patientId, claimId, renderingProviderId, pe
10610
10716
  const selectedTitle = activeSelection?.kind ? rfaTaskLabel(activeSelection.kind) : activeSelection?.title ?? (activeSelection?.kinds ? taskGroups.find((group) => group.kinds.length === activeSelection.kinds.length && group.kinds.every((kind) => activeSelection.kinds.includes(kind)))?.title ?? activeSelection.kinds.map(rfaTaskLabel).join(", ") : "All tasks");
10611
10717
  const selectionControl = (next, text3, ariaLabel) => {
10612
10718
  const target = { ...next, state: view };
10613
- if (!getTaskHref) return /* @__PURE__ */ jsx26("button", { type: "button", className: ariaLabel ? "mbrfa-task-count" : void 0, ...ariaLabel ? { "aria-label": ariaLabel } : {}, onClick: () => setSelection(next), children: text3 });
10719
+ if (!getTaskHref) return /* @__PURE__ */ jsx27("button", { type: "button", className: ariaLabel ? "mbrfa-task-count" : void 0, ...ariaLabel ? { "aria-label": ariaLabel } : {}, onClick: () => setSelection(next), children: text3 });
10614
10720
  const href = getTaskHref(target);
10615
- return /* @__PURE__ */ jsx26("a", { href, className: ariaLabel ? "mbrfa-task-count" : "mbrfa-route-link", ...ariaLabel ? { "aria-label": ariaLabel } : {}, onClick: (event) => {
10721
+ return /* @__PURE__ */ jsx27("a", { href, className: ariaLabel ? "mbrfa-task-count" : "mbrfa-route-link", ...ariaLabel ? { "aria-label": ariaLabel } : {}, onClick: (event) => {
10616
10722
  if (!onNavigate || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
10617
10723
  event.preventDefault();
10618
10724
  onNavigate(href);
10619
10725
  }, children: text3 });
10620
10726
  };
10621
- const countCell = (items, kind, bucket) => items.length ? selectionControl({ ...kind ? { kind } : {}, ...bucket ? { bucket } : {} }, items.length, `${rfaTaskLabel(kind ?? "all_tasks")}, ${bucket ? columns.find((column) => column.key === bucket)?.label : "total"}: ${items.length} ${view.toLowerCase()} tasks`) : /* @__PURE__ */ jsx26("span", { className: "mbrfa-task-zero", children: "0" });
10622
- return /* @__PURE__ */ jsxs24(TreatmentDraftShell, { ...appearance, hideHeading: embedded, title: list3 ? "RFA task list" : "RFA tasks", description: list3 ? "Follow-up tasks matching the selected status, action and age." : "Open follow-up work, grouped by next action and age.", children: [
10623
- /* @__PURE__ */ jsx26("style", { children: `.mbrfa-task-tabs{display:flex;gap:8px;margin:12px 0 18px;flex-wrap:wrap}.mbtd .mbrfa-task-tabs button[aria-pressed=true]{border-color:var(--mb-accent);background:var(--mb-soft);color:var(--mb-accent);font-weight:650}.mbrfa-task-group{border:1px solid var(--mb-border);border-radius:var(--mb-radius);overflow:auto;margin:14px 0;background:var(--mb-surface)}.mbrfa-task-group table{width:100%;border-collapse:collapse;min-width:620px;table-layout:fixed}.mbrfa-task-group th,.mbrfa-task-group td{padding:8px 14px;border-bottom:1px solid var(--mb-border);text-align:center}.mbrfa-task-group th:first-child,.mbrfa-task-group td:first-child{text-align:left;width:31%}.mbrfa-task-group thead th{font-size:12px;background:var(--mb-soft)}.mbrfa-task-group thead th:first-child{font-size:14px}.mbrfa-task-group th small{display:block;font-weight:400;color:var(--mb-muted)}.mbrfa-task-group tfoot{font-weight:650;background:var(--mb-soft)}.mbrfa-task-group tfoot td,.mbrfa-task-group tfoot th{border:0}.mbtd .mbrfa-task-count{display:inline-flex;align-items:center;justify-content:center;text-decoration:none;border:0;background:transparent;color:var(--mb-accent);font-weight:650;min-height:28px;padding:2px 10px}.mbrfa-task-zero{color:var(--mb-muted)}.mbrfa-task-drilldown{margin:20px 0}.mbrfa-task-drilldown table{width:100%;border-collapse:collapse}.mbrfa-task-drilldown th,.mbrfa-task-drilldown td{text-align:left;border-bottom:1px solid var(--mb-border);padding:10px;vertical-align:top}.mbrfa-task-drilldown td small{display:block;color:var(--mb-muted);overflow-wrap:anywhere}.mbrfa-task-scroll{overflow:auto}.mbrfa-task-drilldown h3{margin:0}.mbrfa-inbox{border-top:1px solid var(--mb-border);padding-top:18px;margin-top:20px}.mbrfa-inbox h3{margin-top:0}.mbrfa-list{display:grid;gap:8px;margin:12px 0}.mbrfa-card{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:12px;border:1px solid var(--mb-border);border-radius:8px}.mbrfa-card span{display:block;margin-top:4px}.mbrfa-card p{margin:6px 0}.mbrfa-match-disclosure{margin-top:20px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);padding:14px;background:var(--mb-surface)}.mbrfa-match-disclosure>summary{cursor:pointer;font-weight:650;color:var(--mb-accent)}@media(max-width:600px){.mbrfa-card{align-items:stretch;flex-direction:column}}` }),
10624
- /* @__PURE__ */ jsx26("strong", { children: "Task status" }),
10625
- /* @__PURE__ */ jsx26("div", { className: "mbrfa-task-tabs", role: "group", "aria-label": "Task status", children: ["Due", "Scheduled", "Completed"].map((state) => /* @__PURE__ */ jsxs24("button", { type: "button", "aria-pressed": view === state, onClick: () => {
10727
+ const countCell = (items, kind, bucket) => items.length ? selectionControl({ ...kind ? { kind } : {}, ...bucket ? { bucket } : {} }, items.length, `${rfaTaskLabel(kind ?? "all_tasks")}, ${bucket ? columns.find((column) => column.key === bucket)?.label : "total"}: ${items.length} ${view.toLowerCase()} tasks`) : /* @__PURE__ */ jsx27("span", { className: "mbrfa-task-zero", children: "0" });
10728
+ return /* @__PURE__ */ jsxs25(TreatmentDraftShell, { ...appearance, hideHeading: embedded, title: list3 ? "RFA task list" : "RFA tasks", description: list3 ? "Follow-up tasks matching the selected status, action and age." : "Open follow-up work, grouped by next action and age.", children: [
10729
+ /* @__PURE__ */ jsx27("style", { children: `.mbrfa-task-tabs{display:flex;gap:8px;margin:12px 0 18px;flex-wrap:wrap}.mbtd .mbrfa-task-tabs button[aria-pressed=true]{border-color:var(--mb-accent);background:var(--mb-soft);color:var(--mb-accent);font-weight:650}.mbrfa-task-group{border:1px solid var(--mb-border);border-radius:var(--mb-radius);overflow:auto;margin:14px 0;background:var(--mb-surface)}.mbrfa-task-group table{width:100%;border-collapse:collapse;min-width:620px;table-layout:fixed}.mbrfa-task-group th,.mbrfa-task-group td{padding:8px 14px;border-bottom:1px solid var(--mb-border);text-align:center}.mbrfa-task-group th:first-child,.mbrfa-task-group td:first-child{text-align:left;width:31%}.mbrfa-task-group thead th{font-size:12px;background:var(--mb-soft)}.mbrfa-task-group thead th:first-child{font-size:14px}.mbrfa-task-group th small{display:block;font-weight:400;color:var(--mb-muted)}.mbrfa-task-group tfoot{font-weight:650;background:var(--mb-soft)}.mbrfa-task-group tfoot td,.mbrfa-task-group tfoot th{border:0}.mbtd .mbrfa-task-count{display:inline-flex;align-items:center;justify-content:center;text-decoration:none;border:0;background:transparent;color:var(--mb-accent);font-weight:650;min-height:28px;padding:2px 10px}.mbrfa-task-zero{color:var(--mb-muted)}.mbrfa-task-drilldown{margin:20px 0}.mbrfa-task-drilldown table{width:100%;border-collapse:collapse}.mbrfa-task-drilldown th,.mbrfa-task-drilldown td{text-align:left;border-bottom:1px solid var(--mb-border);padding:10px;vertical-align:top}.mbrfa-task-drilldown td small{display:block;color:var(--mb-muted);overflow-wrap:anywhere}.mbrfa-task-scroll{overflow:auto}.mbrfa-task-drilldown h3{margin:0}.mbrfa-inbox{border-top:1px solid var(--mb-border);padding-top:18px;margin-top:20px}.mbrfa-inbox h3{margin-top:0}.mbrfa-list{display:grid;gap:8px;margin:12px 0}.mbrfa-card{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:12px;border:1px solid var(--mb-border);border-radius:8px}.mbrfa-card span{display:block;margin-top:4px}.mbrfa-card p{margin:6px 0}.mbrfa-match-disclosure{margin-top:20px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);padding:14px;background:var(--mb-surface)}.mbrfa-match-disclosure>summary{cursor:pointer;font-weight:650;color:var(--mb-accent)}@media(max-width:600px){.mbrfa-card{align-items:stretch;flex-direction:column}}` }),
10730
+ /* @__PURE__ */ jsx27("strong", { children: "Task status" }),
10731
+ /* @__PURE__ */ jsx27("div", { className: "mbrfa-task-tabs", role: "group", "aria-label": "Task status", children: ["Due", "Scheduled", "Completed"].map((state) => /* @__PURE__ */ jsxs25("button", { type: "button", "aria-pressed": view === state, onClick: () => {
10626
10732
  if (list3 && getTaskHref) {
10627
10733
  const href = getTaskHref({ ...query, state });
10628
10734
  if (onNavigate) onNavigate(href);
@@ -10637,112 +10743,112 @@ function TaskBoardContent({ options, patientId, claimId, renderingProviderId, pe
10637
10743
  tasks.filter((task) => rfaTaskState(task, now) === state).length,
10638
10744
  ")"
10639
10745
  ] }, state)) }),
10640
- /* @__PURE__ */ jsx26("p", { className: "mbtd-note", children: taskViewDescriptions[view] }),
10641
- error ? /* @__PURE__ */ jsx26("p", { role: "alert", children: error }) : null,
10642
- loading ? /* @__PURE__ */ jsx26("p", { role: "status", children: "Loading tasks\u2026" }) : !error && !stateTasks.length ? /* @__PURE__ */ jsxs24("p", { children: [
10746
+ /* @__PURE__ */ jsx27("p", { className: "mbtd-note", children: taskViewDescriptions[view] }),
10747
+ error ? /* @__PURE__ */ jsx27("p", { role: "alert", children: error }) : null,
10748
+ loading ? /* @__PURE__ */ jsx27("p", { role: "status", children: "Loading tasks\u2026" }) : !error && !stateTasks.length ? /* @__PURE__ */ jsxs25("p", { children: [
10643
10749
  "No ",
10644
10750
  view.toLowerCase(),
10645
10751
  " tasks."
10646
10752
  ] }) : null,
10647
- !list3 && !loading && stateTasks.length ? /* @__PURE__ */ jsx26("p", { children: "Calendar days since task opened. Select a count to see the tasks. Counts represent tasks, so one RFA may appear more than once." }) : null,
10753
+ !list3 && !loading && stateTasks.length ? /* @__PURE__ */ jsx27("p", { children: "Calendar days since task opened. Select a count to see the tasks. Counts represent tasks, so one RFA may appear more than once." }) : null,
10648
10754
  !list3 ? groups2.map((group) => {
10649
10755
  const groupTasks = stateTasks.filter((task) => group.kinds.includes(task.kind));
10650
- return /* @__PURE__ */ jsx26("section", { className: "mbrfa-task-group", "aria-label": group.title, children: /* @__PURE__ */ jsxs24("table", { children: [
10651
- /* @__PURE__ */ jsx26("thead", { children: /* @__PURE__ */ jsxs24("tr", { children: [
10652
- /* @__PURE__ */ jsxs24("th", { scope: "col", children: [
10756
+ return /* @__PURE__ */ jsx27("section", { className: "mbrfa-task-group", "aria-label": group.title, children: /* @__PURE__ */ jsxs25("table", { children: [
10757
+ /* @__PURE__ */ jsx27("thead", { children: /* @__PURE__ */ jsxs25("tr", { children: [
10758
+ /* @__PURE__ */ jsxs25("th", { scope: "col", children: [
10653
10759
  group.title,
10654
- /* @__PURE__ */ jsx26("small", { children: "By date task opened" })
10760
+ /* @__PURE__ */ jsx27("small", { children: "By date task opened" })
10655
10761
  ] }),
10656
- columns.map((column) => /* @__PURE__ */ jsx26("th", { scope: "col", children: /* @__PURE__ */ jsx26("span", { className: "mbrfa-task-age", children: column.label }) }, column.key)),
10657
- /* @__PURE__ */ jsx26("th", { scope: "col", children: "Task total" })
10762
+ columns.map((column) => /* @__PURE__ */ jsx27("th", { scope: "col", children: /* @__PURE__ */ jsx27("span", { className: "mbrfa-task-age", children: column.label }) }, column.key)),
10763
+ /* @__PURE__ */ jsx27("th", { scope: "col", children: "Task total" })
10658
10764
  ] }) }),
10659
- /* @__PURE__ */ jsx26("tbody", { children: group.kinds.filter((kind) => groupTasks.some((task) => task.kind === kind)).map((kind) => {
10765
+ /* @__PURE__ */ jsx27("tbody", { children: group.kinds.filter((kind) => groupTasks.some((task) => task.kind === kind)).map((kind) => {
10660
10766
  const items = groupTasks.filter((task) => task.kind === kind);
10661
- return /* @__PURE__ */ jsxs24("tr", { children: [
10662
- /* @__PURE__ */ jsxs24("th", { scope: "row", children: [
10767
+ return /* @__PURE__ */ jsxs25("tr", { children: [
10768
+ /* @__PURE__ */ jsxs25("th", { scope: "row", children: [
10663
10769
  rfaTaskLabel(kind),
10664
- descriptions[kind] && /* @__PURE__ */ jsx26("small", { children: descriptions[kind] })
10770
+ descriptions[kind] && /* @__PURE__ */ jsx27("small", { children: descriptions[kind] })
10665
10771
  ] }),
10666
- columns.map((column) => /* @__PURE__ */ jsx26("td", { children: countCell(items.filter((task) => rfaTaskAgeBucket(task.createdAt, now) === column.key), kind, column.key) }, column.key)),
10667
- /* @__PURE__ */ jsx26("td", { children: countCell(items, kind) })
10772
+ columns.map((column) => /* @__PURE__ */ jsx27("td", { children: countCell(items.filter((task) => rfaTaskAgeBucket(task.createdAt, now) === column.key), kind, column.key) }, column.key)),
10773
+ /* @__PURE__ */ jsx27("td", { children: countCell(items, kind) })
10668
10774
  ] }, kind);
10669
10775
  }) }),
10670
- /* @__PURE__ */ jsx26("tfoot", { children: /* @__PURE__ */ jsxs24("tr", { children: [
10671
- /* @__PURE__ */ jsx26("th", { scope: "row", children: "Total" }),
10776
+ /* @__PURE__ */ jsx27("tfoot", { children: /* @__PURE__ */ jsxs25("tr", { children: [
10777
+ /* @__PURE__ */ jsx27("th", { scope: "row", children: "Total" }),
10672
10778
  [...columns, { key: "total", label: "Total" }].map((column) => {
10673
10779
  const items = column.key === "total" ? groupTasks : groupTasks.filter((task) => rfaTaskAgeBucket(task.createdAt, now) === column.key);
10674
- return /* @__PURE__ */ jsx26("td", { children: items.length ? selectionControl({ kinds: group.kinds, title: group.title, ...column.key !== "total" ? { bucket: column.key } : {} }, items.length, `${group.title}, ${column.label}: ${items.length} ${view.toLowerCase()} tasks`) : /* @__PURE__ */ jsx26("span", { className: "mbrfa-task-zero", children: "0" }) }, column.key);
10780
+ return /* @__PURE__ */ jsx27("td", { children: items.length ? selectionControl({ kinds: group.kinds, title: group.title, ...column.key !== "total" ? { bucket: column.key } : {} }, items.length, `${group.title}, ${column.label}: ${items.length} ${view.toLowerCase()} tasks`) : /* @__PURE__ */ jsx27("span", { className: "mbrfa-task-zero", children: "0" }) }, column.key);
10675
10781
  })
10676
10782
  ] }) })
10677
10783
  ] }) }, group.title);
10678
10784
  }) : null,
10679
- !list3 && stateTasks.length ? /* @__PURE__ */ jsx26("div", { className: "mbtd-actions", children: selectionControl({}, `View all ${view.toLowerCase()} tasks (${stateTasks.length})`) }) : null,
10680
- list3 || selection ? /* @__PURE__ */ jsxs24("section", { ref: drilldown, tabIndex: -1, className: "mbrfa-task-drilldown", "aria-label": "Selected tasks", children: [
10681
- /* @__PURE__ */ jsxs24("div", { className: "mbtd-actions", children: [
10682
- /* @__PURE__ */ jsxs24("h3", { children: [
10785
+ !list3 && stateTasks.length ? /* @__PURE__ */ jsx27("div", { className: "mbtd-actions", children: selectionControl({}, `View all ${view.toLowerCase()} tasks (${stateTasks.length})`) }) : null,
10786
+ list3 || selection ? /* @__PURE__ */ jsxs25("section", { ref: drilldown, tabIndex: -1, className: "mbrfa-task-drilldown", "aria-label": "Selected tasks", children: [
10787
+ /* @__PURE__ */ jsxs25("div", { className: "mbtd-actions", children: [
10788
+ /* @__PURE__ */ jsxs25("h3", { children: [
10683
10789
  selectedTitle,
10684
10790
  activeSelection?.bucket ? ` \xB7 ${[...taskAgeColumns, { key: "unknown", label: "Unknown age" }].find((column) => column.key === activeSelection.bucket)?.label}` : "",
10685
10791
  " (",
10686
10792
  filtered.length,
10687
10793
  ")"
10688
10794
  ] }),
10689
- !list3 ? /* @__PURE__ */ jsx26("button", { type: "button", onClick: () => setSelection(null), children: "Close task list" }) : null
10795
+ !list3 ? /* @__PURE__ */ jsx27("button", { type: "button", onClick: () => setSelection(null), children: "Close task list" }) : null
10690
10796
  ] }),
10691
- /* @__PURE__ */ jsx26("div", { className: "mbrfa-task-scroll", children: /* @__PURE__ */ jsxs24("table", { children: [
10692
- /* @__PURE__ */ jsx26("thead", { children: /* @__PURE__ */ jsxs24("tr", { children: [
10693
- /* @__PURE__ */ jsx26("th", { children: "Task / request" }),
10694
- /* @__PURE__ */ jsx26("th", { children: view === "Completed" ? "Completed" : "Follow up" }),
10695
- /* @__PURE__ */ jsx26("th", { children: "Assigned to" }),
10696
- /* @__PURE__ */ jsx26("th", { children: "Action" })
10797
+ /* @__PURE__ */ jsx27("div", { className: "mbrfa-task-scroll", children: /* @__PURE__ */ jsxs25("table", { children: [
10798
+ /* @__PURE__ */ jsx27("thead", { children: /* @__PURE__ */ jsxs25("tr", { children: [
10799
+ /* @__PURE__ */ jsx27("th", { children: "Task / request" }),
10800
+ /* @__PURE__ */ jsx27("th", { children: view === "Completed" ? "Completed" : "Follow up" }),
10801
+ /* @__PURE__ */ jsx27("th", { children: "Assigned to" }),
10802
+ /* @__PURE__ */ jsx27("th", { children: "Action" })
10697
10803
  ] }) }),
10698
- /* @__PURE__ */ jsx26("tbody", { children: filtered.map((task) => /* @__PURE__ */ jsxs24("tr", { children: [
10699
- /* @__PURE__ */ jsxs24("td", { children: [
10700
- /* @__PURE__ */ jsx26("strong", { children: rfaTaskLabel(task.kind) }),
10804
+ /* @__PURE__ */ jsx27("tbody", { children: filtered.map((task) => /* @__PURE__ */ jsxs25("tr", { children: [
10805
+ /* @__PURE__ */ jsxs25("td", { children: [
10806
+ /* @__PURE__ */ jsx27("strong", { children: rfaTaskLabel(task.kind) }),
10701
10807
  taskIdentity(task),
10702
- task.responseFilename ? /* @__PURE__ */ jsx26("small", { children: task.responseFilename }) : null,
10703
- task.lastOutcome ? /* @__PURE__ */ jsxs24("small", { children: [
10808
+ task.responseFilename ? /* @__PURE__ */ jsx27("small", { children: task.responseFilename }) : null,
10809
+ task.lastOutcome ? /* @__PURE__ */ jsxs25("small", { children: [
10704
10810
  "Last outcome: ",
10705
10811
  task.lastOutcome.replaceAll("_", " ")
10706
10812
  ] }) : null,
10707
- task.lastNote ? /* @__PURE__ */ jsx26("small", { children: task.lastNote }) : null
10813
+ task.lastNote ? /* @__PURE__ */ jsx27("small", { children: task.lastNote }) : null
10708
10814
  ] }),
10709
- /* @__PURE__ */ jsx26("td", { children: date3(view === "Completed" ? task.resolvedAt ?? task.updatedAt : task.snoozedUntil ?? task.dueAt) }),
10710
- /* @__PURE__ */ jsx26("td", { children: task.assigneeReference || "Unassigned" }),
10711
- /* @__PURE__ */ jsx26("td", { children: /* @__PURE__ */ jsx26("button", { type: "button", onClick: () => onSelect(task.rfaId, task.responseDocumentId ?? void 0), children: task.kind === "post_ur_decision" ? "Review response" : "Open request" }) })
10815
+ /* @__PURE__ */ jsx27("td", { children: date3(view === "Completed" ? task.resolvedAt ?? task.updatedAt : task.snoozedUntil ?? task.dueAt) }),
10816
+ /* @__PURE__ */ jsx27("td", { children: task.assigneeReference || "Unassigned" }),
10817
+ /* @__PURE__ */ jsx27("td", { children: /* @__PURE__ */ jsx27("button", { type: "button", onClick: () => onSelect(task.rfaId, task.responseDocumentId ?? void 0), children: task.kind === "post_ur_decision" ? "Review response" : "Open request" }) })
10712
10818
  ] }, task.id)) })
10713
10819
  ] }) }),
10714
- !filtered.length ? /* @__PURE__ */ jsx26("p", { children: "No tasks match this selection." }) : null
10820
+ !filtered.length ? /* @__PURE__ */ jsx27("p", { children: "No tasks match this selection." }) : null
10715
10821
  ] }) : null,
10716
- !list3 ? !patientId && !claimId && !renderingProviderId ? /* @__PURE__ */ jsxs24("details", { className: "mbrfa-match-disclosure", children: [
10717
- /* @__PURE__ */ jsxs24("summary", { children: [
10822
+ !list3 ? !patientId && !claimId && !renderingProviderId ? /* @__PURE__ */ jsxs25("details", { className: "mbrfa-match-disclosure", children: [
10823
+ /* @__PURE__ */ jsxs25("summary", { children: [
10718
10824
  "Match UR \xB7 Incoming responses",
10719
10825
  inboxCount !== null ? ` (${inboxCount})` : ""
10720
10826
  ] }),
10721
- /* @__PURE__ */ jsx26(InboundFaxInbox, { onCount: setInboxCount, options, editable: permissions.includes("act"), disabled: Boolean(appearance.disabled), onSelect })
10722
- ] }) : /* @__PURE__ */ jsx26("p", { className: "mbtd-note", children: "Open the organization-wide RFA dashboard to match incoming faxes that do not yet belong to a patient or claim." }) : null
10827
+ /* @__PURE__ */ jsx27(InboundFaxInbox, { onCount: setInboxCount, options, editable: permissions.includes("act"), disabled: Boolean(appearance.disabled), onSelect })
10828
+ ] }) : /* @__PURE__ */ jsx27("p", { className: "mbtd-note", children: "Open the organization-wide RFA dashboard to match incoming faxes that do not yet belong to a patient or claim." }) : null
10723
10829
  ] });
10724
10830
  }
10725
10831
  function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10726
10832
  const client = useMemo7(() => createRfaLifecycleClient(options), [options]);
10727
10833
  const records = useMemo7(() => createRfaClient(options), [options]);
10728
- const [faxes, setFaxes] = useState17([]);
10729
- const [fax, setFax] = useState17(null);
10730
- const [pdf, setPdf] = useState17(null);
10731
- const [choices, setChoices] = useState17([]);
10732
- const [selected, setSelected] = useState17("");
10733
- const [search, setSearch] = useState17("");
10734
- const [error, setError] = useState17("");
10735
- const [busy, setBusy] = useState17(false);
10736
- const [loading, setLoading] = useState17(true);
10737
- const [reload, setReload] = useState17(0);
10738
- const [nextCursor, setNextCursor] = useState17(null);
10739
- const [pages, setPages] = useState17([void 0]);
10740
- const [confirmed, setConfirmed] = useState17(false);
10834
+ const [faxes, setFaxes] = useState18([]);
10835
+ const [fax, setFax] = useState18(null);
10836
+ const [pdf, setPdf] = useState18(null);
10837
+ const [choices, setChoices] = useState18([]);
10838
+ const [selected, setSelected] = useState18("");
10839
+ const [search, setSearch] = useState18("");
10840
+ const [error, setError] = useState18("");
10841
+ const [busy, setBusy] = useState18(false);
10842
+ const [loading, setLoading] = useState18(true);
10843
+ const [reload, setReload] = useState18(0);
10844
+ const [nextCursor, setNextCursor] = useState18(null);
10845
+ const [pages, setPages] = useState18([void 0]);
10846
+ const [confirmed, setConfirmed] = useState18(false);
10741
10847
  const keys = useRef13(/* @__PURE__ */ new Map());
10742
10848
  const alive = useRef13(true);
10743
10849
  const pending = useRef13(false);
10744
10850
  const generation = useRef13(0);
10745
- useEffect14(() => {
10851
+ useEffect15(() => {
10746
10852
  alive.current = true;
10747
10853
  return () => {
10748
10854
  alive.current = false;
@@ -10750,7 +10856,7 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10750
10856
  }, []);
10751
10857
  const reviewingFax = useRef13(false);
10752
10858
  reviewingFax.current = Boolean(fax);
10753
- useEffect14(() => {
10859
+ useEffect15(() => {
10754
10860
  let active = true;
10755
10861
  let refreshing = false;
10756
10862
  setFax(null);
@@ -10810,35 +10916,35 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10810
10916
  if (alive.current) setBusy(false);
10811
10917
  }
10812
10918
  };
10813
- return /* @__PURE__ */ jsxs24("section", { className: "mbrfa-inbox", "aria-label": "Match UR", children: [
10814
- /* @__PURE__ */ jsx26("h3", { children: "Response inbox \xB7 Match UR" }),
10815
- /* @__PURE__ */ jsx26("p", { children: "Review incoming response faxes, then choose the matching request. Matching adds the response document and creates a Post UR task; it does not record a treatment decision." }),
10816
- error ? /* @__PURE__ */ jsx26("p", { role: "alert", children: error }) : null,
10817
- loading ? /* @__PURE__ */ jsx26("p", { role: "status", children: "Loading response faxes\u2026" }) : !error && !faxes.length ? /* @__PURE__ */ jsx26("p", { children: "No unmatched response faxes." }) : null,
10818
- pages.length > 1 || nextCursor ? /* @__PURE__ */ jsxs24("div", { className: "mbtd-actions", children: [
10819
- /* @__PURE__ */ jsx26("button", { type: "button", disabled: loading || busy || pages.length < 2, onClick: () => setPages((value) => value.slice(0, -1)), children: "Previous fax page" }),
10820
- /* @__PURE__ */ jsxs24("span", { children: [
10919
+ return /* @__PURE__ */ jsxs25("section", { className: "mbrfa-inbox", "aria-label": "Match UR", children: [
10920
+ /* @__PURE__ */ jsx27("h3", { children: "Response inbox \xB7 Match UR" }),
10921
+ /* @__PURE__ */ jsx27("p", { children: "Review incoming response faxes, then choose the matching request. Matching adds the response document and creates a Post UR task; it does not record a treatment decision." }),
10922
+ error ? /* @__PURE__ */ jsx27("p", { role: "alert", children: error }) : null,
10923
+ loading ? /* @__PURE__ */ jsx27("p", { role: "status", children: "Loading response faxes\u2026" }) : !error && !faxes.length ? /* @__PURE__ */ jsx27("p", { children: "No unmatched response faxes." }) : null,
10924
+ pages.length > 1 || nextCursor ? /* @__PURE__ */ jsxs25("div", { className: "mbtd-actions", children: [
10925
+ /* @__PURE__ */ jsx27("button", { type: "button", disabled: loading || busy || pages.length < 2, onClick: () => setPages((value) => value.slice(0, -1)), children: "Previous fax page" }),
10926
+ /* @__PURE__ */ jsxs25("span", { children: [
10821
10927
  "Page ",
10822
10928
  pages.length
10823
10929
  ] }),
10824
- /* @__PURE__ */ jsx26("button", { type: "button", disabled: loading || busy || !nextCursor, onClick: () => {
10930
+ /* @__PURE__ */ jsx27("button", { type: "button", disabled: loading || busy || !nextCursor, onClick: () => {
10825
10931
  if (nextCursor) setPages((value) => [...value, nextCursor]);
10826
10932
  }, children: "Next fax page" })
10827
10933
  ] }) : null,
10828
- /* @__PURE__ */ jsx26("div", { className: "mbrfa-list", children: faxes.map((item) => /* @__PURE__ */ jsxs24("article", { className: "mbrfa-card", children: [
10829
- /* @__PURE__ */ jsxs24("div", { children: [
10830
- /* @__PURE__ */ jsxs24("strong", { children: [
10934
+ /* @__PURE__ */ jsx27("div", { className: "mbrfa-list", children: faxes.map((item) => /* @__PURE__ */ jsxs25("article", { className: "mbrfa-card", children: [
10935
+ /* @__PURE__ */ jsxs25("div", { children: [
10936
+ /* @__PURE__ */ jsxs25("strong", { children: [
10831
10937
  "Response fax \xB7 ",
10832
10938
  date3(item.receivedAt)
10833
10939
  ] }),
10834
- /* @__PURE__ */ jsxs24("span", { children: [
10940
+ /* @__PURE__ */ jsxs25("span", { children: [
10835
10941
  item.fromName || item.fromFax || "Sender not identified",
10836
10942
  " \xB7 ",
10837
10943
  item.pages ?? "Unknown",
10838
10944
  " pages"
10839
10945
  ] })
10840
10946
  ] }),
10841
- /* @__PURE__ */ jsx26("button", { type: "button", disabled: busy || disabled, onClick: () => {
10947
+ /* @__PURE__ */ jsx27("button", { type: "button", disabled: busy || disabled, onClick: () => {
10842
10948
  const current = ++generation.current;
10843
10949
  setFax(item);
10844
10950
  setPdf(null);
@@ -10855,18 +10961,18 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10855
10961
  });
10856
10962
  }, children: "Review fax" })
10857
10963
  ] }, item.id)) }),
10858
- fax ? /* @__PURE__ */ jsxs24("div", { style: { display: "grid", gap: 16 }, children: [
10859
- /* @__PURE__ */ jsxs24("div", { className: "mbtd-actions", children: [
10860
- /* @__PURE__ */ jsx26("h4", { children: "Match response fax" }),
10861
- /* @__PURE__ */ jsx26("button", { type: "button", disabled: busy, onClick: () => {
10964
+ fax ? /* @__PURE__ */ jsxs25("div", { style: { display: "grid", gap: 16 }, children: [
10965
+ /* @__PURE__ */ jsxs25("div", { className: "mbtd-actions", children: [
10966
+ /* @__PURE__ */ jsx27("h4", { children: "Match response fax" }),
10967
+ /* @__PURE__ */ jsx27("button", { type: "button", disabled: busy, onClick: () => {
10862
10968
  generation.current += 1;
10863
10969
  setFax(null);
10864
10970
  setPdf(null);
10865
10971
  setReload((value) => value + 1);
10866
10972
  }, children: "Close review" })
10867
10973
  ] }),
10868
- pdf ? /* @__PURE__ */ jsx26(RfaPdfReview, { blob: pdf, title: "Incoming utilization review response" }) : null,
10869
- /* @__PURE__ */ jsxs24("form", { onSubmit: (event) => {
10974
+ pdf ? /* @__PURE__ */ jsx27(RfaPdfReview, { blob: pdf, title: "Incoming utilization review response" }) : null,
10975
+ /* @__PURE__ */ jsxs25("form", { onSubmit: (event) => {
10870
10976
  event.preventDefault();
10871
10977
  void run(async () => {
10872
10978
  const result = await records.list({ search: search.trim(), limit: 50 });
@@ -10876,20 +10982,20 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10876
10982
  }
10877
10983
  });
10878
10984
  }, children: [
10879
- /* @__PURE__ */ jsxs24("label", { children: [
10985
+ /* @__PURE__ */ jsxs25("label", { children: [
10880
10986
  "Find patient, claim or RFA",
10881
- /* @__PURE__ */ jsx26("input", { value: search, maxLength: 200, required: true, onChange: (event) => setSearch(event.target.value) })
10987
+ /* @__PURE__ */ jsx27("input", { value: search, maxLength: 200, required: true, onChange: (event) => setSearch(event.target.value) })
10882
10988
  ] }),
10883
- /* @__PURE__ */ jsx26("button", { type: "submit", disabled: busy || disabled, children: "Find requests" })
10989
+ /* @__PURE__ */ jsx27("button", { type: "submit", disabled: busy || disabled, children: "Find requests" })
10884
10990
  ] }),
10885
- /* @__PURE__ */ jsxs24("label", { children: [
10991
+ /* @__PURE__ */ jsxs25("label", { children: [
10886
10992
  "Matching request",
10887
- /* @__PURE__ */ jsxs24("select", { value: selected, disabled: busy || disabled, onChange: (event) => {
10993
+ /* @__PURE__ */ jsxs25("select", { value: selected, disabled: busy || disabled, onChange: (event) => {
10888
10994
  setSelected(event.target.value);
10889
10995
  setConfirmed(false);
10890
10996
  }, children: [
10891
- /* @__PURE__ */ jsx26("option", { value: "", children: "Choose after reviewing the response" }),
10892
- choices.map((record2) => /* @__PURE__ */ jsxs24("option", { value: record2.id, disabled: !canMatchResponse(record2), children: [
10997
+ /* @__PURE__ */ jsx27("option", { value: "", children: "Choose after reviewing the response" }),
10998
+ choices.map((record2) => /* @__PURE__ */ jsxs25("option", { value: record2.id, disabled: !canMatchResponse(record2), children: [
10893
10999
  record2.employeeName,
10894
11000
  " \xB7 ",
10895
11001
  record2.claimNumber || "Claim not recorded",
@@ -10901,8 +11007,8 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10901
11007
  ] }, record2.id))
10902
11008
  ] })
10903
11009
  ] }),
10904
- selected ? /* @__PURE__ */ jsx26("button", { type: "button", disabled: busy || disabled, onClick: () => onSelect(selected), children: "Review selected request" }) : null,
10905
- editable ? /* @__PURE__ */ jsxs24("form", { onSubmit: (event) => {
11010
+ selected ? /* @__PURE__ */ jsx27("button", { type: "button", disabled: busy || disabled, onClick: () => onSelect(selected), children: "Review selected request" }) : null,
11011
+ editable ? /* @__PURE__ */ jsxs25("form", { onSubmit: (event) => {
10906
11012
  event.preventDefault();
10907
11013
  if (!selected || !pdf || !confirmed || !editable || !choices.some((record2) => record2.id === selected && canMatchResponse(record2))) return;
10908
11014
  void run(async () => {
@@ -10921,18 +11027,18 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10921
11027
  }
10922
11028
  });
10923
11029
  }, children: [
10924
- /* @__PURE__ */ jsxs24("label", { children: [
10925
- /* @__PURE__ */ jsx26("input", { type: "checkbox", required: true, checked: confirmed, onChange: (event) => setConfirmed(event.target.checked), disabled: busy || disabled }),
11030
+ /* @__PURE__ */ jsxs25("label", { children: [
11031
+ /* @__PURE__ */ jsx27("input", { type: "checkbox", required: true, checked: confirmed, onChange: (event) => setConfirmed(event.target.checked), disabled: busy || disabled }),
10926
11032
  " I reviewed the response and confirmed its patient, claim, and requested treatment match this request."
10927
11033
  ] }),
10928
- /* @__PURE__ */ jsx26("button", { type: "submit", disabled: busy || disabled || !selected || !pdf || !confirmed, children: "Match response and open Post UR" })
10929
- ] }) : /* @__PURE__ */ jsx26("p", { children: "Matching responses requires authorization from your administrator." })
11034
+ /* @__PURE__ */ jsx27("button", { type: "submit", disabled: busy || disabled || !selected || !pdf || !confirmed, children: "Match response and open Post UR" })
11035
+ ] }) : /* @__PURE__ */ jsx27("p", { children: "Matching responses requires authorization from your administrator." })
10930
11036
  ] }) : null
10931
11037
  ] });
10932
11038
  }
10933
11039
 
10934
11040
  // src/rfa-tracking-panel.tsx
10935
- import { Fragment as Fragment17, useEffect as useEffect15, useMemo as useMemo8, useRef as useRef14, useState as useState18 } from "react";
11041
+ import { Fragment as Fragment17, useEffect as useEffect16, useMemo as useMemo8, useRef as useRef14, useState as useState19 } from "react";
10936
11042
  import { createRfaClient as createRfaClient2, createRfaLifecycleClient as createRfaLifecycleClient2 } from "@mindbill/browser";
10937
11043
 
10938
11044
  // src/rfa-detail-header.tsx
@@ -10955,43 +11061,43 @@ function rfaDecisionDueText(rfa) {
10955
11061
  }
10956
11062
 
10957
11063
  // src/rfa-detail-header.tsx
10958
- import { Fragment as Fragment16, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
11064
+ import { Fragment as Fragment16, jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
10959
11065
  function RfaDetailHeader({ rfa, getPatientHref, getClaimHref, getProviderHref, compact = false }) {
10960
11066
  const status = getRfaLifecycleStatus(rfa);
10961
11067
  const stages = ["Incomplete", "Sent", "Received", "Closed"];
10962
11068
  const current = status === "closed" ? 3 : status === "received" || rfa.receivedAt ? 2 : status === "sent" || rfa.submittedAt ? 1 : 0;
10963
- return /* @__PURE__ */ jsxs25(Fragment16, { children: [
10964
- /* @__PURE__ */ jsxs25("div", { className: "mbrfa-context", children: [
10965
- /* @__PURE__ */ jsxs25("div", { children: [
10966
- /* @__PURE__ */ jsx27("strong", { children: /* @__PURE__ */ jsx27(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }) }),
10967
- /* @__PURE__ */ jsx27("span", { children: /* @__PURE__ */ jsxs25(RfaLink, { href: getClaimHref?.(rfa), children: [
11069
+ return /* @__PURE__ */ jsxs26(Fragment16, { children: [
11070
+ /* @__PURE__ */ jsxs26("div", { className: "mbrfa-context", children: [
11071
+ /* @__PURE__ */ jsxs26("div", { children: [
11072
+ /* @__PURE__ */ jsx28("strong", { children: /* @__PURE__ */ jsx28(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }) }),
11073
+ /* @__PURE__ */ jsx28("span", { children: /* @__PURE__ */ jsxs26(RfaLink, { href: getClaimHref?.(rfa), children: [
10968
11074
  "Claim ",
10969
11075
  rfa.claimNumber || "Not recorded"
10970
11076
  ] }) })
10971
11077
  ] }),
10972
- /* @__PURE__ */ jsxs25("div", { children: [
10973
- /* @__PURE__ */ jsx27("strong", { children: /* @__PURE__ */ jsx27(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
10974
- /* @__PURE__ */ jsx27("span", { children: "Requesting physician" })
11078
+ /* @__PURE__ */ jsxs26("div", { children: [
11079
+ /* @__PURE__ */ jsx28("strong", { children: /* @__PURE__ */ jsx28(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
11080
+ /* @__PURE__ */ jsx28("span", { children: "Requesting physician" })
10975
11081
  ] }),
10976
- /* @__PURE__ */ jsxs25("div", { children: [
10977
- /* @__PURE__ */ jsx27("strong", { children: rfa.expedited ? "Expedited review" : `${rfa.reviewType.charAt(0).toUpperCase()}${rfa.reviewType.slice(1)} review` }),
10978
- /* @__PURE__ */ jsx27("span", { className: "mbrfa-update-note", children: "Updates automatically" })
11082
+ /* @__PURE__ */ jsxs26("div", { children: [
11083
+ /* @__PURE__ */ jsx28("strong", { children: rfa.expedited ? "Expedited review" : `${rfa.reviewType.charAt(0).toUpperCase()}${rfa.reviewType.slice(1)} review` }),
11084
+ /* @__PURE__ */ jsx28("span", { className: "mbrfa-update-note", children: "Updates automatically" })
10979
11085
  ] })
10980
11086
  ] }),
10981
- !compact ? /* @__PURE__ */ jsxs25("section", { className: "mbrfa-progress", "aria-label": "Request status", children: [
10982
- /* @__PURE__ */ jsxs25("div", { className: "mbrfa-progress-heading", children: [
10983
- /* @__PURE__ */ jsxs25("div", { children: [
10984
- /* @__PURE__ */ jsx27("h3", { children: RFA_LIFECYCLE_LABELS[status] }),
10985
- /* @__PURE__ */ jsx27("p", { children: status === "failed" ? "Delivery needs attention. Review the delivery evidence before retrying." : status === "canceled" ? "This request was canceled." : rfa.submittedAt ? `Submitted ${new Date(rfa.submittedAt).toLocaleDateString()}` : "Not yet submitted" })
11087
+ !compact ? /* @__PURE__ */ jsxs26("section", { className: "mbrfa-progress", "aria-label": "Request status", children: [
11088
+ /* @__PURE__ */ jsxs26("div", { className: "mbrfa-progress-heading", children: [
11089
+ /* @__PURE__ */ jsxs26("div", { children: [
11090
+ /* @__PURE__ */ jsx28("h3", { children: RFA_LIFECYCLE_LABELS[status] }),
11091
+ /* @__PURE__ */ jsx28("p", { children: status === "failed" ? "Delivery needs attention. Review the delivery evidence before retrying." : status === "canceled" ? "This request was canceled." : rfa.submittedAt ? `Submitted ${new Date(rfa.submittedAt).toLocaleDateString()}` : "Not yet submitted" })
10986
11092
  ] }),
10987
- /* @__PURE__ */ jsxs25("div", { className: "mbrfa-deadline", children: [
10988
- /* @__PURE__ */ jsx27("span", { children: "Decision due" }),
10989
- /* @__PURE__ */ jsx27("strong", { children: rfaDecisionDueText(rfa) })
11093
+ /* @__PURE__ */ jsxs26("div", { className: "mbrfa-deadline", children: [
11094
+ /* @__PURE__ */ jsx28("span", { children: "Decision due" }),
11095
+ /* @__PURE__ */ jsx28("strong", { children: rfaDecisionDueText(rfa) })
10990
11096
  ] })
10991
11097
  ] }),
10992
- /* @__PURE__ */ jsx27("ol", { "aria-label": "Authorization progress", children: stages.map((stage, index) => /* @__PURE__ */ jsxs25("li", { className: index <= current ? "is-complete" : "", "aria-current": index === current ? "step" : void 0, children: [
10993
- /* @__PURE__ */ jsx27("span", { children: index < current ? "\u2713" : index + 1 }),
10994
- /* @__PURE__ */ jsx27("strong", { children: stage })
11098
+ /* @__PURE__ */ jsx28("ol", { "aria-label": "Authorization progress", children: stages.map((stage, index) => /* @__PURE__ */ jsxs26("li", { className: index <= current ? "is-complete" : "", "aria-current": index === current ? "step" : void 0, children: [
11099
+ /* @__PURE__ */ jsx28("span", { children: index < current ? "\u2713" : index + 1 }),
11100
+ /* @__PURE__ */ jsx28("strong", { children: stage })
10995
11101
  ] }, stage)) })
10996
11102
  ] }) : null
10997
11103
  ] });
@@ -11005,7 +11111,7 @@ var rfaPolishCss = `
11005
11111
  var rfaSimpleCss = `.mbrfa-simple .mbrfa-detail-tabs{display:flex;overflow-x:auto;gap:4px}.mbrfa-simple .mbrfa-detail-tabs button{flex:1;white-space:nowrap}.mbrfa-simple [hidden]{display:none!important}.mbrfa-next-action{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 20px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-soft)}.mbrfa-next-action p{margin:5px 0 0}.mbrfa-simple .mbrfa-bottom-actions{position:static}.mbrfa-simple .mbrfa-bottom-actions>.mbrfa-badge{display:none}@media(max-width:600px){.mbrfa-next-action{align-items:flex-start;flex-direction:column}.mbrfa-simple .mbrfa-detail-tabs button{padding:8px}}`;
11006
11112
 
11007
11113
  // src/rfa-history-entry.tsx
11008
- import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
11114
+ import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
11009
11115
  var object = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
11010
11116
  var string = (value) => typeof value === "string" && value.trim() ? value : void 0;
11011
11117
  var words = (value) => value.replace(/^rfa\./, "").replaceAll("_", " ");
@@ -11079,9 +11185,9 @@ function rows2(value, omit = []) {
11079
11185
  });
11080
11186
  }
11081
11187
  function DefinitionList({ entries }) {
11082
- return /* @__PURE__ */ jsx28("dl", { children: entries.map(([label5, value]) => /* @__PURE__ */ jsxs26("div", { children: [
11083
- /* @__PURE__ */ jsx28("dt", { children: label5 }),
11084
- /* @__PURE__ */ jsx28("dd", { style: { whiteSpace: "pre-wrap" }, children: value })
11188
+ return /* @__PURE__ */ jsx29("dl", { children: entries.map(([label5, value]) => /* @__PURE__ */ jsxs27("div", { children: [
11189
+ /* @__PURE__ */ jsx29("dt", { children: label5 }),
11190
+ /* @__PURE__ */ jsx29("dd", { style: { whiteSpace: "pre-wrap" }, children: value })
11085
11191
  ] }, label5)) });
11086
11192
  }
11087
11193
  function RfaHistoryEntry({ event, rfa, disabled, onDownload }) {
@@ -11106,12 +11212,12 @@ function RfaHistoryEntry({ event, rfa, disabled, onDownload }) {
11106
11212
  }
11107
11213
  const treatment = (id) => {
11108
11214
  const index = rfa.items.findIndex((value) => value.id === id);
11109
- return index >= 0 ? /* @__PURE__ */ jsxs26("a", { href: `#rfa-treatment-${id}`, children: [
11215
+ return index >= 0 ? /* @__PURE__ */ jsxs27("a", { href: `#rfa-treatment-${id}`, children: [
11110
11216
  "Treatment ",
11111
11217
  index + 1,
11112
11218
  ": ",
11113
11219
  rfa.items[index].serviceDescription
11114
- ] }) : /* @__PURE__ */ jsxs26("span", { children: [
11220
+ ] }) : /* @__PURE__ */ jsxs27("span", { children: [
11115
11221
  "Treatment reference: ",
11116
11222
  id
11117
11223
  ] });
@@ -11138,50 +11244,50 @@ function RfaHistoryEntry({ event, rfa, disabled, onDownload }) {
11138
11244
  const hasDetails = entries.length || appointment.length || decisionSections.length || evidence.length || changed.length;
11139
11245
  const actor = /^(system:|system$)/.test(event.actor) ? "System" : /^(native-user:|user:)/.test(event.actor) || /^partner:[^:]+:browser:/.test(event.actor) ? "Team member" : /^partner:/.test(event.actor) ? "Integration" : /^(developer:|integration:|api:)/.test(event.actor) ? "Integration" : event.actor;
11140
11246
  const action = string(payload.action) ?? event.eventType.replace(/^rfa\./, "");
11141
- return /* @__PURE__ */ jsxs26("tr", { children: [
11142
- /* @__PURE__ */ jsx28("td", { children: /* @__PURE__ */ jsx28("time", { dateTime: event.occurredAt ?? void 0, children: date4(event.occurredAt) }) }),
11143
- /* @__PURE__ */ jsx28("td", { className: "mbrfa-history-action", children: actions[action] ?? words(action) }),
11144
- /* @__PURE__ */ jsxs26("td", { children: [
11145
- /* @__PURE__ */ jsx28("span", { className: "mbrfa-sr-only", children: "Recorded by " }),
11247
+ return /* @__PURE__ */ jsxs27("tr", { children: [
11248
+ /* @__PURE__ */ jsx29("td", { children: /* @__PURE__ */ jsx29("time", { dateTime: event.occurredAt ?? void 0, children: date4(event.occurredAt) }) }),
11249
+ /* @__PURE__ */ jsx29("td", { className: "mbrfa-history-action", children: actions[action] ?? words(action) }),
11250
+ /* @__PURE__ */ jsxs27("td", { children: [
11251
+ /* @__PURE__ */ jsx29("span", { className: "mbrfa-sr-only", children: "Recorded by " }),
11146
11252
  actor
11147
11253
  ] }),
11148
- /* @__PURE__ */ jsxs26("td", { children: [
11149
- ["text", "reason", "requestText", "note"].map((key2) => string(payload[key2]) ? /* @__PURE__ */ jsx28("p", { style: { whiteSpace: "pre-wrap" }, children: String(payload[key2]) }, key2) : null),
11150
- ids.size ? /* @__PURE__ */ jsx28("ul", { "aria-label": "Related treatments", children: [...ids].map((id) => /* @__PURE__ */ jsx28("li", { children: treatment(id) }, id)) }) : null,
11151
- hasDetails ? /* @__PURE__ */ jsxs26("details", { children: [
11152
- /* @__PURE__ */ jsx28("summary", { children: "Event details" }),
11153
- entries.length ? /* @__PURE__ */ jsx28(DefinitionList, { entries }) : null,
11154
- changed.length ? /* @__PURE__ */ jsxs26("p", { children: [
11254
+ /* @__PURE__ */ jsxs27("td", { children: [
11255
+ ["text", "reason", "requestText", "note"].map((key2) => string(payload[key2]) ? /* @__PURE__ */ jsx29("p", { style: { whiteSpace: "pre-wrap" }, children: String(payload[key2]) }, key2) : null),
11256
+ ids.size ? /* @__PURE__ */ jsx29("ul", { "aria-label": "Related treatments", children: [...ids].map((id) => /* @__PURE__ */ jsx29("li", { children: treatment(id) }, id)) }) : null,
11257
+ hasDetails ? /* @__PURE__ */ jsxs27("details", { children: [
11258
+ /* @__PURE__ */ jsx29("summary", { children: "Event details" }),
11259
+ entries.length ? /* @__PURE__ */ jsx29(DefinitionList, { entries }) : null,
11260
+ changed.length ? /* @__PURE__ */ jsxs27("p", { children: [
11155
11261
  "Changed fields: ",
11156
11262
  changed.join(", ")
11157
11263
  ] }) : null,
11158
- appointment.length ? /* @__PURE__ */ jsxs26("section", { children: [
11159
- /* @__PURE__ */ jsx28("h4", { children: "Appointment details" }),
11160
- /* @__PURE__ */ jsx28(DefinitionList, { entries: appointment })
11264
+ appointment.length ? /* @__PURE__ */ jsxs27("section", { children: [
11265
+ /* @__PURE__ */ jsx29("h4", { children: "Appointment details" }),
11266
+ /* @__PURE__ */ jsx29(DefinitionList, { entries: appointment })
11161
11267
  ] }) : null,
11162
- decisionSections.map((group) => /* @__PURE__ */ jsxs26("section", { children: [
11163
- /* @__PURE__ */ jsx28("h4", { children: group.title }),
11164
- group.value !== payload ? /* @__PURE__ */ jsx28(DefinitionList, { entries: rows2(group.value, ["reason"]) }) : null,
11165
- group.decisions.map((value, index) => /* @__PURE__ */ jsxs26("div", { children: [
11268
+ decisionSections.map((group) => /* @__PURE__ */ jsxs27("section", { children: [
11269
+ /* @__PURE__ */ jsx29("h4", { children: group.title }),
11270
+ group.value !== payload ? /* @__PURE__ */ jsx29(DefinitionList, { entries: rows2(group.value, ["reason"]) }) : null,
11271
+ group.decisions.map((value, index) => /* @__PURE__ */ jsxs27("div", { children: [
11166
11272
  string(value.itemId) ? treatment(String(value.itemId)) : null,
11167
- /* @__PURE__ */ jsx28(DefinitionList, { entries: rows2(value) })
11273
+ /* @__PURE__ */ jsx29(DefinitionList, { entries: rows2(value) })
11168
11274
  ] }, index))
11169
11275
  ] }, group.title)),
11170
- evidence.length ? /* @__PURE__ */ jsx28("ul", { "aria-label": "Event documents", children: evidence.map((value) => {
11276
+ evidence.length ? /* @__PURE__ */ jsx29("ul", { "aria-label": "Event documents", children: evidence.map((value) => {
11171
11277
  const filename = rfa.documents.find((document2) => document2.id === value.id)?.filename;
11172
- return /* @__PURE__ */ jsx28("li", { children: /* @__PURE__ */ jsxs26("button", { type: "button", disabled, onClick: () => onDownload(value.kind, value.id, filename ?? (value.kind === "packet" ? "RFA submission.pdf" : "RFA evidence.pdf")), children: [
11278
+ return /* @__PURE__ */ jsx29("li", { children: /* @__PURE__ */ jsxs27("button", { type: "button", disabled, onClick: () => onDownload(value.kind, value.id, filename ?? (value.kind === "packet" ? "RFA submission.pdf" : "RFA evidence.pdf")), children: [
11173
11279
  value.label,
11174
11280
  filename ? `: ${filename}` : ""
11175
11281
  ] }) }, `${value.kind}:${value.id}`);
11176
11282
  }) }) : null
11177
- ] }) : !["text", "reason", "requestText", "note"].some((key2) => string(payload[key2])) && !ids.size ? /* @__PURE__ */ jsx28("span", { children: "\u2014" }) : null
11283
+ ] }) : !["text", "reason", "requestText", "note"].some((key2) => string(payload[key2])) && !ids.size ? /* @__PURE__ */ jsx29("span", { children: "\u2014" }) : null
11178
11284
  ] })
11179
11285
  ] });
11180
11286
  }
11181
11287
 
11182
11288
  // src/rfa-detail-cards.tsx
11183
11289
  import { getRfaLifecycleStatus as getRfaLifecycleStatus2, RFA_LIFECYCLE_LABELS as RFA_LIFECYCLE_LABELS2 } from "@mindbill/browser";
11184
- import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
11290
+ import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
11185
11291
  var DECIDED = ["approved", "modified", "denied", "mixed", "closed"];
11186
11292
  var rfaShortDate = (value) => value && Number.isFinite(Date.parse(value)) ? new Date(value).toLocaleString(void 0, { dateStyle: "short", timeStyle: "short" }) : "\u2014";
11187
11293
  var rfaCalendarDate = (value) => {
@@ -11200,7 +11306,7 @@ function rfaOutcome(item) {
11200
11306
  return { label: sentence(item.outcome || "pending"), tone: "muted" };
11201
11307
  }
11202
11308
  function RfaPill({ tone = "muted", children }) {
11203
- return /* @__PURE__ */ jsx29("span", { className: "mbrfa-pill", "data-tone": tone, children });
11309
+ return /* @__PURE__ */ jsx30("span", { className: "mbrfa-pill", "data-tone": tone, children });
11204
11310
  }
11205
11311
  function rfaLifecycleTone(rfa) {
11206
11312
  const status = getRfaLifecycleStatus2(rfa);
@@ -11217,41 +11323,41 @@ function RfaStatusCard({ rfa }) {
11217
11323
  const current = rfa.submittedAt && decided ? 4 : rfa.receivedAt ? 3 : rfa.submittedAt ? 2 : rfa.signedAt ? 1 : 0;
11218
11324
  const stopped = status === "canceled" || status === "failed";
11219
11325
  const detail = status === "canceled" ? "This request was canceled" : status === "failed" ? "Delivery needs attention" : rfa.submittedAt ? `Sent ${rfaShortDate(rfa.submittedAt)}` : rfa.signedAt ? "Signed, not yet sent" : "Not yet signed";
11220
- return /* @__PURE__ */ jsxs27("section", { className: "mbrfa-status", "aria-label": "Request status", "data-stopped": stopped || void 0, children: [
11221
- /* @__PURE__ */ jsxs27("div", { className: "mbrfa-status-heading", children: [
11222
- /* @__PURE__ */ jsxs27("div", { children: [
11223
- /* @__PURE__ */ jsx29("h3", { children: RFA_LIFECYCLE_LABELS2[status] }),
11224
- /* @__PURE__ */ jsx29("p", { children: detail })
11326
+ return /* @__PURE__ */ jsxs28("section", { className: "mbrfa-status", "aria-label": "Request status", "data-stopped": stopped || void 0, children: [
11327
+ /* @__PURE__ */ jsxs28("div", { className: "mbrfa-status-heading", children: [
11328
+ /* @__PURE__ */ jsxs28("div", { children: [
11329
+ /* @__PURE__ */ jsx30("h3", { children: RFA_LIFECYCLE_LABELS2[status] }),
11330
+ /* @__PURE__ */ jsx30("p", { children: detail })
11225
11331
  ] }),
11226
- rfa.submittedAt && !stopped ? /* @__PURE__ */ jsxs27("div", { className: "mbrfa-status-due", children: [
11227
- /* @__PURE__ */ jsx29("span", { children: "Decision due" }),
11228
- /* @__PURE__ */ jsx29("strong", { children: rfaDecisionDueText(rfa) })
11332
+ rfa.submittedAt && !stopped ? /* @__PURE__ */ jsxs28("div", { className: "mbrfa-status-due", children: [
11333
+ /* @__PURE__ */ jsx30("span", { children: "Decision due" }),
11334
+ /* @__PURE__ */ jsx30("strong", { children: rfaDecisionDueText(rfa) })
11229
11335
  ] }) : null
11230
11336
  ] }),
11231
- /* @__PURE__ */ jsx29("ol", { "aria-label": "Authorization progress", children: stages.map((stage, index) => /* @__PURE__ */ jsxs27("li", { "data-state": index < current ? "done" : index === current ? "current" : "todo", "aria-current": index === current ? "step" : void 0, children: [
11232
- /* @__PURE__ */ jsx29("span", { children: index < current ? "\u2713" : index + 1 }),
11233
- /* @__PURE__ */ jsx29("strong", { children: stage })
11337
+ /* @__PURE__ */ jsx30("ol", { "aria-label": "Authorization progress", children: stages.map((stage, index) => /* @__PURE__ */ jsxs28("li", { "data-state": index < current ? "done" : index === current ? "current" : "todo", "aria-current": index === current ? "step" : void 0, children: [
11338
+ /* @__PURE__ */ jsx30("span", { children: index < current ? "\u2713" : index + 1 }),
11339
+ /* @__PURE__ */ jsx30("strong", { children: stage })
11234
11340
  ] }, stage)) })
11235
11341
  ] });
11236
11342
  }
11237
11343
  function RfaCard({ title, count, action, children, id, flush = false }) {
11238
- return /* @__PURE__ */ jsxs27("section", { className: "mbrfa-sheet", id, "aria-label": title, children: [
11239
- /* @__PURE__ */ jsxs27("header", { children: [
11240
- /* @__PURE__ */ jsxs27("h3", { children: [
11344
+ return /* @__PURE__ */ jsxs28("section", { className: "mbrfa-sheet", id, "aria-label": title, children: [
11345
+ /* @__PURE__ */ jsxs28("header", { children: [
11346
+ /* @__PURE__ */ jsxs28("h3", { children: [
11241
11347
  title,
11242
- count !== void 0 ? /* @__PURE__ */ jsx29("span", { className: "mbrfa-count", children: count }) : null
11348
+ count !== void 0 ? /* @__PURE__ */ jsx30("span", { className: "mbrfa-count", children: count }) : null
11243
11349
  ] }),
11244
- action ? /* @__PURE__ */ jsx29("div", { className: "mbrfa-sheet-action", children: action }) : null
11350
+ action ? /* @__PURE__ */ jsx30("div", { className: "mbrfa-sheet-action", children: action }) : null
11245
11351
  ] }),
11246
- /* @__PURE__ */ jsx29("div", { className: flush ? "mbrfa-sheet-flush" : "mbrfa-sheet-body", children })
11352
+ /* @__PURE__ */ jsx30("div", { className: flush ? "mbrfa-sheet-flush" : "mbrfa-sheet-body", children })
11247
11353
  ] });
11248
11354
  }
11249
11355
  function RfaFacts({ entries }) {
11250
11356
  const shown = entries.filter(([, value]) => value !== null && value !== void 0 && value !== "" && value !== false);
11251
- return shown.length ? /* @__PURE__ */ jsx29("dl", { className: "mbrfa-facts", children: shown.map(([name, value]) => /* @__PURE__ */ jsxs27("div", { children: [
11252
- /* @__PURE__ */ jsx29("dt", { children: name }),
11253
- /* @__PURE__ */ jsx29("dd", { children: value })
11254
- ] }, name)) }) : /* @__PURE__ */ jsx29("p", { className: "mbrfa-empty", children: "Not recorded." });
11357
+ return shown.length ? /* @__PURE__ */ jsx30("dl", { className: "mbrfa-facts", children: shown.map(([name, value]) => /* @__PURE__ */ jsxs28("div", { children: [
11358
+ /* @__PURE__ */ jsx30("dt", { children: name }),
11359
+ /* @__PURE__ */ jsx30("dd", { children: value })
11360
+ ] }, name)) }) : /* @__PURE__ */ jsx30("p", { className: "mbrfa-empty", children: "Not recorded." });
11255
11361
  }
11256
11362
  var rfaAddress = (contact) => [contact?.address, [contact?.city, [contact?.state, contact?.zip].filter(Boolean).join(" ")].filter(Boolean).join(", ")].filter(Boolean).join(", ");
11257
11363
  var rfaRequestTypeLabel = (rfa) => rfa.requestType === "resubmission_material_change" ? "Resubmission \u2013 Change in Material Facts" : "New Request";
@@ -11337,7 +11443,7 @@ var rfaCardsCss = `
11337
11443
  `;
11338
11444
 
11339
11445
  // src/rfa-tracking-panel.tsx
11340
- import { Fragment as Fragment18, jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
11446
+ import { Fragment as Fragment18, jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
11341
11447
  var words2 = (value) => value.replace(/^rfa\./, "").replaceAll("_", " ");
11342
11448
  var capital = (value) => value.charAt(0).toUpperCase() + value.slice(1);
11343
11449
  var date5 = (value) => value ? new Date(value).toLocaleString() : "Not recorded";
@@ -11359,32 +11465,32 @@ var localTime = (value) => {
11359
11465
  };
11360
11466
  function RfaTrackingPanel(props) {
11361
11467
  const identity = useMemo8(() => crypto.randomUUID(), [props.options]);
11362
- return /* @__PURE__ */ jsx30(RfaTrackingContent, { ...props }, `${identity}:${props.rfa.id}`);
11468
+ return /* @__PURE__ */ jsx31(RfaTrackingContent, { ...props }, `${identity}:${props.rfa.id}`);
11363
11469
  }
11364
11470
  function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdated, view = "all", embedded = false, cards = false, ...appearance }) {
11365
- const [rfa, setRfa] = useState18(provided);
11366
- useEffect15(() => setRfa(provided), [provided]);
11471
+ const [rfa, setRfa] = useState19(provided);
11472
+ useEffect16(() => setRfa(provided), [provided]);
11367
11473
  const client = useMemo8(() => createRfaLifecycleClient2(options), [options]);
11368
11474
  const records = useMemo8(() => createRfaClient2(options), [options]);
11369
- const [scheduling, setScheduling] = useState18([]);
11370
- const [history, setHistory] = useState18([]);
11371
- const [loadErrors, setLoadErrors] = useState18([]);
11372
- const [loading, setLoading] = useState18(true);
11373
- const [reload, setReload] = useState18(0);
11374
- const [busy, setBusy] = useState18(false);
11375
- const [error, setError] = useState18("");
11376
- const [message, setMessage] = useState18("");
11377
- const [noteOpen, setNoteOpen] = useState18(false);
11475
+ const [scheduling, setScheduling] = useState19([]);
11476
+ const [history, setHistory] = useState19([]);
11477
+ const [loadErrors, setLoadErrors] = useState19([]);
11478
+ const [loading, setLoading] = useState19(true);
11479
+ const [reload, setReload] = useState19(0);
11480
+ const [busy, setBusy] = useState19(false);
11481
+ const [error, setError] = useState19("");
11482
+ const [message, setMessage] = useState19("");
11483
+ const [noteOpen, setNoteOpen] = useState19(false);
11378
11484
  const alive = useRef14(true);
11379
11485
  const pending = useRef14(false);
11380
11486
  const keys = useRef14(/* @__PURE__ */ new Map());
11381
- useEffect15(() => {
11487
+ useEffect16(() => {
11382
11488
  alive.current = true;
11383
11489
  return () => {
11384
11490
  alive.current = false;
11385
11491
  };
11386
11492
  }, []);
11387
- useEffect15(() => {
11493
+ useEffect16(() => {
11388
11494
  let active = true;
11389
11495
  void Promise.allSettled([client.listScheduling(rfa.id), client.listHistory(rfa.id)]).then(([appointments, events]) => {
11390
11496
  if (!active) return;
@@ -11400,7 +11506,7 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11400
11506
  active = false;
11401
11507
  };
11402
11508
  }, [client, rfa.id, rfa.updatedAt, reload]);
11403
- useEffect15(() => {
11509
+ useEffect16(() => {
11404
11510
  const refresh = () => {
11405
11511
  if (!pending.current && document.visibilityState !== "hidden") setReload((value) => value + 1);
11406
11512
  };
@@ -11460,11 +11566,11 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11460
11566
  if (alive.current) setError(reason instanceof Error ? reason.message : "The evidence could not be opened.");
11461
11567
  }
11462
11568
  };
11463
- const evidence = (id, title) => id ? /* @__PURE__ */ jsx30("button", { type: "button", disabled, onClick: () => void download(id, rfa.documents.find((document2) => document2.id === id)?.filename ?? `${title}.pdf`), children: title }) : null;
11569
+ const evidence = (id, title) => id ? /* @__PURE__ */ jsx31("button", { type: "button", disabled, onClick: () => void download(id, rfa.documents.find((document2) => document2.id === id)?.filename ?? `${title}.pdf`), children: title }) : null;
11464
11570
  const canCorrect = permissions.includes("act") && ["received", "under_review", "information_requested", "approved", "modified", "denied", "mixed"].includes(rfa.status);
11465
11571
  const canClose = permissions.includes("edit") && ["submitted", "received", "under_review", "information_requested", "incomplete", "deferred"].includes(rfa.status);
11466
11572
  const otherInformation = (item) => typeof item.metadata?.otherInformation === "string" && item.metadata.otherInformation.trim() ? item.metadata.otherInformation : [item.quantity != null ? `Quantity: ${item.quantity}` : "", item.units != null ? `Units: ${item.units}` : "", item.frequency, item.duration, item.requestedFrom ? `From: ${rfaCalendarDate(item.requestedFrom)}` : "", item.requestedTo ? `Through: ${rfaCalendarDate(item.requestedTo)}` : ""].filter(Boolean).join("; ");
11467
- const noteForm = /* @__PURE__ */ jsxs28("form", { className: "mbrfa-row", onSubmit: (event) => {
11573
+ const noteForm = /* @__PURE__ */ jsxs29("form", { className: "mbrfa-row", onSubmit: (event) => {
11468
11574
  event.preventDefault();
11469
11575
  const form = event.currentTarget;
11470
11576
  try {
@@ -11482,77 +11588,77 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11482
11588
  setError(reason instanceof Error ? reason.message : "Enter a note.");
11483
11589
  }
11484
11590
  }, children: [
11485
- /* @__PURE__ */ jsxs28("label", { children: [
11591
+ /* @__PURE__ */ jsxs29("label", { children: [
11486
11592
  "Note",
11487
- /* @__PURE__ */ jsx30("textarea", { name: "note", required: true, maxLength: 1e4, autoFocus: true, disabled })
11593
+ /* @__PURE__ */ jsx31("textarea", { name: "note", required: true, maxLength: 1e4, autoFocus: true, disabled })
11488
11594
  ] }),
11489
- /* @__PURE__ */ jsxs28("div", { className: "mbtd-actions", children: [
11490
- /* @__PURE__ */ jsx30("button", { type: "submit", className: "mbtd-primary", disabled, children: "Save note" }),
11491
- /* @__PURE__ */ jsx30("button", { type: "button", onClick: () => setNoteOpen(false), children: "Cancel" })
11595
+ /* @__PURE__ */ jsxs29("div", { className: "mbtd-actions", children: [
11596
+ /* @__PURE__ */ jsx31("button", { type: "submit", className: "mbtd-primary", disabled, children: "Save note" }),
11597
+ /* @__PURE__ */ jsx31("button", { type: "button", onClick: () => setNoteOpen(false), children: "Cancel" })
11492
11598
  ] })
11493
11599
  ] });
11494
- const cardContent = /* @__PURE__ */ jsxs28("div", { className: "mbrfa-stack", children: [
11495
- error ? /* @__PURE__ */ jsx30("p", { role: "alert", children: error }) : null,
11496
- message ? /* @__PURE__ */ jsx30("p", { role: "status", children: message }) : null,
11497
- loadErrors.map((value) => /* @__PURE__ */ jsx30("p", { role: "alert", children: value }, value)),
11498
- view !== "history" ? /* @__PURE__ */ jsx30(RfaCard, { title: "Requested Treatment", count: rfa.items.length, flush: true, children: rfa.items.length ? /* @__PURE__ */ jsx30("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs28("table", { className: "mbrfa-grid-table mbrfa-treatment-table", children: [
11499
- /* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsxs28("tr", { children: [
11500
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "#" }),
11501
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Service/Good Requested" }),
11502
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Diagnosis" }),
11503
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "CPT/HCPCS" }),
11504
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Other Information" }),
11505
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Decision" })
11600
+ const cardContent = /* @__PURE__ */ jsxs29("div", { className: "mbrfa-stack", children: [
11601
+ error ? /* @__PURE__ */ jsx31("p", { role: "alert", children: error }) : null,
11602
+ message ? /* @__PURE__ */ jsx31("p", { role: "status", children: message }) : null,
11603
+ loadErrors.map((value) => /* @__PURE__ */ jsx31("p", { role: "alert", children: value }, value)),
11604
+ view !== "history" ? /* @__PURE__ */ jsx31(RfaCard, { title: "Requested Treatment", count: rfa.items.length, flush: true, children: rfa.items.length ? /* @__PURE__ */ jsx31("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs29("table", { className: "mbrfa-grid-table mbrfa-treatment-table", children: [
11605
+ /* @__PURE__ */ jsx31("thead", { children: /* @__PURE__ */ jsxs29("tr", { children: [
11606
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "#" }),
11607
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Service/Good Requested" }),
11608
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Diagnosis" }),
11609
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "CPT/HCPCS" }),
11610
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Other Information" }),
11611
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Decision" })
11506
11612
  ] }) }),
11507
- /* @__PURE__ */ jsx30("tbody", { children: rfa.items.map((item, index) => {
11613
+ /* @__PURE__ */ jsx31("tbody", { children: rfa.items.map((item, index) => {
11508
11614
  const appointment = scheduling.find((value) => value.itemId === item.id);
11509
11615
  const outcome = rfaOutcome(item);
11510
11616
  const showAppointment = !!appointment && (appointment.eligible || appointment.version > 0);
11511
11617
  const closable = canClose && item.outcome === "pending" && !item.decidedAt;
11512
11618
  const correctable = canCorrect && !!item.currentDecisionEventId && item.outcome !== "pending";
11513
- return /* @__PURE__ */ jsxs28(Fragment17, { children: [
11514
- /* @__PURE__ */ jsxs28("tr", { id: `rfa-treatment-${item.id}`, tabIndex: -1, children: [
11515
- /* @__PURE__ */ jsx30("td", { children: index + 1 }),
11516
- /* @__PURE__ */ jsx30("td", { children: /* @__PURE__ */ jsx30("strong", { children: item.serviceDescription }) }),
11517
- /* @__PURE__ */ jsxs28("td", { children: [
11518
- /* @__PURE__ */ jsx30("span", { className: "mbrfa-code", children: item.diagnosisCode }),
11519
- item.diagnosisDescription ? /* @__PURE__ */ jsx30("small", { children: item.diagnosisDescription }) : null
11619
+ return /* @__PURE__ */ jsxs29(Fragment17, { children: [
11620
+ /* @__PURE__ */ jsxs29("tr", { id: `rfa-treatment-${item.id}`, tabIndex: -1, children: [
11621
+ /* @__PURE__ */ jsx31("td", { children: index + 1 }),
11622
+ /* @__PURE__ */ jsx31("td", { children: /* @__PURE__ */ jsx31("strong", { children: item.serviceDescription }) }),
11623
+ /* @__PURE__ */ jsxs29("td", { children: [
11624
+ /* @__PURE__ */ jsx31("span", { className: "mbrfa-code", children: item.diagnosisCode }),
11625
+ item.diagnosisDescription ? /* @__PURE__ */ jsx31("small", { children: item.diagnosisDescription }) : null
11520
11626
  ] }),
11521
- /* @__PURE__ */ jsx30("td", { children: /* @__PURE__ */ jsx30("span", { className: "mbrfa-code", children: item.procedureCode || "\u2014" }) }),
11522
- /* @__PURE__ */ jsx30("td", { children: otherInformation(item) || "\u2014" }),
11523
- /* @__PURE__ */ jsxs28("td", { children: [
11524
- /* @__PURE__ */ jsx30(RfaPill, { tone: outcome.tone, children: outcome.label }),
11525
- item.outcome !== "pending" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11526
- item.authorizationNumber ? /* @__PURE__ */ jsxs28("small", { children: [
11627
+ /* @__PURE__ */ jsx31("td", { children: /* @__PURE__ */ jsx31("span", { className: "mbrfa-code", children: item.procedureCode || "\u2014" }) }),
11628
+ /* @__PURE__ */ jsx31("td", { children: otherInformation(item) || "\u2014" }),
11629
+ /* @__PURE__ */ jsxs29("td", { children: [
11630
+ /* @__PURE__ */ jsx31(RfaPill, { tone: outcome.tone, children: outcome.label }),
11631
+ item.outcome !== "pending" ? /* @__PURE__ */ jsxs29(Fragment18, { children: [
11632
+ item.authorizationNumber ? /* @__PURE__ */ jsxs29("small", { children: [
11527
11633
  "Authorization ",
11528
11634
  item.authorizationNumber
11529
11635
  ] }) : null,
11530
- item.authorizedProcedureCode || item.authorizedQuantity != null || item.authorizedUnits != null ? /* @__PURE__ */ jsxs28("small", { children: [
11636
+ item.authorizedProcedureCode || item.authorizedQuantity != null || item.authorizedUnits != null ? /* @__PURE__ */ jsxs29("small", { children: [
11531
11637
  "Authorized ",
11532
11638
  [item.authorizedProcedureCode || item.procedureCode, item.authorizedQuantity != null ? `quantity ${item.authorizedQuantity}` : "", item.authorizedUnits != null ? `units ${item.authorizedUnits}` : ""].filter(Boolean).join(" \xB7 ")
11533
11639
  ] }) : null,
11534
- item.effectiveFrom || item.effectiveTo ? /* @__PURE__ */ jsxs28("small", { children: [
11640
+ item.effectiveFrom || item.effectiveTo ? /* @__PURE__ */ jsxs29("small", { children: [
11535
11641
  rfaCalendarDate(item.effectiveFrom) || "Not specified",
11536
11642
  " \u2013 ",
11537
11643
  rfaCalendarDate(item.effectiveTo) || "Not specified"
11538
11644
  ] }) : null,
11539
- /* @__PURE__ */ jsxs28("small", { children: [
11645
+ /* @__PURE__ */ jsxs29("small", { children: [
11540
11646
  "Decided ",
11541
11647
  rfaShortDate(item.decidedAt)
11542
11648
  ] })
11543
11649
  ] }) : null
11544
11650
  ] })
11545
11651
  ] }),
11546
- item.decisionReason || item.reviewerName || item.decisionClosure || closable || showAppointment || correctable || item.currentResponseDocumentId || item.currentImrDocumentId ? /* @__PURE__ */ jsxs28("tr", { className: "mbrfa-subrow", children: [
11547
- /* @__PURE__ */ jsx30("td", {}),
11548
- /* @__PURE__ */ jsx30("td", { colSpan: 5, children: /* @__PURE__ */ jsxs28("div", { className: "mbrfa-manage", children: [
11549
- item.decisionReason ? /* @__PURE__ */ jsx30("p", { children: item.decisionReason }) : null,
11550
- item.reviewerName ? /* @__PURE__ */ jsxs28("p", { children: [
11652
+ item.decisionReason || item.reviewerName || item.decisionClosure || closable || showAppointment || correctable || item.currentResponseDocumentId || item.currentImrDocumentId ? /* @__PURE__ */ jsxs29("tr", { className: "mbrfa-subrow", children: [
11653
+ /* @__PURE__ */ jsx31("td", {}),
11654
+ /* @__PURE__ */ jsx31("td", { colSpan: 5, children: /* @__PURE__ */ jsxs29("div", { className: "mbrfa-manage", children: [
11655
+ item.decisionReason ? /* @__PURE__ */ jsx31("p", { children: item.decisionReason }) : null,
11656
+ item.reviewerName ? /* @__PURE__ */ jsxs29("p", { children: [
11551
11657
  "Reviewer: ",
11552
11658
  item.reviewerName,
11553
11659
  item.reviewerPhone ? ` \xB7 ${item.reviewerPhone}` : ""
11554
11660
  ] }) : null,
11555
- item.decisionClosure ? /* @__PURE__ */ jsxs28("p", { children: [
11661
+ item.decisionClosure ? /* @__PURE__ */ jsxs29("p", { children: [
11556
11662
  item.decisionClosure.closed ? "Closed" : "Reopened",
11557
11663
  " by ",
11558
11664
  item.decisionClosure.updatedBy,
@@ -11561,125 +11667,125 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11561
11667
  " \u2014 ",
11562
11668
  item.decisionClosure.reason
11563
11669
  ] }) : null,
11564
- item.currentResponseDocumentId || item.currentImrDocumentId ? /* @__PURE__ */ jsxs28("div", { className: "mbtd-actions", children: [
11670
+ item.currentResponseDocumentId || item.currentImrDocumentId ? /* @__PURE__ */ jsxs29("div", { className: "mbtd-actions", children: [
11565
11671
  evidence(item.currentResponseDocumentId, "View decision evidence"),
11566
11672
  evidence(item.currentImrDocumentId, "View independent medical review form")
11567
11673
  ] }) : null,
11568
- showAppointment ? /* @__PURE__ */ jsx30(AppointmentForm, { appointment, editable: permissions.includes("edit"), disabled: disabled || loadErrors.some((value) => value.startsWith("Appointments")), onError: setError, onSave: (input) => run(`appointment:${item.id}`, input, async (key2) => {
11674
+ showAppointment ? /* @__PURE__ */ jsx31(AppointmentForm, { appointment, editable: permissions.includes("edit"), disabled: disabled || loadErrors.some((value) => value.startsWith("Appointments")), onError: setError, onSave: (input) => run(`appointment:${item.id}`, input, async (key2) => {
11569
11675
  await client.updateScheduling(rfa.id, item.id, input, key2);
11570
11676
  return records.get(rfa.id);
11571
11677
  }) }, `${item.id}:${appointment.version}:${appointment.authorizationToken}`) : null,
11572
- closable ? /* @__PURE__ */ jsx30(TreatmentClosureForm, { item, disabled, onError: setError, onSave: (input) => run(`closure:${item.id}`, input, (key2) => client.updateTreatmentClosure(rfa.id, item.id, input, key2)) }, `${item.id}:${item.decisionClosure?.version ?? 0}`) : null,
11573
- correctable ? /* @__PURE__ */ jsxs28("details", { children: [
11574
- /* @__PURE__ */ jsx30("summary", { children: "Correct this decision" }),
11575
- /* @__PURE__ */ jsx30("p", { children: "The original decision and its evidence remain in history. Corrections require a reason and response evidence. Requests already used for a bill or a scheduled appointment cannot be corrected." }),
11576
- /* @__PURE__ */ jsx30(CorrectionForm, { item, documents: rfa.documents, disabled: disabled || loading || loadErrors.length > 0 || scheduling.some((value) => value.disposition === "scheduled"), onError: setError, onSave: (input) => run(`correction:${item.id}`, input, (key2) => client.correctDecision(rfa.id, input, key2)) }, `${item.id}:${item.currentDecisionEventId}`)
11678
+ closable ? /* @__PURE__ */ jsx31(TreatmentClosureForm, { item, disabled, onError: setError, onSave: (input) => run(`closure:${item.id}`, input, (key2) => client.updateTreatmentClosure(rfa.id, item.id, input, key2)) }, `${item.id}:${item.decisionClosure?.version ?? 0}`) : null,
11679
+ correctable ? /* @__PURE__ */ jsxs29("details", { children: [
11680
+ /* @__PURE__ */ jsx31("summary", { children: "Correct this decision" }),
11681
+ /* @__PURE__ */ jsx31("p", { children: "The original decision and its evidence remain in history. Corrections require a reason and response evidence. Requests already used for a bill or a scheduled appointment cannot be corrected." }),
11682
+ /* @__PURE__ */ jsx31(CorrectionForm, { item, documents: rfa.documents, disabled: disabled || loading || loadErrors.length > 0 || scheduling.some((value) => value.disposition === "scheduled"), onError: setError, onSave: (input) => run(`correction:${item.id}`, input, (key2) => client.correctDecision(rfa.id, input, key2)) }, `${item.id}:${item.currentDecisionEventId}`)
11577
11683
  ] }) : null
11578
11684
  ] }) })
11579
11685
  ] }) : null
11580
11686
  ] }, item.id);
11581
11687
  }) })
11582
- ] }) }) : /* @__PURE__ */ jsx30("p", { className: "mbrfa-sheet-body mbrfa-empty", children: "No treatments recorded." }) }) : null,
11583
- view !== "treatments" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11584
- /* @__PURE__ */ jsxs28(RfaCard, { title: "History", action: permissions.includes("edit") && !noteOpen ? /* @__PURE__ */ jsx30("button", { type: "button", disabled, onClick: () => setNoteOpen(true), children: "Add note" }) : null, flush: true, children: [
11585
- /* @__PURE__ */ jsx30("div", { className: "mbrfa-rows", children: noteOpen ? noteForm : null }),
11586
- loading ? /* @__PURE__ */ jsx30("p", { className: "mbrfa-sheet-body", children: "Loading history\u2026" }) : history.length ? /* @__PURE__ */ jsx30("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs28("table", { className: "mbrfa-history-table", children: [
11587
- /* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsxs28("tr", { children: [
11588
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Date" }),
11589
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Action" }),
11590
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "User" }),
11591
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Details" })
11688
+ ] }) }) : /* @__PURE__ */ jsx31("p", { className: "mbrfa-sheet-body mbrfa-empty", children: "No treatments recorded." }) }) : null,
11689
+ view !== "treatments" ? /* @__PURE__ */ jsxs29(Fragment18, { children: [
11690
+ /* @__PURE__ */ jsxs29(RfaCard, { title: "History", action: permissions.includes("edit") && !noteOpen ? /* @__PURE__ */ jsx31("button", { type: "button", disabled, onClick: () => setNoteOpen(true), children: "Add note" }) : null, flush: true, children: [
11691
+ /* @__PURE__ */ jsx31("div", { className: "mbrfa-rows", children: noteOpen ? noteForm : null }),
11692
+ loading ? /* @__PURE__ */ jsx31("p", { className: "mbrfa-sheet-body", children: "Loading history\u2026" }) : history.length ? /* @__PURE__ */ jsx31("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs29("table", { className: "mbrfa-history-table", children: [
11693
+ /* @__PURE__ */ jsx31("thead", { children: /* @__PURE__ */ jsxs29("tr", { children: [
11694
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Date" }),
11695
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Action" }),
11696
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "User" }),
11697
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Details" })
11592
11698
  ] }) }),
11593
- /* @__PURE__ */ jsx30("tbody", { children: history.map((event) => /* @__PURE__ */ jsx30(RfaHistoryEntry, { event, rfa, disabled, onDownload: (kind, id, filename) => void download(id, filename, kind) }, event.id)) })
11594
- ] }) }) : !loadErrors.some((value) => value.startsWith("History")) ? /* @__PURE__ */ jsx30("p", { className: "mbrfa-sheet-body mbrfa-empty", children: "No history entries have been recorded." }) : null
11699
+ /* @__PURE__ */ jsx31("tbody", { children: history.map((event) => /* @__PURE__ */ jsx31(RfaHistoryEntry, { event, rfa, disabled, onDownload: (kind, id, filename) => void download(id, filename, kind) }, event.id)) })
11700
+ ] }) }) : !loadErrors.some((value) => value.startsWith("History")) ? /* @__PURE__ */ jsx31("p", { className: "mbrfa-sheet-body mbrfa-empty", children: "No history entries have been recorded." }) : null
11595
11701
  ] }),
11596
- rfa.transmissions.length ? /* @__PURE__ */ jsx30(RfaCard, { title: "Delivery", count: rfa.transmissions.length, flush: true, children: /* @__PURE__ */ jsx30("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs28("table", { className: "mbrfa-grid-table", children: [
11597
- /* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsxs28("tr", { children: [
11598
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Date" }),
11599
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Method" }),
11600
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Status" }),
11601
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Recipient" }),
11602
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Confirmed receipt" }),
11603
- /* @__PURE__ */ jsx30("th", { scope: "col", children: /* @__PURE__ */ jsx30("span", { className: "mbrfa-sr-only", children: "Receipt" }) })
11702
+ rfa.transmissions.length ? /* @__PURE__ */ jsx31(RfaCard, { title: "Delivery", count: rfa.transmissions.length, flush: true, children: /* @__PURE__ */ jsx31("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs29("table", { className: "mbrfa-grid-table", children: [
11703
+ /* @__PURE__ */ jsx31("thead", { children: /* @__PURE__ */ jsxs29("tr", { children: [
11704
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Date" }),
11705
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Method" }),
11706
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Status" }),
11707
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Recipient" }),
11708
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Confirmed receipt" }),
11709
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: /* @__PURE__ */ jsx31("span", { className: "mbrfa-sr-only", children: "Receipt" }) })
11604
11710
  ] }) }),
11605
- /* @__PURE__ */ jsx30("tbody", { children: rfa.transmissions.map((transmission) => /* @__PURE__ */ jsxs28("tr", { children: [
11606
- /* @__PURE__ */ jsx30("td", { children: rfaShortDate(transmission.occurredAt) }),
11607
- /* @__PURE__ */ jsxs28("td", { children: [
11711
+ /* @__PURE__ */ jsx31("tbody", { children: rfa.transmissions.map((transmission) => /* @__PURE__ */ jsxs29("tr", { children: [
11712
+ /* @__PURE__ */ jsx31("td", { children: rfaShortDate(transmission.occurredAt) }),
11713
+ /* @__PURE__ */ jsxs29("td", { children: [
11608
11714
  capital(words2(transmission.channel)),
11609
- /* @__PURE__ */ jsxs28("small", { children: [
11715
+ /* @__PURE__ */ jsxs29("small", { children: [
11610
11716
  capital(words2(transmission.direction)),
11611
11717
  transmission.purpose ? ` \xB7 ${words2(transmission.purpose)}` : ""
11612
11718
  ] })
11613
11719
  ] }),
11614
- /* @__PURE__ */ jsx30("td", { children: /* @__PURE__ */ jsx30(RfaPill, { tone: ["delivered", "received", "sent"].includes(transmission.status) ? "ok" : transmission.status === "failed" ? "bad" : "muted", children: capital(words2(transmission.status)) }) }),
11615
- /* @__PURE__ */ jsxs28("td", { children: [
11720
+ /* @__PURE__ */ jsx31("td", { children: /* @__PURE__ */ jsx31(RfaPill, { tone: ["delivered", "received", "sent"].includes(transmission.status) ? "ok" : transmission.status === "failed" ? "bad" : "muted", children: capital(words2(transmission.status)) }) }),
11721
+ /* @__PURE__ */ jsxs29("td", { children: [
11616
11722
  transmission.destination || "\u2014",
11617
- transmission.providerMessageId ? /* @__PURE__ */ jsxs28("small", { children: [
11723
+ transmission.providerMessageId ? /* @__PURE__ */ jsxs29("small", { children: [
11618
11724
  "Reference ",
11619
11725
  transmission.providerMessageId
11620
11726
  ] }) : null
11621
11727
  ] }),
11622
- /* @__PURE__ */ jsx30("td", { children: rfaShortDate(transmission.receivedAt) }),
11623
- /* @__PURE__ */ jsx30("td", { className: "mbrfa-row-actions", children: evidence(transmission.proofDocumentId, "Receipt") })
11728
+ /* @__PURE__ */ jsx31("td", { children: rfaShortDate(transmission.receivedAt) }),
11729
+ /* @__PURE__ */ jsx31("td", { className: "mbrfa-row-actions", children: evidence(transmission.proofDocumentId, "Receipt") })
11624
11730
  ] }, transmission.id)) })
11625
11731
  ] }) }) }) : null
11626
11732
  ] }) : null
11627
11733
  ] });
11628
- const content = /* @__PURE__ */ jsx30(Fragment18, { children: /* @__PURE__ */ jsxs28("div", { style: { display: "grid", gap: 16 }, children: [
11629
- error ? /* @__PURE__ */ jsx30("p", { role: "alert", children: error }) : null,
11630
- message ? /* @__PURE__ */ jsx30("p", { role: "status", children: message }) : null,
11631
- loadErrors.map((value) => /* @__PURE__ */ jsx30("p", { role: "alert", children: value }, value)),
11632
- /* @__PURE__ */ jsxs28("div", { hidden: view === "history", className: "mbrfa-treatment-list", children: [
11633
- /* @__PURE__ */ jsx30("h3", { children: "Requested treatments" }),
11734
+ const content = /* @__PURE__ */ jsx31(Fragment18, { children: /* @__PURE__ */ jsxs29("div", { style: { display: "grid", gap: 16 }, children: [
11735
+ error ? /* @__PURE__ */ jsx31("p", { role: "alert", children: error }) : null,
11736
+ message ? /* @__PURE__ */ jsx31("p", { role: "status", children: message }) : null,
11737
+ loadErrors.map((value) => /* @__PURE__ */ jsx31("p", { role: "alert", children: value }, value)),
11738
+ /* @__PURE__ */ jsxs29("div", { hidden: view === "history", className: "mbrfa-treatment-list", children: [
11739
+ /* @__PURE__ */ jsx31("h3", { children: "Requested treatments" }),
11634
11740
  rfa.items.map((item, index) => {
11635
11741
  const appointment = scheduling.find((value) => value.itemId === item.id);
11636
- return /* @__PURE__ */ jsxs28("fieldset", { id: `rfa-treatment-${item.id}`, tabIndex: -1, children: [
11637
- /* @__PURE__ */ jsxs28("legend", { children: [
11742
+ return /* @__PURE__ */ jsxs29("fieldset", { id: `rfa-treatment-${item.id}`, tabIndex: -1, children: [
11743
+ /* @__PURE__ */ jsxs29("legend", { children: [
11638
11744
  index + 1,
11639
11745
  ". ",
11640
11746
  item.serviceDescription
11641
11747
  ] }),
11642
- /* @__PURE__ */ jsxs28("p", { children: [
11748
+ /* @__PURE__ */ jsxs29("p", { children: [
11643
11749
  item.procedureCode || "No procedure code",
11644
11750
  " \xB7 Diagnosis ",
11645
11751
  item.diagnosisCode,
11646
11752
  " \xB7 ",
11647
11753
  item.decisionClosure?.closed ? "Decision no longer required" : words2(item.outcome)
11648
11754
  ] }),
11649
- /* @__PURE__ */ jsx30("dl", { className: "mbrfa-request-details", children: [["Diagnosis description", item.diagnosisDescription], ["Quantity", item.quantity], ["Units", item.units], ["Frequency", item.frequency], ["Duration", item.duration], ["Requested from", item.requestedFrom], ["Requested through", item.requestedTo]].filter(([, value]) => value !== null && value !== void 0 && value !== "").map(([title, value]) => /* @__PURE__ */ jsxs28("div", { children: [
11650
- /* @__PURE__ */ jsx30("dt", { children: title }),
11651
- /* @__PURE__ */ jsx30("dd", { children: value })
11755
+ /* @__PURE__ */ jsx31("dl", { className: "mbrfa-request-details", children: [["Diagnosis description", item.diagnosisDescription], ["Quantity", item.quantity], ["Units", item.units], ["Frequency", item.frequency], ["Duration", item.duration], ["Requested from", item.requestedFrom], ["Requested through", item.requestedTo]].filter(([, value]) => value !== null && value !== void 0 && value !== "").map(([title, value]) => /* @__PURE__ */ jsxs29("div", { children: [
11756
+ /* @__PURE__ */ jsx31("dt", { children: title }),
11757
+ /* @__PURE__ */ jsx31("dd", { children: value })
11652
11758
  ] }, title)) }),
11653
- item.decisionClosure ? /* @__PURE__ */ jsxs28("p", { children: [
11759
+ item.decisionClosure ? /* @__PURE__ */ jsxs29("p", { children: [
11654
11760
  item.decisionClosure.closed ? "Closed" : "Reopened",
11655
11761
  " by ",
11656
11762
  item.decisionClosure.updatedBy,
11657
11763
  " \xB7 ",
11658
11764
  date5(item.decisionClosure.updatedAt),
11659
- /* @__PURE__ */ jsx30("br", {}),
11765
+ /* @__PURE__ */ jsx31("br", {}),
11660
11766
  item.decisionClosure.reason
11661
11767
  ] }) : null,
11662
- canClose && item.outcome === "pending" && !item.decidedAt ? /* @__PURE__ */ jsx30(TreatmentClosureForm, { item, disabled, onError: setError, onSave: (input) => run(`closure:${item.id}`, input, (key2) => client.updateTreatmentClosure(rfa.id, item.id, input, key2)) }, `${item.id}:${item.decisionClosure?.version ?? 0}`) : null,
11663
- item.outcome !== "pending" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11664
- /* @__PURE__ */ jsxs28("p", { children: [
11768
+ canClose && item.outcome === "pending" && !item.decidedAt ? /* @__PURE__ */ jsx31(TreatmentClosureForm, { item, disabled, onError: setError, onSave: (input) => run(`closure:${item.id}`, input, (key2) => client.updateTreatmentClosure(rfa.id, item.id, input, key2)) }, `${item.id}:${item.decisionClosure?.version ?? 0}`) : null,
11769
+ item.outcome !== "pending" ? /* @__PURE__ */ jsxs29(Fragment18, { children: [
11770
+ /* @__PURE__ */ jsxs29("p", { children: [
11665
11771
  "Decision: ",
11666
11772
  date5(item.decidedAt),
11667
11773
  item.authorizationNumber ? ` \xB7 Authorization ${item.authorizationNumber}` : ""
11668
11774
  ] }),
11669
- item.authorizedProcedureCode || item.authorizedQuantity || item.authorizedUnits ? /* @__PURE__ */ jsxs28("p", { children: [
11775
+ item.authorizedProcedureCode || item.authorizedQuantity || item.authorizedUnits ? /* @__PURE__ */ jsxs29("p", { children: [
11670
11776
  "Authorized: ",
11671
11777
  item.authorizedProcedureCode || item.procedureCode || "Treatment",
11672
11778
  item.authorizedQuantity != null ? ` \xB7 Quantity ${item.authorizedQuantity}` : "",
11673
11779
  item.authorizedUnits != null ? ` \xB7 Units ${item.authorizedUnits}` : ""
11674
11780
  ] }) : null,
11675
- item.effectiveFrom || item.effectiveTo ? /* @__PURE__ */ jsxs28("p", { children: [
11781
+ item.effectiveFrom || item.effectiveTo ? /* @__PURE__ */ jsxs29("p", { children: [
11676
11782
  "Authorization dates: ",
11677
11783
  item.effectiveFrom ?? "Not specified",
11678
11784
  " through ",
11679
11785
  item.effectiveTo ?? "Not specified"
11680
11786
  ] }) : null,
11681
- item.decisionReason ? /* @__PURE__ */ jsx30("p", { children: item.decisionReason }) : null,
11682
- item.reviewerName ? /* @__PURE__ */ jsxs28("p", { children: [
11787
+ item.decisionReason ? /* @__PURE__ */ jsx31("p", { children: item.decisionReason }) : null,
11788
+ item.reviewerName ? /* @__PURE__ */ jsxs29("p", { children: [
11683
11789
  "Reviewer: ",
11684
11790
  item.reviewerName,
11685
11791
  item.reviewerPhone ? ` \xB7 ${item.reviewerPhone}` : ""
@@ -11688,57 +11794,57 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11688
11794
  " ",
11689
11795
  evidence(item.currentImrDocumentId, "View independent medical review form")
11690
11796
  ] }) : null,
11691
- loading ? /* @__PURE__ */ jsx30("p", { children: "Loading appointment\u2026" }) : appointment ? /* @__PURE__ */ jsx30(AppointmentForm, { appointment, editable: permissions.includes("edit"), disabled: disabled || loadErrors.some((value) => value.startsWith("Appointments")), onError: setError, onSave: (input) => run(`appointment:${item.id}`, input, async (key2) => {
11797
+ loading ? /* @__PURE__ */ jsx31("p", { children: "Loading appointment\u2026" }) : appointment ? /* @__PURE__ */ jsx31(AppointmentForm, { appointment, editable: permissions.includes("edit"), disabled: disabled || loadErrors.some((value) => value.startsWith("Appointments")), onError: setError, onSave: (input) => run(`appointment:${item.id}`, input, async (key2) => {
11692
11798
  await client.updateScheduling(rfa.id, item.id, input, key2);
11693
11799
  return records.get(rfa.id);
11694
11800
  }) }, `${item.id}:${appointment.version}:${appointment.authorizationToken}`) : null,
11695
- canCorrect && item.currentDecisionEventId && item.outcome !== "pending" ? /* @__PURE__ */ jsxs28("details", { children: [
11696
- /* @__PURE__ */ jsx30("summary", { children: "Correct this decision" }),
11697
- /* @__PURE__ */ jsx30("p", { children: "The original decision and its evidence remain in history. Corrections require a reason and response evidence. Requests already used for a bill or a scheduled appointment cannot be corrected." }),
11698
- /* @__PURE__ */ jsx30(CorrectionForm, { item, documents: rfa.documents, disabled: disabled || loading || loadErrors.length > 0 || scheduling.some((value) => value.disposition === "scheduled"), onError: setError, onSave: (input) => run(`correction:${item.id}`, input, (key2) => client.correctDecision(rfa.id, input, key2)) }, `${item.id}:${item.currentDecisionEventId}`)
11801
+ canCorrect && item.currentDecisionEventId && item.outcome !== "pending" ? /* @__PURE__ */ jsxs29("details", { children: [
11802
+ /* @__PURE__ */ jsx31("summary", { children: "Correct this decision" }),
11803
+ /* @__PURE__ */ jsx31("p", { children: "The original decision and its evidence remain in history. Corrections require a reason and response evidence. Requests already used for a bill or a scheduled appointment cannot be corrected." }),
11804
+ /* @__PURE__ */ jsx31(CorrectionForm, { item, documents: rfa.documents, disabled: disabled || loading || loadErrors.length > 0 || scheduling.some((value) => value.disposition === "scheduled"), onError: setError, onSave: (input) => run(`correction:${item.id}`, input, (key2) => client.correctDecision(rfa.id, input, key2)) }, `${item.id}:${item.currentDecisionEventId}`)
11699
11805
  ] }) : null
11700
11806
  ] }, item.id);
11701
11807
  })
11702
11808
  ] }),
11703
- /* @__PURE__ */ jsxs28("div", { hidden: view === "treatments", className: "mbrfa-history-content", children: [
11704
- /* @__PURE__ */ jsxs28("details", { className: "mbrfa-delivery-evidence", children: [
11705
- /* @__PURE__ */ jsxs28("summary", { children: [
11809
+ /* @__PURE__ */ jsxs29("div", { hidden: view === "treatments", className: "mbrfa-history-content", children: [
11810
+ /* @__PURE__ */ jsxs29("details", { className: "mbrfa-delivery-evidence", children: [
11811
+ /* @__PURE__ */ jsxs29("summary", { children: [
11706
11812
  "Delivery evidence (",
11707
11813
  rfa.transmissions.length,
11708
11814
  ")"
11709
11815
  ] }),
11710
- rfa.transmissions.length ? rfa.transmissions.map((transmission) => /* @__PURE__ */ jsxs28("article", { style: { paddingBlock: 8 }, children: [
11711
- /* @__PURE__ */ jsxs28("strong", { children: [
11816
+ rfa.transmissions.length ? rfa.transmissions.map((transmission) => /* @__PURE__ */ jsxs29("article", { style: { paddingBlock: 8 }, children: [
11817
+ /* @__PURE__ */ jsxs29("strong", { children: [
11712
11818
  words2(transmission.channel),
11713
11819
  " \xB7 ",
11714
11820
  words2(transmission.status)
11715
11821
  ] }),
11716
- /* @__PURE__ */ jsxs28("p", { children: [
11822
+ /* @__PURE__ */ jsxs29("p", { children: [
11717
11823
  words2(transmission.direction),
11718
11824
  transmission.purpose ? ` \xB7 ${words2(transmission.purpose)}` : "",
11719
11825
  " \xB7 ",
11720
11826
  date5(transmission.occurredAt)
11721
11827
  ] }),
11722
- transmission.destination ? /* @__PURE__ */ jsxs28("p", { children: [
11828
+ transmission.destination ? /* @__PURE__ */ jsxs29("p", { children: [
11723
11829
  "Recipient: ",
11724
11830
  transmission.destination
11725
11831
  ] }) : null,
11726
- transmission.providerMessageId ? /* @__PURE__ */ jsxs28("p", { children: [
11832
+ transmission.providerMessageId ? /* @__PURE__ */ jsxs29("p", { children: [
11727
11833
  "Delivery reference: ",
11728
11834
  transmission.providerMessageId
11729
11835
  ] }) : null,
11730
- transmission.receivedAt ? /* @__PURE__ */ jsxs28("p", { children: [
11836
+ transmission.receivedAt ? /* @__PURE__ */ jsxs29("p", { children: [
11731
11837
  "Confirmed receipt: ",
11732
11838
  date5(transmission.receivedAt)
11733
11839
  ] }) : null,
11734
11840
  evidence(transmission.proofDocumentId, "Download transmission receipt")
11735
- ] }, transmission.id)) : /* @__PURE__ */ jsx30("p", { children: "No transmission evidence has been recorded." })
11841
+ ] }, transmission.id)) : /* @__PURE__ */ jsx31("p", { children: "No transmission evidence has been recorded." })
11736
11842
  ] }),
11737
- /* @__PURE__ */ jsxs28("section", { className: "mbrfa-history-card", "aria-label": "History and notes", children: [
11738
- /* @__PURE__ */ jsx30("h3", { children: "History and notes" }),
11739
- permissions.includes("edit") ? /* @__PURE__ */ jsxs28("details", { className: "mbrfa-note-form", children: [
11740
- /* @__PURE__ */ jsx30("summary", { children: "Add a note" }),
11741
- /* @__PURE__ */ jsx30("form", { onSubmit: (event) => {
11843
+ /* @__PURE__ */ jsxs29("section", { className: "mbrfa-history-card", "aria-label": "History and notes", children: [
11844
+ /* @__PURE__ */ jsx31("h3", { children: "History and notes" }),
11845
+ permissions.includes("edit") ? /* @__PURE__ */ jsxs29("details", { className: "mbrfa-note-form", children: [
11846
+ /* @__PURE__ */ jsx31("summary", { children: "Add a note" }),
11847
+ /* @__PURE__ */ jsx31("form", { onSubmit: (event) => {
11742
11848
  event.preventDefault();
11743
11849
  const form = event.currentTarget;
11744
11850
  try {
@@ -11752,51 +11858,51 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11752
11858
  } catch (reason) {
11753
11859
  setError(reason instanceof Error ? reason.message : "Enter a note.");
11754
11860
  }
11755
- }, children: /* @__PURE__ */ jsxs28("fieldset", { disabled, children: [
11756
- /* @__PURE__ */ jsx30("legend", { children: "Add a note" }),
11757
- /* @__PURE__ */ jsxs28("label", { children: [
11861
+ }, children: /* @__PURE__ */ jsxs29("fieldset", { disabled, children: [
11862
+ /* @__PURE__ */ jsx31("legend", { children: "Add a note" }),
11863
+ /* @__PURE__ */ jsxs29("label", { children: [
11758
11864
  "Note",
11759
- /* @__PURE__ */ jsx30("textarea", { name: "note", required: true, maxLength: 1e4 })
11865
+ /* @__PURE__ */ jsx31("textarea", { name: "note", required: true, maxLength: 1e4 })
11760
11866
  ] }),
11761
- /* @__PURE__ */ jsx30("button", { type: "submit", children: "Save note" })
11867
+ /* @__PURE__ */ jsx31("button", { type: "submit", children: "Save note" })
11762
11868
  ] }) })
11763
11869
  ] }) : null,
11764
- loading ? /* @__PURE__ */ jsx30("p", { children: "Loading history\u2026" }) : history.length ? /* @__PURE__ */ jsx30("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs28("table", { className: "mbrfa-history-table", children: [
11765
- /* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsxs28("tr", { children: [
11766
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Date" }),
11767
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Action" }),
11768
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "User" }),
11769
- /* @__PURE__ */ jsx30("th", { scope: "col", children: "Details" })
11870
+ loading ? /* @__PURE__ */ jsx31("p", { children: "Loading history\u2026" }) : history.length ? /* @__PURE__ */ jsx31("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs29("table", { className: "mbrfa-history-table", children: [
11871
+ /* @__PURE__ */ jsx31("thead", { children: /* @__PURE__ */ jsxs29("tr", { children: [
11872
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Date" }),
11873
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Action" }),
11874
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "User" }),
11875
+ /* @__PURE__ */ jsx31("th", { scope: "col", children: "Details" })
11770
11876
  ] }) }),
11771
- /* @__PURE__ */ jsx30("tbody", { children: history.map((event) => /* @__PURE__ */ jsx30(RfaHistoryEntry, { event, rfa, disabled, onDownload: (kind, id, filename) => void download(id, filename, kind) }, event.id)) })
11772
- ] }) }) : !loadErrors.some((value) => value.startsWith("History")) ? /* @__PURE__ */ jsx30("p", { children: "No history entries have been recorded." }) : null
11877
+ /* @__PURE__ */ jsx31("tbody", { children: history.map((event) => /* @__PURE__ */ jsx31(RfaHistoryEntry, { event, rfa, disabled, onDownload: (kind, id, filename) => void download(id, filename, kind) }, event.id)) })
11878
+ ] }) }) : !loadErrors.some((value) => value.startsWith("History")) ? /* @__PURE__ */ jsx31("p", { children: "No history entries have been recorded." }) : null
11773
11879
  ] })
11774
11880
  ] })
11775
11881
  ] }) });
11776
- if (cards) return /* @__PURE__ */ jsx30("div", { className: "mbrfa-tracking", children: cardContent });
11777
- return embedded ? /* @__PURE__ */ jsx30("div", { className: "mbrfa-tracking", children: content }) : /* @__PURE__ */ jsxs28(TreatmentDraftShell, { ...appearance, title: "Treatments and history", description: "Review each treatment's authorization, appointments, delivery evidence, and notes.", children: [
11778
- /* @__PURE__ */ jsx30("style", { children: rfaDetailCss }),
11882
+ if (cards) return /* @__PURE__ */ jsx31("div", { className: "mbrfa-tracking", children: cardContent });
11883
+ return embedded ? /* @__PURE__ */ jsx31("div", { className: "mbrfa-tracking", children: content }) : /* @__PURE__ */ jsxs29(TreatmentDraftShell, { ...appearance, title: "Treatments and history", description: "Review each treatment's authorization, appointments, delivery evidence, and notes.", children: [
11884
+ /* @__PURE__ */ jsx31("style", { children: rfaDetailCss }),
11779
11885
  content
11780
11886
  ] });
11781
11887
  }
11782
11888
  function AppointmentForm({ appointment, editable, disabled, onError, onSave }) {
11783
- const [disposition, setDisposition] = useState18(appointment.disposition === "canceled" && appointment.version > 0 ? "canceled" : appointment.eligible && appointment.disposition === "no_appointment" ? "no_appointment" : appointment.eligible ? "scheduled" : "canceled");
11784
- return /* @__PURE__ */ jsxs28("section", { children: [
11785
- /* @__PURE__ */ jsx30("h4", { children: "Appointment" }),
11786
- /* @__PURE__ */ jsxs28("p", { children: [
11889
+ const [disposition, setDisposition] = useState19(appointment.disposition === "canceled" && appointment.version > 0 ? "canceled" : appointment.eligible && appointment.disposition === "no_appointment" ? "no_appointment" : appointment.eligible ? "scheduled" : "canceled");
11890
+ return /* @__PURE__ */ jsxs29("section", { children: [
11891
+ /* @__PURE__ */ jsx31("h4", { children: "Appointment" }),
11892
+ /* @__PURE__ */ jsxs29("p", { children: [
11787
11893
  words2(appointment.disposition),
11788
11894
  appointment.appointmentAt ? ` \xB7 ${date5(appointment.appointmentAt)}` : ""
11789
11895
  ] }),
11790
- appointment.providerName ? /* @__PURE__ */ jsxs28("p", { children: [
11896
+ appointment.providerName ? /* @__PURE__ */ jsxs29("p", { children: [
11791
11897
  appointment.providerName,
11792
11898
  " \xB7 ",
11793
11899
  appointment.location
11794
11900
  ] }) : null,
11795
- appointment.reason ? /* @__PURE__ */ jsx30("p", { children: appointment.reason }) : null,
11796
- appointment.version > 0 && !appointment.current ? /* @__PURE__ */ jsx30("p", { role: "status", children: "Authorization has changed. Review the current decision before updating this appointment." }) : null,
11797
- editable && (appointment.eligible || appointment.version > 0) ? /* @__PURE__ */ jsxs28("details", { children: [
11798
- /* @__PURE__ */ jsx30("summary", { children: "Update appointment" }),
11799
- /* @__PURE__ */ jsx30("form", { onSubmit: (event) => {
11901
+ appointment.reason ? /* @__PURE__ */ jsx31("p", { children: appointment.reason }) : null,
11902
+ appointment.version > 0 && !appointment.current ? /* @__PURE__ */ jsx31("p", { role: "status", children: "Authorization has changed. Review the current decision before updating this appointment." }) : null,
11903
+ editable && (appointment.eligible || appointment.version > 0) ? /* @__PURE__ */ jsxs29("details", { children: [
11904
+ /* @__PURE__ */ jsx31("summary", { children: "Update appointment" }),
11905
+ /* @__PURE__ */ jsx31("form", { onSubmit: (event) => {
11800
11906
  event.preventDefault();
11801
11907
  if (disabled) return;
11802
11908
  try {
@@ -11807,42 +11913,42 @@ function AppointmentForm({ appointment, editable, disabled, onError, onSave }) {
11807
11913
  } catch (reason) {
11808
11914
  onError(reason instanceof Error ? reason.message : "Review the appointment details.");
11809
11915
  }
11810
- }, children: /* @__PURE__ */ jsxs28("fieldset", { disabled, children: [
11811
- /* @__PURE__ */ jsx30("legend", { children: "Appointment details" }),
11812
- /* @__PURE__ */ jsxs28("label", { children: [
11916
+ }, children: /* @__PURE__ */ jsxs29("fieldset", { disabled, children: [
11917
+ /* @__PURE__ */ jsx31("legend", { children: "Appointment details" }),
11918
+ /* @__PURE__ */ jsxs29("label", { children: [
11813
11919
  "Disposition",
11814
- /* @__PURE__ */ jsxs28("select", { value: disposition, onChange: (event) => setDisposition(event.target.value), children: [
11815
- appointment.eligible ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11816
- /* @__PURE__ */ jsx30("option", { value: "scheduled", children: "Scheduled" }),
11817
- /* @__PURE__ */ jsx30("option", { value: "no_appointment", children: "No appointment needed" })
11920
+ /* @__PURE__ */ jsxs29("select", { value: disposition, onChange: (event) => setDisposition(event.target.value), children: [
11921
+ appointment.eligible ? /* @__PURE__ */ jsxs29(Fragment18, { children: [
11922
+ /* @__PURE__ */ jsx31("option", { value: "scheduled", children: "Scheduled" }),
11923
+ /* @__PURE__ */ jsx31("option", { value: "no_appointment", children: "No appointment needed" })
11818
11924
  ] }) : null,
11819
- appointment.version > 0 ? /* @__PURE__ */ jsx30("option", { value: "canceled", children: "Canceled" }) : null
11925
+ appointment.version > 0 ? /* @__PURE__ */ jsx31("option", { value: "canceled", children: "Canceled" }) : null
11820
11926
  ] })
11821
11927
  ] }),
11822
- disposition === "scheduled" ? /* @__PURE__ */ jsxs28("div", { className: "mbtd-grid", children: [
11823
- /* @__PURE__ */ jsxs28("label", { children: [
11928
+ disposition === "scheduled" ? /* @__PURE__ */ jsxs29("div", { className: "mbtd-grid", children: [
11929
+ /* @__PURE__ */ jsxs29("label", { children: [
11824
11930
  "Date and time (your local time)",
11825
- /* @__PURE__ */ jsx30("input", { name: "appointmentAt", type: "datetime-local", required: true, defaultValue: localTime(appointment.appointmentAt) })
11931
+ /* @__PURE__ */ jsx31("input", { name: "appointmentAt", type: "datetime-local", required: true, defaultValue: localTime(appointment.appointmentAt) })
11826
11932
  ] }),
11827
- /* @__PURE__ */ jsxs28("label", { children: [
11933
+ /* @__PURE__ */ jsxs29("label", { children: [
11828
11934
  "Provider name",
11829
- /* @__PURE__ */ jsx30("input", { name: "providerName", required: true, maxLength: 200, defaultValue: appointment.providerName ?? "" })
11935
+ /* @__PURE__ */ jsx31("input", { name: "providerName", required: true, maxLength: 200, defaultValue: appointment.providerName ?? "" })
11830
11936
  ] }),
11831
- /* @__PURE__ */ jsxs28("label", { children: [
11937
+ /* @__PURE__ */ jsxs29("label", { children: [
11832
11938
  "Location",
11833
- /* @__PURE__ */ jsx30("input", { name: "location", required: true, maxLength: 500, defaultValue: appointment.location ?? "" })
11939
+ /* @__PURE__ */ jsx31("input", { name: "location", required: true, maxLength: 500, defaultValue: appointment.location ?? "" })
11834
11940
  ] })
11835
- ] }) : /* @__PURE__ */ jsxs28("label", { children: [
11941
+ ] }) : /* @__PURE__ */ jsxs29("label", { children: [
11836
11942
  "Reason",
11837
- /* @__PURE__ */ jsx30("textarea", { name: "reason", required: true, maxLength: 2e3, defaultValue: appointment.reason ?? "" })
11943
+ /* @__PURE__ */ jsx31("textarea", { name: "reason", required: true, maxLength: 2e3, defaultValue: appointment.reason ?? "" })
11838
11944
  ] }),
11839
- /* @__PURE__ */ jsx30("button", { type: "submit", children: "Save appointment" })
11945
+ /* @__PURE__ */ jsx31("button", { type: "submit", children: "Save appointment" })
11840
11946
  ] }) })
11841
- ] }) : !appointment.eligible && appointment.disposition === "pending" ? /* @__PURE__ */ jsx30("p", { children: "Appointments become available after treatment is authorized." }) : null
11947
+ ] }) : !appointment.eligible && appointment.disposition === "pending" ? /* @__PURE__ */ jsx31("p", { children: "Appointments become available after treatment is authorized." }) : null
11842
11948
  ] });
11843
11949
  }
11844
11950
  function CorrectionForm({ item, documents, disabled, onError, onSave }) {
11845
- const [outcome, setOutcome] = useState18(item.outcome);
11951
+ const [outcome, setOutcome] = useState19(item.outcome);
11846
11952
  const submit = (event) => {
11847
11953
  event.preventDefault();
11848
11954
  if (disabled) return;
@@ -11866,90 +11972,90 @@ function CorrectionForm({ item, documents, disabled, onError, onSave }) {
11866
11972
  onError(reason instanceof Error ? reason.message : "Review the correction details.");
11867
11973
  }
11868
11974
  };
11869
- return /* @__PURE__ */ jsx30("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs28("fieldset", { disabled, children: [
11870
- /* @__PURE__ */ jsx30("legend", { children: "Decision correction" }),
11871
- /* @__PURE__ */ jsxs28("div", { className: "mbtd-grid", children: [
11872
- /* @__PURE__ */ jsxs28("label", { children: [
11975
+ return /* @__PURE__ */ jsx31("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs29("fieldset", { disabled, children: [
11976
+ /* @__PURE__ */ jsx31("legend", { children: "Decision correction" }),
11977
+ /* @__PURE__ */ jsxs29("div", { className: "mbtd-grid", children: [
11978
+ /* @__PURE__ */ jsxs29("label", { children: [
11873
11979
  "Correction reason",
11874
- /* @__PURE__ */ jsx30("textarea", { name: "reason", required: true, maxLength: 2e4 })
11980
+ /* @__PURE__ */ jsx31("textarea", { name: "reason", required: true, maxLength: 2e4 })
11875
11981
  ] }),
11876
- /* @__PURE__ */ jsxs28("label", { children: [
11982
+ /* @__PURE__ */ jsxs29("label", { children: [
11877
11983
  "Corrected decision",
11878
- /* @__PURE__ */ jsxs28("select", { value: outcome, onChange: (event) => setOutcome(event.target.value), children: [
11879
- /* @__PURE__ */ jsx30("option", { value: "approved", children: "Approved" }),
11880
- /* @__PURE__ */ jsx30("option", { value: "modified", children: "Modified" }),
11881
- /* @__PURE__ */ jsx30("option", { value: "denied", children: "Denied" })
11984
+ /* @__PURE__ */ jsxs29("select", { value: outcome, onChange: (event) => setOutcome(event.target.value), children: [
11985
+ /* @__PURE__ */ jsx31("option", { value: "approved", children: "Approved" }),
11986
+ /* @__PURE__ */ jsx31("option", { value: "modified", children: "Modified" }),
11987
+ /* @__PURE__ */ jsx31("option", { value: "denied", children: "Denied" })
11882
11988
  ] })
11883
11989
  ] }),
11884
- /* @__PURE__ */ jsxs28("label", { children: [
11990
+ /* @__PURE__ */ jsxs29("label", { children: [
11885
11991
  "Decision time",
11886
- /* @__PURE__ */ jsx30("input", { name: "decidedAt", type: "datetime-local", required: true, defaultValue: localTime(item.decidedAt) })
11992
+ /* @__PURE__ */ jsx31("input", { name: "decidedAt", type: "datetime-local", required: true, defaultValue: localTime(item.decidedAt) })
11887
11993
  ] }),
11888
- /* @__PURE__ */ jsxs28("label", { children: [
11994
+ /* @__PURE__ */ jsxs29("label", { children: [
11889
11995
  "Decision response evidence",
11890
- /* @__PURE__ */ jsxs28("select", { name: "responseDocumentId", required: true, defaultValue: item.currentResponseDocumentId ?? "", children: [
11891
- /* @__PURE__ */ jsx30("option", { value: "", children: "Choose evidence" }),
11892
- documents.filter((document2) => document2.documentType === "ur_response").map((document2) => /* @__PURE__ */ jsx30("option", { value: document2.id, children: document2.filename }, document2.id))
11996
+ /* @__PURE__ */ jsxs29("select", { name: "responseDocumentId", required: true, defaultValue: item.currentResponseDocumentId ?? "", children: [
11997
+ /* @__PURE__ */ jsx31("option", { value: "", children: "Choose evidence" }),
11998
+ documents.filter((document2) => document2.documentType === "ur_response").map((document2) => /* @__PURE__ */ jsx31("option", { value: document2.id, children: document2.filename }, document2.id))
11893
11999
  ] })
11894
12000
  ] }),
11895
- outcome !== "approved" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11896
- /* @__PURE__ */ jsxs28("label", { children: [
12001
+ outcome !== "approved" ? /* @__PURE__ */ jsxs29(Fragment18, { children: [
12002
+ /* @__PURE__ */ jsxs29("label", { children: [
11897
12003
  "Independent medical review form",
11898
- /* @__PURE__ */ jsxs28("select", { name: "imrDocumentId", required: true, defaultValue: item.currentImrDocumentId ?? "", children: [
11899
- /* @__PURE__ */ jsx30("option", { value: "", children: "Choose a form" }),
11900
- documents.filter((document2) => document2.documentType === "imr_form").map((document2) => /* @__PURE__ */ jsx30("option", { value: document2.id, children: document2.filename }, document2.id))
12004
+ /* @__PURE__ */ jsxs29("select", { name: "imrDocumentId", required: true, defaultValue: item.currentImrDocumentId ?? "", children: [
12005
+ /* @__PURE__ */ jsx31("option", { value: "", children: "Choose a form" }),
12006
+ documents.filter((document2) => document2.documentType === "imr_form").map((document2) => /* @__PURE__ */ jsx31("option", { value: document2.id, children: document2.filename }, document2.id))
11901
12007
  ] })
11902
12008
  ] }),
11903
- /* @__PURE__ */ jsxs28("label", { children: [
12009
+ /* @__PURE__ */ jsxs29("label", { children: [
11904
12010
  "Decision reason",
11905
- /* @__PURE__ */ jsx30("textarea", { name: "decisionReason", required: true, defaultValue: item.decisionReason ?? "" })
12011
+ /* @__PURE__ */ jsx31("textarea", { name: "decisionReason", required: true, defaultValue: item.decisionReason ?? "" })
11906
12012
  ] }),
11907
- /* @__PURE__ */ jsxs28("label", { children: [
12013
+ /* @__PURE__ */ jsxs29("label", { children: [
11908
12014
  "Reviewer name",
11909
- /* @__PURE__ */ jsx30("input", { name: "reviewerName", required: true, defaultValue: item.reviewerName ?? "" })
12015
+ /* @__PURE__ */ jsx31("input", { name: "reviewerName", required: true, defaultValue: item.reviewerName ?? "" })
11910
12016
  ] }),
11911
- /* @__PURE__ */ jsxs28("label", { children: [
12017
+ /* @__PURE__ */ jsxs29("label", { children: [
11912
12018
  "Reviewer phone",
11913
- /* @__PURE__ */ jsx30("input", { name: "reviewerPhone", required: true, defaultValue: item.reviewerPhone ?? "" })
12019
+ /* @__PURE__ */ jsx31("input", { name: "reviewerPhone", required: true, defaultValue: item.reviewerPhone ?? "" })
11914
12020
  ] })
11915
12021
  ] }) : null,
11916
- outcome !== "denied" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11917
- /* @__PURE__ */ jsxs28("label", { children: [
12022
+ outcome !== "denied" ? /* @__PURE__ */ jsxs29(Fragment18, { children: [
12023
+ /* @__PURE__ */ jsxs29("label", { children: [
11918
12024
  "Authorization number",
11919
- /* @__PURE__ */ jsx30("input", { name: "authorizationNumber", required: true, defaultValue: item.authorizationNumber ?? "" })
12025
+ /* @__PURE__ */ jsx31("input", { name: "authorizationNumber", required: true, defaultValue: item.authorizationNumber ?? "" })
11920
12026
  ] }),
11921
- /* @__PURE__ */ jsxs28("label", { children: [
12027
+ /* @__PURE__ */ jsxs29("label", { children: [
11922
12028
  "Authorized procedure code",
11923
- /* @__PURE__ */ jsx30("input", { name: "authorizedProcedureCode", defaultValue: item.authorizedProcedureCode ?? "" })
12029
+ /* @__PURE__ */ jsx31("input", { name: "authorizedProcedureCode", defaultValue: item.authorizedProcedureCode ?? "" })
11924
12030
  ] }),
11925
- /* @__PURE__ */ jsxs28("label", { children: [
12031
+ /* @__PURE__ */ jsxs29("label", { children: [
11926
12032
  "Authorized quantity",
11927
- /* @__PURE__ */ jsx30("input", { name: "authorizedQuantity", type: "number", min: "0.001", step: "any", defaultValue: item.authorizedQuantity ?? "" })
12033
+ /* @__PURE__ */ jsx31("input", { name: "authorizedQuantity", type: "number", min: "0.001", step: "any", defaultValue: item.authorizedQuantity ?? "" })
11928
12034
  ] }),
11929
- /* @__PURE__ */ jsxs28("label", { children: [
12035
+ /* @__PURE__ */ jsxs29("label", { children: [
11930
12036
  "Authorized units",
11931
- /* @__PURE__ */ jsx30("input", { name: "authorizedUnits", type: "number", min: "1", defaultValue: item.authorizedUnits ?? "" })
12037
+ /* @__PURE__ */ jsx31("input", { name: "authorizedUnits", type: "number", min: "1", defaultValue: item.authorizedUnits ?? "" })
11932
12038
  ] }),
11933
- /* @__PURE__ */ jsxs28("label", { children: [
12039
+ /* @__PURE__ */ jsxs29("label", { children: [
11934
12040
  "Effective from",
11935
- /* @__PURE__ */ jsx30("input", { name: "effectiveFrom", type: "date", defaultValue: item.effectiveFrom?.slice(0, 10) ?? "" })
12041
+ /* @__PURE__ */ jsx31("input", { name: "effectiveFrom", type: "date", defaultValue: item.effectiveFrom?.slice(0, 10) ?? "" })
11936
12042
  ] }),
11937
- /* @__PURE__ */ jsxs28("label", { children: [
12043
+ /* @__PURE__ */ jsxs29("label", { children: [
11938
12044
  "Effective through",
11939
- /* @__PURE__ */ jsx30("input", { name: "effectiveTo", type: "date", defaultValue: item.effectiveTo?.slice(0, 10) ?? "" })
12045
+ /* @__PURE__ */ jsx31("input", { name: "effectiveTo", type: "date", defaultValue: item.effectiveTo?.slice(0, 10) ?? "" })
11940
12046
  ] })
11941
12047
  ] }) : null
11942
12048
  ] }),
11943
- /* @__PURE__ */ jsx30("button", { type: "submit", children: "Save decision correction" })
12049
+ /* @__PURE__ */ jsx31("button", { type: "submit", children: "Save decision correction" })
11944
12050
  ] }) });
11945
12051
  }
11946
12052
  function TreatmentClosureForm({ item, disabled, onError, onSave }) {
11947
12053
  const closed = Boolean(item.decisionClosure?.closed);
11948
12054
  const title = closed ? "Reopen treatment follow-up" : "Decision no longer required";
11949
- return /* @__PURE__ */ jsxs28("details", { children: [
11950
- /* @__PURE__ */ jsx30("summary", { children: title }),
11951
- /* @__PURE__ */ jsx30("p", { children: closed ? "Resume waiting for a decision on this treatment. Its original review deadline still applies." : "Close follow-up for this treatment without recording an approval or denial. Other treatments remain active. This does not withdraw the request with the claims administrator." }),
11952
- /* @__PURE__ */ jsx30("form", { onSubmit: (event) => {
12055
+ return /* @__PURE__ */ jsxs29("details", { children: [
12056
+ /* @__PURE__ */ jsx31("summary", { children: title }),
12057
+ /* @__PURE__ */ jsx31("p", { children: closed ? "Resume waiting for a decision on this treatment. Its original review deadline still applies." : "Close follow-up for this treatment without recording an approval or denial. Other treatments remain active. This does not withdraw the request with the claims administrator." }),
12058
+ /* @__PURE__ */ jsx31("form", { onSubmit: (event) => {
11953
12059
  event.preventDefault();
11954
12060
  if (disabled) return;
11955
12061
  try {
@@ -11958,112 +12064,112 @@ function TreatmentClosureForm({ item, disabled, onError, onSave }) {
11958
12064
  } catch (reason) {
11959
12065
  onError(reason instanceof Error ? reason.message : "Enter a reason.");
11960
12066
  }
11961
- }, children: /* @__PURE__ */ jsxs28("fieldset", { disabled, children: [
11962
- /* @__PURE__ */ jsx30("legend", { children: closed ? "Reopen this treatment" : "Close this treatment" }),
11963
- /* @__PURE__ */ jsxs28("label", { children: [
12067
+ }, children: /* @__PURE__ */ jsxs29("fieldset", { disabled, children: [
12068
+ /* @__PURE__ */ jsx31("legend", { children: closed ? "Reopen this treatment" : "Close this treatment" }),
12069
+ /* @__PURE__ */ jsxs29("label", { children: [
11964
12070
  closed ? "Reason for reopening" : "Reason a decision is no longer required",
11965
- /* @__PURE__ */ jsx30("textarea", { name: "closureReason", required: true, maxLength: 2e3 })
12071
+ /* @__PURE__ */ jsx31("textarea", { name: "closureReason", required: true, maxLength: 2e3 })
11966
12072
  ] }),
11967
- /* @__PURE__ */ jsx30("div", { className: "mbtd-actions", children: /* @__PURE__ */ jsx30("button", { type: "submit", children: closed ? "Reopen treatment" : "Close treatment" }) })
12073
+ /* @__PURE__ */ jsx31("div", { className: "mbtd-actions", children: /* @__PURE__ */ jsx31("button", { type: "submit", children: closed ? "Reopen treatment" : "Close treatment" }) })
11968
12074
  ] }) })
11969
12075
  ] });
11970
12076
  }
11971
12077
 
11972
12078
  // src/rfa-request-summary.tsx
11973
- import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
12079
+ import { jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
11974
12080
  var readable = (value) => value.replaceAll("_", " ");
11975
12081
  var calendarDate = (value) => value?.match(/^\d{4}-\d{2}-\d{2}/)?.[0] ?? value;
11976
12082
  function Details({ entries }) {
11977
- return /* @__PURE__ */ jsx31("dl", { className: "mbrfa-request-details", children: entries.filter(([, value]) => value !== null && value !== void 0 && value !== "").map(([name, value]) => /* @__PURE__ */ jsxs29("div", { children: [
11978
- /* @__PURE__ */ jsx31("dt", { children: name }),
11979
- /* @__PURE__ */ jsx31("dd", { children: value })
12083
+ return /* @__PURE__ */ jsx32("dl", { className: "mbrfa-request-details", children: entries.filter(([, value]) => value !== null && value !== void 0 && value !== "").map(([name, value]) => /* @__PURE__ */ jsxs30("div", { children: [
12084
+ /* @__PURE__ */ jsx32("dt", { children: name }),
12085
+ /* @__PURE__ */ jsx32("dd", { children: value })
11980
12086
  ] }, name)) });
11981
12087
  }
11982
12088
  function Contact({ title, contact }) {
11983
12089
  const entries = [["Name", contact?.name], ["Contact", contact?.contactName], ["Address", contact?.address], ["City", contact?.city], ["State", contact?.state], ["ZIP", contact?.zip], ["Phone", contact?.phone], ["Fax", contact?.fax], ["Email", contact?.email]];
11984
- return /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
11985
- /* @__PURE__ */ jsx31("h3", { children: title }),
11986
- /* @__PURE__ */ jsx31("div", { className: "mbrfa-info-body", children: entries.some(([, value]) => value) ? /* @__PURE__ */ jsx31(Details, { entries }) : /* @__PURE__ */ jsx31("p", { children: "Not recorded." }) })
12090
+ return /* @__PURE__ */ jsxs30("section", { className: "mbrfa-info-card", children: [
12091
+ /* @__PURE__ */ jsx32("h3", { children: title }),
12092
+ /* @__PURE__ */ jsx32("div", { className: "mbrfa-info-body", children: entries.some(([, value]) => value) ? /* @__PURE__ */ jsx32(Details, { entries }) : /* @__PURE__ */ jsx32("p", { children: "Not recorded." }) })
11987
12093
  ] });
11988
12094
  }
11989
12095
  function RfaRequestSummary({ rfa, onViewClaimsAdministrator, getPatientHref, getClaimHref, getProviderHref, hideTreatments = false, collapseContacts = false }) {
11990
- const contacts2 = /* @__PURE__ */ jsxs29("div", { className: "mbtd-grid", children: [
11991
- /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
11992
- /* @__PURE__ */ jsx31("h3", { children: "Patient and injury" }),
11993
- /* @__PURE__ */ jsx31("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx31(Details, { entries: [["Patient", /* @__PURE__ */ jsx31(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName })], ["Claim number", /* @__PURE__ */ jsx31(RfaLink, { href: getClaimHref?.(rfa), children: rfa.claimNumber || "Not recorded" })], ["Injury", rfa.injuryDescription ? /* @__PURE__ */ jsx31(RfaLink, { href: getClaimHref?.(rfa), children: rfa.injuryDescription }) : null], ["Date of injury", calendarDate(rfa.dateOfInjury) || "Not recorded"]] }) })
12096
+ const contacts2 = /* @__PURE__ */ jsxs30("div", { className: "mbtd-grid", children: [
12097
+ /* @__PURE__ */ jsxs30("section", { className: "mbrfa-info-card", children: [
12098
+ /* @__PURE__ */ jsx32("h3", { children: "Patient and injury" }),
12099
+ /* @__PURE__ */ jsx32("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx32(Details, { entries: [["Patient", /* @__PURE__ */ jsx32(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName })], ["Claim number", /* @__PURE__ */ jsx32(RfaLink, { href: getClaimHref?.(rfa), children: rfa.claimNumber || "Not recorded" })], ["Injury", rfa.injuryDescription ? /* @__PURE__ */ jsx32(RfaLink, { href: getClaimHref?.(rfa), children: rfa.injuryDescription }) : null], ["Date of injury", calendarDate(rfa.dateOfInjury) || "Not recorded"]] }) })
11994
12100
  ] }),
11995
- /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
11996
- /* @__PURE__ */ jsx31("h3", { children: "Requesting physician" }),
11997
- /* @__PURE__ */ jsx31("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx31(Details, { entries: [["Name", /* @__PURE__ */ jsx31(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName })], ["NPI", rfa.providerNpi], ["Phone", rfa.providerPhone], ["Fax", rfa.providerFax]] }) })
12101
+ /* @__PURE__ */ jsxs30("section", { className: "mbrfa-info-card", children: [
12102
+ /* @__PURE__ */ jsx32("h3", { children: "Requesting physician" }),
12103
+ /* @__PURE__ */ jsx32("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx32(Details, { entries: [["Name", /* @__PURE__ */ jsx32(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName })], ["NPI", rfa.providerNpi], ["Phone", rfa.providerPhone], ["Fax", rfa.providerFax]] }) })
11998
12104
  ] }),
11999
- /* @__PURE__ */ jsx31(Contact, { title: "Requesting practice", contact: rfa.requestingPractice }),
12000
- /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
12001
- /* @__PURE__ */ jsx31("h3", { children: "Claims administrator" }),
12002
- /* @__PURE__ */ jsx31("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx31(Details, { entries: [["Name", /* @__PURE__ */ jsx31(RfaLink, { onSelect: onViewClaimsAdministrator, children: rfa.claimsAdminName || rfa.authorizationContact?.name || "Not recorded" })], ["Contact", rfa.authorizationContact?.contactName], ["Phone", rfa.authorizationContact?.phone], ["Fax", rfa.authorizationContact?.fax], ["Email", rfa.authorizationContact?.email], ["Address", [rfa.authorizationContact?.address, rfa.authorizationContact?.city, rfa.authorizationContact?.state, rfa.authorizationContact?.zip].filter(Boolean).join(", ")]] }) })
12105
+ /* @__PURE__ */ jsx32(Contact, { title: "Requesting practice", contact: rfa.requestingPractice }),
12106
+ /* @__PURE__ */ jsxs30("section", { className: "mbrfa-info-card", children: [
12107
+ /* @__PURE__ */ jsx32("h3", { children: "Claims administrator" }),
12108
+ /* @__PURE__ */ jsx32("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx32(Details, { entries: [["Name", /* @__PURE__ */ jsx32(RfaLink, { onSelect: onViewClaimsAdministrator, children: rfa.claimsAdminName || rfa.authorizationContact?.name || "Not recorded" })], ["Contact", rfa.authorizationContact?.contactName], ["Phone", rfa.authorizationContact?.phone], ["Fax", rfa.authorizationContact?.fax], ["Email", rfa.authorizationContact?.email], ["Address", [rfa.authorizationContact?.address, rfa.authorizationContact?.city, rfa.authorizationContact?.state, rfa.authorizationContact?.zip].filter(Boolean).join(", ")]] }) })
12003
12109
  ] })
12004
12110
  ] });
12005
- return /* @__PURE__ */ jsxs29("section", { className: "mbrfa-stack mbrfa-request", "aria-label": "Saved request details", children: [
12006
- /* @__PURE__ */ jsx31("style", { children: `.mbrfa-request-details{display:grid;gap:9px;margin:0}.mbrfa-request-details>div{min-width:0}.mbrfa-request-details dt{font-size:12px;color:var(--mb-muted)}.mbrfa-request-details dd{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}.mbrfa-request h3{font-size:16px;margin:0}.mbrfa-request-treatments{display:grid;gap:14px}.mbrfa-request-treatments article{border-top:1px solid var(--mb-border);padding-top:12px}.mbrfa-request-treatments article:first-child{border-top:0;padding-top:0}.mbrfa-request-treatments h4{margin:0 0 10px;overflow-wrap:anywhere}.mbrfa-request-treatments dl{grid-template-columns:repeat(2,minmax(0,1fr))}@media(max-width:520px){.mbrfa-request-treatments dl{grid-template-columns:minmax(0,1fr)}}` }),
12111
+ return /* @__PURE__ */ jsxs30("section", { className: "mbrfa-stack mbrfa-request", "aria-label": "Saved request details", children: [
12112
+ /* @__PURE__ */ jsx32("style", { children: `.mbrfa-request-details{display:grid;gap:9px;margin:0}.mbrfa-request-details>div{min-width:0}.mbrfa-request-details dt{font-size:12px;color:var(--mb-muted)}.mbrfa-request-details dd{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}.mbrfa-request h3{font-size:16px;margin:0}.mbrfa-request-treatments{display:grid;gap:14px}.mbrfa-request-treatments article{border-top:1px solid var(--mb-border);padding-top:12px}.mbrfa-request-treatments article:first-child{border-top:0;padding-top:0}.mbrfa-request-treatments h4{margin:0 0 10px;overflow-wrap:anywhere}.mbrfa-request-treatments dl{grid-template-columns:repeat(2,minmax(0,1fr))}@media(max-width:520px){.mbrfa-request-treatments dl{grid-template-columns:minmax(0,1fr)}}` }),
12007
12113
  !collapseContacts ? contacts2 : null,
12008
- /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
12009
- /* @__PURE__ */ jsx31("h3", { children: "Request information" }),
12010
- /* @__PURE__ */ jsx31("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx31(Details, { entries: [["Request", rfa.requestType ? readable(rfa.requestType) : "Not recorded"], ["Review type", readable(rfa.reviewType)], ["Expedited review", rfa.expedited ? "Yes" : "No"], ["Written confirmation of prior oral request", rfa.writtenConfirmation || rfa.requestType === "oral_authorization_confirmation" ? "Yes" : "No"], ["Place of service", rfa.placeOfServiceCode], ["Clinical rationale", rfa.rationale], ["Change in material facts", rfa.materialChange]] }) })
12114
+ /* @__PURE__ */ jsxs30("section", { className: "mbrfa-info-card", children: [
12115
+ /* @__PURE__ */ jsx32("h3", { children: "Request information" }),
12116
+ /* @__PURE__ */ jsx32("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx32(Details, { entries: [["Request", rfa.requestType ? readable(rfa.requestType) : "Not recorded"], ["Review type", readable(rfa.reviewType)], ["Expedited review", rfa.expedited ? "Yes" : "No"], ["Written confirmation of prior oral request", rfa.writtenConfirmation || rfa.requestType === "oral_authorization_confirmation" ? "Yes" : "No"], ["Place of service", rfa.placeOfServiceCode], ["Clinical rationale", rfa.rationale], ["Change in material facts", rfa.materialChange]] }) })
12011
12117
  ] }),
12012
- collapseContacts ? /* @__PURE__ */ jsxs29("details", { className: "mbrfa-detail-card", children: [
12013
- /* @__PURE__ */ jsx31("summary", { children: "Patient, physician & claim details" }),
12118
+ collapseContacts ? /* @__PURE__ */ jsxs30("details", { className: "mbrfa-detail-card", children: [
12119
+ /* @__PURE__ */ jsx32("summary", { children: "Patient, physician & claim details" }),
12014
12120
  contacts2
12015
12121
  ] }) : null,
12016
- !hideTreatments ? /* @__PURE__ */ jsxs29("fieldset", { children: [
12017
- /* @__PURE__ */ jsx31("legend", { children: "Requested services" }),
12018
- /* @__PURE__ */ jsx31("div", { className: "mbrfa-request-treatments", children: rfa.items.map((item, index) => /* @__PURE__ */ jsxs29("article", { children: [
12019
- /* @__PURE__ */ jsxs29("h4", { children: [
12122
+ !hideTreatments ? /* @__PURE__ */ jsxs30("fieldset", { children: [
12123
+ /* @__PURE__ */ jsx32("legend", { children: "Requested services" }),
12124
+ /* @__PURE__ */ jsx32("div", { className: "mbrfa-request-treatments", children: rfa.items.map((item, index) => /* @__PURE__ */ jsxs30("article", { children: [
12125
+ /* @__PURE__ */ jsxs30("h4", { children: [
12020
12126
  index + 1,
12021
12127
  ". ",
12022
12128
  item.serviceDescription
12023
12129
  ] }),
12024
- /* @__PURE__ */ jsx31(Details, { entries: [["Diagnosis", item.diagnosisCode], ["Diagnosis description", item.diagnosisDescription], ["CPT / HCPCS", item.procedureCode || "Not specified"], ["Quantity", item.quantity], ["Units", item.units], ["Frequency", item.frequency], ["Duration", item.duration], ["Requested from", calendarDate(item.requestedFrom)], ["Requested through", calendarDate(item.requestedTo)]] })
12130
+ /* @__PURE__ */ jsx32(Details, { entries: [["Diagnosis", item.diagnosisCode], ["Diagnosis description", item.diagnosisDescription], ["CPT / HCPCS", item.procedureCode || "Not specified"], ["Quantity", item.quantity], ["Units", item.units], ["Frequency", item.frequency], ["Duration", item.duration], ["Requested from", calendarDate(item.requestedFrom)], ["Requested through", calendarDate(item.requestedTo)]] })
12025
12131
  ] }, item.id)) }),
12026
- rfa.items.length === 0 ? /* @__PURE__ */ jsx31("p", { children: "No services recorded." }) : null
12132
+ rfa.items.length === 0 ? /* @__PURE__ */ jsx32("p", { children: "No services recorded." }) : null
12027
12133
  ] }) : null
12028
12134
  ] });
12029
12135
  }
12030
12136
 
12031
12137
  // src/rfa-packets.tsx
12032
- import { useEffect as useEffect16, useMemo as useMemo9, useRef as useRef15, useState as useState19 } from "react";
12138
+ import { useEffect as useEffect17, useMemo as useMemo9, useRef as useRef15, useState as useState20 } from "react";
12033
12139
  import { createRfaPacketsClient } from "@mindbill/browser";
12034
- import { Fragment as Fragment19, jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
12140
+ import { Fragment as Fragment19, jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
12035
12141
  function RfaPacketsPanel({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride, ...props }) {
12036
12142
  const options = useMemo9(() => ({ ...sessionEndpoint ? { sessionEndpoint } : {}, ...getSession ? { getSession } : {}, ...apiBaseUrl ? { apiBaseUrl } : {}, ...fetchOverride ? { fetch: fetchOverride } : {} }), [sessionEndpoint, getSession, apiBaseUrl, fetchOverride]);
12037
12143
  const identity = useMemo9(() => crypto.randomUUID(), [options]);
12038
- return /* @__PURE__ */ jsx32(PacketsContent, { options, ...props }, `${identity}:${props.rfa.id}:${props.rfa.contentRevision}:${props.rfa.status}:${props.environment}:${props.permissions?.join(",")}`);
12144
+ return /* @__PURE__ */ jsx33(PacketsContent, { options, ...props }, `${identity}:${props.rfa.id}:${props.rfa.contentRevision}:${props.rfa.status}:${props.environment}:${props.permissions?.join(",")}`);
12039
12145
  }
12040
12146
  function PacketsContent({ rfa, options, permissions = [], environment = "sandbox", disabled = false, onForwarded }) {
12041
12147
  const client = useMemo9(() => createRfaPacketsClient(options), [options]);
12042
- const [history, setHistory] = useState19(null);
12043
- const [selected, setSelected] = useState19("");
12044
- const [prepared, setPrepared] = useState19(null);
12045
- const [channel, setChannel] = useState19("fax");
12046
- const [recipient, setRecipient] = useState19("");
12047
- const [reviewed, setReviewed] = useState19(false);
12048
- const [confirmed, setConfirmed] = useState19(false);
12049
- const [loading, setLoading] = useState19(true);
12050
- const [busy, setBusy] = useState19(false);
12051
- const [error, setError] = useState19("");
12052
- const [notice, setNotice] = useState19("");
12053
- const [reload, setReload] = useState19(0);
12148
+ const [history, setHistory] = useState20(null);
12149
+ const [selected, setSelected] = useState20("");
12150
+ const [prepared, setPrepared] = useState20(null);
12151
+ const [channel, setChannel] = useState20("fax");
12152
+ const [recipient, setRecipient] = useState20("");
12153
+ const [reviewed, setReviewed] = useState20(false);
12154
+ const [confirmed, setConfirmed] = useState20(false);
12155
+ const [loading, setLoading] = useState20(true);
12156
+ const [busy, setBusy] = useState20(false);
12157
+ const [error, setError] = useState20("");
12158
+ const [notice, setNotice] = useState20("");
12159
+ const [reload, setReload] = useState20(0);
12054
12160
  const pending = useRef15(false);
12055
12161
  const keys = useRef15(/* @__PURE__ */ new Map());
12056
12162
  const completed = useRef15(/* @__PURE__ */ new Set());
12057
12163
  const alive = useRef15(true);
12058
12164
  const currentSelection = useRef15(selected);
12059
12165
  currentSelection.current = selected;
12060
- useEffect16(() => {
12166
+ useEffect17(() => {
12061
12167
  alive.current = true;
12062
12168
  return () => {
12063
12169
  alive.current = false;
12064
12170
  };
12065
12171
  }, []);
12066
- useEffect16(() => {
12172
+ useEffect17(() => {
12067
12173
  let active = true;
12068
12174
  setLoading(true);
12069
12175
  setError("");
@@ -12139,23 +12245,23 @@ function PacketsContent({ rfa, options, permissions = [], environment = "sandbox
12139
12245
  if (alive.current) setBusy(false);
12140
12246
  }
12141
12247
  };
12142
- return /* @__PURE__ */ jsxs30("section", { "aria-label": "Saved RFA packets", children: [
12143
- /* @__PURE__ */ jsx32("h3", { children: "Saved packets" }),
12144
- /* @__PURE__ */ jsx32("p", { children: "Open the exact PDF retained for a download or submission. Forwarding preserves the original request and review deadline." }),
12145
- error ? /* @__PURE__ */ jsx32("p", { role: "alert", children: error }) : null,
12146
- notice ? /* @__PURE__ */ jsx32("p", { role: "status", children: notice }) : null,
12147
- loading ? /* @__PURE__ */ jsx32("p", { role: "status", children: "Loading saved packets\u2026" }) : null,
12148
- !loading && !history ? /* @__PURE__ */ jsx32("button", { type: "button", onClick: () => setReload((value) => value + 1), children: "Retry loading packets" }) : null,
12149
- history?.packets.length === 0 ? /* @__PURE__ */ jsx32("p", { children: "No saved packets yet." }) : history ? /* @__PURE__ */ jsxs30(Fragment19, { children: [
12150
- /* @__PURE__ */ jsxs30("label", { children: [
12248
+ return /* @__PURE__ */ jsxs31("section", { "aria-label": "Saved RFA packets", children: [
12249
+ /* @__PURE__ */ jsx33("h3", { children: "Saved packets" }),
12250
+ /* @__PURE__ */ jsx33("p", { children: "Open the exact PDF retained for a download or submission. Forwarding preserves the original request and review deadline." }),
12251
+ error ? /* @__PURE__ */ jsx33("p", { role: "alert", children: error }) : null,
12252
+ notice ? /* @__PURE__ */ jsx33("p", { role: "status", children: notice }) : null,
12253
+ loading ? /* @__PURE__ */ jsx33("p", { role: "status", children: "Loading saved packets\u2026" }) : null,
12254
+ !loading && !history ? /* @__PURE__ */ jsx33("button", { type: "button", onClick: () => setReload((value) => value + 1), children: "Retry loading packets" }) : null,
12255
+ history?.packets.length === 0 ? /* @__PURE__ */ jsx33("p", { children: "No saved packets yet." }) : history ? /* @__PURE__ */ jsxs31(Fragment19, { children: [
12256
+ /* @__PURE__ */ jsxs31("label", { children: [
12151
12257
  "Saved packet",
12152
- /* @__PURE__ */ jsxs30("select", { disabled: locked, value: selected, onChange: (event) => {
12258
+ /* @__PURE__ */ jsxs31("select", { disabled: locked, value: selected, onChange: (event) => {
12153
12259
  setSelected(event.target.value);
12154
12260
  setPrepared(null);
12155
12261
  resetReview();
12156
12262
  }, children: [
12157
- /* @__PURE__ */ jsx32("option", { value: "", children: "Choose a saved packet" }),
12158
- history.packets.map((value) => /* @__PURE__ */ jsxs30("option", { value: value.id, children: [
12263
+ /* @__PURE__ */ jsx33("option", { value: "", children: "Choose a saved packet" }),
12264
+ history.packets.map((value) => /* @__PURE__ */ jsxs31("option", { value: value.id, children: [
12159
12265
  value.source === "submission" ? "Submission" : "Download",
12160
12266
  " \xB7 revision ",
12161
12267
  value.contentRevision,
@@ -12164,68 +12270,68 @@ function PacketsContent({ rfa, options, permissions = [], environment = "sandbox
12164
12270
  ] }, value.id))
12165
12271
  ] })
12166
12272
  ] }),
12167
- /* @__PURE__ */ jsx32("button", { type: "button", disabled: locked || !packet, onClick: () => void view(), children: "View saved PDF" }),
12168
- blob ? /* @__PURE__ */ jsx32(RfaPdfReview, { blob, title: "Saved RFA packet" }) : null,
12169
- !canForward ? /* @__PURE__ */ jsx32("p", { children: environment !== "live" ? "Sandbox: saved PDFs are available for review. External forwarding is disabled." : "Forwarding requires permission from your organization." }) : selected && !eligible ? /* @__PURE__ */ jsx32("p", { children: "This packet is not eligible for forwarding. Submission packets require a successful original dispatch." }) : /* @__PURE__ */ jsxs30("fieldset", { disabled: locked, children: [
12170
- /* @__PURE__ */ jsx32("legend", { children: "Forward saved packet" }),
12171
- /* @__PURE__ */ jsx32("p", { children: "The saved packet may contain the original recipient\u2019s cover sheet. Review all pages before forwarding." }),
12172
- /* @__PURE__ */ jsxs30("label", { children: [
12273
+ /* @__PURE__ */ jsx33("button", { type: "button", disabled: locked || !packet, onClick: () => void view(), children: "View saved PDF" }),
12274
+ blob ? /* @__PURE__ */ jsx33(RfaPdfReview, { blob, title: "Saved RFA packet" }) : null,
12275
+ !canForward ? /* @__PURE__ */ jsx33("p", { children: environment !== "live" ? "Sandbox: saved PDFs are available for review. External forwarding is disabled." : "Forwarding requires permission from your organization." }) : selected && !eligible ? /* @__PURE__ */ jsx33("p", { children: "This packet is not eligible for forwarding. Submission packets require a successful original dispatch." }) : /* @__PURE__ */ jsxs31("fieldset", { disabled: locked, children: [
12276
+ /* @__PURE__ */ jsx33("legend", { children: "Forward saved packet" }),
12277
+ /* @__PURE__ */ jsx33("p", { children: "The saved packet may contain the original recipient\u2019s cover sheet. Review all pages before forwarding." }),
12278
+ /* @__PURE__ */ jsxs31("label", { children: [
12173
12279
  "Forward by",
12174
- /* @__PURE__ */ jsxs30("select", { value: channel, onChange: (event) => {
12280
+ /* @__PURE__ */ jsxs31("select", { value: channel, onChange: (event) => {
12175
12281
  setChannel(event.target.value);
12176
12282
  resetReview();
12177
12283
  }, children: [
12178
- /* @__PURE__ */ jsx32("option", { value: "fax", children: "Fax" }),
12179
- /* @__PURE__ */ jsx32("option", { value: "email", children: "Email" })
12284
+ /* @__PURE__ */ jsx33("option", { value: "fax", children: "Fax" }),
12285
+ /* @__PURE__ */ jsx33("option", { value: "email", children: "Email" })
12180
12286
  ] })
12181
12287
  ] }),
12182
- channel === "email" ? /* @__PURE__ */ jsx32("p", { children: "Email forwarding requires email delivery to be enabled for your organization. The server will reject requests when it is unavailable." }) : null,
12183
- /* @__PURE__ */ jsxs30("label", { children: [
12288
+ channel === "email" ? /* @__PURE__ */ jsx33("p", { children: "Email forwarding requires email delivery to be enabled for your organization. The server will reject requests when it is unavailable." }) : null,
12289
+ /* @__PURE__ */ jsxs31("label", { children: [
12184
12290
  channel === "fax" ? "Recipient fax (with country code)" : "Recipient email",
12185
- /* @__PURE__ */ jsx32("input", { type: channel === "fax" ? "tel" : "email", value: recipient, onChange: (event) => {
12291
+ /* @__PURE__ */ jsx33("input", { type: channel === "fax" ? "tel" : "email", value: recipient, onChange: (event) => {
12186
12292
  setRecipient(event.target.value);
12187
12293
  resetReview();
12188
12294
  } })
12189
12295
  ] }),
12190
- /* @__PURE__ */ jsxs30("label", { className: "mbrfa-check", children: [
12191
- /* @__PURE__ */ jsx32("input", { type: "checkbox", disabled: !blob || !eligible, checked: reviewed, onChange: (event) => {
12296
+ /* @__PURE__ */ jsxs31("label", { className: "mbrfa-check", children: [
12297
+ /* @__PURE__ */ jsx33("input", { type: "checkbox", disabled: !blob || !eligible, checked: reviewed, onChange: (event) => {
12192
12298
  setReviewed(event.target.checked);
12193
12299
  setConfirmed(false);
12194
12300
  } }),
12195
12301
  "I reviewed this saved packet and its attachments."
12196
12302
  ] }),
12197
- /* @__PURE__ */ jsxs30("label", { className: "mbrfa-check", children: [
12198
- /* @__PURE__ */ jsx32("input", { type: "checkbox", disabled: !reviewed || !validRecipient || !eligible, checked: confirmed, onChange: (event) => setConfirmed(event.target.checked) }),
12303
+ /* @__PURE__ */ jsxs31("label", { className: "mbrfa-check", children: [
12304
+ /* @__PURE__ */ jsx33("input", { type: "checkbox", disabled: !reviewed || !validRecipient || !eligible, checked: confirmed, onChange: (event) => setConfirmed(event.target.checked) }),
12199
12305
  "I verified that ",
12200
12306
  destination || "this recipient",
12201
12307
  " is authorized to receive this patient\u2019s packet."
12202
12308
  ] }),
12203
- alreadyForwarded ? /* @__PURE__ */ jsx32("p", { children: "A forward to this recipient is already recorded or pending. Check delivery history." }) : null,
12204
- /* @__PURE__ */ jsx32("button", { type: "button", disabled: !canForward || !eligible || !blob || !reviewed || !confirmed || !validRecipient || alreadyForwarded, onClick: () => void forward(), children: busy ? "Working\u2026" : `Forward packet by ${channel}` })
12309
+ alreadyForwarded ? /* @__PURE__ */ jsx33("p", { children: "A forward to this recipient is already recorded or pending. Check delivery history." }) : null,
12310
+ /* @__PURE__ */ jsx33("button", { type: "button", disabled: !canForward || !eligible || !blob || !reviewed || !confirmed || !validRecipient || alreadyForwarded, onClick: () => void forward(), children: busy ? "Working\u2026" : `Forward packet by ${channel}` })
12205
12311
  ] })
12206
12312
  ] }) : null
12207
12313
  ] });
12208
12314
  }
12209
12315
 
12210
12316
  // src/rfa-draft-actions.tsx
12211
- import { useEffect as useEffect17, useMemo as useMemo10, useRef as useRef16, useState as useState20 } from "react";
12317
+ import { useEffect as useEffect18, useMemo as useMemo10, useRef as useRef16, useState as useState21 } from "react";
12212
12318
  import { createRfaDraftActionsClient } from "@mindbill/browser";
12213
- import { Fragment as Fragment20, jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
12319
+ import { Fragment as Fragment20, jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
12214
12320
  function RfaDraftActions({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride, ...props }) {
12215
12321
  const options = useMemo10(() => ({ ...sessionEndpoint ? { sessionEndpoint } : {}, ...getSession ? { getSession } : {}, ...apiBaseUrl ? { apiBaseUrl } : {}, ...fetchOverride ? { fetch: fetchOverride } : {} }), [sessionEndpoint, getSession, apiBaseUrl, fetchOverride]);
12216
12322
  const identity = useMemo10(() => crypto.randomUUID(), [options]);
12217
- return /* @__PURE__ */ jsx33(DraftActionsContent, { options, ...props }, `${identity}:${props.rfa.id}:${props.rfa.contentRevision}:${props.rfa.status}:${props.rfa.signedAt}:${props.rfa.submittedAt}`);
12323
+ return /* @__PURE__ */ jsx34(DraftActionsContent, { options, ...props }, `${identity}:${props.rfa.id}:${props.rfa.contentRevision}:${props.rfa.status}:${props.rfa.signedAt}:${props.rfa.submittedAt}`);
12218
12324
  }
12219
12325
  function DraftActionsContent({ rfa, options, permissions = [], disabled = false, onCopied, onCanceled }) {
12220
12326
  const client = useMemo10(() => createRfaDraftActionsClient(options), [options]);
12221
- const [confirming, setConfirming] = useState20(null);
12222
- const [busy, setBusy] = useState20(false);
12223
- const [error, setError] = useState20("");
12224
- const [completed, setCompleted] = useState20(null);
12327
+ const [confirming, setConfirming] = useState21(null);
12328
+ const [busy, setBusy] = useState21(false);
12329
+ const [error, setError] = useState21("");
12330
+ const [completed, setCompleted] = useState21(null);
12225
12331
  const pending = useRef16(false);
12226
12332
  const keys = useRef16({});
12227
12333
  const alive = useRef16(true);
12228
- useEffect17(() => {
12334
+ useEffect18(() => {
12229
12335
  alive.current = true;
12230
12336
  return () => {
12231
12337
  alive.current = false;
@@ -12254,112 +12360,112 @@ function DraftActionsContent({ rfa, options, permissions = [], disabled = false,
12254
12360
  if (alive.current) setBusy(false);
12255
12361
  }
12256
12362
  };
12257
- return /* @__PURE__ */ jsxs31("section", { "aria-label": "RFA draft actions", children: [
12258
- error ? /* @__PURE__ */ jsx33("p", { role: "alert", children: error }) : null,
12259
- completed ? /* @__PURE__ */ jsx33("p", { role: "status", children: completed === "copy" ? "A new unsigned draft was created." : "The draft was canceled. Its audit history is retained." }) : confirming && (confirming === "copy" ? canCopy : canCancel) ? /* @__PURE__ */ jsxs31("div", { className: "mbtd-note", children: [
12260
- confirming === "copy" ? /* @__PURE__ */ jsxs31(Fragment20, { children: [
12261
- /* @__PURE__ */ jsx33("p", { children: "Create a new draft with this patient, injury, physician, and requested treatments? Review the new draft and attach supporting documents before signing it." }),
12262
- /* @__PURE__ */ jsx33("p", { children: "Signatures, supporting documents, decisions, and delivery history remain on the original request." })
12263
- ] }) : /* @__PURE__ */ jsx33("p", { children: "Cancel this unsigned draft? It will no longer be available for submission. The request and its audit history will be retained." }),
12264
- /* @__PURE__ */ jsxs31("div", { className: "mbtd-actions", children: [
12265
- /* @__PURE__ */ jsx33("button", { type: "button", disabled: disabled || busy, onClick: () => {
12363
+ return /* @__PURE__ */ jsxs32("section", { "aria-label": "RFA draft actions", children: [
12364
+ error ? /* @__PURE__ */ jsx34("p", { role: "alert", children: error }) : null,
12365
+ completed ? /* @__PURE__ */ jsx34("p", { role: "status", children: completed === "copy" ? "A new unsigned draft was created." : "The draft was canceled. Its audit history is retained." }) : confirming && (confirming === "copy" ? canCopy : canCancel) ? /* @__PURE__ */ jsxs32("div", { className: "mbtd-note", children: [
12366
+ confirming === "copy" ? /* @__PURE__ */ jsxs32(Fragment20, { children: [
12367
+ /* @__PURE__ */ jsx34("p", { children: "Create a new draft with this patient, injury, physician, and requested treatments? Review the new draft and attach supporting documents before signing it." }),
12368
+ /* @__PURE__ */ jsx34("p", { children: "Signatures, supporting documents, decisions, and delivery history remain on the original request." })
12369
+ ] }) : /* @__PURE__ */ jsx34("p", { children: "Cancel this unsigned draft? It will no longer be available for submission. The request and its audit history will be retained." }),
12370
+ /* @__PURE__ */ jsxs32("div", { className: "mbtd-actions", children: [
12371
+ /* @__PURE__ */ jsx34("button", { type: "button", disabled: disabled || busy, onClick: () => {
12266
12372
  void mutate(confirming);
12267
12373
  }, children: busy ? "Saving\u2026" : confirming === "copy" ? "Create draft copy" : "Confirm cancellation" }),
12268
- /* @__PURE__ */ jsx33("button", { type: "button", disabled: busy, onClick: () => {
12374
+ /* @__PURE__ */ jsx34("button", { type: "button", disabled: busy, onClick: () => {
12269
12375
  setConfirming(null);
12270
12376
  setError("");
12271
12377
  }, children: "Keep current request" })
12272
12378
  ] })
12273
- ] }) : /* @__PURE__ */ jsxs31("div", { className: "mbtd-actions", children: [
12274
- canCopy ? /* @__PURE__ */ jsx33("button", { type: "button", disabled: disabled || busy, onClick: () => setConfirming("copy"), children: "Copy to new draft" }) : null,
12275
- canCancel ? /* @__PURE__ */ jsx33("button", { type: "button", disabled: disabled || busy, onClick: () => setConfirming("cancel"), children: "Cancel draft" }) : null
12379
+ ] }) : /* @__PURE__ */ jsxs32("div", { className: "mbtd-actions", children: [
12380
+ canCopy ? /* @__PURE__ */ jsx34("button", { type: "button", disabled: disabled || busy, onClick: () => setConfirming("copy"), children: "Copy to new draft" }) : null,
12381
+ canCancel ? /* @__PURE__ */ jsx34("button", { type: "button", disabled: disabled || busy, onClick: () => setConfirming("cancel"), children: "Cancel draft" }) : null
12276
12382
  ] })
12277
12383
  ] });
12278
12384
  }
12279
12385
 
12280
12386
  // src/rfa-list-view.tsx
12281
12387
  import { getRfaLifecycleStatus as getRfaLifecycleStatus3, RFA_LIFECYCLE_LABELS as RFA_LIFECYCLE_LABELS3 } from "@mindbill/browser";
12282
- import { jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
12388
+ import { jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
12283
12389
  var date6 = (value) => value ? new Date(value).toLocaleDateString() : "\u2014";
12284
12390
  var label2 = (value) => value.replaceAll("_", " ");
12285
12391
  function RfaListView({ records, view, onViewChange, sortBy, sortDirection, onSort, onSelect, lifecycleAvailable = true, hideViewSwitch = false, getRfaHref, getPatientHref, getClaimHref, getProviderHref }) {
12286
- const heading = (field, title) => /* @__PURE__ */ jsx34("th", { scope: "col", "aria-sort": sortBy === field ? sortDirection === "asc" ? "ascending" : "descending" : "none", children: /* @__PURE__ */ jsxs32("button", { type: "button", onClick: () => onSort(field), children: [
12392
+ const heading = (field, title) => /* @__PURE__ */ jsx35("th", { scope: "col", "aria-sort": sortBy === field ? sortDirection === "asc" ? "ascending" : "descending" : "none", children: /* @__PURE__ */ jsxs33("button", { type: "button", onClick: () => onSort(field), children: [
12287
12393
  title,
12288
12394
  sortBy === field ? sortDirection === "asc" ? " \u2191" : " \u2193" : " \u2195"
12289
12395
  ] }) });
12290
- return /* @__PURE__ */ jsxs32("div", { className: "mbrfa-list", children: [
12291
- /* @__PURE__ */ jsx34("style", { children: `.mbrfa-table-scroll{overflow-x:auto;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius)}.mbrfa-table{width:100%;border-collapse:collapse;text-align:left;font-size:13px}.mbrfa-table th,.mbrfa-table td{padding:12px;border-bottom:1px solid var(--mb-border);vertical-align:top;min-width:110px}.mbrfa-table th{background:var(--mb-soft)}.mbrfa-table td small{display:block;color:var(--mb-muted);margin-top:4px}.mbrfa-table tr:last-child td{border-bottom:0}.mbtd .mbrfa-table th button{white-space:nowrap;border:0;background:transparent;padding:0;min-height:28px;font-size:12px;font-weight:650;color:var(--mb-muted)}.mbrfa-table th{font-size:12px;font-weight:650;color:var(--mb-muted)}.mbrfa-table tbody tr:hover{background:var(--mb-soft)}.mbrfa-table td{overflow-wrap:anywhere}.mbrfa-table td:first-child button{color:var(--mb-accent);font-weight:600;background:transparent;border-color:var(--mb-border)}.mbtd .mbrfa-text-link{border:0;background:transparent;padding:0;min-height:0;color:var(--mb-accent);font-weight:600;text-decoration:none;text-align:left;line-height:1.5}.mbtd .mbrfa-text-link:hover{text-decoration:underline}.mbrfa-view button[aria-pressed=true]{background:var(--mb-soft);font-weight:600}` }),
12292
- !hideViewSwitch ? /* @__PURE__ */ jsxs32("div", { className: "mbrfa-list-mode", children: [
12293
- /* @__PURE__ */ jsxs32("label", { children: [
12396
+ return /* @__PURE__ */ jsxs33("div", { className: "mbrfa-list", children: [
12397
+ /* @__PURE__ */ jsx35("style", { children: `.mbrfa-table-scroll{overflow-x:auto;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius)}.mbrfa-table{width:100%;border-collapse:collapse;text-align:left;font-size:13px}.mbrfa-table th,.mbrfa-table td{padding:12px;border-bottom:1px solid var(--mb-border);vertical-align:top;min-width:110px}.mbrfa-table th{background:var(--mb-soft)}.mbrfa-table td small{display:block;color:var(--mb-muted);margin-top:4px}.mbrfa-table tr:last-child td{border-bottom:0}.mbtd .mbrfa-table th button{white-space:nowrap;border:0;background:transparent;padding:0;min-height:28px;font-size:12px;font-weight:650;color:var(--mb-muted)}.mbrfa-table th{font-size:12px;font-weight:650;color:var(--mb-muted)}.mbrfa-table tbody tr:hover{background:var(--mb-soft)}.mbrfa-table td{overflow-wrap:anywhere}.mbrfa-table td:first-child button{color:var(--mb-accent);font-weight:600;background:transparent;border-color:var(--mb-border)}.mbtd .mbrfa-text-link{border:0;background:transparent;padding:0;min-height:0;color:var(--mb-accent);font-weight:600;text-decoration:none;text-align:left;line-height:1.5}.mbtd .mbrfa-text-link:hover{text-decoration:underline}.mbrfa-view button[aria-pressed=true]{background:var(--mb-soft);font-weight:600}` }),
12398
+ !hideViewSwitch ? /* @__PURE__ */ jsxs33("div", { className: "mbrfa-list-mode", children: [
12399
+ /* @__PURE__ */ jsxs33("label", { children: [
12294
12400
  "Show",
12295
- /* @__PURE__ */ jsxs32("select", { value: view, onChange: (event) => onViewChange(event.target.value), children: [
12296
- /* @__PURE__ */ jsx34("option", { value: "rfas", children: "RFAs \u2014 one row per request" }),
12297
- /* @__PURE__ */ jsx34("option", { value: "treatments", children: "Treatments \u2014 one row per service" })
12401
+ /* @__PURE__ */ jsxs33("select", { value: view, onChange: (event) => onViewChange(event.target.value), children: [
12402
+ /* @__PURE__ */ jsx35("option", { value: "rfas", children: "RFAs \u2014 one row per request" }),
12403
+ /* @__PURE__ */ jsx35("option", { value: "treatments", children: "Treatments \u2014 one row per service" })
12298
12404
  ] })
12299
12405
  ] }),
12300
- /* @__PURE__ */ jsx34("p", { children: view === "rfas" ? "One RFA can request several treatments. Open a request to review its treatments and decisions." : "Each treatment belongs to an RFA and can receive its own decision. Page controls move between requests." })
12406
+ /* @__PURE__ */ jsx35("p", { children: view === "rfas" ? "One RFA can request several treatments. Open a request to review its treatments and decisions." : "Each treatment belongs to an RFA and can receive its own decision. Page controls move between requests." })
12301
12407
  ] }) : null,
12302
- !records.length ? /* @__PURE__ */ jsx34("p", { children: "No requests match this view." }) : /* @__PURE__ */ jsx34("div", { className: "mbrfa-table-scroll", tabIndex: 0, role: "region", "aria-label": view === "rfas" ? "RFA table" : "Requested treatments table", children: /* @__PURE__ */ jsxs32("table", { className: "mbrfa-table", children: [
12303
- /* @__PURE__ */ jsx34("thead", { children: /* @__PURE__ */ jsxs32("tr", { children: [
12304
- /* @__PURE__ */ jsx34("th", { scope: "col", children: view === "rfas" ? "Request" : "Request / treatment" }),
12408
+ !records.length ? /* @__PURE__ */ jsx35("p", { children: "No requests match this view." }) : /* @__PURE__ */ jsx35("div", { className: "mbrfa-table-scroll", tabIndex: 0, role: "region", "aria-label": view === "rfas" ? "RFA table" : "Requested treatments table", children: /* @__PURE__ */ jsxs33("table", { className: "mbrfa-table", children: [
12409
+ /* @__PURE__ */ jsx35("thead", { children: /* @__PURE__ */ jsxs33("tr", { children: [
12410
+ /* @__PURE__ */ jsx35("th", { scope: "col", children: view === "rfas" ? "Request" : "Request / treatment" }),
12305
12411
  heading("employeeName", "Patient"),
12306
12412
  heading("providerName", "Requesting physician"),
12307
- /* @__PURE__ */ jsx34("th", { scope: "col", children: view === "rfas" ? "Claims administrator" : "Service / diagnosis" }),
12413
+ /* @__PURE__ */ jsx35("th", { scope: "col", children: view === "rfas" ? "Claims administrator" : "Service / diagnosis" }),
12308
12414
  heading("submittedAt", "Sent"),
12309
- /* @__PURE__ */ jsx34("th", { scope: "col", children: "Decision due" }),
12310
- view === "rfas" ? heading(lifecycleAvailable ? "lifecycleStatus" : "status", lifecycleAvailable ? "Status" : "Clinical status") : /* @__PURE__ */ jsx34("th", { scope: "col", children: "Treatment decision" }),
12415
+ /* @__PURE__ */ jsx35("th", { scope: "col", children: "Decision due" }),
12416
+ view === "rfas" ? heading(lifecycleAvailable ? "lifecycleStatus" : "status", lifecycleAvailable ? "Status" : "Clinical status") : /* @__PURE__ */ jsx35("th", { scope: "col", children: "Treatment decision" }),
12311
12417
  heading("createdAt", "Created")
12312
12418
  ] }) }),
12313
- /* @__PURE__ */ jsx34("tbody", { children: records.flatMap((rfa) => view === "rfas" ? [/* @__PURE__ */ jsxs32("tr", { children: [
12314
- /* @__PURE__ */ jsxs32("td", { children: [
12315
- /* @__PURE__ */ jsx34(RfaLink, { href: getRfaHref?.(rfa.id), onSelect: () => onSelect(rfa.id), children: rfaTitle(rfa) }),
12316
- rfa.displayReference ? /* @__PURE__ */ jsx34("small", { children: rfa.displayReference }) : null
12419
+ /* @__PURE__ */ jsx35("tbody", { children: records.flatMap((rfa) => view === "rfas" ? [/* @__PURE__ */ jsxs33("tr", { children: [
12420
+ /* @__PURE__ */ jsxs33("td", { children: [
12421
+ /* @__PURE__ */ jsx35(RfaLink, { href: getRfaHref?.(rfa.id), onSelect: () => onSelect(rfa.id), children: rfaTitle(rfa) }),
12422
+ rfa.displayReference ? /* @__PURE__ */ jsx35("small", { children: rfa.displayReference }) : null
12317
12423
  ] }),
12318
- /* @__PURE__ */ jsxs32("td", { children: [
12319
- /* @__PURE__ */ jsx34(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }),
12320
- /* @__PURE__ */ jsx34("small", { children: /* @__PURE__ */ jsxs32(RfaLink, { href: getClaimHref?.(rfa), children: [
12424
+ /* @__PURE__ */ jsxs33("td", { children: [
12425
+ /* @__PURE__ */ jsx35(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }),
12426
+ /* @__PURE__ */ jsx35("small", { children: /* @__PURE__ */ jsxs33(RfaLink, { href: getClaimHref?.(rfa), children: [
12321
12427
  "Claim ",
12322
12428
  rfa.claimNumber || "not recorded"
12323
12429
  ] }) })
12324
12430
  ] }),
12325
- /* @__PURE__ */ jsx34("td", { children: /* @__PURE__ */ jsx34(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
12326
- /* @__PURE__ */ jsx34("td", { children: rfa.claimsAdminName || rfa.authorizationContact?.name || "Not recorded" }),
12327
- /* @__PURE__ */ jsx34("td", { children: date6(rfa.submittedAt) }),
12328
- /* @__PURE__ */ jsx34("td", { children: rfaDecisionDueText(rfa) }),
12329
- /* @__PURE__ */ jsx34("td", { children: RFA_LIFECYCLE_LABELS3[getRfaLifecycleStatus3(rfa)] }),
12330
- /* @__PURE__ */ jsx34("td", { children: date6(rfa.createdAt) })
12331
- ] }, rfa.id)] : rfa.items.map((item) => /* @__PURE__ */ jsxs32("tr", { children: [
12332
- /* @__PURE__ */ jsxs32("td", { children: [
12333
- /* @__PURE__ */ jsx34(RfaLink, { href: getRfaHref?.(rfa.id, { treatmentId: item.id }), onSelect: () => onSelect(rfa.id, item.id), children: item.serviceDescription }),
12334
- rfa.displayReference ? /* @__PURE__ */ jsx34("small", { children: rfa.displayReference }) : null
12431
+ /* @__PURE__ */ jsx35("td", { children: /* @__PURE__ */ jsx35(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
12432
+ /* @__PURE__ */ jsx35("td", { children: rfa.claimsAdminName || rfa.authorizationContact?.name || "Not recorded" }),
12433
+ /* @__PURE__ */ jsx35("td", { children: date6(rfa.submittedAt) }),
12434
+ /* @__PURE__ */ jsx35("td", { children: rfaDecisionDueText(rfa) }),
12435
+ /* @__PURE__ */ jsx35("td", { children: RFA_LIFECYCLE_LABELS3[getRfaLifecycleStatus3(rfa)] }),
12436
+ /* @__PURE__ */ jsx35("td", { children: date6(rfa.createdAt) })
12437
+ ] }, rfa.id)] : rfa.items.map((item) => /* @__PURE__ */ jsxs33("tr", { children: [
12438
+ /* @__PURE__ */ jsxs33("td", { children: [
12439
+ /* @__PURE__ */ jsx35(RfaLink, { href: getRfaHref?.(rfa.id, { treatmentId: item.id }), onSelect: () => onSelect(rfa.id, item.id), children: item.serviceDescription }),
12440
+ rfa.displayReference ? /* @__PURE__ */ jsx35("small", { children: rfa.displayReference }) : null
12335
12441
  ] }),
12336
- /* @__PURE__ */ jsxs32("td", { children: [
12337
- /* @__PURE__ */ jsx34(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }),
12338
- /* @__PURE__ */ jsx34("small", { children: /* @__PURE__ */ jsxs32(RfaLink, { href: getClaimHref?.(rfa), children: [
12442
+ /* @__PURE__ */ jsxs33("td", { children: [
12443
+ /* @__PURE__ */ jsx35(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }),
12444
+ /* @__PURE__ */ jsx35("small", { children: /* @__PURE__ */ jsxs33(RfaLink, { href: getClaimHref?.(rfa), children: [
12339
12445
  "Claim ",
12340
12446
  rfa.claimNumber || "not recorded"
12341
12447
  ] }) })
12342
12448
  ] }),
12343
- /* @__PURE__ */ jsx34("td", { children: /* @__PURE__ */ jsx34(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
12344
- /* @__PURE__ */ jsxs32("td", { children: [
12449
+ /* @__PURE__ */ jsx35("td", { children: /* @__PURE__ */ jsx35(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
12450
+ /* @__PURE__ */ jsxs33("td", { children: [
12345
12451
  item.serviceDescription,
12346
- /* @__PURE__ */ jsxs32("small", { children: [
12452
+ /* @__PURE__ */ jsxs33("small", { children: [
12347
12453
  item.procedureCode || "No procedure code",
12348
12454
  " \xB7 ",
12349
12455
  item.diagnosisCode
12350
12456
  ] })
12351
12457
  ] }),
12352
- /* @__PURE__ */ jsx34("td", { children: date6(rfa.submittedAt) }),
12353
- /* @__PURE__ */ jsx34("td", { children: item.decisionClosure?.closed ? "\u2014" : rfaDecisionDueText(rfa) }),
12354
- /* @__PURE__ */ jsxs32("td", { children: [
12458
+ /* @__PURE__ */ jsx35("td", { children: date6(rfa.submittedAt) }),
12459
+ /* @__PURE__ */ jsx35("td", { children: item.decisionClosure?.closed ? "\u2014" : rfaDecisionDueText(rfa) }),
12460
+ /* @__PURE__ */ jsxs33("td", { children: [
12355
12461
  item.decisionClosure?.closed ? "Decision no longer required" : label2(item.outcome),
12356
- /* @__PURE__ */ jsx34("small", { children: date6(item.decidedAt) }),
12357
- item.authorizationNumber ? /* @__PURE__ */ jsxs32("small", { children: [
12462
+ /* @__PURE__ */ jsx35("small", { children: date6(item.decidedAt) }),
12463
+ item.authorizationNumber ? /* @__PURE__ */ jsxs33("small", { children: [
12358
12464
  "Authorization ",
12359
12465
  item.authorizationNumber
12360
12466
  ] }) : null
12361
12467
  ] }),
12362
- /* @__PURE__ */ jsx34("td", { children: date6(rfa.createdAt) })
12468
+ /* @__PURE__ */ jsx35("td", { children: date6(rfa.createdAt) })
12363
12469
  ] }, `${rfa.id}:${item.id}`))) })
12364
12470
  ] }) })
12365
12471
  ] });
@@ -12367,58 +12473,58 @@ function RfaListView({ records, view, onViewChange, sortBy, sortDirection, onSor
12367
12473
 
12368
12474
  // src/rfa-overview.tsx
12369
12475
  import { RFA_LIFECYCLE_LABELS as RFA_LIFECYCLE_LABELS4 } from "@mindbill/browser";
12370
- import { jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
12476
+ import { jsx as jsx36, jsxs as jsxs34 } from "react/jsx-runtime";
12371
12477
  var buckets = [{ id: "0_5", label: "0\u20135 days" }, { id: "6_14", label: "6\u201314 days" }, { id: "15_30", label: "15\u201330 days" }, { id: "31_plus", label: "31+ days" }];
12372
12478
  var groups = [{ title: "Needs attention", tone: "attention", states: ["incomplete", "failed"] }, { title: "Awaiting decision", tone: "waiting", states: ["sent", "received"] }, { title: "Finished", tone: "finished", states: ["closed", "canceled"] }];
12373
12479
  function RfaOverview({ summary, onSelect, combined = false }) {
12374
12480
  const aging = summary.aging;
12375
- const countButton = (count, title, status, bucket) => count ? /* @__PURE__ */ jsx35("button", { type: "button", className: "mbrfa-count", "aria-label": `${title}: ${count} requests`, onClick: () => onSelect(status, bucket), children: count.toLocaleString() }) : /* @__PURE__ */ jsx35("span", { className: "mbrfa-zero", children: "0" });
12376
- if (!summary.byLifecycleStatus) return /* @__PURE__ */ jsxs33("section", { className: "mbrfa-overview", "aria-label": "Clinical review overview", children: [
12377
- /* @__PURE__ */ jsx35("h3", { children: "Clinical review counts" }),
12378
- /* @__PURE__ */ jsx35("div", { className: "mbrfa-legacy-grid", children: Object.entries(summary.byStatus).map(([status, count]) => /* @__PURE__ */ jsxs33("button", { type: "button", onClick: () => onSelect(status), children: [
12379
- /* @__PURE__ */ jsx35("span", { children: status.replaceAll("_", " ") }),
12380
- /* @__PURE__ */ jsx35("strong", { children: count })
12481
+ const countButton = (count, title, status, bucket) => count ? /* @__PURE__ */ jsx36("button", { type: "button", className: "mbrfa-count", "aria-label": `${title}: ${count} requests`, onClick: () => onSelect(status, bucket), children: count.toLocaleString() }) : /* @__PURE__ */ jsx36("span", { className: "mbrfa-zero", children: "0" });
12482
+ if (!summary.byLifecycleStatus) return /* @__PURE__ */ jsxs34("section", { className: "mbrfa-overview", "aria-label": "Clinical review overview", children: [
12483
+ /* @__PURE__ */ jsx36("h3", { children: "Clinical review counts" }),
12484
+ /* @__PURE__ */ jsx36("div", { className: "mbrfa-legacy-grid", children: Object.entries(summary.byStatus).map(([status, count]) => /* @__PURE__ */ jsxs34("button", { type: "button", onClick: () => onSelect(status), children: [
12485
+ /* @__PURE__ */ jsx36("span", { children: status.replaceAll("_", " ") }),
12486
+ /* @__PURE__ */ jsx36("strong", { children: count })
12381
12487
  ] }, status)) })
12382
12488
  ] });
12383
- return /* @__PURE__ */ jsxs33("div", { className: "mbrfa-overview", children: [
12384
- /* @__PURE__ */ jsxs33("div", { className: "mbrfa-overview-title", children: [
12385
- /* @__PURE__ */ jsxs33("div", { children: [
12386
- /* @__PURE__ */ jsx35("h3", { children: combined ? "Requests awaiting a decision" : "Status and aging" }),
12387
- /* @__PURE__ */ jsx35("p", { className: "mbrfa-aging-basis", children: "Calendar days since submission" })
12489
+ return /* @__PURE__ */ jsxs34("div", { className: "mbrfa-overview", children: [
12490
+ /* @__PURE__ */ jsxs34("div", { className: "mbrfa-overview-title", children: [
12491
+ /* @__PURE__ */ jsxs34("div", { children: [
12492
+ /* @__PURE__ */ jsx36("h3", { children: combined ? "Requests awaiting a decision" : "Status and aging" }),
12493
+ /* @__PURE__ */ jsx36("p", { className: "mbrfa-aging-basis", children: "Calendar days since submission" })
12388
12494
  ] }),
12389
- /* @__PURE__ */ jsxs33("span", { children: [
12495
+ /* @__PURE__ */ jsxs34("span", { children: [
12390
12496
  summary.total.toLocaleString(),
12391
12497
  " total requests"
12392
12498
  ] })
12393
12499
  ] }),
12394
- groups.filter((group) => !combined || group.tone === "waiting").map((group) => /* @__PURE__ */ jsxs33("section", { className: `mbrfa-status-group mbrfa-${group.tone}`, "aria-label": group.title, children: [
12395
- /* @__PURE__ */ jsxs33("div", { className: "mbrfa-aging-grid mbrfa-group-heading", children: [
12396
- /* @__PURE__ */ jsxs33("h4", { children: [
12397
- /* @__PURE__ */ jsx35("i", { "aria-hidden": "true" }),
12500
+ groups.filter((group) => !combined || group.tone === "waiting").map((group) => /* @__PURE__ */ jsxs34("section", { className: `mbrfa-status-group mbrfa-${group.tone}`, "aria-label": group.title, children: [
12501
+ /* @__PURE__ */ jsxs34("div", { className: "mbrfa-aging-grid mbrfa-group-heading", children: [
12502
+ /* @__PURE__ */ jsxs34("h4", { children: [
12503
+ /* @__PURE__ */ jsx36("i", { "aria-hidden": "true" }),
12398
12504
  group.title
12399
12505
  ] }),
12400
- buckets.map((bucket) => /* @__PURE__ */ jsx35("span", { className: "mbrfa-age-heading", children: bucket.label }, bucket.id)),
12401
- /* @__PURE__ */ jsx35("span", { className: "mbrfa-total-heading", children: "Total" })
12506
+ buckets.map((bucket) => /* @__PURE__ */ jsx36("span", { className: "mbrfa-age-heading", children: bucket.label }, bucket.id)),
12507
+ /* @__PURE__ */ jsx36("span", { className: "mbrfa-total-heading", children: "Total" })
12402
12508
  ] }),
12403
- group.states.map((status) => /* @__PURE__ */ jsxs33("div", { className: "mbrfa-aging-grid mbrfa-aging-row", children: [
12404
- /* @__PURE__ */ jsx35("strong", { children: RFA_LIFECYCLE_LABELS4[status] }),
12405
- buckets.map((bucket) => /* @__PURE__ */ jsxs33("span", { className: "mbrfa-age-cell", children: [
12406
- /* @__PURE__ */ jsx35("span", { className: "mbrfa-mobile-age", children: bucket.label }),
12407
- group.tone === "waiting" && aging ? countButton(aging.byLifecycleStatus[status]?.[bucket.id] ?? 0, `${RFA_LIFECYCLE_LABELS4[status]} \xB7 ${bucket.label} since submission`, status, bucket.id) : /* @__PURE__ */ jsx35("span", { className: "mbrfa-zero", "aria-label": "Not applicable", children: "\u2014" })
12509
+ group.states.map((status) => /* @__PURE__ */ jsxs34("div", { className: "mbrfa-aging-grid mbrfa-aging-row", children: [
12510
+ /* @__PURE__ */ jsx36("strong", { children: RFA_LIFECYCLE_LABELS4[status] }),
12511
+ buckets.map((bucket) => /* @__PURE__ */ jsxs34("span", { className: "mbrfa-age-cell", children: [
12512
+ /* @__PURE__ */ jsx36("span", { className: "mbrfa-mobile-age", children: bucket.label }),
12513
+ group.tone === "waiting" && aging ? countButton(aging.byLifecycleStatus[status]?.[bucket.id] ?? 0, `${RFA_LIFECYCLE_LABELS4[status]} \xB7 ${bucket.label} since submission`, status, bucket.id) : /* @__PURE__ */ jsx36("span", { className: "mbrfa-zero", "aria-label": "Not applicable", children: "\u2014" })
12408
12514
  ] }, bucket.id)),
12409
- /* @__PURE__ */ jsx35("span", { className: "mbrfa-row-total", children: countButton(summary.byLifecycleStatus?.[status] ?? 0, RFA_LIFECYCLE_LABELS4[status], status) })
12515
+ /* @__PURE__ */ jsx36("span", { className: "mbrfa-row-total", children: countButton(summary.byLifecycleStatus?.[status] ?? 0, RFA_LIFECYCLE_LABELS4[status], status) })
12410
12516
  ] }, status))
12411
12517
  ] }, group.title)),
12412
- /* @__PURE__ */ jsxs33("p", { className: "mbrfa-overview-footnote", children: [
12518
+ /* @__PURE__ */ jsxs34("p", { className: "mbrfa-overview-footnote", children: [
12413
12519
  "Aging counts calendar days since submission, separately from the decision deadline. Only requests awaiting a treatment decision are aged.",
12414
12520
  !aging ? " Aging is unavailable from this server." : ""
12415
12521
  ] }),
12416
- /* @__PURE__ */ jsxs33("button", { type: "button", className: "mbrfa-all-requests", onClick: () => onSelect(""), children: [
12417
- /* @__PURE__ */ jsx35("strong", { children: "All requests" }),
12418
- /* @__PURE__ */ jsxs33("span", { children: [
12522
+ /* @__PURE__ */ jsxs34("button", { type: "button", className: "mbrfa-all-requests", onClick: () => onSelect(""), children: [
12523
+ /* @__PURE__ */ jsx36("strong", { children: "All requests" }),
12524
+ /* @__PURE__ */ jsxs34("span", { children: [
12419
12525
  summary.total.toLocaleString(),
12420
12526
  " ",
12421
- /* @__PURE__ */ jsx35("span", { "aria-hidden": "true", children: "\u2192" })
12527
+ /* @__PURE__ */ jsx36("span", { "aria-hidden": "true", children: "\u2192" })
12422
12528
  ] })
12423
12529
  ] })
12424
12530
  ] });
@@ -12438,21 +12544,21 @@ var rfaDashboardCss = `
12438
12544
  import { useCallback as useCallback3, useEffect as useEffect24, useState as useState27 } from "react";
12439
12545
 
12440
12546
  // src/rfa-claim-setup.tsx
12441
- import { useEffect as useEffect18, useRef as useRef17, useState as useState21 } from "react";
12442
- import { jsx as jsx36, jsxs as jsxs34 } from "react/jsx-runtime";
12547
+ import { useEffect as useEffect19, useRef as useRef17, useState as useState22 } from "react";
12548
+ import { jsx as jsx37, jsxs as jsxs35 } from "react/jsx-runtime";
12443
12549
  function RfaClaimSetup({ client, disabled, onCreated, onCancel }) {
12444
- const [fields2, setFields] = useState21({ firstName: "", lastName: "", dateOfBirth: "", phone: "", line1: "", line2: "", city: "", state: "CA", postalCode: "", claimNumber: "", employer: "", dateOfInjury: "", injuryState: "CA", description: "" });
12445
- const [search, setSearch] = useState21("");
12446
- const [administrators, setAdministrators] = useState21([]);
12447
- const [administratorId, setAdministratorId] = useState21("");
12448
- const [payerId, setPayerId] = useState21("");
12449
- const [busy, setBusy] = useState21(false);
12450
- const [searching, setSearching] = useState21(false);
12451
- const [error, setError] = useState21("");
12452
- const [searched, setSearched] = useState21(false);
12550
+ const [fields2, setFields] = useState22({ firstName: "", lastName: "", dateOfBirth: "", phone: "", line1: "", line2: "", city: "", state: "CA", postalCode: "", claimNumber: "", employer: "", dateOfInjury: "", injuryState: "CA", description: "" });
12551
+ const [search, setSearch] = useState22("");
12552
+ const [administrators, setAdministrators] = useState22([]);
12553
+ const [administratorId, setAdministratorId] = useState22("");
12554
+ const [payerId, setPayerId] = useState22("");
12555
+ const [busy, setBusy] = useState22(false);
12556
+ const [searching, setSearching] = useState22(false);
12557
+ const [error, setError] = useState22("");
12558
+ const [searched, setSearched] = useState22(false);
12453
12559
  const identities = useRef17(null);
12454
12560
  const attempt = useRef17(null);
12455
- useEffect18(() => {
12561
+ useEffect19(() => {
12456
12562
  let active = true;
12457
12563
  const term = search.trim();
12458
12564
  setAdministrators([]);
@@ -12484,11 +12590,11 @@ function RfaClaimSetup({ client, disabled, onCreated, onCancel }) {
12484
12590
  const administrator = administrators.find((value) => value.id === administratorId);
12485
12591
  const availablePayers = administrator?.payers?.filter((value) => value.active !== false) ?? [];
12486
12592
  const locked = disabled || busy;
12487
- const input = (name, label5, maxLength, required2 = true, type = "text") => /* @__PURE__ */ jsxs34("label", { children: [
12593
+ const input = (name, label5, maxLength, required2 = true, type = "text") => /* @__PURE__ */ jsxs35("label", { children: [
12488
12594
  label5,
12489
- /* @__PURE__ */ jsx36("input", { required: required2, type, maxLength, value: fields2[name], onChange: (event) => setFields((value) => ({ ...value, [name]: event.target.value })) })
12595
+ /* @__PURE__ */ jsx37("input", { required: required2, type, maxLength, value: fields2[name], onChange: (event) => setFields((value) => ({ ...value, [name]: event.target.value })) })
12490
12596
  ] });
12491
- return /* @__PURE__ */ jsx36("form", { onSubmit: async (event) => {
12597
+ return /* @__PURE__ */ jsx37("form", { onSubmit: async (event) => {
12492
12598
  event.preventDefault();
12493
12599
  if (locked || !administrator || !client.provisionClaim || administrator.payerSelectionRequired && !payerId) return;
12494
12600
  setBusy(true);
@@ -12508,10 +12614,10 @@ function RfaClaimSetup({ client, disabled, onCreated, onCancel }) {
12508
12614
  } finally {
12509
12615
  setBusy(false);
12510
12616
  }
12511
- }, children: /* @__PURE__ */ jsxs34("fieldset", { disabled: locked, children: [
12512
- /* @__PURE__ */ jsx36("legend", { children: "New patient and injury" }),
12513
- /* @__PURE__ */ jsx36("p", { children: "Save the patient and injury to use for this authorization request. No bill is required." }),
12514
- /* @__PURE__ */ jsxs34("div", { className: "mbtd-grid", children: [
12617
+ }, children: /* @__PURE__ */ jsxs35("fieldset", { disabled: locked, children: [
12618
+ /* @__PURE__ */ jsx37("legend", { children: "New patient and injury" }),
12619
+ /* @__PURE__ */ jsx37("p", { children: "Save the patient and injury to use for this authorization request. No bill is required." }),
12620
+ /* @__PURE__ */ jsxs35("div", { className: "mbtd-grid", children: [
12515
12621
  input("firstName", "Patient first name", 100),
12516
12622
  input("lastName", "Patient last name", 100),
12517
12623
  input("dateOfBirth", "Date of birth", 10, true, "date"),
@@ -12527,128 +12633,46 @@ function RfaClaimSetup({ client, disabled, onCreated, onCancel }) {
12527
12633
  input("injuryState", "Injury state", 2),
12528
12634
  input("description", "Injury description (optional)", 1e3, false)
12529
12635
  ] }),
12530
- /* @__PURE__ */ jsxs34("label", { children: [
12636
+ /* @__PURE__ */ jsxs35("label", { children: [
12531
12637
  "Search claims administrators",
12532
- /* @__PURE__ */ jsx36("input", { type: "search", maxLength: 200, value: search, onChange: (event) => {
12638
+ /* @__PURE__ */ jsx37("input", { type: "search", maxLength: 200, value: search, onChange: (event) => {
12533
12639
  setSearch(event.target.value);
12534
12640
  setAdministratorId("");
12535
12641
  setPayerId("");
12536
12642
  setError("");
12537
12643
  } })
12538
12644
  ] }),
12539
- searching ? /* @__PURE__ */ jsx36("p", { role: "status", children: "Searching claims administrators\u2026" }) : null,
12540
- /* @__PURE__ */ jsxs34("label", { children: [
12645
+ searching ? /* @__PURE__ */ jsx37("p", { role: "status", children: "Searching claims administrators\u2026" }) : null,
12646
+ /* @__PURE__ */ jsxs35("label", { children: [
12541
12647
  "Claims administrator",
12542
- /* @__PURE__ */ jsxs34("select", { required: true, disabled: searching, value: administratorId, onChange: (event) => {
12648
+ /* @__PURE__ */ jsxs35("select", { required: true, disabled: searching, value: administratorId, onChange: (event) => {
12543
12649
  setAdministratorId(event.target.value);
12544
12650
  setPayerId("");
12545
12651
  }, children: [
12546
- /* @__PURE__ */ jsx36("option", { value: "", children: "Choose a claims administrator" }),
12547
- administrators.map((value) => /* @__PURE__ */ jsx36("option", { value: value.id, children: value.name }, value.id))
12652
+ /* @__PURE__ */ jsx37("option", { value: "", children: "Choose a claims administrator" }),
12653
+ administrators.map((value) => /* @__PURE__ */ jsx37("option", { value: value.id, children: value.name }, value.id))
12548
12654
  ] })
12549
12655
  ] }),
12550
- searched && !administrators.length ? /* @__PURE__ */ jsx36("p", { children: "No administrators match this search. Try another name, or add a custom claims administrator in Settings." }) : null,
12551
- availablePayers.length ? /* @__PURE__ */ jsxs34("label", { children: [
12656
+ searched && !administrators.length ? /* @__PURE__ */ jsx37("p", { children: "No administrators match this search. Try another name, or add a custom claims administrator in Settings." }) : null,
12657
+ availablePayers.length ? /* @__PURE__ */ jsxs35("label", { children: [
12552
12658
  "Payer",
12553
12659
  administrator?.payerSelectionRequired ? "" : " (optional)",
12554
- /* @__PURE__ */ jsxs34("select", { required: administrator?.payerSelectionRequired, value: payerId, onChange: (event) => setPayerId(event.target.value), children: [
12555
- /* @__PURE__ */ jsx36("option", { value: "", children: "Choose a payer" }),
12556
- availablePayers.map((value) => /* @__PURE__ */ jsx36("option", { value: value.id, children: value.label }, value.id))
12660
+ /* @__PURE__ */ jsxs35("select", { required: administrator?.payerSelectionRequired, value: payerId, onChange: (event) => setPayerId(event.target.value), children: [
12661
+ /* @__PURE__ */ jsx37("option", { value: "", children: "Choose a payer" }),
12662
+ availablePayers.map((value) => /* @__PURE__ */ jsx37("option", { value: value.id, children: value.label }, value.id))
12557
12663
  ] })
12558
12664
  ] }) : null,
12559
- administrator?.payerSelectionRequired && !availablePayers.length ? /* @__PURE__ */ jsx36("p", { role: "alert", children: "This administrator needs a payer selection, but no active payers are available. Choose another administrator or contact your administrator." }) : null,
12560
- error ? /* @__PURE__ */ jsx36("p", { role: "alert", children: error }) : null,
12561
- /* @__PURE__ */ jsxs34("div", { className: "mbtd-actions", children: [
12562
- /* @__PURE__ */ jsx36("button", { type: "button", onClick: onCancel, children: "Cancel new patient" }),
12563
- /* @__PURE__ */ jsx36("button", { className: "mbtd-primary", type: "submit", disabled: !administrator || !client.provisionClaim || !!(administrator.payerSelectionRequired && !payerId), children: busy ? "Saving patient and injury\u2026" : "Save patient and injury" })
12665
+ administrator?.payerSelectionRequired && !availablePayers.length ? /* @__PURE__ */ jsx37("p", { role: "alert", children: "This administrator needs a payer selection, but no active payers are available. Choose another administrator or contact your administrator." }) : null,
12666
+ error ? /* @__PURE__ */ jsx37("p", { role: "alert", children: error }) : null,
12667
+ /* @__PURE__ */ jsxs35("div", { className: "mbtd-actions", children: [
12668
+ /* @__PURE__ */ jsx37("button", { type: "button", onClick: onCancel, children: "Cancel new patient" }),
12669
+ /* @__PURE__ */ jsx37("button", { className: "mbtd-primary", type: "submit", disabled: !administrator || !client.provisionClaim || !!(administrator.payerSelectionRequired && !payerId), children: busy ? "Saving patient and injury\u2026" : "Save patient and injury" })
12564
12670
  ] })
12565
12671
  ] }) });
12566
12672
  }
12567
12673
 
12568
12674
  // src/rfa-practice-picker.tsx
12569
12675
  import { useEffect as useEffect20, useRef as useRef18, useState as useState23 } from "react";
12570
-
12571
- // src/rfa-official-fields.tsx
12572
- import { useEffect as useEffect19, useState as useState22 } from "react";
12573
- import { jsx as jsx37, jsxs as jsxs35 } from "react/jsx-runtime";
12574
- var formDate = (value) => {
12575
- const match = /^(\d{4})-(\d{2})-(\d{2})/.exec(value ?? "");
12576
- return match ? `${match[2]}/${match[3]}/${match[1]}` : value ?? "";
12577
- };
12578
- function RfaPicker({ label: label5, children }) {
12579
- return /* @__PURE__ */ jsxs35("div", { className: "mbrfa-picker", children: [
12580
- /* @__PURE__ */ jsx37("span", { children: label5 }),
12581
- children
12582
- ] });
12583
- }
12584
- function RfaSavedField({ label: label5, value, span }) {
12585
- return /* @__PURE__ */ jsxs35("div", { className: `mbrfa-s${span} mbrfa-saved`, children: [
12586
- /* @__PURE__ */ jsx37("span", { children: label5 }),
12587
- /* @__PURE__ */ jsx37("strong", { children: value || "\u2014" })
12588
- ] });
12589
- }
12590
- function RfaEmployeeFields({ name, dateOfInjury, claimNumber, details }) {
12591
- return /* @__PURE__ */ jsxs35("div", { className: "mbrfa-form-grid", children: [
12592
- /* @__PURE__ */ jsx37(RfaSavedField, { span: 6, label: "Name (Last, First, Middle)", value: details?.formName || name }),
12593
- /* @__PURE__ */ jsx37(RfaSavedField, { span: 3, label: "Date of Injury (MM/DD/YYYY)", value: formDate(dateOfInjury) }),
12594
- /* @__PURE__ */ jsx37(RfaSavedField, { span: 3, label: "Date of Birth (MM/DD/YYYY)", value: formDate(details?.dateOfBirth) }),
12595
- /* @__PURE__ */ jsx37(RfaSavedField, { span: 3, label: "Claim Number", value: claimNumber }),
12596
- /* @__PURE__ */ jsx37(RfaSavedField, { span: 3, label: "Employer", value: details?.employer })
12597
- ] });
12598
- }
12599
- var contactRows = [
12600
- ["address", "Address", 500, 3],
12601
- ["city", "City", 100, 2],
12602
- ["state", "State", 2, 1],
12603
- ["zip", "Zip Code", 20, 2],
12604
- ["phone", "Phone", 30, 2],
12605
- ["fax", "Fax Number", 30, 2]
12606
- ];
12607
- function RfaOfficialContactFields({ nameLabel, value, onChange, before, beforeEmail, faxHint, editable = true }) {
12608
- const hint = (key2) => key2 === "fax" && faxHint && !value?.fax?.trim() ? /* @__PURE__ */ jsx37("small", { className: "mbrfa-field-hint", children: faxHint }) : null;
12609
- const field = (key2, label5, max, span) => editable ? /* @__PURE__ */ jsxs35("label", { className: `mbrfa-s${span}`, children: [
12610
- label5,
12611
- /* @__PURE__ */ jsx37("input", { type: key2 === "email" ? "email" : key2 === "phone" || key2 === "fax" ? "tel" : "text", maxLength: max, value: value?.[key2] ?? "", onChange: (event) => onChange({ ...value, [key2]: event.target.value }) }),
12612
- hint(key2)
12613
- ] }, key2) : /* @__PURE__ */ jsxs35("div", { className: `mbrfa-s${span} mbrfa-saved`, children: [
12614
- /* @__PURE__ */ jsx37("span", { children: label5 }),
12615
- /* @__PURE__ */ jsx37("strong", { children: value?.[key2]?.trim() || "\u2014" }),
12616
- hint(key2)
12617
- ] }, key2);
12618
- return /* @__PURE__ */ jsxs35("div", { className: "mbrfa-form-grid", children: [
12619
- before,
12620
- field("name", nameLabel, 200, 3),
12621
- field("contactName", "Contact Name", 200, 3),
12622
- contactRows.map(([key2, label5, max, span]) => field(key2, label5, max, span)),
12623
- beforeEmail,
12624
- field("email", "E-mail Address", 254, 6)
12625
- ] });
12626
- }
12627
- function RfaManualToggle({ manual, onChange, disabled }) {
12628
- return /* @__PURE__ */ jsxs35("div", { className: "mbrfa-section-actions", children: [
12629
- /* @__PURE__ */ jsx37("button", { type: "button", className: "mbrfa-link", disabled, "aria-pressed": manual, onClick: () => onChange(!manual), children: manual ? "Done editing" : "Edit manually" }),
12630
- manual ? /* @__PURE__ */ jsx37("span", { children: "These values are saved on this request only." }) : null
12631
- ] });
12632
- }
12633
- function useRfaFormDetails(client, claimId, renderingProviderId, enabled) {
12634
- const [details, setDetails] = useState22();
12635
- useEffect19(() => {
12636
- let active = true;
12637
- setDetails(void 0);
12638
- if (!enabled || !claimId) return;
12639
- void client.getCreationContext({ claimId, renderingProviderId, limit: 1 }).then((context) => {
12640
- if (!active) return;
12641
- const claim = context.claims.find((value) => value.claimId === claimId), provider = context.renderingProviders.find((value) => value.id === renderingProviderId);
12642
- setDetails({ ...context.returnFax ? { returnFax: context.returnFax } : {}, ...context.returnEmail ? { returnEmail: context.returnEmail } : {}, ...claim ? { employee: { formName: claim.employeeFormName, dateOfBirth: claim.dateOfBirth, employer: claim.employer } } : {}, ...provider ? { physician: { specialty: provider.specialty } } : {} });
12643
- }).catch(() => void 0);
12644
- return () => {
12645
- active = false;
12646
- };
12647
- }, [client, claimId, renderingProviderId, enabled]);
12648
- return details;
12649
- }
12650
-
12651
- // src/rfa-practice-picker.tsx
12652
12676
  import { Fragment as Fragment21, jsx as jsx38, jsxs as jsxs36 } from "react/jsx-runtime";
12653
12677
  function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manageLocationsHref, onEditPractice, onEditLocation, onChosen }) {
12654
12678
  const practices = profile?.billingProviders ?? [];
@@ -12758,11 +12782,17 @@ function RfaDiagnosisFields({ code, description, onChange, search, officialForm
12758
12782
  setQuery("");
12759
12783
  }, error }) }) }) : null,
12760
12784
  /* @__PURE__ */ jsxs37("label", { className: "mbrfa-s4", children: [
12761
- "Diagnosis (Required)",
12785
+ /* @__PURE__ */ jsxs37("span", { children: [
12786
+ "Diagnosis",
12787
+ /* @__PURE__ */ jsx39(RfaRequired, {})
12788
+ ] }),
12762
12789
  /* @__PURE__ */ jsx39("input", { required: true, maxLength: 1e3, value: description ?? "", onChange: (event) => onChange({ diagnosisCode: code, diagnosisDescription: event.target.value }) })
12763
12790
  ] }),
12764
12791
  /* @__PURE__ */ jsxs37("label", { className: "mbrfa-s2", children: [
12765
- "ICD-Code (Required)",
12792
+ /* @__PURE__ */ jsxs37("span", { children: [
12793
+ "ICD-Code",
12794
+ /* @__PURE__ */ jsx39(RfaRequired, {})
12795
+ ] }),
12766
12796
  /* @__PURE__ */ jsx39("input", { required: true, maxLength: 16, value: code, onChange: (event) => onChange({ diagnosisCode: event.target.value, diagnosisDescription: description ?? "" }) })
12767
12797
  ] })
12768
12798
  ] });
@@ -12853,7 +12883,9 @@ function RfaContactPicker({ administratorId, claimNumber, contextKey, value, onC
12853
12883
  };
12854
12884
  }, [query, claimNumber, searchClaimsAdministrators]);
12855
12885
  if (officialForm) {
12856
- const shown = value ?? { ...directory?.name ? { name: directory.name } : {}, ...directory?.mailingAddresses?.[0]?.address ? { address: directory.mailingAddresses[0].address } : {}, ...directory?.telephoneNumbers?.[0] ? { phone: directory.telephoneNumbers[0] } : {} };
12886
+ const mailing = directory?.mailingAddresses?.[0]?.address?.trim(), parts = mailing ? /^(.+?),\s*([^,]+),\s*([A-Za-z]{2})\.?\s+(\d{5}(?:-\d{4})?)$/.exec(mailing) : null;
12887
+ const named = (text3) => text3 && /[a-z]/i.test(text3) ? text3 : void 0;
12888
+ const shown = value ?? { ...directory?.name ? { name: directory.name } : {}, ...parts ? { address: parts[1], city: parts[2], state: parts[3].toUpperCase(), zip: parts[4] } : mailing ? { address: mailing } : {}, ...directory?.telephoneNumbers?.[0] ? { phone: directory.telephoneNumbers[0] } : {} };
12857
12889
  return /* @__PURE__ */ jsxs38("fieldset", { children: [
12858
12890
  /* @__PURE__ */ jsx40("legend", { children: "Claims Administrator Information" }),
12859
12891
  /* @__PURE__ */ jsxs38("div", { className: "mbrfa-pickers", "data-columns": "2", children: [
@@ -12861,12 +12893,14 @@ function RfaContactPicker({ administratorId, claimNumber, contextKey, value, onC
12861
12893
  const option = options.find((item) => item.id === id);
12862
12894
  if (option) choose(option);
12863
12895
  } }) }) : null,
12864
- /* @__PURE__ */ jsx40(RfaPicker, { label: directory?.authorizationStatus === "claim_handling_location_routes" ? "Claim-handling office" : "Authorization contact", children: /* @__PURE__ */ jsx40(RfaAuthorizationDestination, { compact: true, onManualEntry: () => setManual(true), contextKey: `${contextKey}:${administratorId ?? ""}`, directory, loading, error, disabled, onChange: (destination) => {
12896
+ /* @__PURE__ */ jsx40(RfaPicker, { label: directory?.authorizationStatus === "claim_handling_location_routes" ? "Claim-handling office" : "Authorization contact", children: /* @__PURE__ */ jsx40(RfaAuthorizationDestination, { compact: true, autoSelectSingle: !value, onManualEntry: () => setManual(true), contextKey: `${contextKey}:${administratorId ?? ""}`, directory, loading, error, disabled, onChange: (destination) => {
12865
12897
  if (!destination) return;
12866
12898
  const kept = { ...shown };
12867
12899
  delete kept.fax;
12868
12900
  delete kept.email;
12869
- onChange(administratorId, { ...kept, name: directory?.name ?? shown.name ?? "", contactName: destination.recipientName ?? destination.label, ...destination.phone ? { phone: destination.phone } : {}, ...destination.method === "fax" ? { fax: destination.destination } : { email: destination.destination } });
12901
+ delete kept.contactName;
12902
+ const contactName = named(destination.recipientName) ?? named(destination.label);
12903
+ onChange(administratorId, { ...kept, name: directory?.name ?? shown.name ?? "", ...contactName ? { contactName } : {}, ...destination.phone ? { phone: destination.phone } : {}, ...destination.method === "fax" ? { fax: destination.destination } : { email: destination.destination } });
12870
12904
  } }) })
12871
12905
  ] }),
12872
12906
  /* @__PURE__ */ jsx40("fieldset", { className: "mbrfa-plain", disabled, children: /* @__PURE__ */ jsx40(RfaOfficialContactFields, { editable: manual, nameLabel: "Company Name", value: shown, onChange: (contact) => onChange(administratorId, contact) }) }),
@@ -13080,7 +13114,7 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13080
13114
  event.preventDefault();
13081
13115
  if (locked) return;
13082
13116
  const next = normalizeRfaDraft(draft2);
13083
- void action.save(next, validateRfaDraft(next) ?? (officialForm && intentRef.current === "review" && !next.requestingPractice?.fax?.trim() ? "Enter the Requesting Physician fax number. The claims administrator faxes the decision back to it." : null));
13117
+ void action.save(next, validateRfaDraft(next) ?? (officialForm && intentRef.current === "review" && !next.requestingPractice?.fax?.trim() ? "Requesting Physician fax number is required." : null));
13084
13118
  };
13085
13119
  const saveError = action.error ? /* @__PURE__ */ jsxs39("p", { role: "alert", children: [
13086
13120
  action.error,
@@ -13124,7 +13158,7 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13124
13158
  /* @__PURE__ */ jsxs39("fieldset", { children: [
13125
13159
  /* @__PURE__ */ jsx41("legend", { children: "Requesting Physician Information" }),
13126
13160
  /* @__PURE__ */ jsxs39("div", { className: "mbrfa-pickers", "data-columns": selectors?.physician ? 3 : 2, children: [
13127
- selectors?.physician ? /* @__PURE__ */ jsx41(RfaPicker, { label: "Requesting physician", children: selectors.physician }) : null,
13161
+ selectors?.physician ? /* @__PURE__ */ jsx41(RfaPicker, { required: true, label: "Requesting physician", children: selectors.physician }) : null,
13128
13162
  /* @__PURE__ */ jsx41(RfaPracticePicker, { profile: organizationProfile, value: draft2.requestingPractice, onChange: (requestingPractice) => update({ requestingPractice }), ...managePracticeHref ? { managePracticeHref } : {}, ...manageLocationsHref ? { manageLocationsHref } : {}, onEditPractice, onEditLocation, onChosen: () => setPracticeManual(false) })
13129
13163
  ] }),
13130
13164
  /* @__PURE__ */ jsx41("fieldset", { className: "mbrfa-plain", disabled: locked, children: /* @__PURE__ */ jsx41(
@@ -13134,15 +13168,14 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13134
13168
  nameLabel: "Practice Name",
13135
13169
  value: draft2.requestingPractice,
13136
13170
  onChange: (requestingPractice) => update({ requestingPractice }),
13137
- faxHint: "Required to send. The decision is faxed back here. Save it on the practice location to fill it automatically.",
13171
+ required: ["fax"],
13138
13172
  before: /* @__PURE__ */ jsx41(RfaSavedField, { span: 6, label: "Physician Name", value: draft2.providerName }),
13139
13173
  beforeEmail: /* @__PURE__ */ jsxs39(Fragment23, { children: [
13140
13174
  /* @__PURE__ */ jsx41(RfaSavedField, { span: 3, label: "Specialty", value: formDetails?.physician?.specialty ?? savedPhysician?.specialty }),
13141
13175
  /* @__PURE__ */ jsx41(RfaSavedField, { span: 3, label: "NPI Number", value: draft2.providerNpi })
13142
13176
  ] })
13143
13177
  }
13144
- ) }),
13145
- /* @__PURE__ */ jsx41(RfaManualToggle, { manual: practiceManual, onChange: setPracticeManual, disabled: locked })
13178
+ ) })
13146
13179
  ] }),
13147
13180
  /* @__PURE__ */ jsx41(RfaContactPicker, { officialForm: true, ...searchClaimsAdministrators ? { searchClaimsAdministrators } : {}, ...getClaimsAdministratorDirectory ? { getClaimsAdministratorDirectory } : {}, ...draft2.claimsAdminId ? { administratorId: draft2.claimsAdminId } : {}, ...draft2.claimNumber ? { claimNumber: draft2.claimNumber } : {}, contextKey: draft2.claimId, value: draft2.authorizationContact, disabled: locked, onChange: (id, authorizationContact) => {
13148
13181
  setAdministratorOverride({ id });
@@ -13156,7 +13189,10 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13156
13189
  /* @__PURE__ */ jsxs39("div", { className: "mbrfa-form-grid", children: [
13157
13190
  /* @__PURE__ */ jsx41(RfaDiagnosisFields, { officialForm: true, code: item.diagnosisCode, ...item.diagnosisDescription !== void 0 ? { description: item.diagnosisDescription } : {}, ...searchDiagnosisCodes ? { search: searchDiagnosisCodes } : {}, onChange: (value) => updateItem(index, value) }),
13158
13191
  /* @__PURE__ */ jsxs39("label", { className: "mbrfa-s4", children: [
13159
- "Service/Good Requested (Required)",
13192
+ /* @__PURE__ */ jsxs39("span", { children: [
13193
+ "Service/Good Requested",
13194
+ /* @__PURE__ */ jsx41(RfaRequired, {})
13195
+ ] }),
13160
13196
  /* @__PURE__ */ jsx41("textarea", { required: true, maxLength: 1e3, value: item.serviceDescription, onChange: (event) => updateItem(index, { serviceDescription: event.target.value }) })
13161
13197
  ] }),
13162
13198
  /* @__PURE__ */ jsxs39("label", { className: "mbrfa-s2", children: [
@@ -14265,7 +14301,7 @@ function RfaDashboard({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOve
14265
14301
  const identity = useMemo12(() => ({ client, signatureClient, key: key() }), [client, signatureClient]);
14266
14302
  return /* @__PURE__ */ jsx45(RfaDashboardContent, { ...props, ...patientId ? { patientId } : {}, ...claimId ? { claimId } : {}, ...renderingProviderId ? { renderingProviderId } : {}, client, signatureClient, options }, `${identity.key}:${patientId ?? ""}:${claimId ?? ""}:${renderingProviderId ?? ""}`);
14267
14303
  }
14268
- function RfaDashboardContent({ client, signatureClient, options, patientId, claimId, renderingProviderId, initialDraft, initialView = "overview", initialOverviewView, initialStatus = "", initialAgingBucket = "", taskPresentation, taskQuery: taskQuery2, renderTaskIdentity, navigation, permissions = [], canCreateClaim = false, renderClaimSelector, renderProviderSelector, officialForm = false, managePracticeHref, onEditPractice, onEditLocation, manageLocationsHref, onPreviewRequest, canManageProviderSignatures = false, environment = "sandbox", actorReference, onCreated, onContinue, selectedRfaId, selectedTreatmentId, selectedResponseDocumentId: controlledResponseDocumentId, onSelectRfa, getRfaHref, getPatientHref, getClaimHref, getProviderHref, formPreviewUrl, hideBackButton = false, hideHeading = false, layout = "classic", ...appearance }) {
14304
+ function RfaDashboardContent({ client, signatureClient, options, patientId, claimId, renderingProviderId, initialDraft, initialView = "overview", initialOverviewView, initialStatus = "", initialAgingBucket = "", taskPresentation, taskQuery: taskQuery2, renderTaskIdentity, navigation, permissions = [], canCreateClaim = false, renderClaimSelector, renderProviderSelector, officialForm = false, managePracticeHref, onEditPractice, onEditLocation, savedProfileChanges, manageLocationsHref, onPreviewRequest, canManageProviderSignatures = false, environment = "sandbox", actorReference, onCreated, onContinue, selectedRfaId, selectedTreatmentId, selectedResponseDocumentId: controlledResponseDocumentId, onSelectRfa, getRfaHref, getPatientHref, getClaimHref, getProviderHref, formPreviewUrl, hideBackButton = false, hideHeading = false, layout = "classic", ...appearance }) {
14269
14305
  const active = useRef22(true);
14270
14306
  useEffect26(() => {
14271
14307
  active.current = true;
@@ -14275,6 +14311,11 @@ function RfaDashboardContent({ client, signatureClient, options, patientId, clai
14275
14311
  }, []);
14276
14312
  const references = useMemo12(() => createBillReferenceClient2(options), [options]);
14277
14313
  const [profile, setProfile] = useState30();
14314
+ useEffect26(() => {
14315
+ if (!savedProfileChanges) return;
14316
+ const merge = (current, saved) => saved?.length ? [...current.map((item) => saved.find((next) => next.id === item.id) ?? item), ...saved.filter((next) => !current.some((item) => item.id === next.id))] : current;
14317
+ setProfile((current) => current ? { ...current, billingProviders: merge(current.billingProviders, savedProfileChanges.billingProviders), locations: merge(current.locations, savedProfileChanges.locations) } : current);
14318
+ }, [savedProfileChanges]);
14278
14319
  const draftFormProps = { officialForm, ...onEditPractice ? { onEditPractice } : {}, ...onEditLocation ? { onEditLocation } : {}, ...managePracticeHref ? { managePracticeHref } : {}, ...manageLocationsHref ? { manageLocationsHref } : {}, onRefreshProfile: async () => {
14279
14320
  const next = await createOrganizationClient4(options).getBillingProfile();
14280
14321
  if (active.current) setProfile(next);