@mindbill/react 0.21.3 → 0.22.0

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
@@ -1155,7 +1155,7 @@ var READ_ONLY_STYLES = `
1155
1155
  `;
1156
1156
 
1157
1157
  // src/bill-submission-form.tsx
1158
- import { useCallback, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
1158
+ import { createContext, useCallback, useContext, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
1159
1159
  import {
1160
1160
  createBillReferenceClient
1161
1161
  } from "@mindbill/browser";
@@ -1528,6 +1528,33 @@ function mergeOptions(defaults, supplied) {
1528
1528
  function mergeDiagnosisOptions(options) {
1529
1529
  return [...new Map(options.map((item) => [item.code.toUpperCase(), item])).values()].sort((left, right) => left.code.localeCompare(right.code, void 0, { numeric: true }));
1530
1530
  }
1531
+ var BillSubmissionSectionsContext = createContext(null);
1532
+ function BillSubmissionSection({ id }) {
1533
+ const sections = useContext(BillSubmissionSectionsContext);
1534
+ if (!sections) throw new Error("Bill submission sections must be rendered inside BillSubmissionForm.");
1535
+ return /* @__PURE__ */ jsx3(Fragment2, { children: sections[id] });
1536
+ }
1537
+ function BillSubmissionHeader() {
1538
+ return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "header" });
1539
+ }
1540
+ function BillSubmissionPatientSection() {
1541
+ return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "patient" });
1542
+ }
1543
+ function BillSubmissionClaimSection() {
1544
+ return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "claim" });
1545
+ }
1546
+ function BillSubmissionProvidersSection() {
1547
+ return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "providers" });
1548
+ }
1549
+ function BillSubmissionServiceLinesSection() {
1550
+ return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "serviceLines" });
1551
+ }
1552
+ function BillSubmissionAttachmentsSection() {
1553
+ return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "attachments" });
1554
+ }
1555
+ function BillSubmissionActions() {
1556
+ return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "actions" });
1557
+ }
1531
1558
  function BillSubmissionForm({
1532
1559
  initialBill,
1533
1560
  attachments = EMPTY_ATTACHMENTS,
@@ -1548,7 +1575,8 @@ function BillSubmissionForm({
1548
1575
  disabled = false,
1549
1576
  submitLabel = "Submit bill",
1550
1577
  heading = "Bill information",
1551
- description = "Review the bill details, add attachments, and submit."
1578
+ description = "Review the bill details, add attachments, and submit.",
1579
+ children
1552
1580
  }) {
1553
1581
  const [bill, setBill] = useState2(() => cloneBill(initialBill));
1554
1582
  const [selectedIds, setSelectedIds] = useState2(() => attachments.map((item) => item.id));
@@ -1740,197 +1768,481 @@ function BillSubmissionForm({
1740
1768
  }
1741
1769
  }
1742
1770
  const claimsAdministratorError = errors["claim.claimsAdministrator"] ?? (!bill.claim.claimsAdministrator?.id ? "Required for routing \u2014 search and select a claims administrator." : void 0);
1743
- return /* @__PURE__ */ jsxs3("form", { ref: formRef, className: `${className} mbsf`, style: { ...mindBillAppearanceStyle(appearance), ...style }, onSubmit: (event) => {
1744
- event.preventDefault();
1745
- void submit();
1746
- }, noValidate: true, children: [
1747
- /* @__PURE__ */ jsx3("style", { children: css }),
1748
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-head", children: [
1749
- /* @__PURE__ */ jsxs3("div", { children: [
1750
- /* @__PURE__ */ jsx3("h3", { className: "mbsf-title", children: heading }),
1751
- /* @__PURE__ */ jsx3("p", { className: "mbsf-copy", children: description })
1771
+ const headerSection = /* @__PURE__ */ jsxs3("div", { className: "mbsf-head", children: [
1772
+ /* @__PURE__ */ jsxs3("div", { children: [
1773
+ /* @__PURE__ */ jsx3("h3", { className: "mbsf-title", children: heading }),
1774
+ /* @__PURE__ */ jsx3("p", { className: "mbsf-copy", children: description })
1775
+ ] }),
1776
+ /* @__PURE__ */ jsxs3("span", { className: "mbsf-required", children: [
1777
+ /* @__PURE__ */ jsx3(RequiredMark, {}),
1778
+ " Required"
1779
+ ] })
1780
+ ] });
1781
+ const patientSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
1782
+ /* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Patient" }),
1783
+ /* @__PURE__ */ jsxs3("div", { className: "mbsf-grid", children: [
1784
+ /* @__PURE__ */ jsx3(Field2, { path: "patient.firstName", label: "First name", required: true, error: errors["patient.firstName"], children: text(bill.patient.firstName, (firstName) => setBill((c) => ({ ...c, patient: { ...c.patient, firstName } }))) }),
1785
+ /* @__PURE__ */ jsx3(Field2, { path: "patient.lastName", label: "Last name", required: true, error: errors["patient.lastName"], children: text(bill.patient.lastName, (lastName) => setBill((c) => ({ ...c, patient: { ...c.patient, lastName } }))) }),
1786
+ /* @__PURE__ */ jsx3(Field2, { label: "Middle name", children: text(bill.patient.middleName, (middleName) => setBill((c) => ({ ...c, patient: { ...c.patient, middleName } }))) }),
1787
+ /* @__PURE__ */ jsx3(Field2, { label: "Phone (optional)", children: text(bill.patient.phone, (phone) => setBill((c) => ({ ...c, patient: { ...c.patient, phone } })), { type: "tel" }) }),
1788
+ /* @__PURE__ */ jsx3(Field2, { path: "patient.dateOfBirth", label: "Date of birth", required: true, error: errors["patient.dateOfBirth"], children: /* @__PURE__ */ jsx3(TextDateInput, { ariaLabel: "Date of birth", value: bill.patient.dateOfBirth, disabled: locked, required: true, onChange: (dateOfBirth) => setBill((c) => ({ ...c, patient: { ...c.patient, dateOfBirth } })) }) }),
1789
+ /* @__PURE__ */ jsx3(Field2, { path: "patient.address.line1", label: "Address", required: true, span: true, error: errors["patient.address.line1"], children: text(bill.patient.address.line1, (line1) => setAddress({ line1 }), { placeholder: "Street address" }) }),
1790
+ /* @__PURE__ */ jsxs3(Field2, { path: "patient.address.postalCode", label: "ZIP", required: true, error: errors["patient.address.postalCode"], children: [
1791
+ text(bill.patient.address.postalCode, updatePostalCode, { maxLength: 10 }),
1792
+ postalStatus ? /* @__PURE__ */ jsx3("small", { className: "mbsf-help", children: postalStatus }) : null
1752
1793
  ] }),
1753
- /* @__PURE__ */ jsxs3("span", { className: "mbsf-required", children: [
1754
- /* @__PURE__ */ jsx3(RequiredMark, {}),
1755
- " Required"
1794
+ /* @__PURE__ */ jsx3(Field2, { path: "patient.address.city", label: "City", required: true, error: errors["patient.address.city"], children: text(bill.patient.address.city, (city) => setAddress({ city })) }),
1795
+ /* @__PURE__ */ jsx3(Field2, { path: "patient.address.state", label: "State", required: true, error: errors["patient.address.state"], children: text(bill.patient.address.state, (state) => setAddress({ state: state.toUpperCase() }), { maxLength: 2 }) })
1796
+ ] })
1797
+ ] });
1798
+ const claimSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
1799
+ /* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Injury & claim" }),
1800
+ /* @__PURE__ */ jsxs3("div", { className: "mbsf-grid", children: [
1801
+ /* @__PURE__ */ jsx3(Field2, { path: "service.date", label: "Date of service", required: true, error: errors["service.date"], children: /* @__PURE__ */ jsx3(TextDateInput, { ariaLabel: "Date of service", value: bill.service.date, disabled: locked, required: true, onChange: (date2) => setBill((c) => ({ ...c, service: { ...c.service, date: date2 } })) }) }),
1802
+ /* @__PURE__ */ jsx3(Field2, { label: "Date of injury", children: /* @__PURE__ */ jsx3(TextDateInput, { ariaLabel: "Date of injury", value: bill.claim.dateOfInjury, disabled: locked, onChange: (dateOfInjury) => setBill((c) => ({ ...c, claim: { ...c.claim, dateOfInjury } })) }) }),
1803
+ /* @__PURE__ */ jsx3(Field2, { label: "Employer (optional)", children: text(bill.claim.employer, (employer) => setBill((c) => ({ ...c, claim: { ...c.claim, employer } }))) }),
1804
+ /* @__PURE__ */ jsx3(Field2, { path: "claim.claimNumber", label: "Claim number", required: true, error: errors["claim.claimNumber"], children: text(bill.claim.claimNumber, (claimNumber) => setBill((c) => ({ ...c, claim: { ...c.claim, claimNumber } }))) }),
1805
+ /* @__PURE__ */ jsx3(Field2, { label: "WCAB / ADJ number (optional)", children: text(bill.claim.adjNumber, (adjNumber) => setBill((c) => ({ ...c, claim: { ...c.claim, adjNumber } }))) }),
1806
+ /* @__PURE__ */ jsx3(Field2, { path: "claim.claimsAdministrator", label: "Claims administrator", required: true, span: true, error: claimsAdministratorError, children: /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: "Claims administrator", invalid: Boolean(claimsAdministratorError), disabled: locked, loading: payerLoading, value: bill.claim.claimsAdministrator?.name ?? "", placeholder: "Search the payer directory\u2026", options: payerResults.map((payer) => ({ id: payer.id, label: payer.name, detail: [payer.hasElectronic ? "Electronic" : "Work comp", ...payer.states ?? []].join(" \xB7 ") })), onQuery: searchPayers, onSelect: (option) => setBill((c) => ({ ...c, claim: { ...c.claim, claimsAdministrator: { id: option.id, name: option.label } } })) }) }),
1807
+ /* @__PURE__ */ jsx3(Field2, { label: "Injury description (optional)", span: true, children: text(bill.claim.description, (description2) => setBill((c) => ({ ...c, claim: { ...c.claim, description: description2 } }))) }),
1808
+ /* @__PURE__ */ jsxs3(Field2, { label: "Diagnosis codes (ICD-10)", span: true, children: [
1809
+ /* @__PURE__ */ jsx3("div", { className: "mbsf-quick-picks", "aria-label": "Common diagnosis codes", children: BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS.map((option) => {
1810
+ const selected = (bill.diagnoses ?? []).includes(option.code);
1811
+ return /* @__PURE__ */ jsxs3("button", { className: "mbsf-quick-pick", "data-selected": selected, type: "button", "aria-pressed": selected, title: `${option.code} \u2014 ${option.description}`, onClick: () => setBill((current) => ({ ...current, diagnoses: selected ? (current.diagnoses ?? []).filter((code) => code !== option.code) : [.../* @__PURE__ */ new Set([...current.diagnoses ?? [], option.code])] })), children: [
1812
+ selected ? "\u2713" : "+",
1813
+ " ",
1814
+ option.label
1815
+ ] }, option.code);
1816
+ }) }),
1817
+ /* @__PURE__ */ jsx3("div", { className: "mbsf-chips", children: (bill.diagnoses ?? []).map((code) => {
1818
+ const option = [...BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS, ...diagnosisChoices].find((item) => item.code === code);
1819
+ return /* @__PURE__ */ jsxs3("span", { className: "mbsf-chip", children: [
1820
+ /* @__PURE__ */ jsx3("strong", { children: code }),
1821
+ option?.description ? ` ${option.description}` : "",
1822
+ /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": `Remove ${code}`, onClick: () => setBill((c) => ({ ...c, diagnoses: (c.diagnoses ?? []).filter((item) => item !== code) })), children: "\xD7" })
1823
+ ] }, code);
1824
+ }) }),
1825
+ /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: "Add diagnosis code", disabled: locked, loading: diagnosisLoading, loadingMore: diagnosisLoadingMore, value: "", placeholder: bill.diagnoses?.length ?? 0 ? `${bill.diagnoses.length} selected \u2014 add more\u2026` : "Search ICD-10 codes\u2026", options: diagnosisChoices.filter((item) => !(bill.diagnoses ?? []).includes(item.code)).map((item) => ({ id: item.code, label: item.code, detail: item.description })), onOpen: () => {
1826
+ if (diagnosisQuery !== "") loadDiagnoses("");
1827
+ }, onQuery: searchDiagnoses, onEndReached: () => loadDiagnoses(diagnosisQuery ?? "", true), onSelect: (option) => setBill((c) => ({ ...c, diagnoses: [.../* @__PURE__ */ new Set([...c.diagnoses ?? [], option.id])] })) })
1756
1828
  ] })
1757
- ] }),
1758
- /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
1759
- /* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Patient" }),
1760
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-grid", children: [
1761
- /* @__PURE__ */ jsx3(Field2, { path: "patient.firstName", label: "First name", required: true, error: errors["patient.firstName"], children: text(bill.patient.firstName, (firstName) => setBill((c) => ({ ...c, patient: { ...c.patient, firstName } }))) }),
1762
- /* @__PURE__ */ jsx3(Field2, { path: "patient.lastName", label: "Last name", required: true, error: errors["patient.lastName"], children: text(bill.patient.lastName, (lastName) => setBill((c) => ({ ...c, patient: { ...c.patient, lastName } }))) }),
1763
- /* @__PURE__ */ jsx3(Field2, { label: "Middle name", children: text(bill.patient.middleName, (middleName) => setBill((c) => ({ ...c, patient: { ...c.patient, middleName } }))) }),
1764
- /* @__PURE__ */ jsx3(Field2, { label: "Phone (optional)", children: text(bill.patient.phone, (phone) => setBill((c) => ({ ...c, patient: { ...c.patient, phone } })), { type: "tel" }) }),
1765
- /* @__PURE__ */ jsx3(Field2, { path: "patient.dateOfBirth", label: "Date of birth", required: true, error: errors["patient.dateOfBirth"], children: /* @__PURE__ */ jsx3(TextDateInput, { ariaLabel: "Date of birth", value: bill.patient.dateOfBirth, disabled: locked, required: true, onChange: (dateOfBirth) => setBill((c) => ({ ...c, patient: { ...c.patient, dateOfBirth } })) }) }),
1766
- /* @__PURE__ */ jsx3(Field2, { path: "patient.address.line1", label: "Address", required: true, span: true, error: errors["patient.address.line1"], children: text(bill.patient.address.line1, (line1) => setAddress({ line1 }), { placeholder: "Street address" }) }),
1767
- /* @__PURE__ */ jsxs3(Field2, { path: "patient.address.postalCode", label: "ZIP", required: true, error: errors["patient.address.postalCode"], children: [
1768
- text(bill.patient.address.postalCode, updatePostalCode, { maxLength: 10 }),
1769
- postalStatus ? /* @__PURE__ */ jsx3("small", { className: "mbsf-help", children: postalStatus }) : null
1829
+ ] })
1830
+ ] });
1831
+ const providersSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
1832
+ /* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Providers & place of service" }),
1833
+ /* @__PURE__ */ jsxs3("div", { className: "mbsf-grid", children: [
1834
+ /* @__PURE__ */ jsx3(Field2, { label: "Billing provider", children: text(bill.billingProvider?.name, (name) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, name } }))) }),
1835
+ /* @__PURE__ */ jsx3(Field2, { label: "Billing tax ID", children: text(bill.billingProvider?.taxId, (taxId) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, taxId } }))) }),
1836
+ /* @__PURE__ */ jsx3(Field2, { label: "Billing NPI", children: text(bill.billingProvider?.npi, (npi) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, npi } }))) }),
1837
+ /* @__PURE__ */ jsx3(Field2, { label: "Billing phone", children: text(bill.billingProvider?.phone, (phone) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, phone } })), { type: "tel" }) }),
1838
+ /* @__PURE__ */ jsx3(Field2, { label: "Rendering provider", children: text(bill.renderingProvider?.name, (name) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, name } }))) }),
1839
+ /* @__PURE__ */ jsx3(Field2, { label: "Specialty", children: text(bill.renderingProvider?.specialty, (specialty) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, specialty } }))) }),
1840
+ /* @__PURE__ */ jsx3(Field2, { label: "Rendering NPI", children: text(bill.renderingProvider?.npi, (npi) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, npi } }))) }),
1841
+ /* @__PURE__ */ jsx3(Field2, { label: "License number", children: text(bill.renderingProvider?.licenseNumber, (licenseNumber) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, licenseNumber } }))) }),
1842
+ /* @__PURE__ */ jsx3(Field2, { label: "License state", children: text(bill.renderingProvider?.licenseState, (licenseState) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, licenseState: licenseState.toUpperCase() } })), { maxLength: 2 }) }),
1843
+ /* @__PURE__ */ jsx3(Field2, { label: "Service location", children: text(bill.serviceLocation?.name, (name) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, name } }))) }),
1844
+ /* @__PURE__ */ jsx3(Field2, { label: "Place of service", children: text(bill.serviceLocation?.placeOfServiceCode, (placeOfServiceCode) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, placeOfServiceCode } })), { maxLength: 2 }) })
1845
+ ] })
1846
+ ] });
1847
+ const serviceLinesSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
1848
+ /* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Evaluation & service lines" }),
1849
+ /* @__PURE__ */ jsx3("p", { className: "mbsf-help", children: "Sets the evaluator/specialty modifier on medical-legal evaluation lines." }),
1850
+ /* @__PURE__ */ jsx3("div", { className: "mbsf-segments", role: "group", "aria-label": "Evaluation type", children: [["qme", "QME (default)"], ["ame", "AME"], ["psych_qme", "Psych QME"]].map(([type, label]) => /* @__PURE__ */ jsx3("button", { className: "mbsf-segment", type: "button", "aria-pressed": evaluationType === type, onClick: () => changeEvaluation(type), children: label }, type)) }),
1851
+ /* @__PURE__ */ jsx3("p", { className: "mbsf-help", children: evaluationType === "ame" ? "Agreed Medical Evaluator \u2014 eligible ML evaluation codes default to modifier -94." : evaluationType === "psych_qme" ? "Psychiatric QME \u2014 eligible ML evaluation codes default to modifier -96 (-95 for ML200)." : "Qualified Medical Evaluator \u2014 eligible ML evaluation codes default to modifier -95." }),
1852
+ /* @__PURE__ */ jsxs3("div", { className: "mbsf-lines", "data-field-path": "serviceLines", "data-invalid": Boolean(errors.serviceLines), children: [
1853
+ /* @__PURE__ */ jsxs3("div", { className: "mbsf-line-head", children: [
1854
+ /* @__PURE__ */ jsx3("span", { children: "Procedure code" }),
1855
+ /* @__PURE__ */ jsx3("span", { children: "Modifiers" }),
1856
+ /* @__PURE__ */ jsx3("span", { children: "Units" }),
1857
+ /* @__PURE__ */ jsx3("span", { children: "Allowed" }),
1858
+ /* @__PURE__ */ jsx3("span", {}),
1859
+ " "
1860
+ ] }),
1861
+ bill.serviceLines.map((line, index) => /* @__PURE__ */ jsxs3("div", { className: "mbsf-line", children: [
1862
+ /* @__PURE__ */ jsxs3("div", { "data-label": "Procedure code", "data-field-path": `serviceLines.${index}.code`, "data-invalid": Boolean(errors[`serviceLines.${index}.code`]), children: [
1863
+ /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: `Procedure code ${index + 1}`, invalid: Boolean(errors[`serviceLines.${index}.code`]), disabled: locked, value: line.code, placeholder: "Search or enter code\u2026", options: procedures.map((item) => ({ id: item.code, label: item.code, detail: item.description })), createOption: customProcedureOption, onSelect: (option) => {
1864
+ const auto = evaluationModifier(evaluationType, option.id);
1865
+ setLine(index, { code: option.id, ...auto ? { modifiers: [auto, ...(line.modifiers ?? []).filter((item) => !["94", "95", "96"].includes(item.replace(/^-/, "")))] } : line.modifiers ? { modifiers: line.modifiers } : {} });
1866
+ } }),
1867
+ line.code ? /* @__PURE__ */ jsx3("small", { className: "mbsf-help", children: procedures.find((item) => item.code === line.code)?.description ?? "Custom CPT, HCPCS, or medical-legal code" }) : null,
1868
+ errors[`serviceLines.${index}.code`] ? /* @__PURE__ */ jsx3("small", { className: "mbsf-error", role: "alert", children: errors[`serviceLines.${index}.code`] }) : null
1869
+ ] }),
1870
+ /* @__PURE__ */ jsxs3("div", { "data-label": "Modifiers", children: [
1871
+ /* @__PURE__ */ jsx3("div", { className: "mbsf-chips", children: (line.modifiers ?? []).map((modifier) => /* @__PURE__ */ jsxs3("span", { className: "mbsf-chip", children: [
1872
+ "\u2212",
1873
+ modifier.replace(/^-/, ""),
1874
+ /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": `Remove modifier ${modifier}`, onClick: () => setLine(index, { modifiers: (line.modifiers ?? []).filter((item) => item !== modifier) }), children: "\xD7" })
1875
+ ] }, modifier)) }),
1876
+ /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: `Modifiers ${index + 1}`, disabled: locked, value: "", placeholder: line.modifiers?.length ?? 0 ? `${line.modifiers.length} modifier${line.modifiers.length === 1 ? "" : "s"}` : "Add modifiers\u2026", options: modifiers.filter((item) => !(line.modifiers ?? []).includes(item.code)).map((item) => ({ id: item.code, label: `\u2212${item.code}`, detail: item.description })), onSelect: (option) => setLine(index, { modifiers: [.../* @__PURE__ */ new Set([...line.modifiers ?? [], option.id])] }) })
1770
1877
  ] }),
1771
- /* @__PURE__ */ jsx3(Field2, { path: "patient.address.city", label: "City", required: true, error: errors["patient.address.city"], children: text(bill.patient.address.city, (city) => setAddress({ city })) }),
1772
- /* @__PURE__ */ jsx3(Field2, { path: "patient.address.state", label: "State", required: true, error: errors["patient.address.state"], children: text(bill.patient.address.state, (state) => setAddress({ state: state.toUpperCase() }), { maxLength: 2 }) })
1878
+ /* @__PURE__ */ jsxs3("div", { "data-label": "Units", "data-field-path": `serviceLines.${index}.units`, "data-invalid": Boolean(errors[`serviceLines.${index}.units`]), children: [
1879
+ /* @__PURE__ */ jsx3("input", { className: "mbsf-input", "aria-label": `Units ${index + 1}`, "aria-invalid": Boolean(errors[`serviceLines.${index}.units`]), type: "number", min: 1, value: line.units ?? 1, onChange: (event) => setLine(index, { units: Number(event.target.value) }) }),
1880
+ errors[`serviceLines.${index}.units`] ? /* @__PURE__ */ jsx3("small", { className: "mbsf-error", role: "alert", children: errors[`serviceLines.${index}.units`] }) : null
1881
+ ] }),
1882
+ /* @__PURE__ */ jsx3("div", { className: "mbsf-money", "data-label": "Allowed", children: lineCharge(line) == null ? "\u2014" : lineCharge(line).toLocaleString(void 0, { style: "currency", currency: "USD" }) }),
1883
+ /* @__PURE__ */ jsx3("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove service line ${index + 1}`, disabled: locked || !lineHasContent(line) && index === bill.serviceLines.length - 1, onClick: () => setBill((c) => ({ ...c, serviceLines: ensureTrailingBillSubmissionLine(c.serviceLines.filter((_, itemIndex) => itemIndex !== index)) })), children: "\xD7" })
1884
+ ] }, index)),
1885
+ /* @__PURE__ */ jsxs3("div", { className: "mbsf-total", children: [
1886
+ /* @__PURE__ */ jsx3("span", { children: "Total" }),
1887
+ /* @__PURE__ */ jsx3("span", { children: total.toLocaleString(void 0, { style: "currency", currency: "USD" }) })
1773
1888
  ] })
