@mindbill/react 0.44.1 → 0.46.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
@@ -1,8 +1,48 @@
1
1
  "use client";
2
2
 
3
+ // src/billing-profile-options.ts
4
+ function organizationProfileOptions(profile) {
5
+ return {
6
+ billingProviders: profile.billingProviders.map((provider) => ({
7
+ id: provider.id,
8
+ label: provider.name,
9
+ value: {
10
+ name: provider.name,
11
+ taxId: provider.taxId,
12
+ npi: provider.npi,
13
+ ...provider.phone !== void 0 ? { phone: provider.phone } : {},
14
+ address: { line1: provider.billingStreet ?? "", city: provider.billingCity ?? "", state: provider.billingState ?? "", postalCode: provider.billingZip ?? "" }
15
+ }
16
+ })),
17
+ renderingProviders: (profile.renderingProviders ?? []).filter((provider) => provider.active !== false).map((provider) => ({
18
+ id: provider.id,
19
+ label: provider.name,
20
+ value: {
21
+ name: provider.name,
22
+ npi: provider.npi,
23
+ ...provider.specialty !== void 0 ? { specialty: provider.specialty } : {},
24
+ ...provider.taxonomy !== void 0 ? { taxonomy: provider.taxonomy } : {},
25
+ ...provider.licenseNumber !== void 0 ? { licenseNumber: provider.licenseNumber } : {},
26
+ ...provider.licenseState !== void 0 ? { licenseState: provider.licenseState } : {},
27
+ ...provider.isQME !== void 0 ? { isQme: provider.isQME } : {},
28
+ ...provider.isAME !== void 0 ? { isAme: provider.isAME } : {}
29
+ }
30
+ })),
31
+ serviceLocations: profile.locations.filter((location) => location.active !== false).map((location) => ({
32
+ id: location.id,
33
+ label: location.nickname || location.name,
34
+ value: {
35
+ name: location.name,
36
+ placeOfServiceCode: location.posCode ?? "",
37
+ address: { line1: location.street, city: location.city, state: location.state, postalCode: location.zip }
38
+ }
39
+ }))
40
+ };
41
+ }
42
+
3
43
  // src/index.tsx
4
44
  import "@mindbill/embed";
5
- import { createElement, useEffect as useEffect12, useRef as useRef7 } from "react";
45
+ import { createElement, useEffect as useEffect12, useRef as useRef8 } from "react";
6
46
 
7
47
  // src/appearance.ts
8
48
  var mindBillThemePresets = {
@@ -99,8 +139,8 @@ var mindBillThemePresets = {
99
139
  textColor: "#05092e",
100
140
  mutedColor: "#596078",
101
141
  borderColor: "#d9dae1",
102
- borderRadius: "0px",
103
- controlRadius: "999px",
142
+ borderRadius: "10px",
143
+ controlRadius: "6px",
104
144
  shadow: "0 1px 2px rgba(5,9,46,.04)",
105
145
  dangerColor: "#b42318",
106
146
  successColor: "#167a58",
@@ -114,6 +154,7 @@ function resolveMindBillAppearance(appearance) {
114
154
  }
115
155
  function mindBillAppearanceStyle(appearance, style) {
116
156
  const resolved = resolveMindBillAppearance(appearance);
157
+ const dashboard = resolved.dashboard;
117
158
  return {
118
159
  "--mb-accent": resolved.accentColor,
119
160
  "--mb-accent-contrast": resolved.accentTextColor,
@@ -130,6 +171,25 @@ function mindBillAppearanceStyle(appearance, style) {
130
171
  "--mb-danger": resolved.dangerColor,
131
172
  "--mb-success": resolved.successColor,
132
173
  "--mb-warning": resolved.warningColor,
174
+ "--mbtk-border": dashboard?.borderColor ?? "var(--mb-border)",
175
+ "--mbtk-border-width": dashboard?.borderWidth ?? "1px",
176
+ "--mbtk-radius": dashboard?.borderRadius ?? "var(--mb-radius)",
177
+ "--mbtk-section-gap": dashboard?.sectionGap ?? "16px",
178
+ "--mbtk-row-height": dashboard?.rowMinHeight ?? "44px",
179
+ // Brand accents can be intentionally pale. Counts remain legible on a surface.
180
+ "--mbtk-link": dashboard?.linkColor ?? "var(--mb-text)",
181
+ "--mbtk-violet": dashboard?.sectionColors?.violet ?? "var(--mb-accent)",
182
+ "--mbtk-red": dashboard?.sectionColors?.red ?? "var(--mb-danger)",
183
+ "--mbtk-blue": dashboard?.sectionColors?.blue ?? "var(--mb-accent)",
184
+ "--mbtk-green": dashboard?.sectionColors?.green ?? "var(--mb-success)",
185
+ "--mbtk-amber": dashboard?.sectionColors?.amber ?? "var(--mb-warning)",
186
+ "--mbtk-neutral": dashboard?.sectionColors?.neutral ?? "var(--mb-muted)",
187
+ "--mbtk-aging-text": dashboard?.agingTextColor ?? "var(--mb-text)",
188
+ "--mbtk-aging-radius": dashboard?.agingRadius ?? "var(--mb-control-radius)",
189
+ ...Object.fromEntries(Array.from({ length: 5 }, (_, index) => [
190
+ `--mbtk-aging-${index + 1}`,
191
+ dashboard?.agingColors?.[index] ?? `color-mix(in srgb,var(--mb-accent) ${6 + index * 4}%,var(--mb-surface))`
192
+ ])),
133
193
  ...style
134
194
  };
135
195
  }
@@ -2564,6 +2624,8 @@ function BillSubmissionForm({
2564
2624
  getSession,
2565
2625
  sessionEndpoint,
2566
2626
  apiBaseUrl,
2627
+ profileOptions,
2628
+ profileDisplay = "expanded",
2567
2629
  fetch: fetchOverride,
2568
2630
  onListClaimsAdministrators,
2569
2631
  onSearchClaimsAdministrators,
@@ -2593,6 +2655,7 @@ function BillSubmissionForm({
2593
2655
  children
2594
2656
  }) {
2595
2657
  const [bill, setBill] = useState5(() => cloneInitialBill(initialBill));
2658
+ const [providerEditing, setProviderEditing] = useState5(false);
2596
2659
  const [selectedIds, setSelectedIds] = useState5(() => attachments.map((item) => item.id));
2597
2660
  const [removedSourceIds, setRemovedSourceIds] = useState5([]);
2598
2661
  const [uploads, setUploads] = useState5([]);
@@ -3084,36 +3147,55 @@ function BillSubmissionForm({
3084
3147
  ] })
3085
3148
  ] })
3086
3149
  ] });
