@ai-matrx/records-ui 0.116.74 → 0.116.75

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
@@ -188,7 +188,7 @@ import {
188
188
  withoutLeadingBlank,
189
189
  workedOutErrorFor,
190
190
  workedOutHoldsNumbers
191
- } from "./chunk-K5RXFZYC.js";
191
+ } from "./chunk-D2FZEAYO.js";
192
192
  import {
193
193
  CHART_PLOT_PX,
194
194
  EMBEDDED_ROW_PX,
@@ -299,7 +299,7 @@ import {
299
299
  visibilityLaneFor,
300
300
  whyNotAskable,
301
301
  writeOnTheWinningVersion_exports
302
- } from "./chunk-XLHEYH5J.js";
302
+ } from "./chunk-NDYZROTI.js";
303
303
  import {
304
304
  ACTION_CHECKING_ACCESS_REASON,
305
305
  ACTION_NOT_HERE_REASON,
@@ -412,7 +412,7 @@ import {
412
412
  useRowRights,
413
413
  useTableRights,
414
414
  withoutInternalCodes
415
- } from "./chunk-ZX4EFZSB.js";
415
+ } from "./chunk-HCPNQM4Y.js";
416
416
  import {
417
417
  FEWEST_KEY_VALUE_PAIRS,
418
418
  FEWEST_LIST_ITEMS,
@@ -2836,7 +2836,79 @@ import {
2836
2836
  cn as cn2
2837
2837
  } from "@ai-matrx/design-system";
2838
2838
  import { formatRelativeTime as formatRelativeTime2 } from "@ai-matrx/kit/format";
2839
+ import { humanizeIdentifier as humanizeIdentifier3 } from "@ai-matrx/kit/text-case";
2840
+
2841
+ // src/valueSource.ts
2842
+ import { isUuidShape } from "@ai-matrx/kit/uuid";
2843
+ import { humanizeIdentifier as humanizeIdentifier2 } from "@ai-matrx/kit/text-case";
2844
+ var ISO_MOMENT = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/;
2845
+ function readable(value) {
2846
+ if (typeof value !== "string") return null;
2847
+ const t = value.trim();
2848
+ if (!t || isUuidShape(t) || ISO_MOMENT.test(t)) return null;
2849
+ return t;
2850
+ }
2851
+ function sourceModelName(source) {
2852
+ if (!source) return null;
2853
+ return readable(source.model_name) ?? readable(source.model);
2854
+ }
2855
+ function readNames(read, nameOf) {
2856
+ if (!Array.isArray(read)) return [];
2857
+ const out = [];
2858
+ for (const item of read) {
2859
+ const key = typeof item === "string" ? item : item && typeof item === "object" ? item.field ?? item.key ?? item.url : null;
2860
+ if (typeof key !== "string" || !key.trim()) continue;
2861
+ if (/^https?:\/\//.test(key)) out.push(key);
2862
+ else if (!isUuidShape(key)) out.push(nameOf(key) ?? humanizeIdentifier2(key));
2863
+ }
2864
+ return [...new Set(out)];
2865
+ }
2866
+ function sourceWords(source, nameOf = () => void 0) {
2867
+ if (!source || typeof source !== "object") return null;
2868
+ const kind2 = typeof source.kind === "string" ? source.kind : null;
2869
+ if (kind2 === "enrichment" || kind2 === "agent" || kind2 === "ai") {
2870
+ const model = sourceModelName(source);
2871
+ const read = readNames(source.read, nameOf);
2872
+ const sure = typeof source.confidence === "number" ? `${Math.round(source.confidence * 100)}% sure` : null;
2873
+ const asked2 = readable(source.instruction);
2874
+ let s = `Filled in by ${model ? model : "a model"}`;
2875
+ if (read.length > 0) s += ` from ${read.join(", ")}`;
2876
+ if (sure) s += `, ${sure}`;
2877
+ s += ".";
2878
+ if (asked2) s += ` Asked: \u201C${asked2}\u201D`;
2879
+ return s;
2880
+ }
2881
+ if (kind2 === "import") {
2882
+ const file = readable(source.file) ?? readable(source.file_name) ?? readable(source.name);
2883
+ const format = readable(source.format);
2884
+ const row = typeof source.row === "number" ? `, row ${source.row}` : "";
2885
+ return `Imported from ${file ? `\u201C${file}\u201D` : format ? `a ${format.toUpperCase()} file` : "a file"}${row}.`;
2886
+ }
2887
+ if (kind2 === "form") return "Answered on a form.";
2888
+ if (kind2 === "capture") return "Captured on a device.";
2889
+ if (kind2 === "move") return "Moved here from an older table.";
2890
+ if (kind2 === "follow") return "Carried over when this record moved.";
2891
+ const note = readable(source.note);
2892
+ if (kind2) return `${humanizeIdentifier2(kind2)}${note ? `: ${note}` : ""}.`;
2893
+ return note;
2894
+ }
2895
+
2896
+ // src/Enrich.tsx
2839
2897
  import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
2898
+ function fillEstimateWords(args) {
2899
+ const each = args.perRowCents ?? args.previewPerRowCents;
2900
+ if (each !== null) {
2901
+ const total = costInPoints(each * args.count, args.rate);
2902
+ if (total !== null) return `about ${total}`;
2903
+ }
2904
+ if (args.estimate === "asking") return null;
2905
+ if (args.estimate && args.estimate.basis !== "none" && args.estimate.costCents !== null) {
2906
+ const total = costInPoints(args.estimate.costCents, args.rate);
2907
+ if (total !== null) return `about ${total}${args.estimate.extraReads ? " or more" : ""}`;
2908
+ }
2909
+ return "no estimate";
2910
+ }
2911
+ var FILL_OFF_REASON = "Switch it on to fill";
2840
2912
  var NO_ENRICH_REASON = "Having an agent fill this column is not switched on here yet, so this panel does not offer it rather than offering something that cannot happen. Everything else on this panel works. It is on our list, not yours.";
2841
2913
  function cellState(cell) {
2842
2914
  if (!cell || !cell.agent_owned) return "none";
@@ -2879,15 +2951,14 @@ function EnrichBadge({ cell, onPin, className }) {
2879
2951
  ago(cell.written_at),
2880
2952
  "."
2881
2953
  ] }) : null,
2882
- source.model ? /* @__PURE__ */ jsxs5("p", { className: "text-muted-foreground", children: [
2883
- String(source.model),
2884
- source.model_version ? ` (${String(source.model_version)})` : "",
2954
+ source.model || typeof source.confidence === "number" ? /* @__PURE__ */ jsxs5("p", { className: "text-muted-foreground", children: [
2955
+ sourceModelName(source) ?? "A model",
2885
2956
  typeof source.confidence === "number" ? ` \xB7 ${Math.round(source.confidence * 100)}% sure` : ""
2886
2957
  ] }) : null,
2887
2958
  source.note ? /* @__PURE__ */ jsx7("p", { className: "text-muted-foreground", children: String(source.note) }) : null,
2888
2959
  read.length > 0 ? /* @__PURE__ */ jsxs5("div", { children: [
2889
2960
  /* @__PURE__ */ jsx7("p", { className: "text-muted-foreground", children: "What it read" }),
2890
- /* @__PURE__ */ jsx7("ul", { className: "list-inside list-disc", children: read.slice(0, 4).map((r, i) => /* @__PURE__ */ jsx7("li", { className: "truncate", children: String(r.title ?? r.url ?? "") }, i)) })
2961
+ /* @__PURE__ */ jsx7("ul", { className: "list-inside list-disc", children: read.slice(0, 4).map((r, i) => /* @__PURE__ */ jsx7("li", { className: "truncate", children: r.title ? String(r.title) : /^https?:\/\//.test(String(r.url ?? "")) ? String(r.url) : humanizeIdentifier3(String(r.url ?? "")) }, i)) })
2891
2962
  ] }) : null,
2892
2963
  alternates.length > 0 ? /* @__PURE__ */ jsxs5("div", { children: [
2893
2964
  /* @__PURE__ */ jsx7("p", { className: "text-muted-foreground", children: state === "unsure" ? "What it considered" : "What it nearly said instead" }),
@@ -2965,6 +3036,8 @@ function EnrichPanel({ tableId, fieldId, className }) {
2965
3036
  const [preview, setPreview] = useState7(null);
2966
3037
  const [fillN, setFillN] = useState7({});
2967
3038
  const [confirming, setConfirming] = useState7(null);
3039
+ const [estimate, setEstimate] = useState7(null);
3040
+ const [previewCost, setPreviewCost] = useState7({});
2968
3041
  const [draft, setDraft] = useState7({});
2969
3042
  const load = useCallback4(async () => {
2970
3043
  const answered = await client.enrichments({ table_id: tableId });
@@ -3031,6 +3104,10 @@ function EnrichPanel({ tableId, fieldId, className }) {
3031
3104
  });
3032
3105
  setBusy(null);
3033
3106
  setOutcome({ ...answered, fieldId: row.field_id });
3107
+ const asked2 = answered.wouldWrite?.length ?? 0;
3108
+ if (previewOnly && answered.ok && typeof answered.costCents === "number" && answered.costCents > 0 && asked2 > 0) {
3109
+ setPreviewCost((prev) => ({ ...prev, [row.field_id]: answered.costCents / asked2 }));
3110
+ }
3034
3111
  if (!previewOnly) await load();
3035
3112
  },
3036
3113
  [host, load, tableId]
@@ -3039,12 +3116,17 @@ function EnrichPanel({ tableId, fieldId, className }) {
3039
3116
  (row, count) => {
3040
3117
  if (count > FILL_TRY_MAX) {
3041
3118
  setConfirming({ fieldId: row.field_id, count });
3119
+ if (row.cost_per_row_cents === null && previewCost[row.field_id] === void 0 && host.estimateFill) {
3120
+ const key = `${row.field_id}:${count}`;
3121
+ setEstimate({ key, value: "asking" });
3122
+ void host.estimateFill({ tableId, fieldId: row.field_id, rows: count }).then((value) => setEstimate((prev) => prev?.key === key ? { key, value } : prev)).catch(() => setEstimate((prev) => prev?.key === key ? { key, value: null } : prev));
3123
+ }
3042
3124
  return;
3043
3125
  }
3044
3126
  setConfirming(null);
3045
3127
  void runIt(row, false, count);
3046
3128
  },
3047
- [runIt]
3129
+ [runIt, previewCost, host, tableId]
3048
3130
  );
3049
3131
  if (error) return /* @__PURE__ */ jsx7(RefusalNotice, { error, className });
3050
3132
  if (rows === null) return /* @__PURE__ */ jsx7(Skeleton, { className: cn2("h-40 w-full", className) });
@@ -3315,6 +3397,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
3315
3397
  size: "sm",
3316
3398
  variant: "outline",
3317
3399
  disabled: busy === row.field_id || !row.enabled || fillCountFrom(fillN[row.field_id] ?? FILL_N_DEFAULT) === null,
3400
+ title: row.enabled ? void 0 : FILL_OFF_REASON,
3318
3401
  "data-enrich-fill-rows": "",
3319
3402
  onClick: () => {
3320
3403
  const n = fillCountFrom(fillN[row.field_id] ?? FILL_N_DEFAULT);
@@ -3332,6 +3415,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
3332
3415
  {
3333
3416
  size: "sm",
3334
3417
  disabled: busy === row.field_id || !row.enabled,
3418
+ title: row.enabled ? void 0 : FILL_OFF_REASON,
3335
3419
  "data-enrich-fill-due": "",
3336
3420
  onClick: () => startFill(row, dueRowsEstimate(row)),
3337
3421
  children: "Fill in what is due"
@@ -3339,13 +3423,37 @@ function EnrichPanel({ tableId, fieldId, className }) {
3339
3423
  )
3340
3424
  ] }) : null
3341
3425
  ] }) : null,
3426
+ rights.admin && host.enrich && !row.enabled ? (
3427
+ // WHY FILL IS GREY, said where it is (CD-AI-04): the column is off, and the one fix is right here.
3428
+ /* @__PURE__ */ jsxs5("p", { className: "flex items-center gap-2 text-xs text-muted-foreground", "data-enrich-fill-off": "", children: [
3429
+ FILL_OFF_REASON,
3430
+ /* @__PURE__ */ jsx7(
3431
+ Button5,
3432
+ {
3433
+ size: "sm",
3434
+ variant: "outline",
3435
+ className: "h-7",
3436
+ disabled: busy === row.field_id,
3437
+ "data-enrich-turn-on": "",
3438
+ onClick: () => void save(row, { enabled: true }),
3439
+ children: "Turn on"
3440
+ }
3441
+ )
3442
+ ] })
3443
+ ) : null,
3342
3444
  confirming && confirming.fieldId === row.field_id ? /* @__PURE__ */ jsxs5("div", { className: "space-y-2 rounded border p-2 text-xs", role: "alertdialog", "data-enrich-confirm": "", children: [
3343
3445
  /* @__PURE__ */ jsxs5("p", { children: [
3344
3446
  `Fill ${confirming.count} rows`,
3345
3447
  (() => {
3346
- const each = row.cost_per_row_cents === null ? null : Number(row.cost_per_row_cents);
3347
- const total = each === null ? null : costInPoints(each * confirming.count, host.pointsRate);
3348
- return total !== null ? ` \xB7 about ${total}` : " \xB7 no estimate yet, it has not run";
3448
+ const key = `${row.field_id}:${confirming.count}`;
3449
+ const words2 = fillEstimateWords({
3450
+ count: confirming.count,
3451
+ perRowCents: row.cost_per_row_cents === null ? null : Number(row.cost_per_row_cents),
3452
+ previewPerRowCents: previewCost[row.field_id] ?? null,
3453
+ estimate: estimate?.key === key ? estimate.value : null,
3454
+ rate: host.pointsRate
3455
+ });
3456
+ return words2 === null ? /* @__PURE__ */ jsx7(Skeleton, { className: "ml-1 inline-block h-3 w-16 align-middle" }) : ` \xB7 ${words2}`;
3349
3457
  })()
3350
3458
  ] }),
3351
3459
  /* @__PURE__ */ jsxs5("div", { className: "flex gap-2", children: [
@@ -8042,7 +8150,7 @@ import {
8042
8150
  } from "@ai-matrx/records/react";
8043
8151
  import { asWriteConflict as asWriteConflict2, predictWriteRefusals, wholeValueOf as wholeValueOf2 } from "@ai-matrx/records/core";
8044
8152
  import { Button as Button23, Separator as Separator2, cn as cn10 } from "@ai-matrx/design-system";
8045
- import { humanizeIdentifier as humanizeIdentifier2 } from "@ai-matrx/kit/text-case";
8153
+ import { humanizeIdentifier as humanizeIdentifier4 } from "@ai-matrx/kit/text-case";
8046
8154
 
8047
8155
  // src/StandardRecordForm.tsx
8048
8156
  import { useState as useState26 } from "react";
@@ -8830,7 +8938,7 @@ function CustomRecordForm({
8830
8938
  Object.entries(said.conflict.contested_fields).map(([key, theirs]) => {
8831
8939
  const column = (fields.data ?? []).find((f) => f.key === key);
8832
8940
  return /* @__PURE__ */ jsxs26("p", { className: "text-[11px]", children: [
8833
- column ? fieldName(column) : humanizeIdentifier2(key),
8941
+ column ? fieldName(column) : humanizeIdentifier4(key),
8834
8942
  ": yours",
8835
8943
  " ",
8836
8944
  /* @__PURE__ */ jsx28("strong", { children: asWords(draft[key]) }),
@@ -9748,7 +9856,7 @@ function defaultColumnWidth(field) {
9748
9856
  var BACK_LINK_COLUMN_PX = KIND_COLUMN_PX.relation;
9749
9857
 
9750
9858
  // src/gridColumns.tsx
9751
- import { humanizeIdentifier as humanizeIdentifier3 } from "@ai-matrx/kit/text-case";
9859
+ import { humanizeIdentifier as humanizeIdentifier5 } from "@ai-matrx/kit/text-case";
9752
9860
  import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
9753
9861
  function workedOutFrom(field) {
9754
9862
  const kind2 = editorKindFor(field);
@@ -9801,7 +9909,7 @@ function pasteOntoFieldsOnly(plan, fields) {
9801
9909
  }
9802
9910
  function columnLabel(fields, columnId2) {
9803
9911
  const field = fields.find((f) => f.key === columnId2);
9804
- return field ? fieldName(field) : humanizeIdentifier3(columnId2);
9912
+ return field ? fieldName(field) : humanizeIdentifier5(columnId2);
9805
9913
  }
9806
9914
  function AddFieldButton({ onClick }) {
9807
9915
  return /* @__PURE__ */ jsx30(
@@ -10478,7 +10586,7 @@ function withSubItems(columns, tree, collapsed, onToggle, onAddSubItem) {
10478
10586
  }
10479
10587
 
10480
10588
  // src/Grid.tsx
10481
- import { humanizeIdentifier as humanizeIdentifier5 } from "@ai-matrx/kit/text-case";
10589
+ import { humanizeIdentifier as humanizeIdentifier7 } from "@ai-matrx/kit/text-case";
10482
10590
 
10483
10591
  // src/PastePreview.tsx
10484
10592
  import { useState as useState32 } from "react";
@@ -10958,7 +11066,7 @@ import { readTypedDate, typedDateText } from "@ai-matrx/records";
10958
11066
  import { useRecordsClient as useRecordsClient30 } from "@ai-matrx/records/react";
10959
11067
  import { Button as Button28, Skeleton as Skeleton9, cn as cn13 } from "@ai-matrx/design-system";
10960
11068
  import { Button as ControlButton, Field as ControlField } from "@ai-matrx/design-system/controls";
10961
- import { humanizeIdentifier as humanizeIdentifier4 } from "@ai-matrx/kit/text-case";
11069
+ import { humanizeIdentifier as humanizeIdentifier6 } from "@ai-matrx/kit/text-case";
10962
11070
  import { Fragment as Fragment9, jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
10963
11071
  function endOfDayIso(day2, zone = getPersonTimeZone()) {
10964
11072
  const [y, m, d] = day2.split("-").map(Number);
@@ -11102,7 +11210,7 @@ function AsOfReading({
11102
11210
  ] });
11103
11211
  }
11104
11212
  return /* @__PURE__ */ jsx35("dl", { className: cn13(box, "grid grid-cols-[minmax(5rem,9rem)_1fr] content-start gap-x-3 gap-y-0.5 p-2 text-[11px]"), "data-records-as-of-reading": "", children: rows.map(({ field, was, now, differs }) => /* @__PURE__ */ jsxs33("div", { className: "contents", "data-as-of-field": field.key, "data-as-of-differs": differs ? "" : void 0, children: [
11105
- /* @__PURE__ */ jsx35("dt", { className: "truncate text-muted-foreground", title: fieldName(field) || humanizeIdentifier4(field.key), children: fieldName(field) || humanizeIdentifier4(field.key) }),
11213
+ /* @__PURE__ */ jsx35("dt", { className: "truncate text-muted-foreground", title: fieldName(field) || humanizeIdentifier6(field.key), children: fieldName(field) || humanizeIdentifier6(field.key) }),
11106
11214
  /* @__PURE__ */ jsx35("dd", { className: cn13("min-w-0 truncate", differs && "rounded bg-amber-500/10 px-1"), children: differs ? /* @__PURE__ */ jsxs33(Fragment9, { children: [
11107
11215
  /* @__PURE__ */ jsx35("span", { className: "font-medium", children: isEmpty2(was) ? "nothing" : scalarText(field, was) }),
11108
11216
  /* @__PURE__ */ jsx35("span", { className: "mx-1 text-muted-foreground", children: "\u2192" }),
@@ -11368,6 +11476,7 @@ function withNewRowValues(preset, data) {
11368
11476
  // src/loadAll.tsx
11369
11477
  import { useCallback as useCallback16, useEffect as useEffect30, useRef as useRef14, useState as useState37 } from "react";
11370
11478
  import { Button as Button31 } from "@ai-matrx/design-system";
11479
+ import { formatCount as formatCount3 } from "@ai-matrx/kit/format";
11371
11480
  import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
11372
11481
  var LOAD_ALL_AFTER = 1e3;
11373
11482
  var LOAD_ALL_CHUNK = 500;
@@ -11424,17 +11533,17 @@ function LoadAllLine({
11424
11533
  onLoad,
11425
11534
  onBack
11426
11535
  }) {
11427
- const n = total.toLocaleString();
11536
+ const n = formatCount3(total);
11428
11537
  return /* @__PURE__ */ jsx40("div", { className: "flex items-center gap-2 px-2 py-1 text-xs text-muted-foreground", "data-records-load-all": "", children: state.rows ? /* @__PURE__ */ jsxs36(Fragment13, { children: [
11429
11538
  /* @__PURE__ */ jsxs36("span", { role: "status", children: [
11430
11539
  "All ",
11431
- state.rows.length.toLocaleString(),
11540
+ formatCount3(state.rows.length),
11432
11541
  " loaded"
11433
11542
  ] }),
11434
11543
  /* @__PURE__ */ jsx40(Button31, { size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: onBack, "data-records-load-all-back": "", children: "Back to pages" })
11435
11544
  ] }) : state.loading ? /* @__PURE__ */ jsxs36("span", { role: "status", "data-records-load-all-progress": "", children: [
11436
11545
  "Loading ",
11437
- state.loaded.toLocaleString(),
11546
+ formatCount3(state.loaded),
11438
11547
  " of ",
11439
11548
  n
11440
11549
  ] }) : /* @__PURE__ */ jsxs36(Fragment13, { children: [
@@ -13531,7 +13640,7 @@ function GridBody({
13531
13640
  const field = (fields.data ?? []).find((f) => f.key === write.key);
13532
13641
  const name = changedRecordName(table.data, rows.find((r) => r.id === write.rowId)?.document ?? {}, write.key, write.after);
13533
13642
  undo.push({
13534
- label: `Changed ${field ? fieldName(field) : humanizeIdentifier5(write.key)} on ${name}`,
13643
+ label: `Changed ${field ? fieldName(field) : humanizeIdentifier7(write.key)} on ${name}`,
13535
13644
  cells: [{ rowId: write.rowId, key: write.key, before: write.before ?? null, after: write.after ?? null, version: write.version }]
13536
13645
  });
13537
13646
  rowMove.noteWrite(write.rowId, write.key);
@@ -14862,7 +14971,7 @@ function GridBody({
14862
14971
  key: sortedKeys[0],
14863
14972
  name: (() => {
14864
14973
  const first = (toolbarFields ?? []).find((f) => f.key === sortedKeys[0]);
14865
- return first ? fieldName(first) : humanizeIdentifier5(sortedKeys[0]);
14974
+ return first ? fieldName(first) : humanizeIdentifier7(sortedKeys[0]);
14866
14975
  })()
14867
14976
  } : null,
14868
14977
  onChange: changeLayout,
@@ -15024,7 +15133,7 @@ function GridBody({
15024
15133
  const labelOfField = useCallback22(
15025
15134
  (key) => {
15026
15135
  const held = (fields.data ?? []).find((f) => f.key === key);
15027
- return held ? fieldName(held) : humanizeIdentifier5(key);
15136
+ return held ? fieldName(held) : humanizeIdentifier7(key);
15028
15137
  },
15029
15138
  [fields.data]
15030
15139
  );
@@ -15686,7 +15795,7 @@ import { Button as Button43, Separator as Separator5, Skeleton as Skeleton13, cn
15686
15795
  // src/recordInPlace.tsx
15687
15796
  import { useMemo as useMemo31, useRef as useRef22 } from "react";
15688
15797
  import { useRecordsClient as useRecordsClient40, useTable as useTable11 } from "@ai-matrx/records/react";
15689
- import { humanizeIdentifier as humanizeIdentifier6 } from "@ai-matrx/kit/text-case";
15798
+ import { humanizeIdentifier as humanizeIdentifier8 } from "@ai-matrx/kit/text-case";
15690
15799
  import { jsx as jsx51, jsxs as jsxs45 } from "react/jsx-runtime";
15691
15800
  function RecordFieldsInPlace({
15692
15801
  tableId,
@@ -15730,7 +15839,7 @@ function RecordFieldsInPlace({
15730
15839
  const field = fields.find((f) => f.key === write.key);
15731
15840
  const name = table.data && document2 ? recordNameIn(table.data, document2) : "this record";
15732
15841
  undo.push({
15733
- label: `Changed ${field ? fieldName(field) : humanizeIdentifier6(write.key)} on ${name || "this record"}`,
15842
+ label: `Changed ${field ? fieldName(field) : humanizeIdentifier8(write.key)} on ${name || "this record"}`,
15734
15843
  cells: [{ rowId: write.rowId, key: write.key, before: write.before ?? null, after: write.after ?? null, version: write.version }]
15735
15844
  });
15736
15845
  };
@@ -15783,10 +15892,10 @@ function RecordFieldsInPlace({
15783
15892
  import { useState as useState47 } from "react";
15784
15893
  import { chooseAlternate } from "@ai-matrx/records";
15785
15894
  import { useRecordsClient as useRecordsClient41 } from "@ai-matrx/records/react";
15786
- import { humanizeIdentifier as humanizeIdentifier7 } from "@ai-matrx/kit/text-case";
15895
+ import { humanizeIdentifier as humanizeIdentifier9 } from "@ai-matrx/kit/text-case";
15787
15896
  import { Button as Button38, Popover as Popover6, PopoverContent as PopoverContent6, PopoverTrigger as PopoverTrigger6, Skeleton as Skeleton11 } from "@ai-matrx/design-system";
15788
15897
  import { jsx as jsx52, jsxs as jsxs46 } from "react/jsx-runtime";
15789
- function sourceWords(document2, pointer) {
15898
+ function sourceWords2(document2, pointer) {
15790
15899
  if (!pointer) return null;
15791
15900
  const source = document2?._sources?.[pointer];
15792
15901
  if (!source) return null;
@@ -15799,7 +15908,7 @@ function sourceObjectWords(source) {
15799
15908
  if (typeof named === "string" && named !== "") return named;
15800
15909
  const kind2 = source["kind"];
15801
15910
  if (kind2 === "record") return "Merged record";
15802
- return typeof kind2 === "string" && kind2 !== "" ? humanizeIdentifier7(kind2) : null;
15911
+ return typeof kind2 === "string" && kind2 !== "" ? humanizeIdentifier9(kind2) : null;
15803
15912
  }
15804
15913
  function shown2(field, value) {
15805
15914
  return value === null || value === void 0 || value === "" ? "nothing" : scalarText(field, value);
@@ -15844,7 +15953,7 @@ function ValueAlternates({
15844
15953
  onChosen();
15845
15954
  }
15846
15955
  const actor = read?.actor;
15847
- const currentFrom = sourceWords(document2, envelope?.src) ?? sourceObjectWords(read?.source) ?? (typeof actor === "string" ? actor : null);
15956
+ const currentFrom = sourceWords2(document2, envelope?.src) ?? sourceObjectWords(read?.source) ?? (typeof actor === "string" ? actor : null);
15848
15957
  return /* @__PURE__ */ jsxs46(Popover6, { open, onOpenChange: (next) => void opened(next), children: [
15849
15958
  /* @__PURE__ */ jsx52(PopoverTrigger6, { asChild: true, children: /* @__PURE__ */ jsx52(
15850
15959
  "button",
@@ -15867,7 +15976,7 @@ function ValueAlternates({
15867
15976
  /* @__PURE__ */ jsxs46("span", { className: "flex min-w-0 flex-1 flex-col", children: [
15868
15977
  /* @__PURE__ */ jsx52("span", { className: "truncate font-medium", children: shown2(field, alt.value) }),
15869
15978
  /* @__PURE__ */ jsxs46("span", { className: "truncate text-[11px] text-muted-foreground", children: [
15870
- sourceWords(document2, alt.src) ?? sourceObjectWords(alt.source) ?? "Unknown source",
15979
+ sourceWords2(document2, alt.src) ?? sourceObjectWords(alt.source) ?? "Unknown source",
15871
15980
  " \xB7 rank ",
15872
15981
  alt.rank
15873
15982
  ] })
@@ -16366,7 +16475,7 @@ function AddBody({ tableId }) {
16366
16475
  }
16367
16476
 
16368
16477
  // src/Peek.tsx
16369
- import { humanizeIdentifier as humanizeIdentifier8 } from "@ai-matrx/kit/text-case";
16478
+ import { humanizeIdentifier as humanizeIdentifier10 } from "@ai-matrx/kit/text-case";
16370
16479
  import { momentZoneOptions } from "@ai-matrx/design-system/field-formats";
16371
16480
  import { Fragment as Fragment19, jsx as jsx57, jsxs as jsxs51 } from "react/jsx-runtime";
16372
16481
  function drawnBelowOnPage(field, bodyKey) {
@@ -16541,7 +16650,7 @@ function computedLinesWorthShowing(rows, document2) {
16541
16650
  );
16542
16651
  }
16543
16652
  function computedInPlainWords(row, field) {
16544
- const name = field ? fieldName(field) : humanizeIdentifier8(row.field_key);
16653
+ const name = field ? fieldName(field) : humanizeIdentifier10(row.field_key);
16545
16654
  const shown4 = row.value === null || row.value === void 0 || row.value === "" ? "nothing" : field ? scalarText(field, row.value) : String(row.value);
16546
16655
  const when = new Date(row.computed_at);
16547
16656
  const at = Number.isNaN(when.getTime()) ? "" : ` on ${when.toLocaleDateString(void 0, momentZoneOptions(when))}`;
@@ -16636,7 +16745,7 @@ function RecordStepper({ neighbors, onStep, expanded, onToggleExpand, full, onTo
16636
16745
  }
16637
16746
 
16638
16747
  // src/HistoryPanel.tsx
16639
- import { isUuidShape } from "@ai-matrx/kit/uuid";
16748
+ import { isUuidShape as isUuidShape2 } from "@ai-matrx/kit/uuid";
16640
16749
  import { useCallback as useCallback25, useEffect as useEffect45, useRef as useRef24, useState as useState54 } from "react";
16641
16750
 
16642
16751
  // src/undoChange.ts
@@ -16682,13 +16791,13 @@ import {
16682
16791
  } from "@ai-matrx/records/react";
16683
16792
  import { Badge as Badge4, Button as Button46, Skeleton as Skeleton14, cn as cn21 } from "@ai-matrx/design-system";
16684
16793
  import { formatRelativeTime as formatRelativeTime3 } from "@ai-matrx/kit/format";
16685
- import { humanizeIdentifier as humanizeIdentifier10 } from "@ai-matrx/kit/text-case";
16794
+ import { humanizeIdentifier as humanizeIdentifier12 } from "@ai-matrx/kit/text-case";
16686
16795
 
16687
16796
  // src/MigrationLog.tsx
16688
16797
  import { useCallback as useCallback24, useEffect as useEffect44, useState as useState53 } from "react";
16689
16798
  import { useRecordsClient as useRecordsClient46 } from "@ai-matrx/records/react";
16690
16799
  import { Button as Button45, cn as cn20 } from "@ai-matrx/design-system";
16691
- import { humanizeIdentifier as humanizeIdentifier9 } from "@ai-matrx/kit/text-case";
16800
+ import { humanizeIdentifier as humanizeIdentifier11 } from "@ai-matrx/kit/text-case";
16692
16801
  import { jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
16693
16802
  var MAKES_A_RECORD = /* @__PURE__ */ new Set(["split", "extract_parent", "extract"]);
16694
16803
  var VERB_WORDS = {
@@ -16703,7 +16812,7 @@ var VERB_WORDS = {
16703
16812
  delete: "Removed"
16704
16813
  };
16705
16814
  function migrationWords(verb) {
16706
- return VERB_WORDS[verb] ?? humanizeIdentifier9(verb);
16815
+ return VERB_WORDS[verb] ?? humanizeIdentifier11(verb);
16707
16816
  }
16708
16817
  function useMigrationLog(recordId) {
16709
16818
  const client = useRecordsClient46();
@@ -17056,6 +17165,7 @@ function VersionRow({
17056
17165
  {
17057
17166
  change,
17058
17167
  field: byKey.get(change.key),
17168
+ nameOf: (key) => byKey.get(key)?.name ?? byKey.get(key)?.label,
17059
17169
  canRestore: canUndo,
17060
17170
  onRestore: () => onUndo(change.key),
17061
17171
  ...onAskAboutField ? { onAskAboutField } : {}
@@ -17127,11 +17237,12 @@ function ChangeLine({
17127
17237
  field,
17128
17238
  canRestore,
17129
17239
  onRestore,
17130
- onAskAboutField
17240
+ onAskAboutField,
17241
+ nameOf
17131
17242
  }) {
17132
17243
  usePeopleTick();
17133
17244
  return /* @__PURE__ */ jsxs54("li", { "data-change-key": change.key, className: "flex items-baseline gap-2 text-[11px]", children: [
17134
- /* @__PURE__ */ jsx60("span", { className: "w-24 shrink-0 truncate font-medium", title: change.label, children: change.label || humanizeIdentifier10(change.key) }),
17245
+ /* @__PURE__ */ jsx60("span", { className: "w-24 shrink-0 truncate font-medium", title: change.label, children: change.label || humanizeIdentifier12(change.key) }),
17135
17246
  /* @__PURE__ */ jsxs54("span", { className: "min-w-0 flex-1 truncate", children: [
17136
17247
  /* @__PURE__ */ jsx60("span", { className: "text-muted-foreground line-through", children: say(change.before, field) }),
17137
17248
  /* @__PURE__ */ jsx60("span", { className: "mx-1 text-muted-foreground", children: "\u2192" }),
@@ -17141,14 +17252,7 @@ function ChangeLine({
17141
17252
  "rule v",
17142
17253
  change.rule.rule_version
17143
17254
  ] }) : null,
17144
- change.source ? /* @__PURE__ */ jsx60(
17145
- "span",
17146
- {
17147
- className: "shrink-0 text-muted-foreground",
17148
- title: Object.entries(change.source).map(([k, v]) => `${humanizeIdentifier10(k)}: ${String(v)}`).join(" \xB7 "),
17149
- children: "evidence"
17150
- }
17151
- ) : null,
17255
+ change.source && sourceWords(change.source, nameOf) ? /* @__PURE__ */ jsx60("span", { className: "shrink-0 text-muted-foreground", title: sourceWords(change.source, nameOf) ?? void 0, "data-change-source": "", children: "evidence" }) : null,
17152
17256
  onAskAboutField ? /* @__PURE__ */ jsx60(
17153
17257
  Button46,
17154
17258
  {
@@ -17265,7 +17369,7 @@ function whenText(at) {
17265
17369
  function say(value, field) {
17266
17370
  if (value === null || value === void 0 || value === "") return "nothing";
17267
17371
  if (field) return scalarText(field, value);
17268
- const ids = (Array.isArray(value) ? value : [value]).filter(isUuidShape);
17372
+ const ids = (Array.isArray(value) ? value : [value]).filter(isUuidShape2);
17269
17373
  if (ids.length > 0 && ids.length === (Array.isArray(value) ? value.length : 1)) {
17270
17374
  return ids.map((id) => knownPerson(id) ?? PERSON_NOT_IN_ORGANIZATION).join(", ");
17271
17375
  }
@@ -17338,7 +17442,7 @@ function FormulaHistoryList({ recordId, fieldKey, label, onClose, className }) {
17338
17442
  }
17339
17443
 
17340
17444
  // src/FieldHistoryPanel.tsx
17341
- import { humanizeIdentifier as humanizeIdentifier11 } from "@ai-matrx/kit/text-case";
17445
+ import { humanizeIdentifier as humanizeIdentifier13 } from "@ai-matrx/kit/text-case";
17342
17446
  import { Fragment as Fragment21, jsx as jsx62, jsxs as jsxs56 } from "react/jsx-runtime";
17343
17447
  var COMPUTED_FIELD_TYPES = /* @__PURE__ */ new Set(["formula", "rollup", "lookup"]);
17344
17448
  function FieldHistoryPanel(props) {
@@ -17350,7 +17454,7 @@ function FieldHistoryPanel(props) {
17350
17454
  {
17351
17455
  recordId: props.recordId,
17352
17456
  fieldKey: props.fieldKey,
17353
- label: field.label || humanizeIdentifier11(props.fieldKey),
17457
+ label: field.label || humanizeIdentifier13(props.fieldKey),
17354
17458
  onClose: props.onClose,
17355
17459
  className: props.className
17356
17460
  }
@@ -17391,7 +17495,7 @@ function FieldValueHistory({
17391
17495
  useEffect47(() => {
17392
17496
  void load();
17393
17497
  }, [load]);
17394
- const label = (fields.data ?? []).find((f) => f.key === fieldKey)?.label || humanizeIdentifier11(fieldKey);
17498
+ const label = (fields.data ?? []).find((f) => f.key === fieldKey)?.label || humanizeIdentifier13(fieldKey);
17395
17499
  if (error) return /* @__PURE__ */ jsx62(RefusalNotice, { error, className });
17396
17500
  if (!rows || fields.loading && !fields.data || table.loading && !table.data) return /* @__PURE__ */ jsx62(Skeleton16, { className: cn23("h-40 w-full", className) });
17397
17501
  async function start(row, back = false) {
@@ -17524,7 +17628,7 @@ import { useCallback as useCallback28, useEffect as useEffect48, useMemo as useM
17524
17628
  import { useRecordsClient as useRecordsClient50, useTable as useTable17 } from "@ai-matrx/records/react";
17525
17629
  import { Badge as Badge7, BasicInput as BasicInput6, BasicTextarea as BasicTextarea4, Button as Button49, Skeleton as Skeleton17, cn as cn24 } from "@ai-matrx/design-system";
17526
17630
  import { Select as Select3 } from "@ai-matrx/design-system/controls";
17527
- import { humanizeIdentifier as humanizeIdentifier12 } from "@ai-matrx/kit/text-case";
17631
+ import { humanizeIdentifier as humanizeIdentifier14 } from "@ai-matrx/kit/text-case";
17528
17632
  import { Fragment as Fragment22, jsx as jsx63, jsxs as jsxs57 } from "react/jsx-runtime";
17529
17633
  var DUE_WORD = DUE_STATE_LABEL;
17530
17634
  var REQUIRES_WORD = CHECKLIST_REQUIREMENT_LABEL;
@@ -17757,7 +17861,7 @@ function StepRow({
17757
17861
  /* @__PURE__ */ jsxs57("div", { className: "flex items-center gap-2", children: [
17758
17862
  /* @__PURE__ */ jsx63("span", { className: "w-5 shrink-0 text-right text-[11px] tabular-nums text-muted-foreground", children: step2.step_order }),
17759
17863
  /* @__PURE__ */ jsx63("span", { className: cn24("min-w-0 flex-1 truncate text-xs", step2.finished && "line-through"), children: step2.title }),
17760
- step2.role ? /* @__PURE__ */ jsx63(Badge7, { variant: "outline", className: "text-[10px]", children: step2.assignee_name ?? humanizeIdentifier12(step2.role) }) : null,
17864
+ step2.role ? /* @__PURE__ */ jsx63(Badge7, { variant: "outline", className: "text-[10px]", children: step2.assignee_name ?? humanizeIdentifier14(step2.role) }) : null,
17761
17865
  step2.due_state && step2.due_state !== "undated" ? /* @__PURE__ */ jsx63(
17762
17866
  Badge7,
17763
17867
  {
@@ -18318,7 +18422,7 @@ function roleKey(said) {
18318
18422
  }
18319
18423
 
18320
18424
  // src/CommentThread.tsx
18321
- import { isUuidShape as isUuidShape2 } from "@ai-matrx/kit/uuid";
18425
+ import { isUuidShape as isUuidShape3 } from "@ai-matrx/kit/uuid";
18322
18426
  import { useCallback as useCallback29, useEffect as useEffect49, useMemo as useMemo33, useRef as useRef26, useState as useState58 } from "react";
18323
18427
  import {
18324
18428
  useFields as useFields15,
@@ -18326,7 +18430,7 @@ import {
18326
18430
  useTable as useTable18
18327
18431
  } from "@ai-matrx/records/react";
18328
18432
  import { Badge as Badge8, Button as Button50, Skeleton as Skeleton18, Textarea as Textarea3, cn as cn25 } from "@ai-matrx/design-system";
18329
- import { humanizeIdentifier as humanizeIdentifier13 } from "@ai-matrx/kit/text-case";
18433
+ import { humanizeIdentifier as humanizeIdentifier15 } from "@ai-matrx/kit/text-case";
18330
18434
  import { jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
18331
18435
  function CommentThread({ tableId, recordId, fieldKey, className }) {
18332
18436
  const client = useRecordsClient51();
@@ -18387,7 +18491,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
18387
18491
  const shown4 = fieldKey ? thread.comments.filter((c) => c.field_key === fieldKey) : thread.comments;
18388
18492
  const roots = shown4.filter((c) => !c.parent_comment_id);
18389
18493
  const repliesOf = (id) => shown4.filter((c) => c.parent_comment_id === id);
18390
- const fieldLabel = fieldKey ? (fields.data ?? []).find((f) => f.key === fieldKey)?.label || humanizeIdentifier13(fieldKey) : null;
18494
+ const fieldLabel = fieldKey ? (fields.data ?? []).find((f) => f.key === fieldKey)?.label || humanizeIdentifier15(fieldKey) : null;
18391
18495
  async function post() {
18392
18496
  if (draft.trim() === "") return;
18393
18497
  setBusy(true);
@@ -18539,7 +18643,7 @@ function Line({
18539
18643
  onReply,
18540
18644
  onResolve
18541
18645
  }) {
18542
- const about = comment.field_key ? fields.find((f) => f.key === comment.field_key)?.label || humanizeIdentifier13(comment.field_key) : null;
18646
+ const about = comment.field_key ? fields.find((f) => f.key === comment.field_key)?.label || humanizeIdentifier15(comment.field_key) : null;
18543
18647
  return /* @__PURE__ */ jsxs58("div", { className: "flex flex-col gap-0.5", children: [
18544
18648
  /* @__PURE__ */ jsxs58("div", { className: "flex items-baseline gap-2 text-[11px] text-muted-foreground", children: [
18545
18649
  /* @__PURE__ */ jsx64("span", { className: "truncate font-medium text-foreground", children: comment.created_by_name }),
@@ -18557,7 +18661,7 @@ function Line({
18557
18661
  /* @__PURE__ */ jsx64("p", { className: "whitespace-pre-wrap text-xs", children: comment.body }),
18558
18662
  comment.mentions.length > 0 ? /* @__PURE__ */ jsxs58("p", { className: "text-[10px] text-muted-foreground", children: [
18559
18663
  "Told: ",
18560
- comment.mentions.map((m) => isUuidShape2(m.name) ? PERSON_NOT_IN_ORGANIZATION : m.name).join(", ")
18664
+ comment.mentions.map((m) => isUuidShape3(m.name) ? PERSON_NOT_IN_ORGANIZATION : m.name).join(", ")
18561
18665
  ] }) : null
18562
18666
  ] });
18563
18667
  }
@@ -19029,7 +19133,7 @@ import { useFields as useFields18, useRecords as useRecords4, useRecordsClient a
19029
19133
  import { withWholeValues } from "@ai-matrx/records/core";
19030
19134
 
19031
19135
  // src/viewExport.ts
19032
- import { formatCount as formatCount3 } from "@ai-matrx/kit/format";
19136
+ import { formatCount as formatCount4 } from "@ai-matrx/kit/format";
19033
19137
  var VIEW_EXPORT_PAGE = 500;
19034
19138
  var VIEW_EXPORT_CEILING = 5e3;
19035
19139
  function viewColumns(fields, presentation) {
@@ -19076,7 +19180,7 @@ async function readViewRows(client, tableId, fields, view, ceiling = VIEW_EXPORT
19076
19180
  }
19077
19181
  }
19078
19182
  function cutWords(written) {
19079
- return `First ${formatCount3(written, { locale: "en-US" })} rows only`;
19183
+ return `First ${formatCount4(written, { locale: "en-US" })} rows only`;
19080
19184
  }
19081
19185
 
19082
19186
  // src/ExportMenu.tsx
@@ -20980,7 +21084,7 @@ import {
20980
21084
  resolveRowColor as resolveRowColor4,
20981
21085
  ROW_TINT_CLASS as ROW_TINT_CLASS3
20982
21086
  } from "@ai-matrx/design-system/data-table";
20983
- import { formatCount as formatCount5 } from "@ai-matrx/kit/format";
21087
+ import { formatCount as formatCount7 } from "@ai-matrx/kit/format";
20984
21088
 
20985
21089
  // src/recordMoves.tsx
20986
21090
  import { useCallback as useCallback36, useEffect as useEffect65, useMemo as useMemo41, useRef as useRef31, useState as useState76 } from "react";
@@ -24889,7 +24993,7 @@ import {
24889
24993
  } from "@ai-matrx/records";
24890
24994
  import { mapPgError as mapPgError2 } from "@ai-matrx/records/core";
24891
24995
  import { cn as cn39 } from "@ai-matrx/design-system";
24892
- import { formatCount as formatCount4 } from "@ai-matrx/kit/format";
24996
+ import { formatCount as formatCount5 } from "@ai-matrx/kit/format";
24893
24997
 
24894
24998
  // src/linkWords.ts
24895
24999
  import { useEffect as useEffect72, useMemo as useMemo48, useState as useState83 } from "react";
@@ -25202,18 +25306,18 @@ function useLinkGroupNamer(block, tableId) {
25202
25306
  // src/measureWords.ts
25203
25307
  import { useEffect as useEffect73, useState as useState84 } from "react";
25204
25308
  import { useOptionalRecordsClient as useOptionalRecordsClient7 } from "@ai-matrx/records/react";
25205
- import { humanizeIdentifier as humanizeIdentifier14 } from "@ai-matrx/kit/text-case";
25309
+ import { humanizeIdentifier as humanizeIdentifier16 } from "@ai-matrx/kit/text-case";
25206
25310
  var OP_WORD = { sum: "Total", avg: "Average", min: "Lowest", max: "Highest" };
25207
25311
  function measureWords(key, fields) {
25208
25312
  if (key === "count") return "How many";
25209
25313
  const at = key.indexOf("_");
25210
- if (at < 0) return humanizeIdentifier14(key);
25314
+ if (at < 0) return humanizeIdentifier16(key);
25211
25315
  const op = key.slice(0, at);
25212
25316
  const column = key.slice(at + 1);
25213
25317
  const field = fields?.find((f) => f.key === column);
25214
- const name = field ? fieldName(field) : humanizeIdentifier14(column);
25318
+ const name = field ? fieldName(field) : humanizeIdentifier16(column);
25215
25319
  const word = OP_WORD[op];
25216
- return word ? `${word} ${name.charAt(0).toLowerCase()}${name.slice(1)}` : `${humanizeIdentifier14(op)} ${name}`;
25320
+ return word ? `${word} ${name.charAt(0).toLowerCase()}${name.slice(1)}` : `${humanizeIdentifier16(op)} ${name}`;
25217
25321
  }
25218
25322
  function useMeasureFields(key, tableId) {
25219
25323
  const client = useOptionalRecordsClient7();
@@ -25639,7 +25743,7 @@ function BigNumber({
25639
25743
  /* @__PURE__ */ jsx93("span", { className: "text-2xl font-semibold tabular-nums", children: total === null ? "\u2013" : pretty2(total) }),
25640
25744
  windows ? /* @__PURE__ */ jsx93(Trend, { pct: block.totals?.change_pct, aimingUp: !!target, className: "text-sm" }) : null
25641
25745
  ] }),
25642
- /* @__PURE__ */ jsx93("span", { className: "text-xs text-muted-foreground", children: windows && typeof priorTotal === "number" ? `${windowName(windows.window, windows.period)} \xB7 ${pretty2(priorTotal)} in ${windowName(windows.prior_window, windows.period)}` : `from ${formatCount4(records)} ${records === 1 ? "record" : "records"}` })
25746
+ /* @__PURE__ */ jsx93("span", { className: "text-xs text-muted-foreground", children: windows && typeof priorTotal === "number" ? `${windowName(windows.window, windows.period)} \xB7 ${pretty2(priorTotal)} in ${windowName(windows.prior_window, windows.period)}` : `from ${formatCount5(records)} ${records === 1 ? "record" : "records"}` })
25643
25747
  ] });
25644
25748
  const ring = target && typeof target.progress === "number" && typeof target.value === "number" ? /* @__PURE__ */ jsxs85("span", { className: "ml-auto flex shrink-0 items-center gap-2", children: [
25645
25749
  /* @__PURE__ */ jsxs85("span", { className: "text-right text-xs text-muted-foreground", children: [
@@ -25766,7 +25870,7 @@ var DONUT_LEGEND_MAX_PX = 264;
25766
25870
  function compactTickPlain(value) {
25767
25871
  if (typeof value !== "number" || !Number.isFinite(value)) return String(value ?? "");
25768
25872
  if (Math.abs(value) < 1e3 && !Number.isInteger(value)) return String(Math.round(value * 10) / 10);
25769
- return formatCount4(value, { style: "compact" });
25873
+ return formatCount5(value, { style: "compact" });
25770
25874
  }
25771
25875
  function wrapTickWords(label, perLine, maxLines = 3) {
25772
25876
  const words2 = label.split(/\s+/).filter(Boolean).map((w) => w.length > perLine ? `${w.slice(0, perLine - 1)}\u2026` : w);
@@ -26369,6 +26473,7 @@ import { useRecordsClient as useRecordsClient71 } from "@ai-matrx/records/react"
26369
26473
  import { measureKey as measureKey6 } from "@ai-matrx/records";
26370
26474
  import { Select as Select9, SelectContent as SelectContent7, SelectItem as SelectItem7, SelectTrigger as SelectTrigger7, SelectValue as SelectValue7, cn as cn40 } from "@ai-matrx/design-system";
26371
26475
  import { Skeleton as Skeleton22 } from "@ai-matrx/design-system/skeleton";
26476
+ import { formatCount as formatCount6 } from "@ai-matrx/kit/format";
26372
26477
  import { Fragment as Fragment36, jsx as jsx95, jsxs as jsxs87 } from "react/jsx-runtime";
26373
26478
  var PIVOT_BOX = "min-h-[16rem]";
26374
26479
  function defaultPivotRows(fields) {
@@ -26538,7 +26643,7 @@ function PivotLayout({ view, fields, filter, onChange, remembered }) {
26538
26643
  ] }) }),
26539
26644
  table.cut ? /* @__PURE__ */ jsxs87("p", { className: "text-xs text-muted-foreground", "data-records-pivot-cut": "", children: [
26540
26645
  "First ",
26541
- PIVOT_CELL_LIMIT.toLocaleString(),
26646
+ formatCount6(PIVOT_CELL_LIMIT),
26542
26647
  " cells only. Narrow the filter to see the rest."
26543
26648
  ] }) : null
26544
26649
  ] })
@@ -27924,9 +28029,9 @@ function ViewPager({ shown: shown4, total, locked = 0, onMore, step: step2 }) {
27924
28029
  return /* @__PURE__ */ jsxs90("p", { className: "flex items-center gap-2 text-xs text-muted-foreground", "data-view-pager": "", children: [
27925
28030
  /* @__PURE__ */ jsxs90("span", { children: [
27926
28031
  "Showing ",
27927
- formatCount5(shown4),
28032
+ formatCount7(shown4),
27928
28033
  " of ",
27929
- formatCount5(total),
28034
+ formatCount7(total),
27930
28035
  " records."
27931
28036
  ] }),
27932
28037
  /* @__PURE__ */ jsxs90(Button71, { size: "sm", variant: "outline", onClick: onMore, children: [
@@ -33019,7 +33124,7 @@ import { useCallback as useCallback48, useEffect as useEffect92, useMemo as useM
33019
33124
  import { useFields as useFields25, useOptionalRecordsClient as useOptionalRecordsClient9 } from "@ai-matrx/records/react";
33020
33125
  import { Button as Button85, Label as Label14, Progress, Skeleton as Skeleton33, cn as cn57, formThemeClasses } from "@ai-matrx/design-system";
33021
33126
  import { answerRefusal, formRoutes, FORM_RUNNER_WORDS_EN, pipeAnswers, submissionStamp } from "@ai-matrx/records/forms";
33022
- import { humanizeIdentifier as humanizeIdentifier15 } from "@ai-matrx/kit/text-case";
33127
+ import { humanizeIdentifier as humanizeIdentifier17 } from "@ai-matrx/kit/text-case";
33023
33128
  import { Fragment as Fragment45, jsx as jsx114, jsxs as jsxs106 } from "react/jsx-runtime";
33024
33129
  function authored(host, text, where) {
33025
33130
  return host.renderText ? host.renderText(text, where) : text;
@@ -33168,7 +33273,7 @@ function FormStage({
33168
33273
  // THE FORM'S OWN WORDS FIRST (MAKE-HOME W5). Unwritten, the Field's display name
33169
33274
  // (`fieldName`: a machine-key label is written the way a person writes it), and with no
33170
33275
  // Field at all the key humanized — a stranger never reads `full_name`.
33171
- ask: q.ask?.trim() || (field ? fieldName(field) : humanizeIdentifier15(q.field)),
33276
+ ask: q.ask?.trim() || (field ? fieldName(field) : humanizeIdentifier17(q.field)),
33172
33277
  help: q.help ?? null,
33173
33278
  required: q.required ?? field?.required ?? false,
33174
33279
  field,
@@ -37789,7 +37894,7 @@ import {
37789
37894
  } from "@ai-matrx/records/react";
37790
37895
  import { onRecordChanged as onRecordChanged2 } from "@ai-matrx/records/core";
37791
37896
  import { downloadFile as downloadFile2 } from "@ai-matrx/kit/download";
37792
- import { formatCount as formatCount6 } from "@ai-matrx/kit/format";
37897
+ import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
37793
37898
  import { BasicInput as BasicInput23, Button as Button95, Checkbox as Checkbox13, Skeleton as Skeleton41, cn as cn65 } from "@ai-matrx/design-system";
37794
37899
  import { formFromSummary as formFromSummary2 } from "@ai-matrx/records/forms";
37795
37900
  import { Fragment as Fragment50, jsx as jsx125, jsxs as jsxs117 } from "react/jsx-runtime";
@@ -38329,7 +38434,7 @@ function NumberBlockView({ block, viewerUserId, extra }) {
38329
38434
  }
38330
38435
  return /* @__PURE__ */ jsxs117(Fragment50, { children: [
38331
38436
  title,
38332
- /* @__PURE__ */ jsx125("p", { className: "text-3xl font-semibold tabular-nums", "data-records-page-number": block.id, children: formatCount6(read.total) })
38437
+ /* @__PURE__ */ jsx125("p", { className: "text-3xl font-semibold tabular-nums", "data-records-page-number": block.id, children: formatCount8(read.total) })
38333
38438
  ] });
38334
38439
  }
38335
38440
  function ChartThroughNote({ title, children }) {
@@ -40712,7 +40817,7 @@ import {
40712
40817
  cn as cn75,
40713
40818
  useIsMobile as useIsMobile2
40714
40819
  } from "@ai-matrx/design-system";
40715
- import { humanizeIdentifier as humanizeIdentifier16 } from "@ai-matrx/kit/text-case";
40820
+ import { humanizeIdentifier as humanizeIdentifier18 } from "@ai-matrx/kit/text-case";
40716
40821
 
40717
40822
  // src/calendarFeed.ts
40718
40823
  function webcalUrl(httpsUrl) {
@@ -41172,7 +41277,7 @@ function TableReferenceDialog({
41172
41277
  }
41173
41278
 
41174
41279
  // src/TableDuplicate.tsx
41175
- import { formatCount as formatCount7 } from "@ai-matrx/kit/format";
41280
+ import { formatCount as formatCount9 } from "@ai-matrx/kit/format";
41176
41281
  import { useState as useState127 } from "react";
41177
41282
  import { tableShapeChanged as tableShapeChanged13, useRecordsClient as useRecordsClient102 } from "@ai-matrx/records/react";
41178
41283
  import { Button as Button106, Dialog as Dialog23, DialogContent as DialogContent23, DialogFooter as DialogFooter15, DialogHeader as DialogHeader23, DialogTitle as DialogTitle23, ErrorBox as ErrorBox4, Input as Input11, Switch as Switch8 } from "@ai-matrx/design-system";
@@ -41181,7 +41286,7 @@ function copyNameFor(name) {
41181
41286
  return `${name.trim() || "Table"} (copy)`;
41182
41287
  }
41183
41288
  function duplicateProgressWords(p) {
41184
- if (p.records && p.records.total > 0) return `Copying records \xB7 ${formatCount7(p.records.done)} of ${formatCount7(p.records.total)}`;
41289
+ if (p.records && p.records.total > 0) return `Copying records \xB7 ${formatCount9(p.records.done)} of ${formatCount9(p.records.total)}`;
41185
41290
  if (p.views.total > 0 && p.step === "views") return `Copying views \xB7 ${p.views.done} of ${p.views.total}`;
41186
41291
  return "Copying columns\u2026";
41187
41292
  }
@@ -41238,7 +41343,7 @@ function TableDuplicateDialog({ tableId, name, organizationId, open, onOpenChang
41238
41343
  " columns, ",
41239
41344
  phase.copy.copied.views,
41240
41345
  " views",
41241
- phase.copy.copied.withRecords ? `, ${formatCount7(phase.copy.copied.records)} records` : "",
41346
+ phase.copy.copied.withRecords ? `, ${formatCount9(phase.copy.copied.records)} records` : "",
41242
41347
  "."
41243
41348
  ] }),
41244
41349
  phase.copy.notCopied.length > 0 ? /* @__PURE__ */ jsxs130("p", { className: "text-xs text-muted-foreground", children: [
@@ -41799,7 +41904,7 @@ function useSlotScroll(slot) {
41799
41904
  }
41800
41905
 
41801
41906
  // src/TablePage.tsx
41802
- import { isUuidShape as isUuidShape3 } from "@ai-matrx/kit/uuid";
41907
+ import { isUuidShape as isUuidShape4 } from "@ai-matrx/kit/uuid";
41803
41908
  import { openOutbound as openOutbound2 } from "@ai-matrx/kit/outbound";
41804
41909
  import { Fragment as Fragment57, jsx as jsx142, jsxs as jsxs134 } from "react/jsx-runtime";
41805
41910
  var RAIL_TITLE = {
@@ -41872,7 +41977,7 @@ function RailFrame({
41872
41977
  function filterInWords(filter, fields) {
41873
41978
  const nameOf = (key) => {
41874
41979
  const field = fields.find((f) => f.key === key);
41875
- return field ? fieldName(field) : humanizeIdentifier16(key);
41980
+ return field ? fieldName(field) : humanizeIdentifier18(key);
41876
41981
  };
41877
41982
  const parts = Object.keys(filter).map((key) => {
41878
41983
  const value = filter[key];
@@ -42048,7 +42153,7 @@ function openingView(activeView, activeDashboardId) {
42048
42153
  }
42049
42154
  function savedViewFromParam(activeView) {
42050
42155
  const word = typeof activeView === "string" ? activeView.trim() : "";
42051
- return isUuidShape3(word) ? word.toLowerCase() : null;
42156
+ return isUuidShape4(word) ? word.toLowerCase() : null;
42052
42157
  }
42053
42158
  function addressForView(view, layout) {
42054
42159
  return view && !view.isDefault ? view.id : layout;
@@ -43141,11 +43246,11 @@ function TablePage({
43141
43246
  }
43142
43247
  ) : null,
43143
43248
  lookRefused ? /* @__PURE__ */ jsx142(RefusalNotice, { error: lookRefused }) : null,
43144
- main === "dashboards" ? /* @__PURE__ */ jsx142(DashboardCanvas, { tableId, activeDashboardId: activeDashboardId ?? null }) : main === "form" ? /* @__PURE__ */ jsx142("div", { className: "min-h-0 flex-1 overflow-y-auto", "data-table-form-view": "", children: /* @__PURE__ */ jsx142(FormsPanel, { tableId, activeFormId: formFromLink && activeItemId && isUuidShape3(activeItemId) ? activeItemId : null, asView: true }) }) : main === "questions" ? /* @__PURE__ */ jsx142(
43249
+ main === "dashboards" ? /* @__PURE__ */ jsx142(DashboardCanvas, { tableId, activeDashboardId: activeDashboardId ?? null }) : main === "form" ? /* @__PURE__ */ jsx142("div", { className: "min-h-0 flex-1 overflow-y-auto", "data-table-form-view": "", children: /* @__PURE__ */ jsx142(FormsPanel, { tableId, activeFormId: formFromLink && activeItemId && isUuidShape4(activeItemId) ? activeItemId : null, asView: true }) }) : main === "questions" ? /* @__PURE__ */ jsx142(
43145
43250
  QuestionPanel,
43146
43251
  {
43147
43252
  tableId,
43148
- activeQuestionId: questionsFromLink && activeItemId && isUuidShape3(activeItemId) ? activeItemId : null,
43253
+ activeQuestionId: questionsFromLink && activeItemId && isUuidShape4(activeItemId) ? activeItemId : null,
43149
43254
  draft: questionDraft
43150
43255
  }
43151
43256
  ) : main === "archived" ? (
@@ -43384,7 +43489,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
43384
43489
  }
43385
43490
 
43386
43491
  // src/entityViews.tsx
43387
- import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
43492
+ import { formatCount as formatCount10 } from "@ai-matrx/kit/format";
43388
43493
  import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider as TooltipProvider2 } from "@ai-matrx/design-system";
43389
43494
  import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
43390
43495
  import { useEffect as useEffect115, useMemo as useMemo75, useRef as useRef54, useState as useState132 } from "react";
@@ -43578,7 +43683,7 @@ function EntityTablePageBody({
43578
43683
  return /* @__PURE__ */ jsxs135("div", { className: cn76("flex min-w-0 flex-col gap-2", className), "data-records-entity-page": source.token, children: [
43579
43684
  presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ jsxs135("div", { className: "flex min-w-0 items-center gap-2", children: [
43580
43685
  presentation === "page" ? /* @__PURE__ */ jsx143("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
43581
- presentation === "page" ? /* @__PURE__ */ jsx143("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : formatCount8(entity.total) }) : null,
43686
+ presentation === "page" ? /* @__PURE__ */ jsx143("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : formatCount10(entity.total) }) : null,
43582
43687
  /* @__PURE__ */ jsxs135("span", { className: "ml-auto flex items-center gap-1", children: [
43583
43688
  boardable ? /* @__PURE__ */ jsxs135(Fragment58, { children: [
43584
43689
  /* @__PURE__ */ jsx143(Button109, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),
@@ -44877,6 +44982,7 @@ export {
44877
44982
  FIELD_TYPE_CATALOGUE,
44878
44983
  FIELD_TYPE_CHOICES,
44879
44984
  FIELD_TYPE_GROUPS,
44985
+ FILL_OFF_REASON,
44880
44986
  FOOTER_WORDS,
44881
44987
  FORMULA_OP_JOINS,
44882
44988
  FORMULA_OP_LABEL,
@@ -45216,6 +45322,7 @@ export {
45216
45322
  fieldTypeChoice,
45217
45323
  fieldTypeLabel,
45218
45324
  fieldsForNewColumns,
45325
+ fillEstimateWords,
45219
45326
  filterTargets,
45220
45327
  fitTransform,
45221
45328
  export_flatWhere as flatWhere,