1774
1889
  ] }),
1775
- /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
1776
- /* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Injury & claim" }),
1777
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-grid", children: [
1778
- /* @__PURE__ */ jsx3(Field2, { path: "service.date", label: "Date of service", required: true, error: errors["service.date"], children: /* @__PURE__ */ jsx3(TextDateInput, { ariaLabel: "Date of service", value: bill.service.date, disabled: locked, required: true, onChange: (date2) => setBill((c) => ({ ...c, service: { ...c.service, date: date2 } })) }) }),
1779
- /* @__PURE__ */ jsx3(Field2, { label: "Date of injury", children: /* @__PURE__ */ jsx3(TextDateInput, { ariaLabel: "Date of injury", value: bill.claim.dateOfInjury, disabled: locked, onChange: (dateOfInjury) => setBill((c) => ({ ...c, claim: { ...c.claim, dateOfInjury } })) }) }),
1780
- /* @__PURE__ */ jsx3(Field2, { label: "Employer (optional)", children: text(bill.claim.employer, (employer) => setBill((c) => ({ ...c, claim: { ...c.claim, employer } }))) }),
1781
- /* @__PURE__ */ jsx3(Field2, { path: "claim.claimNumber", label: "Claim number", required: true, error: errors["claim.claimNumber"], children: text(bill.claim.claimNumber, (claimNumber) => setBill((c) => ({ ...c, claim: { ...c.claim, claimNumber } }))) }),
1782
- /* @__PURE__ */ jsx3(Field2, { label: "WCAB / ADJ number (optional)", children: text(bill.claim.adjNumber, (adjNumber) => setBill((c) => ({ ...c, claim: { ...c.claim, adjNumber } }))) }),
1783
- /* @__PURE__ */ jsx3(Field2, { path: "claim.claimsAdministrator", label: "Claims administrator", required: true, span: true, error: claimsAdministratorError, children: /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: "Claims administrator", invalid: Boolean(claimsAdministratorError), disabled: locked, loading: payerLoading, value: bill.claim.claimsAdministrator?.name ?? "", placeholder: "Search the payer directory\u2026", options: payerResults.map((payer) => ({ id: payer.id, label: payer.name, detail: [payer.hasElectronic ? "Electronic" : "Work comp", ...payer.states ?? []].join(" \xB7 ") })), onQuery: searchPayers, onSelect: (option) => setBill((c) => ({ ...c, claim: { ...c.claim, claimsAdministrator: { id: option.id, name: option.label } } })) }) }),
1784
- /* @__PURE__ */ jsx3(Field2, { label: "Injury description (optional)", span: true, children: text(bill.claim.description, (description2) => setBill((c) => ({ ...c, claim: { ...c.claim, description: description2 } }))) }),
1785
- /* @__PURE__ */ jsxs3(Field2, { label: "Diagnosis codes (ICD-10)", span: true, children: [
1786
- /* @__PURE__ */ jsx3("div", { className: "mbsf-quick-picks", "aria-label": "Common diagnosis codes", children: BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS.map((option) => {
1787
- const selected = (bill.diagnoses ?? []).includes(option.code);
1788
- return /* @__PURE__ */ jsxs3("button", { className: "mbsf-quick-pick", "data-selected": selected, type: "button", "aria-pressed": selected, title: `${option.code} \u2014 ${option.description}`, onClick: () => setBill((current) => ({ ...current, diagnoses: selected ? (current.diagnoses ?? []).filter((code) => code !== option.code) : [.../* @__PURE__ */ new Set([...current.diagnoses ?? [], option.code])] })), children: [
1789
- selected ? "\u2713" : "+",
1790
- " ",
1791
- option.label
1792
- ] }, option.code);
1793
- }) }),
1794
- /* @__PURE__ */ jsx3("div", { className: "mbsf-chips", children: (bill.diagnoses ?? []).map((code) => {
1795
- const option = [...BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS, ...diagnosisChoices].find((item) => item.code === code);
1796
- return /* @__PURE__ */ jsxs3("span", { className: "mbsf-chip", children: [
1797
- /* @__PURE__ */ jsx3("strong", { children: code }),
1798
- option?.description ? ` ${option.description}` : "",
1799
- /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": `Remove ${code}`, onClick: () => setBill((c) => ({ ...c, diagnoses: (c.diagnoses ?? []).filter((item) => item !== code) })), children: "\xD7" })
1800
- ] }, code);
1801
- }) }),
1802
- /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: "Add diagnosis code", disabled: locked, loading: diagnosisLoading, loadingMore: diagnosisLoadingMore, value: "", placeholder: bill.diagnoses?.length ?? 0 ? `${bill.diagnoses.length} selected \u2014 add more\u2026` : "Search ICD-10 codes\u2026", options: diagnosisChoices.filter((item) => !(bill.diagnoses ?? []).includes(item.code)).map((item) => ({ id: item.code, label: item.code, detail: item.description })), onOpen: () => {
1803
- if (diagnosisQuery !== "") loadDiagnoses("");
1804
- }, onQuery: searchDiagnoses, onEndReached: () => loadDiagnoses(diagnosisQuery ?? "", true), onSelect: (option) => setBill((c) => ({ ...c, diagnoses: [.../* @__PURE__ */ new Set([...c.diagnoses ?? [], option.id])] })) })
1890
+ errors.serviceLines ? /* @__PURE__ */ jsx3("p", { className: "mbsf-error", role: "alert", children: errors.serviceLines }) : null
1891
+ ] });
1892
+ const attachmentsSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
1893
+ /* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Attachments" }),
1894
+ /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-list", children: [
1895
+ attachments.filter((attachment) => !removedSourceIds.includes(attachment.id)).map((attachment) => {
1896
+ const auto = attachment.autoAttached || attachment.documentType === "w9";
1897
+ const removable = !auto && attachment.removable !== false;
1898
+ return /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-row", "data-auto": auto, children: [
1899
+ /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-main", children: [
1900
+ auto ? /* @__PURE__ */ jsx3("span", { "aria-label": "Always attached", role: "img", children: "\u2713" }) : null,
1901
+ /* @__PURE__ */ jsxs3("span", { className: "mbsf-file", children: [
1902
+ /* @__PURE__ */ jsx3("strong", { children: attachment.fileName }),
1903
+ /* @__PURE__ */ jsx3("span", { className: "mbsf-badge", children: auto ? "Auto-attached" : documentLabels[attachment.documentType] }),
1904
+ /* @__PURE__ */ jsx3("span", { className: "mbsf-help", style: { display: "block" }, children: attachment.description || (auto ? "Included automatically with every bill." : documentLabels[attachment.documentType]) })
1905
+ ] })
1906
+ ] }),
1907
+ /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-actions", children: [
1908
+ attachment.previewUrl ? /* @__PURE__ */ jsx3("a", { className: "mbsf-secondary", href: attachment.previewUrl, target: "_blank", rel: "noopener noreferrer", children: "Preview" }) : null,
1909
+ removable ? /* @__PURE__ */ jsx3("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove ${attachment.fileName}`, disabled: locked, onClick: () => {
1910
+ setSelectedIds((current) => current.filter((id) => id !== attachment.id));
1911
+ setRemovedSourceIds((current) => [.../* @__PURE__ */ new Set([...current, attachment.id])]);
1912
+ }, children: "\xD7" }) : null
1913
+ ] })
1914
+ ] }, attachment.id);
1915
+ }),
1916
+ uploads.map((upload, index) => /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-row", children: [
1917
+ /* @__PURE__ */ jsx3("div", { className: "mbsf-attach-main", children: /* @__PURE__ */ jsxs3("span", { className: "mbsf-file", children: [
1918
+ /* @__PURE__ */ jsx3("strong", { children: upload.file.name }),
1919
+ /* @__PURE__ */ jsxs3("span", { className: "mbsf-help", style: { display: "block" }, children: [
1920
+ (upload.file.size / 1024 / 1024).toFixed(1),
1921
+ " MB"
1922
+ ] })
1923
+ ] }) }),
1924
+ /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-actions", children: [
1925
+ /* @__PURE__ */ jsx3("button", { className: "mbsf-secondary", type: "button", onClick: () => previewUploadedPdf(upload.file), children: "Preview" }),
1926
+ /* @__PURE__ */ jsx3("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove ${upload.file.name}`, onClick: () => setUploads((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "\xD7" })
1805
1927
  ] })
1806
- ] })
1807
- ] }),
1808
- /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
1809
- /* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Providers & place of service" }),
1810
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-grid", children: [
1811
- /* @__PURE__ */ jsx3(Field2, { label: "Billing provider", children: text(bill.billingProvider?.name, (name) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, name } }))) }),
1812
- /* @__PURE__ */ jsx3(Field2, { label: "Billing tax ID", children: text(bill.billingProvider?.taxId, (taxId) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, taxId } }))) }),
1813
- /* @__PURE__ */ jsx3(Field2, { label: "Billing NPI", children: text(bill.billingProvider?.npi, (npi) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, npi } }))) }),
1814
- /* @__PURE__ */ jsx3(Field2, { label: "Billing phone", children: text(bill.billingProvider?.phone, (phone) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, phone } })), { type: "tel" }) }),
1815
- /* @__PURE__ */ jsx3(Field2, { label: "Rendering provider", children: text(bill.renderingProvider?.name, (name) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, name } }))) }),
1816
- /* @__PURE__ */ jsx3(Field2, { label: "Specialty", children: text(bill.renderingProvider?.specialty, (specialty) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, specialty } }))) }),
1817
- /* @__PURE__ */ jsx3(Field2, { label: "Rendering NPI", children: text(bill.renderingProvider?.npi, (npi) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, npi } }))) }),
1818
- /* @__PURE__ */ jsx3(Field2, { label: "License number", children: text(bill.renderingProvider?.licenseNumber, (licenseNumber) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, licenseNumber } }))) }),
1819
- /* @__PURE__ */ jsx3(Field2, { label: "License state", children: text(bill.renderingProvider?.licenseState, (licenseState) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, licenseState: licenseState.toUpperCase() } })), { maxLength: 2 }) }),
1820
- /* @__PURE__ */ jsx3(Field2, { label: "Service location", children: text(bill.serviceLocation?.name, (name) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, name } }))) }),
1821
- /* @__PURE__ */ jsx3(Field2, { label: "Place of service", children: text(bill.serviceLocation?.placeOfServiceCode, (placeOfServiceCode) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, placeOfServiceCode } })), { maxLength: 2 }) })
1822
- ] })
1928
+ ] }, `${upload.file.name}-${index}`))
1823
1929
  ] }),
