@gemina/elements 0.13.0 → 0.13.2

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.
@@ -45,7 +45,7 @@ async function readErrorEnvelope(error) {
45
45
  }
46
46
 
47
47
  // src/version.ts
48
- var VERSION = "0.13.0";
48
+ var VERSION = "0.13.2";
49
49
 
50
50
  export {
51
51
  getResponseLike,
@@ -53,4 +53,4 @@ export {
53
53
  readErrorEnvelope,
54
54
  VERSION
55
55
  };
56
- //# sourceMappingURL=chunk-7FT4EJTY.js.map
56
+ //# sourceMappingURL=chunk-R7LDCMGS.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/internal/response-like.ts","../src/version.ts"],"sourcesContent":["/**\n * Shared transport-error helpers for the widgets (chat + verification).\n *\n * Extracted verbatim from chat.tsx so both components read thrown SDK errors\n * the same way. Pure and dependency-free: no React, no DOM.\n */\n\n/**\n * The response-like object carried by a thrown transport error. We pull it off\n * by shape rather than `instanceof ResponseError` — robust against duplicated\n * `@gemina/sdk` copies in a bundle (class identity is not shared across\n * copies). On the fetch transport this is the raw `Response`, so `status`,\n * `headers`, and the JSON body are all reachable from here.\n */\nexport interface ResponseLike {\n status?: number;\n headers?: { get?: (name: string) => string | null };\n json?: () => Promise<unknown>;\n clone?: () => ResponseLike;\n}\n\nexport function getResponseLike(error: unknown): ResponseLike | undefined {\n if (error !== null && typeof error === 'object' && 'response' in error) {\n const response = (error as { response?: unknown }).response;\n if (response !== null && typeof response === 'object') {\n return response as ResponseLike;\n }\n }\n return undefined;\n}\n\n/** Extract an HTTP status from a thrown value, or `undefined`. */\nexport function httpStatus(error: unknown): number | undefined {\n const status = getResponseLike(error)?.status;\n return typeof status === 'number' ? status : undefined;\n}\n\n/** What the standard backend error envelope reliably carries. */\nexport interface ErrorEnvelope {\n status: number | undefined;\n /** Stable backend `errors[0].error_code`. */\n errorCode: string | undefined;\n /** Human-readable server fallback (`errors[0].description`). */\n description: string | undefined;\n}\n\n/**\n * Read what the backend actually sent on an error. Only the HTTP status and\n * the stable `errors[0].error_code` / `description` are reliable across\n * environments — production strips `errors[0].detail`, so we never touch it.\n * The fetch body can be read once, so we clone defensively; if that fails\n * (non-JSON, empty, or already consumed) the status still stands.\n */\nexport async function readErrorEnvelope(error: unknown): Promise<ErrorEnvelope> {\n const response = getResponseLike(error);\n const info: ErrorEnvelope = {\n status: typeof response?.status === 'number' ? response.status : undefined,\n errorCode: undefined,\n description: undefined,\n };\n if (response === undefined) {\n return info;\n }\n\n let body: unknown;\n try {\n const source = typeof response.clone === 'function' ? response.clone() : response;\n body = typeof source.json === 'function' ? await source.json() : undefined;\n } catch {\n body = undefined;\n }\n if (body !== null && typeof body === 'object') {\n const errors = (body as { errors?: unknown }).errors;\n if (\n Array.isArray(errors) &&\n errors.length > 0 &&\n errors[0] !== null &&\n typeof errors[0] === 'object'\n ) {\n const first = errors[0] as { error_code?: unknown; description?: unknown };\n if (typeof first.error_code === 'string') {\n info.errorCode = first.error_code;\n }\n if (typeof first.description === 'string') {\n info.description = first.description;\n }\n }\n }\n return info;\n}\n","/** Package version. Keep in sync with package.json. */\nexport const VERSION = '0.13.0';\n"],"mappings":";AAqBO,SAAS,gBAAgB,OAA0C;AACxE,MAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,cAAc,OAAO;AACtE,UAAM,WAAY,MAAiC;AACnD,QAAI,aAAa,QAAQ,OAAO,aAAa,UAAU;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAGO,SAAS,WAAW,OAAoC;AAC7D,QAAM,SAAS,gBAAgB,KAAK,GAAG;AACvC,SAAO,OAAO,WAAW,WAAW,SAAS;AAC/C;AAkBA,eAAsB,kBAAkB,OAAwC;AAC9E,QAAM,WAAW,gBAAgB,KAAK;AACtC,QAAM,OAAsB;AAAA,IAC1B,QAAQ,OAAO,UAAU,WAAW,WAAW,SAAS,SAAS;AAAA,IACjE,WAAW;AAAA,IACX,aAAa;AAAA,EACf;AACA,MAAI,aAAa,QAAW;AAC1B,WAAO;AAAA,EACT;AAEA,MAAI;AACJ,MAAI;AACF,UAAM,SAAS,OAAO,SAAS,UAAU,aAAa,SAAS,MAAM,IAAI;AACzE,WAAO,OAAO,OAAO,SAAS,aAAa,MAAM,OAAO,KAAK,IAAI;AAAA,EACnE,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI,SAAS,QAAQ,OAAO,SAAS,UAAU;AAC7C,UAAM,SAAU,KAA8B;AAC9C,QACE,MAAM,QAAQ,MAAM,KACpB,OAAO,SAAS,KAChB,OAAO,CAAC,MAAM,QACd,OAAO,OAAO,CAAC,MAAM,UACrB;AACA,YAAM,QAAQ,OAAO,CAAC;AACtB,UAAI,OAAO,MAAM,eAAe,UAAU;AACxC,aAAK,YAAY,MAAM;AAAA,MACzB;AACA,UAAI,OAAO,MAAM,gBAAgB,UAAU;AACzC,aAAK,cAAc,MAAM;AAAA,MAC3B;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;;;ACxFO,IAAM,UAAU;","names":[]}
1
+ {"version":3,"sources":["../src/internal/response-like.ts","../src/version.ts"],"sourcesContent":["/**\n * Shared transport-error helpers for the widgets (chat + verification).\n *\n * Extracted verbatim from chat.tsx so both components read thrown SDK errors\n * the same way. Pure and dependency-free: no React, no DOM.\n */\n\n/**\n * The response-like object carried by a thrown transport error. We pull it off\n * by shape rather than `instanceof ResponseError` — robust against duplicated\n * `@gemina/sdk` copies in a bundle (class identity is not shared across\n * copies). On the fetch transport this is the raw `Response`, so `status`,\n * `headers`, and the JSON body are all reachable from here.\n */\nexport interface ResponseLike {\n status?: number;\n headers?: { get?: (name: string) => string | null };\n json?: () => Promise<unknown>;\n clone?: () => ResponseLike;\n}\n\nexport function getResponseLike(error: unknown): ResponseLike | undefined {\n if (error !== null && typeof error === 'object' && 'response' in error) {\n const response = (error as { response?: unknown }).response;\n if (response !== null && typeof response === 'object') {\n return response as ResponseLike;\n }\n }\n return undefined;\n}\n\n/** Extract an HTTP status from a thrown value, or `undefined`. */\nexport function httpStatus(error: unknown): number | undefined {\n const status = getResponseLike(error)?.status;\n return typeof status === 'number' ? status : undefined;\n}\n\n/** What the standard backend error envelope reliably carries. */\nexport interface ErrorEnvelope {\n status: number | undefined;\n /** Stable backend `errors[0].error_code`. */\n errorCode: string | undefined;\n /** Human-readable server fallback (`errors[0].description`). */\n description: string | undefined;\n}\n\n/**\n * Read what the backend actually sent on an error. Only the HTTP status and\n * the stable `errors[0].error_code` / `description` are reliable across\n * environments — production strips `errors[0].detail`, so we never touch it.\n * The fetch body can be read once, so we clone defensively; if that fails\n * (non-JSON, empty, or already consumed) the status still stands.\n */\nexport async function readErrorEnvelope(error: unknown): Promise<ErrorEnvelope> {\n const response = getResponseLike(error);\n const info: ErrorEnvelope = {\n status: typeof response?.status === 'number' ? response.status : undefined,\n errorCode: undefined,\n description: undefined,\n };\n if (response === undefined) {\n return info;\n }\n\n let body: unknown;\n try {\n const source = typeof response.clone === 'function' ? response.clone() : response;\n body = typeof source.json === 'function' ? await source.json() : undefined;\n } catch {\n body = undefined;\n }\n if (body !== null && typeof body === 'object') {\n const errors = (body as { errors?: unknown }).errors;\n if (\n Array.isArray(errors) &&\n errors.length > 0 &&\n errors[0] !== null &&\n typeof errors[0] === 'object'\n ) {\n const first = errors[0] as { error_code?: unknown; description?: unknown };\n if (typeof first.error_code === 'string') {\n info.errorCode = first.error_code;\n }\n if (typeof first.description === 'string') {\n info.description = first.description;\n }\n }\n }\n return info;\n}\n","/** Package version. Keep in sync with package.json. */\nexport const VERSION = '0.13.2';\n"],"mappings":";AAqBO,SAAS,gBAAgB,OAA0C;AACxE,MAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,cAAc,OAAO;AACtE,UAAM,WAAY,MAAiC;AACnD,QAAI,aAAa,QAAQ,OAAO,aAAa,UAAU;AACrD,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAGO,SAAS,WAAW,OAAoC;AAC7D,QAAM,SAAS,gBAAgB,KAAK,GAAG;AACvC,SAAO,OAAO,WAAW,WAAW,SAAS;AAC/C;AAkBA,eAAsB,kBAAkB,OAAwC;AAC9E,QAAM,WAAW,gBAAgB,KAAK;AACtC,QAAM,OAAsB;AAAA,IAC1B,QAAQ,OAAO,UAAU,WAAW,WAAW,SAAS,SAAS;AAAA,IACjE,WAAW;AAAA,IACX,aAAa;AAAA,EACf;AACA,MAAI,aAAa,QAAW;AAC1B,WAAO;AAAA,EACT;AAEA,MAAI;AACJ,MAAI;AACF,UAAM,SAAS,OAAO,SAAS,UAAU,aAAa,SAAS,MAAM,IAAI;AACzE,WAAO,OAAO,OAAO,SAAS,aAAa,MAAM,OAAO,KAAK,IAAI;AAAA,EACnE,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI,SAAS,QAAQ,OAAO,SAAS,UAAU;AAC7C,UAAM,SAAU,KAA8B;AAC9C,QACE,MAAM,QAAQ,MAAM,KACpB,OAAO,SAAS,KAChB,OAAO,CAAC,MAAM,QACd,OAAO,OAAO,CAAC,MAAM,UACrB;AACA,YAAM,QAAQ,OAAO,CAAC;AACtB,UAAI,OAAO,MAAM,eAAe,UAAU;AACxC,aAAK,YAAY,MAAM;AAAA,MACzB;AACA,UAAI,OAAO,MAAM,gBAAgB,UAAU;AACzC,aAAK,cAAc,MAAM;AAAA,MAC3B;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;;;ACxFO,IAAM,UAAU;","names":[]}
package/dist/index.cjs CHANGED
@@ -221,7 +221,7 @@ async function readErrorEnvelope(error) {
221
221
  }
222
222
 
223
223
  // src/version.ts
224
- var VERSION = "0.13.0";
224
+ var VERSION = "0.13.2";
225
225
 
226
226
  // src/chat.tsx
227
227
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -1704,87 +1704,98 @@ var NOTHING_HIDDEN = {
1704
1704
  rows: /* @__PURE__ */ new Set()
1705
1705
  };
1706
1706
  var unplannedRowKey = (tablePointer, index) => `${tablePointer}/${index}`;
1707
- function computeHidden(input) {
1708
- const { classified, plannedTables, cellViews, bindingIndex, edits, pairErrors, suppressed } = input;
1709
- const fields = /* @__PURE__ */ new Set();
1710
- const rows = /* @__PURE__ */ new Set();
1711
- const touched = (editKey) => editKey !== void 0 && (edits.has(editKey) || pairErrors.has(editKey));
1712
- const editKeysByRow = /* @__PURE__ */ new Map();
1713
- for (const view of cellViews) {
1714
- const list = editKeysByRow.get(view.rowKey);
1715
- if (list) list.push(view.editKey);
1716
- else editKeysByRow.set(view.rowKey, [view.editKey]);
1717
- }
1718
- const considerField = (pointer, confidence) => {
1719
- if (suppressed.has(pointer)) return;
1720
- if (!isHighConfidence(confidence)) return;
1721
- const editKey = bindingIndex.get(pointer)?.key.raw;
1722
- if (editKey === void 0 || touched(editKey)) return;
1723
- fields.add(pointer);
1724
- };
1725
- for (const header of classified.headers) {
1726
- considerField(header.pointer, header.confidence);
1727
- }
1707
+ function forEachFieldUnit(classified, visit) {
1708
+ for (const header of classified.headers) visit(header.pointer, header.confidence);
1728
1709
  for (const list of classified.simpleLists) {
1729
- for (const item of list.items) considerField(item.pointer, item.confidence);
1710
+ for (const item of list.items) visit(item.pointer, item.confidence);
1730
1711
  }
1731
1712
  for (const entity of classified.entities) {
1732
1713
  for (const item of entity.items) {
1733
- for (const entityCell of Object.values(item)) considerField(entityCell.pointer, entityCell.confidence);
1714
+ for (const cell of Object.values(item)) visit(cell.pointer, cell.confidence);
1734
1715
  }
1735
1716
  }
1736
- const rowConfidence = (row) => {
1717
+ }
1718
+ function forEachRowUnit(tables, plannedTables, visit) {
1719
+ const confidenceOf = (row) => {
1737
1720
  const meta = row?.[ROW_META_KEY];
1738
1721
  return meta?.confidence ?? null;
1739
1722
  };
1740
- const rowIsHidable = (rowKey) => !(editKeysByRow.get(rowKey) ?? []).some((editKey) => touched(editKey));
1741
- for (const table of classified.tables) {
1742
- const planned = plannedTables.get(table.pointer);
1723
+ const planFor = (tablePointer) => {
1724
+ const exact = plannedTables.get(tablePointer);
1725
+ if (exact !== void 0) return exact;
1726
+ for (const [serverPointer, planned] of plannedTables) {
1727
+ if (matchesTablePointer(serverPointer, tablePointer)) return planned;
1728
+ }
1729
+ return void 0;
1730
+ };
1731
+ for (const table of tables) {
1732
+ const planned = planFor(table.pointer);
1743
1733
  if (planned) {
1744
- for (const plannedRow of planned) {
1745
- if (plannedRow.entry.source === null) continue;
1746
- if (!isHighConfidence(rowConfidence(table.rows[plannedRow.entry.source]))) continue;
1747
- if (!rowIsHidable(plannedRow.entry.id)) continue;
1748
- rows.add(plannedRow.entry.id);
1734
+ for (const row of planned) {
1735
+ const { source } = row.entry;
1736
+ visit(row.entry.id, source === null ? null : confidenceOf(table.rows[source]), source === null);
1749
1737
  }
1750
1738
  continue;
1751
1739
  }
1752
1740
  table.rows.forEach((row, index) => {
1753
- if (!isHighConfidence(rowConfidence(row))) return;
1754
- const key = unplannedRowKey(table.pointer, index);
1755
- if (!rowIsHidable(key)) return;
1756
- rows.add(key);
1741
+ visit(unplannedRowKey(table.pointer, index), confidenceOf(row), false);
1757
1742
  });
1758
1743
  }
1744
+ }
1745
+ function computeHidden(input) {
1746
+ const {
1747
+ classified,
1748
+ tables,
1749
+ plannedTables,
1750
+ cellViews,
1751
+ bindingIndex,
1752
+ edits,
1753
+ pairErrors,
1754
+ suppressed
1755
+ } = input;
1756
+ const fields = /* @__PURE__ */ new Set();
1757
+ const rows = /* @__PURE__ */ new Set();
1758
+ const touched = (editKey) => edits.has(editKey) || pairErrors.has(editKey);
1759
+ const editKeysByRow = /* @__PURE__ */ new Map();
1760
+ for (const view of cellViews) {
1761
+ const list = editKeysByRow.get(view.rowKey);
1762
+ if (list) list.push(view.editKey);
1763
+ else editKeysByRow.set(view.rowKey, [view.editKey]);
1764
+ }
1765
+ forEachFieldUnit(classified, (pointer, confidence) => {
1766
+ if (suppressed.has(pointer) || !isHighConfidence(confidence)) return;
1767
+ const editKey = bindingIndex.get(pointer)?.key.raw;
1768
+ if (editKey === void 0 || touched(editKey)) return;
1769
+ fields.add(pointer);
1770
+ });
1771
+ forEachRowUnit(tables, plannedTables, (rowKey, confidence, added) => {
1772
+ if (added || !isHighConfidence(confidence)) return;
1773
+ if ((editKeysByRow.get(rowKey) ?? []).some(touched)) return;
1774
+ rows.add(rowKey);
1775
+ });
1759
1776
  if (fields.size === 0 && rows.size === 0) return NOTHING_HIDDEN;
1760
1777
  return { fields, rows };
1761
1778
  }
1762
- function countUnits(classified, plannedTables, suppressed) {
1779
+ function countUnits(classified, tables, plannedTables, suppressed) {
1763
1780
  let total = 0;
1764
- total += classified.headers.filter((header) => !suppressed.has(header.pointer)).length;
1765
- for (const list of classified.simpleLists) {
1766
- total += list.items.filter((item) => !suppressed.has(item.pointer)).length;
1767
- }
1768
- for (const entity of classified.entities) {
1769
- for (const item of entity.items) {
1770
- total += Object.values(item).filter((entityCell) => !suppressed.has(entityCell.pointer)).length;
1771
- }
1772
- }
1773
- for (const table of classified.tables) {
1774
- total += plannedTables.get(table.pointer)?.length ?? table.rows.length;
1775
- }
1781
+ forEachFieldUnit(classified, (pointer) => {
1782
+ if (!suppressed.has(pointer)) total += 1;
1783
+ });
1784
+ forEachRowUnit(tables, plannedTables, () => {
1785
+ total += 1;
1786
+ });
1776
1787
  return total;
1777
1788
  }
1778
- function hasAnyConfidence(classified) {
1779
- if (classified.headers.some((header) => header.confidence?.level)) return true;
1780
- if (classified.simpleLists.some((list) => list.items.some((item) => item.confidence?.level))) return true;
1781
- if (classified.entities.some((entity) => entity.items.some(
1782
- (item) => Object.values(item).some((entityCell) => entityCell.confidence?.level)
1783
- ))) return true;
1784
- return classified.tables.some((table) => table.rows.some((row) => {
1785
- const meta = row[ROW_META_KEY];
1786
- return Boolean(meta?.confidence?.level);
1787
- }));
1789
+ function hasAnyConfidence(classified, tables, plannedTables) {
1790
+ let found = false;
1791
+ forEachFieldUnit(classified, (_pointer, confidence) => {
1792
+ if (confidence?.level) found = true;
1793
+ });
1794
+ if (found) return true;
1795
+ forEachRowUnit(tables, plannedTables, (_rowKey, confidence) => {
1796
+ if (confidence?.level) found = true;
1797
+ });
1798
+ return found;
1788
1799
  }
1789
1800
 
1790
1801
  // src/verification/tip.tsx
@@ -2854,35 +2865,42 @@ function HeaderSection(props) {
2854
2865
  }
2855
2866
  function EntitySection(props) {
2856
2867
  const { entity, shared } = props;
2857
- const visibleItems = entity.items.map((item) => Object.fromEntries(
2858
- Object.entries(item).filter(([, cellValue]) => !shared.hidden.fields.has(cellValue.pointer))
2859
- )).filter((item) => Object.keys(item).length > 0);
2868
+ const visibleItems = entity.items.map((item, index) => ({
2869
+ index,
2870
+ cells: Object.fromEntries(
2871
+ Object.entries(item).filter(([, cellValue]) => !shared.hidden.fields.has(cellValue.pointer))
2872
+ )
2873
+ })).filter(({ cells }) => Object.keys(cells).length > 0);
2860
2874
  const label = formatLabel(entity.key);
2861
2875
  const singular = label.replace(/s$/, "");
2862
2876
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "gemina-verification__section", "aria-label": label, children: [
2863
2877
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "gemina-verification__section-header", children: [
2864
2878
  label,
2865
2879
  " (",
2866
- visibleItems.length,
2880
+ entity.items.length,
2867
2881
  ")"
2868
2882
  ] }),
2869
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "gemina-verification__section-body", children: visibleItems.map((item, itemIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "gemina-verification__card", children: [
2870
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "gemina-verification__card-header", children: [
2871
- singular,
2872
- " ",
2873
- itemIndex + 1
2874
- ] }),
2875
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dl", { className: "gemina-verification__dl", children: Object.entries(item).map(([fieldKey, cell]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2876
- FieldPair,
2877
- {
2878
- label: formatLabel(fieldKey),
2879
- ariaLabel: `${singular} ${itemIndex + 1} \u2014 ${formatLabel(fieldKey)}`,
2880
- cell,
2881
- shared
2882
- },
2883
- fieldKey
2884
- )) })
2885
- ] }, itemIndex)) })
2883
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "gemina-verification__section-body", children: visibleItems.map(({ index, cells }) => (
2884
+ // Keyed by the original index, never the filtered position, or React
2885
+ // reuses a hidden card's DOM (and its focus) for its successor.
2886
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "gemina-verification__card", children: [
2887
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "gemina-verification__card-header", children: [
2888
+ singular,
2889
+ " ",
2890
+ index + 1
2891
+ ] }),
2892
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dl", { className: "gemina-verification__dl", children: Object.entries(cells).map(([fieldKey, cell]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2893
+ FieldPair,
2894
+ {
2895
+ label: formatLabel(fieldKey),
2896
+ ariaLabel: `${singular} ${index + 1} \u2014 ${formatLabel(fieldKey)}`,
2897
+ cell,
2898
+ shared
2899
+ },
2900
+ fieldKey
2901
+ )) })
2902
+ ] }, index)
2903
+ )) })
2886
2904
  ] });