3150
+ const compactProviders = profileDisplay === "compact";
3151
+ const providerErrors = Object.keys(errors).some((path) => /^(billingProvider|renderingProvider|serviceLocation)\./.test(path));
3087
3152
  const providersSection = /* @__PURE__ */ jsxs5("fieldset", { className: "mbsf-card", disabled: locked, children: [
3088
3153
  /* @__PURE__ */ jsx5("legend", { className: "mbsf-legend", children: "Providers & place of service" }),
3089
- /* @__PURE__ */ jsxs5("div", { className: "mbsf-grid", children: [
3090
- /* @__PURE__ */ jsx5("h4", { className: "mbsf-subhead", children: "Billing provider" }),
3091
- /* @__PURE__ */ jsx5(Field2, { path: "billingProvider.name", label: "Billing provider name", required: true, error: errors["billingProvider.name"], children: text(bill.billingProvider?.name, (name) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, name } }))) }),
3092
- /* @__PURE__ */ jsx5(Field2, { path: "billingProvider.taxId", label: "Tax ID (EIN / SSN)", required: true, error: errors["billingProvider.taxId"], children: text(bill.billingProvider?.taxId, (taxId) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, taxId } })), { inputMode: "numeric" }) }),
3093
- /* @__PURE__ */ jsx5(Field2, { path: "billingProvider.npi", label: "Billing provider NPI", required: true, error: errors["billingProvider.npi"], children: text(bill.billingProvider?.npi, (npi) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, npi } })), { inputMode: "numeric", maxLength: 10 }) }),
3094
- /* @__PURE__ */ jsx5(Field2, { path: "billingProvider.phone", label: "Billing provider phone", required: true, error: errors["billingProvider.phone"], children: text(bill.billingProvider?.phone, (phone) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, phone } })), { type: "tel" }) }),
3095
- /* @__PURE__ */ jsx5(Field2, { path: "billingProvider.address.line1", label: "Billing address line 1", required: true, span: true, error: errors["billingProvider.address.line1"], children: text(bill.billingProvider?.address?.line1, (line1) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1, line2: c.billingProvider?.address?.line2 ?? "", city: c.billingProvider?.address?.city ?? "", state: c.billingProvider?.address?.state ?? "", postalCode: c.billingProvider?.address?.postalCode ?? "" } } }))) }),
3096
- /* @__PURE__ */ jsx5(Field2, { label: "Billing address line 2 (optional)", span: true, children: text(bill.billingProvider?.address?.line2, (line2) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1: c.billingProvider?.address?.line1 ?? "", line2, city: c.billingProvider?.address?.city ?? "", state: c.billingProvider?.address?.state ?? "", postalCode: c.billingProvider?.address?.postalCode ?? "" } } }))) }),
3097
- /* @__PURE__ */ jsx5(Field2, { path: "billingProvider.address.city", label: "Billing city", required: true, error: errors["billingProvider.address.city"], children: text(bill.billingProvider?.address?.city, (city) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1: c.billingProvider?.address?.line1 ?? "", line2: c.billingProvider?.address?.line2 ?? "", city, state: c.billingProvider?.address?.state ?? "", postalCode: c.billingProvider?.address?.postalCode ?? "" } } }))) }),
3098
- /* @__PURE__ */ jsx5(Field2, { path: "billingProvider.address.state", label: "Billing state", required: true, error: errors["billingProvider.address.state"], children: text(bill.billingProvider?.address?.state, (state) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1: c.billingProvider?.address?.line1 ?? "", line2: c.billingProvider?.address?.line2 ?? "", city: c.billingProvider?.address?.city ?? "", state: state.toUpperCase(), postalCode: c.billingProvider?.address?.postalCode ?? "" } } })), { maxLength: 2 }) }),
3099
- /* @__PURE__ */ jsx5(Field2, { path: "billingProvider.address.postalCode", label: "Billing ZIP", required: true, error: errors["billingProvider.address.postalCode"], children: text(bill.billingProvider?.address?.postalCode, (postalCode) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1: c.billingProvider?.address?.line1 ?? "", line2: c.billingProvider?.address?.line2 ?? "", city: c.billingProvider?.address?.city ?? "", state: c.billingProvider?.address?.state ?? "", postalCode } } }))) }),
3100
- /* @__PURE__ */ jsx5("h4", { className: "mbsf-subhead", children: "Rendering provider" }),
3101
- /* @__PURE__ */ jsx5(Field2, { path: "renderingProvider.name", label: "Rendering provider name", required: true, error: errors["renderingProvider.name"], children: text(bill.renderingProvider?.name, (name) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, name } }))) }),
3102
- /* @__PURE__ */ jsx5(Field2, { path: "renderingProvider.npi", label: "Rendering provider NPI", required: true, error: errors["renderingProvider.npi"], children: text(bill.renderingProvider?.npi, (npi) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, npi } })), { inputMode: "numeric", maxLength: 10 }) }),
3103
- /* @__PURE__ */ jsxs5(Field2, { path: "renderingProvider.taxonomy", label: "Rendering taxonomy", required: true, error: errors["renderingProvider.taxonomy"], children: [
3104
- /* @__PURE__ */ jsx5(ComboBox, { ariaLabel: "Rendering taxonomy", invalid: Boolean(errors["renderingProvider.taxonomy"]), disabled: locked, preserveValueOnOpen: true, value: bill.renderingProvider?.taxonomy ?? "", placeholder: "Search specialty name or taxonomy code\u2026", options: taxonomies.map((item) => ({ id: item.code, label: item.description, detail: item.code })), createOption: (query) => {
3105
- const code = query.trim().toUpperCase();
3106
- return /^[A-Z0-9]{10}$/.test(code) ? { id: code, label: code, detail: "Use this taxonomy code" } : null;
3107
- }, onSelect: (option) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, taxonomy: option.id } })) }),
3108
- /* @__PURE__ */ jsx5("small", { className: "mbsf-help", children: "Search by specialty name or 10-character taxonomy code." })
3109
- ] }),
3110
- /* @__PURE__ */ jsx5("h4", { className: "mbsf-subhead", children: "Service facility" }),
3111
- /* @__PURE__ */ jsx5(Field2, { path: "serviceLocation.placeOfServiceCode", label: "Place of service code", required: true, error: errors["serviceLocation.placeOfServiceCode"], children: text(bill.serviceLocation?.placeOfServiceCode, (placeOfServiceCode) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, placeOfServiceCode } })), { inputMode: "numeric", maxLength: 2, placeholder: "11" }) }),
3112
- /* @__PURE__ */ jsx5(Field2, { path: "serviceLocation.address.line1", label: "Service address line 1", required: true, span: true, error: errors["serviceLocation.address.line1"], children: text(bill.serviceLocation?.address?.line1, (line1) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1, line2: c.serviceLocation?.address?.line2 ?? "", city: c.serviceLocation?.address?.city ?? "", state: c.serviceLocation?.address?.state ?? "", postalCode: c.serviceLocation?.address?.postalCode ?? "" } } }))) }),
3113
- /* @__PURE__ */ jsx5(Field2, { label: "Service address line 2 (optional)", span: true, children: text(bill.serviceLocation?.address?.line2, (line2) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1: c.serviceLocation?.address?.line1 ?? "", line2, city: c.serviceLocation?.address?.city ?? "", state: c.serviceLocation?.address?.state ?? "", postalCode: c.serviceLocation?.address?.postalCode ?? "" } } }))) }),
3114
- /* @__PURE__ */ jsx5(Field2, { path: "serviceLocation.address.city", label: "Service city", required: true, error: errors["serviceLocation.address.city"], children: text(bill.serviceLocation?.address?.city, (city) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1: c.serviceLocation?.address?.line1 ?? "", line2: c.serviceLocation?.address?.line2 ?? "", city, state: c.serviceLocation?.address?.state ?? "", postalCode: c.serviceLocation?.address?.postalCode ?? "" } } }))) }),
3115
- /* @__PURE__ */ jsx5(Field2, { path: "serviceLocation.address.state", label: "Service state", required: true, error: errors["serviceLocation.address.state"], children: text(bill.serviceLocation?.address?.state, (state) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1: c.serviceLocation?.address?.line1 ?? "", line2: c.serviceLocation?.address?.line2 ?? "", city: c.serviceLocation?.address?.city ?? "", state: state.toUpperCase(), postalCode: c.serviceLocation?.address?.postalCode ?? "" } } })), { maxLength: 2 }) }),
3116
- /* @__PURE__ */ jsx5(Field2, { path: "serviceLocation.address.postalCode", label: "Service ZIP", required: true, error: errors["serviceLocation.address.postalCode"], children: text(bill.serviceLocation?.address?.postalCode, (postalCode) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1: c.serviceLocation?.address?.line1 ?? "", line2: c.serviceLocation?.address?.line2 ?? "", city: c.serviceLocation?.address?.city ?? "", state: c.serviceLocation?.address?.state ?? "", postalCode } } }))) })
3154
+ /* @__PURE__ */ jsx5("div", { className: "mbsf-grid", children: [["billingProviders", "billingProvider", "Billing provider"], ["renderingProviders", "renderingProvider", "Rendering provider"], ["serviceLocations", "serviceLocation", "Service location"]].map(([collection, key, label]) => {
3155
+ const options = profileOptions?.[collection];
3156
+ return options?.length ? /* @__PURE__ */ jsxs5(Field2, { label: `Saved ${label.toLowerCase()}`, children: [
3157
+ /* @__PURE__ */ jsx5(ComboBox, { ariaLabel: `Saved ${label.toLowerCase()}`, disabled: locked, value: "", placeholder: bill[key]?.name || `Choose ${label.toLowerCase()}\u2026`, options: options.map(({ id, label: optionLabel }) => ({ id, label: optionLabel })), onSelect: ({ id }) => {
3158
+ const option = options.find((candidate) => candidate.id === id);
3159
+ if (option) setBill((current) => ({ ...current, [key]: structuredClone(option.value) }));
3160
+ } }),
3161
+ /* @__PURE__ */ jsx5("small", { className: "mbsf-help", children: bill[key]?.name ? `Current: ${bill[key]?.name}` : "Select a profile or enter details below." })
3162
+ ] }, key) : null;
3163
+ }) }),
3164
+ compactProviders ? /* @__PURE__ */ jsx5("p", { className: "mbsf-help", children: [bill.billingProvider?.name, bill.renderingProvider?.name, bill.serviceLocation?.name].filter(Boolean).join(" \xB7 ") || "Enter provider details or choose saved profiles." }) : null,
3165
+ /* @__PURE__ */ jsxs5("details", { open: !compactProviders || providerEditing || providerErrors, children: [
3166
+ /* @__PURE__ */ jsx5("summary", { hidden: !compactProviders, onClick: (event) => {
3167
+ event.preventDefault();
3168
+ setProviderEditing((current) => !current);
3169
+ }, style: { cursor: "pointer", marginBottom: 12 }, children: "Review or edit provider details" }),
3170
+ /* @__PURE__ */ jsxs5("div", { className: "mbsf-grid", children: [
3171
+ /* @__PURE__ */ jsx5("h4", { className: "mbsf-subhead", children: "Billing provider" }),
3172
+ /* @__PURE__ */ jsx5(Field2, { path: "billingProvider.name", label: "Billing provider name", required: true, error: errors["billingProvider.name"], children: text(bill.billingProvider?.name, (name) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, name } }))) }),
3173
+ /* @__PURE__ */ jsx5(Field2, { path: "billingProvider.taxId", label: "Tax ID (EIN / SSN)", required: true, error: errors["billingProvider.taxId"], children: text(bill.billingProvider?.taxId, (taxId) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, taxId } })), { inputMode: "numeric" }) }),
3174
+ /* @__PURE__ */ jsx5(Field2, { path: "billingProvider.npi", label: "Billing provider NPI", required: true, error: errors["billingProvider.npi"], children: text(bill.billingProvider?.npi, (npi) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, npi } })), { inputMode: "numeric", maxLength: 10 }) }),
3175
+ /* @__PURE__ */ jsx5(Field2, { path: "billingProvider.phone", label: "Billing provider phone", required: true, error: errors["billingProvider.phone"], children: text(bill.billingProvider?.phone, (phone) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, phone } })), { type: "tel" }) }),
3176
+ /* @__PURE__ */ jsx5(Field2, { path: "billingProvider.address.line1", label: "Billing address line 1", required: true, span: true, error: errors["billingProvider.address.line1"], children: text(bill.billingProvider?.address?.line1, (line1) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1, line2: c.billingProvider?.address?.line2 ?? "", city: c.billingProvider?.address?.city ?? "", state: c.billingProvider?.address?.state ?? "", postalCode: c.billingProvider?.address?.postalCode ?? "" } } }))) }),
3177
+ /* @__PURE__ */ jsx5(Field2, { label: "Billing address line 2 (optional)", span: true, children: text(bill.billingProvider?.address?.line2, (line2) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1: c.billingProvider?.address?.line1 ?? "", line2, city: c.billingProvider?.address?.city ?? "", state: c.billingProvider?.address?.state ?? "", postalCode: c.billingProvider?.address?.postalCode ?? "" } } }))) }),
3178
+ /* @__PURE__ */ jsx5(Field2, { path: "billingProvider.address.city", label: "Billing city", required: true, error: errors["billingProvider.address.city"], children: text(bill.billingProvider?.address?.city, (city) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1: c.billingProvider?.address?.line1 ?? "", line2: c.billingProvider?.address?.line2 ?? "", city, state: c.billingProvider?.address?.state ?? "", postalCode: c.billingProvider?.address?.postalCode ?? "" } } }))) }),
3179
+ /* @__PURE__ */ jsx5(Field2, { path: "billingProvider.address.state", label: "Billing state", required: true, error: errors["billingProvider.address.state"], children: text(bill.billingProvider?.address?.state, (state) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1: c.billingProvider?.address?.line1 ?? "", line2: c.billingProvider?.address?.line2 ?? "", city: c.billingProvider?.address?.city ?? "", state: state.toUpperCase(), postalCode: c.billingProvider?.address?.postalCode ?? "" } } })), { maxLength: 2 }) }),
3180
+ /* @__PURE__ */ jsx5(Field2, { path: "billingProvider.address.postalCode", label: "Billing ZIP", required: true, error: errors["billingProvider.address.postalCode"], children: text(bill.billingProvider?.address?.postalCode, (postalCode) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, address: { line1: c.billingProvider?.address?.line1 ?? "", line2: c.billingProvider?.address?.line2 ?? "", city: c.billingProvider?.address?.city ?? "", state: c.billingProvider?.address?.state ?? "", postalCode } } }))) }),
3181
+ /* @__PURE__ */ jsx5("h4", { className: "mbsf-subhead", children: "Rendering provider" }),
3182
+ /* @__PURE__ */ jsx5(Field2, { path: "renderingProvider.name", label: "Rendering provider name", required: true, error: errors["renderingProvider.name"], children: text(bill.renderingProvider?.name, (name) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, name } }))) }),
3183
+ /* @__PURE__ */ jsx5(Field2, { path: "renderingProvider.npi", label: "Rendering provider NPI", required: true, error: errors["renderingProvider.npi"], children: text(bill.renderingProvider?.npi, (npi) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, npi } })), { inputMode: "numeric", maxLength: 10 }) }),
3184
+ /* @__PURE__ */ jsxs5(Field2, { path: "renderingProvider.taxonomy", label: "Rendering taxonomy", required: true, error: errors["renderingProvider.taxonomy"], children: [
3185
+ /* @__PURE__ */ jsx5(ComboBox, { ariaLabel: "Rendering taxonomy", invalid: Boolean(errors["renderingProvider.taxonomy"]), disabled: locked, preserveValueOnOpen: true, value: bill.renderingProvider?.taxonomy ?? "", placeholder: "Search specialty name or taxonomy code\u2026", options: taxonomies.map((item) => ({ id: item.code, label: item.description, detail: item.code })), createOption: (query) => {
3186
+ const code = query.trim().toUpperCase();
3187
+ return /^[A-Z0-9]{10}$/.test(code) ? { id: code, label: code, detail: "Use this taxonomy code" } : null;
3188
+ }, onSelect: (option) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, taxonomy: option.id } })) }),
3189
+ /* @__PURE__ */ jsx5("small", { className: "mbsf-help", children: "Search by specialty name or 10-character taxonomy code." })
3190
+ ] }),
3191
+ /* @__PURE__ */ jsx5("h4", { className: "mbsf-subhead", children: "Service facility" }),
3192
+ /* @__PURE__ */ jsx5(Field2, { path: "serviceLocation.placeOfServiceCode", label: "Place of service code", required: true, error: errors["serviceLocation.placeOfServiceCode"], children: text(bill.serviceLocation?.placeOfServiceCode, (placeOfServiceCode) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, placeOfServiceCode } })), { inputMode: "numeric", maxLength: 2, placeholder: "11" }) }),
3193
+ /* @__PURE__ */ jsx5(Field2, { path: "serviceLocation.address.line1", label: "Service address line 1", required: true, span: true, error: errors["serviceLocation.address.line1"], children: text(bill.serviceLocation?.address?.line1, (line1) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1, line2: c.serviceLocation?.address?.line2 ?? "", city: c.serviceLocation?.address?.city ?? "", state: c.serviceLocation?.address?.state ?? "", postalCode: c.serviceLocation?.address?.postalCode ?? "" } } }))) }),
3194
+ /* @__PURE__ */ jsx5(Field2, { label: "Service address line 2 (optional)", span: true, children: text(bill.serviceLocation?.address?.line2, (line2) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1: c.serviceLocation?.address?.line1 ?? "", line2, city: c.serviceLocation?.address?.city ?? "", state: c.serviceLocation?.address?.state ?? "", postalCode: c.serviceLocation?.address?.postalCode ?? "" } } }))) }),
3195
+ /* @__PURE__ */ jsx5(Field2, { path: "serviceLocation.address.city", label: "Service city", required: true, error: errors["serviceLocation.address.city"], children: text(bill.serviceLocation?.address?.city, (city) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1: c.serviceLocation?.address?.line1 ?? "", line2: c.serviceLocation?.address?.line2 ?? "", city, state: c.serviceLocation?.address?.state ?? "", postalCode: c.serviceLocation?.address?.postalCode ?? "" } } }))) }),
3196
+ /* @__PURE__ */ jsx5(Field2, { path: "serviceLocation.address.state", label: "Service state", required: true, error: errors["serviceLocation.address.state"], children: text(bill.serviceLocation?.address?.state, (state) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1: c.serviceLocation?.address?.line1 ?? "", line2: c.serviceLocation?.address?.line2 ?? "", city: c.serviceLocation?.address?.city ?? "", state: state.toUpperCase(), postalCode: c.serviceLocation?.address?.postalCode ?? "" } } })), { maxLength: 2 }) }),
3197
+ /* @__PURE__ */ jsx5(Field2, { path: "serviceLocation.address.postalCode", label: "Service ZIP", required: true, error: errors["serviceLocation.address.postalCode"], children: text(bill.serviceLocation?.address?.postalCode, (postalCode) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, address: { line1: c.serviceLocation?.address?.line1 ?? "", line2: c.serviceLocation?.address?.line2 ?? "", city: c.serviceLocation?.address?.city ?? "", state: c.serviceLocation?.address?.state ?? "", postalCode } } }))) })
3198
+ ] })
3117
3199
  ] })
3118
3200
  ] });