1824
- /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
1825
- /* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Evaluation & service lines" }),
1826
- /* @__PURE__ */ jsx3("p", { className: "mbsf-help", children: "Sets the evaluator/specialty modifier on medical-legal evaluation lines." }),
1827
- /* @__PURE__ */ jsx3("div", { className: "mbsf-segments", role: "group", "aria-label": "Evaluation type", children: [["qme", "QME (default)"], ["ame", "AME"], ["psych_qme", "Psych QME"]].map(([type, label]) => /* @__PURE__ */ jsx3("button", { className: "mbsf-segment", type: "button", "aria-pressed": evaluationType === type, onClick: () => changeEvaluation(type), children: label }, type)) }),
1828
- /* @__PURE__ */ jsx3("p", { className: "mbsf-help", children: evaluationType === "ame" ? "Agreed Medical Evaluator \u2014 eligible ML evaluation codes default to modifier -94." : evaluationType === "psych_qme" ? "Psychiatric QME \u2014 eligible ML evaluation codes default to modifier -96 (-95 for ML200)." : "Qualified Medical Evaluator \u2014 eligible ML evaluation codes default to modifier -95." }),
1829
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-lines", "data-field-path": "serviceLines", "data-invalid": Boolean(errors.serviceLines), children: [
1830
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-line-head", children: [
1831
- /* @__PURE__ */ jsx3("span", { children: "Procedure code" }),
1832
- /* @__PURE__ */ jsx3("span", { children: "Modifiers" }),
1833
- /* @__PURE__ */ jsx3("span", { children: "Units" }),
1834
- /* @__PURE__ */ jsx3("span", { children: "Allowed" }),
1835
- /* @__PURE__ */ jsx3("span", {}),
1836
- " "
1930
+ /* @__PURE__ */ jsx3("input", { ref: fileInput, hidden: true, type: "file", accept: "application/pdf,.pdf", multiple: true, onChange: (event) => {
1931
+ if (event.target.files) addFiles(event.target.files);
1932
+ event.target.value = "";
1933
+ } }),
1934
+ /* @__PURE__ */ jsx3("button", { className: "mbsf-drop", "data-active": dragActive, type: "button", onClick: () => fileInput.current?.click(), children: /* @__PURE__ */ jsxs3("span", { children: [
1935
+ /* @__PURE__ */ jsx3("strong", { style: { fontSize: 18 }, children: "Drop additional PDF files here, or click to choose" }),
1936
+ /* @__PURE__ */ jsx3("span", { className: "mbsf-help", style: { display: "block", marginTop: 8 }, children: "Add supporting documents anywhere on this screen." })
1937
+ ] }) })
1938
+ ] });
1939
+ const actionsSection = /* @__PURE__ */ jsxs3(Fragment2, { children: [
1940
+ formError ? /* @__PURE__ */ jsx3("div", { className: "mbsf-alert", role: "alert", children: formError }) : null,
1941
+ /* @__PURE__ */ jsx3("div", { className: "mbsf-actions", children: /* @__PURE__ */ jsx3("button", { className: "mbsf-submit", type: "submit", disabled: locked, children: submitting ? "Submitting\u2026" : submitLabel }) })
1942
+ ] });
1943
+ const sections = {
1944
+ header: headerSection,
1945
+ patient: patientSection,
1946
+ claim: claimSection,
1947
+ providers: providersSection,
1948
+ serviceLines: serviceLinesSection,
1949
+ attachments: attachmentsSection,
1950
+ actions: actionsSection
1951
+ };
1952
+ const defaultLayout = /* @__PURE__ */ jsxs3(Fragment2, { children: [
1953
+ /* @__PURE__ */ jsx3(BillSubmissionHeader, {}),
1954
+ /* @__PURE__ */ jsx3(BillSubmissionPatientSection, {}),
1955
+ /* @__PURE__ */ jsx3(BillSubmissionClaimSection, {}),
1956
+ /* @__PURE__ */ jsx3(BillSubmissionProvidersSection, {}),
1957
+ /* @__PURE__ */ jsx3(BillSubmissionServiceLinesSection, {}),
1958
+ /* @__PURE__ */ jsx3(BillSubmissionAttachmentsSection, {}),
1959
+ /* @__PURE__ */ jsx3(BillSubmissionActions, {})
1960
+ ] });
1961
+ return /* @__PURE__ */ jsx3(BillSubmissionSectionsContext.Provider, { value: sections, children: /* @__PURE__ */ jsxs3("form", { ref: formRef, className: `${className} mbsf`, style: { ...mindBillAppearanceStyle(appearance), ...style }, onSubmit: (event) => {
1962
+ event.preventDefault();
1963
+ void submit();
1964
+ }, noValidate: true, children: [
1965
+ /* @__PURE__ */ jsx3("style", { children: css }),
1966
+ children ?? defaultLayout
1967
+ ] }) });
1968
+ }
1969
+
1970
+ // src/billing-dashboard.tsx
1971
+ import { useMemo as useMemo3, useState as useState3 } from "react";
1972
+ import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1973
+ var css2 = `
1974
+ .mbdash{display:grid;gap:20px;color:var(--mb-text);font-family:var(--mb-font);font-size:15px}.mbdash *{box-sizing:border-box}.mbdash h2,.mbdash h3,.mbdash p{margin:0}.mbdash-copy{color:var(--mb-muted);margin-top:5px!important}.mbdash-card{min-width:0;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);box-shadow:var(--mb-shadow)}
1975
+ .mbdash-head{display:flex;align-items:flex-end;justify-content:space-between;gap:18px}.mbdash-head h2{font-size:24px}.mbdash-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));overflow:hidden}.mbdash-stat{display:grid;gap:7px;padding:20px 22px;border-right:1px solid var(--mb-border)}.mbdash-stat:last-child{border:0}.mbdash-label{color:var(--mb-muted);font-size:12px;font-weight:760;letter-spacing:.06em;text-transform:uppercase}.mbdash-value{font-size:24px;font-weight:780;font-variant-numeric:tabular-nums}.mbdash-aging{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));overflow:hidden}.mbdash-aging-item{display:grid;gap:5px;padding:16px 20px;border-right:1px solid var(--mb-border)}.mbdash-aging-item:last-child{border:0}.mbdash-aging-item strong{font-size:18px;font-variant-numeric:tabular-nums}.mbdash-aging-item span:last-child{color:var(--mb-muted);font-size:13px}
1976
+ .mbdash-filters{display:grid;grid-template-columns:minmax(240px,1fr) minmax(180px,260px);gap:12px}.mbdash-control{width:100%;min-height:46px;padding:10px 12px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-input);color:var(--mb-text);font:inherit}.mbdash-control:focus{outline:3px solid color-mix(in srgb,var(--mb-accent) 22%,transparent);border-color:var(--mb-accent)}
1977
+ .mbdash-table-wrap{overflow:auto}.mbdash-table{width:100%;border-collapse:collapse}.mbdash-table th{padding:13px 16px;border-bottom:1px solid var(--mb-border);color:var(--mb-muted);font-size:12px;letter-spacing:.04em;text-align:left;text-transform:uppercase;white-space:nowrap}.mbdash-table td{padding:16px;border-bottom:1px solid var(--mb-border);vertical-align:top}.mbdash-table tr:last-child td{border-bottom:0}.mbdash-table tbody tr[data-clickable=true]{cursor:pointer}.mbdash-table tbody tr[data-clickable=true]:hover{background:color-mix(in srgb,var(--mb-accent) 5%,var(--mb-surface))}.mbdash-primary{display:block;color:var(--mb-text);font-weight:720;text-decoration:none}.mbdash-secondary{display:block;margin-top:4px;color:var(--mb-muted);font-size:13px}.mbdash-state{display:inline-flex;padding:4px 9px;border-radius:999px;background:color-mix(in srgb,var(--mb-accent) 10%,var(--mb-surface));color:var(--mb-text);font-size:12px;font-weight:720}.mbdash-money{text-align:right!important;font-variant-numeric:tabular-nums;white-space:nowrap}.mbdash-empty{padding:46px 22px;color:var(--mb-muted);text-align:center}.mbdash-mobile-list{display:none}.mbdash-mobile-card{display:grid;gap:14px;padding:18px;border-bottom:1px solid var(--mb-border)}.mbdash-mobile-card:last-child{border:0}.mbdash-mobile-top,.mbdash-mobile-money{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.mbdash-mobile-money>span{display:grid;gap:3px}.mbdash-mobile-money small{color:var(--mb-muted)}
1978
+ .mbdash-report-head{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 22px;border-bottom:1px solid var(--mb-border)}.mbdash-report-total td{font-weight:780;background:var(--mb-soft)}
1979
+ @media(max-width:900px){.mbdash-summary{grid-template-columns:repeat(2,1fr)}.mbdash-stat:nth-child(2){border-right:0}.mbdash-stat:nth-child(-n+2){border-bottom:1px solid var(--mb-border)}.mbdash-aging{grid-template-columns:repeat(2,1fr)}.mbdash-aging-item:nth-child(2){border-right:0}.mbdash-aging-item:nth-child(-n+2){border-bottom:1px solid var(--mb-border)}}
1980
+ @media(max-width:700px){.mbdash{gap:16px}.mbdash-head{align-items:flex-start;flex-direction:column}.mbdash-filters{grid-template-columns:1fr}.mbdash-table-wrap{display:none}.mbdash-mobile-list{display:block}.mbdash-value{font-size:20px}.mbdash-stat,.mbdash-aging-item{padding:16px}.mbdash-report .mbdash-table-wrap{display:block}.mbdash-report .mbdash-table th:nth-child(2),.mbdash-report .mbdash-table td:nth-child(2),.mbdash-report .mbdash-table th:nth-child(3),.mbdash-report .mbdash-table td:nth-child(3){display:none}}
1981
+ `;
1982
+ var terminalStates = /* @__PURE__ */ new Set(["closed", "voided", "cancelled"]);
1983
+ var money3 = (value) => Number(value || 0).toLocaleString(void 0, { style: "currency", currency: "USD" });
1984
+ var stateLabel = (state) => state.replaceAll("_", " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
1985
+ function billAgingDays(bill, now = /* @__PURE__ */ new Date()) {
1986
+ if (Number.isFinite(bill.agingDays)) return Math.max(0, Math.floor(bill.agingDays));
1987
+ if (!bill.submittedAt) return 0;
1988
+ const submitted = new Date(bill.submittedAt);
1989
+ if (Number.isNaN(submitted.valueOf())) return 0;
1990
+ return Math.max(0, Math.floor((now.valueOf() - submitted.valueOf()) / 864e5));
1991
+ }
1992
+ function billAgingBucket(bill, now = /* @__PURE__ */ new Date()) {
1993
+ const days = billAgingDays(bill, now);
1994
+ if (days <= 30) return "current";
1995
+ if (days <= 60) return "31-60";
1996
+ if (days <= 90) return "61-90";
1997
+ return "91+";
1998
+ }
1999
+ function summarizeBillingDashboard(bills, now = /* @__PURE__ */ new Date()) {
2000
+ const aging = [
2001
+ { id: "current", label: "0\u201330 days", count: 0, balance: 0 },
2002
+ { id: "31-60", label: "31\u201360 days", count: 0, balance: 0 },
2003
+ { id: "61-90", label: "61\u201390 days", count: 0, balance: 0 },
2004
+ { id: "91+", label: "91+ days", count: 0, balance: 0 }
2005
+ ];
2006
+ let totalBilled = 0;
2007
+ let totalPaid = 0;
2008
+ let outstanding = 0;
2009
+ let openCount = 0;
2010
+ for (const bill of bills) {
2011
+ totalBilled += Number(bill.totalCharge || 0);
2012
+ totalPaid += Number(bill.totalPaid || 0);
2013
+ outstanding += Number(bill.balanceDue || 0);
2014
+ if (!terminalStates.has(bill.state.toLowerCase()) && bill.balanceDue > 0) {
2015
+ openCount += 1;
2016
+ const bucket = aging.find((item) => item.id === billAgingBucket(bill, now));
2017
+ bucket.count += 1;
2018
+ bucket.balance += Number(bill.balanceDue || 0);
2019
+ }
2020
+ }
2021
+ return { totalBilled, totalPaid, outstanding, openCount, bills: bills.length, aging };
2022
+ }
2023
+ function Shell({ appearance, className = "", style, children }) {
2024
+ return /* @__PURE__ */ jsxs4("div", { className: `mbdash ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
2025
+ /* @__PURE__ */ jsx4("style", { children: css2 }),
2026
+ children
2027
+ ] });
2028
+ }
2029
+ function BillIdentity({ bill }) {
2030
+ const label = bill.billNumber == null ? bill.externalId ?? "Bill" : `Bill #${bill.billNumber}`;
2031
+ const content = /* @__PURE__ */ jsxs4(Fragment3, { children: [
2032
+ /* @__PURE__ */ jsx4("span", { className: "mbdash-primary", children: label }),
2033
+ /* @__PURE__ */ jsx4("span", { className: "mbdash-secondary", children: [bill.patientName, bill.claimNumber ? `Claim ${bill.claimNumber}` : null].filter(Boolean).join(" \xB7 ") })
2034
+ ] });
2035
+ return bill.href ? /* @__PURE__ */ jsx4("a", { href: bill.href, className: "mbdash-primary", children: content }) : /* @__PURE__ */ jsx4(Fragment3, { children: content });
2036
+ }
2037
+ function BillListContent({ bills, onSelectBill, emptyState = "No bills match these filters." }) {
2038
+ if (!bills.length) return /* @__PURE__ */ jsx4("div", { className: "mbdash-card mbdash-empty", children: emptyState });
2039
+ return /* @__PURE__ */ jsxs4("div", { className: "mbdash-card", children: [
2040
+ /* @__PURE__ */ jsx4("div", { className: "mbdash-table-wrap", children: /* @__PURE__ */ jsxs4("table", { className: "mbdash-table", children: [
2041
+ /* @__PURE__ */ jsx4("thead", { children: /* @__PURE__ */ jsxs4("tr", { children: [
2042
+ /* @__PURE__ */ jsx4("th", { children: "Bill" }),
2043
+ /* @__PURE__ */ jsx4("th", { children: "Payer" }),
2044
+ /* @__PURE__ */ jsx4("th", { children: "Status" }),
2045
+ /* @__PURE__ */ jsx4("th", { children: "Age" }),
2046
+ /* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Billed" }),
2047
+ /* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Paid" }),
2048
+ /* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Balance" })
2049
+ ] }) }),
2050
+ /* @__PURE__ */ jsx4("tbody", { children: bills.map((bill) => /* @__PURE__ */ jsxs4("tr", { "data-clickable": Boolean(onSelectBill), onClick: () => onSelectBill?.(bill), children: [
2051
+ /* @__PURE__ */ jsx4("td", { children: /* @__PURE__ */ jsx4(BillIdentity, { bill }) }),
2052
+ /* @__PURE__ */ jsx4("td", { children: bill.payerName || "\u2014" }),
2053
+ /* @__PURE__ */ jsx4("td", { children: /* @__PURE__ */ jsx4("span", { className: "mbdash-state", children: stateLabel(bill.state) }) }),
2054
+ /* @__PURE__ */ jsxs4("td", { children: [
2055
+ billAgingDays(bill),
2056
+ " days"
1837
2057
  ] }),
1838
- bill.serviceLines.map((line, index) => /* @__PURE__ */ jsxs3("div", { className: "mbsf-line", children: [
1839
- /* @__PURE__ */ jsxs3("div", { "data-label": "Procedure code", "data-field-path": `serviceLines.${index}.code`, "data-invalid": Boolean(errors[`serviceLines.${index}.code`]), children: [
1840
- /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: `Procedure code ${index + 1}`, invalid: Boolean(errors[`serviceLines.${index}.code`]), disabled: locked, value: line.code, placeholder: "Search or enter code\u2026", options: procedures.map((item) => ({ id: item.code, label: item.code, detail: item.description })), createOption: customProcedureOption, onSelect: (option) => {
1841
- const auto = evaluationModifier(evaluationType, option.id);
1842
- setLine(index, { code: option.id, ...auto ? { modifiers: [auto, ...(line.modifiers ?? []).filter((item) => !["94", "95", "96"].includes(item.replace(/^-/, "")))] } : line.modifiers ? { modifiers: line.modifiers } : {} });
1843
- } }),
1844
- line.code ? /* @__PURE__ */ jsx3("small", { className: "mbsf-help", children: procedures.find((item) => item.code === line.code)?.description ?? "Custom CPT, HCPCS, or medical-legal code" }) : null,
1845
- errors[`serviceLines.${index}.code`] ? /* @__PURE__ */ jsx3("small", { className: "mbsf-error", role: "alert", children: errors[`serviceLines.${index}.code`] }) : null
1846
- ] }),
1847
- /* @__PURE__ */ jsxs3("div", { "data-label": "Modifiers", children: [
1848
- /* @__PURE__ */ jsx3("div", { className: "mbsf-chips", children: (line.modifiers ?? []).map((modifier) => /* @__PURE__ */ jsxs3("span", { className: "mbsf-chip", children: [
1849
- "\u2212",
1850
- modifier.replace(/^-/, ""),
1851
- /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": `Remove modifier ${modifier}`, onClick: () => setLine(index, { modifiers: (line.modifiers ?? []).filter((item) => item !== modifier) }), children: "\xD7" })
1852
- ] }, modifier)) }),
1853
- /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: `Modifiers ${index + 1}`, disabled: locked, value: "", placeholder: line.modifiers?.length ?? 0 ? `${line.modifiers.length} modifier${line.modifiers.length === 1 ? "" : "s"}` : "Add modifiers\u2026", options: modifiers.filter((item) => !(line.modifiers ?? []).includes(item.code)).map((item) => ({ id: item.code, label: `\u2212${item.code}`, detail: item.description })), onSelect: (option) => setLine(index, { modifiers: [.../* @__PURE__ */ new Set([...line.modifiers ?? [], option.id])] }) })
1854
- ] }),
1855
- /* @__PURE__ */ jsxs3("div", { "data-label": "Units", "data-field-path": `serviceLines.${index}.units`, "data-invalid": Boolean(errors[`serviceLines.${index}.units`]), children: [
1856
- /* @__PURE__ */ jsx3("input", { className: "mbsf-input", "aria-label": `Units ${index + 1}`, "aria-invalid": Boolean(errors[`serviceLines.${index}.units`]), type: "number", min: 1, value: line.units ?? 1, onChange: (event) => setLine(index, { units: Number(event.target.value) }) }),
1857
- errors[`serviceLines.${index}.units`] ? /* @__PURE__ */ jsx3("small", { className: "mbsf-error", role: "alert", children: errors[`serviceLines.${index}.units`] }) : null
1858
- ] }),
1859
- /* @__PURE__ */ jsx3("div", { className: "mbsf-money", "data-label": "Allowed", children: lineCharge(line) == null ? "\u2014" : lineCharge(line).toLocaleString(void 0, { style: "currency", currency: "USD" }) }),
1860
- /* @__PURE__ */ jsx3("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove service line ${index + 1}`, disabled: locked || !lineHasContent(line) && index === bill.serviceLines.length - 1, onClick: () => setBill((c) => ({ ...c, serviceLines: ensureTrailingBillSubmissionLine(c.serviceLines.filter((_, itemIndex) => itemIndex !== index)) })), children: "\xD7" })
1861
- ] }, index)),
1862
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-total", children: [
1863
- /* @__PURE__ */ jsx3("span", { children: "Total" }),
1864
- /* @__PURE__ */ jsx3("span", { children: total.toLocaleString(void 0, { style: "currency", currency: "USD" }) })
2058
+ /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(bill.totalCharge) }),
2059
+ /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(bill.totalPaid) }),
2060
+ /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: /* @__PURE__ */ jsx4("strong", { children: money3(bill.balanceDue) }) })
2061
+ ] }, bill.id)) })
2062
+ ] }) }),
2063
+ /* @__PURE__ */ jsx4("div", { className: "mbdash-mobile-list", children: bills.map((bill) => /* @__PURE__ */ jsxs4("article", { className: "mbdash-mobile-card", onClick: () => onSelectBill?.(bill), children: [
2064
+ /* @__PURE__ */ jsxs4("div", { className: "mbdash-mobile-top", children: [
2065
+ /* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsx4(BillIdentity, { bill }) }),
2066
+ /* @__PURE__ */ jsx4("span", { className: "mbdash-state", children: stateLabel(bill.state) })
2067
+ ] }),
2068
+ /* @__PURE__ */ jsxs4("div", { className: "mbdash-mobile-money", children: [
2069
+ /* @__PURE__ */ jsxs4("span", { children: [
2070
+ /* @__PURE__ */ jsx4("small", { children: "Age" }),
2071
+ billAgingDays(bill),
2072
+ " days"
2073
+ ] }),
2074
+ /* @__PURE__ */ jsxs4("span", { children: [
2075
+ /* @__PURE__ */ jsx4("small", { children: "Paid" }),
2076
+ money3(bill.totalPaid)
2077
+ ] }),
2078
+ /* @__PURE__ */ jsxs4("span", { children: [
2079
+ /* @__PURE__ */ jsx4("small", { children: "Balance" }),
2080
+ /* @__PURE__ */ jsx4("strong", { children: money3(bill.balanceDue) })
1865
2081
  ] })
2082
+ ] })
2083
+ ] }, bill.id)) })
2084
+ ] });
2085
+ }
2086
+ function BillList(props) {
2087
+ const shellProps = {
2088
+ ...props.appearance === void 0 ? {} : { appearance: props.appearance },
2089
+ ...props.className === void 0 ? {} : { className: props.className },
2090
+ ...props.style === void 0 ? {} : { style: props.style }
2091
+ };
2092
+ return /* @__PURE__ */ jsx4(Shell, { ...shellProps, children: /* @__PURE__ */ jsx4(BillListContent, { ...props }) });
2093
+ }
2094
+ function AgingContent({ bills, heading = "Accounts receivable" }) {
2095
+ const summary = useMemo3(() => summarizeBillingDashboard(bills), [bills]);
2096
+ return /* @__PURE__ */ jsxs4(Fragment3, { children: [
2097
+ /* @__PURE__ */ jsx4("div", { className: "mbdash-head", children: /* @__PURE__ */ jsxs4("div", { children: [
2098
+ /* @__PURE__ */ jsx4("h2", { children: heading }),
2099
+ /* @__PURE__ */ jsx4("p", { className: "mbdash-copy", children: "Current balances and aging at a glance." })
2100
+ ] }) }),
2101
+ /* @__PURE__ */ jsxs4("div", { className: "mbdash-card mbdash-summary", children: [
2102
+ /* @__PURE__ */ jsxs4("div", { className: "mbdash-stat", children: [
2103
+ /* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: "Outstanding" }),
2104
+ /* @__PURE__ */ jsx4("span", { className: "mbdash-value", children: money3(summary.outstanding) })
1866
2105
  ] }),
1867
- errors.serviceLines ? /* @__PURE__ */ jsx3("p", { className: "mbsf-error", role: "alert", children: errors.serviceLines }) : null
1868
- ] }),
1869
- /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
1870
- /* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Attachments" }),
1871
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-list", children: [
1872
- attachments.filter((attachment) => !removedSourceIds.includes(attachment.id)).map((attachment) => {
1873
- const auto = attachment.autoAttached || attachment.documentType === "w9";
1874
- const removable = !auto && attachment.removable !== false;
1875
- return /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-row", "data-auto": auto, children: [
1876
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-main", children: [
1877
- auto ? /* @__PURE__ */ jsx3("span", { "aria-label": "Always attached", role: "img", children: "\u2713" }) : null,
1878
- /* @__PURE__ */ jsxs3("span", { className: "mbsf-file", children: [
1879
- /* @__PURE__ */ jsx3("strong", { children: attachment.fileName }),
1880
- /* @__PURE__ */ jsx3("span", { className: "mbsf-badge", children: auto ? "Auto-attached" : documentLabels[attachment.documentType] }),
1881
- /* @__PURE__ */ jsx3("span", { className: "mbsf-help", style: { display: "block" }, children: attachment.description || (auto ? "Included automatically with every bill." : documentLabels[attachment.documentType]) })
1882
- ] })
1883
- ] }),
1884
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-actions", children: [
1885
- attachment.previewUrl ? /* @__PURE__ */ jsx3("a", { className: "mbsf-secondary", href: attachment.previewUrl, target: "_blank", rel: "noopener noreferrer", children: "Preview" }) : null,
1886
- removable ? /* @__PURE__ */ jsx3("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove ${attachment.fileName}`, disabled: locked, onClick: () => {
1887
- setSelectedIds((current) => current.filter((id) => id !== attachment.id));
1888
- setRemovedSourceIds((current) => [.../* @__PURE__ */ new Set([...current, attachment.id])]);
1889
- }, children: "\xD7" }) : null
1890
- ] })
1891
- ] }, attachment.id);
1892
- }),
1893
- uploads.map((upload, index) => /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-row", children: [
1894
- /* @__PURE__ */ jsx3("div", { className: "mbsf-attach-main", children: /* @__PURE__ */ jsxs3("span", { className: "mbsf-file", children: [
1895
- /* @__PURE__ */ jsx3("strong", { children: upload.file.name }),
1896
- /* @__PURE__ */ jsxs3("span", { className: "mbsf-help", style: { display: "block" }, children: [
1897
- (upload.file.size / 1024 / 1024).toFixed(1),
1898
- " MB"
1899
- ] })
1900
- ] }) }),
1901
- /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-actions", children: [
1902
- /* @__PURE__ */ jsx3("button", { className: "mbsf-secondary", type: "button", onClick: () => previewUploadedPdf(upload.file), children: "Preview" }),
1903
- /* @__PURE__ */ jsx3("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove ${upload.file.name}`, onClick: () => setUploads((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "\xD7" })
1904
- ] })
1905
- ] }, `${upload.file.name}-${index}`))
2106
+ /* @__PURE__ */ jsxs4("div", { className: "mbdash-stat", children: [
2107
+ /* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: "Open bills" }),
2108
+ /* @__PURE__ */ jsx4("span", { className: "mbdash-value", children: summary.openCount })
2109
+ ] }),
2110
+ /* @__PURE__ */ jsxs4("div", { className: "mbdash-stat", children: [
2111
+ /* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: "Collected" }),
2112
+ /* @__PURE__ */ jsx4("span", { className: "mbdash-value", children: money3(summary.totalPaid) })
1906
2113
  ] }),