2887
2905
  }
2888
2906
  function TableRowView(props) {
@@ -3060,7 +3078,7 @@ function TableSection(props) {
3060
3078
  );
3061
3079
  const showControls = planned !== void 0 && mutable !== void 0 && !shared.readOnly && !shared.filterOn;
3062
3080
  const visiblePlanned = planned?.map((plannedRow, position) => ({ plannedRow, position })).filter(({ plannedRow }) => !shared.hidden.rows.has(plannedRow.entry.id));
3063
- const visibleRowIndices = planned ? null : table.rows.map((_row, index) => index).filter((index) => !shared.hidden.rows.has(unplannedRowKey(table.pointer, index)));
3081
+ const visibleRowIndices = planned ? [] : table.rows.map((_row, index) => index).filter((index) => !shared.hidden.rows.has(unplannedRowKey(table.pointer, index)));
3064
3082
  const visibleCount = visiblePlanned ? visiblePlanned.length : visibleRowIndices.length;
3065
3083
  const allHidden = visibleCount === 0 && rowCount > 0;
3066
3084
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "gemina-verification__section", "aria-label": label, children: [
@@ -3073,6 +3091,7 @@ function TableSection(props) {
3073
3091
  needsReview > 0 ? ` \xB7 ${needsReview} need review` : "",
3074
3092
  ")"
3075
3093
  ] }),