3119
3201
  const serviceLinesSection = /* @__PURE__ */ jsxs5("fieldset", { className: "mbsf-card", disabled: locked, children: [
@@ -3705,37 +3787,29 @@ import {
3705
3787
  buildBillTasksDashboard
3706
3788
  } from "@mindbill/browser";
3707
3789
  import { Fragment as Fragment6, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
3708
- var TONES = {
3709
- violet: "#7c53c3",
3710
- red: "#cf4437",
3711
- blue: "#2f7fd1",
3712
- green: "#2c9a5b",
3713
- amber: "#d9931f",
3714
- neutral: "#8195a1"
3715
- };
3716
- var BUCKET_PILL_BASES = ["#2c9a5b", "#1f9aa8", "#dcbb28", "#e08a2e", "#d75d8a"];
3717
3790
  var css6 = `
3718
3791
  .mbtk{color:var(--mb-text);font-family:var(--mb-font);font-size:14px}.mbtk *{box-sizing:border-box}.mbtk h2,.mbtk p{margin:0}
3719
3792
  .mbtk-heading{margin-bottom:14px}.mbtk-heading h2{font-size:24px}
3720
3793
  .mbtk-toolbar{margin-bottom:14px}
3721
- .mbtk-section{margin-bottom:16px;border:1.5px solid var(--mbtk-tone,var(--mb-border));border-radius:var(--mb-radius);background:var(--mb-surface);box-shadow:var(--mb-shadow);overflow:hidden}
3722
- .mbtk-section.is-grand{border-color:var(--mb-border)}
3794
+ .mbtk-section{margin-bottom:var(--mbtk-section-gap);border:var(--mbtk-border-width) solid var(--mbtk-border);border-radius:var(--mbtk-radius);background:var(--mb-surface);box-shadow:var(--mb-shadow);overflow:hidden}
3723
3795
  .mbtk-grid{display:grid;grid-template-columns:var(--mbtk-cols);gap:0 10px;align-items:center;padding:0 16px}
3724
- .mbtk-head{padding:12px 16px;border-bottom:1px solid color-mix(in srgb,var(--mbtk-tone,var(--mb-border)) 22%,var(--mb-border))}
3796
+ .mbtk-head{padding:12px 16px;border-bottom:1px solid var(--mb-border)}
3725
3797
  .mbtk-title{display:flex;align-items:center;gap:9px;min-width:0}
3726
3798
  .mbtk-dot{flex:0 0 auto;width:11px;height:11px;border-radius:50%;background:var(--mbtk-tone,var(--mb-muted))}
3727
3799
  .mbtk-title-text{min-width:0}
3728
3800
  .mbtk-title-text strong{display:block;font-size:15.5px;line-height:1.3}
3729
3801
  .mbtk-basis{display:block;color:var(--mb-muted);font-size:12px;line-height:1.35}
3730
- .mbtk-pill{justify-self:stretch;padding:5px 6px;border-radius:999px;background:color-mix(in srgb,var(--mbtk-pill) 20%,var(--mb-surface));color:color-mix(in srgb,var(--mbtk-pill) 62%,var(--mb-text));font-size:11px;font-weight:750;line-height:1.25;text-align:center;white-space:nowrap}
3802
+ .mbtk-pill{justify-self:stretch;padding:5px 6px;border-radius:var(--mbtk-aging-radius);background:var(--mb-soft);background:var(--mbtk-pill);color:var(--mbtk-aging-text);font-size:11px;font-weight:750;line-height:1.25;text-align:center;white-space:nowrap}
3731
3803
  .mbtk-colhead{justify-self:stretch;color:var(--mb-muted);font-size:11px;font-weight:800;letter-spacing:.05em;text-transform:uppercase;text-align:center;white-space:nowrap}
3732
- .mbtk-row{border-top:1px solid color-mix(in srgb,var(--mb-border) 60%,transparent);min-height:44px}
3804
+ .mbtk-row{border-top:1px solid color-mix(in srgb,var(--mb-border) 60%,transparent);min-height:var(--mbtk-row-height)}
3733
3805
  .mbtk-row:first-of-type{border-top:0}
3734
3806
  .mbtk-rowlabel{color:var(--mb-muted);font-size:13px;line-height:1.35;padding:9px 0;overflow-wrap:anywhere}
3735
3807
  .mbtk-count{text-align:center;font-variant-numeric:tabular-nums}
3736
3808
  .mbtk-zero{color:var(--mb-muted)}
3737
- .mbtk-link{border:0;background:none;padding:6px 8px;color:var(--mb-accent);font:inherit;font-weight:750;font-variant-numeric:tabular-nums;cursor:pointer;border-radius:6px}
3809
+ .mbtk-bal{display:block;color:var(--mb-muted);font-size:11px;font-weight:550;line-height:1.35;white-space:nowrap;font-variant-numeric:tabular-nums}
3810
+ .mbtk-link{border:0;background:none;padding:6px 8px;min-height:44px;min-width:44px;color:var(--mbtk-link);font:inherit;font-weight:750;font-variant-numeric:tabular-nums;cursor:pointer;border-radius:var(--mb-control-radius)}
3738
3811
  .mbtk-link:hover{text-decoration:underline;background:color-mix(in srgb,var(--mb-accent) 8%,transparent)}
3812
+ .mbtk-link:focus-visible{outline:2px solid var(--mbtk-link);outline-offset:2px;text-decoration:underline}
3739
3813
  .mbtk-total{text-align:center}
3740
3814
  .mbtk-totals{background:var(--mb-soft);border-top:1px solid var(--mb-border);font-weight:760}
3741
3815
  .mbtk-totals .mbtk-rowlabel{color:var(--mb-text);font-weight:760}
@@ -3745,17 +3819,26 @@ var css6 = `
3745
3819
  .mbtk-footnote{margin-top:12px;color:var(--mb-muted);font-size:12.5px}
3746
3820
  @media(max-width:760px){.mbtk-pill,.mbtk-colhead,.mbtk-count{display:none}.mbtk-grid{grid-template-columns:minmax(0,1fr) auto}}
3747
3821
  `;
3748
- function cellButton(key, count, className, label, onSelect) {
3822
+ var USD = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" });
3823
+ function cellBody(count, balance) {
3824
+ return /* @__PURE__ */ jsxs8(Fragment6, { children: [
3825
+ /* @__PURE__ */ jsx8("span", { children: count }),
3826
+ count > 0 && balance !== void 0 && Number.isFinite(balance) ? /* @__PURE__ */ jsx8("span", { className: "mbtk-bal", children: USD.format(balance) }) : null
3827
+ ] });
3828
+ }
3829
+ function cellButton(key, count, className, label, onSelect, balance) {
3830
+ const ariaLabel = count > 0 && balance !== void 0 && Number.isFinite(balance) ? `${label} \xB7 ${USD.format(balance)} due` : label;
3749
3831
  if (count > 0 && onSelect) {
3750
- return /* @__PURE__ */ jsx8("span", { className, children: /* @__PURE__ */ jsx8("button", { type: "button", className: "mbtk-link", "aria-label": label, onClick: onSelect, children: count }) }, key);
3832
+ return /* @__PURE__ */ jsx8("span", { className, children: /* @__PURE__ */ jsx8("button", { type: "button", className: "mbtk-link", "aria-label": ariaLabel, onClick: onSelect, children: cellBody(count, balance) }) }, key);
3751
3833
  }
3752
- return /* @__PURE__ */ jsx8("span", { className: `${className}${count === 0 ? " mbtk-zero" : ""}`, children: count }, key);
3834
+ return /* @__PURE__ */ jsx8("span", { className: `${className}${count === 0 ? " mbtk-zero" : ""}`, children: cellBody(count, balance) }, key);
3753
3835
  }
3754
3836
  function TaskRow({
3755
3837
  sectionId,
3756
3838
  row,
3757
3839
  buckets,
3758
- onSelectCell
3840
+ onSelectCell,
3841
+ itemLabel
3759
3842
  }) {
3760
3843
  const allRefs = row.refs.flat();
3761
3844
  return /* @__PURE__ */ jsxs8("div", { className: "mbtk-grid mbtk-row", children: [
@@ -3766,16 +3849,18 @@ function TaskRow({
3766
3849
  bucket.id,
3767
3850
  count,
3768
3851
  "mbtk-count",
3769
- `${row.label} \xB7 ${bucket.label}: ${count} tasks`,
3770
- onSelectCell ? () => onSelectCell({ sectionId, rowId: row.id, bucketId: bucket.id, refs: row.refs[index] ?? [], count }) : null
3852
+ `${row.label} \xB7 ${bucket.label}: ${count} ${itemLabel}`,
3853
+ onSelectCell ? () => onSelectCell({ sectionId, rowId: row.id, bucketId: bucket.id, refs: row.refs[index] ?? [], count }) : null,
3854
+ row.balances?.[index]
3771
3855
  );
3772
3856
  }),
3773
3857
  cellButton(
3774
3858
  "task-total",
3775
3859
  row.total,
3776
3860
  "mbtk-total",
3777
- `${row.label} \xB7 all ages: ${row.total} tasks`,
3778
- onSelectCell ? () => onSelectCell({ sectionId, rowId: row.id, bucketId: null, refs: allRefs, count: row.total }) : null
3861
+ `${row.label} \xB7 all ages: ${row.total} ${itemLabel}`,
3862
+ onSelectCell ? () => onSelectCell({ sectionId, rowId: row.id, bucketId: null, refs: allRefs, count: row.total }) : null,
3863
+ row.balanceTotal
3779
3864
  )
3780
3865
  ] });
3781
3866
  }
@@ -3783,13 +3868,15 @@ function SectionCard({
3783
3868
  section,
3784
3869
  buckets,
3785
3870
  emptyLabel,
3786
- onSelectCell
3871
+ onSelectCell,
3872
+ totalLabel,
3873
+ itemLabel
3787
3874
  }) {
3788
3875
  return /* @__PURE__ */ jsxs8(
3789
3876
  "section",
3790
3877
  {
3791
3878
  className: "mbtk-section",
3792
- style: { "--mbtk-tone": TONES[section.tone] },
3879
+ style: { "--mbtk-tone": `var(--mbtk-${section.tone})` },
3793
3880
  "aria-label": section.label,
3794
3881
  children: [
3795
3882
  /* @__PURE__ */ jsxs8("div", { className: "mbtk-grid mbtk-head", children: [
@@ -3807,19 +3894,19 @@ function SectionCard({
3807
3894
  "span",
3808
3895
  {
3809
3896
  className: "mbtk-pill",
3810
- style: { "--mbtk-pill": BUCKET_PILL_BASES[index % BUCKET_PILL_BASES.length] },
3897
+ style: { "--mbtk-pill": `var(--mbtk-aging-${Math.min(index + 1, 5)})` },
3811
3898
  children: bucket.label
3812
3899
  },
3813
3900
  bucket.id
3814
3901
  )),
3815
- /* @__PURE__ */ jsx8("span", { className: "mbtk-colhead", children: "Task Total" })
3902
+ /* @__PURE__ */ jsx8("span", { className: "mbtk-colhead", children: totalLabel })
3816
3903
  ] }),
3817
3904
  section.empty ? /* @__PURE__ */ jsx8("p", { className: "mbtk-empty", children: emptyLabel }) : /* @__PURE__ */ jsxs8(Fragment6, { children: [
3818
- section.rows.map((row) => /* @__PURE__ */ jsx8(TaskRow, { sectionId: section.id, row, buckets, onSelectCell }, row.id)),
3905
+ section.rows.map((row) => /* @__PURE__ */ jsx8(TaskRow, { sectionId: section.id, row, buckets, onSelectCell, itemLabel }, row.id)),
3819
3906
  /* @__PURE__ */ jsxs8("div", { className: "mbtk-grid mbtk-row mbtk-totals", children: [
3820
3907
  /* @__PURE__ */ jsx8("span", { className: "mbtk-rowlabel", children: "Total" }),
3821
- buckets.map((bucket, index) => /* @__PURE__ */ jsx8("span", { className: "mbtk-count", children: section.totals[index] ?? 0 }, bucket.id)),
3822
- /* @__PURE__ */ jsx8("span", { className: "mbtk-total", children: section.total })
3908
+ buckets.map((bucket, index) => /* @__PURE__ */ jsx8("span", { className: "mbtk-count", children: cellBody(section.totals[index] ?? 0, section.balanceTotals?.[index]) }, bucket.id)),
3909
+ /* @__PURE__ */ jsx8("span", { className: "mbtk-total", children: cellBody(section.total, section.balanceTotal) })
3823
3910
  ] })
3824
3911
  ] })
3825
3912
  ]
@@ -3831,6 +3918,8 @@ function BillTasksDashboard({
3831
3918
  buckets = BILL_TASKS_AGING_BUCKETS,
3832
3919
  heading,
3833
3920
  grandTotalLabel = "Bill Tasks Total",
3921
+ totalLabel = "Task Total",
3922
+ itemLabel = "tasks",
3834
3923
  emptyLabel = "No Tasks",
3835
3924
  onSelectCell,
3836
3925
  toolbar,
@@ -3855,14 +3944,16 @@ function BillTasksDashboard({
3855
3944
  section,
3856
3945
  buckets,
3857
3946
  emptyLabel,
3858
- onSelectCell
3947
+ onSelectCell,
3948
+ totalLabel,
3949
+ itemLabel
3859
3950
  },
3860
3951
  section.id
3861
3952
  )),
3862
3953
  /* @__PURE__ */ jsx8("section", { className: "mbtk-section is-grand", "aria-label": grandTotalLabel, children: /* @__PURE__ */ jsxs8("div", { className: "mbtk-grid mbtk-row mbtk-grand mbtk-totals", children: [
3863
3954
  /* @__PURE__ */ jsx8("span", { className: "mbtk-rowlabel", children: grandTotalLabel }),
3864
- buckets.map((bucket, index) => /* @__PURE__ */ jsx8("span", { className: "mbtk-count", children: data.grandTotals[index] ?? 0 }, bucket.id)),
3865
- /* @__PURE__ */ jsx8("span", { className: "mbtk-total", children: data.grandTotal })
3955
+ buckets.map((bucket, index) => /* @__PURE__ */ jsx8("span", { className: "mbtk-count", children: cellBody(data.grandTotals[index] ?? 0, data.grandBalanceTotals?.[index]) }, bucket.id)),
3956
+ /* @__PURE__ */ jsx8("span", { className: "mbtk-total", children: cellBody(data.grandTotal, data.grandBalanceTotal) })
3866
3957
  ] }) }),
3867
3958
  footnote ? /* @__PURE__ */ jsx8("p", { className: "mbtk-footnote", children: footnote }) : null
3868
3959
  ]
@@ -3972,12 +4063,12 @@ function billSubmissionsRibbonFromHistory(history, attempts = []) {
3972
4063
  var css7 = `
3973
4064
  .mbsr{display:flex;gap:10px;overflow-x:auto;padding-bottom:4px;color:var(--mb-text);font-family:var(--mb-font);font-size:13px}
3974
4065
  .mbsr *{box-sizing:border-box}
3975
- .mbsr-chip{flex:0 0 auto;display:grid;gap:7px;min-width:180px;max-width:280px;padding:11px 13px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-surface);color:inherit;font:inherit;text-align:left;text-decoration:none;cursor:pointer}
4066
+ .mbsr-chip{flex:0 0 240px;display:grid;gap:7px;width:240px;min-width:min(240px,85vw);max-width:280px;padding:11px 13px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-surface);color:inherit;font:inherit;text-align:left;text-decoration:none;cursor:pointer}
3976
4067
  .mbsr-chip:hover{border-color:var(--mb-accent)}
3977
4068
  .mbsr-chip[data-active=true]{border-color:var(--mb-accent);background:color-mix(in srgb,var(--mb-accent) 7%,var(--mb-surface));box-shadow:0 0 0 1px var(--mb-accent) inset}
3978
- .mbsr-top{display:flex;align-items:center;gap:8px;min-width:0}
3979
- .mbsr-label{font-size:13.5px;font-weight:760;line-height:1.3;overflow-wrap:anywhere}
3980
- .mbsr-badge{flex:0 0 auto;padding:2px 8px;border:1px solid color-mix(in srgb,var(--mb-muted) 45%,var(--mb-border));border-radius:999px;background:var(--mb-soft);font-size:11px;font-weight:700;white-space:nowrap}
4069
+ .mbsr-top{display:grid;grid-template-columns:minmax(0,1fr);gap:6px;min-width:0}
4070
+ .mbsr-label{min-width:0;font-size:13.5px;font-weight:760;line-height:1.3;overflow-wrap:normal;word-break:normal}
4071
+ .mbsr-badge{justify-self:start;max-width:100%;padding:2px 8px;border:1px solid color-mix(in srgb,var(--mb-muted) 45%,var(--mb-border));border-radius:999px;background:var(--mb-soft);font-size:11px;font-weight:700;white-space:normal}
3981
4072
  .mbsr-badge[data-tone=success]{border-color:color-mix(in srgb,#23876f 52%,var(--mb-border));background:color-mix(in srgb,#23876f 11%,var(--mb-surface));color:#176452}
3982
4073
  .mbsr-badge[data-tone=warning]{border-color:color-mix(in srgb,var(--mb-warning) 55%,var(--mb-border));background:color-mix(in srgb,var(--mb-warning) 12%,var(--mb-surface))}
3983
4074
  .mbsr-badge[data-tone=danger]{border-color:color-mix(in srgb,var(--mb-danger) 45%,var(--mb-border));background:color-mix(in srgb,var(--mb-danger) 9%,var(--mb-surface));color:var(--mb-danger)}
@@ -4401,13 +4492,14 @@ function ReportBillStatusDialog({
4401
4492
  }
4402
4493
 
4403
4494
  // src/organization-onboarding.tsx
4404
- import { useCallback as useCallback2, useEffect as useEffect7, useMemo as useMemo6, useRef as useRef3, useState as useState8 } from "react";
4495
+ import { useCallback as useCallback2, useEffect as useEffect7, useId as useId2, useMemo as useMemo6, useRef as useRef3, useState as useState8 } from "react";
4405
4496
  import {
4406
4497
  createOrganizationClient
4407
4498
  } from "@mindbill/browser";
4408
4499
  import { Fragment as Fragment9, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
4409
4500
  var STEPS = [
4410
4501
  { id: "practice", label: "Practice & billing" },
4502
+ { id: "rendering", label: "Rendering providers" },
4411
4503
  { id: "locations", label: "Locations" },
4412
4504
  { id: "w9", label: "W-9" },
4413
4505
  { id: "review", label: "Review" }
@@ -4419,13 +4511,13 @@ var css9 = `
4419
4511
  .mbob-steps{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:20px}
4420
4512
  .mbob-step{display:inline-flex;align-items:center;gap:7px;border:1px solid var(--mb-border);border-radius:999px;background:var(--mb-surface);padding:7px 13px;color:var(--mb-muted);font:inherit;font-size:13px;font-weight:700;cursor:pointer}
4421
4513
  .mbob-step[data-active=true]{border-color:var(--mb-accent);color:var(--mb-accent);background:color-mix(in srgb,var(--mb-accent) 8%,var(--mb-surface))}
4422
- .mbob-step[data-done=true] i{color:#159447;font-style:normal}
4514
+ .mbob-step[data-done=true] i{color:var(--mb-success);font-style:normal}
4423
4515
  .mbob-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px 22px}.mbob-span{grid-column:1/-1}
4424
4516
  .mbob-field{display:grid;gap:7px;font-size:13px;font-weight:720}
4425
- .mbob-field input{width:100%;min-height:44px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-input);padding:10px 12px;color:var(--mb-text);font:inherit;font-weight:450}
4517
+ .mbob-field input,.mbob-field select{width:100%;min-height:44px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-input);padding:10px 12px;color:var(--mb-text);font:inherit;font-weight:450}
4426
4518
  .mbob-field input:focus{outline:3px solid color-mix(in srgb,var(--mb-accent) 22%,transparent);border-color:var(--mb-accent)}
4427
4519
  .mbob-subhead{margin:20px 0 12px!important;padding-top:16px;border-top:1px solid var(--mb-border);font-size:15px}
4428
- .mbob-loc{display:grid;grid-template-columns:1.2fr 1.4fr .9fr .4fr .6fr auto auto;gap:10px;align-items:end;border-top:1px solid color-mix(in srgb,var(--mb-border) 60%,transparent);padding:12px 0}
4520
+ .mbob-loc{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;align-items:end;border-top:1px solid color-mix(in srgb,var(--mb-border) 60%,transparent);padding:16px 0}
4429
4521
  .mbob-loc:first-of-type{border-top:0}
4430
4522
  .mbob-primary{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--mb-muted);white-space:nowrap;padding-bottom:12px}
4431
4523
  .mbob-remove{border:0;background:transparent;color:var(--mb-muted);font-size:20px;cursor:pointer;padding-bottom:8px}
@@ -4433,21 +4525,22 @@ var css9 = `
4433
4525
  .mbob-drop{display:grid;place-content:center;gap:6px;min-height:150px;border:2px dashed color-mix(in srgb,var(--mb-muted) 55%,transparent);border-radius:var(--mb-control-radius);text-align:center;cursor:pointer;position:relative}
4434
4526
  .mbob-drop input{position:absolute;inset:0;opacity:0;cursor:pointer}
4435
4527
  .mbob-drop span{color:var(--mb-muted);font-size:13px}
4436
- .mbob-w9-current{display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid #9fd6b4;border-radius:var(--mb-control-radius);background:#f3fcf6;padding:12px 14px;margin-bottom:14px}
4528
+ .mbob-w9-current{display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid color-mix(in srgb,var(--mb-success) 35%,var(--mb-border));border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-success) 8%,var(--mb-surface));padding:12px 14px;margin-bottom:14px}
4437
4529
  .mbob-w9-current span{color:var(--mb-muted);font-size:13px}
4438
4530
  .mbob-check{display:grid;gap:9px}
4439
4531
  .mbob-check-item{display:flex;align-items:center;gap:10px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);padding:11px 14px}
4440
- .mbob-check-item[data-complete=true]{border-color:#9fd6b4;background:#f3fcf6}
4532
+ .mbob-check-item[data-complete=true]{border-color:color-mix(in srgb,var(--mb-success) 35%,var(--mb-border));background:color-mix(in srgb,var(--mb-success) 8%,var(--mb-surface))}
4441
4533
  .mbob-check-item i{font-style:normal}
4442
4534
  .mbob-actions{display:flex;justify-content:space-between;align-items:center;gap:14px;margin-top:20px}
4443
4535
  .mbob-save{min-width:170px;border:0;border-radius:var(--mb-control-radius);background:var(--mb-accent);color:var(--mb-accent-contrast);padding:12px 22px;font:inherit;font-weight:780;cursor:pointer}
4444
4536
  .mbob-save:disabled{opacity:.6;cursor:wait}
4445
4537
  .mbob-error{margin-top:14px;border-left:4px solid var(--mb-danger);border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-danger) 8%,var(--mb-surface));padding:12px 14px;color:var(--mb-danger)}
4446
4538
  .mbob-status{color:var(--mb-muted)}
4447
- .mbob-done{color:#159447;font-weight:750}
4539
+ .mbob-done{color:var(--mb-success);font-weight:750}
4448
4540
  @media(max-width:820px){.mbob-grid{grid-template-columns:1fr}.mbob-span{grid-column:auto}.mbob-loc{grid-template-columns:1fr 1fr;align-items:center}.mbob-loc>*{grid-column:auto}}
4449
4541
  `;
4450
4542
  var blankLocation = () => ({ name: "", street: "", city: "", state: "", zip: "", isPrimary: false });
4543
+ var blankRendering = () => ({ name: "", npi: "", specialty: "", taxonomy: "", active: true });
4451
4544
  async function fileToBase64(file) {
4452
4545
  const buffer = new Uint8Array(await file.arrayBuffer());
4453
4546
  let binary = "";
@@ -4482,6 +4575,8 @@ function OrganizationOnboarding({
4482
4575
  const [identity, setIdentity] = useState8({ name: "", legalName: "", taxId: "", npi: "", phone: "", email: "" });
4483
4576
  const [provider, setProvider] = useState8({ name: "", taxId: "", npi: "", billType: "Professional", phone: "", billingStreet: "", billingCity: "", billingState: "", billingZip: "" });
4484
4577
  const [locations, setLocations] = useState8([blankLocation()]);
4578
+ const [rendering, setRendering] = useState8(blankRendering);
4579
+ const primaryGroup = useId2();
4485
4580
  const [w9File, setW9File] = useState8(null);
4486
4581
  const [saving, setSaving] = useState8(false);
4487
4582
  const [error, setError] = useState8(null);
@@ -4498,6 +4593,7 @@ function OrganizationOnboarding({
4498
4593
  email: next.practiceIdentity.email ?? current.email
4499
4594
  }));
4500
4595
  if (next.billingProviders[0]) setProvider({ billType: "Professional", ...next.billingProviders[0] });
4596
+ if (next.renderingProviders?.[0]) setRendering({ ...next.renderingProviders[0] });
4501
4597
  if (next.locations.length) setLocations(next.locations.map((item) => ({ ...item })));
4502
4598
  if (next.onboarding.complete && !completedFired.current) {
4503
4599
  completedFired.current = true;
@@ -4530,7 +4626,7 @@ function OrganizationOnboarding({
4530
4626
  setSavedStep((current) => ({ ...current, [stepId]: true }));
4531
4627
  onSaved?.(next);
4532
4628
  if (variant === "onboarding") {
4533
- const order = ["practice", "locations", "w9", "review"];
4629
+ const order = STEPS.map((item) => item.id);
4534
4630
  const nextStep = order[order.indexOf(stepId) + 1];
4535
4631
  if (nextStep) setStep(nextStep);
4536
4632
  }
@@ -4542,10 +4638,15 @@ function OrganizationOnboarding({
4542
4638
  setSaving(false);
4543
4639
  }
4544
4640
  };
4545
- const savePractice = () => run(() => client.saveBillingProfile({
4546
- practiceIdentity: identity,
4547
- ...provider.name.trim() || provider.taxId.trim() || provider.npi.trim() ? { billingProviders: [provider] } : {}
4548
- }), "practice");
4641
+ const savePractice = () => run(() => {
4642
+ if ([identity.taxId, provider.taxId].some((value) => /^\d{3}-\d{2}-\d{4}$/.test(value.trim()))) {
4643
+ throw new Error("Saved organization profiles support EINs only. Do not enter an SSN.");
4644
+ }
4645
+ return client.saveBillingProfile({
4646
+ practiceIdentity: identity,
4647
+ ...provider.name.trim() || provider.taxId.trim() || provider.npi.trim() ? { billingProviders: [provider] } : {}
4648
+ });
4649
+ }, "practice");
4549
4650
  const saveLocations = () => run(() => client.saveLocations(locations.filter((item) => item.name.trim() || item.street.trim())), "locations");
4550
4651
  const saveW9 = () => run(async () => {
4551
4652
  if (!w9File) throw new Error("Choose the practice W-9 PDF first.");
@@ -4560,6 +4661,7 @@ function OrganizationOnboarding({
4560
4661
  return { ...item, ...patch };
4561
4662
  }));
4562
4663
  const practiceSection = /* @__PURE__ */ jsxs11("div", { children: [
4664
+ /* @__PURE__ */ jsx11("p", { className: "mbob-status", children: "Save business EINs only. Do not enter an SSN; saved personal tax IDs are not supported by this settings flow." }),
4563
4665
  /* @__PURE__ */ jsxs11("div", { className: "mbob-grid", children: [
4564
4666
  field("Practice name", identity.name, (name) => setIdentity((c) => ({ ...c, name }))),
4565
4667
  field("Legal name", identity.legalName, (legalName) => setIdentity((c) => ({ ...c, legalName }))),
@@ -4569,9 +4671,16 @@ function OrganizationOnboarding({
4569
4671
  field("Email", identity.email, (email) => setIdentity((c) => ({ ...c, email })))
4570
4672
  ] }),
4571
4673
  /* @__PURE__ */ jsx11("h3", { className: "mbob-subhead", children: "Billing provider (pay-to)" }),
4674
+ /* @__PURE__ */ jsxs11("label", { className: "mbob-field", children: [
4675
+ "Saved billing provider",
4676
+ /* @__PURE__ */ jsxs11("select", { disabled: saving, value: provider.id ?? "", onChange: (event) => setProvider({ ...profile?.billingProviders.find((item) => item.id === event.target.value) ?? { name: "", taxId: "", npi: "" } }), children: [
4677
+ /* @__PURE__ */ jsx11("option", { value: "", children: "Add a billing provider" }),
4678
+ profile?.billingProviders.map((item) => /* @__PURE__ */ jsx11("option", { value: item.id, children: item.name }, item.id))
4679
+ ] })
4680
+ ] }),
4572
4681
  /* @__PURE__ */ jsxs11("div", { className: "mbob-grid", children: [
4573
4682
  field("Billing provider name", provider.name, (name) => setProvider((c) => ({ ...c, name }))),
4574
- field("Billing tax ID", provider.taxId, (taxId) => setProvider((c) => ({ ...c, taxId }))),
4683
+ field("Billing tax ID (EIN only)", provider.taxId, (taxId) => setProvider((c) => ({ ...c, taxId }))),
4575
4684
  field("Billing NPI", provider.npi, (npi) => setProvider((c) => ({ ...c, npi }))),
4576
4685
  field("Billing phone", provider.phone ?? "", (phone) => setProvider((c) => ({ ...c, phone }))),
4577
4686
  field("Street", provider.billingStreet ?? "", (billingStreet) => setProvider((c) => ({ ...c, billingStreet })), true),
@@ -4584,18 +4693,47 @@ function OrganizationOnboarding({
4584
4693
  /* @__PURE__ */ jsx11("button", { className: "mbob-save", type: "button", disabled: saving, onClick: savePractice, children: saving ? "Saving\u2026" : "Save practice" })
4585
4694
  ] })
4586
4695
  ] });
4696
+ const renderingSection = /* @__PURE__ */ jsxs11("div", { children: [
4697
+ /* @__PURE__ */ jsxs11("label", { className: "mbob-field", children: [
4698
+ "Saved rendering provider",
4699
+ /* @__PURE__ */ jsxs11("select", { disabled: saving, value: rendering.id ?? "", onChange: (event) => setRendering({ ...profile?.renderingProviders?.find((item) => item.id === event.target.value) ?? blankRendering() }), children: [
4700
+ /* @__PURE__ */ jsx11("option", { value: "", children: "Add a rendering provider" }),
4701
+ profile?.renderingProviders?.map((item) => /* @__PURE__ */ jsxs11("option", { value: item.id, children: [
4702
+ item.name,
4703
+ item.active === false ? " (inactive)" : ""
4704
+ ] }, item.id))
4705
+ ] })
4706
+ ] }),
4707
+ /* @__PURE__ */ jsxs11("div", { className: "mbob-grid", style: { marginTop: 16 }, children: [
4708
+ field("Rendering provider name", rendering.name, (name) => setRendering((c) => ({ ...c, name }))),
4709
+ field("Rendering NPI", rendering.npi, (npi) => setRendering((c) => ({ ...c, npi }))),
4710
+ field("Taxonomy", rendering.taxonomy ?? "", (taxonomy) => setRendering((c) => ({ ...c, taxonomy }))),
4711
+ field("Specialty", rendering.specialty ?? "", (specialty) => setRendering((c) => ({ ...c, specialty }))),
4712
+ field("License number", rendering.licenseNumber ?? "", (licenseNumber) => setRendering((c) => ({ ...c, licenseNumber }))),
4713
+ field("License state", rendering.licenseState ?? "", (licenseState) => setRendering((c) => ({ ...c, licenseState: licenseState.toUpperCase().slice(0, 2) }))),
4714
+ /* @__PURE__ */ jsxs11("label", { children: [
4715
+ /* @__PURE__ */ jsx11("input", { disabled: saving, type: "checkbox", checked: rendering.active !== false, onChange: (event) => setRendering((c) => ({ ...c, active: event.target.checked })) }),
4716
+ " Available for new bills"
4717
+ ] })
4718
+ ] }),
4719
+ /* @__PURE__ */ jsxs11("div", { className: "mbob-actions", children: [
4720
+ /* @__PURE__ */ jsx11("span", { className: "mbob-status", children: savedStep["rendering"] ? "Saved to MindBill." : "Saved profiles do not change previously submitted bills." }),
4721
+ /* @__PURE__ */ jsx11("button", { className: "mbob-save", type: "button", disabled: saving || !rendering.name.trim(), onClick: () => run(() => client.saveBillingProfile({ renderingProviders: [rendering] }), "rendering"), children: saving ? "Saving\u2026" : "Save rendering provider" })
4722
+ ] })
4723
+ ] });
4587
4724
  const locationsSection = /* @__PURE__ */ jsxs11("div", { children: [
4588
4725
  locations.map((location, index) => /* @__PURE__ */ jsxs11("div", { className: "mbob-loc", children: [
4589
- field("Name", location.name, (name) => setLocation(index, { name })),
4726
+ field("Name", location.name ?? "", (name) => setLocation(index, { name })),
4590
4727
  field("Street", location.street, (street) => setLocation(index, { street })),
4591
4728
  field("City", location.city, (city) => setLocation(index, { city })),
4592
4729
  field("State", location.state, (state) => setLocation(index, { state: state.toUpperCase().slice(0, 2) })),
4593
4730
  field("ZIP", location.zip, (zip) => setLocation(index, { zip })),
4731
+ field("Place of service code", location.posCode ?? "", (posCode) => setLocation(index, { posCode }), false, "11"),
4594
4732
  /* @__PURE__ */ jsxs11("label", { className: "mbob-primary", children: [
4595
- /* @__PURE__ */ jsx11("input", { type: "radio", name: "mbob-primary", checked: location.isPrimary === true, onChange: () => setLocation(index, { isPrimary: true }) }),
4733
+ /* @__PURE__ */ jsx11("input", { disabled: saving || location.active === false, type: "radio", name: primaryGroup, checked: location.isPrimary === true, onChange: () => setLocation(index, { isPrimary: true }) }),
4596
4734
  " Primary"
4597
4735
  ] }),
4598
- /* @__PURE__ */ jsx11("button", { className: "mbob-remove", type: "button", "aria-label": "Remove location", onClick: () => setLocations((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "\xD7" })
4736
+ location.id ? /* @__PURE__ */ jsx11("button", { className: "mbob-secondary", disabled: saving, type: "button", onClick: () => setLocation(index, { active: location.active === false, ...location.active !== false ? { isPrimary: false } : {} }), children: location.active === false ? "Restore" : "Archive" }) : /* @__PURE__ */ jsx11("button", { className: "mbob-remove", disabled: saving, type: "button", "aria-label": "Remove location", onClick: () => setLocations((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "\xD7" })
4599
4737
  ] }, location.id ?? index)),
4600
4738
  /* @__PURE__ */ jsx11("button", { className: "mbob-add", type: "button", onClick: () => setLocations((current) => [...current, blankLocation()]), children: "+ Add location" }),
4601
4739
  /* @__PURE__ */ jsxs11("div", { className: "mbob-actions", children: [
@@ -4631,7 +4769,7 @@ function OrganizationOnboarding({
4631
4769
  ] }, item.id)),
4632
4770
  profile?.onboarding.complete ? /* @__PURE__ */ jsx11("p", { className: "mbob-done", children: "Billing setup is complete \u2014 bills submitted from your product carry this profile automatically." }) : /* @__PURE__ */ jsx11("p", { className: "mbob-status", children: "Items above complete themselves as each section is saved." })
4633
4771
  ] });
4634
- const sections = { practice: practiceSection, locations: locationsSection, w9: w9Section, review: reviewSection };
4772
+ const sections = { practice: practiceSection, rendering: renderingSection, locations: locationsSection, w9: w9Section, review: reviewSection };
4635
4773
  return /* @__PURE__ */ jsxs11("div", { className: `mbob ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
4636
4774
  /* @__PURE__ */ jsx11("style", { children: css9 }),
4637
4775
  /* @__PURE__ */ jsxs11("div", { className: "mbob-card", children: [
@@ -4648,6 +4786,8 @@ function OrganizationOnboarding({
4648
4786
  sections[step]
4649
4787
  ] }) : /* @__PURE__ */ jsxs11(Fragment9, { children: [
4650
4788
  practiceSection,
4789
+ /* @__PURE__ */ jsx11("h3", { className: "mbob-subhead", children: "Rendering providers" }),
4790
+ renderingSection,
4651
4791
  /* @__PURE__ */ jsx11("h3", { className: "mbob-subhead", children: "Locations" }),
4652
4792
  locationsSection,
4653
4793
  /* @__PURE__ */ jsx11("h3", { className: "mbob-subhead", children: "Practice W-9" }),
@@ -5568,16 +5708,16 @@ var SECOND_REVIEW_REASON_TEMPLATES = [
5568
5708
  }
5569
5709
  ];
5570
5710
  var css10 = `
5571
- .mbsr{display:grid;gap:18px;color:var(--mb-text);font-family:var(--mb-font)}
5572
- .mbsr *{box-sizing:border-box}.mbsr h3{margin:0;font-size:22px}.mbsr p{margin:4px 0 0;color:var(--mb-muted)}
5573
- .mbsr-deadline{padding:12px 14px;border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-warning) 10%,var(--mb-surface));color:var(--mb-text)!important}
5574
- .mbsr-template,.mbsr-field{display:grid;gap:6px}.mbsr-label{font-size:13px;font-weight:720}.mbsr-select,.mbsr-textarea{width:100%;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}.mbsr-textarea{min-height:86px;resize:vertical}.mbsr-select:focus,.mbsr-textarea:focus{outline:3px solid color-mix(in srgb,var(--mb-accent) 20%,transparent);border-color:var(--mb-accent)}
5575
- .mbsr-lines{display:grid;gap:10px}.mbsr-line{display:grid;gap:12px;padding:14px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-surface)}.mbsr-line[data-selected=true]{border-color:color-mix(in srgb,var(--mb-accent) 65%,var(--mb-border));background:color-mix(in srgb,var(--mb-accent) 4%,var(--mb-surface))}.mbsr-line-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.mbsr-check{display:flex;align-items:center;gap:9px;font-weight:750}.mbsr-check input{width:18px;height:18px;accent-color:var(--mb-accent)}.mbsr-metrics{display:flex;gap:14px;color:var(--mb-muted);font-size:12px}.mbsr-auth{display:flex;align-items:center;flex-wrap:wrap;gap:8px;font-size:13px}.mbsr-auth strong{margin-right:4px}.mbsr-auth label{display:flex;align-items:center;gap:5px}.mbsr-auth input{accent-color:var(--mb-accent)}
5576
- .mbsr-packet{display:grid;gap:10px;padding:0;border:0}.mbsr-packet legend{margin-bottom:8px;font-weight:750}.mbsr-document{display:flex;align-items:center;gap:10px;padding:10px 0;border-top:1px solid var(--mb-border)}.mbsr-document input{width:18px;height:18px;accent-color:var(--mb-accent)}.mbsr-document span{display:grid;min-width:0;flex:1}.mbsr-document small{color:var(--mb-muted)}.mbsr-link{border:0;background:transparent;color:var(--mb-accent);font:inherit;font-weight:700;cursor:pointer}
5577
- .mbsr-upload{display:grid;place-items:center;min-height:82px;padding:16px;border:1px dashed color-mix(in srgb,var(--mb-accent) 55%,var(--mb-border));border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-accent) 3%,var(--mb-surface));cursor:pointer}.mbsr-upload input{position:absolute;width:1px;height:1px;opacity:0}.mbsr-upload strong{color:var(--mb-accent)}
5578
- .mbsr-uploaded{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 11px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius)}
5579
- .mbsr-error{padding:10px 12px;border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-danger) 10%,transparent);color:var(--mb-danger);font-size:13px}.mbsr-actions{display:flex;justify-content:flex-end;gap:10px}.mbsr-button{min-height:42px;padding:9px 16px;border-radius:var(--mb-control-radius);font:inherit;font-weight:740;cursor:pointer}.mbsr-button.secondary{border:1px solid var(--mb-border);background:var(--mb-surface);color:var(--mb-text)}.mbsr-button.primary{border:0;background:var(--mb-accent);color:var(--mb-accent-contrast)}.mbsr-button:disabled{opacity:.55;cursor:not-allowed}
5580
- @media(max-width:680px){.mbsr-line-head{align-items:flex-start;flex-direction:column}.mbsr-metrics{flex-wrap:wrap}}
5711
+ .mb-second-review{display:grid;gap:18px;padding:22px;color:var(--mb-text);font-family:var(--mb-font);background:var(--mb-surface);border:1px solid var(--mb-border);border-radius:var(--mb-radius);box-shadow:var(--mb-shadow)}
5712
+ .mb-second-review *{box-sizing:border-box}.mb-second-review h3{margin:0;font-size:22px}.mb-second-review p{margin:4px 0 0;color:var(--mb-muted)}
5713
+ .mb-second-review-deadline{padding:12px 14px;border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-warning) 10%,var(--mb-surface));color:var(--mb-text)!important}
5714
+ .mb-second-review-template,.mb-second-review-field{display:grid;gap:6px}.mb-second-review-label{font-size:13px;font-weight:720}.mb-second-review-select,.mb-second-review-textarea{width:100%;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}.mb-second-review-textarea{min-height:86px;resize:vertical}.mb-second-review-select:focus,.mb-second-review-textarea:focus{outline:3px solid color-mix(in srgb,var(--mb-accent) 20%,transparent);border-color:var(--mb-accent)}
5715
+ .mb-second-review-lines{display:grid;gap:10px}.mb-second-review-line{display:grid;gap:12px;padding:14px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-surface)}.mb-second-review-line[data-selected=true]{border-color:color-mix(in srgb,var(--mb-accent) 65%,var(--mb-border));background:color-mix(in srgb,var(--mb-accent) 4%,var(--mb-surface))}.mb-second-review-line-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.mb-second-review-check{display:flex;align-items:center;gap:9px;font-weight:750}.mb-second-review-check input{width:18px;height:18px;accent-color:var(--mb-accent)}.mb-second-review-metrics{display:flex;gap:14px;color:var(--mb-muted);font-size:12px}.mb-second-review-auth{display:flex;align-items:center;flex-wrap:wrap;gap:8px;font-size:13px}.mb-second-review-auth strong{margin-right:4px}.mb-second-review-auth label{display:flex;align-items:center;gap:5px}.mb-second-review-auth input{accent-color:var(--mb-accent)}
5716
+ .mb-second-review-packet{display:grid;gap:10px;padding:0;border:0}.mb-second-review-packet legend{margin-bottom:8px;font-weight:750}.mb-second-review-document{display:flex;align-items:center;gap:10px;padding:10px 0;border-top:1px solid var(--mb-border)}.mb-second-review-document input{width:18px;height:18px;accent-color:var(--mb-accent)}.mb-second-review-document span{display:grid;min-width:0;flex:1}.mb-second-review-document small{color:var(--mb-muted)}.mb-second-review-link{border:0;background:transparent;color:var(--mb-accent);font:inherit;font-weight:700;cursor:pointer}
5717
+ .mb-second-review-upload{display:grid;place-items:center;min-height:82px;padding:16px;border:1px dashed color-mix(in srgb,var(--mb-accent) 55%,var(--mb-border));border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-accent) 3%,var(--mb-surface));cursor:pointer}.mb-second-review-upload input{position:absolute;width:1px;height:1px;opacity:0}.mb-second-review-upload strong{color:var(--mb-accent)}
5718
+ .mb-second-review-uploaded{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 11px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius)}
5719
+ .mb-second-review-error{padding:10px 12px;border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-danger) 10%,transparent);color:var(--mb-danger);font-size:13px}.mb-second-review-actions{display:flex;justify-content:flex-end;gap:10px}.mb-second-review-button{min-height:42px;padding:9px 16px;border-radius:var(--mb-control-radius);font:inherit;font-weight:740;cursor:pointer}.mb-second-review-button.secondary{border:1px solid var(--mb-border);background:var(--mb-surface);color:var(--mb-text)}.mb-second-review-button.primary{border:0;background:var(--mb-accent);color:var(--mb-accent-contrast)}.mb-second-review-button:disabled{opacity:.55;cursor:not-allowed}
5720
+ @media(max-width:680px){.mb-second-review{padding:16px}.mb-second-review-line-head{align-items:flex-start;flex-direction:column}.mb-second-review-metrics{flex-wrap:wrap}}
5581
5721
  `;
5582
5722
  function money5(value) {
5583
5723
  return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(value);
@@ -5691,14 +5831,14 @@ function SecondReviewForm({
5691
5831
  };
5692
5832
  return /* @__PURE__ */ jsxs14(Fragment12, { children: [
5693
5833
  /* @__PURE__ */ jsx14("style", { children: css10 }),
5694
- /* @__PURE__ */ jsxs14("section", { className: "mbsr", children: [
5834
+ /* @__PURE__ */ jsxs14("section", { className: "mb-second-review", children: [
5695
5835
  /* @__PURE__ */ jsxs14("div", { children: [
5696
5836
  /* @__PURE__ */ jsx14("h3", { children: "Submit Second Review" }),
5697
5837
  /* @__PURE__ */ jsx14("p", { children: "Select each disputed service and explain why it should be reconsidered." })
5698
5838
  ] }),
5699
- /* @__PURE__ */ jsxs14("label", { className: "mbsr-template", children: [
5700
- /* @__PURE__ */ jsx14("span", { className: "mbsr-label", children: "Apply a saved reason to selected lines" }),
5701
- /* @__PURE__ */ jsxs14("select", { className: "mbsr-select", defaultValue: "", onChange: (event) => {
5839
+ /* @__PURE__ */ jsxs14("label", { className: "mb-second-review-template", children: [
5840
+ /* @__PURE__ */ jsx14("span", { className: "mb-second-review-label", children: "Apply a saved reason to selected lines" }),
5841
+ /* @__PURE__ */ jsxs14("select", { className: "mb-second-review-select", defaultValue: "", onChange: (event) => {
5702
5842
  applyTemplate(event.target.value);
5703
5843
  event.target.value = "";
5704
5844
  }, children: [
@@ -5706,19 +5846,19 @@ function SecondReviewForm({
5706
5846
  SECOND_REVIEW_REASON_TEMPLATES.map((template) => /* @__PURE__ */ jsx14("option", { value: template.value, children: template.label }, template.label))
5707
5847
  ] })
5708
5848
  ] }),
5709
- /* @__PURE__ */ jsxs14("section", { className: "mbsr-lines", "aria-label": "Service lines in dispute", children: [
5849
+ /* @__PURE__ */ jsxs14("section", { className: "mb-second-review-lines", "aria-label": "Service lines in dispute", children: [
5710
5850
  selectableLines.map((line) => {
5711
5851
  const draft = lines[line.id];
5712
- return /* @__PURE__ */ jsxs14("article", { className: "mbsr-line", "data-selected": draft?.selected, children: [
5713
- /* @__PURE__ */ jsxs14("div", { className: "mbsr-line-head", children: [
5714
- /* @__PURE__ */ jsxs14("label", { className: "mbsr-check", children: [
5852
+ return /* @__PURE__ */ jsxs14("article", { className: "mb-second-review-line", "data-selected": draft?.selected, children: [
5853
+ /* @__PURE__ */ jsxs14("div", { className: "mb-second-review-line-head", children: [
5854
+ /* @__PURE__ */ jsxs14("label", { className: "mb-second-review-check", children: [
5715
5855
  /* @__PURE__ */ jsx14("input", { type: "checkbox", checked: Boolean(draft?.selected), onChange: (event) => patchLine(line.id, { selected: event.target.checked }) }),
5716
5856
  /* @__PURE__ */ jsxs14("span", { children: [
5717
5857
  line.code,
5718
5858
  line.modifiers.length ? `-${line.modifiers.join("-")}` : ""
5719
5859
  ] })
5720
5860
  ] }),
5721
- /* @__PURE__ */ jsxs14("span", { className: "mbsr-metrics", children: [
5861
+ /* @__PURE__ */ jsxs14("span", { className: "mb-second-review-metrics", children: [
5722
5862
  /* @__PURE__ */ jsxs14("span", { children: [
5723
5863
  line.units,
5724
5864
  " unit",
@@ -5728,11 +5868,11 @@ function SecondReviewForm({
5728
5868
  ] })
5729
5869
  ] }),
5730
5870
  draft?.selected ? /* @__PURE__ */ jsxs14(Fragment12, { children: [
5731
- /* @__PURE__ */ jsxs14("label", { className: "mbsr-field", children: [
5732
- /* @__PURE__ */ jsx14("span", { className: "mbsr-label", children: "Reason for requesting Second Review" }),
5733
- /* @__PURE__ */ jsx14("textarea", { className: "mbsr-textarea", required: true, value: draft.reason, onChange: (event) => patchLine(line.id, { reason: event.target.value }) })
5871
+ /* @__PURE__ */ jsxs14("label", { className: "mb-second-review-field", children: [
5872
+ /* @__PURE__ */ jsx14("span", { className: "mb-second-review-label", children: "Reason for requesting Second Review" }),
5873
+ /* @__PURE__ */ jsx14("textarea", { className: "mb-second-review-textarea", required: true, value: draft.reason, onChange: (event) => patchLine(line.id, { reason: event.target.value }) })
5734
5874
  ] }),
5735
- /* @__PURE__ */ jsxs14("div", { className: "mbsr-auth", role: "radiogroup", "aria-label": `Service or good ${line.code} authorized`, children: [
5875
+ /* @__PURE__ */ jsxs14("div", { className: "mb-second-review-auth", role: "radiogroup", "aria-label": `Service or good ${line.code} authorized`, children: [
5736
5876
  /* @__PURE__ */ jsx14("strong", { children: "Service/Good Authorized?" }),
5737
5877
  [["yes", "Yes"], ["no", "No"], ["", "Not specified"]].map(([value, label]) => /* @__PURE__ */ jsxs14("label", { children: [
5738
5878
  /* @__PURE__ */ jsx14("input", { type: "radio", name: `authorized-${line.id}`, checked: draft.serviceAuthorized === value, onChange: () => patchLine(line.id, { serviceAuthorized: value }) }),
@@ -5742,34 +5882,34 @@ function SecondReviewForm({
5742
5882
  ] }) : null
5743
5883
  ] }, line.id);
5744
5884
  }),
5745
- !selectableLines.length ? /* @__PURE__ */ jsx14("div", { className: "mbsr-error", children: "This bill has no stable service-line identifiers. Refresh the bill before submitting a Second Review." }) : null
5885
+ !selectableLines.length ? /* @__PURE__ */ jsx14("div", { className: "mb-second-review-error", children: "This bill has no stable service-line identifiers. Refresh the bill before submitting a Second Review." }) : null
5746
5886
  ] }),
5747
- /* @__PURE__ */ jsxs14("fieldset", { className: "mbsr-packet", children: [
5887
+ /* @__PURE__ */ jsxs14("fieldset", { className: "mb-second-review-packet", children: [
5748
5888
  /* @__PURE__ */ jsx14("legend", { children: "Supporting packet" }),
5749
- data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs14("label", { className: "mbsr-document", children: [
5889
+ data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs14("label", { className: "mb-second-review-document", children: [
5750
5890
  /* @__PURE__ */ jsx14("input", { type: "checkbox", checked: attachmentIds.includes(attachment.id), onChange: (event) => setAttachmentIds((current) => event.target.checked ? [...current, attachment.id] : current.filter((id) => id !== attachment.id)) }),
5751
5891
  /* @__PURE__ */ jsxs14("span", { children: [
5752
5892
  /* @__PURE__ */ jsx14("strong", { children: attachment.filename }),
5753
5893
  /* @__PURE__ */ jsx14("small", { children: attachment.description || attachment.documentType })
5754
5894
  ] }),
5755
- /* @__PURE__ */ jsx14("button", { className: "mbsr-link", type: "button", onClick: () => void openAttachment(attachment).catch(() => void 0), children: "View" })
5895
+ /* @__PURE__ */ jsx14("button", { className: "mb-second-review-link", type: "button", onClick: () => void openAttachment(attachment).catch(() => void 0), children: "View" })
5756
5896
  ] }, attachment.id)),
5757
- /* @__PURE__ */ jsxs14("label", { className: "mbsr-upload", children: [
5897
+ /* @__PURE__ */ jsxs14("label", { className: "mb-second-review-upload", children: [
5758
5898
  /* @__PURE__ */ jsx14("input", { type: "file", accept: "application/pdf,.pdf", multiple: true, onChange: addUploads }),
5759
5899
  /* @__PURE__ */ jsxs14("span", { children: [
5760
5900
  /* @__PURE__ */ jsx14("strong", { children: "Choose one or more PDF files" }),
5761
5901
  " to attach"
5762
5902
  ] })
5763
5903
  ] }),
5764
- uploads.map((upload, index) => /* @__PURE__ */ jsxs14("div", { className: "mbsr-uploaded", children: [
5904
+ uploads.map((upload, index) => /* @__PURE__ */ jsxs14("div", { className: "mb-second-review-uploaded", children: [
5765
5905
  /* @__PURE__ */ jsx14("span", { children: upload.file.name }),
5766
- /* @__PURE__ */ jsx14("button", { className: "mbsr-link", type: "button", onClick: () => setUploads((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "Remove" })
5906
+ /* @__PURE__ */ jsx14("button", { className: "mb-second-review-link", type: "button", onClick: () => setUploads((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "Remove" })
5767
5907
  ] }, `${upload.file.name}-${index}`))
5768
5908
  ] }),
5769
- formError || error?.message ? /* @__PURE__ */ jsx14("div", { className: "mbsr-error", role: "alert", children: formError || error?.message }) : null,
5770
- /* @__PURE__ */ jsxs14("div", { className: "mbsr-actions", children: [
5771
- /* @__PURE__ */ jsx14("button", { className: "mbsr-button secondary", type: "button", disabled: submitting || preparing, onClick: onCancel, children: "Cancel" }),
5772
- /* @__PURE__ */ jsx14("button", { className: "mbsr-button primary", type: "button", disabled: submitting || preparing || !selected.length || invalidReason, onClick: () => void continueToDelivery(), children: preparing ? "Preparing\u2026" : "Continue to delivery" })
5909
+ formError || error?.message ? /* @__PURE__ */ jsx14("div", { className: "mb-second-review-error", role: "alert", children: formError || error?.message }) : null,
5910
+ /* @__PURE__ */ jsxs14("div", { className: "mb-second-review-actions", children: [
5911
+ /* @__PURE__ */ jsx14("button", { className: "mb-second-review-button secondary", type: "button", disabled: submitting || preparing, onClick: onCancel, children: "Cancel" }),
5912
+ /* @__PURE__ */ jsx14("button", { className: "mb-second-review-button primary", type: "button", disabled: submitting || preparing || !selected.length || invalidReason, onClick: () => void continueToDelivery(), children: preparing ? "Preparing\u2026" : "Continue to delivery" })
5773
5913
  ] })
5774
5914
  ] }),
5775
5915
  delivery ? /* @__PURE__ */ jsx14(SendRouteDialog, { title: "Confirm Second Review delivery", delivery, submitting: submitting || preparing, error: formError || error?.message || null, onCancel: () => setDelivery(null), onConfirm: (route) => void submit(route) }) : null
@@ -5925,6 +6065,7 @@ function useBillLifecycle({
5925
6065
  openAttachment,
5926
6066
  openEor,
5927
6067
  downloadPacket,
6068
+ addNote: (input) => mutate(() => client.addNote(input)),
5928
6069
  closeBill: (input) => mutate(() => client.closeBill(input)),
5929
6070
  reopenBill: (input) => mutate(() => client.reopenBill(input)),
5930
6071
  postPayment: (input) => mutate(() => client.postPayment(input)),
@@ -6175,6 +6316,7 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6175
6316
  const [selectedSubmissionId, setSelectedSubmissionId] = useState12();
6176
6317
  const [panel, setPanel] = useState12("");
6177
6318
  const [notice, setNotice] = useState12("");
6319
+ const [note, setNote] = useState12("");
6178
6320
  const [reason, setReason] = useState12("");
6179
6321
  const [correctionError, setCorrectionError] = useState12("");
6180
6322
  const [newBillError, setNewBillError] = useState12("");
@@ -6228,6 +6370,17 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6228
6370
  } catch {
6229
6371
  }
6230
6372
  };
6373
+ const addNote = async () => {
6374
+ const value = note.trim();
6375
+ if (!value) return;
6376
+ setNotice("");
6377
+ try {
6378
+ await lifecycle.addNote({ note: value, ...actor });
6379
+ setNote("");
6380
+ setNotice("Note added.");
6381
+ } catch {
6382
+ }
6383
+ };
6231
6384
  const submitCorrection = async (value) => {
6232
6385
  setNotice("");
6233
6386
  setCorrectionError("");
@@ -6318,7 +6471,8 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6318
6471
  const mappedRibbonItems = data.history ? billSubmissionsRibbonFromHistory(data.history, data.attempts) : [];
6319
6472
  const activeSubmissionId = selectedSubmissionId ?? mappedRibbonItems.find((item) => item.active)?.id ?? mappedRibbonItems[mappedRibbonItems.length - 1]?.id;
6320
6473
  const ribbonItems = mappedRibbonItems.map((item) => ({ ...item, active: item.id === activeSubmissionId }));
6321
- const selectedHistoryEntryId = ribbonItems.find((item) => item.id === activeSubmissionId)?.historyEntryId;
6474
+ const selectedAttempt = data.attempts?.find((attempt) => attempt.id === activeSubmissionId);
6475
+ const billNotes = (data.history ?? []).filter((entry) => entry.kind === "note").slice().reverse();
6322
6476
  const statusContacts = reportBillStatusContacts(data.delivery);
6323
6477
  const receiptEntries = (data.history ?? []).filter((entry) => entry.kind === "submission" || entry.kind === "ack");
6324
6478
  const reviewDeadline = secondReviewDeadline(data.eors);
@@ -6326,7 +6480,7 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6326
6480
  /* @__PURE__ */ jsx15("style", { children: CONNECTED_LIFECYCLE_STYLES }),
6327
6481
  ribbonItems.length >= 2 ? /* @__PURE__ */ jsx15(BillSubmissionsRibbon, { items: ribbonItems, onSelect: (item) => {
6328
6482
  setSelectedSubmissionId(item.id);
6329
- setTab("history");
6483
+ setTab("details");
6330
6484
  }, ...appearance ? { appearance } : {} }) : null,
6331
6485
  data.lifecycle.state.toLowerCase() === "rejected" && data.rejection ? /* @__PURE__ */ jsx15(BillRejectionNotice, { rejection: data.rejection, submittedAt: data.lifecycle.submittedAt ?? null, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx15(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
6332
6486
  /* @__PURE__ */ jsxs15("header", { className: "mb-lifecycle-head", children: [
@@ -6348,6 +6502,40 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6348
6502
  /* @__PURE__ */ jsx15("button", { type: "button", role: "tab", "aria-selected": tab === "history", onClick: () => setTab("history"), children: "Bill history" })
6349
6503
  ] }),
6350
6504
  tab === "details" ? /* @__PURE__ */ jsxs15("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
6505
+ selectedAttempt && ribbonItems.length >= 2 ? /* @__PURE__ */ jsxs15("section", { className: "mb-lifecycle-attempt-detail", "aria-label": "Selected submission detail", children: [
6506
+ /* @__PURE__ */ jsxs15("header", { children: [
6507
+ /* @__PURE__ */ jsxs15("div", { children: [
6508
+ /* @__PURE__ */ jsx15("span", { children: "Selected submission" }),
6509
+ /* @__PURE__ */ jsx15("h3", { children: selectedAttempt.label })
6510
+ ] }),
6511
+ /* @__PURE__ */ jsx15("strong", { children: selectedAttempt.isCurrent ? "Current" : "Previous" })
6512
+ ] }),
6513
+ /* @__PURE__ */ jsxs15("dl", { children: [
6514
+ /* @__PURE__ */ jsxs15("div", { children: [
6515
+ /* @__PURE__ */ jsx15("dt", { children: "Bill" }),
6516
+ /* @__PURE__ */ jsxs15("dd", { children: [
6517
+ "#",
6518
+ selectedAttempt.billNumber || data.bill.billNumber
6519
+ ] })
6520
+ ] }),
6521
+ /* @__PURE__ */ jsxs15("div", { children: [
6522
+ /* @__PURE__ */ jsx15("dt", { children: "Delivery" }),
6523
+ /* @__PURE__ */ jsx15("dd", { children: selectedAttempt.deliveryLabel || "\u2014" })
6524
+ ] }),
6525
+ /* @__PURE__ */ jsxs15("div", { children: [
6526
+ /* @__PURE__ */ jsx15("dt", { children: "Sent" }),
6527
+ /* @__PURE__ */ jsx15("dd", { children: selectedAttempt.sentAt ? new Date(selectedAttempt.sentAt).toLocaleString() : "\u2014" })
6528
+ ] }),
6529
+ /* @__PURE__ */ jsxs15("div", { children: [
6530
+ /* @__PURE__ */ jsx15("dt", { children: "Status" }),
6531
+ /* @__PURE__ */ jsx15("dd", { children: selectedAttempt.ackLabel || selectedAttempt.status || "Submitted" })
6532
+ ] }),
6533
+ selectedAttempt.complianceLabel ? /* @__PURE__ */ jsxs15("div", { children: [
6534
+ /* @__PURE__ */ jsx15("dt", { children: selectedAttempt.complianceLabel }),
6535
+ /* @__PURE__ */ jsx15("dd", { children: selectedAttempt.complianceAt ? new Date(selectedAttempt.complianceAt).toLocaleDateString() : "\u2014" })
6536
+ ] }) : null
6537
+ ] })
6538
+ ] }) : null,
6351
6539
  data.eors.length || data.payments.length || ["processed", "denied", "partially_paid"].includes(data.lifecycle.state) ? /* @__PURE__ */ jsx15(BillExplanationOfReview, { remittance: data.remittance, eors: data.eors, payments: data.payments, submittedAt: data.lifecycle.submittedAt ?? null, onOpenEor: lifecycle.openEor, ...appearance ? { appearance } : {} }) : null,
6352
6540
  showSandboxControls ? /* @__PURE__ */ jsxs15("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
6353
6541
  /* @__PURE__ */ jsxs15("div", { children: [
@@ -6360,8 +6548,35 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6360
6548
  /* @__PURE__ */ jsx15("span", { children: scenario.detail })
6361
6549
  ] }, scenario.id)) }) : /* @__PURE__ */ jsx15("p", { className: "mb-lifecycle-simulator-idle", children: "No simulated payer transition is needed at this stage. Use the bill action below to continue." })
6362
6550
  ] }) : null,
6363
- /* @__PURE__ */ jsx15(BillReadOnlyForm, { data, onOpenAttachment: lifecycle.openAttachment, ...appearance ? { appearance } : {} })
6364
- ] }) : /* @__PURE__ */ jsx15("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: data.history?.length ? /* @__PURE__ */ jsx15(BillHistoryTable, { entries: data.history, ...selectedHistoryEntryId ? { selectedEntryId: selectedHistoryEntryId } : {}, onOpenDocument: lifecycle.openAttachment, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx15(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
6551
+ /* @__PURE__ */ jsx15(BillReadOnlyForm, { data, onOpenAttachment: lifecycle.openAttachment, ...appearance ? { appearance } : {} }),
6552
+ /* @__PURE__ */ jsxs15("section", { className: "mb-lifecycle-notes", "aria-label": "Bill notes", children: [
6553
+ /* @__PURE__ */ jsxs15("header", { children: [
6554
+ /* @__PURE__ */ jsxs15("div", { children: [
6555
+ /* @__PURE__ */ jsx15("h3", { children: "Bill notes" }),
6556
+ /* @__PURE__ */ jsx15("p", { children: "Shared with everyone working this bill through the Partner API." })
6557
+ ] }),
6558
+ /* @__PURE__ */ jsx15("span", { children: billNotes.length })
6559
+ ] }),
6560
+ billNotes.length ? /* @__PURE__ */ jsx15("ol", { children: billNotes.map((entry) => /* @__PURE__ */ jsxs15("li", { children: [
6561
+ /* @__PURE__ */ jsx15("p", { children: entry.summary }),
6562
+ /* @__PURE__ */ jsxs15("small", { children: [
6563
+ entry.actor || "System",
6564
+ " \xB7 ",
6565
+ usDate(entry.date)
6566
+ ] })
6567
+ ] }, entry.id)) }) : /* @__PURE__ */ jsx15("p", { className: "mb-lifecycle-notes-empty", children: "No notes yet." }),
6568
+ /* @__PURE__ */ jsxs15("form", { onSubmit: (event) => {
6569
+ event.preventDefault();
6570
+ void addNote();
6571
+ }, children: [
6572
+ /* @__PURE__ */ jsxs15("label", { children: [
6573
+ /* @__PURE__ */ jsx15("span", { children: "Add a note" }),
6574
+ /* @__PURE__ */ jsx15("textarea", { value: note, maxLength: 2e3, placeholder: "Add context for the billing team\u2026", onChange: (event) => setNote(event.target.value) })
6575
+ ] }),
6576
+ /* @__PURE__ */ jsx15("button", { type: "submit", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !note.trim(), children: lifecycle.isMutating ? "Adding\u2026" : "Add note" })
6577
+ ] })
6578
+ ] })
6579
+ ] }) : /* @__PURE__ */ jsx15("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: data.history?.length ? /* @__PURE__ */ jsx15(BillHistoryTable, { entries: data.history, onOpenDocument: lifecycle.openAttachment, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx15(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
6365
6580
  viewEor || actions.length ? /* @__PURE__ */ jsxs15("aside", { className: "mb-lifecycle-actions-sheet", "aria-label": "Bill actions", children: [
6366
6581
  viewEor && data.eors[0] ? /* @__PURE__ */ jsx15("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(data.eors[0]).catch(() => void 0), children: viewEor.label }) : null,
6367
6582
  actions.map((action) => /* @__PURE__ */ jsx15("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
@@ -6591,19 +6806,23 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6591
6806
  ] });
6592
6807
  }
6593
6808
  var CONNECTED_LIFECYCLE_STYLES = `
6809
+ .mb-lifecycle-attempt-detail{display:grid;gap:15px;padding:18px;border:1px solid color-mix(in srgb,var(--mb-accent) 38%,var(--mb-border));border-radius:var(--mb-radius,14px);background:color-mix(in srgb,var(--mb-accent) 5%,var(--mb-surface))}.mb-lifecycle-attempt-detail>header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.mb-lifecycle-attempt-detail>header span{color:var(--mb-accent);font-size:.72rem;font-weight:850;letter-spacing:.08em;text-transform:uppercase}.mb-lifecycle-attempt-detail h3{margin:3px 0 0;font-size:1.08rem}.mb-lifecycle-attempt-detail>header>strong{padding:4px 9px;border:1px solid color-mix(in srgb,var(--mb-accent) 35%,var(--mb-border));border-radius:999px;background:var(--mb-surface);color:var(--mb-accent);font-size:.75rem}.mb-lifecycle-attempt-detail dl{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:0}.mb-lifecycle-attempt-detail dl>div{display:grid;gap:2px;min-width:0}.mb-lifecycle-attempt-detail dt{color:var(--mb-muted);font-size:.7rem;font-weight:800;letter-spacing:.06em;text-transform:uppercase}.mb-lifecycle-attempt-detail dd{min-width:0;margin:0;font-weight:700;overflow-wrap:anywhere}
6810
+ .mb-lifecycle-notes{display:grid;gap:14px;padding:20px;border:1px solid var(--mb-border);border-radius:var(--mb-radius,14px);background:var(--mb-surface)}.mb-lifecycle-notes>header{display:flex;align-items:center;justify-content:space-between;gap:16px}.mb-lifecycle-notes h3{margin:0;font-size:1.08rem}.mb-lifecycle-notes header p{margin:3px 0 0;color:var(--mb-muted)}.mb-lifecycle-notes>header>span{display:grid;place-items:center;min-width:28px;height:28px;border-radius:999px;background:var(--mb-soft);font-weight:750}.mb-lifecycle-notes ol{display:grid;gap:9px;margin:0;padding:0;list-style:none}.mb-lifecycle-notes li{padding:11px 13px;border-left:3px solid color-mix(in srgb,var(--mb-accent) 52%,var(--mb-border));border-radius:0 8px 8px 0;background:var(--mb-soft)}.mb-lifecycle-notes li p{margin:0;white-space:pre-wrap}.mb-lifecycle-notes li small{display:block;margin-top:4px;color:var(--mb-muted)}.mb-lifecycle-notes-empty{margin:0;color:var(--mb-muted)}.mb-lifecycle-notes form{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:10px}.mb-lifecycle-notes label{display:grid;gap:6px;font-size:.82rem;font-weight:750}.mb-lifecycle-notes textarea{width:100%;min-height:76px;padding:10px 12px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius,8px);background:var(--mb-input,#fff);color:var(--mb-text);font:inherit;resize:vertical}
6594
6811
  .mb-lifecycle-simulator{display:grid;gap:14px;padding:18px;border:1px solid #b8dadd;border-radius:var(--mb-radius,14px);background:#f2fbfb}.mb-lifecycle-simulator>div:first-child>span{color:var(--mb-accent);font-size:.72rem;font-weight:850;letter-spacing:.09em;text-transform:uppercase}.mb-lifecycle-simulator h3{margin:3px 0 0;font-size:1.05rem}.mb-lifecycle-simulator p{margin:4px 0 0;color:var(--mb-muted)}.mb-lifecycle-simulator-actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px}.mb-lifecycle-simulator-actions button{min-height:76px;border:1px solid #a9cccf;border-radius:10px;background:var(--mb-surface);color:var(--mb-text);cursor:pointer;padding:12px 14px;text-align:left;font:inherit}.mb-lifecycle-simulator-actions button:hover{border-color:var(--mb-accent);box-shadow:0 3px 14px rgba(23,108,112,.1)}.mb-lifecycle-simulator-actions button:disabled{cursor:not-allowed;opacity:.55}.mb-lifecycle-simulator-actions button strong,.mb-lifecycle-simulator-actions button span{display:block}.mb-lifecycle-simulator-actions button span{margin-top:3px;color:var(--mb-muted);font-size:.83rem}.mb-lifecycle-simulator-idle{padding:10px 12px;border-radius:8px;background:rgba(255,255,255,.72)}
6595
6812
  .mb-connected-lifecycle{--mb-accent:#176c70;--mb-text:#17282d;--mb-muted:#607176;--mb-border:#d7e0df;--mb-soft:#f4f7f6;--mb-surface:#fff;display:grid;gap:18px;color:var(--mb-text);font:14px/1.45 var(--mb-font,Inter,ui-sans-serif,system-ui,sans-serif)}.mb-connected-lifecycle *{box-sizing:border-box}.mb-lifecycle-head{display:flex;align-items:center;justify-content:space-between;gap:20px}.mb-lifecycle-title{display:flex;align-items:center;flex-wrap:wrap;gap:10px}.mb-lifecycle-title h2{margin:0;font-size:1.7rem}.mb-lifecycle-head p{margin:3px 0 0;color:var(--mb-muted)}.mb-lifecycle-tabs{display:grid;grid-template-columns:1fr 1fr;border:1px solid var(--mb-border);border-radius:12px;background:var(--mb-surface);padding:6px}.mb-lifecycle-tabs button{min-height:46px;border:0;border-radius:8px;background:transparent;color:var(--mb-muted);font:inherit;font-size:1rem;font-weight:750;cursor:pointer}.mb-lifecycle-tabs button[aria-selected=true]{background:var(--mb-accent);color:white}.mb-lifecycle-tabpanel{display:grid;gap:18px}.mb-lifecycle-button{min-height:40px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius,8px);background:var(--mb-input,#fff);color:var(--mb-text);cursor:pointer;font:inherit;font-weight:750;padding:9px 14px}.mb-lifecycle-button.primary{border-color:var(--mb-accent);background:var(--mb-accent);color:var(--mb-accent-contrast,#fff)}.mb-lifecycle-button:disabled{cursor:not-allowed;opacity:.5}.mb-lifecycle-actions-sheet{position:sticky;bottom:12px;z-index:24;display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:9px;padding:10px;border:1px solid var(--mb-border);border-radius:12px;background:color-mix(in srgb,var(--mb-surface) 94%,transparent);box-shadow:0 10px 34px rgba(18,35,43,.16);backdrop-filter:blur(12px)}.mb-lifecycle-card,.mb-lifecycle-panel{padding:20px;border:1px solid var(--mb-border);border-radius:var(--mb-radius,14px);background:var(--mb-surface)}.mb-lifecycle-card header{display:flex;align-items:center;justify-content:space-between;gap:20px}.mb-lifecycle-card h3,.mb-lifecycle-panel h3{margin:0;font-size:1.08rem}.mb-lifecycle-card p,.mb-lifecycle-panel p{margin:3px 0 0;color:var(--mb-muted)}.mb-lifecycle-card header>span{display:grid;place-items:center;min-width:28px;height:28px;border-radius:999px;background:var(--mb-soft);font-weight:750}.mb-lifecycle-documents{list-style:none;margin:14px 0 0;padding:0}.mb-lifecycle-documents li{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:12px 0;border-top:1px solid var(--mb-border)}.mb-lifecycle-documents li>div{display:grid;gap:3px;min-width:0}.mb-lifecycle-documents li span{color:var(--mb-muted);font-size:.85rem}.mb-lifecycle-dialog-backdrop{position:fixed;z-index:2147483000;inset:0;display:grid;place-items:center;padding:20px;background:rgba(18,35,43,.56);backdrop-filter:blur(3px)}.mb-lifecycle-dialog{position:relative;width:min(760px,100%);max-height:calc(100dvh - 40px);overflow:auto;outline:0}.mb-lifecycle-dialog-close{position:absolute;z-index:1;top:12px;right:12px;width:44px;height:44px;border:1px solid var(--mb-border);border-radius:10px;background:var(--mb-surface);color:var(--mb-text);cursor:pointer;font:24px/1 inherit}.mb-lifecycle-panel{display:grid;gap:17px;padding-top:24px;box-shadow:0 24px 70px rgba(18,35,43,.22)}.mb-lifecycle-panel label{display:grid;gap:6px;font-size:.85rem;font-weight:750}.mb-lifecycle-panel label small{color:var(--mb-muted);font-weight:500}.mb-lifecycle-panel input,.mb-lifecycle-panel select,.mb-lifecycle-panel textarea{width:100%;min-height:44px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius,8px);background:var(--mb-input,#fff);color:var(--mb-text);font:inherit;padding:10px 12px}.mb-lifecycle-panel textarea{min-height:100px;resize:vertical}.mb-lifecycle-fields{display:grid;gap:13px}.mb-lifecycle-fields.two{grid-template-columns:repeat(2,minmax(0,1fr))}.mb-lifecycle-fields .full{grid-column:1/-1}.mb-lifecycle-panel-actions{display:flex;justify-content:flex-end;gap:8px}.mb-lifecycle-packet{display:grid;gap:0;margin:0;padding:0;border:0}.mb-lifecycle-packet legend{margin-bottom:7px;font-size:.85rem;font-weight:800}.mb-lifecycle-packet>label{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:10px;padding:10px 2px;border-top:1px solid var(--mb-border)}.mb-lifecycle-packet>label>input{width:16px;min-height:16px}.mb-lifecycle-packet>label>span{display:grid}.mb-lifecycle-packet button{border:0;background:transparent;color:var(--mb-accent);cursor:pointer;font:inherit}.mb-lifecycle-message,.mb-lifecycle-error,.mb-lifecycle-loading{padding:12px 14px;border-radius:9px}.mb-lifecycle-message.success{background:#edf9f2;color:#217449}.mb-lifecycle-message.error,.mb-lifecycle-error{background:#fff0ef;color:#9d3029}.mb-lifecycle-error{display:flex;align-items:center;gap:12px}.mb-lifecycle-error span{flex:1}.mb-lifecycle-error button{border:1px solid currentColor;border-radius:7px;background:transparent;color:inherit;padding:7px 10px}
6596
6813
  .mb-lifecycle-dialog.wide{width:min(1280px,100%)}.mb-lifecycle-correction{display:grid;gap:16px;padding:22px;border-radius:var(--mb-radius,14px);background:var(--mb-surface);box-shadow:0 24px 70px rgba(18,35,43,.22)}.mb-lifecycle-correction>header{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;padding-right:56px}.mb-lifecycle-correction h3{margin:0;font-size:1.2rem}.mb-lifecycle-correction header p{margin:4px 0 0;color:var(--mb-muted)}.mb-lifecycle-live-warning,.mb-lifecycle-correction-reason,.mb-lifecycle-correction-contact{display:grid;gap:4px;padding:13px 15px;border-radius:10px}.mb-lifecycle-live-warning{border-left:4px solid #b97716;background:#fff8e8;color:#6f470e}.mb-lifecycle-correction-reason{grid-template-columns:max-content minmax(0,1fr);align-items:start;column-gap:18px;row-gap:10px;border-left:4px solid #c5443f;background:#fff2f1;color:#812d29}.mb-lifecycle-correction-reason-code,.mb-lifecycle-correction-reason-description{display:grid;gap:4px}.mb-lifecycle-correction-reason-code>span,.mb-lifecycle-correction-reason-description>span,.mb-lifecycle-correction-reason-code small>span{color:#9b514d;font-size:.7rem;font-weight:850;letter-spacing:.07em;text-transform:uppercase}.mb-lifecycle-correction-reason code{width:max-content;border:1px solid #e8b4b0;border-radius:6px;background:rgba(255,255,255,.66);color:#812d29;font:750 .84rem/1.35 ui-monospace,SFMono-Regular,Menlo,monospace;padding:3px 7px}.mb-lifecycle-correction-reason-code small{display:grid;gap:1px;margin-top:3px;color:#9b514d;font:500 .72rem/1.35 ui-monospace,SFMono-Regular,Menlo,monospace}.mb-lifecycle-correction-reason-description strong{font-size:.94rem}.mb-lifecycle-correction-reason>ul{grid-column:1/-1;display:grid;gap:5px;margin:0;padding:8px 0 0 18px;border-top:1px solid #ecc7c4}.mb-lifecycle-correction-reason li{padding-left:3px}.mb-lifecycle-correction-reason li code{margin-right:7px}.mb-lifecycle-correction-contact{border:1px solid color-mix(in srgb,var(--mb-accent) 35%,var(--mb-border));background:color-mix(in srgb,var(--mb-accent) 7%,var(--mb-surface))}.mb-lifecycle-correction-contact dl{display:grid;gap:10px;margin:8px 0 0}.mb-lifecycle-correction-contact dl>div{display:grid;grid-template-columns:68px minmax(0,1fr);gap:10px}.mb-lifecycle-correction-contact dt{padding-top:2px;color:var(--mb-muted);font-size:.78rem;font-weight:800;text-transform:uppercase}.mb-lifecycle-correction-contact dd{min-width:0;margin:0;overflow-wrap:anywhere}.mb-lifecycle-correction-contact dd ul{display:grid;gap:4px;margin:0;padding:0;list-style:none}.mb-lifecycle-correction-contact dd li{min-width:0}.mb-lifecycle-correction-contact a{color:var(--mb-accent);text-underline-offset:2px}.mb-lifecycle-correction-note{display:grid;gap:6px;font-size:.85rem;font-weight:750}.mb-lifecycle-correction-note textarea{min-height:76px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius,8px);background:var(--mb-input,#fff);color:var(--mb-text);font:inherit;padding:10px 12px;resize:vertical}
6597
6814
  .mb-payment-total{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;border-radius:9px;background:var(--mb-soft)}.mb-payment-total strong{font-size:1.12rem}
6598
6815
  .mb-lifecycle-deadline-hint{margin:0;padding:10px 12px;border-radius:9px;background:color-mix(in srgb,var(--mb-warning,#8a5c17) 10%,var(--mb-surface));color:var(--mb-warning,#8a5c17);font-size:.85rem}
6599
- @media(max-width:700px){.mb-lifecycle-head,.mb-lifecycle-card header{align-items:stretch;flex-direction:column}.mb-lifecycle-head>.mb-lifecycle-button{width:100%}.mb-lifecycle-actions-sheet{bottom:calc(var(--mb-host-bottom-offset,72px) + env(safe-area-inset-bottom) + 8px);grid-template-columns:repeat(2,minmax(0,1fr))}.mb-lifecycle-actions-sheet .mb-lifecycle-button:last-child:nth-child(odd){grid-column:1/-1}.mb-lifecycle-fields.two{grid-template-columns:1fr}.mb-lifecycle-fields .full{grid-column:auto}.mb-lifecycle-dialog-backdrop{align-items:end;padding:0}.mb-lifecycle-dialog{max-height:calc(100dvh - 12px)}.mb-lifecycle-dialog .mb-lifecycle-panel,.mb-lifecycle-correction{border-radius:18px 18px 0 0}.mb-lifecycle-correction{padding:18px 12px calc(18px + env(safe-area-inset-bottom))}.mb-lifecycle-correction>header{align-items:stretch;flex-direction:column;padding-right:56px}.mb-lifecycle-correction-reason{grid-template-columns:1fr}.mb-lifecycle-correction-reason>ul{grid-column:auto}.mb-lifecycle-correction-contact dl>div{grid-template-columns:1fr;gap:2px}.mb-lifecycle-tabs button{font-size:.9rem}.mb-lifecycle-title h2{font-size:1.4rem}}
6816
+ @media(max-width:700px){.mb-lifecycle-attempt-detail dl{grid-template-columns:repeat(2,minmax(0,1fr))}.mb-lifecycle-notes form{grid-template-columns:1fr}.mb-lifecycle-notes form button{width:100%}.mb-lifecycle-head,.mb-lifecycle-card header{align-items:stretch;flex-direction:column}.mb-lifecycle-head>.mb-lifecycle-button{width:100%}.mb-lifecycle-actions-sheet{bottom:calc(var(--mb-host-bottom-offset,72px) + env(safe-area-inset-bottom) + 8px);grid-template-columns:repeat(2,minmax(0,1fr))}.mb-lifecycle-actions-sheet .mb-lifecycle-button:last-child:nth-child(odd){grid-column:1/-1}.mb-lifecycle-fields.two{grid-template-columns:1fr}.mb-lifecycle-fields .full{grid-column:auto}.mb-lifecycle-dialog-backdrop{align-items:end;padding:0}.mb-lifecycle-dialog{max-height:calc(100dvh - 12px)}.mb-lifecycle-dialog .mb-lifecycle-panel,.mb-lifecycle-correction{border-radius:18px 18px 0 0}.mb-lifecycle-correction{padding:18px 12px calc(18px + env(safe-area-inset-bottom))}.mb-lifecycle-correction>header{align-items:stretch;flex-direction:column;padding-right:56px}.mb-lifecycle-correction-reason{grid-template-columns:1fr}.mb-lifecycle-correction-reason>ul{grid-column:auto}.mb-lifecycle-correction-contact dl>div{grid-template-columns:1fr;gap:2px}.mb-lifecycle-tabs button{font-size:.9rem}.mb-lifecycle-title h2{font-size:1.4rem}}
6600
6817
  `;
6601
6818
 
6602
6819
  // src/connected-billing-workspace.tsx
6603
6820
  import {
6604
6821
  useCallback as useCallback5,
6605
6822
  useEffect as useEffect11,
6823
+ useLayoutEffect,
6606
6824
  useMemo as useMemo10,
6825
+ useRef as useRef7,
6607
6826
  useState as useState13
6608
6827
  } from "react";
6609
6828
 
@@ -6711,7 +6930,17 @@ function createBillingOperationsClient({
6711
6930
  pendingSessionSignal = null;
6712
6931
  },
6713
6932
  getBills(query = {}, signal) {
6714
- return get(`/partner/v2/browser/bills${queryString(query)}`, signal);
6933
+ const { claimsAdministrator, taskType, taskSection: _taskSection, sort, status, ...filters } = query;
6934
+ void _taskSection;
6935
+ const sortKey = sort?.startsWith("balance_") ? "balanceDue" : sort?.startsWith("patient_") ? "patient" : sort ? "submitted" : void 0;
6936
+ return get(`/partner/v2/browser/bills${queryString({
6937
+ ...filters,
6938
+ status: status === "submitted" ? "sent" : status,
6939
+ claimsAdminId: claimsAdministrator,
6940
+ taskKind: taskType,
6941
+ sort: sortKey,
6942
+ dir: sort ? sort.endsWith("_asc") ? "asc" : "desc" : void 0
6943
+ })}`, signal);
6715
6944
  },
6716
6945
  getBillTasks(claimsAdministrator, signal) {
6717
6946
  return get(
@@ -6735,6 +6964,7 @@ function createBillingOperationsClient({
6735
6964
  import { Fragment as Fragment14, jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
6736
6965
  var css11 = `
6737
6966
  .mbow{color:var(--mb-text);font:14px/1.45 var(--mb-font);background:var(--mb-soft);border-radius:var(--mb-radius);padding:20px}.mbow *{box-sizing:border-box}.mbow h2,.mbow h3,.mbow p{margin:0}.mbow a{color:var(--mb-accent)}
6967
+ .mbow-workspace{width:100%;height:100%;max-height:var(--mbow-available-height,100dvh);min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
6738
6968
  .mbow-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:18px}.mbow-head h2{font-size:24px;line-height:1.2}.mbow-sub{color:var(--mb-muted);margin-top:4px!important}.mbow-actions{display:flex;gap:8px;flex-wrap:wrap}
6739
6969
  .mbow-button,.mbow-input,.mbow-select{min-height:38px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-input);color:var(--mb-text);font:inherit}.mbow-button{padding:7px 12px;cursor:pointer;font-weight:650}.mbow-button:hover{border-color:var(--mb-accent)}.mbow-button.primary{background:var(--mb-accent);border-color:var(--mb-accent);color:var(--mb-accent-contrast)}.mbow-button:disabled{opacity:.55;cursor:not-allowed}.mbow-input,.mbow-select{padding:7px 10px}.mbow-input{min-width:260px;flex:1}
6740
6970
  .mbow-tabs{display:flex;gap:4px;border-bottom:1px solid var(--mb-border);margin-bottom:18px;overflow:auto}.mbow-tab{border:0;border-bottom:3px solid transparent;background:transparent;color:var(--mb-muted);padding:10px 13px;font:inherit;font-weight:700;white-space:nowrap;cursor:pointer}.mbow-tab.active{color:var(--mb-text);border-bottom-color:var(--mb-accent)}
@@ -6759,12 +6989,40 @@ function defaultRange(days = 29) {
6759
6989
  const iso = (date2) => date2.toISOString().slice(0, 10);
6760
6990
  return { from: iso(from), to: iso(to) };
6761
6991
  }
6762
- function Surface({ appearance, className = "", style, children }) {
6763
- return /* @__PURE__ */ jsxs16("div", { className: `mbow ${className}`.trim(), style: mindBillAppearanceStyle(appearance, style), children: [
6992
+ function Surface({ appearance, className = "", style, children, surfaceRef }) {
6993
+ return /* @__PURE__ */ jsxs16("div", { ref: surfaceRef, className: `mbow ${className}`.trim(), style: mindBillAppearanceStyle(appearance, style), children: [
6764
6994
  /* @__PURE__ */ jsx16("style", { children: css11 }),
6765
6995
  children
6766
6996
  ] });
6767
6997
  }
6998
+ function useAvailableViewportHeight() {
6999
+ const workspaceRef = useRef7(null);
7000
+ const [availableHeight, setAvailableHeight] = useState13(null);
7001
+ useLayoutEffect(() => {
7002
+ const element = workspaceRef.current;
7003
+ if (!element || typeof window === "undefined") return;
7004
+ let frame = 0;
7005
+ const update = () => {
7006
+ window.cancelAnimationFrame(frame);
7007
+ frame = window.requestAnimationFrame(() => {
7008
+ const viewportHeight = window.visualViewport?.height ?? window.innerHeight;
7009
+ const top = Math.max(0, element.getBoundingClientRect().top);
7010
+ setAvailableHeight(Math.max(240, viewportHeight - top - 16));
7011
+ });
7012
+ };
7013
+ update();
7014
+ window.addEventListener("resize", update);
7015
+ window.addEventListener("scroll", update, true);
7016
+ window.visualViewport?.addEventListener("resize", update);
7017
+ return () => {
7018
+ window.cancelAnimationFrame(frame);
7019
+ window.removeEventListener("resize", update);
7020
+ window.removeEventListener("scroll", update, true);
7021
+ window.visualViewport?.removeEventListener("resize", update);
7022
+ };
7023
+ }, []);
7024
+ return { workspaceRef, availableHeight };
7025
+ }
6768
7026
  function useClient(options) {
6769
7027
  return useMemo10(() => createBillingOperationsClient(options), [options.apiBaseUrl, options.fetch, options.getSession, options.sessionEndpoint]);
6770
7028
  }
@@ -6774,7 +7032,7 @@ function BillSearchContent({
6774
7032
  onSelectBill,
6775
7033
  heading
6776
7034
  }) {
6777
- const [query, setQuery] = useState13({ status: "all", age: "all", page: 1, pageSize: 25, sort: "submitted_desc", ...initialQuery });
7035
+ const [query, setQuery] = useState13({ age: "all", page: 1, pageSize: 25, sort: "submitted_desc", ...initialQuery, status: initialQuery?.status === "submitted" ? "sent" : initialQuery?.status ?? "all" });
6778
7036
  const [draft, setDraft] = useState13(initialQuery?.q ?? "");
6779
7037
  const [result, setResult] = useState13(null);
6780
7038
  const [error, setError] = useState13(null);
@@ -6807,8 +7065,9 @@ function BillSearchContent({
6807
7065
  /* @__PURE__ */ jsxs16("select", { className: "mbow-select", value: query.status ?? "all", onChange: (event) => update({ status: event.target.value }), "aria-label": "Bill status", children: [
6808
7066
  /* @__PURE__ */ jsx16("option", { value: "all", children: "All statuses" }),
6809
7067
  /* @__PURE__ */ jsx16("option", { value: "incomplete", children: "Incomplete" }),
6810
- /* @__PURE__ */ jsx16("option", { value: "submitted", children: "Submitted" }),
7068
+ /* @__PURE__ */ jsx16("option", { value: "sent", children: "Sent" }),
6811
7069
  /* @__PURE__ */ jsx16("option", { value: "accepted", children: "Accepted" }),
7070
+ /* @__PURE__ */ jsx16("option", { value: "accepted_no_response", children: "Accepted \u2014 response overdue" }),
6812
7071
  /* @__PURE__ */ jsx16("option", { value: "rejected", children: "Rejected" }),
6813
7072
  /* @__PURE__ */ jsx16("option", { value: "processed", children: "Processed" }),
6814
7073
  /* @__PURE__ */ jsx16("option", { value: "paid", children: "Paid" }),
@@ -6826,7 +7085,7 @@ function BillSearchContent({
6826
7085
  /* @__PURE__ */ jsx16("button", { className: "mbow-button", type: "submit", children: "Search" })
6827
7086
  ] }),
6828
7087
  /* @__PURE__ */ jsxs16("div", { className: "mbow-card mbow-scroll", children: [
6829
- loading && !result ? /* @__PURE__ */ jsx16("div", { className: "mbow-state", role: "status", children: "Loading bills\u2026" }) : error && !result ? /* @__PURE__ */ jsxs16("div", { className: "mbow-state mbow-error", role: "alert", children: [
7088
+ loading ? /* @__PURE__ */ jsx16("div", { className: "mbow-state", role: "status", children: "Loading bills\u2026" }) : error ? /* @__PURE__ */ jsxs16("div", { className: "mbow-state mbow-error", role: "alert", children: [
6830
7089
  error.message,
6831
7090
  " ",
6832
7091
  /* @__PURE__ */ jsx16("button", { className: "mbow-button", type: "button", onClick: () => void load(), children: "Retry" })
@@ -6858,7 +7117,7 @@ function BillSearchContent({
6858
7117
  /* @__PURE__ */ jsx16("td", { className: "mbow-money mbow-strong", children: money6(bill.balanceDue) })
6859
7118
  ] }, bill.id)) })
6860
7119
  ] }),
6861
- result ? /* @__PURE__ */ jsxs16("div", { className: "mbow-pager", children: [
7120
+ result && !loading && !error ? /* @__PURE__ */ jsxs16("div", { className: "mbow-pager", children: [
6862
7121
  /* @__PURE__ */ jsxs16("span", { children: [
6863
7122
  "Showing ",
6864
7123
  result.total === 0 ? 0 : (result.page - 1) * result.pageSize + 1,
@@ -6887,6 +7146,9 @@ function ConnectedBillSearch({ appearance, className, style, initialQuery, onSel
6887
7146
  function taskQuery(cell) {
6888
7147
  const [taskType, taskLabel] = cell.rowId.split("::", 2);
6889
7148
  const age = cell.bucketId === "1-30" ? "0-30" : cell.bucketId;
7149
+ if (cell.sectionId === "waiting_sent" || cell.sectionId === "waiting_accepted") {
7150
+ return { status: cell.rowId, ...age ? { age } : {} };
7151
+ }
6890
7152
  return { status: "all", taskSection: cell.sectionId, ...taskType ? { taskType } : {}, ...taskLabel ? { taskLabel } : {}, ...age ? { age } : {} };
6891
7153
  }
6892
7154
  function BillTasksContent({ client, onDrillDown, appearance }) {
@@ -6913,16 +7175,34 @@ function BillTasksContent({ client, onDrillDown, appearance }) {
6913
7175
  if (loading && !result) return /* @__PURE__ */ jsx16("div", { className: "mbow-state", children: "Loading bill tasks\u2026" });
6914
7176
  if (error && !result) return /* @__PURE__ */ jsx16("div", { className: "mbow-state mbow-error", children: error.message });
6915
7177
  if (!result) return /* @__PURE__ */ jsx16(Fragment14, {});
7178
+ const selectionProps = loading || error ? {} : {
7179
+ onSelectCell: (cell) => onDrillDown?.({ ...taskQuery(cell), ...claimsAdminId ? { claimsAdministrator: claimsAdminId } : {} })
7180
+ };
6916
7181
  return /* @__PURE__ */ jsxs16(Fragment14, { children: [
6917
7182
  /* @__PURE__ */ jsxs16("p", { className: "mbow-task-note", children: [
6918
- "Open follow-up work only. Sent bills waiting on a payer stay available in ",
6919
- /* @__PURE__ */ jsx16("strong", { children: "All bills" }),
6920
- "."
7183
+ "Open follow-up work grouped by task and age. ",
7184
+ result.waiting ? "Sent and accepted bills waiting for a payer are shown below." : "Find sent and accepted bills in All bills."
6921
7185
  ] }),
6922
- /* @__PURE__ */ jsx16(BillTasksDashboard, { data: result.dashboard, appearance: appearance ?? { preset: "mindbill" }, toolbar: /* @__PURE__ */ jsxs16("select", { className: "mbow-select", value: claimsAdminId, onChange: (event) => setClaimsAdminId(event.target.value), children: [
7186
+ loading ? /* @__PURE__ */ jsx16("p", { role: "status", children: "Updating bill tasks\u2026" }) : null,
7187
+ error ? /* @__PURE__ */ jsx16("p", { role: "alert", className: "mbow-error", children: error.message }) : null,
7188
+ /* @__PURE__ */ jsx16(BillTasksDashboard, { data: result.dashboard, appearance: appearance ?? { preset: "mindbill" }, toolbar: /* @__PURE__ */ jsxs16("select", { "aria-label": "Claims administrator filter", className: "mbow-select", value: claimsAdminId, onChange: (event) => setClaimsAdminId(event.target.value), children: [
6923
7189
  /* @__PURE__ */ jsx16("option", { value: "", children: "All claims administrators" }),
6924
7190
  result.filters.claimsAdministrators.map((item) => /* @__PURE__ */ jsx16("option", { value: item.id, children: item.name }, item.id))
6925
- ] }), onSelectCell: (cell) => onDrillDown?.(taskQuery(cell)) })
7191
+ ] }), ...selectionProps }),
7192
+ result.waiting ? /* @__PURE__ */ jsx16(
7193
+ BillTasksDashboard,
7194
+ {
7195
+ data: result.waiting,
7196
+ appearance: appearance ?? { preset: "mindbill" },
7197
+ heading: "Bills waiting for payer",
7198
+ totalLabel: "Bill Total",
7199
+ itemLabel: "bills",
7200
+ grandTotalLabel: "Waiting Bills Total",
7201
+ emptyLabel: "No waiting bills",
7202
+ ...selectionProps,
7203
+ footnote: "Waiting bills can also have overdue follow-up tasks above. These bill totals are separate from task totals."
7204
+ }
7205
+ ) : null
6926
7206
  ] });
6927
7207
  }
6928
7208
  function ConnectedBillTasksDashboard({ appearance, className, style, onDrillDown, ...options }) {
@@ -7089,7 +7369,11 @@ function ConnectedBillingWorkspace({ appearance, className, style, initialView =
7089
7369
  const [view, setView] = useState13(initialView);
7090
7370
  const [billQuery, setBillQuery] = useState13({ status: "all" });
7091
7371
  const [selectedBillId, setSelectedBillId] = useState13(null);
7092
- if (selectedBillId) return /* @__PURE__ */ jsxs16(Surface, { appearance, className, style, children: [
7372
+ const { workspaceRef, availableHeight } = useAvailableViewportHeight();
7373
+ const workspaceClassName = ["mbow-workspace", className].filter(Boolean).join(" ");
7374
+ const hasExplicitHeight = style?.height != null || style?.maxHeight != null;
7375
+ const workspaceStyle = availableHeight == null || hasExplicitHeight ? style : { ...style, maxHeight: availableHeight };
7376
+ if (selectedBillId) return /* @__PURE__ */ jsxs16(Surface, { surfaceRef: workspaceRef, appearance, className: workspaceClassName, style: workspaceStyle, children: [
7093
7377
  /* @__PURE__ */ jsx16("button", { className: "mbow-button mbow-back", type: "button", onClick: () => setSelectedBillId(null), children: "\u2190 Back to bills" }),
7094
7378
  /* @__PURE__ */ jsx16(ConnectedBillLifecycle, { billId: selectedBillId, ...options, ...appearance ? { appearance } : {} })
7095
7379
  ] });
@@ -7098,7 +7382,7 @@ function ConnectedBillingWorkspace({ appearance, className, style, initialView =
7098
7382
  setSelectedBillId(null);
7099
7383
  };
7100
7384
  const appearanceProps = appearance ? { appearance } : {};
7101
- return /* @__PURE__ */ jsxs16(Surface, { appearance, className, style, children: [
7385
+ return /* @__PURE__ */ jsxs16(Surface, { surfaceRef: workspaceRef, appearance, className: workspaceClassName, style: workspaceStyle, children: [
7102
7386
  /* @__PURE__ */ jsxs16("div", { className: "mbow-head", children: [
7103
7387
  /* @__PURE__ */ jsxs16("div", { children: [
7104
7388
  /* @__PURE__ */ jsx16("h2", { children: "Billing" }),
@@ -7116,7 +7400,7 @@ function ConnectedBillingWorkspace({ appearance, className, style, initialView =
7116
7400
 
7117
7401
  // src/index.tsx
7118
7402
  function widget(tagName, props) {
7119
- const ref = useRef7(null);
7403
+ const ref = useRef8(null);
7120
7404
  const { onMindBill, onMindBillError } = props;
7121
7405
  useEffect12(() => {
7122
7406
  const element = ref.current;
@@ -7245,6 +7529,7 @@ export {
7245
7529
  mindBillAppearanceStyle,
7246
7530
  mindBillThemePresets,
7247
7531
  normalizeClaimsAdministratorName,
7532
+ organizationProfileOptions,
7248
7533
  parseBillSubmissionDate,
7249
7534
  prepareBillSubmissionDocuments,
7250
7535
  reportBillStatusContacts2 as reportBillStatusContacts,