@mindbill/react 0.77.31 → 0.77.33

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
@@ -1077,7 +1077,7 @@ function organizationProfileOptions(profile) {
1077
1077
 
1078
1078
  // src/index.tsx
1079
1079
  import "@mindbill/embed";
1080
- import { createElement, useEffect as useEffect34, useRef as useRef28 } from "react";
1080
+ import { createElement, useEffect as useEffect35, useRef as useRef29 } from "react";
1081
1081
 
1082
1082
  // src/claim-form-summary.tsx
1083
1083
  import { jsx as jsx5 } from "react/jsx-runtime";
@@ -10031,7 +10031,7 @@ function BillSubmissionForm({
10031
10031
  import { useId as useId9, useMemo as useMemo13, useState as useState31 } from "react";
10032
10032
 
10033
10033
  // src/rfa-dashboard.tsx
10034
- import { useEffect as useEffect25, useId as useId8, useMemo as useMemo12, useRef as useRef21, useState as useState30 } from "react";
10034
+ import { useEffect as useEffect26, useId as useId8, useMemo as useMemo12, useRef as useRef22, useState as useState30 } from "react";
10035
10035
  import { getRfaLifecycleStatus as getRfaLifecycleStatus4, RFA_LIFECYCLE_LABELS as RFA_LIFECYCLE_LABELS5, createRfaClient as createRfaClient4, createBillReferenceClient as createBillReferenceClient2, createOrganizationClient as createOrganizationClient4 } from "@mindbill/browser";
10036
10036
 
10037
10037
  // src/rfa-display.tsx
@@ -10049,28 +10049,93 @@ 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 useRef12, useState as useState16 } from "react";
10052
+ import { useEffect as useEffect14, useMemo as useMemo7, useRef as useRef13, useState as useState17 } 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 useRef10, useState as useState14 } from "react";
10056
+ import { useEffect as useEffect13, useRef as useRef11, useState as useState15 } from "react";
10057
10057
 
10058
10058
  // src/rfa-authorization-destination.tsx
10059
- import { useEffect as useEffect12, useRef as useRef9, useState as useState13 } from "react";
10060
- import { normalizeRfaFax, rfaAuthorizationDestinations, rfaAuthorizationGuidance as rfaAuthorizationGuidance2 } from "@mindbill/browser";
10059
+ import { useEffect as useEffect12, useRef as useRef10, useState as useState14 } from "react";
10060
+
10061
+ // src/rfa-identity-select.tsx
10062
+ import { useId as useId5, useRef as useRef9, useState as useState13 } from "react";
10061
10063
  import { Fragment as Fragment12, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
10062
- function RfaAuthorizationDestination({ contextKey, directory, savedContact, loading = false, error, disabled = false, onChange, onSelectionStart, compact = false }) {
10064
+ function RfaIdentitySelect({ label: label5, placeholder, searchPlaceholder, query, searchable, disabled = false, loading = false, error = "", value, options, onSearch, onSelect }) {
10065
+ const id = useId5();
10066
+ const trigger = useRef9(null);
10067
+ const [open, setOpen] = useState13(false);
10068
+ const [active, setActive] = useState13(0);
10069
+ const selected = options.find((option) => option.id === value);
10070
+ const choose = (option) => {
10071
+ onSelect(option.id);
10072
+ setOpen(false);
10073
+ trigger.current?.focus();
10074
+ };
10075
+ return /* @__PURE__ */ jsxs20("div", { className: "mbrfa-identity-select", onBlur: (event) => {
10076
+ if (!event.currentTarget.contains(event.relatedTarget)) setOpen(false);
10077
+ }, onKeyDown: (event) => {
10078
+ if (event.key === "Escape") {
10079
+ event.preventDefault();
10080
+ setOpen(false);
10081
+ trigger.current?.focus();
10082
+ }
10083
+ }, children: [
10084
+ /* @__PURE__ */ jsx22("style", { children: `.mbrfa-identity-select{position:relative;min-width:0}.mbrfa-identity-select>button{display:flex;justify-content:space-between;align-items:center;width:100%;text-align:left;gap:12px;min-height:44px}.mbrfa-identity-select small{display:block;opacity:.75;font-size:12px;margin-top:3px}.mbrfa-identity-select>button{height:44px}.mbrfa-identity-value{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mbrfa-identity-value small{display:inline;margin:0}.mbrfa-identity-menu{position:absolute;z-index:40;top:calc(100% + 6px);left:0;right:0;padding:10px;background:var(--mbtd-surface,#fff);color:inherit;border:1px solid var(--mbtd-border,#d6d3cc);border-radius:8px;box-shadow:0 8px 24px #0002}.mbrfa-identity-menu input{width:100%;box-sizing:border-box}.mbrfa-identity-options{max-height:280px;overflow:auto;margin-top:6px}.mbrfa-identity-options button{display:block;width:100%;text-align:left;padding:10px 12px;border:0;border-radius:4px;min-height:44px}.mbrfa-identity-options button:hover,.mbrfa-identity-options button[data-active=true]{background:#1c595918}.mbrfa-identity-menu p{padding:8px;margin:0}` }),
10085
+ /* @__PURE__ */ jsxs20("button", { ref: trigger, type: "button", "aria-label": label5, "aria-haspopup": "listbox", "aria-expanded": open, "aria-controls": open ? `${id}-list` : void 0, disabled, onClick: () => {
10086
+ setOpen(!open);
10087
+ setActive(0);
10088
+ }, children: [
10089
+ /* @__PURE__ */ jsx22("span", { className: "mbrfa-identity-value", children: selected ? /* @__PURE__ */ jsxs20(Fragment12, { children: [
10090
+ selected.label,
10091
+ selected.detail ? /* @__PURE__ */ jsxs20("small", { children: [
10092
+ " \xB7 ",
10093
+ selected.detail
10094
+ ] }) : null
10095
+ ] }) : placeholder }),
10096
+ /* @__PURE__ */ jsx22("span", { "aria-hidden": "true", children: "\u2304" })
10097
+ ] }),
10098
+ open ? /* @__PURE__ */ jsxs20("div", { className: "mbrfa-identity-menu", children: [
10099
+ searchable ? /* @__PURE__ */ jsx22("input", { autoFocus: true, role: "combobox", "aria-label": searchPlaceholder, "aria-autocomplete": "list", "aria-expanded": "true", "aria-controls": `${id}-list`, "aria-activedescendant": !loading && !error && options[active] ? `${id}-${active}` : void 0, type: "search", autoComplete: "off", maxLength: 200, placeholder: searchPlaceholder, value: query, onChange: (event) => {
10100
+ setActive(0);
10101
+ onSearch(event.target.value);
10102
+ }, onKeyDown: (event) => {
10103
+ if (loading || error || !options.length) return;
10104
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
10105
+ event.preventDefault();
10106
+ const next = (active + (event.key === "ArrowDown" ? 1 : -1) + options.length) % options.length;
10107
+ setActive(next);
10108
+ document.getElementById(`${id}-${next}`)?.scrollIntoView({ block: "nearest" });
10109
+ }
10110
+ if (event.key === "Enter" && options[active]) {
10111
+ event.preventDefault();
10112
+ choose(options[active]);
10113
+ }
10114
+ } }) : null,
10115
+ /* @__PURE__ */ jsx22("div", { className: "mbrfa-identity-options", id: `${id}-list`, role: "listbox", "aria-label": label5, "aria-busy": loading, children: loading ? /* @__PURE__ */ jsx22("p", { role: "status", children: "Searching\u2026" }) : error ? /* @__PURE__ */ jsx22("p", { role: "alert", children: error }) : options.length ? options.map((option, index) => /* @__PURE__ */ jsxs20("button", { type: "button", role: "option", id: `${id}-${index}`, "aria-selected": option.id === value, "data-active": index === active, onMouseDown: (event) => event.preventDefault(), onClick: () => choose(option), children: [
10116
+ option.label,
10117
+ option.detail ? /* @__PURE__ */ jsx22("small", { children: option.detail }) : null
10118
+ ] }, option.id)) : /* @__PURE__ */ jsx22("p", { children: "No matches. Try another search." }) })
10119
+ ] }) : null
10120
+ ] });
10121
+ }
10122
+
10123
+ // src/rfa-authorization-destination.tsx
10124
+ 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 }) {
10063
10127
  const options = loading || error ? [] : rfaAuthorizationDestinations(directory);
10064
10128
  const fax = savedContact?.fax ? normalizeRfaFax(savedContact.fax) : null;
10065
10129
  const savedLabel = savedContact?.contactName || savedContact?.name || "Saved request contact";
10066
10130
  if (fax && !options.some((option) => option.method === "fax" && option.destination === fax)) options.unshift({ method: "fax", destination: fax, label: savedLabel, ...savedContact?.contactName ? { recipientName: savedContact.contactName } : {} });
10067
10131
  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 } : {} });
10068
10132
  const signature = JSON.stringify([contextKey, directory?.authorizationStatus, options, loading, error]);
10069
- const [selection, setSelection] = useState13("");
10070
- const [manual, setManual] = useState13("");
10071
- const [contactName, setContactName] = useState13("");
10133
+ const [selection, setSelection] = useState14("");
10134
+ const [manual, setManual] = useState14("");
10135
+ const [query, setQuery] = useState14("");
10136
+ const [contactName, setContactName] = useState14("");
10072
10137
  const needsAdjuster = directory?.authorizationStatus === "adjuster_specific_required";
10073
- const callback = useRef9(onChange);
10138
+ const callback = useRef10(onChange);
10074
10139
  callback.current = onChange;
10075
10140
  useEffect12(() => {
10076
10141
  setSelection("");
@@ -10092,104 +10157,125 @@ function RfaAuthorizationDestination({ contextKey, directory, savedContact, load
10092
10157
  })() : nextSelection === "manual-email" ? /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value.trim()) ? { method: "email", destination: value.trim(), label: "Confirmed authorization email" } : null : nextSelection === "" ? null : options[Number(nextSelection)] ?? null;
10093
10158
  onChange(selected ? { ...selected, ...recipientName ? { recipientName } : {} } : null);
10094
10159
  };
10095
- const guidance = /* @__PURE__ */ jsxs20(Fragment12, { children: [
10096
- /* @__PURE__ */ jsx22("p", { style: { margin: 0 }, children: loading ? "Loading authorization contacts\u2026" : error ? "Directory details are unavailable. Confirm a destination with the handling adjuster." : rfaAuthorizationGuidance2(directory) }),
10097
- directory?.authorizationNotice ? /* @__PURE__ */ jsx22("p", { style: { margin: 0 }, children: directory.authorizationNotice }) : null
10160
+ const pick = (value) => {
10161
+ setSelection(value);
10162
+ setManual("");
10163
+ const name = options[Number(value)]?.recipientName ?? "";
10164
+ setContactName(name);
10165
+ emit(value, "", name);
10166
+ };
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
10098
10170
  ] });