1907
- /* @__PURE__ */ jsx3("input", { ref: fileInput, hidden: true, type: "file", accept: "application/pdf,.pdf", multiple: true, onChange: (event) => {
1908
- if (event.target.files) addFiles(event.target.files);
1909
- event.target.value = "";
1910
- } }),
1911
- /* @__PURE__ */ jsx3("button", { className: "mbsf-drop", "data-active": dragActive, type: "button", onClick: () => fileInput.current?.click(), children: /* @__PURE__ */ jsxs3("span", { children: [
1912
- /* @__PURE__ */ jsx3("strong", { style: { fontSize: 18 }, children: "Drop additional PDF files here, or click to choose" }),
1913
- /* @__PURE__ */ jsx3("span", { className: "mbsf-help", style: { display: "block", marginTop: 8 }, children: "Add supporting documents anywhere on this screen." })
1914
- ] }) })
2114
+ /* @__PURE__ */ jsxs4("div", { className: "mbdash-stat", children: [
2115
+ /* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: "Total billed" }),
2116
+ /* @__PURE__ */ jsx4("span", { className: "mbdash-value", children: money3(summary.totalBilled) })
2117
+ ] })
1915
2118
  ] }),
1916
- formError ? /* @__PURE__ */ jsx3("div", { className: "mbsf-alert", role: "alert", children: formError }) : null,
1917
- /* @__PURE__ */ jsx3("div", { className: "mbsf-actions", children: /* @__PURE__ */ jsx3("button", { className: "mbsf-submit", type: "submit", disabled: locked, children: submitting ? "Submitting\u2026" : submitLabel }) })
2119
+ /* @__PURE__ */ jsx4("div", { className: "mbdash-card mbdash-aging", children: summary.aging.map((bucket) => /* @__PURE__ */ jsxs4("div", { className: "mbdash-aging-item", children: [
2120
+ /* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: bucket.label }),
2121
+ /* @__PURE__ */ jsx4("strong", { children: money3(bucket.balance) }),
2122
+ /* @__PURE__ */ jsxs4("span", { children: [
2123
+ bucket.count,
2124
+ " bill",
2125
+ bucket.count === 1 ? "" : "s"
2126
+ ] })
2127
+ ] }, bucket.id)) })
1918
2128
  ] });
1919
2129
  }