3094
+ shared.filterOn && mutable !== void 0 && !shared.readOnly ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "gemina-verification__filter-note", children: "Row editing is off while filtering" }) : null,
3076
3095
  table.overallConfidence ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "gemina-verification__overall-confidence", children: [
3077
3096
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Overall confidence" }),
3078
3097
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ConfidenceDot, { confidence: table.overallConfidence })
@@ -3821,6 +3840,10 @@ var VERIFICATION_CSS = `
3821
3840
  font-size: 12px;
3822
3841
  color: var(--gemina-verification-muted);
3823
3842
  }
3843
+ .gemina-verification__filter-note {
3844
+ font-size: 12px;
3845
+ color: var(--gemina-verification-muted);
3846
+ }
3824
3847
  .gemina-verification__all-scored {
3825
3848
  margin: 0;
3826
3849
  padding: 12px;
@@ -4323,19 +4346,19 @@ function GeminaVerification(props) {
4323
4346
  return map;
4324
4347
  }, [bindings]);
4325
4348
  const unmatched = (0, import_react5.useMemo)(() => {
4326
- const rendered = /* @__PURE__ */ new Set();
4349
+ const rendered2 = /* @__PURE__ */ new Set();
4327
4350
  for (const field of classified.headers) {
4328
- rendered.add(field.pointer);
4351
+ rendered2.add(field.pointer);
4329
4352
  }
4330
4353
  for (const list of classified.simpleLists) {
4331
4354
  for (const item of list.items) {
4332
- rendered.add(item.pointer);
4355
+ rendered2.add(item.pointer);
4333
4356
  }
4334
4357
  }
4335
4358
  for (const entity of classified.entities) {
4336
4359
  for (const item of entity.items) {
4337
4360
  for (const cell of Object.values(item)) {
4338
- rendered.add(cell.pointer);
4361
+ rendered2.add(cell.pointer);
4339
4362
  }
4340
4363
  }
4341
4364
  }
@@ -4343,12 +4366,12 @@ function GeminaVerification(props) {
4343
4366
  for (const row of table.rows) {
4344
4367
  for (const [key, cell] of Object.entries(row)) {
4345
4368
  if (key !== ROW_META_KEY) {
4346
- rendered.add(cell.pointer);
4369
+ rendered2.add(cell.pointer);
4347
4370
  }
4348
4371
  }
4349
4372
  }
4350
4373
  }
4351
- return bindings.filter((binding) => !rendered.has(binding.fieldPointer));
4374
+ return bindings.filter((binding) => !rendered2.has(binding.fieldPointer));
4352
4375
  }, [classified, bindings]);
4353
4376
  const overlayRects = (0, import_react5.useMemo)(() => {
4354
4377
  const rects = [];
@@ -4513,28 +4536,33 @@ function GeminaVerification(props) {
4513
4536
  });
4514
4537
  }, []);
4515
4538
  const pairErrors = (0, import_react5.useMemo)(() => unitSizePairErrors(cellViews, edits), [cellViews, edits]);
4516
- const suppressed = (0, import_react5.useMemo)(
4517
- () => withEmptyMutableTables(classified, loaded?.rowMutableTables ?? []).suppressed,
4539
+ const rendered = (0, import_react5.useMemo)(
4540
+ () => withEmptyMutableTables(classified, loaded?.rowMutableTables ?? []),
4518
4541
  [classified, loaded?.rowMutableTables]
4519
4542
  );
4520
- const canFilter = (0, import_react5.useMemo)(() => hasAnyConfidence(classified), [classified]);
4543
+ const canFilter = (0, import_react5.useMemo)(
4544
+ () => hasAnyConfidence(classified, rendered.tables, plannedTables),
4545
+ [classified, rendered, plannedTables]
4546
+ );
4521
4547
  const hidden = (0, import_react5.useMemo)(
4522
4548
  () => filterOn && canFilter ? computeHidden({
4523
4549
  classified,
4550
+ tables: rendered.tables,
4524
4551
  plannedTables,
4525
4552
  cellViews,
4526
4553
  bindingIndex,
4527
4554
  edits,
4528
4555
  pairErrors,
4529
- suppressed
4556
+ suppressed: rendered.suppressed
4530
4557
  }) : NOTHING_HIDDEN,
4531
- [filterOn, canFilter, classified, plannedTables, cellViews, bindingIndex, edits, pairErrors, suppressed]
4558
+ [filterOn, canFilter, classified, rendered, plannedTables, cellViews, bindingIndex, edits, pairErrors]
4532
4559
  );
4533
4560
  const totalUnits = (0, import_react5.useMemo)(
4534
- () => countUnits(classified, plannedTables, suppressed) + unmatched.length,
4535
- [classified, plannedTables, suppressed, unmatched]
4561
+ () => countUnits(classified, rendered.tables, plannedTables, rendered.suppressed) + unmatched.length,
4562
+ [classified, rendered, plannedTables, unmatched]
4536
4563
  );
4537
4564
  const visibleUnits = totalUnits - hidden.fields.size - hidden.rows.size;
4565
+ const allClear = filterOn && totalUnits > 0 && visibleUnits === 0;
4538
4566
  const invalidCount = (0, import_react5.useMemo)(() => {
4539
4567
  const rowLevel = pairErrors.size;
4540
4568
  if (edits.size === 0) {
@@ -4695,7 +4723,7 @@ function GeminaVerification(props) {
4695
4723
  onImageExpired: handleImageExpired
4696
4724
  }
4697
4725
  ),
4698
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4726
+ allClear ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "gemina-verification__all-scored", role: "status", children: `Nothing needs review \u2014 all ${totalUnits} fields scored high.` }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4699
4727
  VerificationForm,
4700
4728
  {
4701
4729
  classified,