10099
- return /* @__PURE__ */ jsxs20("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: [
10100
- compact ? null : /* @__PURE__ */ jsxs20(Fragment12, { children: [
10101
- /* @__PURE__ */ jsx22("legend", { children: "Authorization destination" }),
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" }),
10102
10174
  guidance
10103
10175
  ] }),
10104
- /* @__PURE__ */ jsxs20("label", { style: { display: "grid", gap: 6, minWidth: 0 }, children: [
10105
- compact ? /* @__PURE__ */ jsx22("span", { className: "mbrfa-visually-hidden", children: "Authorization contact" }) : directory?.authorizationStatus === "claim_handling_location_routes" ? "Claim-handling office" : "Authorization contact",
10106
- /* @__PURE__ */ jsxs20("select", { value: selection, onChange: (event) => {
10107
- const value = event.target.value;
10108
- setSelection(value);
10109
- setManual("");
10110
- const name = options[Number(value)]?.recipientName ?? "";
10111
- setContactName(name);
10112
- emit(value, "", name);
10113
- }, style: { padding: 10, width: "100%", minWidth: 0, maxWidth: "100%", font: "inherit" }, children: [
10114
- /* @__PURE__ */ jsx22("option", { value: "", children: "Choose a destination\u2026" }),
10115
- options.map((option, index) => /* @__PURE__ */ jsxs20("option", { value: String(index), children: [
10176
+ compact ? /* @__PURE__ */ jsx23(
10177
+ RfaIdentitySelect,
10178
+ {
10179
+ label: directory?.authorizationStatus === "claim_handling_location_routes" ? "Claim-handling office" : "Authorization contact",
10180
+ placeholder: "Choose a destination",
10181
+ searchPlaceholder: "Search offices, fax numbers or e-mail",
10182
+ query,
10183
+ onSearch: setQuery,
10184
+ searchable: true,
10185
+ disabled: disabled || loading,
10186
+ 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())),
10188
+ onSelect: (value) => {
10189
+ setQuery("");
10190
+ if (value === "manual-entry") {
10191
+ onManualEntry?.();
10192
+ return;
10193
+ }
10194
+ pick(value);
10195
+ }
10196
+ }
10197
+ ) : /* @__PURE__ */ jsxs21("label", { style: { display: "grid", gap: 6, minWidth: 0 }, children: [
10198
+ 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: [
10116
10202
  option.label,
10117
10203
  " \xB7 ",
10118
10204
  option.method === "fax" ? "Fax" : "Email",
10119
10205
  ": ",
10120
10206
  option.destination
10121
10207
  ] }, `${option.method}:${option.destination}:${index}`)),
10122
- /* @__PURE__ */ jsx22("option", { value: "manual", children: needsAdjuster ? "Enter the handling adjuster\u2019s fax" : "Enter another confirmed authorization fax" }),
10123
- /* @__PURE__ */ jsx22("option", { value: "manual-email", children: "Enter a confirmed authorization email" })
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" })
10124
10210
  ] })
10125
10211
  ] }),
10126
- selection !== "" && (needsAdjuster || selection === "manual" || selection === "manual-email") ? /* @__PURE__ */ jsxs20("label", { style: { display: "grid", gap: 6 }, children: [
10212
+ selection !== "" && (needsAdjuster || selection === "manual" || selection === "manual-email") ? /* @__PURE__ */ jsxs21("label", { style: { display: "grid", gap: 6 }, children: [
10127
10213
  needsAdjuster ? "Handling adjuster name (required)" : "Recipient / attention (optional)",
10128
- /* @__PURE__ */ jsx22("input", { value: contactName, maxLength: 200, required: needsAdjuster, onChange: (event) => {
10214
+ /* @__PURE__ */ jsx23("input", { value: contactName, maxLength: 200, required: needsAdjuster, onChange: (event) => {
10129
10215
  setContactName(event.target.value);
10130
10216
  emit(selection, manual, event.target.value);
10131
10217
  } })
10132
10218
  ] }) : null,
10133
- selection === "manual-email" ? /* @__PURE__ */ jsxs20("label", { children: [
10219
+ selection === "manual-email" ? /* @__PURE__ */ jsxs21("label", { children: [
10134
10220
  "Authorization email address",
10135
- /* @__PURE__ */ jsx22("input", { type: "email", value: manual, onChange: (event) => {
10221
+ /* @__PURE__ */ jsx23("input", { type: "email", value: manual, onChange: (event) => {
10136
10222
  const value = event.target.value;
10137
10223
  setManual(value);
10138
10224
  emit(selection, value, contactName);
10139
10225
  } })
10140
- ] }) : selection === "manual" ? /* @__PURE__ */ jsxs20("label", { style: { display: "grid", gap: 6, minWidth: 0 }, children: [
10226
+ ] }) : selection === "manual" ? /* @__PURE__ */ jsxs21("label", { style: { display: "grid", gap: 6, minWidth: 0 }, children: [
10141
10227
  "Authorization fax number",
10142
- /* @__PURE__ */ jsx22("input", { type: "tel", value: manual, onChange: (event) => {
10228
+ /* @__PURE__ */ jsx23("input", { type: "tel", value: manual, onChange: (event) => {
10143
10229
  const value = event.target.value;
10144
10230
  setManual(value);
10145
10231
  emit(selection, value, contactName);
10146
10232
  }, style: { padding: 10, width: "100%", minWidth: 0, boxSizing: "border-box", font: "inherit" } })
10147
- ] }) : selection !== "" && chosen ? /* @__PURE__ */ jsxs20(Fragment12, { children: [
10148
- chosen.method === "email" ? /* @__PURE__ */ jsxs20("p", { style: { margin: 0, overflowWrap: "anywhere" }, children: [
10233
+ ] }) : selection !== "" && chosen ? /* @__PURE__ */ jsxs21(Fragment13, { children: [
10234
+ chosen.method === "email" ? /* @__PURE__ */ jsxs21("p", { style: { margin: 0, overflowWrap: "anywhere" }, children: [
10149
10235
  "Email: ",
10150
10236
  chosen.destination,
10151
10237
  ". Review this recipient before preparing and sending the packet."
10152
10238
  ] }) : null,
10153
- chosen.phone ? /* @__PURE__ */ jsxs20("small", { children: [
10239
+ chosen.phone ? /* @__PURE__ */ jsxs21("small", { children: [
10154
10240
  "Telephone for questions: ",
10155
10241
  chosen.phone
10156
10242
  ] }) : null
10157
10243
  ] }) : null,
10158
- compact ? /* @__PURE__ */ jsx22("small", { className: "mbrfa-guidance", children: guidance }) : null
10244
+ compact ? /* @__PURE__ */ jsx23("small", { className: "mbrfa-guidance", children: guidance }) : null
10159
10245
  ] });
10160
10246
  }
10161
10247
 
10162
10248
  // src/rfa-delivery-panel.tsx
10163
- import { Fragment as Fragment13, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
10249
+ import { Fragment as Fragment14, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
10164
10250
  function RfaPdfReview({ blob, title }) {
10165
- const [url, setUrl] = useState14("");
10251
+ const [url, setUrl] = useState15("");
10166
10252
  useEffect13(() => {
10167
10253
  const next = URL.createObjectURL(blob);
10168
10254
  setUrl(next);
10169
10255
  return () => URL.revokeObjectURL(next);
10170
10256
  }, [blob]);
10171
- return /* @__PURE__ */ jsx23("div", { children: url ? /* @__PURE__ */ jsxs21(Fragment13, { children: [
10172
- /* @__PURE__ */ jsxs21("div", { className: "mbtd-actions", children: [
10173
- /* @__PURE__ */ jsxs21("a", { href: url, target: "_blank", rel: "noopener noreferrer", children: [
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: [
10174
10260
  "Open ",
10175
10261
  title,
10176
10262
  " PDF"
10177
10263
  ] }),
10178
- /* @__PURE__ */ jsx23("a", { href: url, download: "authorization-packet.pdf", children: "Download PDF" })
10264
+ /* @__PURE__ */ jsx24("a", { href: url, download: "authorization-packet.pdf", children: "Download PDF" })
10179
10265
  ] }),
10180
- /* @__PURE__ */ jsx23("iframe", { title, src: url, style: { width: "100%", height: 420, border: "1px solid var(--mb-border)", marginTop: 10 } })
10266
+ /* @__PURE__ */ jsx24("iframe", { title, src: url, style: { width: "100%", height: 420, border: "1px solid var(--mb-border)", marginTop: 10 } })
10181
10267
  ] }) : null });
10182
10268
  }
10183
10269
  function RfaDeliveryPanel({ rfa, client, documentIds, directory, directoryLoading, directoryError, locked, environment, canSend, run, onUpdated }) {
10184
- const [mode, setMode] = useState14("send");
10185
- const [destination, setDestination] = useState14(null);
10186
- const [message, setMessage] = useState14("");
10187
- const [prepared, setPrepared] = useState14(null);
10188
- const [reviewed, setReviewed] = useState14(false);
10189
- const [confirmed, setConfirmed] = useState14(false);
10190
- const keys = useRef10(/* @__PURE__ */ new Map());
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);
10276
+ const keys = useRef11(/* @__PURE__ */ new Map());
10191
10277
  const fingerprint = JSON.stringify([rfa.id, rfa.contentRevision, documentIds, mode, destination?.method, destination?.destination, destination?.recipientName, message.trim()]);
10192
- const current = useRef10(fingerprint);
10278
+ const current = useRef11(fingerprint);
10193
10279
  current.current = fingerprint;
10194
10280
  useEffect13(() => {
10195
10281
  setPrepared(null);
@@ -10197,26 +10283,26 @@ function RfaDeliveryPanel({ rfa, client, documentIds, directory, directoryLoadin
10197
10283
  setConfirmed(false);
10198
10284
  }, [fingerprint]);
10199
10285
  const packet = prepared?.fingerprint === fingerprint ? prepared : null;
10200
- return /* @__PURE__ */ jsxs21("fieldset", { children: [
10201
- /* @__PURE__ */ jsx23("legend", { children: "Review packet and send" }),
10202
- !rfa.readiness.ready ? /* @__PURE__ */ jsxs21("p", { children: [
10286
+ return /* @__PURE__ */ jsxs22("fieldset", { children: [
10287
+ /* @__PURE__ */ jsx24("legend", { children: "Review packet and send" }),
10288
+ !rfa.readiness.ready ? /* @__PURE__ */ jsxs22("p", { children: [
10203
10289
  "Still needed: ",
10204
10290
  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",
10205
10291
  "."
10206
10292
  ] }) : null,
10207
- /* @__PURE__ */ jsxs21("label", { children: [
10293
+ /* @__PURE__ */ jsxs22("label", { children: [
10208
10294
  "Delivery method",
10209
- /* @__PURE__ */ jsxs21("select", { disabled: locked, value: mode, onChange: (event) => setMode(event.target.value), children: [
10210
- /* @__PURE__ */ jsx23("option", { value: "send", children: "Send to claims administrator" }),
10211
- /* @__PURE__ */ jsx23("option", { value: "download", children: "Download for manual submission" })
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" })
10212
10298
  ] })
10213
10299
  ] }),
10214
- mode === "send" ? /* @__PURE__ */ jsx23(RfaAuthorizationDestination, { contextKey: `${rfa.id}:${rfa.claimsAdminId ?? "manual"}`, directory, savedContact: rfa.authorizationContact, loading: directoryLoading, error: directoryError, disabled: locked, onChange: setDestination }) : /* @__PURE__ */ jsx23("p", { children: "Downloading does not mark this request as sent. Keep proof of any submission made outside this dashboard." }),
10215
- /* @__PURE__ */ jsxs21("label", { children: [
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: [
10216
10302
  destination?.method === "email" && mode === "send" ? "Email message (optional)" : "Fax cover sheet message (optional)",
10217
- /* @__PURE__ */ jsx23("textarea", { disabled: locked, maxLength: 1e3, rows: 3, value: message, onChange: (event) => setMessage(event.target.value) })
10303
+ /* @__PURE__ */ jsx24("textarea", { disabled: locked, maxLength: 1e3, rows: 3, value: message, onChange: (event) => setMessage(event.target.value) })
10218
10304
  ] }),
10219
- /* @__PURE__ */ jsx23("button", { type: "button", disabled: locked || !rfa.signedAt || documentIds.length < 2 || mode === "send" && !destination, onClick: () => void run(async () => {
10305
+ /* @__PURE__ */ jsx24("button", { type: "button", disabled: locked || !rfa.signedAt || documentIds.length < 2 || mode === "send" && !destination, onClick: () => void run(async () => {
10220
10306
  const requestFingerprint = fingerprint;
10221
10307
  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() } : {} });
10222
10308
  const blob = await client.getPacket(rfa.id, preview.packetId);
@@ -10226,25 +10312,25 @@ function RfaDeliveryPanel({ rfa, client, documentIds, directory, directoryLoadin
10226
10312
  setConfirmed(false);
10227
10313
  }
10228
10314
  }), children: "Prepare packet with cover sheet" }),
10229
- packet ? /* @__PURE__ */ jsxs21(Fragment13, { children: [
10230
- /* @__PURE__ */ jsx23(RfaPdfReview, { blob: packet.blob, title: "RFA submission packet" }),
10231
- /* @__PURE__ */ jsxs21("label", { className: "mbrfa-check", children: [
10232
- /* @__PURE__ */ jsx23("input", { type: "checkbox", disabled: locked, checked: reviewed, onChange: (event) => {
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) => {
10233
10319
  setReviewed(event.target.checked);
10234
10320
  setConfirmed(false);
10235
10321
  } }),
10236
10322
  "I reviewed the assembled packet, including the cover sheet and clinical documents."
10237
10323
  ] })
10238
10324
  ] }) : null,
10239
- mode === "send" ? environment !== "live" ? /* @__PURE__ */ jsx23("p", { className: "mbtd-note", children: "Sandbox: review and prepare the packet here. External fax delivery is disabled. Email sending is also disabled." }) : !canSend ? /* @__PURE__ */ jsx23("p", { children: "Sending requires permission from your organization." }) : /* @__PURE__ */ jsxs21(Fragment13, { children: [
10240
- /* @__PURE__ */ jsxs21("label", { className: "mbrfa-check", children: [
10241
- /* @__PURE__ */ jsx23("input", { type: "checkbox", disabled: locked || !packet || !reviewed || !destination, checked: confirmed && !!packet, onChange: (event) => setConfirmed(event.target.checked) }),
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) }),
10242
10328
  "Send this reviewed packet to ",
10243
10329
  destination?.recipientName ? `${destination.recipientName} at ` : "",
10244
10330
  destination?.destination || "the selected authorization recipient",
10245
10331
  ". I verified the recipient for this claim."
10246
10332
  ] }),
10247
- /* @__PURE__ */ jsx23("button", { type: "button", className: "mbtd-primary", disabled: locked || !confirmed || !reviewed || !packet || !destination || !rfa.readiness.ready || !!rfa.submittedAt, onClick: () => void run(async () => {
10333
+ /* @__PURE__ */ jsx24("button", { type: "button", className: "mbtd-primary", disabled: locked || !confirmed || !reviewed || !packet || !destination || !rfa.readiness.ready || !!rfa.submittedAt, onClick: () => void run(async () => {
10248
10334
  if (!packet || !destination || !confirmed || !reviewed) return;
10249
10335
  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() } : {} };
10250
10336
  const signature = JSON.stringify(body);
@@ -10260,13 +10346,13 @@ function RfaDeliveryPanel({ rfa, client, documentIds, directory, directoryLoadin
10260
10346
  }
10261
10347
 
10262
10348
  // src/treatment-draft-shared.tsx
10263
- import { useRef as useRef11, useState as useState15 } from "react";
10264
- import { Fragment as Fragment14, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
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";
10265
10351
  function useDraftSave(onSave) {
10266
- const pending = useRef11(false);
10267
- const [busy, setBusy] = useState15(false);
10268
- const [message, setMessage] = useState15("");
10269
- const [error, setError] = useState15(null);
10352
+ const pending = useRef12(false);
10353
+ const [busy, setBusy] = useState16(false);
10354
+ const [message, setMessage] = useState16("");
10355
+ const [error, setError] = useState16(null);
10270
10356
  const clear = () => {
10271
10357
  setMessage("");
10272
10358
  setError(null);
@@ -10293,8 +10379,8 @@ function useDraftSave(onSave) {
10293
10379
  return { busy, message, error, clear, save };
10294
10380
  }
10295
10381
  function TreatmentDraftShell({ title, description, children, hideHeading = false, appearance, className = "", style }) {
10296
- return /* @__PURE__ */ jsxs22("section", { className: `mbtd ${className}`.trim(), "aria-label": title, style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
10297
- /* @__PURE__ */ jsx24("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}
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}
10298
10384
  .mbtd .mbrfa-request-details>.mbtd-grid{display:flex;flex-direction:column;gap:12px}
10299
10385
  .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)}
10300
10386
  .mbtd .mbrfa-request-details .mbrfa-check{min-height:44px;align-items:flex-start;gap:10px;line-height:20px;cursor:pointer}
@@ -10314,16 +10400,42 @@ function TreatmentDraftShell({ title, description, children, hideHeading = false
10314
10400
  .mbtd .mbrfa-form-grid .mbrfa-picker{padding-bottom:2px}
10315
10401
  .mbtd .mbrfa-picker a,.mbtd .mbrfa-picker-links{font-size:12px}.mbtd .mbrfa-picker-links{display:flex;gap:12px;flex-wrap:wrap;align-items:center;min-height:18px}
10316
10402
  .mbtd .mbrfa-picker p,.mbtd .mbrfa-guidance p{margin:0;font-size:12px}.mbtd .mbrfa-guidance{display:grid;gap:4px}
10317
- .mbtd button.mbrfa-link.mbrfa-link{border:0;background:none;padding:0;min-height:0;color:var(--mb-accent);font-size:12px;text-decoration:underline}
10403
+ .mbtd .mbrfa-section-actions{display:flex;gap:12px;align-items:center;margin-top:14px;font-size:12px;color:var(--mb-muted)}
10404
+ .mbtd .mbrfa-field-hint{font-size:12px;color:var(--mb-muted);font-weight:400}
10405
+ .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
+ .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}
10318
10407
  .mbtd fieldset.mbrfa-plain.mbrfa-plain{border:0;padding:0;margin:0;background:none;border-radius:0;min-width:0}
10319
10408
  .mbtd .mbrfa-visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
10409
+ .mbtd form.mbrfa-official{gap:18px;counter-reset:mbrfa-section}
10410
+ .mbtd form.mbrfa-official>fieldset{padding:0 20px 20px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);box-shadow:0 1px 2px #0000000a}
10411
+ .mbtd form.mbrfa-official>fieldset>legend{float:left;display:flex;align-items:center;gap:10px;width:calc(100% + 40px);margin:0 -20px;padding:13px 20px;border-bottom:1px solid var(--mb-border);font-size:14px;font-weight:600;letter-spacing:-.005em}
10412
+ .mbtd form.mbrfa-official>fieldset>legend+*{clear:both}.mbtd form.mbrfa-official>fieldset>legend+:not(.mbrfa-pickers){margin-top:18px}
10413
+ .mbtd form.mbrfa-official>fieldset>legend::before{counter-increment:mbrfa-section;content:counter(mbrfa-section);display:grid;place-items:center;width:22px;height:22px;border-radius:50%;background:color-mix(in srgb,var(--mb-accent) 12%,var(--mb-surface));color:var(--mb-accent);font-size:12px;font-weight:600}
10414
+ .mbtd form.mbrfa-official .mbrfa-pickers{margin:0 -20px 18px;padding:16px 20px;border-bottom:1px solid var(--mb-border);background:var(--mb-soft)}
10415
+ .mbtd form.mbrfa-official .mbrfa-picker>span:first-child{font-size:12px;font-weight:600;letter-spacing:.01em}
10416
+ .mbtd form.mbrfa-official .mbrfa-form-grid{gap:14px 20px}
10417
+ .mbtd form.mbrfa-official .mbrfa-saved>span,.mbtd form.mbrfa-official .mbrfa-form-grid>label{font-size:12px;color:var(--mb-muted);font-weight:500}
10418
+ .mbtd form.mbrfa-official .mbrfa-form-grid>label>:is(input,textarea){color:var(--mb-text)}
10419
+ .mbtd form.mbrfa-official .mbrfa-saved>strong{font-size:14px;font-weight:500;color:var(--mb-text)}
10420
+ .mbtd form.mbrfa-official .mbrfa-request-details>.mbtd-grid{gap:4px}
10421
+ .mbtd form.mbrfa-official .mbrfa-request-types{display:inline-grid;grid-auto-flow:column;grid-template-columns:none;gap:0;padding:3px;margin-bottom:10px;border:1px solid var(--mb-border);border-radius:calc(var(--mb-control-radius) + 3px);background:var(--mb-soft);justify-self:start;width:fit-content;max-width:100%}
10422
+ .mbtd form.mbrfa-official .mbrfa-request-types .mbrfa-check{min-height:34px;padding:6px 16px;border-radius:var(--mb-control-radius);color:var(--mb-muted);font-size:13px}
10423
+ .mbtd form.mbrfa-official .mbrfa-request-types .mbrfa-check:has(input:checked){background:var(--mb-surface);color:var(--mb-text);box-shadow:0 1px 2px #00000014}
10424
+ .mbtd form.mbrfa-official .mbrfa-request-types input[type=radio]{position:absolute;opacity:0;width:1px;height:1px}
10425
+ .mbtd form.mbrfa-official .mbrfa-request-types .mbrfa-check:has(input:focus-visible){outline:2px solid var(--mb-accent);outline-offset:2px}
10426
+ .mbtd form.mbrfa-official .mbrfa-request-details .mbrfa-check{min-height:32px;font-size:13px}
10427
+ .mbtd form.mbrfa-official .mbrfa-section-actions{margin-top:16px;padding-top:12px;border-top:1px dashed var(--mb-border)}
10428
+ .mbtd form.mbrfa-official>div:has(>button:only-child)>button{border-style:dashed;color:var(--mb-accent);font-weight:500}
10429
+ .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}
10430
+ .mbtd form.mbrfa-official>.mbtd-actions:last-child>[role=status]{margin-right:auto;order:9}
10431
+ @media(max-width:760px){.mbtd form.mbrfa-official>.mbtd-actions:last-child{position:static;flex-direction:row}.mbtd form.mbrfa-official .mbrfa-request-types{grid-auto-flow:row;width:100%}}
10320
10432
  @media(max-width:760px){.mbtd .mbrfa-pickers,.mbtd .mbrfa-pickers[data-columns="2"]{grid-template-columns:minmax(0,1fr)}.mbtd .mbrfa-form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.mbtd .mbrfa-form-grid>*{grid-column:1/-1}.mbtd .mbrfa-form-grid>.mbrfa-s1,.mbtd .mbrfa-form-grid>.mbrfa-s2{grid-column:span 1}}
10321
10433
  @media(max-width:640px){.mbtd .mbrfa-request-types{grid-template-columns:1fr;gap:4px}}
10322
10434
  @media(forced-colors:active){.mbtd .mbrfa-request-types input[type=radio]{appearance:auto}.mbtd .mbrfa-request-types input[type=radio]::after{display:none}}
10323
10435
  .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}}` }),
10324
- !hideHeading ? /* @__PURE__ */ jsxs22(Fragment14, { children: [
10325
- /* @__PURE__ */ jsx24("h2", { children: title }),
10326
- /* @__PURE__ */ jsx24("p", { children: description })
10436
+ !hideHeading ? /* @__PURE__ */ jsxs23(Fragment15, { children: [
10437
+ /* @__PURE__ */ jsx25("h2", { children: title }),
10438
+ /* @__PURE__ */ jsx25("p", { children: description })
10327
10439
  ] }) : null,
10328
10440
  children
10329
10441
  ] });
@@ -10333,7 +10445,7 @@ function isDraftDate(value) {
10333
10445
  }
10334
10446
 
10335
10447
  // src/rfa-task-board.tsx
10336
- import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
10448
+ import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
10337
10449
  function rfaTaskState(task, now = Date.now()) {
10338
10450
  if (task.status === "resolved" || task.resolvedAt) return "Completed";
10339
10451
  return Date.parse(task.snoozedUntil ?? task.dueAt) > now ? "Scheduled" : "Due";
@@ -10375,30 +10487,30 @@ var date3 = (value) => new Date(value).toLocaleString();
10375
10487
  function RfaTaskBoard({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride, ...props }) {
10376
10488
  const options = useMemo7(() => ({ ...sessionEndpoint ? { sessionEndpoint } : {}, ...getSession ? { getSession } : {}, ...apiBaseUrl ? { apiBaseUrl } : {}, ...fetchOverride ? { fetch: fetchOverride } : {} }), [sessionEndpoint, getSession, apiBaseUrl, fetchOverride]);
10377
10489
  const identity = useMemo7(() => crypto.randomUUID(), [options]);
10378
- return /* @__PURE__ */ jsx25(TaskBoardContent, { ...props, options }, `${identity}:${props.patientId ?? ""}:${props.claimId ?? ""}:${props.renderingProviderId ?? ""}`);
10490
+ return /* @__PURE__ */ jsx26(TaskBoardContent, { ...props, options }, `${identity}:${props.patientId ?? ""}:${props.claimId ?? ""}:${props.renderingProviderId ?? ""}`);
10379
10491
  }
10380
10492
  function TaskBoardContent({ options, patientId, claimId, renderingProviderId, permissions = [], onSelect, embedded = false, presentation = "dashboard", query, getTaskHref, onNavigate, renderTaskIdentity, ...appearance }) {
10381
10493
  const client = useMemo7(() => createRfaLifecycleClient(options), [options]);
10382
10494
  const requests = useMemo7(() => createRfaClient(options), [options]);
10383
- const [requestIdentities, setRequestIdentities] = useState16({});
10384
- const [tasks, setTasks] = useState16([]);
10385
- const [error, setError] = useState16("");
10386
- const [loading, setLoading] = useState16(true);
10387
- const [now, setNow] = useState16(Date.now);
10388
- const [inboxCount, setInboxCount] = useState16(null);
10495
+ const [requestIdentities, setRequestIdentities] = useState17({});
10496
+ const [tasks, setTasks] = useState17([]);
10497
+ const [error, setError] = useState17("");
10498
+ const [loading, setLoading] = useState17(true);
10499
+ const [now, setNow] = useState17(Date.now);
10500
+ const [inboxCount, setInboxCount] = useState17(null);
10389
10501
  useEffect14(() => {
10390
10502
  const timer = setInterval(() => setNow(Date.now()), 6e4);
10391
10503
  return () => clearInterval(timer);
10392
10504
  }, []);
10393
- const [view, setView] = useState16(query?.state ?? "Due");
10394
- const [selection, setSelection] = useState16(null);
10505
+ const [view, setView] = useState17(query?.state ?? "Due");
10506
+ const [selection, setSelection] = useState17(null);
10395
10507
  const list3 = presentation === "list";
10396
10508
  useEffect14(() => {
10397
10509
  setView(query?.state ?? "Due");
10398
10510
  setSelection(null);
10399
10511
  }, [query]);
10400
10512
  const activeSelection = list3 ? query ?? {} : selection;
10401
- const drilldown = useRef12(null);
10513
+ const drilldown = useRef13(null);
10402
10514
  useEffect14(() => {
10403
10515
  if (selection) {
10404
10516
  drilldown.current?.scrollIntoView?.({ block: "nearest" });
@@ -10481,15 +10593,15 @@ function TaskBoardContent({ options, patientId, claimId, renderingProviderId, pe
10481
10593
  if (renderTaskIdentity) return renderTaskIdentity(task);
10482
10594
  if (!list3) return null;
10483
10595
  const record2 = requestIdentities[task.rfaId];
10484
- return record2 ? /* @__PURE__ */ jsxs23("div", { className: "mbrfa-task-identity", children: [
10485
- /* @__PURE__ */ jsx25("span", { children: record2.employeeName }),
10486
- /* @__PURE__ */ jsxs23("small", { children: [
10596
+ return record2 ? /* @__PURE__ */ jsxs24("div", { className: "mbrfa-task-identity", children: [
10597
+ /* @__PURE__ */ jsx26("span", { children: record2.employeeName }),
10598
+ /* @__PURE__ */ jsxs24("small", { children: [
10487
10599
  "Claim ",
10488
10600
  record2.claimNumber || record2.claimId,
10489
10601
  record2.displayReference ? ` \xB7 ${record2.displayReference}` : ""
10490
10602
  ] }),
10491
- /* @__PURE__ */ jsx25("small", { children: record2.items?.map((item) => item.serviceDescription).filter(Boolean).join("; ") || "Request for authorization" })
10492
- ] }) : /* @__PURE__ */ jsxs23("small", { children: [
10603
+ /* @__PURE__ */ jsx26("small", { children: record2.items?.map((item) => item.serviceDescription).filter(Boolean).join("; ") || "Request for authorization" })
10604
+ ] }) : /* @__PURE__ */ jsxs24("small", { children: [
10493
10605
  "Request ",
10494
10606
  task.rfaId,
10495
10607
  " \xB7 Claim ",
@@ -10501,19 +10613,19 @@ function TaskBoardContent({ options, patientId, claimId, renderingProviderId, pe
10501
10613
  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");
10502
10614
  const selectionControl = (next, text3, ariaLabel) => {
10503
10615
  const target = { ...next, state: view };
10504
- if (!getTaskHref) return /* @__PURE__ */ jsx25("button", { type: "button", className: ariaLabel ? "mbrfa-task-count" : void 0, ...ariaLabel ? { "aria-label": ariaLabel } : {}, onClick: () => setSelection(next), children: text3 });
10616
+ if (!getTaskHref) return /* @__PURE__ */ jsx26("button", { type: "button", className: ariaLabel ? "mbrfa-task-count" : void 0, ...ariaLabel ? { "aria-label": ariaLabel } : {}, onClick: () => setSelection(next), children: text3 });
10505
10617
  const href = getTaskHref(target);
10506
- return /* @__PURE__ */ jsx25("a", { href, className: ariaLabel ? "mbrfa-task-count" : "mbrfa-route-link", ...ariaLabel ? { "aria-label": ariaLabel } : {}, onClick: (event) => {
10618
+ return /* @__PURE__ */ jsx26("a", { href, className: ariaLabel ? "mbrfa-task-count" : "mbrfa-route-link", ...ariaLabel ? { "aria-label": ariaLabel } : {}, onClick: (event) => {
10507
10619
  if (!onNavigate || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
10508
10620
  event.preventDefault();
10509
10621
  onNavigate(href);
10510
10622
  }, children: text3 });
10511
10623
  };
10512
- 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__ */ jsx25("span", { className: "mbrfa-task-zero", children: "0" });
10513
- return /* @__PURE__ */ jsxs23(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: [
10514
- /* @__PURE__ */ jsx25("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}}` }),
10515
- /* @__PURE__ */ jsx25("strong", { children: "Task status" }),
10516
- /* @__PURE__ */ jsx25("div", { className: "mbrfa-task-tabs", role: "group", "aria-label": "Task status", children: ["Due", "Scheduled", "Completed"].map((state) => /* @__PURE__ */ jsxs23("button", { type: "button", "aria-pressed": view === state, onClick: () => {
10624
+ 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" });
10625
+ 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: [
10626
+ /* @__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}}` }),
10627
+ /* @__PURE__ */ jsx26("strong", { children: "Task status" }),
10628
+ /* @__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: () => {
10517
10629
  if (list3 && getTaskHref) {
10518
10630
  const href = getTaskHref({ ...query, state });
10519
10631
  if (onNavigate) onNavigate(href);
@@ -10528,118 +10640,118 @@ function TaskBoardContent({ options, patientId, claimId, renderingProviderId, pe
10528
10640
  tasks.filter((task) => rfaTaskState(task, now) === state).length,
10529
10641
  ")"
10530
10642
  ] }, state)) }),
10531
- /* @__PURE__ */ jsx25("p", { className: "mbtd-note", children: taskViewDescriptions[view] }),
10532
- error ? /* @__PURE__ */ jsx25("p", { role: "alert", children: error }) : null,
10533
- loading ? /* @__PURE__ */ jsx25("p", { role: "status", children: "Loading tasks\u2026" }) : !error && !stateTasks.length ? /* @__PURE__ */ jsxs23("p", { children: [
10643
+ /* @__PURE__ */ jsx26("p", { className: "mbtd-note", children: taskViewDescriptions[view] }),
10644
+ error ? /* @__PURE__ */ jsx26("p", { role: "alert", children: error }) : null,
10645
+ loading ? /* @__PURE__ */ jsx26("p", { role: "status", children: "Loading tasks\u2026" }) : !error && !stateTasks.length ? /* @__PURE__ */ jsxs24("p", { children: [
10534
10646
  "No ",
10535
10647
  view.toLowerCase(),
10536
10648
  " tasks."
10537
10649
  ] }) : null,
10538
- !list3 && !loading && stateTasks.length ? /* @__PURE__ */ jsx25("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,
10650
+ !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,
10539
10651
  !list3 ? groups2.map((group) => {
10540
10652
  const groupTasks = stateTasks.filter((task) => group.kinds.includes(task.kind));
10541
- return /* @__PURE__ */ jsx25("section", { className: "mbrfa-task-group", "aria-label": group.title, children: /* @__PURE__ */ jsxs23("table", { children: [
10542
- /* @__PURE__ */ jsx25("thead", { children: /* @__PURE__ */ jsxs23("tr", { children: [
10543
- /* @__PURE__ */ jsxs23("th", { scope: "col", children: [
10653
+ return /* @__PURE__ */ jsx26("section", { className: "mbrfa-task-group", "aria-label": group.title, children: /* @__PURE__ */ jsxs24("table", { children: [
10654
+ /* @__PURE__ */ jsx26("thead", { children: /* @__PURE__ */ jsxs24("tr", { children: [
10655
+ /* @__PURE__ */ jsxs24("th", { scope: "col", children: [
10544
10656
  group.title,
10545
- /* @__PURE__ */ jsx25("small", { children: "By date task opened" })
10657
+ /* @__PURE__ */ jsx26("small", { children: "By date task opened" })
10546
10658
  ] }),
10547
- columns.map((column) => /* @__PURE__ */ jsx25("th", { scope: "col", children: /* @__PURE__ */ jsx25("span", { className: "mbrfa-task-age", children: column.label }) }, column.key)),
10548
- /* @__PURE__ */ jsx25("th", { scope: "col", children: "Task total" })
10659
+ columns.map((column) => /* @__PURE__ */ jsx26("th", { scope: "col", children: /* @__PURE__ */ jsx26("span", { className: "mbrfa-task-age", children: column.label }) }, column.key)),
10660
+ /* @__PURE__ */ jsx26("th", { scope: "col", children: "Task total" })
10549
10661
  ] }) }),
10550
- /* @__PURE__ */ jsx25("tbody", { children: group.kinds.filter((kind) => groupTasks.some((task) => task.kind === kind)).map((kind) => {
10662
+ /* @__PURE__ */ jsx26("tbody", { children: group.kinds.filter((kind) => groupTasks.some((task) => task.kind === kind)).map((kind) => {
10551
10663
  const items = groupTasks.filter((task) => task.kind === kind);
10552
- return /* @__PURE__ */ jsxs23("tr", { children: [
10553
- /* @__PURE__ */ jsxs23("th", { scope: "row", children: [
10664
+ return /* @__PURE__ */ jsxs24("tr", { children: [
10665
+ /* @__PURE__ */ jsxs24("th", { scope: "row", children: [
10554
10666
  rfaTaskLabel(kind),
10555
- descriptions[kind] && /* @__PURE__ */ jsx25("small", { children: descriptions[kind] })
10667
+ descriptions[kind] && /* @__PURE__ */ jsx26("small", { children: descriptions[kind] })
10556
10668
  ] }),
10557
- columns.map((column) => /* @__PURE__ */ jsx25("td", { children: countCell(items.filter((task) => rfaTaskAgeBucket(task.createdAt, now) === column.key), kind, column.key) }, column.key)),
10558
- /* @__PURE__ */ jsx25("td", { children: countCell(items, kind) })
10669
+ columns.map((column) => /* @__PURE__ */ jsx26("td", { children: countCell(items.filter((task) => rfaTaskAgeBucket(task.createdAt, now) === column.key), kind, column.key) }, column.key)),
10670
+ /* @__PURE__ */ jsx26("td", { children: countCell(items, kind) })
10559
10671
  ] }, kind);
10560
10672
  }) }),
10561
- /* @__PURE__ */ jsx25("tfoot", { children: /* @__PURE__ */ jsxs23("tr", { children: [
10562
- /* @__PURE__ */ jsx25("th", { scope: "row", children: "Total" }),
10673
+ /* @__PURE__ */ jsx26("tfoot", { children: /* @__PURE__ */ jsxs24("tr", { children: [
10674
+ /* @__PURE__ */ jsx26("th", { scope: "row", children: "Total" }),
10563
10675
  [...columns, { key: "total", label: "Total" }].map((column) => {
10564
10676
  const items = column.key === "total" ? groupTasks : groupTasks.filter((task) => rfaTaskAgeBucket(task.createdAt, now) === column.key);
10565
- return /* @__PURE__ */ jsx25("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__ */ jsx25("span", { className: "mbrfa-task-zero", children: "0" }) }, column.key);
10677
+ 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);
10566
10678
  })
10567
10679
  ] }) })
10568
10680
  ] }) }, group.title);
10569
10681
  }) : null,
10570
- !list3 && stateTasks.length ? /* @__PURE__ */ jsx25("div", { className: "mbtd-actions", children: selectionControl({}, `View all ${view.toLowerCase()} tasks (${stateTasks.length})`) }) : null,
10571
- list3 || selection ? /* @__PURE__ */ jsxs23("section", { ref: drilldown, tabIndex: -1, className: "mbrfa-task-drilldown", "aria-label": "Selected tasks", children: [
10572
- /* @__PURE__ */ jsxs23("div", { className: "mbtd-actions", children: [
10573
- /* @__PURE__ */ jsxs23("h3", { children: [
10682
+ !list3 && stateTasks.length ? /* @__PURE__ */ jsx26("div", { className: "mbtd-actions", children: selectionControl({}, `View all ${view.toLowerCase()} tasks (${stateTasks.length})`) }) : null,
10683
+ list3 || selection ? /* @__PURE__ */ jsxs24("section", { ref: drilldown, tabIndex: -1, className: "mbrfa-task-drilldown", "aria-label": "Selected tasks", children: [
10684
+ /* @__PURE__ */ jsxs24("div", { className: "mbtd-actions", children: [
10685
+ /* @__PURE__ */ jsxs24("h3", { children: [
10574
10686
  selectedTitle,
10575
10687
  activeSelection?.bucket ? ` \xB7 ${[...taskAgeColumns, { key: "unknown", label: "Unknown age" }].find((column) => column.key === activeSelection.bucket)?.label}` : "",
10576
10688
  " (",
10577
10689
  filtered.length,
10578
10690
  ")"
10579
10691
  ] }),
10580
- !list3 ? /* @__PURE__ */ jsx25("button", { type: "button", onClick: () => setSelection(null), children: "Close task list" }) : null
10692
+ !list3 ? /* @__PURE__ */ jsx26("button", { type: "button", onClick: () => setSelection(null), children: "Close task list" }) : null
10581
10693
  ] }),
10582
- /* @__PURE__ */ jsx25("div", { className: "mbrfa-task-scroll", children: /* @__PURE__ */ jsxs23("table", { children: [
10583
- /* @__PURE__ */ jsx25("thead", { children: /* @__PURE__ */ jsxs23("tr", { children: [
10584
- /* @__PURE__ */ jsx25("th", { children: "Task / request" }),
10585
- /* @__PURE__ */ jsx25("th", { children: view === "Completed" ? "Completed" : "Follow up" }),
10586
- /* @__PURE__ */ jsx25("th", { children: "Assigned to" }),
10587
- /* @__PURE__ */ jsx25("th", { children: "Action" })
10694
+ /* @__PURE__ */ jsx26("div", { className: "mbrfa-task-scroll", children: /* @__PURE__ */ jsxs24("table", { children: [
10695
+ /* @__PURE__ */ jsx26("thead", { children: /* @__PURE__ */ jsxs24("tr", { children: [
10696
+ /* @__PURE__ */ jsx26("th", { children: "Task / request" }),
10697
+ /* @__PURE__ */ jsx26("th", { children: view === "Completed" ? "Completed" : "Follow up" }),
10698
+ /* @__PURE__ */ jsx26("th", { children: "Assigned to" }),
10699
+ /* @__PURE__ */ jsx26("th", { children: "Action" })
10588
10700
  ] }) }),
10589
- /* @__PURE__ */ jsx25("tbody", { children: filtered.map((task) => /* @__PURE__ */ jsxs23("tr", { children: [
10590
- /* @__PURE__ */ jsxs23("td", { children: [
10591
- /* @__PURE__ */ jsx25("strong", { children: rfaTaskLabel(task.kind) }),
10701
+ /* @__PURE__ */ jsx26("tbody", { children: filtered.map((task) => /* @__PURE__ */ jsxs24("tr", { children: [
10702
+ /* @__PURE__ */ jsxs24("td", { children: [
10703
+ /* @__PURE__ */ jsx26("strong", { children: rfaTaskLabel(task.kind) }),
10592
10704
  taskIdentity(task),
10593
- task.responseFilename ? /* @__PURE__ */ jsx25("small", { children: task.responseFilename }) : null,
10594
- task.lastOutcome ? /* @__PURE__ */ jsxs23("small", { children: [
10705
+ task.responseFilename ? /* @__PURE__ */ jsx26("small", { children: task.responseFilename }) : null,
10706
+ task.lastOutcome ? /* @__PURE__ */ jsxs24("small", { children: [
10595
10707
  "Last outcome: ",
10596
10708
  task.lastOutcome.replaceAll("_", " ")
10597
10709
  ] }) : null,
10598
- task.lastNote ? /* @__PURE__ */ jsx25("small", { children: task.lastNote }) : null
10710
+ task.lastNote ? /* @__PURE__ */ jsx26("small", { children: task.lastNote }) : null
10599
10711
  ] }),
10600
- /* @__PURE__ */ jsx25("td", { children: date3(view === "Completed" ? task.resolvedAt ?? task.updatedAt : task.snoozedUntil ?? task.dueAt) }),
10601
- /* @__PURE__ */ jsx25("td", { children: task.assigneeReference || "Unassigned" }),
10602
- /* @__PURE__ */ jsx25("td", { children: /* @__PURE__ */ jsx25("button", { type: "button", onClick: () => onSelect(task.rfaId, task.responseDocumentId ?? void 0), children: task.kind === "post_ur_decision" ? "Review response" : "Open request" }) })
10712
+ /* @__PURE__ */ jsx26("td", { children: date3(view === "Completed" ? task.resolvedAt ?? task.updatedAt : task.snoozedUntil ?? task.dueAt) }),
10713
+ /* @__PURE__ */ jsx26("td", { children: task.assigneeReference || "Unassigned" }),
10714
+ /* @__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" }) })
10603
10715
  ] }, task.id)) })
10604
10716
  ] }) }),
10605
- !filtered.length ? /* @__PURE__ */ jsx25("p", { children: "No tasks match this selection." }) : null
10717
+ !filtered.length ? /* @__PURE__ */ jsx26("p", { children: "No tasks match this selection." }) : null
10606
10718
  ] }) : null,
10607
- !list3 ? !patientId && !claimId && !renderingProviderId ? /* @__PURE__ */ jsxs23("details", { className: "mbrfa-match-disclosure", children: [
10608
- /* @__PURE__ */ jsxs23("summary", { children: [
10719
+ !list3 ? !patientId && !claimId && !renderingProviderId ? /* @__PURE__ */ jsxs24("details", { className: "mbrfa-match-disclosure", children: [
10720
+ /* @__PURE__ */ jsxs24("summary", { children: [
10609
10721
  "Match UR \xB7 Incoming responses",
10610
10722
  inboxCount !== null ? ` (${inboxCount})` : ""
10611
10723
  ] }),
10612
- /* @__PURE__ */ jsx25(InboundFaxInbox, { onCount: setInboxCount, options, editable: permissions.includes("act"), disabled: Boolean(appearance.disabled), onSelect })
10613
- ] }) : /* @__PURE__ */ jsx25("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
10724
+ /* @__PURE__ */ jsx26(InboundFaxInbox, { onCount: setInboxCount, options, editable: permissions.includes("act"), disabled: Boolean(appearance.disabled), onSelect })
10725
+ ] }) : /* @__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
10614
10726
  ] });
10615
10727
  }
10616
10728
  function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10617
10729
  const client = useMemo7(() => createRfaLifecycleClient(options), [options]);
10618
10730
  const records = useMemo7(() => createRfaClient(options), [options]);
10619
- const [faxes, setFaxes] = useState16([]);
10620
- const [fax, setFax] = useState16(null);
10621
- const [pdf, setPdf] = useState16(null);
10622
- const [choices, setChoices] = useState16([]);
10623
- const [selected, setSelected] = useState16("");
10624
- const [search, setSearch] = useState16("");
10625
- const [error, setError] = useState16("");
10626
- const [busy, setBusy] = useState16(false);
10627
- const [loading, setLoading] = useState16(true);
10628
- const [reload, setReload] = useState16(0);
10629
- const [nextCursor, setNextCursor] = useState16(null);
10630
- const [pages, setPages] = useState16([void 0]);
10631
- const [confirmed, setConfirmed] = useState16(false);
10632
- const keys = useRef12(/* @__PURE__ */ new Map());
10633
- const alive = useRef12(true);
10634
- const pending = useRef12(false);
10635
- const generation = useRef12(0);
10731
+ const [faxes, setFaxes] = useState17([]);
10732
+ const [fax, setFax] = useState17(null);
10733
+ const [pdf, setPdf] = useState17(null);
10734
+ const [choices, setChoices] = useState17([]);
10735
+ const [selected, setSelected] = useState17("");
10736
+ const [search, setSearch] = useState17("");
10737
+ const [error, setError] = useState17("");
10738
+ const [busy, setBusy] = useState17(false);
10739
+ const [loading, setLoading] = useState17(true);
10740
+ const [reload, setReload] = useState17(0);
10741
+ const [nextCursor, setNextCursor] = useState17(null);
10742
+ const [pages, setPages] = useState17([void 0]);
10743
+ const [confirmed, setConfirmed] = useState17(false);
10744
+ const keys = useRef13(/* @__PURE__ */ new Map());
10745
+ const alive = useRef13(true);
10746
+ const pending = useRef13(false);
10747
+ const generation = useRef13(0);
10636
10748
  useEffect14(() => {
10637
10749
  alive.current = true;
10638
10750
  return () => {
10639
10751
  alive.current = false;
10640
10752
  };
10641
10753
  }, []);
10642
- const reviewingFax = useRef12(false);
10754
+ const reviewingFax = useRef13(false);
10643
10755
  reviewingFax.current = Boolean(fax);
10644
10756
  useEffect14(() => {
10645
10757
  let active = true;
@@ -10701,35 +10813,35 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10701
10813
  if (alive.current) setBusy(false);
10702
10814
  }
10703
10815
  };
10704
- return /* @__PURE__ */ jsxs23("section", { className: "mbrfa-inbox", "aria-label": "Match UR", children: [
10705
- /* @__PURE__ */ jsx25("h3", { children: "Response inbox \xB7 Match UR" }),
10706
- /* @__PURE__ */ jsx25("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." }),
10707
- error ? /* @__PURE__ */ jsx25("p", { role: "alert", children: error }) : null,
10708
- loading ? /* @__PURE__ */ jsx25("p", { role: "status", children: "Loading response faxes\u2026" }) : !error && !faxes.length ? /* @__PURE__ */ jsx25("p", { children: "No unmatched response faxes." }) : null,
10709
- pages.length > 1 || nextCursor ? /* @__PURE__ */ jsxs23("div", { className: "mbtd-actions", children: [
10710
- /* @__PURE__ */ jsx25("button", { type: "button", disabled: loading || busy || pages.length < 2, onClick: () => setPages((value) => value.slice(0, -1)), children: "Previous fax page" }),
10711
- /* @__PURE__ */ jsxs23("span", { children: [
10816
+ return /* @__PURE__ */ jsxs24("section", { className: "mbrfa-inbox", "aria-label": "Match UR", children: [
10817
+ /* @__PURE__ */ jsx26("h3", { children: "Response inbox \xB7 Match UR" }),
10818
+ /* @__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." }),
10819
+ error ? /* @__PURE__ */ jsx26("p", { role: "alert", children: error }) : null,
10820
+ loading ? /* @__PURE__ */ jsx26("p", { role: "status", children: "Loading response faxes\u2026" }) : !error && !faxes.length ? /* @__PURE__ */ jsx26("p", { children: "No unmatched response faxes." }) : null,
10821
+ pages.length > 1 || nextCursor ? /* @__PURE__ */ jsxs24("div", { className: "mbtd-actions", children: [
10822
+ /* @__PURE__ */ jsx26("button", { type: "button", disabled: loading || busy || pages.length < 2, onClick: () => setPages((value) => value.slice(0, -1)), children: "Previous fax page" }),
10823
+ /* @__PURE__ */ jsxs24("span", { children: [
10712
10824
  "Page ",
10713
10825
  pages.length
10714
10826
  ] }),
10715
- /* @__PURE__ */ jsx25("button", { type: "button", disabled: loading || busy || !nextCursor, onClick: () => {
10827
+ /* @__PURE__ */ jsx26("button", { type: "button", disabled: loading || busy || !nextCursor, onClick: () => {
10716
10828
  if (nextCursor) setPages((value) => [...value, nextCursor]);
10717
10829
  }, children: "Next fax page" })
10718
10830
  ] }) : null,
10719
- /* @__PURE__ */ jsx25("div", { className: "mbrfa-list", children: faxes.map((item) => /* @__PURE__ */ jsxs23("article", { className: "mbrfa-card", children: [
10720
- /* @__PURE__ */ jsxs23("div", { children: [
10721
- /* @__PURE__ */ jsxs23("strong", { children: [
10831
+ /* @__PURE__ */ jsx26("div", { className: "mbrfa-list", children: faxes.map((item) => /* @__PURE__ */ jsxs24("article", { className: "mbrfa-card", children: [
10832
+ /* @__PURE__ */ jsxs24("div", { children: [
10833
+ /* @__PURE__ */ jsxs24("strong", { children: [
10722
10834
  "Response fax \xB7 ",
10723
10835
  date3(item.receivedAt)
10724
10836
  ] }),
10725
- /* @__PURE__ */ jsxs23("span", { children: [
10837
+ /* @__PURE__ */ jsxs24("span", { children: [
10726
10838
  item.fromName || item.fromFax || "Sender not identified",
10727
10839
  " \xB7 ",
10728
10840
  item.pages ?? "Unknown",
10729
10841
  " pages"
10730
10842
  ] })
10731
10843
  ] }),
10732
- /* @__PURE__ */ jsx25("button", { type: "button", disabled: busy || disabled, onClick: () => {
10844
+ /* @__PURE__ */ jsx26("button", { type: "button", disabled: busy || disabled, onClick: () => {
10733
10845
  const current = ++generation.current;
10734
10846
  setFax(item);
10735
10847
  setPdf(null);
@@ -10746,18 +10858,18 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10746
10858
  });
10747
10859
  }, children: "Review fax" })
10748
10860
  ] }, item.id)) }),
10749
- fax ? /* @__PURE__ */ jsxs23("div", { style: { display: "grid", gap: 16 }, children: [
10750
- /* @__PURE__ */ jsxs23("div", { className: "mbtd-actions", children: [
10751
- /* @__PURE__ */ jsx25("h4", { children: "Match response fax" }),
10752
- /* @__PURE__ */ jsx25("button", { type: "button", disabled: busy, onClick: () => {
10861
+ fax ? /* @__PURE__ */ jsxs24("div", { style: { display: "grid", gap: 16 }, children: [
10862
+ /* @__PURE__ */ jsxs24("div", { className: "mbtd-actions", children: [
10863
+ /* @__PURE__ */ jsx26("h4", { children: "Match response fax" }),
10864
+ /* @__PURE__ */ jsx26("button", { type: "button", disabled: busy, onClick: () => {
10753
10865
  generation.current += 1;
10754
10866
  setFax(null);
10755
10867
  setPdf(null);
10756
10868
  setReload((value) => value + 1);
10757
10869
  }, children: "Close review" })
10758
10870
  ] }),
10759
- pdf ? /* @__PURE__ */ jsx25(RfaPdfReview, { blob: pdf, title: "Incoming utilization review response" }) : null,
10760
- /* @__PURE__ */ jsxs23("form", { onSubmit: (event) => {
10871
+ pdf ? /* @__PURE__ */ jsx26(RfaPdfReview, { blob: pdf, title: "Incoming utilization review response" }) : null,
10872
+ /* @__PURE__ */ jsxs24("form", { onSubmit: (event) => {
10761
10873
  event.preventDefault();
10762
10874
  void run(async () => {
10763
10875
  const result = await records.list({ search: search.trim(), limit: 50 });
@@ -10767,20 +10879,20 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10767
10879
  }
10768
10880
  });
10769
10881
  }, children: [
10770
- /* @__PURE__ */ jsxs23("label", { children: [
10882
+ /* @__PURE__ */ jsxs24("label", { children: [
10771
10883
  "Find patient, claim or RFA",
10772
- /* @__PURE__ */ jsx25("input", { value: search, maxLength: 200, required: true, onChange: (event) => setSearch(event.target.value) })
10884
+ /* @__PURE__ */ jsx26("input", { value: search, maxLength: 200, required: true, onChange: (event) => setSearch(event.target.value) })
10773
10885
  ] }),
10774
- /* @__PURE__ */ jsx25("button", { type: "submit", disabled: busy || disabled, children: "Find requests" })
10886
+ /* @__PURE__ */ jsx26("button", { type: "submit", disabled: busy || disabled, children: "Find requests" })
10775
10887
  ] }),
10776
- /* @__PURE__ */ jsxs23("label", { children: [
10888
+ /* @__PURE__ */ jsxs24("label", { children: [
10777
10889
  "Matching request",
10778
- /* @__PURE__ */ jsxs23("select", { value: selected, disabled: busy || disabled, onChange: (event) => {
10890
+ /* @__PURE__ */ jsxs24("select", { value: selected, disabled: busy || disabled, onChange: (event) => {
10779
10891
  setSelected(event.target.value);
10780
10892
  setConfirmed(false);
10781
10893
  }, children: [
10782
- /* @__PURE__ */ jsx25("option", { value: "", children: "Choose after reviewing the response" }),
10783
- choices.map((record2) => /* @__PURE__ */ jsxs23("option", { value: record2.id, disabled: !canMatchResponse(record2), children: [
10894
+ /* @__PURE__ */ jsx26("option", { value: "", children: "Choose after reviewing the response" }),
10895
+ choices.map((record2) => /* @__PURE__ */ jsxs24("option", { value: record2.id, disabled: !canMatchResponse(record2), children: [
10784
10896
  record2.employeeName,
10785
10897
  " \xB7 ",
10786
10898
  record2.claimNumber || "Claim not recorded",
@@ -10792,8 +10904,8 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10792
10904
  ] }, record2.id))
10793
10905
  ] })
10794
10906
  ] }),
10795
- selected ? /* @__PURE__ */ jsx25("button", { type: "button", disabled: busy || disabled, onClick: () => onSelect(selected), children: "Review selected request" }) : null,
10796
- editable ? /* @__PURE__ */ jsxs23("form", { onSubmit: (event) => {
10907
+ selected ? /* @__PURE__ */ jsx26("button", { type: "button", disabled: busy || disabled, onClick: () => onSelect(selected), children: "Review selected request" }) : null,
10908
+ editable ? /* @__PURE__ */ jsxs24("form", { onSubmit: (event) => {
10797
10909
  event.preventDefault();
10798
10910
  if (!selected || !pdf || !confirmed || !editable || !choices.some((record2) => record2.id === selected && canMatchResponse(record2))) return;
10799
10911
  void run(async () => {
@@ -10812,18 +10924,18 @@ function InboundFaxInbox({ options, editable, disabled, onSelect, onCount }) {
10812
10924
  }
10813
10925
  });
10814
10926
  }, children: [
10815
- /* @__PURE__ */ jsxs23("label", { children: [
10816
- /* @__PURE__ */ jsx25("input", { type: "checkbox", required: true, checked: confirmed, onChange: (event) => setConfirmed(event.target.checked), disabled: busy || disabled }),
10927
+ /* @__PURE__ */ jsxs24("label", { children: [
10928
+ /* @__PURE__ */ jsx26("input", { type: "checkbox", required: true, checked: confirmed, onChange: (event) => setConfirmed(event.target.checked), disabled: busy || disabled }),
10817
10929
  " I reviewed the response and confirmed its patient, claim, and requested treatment match this request."
10818
10930
  ] }),
10819
- /* @__PURE__ */ jsx25("button", { type: "submit", disabled: busy || disabled || !selected || !pdf || !confirmed, children: "Match response and open Post UR" })
10820
- ] }) : /* @__PURE__ */ jsx25("p", { children: "Matching responses requires authorization from your administrator." })
10931
+ /* @__PURE__ */ jsx26("button", { type: "submit", disabled: busy || disabled || !selected || !pdf || !confirmed, children: "Match response and open Post UR" })
10932
+ ] }) : /* @__PURE__ */ jsx26("p", { children: "Matching responses requires authorization from your administrator." })
10821
10933
  ] }) : null
10822
10934
  ] });
10823
10935
  }
10824
10936
 
10825
10937
  // src/rfa-tracking-panel.tsx
10826
- import { Fragment as Fragment16, useEffect as useEffect15, useMemo as useMemo8, useRef as useRef13, useState as useState17 } from "react";
10938
+ import { Fragment as Fragment17, useEffect as useEffect15, useMemo as useMemo8, useRef as useRef14, useState as useState18 } from "react";
10827
10939
  import { createRfaClient as createRfaClient2, createRfaLifecycleClient as createRfaLifecycleClient2 } from "@mindbill/browser";
10828
10940
 
10829
10941
  // src/rfa-detail-header.tsx
@@ -10846,43 +10958,43 @@ function rfaDecisionDueText(rfa) {
10846
10958
  }
10847
10959
 
10848
10960
  // src/rfa-detail-header.tsx
10849
- import { Fragment as Fragment15, jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
10961
+ import { Fragment as Fragment16, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
10850
10962
  function RfaDetailHeader({ rfa, getPatientHref, getClaimHref, getProviderHref, compact = false }) {
10851
10963
  const status = getRfaLifecycleStatus(rfa);
10852
10964
  const stages = ["Incomplete", "Sent", "Received", "Closed"];
10853
10965
  const current = status === "closed" ? 3 : status === "received" || rfa.receivedAt ? 2 : status === "sent" || rfa.submittedAt ? 1 : 0;
10854
- return /* @__PURE__ */ jsxs24(Fragment15, { children: [
10855
- /* @__PURE__ */ jsxs24("div", { className: "mbrfa-context", children: [
10856
- /* @__PURE__ */ jsxs24("div", { children: [
10857
- /* @__PURE__ */ jsx26("strong", { children: /* @__PURE__ */ jsx26(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }) }),
10858
- /* @__PURE__ */ jsx26("span", { children: /* @__PURE__ */ jsxs24(RfaLink, { href: getClaimHref?.(rfa), children: [
10966
+ return /* @__PURE__ */ jsxs25(Fragment16, { children: [
10967
+ /* @__PURE__ */ jsxs25("div", { className: "mbrfa-context", children: [
10968
+ /* @__PURE__ */ jsxs25("div", { children: [
10969
+ /* @__PURE__ */ jsx27("strong", { children: /* @__PURE__ */ jsx27(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }) }),
10970
+ /* @__PURE__ */ jsx27("span", { children: /* @__PURE__ */ jsxs25(RfaLink, { href: getClaimHref?.(rfa), children: [
10859
10971
  "Claim ",
10860
10972
  rfa.claimNumber || "Not recorded"
10861
10973
  ] }) })
10862
10974
  ] }),
10863
- /* @__PURE__ */ jsxs24("div", { children: [
10864
- /* @__PURE__ */ jsx26("strong", { children: /* @__PURE__ */ jsx26(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
10865
- /* @__PURE__ */ jsx26("span", { children: "Requesting physician" })
10975
+ /* @__PURE__ */ jsxs25("div", { children: [
10976
+ /* @__PURE__ */ jsx27("strong", { children: /* @__PURE__ */ jsx27(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
10977
+ /* @__PURE__ */ jsx27("span", { children: "Requesting physician" })
10866
10978
  ] }),
10867
- /* @__PURE__ */ jsxs24("div", { children: [
10868
- /* @__PURE__ */ jsx26("strong", { children: rfa.expedited ? "Expedited review" : `${rfa.reviewType.charAt(0).toUpperCase()}${rfa.reviewType.slice(1)} review` }),
10869
- /* @__PURE__ */ jsx26("span", { className: "mbrfa-update-note", children: "Updates automatically" })
10979
+ /* @__PURE__ */ jsxs25("div", { children: [
10980
+ /* @__PURE__ */ jsx27("strong", { children: rfa.expedited ? "Expedited review" : `${rfa.reviewType.charAt(0).toUpperCase()}${rfa.reviewType.slice(1)} review` }),
10981
+ /* @__PURE__ */ jsx27("span", { className: "mbrfa-update-note", children: "Updates automatically" })
10870
10982
  ] })
10871
10983
  ] }),
10872
- !compact ? /* @__PURE__ */ jsxs24("section", { className: "mbrfa-progress", "aria-label": "Request status", children: [
10873
- /* @__PURE__ */ jsxs24("div", { className: "mbrfa-progress-heading", children: [
10874
- /* @__PURE__ */ jsxs24("div", { children: [
10875
- /* @__PURE__ */ jsx26("h3", { children: RFA_LIFECYCLE_LABELS[status] }),
10876
- /* @__PURE__ */ jsx26("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" })
10984
+ !compact ? /* @__PURE__ */ jsxs25("section", { className: "mbrfa-progress", "aria-label": "Request status", children: [
10985
+ /* @__PURE__ */ jsxs25("div", { className: "mbrfa-progress-heading", children: [
10986
+ /* @__PURE__ */ jsxs25("div", { children: [
10987
+ /* @__PURE__ */ jsx27("h3", { children: RFA_LIFECYCLE_LABELS[status] }),
10988
+ /* @__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" })
10877
10989
  ] }),
10878
- /* @__PURE__ */ jsxs24("div", { className: "mbrfa-deadline", children: [
10879
- /* @__PURE__ */ jsx26("span", { children: "Decision due" }),
10880
- /* @__PURE__ */ jsx26("strong", { children: rfaDecisionDueText(rfa) })
10990
+ /* @__PURE__ */ jsxs25("div", { className: "mbrfa-deadline", children: [
10991
+ /* @__PURE__ */ jsx27("span", { children: "Decision due" }),
10992
+ /* @__PURE__ */ jsx27("strong", { children: rfaDecisionDueText(rfa) })
10881
10993
  ] })
10882
10994
  ] }),
10883
- /* @__PURE__ */ jsx26("ol", { "aria-label": "Authorization progress", children: stages.map((stage, index) => /* @__PURE__ */ jsxs24("li", { className: index <= current ? "is-complete" : "", "aria-current": index === current ? "step" : void 0, children: [
10884
- /* @__PURE__ */ jsx26("span", { children: index < current ? "\u2713" : index + 1 }),
10885
- /* @__PURE__ */ jsx26("strong", { children: stage })
10995
+ /* @__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: [
10996
+ /* @__PURE__ */ jsx27("span", { children: index < current ? "\u2713" : index + 1 }),
10997
+ /* @__PURE__ */ jsx27("strong", { children: stage })
10886
10998
  ] }, stage)) })
10887
10999
  ] }) : null
10888
11000
  ] });
@@ -10896,7 +11008,7 @@ var rfaPolishCss = `
10896
11008
  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}}`;
10897
11009
 
10898
11010
  // src/rfa-history-entry.tsx
10899
- import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
11011
+ import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
10900
11012
  var object = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
10901
11013
  var string = (value) => typeof value === "string" && value.trim() ? value : void 0;
10902
11014
  var words = (value) => value.replace(/^rfa\./, "").replaceAll("_", " ");
@@ -10970,9 +11082,9 @@ function rows2(value, omit = []) {
10970
11082
  });
10971
11083
  }
10972
11084
  function DefinitionList({ entries }) {
10973
- return /* @__PURE__ */ jsx27("dl", { children: entries.map(([label5, value]) => /* @__PURE__ */ jsxs25("div", { children: [
10974
- /* @__PURE__ */ jsx27("dt", { children: label5 }),
10975
- /* @__PURE__ */ jsx27("dd", { style: { whiteSpace: "pre-wrap" }, children: value })
11085
+ return /* @__PURE__ */ jsx28("dl", { children: entries.map(([label5, value]) => /* @__PURE__ */ jsxs26("div", { children: [
11086
+ /* @__PURE__ */ jsx28("dt", { children: label5 }),
11087
+ /* @__PURE__ */ jsx28("dd", { style: { whiteSpace: "pre-wrap" }, children: value })
10976
11088
  ] }, label5)) });
10977
11089
  }
10978
11090
  function RfaHistoryEntry({ event, rfa, disabled, onDownload }) {
@@ -10997,12 +11109,12 @@ function RfaHistoryEntry({ event, rfa, disabled, onDownload }) {
10997
11109
  }
10998
11110
  const treatment = (id) => {
10999
11111
  const index = rfa.items.findIndex((value) => value.id === id);
11000
- return index >= 0 ? /* @__PURE__ */ jsxs25("a", { href: `#rfa-treatment-${id}`, children: [
11112
+ return index >= 0 ? /* @__PURE__ */ jsxs26("a", { href: `#rfa-treatment-${id}`, children: [
11001
11113
  "Treatment ",
11002
11114
  index + 1,
11003
11115
  ": ",
11004
11116
  rfa.items[index].serviceDescription
11005
- ] }) : /* @__PURE__ */ jsxs25("span", { children: [
11117
+ ] }) : /* @__PURE__ */ jsxs26("span", { children: [
11006
11118
  "Treatment reference: ",
11007
11119
  id
11008
11120
  ] });
@@ -11029,50 +11141,50 @@ function RfaHistoryEntry({ event, rfa, disabled, onDownload }) {
11029
11141
  const hasDetails = entries.length || appointment.length || decisionSections.length || evidence.length || changed.length;
11030
11142
  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;
11031
11143
  const action = string(payload.action) ?? event.eventType.replace(/^rfa\./, "");
11032
- return /* @__PURE__ */ jsxs25("tr", { children: [
11033
- /* @__PURE__ */ jsx27("td", { children: /* @__PURE__ */ jsx27("time", { dateTime: event.occurredAt ?? void 0, children: date4(event.occurredAt) }) }),
11034
- /* @__PURE__ */ jsx27("td", { className: "mbrfa-history-action", children: actions[action] ?? words(action) }),
11035
- /* @__PURE__ */ jsxs25("td", { children: [
11036
- /* @__PURE__ */ jsx27("span", { className: "mbrfa-sr-only", children: "Recorded by " }),
11144
+ return /* @__PURE__ */ jsxs26("tr", { children: [
11145
+ /* @__PURE__ */ jsx28("td", { children: /* @__PURE__ */ jsx28("time", { dateTime: event.occurredAt ?? void 0, children: date4(event.occurredAt) }) }),
11146
+ /* @__PURE__ */ jsx28("td", { className: "mbrfa-history-action", children: actions[action] ?? words(action) }),
11147
+ /* @__PURE__ */ jsxs26("td", { children: [
11148
+ /* @__PURE__ */ jsx28("span", { className: "mbrfa-sr-only", children: "Recorded by " }),
11037
11149
  actor
11038
11150
  ] }),
11039
- /* @__PURE__ */ jsxs25("td", { children: [
11040
- ["text", "reason", "requestText", "note"].map((key2) => string(payload[key2]) ? /* @__PURE__ */ jsx27("p", { style: { whiteSpace: "pre-wrap" }, children: String(payload[key2]) }, key2) : null),
11041
- ids.size ? /* @__PURE__ */ jsx27("ul", { "aria-label": "Related treatments", children: [...ids].map((id) => /* @__PURE__ */ jsx27("li", { children: treatment(id) }, id)) }) : null,
11042
- hasDetails ? /* @__PURE__ */ jsxs25("details", { children: [
11043
- /* @__PURE__ */ jsx27("summary", { children: "Event details" }),
11044
- entries.length ? /* @__PURE__ */ jsx27(DefinitionList, { entries }) : null,
11045
- changed.length ? /* @__PURE__ */ jsxs25("p", { children: [
11151
+ /* @__PURE__ */ jsxs26("td", { children: [
11152
+ ["text", "reason", "requestText", "note"].map((key2) => string(payload[key2]) ? /* @__PURE__ */ jsx28("p", { style: { whiteSpace: "pre-wrap" }, children: String(payload[key2]) }, key2) : null),
11153
+ ids.size ? /* @__PURE__ */ jsx28("ul", { "aria-label": "Related treatments", children: [...ids].map((id) => /* @__PURE__ */ jsx28("li", { children: treatment(id) }, id)) }) : null,
11154
+ hasDetails ? /* @__PURE__ */ jsxs26("details", { children: [
11155
+ /* @__PURE__ */ jsx28("summary", { children: "Event details" }),
11156
+ entries.length ? /* @__PURE__ */ jsx28(DefinitionList, { entries }) : null,
11157
+ changed.length ? /* @__PURE__ */ jsxs26("p", { children: [
11046
11158
  "Changed fields: ",
11047
11159
  changed.join(", ")
11048
11160
  ] }) : null,
11049
- appointment.length ? /* @__PURE__ */ jsxs25("section", { children: [
11050
- /* @__PURE__ */ jsx27("h4", { children: "Appointment details" }),
11051
- /* @__PURE__ */ jsx27(DefinitionList, { entries: appointment })
11161
+ appointment.length ? /* @__PURE__ */ jsxs26("section", { children: [
11162
+ /* @__PURE__ */ jsx28("h4", { children: "Appointment details" }),
11163
+ /* @__PURE__ */ jsx28(DefinitionList, { entries: appointment })
11052
11164
  ] }) : null,
11053
- decisionSections.map((group) => /* @__PURE__ */ jsxs25("section", { children: [
11054
- /* @__PURE__ */ jsx27("h4", { children: group.title }),
11055
- group.value !== payload ? /* @__PURE__ */ jsx27(DefinitionList, { entries: rows2(group.value, ["reason"]) }) : null,
11056
- group.decisions.map((value, index) => /* @__PURE__ */ jsxs25("div", { children: [
11165
+ decisionSections.map((group) => /* @__PURE__ */ jsxs26("section", { children: [
11166
+ /* @__PURE__ */ jsx28("h4", { children: group.title }),
11167
+ group.value !== payload ? /* @__PURE__ */ jsx28(DefinitionList, { entries: rows2(group.value, ["reason"]) }) : null,
11168
+ group.decisions.map((value, index) => /* @__PURE__ */ jsxs26("div", { children: [
11057
11169
  string(value.itemId) ? treatment(String(value.itemId)) : null,
11058
- /* @__PURE__ */ jsx27(DefinitionList, { entries: rows2(value) })
11170
+ /* @__PURE__ */ jsx28(DefinitionList, { entries: rows2(value) })
11059
11171
  ] }, index))
11060
11172
  ] }, group.title)),
11061
- evidence.length ? /* @__PURE__ */ jsx27("ul", { "aria-label": "Event documents", children: evidence.map((value) => {
11173
+ evidence.length ? /* @__PURE__ */ jsx28("ul", { "aria-label": "Event documents", children: evidence.map((value) => {
11062
11174
  const filename = rfa.documents.find((document2) => document2.id === value.id)?.filename;
11063
- return /* @__PURE__ */ jsx27("li", { children: /* @__PURE__ */ jsxs25("button", { type: "button", disabled, onClick: () => onDownload(value.kind, value.id, filename ?? (value.kind === "packet" ? "RFA submission.pdf" : "RFA evidence.pdf")), children: [
11175
+ 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: [
11064
11176
  value.label,
11065
11177
  filename ? `: ${filename}` : ""
11066
11178
  ] }) }, `${value.kind}:${value.id}`);
11067
11179
  }) }) : null
11068
- ] }) : !["text", "reason", "requestText", "note"].some((key2) => string(payload[key2])) && !ids.size ? /* @__PURE__ */ jsx27("span", { children: "\u2014" }) : null
11180
+ ] }) : !["text", "reason", "requestText", "note"].some((key2) => string(payload[key2])) && !ids.size ? /* @__PURE__ */ jsx28("span", { children: "\u2014" }) : null
11069
11181
  ] })
11070
11182
  ] });
11071
11183
  }
11072
11184
 
11073
11185
  // src/rfa-detail-cards.tsx
11074
11186
  import { getRfaLifecycleStatus as getRfaLifecycleStatus2, RFA_LIFECYCLE_LABELS as RFA_LIFECYCLE_LABELS2 } from "@mindbill/browser";
11075
- import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
11187
+ import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
11076
11188
  var DECIDED = ["approved", "modified", "denied", "mixed", "closed"];
11077
11189
  var rfaShortDate = (value) => value && Number.isFinite(Date.parse(value)) ? new Date(value).toLocaleString(void 0, { dateStyle: "short", timeStyle: "short" }) : "\u2014";
11078
11190
  var rfaCalendarDate = (value) => {
@@ -11091,7 +11203,7 @@ function rfaOutcome(item) {
11091
11203
  return { label: sentence(item.outcome || "pending"), tone: "muted" };
11092
11204
  }
11093
11205
  function RfaPill({ tone = "muted", children }) {
11094
- return /* @__PURE__ */ jsx28("span", { className: "mbrfa-pill", "data-tone": tone, children });
11206
+ return /* @__PURE__ */ jsx29("span", { className: "mbrfa-pill", "data-tone": tone, children });
11095
11207
  }
11096
11208
  function rfaLifecycleTone(rfa) {
11097
11209
  const status = getRfaLifecycleStatus2(rfa);
@@ -11108,41 +11220,41 @@ function RfaStatusCard({ rfa }) {
11108
11220
  const current = rfa.submittedAt && decided ? 4 : rfa.receivedAt ? 3 : rfa.submittedAt ? 2 : rfa.signedAt ? 1 : 0;
11109
11221
  const stopped = status === "canceled" || status === "failed";
11110
11222
  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";
11111
- return /* @__PURE__ */ jsxs26("section", { className: "mbrfa-status", "aria-label": "Request status", "data-stopped": stopped || void 0, children: [
11112
- /* @__PURE__ */ jsxs26("div", { className: "mbrfa-status-heading", children: [
11113
- /* @__PURE__ */ jsxs26("div", { children: [
11114
- /* @__PURE__ */ jsx28("h3", { children: RFA_LIFECYCLE_LABELS2[status] }),
11115
- /* @__PURE__ */ jsx28("p", { children: detail })
11223
+ return /* @__PURE__ */ jsxs27("section", { className: "mbrfa-status", "aria-label": "Request status", "data-stopped": stopped || void 0, children: [
11224
+ /* @__PURE__ */ jsxs27("div", { className: "mbrfa-status-heading", children: [
11225
+ /* @__PURE__ */ jsxs27("div", { children: [
11226
+ /* @__PURE__ */ jsx29("h3", { children: RFA_LIFECYCLE_LABELS2[status] }),
11227
+ /* @__PURE__ */ jsx29("p", { children: detail })
11116
11228
  ] }),
11117
- rfa.submittedAt && !stopped ? /* @__PURE__ */ jsxs26("div", { className: "mbrfa-status-due", children: [
11118
- /* @__PURE__ */ jsx28("span", { children: "Decision due" }),
11119
- /* @__PURE__ */ jsx28("strong", { children: rfaDecisionDueText(rfa) })
11229
+ rfa.submittedAt && !stopped ? /* @__PURE__ */ jsxs27("div", { className: "mbrfa-status-due", children: [
11230
+ /* @__PURE__ */ jsx29("span", { children: "Decision due" }),
11231
+ /* @__PURE__ */ jsx29("strong", { children: rfaDecisionDueText(rfa) })
11120
11232
  ] }) : null
11121
11233
  ] }),
11122
- /* @__PURE__ */ jsx28("ol", { "aria-label": "Authorization progress", children: stages.map((stage, index) => /* @__PURE__ */ jsxs26("li", { "data-state": index < current ? "done" : index === current ? "current" : "todo", "aria-current": index === current ? "step" : void 0, children: [
11123
- /* @__PURE__ */ jsx28("span", { children: index < current ? "\u2713" : index + 1 }),
11124
- /* @__PURE__ */ jsx28("strong", { children: stage })
11234
+ /* @__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: [
11235
+ /* @__PURE__ */ jsx29("span", { children: index < current ? "\u2713" : index + 1 }),
11236
+ /* @__PURE__ */ jsx29("strong", { children: stage })
11125
11237
  ] }, stage)) })
11126
11238
  ] });
11127
11239
  }
11128
11240
  function RfaCard({ title, count, action, children, id, flush = false }) {
11129
- return /* @__PURE__ */ jsxs26("section", { className: "mbrfa-sheet", id, "aria-label": title, children: [
11130
- /* @__PURE__ */ jsxs26("header", { children: [
11131
- /* @__PURE__ */ jsxs26("h3", { children: [
11241
+ return /* @__PURE__ */ jsxs27("section", { className: "mbrfa-sheet", id, "aria-label": title, children: [
11242
+ /* @__PURE__ */ jsxs27("header", { children: [
11243
+ /* @__PURE__ */ jsxs27("h3", { children: [
11132
11244
  title,
11133
- count !== void 0 ? /* @__PURE__ */ jsx28("span", { className: "mbrfa-count", children: count }) : null
11245
+ count !== void 0 ? /* @__PURE__ */ jsx29("span", { className: "mbrfa-count", children: count }) : null
11134
11246
  ] }),
11135
- action ? /* @__PURE__ */ jsx28("div", { className: "mbrfa-sheet-action", children: action }) : null
11247
+ action ? /* @__PURE__ */ jsx29("div", { className: "mbrfa-sheet-action", children: action }) : null
11136
11248
  ] }),
11137
- /* @__PURE__ */ jsx28("div", { className: flush ? "mbrfa-sheet-flush" : "mbrfa-sheet-body", children })
11249
+ /* @__PURE__ */ jsx29("div", { className: flush ? "mbrfa-sheet-flush" : "mbrfa-sheet-body", children })
11138
11250
  ] });
11139
11251
  }
11140
11252
  function RfaFacts({ entries }) {
11141
11253
  const shown = entries.filter(([, value]) => value !== null && value !== void 0 && value !== "" && value !== false);
11142
- return shown.length ? /* @__PURE__ */ jsx28("dl", { className: "mbrfa-facts", children: shown.map(([name, value]) => /* @__PURE__ */ jsxs26("div", { children: [
11143
- /* @__PURE__ */ jsx28("dt", { children: name }),
11144
- /* @__PURE__ */ jsx28("dd", { children: value })
11145
- ] }, name)) }) : /* @__PURE__ */ jsx28("p", { className: "mbrfa-empty", children: "Not recorded." });
11254
+ return shown.length ? /* @__PURE__ */ jsx29("dl", { className: "mbrfa-facts", children: shown.map(([name, value]) => /* @__PURE__ */ jsxs27("div", { children: [
11255
+ /* @__PURE__ */ jsx29("dt", { children: name }),
11256
+ /* @__PURE__ */ jsx29("dd", { children: value })
11257
+ ] }, name)) }) : /* @__PURE__ */ jsx29("p", { className: "mbrfa-empty", children: "Not recorded." });
11146
11258
  }
11147
11259
  var rfaAddress = (contact) => [contact?.address, [contact?.city, [contact?.state, contact?.zip].filter(Boolean).join(" ")].filter(Boolean).join(", ")].filter(Boolean).join(", ");
11148
11260
  var rfaRequestTypeLabel = (rfa) => rfa.requestType === "resubmission_material_change" ? "Resubmission \u2013 Change in Material Facts" : "New Request";
@@ -11228,7 +11340,7 @@ var rfaCardsCss = `
11228
11340
  `;
11229
11341
 
11230
11342
  // src/rfa-tracking-panel.tsx
11231
- import { Fragment as Fragment17, jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
11343
+ import { Fragment as Fragment18, jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
11232
11344
  var words2 = (value) => value.replace(/^rfa\./, "").replaceAll("_", " ");
11233
11345
  var capital = (value) => value.charAt(0).toUpperCase() + value.slice(1);
11234
11346
  var date5 = (value) => value ? new Date(value).toLocaleString() : "Not recorded";
@@ -11250,25 +11362,25 @@ var localTime = (value) => {
11250
11362
  };
11251
11363
  function RfaTrackingPanel(props) {
11252
11364
  const identity = useMemo8(() => crypto.randomUUID(), [props.options]);
11253
- return /* @__PURE__ */ jsx29(RfaTrackingContent, { ...props }, `${identity}:${props.rfa.id}`);
11365
+ return /* @__PURE__ */ jsx30(RfaTrackingContent, { ...props }, `${identity}:${props.rfa.id}`);
11254
11366
  }
11255
11367
  function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdated, view = "all", embedded = false, cards = false, ...appearance }) {
11256
- const [rfa, setRfa] = useState17(provided);
11368
+ const [rfa, setRfa] = useState18(provided);
11257
11369
  useEffect15(() => setRfa(provided), [provided]);
11258
11370
  const client = useMemo8(() => createRfaLifecycleClient2(options), [options]);
11259
11371
  const records = useMemo8(() => createRfaClient2(options), [options]);
11260
- const [scheduling, setScheduling] = useState17([]);
11261
- const [history, setHistory] = useState17([]);
11262
- const [loadErrors, setLoadErrors] = useState17([]);
11263
- const [loading, setLoading] = useState17(true);
11264
- const [reload, setReload] = useState17(0);
11265
- const [busy, setBusy] = useState17(false);
11266
- const [error, setError] = useState17("");
11267
- const [message, setMessage] = useState17("");
11268
- const [noteOpen, setNoteOpen] = useState17(false);
11269
- const alive = useRef13(true);
11270
- const pending = useRef13(false);
11271
- const keys = useRef13(/* @__PURE__ */ new Map());
11372
+ const [scheduling, setScheduling] = useState18([]);
11373
+ const [history, setHistory] = useState18([]);
11374
+ const [loadErrors, setLoadErrors] = useState18([]);
11375
+ const [loading, setLoading] = useState18(true);
11376
+ const [reload, setReload] = useState18(0);
11377
+ const [busy, setBusy] = useState18(false);
11378
+ const [error, setError] = useState18("");
11379
+ const [message, setMessage] = useState18("");
11380
+ const [noteOpen, setNoteOpen] = useState18(false);
11381
+ const alive = useRef14(true);
11382
+ const pending = useRef14(false);
11383
+ const keys = useRef14(/* @__PURE__ */ new Map());
11272
11384
  useEffect15(() => {
11273
11385
  alive.current = true;
11274
11386
  return () => {
@@ -11351,11 +11463,11 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11351
11463
  if (alive.current) setError(reason instanceof Error ? reason.message : "The evidence could not be opened.");
11352
11464
  }
11353
11465
  };
11354
- const evidence = (id, title) => id ? /* @__PURE__ */ jsx29("button", { type: "button", disabled, onClick: () => void download(id, rfa.documents.find((document2) => document2.id === id)?.filename ?? `${title}.pdf`), children: title }) : null;
11466
+ 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;
11355
11467
  const canCorrect = permissions.includes("act") && ["received", "under_review", "information_requested", "approved", "modified", "denied", "mixed"].includes(rfa.status);
11356
11468
  const canClose = permissions.includes("edit") && ["submitted", "received", "under_review", "information_requested", "incomplete", "deferred"].includes(rfa.status);
11357
11469
  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("; ");
11358
- const noteForm = /* @__PURE__ */ jsxs27("form", { className: "mbrfa-row", onSubmit: (event) => {
11470
+ const noteForm = /* @__PURE__ */ jsxs28("form", { className: "mbrfa-row", onSubmit: (event) => {
11359
11471
  event.preventDefault();
11360
11472
  const form = event.currentTarget;
11361
11473
  try {
@@ -11373,77 +11485,77 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11373
11485
  setError(reason instanceof Error ? reason.message : "Enter a note.");
11374
11486
  }
11375
11487
  }, children: [
11376
- /* @__PURE__ */ jsxs27("label", { children: [
11488
+ /* @__PURE__ */ jsxs28("label", { children: [
11377
11489
  "Note",
11378
- /* @__PURE__ */ jsx29("textarea", { name: "note", required: true, maxLength: 1e4, autoFocus: true, disabled })
11490
+ /* @__PURE__ */ jsx30("textarea", { name: "note", required: true, maxLength: 1e4, autoFocus: true, disabled })
11379
11491
  ] }),
11380
- /* @__PURE__ */ jsxs27("div", { className: "mbtd-actions", children: [
11381
- /* @__PURE__ */ jsx29("button", { type: "submit", className: "mbtd-primary", disabled, children: "Save note" }),
11382
- /* @__PURE__ */ jsx29("button", { type: "button", onClick: () => setNoteOpen(false), children: "Cancel" })
11492
+ /* @__PURE__ */ jsxs28("div", { className: "mbtd-actions", children: [
11493
+ /* @__PURE__ */ jsx30("button", { type: "submit", className: "mbtd-primary", disabled, children: "Save note" }),
11494
+ /* @__PURE__ */ jsx30("button", { type: "button", onClick: () => setNoteOpen(false), children: "Cancel" })
11383
11495
  ] })
11384
11496
  ] });
11385
- const cardContent = /* @__PURE__ */ jsxs27("div", { className: "mbrfa-stack", children: [
11386
- error ? /* @__PURE__ */ jsx29("p", { role: "alert", children: error }) : null,
11387
- message ? /* @__PURE__ */ jsx29("p", { role: "status", children: message }) : null,
11388
- loadErrors.map((value) => /* @__PURE__ */ jsx29("p", { role: "alert", children: value }, value)),
11389
- view !== "history" ? /* @__PURE__ */ jsx29(RfaCard, { title: "Requested Treatment", count: rfa.items.length, flush: true, children: rfa.items.length ? /* @__PURE__ */ jsx29("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs27("table", { className: "mbrfa-grid-table mbrfa-treatment-table", children: [
11390
- /* @__PURE__ */ jsx29("thead", { children: /* @__PURE__ */ jsxs27("tr", { children: [
11391
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "#" }),
11392
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Service/Good Requested" }),
11393
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Diagnosis" }),
11394
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "CPT/HCPCS" }),
11395
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Other Information" }),
11396
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Decision" })
11497
+ const cardContent = /* @__PURE__ */ jsxs28("div", { className: "mbrfa-stack", children: [
11498
+ error ? /* @__PURE__ */ jsx30("p", { role: "alert", children: error }) : null,
11499
+ message ? /* @__PURE__ */ jsx30("p", { role: "status", children: message }) : null,
11500
+ loadErrors.map((value) => /* @__PURE__ */ jsx30("p", { role: "alert", children: value }, value)),
11501
+ 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: [
11502
+ /* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsxs28("tr", { children: [
11503
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "#" }),
11504
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Service/Good Requested" }),
11505
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Diagnosis" }),
11506
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "CPT/HCPCS" }),
11507
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Other Information" }),
11508
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Decision" })
11397
11509
  ] }) }),
11398
- /* @__PURE__ */ jsx29("tbody", { children: rfa.items.map((item, index) => {
11510
+ /* @__PURE__ */ jsx30("tbody", { children: rfa.items.map((item, index) => {
11399
11511
  const appointment = scheduling.find((value) => value.itemId === item.id);
11400
11512
  const outcome = rfaOutcome(item);
11401
11513
  const showAppointment = !!appointment && (appointment.eligible || appointment.version > 0);
11402
11514
  const closable = canClose && item.outcome === "pending" && !item.decidedAt;
11403
11515
  const correctable = canCorrect && !!item.currentDecisionEventId && item.outcome !== "pending";
11404
- return /* @__PURE__ */ jsxs27(Fragment16, { children: [
11405
- /* @__PURE__ */ jsxs27("tr", { id: `rfa-treatment-${item.id}`, tabIndex: -1, children: [
11406
- /* @__PURE__ */ jsx29("td", { children: index + 1 }),
11407
- /* @__PURE__ */ jsx29("td", { children: /* @__PURE__ */ jsx29("strong", { children: item.serviceDescription }) }),
11408
- /* @__PURE__ */ jsxs27("td", { children: [
11409
- /* @__PURE__ */ jsx29("span", { className: "mbrfa-code", children: item.diagnosisCode }),
11410
- item.diagnosisDescription ? /* @__PURE__ */ jsx29("small", { children: item.diagnosisDescription }) : null
11516
+ return /* @__PURE__ */ jsxs28(Fragment17, { children: [
11517
+ /* @__PURE__ */ jsxs28("tr", { id: `rfa-treatment-${item.id}`, tabIndex: -1, children: [
11518
+ /* @__PURE__ */ jsx30("td", { children: index + 1 }),
11519
+ /* @__PURE__ */ jsx30("td", { children: /* @__PURE__ */ jsx30("strong", { children: item.serviceDescription }) }),
11520
+ /* @__PURE__ */ jsxs28("td", { children: [
11521
+ /* @__PURE__ */ jsx30("span", { className: "mbrfa-code", children: item.diagnosisCode }),
11522
+ item.diagnosisDescription ? /* @__PURE__ */ jsx30("small", { children: item.diagnosisDescription }) : null
11411
11523
  ] }),
11412
- /* @__PURE__ */ jsx29("td", { children: /* @__PURE__ */ jsx29("span", { className: "mbrfa-code", children: item.procedureCode || "\u2014" }) }),
11413
- /* @__PURE__ */ jsx29("td", { children: otherInformation(item) || "\u2014" }),
11414
- /* @__PURE__ */ jsxs27("td", { children: [
11415
- /* @__PURE__ */ jsx29(RfaPill, { tone: outcome.tone, children: outcome.label }),
11416
- item.outcome !== "pending" ? /* @__PURE__ */ jsxs27(Fragment17, { children: [
11417
- item.authorizationNumber ? /* @__PURE__ */ jsxs27("small", { children: [
11524
+ /* @__PURE__ */ jsx30("td", { children: /* @__PURE__ */ jsx30("span", { className: "mbrfa-code", children: item.procedureCode || "\u2014" }) }),
11525
+ /* @__PURE__ */ jsx30("td", { children: otherInformation(item) || "\u2014" }),
11526
+ /* @__PURE__ */ jsxs28("td", { children: [
11527
+ /* @__PURE__ */ jsx30(RfaPill, { tone: outcome.tone, children: outcome.label }),
11528
+ item.outcome !== "pending" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11529
+ item.authorizationNumber ? /* @__PURE__ */ jsxs28("small", { children: [
11418
11530
  "Authorization ",
11419
11531
  item.authorizationNumber
11420
11532
  ] }) : null,
11421
- item.authorizedProcedureCode || item.authorizedQuantity != null || item.authorizedUnits != null ? /* @__PURE__ */ jsxs27("small", { children: [
11533
+ item.authorizedProcedureCode || item.authorizedQuantity != null || item.authorizedUnits != null ? /* @__PURE__ */ jsxs28("small", { children: [
11422
11534
  "Authorized ",
11423
11535
  [item.authorizedProcedureCode || item.procedureCode, item.authorizedQuantity != null ? `quantity ${item.authorizedQuantity}` : "", item.authorizedUnits != null ? `units ${item.authorizedUnits}` : ""].filter(Boolean).join(" \xB7 ")
11424
11536
  ] }) : null,
11425
- item.effectiveFrom || item.effectiveTo ? /* @__PURE__ */ jsxs27("small", { children: [
11537
+ item.effectiveFrom || item.effectiveTo ? /* @__PURE__ */ jsxs28("small", { children: [
11426
11538
  rfaCalendarDate(item.effectiveFrom) || "Not specified",
11427
11539
  " \u2013 ",
11428
11540
  rfaCalendarDate(item.effectiveTo) || "Not specified"
11429
11541
  ] }) : null,
11430
- /* @__PURE__ */ jsxs27("small", { children: [
11542
+ /* @__PURE__ */ jsxs28("small", { children: [
11431
11543
  "Decided ",
11432
11544
  rfaShortDate(item.decidedAt)
11433
11545
  ] })
11434
11546
  ] }) : null
11435
11547
  ] })
11436
11548
  ] }),
11437
- item.decisionReason || item.reviewerName || item.decisionClosure || closable || showAppointment || correctable || item.currentResponseDocumentId || item.currentImrDocumentId ? /* @__PURE__ */ jsxs27("tr", { className: "mbrfa-subrow", children: [
11438
- /* @__PURE__ */ jsx29("td", {}),
11439
- /* @__PURE__ */ jsx29("td", { colSpan: 5, children: /* @__PURE__ */ jsxs27("div", { className: "mbrfa-manage", children: [
11440
- item.decisionReason ? /* @__PURE__ */ jsx29("p", { children: item.decisionReason }) : null,
11441
- item.reviewerName ? /* @__PURE__ */ jsxs27("p", { children: [
11549
+ item.decisionReason || item.reviewerName || item.decisionClosure || closable || showAppointment || correctable || item.currentResponseDocumentId || item.currentImrDocumentId ? /* @__PURE__ */ jsxs28("tr", { className: "mbrfa-subrow", children: [
11550
+ /* @__PURE__ */ jsx30("td", {}),
11551
+ /* @__PURE__ */ jsx30("td", { colSpan: 5, children: /* @__PURE__ */ jsxs28("div", { className: "mbrfa-manage", children: [
11552
+ item.decisionReason ? /* @__PURE__ */ jsx30("p", { children: item.decisionReason }) : null,
11553
+ item.reviewerName ? /* @__PURE__ */ jsxs28("p", { children: [
11442
11554
  "Reviewer: ",
11443
11555
  item.reviewerName,
11444
11556
  item.reviewerPhone ? ` \xB7 ${item.reviewerPhone}` : ""
11445
11557
  ] }) : null,
11446
- item.decisionClosure ? /* @__PURE__ */ jsxs27("p", { children: [
11558
+ item.decisionClosure ? /* @__PURE__ */ jsxs28("p", { children: [
11447
11559
  item.decisionClosure.closed ? "Closed" : "Reopened",
11448
11560
  " by ",
11449
11561
  item.decisionClosure.updatedBy,
@@ -11452,125 +11564,125 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11452
11564
  " \u2014 ",
11453
11565
  item.decisionClosure.reason
11454
11566
  ] }) : null,
11455
- item.currentResponseDocumentId || item.currentImrDocumentId ? /* @__PURE__ */ jsxs27("div", { className: "mbtd-actions", children: [
11567
+ item.currentResponseDocumentId || item.currentImrDocumentId ? /* @__PURE__ */ jsxs28("div", { className: "mbtd-actions", children: [
11456
11568
  evidence(item.currentResponseDocumentId, "View decision evidence"),
11457
11569
  evidence(item.currentImrDocumentId, "View independent medical review form")
11458
11570
  ] }) : null,
11459
- showAppointment ? /* @__PURE__ */ jsx29(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) => {
11571
+ 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) => {
11460
11572
  await client.updateScheduling(rfa.id, item.id, input, key2);
11461
11573
  return records.get(rfa.id);
11462
11574
  }) }, `${item.id}:${appointment.version}:${appointment.authorizationToken}`) : null,
11463
- closable ? /* @__PURE__ */ jsx29(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,
11464
- correctable ? /* @__PURE__ */ jsxs27("details", { children: [
11465
- /* @__PURE__ */ jsx29("summary", { children: "Correct this decision" }),
11466
- /* @__PURE__ */ jsx29("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." }),
11467
- /* @__PURE__ */ jsx29(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}`)
11575
+ 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,
11576
+ correctable ? /* @__PURE__ */ jsxs28("details", { children: [
11577
+ /* @__PURE__ */ jsx30("summary", { children: "Correct this decision" }),
11578
+ /* @__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." }),
11579
+ /* @__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}`)
11468
11580
  ] }) : null
11469
11581
  ] }) })
11470
11582
  ] }) : null
11471
11583
  ] }, item.id);
11472
11584
  }) })
11473
- ] }) }) : /* @__PURE__ */ jsx29("p", { className: "mbrfa-sheet-body mbrfa-empty", children: "No treatments recorded." }) }) : null,
11474
- view !== "treatments" ? /* @__PURE__ */ jsxs27(Fragment17, { children: [
11475
- /* @__PURE__ */ jsxs27(RfaCard, { title: "History", action: permissions.includes("edit") && !noteOpen ? /* @__PURE__ */ jsx29("button", { type: "button", disabled, onClick: () => setNoteOpen(true), children: "Add note" }) : null, flush: true, children: [
11476
- /* @__PURE__ */ jsx29("div", { className: "mbrfa-rows", children: noteOpen ? noteForm : null }),
11477
- loading ? /* @__PURE__ */ jsx29("p", { className: "mbrfa-sheet-body", children: "Loading history\u2026" }) : history.length ? /* @__PURE__ */ jsx29("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs27("table", { className: "mbrfa-history-table", children: [
11478
- /* @__PURE__ */ jsx29("thead", { children: /* @__PURE__ */ jsxs27("tr", { children: [
11479
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Date" }),
11480
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Action" }),
11481
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "User" }),
11482
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Details" })
11585
+ ] }) }) : /* @__PURE__ */ jsx30("p", { className: "mbrfa-sheet-body mbrfa-empty", children: "No treatments recorded." }) }) : null,
11586
+ view !== "treatments" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11587
+ /* @__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: [
11588
+ /* @__PURE__ */ jsx30("div", { className: "mbrfa-rows", children: noteOpen ? noteForm : null }),
11589
+ 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: [
11590
+ /* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsxs28("tr", { children: [
11591
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Date" }),
11592
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Action" }),
11593
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "User" }),
11594
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Details" })
11483
11595
  ] }) }),
11484
- /* @__PURE__ */ jsx29("tbody", { children: history.map((event) => /* @__PURE__ */ jsx29(RfaHistoryEntry, { event, rfa, disabled, onDownload: (kind, id, filename) => void download(id, filename, kind) }, event.id)) })
11485
- ] }) }) : !loadErrors.some((value) => value.startsWith("History")) ? /* @__PURE__ */ jsx29("p", { className: "mbrfa-sheet-body mbrfa-empty", children: "No history entries have been recorded." }) : null
11596
+ /* @__PURE__ */ jsx30("tbody", { children: history.map((event) => /* @__PURE__ */ jsx30(RfaHistoryEntry, { event, rfa, disabled, onDownload: (kind, id, filename) => void download(id, filename, kind) }, event.id)) })
11597
+ ] }) }) : !loadErrors.some((value) => value.startsWith("History")) ? /* @__PURE__ */ jsx30("p", { className: "mbrfa-sheet-body mbrfa-empty", children: "No history entries have been recorded." }) : null
11486
11598
  ] }),
11487
- rfa.transmissions.length ? /* @__PURE__ */ jsx29(RfaCard, { title: "Delivery", count: rfa.transmissions.length, flush: true, children: /* @__PURE__ */ jsx29("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs27("table", { className: "mbrfa-grid-table", children: [
11488
- /* @__PURE__ */ jsx29("thead", { children: /* @__PURE__ */ jsxs27("tr", { children: [
11489
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Date" }),
11490
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Method" }),
11491
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Status" }),
11492
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Recipient" }),
11493
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Confirmed receipt" }),
11494
- /* @__PURE__ */ jsx29("th", { scope: "col", children: /* @__PURE__ */ jsx29("span", { className: "mbrfa-sr-only", children: "Receipt" }) })
11599
+ 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: [
11600
+ /* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsxs28("tr", { children: [
11601
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Date" }),
11602
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Method" }),
11603
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Status" }),
11604
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Recipient" }),
11605
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Confirmed receipt" }),
11606
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: /* @__PURE__ */ jsx30("span", { className: "mbrfa-sr-only", children: "Receipt" }) })
11495
11607
  ] }) }),
11496
- /* @__PURE__ */ jsx29("tbody", { children: rfa.transmissions.map((transmission) => /* @__PURE__ */ jsxs27("tr", { children: [
11497
- /* @__PURE__ */ jsx29("td", { children: rfaShortDate(transmission.occurredAt) }),
11498
- /* @__PURE__ */ jsxs27("td", { children: [
11608
+ /* @__PURE__ */ jsx30("tbody", { children: rfa.transmissions.map((transmission) => /* @__PURE__ */ jsxs28("tr", { children: [
11609
+ /* @__PURE__ */ jsx30("td", { children: rfaShortDate(transmission.occurredAt) }),
11610
+ /* @__PURE__ */ jsxs28("td", { children: [
11499
11611
  capital(words2(transmission.channel)),
11500
- /* @__PURE__ */ jsxs27("small", { children: [
11612
+ /* @__PURE__ */ jsxs28("small", { children: [
11501
11613
  capital(words2(transmission.direction)),
11502
11614
  transmission.purpose ? ` \xB7 ${words2(transmission.purpose)}` : ""
11503
11615
  ] })
11504
11616
  ] }),
11505
- /* @__PURE__ */ jsx29("td", { children: /* @__PURE__ */ jsx29(RfaPill, { tone: ["delivered", "received", "sent"].includes(transmission.status) ? "ok" : transmission.status === "failed" ? "bad" : "muted", children: capital(words2(transmission.status)) }) }),
11506
- /* @__PURE__ */ jsxs27("td", { children: [
11617
+ /* @__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)) }) }),
11618
+ /* @__PURE__ */ jsxs28("td", { children: [
11507
11619
  transmission.destination || "\u2014",
11508
- transmission.providerMessageId ? /* @__PURE__ */ jsxs27("small", { children: [
11620
+ transmission.providerMessageId ? /* @__PURE__ */ jsxs28("small", { children: [
11509
11621
  "Reference ",
11510
11622
  transmission.providerMessageId
11511
11623
  ] }) : null
11512
11624
  ] }),
11513
- /* @__PURE__ */ jsx29("td", { children: rfaShortDate(transmission.receivedAt) }),
11514
- /* @__PURE__ */ jsx29("td", { className: "mbrfa-row-actions", children: evidence(transmission.proofDocumentId, "Receipt") })
11625
+ /* @__PURE__ */ jsx30("td", { children: rfaShortDate(transmission.receivedAt) }),
11626
+ /* @__PURE__ */ jsx30("td", { className: "mbrfa-row-actions", children: evidence(transmission.proofDocumentId, "Receipt") })
11515
11627
  ] }, transmission.id)) })
11516
11628
  ] }) }) }) : null
11517
11629
  ] }) : null
11518
11630
  ] });
11519
- const content = /* @__PURE__ */ jsx29(Fragment17, { children: /* @__PURE__ */ jsxs27("div", { style: { display: "grid", gap: 16 }, children: [
11520
- error ? /* @__PURE__ */ jsx29("p", { role: "alert", children: error }) : null,
11521
- message ? /* @__PURE__ */ jsx29("p", { role: "status", children: message }) : null,
11522
- loadErrors.map((value) => /* @__PURE__ */ jsx29("p", { role: "alert", children: value }, value)),
11523
- /* @__PURE__ */ jsxs27("div", { hidden: view === "history", className: "mbrfa-treatment-list", children: [
11524
- /* @__PURE__ */ jsx29("h3", { children: "Requested treatments" }),
11631
+ const content = /* @__PURE__ */ jsx30(Fragment18, { children: /* @__PURE__ */ jsxs28("div", { style: { display: "grid", gap: 16 }, children: [
11632
+ error ? /* @__PURE__ */ jsx30("p", { role: "alert", children: error }) : null,
11633
+ message ? /* @__PURE__ */ jsx30("p", { role: "status", children: message }) : null,
11634
+ loadErrors.map((value) => /* @__PURE__ */ jsx30("p", { role: "alert", children: value }, value)),
11635
+ /* @__PURE__ */ jsxs28("div", { hidden: view === "history", className: "mbrfa-treatment-list", children: [
11636
+ /* @__PURE__ */ jsx30("h3", { children: "Requested treatments" }),
11525
11637
  rfa.items.map((item, index) => {
11526
11638
  const appointment = scheduling.find((value) => value.itemId === item.id);
11527
- return /* @__PURE__ */ jsxs27("fieldset", { id: `rfa-treatment-${item.id}`, tabIndex: -1, children: [
11528
- /* @__PURE__ */ jsxs27("legend", { children: [
11639
+ return /* @__PURE__ */ jsxs28("fieldset", { id: `rfa-treatment-${item.id}`, tabIndex: -1, children: [
11640
+ /* @__PURE__ */ jsxs28("legend", { children: [
11529
11641
  index + 1,
11530
11642
  ". ",
11531
11643
  item.serviceDescription
11532
11644
  ] }),
11533
- /* @__PURE__ */ jsxs27("p", { children: [
11645
+ /* @__PURE__ */ jsxs28("p", { children: [
11534
11646
  item.procedureCode || "No procedure code",
11535
11647
  " \xB7 Diagnosis ",
11536
11648
  item.diagnosisCode,
11537
11649
  " \xB7 ",
11538
11650
  item.decisionClosure?.closed ? "Decision no longer required" : words2(item.outcome)
11539
11651
  ] }),
11540
- /* @__PURE__ */ jsx29("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__ */ jsxs27("div", { children: [
11541
- /* @__PURE__ */ jsx29("dt", { children: title }),
11542
- /* @__PURE__ */ jsx29("dd", { children: value })
11652
+ /* @__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: [
11653
+ /* @__PURE__ */ jsx30("dt", { children: title }),
11654
+ /* @__PURE__ */ jsx30("dd", { children: value })
11543
11655
  ] }, title)) }),
11544
- item.decisionClosure ? /* @__PURE__ */ jsxs27("p", { children: [
11656
+ item.decisionClosure ? /* @__PURE__ */ jsxs28("p", { children: [
11545
11657
  item.decisionClosure.closed ? "Closed" : "Reopened",
11546
11658
  " by ",
11547
11659
  item.decisionClosure.updatedBy,
11548
11660
  " \xB7 ",
11549
11661
  date5(item.decisionClosure.updatedAt),
11550
- /* @__PURE__ */ jsx29("br", {}),
11662
+ /* @__PURE__ */ jsx30("br", {}),
11551
11663
  item.decisionClosure.reason
11552
11664
  ] }) : null,
11553
- canClose && item.outcome === "pending" && !item.decidedAt ? /* @__PURE__ */ jsx29(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,
11554
- item.outcome !== "pending" ? /* @__PURE__ */ jsxs27(Fragment17, { children: [
11555
- /* @__PURE__ */ jsxs27("p", { children: [
11665
+ 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,
11666
+ item.outcome !== "pending" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11667
+ /* @__PURE__ */ jsxs28("p", { children: [
11556
11668
  "Decision: ",
11557
11669
  date5(item.decidedAt),
11558
11670
  item.authorizationNumber ? ` \xB7 Authorization ${item.authorizationNumber}` : ""
11559
11671
  ] }),
11560
- item.authorizedProcedureCode || item.authorizedQuantity || item.authorizedUnits ? /* @__PURE__ */ jsxs27("p", { children: [
11672
+ item.authorizedProcedureCode || item.authorizedQuantity || item.authorizedUnits ? /* @__PURE__ */ jsxs28("p", { children: [
11561
11673
  "Authorized: ",
11562
11674
  item.authorizedProcedureCode || item.procedureCode || "Treatment",
11563
11675
  item.authorizedQuantity != null ? ` \xB7 Quantity ${item.authorizedQuantity}` : "",
11564
11676
  item.authorizedUnits != null ? ` \xB7 Units ${item.authorizedUnits}` : ""
11565
11677
  ] }) : null,
11566
- item.effectiveFrom || item.effectiveTo ? /* @__PURE__ */ jsxs27("p", { children: [
11678
+ item.effectiveFrom || item.effectiveTo ? /* @__PURE__ */ jsxs28("p", { children: [
11567
11679
  "Authorization dates: ",
11568
11680
  item.effectiveFrom ?? "Not specified",
11569
11681
  " through ",
11570
11682
  item.effectiveTo ?? "Not specified"
11571
11683
  ] }) : null,
11572
- item.decisionReason ? /* @__PURE__ */ jsx29("p", { children: item.decisionReason }) : null,
11573
- item.reviewerName ? /* @__PURE__ */ jsxs27("p", { children: [
11684
+ item.decisionReason ? /* @__PURE__ */ jsx30("p", { children: item.decisionReason }) : null,
11685
+ item.reviewerName ? /* @__PURE__ */ jsxs28("p", { children: [
11574
11686
  "Reviewer: ",
11575
11687
  item.reviewerName,
11576
11688
  item.reviewerPhone ? ` \xB7 ${item.reviewerPhone}` : ""
@@ -11579,57 +11691,57 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11579
11691
  " ",
11580
11692
  evidence(item.currentImrDocumentId, "View independent medical review form")
11581
11693
  ] }) : null,
11582
- loading ? /* @__PURE__ */ jsx29("p", { children: "Loading appointment\u2026" }) : appointment ? /* @__PURE__ */ jsx29(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) => {
11694
+ 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) => {
11583
11695
  await client.updateScheduling(rfa.id, item.id, input, key2);
11584
11696
  return records.get(rfa.id);
11585
11697
  }) }, `${item.id}:${appointment.version}:${appointment.authorizationToken}`) : null,
11586
- canCorrect && item.currentDecisionEventId && item.outcome !== "pending" ? /* @__PURE__ */ jsxs27("details", { children: [
11587
- /* @__PURE__ */ jsx29("summary", { children: "Correct this decision" }),
11588
- /* @__PURE__ */ jsx29("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." }),
11589
- /* @__PURE__ */ jsx29(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}`)
11698
+ canCorrect && item.currentDecisionEventId && item.outcome !== "pending" ? /* @__PURE__ */ jsxs28("details", { children: [
11699
+ /* @__PURE__ */ jsx30("summary", { children: "Correct this decision" }),
11700
+ /* @__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." }),
11701
+ /* @__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}`)
11590
11702
  ] }) : null
11591
11703
  ] }, item.id);
11592
11704
  })
11593
11705
  ] }),
11594
- /* @__PURE__ */ jsxs27("div", { hidden: view === "treatments", className: "mbrfa-history-content", children: [
11595
- /* @__PURE__ */ jsxs27("details", { className: "mbrfa-delivery-evidence", children: [
11596
- /* @__PURE__ */ jsxs27("summary", { children: [
11706
+ /* @__PURE__ */ jsxs28("div", { hidden: view === "treatments", className: "mbrfa-history-content", children: [
11707
+ /* @__PURE__ */ jsxs28("details", { className: "mbrfa-delivery-evidence", children: [
11708
+ /* @__PURE__ */ jsxs28("summary", { children: [
11597
11709
  "Delivery evidence (",
11598
11710
  rfa.transmissions.length,
11599
11711
  ")"
11600
11712
  ] }),
11601
- rfa.transmissions.length ? rfa.transmissions.map((transmission) => /* @__PURE__ */ jsxs27("article", { style: { paddingBlock: 8 }, children: [
11602
- /* @__PURE__ */ jsxs27("strong", { children: [
11713
+ rfa.transmissions.length ? rfa.transmissions.map((transmission) => /* @__PURE__ */ jsxs28("article", { style: { paddingBlock: 8 }, children: [
11714
+ /* @__PURE__ */ jsxs28("strong", { children: [
11603
11715
  words2(transmission.channel),
11604
11716
  " \xB7 ",
11605
11717
  words2(transmission.status)
11606
11718
  ] }),
11607
- /* @__PURE__ */ jsxs27("p", { children: [
11719
+ /* @__PURE__ */ jsxs28("p", { children: [
11608
11720
  words2(transmission.direction),
11609
11721
  transmission.purpose ? ` \xB7 ${words2(transmission.purpose)}` : "",
11610
11722
  " \xB7 ",
11611
11723
  date5(transmission.occurredAt)
11612
11724
  ] }),
11613
- transmission.destination ? /* @__PURE__ */ jsxs27("p", { children: [
11725
+ transmission.destination ? /* @__PURE__ */ jsxs28("p", { children: [
11614
11726
  "Recipient: ",
11615
11727
  transmission.destination
11616
11728
  ] }) : null,
11617
- transmission.providerMessageId ? /* @__PURE__ */ jsxs27("p", { children: [
11729
+ transmission.providerMessageId ? /* @__PURE__ */ jsxs28("p", { children: [
11618
11730
  "Delivery reference: ",
11619
11731
  transmission.providerMessageId
11620
11732
  ] }) : null,
11621
- transmission.receivedAt ? /* @__PURE__ */ jsxs27("p", { children: [
11733
+ transmission.receivedAt ? /* @__PURE__ */ jsxs28("p", { children: [
11622
11734
  "Confirmed receipt: ",
11623
11735
  date5(transmission.receivedAt)
11624
11736
  ] }) : null,
11625
11737
  evidence(transmission.proofDocumentId, "Download transmission receipt")
11626
- ] }, transmission.id)) : /* @__PURE__ */ jsx29("p", { children: "No transmission evidence has been recorded." })
11738
+ ] }, transmission.id)) : /* @__PURE__ */ jsx30("p", { children: "No transmission evidence has been recorded." })
11627
11739
  ] }),
11628
- /* @__PURE__ */ jsxs27("section", { className: "mbrfa-history-card", "aria-label": "History and notes", children: [
11629
- /* @__PURE__ */ jsx29("h3", { children: "History and notes" }),
11630
- permissions.includes("edit") ? /* @__PURE__ */ jsxs27("details", { className: "mbrfa-note-form", children: [
11631
- /* @__PURE__ */ jsx29("summary", { children: "Add a note" }),
11632
- /* @__PURE__ */ jsx29("form", { onSubmit: (event) => {
11740
+ /* @__PURE__ */ jsxs28("section", { className: "mbrfa-history-card", "aria-label": "History and notes", children: [
11741
+ /* @__PURE__ */ jsx30("h3", { children: "History and notes" }),
11742
+ permissions.includes("edit") ? /* @__PURE__ */ jsxs28("details", { className: "mbrfa-note-form", children: [
11743
+ /* @__PURE__ */ jsx30("summary", { children: "Add a note" }),
11744
+ /* @__PURE__ */ jsx30("form", { onSubmit: (event) => {
11633
11745
  event.preventDefault();
11634
11746
  const form = event.currentTarget;
11635
11747
  try {
@@ -11643,51 +11755,51 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11643
11755
  } catch (reason) {
11644
11756
  setError(reason instanceof Error ? reason.message : "Enter a note.");
11645
11757
  }
11646
- }, children: /* @__PURE__ */ jsxs27("fieldset", { disabled, children: [
11647
- /* @__PURE__ */ jsx29("legend", { children: "Add a note" }),
11648
- /* @__PURE__ */ jsxs27("label", { children: [
11758
+ }, children: /* @__PURE__ */ jsxs28("fieldset", { disabled, children: [
11759
+ /* @__PURE__ */ jsx30("legend", { children: "Add a note" }),
11760
+ /* @__PURE__ */ jsxs28("label", { children: [
11649
11761
  "Note",
11650
- /* @__PURE__ */ jsx29("textarea", { name: "note", required: true, maxLength: 1e4 })
11762
+ /* @__PURE__ */ jsx30("textarea", { name: "note", required: true, maxLength: 1e4 })
11651
11763
  ] }),
11652
- /* @__PURE__ */ jsx29("button", { type: "submit", children: "Save note" })
11764
+ /* @__PURE__ */ jsx30("button", { type: "submit", children: "Save note" })
11653
11765
  ] }) })
11654
11766
  ] }) : null,
11655
- loading ? /* @__PURE__ */ jsx29("p", { children: "Loading history\u2026" }) : history.length ? /* @__PURE__ */ jsx29("div", { className: "mbrfa-table-scroll", children: /* @__PURE__ */ jsxs27("table", { className: "mbrfa-history-table", children: [
11656
- /* @__PURE__ */ jsx29("thead", { children: /* @__PURE__ */ jsxs27("tr", { children: [
11657
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Date" }),
11658
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Action" }),
11659
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "User" }),
11660
- /* @__PURE__ */ jsx29("th", { scope: "col", children: "Details" })
11767
+ 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: [
11768
+ /* @__PURE__ */ jsx30("thead", { children: /* @__PURE__ */ jsxs28("tr", { children: [
11769
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Date" }),
11770
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Action" }),
11771
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "User" }),
11772
+ /* @__PURE__ */ jsx30("th", { scope: "col", children: "Details" })
11661
11773
  ] }) }),
11662
- /* @__PURE__ */ jsx29("tbody", { children: history.map((event) => /* @__PURE__ */ jsx29(RfaHistoryEntry, { event, rfa, disabled, onDownload: (kind, id, filename) => void download(id, filename, kind) }, event.id)) })
11663
- ] }) }) : !loadErrors.some((value) => value.startsWith("History")) ? /* @__PURE__ */ jsx29("p", { children: "No history entries have been recorded." }) : null
11774
+ /* @__PURE__ */ jsx30("tbody", { children: history.map((event) => /* @__PURE__ */ jsx30(RfaHistoryEntry, { event, rfa, disabled, onDownload: (kind, id, filename) => void download(id, filename, kind) }, event.id)) })
11775
+ ] }) }) : !loadErrors.some((value) => value.startsWith("History")) ? /* @__PURE__ */ jsx30("p", { children: "No history entries have been recorded." }) : null
11664
11776
  ] })
11665
11777
  ] })
11666
11778
  ] }) });
11667
- if (cards) return /* @__PURE__ */ jsx29("div", { className: "mbrfa-tracking", children: cardContent });
11668
- return embedded ? /* @__PURE__ */ jsx29("div", { className: "mbrfa-tracking", children: content }) : /* @__PURE__ */ jsxs27(TreatmentDraftShell, { ...appearance, title: "Treatments and history", description: "Review each treatment's authorization, appointments, delivery evidence, and notes.", children: [
11669
- /* @__PURE__ */ jsx29("style", { children: rfaDetailCss }),
11779
+ if (cards) return /* @__PURE__ */ jsx30("div", { className: "mbrfa-tracking", children: cardContent });
11780
+ 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: [
11781
+ /* @__PURE__ */ jsx30("style", { children: rfaDetailCss }),
11670
11782
  content
11671
11783
  ] });
11672
11784
  }
11673
11785
  function AppointmentForm({ appointment, editable, disabled, onError, onSave }) {
11674
- const [disposition, setDisposition] = useState17(appointment.disposition === "canceled" && appointment.version > 0 ? "canceled" : appointment.eligible && appointment.disposition === "no_appointment" ? "no_appointment" : appointment.eligible ? "scheduled" : "canceled");
11675
- return /* @__PURE__ */ jsxs27("section", { children: [
11676
- /* @__PURE__ */ jsx29("h4", { children: "Appointment" }),
11677
- /* @__PURE__ */ jsxs27("p", { children: [
11786
+ const [disposition, setDisposition] = useState18(appointment.disposition === "canceled" && appointment.version > 0 ? "canceled" : appointment.eligible && appointment.disposition === "no_appointment" ? "no_appointment" : appointment.eligible ? "scheduled" : "canceled");
11787
+ return /* @__PURE__ */ jsxs28("section", { children: [
11788
+ /* @__PURE__ */ jsx30("h4", { children: "Appointment" }),
11789
+ /* @__PURE__ */ jsxs28("p", { children: [
11678
11790
  words2(appointment.disposition),
11679
11791
  appointment.appointmentAt ? ` \xB7 ${date5(appointment.appointmentAt)}` : ""
11680
11792
  ] }),
11681
- appointment.providerName ? /* @__PURE__ */ jsxs27("p", { children: [
11793
+ appointment.providerName ? /* @__PURE__ */ jsxs28("p", { children: [
11682
11794
  appointment.providerName,
11683
11795
  " \xB7 ",
11684
11796
  appointment.location
11685
11797
  ] }) : null,
11686
- appointment.reason ? /* @__PURE__ */ jsx29("p", { children: appointment.reason }) : null,
11687
- appointment.version > 0 && !appointment.current ? /* @__PURE__ */ jsx29("p", { role: "status", children: "Authorization has changed. Review the current decision before updating this appointment." }) : null,
11688
- editable && (appointment.eligible || appointment.version > 0) ? /* @__PURE__ */ jsxs27("details", { children: [
11689
- /* @__PURE__ */ jsx29("summary", { children: "Update appointment" }),
11690
- /* @__PURE__ */ jsx29("form", { onSubmit: (event) => {
11798
+ appointment.reason ? /* @__PURE__ */ jsx30("p", { children: appointment.reason }) : null,
11799
+ appointment.version > 0 && !appointment.current ? /* @__PURE__ */ jsx30("p", { role: "status", children: "Authorization has changed. Review the current decision before updating this appointment." }) : null,
11800
+ editable && (appointment.eligible || appointment.version > 0) ? /* @__PURE__ */ jsxs28("details", { children: [
11801
+ /* @__PURE__ */ jsx30("summary", { children: "Update appointment" }),
11802
+ /* @__PURE__ */ jsx30("form", { onSubmit: (event) => {
11691
11803
  event.preventDefault();
11692
11804
  if (disabled) return;
11693
11805
  try {
@@ -11698,42 +11810,42 @@ function AppointmentForm({ appointment, editable, disabled, onError, onSave }) {
11698
11810
  } catch (reason) {
11699
11811
  onError(reason instanceof Error ? reason.message : "Review the appointment details.");
11700
11812
  }
11701
- }, children: /* @__PURE__ */ jsxs27("fieldset", { disabled, children: [
11702
- /* @__PURE__ */ jsx29("legend", { children: "Appointment details" }),
11703
- /* @__PURE__ */ jsxs27("label", { children: [
11813
+ }, children: /* @__PURE__ */ jsxs28("fieldset", { disabled, children: [
11814
+ /* @__PURE__ */ jsx30("legend", { children: "Appointment details" }),
11815
+ /* @__PURE__ */ jsxs28("label", { children: [
11704
11816
  "Disposition",
11705
- /* @__PURE__ */ jsxs27("select", { value: disposition, onChange: (event) => setDisposition(event.target.value), children: [
11706
- appointment.eligible ? /* @__PURE__ */ jsxs27(Fragment17, { children: [
11707
- /* @__PURE__ */ jsx29("option", { value: "scheduled", children: "Scheduled" }),
11708
- /* @__PURE__ */ jsx29("option", { value: "no_appointment", children: "No appointment needed" })
11817
+ /* @__PURE__ */ jsxs28("select", { value: disposition, onChange: (event) => setDisposition(event.target.value), children: [
11818
+ appointment.eligible ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11819
+ /* @__PURE__ */ jsx30("option", { value: "scheduled", children: "Scheduled" }),
11820
+ /* @__PURE__ */ jsx30("option", { value: "no_appointment", children: "No appointment needed" })
11709
11821
  ] }) : null,
11710
- appointment.version > 0 ? /* @__PURE__ */ jsx29("option", { value: "canceled", children: "Canceled" }) : null
11822
+ appointment.version > 0 ? /* @__PURE__ */ jsx30("option", { value: "canceled", children: "Canceled" }) : null
11711
11823
  ] })
11712
11824
  ] }),
11713
- disposition === "scheduled" ? /* @__PURE__ */ jsxs27("div", { className: "mbtd-grid", children: [
11714
- /* @__PURE__ */ jsxs27("label", { children: [
11825
+ disposition === "scheduled" ? /* @__PURE__ */ jsxs28("div", { className: "mbtd-grid", children: [
11826
+ /* @__PURE__ */ jsxs28("label", { children: [
11715
11827
  "Date and time (your local time)",
11716
- /* @__PURE__ */ jsx29("input", { name: "appointmentAt", type: "datetime-local", required: true, defaultValue: localTime(appointment.appointmentAt) })
11828
+ /* @__PURE__ */ jsx30("input", { name: "appointmentAt", type: "datetime-local", required: true, defaultValue: localTime(appointment.appointmentAt) })
11717
11829
  ] }),
11718
- /* @__PURE__ */ jsxs27("label", { children: [
11830
+ /* @__PURE__ */ jsxs28("label", { children: [
11719
11831
  "Provider name",
11720
- /* @__PURE__ */ jsx29("input", { name: "providerName", required: true, maxLength: 200, defaultValue: appointment.providerName ?? "" })
11832
+ /* @__PURE__ */ jsx30("input", { name: "providerName", required: true, maxLength: 200, defaultValue: appointment.providerName ?? "" })
11721
11833
  ] }),
11722
- /* @__PURE__ */ jsxs27("label", { children: [
11834
+ /* @__PURE__ */ jsxs28("label", { children: [
11723
11835
  "Location",
11724
- /* @__PURE__ */ jsx29("input", { name: "location", required: true, maxLength: 500, defaultValue: appointment.location ?? "" })
11836
+ /* @__PURE__ */ jsx30("input", { name: "location", required: true, maxLength: 500, defaultValue: appointment.location ?? "" })
11725
11837
  ] })
11726
- ] }) : /* @__PURE__ */ jsxs27("label", { children: [
11838
+ ] }) : /* @__PURE__ */ jsxs28("label", { children: [
11727
11839
  "Reason",
11728
- /* @__PURE__ */ jsx29("textarea", { name: "reason", required: true, maxLength: 2e3, defaultValue: appointment.reason ?? "" })
11840
+ /* @__PURE__ */ jsx30("textarea", { name: "reason", required: true, maxLength: 2e3, defaultValue: appointment.reason ?? "" })
11729
11841
  ] }),
11730
- /* @__PURE__ */ jsx29("button", { type: "submit", children: "Save appointment" })
11842
+ /* @__PURE__ */ jsx30("button", { type: "submit", children: "Save appointment" })
11731
11843
  ] }) })
11732
- ] }) : !appointment.eligible && appointment.disposition === "pending" ? /* @__PURE__ */ jsx29("p", { children: "Appointments become available after treatment is authorized." }) : null
11844
+ ] }) : !appointment.eligible && appointment.disposition === "pending" ? /* @__PURE__ */ jsx30("p", { children: "Appointments become available after treatment is authorized." }) : null
11733
11845
  ] });
11734
11846
  }
11735
11847
  function CorrectionForm({ item, documents, disabled, onError, onSave }) {
11736
- const [outcome, setOutcome] = useState17(item.outcome);
11848
+ const [outcome, setOutcome] = useState18(item.outcome);
11737
11849
  const submit = (event) => {
11738
11850
  event.preventDefault();
11739
11851
  if (disabled) return;
@@ -11757,90 +11869,90 @@ function CorrectionForm({ item, documents, disabled, onError, onSave }) {
11757
11869
  onError(reason instanceof Error ? reason.message : "Review the correction details.");
11758
11870
  }
11759
11871
  };
11760
- return /* @__PURE__ */ jsx29("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs27("fieldset", { disabled, children: [
11761
- /* @__PURE__ */ jsx29("legend", { children: "Decision correction" }),
11762
- /* @__PURE__ */ jsxs27("div", { className: "mbtd-grid", children: [
11763
- /* @__PURE__ */ jsxs27("label", { children: [
11872
+ return /* @__PURE__ */ jsx30("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs28("fieldset", { disabled, children: [
11873
+ /* @__PURE__ */ jsx30("legend", { children: "Decision correction" }),
11874
+ /* @__PURE__ */ jsxs28("div", { className: "mbtd-grid", children: [
11875
+ /* @__PURE__ */ jsxs28("label", { children: [
11764
11876
  "Correction reason",
11765
- /* @__PURE__ */ jsx29("textarea", { name: "reason", required: true, maxLength: 2e4 })
11877
+ /* @__PURE__ */ jsx30("textarea", { name: "reason", required: true, maxLength: 2e4 })
11766
11878
  ] }),
11767
- /* @__PURE__ */ jsxs27("label", { children: [
11879
+ /* @__PURE__ */ jsxs28("label", { children: [
11768
11880
  "Corrected decision",
11769
- /* @__PURE__ */ jsxs27("select", { value: outcome, onChange: (event) => setOutcome(event.target.value), children: [
11770
- /* @__PURE__ */ jsx29("option", { value: "approved", children: "Approved" }),
11771
- /* @__PURE__ */ jsx29("option", { value: "modified", children: "Modified" }),
11772
- /* @__PURE__ */ jsx29("option", { value: "denied", children: "Denied" })
11881
+ /* @__PURE__ */ jsxs28("select", { value: outcome, onChange: (event) => setOutcome(event.target.value), children: [
11882
+ /* @__PURE__ */ jsx30("option", { value: "approved", children: "Approved" }),
11883
+ /* @__PURE__ */ jsx30("option", { value: "modified", children: "Modified" }),
11884
+ /* @__PURE__ */ jsx30("option", { value: "denied", children: "Denied" })
11773
11885
  ] })
11774
11886
  ] }),
11775
- /* @__PURE__ */ jsxs27("label", { children: [
11887
+ /* @__PURE__ */ jsxs28("label", { children: [
11776
11888
  "Decision time",
11777
- /* @__PURE__ */ jsx29("input", { name: "decidedAt", type: "datetime-local", required: true, defaultValue: localTime(item.decidedAt) })
11889
+ /* @__PURE__ */ jsx30("input", { name: "decidedAt", type: "datetime-local", required: true, defaultValue: localTime(item.decidedAt) })
11778
11890
  ] }),
11779
- /* @__PURE__ */ jsxs27("label", { children: [
11891
+ /* @__PURE__ */ jsxs28("label", { children: [
11780
11892
  "Decision response evidence",
11781
- /* @__PURE__ */ jsxs27("select", { name: "responseDocumentId", required: true, defaultValue: item.currentResponseDocumentId ?? "", children: [
11782
- /* @__PURE__ */ jsx29("option", { value: "", children: "Choose evidence" }),
11783
- documents.filter((document2) => document2.documentType === "ur_response").map((document2) => /* @__PURE__ */ jsx29("option", { value: document2.id, children: document2.filename }, document2.id))
11893
+ /* @__PURE__ */ jsxs28("select", { name: "responseDocumentId", required: true, defaultValue: item.currentResponseDocumentId ?? "", children: [
11894
+ /* @__PURE__ */ jsx30("option", { value: "", children: "Choose evidence" }),
11895
+ documents.filter((document2) => document2.documentType === "ur_response").map((document2) => /* @__PURE__ */ jsx30("option", { value: document2.id, children: document2.filename }, document2.id))
11784
11896
  ] })
11785
11897
  ] }),
11786
- outcome !== "approved" ? /* @__PURE__ */ jsxs27(Fragment17, { children: [
11787
- /* @__PURE__ */ jsxs27("label", { children: [
11898
+ outcome !== "approved" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11899
+ /* @__PURE__ */ jsxs28("label", { children: [
11788
11900
  "Independent medical review form",
11789
- /* @__PURE__ */ jsxs27("select", { name: "imrDocumentId", required: true, defaultValue: item.currentImrDocumentId ?? "", children: [
11790
- /* @__PURE__ */ jsx29("option", { value: "", children: "Choose a form" }),
11791
- documents.filter((document2) => document2.documentType === "imr_form").map((document2) => /* @__PURE__ */ jsx29("option", { value: document2.id, children: document2.filename }, document2.id))
11901
+ /* @__PURE__ */ jsxs28("select", { name: "imrDocumentId", required: true, defaultValue: item.currentImrDocumentId ?? "", children: [
11902
+ /* @__PURE__ */ jsx30("option", { value: "", children: "Choose a form" }),
11903
+ documents.filter((document2) => document2.documentType === "imr_form").map((document2) => /* @__PURE__ */ jsx30("option", { value: document2.id, children: document2.filename }, document2.id))
11792
11904
  ] })
11793
11905
  ] }),
11794
- /* @__PURE__ */ jsxs27("label", { children: [
11906
+ /* @__PURE__ */ jsxs28("label", { children: [
11795
11907
  "Decision reason",
11796
- /* @__PURE__ */ jsx29("textarea", { name: "decisionReason", required: true, defaultValue: item.decisionReason ?? "" })
11908
+ /* @__PURE__ */ jsx30("textarea", { name: "decisionReason", required: true, defaultValue: item.decisionReason ?? "" })
11797
11909
  ] }),
11798
- /* @__PURE__ */ jsxs27("label", { children: [
11910
+ /* @__PURE__ */ jsxs28("label", { children: [
11799
11911
  "Reviewer name",
11800
- /* @__PURE__ */ jsx29("input", { name: "reviewerName", required: true, defaultValue: item.reviewerName ?? "" })
11912
+ /* @__PURE__ */ jsx30("input", { name: "reviewerName", required: true, defaultValue: item.reviewerName ?? "" })
11801
11913
  ] }),
11802
- /* @__PURE__ */ jsxs27("label", { children: [
11914
+ /* @__PURE__ */ jsxs28("label", { children: [
11803
11915
  "Reviewer phone",
11804
- /* @__PURE__ */ jsx29("input", { name: "reviewerPhone", required: true, defaultValue: item.reviewerPhone ?? "" })
11916
+ /* @__PURE__ */ jsx30("input", { name: "reviewerPhone", required: true, defaultValue: item.reviewerPhone ?? "" })
11805
11917
  ] })
11806
11918
  ] }) : null,
11807
- outcome !== "denied" ? /* @__PURE__ */ jsxs27(Fragment17, { children: [
11808
- /* @__PURE__ */ jsxs27("label", { children: [
11919
+ outcome !== "denied" ? /* @__PURE__ */ jsxs28(Fragment18, { children: [
11920
+ /* @__PURE__ */ jsxs28("label", { children: [
11809
11921
  "Authorization number",
11810
- /* @__PURE__ */ jsx29("input", { name: "authorizationNumber", required: true, defaultValue: item.authorizationNumber ?? "" })
11922
+ /* @__PURE__ */ jsx30("input", { name: "authorizationNumber", required: true, defaultValue: item.authorizationNumber ?? "" })
11811
11923
  ] }),
11812
- /* @__PURE__ */ jsxs27("label", { children: [
11924
+ /* @__PURE__ */ jsxs28("label", { children: [
11813
11925
  "Authorized procedure code",
11814
- /* @__PURE__ */ jsx29("input", { name: "authorizedProcedureCode", defaultValue: item.authorizedProcedureCode ?? "" })
11926
+ /* @__PURE__ */ jsx30("input", { name: "authorizedProcedureCode", defaultValue: item.authorizedProcedureCode ?? "" })
11815
11927
  ] }),
11816
- /* @__PURE__ */ jsxs27("label", { children: [
11928
+ /* @__PURE__ */ jsxs28("label", { children: [
11817
11929
  "Authorized quantity",
11818
- /* @__PURE__ */ jsx29("input", { name: "authorizedQuantity", type: "number", min: "0.001", step: "any", defaultValue: item.authorizedQuantity ?? "" })
11930
+ /* @__PURE__ */ jsx30("input", { name: "authorizedQuantity", type: "number", min: "0.001", step: "any", defaultValue: item.authorizedQuantity ?? "" })
11819
11931
  ] }),
11820
- /* @__PURE__ */ jsxs27("label", { children: [
11932
+ /* @__PURE__ */ jsxs28("label", { children: [
11821
11933
  "Authorized units",
11822
- /* @__PURE__ */ jsx29("input", { name: "authorizedUnits", type: "number", min: "1", defaultValue: item.authorizedUnits ?? "" })
11934
+ /* @__PURE__ */ jsx30("input", { name: "authorizedUnits", type: "number", min: "1", defaultValue: item.authorizedUnits ?? "" })
11823
11935
  ] }),
11824
- /* @__PURE__ */ jsxs27("label", { children: [
11936
+ /* @__PURE__ */ jsxs28("label", { children: [
11825
11937
  "Effective from",
11826
- /* @__PURE__ */ jsx29("input", { name: "effectiveFrom", type: "date", defaultValue: item.effectiveFrom?.slice(0, 10) ?? "" })
11938
+ /* @__PURE__ */ jsx30("input", { name: "effectiveFrom", type: "date", defaultValue: item.effectiveFrom?.slice(0, 10) ?? "" })
11827
11939
  ] }),
11828
- /* @__PURE__ */ jsxs27("label", { children: [
11940
+ /* @__PURE__ */ jsxs28("label", { children: [
11829
11941
  "Effective through",
11830
- /* @__PURE__ */ jsx29("input", { name: "effectiveTo", type: "date", defaultValue: item.effectiveTo?.slice(0, 10) ?? "" })
11942
+ /* @__PURE__ */ jsx30("input", { name: "effectiveTo", type: "date", defaultValue: item.effectiveTo?.slice(0, 10) ?? "" })
11831
11943
  ] })
11832
11944
  ] }) : null
11833
11945
  ] }),
11834
- /* @__PURE__ */ jsx29("button", { type: "submit", children: "Save decision correction" })
11946
+ /* @__PURE__ */ jsx30("button", { type: "submit", children: "Save decision correction" })
11835
11947
  ] }) });
11836
11948
  }
11837
11949
  function TreatmentClosureForm({ item, disabled, onError, onSave }) {
11838
11950
  const closed = Boolean(item.decisionClosure?.closed);
11839
11951
  const title = closed ? "Reopen treatment follow-up" : "Decision no longer required";
11840
- return /* @__PURE__ */ jsxs27("details", { children: [
11841
- /* @__PURE__ */ jsx29("summary", { children: title }),
11842
- /* @__PURE__ */ jsx29("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." }),
11843
- /* @__PURE__ */ jsx29("form", { onSubmit: (event) => {
11952
+ return /* @__PURE__ */ jsxs28("details", { children: [
11953
+ /* @__PURE__ */ jsx30("summary", { children: title }),
11954
+ /* @__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." }),
11955
+ /* @__PURE__ */ jsx30("form", { onSubmit: (event) => {
11844
11956
  event.preventDefault();
11845
11957
  if (disabled) return;
11846
11958
  try {
@@ -11849,104 +11961,104 @@ function TreatmentClosureForm({ item, disabled, onError, onSave }) {
11849
11961
  } catch (reason) {
11850
11962
  onError(reason instanceof Error ? reason.message : "Enter a reason.");
11851
11963
  }
11852
- }, children: /* @__PURE__ */ jsxs27("fieldset", { disabled, children: [
11853
- /* @__PURE__ */ jsx29("legend", { children: closed ? "Reopen this treatment" : "Close this treatment" }),
11854
- /* @__PURE__ */ jsxs27("label", { children: [
11964
+ }, children: /* @__PURE__ */ jsxs28("fieldset", { disabled, children: [
11965
+ /* @__PURE__ */ jsx30("legend", { children: closed ? "Reopen this treatment" : "Close this treatment" }),
11966
+ /* @__PURE__ */ jsxs28("label", { children: [
11855
11967
  closed ? "Reason for reopening" : "Reason a decision is no longer required",
11856
- /* @__PURE__ */ jsx29("textarea", { name: "closureReason", required: true, maxLength: 2e3 })
11968
+ /* @__PURE__ */ jsx30("textarea", { name: "closureReason", required: true, maxLength: 2e3 })
11857
11969
  ] }),
11858
- /* @__PURE__ */ jsx29("div", { className: "mbtd-actions", children: /* @__PURE__ */ jsx29("button", { type: "submit", children: closed ? "Reopen treatment" : "Close treatment" }) })
11970
+ /* @__PURE__ */ jsx30("div", { className: "mbtd-actions", children: /* @__PURE__ */ jsx30("button", { type: "submit", children: closed ? "Reopen treatment" : "Close treatment" }) })
11859
11971
  ] }) })
11860
11972
  ] });
11861
11973
  }
11862
11974
 
11863
11975
  // src/rfa-request-summary.tsx
11864
- import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
11976
+ import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
11865
11977
  var readable = (value) => value.replaceAll("_", " ");
11866
11978
  var calendarDate = (value) => value?.match(/^\d{4}-\d{2}-\d{2}/)?.[0] ?? value;
11867
11979
  function Details({ entries }) {
11868
- return /* @__PURE__ */ jsx30("dl", { className: "mbrfa-request-details", children: entries.filter(([, value]) => value !== null && value !== void 0 && value !== "").map(([name, value]) => /* @__PURE__ */ jsxs28("div", { children: [
11869
- /* @__PURE__ */ jsx30("dt", { children: name }),
11870
- /* @__PURE__ */ jsx30("dd", { children: value })
11980
+ 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: [
11981
+ /* @__PURE__ */ jsx31("dt", { children: name }),
11982
+ /* @__PURE__ */ jsx31("dd", { children: value })
11871
11983
  ] }, name)) });
11872
11984
  }
11873
11985
  function Contact({ title, contact }) {
11874
11986
  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]];
11875
- return /* @__PURE__ */ jsxs28("section", { className: "mbrfa-info-card", children: [
11876
- /* @__PURE__ */ jsx30("h3", { children: title }),
11877
- /* @__PURE__ */ jsx30("div", { className: "mbrfa-info-body", children: entries.some(([, value]) => value) ? /* @__PURE__ */ jsx30(Details, { entries }) : /* @__PURE__ */ jsx30("p", { children: "Not recorded." }) })
11987
+ return /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
11988
+ /* @__PURE__ */ jsx31("h3", { children: title }),
11989
+ /* @__PURE__ */ jsx31("div", { className: "mbrfa-info-body", children: entries.some(([, value]) => value) ? /* @__PURE__ */ jsx31(Details, { entries }) : /* @__PURE__ */ jsx31("p", { children: "Not recorded." }) })
11878
11990
  ] });
11879
11991
  }
11880
11992
  function RfaRequestSummary({ rfa, onViewClaimsAdministrator, getPatientHref, getClaimHref, getProviderHref, hideTreatments = false, collapseContacts = false }) {
11881
- const contacts2 = /* @__PURE__ */ jsxs28("div", { className: "mbtd-grid", children: [
11882
- /* @__PURE__ */ jsxs28("section", { className: "mbrfa-info-card", children: [
11883
- /* @__PURE__ */ jsx30("h3", { children: "Patient and injury" }),
11884
- /* @__PURE__ */ jsx30("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx30(Details, { entries: [["Patient", /* @__PURE__ */ jsx30(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName })], ["Claim number", /* @__PURE__ */ jsx30(RfaLink, { href: getClaimHref?.(rfa), children: rfa.claimNumber || "Not recorded" })], ["Injury", rfa.injuryDescription ? /* @__PURE__ */ jsx30(RfaLink, { href: getClaimHref?.(rfa), children: rfa.injuryDescription }) : null], ["Date of injury", calendarDate(rfa.dateOfInjury) || "Not recorded"]] }) })
11993
+ const contacts2 = /* @__PURE__ */ jsxs29("div", { className: "mbtd-grid", children: [
11994
+ /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
11995
+ /* @__PURE__ */ jsx31("h3", { children: "Patient and injury" }),
11996
+ /* @__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"]] }) })
11885
11997
  ] }),
11886
- /* @__PURE__ */ jsxs28("section", { className: "mbrfa-info-card", children: [
11887
- /* @__PURE__ */ jsx30("h3", { children: "Requesting physician" }),
11888
- /* @__PURE__ */ jsx30("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx30(Details, { entries: [["Name", /* @__PURE__ */ jsx30(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName })], ["NPI", rfa.providerNpi], ["Phone", rfa.providerPhone], ["Fax", rfa.providerFax]] }) })
11998
+ /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
11999
+ /* @__PURE__ */ jsx31("h3", { children: "Requesting physician" }),
12000
+ /* @__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]] }) })
11889
12001
  ] }),
11890
- /* @__PURE__ */ jsx30(Contact, { title: "Requesting practice", contact: rfa.requestingPractice }),
11891
- /* @__PURE__ */ jsxs28("section", { className: "mbrfa-info-card", children: [
11892
- /* @__PURE__ */ jsx30("h3", { children: "Claims administrator" }),
11893
- /* @__PURE__ */ jsx30("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx30(Details, { entries: [["Name", /* @__PURE__ */ jsx30(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(", ")]] }) })
12002
+ /* @__PURE__ */ jsx31(Contact, { title: "Requesting practice", contact: rfa.requestingPractice }),
12003
+ /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
12004
+ /* @__PURE__ */ jsx31("h3", { children: "Claims administrator" }),
12005
+ /* @__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(", ")]] }) })
11894
12006
  ] })
11895
12007
  ] });
11896
- return /* @__PURE__ */ jsxs28("section", { className: "mbrfa-stack mbrfa-request", "aria-label": "Saved request details", children: [
11897
- /* @__PURE__ */ jsx30("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)}}` }),
12008
+ return /* @__PURE__ */ jsxs29("section", { className: "mbrfa-stack mbrfa-request", "aria-label": "Saved request details", children: [
12009
+ /* @__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)}}` }),
11898
12010
  !collapseContacts ? contacts2 : null,
11899
- /* @__PURE__ */ jsxs28("section", { className: "mbrfa-info-card", children: [
11900
- /* @__PURE__ */ jsx30("h3", { children: "Request information" }),
11901
- /* @__PURE__ */ jsx30("div", { className: "mbrfa-info-body", children: /* @__PURE__ */ jsx30(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
+ /* @__PURE__ */ jsxs29("section", { className: "mbrfa-info-card", children: [
12012
+ /* @__PURE__ */ jsx31("h3", { children: "Request information" }),
12013
+ /* @__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]] }) })
11902
12014
  ] }),
11903
- collapseContacts ? /* @__PURE__ */ jsxs28("details", { className: "mbrfa-detail-card", children: [
11904
- /* @__PURE__ */ jsx30("summary", { children: "Patient, physician & claim details" }),
12015
+ collapseContacts ? /* @__PURE__ */ jsxs29("details", { className: "mbrfa-detail-card", children: [
12016
+ /* @__PURE__ */ jsx31("summary", { children: "Patient, physician & claim details" }),
11905
12017
  contacts2
11906
12018
  ] }) : null,
11907
- !hideTreatments ? /* @__PURE__ */ jsxs28("fieldset", { children: [
11908
- /* @__PURE__ */ jsx30("legend", { children: "Requested services" }),
11909
- /* @__PURE__ */ jsx30("div", { className: "mbrfa-request-treatments", children: rfa.items.map((item, index) => /* @__PURE__ */ jsxs28("article", { children: [
11910
- /* @__PURE__ */ jsxs28("h4", { children: [
12019
+ !hideTreatments ? /* @__PURE__ */ jsxs29("fieldset", { children: [
12020
+ /* @__PURE__ */ jsx31("legend", { children: "Requested services" }),
12021
+ /* @__PURE__ */ jsx31("div", { className: "mbrfa-request-treatments", children: rfa.items.map((item, index) => /* @__PURE__ */ jsxs29("article", { children: [
12022
+ /* @__PURE__ */ jsxs29("h4", { children: [
11911
12023
  index + 1,
11912
12024
  ". ",
11913
12025
  item.serviceDescription
11914
12026
  ] }),
11915
- /* @__PURE__ */ jsx30(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)]] })
12027
+ /* @__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)]] })
11916
12028
  ] }, item.id)) }),
11917
- rfa.items.length === 0 ? /* @__PURE__ */ jsx30("p", { children: "No services recorded." }) : null
12029
+ rfa.items.length === 0 ? /* @__PURE__ */ jsx31("p", { children: "No services recorded." }) : null
11918
12030
  ] }) : null
11919
12031
  ] });
11920
12032
  }
11921
12033
 
11922
12034
  // src/rfa-packets.tsx
11923
- import { useEffect as useEffect16, useMemo as useMemo9, useRef as useRef14, useState as useState18 } from "react";
12035
+ import { useEffect as useEffect16, useMemo as useMemo9, useRef as useRef15, useState as useState19 } from "react";
11924
12036
  import { createRfaPacketsClient } from "@mindbill/browser";
11925
- import { Fragment as Fragment18, jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
12037
+ import { Fragment as Fragment19, jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
11926
12038
  function RfaPacketsPanel({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride, ...props }) {
11927
12039
  const options = useMemo9(() => ({ ...sessionEndpoint ? { sessionEndpoint } : {}, ...getSession ? { getSession } : {}, ...apiBaseUrl ? { apiBaseUrl } : {}, ...fetchOverride ? { fetch: fetchOverride } : {} }), [sessionEndpoint, getSession, apiBaseUrl, fetchOverride]);
11928
12040
  const identity = useMemo9(() => crypto.randomUUID(), [options]);
11929
- return /* @__PURE__ */ jsx31(PacketsContent, { options, ...props }, `${identity}:${props.rfa.id}:${props.rfa.contentRevision}:${props.rfa.status}:${props.environment}:${props.permissions?.join(",")}`);
12041
+ return /* @__PURE__ */ jsx32(PacketsContent, { options, ...props }, `${identity}:${props.rfa.id}:${props.rfa.contentRevision}:${props.rfa.status}:${props.environment}:${props.permissions?.join(",")}`);
11930
12042
  }
11931
12043
  function PacketsContent({ rfa, options, permissions = [], environment = "sandbox", disabled = false, onForwarded }) {
11932
12044
  const client = useMemo9(() => createRfaPacketsClient(options), [options]);
11933
- const [history, setHistory] = useState18(null);
11934
- const [selected, setSelected] = useState18("");
11935
- const [prepared, setPrepared] = useState18(null);
11936
- const [channel, setChannel] = useState18("fax");
11937
- const [recipient, setRecipient] = useState18("");
11938
- const [reviewed, setReviewed] = useState18(false);
11939
- const [confirmed, setConfirmed] = useState18(false);
11940
- const [loading, setLoading] = useState18(true);
11941
- const [busy, setBusy] = useState18(false);
11942
- const [error, setError] = useState18("");
11943
- const [notice, setNotice] = useState18("");
11944
- const [reload, setReload] = useState18(0);
11945
- const pending = useRef14(false);
11946
- const keys = useRef14(/* @__PURE__ */ new Map());
11947
- const completed = useRef14(/* @__PURE__ */ new Set());
11948
- const alive = useRef14(true);
11949
- const currentSelection = useRef14(selected);
12045
+ const [history, setHistory] = useState19(null);
12046
+ const [selected, setSelected] = useState19("");
12047
+ const [prepared, setPrepared] = useState19(null);
12048
+ const [channel, setChannel] = useState19("fax");
12049
+ const [recipient, setRecipient] = useState19("");
12050
+ const [reviewed, setReviewed] = useState19(false);
12051
+ const [confirmed, setConfirmed] = useState19(false);
12052
+ const [loading, setLoading] = useState19(true);
12053
+ const [busy, setBusy] = useState19(false);
12054
+ const [error, setError] = useState19("");
12055
+ const [notice, setNotice] = useState19("");
12056
+ const [reload, setReload] = useState19(0);
12057
+ const pending = useRef15(false);
12058
+ const keys = useRef15(/* @__PURE__ */ new Map());
12059
+ const completed = useRef15(/* @__PURE__ */ new Set());
12060
+ const alive = useRef15(true);
12061
+ const currentSelection = useRef15(selected);
11950
12062
  currentSelection.current = selected;
11951
12063
  useEffect16(() => {
11952
12064
  alive.current = true;
@@ -12030,23 +12142,23 @@ function PacketsContent({ rfa, options, permissions = [], environment = "sandbox
12030
12142
  if (alive.current) setBusy(false);
12031
12143
  }
12032
12144
  };
12033
- return /* @__PURE__ */ jsxs29("section", { "aria-label": "Saved RFA packets", children: [
12034
- /* @__PURE__ */ jsx31("h3", { children: "Saved packets" }),
12035
- /* @__PURE__ */ jsx31("p", { children: "Open the exact PDF retained for a download or submission. Forwarding preserves the original request and review deadline." }),
12036
- error ? /* @__PURE__ */ jsx31("p", { role: "alert", children: error }) : null,
12037
- notice ? /* @__PURE__ */ jsx31("p", { role: "status", children: notice }) : null,
12038
- loading ? /* @__PURE__ */ jsx31("p", { role: "status", children: "Loading saved packets\u2026" }) : null,
12039
- !loading && !history ? /* @__PURE__ */ jsx31("button", { type: "button", onClick: () => setReload((value) => value + 1), children: "Retry loading packets" }) : null,
12040
- history?.packets.length === 0 ? /* @__PURE__ */ jsx31("p", { children: "No saved packets yet." }) : history ? /* @__PURE__ */ jsxs29(Fragment18, { children: [
12041
- /* @__PURE__ */ jsxs29("label", { children: [
12145
+ return /* @__PURE__ */ jsxs30("section", { "aria-label": "Saved RFA packets", children: [
12146
+ /* @__PURE__ */ jsx32("h3", { children: "Saved packets" }),
12147
+ /* @__PURE__ */ jsx32("p", { children: "Open the exact PDF retained for a download or submission. Forwarding preserves the original request and review deadline." }),
12148
+ error ? /* @__PURE__ */ jsx32("p", { role: "alert", children: error }) : null,
12149
+ notice ? /* @__PURE__ */ jsx32("p", { role: "status", children: notice }) : null,
12150
+ loading ? /* @__PURE__ */ jsx32("p", { role: "status", children: "Loading saved packets\u2026" }) : null,
12151
+ !loading && !history ? /* @__PURE__ */ jsx32("button", { type: "button", onClick: () => setReload((value) => value + 1), children: "Retry loading packets" }) : null,
12152
+ history?.packets.length === 0 ? /* @__PURE__ */ jsx32("p", { children: "No saved packets yet." }) : history ? /* @__PURE__ */ jsxs30(Fragment19, { children: [
12153
+ /* @__PURE__ */ jsxs30("label", { children: [
12042
12154
  "Saved packet",
12043
- /* @__PURE__ */ jsxs29("select", { disabled: locked, value: selected, onChange: (event) => {
12155
+ /* @__PURE__ */ jsxs30("select", { disabled: locked, value: selected, onChange: (event) => {
12044
12156
  setSelected(event.target.value);
12045
12157
  setPrepared(null);
12046
12158
  resetReview();
12047
12159
  }, children: [
12048
- /* @__PURE__ */ jsx31("option", { value: "", children: "Choose a saved packet" }),
12049
- history.packets.map((value) => /* @__PURE__ */ jsxs29("option", { value: value.id, children: [
12160
+ /* @__PURE__ */ jsx32("option", { value: "", children: "Choose a saved packet" }),
12161
+ history.packets.map((value) => /* @__PURE__ */ jsxs30("option", { value: value.id, children: [
12050
12162
  value.source === "submission" ? "Submission" : "Download",
12051
12163
  " \xB7 revision ",
12052
12164
  value.contentRevision,
@@ -12055,67 +12167,67 @@ function PacketsContent({ rfa, options, permissions = [], environment = "sandbox
12055
12167
  ] }, value.id))
12056
12168
  ] })
12057
12169
  ] }),
12058
- /* @__PURE__ */ jsx31("button", { type: "button", disabled: locked || !packet, onClick: () => void view(), children: "View saved PDF" }),
12059
- blob ? /* @__PURE__ */ jsx31(RfaPdfReview, { blob, title: "Saved RFA packet" }) : null,
12060
- !canForward ? /* @__PURE__ */ jsx31("p", { children: environment !== "live" ? "Sandbox: saved PDFs are available for review. External forwarding is disabled." : "Forwarding requires permission from your organization." }) : selected && !eligible ? /* @__PURE__ */ jsx31("p", { children: "This packet is not eligible for forwarding. Submission packets require a successful original dispatch." }) : /* @__PURE__ */ jsxs29("fieldset", { disabled: locked, children: [
12061
- /* @__PURE__ */ jsx31("legend", { children: "Forward saved packet" }),
12062
- /* @__PURE__ */ jsx31("p", { children: "The saved packet may contain the original recipient\u2019s cover sheet. Review all pages before forwarding." }),
12063
- /* @__PURE__ */ jsxs29("label", { children: [
12170
+ /* @__PURE__ */ jsx32("button", { type: "button", disabled: locked || !packet, onClick: () => void view(), children: "View saved PDF" }),
12171
+ blob ? /* @__PURE__ */ jsx32(RfaPdfReview, { blob, title: "Saved RFA packet" }) : null,
12172
+ !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: [
12173
+ /* @__PURE__ */ jsx32("legend", { children: "Forward saved packet" }),
12174
+ /* @__PURE__ */ jsx32("p", { children: "The saved packet may contain the original recipient\u2019s cover sheet. Review all pages before forwarding." }),
12175
+ /* @__PURE__ */ jsxs30("label", { children: [
12064
12176
  "Forward by",
12065
- /* @__PURE__ */ jsxs29("select", { value: channel, onChange: (event) => {
12177
+ /* @__PURE__ */ jsxs30("select", { value: channel, onChange: (event) => {
12066
12178
  setChannel(event.target.value);
12067
12179
  resetReview();
12068
12180
  }, children: [
12069
- /* @__PURE__ */ jsx31("option", { value: "fax", children: "Fax" }),
12070
- /* @__PURE__ */ jsx31("option", { value: "email", children: "Email" })
12181
+ /* @__PURE__ */ jsx32("option", { value: "fax", children: "Fax" }),
12182
+ /* @__PURE__ */ jsx32("option", { value: "email", children: "Email" })
12071
12183
  ] })
12072
12184
  ] }),
12073
- channel === "email" ? /* @__PURE__ */ jsx31("p", { children: "Email forwarding requires email delivery to be enabled for your organization. The server will reject requests when it is unavailable." }) : null,
12074
- /* @__PURE__ */ jsxs29("label", { children: [
12185
+ 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,
12186
+ /* @__PURE__ */ jsxs30("label", { children: [
12075
12187
  channel === "fax" ? "Recipient fax (with country code)" : "Recipient email",
12076
- /* @__PURE__ */ jsx31("input", { type: channel === "fax" ? "tel" : "email", value: recipient, onChange: (event) => {
12188
+ /* @__PURE__ */ jsx32("input", { type: channel === "fax" ? "tel" : "email", value: recipient, onChange: (event) => {
12077
12189
  setRecipient(event.target.value);
12078
12190
  resetReview();
12079
12191
  } })
12080
12192
  ] }),
12081
- /* @__PURE__ */ jsxs29("label", { className: "mbrfa-check", children: [
12082
- /* @__PURE__ */ jsx31("input", { type: "checkbox", disabled: !blob || !eligible, checked: reviewed, onChange: (event) => {
12193
+ /* @__PURE__ */ jsxs30("label", { className: "mbrfa-check", children: [
12194
+ /* @__PURE__ */ jsx32("input", { type: "checkbox", disabled: !blob || !eligible, checked: reviewed, onChange: (event) => {
12083
12195
  setReviewed(event.target.checked);
12084
12196
  setConfirmed(false);
12085
12197
  } }),
12086
12198
  "I reviewed this saved packet and its attachments."
12087
12199
  ] }),
12088
- /* @__PURE__ */ jsxs29("label", { className: "mbrfa-check", children: [
12089
- /* @__PURE__ */ jsx31("input", { type: "checkbox", disabled: !reviewed || !validRecipient || !eligible, checked: confirmed, onChange: (event) => setConfirmed(event.target.checked) }),
12200
+ /* @__PURE__ */ jsxs30("label", { className: "mbrfa-check", children: [
12201
+ /* @__PURE__ */ jsx32("input", { type: "checkbox", disabled: !reviewed || !validRecipient || !eligible, checked: confirmed, onChange: (event) => setConfirmed(event.target.checked) }),
12090
12202
  "I verified that ",
12091
12203
  destination || "this recipient",
12092
12204
  " is authorized to receive this patient\u2019s packet."
12093
12205
  ] }),
12094
- alreadyForwarded ? /* @__PURE__ */ jsx31("p", { children: "A forward to this recipient is already recorded or pending. Check delivery history." }) : null,
12095
- /* @__PURE__ */ jsx31("button", { type: "button", disabled: !canForward || !eligible || !blob || !reviewed || !confirmed || !validRecipient || alreadyForwarded, onClick: () => void forward(), children: busy ? "Working\u2026" : `Forward packet by ${channel}` })
12206
+ alreadyForwarded ? /* @__PURE__ */ jsx32("p", { children: "A forward to this recipient is already recorded or pending. Check delivery history." }) : null,
12207
+ /* @__PURE__ */ jsx32("button", { type: "button", disabled: !canForward || !eligible || !blob || !reviewed || !confirmed || !validRecipient || alreadyForwarded, onClick: () => void forward(), children: busy ? "Working\u2026" : `Forward packet by ${channel}` })
12096
12208
  ] })
12097
12209
  ] }) : null
12098
12210
  ] });
12099
12211
  }
12100
12212
 
12101
12213
  // src/rfa-draft-actions.tsx
12102
- import { useEffect as useEffect17, useMemo as useMemo10, useRef as useRef15, useState as useState19 } from "react";
12214
+ import { useEffect as useEffect17, useMemo as useMemo10, useRef as useRef16, useState as useState20 } from "react";
12103
12215
  import { createRfaDraftActionsClient } from "@mindbill/browser";
12104
- import { Fragment as Fragment19, jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
12216
+ import { Fragment as Fragment20, jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
12105
12217
  function RfaDraftActions({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride, ...props }) {
12106
12218
  const options = useMemo10(() => ({ ...sessionEndpoint ? { sessionEndpoint } : {}, ...getSession ? { getSession } : {}, ...apiBaseUrl ? { apiBaseUrl } : {}, ...fetchOverride ? { fetch: fetchOverride } : {} }), [sessionEndpoint, getSession, apiBaseUrl, fetchOverride]);
12107
12219
  const identity = useMemo10(() => crypto.randomUUID(), [options]);
12108
- return /* @__PURE__ */ jsx32(DraftActionsContent, { options, ...props }, `${identity}:${props.rfa.id}:${props.rfa.contentRevision}:${props.rfa.status}:${props.rfa.signedAt}:${props.rfa.submittedAt}`);
12220
+ return /* @__PURE__ */ jsx33(DraftActionsContent, { options, ...props }, `${identity}:${props.rfa.id}:${props.rfa.contentRevision}:${props.rfa.status}:${props.rfa.signedAt}:${props.rfa.submittedAt}`);
12109
12221
  }
12110
12222
  function DraftActionsContent({ rfa, options, permissions = [], disabled = false, onCopied, onCanceled }) {
12111
12223
  const client = useMemo10(() => createRfaDraftActionsClient(options), [options]);
12112
- const [confirming, setConfirming] = useState19(null);
12113
- const [busy, setBusy] = useState19(false);
12114
- const [error, setError] = useState19("");
12115
- const [completed, setCompleted] = useState19(null);
12116
- const pending = useRef15(false);
12117
- const keys = useRef15({});
12118
- const alive = useRef15(true);
12224
+ const [confirming, setConfirming] = useState20(null);
12225
+ const [busy, setBusy] = useState20(false);
12226
+ const [error, setError] = useState20("");
12227
+ const [completed, setCompleted] = useState20(null);
12228
+ const pending = useRef16(false);
12229
+ const keys = useRef16({});
12230
+ const alive = useRef16(true);
12119
12231
  useEffect17(() => {
12120
12232
  alive.current = true;
12121
12233
  return () => {
@@ -12145,112 +12257,112 @@ function DraftActionsContent({ rfa, options, permissions = [], disabled = false,
12145
12257
  if (alive.current) setBusy(false);
12146
12258
  }
12147
12259
  };
12148
- return /* @__PURE__ */ jsxs30("section", { "aria-label": "RFA draft actions", children: [
12149
- error ? /* @__PURE__ */ jsx32("p", { role: "alert", children: error }) : null,
12150
- completed ? /* @__PURE__ */ jsx32("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__ */ jsxs30("div", { className: "mbtd-note", children: [
12151
- confirming === "copy" ? /* @__PURE__ */ jsxs30(Fragment19, { children: [
12152
- /* @__PURE__ */ jsx32("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." }),
12153
- /* @__PURE__ */ jsx32("p", { children: "Signatures, supporting documents, decisions, and delivery history remain on the original request." })
12154
- ] }) : /* @__PURE__ */ jsx32("p", { children: "Cancel this unsigned draft? It will no longer be available for submission. The request and its audit history will be retained." }),
12155
- /* @__PURE__ */ jsxs30("div", { className: "mbtd-actions", children: [
12156
- /* @__PURE__ */ jsx32("button", { type: "button", disabled: disabled || busy, onClick: () => {
12260
+ return /* @__PURE__ */ jsxs31("section", { "aria-label": "RFA draft actions", children: [
12261
+ error ? /* @__PURE__ */ jsx33("p", { role: "alert", children: error }) : null,
12262
+ 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: [
12263
+ confirming === "copy" ? /* @__PURE__ */ jsxs31(Fragment20, { children: [
12264
+ /* @__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." }),
12265
+ /* @__PURE__ */ jsx33("p", { children: "Signatures, supporting documents, decisions, and delivery history remain on the original request." })
12266
+ ] }) : /* @__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." }),
12267
+ /* @__PURE__ */ jsxs31("div", { className: "mbtd-actions", children: [
12268
+ /* @__PURE__ */ jsx33("button", { type: "button", disabled: disabled || busy, onClick: () => {
12157
12269
  void mutate(confirming);
12158
12270
  }, children: busy ? "Saving\u2026" : confirming === "copy" ? "Create draft copy" : "Confirm cancellation" }),
12159
- /* @__PURE__ */ jsx32("button", { type: "button", disabled: busy, onClick: () => {
12271
+ /* @__PURE__ */ jsx33("button", { type: "button", disabled: busy, onClick: () => {
12160
12272
  setConfirming(null);
12161
12273
  setError("");
12162
12274
  }, children: "Keep current request" })
12163
12275
  ] })
12164
- ] }) : /* @__PURE__ */ jsxs30("div", { className: "mbtd-actions", children: [
12165
- canCopy ? /* @__PURE__ */ jsx32("button", { type: "button", disabled: disabled || busy, onClick: () => setConfirming("copy"), children: "Copy to new draft" }) : null,
12166
- canCancel ? /* @__PURE__ */ jsx32("button", { type: "button", disabled: disabled || busy, onClick: () => setConfirming("cancel"), children: "Cancel draft" }) : null
12276
+ ] }) : /* @__PURE__ */ jsxs31("div", { className: "mbtd-actions", children: [
12277
+ canCopy ? /* @__PURE__ */ jsx33("button", { type: "button", disabled: disabled || busy, onClick: () => setConfirming("copy"), children: "Copy to new draft" }) : null,
12278
+ canCancel ? /* @__PURE__ */ jsx33("button", { type: "button", disabled: disabled || busy, onClick: () => setConfirming("cancel"), children: "Cancel draft" }) : null
12167
12279
  ] })
12168
12280
  ] });
12169
12281
  }
12170
12282
 
12171
12283
  // src/rfa-list-view.tsx
12172
12284
  import { getRfaLifecycleStatus as getRfaLifecycleStatus3, RFA_LIFECYCLE_LABELS as RFA_LIFECYCLE_LABELS3 } from "@mindbill/browser";
12173
- import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
12285
+ import { jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
12174
12286
  var date6 = (value) => value ? new Date(value).toLocaleDateString() : "\u2014";
12175
12287
  var label2 = (value) => value.replaceAll("_", " ");
12176
12288
  function RfaListView({ records, view, onViewChange, sortBy, sortDirection, onSort, onSelect, lifecycleAvailable = true, hideViewSwitch = false, getRfaHref, getPatientHref, getClaimHref, getProviderHref }) {
12177
- const heading = (field, title) => /* @__PURE__ */ jsx33("th", { scope: "col", "aria-sort": sortBy === field ? sortDirection === "asc" ? "ascending" : "descending" : "none", children: /* @__PURE__ */ jsxs31("button", { type: "button", onClick: () => onSort(field), children: [
12289
+ 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: [
12178
12290
  title,
12179
12291
  sortBy === field ? sortDirection === "asc" ? " \u2191" : " \u2193" : " \u2195"
12180
12292
  ] }) });
12181
- return /* @__PURE__ */ jsxs31("div", { className: "mbrfa-list", children: [
12182
- /* @__PURE__ */ jsx33("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}` }),
12183
- !hideViewSwitch ? /* @__PURE__ */ jsxs31("div", { className: "mbrfa-list-mode", children: [
12184
- /* @__PURE__ */ jsxs31("label", { children: [
12293
+ return /* @__PURE__ */ jsxs32("div", { className: "mbrfa-list", children: [
12294
+ /* @__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}` }),
12295
+ !hideViewSwitch ? /* @__PURE__ */ jsxs32("div", { className: "mbrfa-list-mode", children: [
12296
+ /* @__PURE__ */ jsxs32("label", { children: [
12185
12297
  "Show",
12186
- /* @__PURE__ */ jsxs31("select", { value: view, onChange: (event) => onViewChange(event.target.value), children: [
12187
- /* @__PURE__ */ jsx33("option", { value: "rfas", children: "RFAs \u2014 one row per request" }),
12188
- /* @__PURE__ */ jsx33("option", { value: "treatments", children: "Treatments \u2014 one row per service" })
12298
+ /* @__PURE__ */ jsxs32("select", { value: view, onChange: (event) => onViewChange(event.target.value), children: [
12299
+ /* @__PURE__ */ jsx34("option", { value: "rfas", children: "RFAs \u2014 one row per request" }),
12300
+ /* @__PURE__ */ jsx34("option", { value: "treatments", children: "Treatments \u2014 one row per service" })
12189
12301
  ] })
12190
12302
  ] }),
12191
- /* @__PURE__ */ jsx33("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." })
12303
+ /* @__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." })
12192
12304
  ] }) : null,
12193
- !records.length ? /* @__PURE__ */ jsx33("p", { children: "No requests match this view." }) : /* @__PURE__ */ jsx33("div", { className: "mbrfa-table-scroll", tabIndex: 0, role: "region", "aria-label": view === "rfas" ? "RFA table" : "Requested treatments table", children: /* @__PURE__ */ jsxs31("table", { className: "mbrfa-table", children: [
12194
- /* @__PURE__ */ jsx33("thead", { children: /* @__PURE__ */ jsxs31("tr", { children: [
12195
- /* @__PURE__ */ jsx33("th", { scope: "col", children: view === "rfas" ? "Request" : "Request / treatment" }),
12305
+ !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: [
12306
+ /* @__PURE__ */ jsx34("thead", { children: /* @__PURE__ */ jsxs32("tr", { children: [
12307
+ /* @__PURE__ */ jsx34("th", { scope: "col", children: view === "rfas" ? "Request" : "Request / treatment" }),
12196
12308
  heading("employeeName", "Patient"),
12197
12309
  heading("providerName", "Requesting physician"),
12198
- /* @__PURE__ */ jsx33("th", { scope: "col", children: view === "rfas" ? "Claims administrator" : "Service / diagnosis" }),
12310
+ /* @__PURE__ */ jsx34("th", { scope: "col", children: view === "rfas" ? "Claims administrator" : "Service / diagnosis" }),
12199
12311
  heading("submittedAt", "Sent"),
12200
- /* @__PURE__ */ jsx33("th", { scope: "col", children: "Decision due" }),
12201
- view === "rfas" ? heading(lifecycleAvailable ? "lifecycleStatus" : "status", lifecycleAvailable ? "Status" : "Clinical status") : /* @__PURE__ */ jsx33("th", { scope: "col", children: "Treatment decision" }),
12312
+ /* @__PURE__ */ jsx34("th", { scope: "col", children: "Decision due" }),
12313
+ view === "rfas" ? heading(lifecycleAvailable ? "lifecycleStatus" : "status", lifecycleAvailable ? "Status" : "Clinical status") : /* @__PURE__ */ jsx34("th", { scope: "col", children: "Treatment decision" }),
12202
12314
  heading("createdAt", "Created")
12203
12315
  ] }) }),
12204
- /* @__PURE__ */ jsx33("tbody", { children: records.flatMap((rfa) => view === "rfas" ? [/* @__PURE__ */ jsxs31("tr", { children: [
12205
- /* @__PURE__ */ jsxs31("td", { children: [
12206
- /* @__PURE__ */ jsx33(RfaLink, { href: getRfaHref?.(rfa.id), onSelect: () => onSelect(rfa.id), children: rfaTitle(rfa) }),
12207
- rfa.displayReference ? /* @__PURE__ */ jsx33("small", { children: rfa.displayReference }) : null
12316
+ /* @__PURE__ */ jsx34("tbody", { children: records.flatMap((rfa) => view === "rfas" ? [/* @__PURE__ */ jsxs32("tr", { children: [
12317
+ /* @__PURE__ */ jsxs32("td", { children: [
12318
+ /* @__PURE__ */ jsx34(RfaLink, { href: getRfaHref?.(rfa.id), onSelect: () => onSelect(rfa.id), children: rfaTitle(rfa) }),
12319
+ rfa.displayReference ? /* @__PURE__ */ jsx34("small", { children: rfa.displayReference }) : null
12208
12320
  ] }),
12209
- /* @__PURE__ */ jsxs31("td", { children: [
12210
- /* @__PURE__ */ jsx33(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }),
12211
- /* @__PURE__ */ jsx33("small", { children: /* @__PURE__ */ jsxs31(RfaLink, { href: getClaimHref?.(rfa), children: [
12321
+ /* @__PURE__ */ jsxs32("td", { children: [
12322
+ /* @__PURE__ */ jsx34(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }),
12323
+ /* @__PURE__ */ jsx34("small", { children: /* @__PURE__ */ jsxs32(RfaLink, { href: getClaimHref?.(rfa), children: [
12212
12324
  "Claim ",
12213
12325
  rfa.claimNumber || "not recorded"
12214
12326
  ] }) })
12215
12327
  ] }),
12216
- /* @__PURE__ */ jsx33("td", { children: /* @__PURE__ */ jsx33(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
12217
- /* @__PURE__ */ jsx33("td", { children: rfa.claimsAdminName || rfa.authorizationContact?.name || "Not recorded" }),
12218
- /* @__PURE__ */ jsx33("td", { children: date6(rfa.submittedAt) }),
12219
- /* @__PURE__ */ jsx33("td", { children: rfaDecisionDueText(rfa) }),
12220
- /* @__PURE__ */ jsx33("td", { children: RFA_LIFECYCLE_LABELS3[getRfaLifecycleStatus3(rfa)] }),
12221
- /* @__PURE__ */ jsx33("td", { children: date6(rfa.createdAt) })
12222
- ] }, rfa.id)] : rfa.items.map((item) => /* @__PURE__ */ jsxs31("tr", { children: [
12223
- /* @__PURE__ */ jsxs31("td", { children: [
12224
- /* @__PURE__ */ jsx33(RfaLink, { href: getRfaHref?.(rfa.id, { treatmentId: item.id }), onSelect: () => onSelect(rfa.id, item.id), children: item.serviceDescription }),
12225
- rfa.displayReference ? /* @__PURE__ */ jsx33("small", { children: rfa.displayReference }) : null
12328
+ /* @__PURE__ */ jsx34("td", { children: /* @__PURE__ */ jsx34(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
12329
+ /* @__PURE__ */ jsx34("td", { children: rfa.claimsAdminName || rfa.authorizationContact?.name || "Not recorded" }),
12330
+ /* @__PURE__ */ jsx34("td", { children: date6(rfa.submittedAt) }),
12331
+ /* @__PURE__ */ jsx34("td", { children: rfaDecisionDueText(rfa) }),
12332
+ /* @__PURE__ */ jsx34("td", { children: RFA_LIFECYCLE_LABELS3[getRfaLifecycleStatus3(rfa)] }),
12333
+ /* @__PURE__ */ jsx34("td", { children: date6(rfa.createdAt) })
12334
+ ] }, rfa.id)] : rfa.items.map((item) => /* @__PURE__ */ jsxs32("tr", { children: [
12335
+ /* @__PURE__ */ jsxs32("td", { children: [
12336
+ /* @__PURE__ */ jsx34(RfaLink, { href: getRfaHref?.(rfa.id, { treatmentId: item.id }), onSelect: () => onSelect(rfa.id, item.id), children: item.serviceDescription }),
12337
+ rfa.displayReference ? /* @__PURE__ */ jsx34("small", { children: rfa.displayReference }) : null
12226
12338
  ] }),
12227
- /* @__PURE__ */ jsxs31("td", { children: [
12228
- /* @__PURE__ */ jsx33(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }),
12229
- /* @__PURE__ */ jsx33("small", { children: /* @__PURE__ */ jsxs31(RfaLink, { href: getClaimHref?.(rfa), children: [
12339
+ /* @__PURE__ */ jsxs32("td", { children: [
12340
+ /* @__PURE__ */ jsx34(RfaLink, { href: getPatientHref?.(rfa), children: rfa.employeeName }),
12341
+ /* @__PURE__ */ jsx34("small", { children: /* @__PURE__ */ jsxs32(RfaLink, { href: getClaimHref?.(rfa), children: [
12230
12342
  "Claim ",
12231
12343
  rfa.claimNumber || "not recorded"
12232
12344
  ] }) })
12233
12345
  ] }),
12234
- /* @__PURE__ */ jsx33("td", { children: /* @__PURE__ */ jsx33(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
12235
- /* @__PURE__ */ jsxs31("td", { children: [
12346
+ /* @__PURE__ */ jsx34("td", { children: /* @__PURE__ */ jsx34(RfaLink, { href: getProviderHref?.(rfa), children: rfa.providerName }) }),
12347
+ /* @__PURE__ */ jsxs32("td", { children: [
12236
12348
  item.serviceDescription,
12237
- /* @__PURE__ */ jsxs31("small", { children: [
12349
+ /* @__PURE__ */ jsxs32("small", { children: [
12238
12350
  item.procedureCode || "No procedure code",
12239
12351
  " \xB7 ",
12240
12352
  item.diagnosisCode
12241
12353
  ] })
12242
12354
  ] }),
12243
- /* @__PURE__ */ jsx33("td", { children: date6(rfa.submittedAt) }),
12244
- /* @__PURE__ */ jsx33("td", { children: item.decisionClosure?.closed ? "\u2014" : rfaDecisionDueText(rfa) }),
12245
- /* @__PURE__ */ jsxs31("td", { children: [
12355
+ /* @__PURE__ */ jsx34("td", { children: date6(rfa.submittedAt) }),
12356
+ /* @__PURE__ */ jsx34("td", { children: item.decisionClosure?.closed ? "\u2014" : rfaDecisionDueText(rfa) }),
12357
+ /* @__PURE__ */ jsxs32("td", { children: [
12246
12358
  item.decisionClosure?.closed ? "Decision no longer required" : label2(item.outcome),
12247
- /* @__PURE__ */ jsx33("small", { children: date6(item.decidedAt) }),
12248
- item.authorizationNumber ? /* @__PURE__ */ jsxs31("small", { children: [
12359
+ /* @__PURE__ */ jsx34("small", { children: date6(item.decidedAt) }),
12360
+ item.authorizationNumber ? /* @__PURE__ */ jsxs32("small", { children: [
12249
12361
  "Authorization ",
12250
12362
  item.authorizationNumber
12251
12363
  ] }) : null
12252
12364
  ] }),
12253
- /* @__PURE__ */ jsx33("td", { children: date6(rfa.createdAt) })
12365
+ /* @__PURE__ */ jsx34("td", { children: date6(rfa.createdAt) })
12254
12366
  ] }, `${rfa.id}:${item.id}`))) })
12255
12367
  ] }) })
12256
12368
  ] });
@@ -12258,58 +12370,58 @@ function RfaListView({ records, view, onViewChange, sortBy, sortDirection, onSor
12258
12370
 
12259
12371
  // src/rfa-overview.tsx
12260
12372
  import { RFA_LIFECYCLE_LABELS as RFA_LIFECYCLE_LABELS4 } from "@mindbill/browser";
12261
- import { jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
12373
+ import { jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
12262
12374
  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" }];
12263
12375
  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"] }];
12264
12376
  function RfaOverview({ summary, onSelect, combined = false }) {
12265
12377
  const aging = summary.aging;
12266
- const countButton = (count, title, status, bucket) => count ? /* @__PURE__ */ jsx34("button", { type: "button", className: "mbrfa-count", "aria-label": `${title}: ${count} requests`, onClick: () => onSelect(status, bucket), children: count.toLocaleString() }) : /* @__PURE__ */ jsx34("span", { className: "mbrfa-zero", children: "0" });
12267
- if (!summary.byLifecycleStatus) return /* @__PURE__ */ jsxs32("section", { className: "mbrfa-overview", "aria-label": "Clinical review overview", children: [
12268
- /* @__PURE__ */ jsx34("h3", { children: "Clinical review counts" }),
12269
- /* @__PURE__ */ jsx34("div", { className: "mbrfa-legacy-grid", children: Object.entries(summary.byStatus).map(([status, count]) => /* @__PURE__ */ jsxs32("button", { type: "button", onClick: () => onSelect(status), children: [
12270
- /* @__PURE__ */ jsx34("span", { children: status.replaceAll("_", " ") }),
12271
- /* @__PURE__ */ jsx34("strong", { children: count })
12378
+ 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" });
12379
+ if (!summary.byLifecycleStatus) return /* @__PURE__ */ jsxs33("section", { className: "mbrfa-overview", "aria-label": "Clinical review overview", children: [
12380
+ /* @__PURE__ */ jsx35("h3", { children: "Clinical review counts" }),
12381
+ /* @__PURE__ */ jsx35("div", { className: "mbrfa-legacy-grid", children: Object.entries(summary.byStatus).map(([status, count]) => /* @__PURE__ */ jsxs33("button", { type: "button", onClick: () => onSelect(status), children: [
12382
+ /* @__PURE__ */ jsx35("span", { children: status.replaceAll("_", " ") }),
12383
+ /* @__PURE__ */ jsx35("strong", { children: count })
12272
12384
  ] }, status)) })
12273
12385
  ] });
12274
- return /* @__PURE__ */ jsxs32("div", { className: "mbrfa-overview", children: [
12275
- /* @__PURE__ */ jsxs32("div", { className: "mbrfa-overview-title", children: [
12276
- /* @__PURE__ */ jsxs32("div", { children: [
12277
- /* @__PURE__ */ jsx34("h3", { children: combined ? "Requests awaiting a decision" : "Status and aging" }),
12278
- /* @__PURE__ */ jsx34("p", { className: "mbrfa-aging-basis", children: "Calendar days since submission" })
12386
+ return /* @__PURE__ */ jsxs33("div", { className: "mbrfa-overview", children: [
12387
+ /* @__PURE__ */ jsxs33("div", { className: "mbrfa-overview-title", children: [
12388
+ /* @__PURE__ */ jsxs33("div", { children: [
12389
+ /* @__PURE__ */ jsx35("h3", { children: combined ? "Requests awaiting a decision" : "Status and aging" }),
12390
+ /* @__PURE__ */ jsx35("p", { className: "mbrfa-aging-basis", children: "Calendar days since submission" })
12279
12391
  ] }),
12280
- /* @__PURE__ */ jsxs32("span", { children: [
12392
+ /* @__PURE__ */ jsxs33("span", { children: [
12281
12393
  summary.total.toLocaleString(),
12282
12394
  " total requests"
12283
12395
  ] })
12284
12396
  ] }),
12285
- groups.filter((group) => !combined || group.tone === "waiting").map((group) => /* @__PURE__ */ jsxs32("section", { className: `mbrfa-status-group mbrfa-${group.tone}`, "aria-label": group.title, children: [
12286
- /* @__PURE__ */ jsxs32("div", { className: "mbrfa-aging-grid mbrfa-group-heading", children: [
12287
- /* @__PURE__ */ jsxs32("h4", { children: [
12288
- /* @__PURE__ */ jsx34("i", { "aria-hidden": "true" }),
12397
+ groups.filter((group) => !combined || group.tone === "waiting").map((group) => /* @__PURE__ */ jsxs33("section", { className: `mbrfa-status-group mbrfa-${group.tone}`, "aria-label": group.title, children: [
12398
+ /* @__PURE__ */ jsxs33("div", { className: "mbrfa-aging-grid mbrfa-group-heading", children: [
12399
+ /* @__PURE__ */ jsxs33("h4", { children: [
12400
+ /* @__PURE__ */ jsx35("i", { "aria-hidden": "true" }),
12289
12401
  group.title
12290
12402
  ] }),
12291
- buckets.map((bucket) => /* @__PURE__ */ jsx34("span", { className: "mbrfa-age-heading", children: bucket.label }, bucket.id)),
12292
- /* @__PURE__ */ jsx34("span", { className: "mbrfa-total-heading", children: "Total" })
12403
+ buckets.map((bucket) => /* @__PURE__ */ jsx35("span", { className: "mbrfa-age-heading", children: bucket.label }, bucket.id)),
12404
+ /* @__PURE__ */ jsx35("span", { className: "mbrfa-total-heading", children: "Total" })
12293
12405
  ] }),
12294
- group.states.map((status) => /* @__PURE__ */ jsxs32("div", { className: "mbrfa-aging-grid mbrfa-aging-row", children: [
12295
- /* @__PURE__ */ jsx34("strong", { children: RFA_LIFECYCLE_LABELS4[status] }),
12296
- buckets.map((bucket) => /* @__PURE__ */ jsxs32("span", { className: "mbrfa-age-cell", children: [
12297
- /* @__PURE__ */ jsx34("span", { className: "mbrfa-mobile-age", children: bucket.label }),
12298
- group.tone === "waiting" && aging ? countButton(aging.byLifecycleStatus[status]?.[bucket.id] ?? 0, `${RFA_LIFECYCLE_LABELS4[status]} \xB7 ${bucket.label} since submission`, status, bucket.id) : /* @__PURE__ */ jsx34("span", { className: "mbrfa-zero", "aria-label": "Not applicable", children: "\u2014" })
12406
+ group.states.map((status) => /* @__PURE__ */ jsxs33("div", { className: "mbrfa-aging-grid mbrfa-aging-row", children: [
12407
+ /* @__PURE__ */ jsx35("strong", { children: RFA_LIFECYCLE_LABELS4[status] }),
12408
+ buckets.map((bucket) => /* @__PURE__ */ jsxs33("span", { className: "mbrfa-age-cell", children: [
12409
+ /* @__PURE__ */ jsx35("span", { className: "mbrfa-mobile-age", children: bucket.label }),
12410
+ 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" })
12299
12411
  ] }, bucket.id)),
12300
- /* @__PURE__ */ jsx34("span", { className: "mbrfa-row-total", children: countButton(summary.byLifecycleStatus?.[status] ?? 0, RFA_LIFECYCLE_LABELS4[status], status) })
12412
+ /* @__PURE__ */ jsx35("span", { className: "mbrfa-row-total", children: countButton(summary.byLifecycleStatus?.[status] ?? 0, RFA_LIFECYCLE_LABELS4[status], status) })
12301
12413
  ] }, status))
12302
12414
  ] }, group.title)),
12303
- /* @__PURE__ */ jsxs32("p", { className: "mbrfa-overview-footnote", children: [
12415
+ /* @__PURE__ */ jsxs33("p", { className: "mbrfa-overview-footnote", children: [
12304
12416
  "Aging counts calendar days since submission, separately from the decision deadline. Only requests awaiting a treatment decision are aged.",
12305
12417
  !aging ? " Aging is unavailable from this server." : ""
12306
12418
  ] }),
12307
- /* @__PURE__ */ jsxs32("button", { type: "button", className: "mbrfa-all-requests", onClick: () => onSelect(""), children: [
12308
- /* @__PURE__ */ jsx34("strong", { children: "All requests" }),
12309
- /* @__PURE__ */ jsxs32("span", { children: [
12419
+ /* @__PURE__ */ jsxs33("button", { type: "button", className: "mbrfa-all-requests", onClick: () => onSelect(""), children: [
12420
+ /* @__PURE__ */ jsx35("strong", { children: "All requests" }),
12421
+ /* @__PURE__ */ jsxs33("span", { children: [
12310
12422
  summary.total.toLocaleString(),
12311
12423
  " ",
12312
- /* @__PURE__ */ jsx34("span", { "aria-hidden": "true", children: "\u2192" })
12424
+ /* @__PURE__ */ jsx35("span", { "aria-hidden": "true", children: "\u2192" })
12313
12425
  ] })
12314
12426
  ] })
12315
12427
  ] });
@@ -12326,69 +12438,7 @@ var rfaDashboardCss = `
12326
12438
  `;
12327
12439
 
12328
12440
  // src/rfa-create-form.tsx
12329
- import { useCallback as useCallback3, useEffect as useEffect23, useState as useState27 } from "react";
12330
-
12331
- // src/rfa-identity-select.tsx
12332
- import { useId as useId5, useRef as useRef16, useState as useState20 } from "react";
12333
- import { Fragment as Fragment20, jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
12334
- function RfaIdentitySelect({ label: label5, placeholder, searchPlaceholder, query, searchable, disabled = false, loading = false, error = "", value, options, onSearch, onSelect }) {
12335
- const id = useId5();
12336
- const trigger = useRef16(null);
12337
- const [open, setOpen] = useState20(false);
12338
- const [active, setActive] = useState20(0);
12339
- const selected = options.find((option) => option.id === value);
12340
- const choose = (option) => {
12341
- onSelect(option.id);
12342
- setOpen(false);
12343
- trigger.current?.focus();
12344
- };
12345
- return /* @__PURE__ */ jsxs33("div", { className: "mbrfa-identity-select", onBlur: (event) => {
12346
- if (!event.currentTarget.contains(event.relatedTarget)) setOpen(false);
12347
- }, onKeyDown: (event) => {
12348
- if (event.key === "Escape") {
12349
- event.preventDefault();
12350
- setOpen(false);
12351
- trigger.current?.focus();
12352
- }
12353
- }, children: [
12354
- /* @__PURE__ */ jsx35("style", { children: `.mbrfa-identity-select{position:relative;min-width:0}.mbrfa-identity-select>button{display:flex;justify-content:space-between;align-items:center;width:100%;text-align:left;gap:12px;min-height:44px}.mbrfa-identity-select small{display:block;opacity:.75;font-size:12px;margin-top:3px}.mbrfa-identity-select>button{height:44px}.mbrfa-identity-value{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mbrfa-identity-value small{display:inline;margin:0}.mbrfa-identity-menu{position:absolute;z-index:40;top:calc(100% + 6px);left:0;right:0;padding:10px;background:var(--mbtd-surface,#fff);color:inherit;border:1px solid var(--mbtd-border,#d6d3cc);border-radius:8px;box-shadow:0 8px 24px #0002}.mbrfa-identity-menu input{width:100%;box-sizing:border-box}.mbrfa-identity-options{max-height:280px;overflow:auto;margin-top:6px}.mbrfa-identity-options button{display:block;width:100%;text-align:left;padding:10px 12px;border:0;border-radius:4px;min-height:44px}.mbrfa-identity-options button:hover,.mbrfa-identity-options button[data-active=true]{background:#1c595918}.mbrfa-identity-menu p{padding:8px;margin:0}` }),
12355
- /* @__PURE__ */ jsxs33("button", { ref: trigger, type: "button", "aria-label": label5, "aria-haspopup": "listbox", "aria-expanded": open, "aria-controls": open ? `${id}-list` : void 0, disabled, onClick: () => {
12356
- setOpen(!open);
12357
- setActive(0);
12358
- }, children: [
12359
- /* @__PURE__ */ jsx35("span", { className: "mbrfa-identity-value", children: selected ? /* @__PURE__ */ jsxs33(Fragment20, { children: [
12360
- selected.label,
12361
- selected.detail ? /* @__PURE__ */ jsxs33("small", { children: [
12362
- " \xB7 ",
12363
- selected.detail
12364
- ] }) : null
12365
- ] }) : placeholder }),
12366
- /* @__PURE__ */ jsx35("span", { "aria-hidden": "true", children: "\u2304" })
12367
- ] }),
12368
- open ? /* @__PURE__ */ jsxs33("div", { className: "mbrfa-identity-menu", children: [
12369
- searchable ? /* @__PURE__ */ jsx35("input", { autoFocus: true, role: "combobox", "aria-label": searchPlaceholder, "aria-autocomplete": "list", "aria-expanded": "true", "aria-controls": `${id}-list`, "aria-activedescendant": !loading && !error && options[active] ? `${id}-${active}` : void 0, type: "search", autoComplete: "off", maxLength: 200, placeholder: searchPlaceholder, value: query, onChange: (event) => {
12370
- setActive(0);
12371
- onSearch(event.target.value);
12372
- }, onKeyDown: (event) => {
12373
- if (loading || error || !options.length) return;
12374
- if (event.key === "ArrowDown" || event.key === "ArrowUp") {
12375
- event.preventDefault();
12376
- const next = (active + (event.key === "ArrowDown" ? 1 : -1) + options.length) % options.length;
12377
- setActive(next);
12378
- document.getElementById(`${id}-${next}`)?.scrollIntoView({ block: "nearest" });
12379
- }
12380
- if (event.key === "Enter" && options[active]) {
12381
- event.preventDefault();
12382
- choose(options[active]);
12383
- }
12384
- } }) : null,
12385
- /* @__PURE__ */ jsx35("div", { className: "mbrfa-identity-options", id: `${id}-list`, role: "listbox", "aria-label": label5, "aria-busy": loading, children: loading ? /* @__PURE__ */ jsx35("p", { role: "status", children: "Searching\u2026" }) : error ? /* @__PURE__ */ jsx35("p", { role: "alert", children: error }) : options.length ? options.map((option, index) => /* @__PURE__ */ jsxs33("button", { type: "button", role: "option", id: `${id}-${index}`, "aria-selected": option.id === value, "data-active": index === active, onMouseDown: (event) => event.preventDefault(), onClick: () => choose(option), children: [
12386
- option.label,
12387
- option.detail ? /* @__PURE__ */ jsx35("small", { children: option.detail }) : null
12388
- ] }, option.id)) : /* @__PURE__ */ jsx35("p", { children: "No matches. Try another search." }) })
12389
- ] }) : null
12390
- ] });
12391
- }
12441
+ import { useCallback as useCallback3, useEffect as useEffect24, useState as useState27 } from "react";
12392
12442
 
12393
12443
  // src/rfa-claim-setup.tsx
12394
12444
  import { useEffect as useEffect18, useRef as useRef17, useState as useState21 } from "react";
@@ -12519,7 +12569,7 @@ function RfaClaimSetup({ client, disabled, onCreated, onCancel }) {
12519
12569
  }
12520
12570
 
12521
12571
  // src/rfa-practice-picker.tsx
12522
- import { useState as useState23 } from "react";
12572
+ import { useEffect as useEffect20, useRef as useRef18, useState as useState23 } from "react";
12523
12573
 
12524
12574
  // src/rfa-official-fields.tsx
12525
12575
  import { useEffect as useEffect19, useState as useState22 } from "react";
@@ -12557,10 +12607,16 @@ var contactRows = [
12557
12607
  ["phone", "Phone", 30, 2],
12558
12608
  ["fax", "Fax Number", 30, 2]
12559
12609
  ];
12560
- function RfaOfficialContactFields({ nameLabel, value, onChange, before, beforeEmail }) {
12561
- const field = (key2, label5, max, span) => /* @__PURE__ */ jsxs35("label", { className: `mbrfa-s${span}`, children: [
12610
+ function RfaOfficialContactFields({ nameLabel, value, onChange, before, beforeEmail, faxHint, editable = true }) {
12611
+ const hint = (key2) => key2 === "fax" && faxHint && !value?.fax?.trim() ? /* @__PURE__ */ jsx37("small", { className: "mbrfa-field-hint", children: faxHint }) : null;
12612
+ const field = (key2, label5, max, span) => editable ? /* @__PURE__ */ jsxs35("label", { className: `mbrfa-s${span}`, children: [
12562
12613
  label5,
12563
- /* @__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 }) })
12614
+ /* @__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 }) }),
12615
+ hint(key2)
12616
+ ] }, key2) : /* @__PURE__ */ jsxs35("div", { className: `mbrfa-s${span} mbrfa-saved`, children: [
12617
+ /* @__PURE__ */ jsx37("span", { children: label5 }),
12618
+ /* @__PURE__ */ jsx37("strong", { children: value?.[key2]?.trim() || "\u2014" }),
12619
+ hint(key2)
12564
12620
  ] }, key2);
12565
12621
  return /* @__PURE__ */ jsxs35("div", { className: "mbrfa-form-grid", children: [
12566
12622
  before,
@@ -12571,6 +12627,12 @@ function RfaOfficialContactFields({ nameLabel, value, onChange, before, beforeEm
12571
12627
  field("email", "E-mail Address", 254, 6)
12572
12628
  ] });
12573
12629
  }
12630
+ function RfaManualToggle({ manual, onChange, disabled }) {
12631
+ return /* @__PURE__ */ jsxs35("div", { className: "mbrfa-section-actions", children: [
12632
+ /* @__PURE__ */ jsx37("button", { type: "button", className: "mbrfa-link", disabled, "aria-pressed": manual, onClick: () => onChange(!manual), children: manual ? "Done editing" : "Edit manually" }),
12633
+ manual ? /* @__PURE__ */ jsx37("span", { children: "These values are saved on this request only." }) : null
12634
+ ] });
12635
+ }
12574
12636
  function useRfaFormDetails(client, claimId, renderingProviderId, enabled) {
12575
12637
  const [details, setDetails] = useState22();
12576
12638
  useEffect19(() => {
@@ -12580,7 +12642,7 @@ function useRfaFormDetails(client, claimId, renderingProviderId, enabled) {
12580
12642
  void client.getCreationContext({ claimId, renderingProviderId, limit: 1 }).then((context) => {
12581
12643
  if (!active) return;
12582
12644
  const claim = context.claims.find((value) => value.claimId === claimId), provider = context.renderingProviders.find((value) => value.id === renderingProviderId);
12583
- setDetails({ ...claim ? { employee: { formName: claim.employeeFormName, dateOfBirth: claim.dateOfBirth, employer: claim.employer } } : {}, ...provider ? { physician: { specialty: provider.specialty } } : {} });
12645
+ 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 } } : {} });
12584
12646
  }).catch(() => void 0);
12585
12647
  return () => {
12586
12648
  active = false;
@@ -12591,11 +12653,20 @@ function useRfaFormDetails(client, claimId, renderingProviderId, enabled) {
12591
12653
 
12592
12654
  // src/rfa-practice-picker.tsx
12593
12655
  import { Fragment as Fragment21, jsx as jsx38, jsxs as jsxs36 } from "react/jsx-runtime";
12594
- function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manageLocationsHref }) {
12656
+ function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manageLocationsHref, onEditPractice, onEditLocation, onChosen }) {
12595
12657
  const practices = profile?.billingProviders ?? [];
12596
12658
  const [practice, setPractice] = useState23(() => practices.find((item) => item.name === value?.name)?.id ?? "");
12597
12659
  const [location, setLocation] = useState23(() => practice ? (profile?.locations ?? []).find((item) => item.active !== false && item.street === value?.address && (!item.billingProviderId || item.billingProviderId === practice))?.id ?? "" : "");
12598
12660
  const located = (chosen, phone) => ({ address: chosen.street, city: chosen.city, state: chosen.state, zip: chosen.zip, ...chosen.contact?.name ? { contactName: chosen.contact.name } : {}, ...chosen.contact?.phone || phone ? { phone: chosen.contact?.phone || phone } : {}, ...chosen.contact?.fax ? { fax: chosen.contact.fax } : {}, ...chosen.contact?.email ? { email: chosen.contact.email } : {} });
12661
+ const savedPractice = practices.find((item) => item.id === practice), savedLocation = (profile?.locations ?? []).find((item) => item.id === location);
12662
+ const savedKey = JSON.stringify([savedPractice?.name, savedPractice?.phone, savedPractice?.billingStreet, savedPractice?.billingCity, savedPractice?.billingState, savedPractice?.billingZip, savedLocation?.street, savedLocation?.city, savedLocation?.state, savedLocation?.zip, savedLocation?.contact]);
12663
+ const appliedKey = useRef18(savedKey);
12664
+ useEffect20(() => {
12665
+ if (appliedKey.current === savedKey) return;
12666
+ appliedKey.current = savedKey;
12667
+ if (!savedPractice) return;
12668
+ onChange({ ...value, name: savedPractice.name, phone: savedPractice.phone ?? "", address: savedPractice.billingStreet ?? "", city: savedPractice.billingCity ?? "", state: savedPractice.billingState ?? "", zip: savedPractice.billingZip ?? "", ...savedLocation ? located(savedLocation, savedPractice.phone) : {} });
12669
+ }, [savedKey]);
12599
12670
  const [practiceQuery, setPracticeQuery] = useState23("");
12600
12671
  const [locationQuery, setLocationQuery] = useState23("");
12601
12672
  const locations = (profile?.locations ?? []).filter((item) => item.active !== false && (item.billingProviderId ? item.billingProviderId === practice : practices.length <= 1));
@@ -12606,13 +12677,17 @@ function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manag
12606
12677
  if (!provider) return;
12607
12678
  setPractice(id);
12608
12679
  setPracticeQuery("");
12680
+ onChosen?.();
12609
12681
  const matching = (profile?.locations ?? []).filter((item) => item.active !== false && (item.billingProviderId === id || !item.billingProviderId && practices.length === 1));
12610
12682
  const primary = matching.filter((item) => item.isPrimary);
12611
12683
  const chosen = matching.length === 1 ? matching[0] : primary.length === 1 ? primary[0] : void 0;
12612
12684
  setLocation(chosen?.id ?? "");
12613
12685
  onChange({ ...value, name: provider.name, phone: provider.phone ?? "", address: provider.billingStreet ?? "", city: provider.billingCity ?? "", state: provider.billingState ?? "", zip: provider.billingZip ?? "", ...chosen ? located(chosen, provider.phone) : {} });
12614
12686
  } }),
12615
- /* @__PURE__ */ jsx38("span", { className: "mbrfa-picker-links", children: managePracticeHref ? /* @__PURE__ */ jsx38("a", { href: managePracticeHref, target: "_blank", rel: "noopener noreferrer", children: "Add / manage practices" }) : null })
12687
+ /* @__PURE__ */ jsxs36("span", { className: "mbrfa-picker-links", children: [
12688
+ onEditPractice && practice ? /* @__PURE__ */ jsx38("button", { type: "button", className: "mbrfa-link", onClick: () => onEditPractice(practice), children: "Edit practice" }) : null,
12689
+ managePracticeHref ? /* @__PURE__ */ jsx38("a", { className: "mbrfa-link-out", href: managePracticeHref, target: "_blank", rel: "noopener noreferrer", children: onEditPractice ? "Manage practices \u2197" : "Add / manage practices" }) : null
12690
+ ] })
12616
12691
  ] }),
12617
12692
  /* @__PURE__ */ jsxs36(RfaPicker, { label: "Practice location", children: [
12618
12693
  /* @__PURE__ */ jsx38(RfaIdentitySelect, { label: "Practice location", placeholder: practice ? "Choose a location" : "Choose a practice first", searchPlaceholder: "Search locations", query: locationQuery, onSearch: setLocationQuery, searchable: true, disabled: !practice, value: location, options: locations.filter((item) => item.id === location || item.name.toLowerCase().includes(locationQuery.toLowerCase())).map((item) => ({ id: item.id, label: item.name, detail: `${item.street}, ${item.city}` })), onSelect: (id) => {
@@ -12620,18 +12695,23 @@ function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manag
12620
12695
  if (!chosen) return;
12621
12696
  setLocation(id);
12622
12697
  setLocationQuery("");
12698
+ onChosen?.();
12623
12699
  onChange({ ...value, ...located(chosen, practices.find((item) => item.id === practice)?.phone) });
12624
12700
  } }),
12625
- /* @__PURE__ */ jsx38("span", { className: "mbrfa-picker-links", children: manageLocationsHref ? /* @__PURE__ */ jsx38("a", { href: manageLocationsHref, target: "_blank", rel: "noopener noreferrer", children: "Add / manage locations" }) : null })
12701
+ /* @__PURE__ */ jsxs36("span", { className: "mbrfa-picker-links", children: [
12702
+ onEditLocation && practice && location ? /* @__PURE__ */ jsx38("button", { type: "button", className: "mbrfa-link", onClick: () => onEditLocation(location, practice), children: "Edit location" }) : null,
12703
+ onEditLocation && practice ? /* @__PURE__ */ jsx38("button", { type: "button", className: "mbrfa-link", onClick: () => onEditLocation(null, practice), children: "Add location" }) : null,
12704
+ manageLocationsHref ? /* @__PURE__ */ jsx38("a", { className: "mbrfa-link-out", href: manageLocationsHref, target: "_blank", rel: "noopener noreferrer", children: onEditLocation ? "Manage locations \u2197" : "Add / manage locations" }) : null
12705
+ ] })
12626
12706
  ] })
12627
12707
  ] });
12628
12708
  }
12629
12709
 
12630
12710
  // src/rfa-contact-picker.tsx
12631
- import { useEffect as useEffect21, useId as useId7, useState as useState25 } from "react";
12711
+ import { useEffect as useEffect22, useId as useId7, useState as useState25 } from "react";
12632
12712
 
12633
12713
  // src/rfa-draft-fields.tsx
12634
- import { useEffect as useEffect20, useId as useId6, useState as useState24 } from "react";
12714
+ import { useEffect as useEffect21, useId as useId6, useState as useState24 } from "react";
12635
12715
  import { Fragment as Fragment22, jsx as jsx39, jsxs as jsxs37 } from "react/jsx-runtime";
12636
12716
  function RfaContactFields({ title, value, onChange }) {
12637
12717
  return /* @__PURE__ */ jsxs37("fieldset", { children: [
@@ -12657,7 +12737,7 @@ function RfaDiagnosisFields({ code, description, onChange, search, officialForm
12657
12737
  const [query, setQuery] = useState24("");
12658
12738
  const [results, setResults] = useState24([]);
12659
12739
  const [error, setError] = useState24("");
12660
- useEffect20(() => {
12740
+ useEffect21(() => {
12661
12741
  let active = true;
12662
12742
  setResults([]);
12663
12743
  setError("");
@@ -12719,6 +12799,7 @@ function RfaDiagnosisFields({ code, description, onChange, search, officialForm
12719
12799
  import { jsx as jsx40, jsxs as jsxs38 } from "react/jsx-runtime";
12720
12800
  function RfaContactPicker({ administratorId, claimNumber, contextKey, value, onChange, searchClaimsAdministrators, getClaimsAdministratorDirectory, disabled, officialForm = false }) {
12721
12801
  const listId = useId7();
12802
+ const [manual, setManual] = useState25(() => officialForm && !searchClaimsAdministrators);
12722
12803
  const [query, setQuery] = useState25("");
12723
12804
  const [options, setOptions] = useState25([]);
12724
12805
  const [directory, setDirectory] = useState25(null);
@@ -12732,7 +12813,7 @@ function RfaContactPicker({ administratorId, claimNumber, contextKey, value, onC
12732
12813
  setActiveIndex(-1);
12733
12814
  if (option.id !== administratorId) onChange(option.id, null);
12734
12815
  };
12735
- useEffect21(() => {
12816
+ useEffect22(() => {
12736
12817
  let active = true;
12737
12818
  setDirectory(null);
12738
12819
  setError("");
@@ -12753,7 +12834,7 @@ function RfaContactPicker({ administratorId, claimNumber, contextKey, value, onC
12753
12834
  active = false;
12754
12835
  };
12755
12836
  }, [administratorId, contextKey, getClaimsAdministratorDirectory]);
12756
- useEffect21(() => {
12837
+ useEffect22(() => {
12757
12838
  let active = true;
12758
12839
  setOptions([]);
12759
12840
  setSearchError("");
@@ -12783,7 +12864,7 @@ function RfaContactPicker({ administratorId, claimNumber, contextKey, value, onC
12783
12864
  const option = options.find((item) => item.id === id);
12784
12865
  if (option) choose(option);
12785
12866
  } }) }) : null,
12786
- /* @__PURE__ */ jsx40(RfaPicker, { label: directory?.authorizationStatus === "claim_handling_location_routes" ? "Claim-handling office" : "Authorization contact", children: /* @__PURE__ */ jsx40(RfaAuthorizationDestination, { compact: true, contextKey: `${contextKey}:${administratorId ?? ""}`, directory, loading, error, disabled, onChange: (destination) => {
12867
+ /* @__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) => {
12787
12868
  if (!destination) return;
12788
12869
  const kept = { ...shown };
12789
12870
  delete kept.fax;
@@ -12791,7 +12872,8 @@ function RfaContactPicker({ administratorId, claimNumber, contextKey, value, onC
12791
12872
  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 } });
12792
12873
  } }) })
12793
12874
  ] }),
12794
- /* @__PURE__ */ jsx40("fieldset", { className: "mbrfa-plain", disabled, children: /* @__PURE__ */ jsx40(RfaOfficialContactFields, { nameLabel: "Company Name", value: shown, onChange: (contact) => onChange(administratorId, contact) }) })
12875
+ /* @__PURE__ */ jsx40("fieldset", { className: "mbrfa-plain", disabled, children: /* @__PURE__ */ jsx40(RfaOfficialContactFields, { editable: manual, nameLabel: "Company Name", value: shown, onChange: (contact) => onChange(administratorId, contact) }) }),
12876
+ /* @__PURE__ */ jsx40(RfaManualToggle, { manual, onChange: setManual, disabled })
12795
12877
  ] });
12796
12878
  }
12797
12879
  return /* @__PURE__ */ jsxs38("fieldset", { disabled, children: [
@@ -12834,7 +12916,7 @@ function RfaContactPicker({ administratorId, claimNumber, contextKey, value, onC
12834
12916
  }
12835
12917
 
12836
12918
  // src/rfa-draft-form.tsx
12837
- import { useEffect as useEffect22, useRef as useRef18, useState as useState26 } from "react";
12919
+ import { useEffect as useEffect23, useRef as useRef19, useState as useState26 } from "react";
12838
12920
  import { Fragment as Fragment23, jsx as jsx41, jsxs as jsxs39 } from "react/jsx-runtime";
12839
12921
  function normalizeRfaDraft(draft2) {
12840
12922
  const copy = structuredClone(draft2);
@@ -12882,9 +12964,9 @@ function validateRfaDraft(draft2) {
12882
12964
  }
12883
12965
  return null;
12884
12966
  }
12885
- function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetails, selectors, managePracticeHref, manageLocationsHref, onRefreshProfile, onReview, onPreview, searchClaimsAdministrators, getClaimsAdministratorDirectory, embedded = false, onSave, onBack, mode = "create", searchDiagnosisCodes, organizationProfile, savedDiagnosisCodes = [], supportingDocuments, disabled = false, ...appearance }) {
12967
+ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetails, selectors, onEditPractice, onEditLocation, managePracticeHref, manageLocationsHref, onRefreshProfile, onReview, onPreview, searchClaimsAdministrators, getClaimsAdministratorDirectory, embedded = false, onSave, onBack, mode = "create", searchDiagnosisCodes, organizationProfile, savedDiagnosisCodes = [], supportingDocuments, disabled = false, ...appearance }) {
12886
12968
  const [savedDraft, setDraft] = useState26(() => normalizeRfaDraft(initialDraft));
12887
- useEffect22(() => {
12969
+ useEffect23(() => {
12888
12970
  if (identity) setDraft((current) => {
12889
12971
  const next = { ...current };
12890
12972
  delete next.providerPhone;
@@ -12894,14 +12976,22 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
12894
12976
  }, [identity?.renderingProviderId]);
12895
12977
  const savedPhysician = organizationProfile?.renderingProviders?.find((provider) => provider.id === (identity?.renderingProviderId ?? savedDraft.renderingProviderId));
12896
12978
  const physicianEmail = savedPhysician?.email;
12897
- const filledEmail = useRef18(void 0);
12898
- useEffect22(() => {
12979
+ const returnFax = formDetails?.returnFax;
12980
+ useEffect23(() => {
12981
+ if (officialForm && returnFax) setDraft((current) => current.requestingPractice?.fax?.trim() ? current : { ...current, requestingPractice: { ...current.requestingPractice, fax: returnFax } });
12982
+ }, [officialForm, returnFax, savedDraft.requestingPractice?.fax]);
12983
+ const returnEmail = formDetails?.returnEmail;
12984
+ useEffect23(() => {
12985
+ if (officialForm && returnEmail && !physicianEmail) setDraft((current) => current.requestingPractice?.email?.trim() ? current : { ...current, requestingPractice: { ...current.requestingPractice, email: returnEmail } });
12986
+ }, [officialForm, returnEmail, physicianEmail, savedDraft.requestingPractice?.email]);
12987
+ const filledEmail = useRef19(void 0);
12988
+ useEffect23(() => {
12899
12989
  if (!officialForm || !physicianEmail) return;
12900
12990
  const previous = filledEmail.current;
12901
12991
  filledEmail.current = physicianEmail;
12902
12992
  setDraft((current) => current.requestingPractice?.email && current.requestingPractice.email !== previous ? current : { ...current, requestingPractice: { ...current.requestingPractice, email: physicianEmail } });
12903
12993
  }, [officialForm, physicianEmail]);
12904
- useEffect22(() => {
12994
+ useEffect23(() => {
12905
12995
  if (!officialForm || !onRefreshProfile) return;
12906
12996
  let last = Date.now();
12907
12997
  const refresh = () => {
@@ -12916,10 +13006,14 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
12916
13006
  document.removeEventListener("visibilitychange", refresh);
12917
13007
  };
12918
13008
  }, [officialForm, onRefreshProfile]);
13009
+ const [practiceManualChoice, setPracticeManual] = useState26(null);
13010
+ const savedPractices = organizationProfile?.billingProviders ?? [];
13011
+ const typedPractice = Object.values(savedDraft.requestingPractice ?? {}).some((value) => value?.trim());
13012
+ const practiceManual = practiceManualChoice ?? !(savedPractices.some((provider) => provider.name === savedDraft.requestingPractice?.name) || !typedPractice && savedPractices.length > 0);
12919
13013
  const [administratorOverride, setAdministratorOverride] = useState26(null);
12920
13014
  const identityKey = `${identity?.claimId ?? ""}:${identity?.claimsAdminId ?? ""}`;
12921
- const previousClaim = useRef18(identityKey);
12922
- useEffect22(() => {
13015
+ const previousClaim = useRef19(identityKey);
13016
+ useEffect23(() => {
12923
13017
  if (previousClaim.current !== identityKey) {
12924
13018
  setAdministratorOverride(null);
12925
13019
  setDraft((current) => ({ ...current, authorizationContact: null, ...officialForm ? { items: [{ diagnosisCode: savedDiagnosisCodes[0] ?? "", serviceDescription: "" }] } : {} }));
@@ -12939,7 +13033,7 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
12939
13033
  else delete draft2.claimsAdminId;
12940
13034
  }
12941
13035
  const [intent, setIntent] = useState26("save");
12942
- const intentRef = useRef18(intent);
13036
+ const intentRef = useRef19(intent);
12943
13037
  const chooseIntent = (value) => {
12944
13038
  intentRef.current = value;
12945
13039
  setIntent(value);
@@ -12989,7 +13083,7 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
12989
13083
  event.preventDefault();
12990
13084
  if (locked) return;
12991
13085
  const next = normalizeRfaDraft(draft2);
12992
- void action.save(next, validateRfaDraft(next));
13086
+ 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));
12993
13087
  };
12994
13088
  const saveError = action.error ? /* @__PURE__ */ jsxs39("p", { role: "alert", children: [
12995
13089
  action.error,
@@ -12998,7 +13092,7 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
12998
13092
  if (officialForm) return /* @__PURE__ */ jsxs39(TreatmentDraftShell, { ...appearance, hideHeading: embedded, title: "Request for authorization", description: "DWC Form RFA", children: [
12999
13093
  mode === "edit" ? /* @__PURE__ */ jsx41("p", { className: "mbtd-note", children: "Saving replaces this draft, clears its signature, and requires a new signing review. It does not send the request or authorize treatment." }) : null,
13000
13094
  onBack ? /* @__PURE__ */ jsx41("button", { type: "button", disabled: locked, onClick: () => onBack(draft2), children: "Back to patient and physician" }) : null,
13001
- /* @__PURE__ */ jsxs39("form", { onSubmit: submit, children: [
13095
+ /* @__PURE__ */ jsxs39("form", { onSubmit: submit, className: "mbrfa-official", children: [
13002
13096
  /* @__PURE__ */ jsxs39("fieldset", { disabled: locked, className: "mbrfa-request-details", children: [
13003
13097
  /* @__PURE__ */ jsx41("legend", { children: "Request type" }),
13004
13098
  /* @__PURE__ */ jsxs39("div", { className: "mbtd-grid", children: [
@@ -13034,21 +13128,24 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13034
13128
  /* @__PURE__ */ jsx41("legend", { children: "Requesting Physician Information" }),
13035
13129
  /* @__PURE__ */ jsxs39("div", { className: "mbrfa-pickers", "data-columns": selectors?.physician ? 3 : 2, children: [
13036
13130
  selectors?.physician ? /* @__PURE__ */ jsx41(RfaPicker, { label: "Requesting physician", children: selectors.physician }) : null,
13037
- /* @__PURE__ */ jsx41(RfaPracticePicker, { profile: organizationProfile, value: draft2.requestingPractice, onChange: (requestingPractice) => update({ requestingPractice }), ...managePracticeHref ? { managePracticeHref } : {}, ...manageLocationsHref ? { manageLocationsHref } : {} })
13131
+ /* @__PURE__ */ jsx41(RfaPracticePicker, { profile: organizationProfile, value: draft2.requestingPractice, onChange: (requestingPractice) => update({ requestingPractice }), ...managePracticeHref ? { managePracticeHref } : {}, ...manageLocationsHref ? { manageLocationsHref } : {}, onEditPractice, onEditLocation, onChosen: () => setPracticeManual(false) })
13038
13132
  ] }),
13039
13133
  /* @__PURE__ */ jsx41("fieldset", { className: "mbrfa-plain", disabled: locked, children: /* @__PURE__ */ jsx41(
13040
13134
  RfaOfficialContactFields,
13041
13135
  {
13136
+ editable: practiceManual,
13042
13137
  nameLabel: "Practice Name",
13043
13138
  value: draft2.requestingPractice,
13044
13139
  onChange: (requestingPractice) => update({ requestingPractice }),
13045
- before: /* @__PURE__ */ jsx41(RfaSavedField, { span: 6, label: "Name", value: draft2.providerName }),
13140
+ faxHint: "Required to send. The decision is faxed back here. Save it on the practice location to fill it automatically.",
13141
+ before: /* @__PURE__ */ jsx41(RfaSavedField, { span: 6, label: "Physician Name", value: draft2.providerName }),
13046
13142
  beforeEmail: /* @__PURE__ */ jsxs39(Fragment23, { children: [
13047
13143
  /* @__PURE__ */ jsx41(RfaSavedField, { span: 3, label: "Specialty", value: formDetails?.physician?.specialty ?? savedPhysician?.specialty }),
13048
13144
  /* @__PURE__ */ jsx41(RfaSavedField, { span: 3, label: "NPI Number", value: draft2.providerNpi })
13049
13145
  ] })
13050
13146
  }
13051
- ) })
13147
+ ) }),
13148
+ /* @__PURE__ */ jsx41(RfaManualToggle, { manual: practiceManual, onChange: setPracticeManual, disabled: locked })
13052
13149
  ] }),
13053
13150
  /* @__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) => {
13054
13151
  setAdministratorOverride({ id });
@@ -13281,7 +13378,7 @@ function SavedIdentityForm({ client, claimId, renderingProviderId, onSave, canCr
13281
13378
  const [loading, setLoading] = useState27(true);
13282
13379
  const [error, setError] = useState27("");
13283
13380
  const [reload, setReload] = useState27(0);
13284
- useEffect23(() => {
13381
+ useEffect24(() => {
13285
13382
  let active = true;
13286
13383
  setLoading(true);
13287
13384
  setError("");
@@ -13321,7 +13418,7 @@ function SavedIdentityForm({ client, claimId, renderingProviderId, onSave, canCr
13321
13418
  };
13322
13419
  }, [client, query, effectiveClaimId, effectiveProviderId, renderingProviderId, reload]);
13323
13420
  const refreshOnReturn = !!draftFormProps?.officialForm;
13324
- useEffect23(() => {
13421
+ useEffect24(() => {
13325
13422
  if (!refreshOnReturn) return;
13326
13423
  let last = Date.now();
13327
13424
  const refresh = () => {
@@ -13339,11 +13436,11 @@ function SavedIdentityForm({ client, claimId, renderingProviderId, onSave, canCr
13339
13436
  const claim = context?.claims.find((value) => value.claimId === selectedClaim);
13340
13437
  const provider = context?.renderingProviders.find((value) => value.id === selectedProvider);
13341
13438
  const locked = disabled || loading;
13342
- useEffect23(() => {
13439
+ useEffect24(() => {
13343
13440
  const timer = setTimeout(() => setQuery((value) => value.search === searchInput.trim() ? value : { ...value, search: searchInput.trim(), cursor: "" }), 300);
13344
13441
  return () => clearTimeout(timer);
13345
13442
  }, [searchInput]);
13346
- useEffect23(() => {
13443
+ useEffect24(() => {
13347
13444
  const timer = setTimeout(() => setQuery((value) => value.providerSearch === providerSearchInput.trim() ? value : { ...value, providerSearch: providerSearchInput.trim(), providerCursor: "" }), 300);
13348
13445
  return () => clearTimeout(timer);
13349
13446
  }, [providerSearchInput]);
@@ -13485,7 +13582,9 @@ function SavedIdentityForm({ client, claimId, renderingProviderId, onSave, canCr
13485
13582
  const selectedDetails = useRfaFormDetails(client, claim?.claimId ?? "", provider?.id ?? "", official && !!claim && !effectiveClaimId);
13486
13583
  const formDetails = {
13487
13584
  ...claim ? { employee: selectedDetails?.employee ?? { formName: claim.employeeFormName, dateOfBirth: claim.dateOfBirth, employer: claim.employer } } : {},
13488
- ...provider ? { physician: { specialty: provider.specialty } } : {}
13585
+ ...provider ? { physician: { specialty: provider.specialty } } : {},
13586
+ ...context?.returnFax ? { returnFax: context.returnFax } : {},
13587
+ ...context?.returnEmail ? { returnEmail: context.returnEmail } : {}
13489
13588
  };
13490
13589
  return /* @__PURE__ */ jsxs40(TreatmentDraftShell, { ...appearance, title: "New authorization request", description: official ? "DWC Form RFA" : renderClaimSelector ? "Choose a patient, then select their injury / claim. Complete the treatment and attach supporting documents below." : "Choose an existing claim or add a new patient and injury here. Complete the treatment and attach supporting documents below.", children: [
13491
13590
  addingClaim ? /* @__PURE__ */ jsx42(RfaClaimSetup, { client, disabled, onCancel: () => setAddingClaim(false), onCreated: (result) => {
@@ -13596,7 +13695,7 @@ function rfaDraftReplacement(draft2, expectedRevision) {
13596
13695
  }
13597
13696
 
13598
13697
  // src/rfa-lifecycle-controls.tsx
13599
- import { useEffect as useEffect24, useMemo as useMemo11, useRef as useRef19, useState as useState28 } from "react";
13698
+ import { useEffect as useEffect25, useMemo as useMemo11, useRef as useRef20, useState as useState28 } from "react";
13600
13699
  import { createRfaClient as createRfaClient3, createRfaLifecycleClient as createRfaLifecycleClient3 } from "@mindbill/browser";
13601
13700
  import { Fragment as Fragment25, jsx as jsx43, jsxs as jsxs41 } from "react/jsx-runtime";
13602
13701
  var text2 = (form, name) => String(form.get(name) ?? "").trim();
@@ -13615,7 +13714,7 @@ function RfaLifecycleControls({ sessionEndpoint, getSession, apiBaseUrl, fetch:
13615
13714
  }
13616
13715
  function LifecycleContent({ rfa: providedRfa, options, permissions = [], onUpdated, selectedResponseDocumentId, rows: rows3 = false, ...appearance }) {
13617
13716
  const [rfa, setRfa] = useState28(providedRfa);
13618
- useEffect24(() => {
13717
+ useEffect25(() => {
13619
13718
  setRfa(providedRfa);
13620
13719
  }, [providedRfa]);
13621
13720
  const client = useMemo11(() => createRfaLifecycleClient3(options), [options]);
@@ -13631,7 +13730,7 @@ function LifecycleContent({ rfa: providedRfa, options, permissions = [], onUpdat
13631
13730
  const [responsePdf, setResponsePdf] = useState28(null);
13632
13731
  const [previewError, setPreviewError] = useState28("");
13633
13732
  const [previewReload, setPreviewReload] = useState28(0);
13634
- useEffect24(() => {
13733
+ useEffect25(() => {
13635
13734
  let active = true;
13636
13735
  setResponsePdf(null);
13637
13736
  setPreviewError("");
@@ -13647,16 +13746,16 @@ function LifecycleContent({ rfa: providedRfa, options, permissions = [], onUpdat
13647
13746
  };
13648
13747
  }, [records, rfa.id, responseDocument, rfa.documents, previewReload]);
13649
13748
  const [outcomes, setOutcomes] = useState28({});
13650
- const alive = useRef19(true);
13651
- const pending = useRef19(false);
13652
- const keys = useRef19(/* @__PURE__ */ new Map());
13653
- useEffect24(() => {
13749
+ const alive = useRef20(true);
13750
+ const pending = useRef20(false);
13751
+ const keys = useRef20(/* @__PURE__ */ new Map());
13752
+ useEffect25(() => {
13654
13753
  alive.current = true;
13655
13754
  return () => {
13656
13755
  alive.current = false;
13657
13756
  };
13658
13757
  }, []);
13659
- useEffect24(() => {
13758
+ useEffect25(() => {
13660
13759
  let active = true;
13661
13760
  (async () => {
13662
13761
  const found = [];
@@ -13682,7 +13781,7 @@ function LifecycleContent({ rfa: providedRfa, options, permissions = [], onUpdat
13682
13781
  active = false;
13683
13782
  };
13684
13783
  }, [client, rfa.claimId, rfa.id, rfa.updatedAt, reload]);
13685
- useEffect24(() => {
13784
+ useEffect25(() => {
13686
13785
  const refresh = () => {
13687
13786
  if (!pending.current && document.visibilityState !== "hidden" && !document.activeElement?.closest("form")) setReload((value) => value + 1);
13688
13787
  };
@@ -14080,7 +14179,7 @@ function FollowUpForm({ task, selected, editable, disabled, onSave, onReview, ha
14080
14179
  }
14081
14180
 
14082
14181
  // src/rfa-provider-signature-setup.tsx
14083
- import { useRef as useRef20, useState as useState29 } from "react";
14182
+ import { useRef as useRef21, useState as useState29 } from "react";
14084
14183
  import { jsx as jsx44, jsxs as jsxs42 } from "react/jsx-runtime";
14085
14184
  function RfaProviderSignatureSetup(props) {
14086
14185
  return /* @__PURE__ */ jsx44(SignatureForm, { ...props }, props.renderingProviderId);
@@ -14091,7 +14190,7 @@ function SignatureForm({ client, renderingProviderId, providerName, disabled, on
14091
14190
  const [authorized, setAuthorized] = useState29(false);
14092
14191
  const [busy, setBusy] = useState29(false);
14093
14192
  const [error, setError] = useState29("");
14094
- const attempt = useRef20(null);
14193
+ const attempt = useRef21(null);
14095
14194
  return /* @__PURE__ */ jsx44("form", { onSubmit: async (event) => {
14096
14195
  event.preventDefault();
14097
14196
  if (busy || disabled || !file || !authorized || !actor.trim() || !client.saveProviderSignature) return;
@@ -14169,9 +14268,9 @@ function RfaDashboard({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOve
14169
14268
  const identity = useMemo12(() => ({ client, signatureClient, key: key() }), [client, signatureClient]);
14170
14269
  return /* @__PURE__ */ jsx45(RfaDashboardContent, { ...props, ...patientId ? { patientId } : {}, ...claimId ? { claimId } : {}, ...renderingProviderId ? { renderingProviderId } : {}, client, signatureClient, options }, `${identity.key}:${patientId ?? ""}:${claimId ?? ""}:${renderingProviderId ?? ""}`);
14171
14270
  }
14172
- 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, 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 }) {
14173
- const active = useRef21(true);
14174
- useEffect25(() => {
14271
+ 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 }) {
14272
+ const active = useRef22(true);
14273
+ useEffect26(() => {
14175
14274
  active.current = true;
14176
14275
  return () => {
14177
14276
  active.current = false;
@@ -14179,7 +14278,7 @@ function RfaDashboardContent({ client, signatureClient, options, patientId, clai
14179
14278
  }, []);
14180
14279
  const references = useMemo12(() => createBillReferenceClient2(options), [options]);
14181
14280
  const [profile, setProfile] = useState30();
14182
- const draftFormProps = { officialForm, ...managePracticeHref ? { managePracticeHref } : {}, ...manageLocationsHref ? { manageLocationsHref } : {}, onRefreshProfile: async () => {
14281
+ const draftFormProps = { officialForm, ...onEditPractice ? { onEditPractice } : {}, ...onEditLocation ? { onEditLocation } : {}, ...managePracticeHref ? { managePracticeHref } : {}, ...manageLocationsHref ? { manageLocationsHref } : {}, onRefreshProfile: async () => {
14183
14282
  const next = await createOrganizationClient4(options).getBillingProfile();
14184
14283
  if (active.current) setProfile(next);
14185
14284
  }, ...client.searchClaimsAdministrators ? { searchClaimsAdministrators: client.searchClaimsAdministrators } : {}, ...client.getClaimsAdministratorDirectory ? { getClaimsAdministratorDirectory: client.getClaimsAdministratorDirectory } : {}, searchDiagnosisCodes: references.searchDiagnosisCodes, ...profile ? { organizationProfile: profile } : {} };
@@ -14219,7 +14318,7 @@ function RfaDashboardContent({ client, signatureClient, options, patientId, clai
14219
14318
  setSelectedResponseDocumentId(context?.responseDocumentId);
14220
14319
  setSelected(id);
14221
14320
  };
14222
- useEffect25(() => {
14321
+ useEffect26(() => {
14223
14322
  if (!creating && !selected) return;
14224
14323
  let active2 = true;
14225
14324
  createOrganizationClient4(options).getBillingProfile().then((value) => {
@@ -14231,8 +14330,8 @@ function RfaDashboardContent({ client, signatureClient, options, patientId, clai
14231
14330
  };
14232
14331
  }, [options, creating, selected]);
14233
14332
  const [loading, setLoading] = useState30(true);
14234
- const createKeys = useRef21(/* @__PURE__ */ new Map());
14235
- useEffect25(() => {
14333
+ const createKeys = useRef22(/* @__PURE__ */ new Map());
14334
+ useEffect26(() => {
14236
14335
  const timer = setTimeout(() => {
14237
14336
  setSearch(searchInput.trim());
14238
14337
  setCursor(void 0);
@@ -14240,7 +14339,7 @@ function RfaDashboardContent({ client, signatureClient, options, patientId, clai
14240
14339
  }, 300);
14241
14340
  return () => clearTimeout(timer);
14242
14341
  }, [searchInput]);
14243
- useEffect25(() => {
14342
+ useEffect26(() => {
14244
14343
  if (selected || creating) return;
14245
14344
  let alive = true;
14246
14345
  let pending = false;
@@ -14438,20 +14537,20 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
14438
14537
  setDetailTab("details");
14439
14538
  setTimeout(() => document.getElementById(`${tabId}-${suffix}`)?.scrollIntoView?.({ block: "start", behavior: "smooth" }), 0);
14440
14539
  };
14441
- useEffect25(() => {
14540
+ useEffect26(() => {
14442
14541
  if (selectedItem || selectedResponseDocumentId) setDetailTab("details");
14443
14542
  }, [selectedResponseDocumentId, selectedItem]);
14444
- const responseFocused = useRef21(false);
14445
- useEffect25(() => {
14543
+ const responseFocused = useRef22(false);
14544
+ useEffect26(() => {
14446
14545
  if (simple && rfa && selectedResponseDocumentId && !responseFocused.current) {
14447
14546
  responseFocused.current = true;
14448
14547
  document.getElementById(`${tabId}-review`)?.scrollIntoView?.({ block: "start" });
14449
14548
  }
14450
14549
  }, [simple, rfa, selectedResponseDocumentId, tabId]);
14451
- const alive = useRef21(true);
14452
- const pending = useRef21(false);
14453
- const loadGeneration = useRef21(0);
14454
- const keys = useRef21(/* @__PURE__ */ new Map());
14550
+ const alive = useRef22(true);
14551
+ const pending = useRef22(false);
14552
+ const loadGeneration = useRef22(0);
14553
+ const keys = useRef22(/* @__PURE__ */ new Map());
14455
14554
  const [descriptions2, setDescriptions] = useState30({});
14456
14555
  const [preview, setPreview] = useState30(null);
14457
14556
  const [previewPdf, setPreviewPdf] = useState30(null);
@@ -14463,7 +14562,7 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
14463
14562
  const [directoryError, setDirectoryError] = useState30(null);
14464
14563
  const [directoryOpen, setDirectoryOpen] = useState30(false);
14465
14564
  const [openedDocument, setOpenedDocument] = useState30(null);
14466
- useEffect25(() => {
14565
+ useEffect26(() => {
14467
14566
  alive.current = true;
14468
14567
  return () => {
14469
14568
  alive.current = false;
@@ -14481,7 +14580,7 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
14481
14580
  const currentForm = forms.sort((a, b) => (b.createdAt ?? "").localeCompare(a.createdAt ?? ""))[0];
14482
14581
  setDocumentIds(value.documents.filter((document2) => document2.id === currentForm?.id || ["clinical_report", "supporting_record"].includes(document2.documentType)).map((document2) => document2.id));
14483
14582
  };
14484
- useEffect25(() => {
14583
+ useEffect26(() => {
14485
14584
  let active = true;
14486
14585
  const generation = ++loadGeneration.current;
14487
14586
  setError("");
@@ -14494,9 +14593,9 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
14494
14593
  active = false;
14495
14594
  };
14496
14595
  }, [client, id, reload]);
14497
- const currentRfa = useRef21(rfa);
14596
+ const currentRfa = useRef22(rfa);
14498
14597
  currentRfa.current = rfa;
14499
- useEffect25(() => {
14598
+ useEffect26(() => {
14500
14599
  let active = true;
14501
14600
  let reading = false;
14502
14601
  const refresh = async () => {
@@ -14526,8 +14625,8 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
14526
14625
  document.removeEventListener("visibilitychange", resume);
14527
14626
  };
14528
14627
  }, [client, id, editing]);
14529
- const focusedTreatment = useRef21(null);
14530
- useEffect25(() => {
14628
+ const focusedTreatment = useRef22(null);
14629
+ useEffect26(() => {
14531
14630
  if (!rfa || !selectedItem || focusedTreatment.current === selectedItem) return;
14532
14631
  const element = document.getElementById(`rfa-treatment-${selectedItem}`);
14533
14632
  if (element) {
@@ -14537,7 +14636,7 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
14537
14636
  }
14538
14637
  }, [rfa, selectedItem, detailTab]);
14539
14638
  const claimsAdminId = rfa?.claimsAdminId;
14540
- useEffect25(() => {
14639
+ useEffect26(() => {
14541
14640
  let active = true;
14542
14641
  setDirectory(null);
14543
14642
  setDirectoryError(null);
@@ -15903,7 +16002,7 @@ function BillSubmissionsRibbon({
15903
16002
  }
15904
16003
 
15905
16004
  // src/report-bill-status-dialog.tsx
15906
- import { useEffect as useEffect26, useState as useState32 } from "react";
16005
+ import { useEffect as useEffect27, useState as useState32 } from "react";
15907
16006
  import {
15908
16007
  REPORT_BILL_STATUS_OPTIONS
15909
16008
  } from "@mindbill/browser";
@@ -16124,7 +16223,7 @@ function ReportBillStatusDialog({
16124
16223
  const [phone, setPhone] = useState32("");
16125
16224
  const [callReference, setCallReference] = useState32("");
16126
16225
  const [note, setNote] = useState32("");
16127
- useEffect26(() => {
16226
+ useEffect27(() => {
16128
16227
  const onKey = (event) => {
16129
16228
  if (event.key === "Escape" && !submitting) onCancel();
16130
16229
  };
@@ -16259,7 +16358,7 @@ function ReportBillStatusDialog({
16259
16358
  }
16260
16359
 
16261
16360
  // src/payment-review.tsx
16262
- import { useEffect as useEffect27, useMemo as useMemo15, useState as useState33 } from "react";
16361
+ import { useEffect as useEffect28, useMemo as useMemo15, useState as useState33 } from "react";
16263
16362
 
16264
16363
  // src/billing-operations-client.ts
16265
16364
  import {
@@ -16434,7 +16533,7 @@ function ConnectedPaymentReview({ initialQuery, onSelectBill, onPostPayment, app
16434
16533
  const [error, setError] = useState33(false);
16435
16534
  const [retry, setRetry] = useState33(0);
16436
16535
  const invalidRange = Boolean(query.receivedFrom && query.receivedTo && query.receivedFrom > query.receivedTo);
16437
- useEffect27(() => {
16536
+ useEffect28(() => {
16438
16537
  const controller = new AbortController();
16439
16538
  setResult(null);
16440
16539
  setError(false);
@@ -16561,7 +16660,7 @@ function ConnectedPaymentReview({ initialQuery, onSelectBill, onPostPayment, app
16561
16660
  }
16562
16661
 
16563
16662
  // src/notification-settings.tsx
16564
- import { useEffect as useEffect28, useId as useId10, useRef as useRef22, useState as useState34 } from "react";
16663
+ import { useEffect as useEffect29, useId as useId10, useRef as useRef23, useState as useState34 } from "react";
16565
16664
  import { Fragment as Fragment31, jsx as jsx54, jsxs as jsxs51 } from "react/jsx-runtime";
16566
16665
  function defaultNotificationPreferences() {
16567
16666
  return { enabled: false, statusUpdates: false, agingDays: [], quietHours: true, reportDigest: "off" };
@@ -16603,8 +16702,8 @@ function NotificationSettingsSession({ adapter, appearance, className, style, on
16603
16702
  const [notice, setNotice] = useState34("");
16604
16703
  const [failed, setFailed] = useState34(false);
16605
16704
  const [reload, setReload] = useState34(0);
16606
- const request = useRef22(0);
16607
- useEffect28(() => {
16705
+ const request = useRef23(0);
16706
+ useEffect29(() => {
16608
16707
  const current = ++request.current;
16609
16708
  setPhase("loading");
16610
16709
  setSnapshot(null);
@@ -16747,7 +16846,7 @@ function NotificationSettingsSession({ adapter, appearance, className, style, on
16747
16846
  }
16748
16847
 
16749
16848
  // src/notification-recipients.tsx
16750
- import { useEffect as useEffect29, useId as useId11, useRef as useRef23, useState as useState35 } from "react";
16849
+ import { useEffect as useEffect30, useId as useId11, useRef as useRef24, useState as useState35 } from "react";
16751
16850
  import { jsx as jsx55, jsxs as jsxs52 } from "react/jsx-runtime";
16752
16851
  function notificationRecipientInvitation(input, requestId) {
16753
16852
  const preferences = notificationSettingsUpdate({ ...input, enabled: false }, false);
@@ -16788,9 +16887,9 @@ function RecipientSettingsSession({ adapter, appearance, className, style }) {
16788
16887
  const [notice, setNotice] = useState35("");
16789
16888
  const [failed, setFailed] = useState35(false);
16790
16889
  const [hasReceipt, setHasReceipt] = useState35(false);
16791
- const generation = useRef23(0);
16792
- const pending = useRef23(null);
16793
- useEffect29(() => {
16890
+ const generation = useRef24(0);
16891
+ const pending = useRef24(null);
16892
+ useEffect30(() => {
16794
16893
  const current = ++generation.current;
16795
16894
  setBusy(true);
16796
16895
  setSnapshot(null);
@@ -16945,9 +17044,9 @@ function RecipientSettingsSession({ adapter, appearance, className, style }) {
16945
17044
  // src/connected-bill-status.tsx
16946
17045
  import {
16947
17046
  useCallback as useCallback4,
16948
- useEffect as useEffect30,
17047
+ useEffect as useEffect31,
16949
17048
  useMemo as useMemo16,
16950
- useRef as useRef24,
17049
+ useRef as useRef25,
16951
17050
  useState as useState36
16952
17051
  } from "react";
16953
17052
  import {
@@ -17098,12 +17197,12 @@ function useBillStatus({
17098
17197
  const [error, setError] = useState36(null);
17099
17198
  const [isLoading, setIsLoading] = useState36(enabled && !initialData);
17100
17199
  const [isRefreshing, setIsRefreshing] = useState36(false);
17101
- const dataRef = useRef24(initialData);
17102
- const initialDataRef = useRef24(initialData);
17200
+ const dataRef = useRef25(initialData);
17201
+ const initialDataRef = useRef25(initialData);
17103
17202
  initialDataRef.current = initialData;
17104
- const activeControllerRef = useRef24(null);
17105
- const requestSequence = useRef24(0);
17106
- useEffect30(() => {
17203
+ const activeControllerRef = useRef25(null);
17204
+ const requestSequence = useRef25(0);
17205
+ useEffect31(() => {
17107
17206
  const seed = initialDataRef.current;
17108
17207
  dataRef.current = seed;
17109
17208
  setData(seed);
@@ -17144,10 +17243,10 @@ function useBillStatus({
17144
17243
  }
17145
17244
  }
17146
17245
  }, [billId, client, enabled]);
17147
- useEffect30(() => {
17246
+ useEffect31(() => {
17148
17247
  if (enabled) void load();
17149
17248
  }, [enabled, load]);
17150
- useEffect30(() => {
17249
+ useEffect31(() => {
17151
17250
  if (!enabled || refreshInterval <= 0) return;
17152
17251
  const timer = window.setInterval(() => void load(), refreshInterval);
17153
17252
  const onFocus = () => void load();
@@ -17205,7 +17304,7 @@ function ConnectedBillStatus({
17205
17304
  }
17206
17305
 
17207
17306
  // src/bill-lifecycle-surfaces.tsx
17208
- import { useEffect as useEffect31, useRef as useRef25, useState as useState37 } from "react";
17307
+ import { useEffect as useEffect32, useRef as useRef26, useState as useState37 } from "react";
17209
17308
  import { Fragment as Fragment33, jsx as jsx57, jsxs as jsxs54 } from "react/jsx-runtime";
17210
17309
  function visibleBillLifecycleActions(actions2, showUnavailable = false, maxVisible) {
17211
17310
  const visible = actions2.filter((action) => action.enabled || showUnavailable);
@@ -17283,8 +17382,8 @@ function historyDate(iso) {
17283
17382
  }
17284
17383
  function BillHistoryTable({ entries, selectedEntryId, emptyLabel = "No bill history yet.", appearance, className, style, formatDate = historyDate, documentHref, onOpenDocument }) {
17285
17384
  const [expanded, setExpanded] = useState37({});
17286
- const selectedRowRef = useRef25(null);
17287
- useEffect31(() => {
17385
+ const selectedRowRef = useRef26(null);
17386
+ useEffect32(() => {
17288
17387
  if (!selectedEntryId) return;
17289
17388
  const selected = entries.find((entry) => entry.id === selectedEntryId);
17290
17389
  if (selected?.details) setExpanded((current) => current[selectedEntryId] ? current : { ...current, [selectedEntryId]: true });
@@ -17843,9 +17942,9 @@ var lifecycleSurfaceStyles = `
17843
17942
  // src/connected-bill-lifecycle.tsx
17844
17943
  import {
17845
17944
  useCallback as useCallback5,
17846
- useEffect as useEffect32,
17945
+ useEffect as useEffect33,
17847
17946
  useMemo as useMemo18,
17848
- useRef as useRef26,
17947
+ useRef as useRef27,
17849
17948
  useState as useState39
17850
17949
  } from "react";
17851
17950
  import {
@@ -18237,7 +18336,7 @@ function useBillLifecycle({
18237
18336
  const [isLoading, setIsLoading] = useState39(enabled);
18238
18337
  const [isRefreshing, setIsRefreshing] = useState39(false);
18239
18338
  const [isMutating, setIsMutating] = useState39(false);
18240
- const mounted = useRef26(true);
18339
+ const mounted = useRef27(true);
18241
18340
  const client = useMemo18(() => createBillLifecycleClient({
18242
18341
  billId: providedBillId,
18243
18342
  sessionEndpoint,
@@ -18245,12 +18344,12 @@ function useBillLifecycle({
18245
18344
  apiBaseUrl,
18246
18345
  fetch: fetchOverride
18247
18346
  }), [apiBaseUrl, fetchOverride, getSession, providedBillId, sessionEndpoint]);
18248
- useEffect32(() => {
18347
+ useEffect33(() => {
18249
18348
  setData(null);
18250
18349
  setError(null);
18251
18350
  setIsLoading(enabled);
18252
18351
  }, [enabled, providedBillId]);
18253
- useEffect32(() => {
18352
+ useEffect33(() => {
18254
18353
  mounted.current = true;
18255
18354
  return () => {
18256
18355
  mounted.current = false;
@@ -18274,7 +18373,7 @@ function useBillLifecycle({
18274
18373
  }
18275
18374
  }
18276
18375
  }, [client, enabled]);
18277
- useEffect32(() => {
18376
+ useEffect33(() => {
18278
18377
  if (!enabled) return;
18279
18378
  void refresh();
18280
18379
  const interval2 = refreshInterval > 0 ? window.setInterval(() => void refresh(), refreshInterval) : null;
@@ -18400,10 +18499,10 @@ function useBillLifecycle({
18400
18499
  };
18401
18500
  }
18402
18501
  function LifecycleDialog({ children, title, wide = false, onClose }) {
18403
- const dialog = useRef26(null);
18404
- const onCloseRef = useRef26(onClose);
18502
+ const dialog = useRef27(null);
18503
+ const onCloseRef = useRef27(onClose);
18405
18504
  onCloseRef.current = onClose;
18406
- useEffect32(() => {
18505
+ useEffect33(() => {
18407
18506
  const previous = document.activeElement;
18408
18507
  dialog.current?.focus();
18409
18508
  const onKeyDown = (event) => event.key === "Escape" && onCloseRef.current();
@@ -18695,11 +18794,11 @@ function ConnectedBillLifecycle({
18695
18794
  const [payment, setPayment] = useState39({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
18696
18795
  const [duplicateError, setDuplicateError] = useState39("");
18697
18796
  const currentAttemptKey = data?.attempts?.find((attempt) => attempt.isCurrent)?.id ?? data?.history?.filter((entry) => entry.kind === "submission").at(-1)?.id ?? data?.bill.id;
18698
- useEffect32(() => {
18797
+ useEffect33(() => {
18699
18798
  setPanel("");
18700
18799
  }, [currentAttemptKey]);
18701
18800
  const actor = actorName?.trim() ? { actorName: actorName.trim() } : {};
18702
- const lastData = useRef26(null);
18801
+ const lastData = useRef27(null);
18703
18802
  const correctionInitialBill = useMemo18(() => data ? correctionBill(data) : null, [data]);
18704
18803
  const correctionAttachments = useMemo18(() => data ? data.bill.attachments.map((attachment) => {
18705
18804
  const documentType = correctionDocumentType(attachment.documentType);
@@ -18716,7 +18815,7 @@ function ConnectedBillLifecycle({
18716
18815
  };
18717
18816
  }) : [], [data, lifecycle]);
18718
18817
  const correctionAttentionFields = useMemo18(() => data?.rejection?.issues?.flatMap((issue) => issue.fieldPaths || []).filter((path, index, fields2) => fields2.indexOf(path) === index) || [], [data]);
18719
- useEffect32(() => {
18818
+ useEffect33(() => {
18720
18819
  if (!data || data === lastData.current) return;
18721
18820
  lastData.current = data;
18722
18821
  onChanged?.(data);
@@ -19210,11 +19309,11 @@ var CONNECTED_LIFECYCLE_STYLES = `
19210
19309
  // src/connected-billing-workspace.tsx
19211
19310
  import {
19212
19311
  useCallback as useCallback6,
19213
- useEffect as useEffect33,
19312
+ useEffect as useEffect34,
19214
19313
  useId as useId12,
19215
19314
  useLayoutEffect,
19216
19315
  useMemo as useMemo19,
19217
- useRef as useRef27,
19316
+ useRef as useRef28,
19218
19317
  useState as useState40
19219
19318
  } from "react";
19220
19319
  import { Fragment as Fragment36, jsx as jsx60, jsxs as jsxs57 } from "react/jsx-runtime";
@@ -19270,7 +19369,7 @@ function Surface({ appearance, className = "", style, children, surfaceRef }) {
19270
19369
  ] });
19271
19370
  }
19272
19371
  function useAvailableViewportHeight() {
19273
- const workspaceRef = useRef27(null);
19372
+ const workspaceRef = useRef28(null);
19274
19373
  const [availableHeight, setAvailableHeight] = useState40(null);
19275
19374
  useLayoutEffect(() => {
19276
19375
  const element = workspaceRef.current;
@@ -19327,7 +19426,7 @@ function BillSearchContent({
19327
19426
  if (!signal?.aborted) setLoading(false);
19328
19427
  }
19329
19428
  }, [client, query]);
19330
- useEffect33(() => {
19429
+ useEffect34(() => {
19331
19430
  const controller = new AbortController();
19332
19431
  void load(controller.signal);
19333
19432
  return () => controller.abort();
@@ -19458,7 +19557,7 @@ function BillTasksContent({ client, onDrillDown, appearance }) {
19458
19557
  if (!signal?.aborted) setLoading(false);
19459
19558
  }
19460
19559
  }, [claimsAdminId, renderingProviderId, client]);
19461
- useEffect33(() => {
19560
+ useEffect34(() => {
19462
19561
  const controller = new AbortController();
19463
19562
  void load(controller.signal);
19464
19563
  return () => controller.abort();
@@ -19522,7 +19621,7 @@ function ConnectedServiceLineItemsReport({ appearance, className, style, initial
19522
19621
  const [to, setTo] = useState40(initialTo ?? defaults.to);
19523
19622
  const [data, setData] = useState40(null);
19524
19623
  const [error, setError] = useState40(null);
19525
- useEffect33(() => {
19624
+ useEffect34(() => {
19526
19625
  const controller = new AbortController();
19527
19626
  setError(null);
19528
19627
  void client.getServiceLineItems({ from, to }, controller.signal).then(setData).catch((cause) => {
@@ -19607,7 +19706,7 @@ function ConnectedProductivityReport({ appearance, className, style, initialFrom
19607
19706
  const [to, setTo] = useState40(initialTo ?? defaults.to);
19608
19707
  const [data, setData] = useState40(null);
19609
19708
  const [error, setError] = useState40(null);
19610
- useEffect33(() => {
19709
+ useEffect34(() => {
19611
19710
  const controller = new AbortController();
19612
19711
  setError(null);
19613
19712
  void client.getProductivity({ from, to }, controller.signal).then(setData).catch((cause) => {
@@ -19891,9 +19990,9 @@ function DentalDraftEditor({ initialContent, onSave, disabled = false, ...appear
19891
19990
 
19892
19991
  // src/index.tsx
19893
19992
  function widget(tagName, props) {
19894
- const ref = useRef28(null);
19993
+ const ref = useRef29(null);
19895
19994
  const { onMindBill, onMindBillError } = props;
19896
- useEffect34(() => {
19995
+ useEffect35(() => {
19897
19996
  const element = ref.current;
19898
19997
  if (!element) return;
19899
19998
  const handleEvent = (event) => onMindBill?.(event);