2130
+ function BillAgingSummary(props) {
2131
+ const shellProps = {
2132
+ ...props.appearance === void 0 ? {} : { appearance: props.appearance },
2133
+ ...props.className === void 0 ? {} : { className: props.className },
2134
+ ...props.style === void 0 ? {} : { style: props.style }
2135
+ };
2136
+ return /* @__PURE__ */ jsx4(Shell, { ...shellProps, children: /* @__PURE__ */ jsx4(AgingContent, { bills: props.bills, ...props.heading === void 0 ? {} : { heading: props.heading } }) });
2137
+ }
2138
+ function BillingDashboard({ bills, heading = "Billing", description = "Track submitted bills, payments, and outstanding balances.", onSelectBill, initialSearch = "", initialState = "all", hideFilters = false, appearance, className, style }) {
2139
+ const [search, setSearch] = useState3(initialSearch);
2140
+ const [state, setState] = useState3(initialState);
2141
+ const states = useMemo3(() => [...new Set(bills.map((bill) => bill.state))].sort((a, b) => a.localeCompare(b)), [bills]);
2142
+ const filtered = useMemo3(() => {
2143
+ const query = search.trim().toLowerCase();
2144
+ return bills.filter((bill) => (state === "all" || bill.state === state) && (!query || [bill.billNumber, bill.externalId, bill.patientName, bill.claimNumber, bill.payerName, bill.workItemLabel].some((value) => String(value ?? "").toLowerCase().includes(query))));
2145
+ }, [bills, search, state]);
2146
+ const shellProps = {
2147
+ ...appearance === void 0 ? {} : { appearance },
2148
+ ...className === void 0 ? {} : { className },
2149
+ ...style === void 0 ? {} : { style }
2150
+ };
2151
+ const listProps = { bills: filtered, ...onSelectBill === void 0 ? {} : { onSelectBill } };
2152
+ return /* @__PURE__ */ jsxs4(Shell, { ...shellProps, children: [
2153
+ /* @__PURE__ */ jsx4("div", { className: "mbdash-head", children: /* @__PURE__ */ jsxs4("div", { children: [
2154
+ /* @__PURE__ */ jsx4("h2", { children: heading }),
2155
+ /* @__PURE__ */ jsx4("p", { className: "mbdash-copy", children: description })
2156
+ ] }) }),
2157
+ /* @__PURE__ */ jsx4(AgingContent, { bills: filtered, heading: "Receivables" }),
2158
+ hideFilters ? null : /* @__PURE__ */ jsxs4("div", { className: "mbdash-filters", children: [
2159
+ /* @__PURE__ */ jsx4("input", { className: "mbdash-control", type: "search", value: search, onChange: (event) => setSearch(event.target.value), placeholder: "Search patient, claim, payer, or bill\u2026", "aria-label": "Search bills" }),
2160
+ /* @__PURE__ */ jsxs4("select", { className: "mbdash-control", value: state, onChange: (event) => setState(event.target.value), "aria-label": "Filter bills by status", children: [
2161
+ /* @__PURE__ */ jsx4("option", { value: "all", children: "All statuses" }),
2162
+ states.map((item) => /* @__PURE__ */ jsx4("option", { value: item, children: stateLabel(item) }, item))
2163
+ ] })
2164
+ ] }),
2165
+ /* @__PURE__ */ jsx4(BillListContent, { ...listProps })
2166
+ ] });
2167
+ }
2168
+ function buildBillingReportRows(bills, groupBy = "status") {
2169
+ const rows = /* @__PURE__ */ new Map();
2170
+ for (const bill of bills) {
2171
+ const key = groupBy === "payer" ? bill.payerName || "Unassigned payer" : groupBy === "aging" ? billAgingBucket(bill) : bill.state;
2172
+ const label = groupBy === "status" ? stateLabel(key) : groupBy === "aging" ? { current: "0\u201330 days", "31-60": "31\u201360 days", "61-90": "61\u201390 days", "91+": "91+ days" }[key] ?? key : key;
2173
+ const row = rows.get(key) ?? { key, label, billCount: 0, totalBilled: 0, totalPaid: 0, balanceDue: 0 };
2174
+ row.billCount += 1;
2175
+ row.totalBilled += Number(bill.totalCharge || 0);
2176
+ row.totalPaid += Number(bill.totalPaid || 0);
2177
+ row.balanceDue += Number(bill.balanceDue || 0);
2178
+ rows.set(key, row);
2179
+ }
2180
+ return [...rows.values()].sort((a, b) => a.label.localeCompare(b.label, void 0, { numeric: true }));
2181
+ }
2182
+ function buildBillingReportCsv(bills, groupBy = "status") {
2183
+ const escape = (value) => `"${String(value).replaceAll('"', '""')}"`;
2184
+ return [["Group", "Bills", "Total billed", "Total paid", "Balance due"].map(escape).join(","), ...buildBillingReportRows(bills, groupBy).map((row) => [row.label, row.billCount, row.totalBilled.toFixed(2), row.totalPaid.toFixed(2), row.balanceDue.toFixed(2)].map(escape).join(","))].join("\n");
2185
+ }
2186
+ function BillingReport({ bills, groupBy = "status", heading = "Billing report", description = "Billed, paid, and outstanding totals.", appearance, className, style }) {
2187
+ const rows = useMemo3(() => buildBillingReportRows(bills, groupBy), [bills, groupBy]);
2188
+ const total = useMemo3(() => summarizeBillingDashboard(bills), [bills]);
2189
+ const shellProps = {
2190
+ ...appearance === void 0 ? {} : { appearance },
2191
+ className: `mbdash-report ${className ?? ""}`.trim(),
2192
+ ...style === void 0 ? {} : { style }
2193
+ };
2194
+ return /* @__PURE__ */ jsx4(Shell, { ...shellProps, children: /* @__PURE__ */ jsxs4("div", { className: "mbdash-card", children: [
2195
+ /* @__PURE__ */ jsxs4("div", { className: "mbdash-report-head", children: [
2196
+ /* @__PURE__ */ jsxs4("div", { children: [
2197
+ /* @__PURE__ */ jsx4("h2", { children: heading }),
2198
+ /* @__PURE__ */ jsx4("p", { className: "mbdash-copy", children: description })
2199
+ ] }),
2200
+ /* @__PURE__ */ jsxs4("span", { className: "mbdash-state", children: [
2201
+ "By ",
2202
+ groupBy
2203
+ ] })
2204
+ ] }),
2205
+ /* @__PURE__ */ jsx4("div", { className: "mbdash-table-wrap", children: /* @__PURE__ */ jsxs4("table", { className: "mbdash-table", children: [
2206
+ /* @__PURE__ */ jsx4("thead", { children: /* @__PURE__ */ jsxs4("tr", { children: [
2207
+ /* @__PURE__ */ jsx4("th", { children: "Group" }),
2208
+ /* @__PURE__ */ jsx4("th", { children: "Bills" }),
2209
+ /* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Billed" }),
2210
+ /* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Paid" }),
2211
+ /* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Balance" })
2212
+ ] }) }),
2213
+ /* @__PURE__ */ jsxs4("tbody", { children: [
2214
+ rows.map((row) => /* @__PURE__ */ jsxs4("tr", { children: [
2215
+ /* @__PURE__ */ jsx4("td", { children: /* @__PURE__ */ jsx4("strong", { children: row.label }) }),
2216
+ /* @__PURE__ */ jsx4("td", { children: row.billCount }),
2217
+ /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(row.totalBilled) }),
2218
+ /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(row.totalPaid) }),
2219
+ /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(row.balanceDue) })
2220
+ ] }, row.key)),
2221
+ /* @__PURE__ */ jsxs4("tr", { className: "mbdash-report-total", children: [
2222
+ /* @__PURE__ */ jsx4("td", { children: "Total" }),
2223
+ /* @__PURE__ */ jsx4("td", { children: total.bills }),
2224
+ /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(total.totalBilled) }),
2225
+ /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(total.totalPaid) }),
2226
+ /* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(total.outstanding) })
2227
+ ] })
2228
+ ] })
2229
+ ] }) })
2230
+ ] }) });
2231
+ }
1920
2232
 
1921
2233
  // src/connected-bill-status.tsx
1922
2234
  import {
1923
2235
  useCallback as useCallback2,
1924
2236
  useEffect as useEffect3,
1925
- useMemo as useMemo3,
2237
+ useMemo as useMemo4,
1926
2238
  useRef as useRef3,
1927
- useState as useState3
2239
+ useState as useState4
1928
2240
  } from "react";
1929
2241
  import {
1930
2242
  DEFAULT_API_BASE_URL,
1931
2243
  DEFAULT_SESSION_ENDPOINT
1932
2244
  } from "@mindbill/browser";
1933
- import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
2245
+ import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1934
2246
  var DEFAULT_REFRESH_INTERVAL = 6e4;
1935
2247
  async function responseError(response, fallback) {
1936
2248
  const body = await response.json().catch(() => null);
@@ -2063,17 +2375,17 @@ function useBillStatus({
2063
2375
  initialData = null,
2064
2376
  fetch: fetchOverride
2065
2377
  }) {
2066
- const client = useMemo3(() => createBillStatusClient({
2378
+ const client = useMemo4(() => createBillStatusClient({
2067
2379
  billId,
2068
2380
  sessionEndpoint,
2069
2381
  ...getSession ? { getSession } : {},
2070
2382
  apiBaseUrl,
2071
2383
  ...fetchOverride ? { fetch: fetchOverride } : {}
2072
2384
  }), [apiBaseUrl, billId, fetchOverride, getSession, sessionEndpoint]);
2073
- const [data, setData] = useState3(initialData);
2074
- const [error, setError] = useState3(null);
2075
- const [isLoading, setIsLoading] = useState3(enabled && !initialData);
2076
- const [isRefreshing, setIsRefreshing] = useState3(false);
2385
+ const [data, setData] = useState4(initialData);
2386
+ const [error, setError] = useState4(null);
2387
+ const [isLoading, setIsLoading] = useState4(enabled && !initialData);
2388
+ const [isRefreshing, setIsRefreshing] = useState4(false);
2077
2389
  const dataRef = useRef3(initialData);
2078
2390
  const initialDataRef = useRef3(initialData);
2079
2391
  initialDataRef.current = initialData;
@@ -2151,17 +2463,17 @@ function ConnectedBillStatus({
2151
2463
  }) {
2152
2464
  const status = useBillStatus(options);
2153
2465
  if (status.isLoading && !status.data) {
2154
- return /* @__PURE__ */ jsx4(Fragment3, { children: loadingFallback ?? /* @__PURE__ */ jsx4("div", { role: "status", children: "Loading bill status\u2026" }) });
2466
+ return /* @__PURE__ */ jsx5(Fragment4, { children: loadingFallback ?? /* @__PURE__ */ jsx5("div", { role: "status", children: "Loading bill status\u2026" }) });
2155
2467
  }
2156
2468
  if (status.error && !status.data) {
2157
- return /* @__PURE__ */ jsx4(Fragment3, { children: errorFallback?.(status.error, status.refresh) ?? /* @__PURE__ */ jsxs4("div", { role: "alert", children: [
2469
+ return /* @__PURE__ */ jsx5(Fragment4, { children: errorFallback?.(status.error, status.refresh) ?? /* @__PURE__ */ jsxs5("div", { role: "alert", children: [
2158
2470
  status.error.message,
2159
2471
  " ",
2160
- /* @__PURE__ */ jsx4("button", { type: "button", onClick: () => void status.refresh(), children: "Retry" })
2472
+ /* @__PURE__ */ jsx5("button", { type: "button", onClick: () => void status.refresh(), children: "Retry" })
2161
2473
  ] }) });
2162
2474
  }
2163
2475
  if (!status.data) return null;
2164
- return /* @__PURE__ */ jsx4(
2476
+ return /* @__PURE__ */ jsx5(
2165
2477
  BillStatusSummary,
2166
2478
  {
2167
2479
  status: status.data.state,
@@ -2180,7 +2492,7 @@ function ConnectedBillStatus({
2180
2492
  }
2181
2493
 
2182
2494
  // src/bill-lifecycle-surfaces.tsx
2183
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
2495
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
2184
2496
  function visibleBillLifecycleActions(actions, showUnavailable = false) {
2185
2497
  return actions.filter((action) => action.enabled || showUnavailable);
2186
2498
  }
@@ -2195,11 +2507,11 @@ function BillLifecycleActions({
2195
2507
  }) {
2196
2508
  const visible = visibleBillLifecycleActions(actions, showUnavailable);
2197
2509
  if (!visible.length) return null;
2198
- return /* @__PURE__ */ jsxs5("div", { className: classes("mb-lifecycle-actions", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill actions", children: [
2199
- /* @__PURE__ */ jsx5("style", { children: lifecycleSurfaceStyles }),
2200
- visible.map((action) => /* @__PURE__ */ jsxs5("div", { className: "mb-lifecycle-action", children: [
2201
- /* @__PURE__ */ jsx5("button", { type: "button", className: action.primary ? "mb-action-button is-primary" : "mb-action-button", disabled: disabled || !action.enabled, onClick: () => onAction(action), children: action.label }),
2202
- !action.enabled && action.reason ? /* @__PURE__ */ jsx5("span", { className: "mb-action-reason", children: action.reason }) : null
2510
+ return /* @__PURE__ */ jsxs6("div", { className: classes("mb-lifecycle-actions", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill actions", children: [
2511
+ /* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
2512
+ visible.map((action) => /* @__PURE__ */ jsxs6("div", { className: "mb-lifecycle-action", children: [
2513
+ /* @__PURE__ */ jsx6("button", { type: "button", className: action.primary ? "mb-action-button is-primary" : "mb-action-button", disabled: disabled || !action.enabled, onClick: () => onAction(action), children: action.label }),
2514
+ !action.enabled && action.reason ? /* @__PURE__ */ jsx6("span", { className: "mb-action-reason", children: action.reason }) : null
2203
2515
  ] }, action.id))
2204
2516
  ] });
2205
2517
  }
@@ -2229,21 +2541,21 @@ function defaultFormatDate(createdAt) {
2229
2541
  return new Intl.DateTimeFormat(void 0, { dateStyle: "medium", timeStyle: "short" }).format(parsed);
2230
2542
  }
2231
2543
  function BillActivityTimeline({ events, emptyLabel = "No bill activity yet.", appearance, className, style, formatDate = defaultFormatDate }) {
2232
- return /* @__PURE__ */ jsxs5("section", { className: classes("mb-surface mb-activity", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill activity", children: [
2233
- /* @__PURE__ */ jsx5("style", { children: lifecycleSurfaceStyles }),
2234
- /* @__PURE__ */ jsxs5("header", { className: "mb-surface-heading", children: [
2235
- /* @__PURE__ */ jsxs5("div", { children: [
2236
- /* @__PURE__ */ jsx5("strong", { children: "Bill history" }),
2237
- /* @__PURE__ */ jsx5("span", { children: "Submission, payer responses, follow-up, and payments." })
2544
+ return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-activity", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill activity", children: [
2545
+ /* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
2546
+ /* @__PURE__ */ jsxs6("header", { className: "mb-surface-heading", children: [
2547
+ /* @__PURE__ */ jsxs6("div", { children: [
2548
+ /* @__PURE__ */ jsx6("strong", { children: "Bill history" }),
2549
+ /* @__PURE__ */ jsx6("span", { children: "Submission, payer responses, follow-up, and payments." })
2238
2550
  ] }),
2239
- /* @__PURE__ */ jsx5("span", { children: events.length })
2551
+ /* @__PURE__ */ jsx6("span", { children: events.length })
2240
2552
  ] }),
2241
- !events.length ? /* @__PURE__ */ jsx5("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsx5("ol", { className: "mb-activity-list", children: events.map((event) => /* @__PURE__ */ jsxs5("li", { className: "mb-activity-item", children: [
2242
- /* @__PURE__ */ jsx5("span", { className: "mb-activity-marker", "aria-hidden": "true" }),
2243
- /* @__PURE__ */ jsxs5("div", { className: "mb-activity-content", children: [
2244
- /* @__PURE__ */ jsx5("strong", { children: event.title ?? billActivityEventLabel(event.type) }),
2245
- event.description ? /* @__PURE__ */ jsx5("p", { children: event.description }) : null,
2246
- /* @__PURE__ */ jsxs5("span", { children: [
2553
+ !events.length ? /* @__PURE__ */ jsx6("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsx6("ol", { className: "mb-activity-list", children: events.map((event) => /* @__PURE__ */ jsxs6("li", { className: "mb-activity-item", children: [
2554
+ /* @__PURE__ */ jsx6("span", { className: "mb-activity-marker", "aria-hidden": "true" }),
2555
+ /* @__PURE__ */ jsxs6("div", { className: "mb-activity-content", children: [
2556
+ /* @__PURE__ */ jsx6("strong", { children: event.title ?? billActivityEventLabel(event.type) }),
2557
+ event.description ? /* @__PURE__ */ jsx6("p", { children: event.description }) : null,
2558
+ /* @__PURE__ */ jsxs6("span", { children: [
2247
2559
  formatDate(event.createdAt),
2248
2560
  event.actor ? ` \xB7 ${event.actor}` : ""
2249
2561
  ] })
@@ -2278,20 +2590,20 @@ function billLifecycleDisplayLabel(state, nativeStatus) {
2278
2590
  function BillLifecycleProgress({ state, nativeStatus, submittedAt, agingDays, appearance, className, style }) {
2279
2591
  const current = billLifecycleStage(state);
2280
2592
  const currentIndex = lifecycleStages.findIndex((stage) => stage.id === current);
2281
- return /* @__PURE__ */ jsxs5("section", { className: classes("mb-surface mb-progress", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill lifecycle", children: [
2282
- /* @__PURE__ */ jsx5("style", { children: lifecycleSurfaceStyles }),
2283
- /* @__PURE__ */ jsx5("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs5("div", { children: [
2284
- /* @__PURE__ */ jsx5("strong", { children: billLifecycleDisplayLabel(state, nativeStatus) }),
2285
- /* @__PURE__ */ jsxs5("span", { children: [
2593
+ return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-progress", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill lifecycle", children: [
2594
+ /* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
2595
+ /* @__PURE__ */ jsx6("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs6("div", { children: [
2596
+ /* @__PURE__ */ jsx6("strong", { children: billLifecycleDisplayLabel(state, nativeStatus) }),
2597
+ /* @__PURE__ */ jsxs6("span", { children: [
2286
2598
  submittedAt ? `Submitted ${defaultFormatDate(submittedAt)}` : "Submitted",
2287
2599
  typeof agingDays === "number" ? ` \xB7 ${agingDays} days old` : ""
2288
2600
  ] })
2289
2601
  ] }) }),
2290
- /* @__PURE__ */ jsx5("ol", { className: "mb-progress-list", children: lifecycleStages.map((stage, index) => {
2602
+ /* @__PURE__ */ jsx6("ol", { className: "mb-progress-list", children: lifecycleStages.map((stage, index) => {
2291
2603
  const status = index < currentIndex ? "complete" : index === currentIndex ? "current" : "upcoming";
2292
- return /* @__PURE__ */ jsxs5("li", { className: `is-${status}`, "aria-current": status === "current" ? "step" : void 0, children: [
2293
- /* @__PURE__ */ jsx5("span", { "aria-hidden": "true", children: status === "complete" ? "\u2713" : index + 1 }),
2294
- /* @__PURE__ */ jsx5("b", { children: stage.label })
2604
+ return /* @__PURE__ */ jsxs6("li", { className: `is-${status}`, "aria-current": status === "current" ? "step" : void 0, children: [
2605
+ /* @__PURE__ */ jsx6("span", { "aria-hidden": "true", children: status === "complete" ? "\u2713" : index + 1 }),
2606
+ /* @__PURE__ */ jsx6("b", { children: stage.label })
2295
2607
  ] }, stage.id);
2296
2608
  }) })
2297
2609
  ] });
@@ -2305,45 +2617,45 @@ function BillSnapshotSummary({ bill, patient, injury, delivery, appearance, clas
2305
2617
  ["Charged", currency(bill.totalCharge)],
2306
2618
  ["Balance", currency(bill.balanceDue)]
2307
2619
  ];
2308
- return /* @__PURE__ */ jsxs5("section", { className: classes("mb-surface mb-snapshot", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill snapshot", children: [
2309
- /* @__PURE__ */ jsx5("style", { children: lifecycleSurfaceStyles }),
2310
- /* @__PURE__ */ jsx5("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs5("div", { children: [
2311
- /* @__PURE__ */ jsx5("strong", { children: "Bill snapshot" }),
2312
- /* @__PURE__ */ jsxs5("span", { children: [
2620
+ return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-snapshot", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill snapshot", children: [
2621
+ /* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
2622
+ /* @__PURE__ */ jsx6("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs6("div", { children: [
2623
+ /* @__PURE__ */ jsx6("strong", { children: "Bill snapshot" }),
2624
+ /* @__PURE__ */ jsxs6("span", { children: [
2313
2625
  "Bill #",
2314
2626
  bill.billNumber
2315
2627
  ] })
2316
2628
  ] }) }),
2317
- /* @__PURE__ */ jsx5("dl", { children: values.map(([label, value]) => /* @__PURE__ */ jsxs5("div", { children: [
2318
- /* @__PURE__ */ jsx5("dt", { children: label }),
2319
- /* @__PURE__ */ jsx5("dd", { children: value })
2629
+ /* @__PURE__ */ jsx6("dl", { children: values.map(([label, value]) => /* @__PURE__ */ jsxs6("div", { children: [
2630
+ /* @__PURE__ */ jsx6("dt", { children: label }),
2631
+ /* @__PURE__ */ jsx6("dd", { children: value })
2320
2632
  ] }, label)) })
2321
2633
  ] });
2322
2634
  }
2323
2635
  function BillRemittanceCard({ remittance, appearance, className, style }) {
2324
- return /* @__PURE__ */ jsxs5("section", { className: classes("mb-surface mb-remittance", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Remittance summary", children: [
2325
- /* @__PURE__ */ jsx5("style", { children: lifecycleSurfaceStyles }),
2326
- /* @__PURE__ */ jsx5("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs5("div", { children: [
2327
- /* @__PURE__ */ jsx5("strong", { children: "Remittance" }),
2328
- /* @__PURE__ */ jsx5("span", { children: "Amounts reported by the payer and posted to the bill." })
2636
+ return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-remittance", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Remittance summary", children: [
2637
+ /* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
2638
+ /* @__PURE__ */ jsx6("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs6("div", { children: [
2639
+ /* @__PURE__ */ jsx6("strong", { children: "Remittance" }),
2640
+ /* @__PURE__ */ jsx6("span", { children: "Amounts reported by the payer and posted to the bill." })
2329
2641
  ] }) }),
2330
- /* @__PURE__ */ jsxs5("dl", { children: [
2331
- /* @__PURE__ */ jsxs5("div", { children: [
2332
- /* @__PURE__ */ jsx5("dt", { children: "Payer reported" }),
2333
- /* @__PURE__ */ jsx5("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
2642
+ /* @__PURE__ */ jsxs6("dl", { children: [
2643
+ /* @__PURE__ */ jsxs6("div", { children: [
2644
+ /* @__PURE__ */ jsx6("dt", { children: "Payer reported" }),
2645
+ /* @__PURE__ */ jsx6("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
2334
2646
  ] }),
2335
- /* @__PURE__ */ jsxs5("div", { children: [
2336
- /* @__PURE__ */ jsx5("dt", { children: "Posted" }),
2337
- /* @__PURE__ */ jsx5("dd", { children: currency(remittance.totalPaid) })
2647
+ /* @__PURE__ */ jsxs6("div", { children: [
2648
+ /* @__PURE__ */ jsx6("dt", { children: "Posted" }),
2649
+ /* @__PURE__ */ jsx6("dd", { children: currency(remittance.totalPaid) })
2338
2650
  ] }),
2339
- /* @__PURE__ */ jsxs5("div", { children: [
2340
- /* @__PURE__ */ jsx5("dt", { children: "Balance" }),
2341
- /* @__PURE__ */ jsx5("dd", { children: currency(remittance.balanceDue) })
2651
+ /* @__PURE__ */ jsxs6("div", { children: [
2652
+ /* @__PURE__ */ jsx6("dt", { children: "Balance" }),
2653
+ /* @__PURE__ */ jsx6("dd", { children: currency(remittance.balanceDue) })
2342
2654
  ] })
2343
2655
  ] }),
2344
- remittance.denialReason ? /* @__PURE__ */ jsxs5("div", { className: "mb-denial", children: [
2345
- /* @__PURE__ */ jsx5("strong", { children: "Denial reason" }),
2346
- /* @__PURE__ */ jsx5("p", { children: remittance.denialReason })
2656
+ remittance.denialReason ? /* @__PURE__ */ jsxs6("div", { className: "mb-denial", children: [
2657
+ /* @__PURE__ */ jsx6("strong", { children: "Denial reason" }),
2658
+ /* @__PURE__ */ jsx6("p", { children: remittance.denialReason })
2347
2659
  ] }) : null
2348
2660
  ] });
2349
2661
  }
@@ -2358,42 +2670,42 @@ function BillPayerContactCard({ delivery, appearance, className, style }) {
2358
2670
  delivery.contacts.portalUrl ? ["Portal", "Open payer portal", delivery.contacts.portalUrl] : null
2359
2671
  ].filter(Boolean);
2360
2672
  if (!delivery.payerName && !contacts.length) return null;
2361
- return /* @__PURE__ */ jsxs5("section", { className: classes("mb-surface mb-contacts", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payer contact information", children: [
2362
- /* @__PURE__ */ jsx5("style", { children: lifecycleSurfaceStyles }),
2363
- /* @__PURE__ */ jsx5("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs5("div", { children: [
2364
- /* @__PURE__ */ jsx5("strong", { children: delivery.payerName || "Claims administrator" }),
2365
- /* @__PURE__ */ jsx5("span", { children: "Billing and follow-up contacts." })
2673
+ return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-contacts", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payer contact information", children: [
2674
+ /* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
2675
+ /* @__PURE__ */ jsx6("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs6("div", { children: [
2676
+ /* @__PURE__ */ jsx6("strong", { children: delivery.payerName || "Claims administrator" }),
2677
+ /* @__PURE__ */ jsx6("span", { children: "Billing and follow-up contacts." })
2366
2678
  ] }) }),
2367
- !contacts.length ? /* @__PURE__ */ jsx5("p", { className: "mb-empty", children: "No payer contact details are available." }) : /* @__PURE__ */ jsx5("dl", { children: contacts.map(([label, value, href]) => /* @__PURE__ */ jsxs5("div", { children: [
2368
- /* @__PURE__ */ jsx5("dt", { children: label }),
2369
- /* @__PURE__ */ jsx5("dd", { children: href ? /* @__PURE__ */ jsx5("a", { href, target: label === "Portal" ? "_blank" : void 0, rel: label === "Portal" ? "noreferrer noopener" : void 0, children: value }) : value })
2679
+ !contacts.length ? /* @__PURE__ */ jsx6("p", { className: "mb-empty", children: "No payer contact details are available." }) : /* @__PURE__ */ jsx6("dl", { children: contacts.map(([label, value, href]) => /* @__PURE__ */ jsxs6("div", { children: [
2680
+ /* @__PURE__ */ jsx6("dt", { children: label }),
2681
+ /* @__PURE__ */ jsx6("dd", { children: href ? /* @__PURE__ */ jsx6("a", { href, target: label === "Portal" ? "_blank" : void 0, rel: label === "Portal" ? "noreferrer noopener" : void 0, children: value }) : value })
2370
2682
  ] }, label)) })
2371
2683
  ] });
2372
2684
  }
2373
2685
  function BillPaymentLedger({ payments, appearance, className, style }) {
2374
- return /* @__PURE__ */ jsxs5("section", { className: classes("mb-surface mb-payments", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payment ledger", children: [
2375
- /* @__PURE__ */ jsx5("style", { children: lifecycleSurfaceStyles }),
2376
- /* @__PURE__ */ jsxs5("header", { className: "mb-surface-heading", children: [
2377
- /* @__PURE__ */ jsxs5("div", { children: [
2378
- /* @__PURE__ */ jsx5("strong", { children: "Payments" }),
2379
- /* @__PURE__ */ jsx5("span", { children: "Payments posted to this bill." })
2686
+ return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-payments", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payment ledger", children: [
2687
+ /* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
2688
+ /* @__PURE__ */ jsxs6("header", { className: "mb-surface-heading", children: [
2689
+ /* @__PURE__ */ jsxs6("div", { children: [
2690
+ /* @__PURE__ */ jsx6("strong", { children: "Payments" }),
2691
+ /* @__PURE__ */ jsx6("span", { children: "Payments posted to this bill." })
2380
2692
  ] }),
2381
- /* @__PURE__ */ jsx5("span", { children: payments.length })
2693
+ /* @__PURE__ */ jsx6("span", { children: payments.length })
2382
2694
  ] }),
2383
- !payments.length ? /* @__PURE__ */ jsx5("p", { className: "mb-empty", children: "No payments posted." }) : /* @__PURE__ */ jsx5("div", { className: "mb-payment-list", children: payments.map((payment) => /* @__PURE__ */ jsxs5("article", { children: [
2384
- /* @__PURE__ */ jsxs5("div", { children: [
2385
- /* @__PURE__ */ jsx5("strong", { children: currency(payment.amount) }),
2386
- /* @__PURE__ */ jsxs5("span", { children: [
2695
+ !payments.length ? /* @__PURE__ */ jsx6("p", { className: "mb-empty", children: "No payments posted." }) : /* @__PURE__ */ jsx6("div", { className: "mb-payment-list", children: payments.map((payment) => /* @__PURE__ */ jsxs6("article", { children: [
2696
+ /* @__PURE__ */ jsxs6("div", { children: [
2697
+ /* @__PURE__ */ jsx6("strong", { children: currency(payment.amount) }),
2698
+ /* @__PURE__ */ jsxs6("span", { children: [
2387
2699
  humanize(payment.status || "posted"),
2388
2700
  " \xB7 ",
2389
2701
  payment.method.toUpperCase()
2390
2702
  ] })
2391
2703
  ] }),
2392
- /* @__PURE__ */ jsxs5("div", { children: [
2393
- /* @__PURE__ */ jsx5("span", { children: payment.checkNumber ? `#${payment.checkNumber}` : payment.source.toUpperCase() }),
2394
- /* @__PURE__ */ jsx5("span", { children: payment.depositDate || defaultFormatDate(payment.postedAt) })
2704
+ /* @__PURE__ */ jsxs6("div", { children: [
2705
+ /* @__PURE__ */ jsx6("span", { children: payment.checkNumber ? `#${payment.checkNumber}` : payment.source.toUpperCase() }),
2706
+ /* @__PURE__ */ jsx6("span", { children: payment.depositDate || defaultFormatDate(payment.postedAt) })
2395
2707
  ] }),
2396
- payment.note ? /* @__PURE__ */ jsx5("p", { children: payment.note }) : null
2708
+ payment.note ? /* @__PURE__ */ jsx6("p", { children: payment.note }) : null
2397
2709
  ] }, payment.id)) })
2398
2710
  ] });
2399
2711
  }
@@ -2422,9 +2734,9 @@ var lifecycleSurfaceStyles = `
2422
2734
  import {
2423
2735
  useCallback as useCallback3,
2424
2736
  useEffect as useEffect4,
2425
- useMemo as useMemo4,
2737
+ useMemo as useMemo5,
2426
2738
  useRef as useRef4,
2427
- useState as useState4
2739
+ useState as useState5
2428
2740
  } from "react";
2429
2741
  import {
2430
2742
  DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL2,
@@ -2432,7 +2744,7 @@ import {
2432
2744
  createBillLifecycleClient
2433
2745
  } from "@mindbill/browser";
2434
2746
  import { createBillLifecycleClient as createBillLifecycleClient2 } from "@mindbill/browser";
2435
- import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
2747
+ import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
2436
2748
  var DEFAULT_REFRESH_INTERVAL2 = 6e4;
2437
2749
  function downloadBlob(blob, filename, open = false) {
2438
2750
  const url = URL.createObjectURL(blob);
@@ -2454,13 +2766,13 @@ function useBillLifecycle({
2454
2766
  initialData = null,
2455
2767
  fetch: fetchOverride
2456
2768
  }) {
2457
- const [data, setData] = useState4(initialData);
2458
- const [error, setError] = useState4(null);
2459
- const [isLoading, setIsLoading] = useState4(enabled && !initialData);
2460
- const [isRefreshing, setIsRefreshing] = useState4(false);
2461
- const [isMutating, setIsMutating] = useState4(false);
2769
+ const [data, setData] = useState5(initialData);
2770
+ const [error, setError] = useState5(null);
2771
+ const [isLoading, setIsLoading] = useState5(enabled && !initialData);
2772
+ const [isRefreshing, setIsRefreshing] = useState5(false);
2773
+ const [isMutating, setIsMutating] = useState5(false);
2462
2774
  const mounted = useRef4(true);
2463
- const client = useMemo4(() => createBillLifecycleClient({
2775
+ const client = useMemo5(() => createBillLifecycleClient({
2464
2776
  billId: providedBillId,
2465
2777
  sessionEndpoint,
2466
2778
  getSession,
@@ -2564,8 +2876,8 @@ function LifecycleDialog({ children, title, onClose }) {
2564
2876
  previous?.focus();
2565
2877
  };
2566
2878
  }, [onClose]);
2567
- return /* @__PURE__ */ jsx6("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs6("div", { ref: dialog, className: "mb-lifecycle-dialog", role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
2568
- /* @__PURE__ */ jsx6("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
2879
+ return /* @__PURE__ */ jsx7("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs7("div", { ref: dialog, className: "mb-lifecycle-dialog", role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
2880
+ /* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
2569
2881
  children
2570
2882
  ] }) });
2571
2883
  }
@@ -2595,12 +2907,12 @@ function sandboxScenarios(state) {
2595
2907
  function ConnectedBillLifecycle({ appearance, className, style, loadingFallback, errorFallback, onChanged, ...options }) {
2596
2908
  const lifecycle = useBillLifecycle(options);
2597
2909
  const { data } = lifecycle;
2598
- const [tab, setTab] = useState4("details");
2599
- const [panel, setPanel] = useState4("");
2600
- const [notice, setNotice] = useState4("");
2601
- const [reason, setReason] = useState4("");
2602
- const [payment, setPayment] = useState4({ amount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
2603
- const [review, setReview] = useState4({ reason: "", payerClaimControlNumber: "", disputedAmount: void 0, attachmentIds: [], route: "ebill" });
2910
+ const [tab, setTab] = useState5("details");
2911
+ const [panel, setPanel] = useState5("");
2912
+ const [notice, setNotice] = useState5("");
2913
+ const [reason, setReason] = useState5("");
2914
+ const [payment, setPayment] = useState5({ amount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
2915
+ const [review, setReview] = useState5({ reason: "", payerClaimControlNumber: "", disputedAmount: void 0, attachmentIds: [], route: "ebill" });
2604
2916
  const lastData = useRef4(null);
2605
2917
  useEffect4(() => {
2606
2918
  if (!data || data === lastData.current) return;
@@ -2613,13 +2925,13 @@ function ConnectedBillLifecycle({ appearance, className, style, loadingFallback,
2613
2925
  attachmentIds: current.attachmentIds.length ? current.attachmentIds.filter((id) => data.bill.attachments.some((document2) => document2.id === id)) : data.bill.attachments.map((document2) => document2.id)
2614
2926
  }));
2615
2927
  }, [data, onChanged]);
2616
- if (lifecycle.isLoading && !data) return /* @__PURE__ */ jsx6(Fragment4, { children: loadingFallback ?? /* @__PURE__ */ jsx6("div", { className: "mb-lifecycle-loading", children: "Loading bill\u2026" }) });
2928
+ if (lifecycle.isLoading && !data) return /* @__PURE__ */ jsx7(Fragment5, { children: loadingFallback ?? /* @__PURE__ */ jsx7("div", { className: "mb-lifecycle-loading", children: "Loading bill\u2026" }) });
2617
2929
  if (!data) {
2618
2930
  const error = lifecycle.error ?? new Error("Bill could not be loaded.");
2619
- return /* @__PURE__ */ jsx6(Fragment4, { children: errorFallback?.(error, lifecycle.refresh) ?? /* @__PURE__ */ jsxs6("div", { className: "mb-lifecycle-error", role: "alert", children: [
2620
- /* @__PURE__ */ jsx6("strong", { children: "Billing is unavailable." }),
2621
- /* @__PURE__ */ jsx6("span", { children: error.message }),
2622
- /* @__PURE__ */ jsx6("button", { type: "button", onClick: () => void lifecycle.refresh(), children: "Try again" })
2931
+ return /* @__PURE__ */ jsx7(Fragment5, { children: errorFallback?.(error, lifecycle.refresh) ?? /* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-error", role: "alert", children: [
2932
+ /* @__PURE__ */ jsx7("strong", { children: "Billing is unavailable." }),
2933
+ /* @__PURE__ */ jsx7("span", { children: error.message }),
2934
+ /* @__PURE__ */ jsx7("button", { type: "button", onClick: () => void lifecycle.refresh(), children: "Try again" })
2623
2935
  ] }) });
2624
2936
  }
2625
2937
  const complete = async (message, task) => {
@@ -2636,185 +2948,185 @@ function ConnectedBillLifecycle({ appearance, className, style, loadingFallback,
2636
2948
  const supportedActions = /* @__PURE__ */ new Set(["resubmit", "second_review", "post_payment", "close", "reopen"]);
2637
2949
  const actions = data.lifecycle.actions.filter((action) => action.enabled && supportedActions.has(action.id));
2638
2950
  const simulations = data.environment === "sandbox" ? sandboxScenarios(data.lifecycle.state) : [];
2639
- return /* @__PURE__ */ jsxs6("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
2640
- /* @__PURE__ */ jsx6("style", { children: CONNECTED_LIFECYCLE_STYLES }),
2641
- /* @__PURE__ */ jsx6(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
2642
- /* @__PURE__ */ jsxs6("header", { className: "mb-lifecycle-head", children: [
2643
- /* @__PURE__ */ jsxs6("div", { children: [
2644
- /* @__PURE__ */ jsxs6("div", { className: "mb-lifecycle-title", children: [
2645
- /* @__PURE__ */ jsxs6("h2", { children: [
2951
+ return /* @__PURE__ */ jsxs7("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
2952
+ /* @__PURE__ */ jsx7("style", { children: CONNECTED_LIFECYCLE_STYLES }),
2953
+ /* @__PURE__ */ jsx7(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
2954
+ /* @__PURE__ */ jsxs7("header", { className: "mb-lifecycle-head", children: [
2955
+ /* @__PURE__ */ jsxs7("div", { children: [
2956
+ /* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-title", children: [
2957
+ /* @__PURE__ */ jsxs7("h2", { children: [
2646
2958
  "Bill #",
2647
2959
  data.bill.billNumber
2648
2960
  ] }),
2649
- /* @__PURE__ */ jsx6("span", { children: billLifecycleDisplayLabel(data.lifecycle.state, data.lifecycle.nativeStatus) })
2961
+ /* @__PURE__ */ jsx7("span", { children: billLifecycleDisplayLabel(data.lifecycle.state, data.lifecycle.nativeStatus) })
2650
2962
  ] }),
2651
- /* @__PURE__ */ jsxs6("p", { children: [
2963
+ /* @__PURE__ */ jsxs7("p", { children: [
2652
2964
  "Claim ",
2653
2965
  data.injury.claimNumber || "\u2014",
2654
2966
  lifecycle.isRefreshing ? " \xB7 Refreshing\u2026" : ""
2655
2967
  ] })
2656
2968
  ] }),
2657
- /* @__PURE__ */ jsx6("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadPacket().catch(() => void 0), children: "Download packet" })
2969
+ /* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadPacket().catch(() => void 0), children: "Download packet" })
2658
2970
  ] }),
2659
- /* @__PURE__ */ jsxs6("div", { className: "mb-lifecycle-tabs", role: "tablist", "aria-label": "Bill view", children: [
2660
- /* @__PURE__ */ jsx6("button", { type: "button", role: "tab", "aria-selected": tab === "details", onClick: () => setTab("details"), children: "Bill details" }),
2661
- /* @__PURE__ */ jsxs6("button", { type: "button", role: "tab", "aria-selected": tab === "history", onClick: () => setTab("history"), children: [
2971
+ /* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-tabs", role: "tablist", "aria-label": "Bill view", children: [
2972
+ /* @__PURE__ */ jsx7("button", { type: "button", role: "tab", "aria-selected": tab === "details", onClick: () => setTab("details"), children: "Bill details" }),
2973
+ /* @__PURE__ */ jsxs7("button", { type: "button", role: "tab", "aria-selected": tab === "history", onClick: () => setTab("history"), children: [
2662
2974
  "Bill history ",
2663
- /* @__PURE__ */ jsx6("span", { children: data.activity.length })
2975
+ /* @__PURE__ */ jsx7("span", { children: data.activity.length })
2664
2976
  ] })
2665
2977
  ] }),
2666
- data.environment === "sandbox" ? /* @__PURE__ */ jsxs6("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
2667
- /* @__PURE__ */ jsxs6("div", { children: [
2668
- /* @__PURE__ */ jsx6("span", { children: "Sandbox demo controls" }),
2669
- /* @__PURE__ */ jsx6("h3", { children: "Simulate the next payer response" }),
2670
- /* @__PURE__ */ jsx6("p", { children: "This changes sandbox data only. QME Companion receives the result through the same lifecycle API and components partners use." })
2978
+ data.environment === "sandbox" ? /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
2979
+ /* @__PURE__ */ jsxs7("div", { children: [
2980
+ /* @__PURE__ */ jsx7("span", { children: "Sandbox demo controls" }),
2981
+ /* @__PURE__ */ jsx7("h3", { children: "Simulate the next payer response" }),
2982
+ /* @__PURE__ */ jsx7("p", { children: "This changes sandbox data only. QME Companion receives the result through the same lifecycle API and components partners use." })
2671
2983
  ] }),
2672
- simulations.length ? /* @__PURE__ */ jsx6("div", { className: "mb-lifecycle-simulator-actions", children: simulations.map((scenario) => /* @__PURE__ */ jsxs6("button", { type: "button", disabled: lifecycle.isMutating, onClick: () => void complete(`${scenario.label} simulated.`, () => lifecycle.simulateSandbox({ scenario: scenario.id })), children: [
2673
- /* @__PURE__ */ jsx6("strong", { children: scenario.label }),
2674
- /* @__PURE__ */ jsx6("span", { children: scenario.detail })
2675
- ] }, scenario.id)) }) : /* @__PURE__ */ jsx6("p", { className: "mb-lifecycle-simulator-idle", children: "No simulated payer transition is needed at this stage. Use the bill action below to continue." })
2984
+ simulations.length ? /* @__PURE__ */ jsx7("div", { className: "mb-lifecycle-simulator-actions", children: simulations.map((scenario) => /* @__PURE__ */ jsxs7("button", { type: "button", disabled: lifecycle.isMutating, onClick: () => void complete(`${scenario.label} simulated.`, () => lifecycle.simulateSandbox({ scenario: scenario.id })), children: [
2985
+ /* @__PURE__ */ jsx7("strong", { children: scenario.label }),
2986
+ /* @__PURE__ */ jsx7("span", { children: scenario.detail })
2987
+ ] }, scenario.id)) }) : /* @__PURE__ */ jsx7("p", { className: "mb-lifecycle-simulator-idle", children: "No simulated payer transition is needed at this stage. Use the bill action below to continue." })
2676
2988
  ] }) : null,
2677
- tab === "details" ? /* @__PURE__ */ jsxs6("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
2678
- /* @__PURE__ */ jsx6(BillReadOnlyForm, { data, onOpenAttachment: lifecycle.openAttachment, ...appearance ? { appearance } : {} }),
2679
- data.eors.length ? /* @__PURE__ */ jsxs6("section", { className: "mb-lifecycle-card", id: `mb-eors-${data.bill.id}`, children: [
2680
- /* @__PURE__ */ jsxs6("header", { children: [
2681
- /* @__PURE__ */ jsxs6("div", { children: [
2682
- /* @__PURE__ */ jsx6("h3", { children: "Explanation of Review" }),
2683
- /* @__PURE__ */ jsx6("p", { children: "The payer response associated with this immutable submission." })
2989
+ tab === "details" ? /* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
2990
+ /* @__PURE__ */ jsx7(BillReadOnlyForm, { data, onOpenAttachment: lifecycle.openAttachment, ...appearance ? { appearance } : {} }),
2991
+ data.eors.length ? /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-card", id: `mb-eors-${data.bill.id}`, children: [
2992
+ /* @__PURE__ */ jsxs7("header", { children: [
2993
+ /* @__PURE__ */ jsxs7("div", { children: [
2994
+ /* @__PURE__ */ jsx7("h3", { children: "Explanation of Review" }),
2995
+ /* @__PURE__ */ jsx7("p", { children: "The payer response associated with this immutable submission." })
2684
2996
  ] }),
2685
- /* @__PURE__ */ jsx6("span", { children: data.eors.length })
2997
+ /* @__PURE__ */ jsx7("span", { children: data.eors.length })
2686
2998
  ] }),
2687
- /* @__PURE__ */ jsx6("ul", { className: "mb-lifecycle-documents", children: data.eors.map((eor) => /* @__PURE__ */ jsxs6("li", { children: [
2688
- /* @__PURE__ */ jsxs6("div", { children: [
2689
- /* @__PURE__ */ jsx6("strong", { children: eor.filename }),
2690
- /* @__PURE__ */ jsx6("span", { children: eor.description || `Received ${new Date(eor.addedAt).toLocaleDateString()}` })
2999
+ /* @__PURE__ */ jsx7("ul", { className: "mb-lifecycle-documents", children: data.eors.map((eor) => /* @__PURE__ */ jsxs7("li", { children: [
3000
+ /* @__PURE__ */ jsxs7("div", { children: [
3001
+ /* @__PURE__ */ jsx7("strong", { children: eor.filename }),
3002
+ /* @__PURE__ */ jsx7("span", { children: eor.description || `Received ${new Date(eor.addedAt).toLocaleDateString()}` })
2691
3003
  ] }),
2692
- /* @__PURE__ */ jsx6("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(eor).catch(() => void 0), children: "View EOR" })
3004
+ /* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(eor).catch(() => void 0), children: "View EOR" })
2693
3005
  ] }, eor.id)) })
2694
3006
  ] }) : null,
2695
- viewEor || actions.length ? /* @__PURE__ */ jsxs6("section", { className: "mb-lifecycle-actions-sheet", children: [
2696
- /* @__PURE__ */ jsxs6("div", { children: [
2697
- /* @__PURE__ */ jsx6("h3", { children: data.lifecycle.state.includes("closed") ? "This bill is closed" : data.lifecycle.state.includes("denied") || data.lifecycle.state.includes("rejected") ? "This bill needs attention" : "Available actions" }),
2698
- /* @__PURE__ */ jsx6("p", { children: "Actions are determined by the current bill status." })
3007
+ viewEor || actions.length ? /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-actions-sheet", children: [
3008
+ /* @__PURE__ */ jsxs7("div", { children: [
3009
+ /* @__PURE__ */ jsx7("h3", { children: data.lifecycle.state.includes("closed") ? "This bill is closed" : data.lifecycle.state.includes("denied") || data.lifecycle.state.includes("rejected") ? "This bill needs attention" : "Available actions" }),
3010
+ /* @__PURE__ */ jsx7("p", { children: "Actions are determined by the current bill status." })
2699
3011
  ] }),
2700
- /* @__PURE__ */ jsxs6("div", { children: [
2701
- viewEor ? /* @__PURE__ */ jsx6("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => document.getElementById(`mb-eors-${data.bill.id}`)?.scrollIntoView({ behavior: "smooth" }), children: viewEor.label }) : null,
2702
- actions.map((action) => /* @__PURE__ */ jsx6("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
3012
+ /* @__PURE__ */ jsxs7("div", { children: [
3013
+ viewEor ? /* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => document.getElementById(`mb-eors-${data.bill.id}`)?.scrollIntoView({ behavior: "smooth" }), children: viewEor.label }) : null,
3014
+ actions.map((action) => /* @__PURE__ */ jsx7("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
2703
3015
  const next = actionPanel(action);
2704
3016
  if (next) setPanel(next);
2705
3017
  }, children: action.label }, action.id))
2706
3018
  ] })
2707
3019
  ] }) : null
2708
- ] }) : /* @__PURE__ */ jsx6("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: /* @__PURE__ */ jsx6(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
2709
- panel === "resubmit" ? /* @__PURE__ */ jsx6(LifecycleDialog, { title: "Correct and resubmit", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs6("section", { className: "mb-lifecycle-panel", children: [
2710
- /* @__PURE__ */ jsxs6("div", { children: [
2711
- /* @__PURE__ */ jsx6("h3", { children: "Correct and resubmit" }),
2712
- /* @__PURE__ */ jsx6("p", { children: "The original submission remains immutable. This records a new submission attempt after the routing issue is corrected." })
3020
+ ] }) : /* @__PURE__ */ jsx7("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: /* @__PURE__ */ jsx7(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
3021
+ panel === "resubmit" ? /* @__PURE__ */ jsx7(LifecycleDialog, { title: "Correct and resubmit", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-panel", children: [
3022
+ /* @__PURE__ */ jsxs7("div", { children: [
3023
+ /* @__PURE__ */ jsx7("h3", { children: "Correct and resubmit" }),
3024
+ /* @__PURE__ */ jsx7("p", { children: "The original submission remains immutable. This records a new submission attempt after the routing issue is corrected." })
2713
3025
  ] }),
2714
- /* @__PURE__ */ jsxs6("label", { children: [
2715
- /* @__PURE__ */ jsx6("span", { children: "Correction note (optional)" }),
2716
- /* @__PURE__ */ jsx6("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
3026
+ /* @__PURE__ */ jsxs7("label", { children: [
3027
+ /* @__PURE__ */ jsx7("span", { children: "Correction note (optional)" }),
3028
+ /* @__PURE__ */ jsx7("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
2717
3029
  ] }),
2718
- /* @__PURE__ */ jsxs6("div", { className: "mb-lifecycle-panel-actions", children: [
2719
- /* @__PURE__ */ jsx6("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
2720
- /* @__PURE__ */ jsx6("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void complete("Bill resubmitted.", () => lifecycle.resubmitBill({ reason })), children: lifecycle.isMutating ? "Resubmitting\u2026" : "Resubmit bill" })
3030
+ /* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-panel-actions", children: [
3031
+ /* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
3032
+ /* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void complete("Bill resubmitted.", () => lifecycle.resubmitBill({ reason })), children: lifecycle.isMutating ? "Resubmitting\u2026" : "Resubmit bill" })
2721
3033
  ] })
2722
3034
  ] }) }) : null,
2723
- panel === "second_review" ? /* @__PURE__ */ jsx6(LifecycleDialog, { title: "Submit Second Review", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs6("section", { className: "mb-lifecycle-panel", children: [
2724
- /* @__PURE__ */ jsxs6("div", { children: [
2725
- /* @__PURE__ */ jsx6("h3", { children: "Submit Second Review" }),
2726
- /* @__PURE__ */ jsx6("p", { children: "Explain the dispute and include the payer control number and supporting documents." })
3035
+ panel === "second_review" ? /* @__PURE__ */ jsx7(LifecycleDialog, { title: "Submit Second Review", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-panel", children: [
3036
+ /* @__PURE__ */ jsxs7("div", { children: [
3037
+ /* @__PURE__ */ jsx7("h3", { children: "Submit Second Review" }),
3038
+ /* @__PURE__ */ jsx7("p", { children: "Explain the dispute and include the payer control number and supporting documents." })
2727
3039
  ] }),
2728
- /* @__PURE__ */ jsxs6("div", { className: "mb-lifecycle-fields two", children: [
2729
- /* @__PURE__ */ jsxs6("label", { className: "full", children: [
2730
- /* @__PURE__ */ jsx6("span", { children: "Reason" }),
2731
- /* @__PURE__ */ jsx6("textarea", { required: true, value: review.reason, onChange: (event) => setReview((current) => ({ ...current, reason: event.target.value })) })
3040
+ /* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-fields two", children: [
3041
+ /* @__PURE__ */ jsxs7("label", { className: "full", children: [
3042
+ /* @__PURE__ */ jsx7("span", { children: "Reason" }),
3043
+ /* @__PURE__ */ jsx7("textarea", { required: true, value: review.reason, onChange: (event) => setReview((current) => ({ ...current, reason: event.target.value })) })
2732
3044
  ] }),
2733
- /* @__PURE__ */ jsxs6("label", { children: [
2734
- /* @__PURE__ */ jsx6("span", { children: "Payer claim control number" }),
2735
- /* @__PURE__ */ jsx6("input", { required: true, value: review.payerClaimControlNumber, onChange: (event) => setReview((current) => ({ ...current, payerClaimControlNumber: event.target.value })) })
3045
+ /* @__PURE__ */ jsxs7("label", { children: [
3046
+ /* @__PURE__ */ jsx7("span", { children: "Payer claim control number" }),
3047
+ /* @__PURE__ */ jsx7("input", { required: true, value: review.payerClaimControlNumber, onChange: (event) => setReview((current) => ({ ...current, payerClaimControlNumber: event.target.value })) })
2736
3048
  ] }),
2737
- /* @__PURE__ */ jsxs6("label", { children: [
2738
- /* @__PURE__ */ jsx6("span", { children: "Disputed amount" }),
2739
- /* @__PURE__ */ jsx6("input", { type: "number", min: "0.01", step: "0.01", value: review.disputedAmount ?? "", onChange: (event) => setReview((current) => ({ ...current, disputedAmount: event.target.value ? Number(event.target.value) : void 0 })) })
3049
+ /* @__PURE__ */ jsxs7("label", { children: [
3050
+ /* @__PURE__ */ jsx7("span", { children: "Disputed amount" }),
3051
+ /* @__PURE__ */ jsx7("input", { type: "number", min: "0.01", step: "0.01", value: review.disputedAmount ?? "", onChange: (event) => setReview((current) => ({ ...current, disputedAmount: event.target.value ? Number(event.target.value) : void 0 })) })
2740
3052
  ] }),
2741
- /* @__PURE__ */ jsxs6("label", { children: [
2742
- /* @__PURE__ */ jsx6("span", { children: "Send via" }),
2743
- /* @__PURE__ */ jsxs6("select", { value: review.route, onChange: (event) => setReview((current) => ({ ...current, route: event.target.value })), children: [
2744
- /* @__PURE__ */ jsx6("option", { value: "ebill", children: "E-bill" }),
2745
- /* @__PURE__ */ jsx6("option", { value: "fax", children: "Fax" }),
2746
- /* @__PURE__ */ jsx6("option", { value: "mail", children: "Mail" }),
2747
- /* @__PURE__ */ jsx6("option", { value: "email", children: "Email" })
3053
+ /* @__PURE__ */ jsxs7("label", { children: [
3054
+ /* @__PURE__ */ jsx7("span", { children: "Send via" }),
3055
+ /* @__PURE__ */ jsxs7("select", { value: review.route, onChange: (event) => setReview((current) => ({ ...current, route: event.target.value })), children: [
3056
+ /* @__PURE__ */ jsx7("option", { value: "ebill", children: "E-bill" }),
3057
+ /* @__PURE__ */ jsx7("option", { value: "fax", children: "Fax" }),
3058
+ /* @__PURE__ */ jsx7("option", { value: "mail", children: "Mail" }),
3059
+ /* @__PURE__ */ jsx7("option", { value: "email", children: "Email" })
2748
3060
  ] })
2749
3061
  ] })
2750
3062
  ] }),
2751
- /* @__PURE__ */ jsxs6("fieldset", { className: "mb-lifecycle-packet", children: [
2752
- /* @__PURE__ */ jsx6("legend", { children: "Supporting packet" }),
2753
- data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs6("label", { children: [
2754
- /* @__PURE__ */ jsx6("input", { type: "checkbox", checked: review.attachmentIds.includes(attachment.id), onChange: (event) => setReview((current) => ({ ...current, attachmentIds: event.target.checked ? [...current.attachmentIds, attachment.id] : current.attachmentIds.filter((id) => id !== attachment.id) })) }),
2755
- /* @__PURE__ */ jsxs6("span", { children: [
2756
- /* @__PURE__ */ jsx6("strong", { children: attachment.filename }),
2757
- /* @__PURE__ */ jsx6("small", { children: attachment.description || attachment.documentType })
3063
+ /* @__PURE__ */ jsxs7("fieldset", { className: "mb-lifecycle-packet", children: [
3064
+ /* @__PURE__ */ jsx7("legend", { children: "Supporting packet" }),
3065
+ data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs7("label", { children: [
3066
+ /* @__PURE__ */ jsx7("input", { type: "checkbox", checked: review.attachmentIds.includes(attachment.id), onChange: (event) => setReview((current) => ({ ...current, attachmentIds: event.target.checked ? [...current.attachmentIds, attachment.id] : current.attachmentIds.filter((id) => id !== attachment.id) })) }),
3067
+ /* @__PURE__ */ jsxs7("span", { children: [
3068
+ /* @__PURE__ */ jsx7("strong", { children: attachment.filename }),
3069
+ /* @__PURE__ */ jsx7("small", { children: attachment.description || attachment.documentType })
2758
3070
  ] }),
2759
- /* @__PURE__ */ jsx6("button", { type: "button", onClick: () => void lifecycle.openAttachment(attachment).catch(() => void 0), children: "View" })
3071
+ /* @__PURE__ */ jsx7("button", { type: "button", onClick: () => void lifecycle.openAttachment(attachment).catch(() => void 0), children: "View" })
2760
3072
  ] }, attachment.id))
2761
3073
  ] }),
2762
- /* @__PURE__ */ jsxs6("div", { className: "mb-lifecycle-panel-actions", children: [
2763
- /* @__PURE__ */ jsx6("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
2764
- /* @__PURE__ */ jsx6("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !review.reason.trim() || !review.payerClaimControlNumber.trim(), onClick: () => void complete("Second Review submitted.", () => lifecycle.submitSecondReview(review)), children: lifecycle.isMutating ? "Submitting\u2026" : "Submit Second Review" })
3074
+ /* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-panel-actions", children: [
3075
+ /* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
3076
+ /* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !review.reason.trim() || !review.payerClaimControlNumber.trim(), onClick: () => void complete("Second Review submitted.", () => lifecycle.submitSecondReview(review)), children: lifecycle.isMutating ? "Submitting\u2026" : "Submit Second Review" })
2765
3077
  ] })
2766
3078
  ] }) }) : null,
2767
- panel === "payment" ? /* @__PURE__ */ jsx6(LifecycleDialog, { title: "Post payment", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs6("section", { className: "mb-lifecycle-panel", children: [
2768
- /* @__PURE__ */ jsxs6("div", { children: [
2769
- /* @__PURE__ */ jsx6("h3", { children: "Post payment" }),
2770
- /* @__PURE__ */ jsx6("p", { children: "Record funds shown on the payer response." })
3079
+ panel === "payment" ? /* @__PURE__ */ jsx7(LifecycleDialog, { title: "Post payment", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-panel", children: [
3080
+ /* @__PURE__ */ jsxs7("div", { children: [
3081
+ /* @__PURE__ */ jsx7("h3", { children: "Post payment" }),
3082
+ /* @__PURE__ */ jsx7("p", { children: "Record funds shown on the payer response." })
2771
3083
  ] }),
2772
- /* @__PURE__ */ jsxs6("div", { className: "mb-lifecycle-fields two", children: [
2773
- /* @__PURE__ */ jsxs6("label", { children: [
2774
- /* @__PURE__ */ jsx6("span", { children: "Amount" }),
2775
- /* @__PURE__ */ jsx6("input", { type: "number", min: "0.01", max: data.bill.balanceDue, step: "0.01", value: payment.amount || "", onChange: (event) => setPayment((current) => ({ ...current, amount: Number(event.target.value) })) })
3084
+ /* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-fields two", children: [
3085
+ /* @__PURE__ */ jsxs7("label", { children: [
3086
+ /* @__PURE__ */ jsx7("span", { children: "Amount" }),
3087
+ /* @__PURE__ */ jsx7("input", { type: "number", min: "0.01", max: data.bill.balanceDue, step: "0.01", value: payment.amount || "", onChange: (event) => setPayment((current) => ({ ...current, amount: Number(event.target.value) })) })
2776
3088
  ] }),
2777
- /* @__PURE__ */ jsxs6("label", { children: [
2778
- /* @__PURE__ */ jsx6("span", { children: "Method" }),
2779
- /* @__PURE__ */ jsxs6("select", { value: payment.method, onChange: (event) => setPayment((current) => ({ ...current, method: event.target.value })), children: [
2780
- /* @__PURE__ */ jsx6("option", { value: "check", children: "Check" }),
2781
- /* @__PURE__ */ jsx6("option", { value: "eft", children: "EFT" })
3089
+ /* @__PURE__ */ jsxs7("label", { children: [
3090
+ /* @__PURE__ */ jsx7("span", { children: "Method" }),
3091
+ /* @__PURE__ */ jsxs7("select", { value: payment.method, onChange: (event) => setPayment((current) => ({ ...current, method: event.target.value })), children: [
3092
+ /* @__PURE__ */ jsx7("option", { value: "check", children: "Check" }),
3093
+ /* @__PURE__ */ jsx7("option", { value: "eft", children: "EFT" })
2782
3094
  ] })
2783
3095
  ] }),
2784
- /* @__PURE__ */ jsxs6("label", { children: [
2785
- /* @__PURE__ */ jsx6("span", { children: payment.method === "check" ? "Check number" : "EFT reference" }),
2786
- /* @__PURE__ */ jsx6("input", { value: payment.checkNumber, onChange: (event) => setPayment((current) => ({ ...current, checkNumber: event.target.value })) })
3096
+ /* @__PURE__ */ jsxs7("label", { children: [
3097
+ /* @__PURE__ */ jsx7("span", { children: payment.method === "check" ? "Check number" : "EFT reference" }),
3098
+ /* @__PURE__ */ jsx7("input", { value: payment.checkNumber, onChange: (event) => setPayment((current) => ({ ...current, checkNumber: event.target.value })) })
2787
3099
  ] }),
2788
- /* @__PURE__ */ jsxs6("label", { children: [
2789
- /* @__PURE__ */ jsx6("span", { children: "Deposit date" }),
2790
- /* @__PURE__ */ jsx6("input", { required: true, value: payment.depositDate, placeholder: "MM/DD/YYYY", onChange: (event) => setPayment((current) => ({ ...current, depositDate: event.target.value })) })
3100
+ /* @__PURE__ */ jsxs7("label", { children: [
3101
+ /* @__PURE__ */ jsx7("span", { children: "Deposit date" }),
3102
+ /* @__PURE__ */ jsx7("input", { required: true, value: payment.depositDate, placeholder: "MM/DD/YYYY", onChange: (event) => setPayment((current) => ({ ...current, depositDate: event.target.value })) })
2791
3103
  ] }),
2792
- /* @__PURE__ */ jsxs6("label", { className: "full", children: [
2793
- /* @__PURE__ */ jsx6("span", { children: "Note (optional)" }),
2794
- /* @__PURE__ */ jsx6("input", { value: payment.note, onChange: (event) => setPayment((current) => ({ ...current, note: event.target.value })) })
3104
+ /* @__PURE__ */ jsxs7("label", { className: "full", children: [
3105
+ /* @__PURE__ */ jsx7("span", { children: "Note (optional)" }),
3106
+ /* @__PURE__ */ jsx7("input", { value: payment.note, onChange: (event) => setPayment((current) => ({ ...current, note: event.target.value })) })
2795
3107
  ] })
2796
3108
  ] }),
2797
- /* @__PURE__ */ jsxs6("div", { className: "mb-lifecycle-panel-actions", children: [
2798
- /* @__PURE__ */ jsx6("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
2799
- /* @__PURE__ */ jsx6("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || payment.amount <= 0 || payment.amount > data.bill.balanceDue || !payment.depositDate, onClick: () => void complete("Payment posted.", () => lifecycle.postPayment(payment)), children: lifecycle.isMutating ? "Posting\u2026" : "Post payment" })
3109
+ /* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-panel-actions", children: [
3110
+ /* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
3111
+ /* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || payment.amount <= 0 || payment.amount > data.bill.balanceDue || !payment.depositDate, onClick: () => void complete("Payment posted.", () => lifecycle.postPayment(payment)), children: lifecycle.isMutating ? "Posting\u2026" : "Post payment" })
2800
3112
  ] })
2801
3113
  ] }) }) : null,
2802
- panel === "close" || panel === "reopen" ? /* @__PURE__ */ jsx6(LifecycleDialog, { title: panel === "close" ? "Close bill" : "Reopen bill", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs6("section", { className: "mb-lifecycle-panel", children: [
2803
- /* @__PURE__ */ jsxs6("div", { children: [
2804
- /* @__PURE__ */ jsx6("h3", { children: panel === "close" ? "Close bill" : "Reopen bill" }),
2805
- /* @__PURE__ */ jsx6("p", { children: panel === "close" ? "The immutable submission and history remain available." : "Return this bill to active follow-up without changing the submitted snapshot." })
3114
+ panel === "close" || panel === "reopen" ? /* @__PURE__ */ jsx7(LifecycleDialog, { title: panel === "close" ? "Close bill" : "Reopen bill", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-panel", children: [
3115
+ /* @__PURE__ */ jsxs7("div", { children: [
3116
+ /* @__PURE__ */ jsx7("h3", { children: panel === "close" ? "Close bill" : "Reopen bill" }),
3117
+ /* @__PURE__ */ jsx7("p", { children: panel === "close" ? "The immutable submission and history remain available." : "Return this bill to active follow-up without changing the submitted snapshot." })
2806
3118
  ] }),
2807
- /* @__PURE__ */ jsxs6("label", { children: [
2808
- /* @__PURE__ */ jsx6("span", { children: "Reason" }),
2809
- /* @__PURE__ */ jsx6("textarea", { required: true, value: reason, onChange: (event) => setReason(event.target.value) })
3119
+ /* @__PURE__ */ jsxs7("label", { children: [
3120
+ /* @__PURE__ */ jsx7("span", { children: "Reason" }),
3121
+ /* @__PURE__ */ jsx7("textarea", { required: true, value: reason, onChange: (event) => setReason(event.target.value) })
2810
3122
  ] }),
2811
- /* @__PURE__ */ jsxs6("div", { className: "mb-lifecycle-panel-actions", children: [
2812
- /* @__PURE__ */ jsx6("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
2813
- /* @__PURE__ */ jsx6("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !reason.trim(), onClick: () => void complete(panel === "close" ? "Bill closed." : "Bill reopened.", () => panel === "close" ? lifecycle.closeBill({ reason }) : lifecycle.reopenBill({ reason })), children: lifecycle.isMutating ? "Saving\u2026" : panel === "close" ? "Close bill" : "Reopen bill" })
3123
+ /* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-panel-actions", children: [
3124
+ /* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
3125
+ /* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !reason.trim(), onClick: () => void complete(panel === "close" ? "Bill closed." : "Bill reopened.", () => panel === "close" ? lifecycle.closeBill({ reason }) : lifecycle.reopenBill({ reason })), children: lifecycle.isMutating ? "Saving\u2026" : panel === "close" ? "Close bill" : "Reopen bill" })
2814
3126
  ] })
2815
3127
  ] }) }) : null,
2816
- notice ? /* @__PURE__ */ jsx6("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
2817
- lifecycle.error ? /* @__PURE__ */ jsx6("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
3128
+ notice ? /* @__PURE__ */ jsx7("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
3129
+ lifecycle.error ? /* @__PURE__ */ jsx7("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
2818
3130
  ] });
2819
3131
  }
2820
3132
  var CONNECTED_LIFECYCLE_STYLES = `
@@ -2868,8 +3180,10 @@ export {
2868
3180
  BILL_SUBMISSION_DOCUMENT_TYPES,
2869
3181
  BILL_SUBMISSION_REQUIRED_FIELDS,
2870
3182
  BillActivityTimeline,
3183
+ BillAgingSummary,
2871
3184
  BillLifecycleActions,
2872
3185
  BillLifecycleProgress,
3186
+ BillList,
2873
3187
  BillPayerContactCard,
2874
3188
  BillPaymentLedger,
2875
3189
  BillReadOnlyForm,
@@ -2877,7 +3191,16 @@ export {
2877
3191
  BillReviewForm,
2878
3192
  BillSnapshotSummary,
2879
3193
  BillStatusSummary,
3194
+ BillSubmissionActions,
3195
+ BillSubmissionAttachmentsSection,
3196
+ BillSubmissionClaimSection,
2880
3197
  BillSubmissionForm,
3198
+ BillSubmissionHeader,
3199
+ BillSubmissionPatientSection,
3200
+ BillSubmissionProvidersSection,
3201
+ BillSubmissionServiceLinesSection,
3202
+ BillingDashboard,
3203
+ BillingReport,
2881
3204
  ConnectedBillLifecycle,
2882
3205
  ConnectedBillStatus,
2883
3206
  DEFAULT_BILL_SUBMISSION_MODIFIERS,
@@ -2886,9 +3209,13 @@ export {
2886
3209
  MindBillBillTimeline,
2887
3210
  applyBillSubmissionEvaluationModifiers,
2888
3211
  billActivityEventLabel,
3212
+ billAgingBucket,
3213
+ billAgingDays,
2889
3214
  billLifecycleDisplayLabel,
2890
3215
  billLifecycleStage,
2891
3216
  buildBillReviewSaveInput,
3217
+ buildBillingReportCsv,
3218
+ buildBillingReportRows,
2892
3219
  calculateBillSubmissionAllowedAmount,
2893
3220
  createBillLifecycleClient2 as createBillLifecycleClient,
2894
3221
  createBillStatusClient,
@@ -2899,6 +3226,7 @@ export {
2899
3226
  mindBillThemePresets,
2900
3227
  parseBillSubmissionDate,
2901
3228
  resolveMindBillAppearance,
3229
+ summarizeBillingDashboard,
2902
3230
  useBillLifecycle,
2903
3231
  useBillStatus,
2904
3232
  validateBillSubmission,