@ai-matrx/records-ui 0.93.146 → 0.93.153

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/pickers.js CHANGED
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
 
3
3
  // src/TablePickers.tsx
4
- import { useEffect as useEffect12, useMemo as useMemo7, useState as useState15 } from "react";
4
+ import { useEffect as useEffect12, useMemo as useMemo7, useState as useState16 } from "react";
5
5
  import { RecordsProvider as RecordsProvider2, useFields, useRecords, useTable } from "@ai-matrx/records/react";
6
6
  import { Button as Button9, CreatablePicker } from "@ai-matrx/design-system";
7
7
 
8
8
  // src/editors.tsx
9
- import { useCallback as useCallback4, useEffect as useEffect10, useRef as useRef9, useState as useState13 } from "react";
9
+ import { useCallback as useCallback4, useEffect as useEffect10, useRef as useRef9, useState as useState14 } from "react";
10
10
  import { allowsOtherValues, choiceValuesOf, coerceTypedAnswer, newerKindOf as newerKindOf4, decideTypedChoice, isTheChosen, optionKey as optionKey2, rankTypedMatches as rankTypedMatches3, readTypedTime as readTypedTime2, typedDateText as typedDateText2, typedTimeText as typedTimeText2 } from "@ai-matrx/records";
11
- import { useOptionalRecordsClient as useOptionalRecordsClient6 } from "@ai-matrx/records/react";
11
+ import { useOptionalRecordsClient as useOptionalRecordsClient7 } from "@ai-matrx/records/react";
12
12
  import {
13
13
  BasicInput as BasicInput6,
14
14
  BasicTextarea as BasicTextarea2,
@@ -19,12 +19,12 @@ import {
19
19
  Popover as Popover4,
20
20
  PopoverContent as PopoverContent4,
21
21
  PopoverTrigger as PopoverTrigger4,
22
- Select,
23
- SelectContent,
24
- SelectItem,
25
- SelectTrigger,
26
- SelectValue,
27
- cn as cn11
22
+ Select as Select2,
23
+ SelectContent as SelectContent2,
24
+ SelectItem as SelectItem2,
25
+ SelectTrigger as SelectTrigger2,
26
+ SelectValue as SelectValue2,
27
+ cn as cn12
28
28
  } from "@ai-matrx/design-system";
29
29
 
30
30
  // src/dates.ts
@@ -82,7 +82,9 @@ import {
82
82
  isAddressValue,
83
83
  isPersonStamp,
84
84
  newerKindOf,
85
+ personStampText,
85
86
  readTypedDuration,
87
+ safeLinkHref,
86
88
  statusGroupOf
87
89
  } from "@ai-matrx/records";
88
90
  import { BasicInput, cn } from "@ai-matrx/design-system";
@@ -96,7 +98,7 @@ function newerKindValue(field, value, opts = {}) {
96
98
  }
97
99
  case "created_by":
98
100
  case "modified_by":
99
- return isPersonStamp(value) ? /* @__PURE__ */ jsx(PersonStampChip, { name: value.name }) : void 0;
101
+ return isPersonStamp(value) ? /* @__PURE__ */ jsx(PersonStampChip, { stamp: value }) : void 0;
100
102
  case "address":
101
103
  return isAddressValue(value) || typeof value === "string" ? /* @__PURE__ */ jsx(AddressLink, { value }) : void 0;
102
104
  case "barcode":
@@ -112,10 +114,12 @@ function newerKindValue(field, value, opts = {}) {
112
114
  return void 0;
113
115
  }
114
116
  }
115
- function PersonStampChip({ name }) {
116
- const words = name && name.trim() !== "" ? name : NOT_A_MEMBER_WORDS;
117
- const initial = name && name.trim() !== "" ? name.trim()[0].toUpperCase() : "?";
118
- return /* @__PURE__ */ jsxs("span", { className: "inline-flex min-w-0 items-center gap-1.5", "data-records-person-stamp": "", children: [
117
+ function PersonStampChip({ stamp }) {
118
+ const words = personStampText(stamp) ?? NOT_A_MEMBER_WORDS;
119
+ const tier = stamp.actor ?? "user";
120
+ const name = tier === "user" ? stamp.name : null;
121
+ const initial = tier === "system" ? "\u2699" : tier === "agent" ? "\u2726" : name && name.trim() !== "" ? name.trim()[0].toUpperCase() : "?";
122
+ return /* @__PURE__ */ jsxs("span", { className: "inline-flex min-w-0 items-center gap-1.5", "data-records-person-stamp": tier, children: [
119
123
  /* @__PURE__ */ jsx(
120
124
  "span",
121
125
  {
@@ -124,7 +128,7 @@ function PersonStampChip({ name }) {
124
128
  children: initial
125
129
  }
126
130
  ),
127
- /* @__PURE__ */ jsx("span", { className: cn("truncate", name ? "" : "italic text-muted-foreground"), children: words })
131
+ /* @__PURE__ */ jsx("span", { className: cn("truncate", tier === "user" && !name ? "italic text-muted-foreground" : ""), children: words })
128
132
  ] });
129
133
  }
130
134
  function AddressLink({ value }) {
@@ -149,12 +153,13 @@ function AddressLink({ value }) {
149
153
  );
150
154
  }
151
155
  var STATUS_GROUP_MARK = { todo: "\u25CB", in_progress: "\u25D0", done: "\u25CF" };
152
- function statusMarkOf(field, value) {
156
+ function statusMarkOf(field, value, document2) {
153
157
  if (newerKindOf(field) !== "status" || typeof value !== "string") return null;
154
- const group = statusGroupOf(field, value);
158
+ const chosen = document2?.["_choices"]?.[field.key];
159
+ const key = chosen && typeof chosen === "object" && typeof chosen.key === "string" ? chosen.key : value;
160
+ const group = statusGroupOf(field, key);
155
161
  return { mark: STATUS_GROUP_MARK[group], group, words: STATUS_GROUP_WORDS[group] };
156
162
  }
157
- var SAFE_HREF = /^(https?:\/\/|mailto:)/i;
158
163
  function inline(text, key) {
159
164
  const out = [];
160
165
  let at = 0;
@@ -181,9 +186,9 @@ function marks(text, key) {
181
186
  if (tok.startsWith("**") || tok.startsWith("__")) out.push(/* @__PURE__ */ jsx("strong", { children: tok.slice(2, -2) }, k));
182
187
  else if (tok.startsWith("[")) {
183
188
  const link = /^\[([^\]]+)\]\(([^)\s]+)\)$/.exec(tok);
184
- const href = link?.[2] ?? "";
189
+ const href = safeLinkHref(link?.[2] ?? "");
185
190
  out.push(
186
- SAFE_HREF.test(href) ? /* @__PURE__ */ jsx("a", { href, target: "_blank", rel: "noopener noreferrer", className: "text-primary underline-offset-2 hover:underline", onClick: own, children: link?.[1] }, k) : link?.[1] ?? tok
191
+ href ? /* @__PURE__ */ jsx("a", { href, target: "_blank", rel: "noopener noreferrer", className: "text-primary underline-offset-2 hover:underline", onClick: own, children: link?.[1] }, k) : link?.[1] ?? tok
187
192
  );
188
193
  } else out.push(/* @__PURE__ */ jsx("em", { children: tok.slice(1, -1) }, k));
189
194
  last = at + tok.length;
@@ -622,7 +627,12 @@ var TITLE = {
622
627
  already_exists: "That already exists",
623
628
  not_supported: "That cannot be done here",
624
629
  store_limit: "This has got as big as it can",
625
- store_not_served: "This organization does not keep its data here",
630
+ // 🚨 NOT "THE SWITCH IS OFF" (lane 7 W1 fix round 1). PGRST202 / PGRST205 land here, and the
631
+ // commonest cause is a door this screen asks for that the database it talks to does not serve
632
+ // YET — a release in flight. Telling the person her organization has its store switched off was
633
+ // false (the switch is answered by its own door, `platform.unified_data_store_on`). Honest:
634
+ // nothing happened, and it is ours, and it passes.
635
+ store_not_served: "This isn't available right now",
626
636
  unreachable: "We could not reach your data",
627
637
  needs_approval: "This is waiting on someone's approval",
628
638
  stale_read: "Your view of this is a moment behind",
@@ -640,7 +650,7 @@ var REMEDY = {
640
650
  already_exists: "Use a different name.",
641
651
  not_supported: "There is another way to do this \u2014 ask, and we will point you at it.",
642
652
  store_limit: "Split it up, or ask us to raise the ceiling for your organization.",
643
- store_not_served: "An administrator of this organization turns the record store on from the data settings screen.",
653
+ store_not_served: "Nothing was changed. Try again in a few minutes.",
644
654
  // 🚨 NOTHING WAS WRITTEN AND NOTHING WAS REFUSED (lane TAILS-6). The call
645
655
  // never arrived, so "try again" is the honest instruction rather than a
646
656
  // consolation — and saying nothing changed is the half a person actually
@@ -1140,7 +1150,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
1140
1150
 
1141
1151
  // src/gridAttachments.tsx
1142
1152
  import { useEffect as useEffect6, useRef as useRef5, useState as useState7 } from "react";
1143
- import { useOptionalRecordsClient as useOptionalRecordsClient2 } from "@ai-matrx/records/react";
1153
+ import { useOptionalRecordsClient as useOptionalRecordsClient3 } from "@ai-matrx/records/react";
1144
1154
  import { Badge, Button as Button5 } from "@ai-matrx/design-system";
1145
1155
 
1146
1156
  // src/host.tsx
@@ -1226,6 +1236,7 @@ import { isUuidShape as isUuidShape2 } from "@ai-matrx/kit/uuid";
1226
1236
  // src/signature.tsx
1227
1237
  import { useEffect as useEffect4, useRef as useRef2, useState as useState4 } from "react";
1228
1238
  import { Button as Button3, ErrorBox as ErrorBox2, cn as cn5 } from "@ai-matrx/design-system";
1239
+ import { useOptionalRecordsClient as useOptionalRecordsClient2 } from "@ai-matrx/records/react";
1229
1240
  import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
1230
1241
  var DRAWN = /^data:image\/(png|jpeg);base64,[A-Za-z0-9+/=]{64,}$/;
1231
1242
  function drawnSignatureOf(value) {
@@ -1236,18 +1247,105 @@ function signatureWords(value) {
1236
1247
  if (value === null || value === void 0 || value === "") return null;
1237
1248
  return drawnSignatureOf(value) ? SIGNED_WORD : String(value);
1238
1249
  }
1239
- function SignatureValue({ value, inCell }) {
1250
+ function signatureFileOf(source) {
1251
+ if (!source || typeof source !== "object") return null;
1252
+ const src = source;
1253
+ const id = src["signature_file_id"];
1254
+ return src["kind"] === "signature" && typeof id === "string" && id !== "" ? id : null;
1255
+ }
1256
+ function signatureFileIn(document2, key) {
1257
+ const values = document2?.["_values"];
1258
+ const src = values?.[key]?.src;
1259
+ if (typeof src === "string") {
1260
+ const sources = document2?.["_sources"];
1261
+ return signatureFileOf(sources?.[src]);
1262
+ }
1263
+ return signatureFileOf(src);
1264
+ }
1265
+ var SOURCES = /* @__PURE__ */ new WeakMap();
1266
+ var FILES = /* @__PURE__ */ new WeakMap();
1267
+ function signatureFilesOf(client, recordId) {
1268
+ let held = SOURCES.get(client);
1269
+ if (!held) SOURCES.set(client, held = /* @__PURE__ */ new Map());
1270
+ let asked2 = held.get(recordId);
1271
+ if (!asked2) {
1272
+ asked2 = client.recordValuesVersioned({ record_id: recordId }).then((answered) => {
1273
+ if (!answered.ok) return {};
1274
+ return Object.fromEntries(answered.data.map((v) => [v.field_key, signatureFileOf(v.source)]));
1275
+ });
1276
+ held.set(recordId, asked2);
1277
+ }
1278
+ return asked2;
1279
+ }
1280
+ function drawingOf(client, fileId) {
1281
+ let held = FILES.get(client);
1282
+ if (!held) FILES.set(client, held = /* @__PURE__ */ new Map());
1283
+ let asked2 = held.get(fileId);
1284
+ if (!asked2) {
1285
+ asked2 = client.recordRead({ record_id: fileId }).then((answered) => {
1286
+ if (!answered.ok) return { src: null, hostFileId: null };
1287
+ const doc = answered.data.document ?? {};
1288
+ const content = drawnSignatureOf(doc["content"]);
1289
+ const hostFileId = typeof doc["file_id"] === "string" && doc["file_id"] !== "" ? doc["file_id"] : null;
1290
+ return { src: content, hostFileId };
1291
+ });
1292
+ held.set(fileId, asked2);
1293
+ }
1294
+ return asked2;
1295
+ }
1296
+ function DrawnImage({ src, inCell }) {
1297
+ return /* @__PURE__ */ jsx6(
1298
+ "img",
1299
+ {
1300
+ src,
1301
+ alt: SIGNED_WORD,
1302
+ "data-records-signature": "",
1303
+ className: cn5("max-w-[12rem] object-contain object-left dark:invert", inCell ? "h-7" : "h-12")
1304
+ }
1305
+ );
1306
+ }
1307
+ function SignatureDrawing({
1308
+ recordId,
1309
+ fieldKey,
1310
+ fileId: knownFile,
1311
+ value,
1312
+ inCell
1313
+ }) {
1314
+ const client = useOptionalRecordsClient2();
1315
+ const host = useRecordsUi();
1316
+ const [drawing, setDrawing] = useState4(null);
1317
+ useEffect4(() => {
1318
+ let cancelled = false;
1319
+ setDrawing(null);
1320
+ if (!client) return;
1321
+ void (async () => {
1322
+ const fileId = knownFile ?? (recordId && fieldKey ? (await signatureFilesOf(client, recordId))[fieldKey] ?? null : null);
1323
+ if (!fileId || cancelled) return;
1324
+ const read = await drawingOf(client, fileId);
1325
+ if (!cancelled) setDrawing(read);
1326
+ })();
1327
+ return () => {
1328
+ cancelled = true;
1329
+ };
1330
+ }, [client, recordId, fieldKey, knownFile]);
1331
+ if (drawing?.src) return /* @__PURE__ */ jsx6(DrawnImage, { src: drawing.src, inCell });
1332
+ if (drawing?.hostFileId && host.fileImage) {
1333
+ return /* @__PURE__ */ jsx6("span", { className: cn5("inline-block max-w-[12rem] dark:invert", inCell ? "h-7" : "h-12"), "data-records-signature": "", children: host.fileImage({ fileId: drawing.hostFileId, alt: SIGNED_WORD }) });
1334
+ }
1335
+ return /* @__PURE__ */ jsx6("span", { className: "font-serif italic", children: String(value) });
1336
+ }
1337
+ function SignatureValue({
1338
+ value,
1339
+ inCell,
1340
+ recordId,
1341
+ fieldKey,
1342
+ document: document2
1343
+ }) {
1240
1344
  const drawn = drawnSignatureOf(value);
1241
- if (drawn) {
1242
- return /* @__PURE__ */ jsx6(
1243
- "img",
1244
- {
1245
- src: drawn,
1246
- alt: SIGNED_WORD,
1247
- "data-records-signature": "",
1248
- className: cn5("max-w-[12rem] object-contain object-left dark:invert", inCell ? "h-7" : "h-12")
1249
- }
1250
- );
1345
+ if (drawn) return /* @__PURE__ */ jsx6(DrawnImage, { src: drawn, inCell });
1346
+ const fileId = fieldKey ? signatureFileIn(document2, fieldKey) : null;
1347
+ if (value === SIGNED_WORD && (fileId || recordId && fieldKey)) {
1348
+ return /* @__PURE__ */ jsx6(SignatureDrawing, { recordId: recordId ?? null, fieldKey: fieldKey ?? null, fileId, value, inCell });
1251
1349
  }
1252
1350
  return /* @__PURE__ */ jsx6("span", { className: "font-serif italic", children: String(value) });
1253
1351
  }
@@ -1717,7 +1815,7 @@ function rememberHostFileIds(ids) {
1717
1815
  var FILE_CHIP_UNREAD = "File";
1718
1816
  var FILE_CHIP_NO_PAGE = "This screen has no way to open files yet.";
1719
1817
  function AttachmentChip({ id, onRemove }) {
1720
- const client = useOptionalRecordsClient2();
1818
+ const client = useOptionalRecordsClient3();
1721
1819
  const host = useRecordsUi();
1722
1820
  const [read, setRead] = useState7(null);
1723
1821
  useEffect6(() => {
@@ -1862,11 +1960,99 @@ function AttachmentControl({
1862
1960
  }
1863
1961
 
1864
1962
  // src/EntityReferenceControl.tsx
1865
- import { useMemo as useMemo4, useState as useState8 } from "react";
1963
+ import { useMemo as useMemo4, useState as useState9 } from "react";
1866
1964
  import { entityRefsOf, entityRefsToWrite } from "@ai-matrx/records";
1867
- import { useEntityReferenceKinds, useEntityReferenceSearch, useEntityReferenceWords, useOptionalRecordsClient as useOptionalRecordsClient3 } from "@ai-matrx/records/react";
1868
- import { Badge as Badge2, Button as Button6, cn as cn7 } from "@ai-matrx/design-system";
1869
- import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1965
+ import { useEntityReferenceKinds, useEntityReferenceSearch, useEntityReferenceWords, useOptionalRecordsClient as useOptionalRecordsClient4 } from "@ai-matrx/records/react";
1966
+ import { Badge as Badge2, Button as Button6, cn as cn8 } from "@ai-matrx/design-system";
1967
+
1968
+ // src/PickOne.tsx
1969
+ import { useState as useState8 } from "react";
1970
+ import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, cn as cn7 } from "@ai-matrx/design-system";
1971
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1972
+ var PICK_ONE_SEARCH_AFTER = 7;
1973
+ var EMPTY = "__records_pick_one_empty__";
1974
+ var inner = (v) => v === "" ? EMPTY : v;
1975
+ var outer = (v) => v === EMPTY ? "" : v;
1976
+ function PickOne({
1977
+ value,
1978
+ onChange,
1979
+ options,
1980
+ label,
1981
+ placeholder,
1982
+ id,
1983
+ className,
1984
+ disabled,
1985
+ attrs
1986
+ }) {
1987
+ const [open, setOpen] = useState8(false);
1988
+ const [search, setSearch] = useState8("");
1989
+ const current = options.find((o) => o.value === value);
1990
+ if (options.length > PICK_ONE_SEARCH_AFTER) {
1991
+ const q = search.trim().toLowerCase();
1992
+ const shown2 = q === "" ? options : options.filter((o) => o.label.toLowerCase().includes(q));
1993
+ return /* @__PURE__ */ jsx10("span", { className: cn7("inline-flex min-w-0", className), "data-records-pick-one": "search", "data-pick-value": value, ...attrs ?? {}, children: /* @__PURE__ */ jsx10(
1994
+ PickOrAdd,
1995
+ {
1996
+ triggerLabel: label,
1997
+ triggerText: current?.label ?? placeholder ?? "",
1998
+ triggerId: id,
1999
+ open: open && !disabled,
2000
+ onOpenChange: (next) => {
2001
+ setOpen(next);
2002
+ if (!next) setSearch("");
2003
+ },
2004
+ search,
2005
+ onSearch: setSearch,
2006
+ items: shown2.map((o) => ({
2007
+ id: inner(o.value),
2008
+ label: o.label,
2009
+ detail: o.group,
2010
+ picked: o.value === value,
2011
+ attrs: { "data-pick-value": o.value, ...o.group ? { "data-pick-group": o.group } : {} }
2012
+ })),
2013
+ onPick: (picked) => {
2014
+ onChange(outer(picked));
2015
+ setOpen(false);
2016
+ setSearch("");
2017
+ },
2018
+ empty: /* @__PURE__ */ jsx10("p", { className: "p-2 text-xs text-muted-foreground", children: "No match" })
2019
+ }
2020
+ ) });
2021
+ }
2022
+ return /* @__PURE__ */ jsxs8(Select, { value: current ? inner(current.value) : "", onValueChange: (v) => onChange(outer(v)), disabled: disabled ?? false, children: [
2023
+ /* @__PURE__ */ jsx10(
2024
+ SelectTrigger,
2025
+ {
2026
+ id,
2027
+ size: "sm",
2028
+ "aria-label": label,
2029
+ className: cn7("h-7 w-auto min-w-[7rem] text-xs", className),
2030
+ "data-records-pick-one": "list",
2031
+ "data-pick-value": value,
2032
+ ...attrs ?? {},
2033
+ children: /* @__PURE__ */ jsx10(SelectValue, { placeholder })
2034
+ }
2035
+ ),
2036
+ /* @__PURE__ */ jsx10(SelectContent, { children: groupsOf(options).map(
2037
+ ([group, items]) => group ? /* @__PURE__ */ jsxs8(SelectGroup, { children: [
2038
+ /* @__PURE__ */ jsx10(SelectLabel, { children: group }),
2039
+ items.map((o) => /* @__PURE__ */ jsx10(SelectItem, { value: inner(o.value), "data-pick-value": o.value, "data-pick-group": group, children: o.label }, inner(o.value)))
2040
+ ] }, group) : items.map((o) => /* @__PURE__ */ jsx10(SelectItem, { value: inner(o.value), "data-pick-value": o.value, children: o.label }, inner(o.value)))
2041
+ ) })
2042
+ ] });
2043
+ }
2044
+ function groupsOf(options) {
2045
+ const out = [];
2046
+ for (const o of options) {
2047
+ const last = out[out.length - 1];
2048
+ if (last && last[0] === o.group) last[1].push(o);
2049
+ else out.push([o.group, [o]]);
2050
+ }
2051
+ return out;
2052
+ }
2053
+
2054
+ // src/EntityReferenceControl.tsx
2055
+ import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
1870
2056
  var WITHHELD_ENTITY_LABEL = "Something you have not been given access to";
1871
2057
  var ENTITY_REFERENCE_EMPTY = "Nothing is pointed at yet.";
1872
2058
  function entityReferenceText(value) {
@@ -1880,12 +2066,12 @@ function allowedKindsOf(field) {
1880
2066
  return kinds.map((k) => String(k).trim().toLowerCase()).filter(Boolean);
1881
2067
  }
1882
2068
  function EntityReferenceControl(props) {
1883
- const client = useOptionalRecordsClient3();
1884
- return client ? /* @__PURE__ */ jsx10(WithWords, { ...props }) : /* @__PURE__ */ jsx10(Chips, { ...props, words: null, picker: null });
2069
+ const client = useOptionalRecordsClient4();
2070
+ return client ? /* @__PURE__ */ jsx11(WithWords, { ...props }) : /* @__PURE__ */ jsx11(Chips, { ...props, words: null, picker: null });
1885
2071
  }
1886
2072
  function WithWords(props) {
1887
2073
  const refs = useMemo4(() => entityRefsOf(props.value), [props.value]);
1888
- const [known, setKnown] = useState8([]);
2074
+ const [known, setKnown] = useState9([]);
1889
2075
  const withKnown = refs.map((r) => r.label === null ? known.find((k) => k.token === r.token && k.id === r.id) ?? r : r);
1890
2076
  const unlabelled = useMemo4(
1891
2077
  () => withKnown.filter((r) => r.label === null).map((r) => ({ token: r.token, id: r.id })),
@@ -1893,7 +2079,7 @@ function WithWords(props) {
1893
2079
  [JSON.stringify(withKnown)]
1894
2080
  );
1895
2081
  const words = useEntityReferenceWords(unlabelled);
1896
- const picker = props.disabled ? null : /* @__PURE__ */ jsx10(
2082
+ const picker = props.disabled ? null : /* @__PURE__ */ jsx11(
1897
2083
  EntityReferencePicker,
1898
2084
  {
1899
2085
  field: props.field,
@@ -1906,7 +2092,7 @@ function WithWords(props) {
1906
2092
  }
1907
2093
  }
1908
2094
  );
1909
- return /* @__PURE__ */ jsx10(Chips, { ...props, value: withKnown, words, picker });
2095
+ return /* @__PURE__ */ jsx11(Chips, { ...props, value: withKnown, words, picker });
1910
2096
  }
1911
2097
  function EntityReferencePicker({
1912
2098
  field,
@@ -1916,9 +2102,9 @@ function EntityReferencePicker({
1916
2102
  const allowed = allowedKindsOf(field);
1917
2103
  const kinds = useEntityReferenceKinds();
1918
2104
  const labelOfKind = (token) => kinds.data?.find((k) => k.token === token)?.label ?? token.replace(/_/g, " ");
1919
- const [open, setOpen] = useState8(false);
1920
- const [search, setSearch] = useState8("");
1921
- const [only, setOnly] = useState8(null);
2105
+ const [open, setOpen] = useState9(false);
2106
+ const [search, setSearch] = useState9("");
2107
+ const [only, setOnly] = useState9(null);
1922
2108
  const tokens = only ? [only] : allowed;
1923
2109
  const found = useEntityReferenceSearch(tokens, search, open);
1924
2110
  const multi = Boolean(field.multi);
@@ -1929,7 +2115,7 @@ function EntityReferencePicker({
1929
2115
  picked: refs.some((x) => x.token === r.token && x.id === r.id),
1930
2116
  attrs: { "data-entity-reference-candidate": `${r.token}:${r.id}` }
1931
2117
  }));
1932
- const kindChoice = allowed.length > 1 ? allowed.length <= 4 ? /* @__PURE__ */ jsx10("div", { className: "mb-1 flex flex-wrap gap-1", role: "group", "aria-label": `Which kind \u2014 ${field.label}`, children: [null, ...allowed].map((token) => /* @__PURE__ */ jsx10(
2118
+ const kindChoice = allowed.length > 1 ? allowed.length <= 4 ? /* @__PURE__ */ jsx11("div", { className: "mb-1 flex flex-wrap gap-1", role: "group", "aria-label": `Which kind \u2014 ${field.label}`, children: [null, ...allowed].map((token) => /* @__PURE__ */ jsx11(
1933
2119
  Button6,
1934
2120
  {
1935
2121
  type: "button",
@@ -1941,26 +2127,23 @@ function EntityReferencePicker({
1941
2127
  children: token ? labelOfKind(token) : "Any"
1942
2128
  },
1943
2129
  token ?? "any"
1944
- )) }) : /* @__PURE__ */ jsxs8(
1945
- "select",
2130
+ )) }) : /* @__PURE__ */ jsx11(
2131
+ PickOne,
1946
2132
  {
1947
- className: "mb-1 h-7 w-full rounded border border-border bg-background px-1 text-xs",
1948
- "aria-label": `Which kind \u2014 ${field.label}`,
2133
+ label: `Which kind \u2014 ${field.label}`,
2134
+ className: "mb-1 w-full",
1949
2135
  value: only ?? "",
1950
- onChange: (e) => setOnly(e.target.value || null),
1951
- children: [
1952
- /* @__PURE__ */ jsx10("option", { value: "", children: "Any kind" }),
1953
- allowed.map((token) => /* @__PURE__ */ jsx10("option", { value: token, children: labelOfKind(token) }, token))
1954
- ]
2136
+ onChange: (picked) => setOnly(picked || null),
2137
+ options: [{ value: "", label: "Any kind" }, ...allowed.map((token) => ({ value: token, label: labelOfKind(token) }))]
1955
2138
  }
1956
2139
  ) : null;
1957
- const notice = /* @__PURE__ */ jsxs8(Fragment3, { children: [
2140
+ const notice = /* @__PURE__ */ jsxs9(Fragment3, { children: [
1958
2141
  kindChoice,
1959
- found.error ? /* @__PURE__ */ jsx10(RefusalLine, { error: found.error, className: "px-2 py-1 text-[11px]" }) : null,
1960
- found.loading && !found.data ? /* @__PURE__ */ jsx10("p", { className: "px-2 py-1 text-[11px] text-muted-foreground", children: "Searching\u2026" }) : null
2142
+ found.error ? /* @__PURE__ */ jsx11(RefusalLine, { error: found.error, className: "px-2 py-1 text-[11px]" }) : null,
2143
+ found.loading && !found.data ? /* @__PURE__ */ jsx11("p", { className: "px-2 py-1 text-[11px] text-muted-foreground", children: "Searching\u2026" }) : null
1961
2144
  ] });
1962
2145
  const kindWords = allowed.length === 1 ? labelOfKind(allowed[0]).toLowerCase() : "thing";
1963
- return /* @__PURE__ */ jsx10(
2146
+ return /* @__PURE__ */ jsx11(
1964
2147
  PickOrAdd,
1965
2148
  {
1966
2149
  triggerLabel: `Pick for ${field.label}`,
@@ -1974,7 +2157,7 @@ function EntityReferencePicker({
1974
2157
  onSearch: setSearch,
1975
2158
  items,
1976
2159
  notice,
1977
- empty: found.loading ? null : /* @__PURE__ */ jsx10("p", { className: "px-2 py-1 text-[11px] text-muted-foreground", children: search.trim() ? `No ${kindWords} you can open is called \u201C${search.trim()}\u201D.` : `There is no ${kindWords} you can open yet.` }),
2160
+ empty: found.loading ? null : /* @__PURE__ */ jsx11("p", { className: "px-2 py-1 text-[11px] text-muted-foreground", children: search.trim() ? `No ${kindWords} you can open is called \u201C${search.trim()}\u201D.` : `There is no ${kindWords} you can open yet.` }),
1978
2161
  onPick: (key) => {
1979
2162
  const r = (found.data ?? []).find((x) => `${x.token}:${x.id}` === key);
1980
2163
  if (!r) return;
@@ -2004,13 +2187,13 @@ function Chips({
2004
2187
  return WITHHELD_ENTITY_LABEL;
2005
2188
  };
2006
2189
  const multi = Boolean(field.multi);
2007
- return /* @__PURE__ */ jsxs8("div", { id, className: cn7("flex flex-wrap items-center gap-1", className), "aria-label": `What ${field.label} points at`, children: [
2008
- refs.length === 0 && !picker ? /* @__PURE__ */ jsx10("span", { className: "text-[11px] text-muted-foreground", children: ENTITY_REFERENCE_EMPTY }) : null,
2190
+ return /* @__PURE__ */ jsxs9("div", { id, className: cn8("flex flex-wrap items-center gap-1", className), "aria-label": `What ${field.label} points at`, children: [
2191
+ refs.length === 0 && !picker ? /* @__PURE__ */ jsx11("span", { className: "text-[11px] text-muted-foreground", children: ENTITY_REFERENCE_EMPTY }) : null,
2009
2192
  refs.map((r) => {
2010
2193
  const label = labelOf(r.token, r.id, r.label);
2011
- return /* @__PURE__ */ jsxs8(Badge2, { variant: "secondary", className: "gap-1 text-[11px]", "data-entity-reference-chip": `${r.token}:${r.id}`, children: [
2194
+ return /* @__PURE__ */ jsxs9(Badge2, { variant: "secondary", className: "gap-1 text-[11px]", "data-entity-reference-chip": `${r.token}:${r.id}`, children: [
2012
2195
  label,
2013
- disabled ? null : /* @__PURE__ */ jsx10(
2196
+ disabled ? null : /* @__PURE__ */ jsx11(
2014
2197
  "button",
2015
2198
  {
2016
2199
  type: "button",
@@ -2030,9 +2213,9 @@ function Chips({
2030
2213
  }
2031
2214
 
2032
2215
  // src/PersonPicker.tsx
2033
- import { useCallback as useCallback3, useEffect as useEffect7, useMemo as useMemo5, useRef as useRef6, useState as useState9 } from "react";
2216
+ import { useCallback as useCallback3, useEffect as useEffect7, useMemo as useMemo5, useRef as useRef6, useState as useState10 } from "react";
2034
2217
  import { rankTypedMatches as rankTypedMatches2 } from "@ai-matrx/records";
2035
- import { useOptionalRecordsClient as useOptionalRecordsClient4 } from "@ai-matrx/records/react";
2218
+ import { useOptionalRecordsClient as useOptionalRecordsClient5 } from "@ai-matrx/records/react";
2036
2219
  import {
2037
2220
  BasicInput as BasicInput4,
2038
2221
  Button as Button7,
@@ -2040,9 +2223,9 @@ import {
2040
2223
  PopoverContent as PopoverContent2,
2041
2224
  PopoverTrigger as PopoverTrigger2,
2042
2225
  ScrollArea as ScrollArea2,
2043
- cn as cn8
2226
+ cn as cn9
2044
2227
  } from "@ai-matrx/design-system";
2045
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2228
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2046
2229
  function personFromRow(row) {
2047
2230
  const data = row.document ?? {};
2048
2231
  const userId = data["user_id"];
@@ -2073,20 +2256,20 @@ async function personRecordForMember(client, personTableId, people, member) {
2073
2256
  return written;
2074
2257
  }
2075
2258
  function PersonPicker({ field, value, onChange, disabled, id, className, autoOpen, onClose, initialSearch }) {
2076
- const client = useOptionalRecordsClient4();
2259
+ const client = useOptionalRecordsClient5();
2077
2260
  const host = useRecordsUi();
2078
- const [members, setMembers] = useState9(null);
2079
- const [people, setPeople] = useState9([]);
2080
- const [error, setError] = useState9(null);
2081
- const [search, setSearch] = useState9(initialSearch ?? "");
2082
- const [open, setOpenState] = useState9(autoOpen === true);
2261
+ const [members, setMembers] = useState10(null);
2262
+ const [people, setPeople] = useState10([]);
2263
+ const [error, setError] = useState10(null);
2264
+ const [search, setSearch] = useState10(initialSearch ?? "");
2265
+ const [open, setOpenState] = useState10(autoOpen === true);
2083
2266
  const onCloseRef = useRef6(onClose);
2084
2267
  onCloseRef.current = onClose;
2085
2268
  const setOpen = useCallback3((next) => {
2086
2269
  setOpenState(next);
2087
2270
  if (!next) onCloseRef.current?.();
2088
2271
  }, []);
2089
- const [busy, setBusy] = useState9(false);
2272
+ const [busy, setBusy] = useState10(false);
2090
2273
  const membersPort = host.members;
2091
2274
  const personTable = field.relation_target;
2092
2275
  const picked = useMemo5(
@@ -2133,10 +2316,10 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
2133
2316
  });
2134
2317
  const pickRef = useRef6(null);
2135
2318
  if (!membersPort || !client) {
2136
- return /* @__PURE__ */ jsx11("p", { className: cn8("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
2319
+ return /* @__PURE__ */ jsx12("p", { className: cn9("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
2137
2320
  }
2138
2321
  if (!personTable) {
2139
- return /* @__PURE__ */ jsxs9("p", { className: cn8("text-xs text-muted-foreground", className), children: [
2322
+ return /* @__PURE__ */ jsxs10("p", { className: cn9("text-xs text-muted-foreground", className), children: [
2140
2323
  fieldName(field),
2141
2324
  " is a person field, but it does not say which Table the people are records of yet, so there is nothing to pick from. A table admin sets its target in the field editor."
2142
2325
  ] });
@@ -2179,8 +2362,8 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
2179
2362
  const pickedUserIds = new Set(
2180
2363
  picked.map((recordId) => people.find((p) => p.id === recordId)?.userId).filter(Boolean)
2181
2364
  );
2182
- return /* @__PURE__ */ jsxs9("div", { className: cn8("flex flex-wrap items-center gap-1", className), children: [
2183
- picked.map((recordId) => /* @__PURE__ */ jsx11(
2365
+ return /* @__PURE__ */ jsxs10("div", { className: cn9("flex flex-wrap items-center gap-1", className), children: [
2366
+ picked.map((recordId) => /* @__PURE__ */ jsx12(
2184
2367
  RecordChip,
2185
2368
  {
2186
2369
  title: nameOfRecord(recordId),
@@ -2188,8 +2371,8 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
2188
2371
  },
2189
2372
  recordId
2190
2373
  )),
2191
- disabled ? null : /* @__PURE__ */ jsxs9(Popover2, { open, onOpenChange: setOpen, children: [
2192
- /* @__PURE__ */ jsx11(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx11(
2374
+ disabled ? null : /* @__PURE__ */ jsxs10(Popover2, { open, onOpenChange: setOpen, children: [
2375
+ /* @__PURE__ */ jsx12(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx12(
2193
2376
  Button7,
2194
2377
  {
2195
2378
  id,
@@ -2200,7 +2383,7 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
2200
2383
  children: picked.length === 0 ? "Pick a person" : "Change"
2201
2384
  }
2202
2385
  ) }),
2203
- /* @__PURE__ */ jsxs9(
2386
+ /* @__PURE__ */ jsxs10(
2204
2387
  PopoverContent2,
2205
2388
  {
2206
2389
  sizing: "content",
@@ -2209,7 +2392,7 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
2209
2392
  "data-matrx-cell-editor": "",
2210
2393
  onKeyDown: (event) => event.stopPropagation(),
2211
2394
  children: [
2212
- /* @__PURE__ */ jsx11(
2395
+ /* @__PURE__ */ jsx12(
2213
2396
  BasicInput4,
2214
2397
  {
2215
2398
  value: search,
@@ -2222,31 +2405,31 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
2222
2405
  className: "mb-1 h-7 text-xs"
2223
2406
  }
2224
2407
  ),
2225
- error ? /* @__PURE__ */ jsx11(RefusalLine, { error, className: "p-2" }) : null,
2226
- members === null ? /* @__PURE__ */ jsx11("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading the members\u2026" }) : null,
2227
- /* @__PURE__ */ jsxs9(ScrollArea2, { className: "max-h-56", children: [
2228
- /* @__PURE__ */ jsx11("ul", { role: "listbox", "aria-label": `People for ${fieldName(field)}`, children: visible.map((member, index) => /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsxs9(
2408
+ error ? /* @__PURE__ */ jsx12(RefusalLine, { error, className: "p-2" }) : null,
2409
+ members === null ? /* @__PURE__ */ jsx12("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading the members\u2026" }) : null,
2410
+ /* @__PURE__ */ jsxs10(ScrollArea2, { className: "max-h-56", children: [
2411
+ /* @__PURE__ */ jsx12("ul", { role: "listbox", "aria-label": `People for ${fieldName(field)}`, children: visible.map((member, index) => /* @__PURE__ */ jsx12("li", { children: /* @__PURE__ */ jsxs10(
2229
2412
  "button",
2230
2413
  {
2231
2414
  type: "button",
2232
2415
  disabled: busy,
2233
2416
  "data-pick-highlighted": index === keys.highlight ? "" : void 0,
2234
2417
  onClick: () => void pick(member),
2235
- className: cn8(
2418
+ className: cn9(
2236
2419
  "w-full truncate rounded px-2 py-1 text-left text-xs hover:bg-muted",
2237
2420
  pickedUserIds.has(member.userId) ? "bg-accent text-accent-foreground" : "",
2238
2421
  index === keys.highlight ? "ring-1 ring-ring" : ""
2239
2422
  ),
2240
2423
  children: [
2241
- /* @__PURE__ */ jsx11("span", { children: memberName(member) }),
2242
- member.email && member.email !== memberName(member) ? /* @__PURE__ */ jsxs9("span", { className: "ml-1.5 opacity-60", children: [
2424
+ /* @__PURE__ */ jsx12("span", { children: memberName(member) }),
2425
+ member.email && member.email !== memberName(member) ? /* @__PURE__ */ jsxs10("span", { className: "ml-1.5 opacity-60", children: [
2243
2426
  "\xB7 ",
2244
2427
  member.email
2245
2428
  ] }) : null
2246
2429
  ]
2247
2430
  }
2248
2431
  ) }, member.userId)) }),
2249
- members !== null && visible.length === 0 ? /* @__PURE__ */ jsx11("p", { className: "p-2 text-xs text-muted-foreground", children: members.length === 0 ? "This organization has no other members yet, so there is nobody to assign." : "Nobody in this organization matches." }) : null
2432
+ members !== null && visible.length === 0 ? /* @__PURE__ */ jsx12("p", { className: "p-2 text-xs text-muted-foreground", children: members.length === 0 ? "This organization has no other members yet, so there is nobody to assign." : "Nobody in this organization matches." }) : null
2250
2433
  ] })
2251
2434
  ]
2252
2435
  }
@@ -2322,7 +2505,7 @@ function currencyCodeFor(unit) {
2322
2505
  }
2323
2506
 
2324
2507
  // src/formatControls.tsx
2325
- import { useEffect as useEffect8, useRef as useRef8, useState as useState10 } from "react";
2508
+ import { useEffect as useEffect8, useRef as useRef8, useState as useState11 } from "react";
2326
2509
  import { BasicInput as BasicInput5, BasicTextarea } from "@ai-matrx/design-system";
2327
2510
  import { getFieldFormat as getFieldFormat3, parseFieldInput } from "@ai-matrx/design-system/field-formats";
2328
2511
 
@@ -2330,8 +2513,8 @@ import { getFieldFormat as getFieldFormat3, parseFieldInput } from "@ai-matrx/de
2330
2513
  import { useRef as useRef7 } from "react";
2331
2514
  import { FormattedCell } from "@ai-matrx/design-system/data-table";
2332
2515
  import { formatFieldValue as formatFieldValue2, getFieldFormat as getFieldFormat2 } from "@ai-matrx/design-system/field-formats";
2333
- import { cn as cn9 } from "@ai-matrx/design-system";
2334
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2516
+ import { cn as cn10 } from "@ai-matrx/design-system";
2517
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
2335
2518
  var LINK = "inline-flex min-w-0 items-center gap-1 text-primary hover:underline";
2336
2519
  var own2 = (event) => event.stopPropagation();
2337
2520
  function numberOf(value) {
@@ -2353,7 +2536,7 @@ function RatingStars({
2353
2536
  const score = numberOf(value) ?? 0;
2354
2537
  const shown2 = Math.round(score);
2355
2538
  const said = `${shown2} out of ${max}`;
2356
- return /* @__PURE__ */ jsx12(
2539
+ return /* @__PURE__ */ jsx13(
2357
2540
  "span",
2358
2541
  {
2359
2542
  "data-records-rating": "",
@@ -2365,8 +2548,8 @@ function RatingStars({
2365
2548
  children: Array.from({ length: max }, (_, i) => {
2366
2549
  const n = i + 1;
2367
2550
  const lit = n <= shown2;
2368
- const star = /* @__PURE__ */ jsx12("span", { "aria-hidden": true, className: cn9("text-sm leading-none", lit ? "text-amber-400" : "text-muted-foreground/40"), children: "\u2605" });
2369
- return onRate ? /* @__PURE__ */ jsx12(
2551
+ const star = /* @__PURE__ */ jsx13("span", { "aria-hidden": true, className: cn10("text-sm leading-none", lit ? "text-amber-400" : "text-muted-foreground/40"), children: "\u2605" });
2552
+ return onRate ? /* @__PURE__ */ jsx13(
2370
2553
  "button",
2371
2554
  {
2372
2555
  type: "button",
@@ -2391,7 +2574,7 @@ function RatingStars({
2391
2574
  children: star
2392
2575
  },
2393
2576
  n
2394
- ) : /* @__PURE__ */ jsx12("span", { children: star }, n);
2577
+ ) : /* @__PURE__ */ jsx13("span", { children: star }, n);
2395
2578
  })
2396
2579
  }
2397
2580
  );
@@ -2399,13 +2582,13 @@ function RatingStars({
2399
2582
  function rich(id, text, raw, format) {
2400
2583
  switch (id) {
2401
2584
  case "email":
2402
- return /* @__PURE__ */ jsx12("a", { href: `mailto:${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ jsx12("span", { className: "truncate", children: text }) });
2585
+ return /* @__PURE__ */ jsx13("a", { href: `mailto:${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ jsx13("span", { className: "truncate", children: text }) });
2403
2586
  case "url":
2404
- return /* @__PURE__ */ jsx12("a", { href: text.includes("://") ? text : `https://${text}`, target: "_blank", rel: "noopener noreferrer", className: LINK, onClick: own2, children: /* @__PURE__ */ jsx12("span", { className: "truncate", children: text }) });
2587
+ return /* @__PURE__ */ jsx13("a", { href: text.includes("://") ? text : `https://${text}`, target: "_blank", rel: "noopener noreferrer", className: LINK, onClick: own2, children: /* @__PURE__ */ jsx13("span", { className: "truncate", children: text }) });
2405
2588
  case "phone":
2406
- return /* @__PURE__ */ jsx12("a", { href: `tel:${text.replace(/[^\d+]/g, "")}`, className: LINK, onClick: own2, title: text, children: /* @__PURE__ */ jsx12("span", { className: "truncate tabular-nums", children: formatPhone(text) }) });
2589
+ return /* @__PURE__ */ jsx13("a", { href: `tel:${text.replace(/[^\d+]/g, "")}`, className: LINK, onClick: own2, title: text, children: /* @__PURE__ */ jsx13("span", { className: "truncate tabular-nums", children: formatPhone(text) }) });
2407
2590
  case "address":
2408
- return /* @__PURE__ */ jsx12(
2591
+ return /* @__PURE__ */ jsx13(
2409
2592
  "a",
2410
2593
  {
2411
2594
  href: `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(text)}`,
@@ -2414,7 +2597,7 @@ function rich(id, text, raw, format) {
2414
2597
  className: LINK,
2415
2598
  title: "Open in maps",
2416
2599
  onClick: own2,
2417
- children: /* @__PURE__ */ jsx12("span", { className: "truncate", children: text })
2600
+ children: /* @__PURE__ */ jsx13("span", { className: "truncate", children: text })
2418
2601
  }
2419
2602
  );
2420
2603
  case "progress": {
@@ -2422,8 +2605,8 @@ function rich(id, text, raw, format) {
2422
2605
  if (n === null) return void 0;
2423
2606
  const pct = format.options?.percentScale === "fraction" ? n * 100 : n;
2424
2607
  const clamped = Math.max(0, Math.min(100, pct));
2425
- return /* @__PURE__ */ jsxs10("span", { className: "inline-flex w-full min-w-0 items-center gap-2", title: text, children: [
2426
- /* @__PURE__ */ jsx12(
2608
+ return /* @__PURE__ */ jsxs11("span", { className: "inline-flex w-full min-w-0 items-center gap-2", title: text, children: [
2609
+ /* @__PURE__ */ jsx13(
2427
2610
  "span",
2428
2611
  {
2429
2612
  role: "progressbar",
@@ -2431,24 +2614,24 @@ function rich(id, text, raw, format) {
2431
2614
  "aria-valuemax": 100,
2432
2615
  "aria-valuenow": Math.round(clamped),
2433
2616
  className: "h-1.5 min-w-8 flex-1 overflow-hidden rounded-full bg-muted",
2434
- children: /* @__PURE__ */ jsx12("span", { className: cn9("block h-full rounded-full", pct >= 100 ? "bg-emerald-500" : "bg-primary"), style: { width: `${clamped}%` } })
2617
+ children: /* @__PURE__ */ jsx13("span", { className: cn10("block h-full rounded-full", pct >= 100 ? "bg-emerald-500" : "bg-primary"), style: { width: `${clamped}%` } })
2435
2618
  }
2436
2619
  ),
2437
- /* @__PURE__ */ jsx12("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: text })
2620
+ /* @__PURE__ */ jsx13("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: text })
2438
2621
  ] });
2439
2622
  }
2440
2623
  case "color":
2441
- return /* @__PURE__ */ jsxs10("span", { className: "inline-flex items-center gap-1.5", children: [
2442
- /* @__PURE__ */ jsx12("span", { className: "h-4 w-4 shrink-0 rounded border border-border", style: { backgroundColor: text } }),
2443
- /* @__PURE__ */ jsx12("code", { className: "font-mono text-xs", children: text })
2624
+ return /* @__PURE__ */ jsxs11("span", { className: "inline-flex items-center gap-1.5", children: [
2625
+ /* @__PURE__ */ jsx13("span", { className: "h-4 w-4 shrink-0 rounded border border-border", style: { backgroundColor: text } }),
2626
+ /* @__PURE__ */ jsx13("code", { className: "font-mono text-xs", children: text })
2444
2627
  ] });
2445
2628
  case "tags": {
2446
2629
  const items = Array.isArray(raw) ? raw.map(String) : text.split(",").map((s) => s.trim()).filter(Boolean);
2447
2630
  if (items.length === 0) return void 0;
2448
- return /* @__PURE__ */ jsx12("span", { className: "flex flex-wrap items-center gap-1", children: items.map((item, i) => /* @__PURE__ */ jsx12("span", { className: "inline-flex items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs", children: item }, `${item}-${i}`)) });
2631
+ return /* @__PURE__ */ jsx13("span", { className: "flex flex-wrap items-center gap-1", children: items.map((item, i) => /* @__PURE__ */ jsx13("span", { className: "inline-flex items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs", children: item }, `${item}-${i}`)) });
2449
2632
  }
2450
2633
  case "rating":
2451
- return numberOf(raw) === null ? void 0 : /* @__PURE__ */ jsx12(RatingStars, { value: raw, max: format.options?.ratingMax ?? 5 });
2634
+ return numberOf(raw) === null ? void 0 : /* @__PURE__ */ jsx13(RatingStars, { value: raw, max: format.options?.ratingMax ?? 5 });
2452
2635
  default:
2453
2636
  return void 0;
2454
2637
  }
@@ -2463,11 +2646,11 @@ function FormattedValue({
2463
2646
  const score = numberOf(value);
2464
2647
  const max = format.options?.ratingMax ?? 5;
2465
2648
  if (def?.id === "rating" && onRate && (value === null || value === void 0 || value === "" || score !== null && score >= 0 && score <= max)) {
2466
- return /* @__PURE__ */ jsx12(RatingStars, { value, max: format.options?.ratingMax ?? 5, onRate, selectFirst });
2649
+ return /* @__PURE__ */ jsx13(RatingStars, { value, max: format.options?.ratingMax ?? 5, onRate, selectFirst });
2467
2650
  }
2468
2651
  const result = formatFieldValue2(value, format);
2469
- if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ jsx12(FormattedCell, { result });
2470
- return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ jsx12(FormattedCell, { result });
2652
+ if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ jsx13(FormattedCell, { result });
2653
+ return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ jsx13(FormattedCell, { result });
2471
2654
  }
2472
2655
  function formatPhone(raw) {
2473
2656
  const text = raw.trim();
@@ -2491,7 +2674,7 @@ function linkChipText(raw) {
2491
2674
  }
2492
2675
 
2493
2676
  // src/formatControls.tsx
2494
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
2677
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
2495
2678
  var TYPED_NUMBERS = /* @__PURE__ */ new Set(["currency", "percent", "progress", "decimal", "duration", "file_size", "integer"]);
2496
2679
  function scaled(format) {
2497
2680
  return (format.id === "percent" || format.id === "progress") && format.options?.percentScale === "fraction";
@@ -2508,13 +2691,13 @@ function keptValue(format, raw) {
2508
2691
  return parsed;
2509
2692
  }
2510
2693
  function NumberInFormat({ format, value, onChange, disabled, id }) {
2511
- const [text, setText] = useState10(() => typedText(format, value));
2694
+ const [text, setText] = useState11(() => typedText(format, value));
2512
2695
  const lastSent = useRef8(void 0);
2513
2696
  useEffect8(() => {
2514
2697
  if (value === lastSent.current) return;
2515
2698
  setText(typedText(format, value));
2516
2699
  }, [value, format]);
2517
- return /* @__PURE__ */ jsx13(
2700
+ return /* @__PURE__ */ jsx14(
2518
2701
  BasicInput5,
2519
2702
  {
2520
2703
  id,
@@ -2539,16 +2722,16 @@ function formatControl(args) {
2539
2722
  const text = value === null || value === void 0 ? "" : String(value);
2540
2723
  const commit = (raw) => onChange(raw === "" ? null : parseFieldInput(raw, format));
2541
2724
  if (def.id === "rating") {
2542
- return disabled ? /* @__PURE__ */ jsx13(RatingStars, { value, max: format.options?.ratingMax ?? 5, label }) : /* @__PURE__ */ jsx13("span", { id, className: "inline-flex", children: /* @__PURE__ */ jsx13(RatingStars, { value, max: format.options?.ratingMax ?? 5, label, onRate: (n) => onChange(n) }) });
2725
+ return disabled ? /* @__PURE__ */ jsx14(RatingStars, { value, max: format.options?.ratingMax ?? 5, label }) : /* @__PURE__ */ jsx14("span", { id, className: "inline-flex", children: /* @__PURE__ */ jsx14(RatingStars, { value, max: format.options?.ratingMax ?? 5, label, onRate: (n) => onChange(n) }) });
2543
2726
  }
2544
- if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */ jsx13(NumberInFormat, { ...args });
2727
+ if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */ jsx14(NumberInFormat, { ...args });
2545
2728
  switch (def.editor) {
2546
2729
  // A TIME OF DAY is not this file's: `FieldControl` draws the typed box and its helper
2547
2730
  // (`TypedWordsControl`), never the browser's time control (grids review 3, 2026-09-30).
2548
2731
  case "email":
2549
2732
  case "url":
2550
2733
  case "tel":
2551
- return /* @__PURE__ */ jsx13(
2734
+ return /* @__PURE__ */ jsx14(
2552
2735
  BasicInput5,
2553
2736
  {
2554
2737
  id,
@@ -2560,8 +2743,8 @@ function formatControl(args) {
2560
2743
  }
2561
2744
  );
2562
2745
  case "color":
2563
- return /* @__PURE__ */ jsxs11("span", { className: "flex items-center gap-2", children: [
2564
- /* @__PURE__ */ jsx13(
2746
+ return /* @__PURE__ */ jsxs12("span", { className: "flex items-center gap-2", children: [
2747
+ /* @__PURE__ */ jsx14(
2565
2748
  BasicInput5,
2566
2749
  {
2567
2750
  id: `${id}-swatch`,
@@ -2573,20 +2756,20 @@ function formatControl(args) {
2573
2756
  onChange: (e) => commit(e.target.value)
2574
2757
  }
2575
2758
  ),
2576
- /* @__PURE__ */ jsx13(BasicInput5, { id, value: text, placeholder: "#3b82f6", disabled, onChange: (e) => commit(e.target.value) })
2759
+ /* @__PURE__ */ jsx14(BasicInput5, { id, value: text, placeholder: "#3b82f6", disabled, onChange: (e) => commit(e.target.value) })
2577
2760
  ] });
2578
2761
  case "textarea":
2579
- return /* @__PURE__ */ jsx13(BasicTextarea, { id, rows: 4, value: text, disabled, onChange: (e) => commit(e.target.value) });
2762
+ return /* @__PURE__ */ jsx14(BasicTextarea, { id, rows: 4, value: text, disabled, onChange: (e) => commit(e.target.value) });
2580
2763
  default:
2581
2764
  return null;
2582
2765
  }
2583
2766
  }
2584
2767
 
2585
2768
  // src/typedDateHelper.tsx
2586
- import { useState as useState11 } from "react";
2587
- import { Popover as Popover3, PopoverContent as PopoverContent3, PopoverTrigger as PopoverTrigger3, cn as cn10 } from "@ai-matrx/design-system";
2769
+ import { useState as useState12 } from "react";
2770
+ import { Popover as Popover3, PopoverContent as PopoverContent3, PopoverTrigger as PopoverTrigger3, cn as cn11 } from "@ai-matrx/design-system";
2588
2771
  import { readTypedDate, readTypedTime, typedDateText, typedTimeText } from "@ai-matrx/records";
2589
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
2772
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
2590
2773
  var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
2591
2774
  var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
2592
2775
  function pad(n) {
@@ -2615,23 +2798,23 @@ function wordsFor(kind, day, time) {
2615
2798
  }
2616
2799
  var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
2617
2800
  function CalendarGlyph() {
2618
- return /* @__PURE__ */ jsxs12("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2619
- /* @__PURE__ */ jsx14("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
2620
- /* @__PURE__ */ jsx14("path", { d: "M16 2v4M8 2v4M3 10h18" })
2801
+ return /* @__PURE__ */ jsxs13("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2802
+ /* @__PURE__ */ jsx15("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
2803
+ /* @__PURE__ */ jsx15("path", { d: "M16 2v4M8 2v4M3 10h18" })
2621
2804
  ] });
2622
2805
  }
2623
2806
  function ClockGlyph() {
2624
- return /* @__PURE__ */ jsxs12("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2625
- /* @__PURE__ */ jsx14("circle", { cx: "12", cy: "12", r: "10" }),
2626
- /* @__PURE__ */ jsx14("path", { d: "M12 6v6l4 2" })
2807
+ return /* @__PURE__ */ jsxs13("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2808
+ /* @__PURE__ */ jsx15("circle", { cx: "12", cy: "12", r: "10" }),
2809
+ /* @__PURE__ */ jsx15("path", { d: "M12 6v6l4 2" })
2627
2810
  ] });
2628
2811
  }
2629
2812
  function TypedDateHelper({ kind, text, onText, label }) {
2630
- const [open, setOpen] = useState11(false);
2813
+ const [open, setOpen] = useState12(false);
2631
2814
  const held = readBox(text, kind);
2632
2815
  const today = /* @__PURE__ */ new Date();
2633
2816
  const start = held.day ? new Date(Number(held.day.slice(0, 4)), Number(held.day.slice(5, 7)) - 1, 1) : new Date(today.getFullYear(), today.getMonth(), 1);
2634
- const [month, setMonth] = useState11(null);
2817
+ const [month, setMonth] = useState12(null);
2635
2818
  const shown2 = month ?? { y: start.getFullYear(), m: start.getMonth() };
2636
2819
  const first = new Date(shown2.y, shown2.m, 1).getDay();
2637
2820
  const days = new Date(shown2.y, shown2.m + 1, 0).getDate();
@@ -2652,8 +2835,8 @@ function TypedDateHelper({ kind, text, onText, label }) {
2652
2835
  const at = new Date(shown2.y, shown2.m + by, 1);
2653
2836
  setMonth({ y: at.getFullYear(), m: at.getMonth() });
2654
2837
  };
2655
- return /* @__PURE__ */ jsxs12(Popover3, { open, onOpenChange: setOpen, children: [
2656
- /* @__PURE__ */ jsx14(PopoverTrigger3, { asChild: true, children: /* @__PURE__ */ jsx14(
2838
+ return /* @__PURE__ */ jsxs13(Popover3, { open, onOpenChange: setOpen, children: [
2839
+ /* @__PURE__ */ jsx15(PopoverTrigger3, { asChild: true, children: /* @__PURE__ */ jsx15(
2657
2840
  "button",
2658
2841
  {
2659
2842
  type: "button",
@@ -2662,10 +2845,10 @@ function TypedDateHelper({ kind, text, onText, label }) {
2662
2845
  "aria-label": kind === "time" ? `Pick a time for ${label}` : `Pick a date for ${label}`,
2663
2846
  title: kind === "time" ? "Pick a time" : "Pick a date",
2664
2847
  className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground",
2665
- children: kind === "time" ? /* @__PURE__ */ jsx14(ClockGlyph, {}) : /* @__PURE__ */ jsx14(CalendarGlyph, {})
2848
+ children: kind === "time" ? /* @__PURE__ */ jsx15(ClockGlyph, {}) : /* @__PURE__ */ jsx15(CalendarGlyph, {})
2666
2849
  }
2667
2850
  ) }),
2668
- /* @__PURE__ */ jsx14(
2851
+ /* @__PURE__ */ jsx15(
2669
2852
  PopoverContent3,
2670
2853
  {
2671
2854
  sizing: "content",
@@ -2675,29 +2858,29 @@ function TypedDateHelper({ kind, text, onText, label }) {
2675
2858
  "data-records-date-helper-panel": "",
2676
2859
  onOpenAutoFocus: (e) => e.preventDefault(),
2677
2860
  onCloseAutoFocus: (e) => e.preventDefault(),
2678
- children: /* @__PURE__ */ jsxs12("div", { className: "flex gap-2", children: [
2679
- kind === "time" ? null : /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1", role: "grid", "aria-label": `${MONTHS[shown2.m]} ${shown2.y}`, children: [
2680
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between text-xs font-medium", children: [
2681
- /* @__PURE__ */ jsx14("button", { type: "button", ...keepFocus, "aria-label": "Previous month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(-1), children: "\u2039" }),
2682
- /* @__PURE__ */ jsxs12("span", { children: [
2861
+ children: /* @__PURE__ */ jsxs13("div", { className: "flex gap-2", children: [
2862
+ kind === "time" ? null : /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-1", role: "grid", "aria-label": `${MONTHS[shown2.m]} ${shown2.y}`, children: [
2863
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between text-xs font-medium", children: [
2864
+ /* @__PURE__ */ jsx15("button", { type: "button", ...keepFocus, "aria-label": "Previous month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(-1), children: "\u2039" }),
2865
+ /* @__PURE__ */ jsxs13("span", { children: [
2683
2866
  MONTHS[shown2.m],
2684
2867
  " ",
2685
2868
  shown2.y
2686
2869
  ] }),
2687
- /* @__PURE__ */ jsx14("button", { type: "button", ...keepFocus, "aria-label": "Next month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(1), children: "\u203A" })
2870
+ /* @__PURE__ */ jsx15("button", { type: "button", ...keepFocus, "aria-label": "Next month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(1), children: "\u203A" })
2688
2871
  ] }),
2689
- /* @__PURE__ */ jsxs12("div", { className: "grid grid-cols-7 gap-0.5 text-center text-[11px]", children: [
2690
- WEEK.map((w) => /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground", children: w }, w)),
2872
+ /* @__PURE__ */ jsxs13("div", { className: "grid grid-cols-7 gap-0.5 text-center text-[11px]", children: [
2873
+ WEEK.map((w) => /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: w }, w)),
2691
2874
  cells.map((d, i) => {
2692
- if (d === null) return /* @__PURE__ */ jsx14("span", {}, `blank-${i}`);
2875
+ if (d === null) return /* @__PURE__ */ jsx15("span", {}, `blank-${i}`);
2693
2876
  const key = `${shown2.y}-${pad(shown2.m + 1)}-${pad(d)}`;
2694
- return /* @__PURE__ */ jsx14(
2877
+ return /* @__PURE__ */ jsx15(
2695
2878
  "button",
2696
2879
  {
2697
2880
  type: "button",
2698
2881
  ...keepFocus,
2699
2882
  "data-records-date-helper-day": key,
2700
- className: cn10(
2883
+ className: cn11(
2701
2884
  "h-6 w-6 rounded tabular-nums hover:bg-muted",
2702
2885
  key === held.day ? "bg-primary text-primary-foreground hover:bg-primary" : "",
2703
2886
  key === todayKey && key !== held.day ? "ring-1 ring-ring" : ""
@@ -2710,13 +2893,13 @@ function TypedDateHelper({ kind, text, onText, label }) {
2710
2893
  })
2711
2894
  ] })
2712
2895
  ] }),
2713
- kind === "date" ? null : /* @__PURE__ */ jsx14("div", { className: "flex max-h-48 flex-col overflow-y-auto pr-1 text-[11px]", "aria-label": "Times", children: times.map((t) => /* @__PURE__ */ jsx14(
2896
+ kind === "date" ? null : /* @__PURE__ */ jsx15("div", { className: "flex max-h-48 flex-col overflow-y-auto pr-1 text-[11px]", "aria-label": "Times", children: times.map((t) => /* @__PURE__ */ jsx15(
2714
2897
  "button",
2715
2898
  {
2716
2899
  type: "button",
2717
2900
  ...keepFocus,
2718
2901
  "data-records-date-helper-time": `${pad(t.h)}:${pad(t.m)}`,
2719
- className: cn10(
2902
+ className: cn11(
2720
2903
  "whitespace-nowrap rounded px-2 py-0.5 text-left tabular-nums hover:bg-muted",
2721
2904
  held.time && held.time.h === t.h && held.time.m === t.m ? "bg-primary text-primary-foreground" : ""
2722
2905
  ),
@@ -2732,8 +2915,8 @@ function TypedDateHelper({ kind, text, onText, label }) {
2732
2915
  }
2733
2916
 
2734
2917
  // src/choiceNudge.ts
2735
- import { useEffect as useEffect9, useState as useState12 } from "react";
2736
- import { useOptionalRecordsClient as useOptionalRecordsClient5 } from "@ai-matrx/records/react";
2918
+ import { useEffect as useEffect9, useState as useState13 } from "react";
2919
+ import { useOptionalRecordsClient as useOptionalRecordsClient6 } from "@ai-matrx/records/react";
2737
2920
  var asked = /* @__PURE__ */ new WeakMap();
2738
2921
  function choiceNudgeOf(client) {
2739
2922
  let answer = asked.get(client);
@@ -2747,8 +2930,8 @@ function choiceNudgeOf(client) {
2747
2930
  return answer;
2748
2931
  }
2749
2932
  function useChoiceNudge(enabled = true) {
2750
- const client = useOptionalRecordsClient5();
2751
- const [nudge, setNudge] = useState12(null);
2933
+ const client = useOptionalRecordsClient6();
2934
+ const [nudge, setNudge] = useState13(null);
2752
2935
  useEffect9(() => {
2753
2936
  if (!enabled || !client) return;
2754
2937
  let live = true;
@@ -2821,7 +3004,7 @@ function choiceChipLookOf(field, ...words) {
2821
3004
  }
2822
3005
 
2823
3006
  // src/editors.tsx
2824
- import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
3007
+ import { Fragment as Fragment4, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
2825
3008
  var CHOICE_EDITOR_ADDS_WHAT_IS_TYPED = true;
2826
3009
  function isChoiceAddition(value) {
2827
3010
  return typeof value === "object" && value !== null && value.addingChoices === true;
@@ -2851,12 +3034,12 @@ function ChoiceAskButtons({
2851
3034
  onCancel,
2852
3035
  busy
2853
3036
  }) {
2854
- return /* @__PURE__ */ jsxs13("span", { "data-records-choice-ask": "", role: "group", "aria-label": choiceAskSentence(field, words), className: "flex flex-col gap-1", children: [
2855
- /* @__PURE__ */ jsx15("span", { className: "text-[11px] leading-snug", children: choiceAskSentence(field, words) }),
2856
- /* @__PURE__ */ jsxs13("span", { className: "flex flex-wrap items-center gap-1", children: [
2857
- /* @__PURE__ */ jsx15(Button8, { type: "button", size: "sm", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onAdd, children: "Add" }),
2858
- keepOffered ? /* @__PURE__ */ jsx15(Button8, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onKeep, children: "Keep as typed" }) : null,
2859
- /* @__PURE__ */ jsx15(Button8, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onCancel, children: "Cancel" })
3037
+ return /* @__PURE__ */ jsxs14("span", { "data-records-choice-ask": "", role: "group", "aria-label": choiceAskSentence(field, words), className: "flex flex-col gap-1", children: [
3038
+ /* @__PURE__ */ jsx16("span", { className: "text-[11px] leading-snug", children: choiceAskSentence(field, words) }),
3039
+ /* @__PURE__ */ jsxs14("span", { className: "flex flex-wrap items-center gap-1", children: [
3040
+ /* @__PURE__ */ jsx16(Button8, { type: "button", size: "sm", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onAdd, children: "Add" }),
3041
+ keepOffered ? /* @__PURE__ */ jsx16(Button8, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onKeep, children: "Keep as typed" }) : null,
3042
+ /* @__PURE__ */ jsx16(Button8, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onCancel, children: "Cancel" })
2860
3043
  ] })
2861
3044
  ] });
2862
3045
  }
@@ -2939,11 +3122,11 @@ function openingText(field, value) {
2939
3122
  return format ? typedText(format, value) : String(value);
2940
3123
  }
2941
3124
  function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCancel }) {
2942
- const client = useOptionalRecordsClient6();
3125
+ const client = useOptionalRecordsClient7();
2943
3126
  const kind = String(editorKindFor(field));
2944
3127
  const needsChoices = kind === "select" || kind === "multi_select";
2945
3128
  const nudge = useChoiceNudge(needsChoices);
2946
- const [choices, setChoices] = useState13(null);
3129
+ const [choices, setChoices] = useState14(null);
2947
3130
  useEffect10(() => {
2948
3131
  if (!needsChoices || !client) return;
2949
3132
  let cancelled = false;
@@ -2966,7 +3149,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
2966
3149
  judged: judgeTyped(field, text, needsChoices ? choices : void 0, needsChoices ? nudge : void 0),
2967
3150
  ...value.openedAs !== void 0 ? { openedAs: value.openedAs } : {}
2968
3151
  });
2969
- const box = /* @__PURE__ */ jsx15(
3152
+ const box = /* @__PURE__ */ jsx16(
2970
3153
  BasicInput6,
2971
3154
  {
2972
3155
  id,
@@ -2978,16 +3161,16 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
2978
3161
  onChange: (e) => retype(e.target.value)
2979
3162
  }
2980
3163
  );
2981
- return /* @__PURE__ */ jsxs13("span", { className: "flex flex-col gap-0.5", children: [
2982
- helper && !disabled ? /* @__PURE__ */ jsxs13("span", { className: "flex min-w-0 items-center gap-0.5", children: [
3164
+ return /* @__PURE__ */ jsxs14("span", { className: "flex flex-col gap-0.5", children: [
3165
+ helper && !disabled ? /* @__PURE__ */ jsxs14("span", { className: "flex min-w-0 items-center gap-0.5", children: [
2983
3166
  box,
2984
- /* @__PURE__ */ jsx15(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field) })
3167
+ /* @__PURE__ */ jsx16(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field) })
2985
3168
  ] }) : box,
2986
- judged === null ? /* @__PURE__ */ jsxs13("span", { className: "text-[10px] text-muted-foreground", children: [
3169
+ judged === null ? /* @__PURE__ */ jsxs14("span", { className: "text-[10px] text-muted-foreground", children: [
2987
3170
  "Reading ",
2988
3171
  fieldName(field),
2989
3172
  "'s choices\u2026"
2990
- ] }) : "ask" in judged ? /* @__PURE__ */ jsx15(
3173
+ ] }) : "ask" in judged ? /* @__PURE__ */ jsx16(
2991
3174
  ChoiceAskButtons,
2992
3175
  {
2993
3176
  field,
@@ -3003,10 +3186,10 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
3003
3186
  },
3004
3187
  onCancel: () => onCancel?.()
3005
3188
  }
3006
- ) : "refusal" in judged ? /* @__PURE__ */ jsxs13("span", { className: "flex flex-col gap-1", children: [
3007
- /* @__PURE__ */ jsx15("span", { "data-records-typed-refusal": "", role: "status", className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: judged.refusal }),
3008
- judged.cancelOnly && onCancel ? /* @__PURE__ */ jsx15("span", { "data-records-choice-ask": "", children: /* @__PURE__ */ jsx15(Button8, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onCancel(), children: "Cancel" }) }) : null
3009
- ] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ jsxs13("span", { "data-records-typed-reads-as": "", className: "text-[10px] text-muted-foreground", children: [
3189
+ ) : "refusal" in judged ? /* @__PURE__ */ jsxs14("span", { className: "flex flex-col gap-1", children: [
3190
+ /* @__PURE__ */ jsx16("span", { "data-records-typed-refusal": "", role: "status", className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: judged.refusal }),
3191
+ judged.cancelOnly && onCancel ? /* @__PURE__ */ jsx16("span", { "data-records-choice-ask": "", children: /* @__PURE__ */ jsx16(Button8, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onCancel(), children: "Cancel" }) }) : null
3192
+ ] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ jsxs14("span", { "data-records-typed-reads-as": "", className: "text-[10px] text-muted-foreground", children: [
3010
3193
  isChoiceAddition(judged.value) ? `Adds ${quoted(judged.value.add)} to the choices for ${fieldName(field)}. ` : null,
3011
3194
  "Reads as",
3012
3195
  " ",
@@ -3017,7 +3200,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
3017
3200
  }).join(", ")
3018
3201
  ) : (() => {
3019
3202
  const shown2 = format ?? (kind === "datetime" ? { id: carriesTimeOfDay(field, judged.value) ? "datetime" : "date" } : void 0);
3020
- return shown2 ? /* @__PURE__ */ jsx15(FormattedValue, { value: judged.value, format: shown2 }) : String(judged.value);
3203
+ return shown2 ? /* @__PURE__ */ jsx16(FormattedValue, { value: judged.value, format: shown2 }) : String(judged.value);
3021
3204
  })()
3022
3205
  ] })
3023
3206
  ] });
@@ -3030,13 +3213,13 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3030
3213
  const host = useRecordsUi();
3031
3214
  const kind = editorKindFor(field);
3032
3215
  const inputId = id ?? `field-${field.key}`;
3033
- const ownDetails = useOptionalRecordsClient6() === null;
3034
- if (isTypedDraft(value)) return /* @__PURE__ */ jsx15(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
3035
- if (isSignatureField(field)) return /* @__PURE__ */ jsx15(SignaturePad, { id: inputId, value, onChange, disabled });
3216
+ const ownDetails = useOptionalRecordsClient7() === null;
3217
+ if (isTypedDraft(value)) return /* @__PURE__ */ jsx16(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
3218
+ if (isSignatureField(field)) return /* @__PURE__ */ jsx16(SignaturePad, { id: inputId, value, onChange, disabled });
3036
3219
  const newerControl = newerKindControl({ field, value, onChange, disabled, id: inputId });
3037
3220
  if (newerControl !== void 0) return newerControl;
3038
3221
  const format = formatForField(field);
3039
- if (format && format.id === "time") return /* @__PURE__ */ jsx15(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
3222
+ if (format && format.id === "time") return /* @__PURE__ */ jsx16(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
3040
3223
  if (format && !FORMAT_BLIND_KINDS.has(String(kind))) {
3041
3224
  const own3 = formatControl({ format, value, onChange, disabled, id: inputId, label: fieldName(field), ownDetails });
3042
3225
  if (own3) return own3;
@@ -3045,17 +3228,17 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3045
3228
  case "formula":
3046
3229
  case "lookup":
3047
3230
  case "rollup":
3048
- return /* @__PURE__ */ jsxs13("div", { id: inputId, className: "rounded border border-dashed px-2 py-1.5 text-xs text-muted-foreground", children: [
3231
+ return /* @__PURE__ */ jsxs14("div", { id: inputId, className: "rounded border border-dashed px-2 py-1.5 text-xs text-muted-foreground", children: [
3049
3232
  value === null || value === void 0 ? "\u2014" : String(value),
3050
- /* @__PURE__ */ jsxs13("span", { className: "ml-2 italic", children: [
3233
+ /* @__PURE__ */ jsxs14("span", { className: "ml-2 italic", children: [
3051
3234
  fieldName(field),
3052
3235
  " is worked out by the system, so it cannot be typed in"
3053
3236
  ] })
3054
3237
  ] });
3055
3238
  case "json":
3056
- return /* @__PURE__ */ jsx15(JsonControl, { field, value, onChange, disabled, id: inputId });
3239
+ return /* @__PURE__ */ jsx16(JsonControl, { field, value, onChange, disabled, id: inputId });
3057
3240
  case "long_text":
3058
- return /* @__PURE__ */ jsx15(
3241
+ return /* @__PURE__ */ jsx16(
3059
3242
  BasicTextarea2,
3060
3243
  {
3061
3244
  id: inputId,
@@ -3068,7 +3251,7 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3068
3251
  case "number":
3069
3252
  case "currency":
3070
3253
  case "percent":
3071
- return /* @__PURE__ */ jsx15(
3254
+ return /* @__PURE__ */ jsx16(
3072
3255
  BasicInput6,
3073
3256
  {
3074
3257
  id: inputId,
@@ -3081,11 +3264,11 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3081
3264
  }
3082
3265
  );
3083
3266
  case "datetime":
3084
- return /* @__PURE__ */ jsx15(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
3267
+ return /* @__PURE__ */ jsx16(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
3085
3268
  case "email":
3086
3269
  case "phone":
3087
3270
  case "url":
3088
- return /* @__PURE__ */ jsx15(
3271
+ return /* @__PURE__ */ jsx16(
3089
3272
  BasicInput6,
3090
3273
  {
3091
3274
  id: inputId,
@@ -3097,24 +3280,24 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3097
3280
  }
3098
3281
  );
3099
3282
  case "checkbox":
3100
- return /* @__PURE__ */ jsx15(CheckboxControl, { field, value, onChange, disabled, id: inputId });
3283
+ return /* @__PURE__ */ jsx16(CheckboxControl, { field, value, onChange, disabled, id: inputId });
3101
3284
  case "select":
3102
3285
  case "multi_select":
3103
- return /* @__PURE__ */ jsx15(OptionControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, addsChoices, initialSearch, asForm });
3286
+ return /* @__PURE__ */ jsx16(OptionControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, addsChoices, initialSearch, asForm });
3104
3287
  case "member":
3105
- return /* @__PURE__ */ jsx15(PersonPicker, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, initialSearch });
3288
+ return /* @__PURE__ */ jsx16(PersonPicker, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, initialSearch });
3106
3289
  case "entity_reference":
3107
- return /* @__PURE__ */ jsx15(EntityReferenceControl, { field, value, onChange, disabled, id: inputId });
3290
+ return /* @__PURE__ */ jsx16(EntityReferenceControl, { field, value, onChange, disabled, id: inputId });
3108
3291
  case "attachment":
3109
3292
  if (hostTakesFiles(host)) {
3110
- return /* @__PURE__ */ jsx15(AttachmentControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose });
3293
+ return /* @__PURE__ */ jsx16(AttachmentControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose });
3111
3294
  }
3112
- return /* @__PURE__ */ jsx15(RelationPicker, { field, value, onChange, disabled, id: inputId });
3295
+ return /* @__PURE__ */ jsx16(RelationPicker, { field, value, onChange, disabled, id: inputId });
3113
3296
  case "relation":
3114
- return /* @__PURE__ */ jsx15(RelationPicker, { field, value, onChange, disabled, id: inputId });
3297
+ return /* @__PURE__ */ jsx16(RelationPicker, { field, value, onChange, disabled, id: inputId });
3115
3298
  default:
3116
3299
  if (typeof value === "boolean" || field.config?.["kind"] === "boolean") {
3117
- return /* @__PURE__ */ jsx15(
3300
+ return /* @__PURE__ */ jsx16(
3118
3301
  Checkbox,
3119
3302
  {
3120
3303
  id: inputId,
@@ -3124,7 +3307,7 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3124
3307
  }
3125
3308
  );
3126
3309
  }
3127
- return /* @__PURE__ */ jsx15(
3310
+ return /* @__PURE__ */ jsx16(
3128
3311
  BasicInput6,
3129
3312
  {
3130
3313
  id: inputId,
@@ -3137,8 +3320,8 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3137
3320
  }
3138
3321
  }
3139
3322
  function TypedWordsControl({ field, value, onChange, disabled, id }) {
3140
- const [text, setText] = useState13(() => openingText(field, value));
3141
- const [refusal2, setRefusal] = useState13(null);
3323
+ const [text, setText] = useState14(() => openingText(field, value));
3324
+ const [refusal2, setRefusal] = useState14(null);
3142
3325
  const sent = useRef9(value);
3143
3326
  useEffect10(() => {
3144
3327
  if (value === sent.current) return;
@@ -3158,9 +3341,9 @@ function TypedWordsControl({ field, value, onChange, disabled, id }) {
3158
3341
  setRefusal(judged.refusal);
3159
3342
  }
3160
3343
  };
3161
- return /* @__PURE__ */ jsxs13("span", { className: "flex flex-col gap-0.5", children: [
3162
- /* @__PURE__ */ jsxs13("span", { className: "flex min-w-0 items-center gap-0.5", children: [
3163
- /* @__PURE__ */ jsx15(
3344
+ return /* @__PURE__ */ jsxs14("span", { className: "flex flex-col gap-0.5", children: [
3345
+ /* @__PURE__ */ jsxs14("span", { className: "flex min-w-0 items-center gap-0.5", children: [
3346
+ /* @__PURE__ */ jsx16(
3164
3347
  BasicInput6,
3165
3348
  {
3166
3349
  id,
@@ -3177,15 +3360,15 @@ function TypedWordsControl({ field, value, onChange, disabled, id }) {
3177
3360
  }
3178
3361
  }
3179
3362
  ),
3180
- helper && !disabled ? /* @__PURE__ */ jsx15(TypedDateHelper, { kind: helper, text, onText: retype, label: fieldName(field) }) : null
3363
+ helper && !disabled ? /* @__PURE__ */ jsx16(TypedDateHelper, { kind: helper, text, onText: retype, label: fieldName(field) }) : null
3181
3364
  ] }),
3182
- refusal2 ? /* @__PURE__ */ jsx15("span", { "data-records-typed-refusal": "", role: "status", className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: refusal2 }) : null
3365
+ refusal2 ? /* @__PURE__ */ jsx16("span", { "data-records-typed-refusal": "", role: "status", className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: refusal2 }) : null
3183
3366
  ] });
3184
3367
  }
3185
3368
  function CheckboxControl({ field, value, onChange, disabled, id }) {
3186
3369
  const unanswered = value === null || value === void 0;
3187
- return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
3188
- /* @__PURE__ */ jsx15(
3370
+ return /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
3371
+ /* @__PURE__ */ jsx16(
3189
3372
  Checkbox,
3190
3373
  {
3191
3374
  id,
@@ -3195,9 +3378,9 @@ function CheckboxControl({ field, value, onChange, disabled, id }) {
3195
3378
  onCheckedChange: (next) => onChange(next === true)
3196
3379
  }
3197
3380
  ),
3198
- unanswered ? /* @__PURE__ */ jsx15("span", { className: "text-xs italic text-muted-foreground", children: "not answered yet" }) : /* @__PURE__ */ jsxs13(Fragment4, { children: [
3199
- /* @__PURE__ */ jsx15("span", { className: "text-xs text-muted-foreground", children: value === true ? "Yes" : "No" }),
3200
- field.required ? null : /* @__PURE__ */ jsx15(
3381
+ unanswered ? /* @__PURE__ */ jsx16("span", { className: "text-xs italic text-muted-foreground", children: "not answered yet" }) : /* @__PURE__ */ jsxs14(Fragment4, { children: [
3382
+ /* @__PURE__ */ jsx16("span", { className: "text-xs text-muted-foreground", children: value === true ? "Yes" : "No" }),
3383
+ field.required ? null : /* @__PURE__ */ jsx16(
3201
3384
  Button8,
3202
3385
  {
3203
3386
  size: "sm",
@@ -3213,10 +3396,10 @@ function CheckboxControl({ field, value, onChange, disabled, id }) {
3213
3396
  }
3214
3397
  function JsonControl({ field, value, onChange, disabled, id }) {
3215
3398
  const initial = value === null || value === void 0 ? "" : typeof value === "string" ? value : JSON.stringify(value, null, 2);
3216
- const [text, setText] = useState13(initial);
3217
- const [broken, setBroken] = useState13(null);
3218
- return /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-1", children: [
3219
- /* @__PURE__ */ jsx15(
3399
+ const [text, setText] = useState14(initial);
3400
+ const [broken, setBroken] = useState14(null);
3401
+ return /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-1", children: [
3402
+ /* @__PURE__ */ jsx16(
3220
3403
  BasicTextarea2,
3221
3404
  {
3222
3405
  id,
@@ -3250,7 +3433,7 @@ function JsonControl({ field, value, onChange, disabled, id }) {
3250
3433
  ),
3251
3434
  broken ? (
3252
3435
  // The typed text is still in the box: the notice owns the two doors out.
3253
- /* @__PURE__ */ jsx15(
3436
+ /* @__PURE__ */ jsx16(
3254
3437
  RefusalNotice,
3255
3438
  {
3256
3439
  error: broken,
@@ -3274,10 +3457,10 @@ function inTheStoresOrder(options) {
3274
3457
  return [...options].sort((a, b) => position(a) - position(b) || made(a).localeCompare(made(b)));
3275
3458
  }
3276
3459
  function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose, addsChoices, initialSearch, asForm }) {
3277
- const client = useOptionalRecordsClient6();
3278
- const [options, setOptions] = useState13(null);
3279
- const [refusal2, setRefusal] = useState13(null);
3280
- const [reread, setReread] = useState13(0);
3460
+ const client = useOptionalRecordsClient7();
3461
+ const [options, setOptions] = useState14(null);
3462
+ const [refusal2, setRefusal] = useState14(null);
3463
+ const [reread, setReread] = useState14(0);
3281
3464
  useEffect10(() => {
3282
3465
  if (!client) return;
3283
3466
  let cancelled = false;
@@ -3292,11 +3475,11 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3292
3475
  }, [client, field.id, reread]);
3293
3476
  const handed = publicChoicesOf(field);
3294
3477
  if (!client && handed.length > 0) {
3295
- return /* @__PURE__ */ jsx15(ChoiceAnswer, { field, choices: handed, value, onChange, disabled, id });
3478
+ return /* @__PURE__ */ jsx16(ChoiceAnswer, { field, choices: handed, value, onChange, disabled, id });
3296
3479
  }
3297
3480
  if (!client) {
3298
- return /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-1", children: [
3299
- /* @__PURE__ */ jsx15(
3481
+ return /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-1", children: [
3482
+ /* @__PURE__ */ jsx16(
3300
3483
  BasicInput6,
3301
3484
  {
3302
3485
  id,
@@ -3305,15 +3488,15 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3305
3488
  onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
3306
3489
  }
3307
3490
  ),
3308
- /* @__PURE__ */ jsx15("p", { className: "text-xs text-muted-foreground", children: "This is normally picked from a list. A page answered without an account cannot read that list, so type your answer and whoever receives it will match it up." })
3491
+ /* @__PURE__ */ jsx16("p", { className: "text-xs text-muted-foreground", children: "This is normally picked from a list. A page answered without an account cannot read that list, so type your answer and whoever receives it will match it up." })
3309
3492
  ] });
3310
3493
  }
3311
3494
  if (refusal2)
3312
- return /* @__PURE__ */ jsx15("div", { id, children: /* @__PURE__ */ jsx15(RefusalLine, { error: refusal2 }) });
3313
- if (!options) return /* @__PURE__ */ jsx15("p", { id, className: "text-xs text-muted-foreground", children: "Reading this field's choices\u2026" });
3495
+ return /* @__PURE__ */ jsx16("div", { id, children: /* @__PURE__ */ jsx16(RefusalLine, { error: refusal2 }) });
3496
+ if (!options) return /* @__PURE__ */ jsx16("p", { id, className: "text-xs text-muted-foreground", children: "Reading this field's choices\u2026" });
3314
3497
  if (asForm && options.length > 0) {
3315
3498
  const titled = (option) => recordName(option.data, null, "Unnamed choice");
3316
- return /* @__PURE__ */ jsx15(
3499
+ return /* @__PURE__ */ jsx16(
3317
3500
  ChoiceAnswer,
3318
3501
  {
3319
3502
  field,
@@ -3330,7 +3513,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3330
3513
  );
3331
3514
  }
3332
3515
  if (CHOICE_EDITOR_ADDS_WHAT_IS_TYPED) {
3333
- return /* @__PURE__ */ jsx15(
3516
+ return /* @__PURE__ */ jsx16(
3334
3517
  OpenChoicePicker,
3335
3518
  {
3336
3519
  field,
@@ -3349,13 +3532,13 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3349
3532
  );
3350
3533
  }
3351
3534
  if (options.length === 0) {
3352
- return /* @__PURE__ */ jsx15("p", { id, className: "text-xs text-muted-foreground", children: field.options_table_id ? `${fieldName(field)} takes its choices from a Table that has no records yet \u2014 add the choices there and they appear here.` : `${fieldName(field)} does not name the Table its choices come from yet, so there is nothing to choose. A table admin sets it in the field editor.` });
3535
+ return /* @__PURE__ */ jsx16("p", { id, className: "text-xs text-muted-foreground", children: field.options_table_id ? `${fieldName(field)} takes its choices from a Table that has no records yet \u2014 add the choices there and they appear here.` : `${fieldName(field)} does not name the Table its choices come from yet, so there is nothing to choose. A table admin sets it in the field editor.` });
3353
3536
  }
3354
3537
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
3355
3538
  if (field.multi) {
3356
3539
  const chosen = options.filter((option) => choiceValuesOf(value).some((v) => isTheChosen(option, v)));
3357
3540
  const picked = new Set(chosen.map((option) => optionKey2(option)));
3358
- const toggles = /* @__PURE__ */ jsx15("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ jsx15(
3541
+ const toggles = /* @__PURE__ */ jsx16("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ jsx16(
3359
3542
  Button8,
3360
3543
  {
3361
3544
  type: "button",
@@ -3373,7 +3556,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3373
3556
  option.id
3374
3557
  )) });
3375
3558
  if (!autoOpen) return toggles;
3376
- return /* @__PURE__ */ jsxs13(
3559
+ return /* @__PURE__ */ jsxs14(
3377
3560
  Popover4,
3378
3561
  {
3379
3562
  defaultOpen: true,
@@ -3381,15 +3564,15 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3381
3564
  if (!open) onClose?.();
3382
3565
  },
3383
3566
  children: [
3384
- /* @__PURE__ */ jsx15(PopoverTrigger4, { asChild: true, children: /* @__PURE__ */ jsx15(Button8, { id, type: "button", size: "sm", variant: "outline", className: "h-6 max-w-full truncate", children: chosen.length === 0 ? "Choose" : chosen.map(titleOf).join(", ") }) }),
3385
- /* @__PURE__ */ jsx15(PopoverContent4, { sizing: "content", className: "max-w-[20rem] p-2", align: "start", children: toggles })
3567
+ /* @__PURE__ */ jsx16(PopoverTrigger4, { asChild: true, children: /* @__PURE__ */ jsx16(Button8, { id, type: "button", size: "sm", variant: "outline", className: "h-6 max-w-full truncate", children: chosen.length === 0 ? "Choose" : chosen.map(titleOf).join(", ") }) }),
3568
+ /* @__PURE__ */ jsx16(PopoverContent4, { sizing: "content", className: "max-w-[20rem] p-2", align: "start", children: toggles })
3386
3569
  ]
3387
3570
  }
3388
3571
  );
3389
3572
  }
3390
3573
  const current = options.find((option) => isTheChosen(option, value));
3391
- return /* @__PURE__ */ jsxs13(
3392
- Select,
3574
+ return /* @__PURE__ */ jsxs14(
3575
+ Select2,
3393
3576
  {
3394
3577
  value: current ? optionKey2(current) : "",
3395
3578
  disabled: disabled ?? false,
@@ -3402,8 +3585,8 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3402
3585
  }
3403
3586
  } : {},
3404
3587
  children: [
3405
- /* @__PURE__ */ jsx15(SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ jsx15(SelectValue, { placeholder: "Choose" }) }),
3406
- /* @__PURE__ */ jsx15(SelectContent, { children: options.map((option) => /* @__PURE__ */ jsx15(SelectItem, { value: optionKey2(option), children: titleOf(option) }, option.id)) })
3588
+ /* @__PURE__ */ jsx16(SelectTrigger2, { id, size: "sm", children: /* @__PURE__ */ jsx16(SelectValue2, { placeholder: "Choose" }) }),
3589
+ /* @__PURE__ */ jsx16(SelectContent2, { children: options.map((option) => /* @__PURE__ */ jsx16(SelectItem2, { value: optionKey2(option), children: titleOf(option) }, option.id)) })
3407
3590
  ]
3408
3591
  }
3409
3592
  );
@@ -3422,18 +3605,18 @@ function OpenChoicePicker({
3422
3605
  allowOther = true,
3423
3606
  onChoicesChanged
3424
3607
  }) {
3425
- const client = useOptionalRecordsClient6();
3608
+ const client = useOptionalRecordsClient7();
3426
3609
  const nudge = useChoiceNudge();
3427
- const [open, setOpenState] = useState13(autoOpen === true);
3610
+ const [open, setOpenState] = useState14(autoOpen === true);
3428
3611
  const onCloseRef = useRef9(onClose);
3429
3612
  onCloseRef.current = onClose;
3430
3613
  const setOpen = useCallback4((next) => {
3431
3614
  setOpenState(next);
3432
3615
  if (!next) onCloseRef.current?.();
3433
3616
  }, []);
3434
- const [search, setSearch] = useState13(initialSearch ?? "");
3435
- const [adding, setAdding] = useState13(false);
3436
- const [addRefused, setAddRefused] = useState13(null);
3617
+ const [search, setSearch] = useState14(initialSearch ?? "");
3618
+ const [adding, setAdding] = useState14(false);
3619
+ const [addRefused, setAddRefused] = useState14(null);
3437
3620
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
3438
3621
  const held = withoutAddition(value);
3439
3622
  const current = choiceValuesOf(held.value);
@@ -3485,7 +3668,7 @@ function OpenChoicePicker({
3485
3668
  });
3486
3669
  };
3487
3670
  const offList = q !== "" && decided.decision !== "chosen" && decided.decision !== "empty";
3488
- const foot = offList && decided.decision === "ask" ? /* @__PURE__ */ jsx15(
3671
+ const foot = offList && decided.decision === "ask" ? /* @__PURE__ */ jsx16(
3489
3672
  ChoiceAskButtons,
3490
3673
  {
3491
3674
  field,
@@ -3502,14 +3685,14 @@ function OpenChoicePicker({
3502
3685
  }
3503
3686
  ) : null;
3504
3687
  const add = offList && decided.decision === "add" ? { label: `Add \u201C${q}\u201D to the choices`, onAdd: addTyped, disabled: adding } : offList && decided.decision === "keep_as_typed" ? { label: `Keep \u201C${q}\u201D as typed`, onAdd: () => choose(q) } : null;
3505
- return /* @__PURE__ */ jsxs13("div", { id, className: "flex flex-wrap items-center gap-1", children: [
3688
+ return /* @__PURE__ */ jsxs14("div", { id, className: "flex flex-wrap items-center gap-1", children: [
3506
3689
  pickedWords.map((word, i) => {
3507
3690
  const chip = chipOf(options.find((o) => isTheChosen(o, current[i])), word);
3508
- return /* @__PURE__ */ jsx15(Badge3, { variant: "outline", className: cn11("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
3691
+ return /* @__PURE__ */ jsx16(Badge3, { variant: "outline", className: cn12("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
3509
3692
  }),
3510
3693
  disabled ? null : (
3511
3694
  // THE ONE "PICK OR ADD" BUILDER (PickOrAdd.tsx) — the relation picker draws the same one.
3512
- /* @__PURE__ */ jsx15(
3695
+ /* @__PURE__ */ jsx16(
3513
3696
  PickOrAdd,
3514
3697
  {
3515
3698
  triggerLabel: `Pick for ${fieldName(field)}`,
@@ -3531,15 +3714,15 @@ function OpenChoicePicker({
3531
3714
  const option = options.find((o) => o.id === optionId);
3532
3715
  if (option) choose(optionKey2(option));
3533
3716
  },
3534
- empty: q === "" ? /* @__PURE__ */ jsx15("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
3717
+ empty: q === "" ? /* @__PURE__ */ jsx16("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
3535
3718
  add,
3536
3719
  foot,
3537
3720
  ...offList && decided.decision === "ask" && !adding ? { onEnterWithNoMatch: addTyped } : {},
3538
- footNote: addRefused ? /* @__PURE__ */ jsx15(RefusalLine, { error: addRefused }) : offList && decided.decision === "not_a_choice" ? (
3721
+ footNote: addRefused ? /* @__PURE__ */ jsx16(RefusalLine, { error: addRefused }) : offList && decided.decision === "not_a_choice" ? (
3539
3722
  // never_add on a column that takes only its choices: said, never a silent nothing.
3540
- /* @__PURE__ */ jsxs13(Fragment4, { children: [
3541
- /* @__PURE__ */ jsx15("p", { "data-records-typed-refusal": "", className: "p-2 text-xs text-muted-foreground", children: notAChoiceSentence(field, [q]) }),
3542
- autoOpen ? /* @__PURE__ */ jsx15("span", { "data-records-choice-ask": "", className: "px-2 pb-1", children: /* @__PURE__ */ jsx15(Button8, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => setOpen(false), children: "Cancel" }) }) : null
3723
+ /* @__PURE__ */ jsxs14(Fragment4, { children: [
3724
+ /* @__PURE__ */ jsx16("p", { "data-records-typed-refusal": "", className: "p-2 text-xs text-muted-foreground", children: notAChoiceSentence(field, [q]) }),
3725
+ autoOpen ? /* @__PURE__ */ jsx16("span", { "data-records-choice-ask": "", className: "px-2 pb-1", children: /* @__PURE__ */ jsx16(Button8, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => setOpen(false), children: "Cancel" }) }) : null
3543
3726
  ] })
3544
3727
  ) : null
3545
3728
  }
@@ -3558,9 +3741,9 @@ function RecordChip({
3558
3741
  // name. So it caps at its container and ends in an ellipsis with the whole name in
3559
3742
  // its tooltip, rather than being cut mid-word by whatever box it landed in
3560
3743
  // (lane FIX-14, 2026-09-22).
3561
- /* @__PURE__ */ jsxs13(Badge3, { variant: "secondary", className: cn11("max-w-full gap-1 text-[11px]", className), title, children: [
3562
- /* @__PURE__ */ jsx15("span", { className: "min-w-0 truncate", children: title }),
3563
- onRemove ? /* @__PURE__ */ jsx15("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${title}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
3744
+ /* @__PURE__ */ jsxs14(Badge3, { variant: "secondary", className: cn12("max-w-full gap-1 text-[11px]", className), title, children: [
3745
+ /* @__PURE__ */ jsx16("span", { className: "min-w-0 truncate", children: title }),
3746
+ onRemove ? /* @__PURE__ */ jsx16("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${title}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
3564
3747
  ] })
3565
3748
  );
3566
3749
  }
@@ -3572,7 +3755,8 @@ function publicChoicesOf(field) {
3572
3755
  return typeof o.key === "string" && typeof o.label === "string" ? [{ key: o.key, label: o.label }] : [];
3573
3756
  });
3574
3757
  }
3575
- var FORM_PILL_LIMIT = 4;
3758
+ var FORM_SEARCH_AFTER = 8;
3759
+ var CHOICE_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
3576
3760
  function ChoiceAnswer({
3577
3761
  field,
3578
3762
  choices,
@@ -3582,7 +3766,7 @@ function ChoiceAnswer({
3582
3766
  id,
3583
3767
  isChosen
3584
3768
  }) {
3585
- const [search, setSearch] = useState13("");
3769
+ const [search, setSearch] = useState14("");
3586
3770
  const held = field.multi ? choiceValuesOf(value) : value === null || value === void 0 || value === "" ? [] : [value];
3587
3771
  const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
3588
3772
  const press = (choice) => {
@@ -3593,40 +3777,59 @@ function ChoiceAnswer({
3593
3777
  const keys = choices.filter((c) => c.key === choice.key ? !on(c) : on(c)).map((c) => c.key);
3594
3778
  onChange(keys.length === 0 ? null : keys);
3595
3779
  };
3596
- const pill = (choice) => {
3780
+ const lettered = choices.length <= CHOICE_LETTERS.length;
3781
+ const option = (choice) => {
3597
3782
  const chosen = on(choice);
3598
- const look = choiceChipLookOf(field, choice.key, choice.label);
3599
- return /* @__PURE__ */ jsxs13(
3783
+ const letter = lettered ? CHOICE_LETTERS[choices.indexOf(choice)] : null;
3784
+ return /* @__PURE__ */ jsxs14(
3600
3785
  "button",
3601
3786
  {
3602
3787
  type: "button",
3603
3788
  role: field.multi ? "checkbox" : "radio",
3604
3789
  "aria-checked": chosen,
3790
+ "aria-label": choice.label,
3605
3791
  disabled,
3606
3792
  onClick: () => press(choice),
3607
- "data-records-choice-chip": "",
3608
3793
  "data-records-choice-answer": choice.key,
3609
- className: cn11(
3610
- "inline-flex min-h-11 max-w-full items-center gap-1 rounded-md border px-3 text-sm font-medium sm:min-h-8 sm:px-2.5 sm:text-xs",
3611
- look.className,
3612
- chosen ? "ring-2 ring-ring ring-offset-1" : "opacity-80 hover:opacity-100"
3794
+ className: cn12(
3795
+ "flex min-h-11 w-full items-center gap-3 rounded-md border px-3 py-2 text-left text-base font-medium text-foreground transition-colors sm:min-h-10 sm:text-sm",
3796
+ chosen ? "border-primary bg-primary/10" : "border-primary/30 bg-primary/[0.03] hover:bg-primary/10"
3613
3797
  ),
3614
3798
  children: [
3615
- chosen ? /* @__PURE__ */ jsx15("span", { "aria-hidden": "true", children: "\u2713" }) : null,
3616
- /* @__PURE__ */ jsx15("span", { className: "truncate", children: choice.label })
3799
+ letter ? /* @__PURE__ */ jsx16(
3800
+ "kbd",
3801
+ {
3802
+ "aria-hidden": "true",
3803
+ className: cn12(
3804
+ "inline-flex h-6 w-6 shrink-0 items-center justify-center rounded border font-sans text-xs font-semibold",
3805
+ chosen ? "border-primary bg-primary text-primary-foreground" : "border-primary/40 text-primary"
3806
+ ),
3807
+ children: letter
3808
+ }
3809
+ ) : null,
3810
+ /* @__PURE__ */ jsx16("span", { className: "min-w-0 flex-1 break-words", children: choice.label }),
3811
+ chosen ? /* @__PURE__ */ jsx16("span", { "aria-hidden": "true", className: "shrink-0 text-primary", children: "\u2713" }) : null
3617
3812
  ]
3618
3813
  },
3619
3814
  choice.key
3620
3815
  );
3621
3816
  };
3622
- const group = { role: field.multi ? "group" : "radiogroup", "aria-label": fieldName(field) };
3623
- if (choices.length <= FORM_PILL_LIMIT) {
3624
- return /* @__PURE__ */ jsx15("div", { id, className: "flex flex-wrap gap-1.5", ...group, children: choices.map(pill) });
3817
+ const onKeyDown = (event) => {
3818
+ if (!lettered || disabled || event.metaKey || event.ctrlKey || event.altKey) return;
3819
+ if (event.target.tagName === "INPUT") return;
3820
+ const at = CHOICE_LETTERS.indexOf(event.key.toUpperCase());
3821
+ if (event.key.length !== 1 || at < 0 || at >= choices.length) return;
3822
+ event.preventDefault();
3823
+ press(choices[at]);
3824
+ };
3825
+ const group = { role: field.multi ? "group" : "radiogroup", "aria-label": fieldName(field), onKeyDown };
3826
+ if (choices.length <= FORM_SEARCH_AFTER) {
3827
+ return /* @__PURE__ */ jsx16("div", { id, className: "flex w-full flex-col gap-2", ...group, children: choices.map(option) });
3625
3828
  }
3626
3829
  const q = search.trim().toLowerCase();
3627
3830
  const shown2 = q === "" ? choices : choices.filter((c) => c.label.toLowerCase().includes(q));
3628
- return /* @__PURE__ */ jsxs13("div", { id, className: "flex flex-col gap-1.5", children: [
3629
- /* @__PURE__ */ jsx15(
3831
+ return /* @__PURE__ */ jsxs14("div", { id, className: "flex w-full flex-col gap-2", onKeyDown, children: [
3832
+ /* @__PURE__ */ jsx16(
3630
3833
  BasicInput6,
3631
3834
  {
3632
3835
  value: search,
@@ -3634,12 +3837,12 @@ function ChoiceAnswer({
3634
3837
  placeholder: "Search",
3635
3838
  "aria-label": `Search \u2014 ${fieldName(field)}`,
3636
3839
  autoComplete: "off",
3637
- className: "h-11 text-base sm:h-8 sm:text-xs"
3840
+ className: "h-11 text-base sm:h-9 sm:text-sm"
3638
3841
  }
3639
3842
  ),
3640
- /* @__PURE__ */ jsxs13("div", { className: "flex max-h-56 flex-wrap content-start gap-1.5 overflow-y-auto", ...group, children: [
3641
- shown2.map(pill),
3642
- shown2.length === 0 ? /* @__PURE__ */ jsx15("p", { className: "text-xs text-muted-foreground", children: "No match" }) : null
3843
+ /* @__PURE__ */ jsxs14("div", { className: "flex max-h-80 w-full flex-col gap-2 overflow-y-auto", role: group.role, "aria-label": group["aria-label"], children: [
3844
+ shown2.map(option),
3845
+ shown2.length === 0 ? /* @__PURE__ */ jsx16("p", { className: "text-xs text-muted-foreground", children: "No match" }) : null
3643
3846
  ] })
3644
3847
  ] });
3645
3848
  }
@@ -3647,17 +3850,17 @@ function ChoiceAnswer({
3647
3850
  // src/RecordsMount.tsx
3648
3851
  import { useRef as useRef10 } from "react";
3649
3852
  import { RecordsProvider } from "@ai-matrx/records/react";
3650
- import { jsx as jsx16 } from "react/jsx-runtime";
3853
+ import { jsx as jsx17 } from "react/jsx-runtime";
3651
3854
  function personActor(userId) {
3652
3855
  return userId ? { actor: "user", user_id: userId } : { actor: "user" };
3653
3856
  }
3654
3857
 
3655
3858
  // src/tablePicking.tsx
3656
- import { useEffect as useEffect11, useMemo as useMemo6, useState as useState14 } from "react";
3859
+ import { useCallback as useCallback5, useEffect as useEffect11, useMemo as useMemo6, useState as useState15 } from "react";
3657
3860
  import { withTablePlacement } from "@ai-matrx/records";
3658
3861
  import { useRecordsClient as useRecordsClient2, useTables } from "@ai-matrx/records/react";
3659
- import { Checkbox as Checkbox2, cn as cn12 } from "@ai-matrx/design-system";
3660
- import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
3862
+ import { Checkbox as Checkbox2, cn as cn13 } from "@ai-matrx/design-system";
3863
+ import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
3661
3864
  var APP_TABLE_PREFIX = "records_ui_";
3662
3865
  function isValueSet(table) {
3663
3866
  if (table.kept_for === "choices") return true;
@@ -3700,9 +3903,9 @@ function madeOn(stamp) {
3700
3903
  }
3701
3904
 
3702
3905
  // src/TablePickers.tsx
3703
- import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
3906
+ import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
3704
3907
  function useTablesAnywhere(dataSource) {
3705
- const [state, setState] = useState15({ loading: true, error: null, rows: [] });
3908
+ const [state, setState] = useState16({ loading: true, error: null, rows: [] });
3706
3909
  useEffect12(() => {
3707
3910
  let live = true;
3708
3911
  void Promise.resolve(dataSource.rpc("data_home_tables", {}, { schema: "custom" })).then(
@@ -3740,8 +3943,8 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
3740
3943
  keywords: t.organization_name
3741
3944
  }));
3742
3945
  const missing = Boolean(value) && !list.loading && !list.error && !list.rows.some((t) => t.table_id === value);
3743
- return /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
3744
- /* @__PURE__ */ jsx18(
3946
+ return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1", children: [
3947
+ /* @__PURE__ */ jsx19(
3745
3948
  CreatablePicker,
3746
3949
  {
3747
3950
  value: value || null,
@@ -3755,23 +3958,23 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
3755
3958
  ariaLabel: "Table"
3756
3959
  }
3757
3960
  ),
3758
- list.error && /* @__PURE__ */ jsx18(RefusalLine, { error: refusal("door", list.error, "Try again in a moment.") }),
3759
- missing && /* @__PURE__ */ jsx18("p", { className: "text-[11px] text-destructive", children: "This table is archived or not shared with you." })
3961
+ list.error && /* @__PURE__ */ jsx19(RefusalLine, { error: refusal("door", list.error, "Try again in a moment.") }),
3962
+ missing && /* @__PURE__ */ jsx19("p", { className: "text-[11px] text-destructive", children: "This table is archived or not shared with you." })
3760
3963
  ] });
3761
3964
  }
3762
3965
  function TableScope({ dataSource, userId, tableId, children, fallback = null, tables }) {
3763
3966
  const own3 = useTablesAnywhere(dataSource);
3764
3967
  const list = tables ?? own3;
3765
3968
  const organizationId = list.rows.find((t) => t.table_id === tableId)?.organization_id ?? null;
3766
- if (!tableId || !organizationId) return /* @__PURE__ */ jsx18(Fragment5, { children: fallback });
3767
- return /* @__PURE__ */ jsx18(RecordsProvider2, { config: { dataSource, actor: personActor(userId), organizationId }, children });
3969
+ if (!tableId || !organizationId) return /* @__PURE__ */ jsx19(Fragment5, { children: fallback });
3970
+ return /* @__PURE__ */ jsx19(RecordsProvider2, { config: { dataSource, actor: personActor(userId), organizationId }, children });
3768
3971
  }
3769
3972
  function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
3770
3973
  const fields = useFields(tableId);
3771
3974
  const all = useMemo7(() => fields.data ?? [], [fields.data]);
3772
3975
  const byKey = useMemo7(() => new Map(all.map((f) => [f.key, f])), [all]);
3773
3976
  const keys = Object.keys(value);
3774
- const [adding, setAdding] = useState15(false);
3977
+ const [adding, setAdding] = useState16(false);
3775
3978
  const optionsFor = (current) => all.filter((f) => f.key === current || !(f.key in value)).map((f) => ({ value: f.key, label: fieldName(f) }));
3776
3979
  const rename = (from, to) => {
3777
3980
  if (from === to) return;
@@ -3784,11 +3987,11 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
3784
3987
  void _gone;
3785
3988
  onChange(rest);
3786
3989
  };
3787
- return /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-2", children: [
3788
- fields.error && /* @__PURE__ */ jsx18(RefusalLine, { error: fields.error }),
3990
+ return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-2", children: [
3991
+ fields.error && /* @__PURE__ */ jsx19(RefusalLine, { error: fields.error }),
3789
3992
  keys.map((key) => {
3790
3993
  const field = byKey.get(key);
3791
- return /* @__PURE__ */ jsx18(
3994
+ return /* @__PURE__ */ jsx19(
3792
3995
  ColumnValueRow,
3793
3996
  {
3794
3997
  columnKey: key,
@@ -3804,7 +4007,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
3804
4007
  key
3805
4008
  );
3806
4009
  }),
3807
- adding && /* @__PURE__ */ jsx18(
4010
+ adding && /* @__PURE__ */ jsx19(
3808
4011
  ColumnValueRow,
3809
4012
  {
3810
4013
  columnKey: null,
@@ -3821,7 +4024,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
3821
4024
  onRemove: () => setAdding(false)
3822
4025
  }
3823
4026
  ),
3824
- !disabled && !adding && keys.length < all.length && /* @__PURE__ */ jsx18(Button9, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
4027
+ !disabled && !adding && keys.length < all.length && /* @__PURE__ */ jsx19(Button9, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
3825
4028
  ] });
3826
4029
  }
3827
4030
  function ColumnValueRow({
@@ -3837,9 +4040,9 @@ function ColumnValueRow({
3837
4040
  }) {
3838
4041
  const orphan = columnKey !== null && !loading && field === void 0;
3839
4042
  const shown2 = orphan ? [{ value: columnKey, label: columnKey, hint: "Not a column" }, ...options] : options;
3840
- return /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1 rounded-md border border-border/60 p-2", children: [
3841
- /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2", children: [
3842
- /* @__PURE__ */ jsx18("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx18(
4043
+ return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1 rounded-md border border-border/60 p-2", children: [
4044
+ /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
4045
+ /* @__PURE__ */ jsx19("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx19(
3843
4046
  CreatablePicker,
3844
4047
  {
3845
4048
  value: columnKey,
@@ -3853,9 +4056,9 @@ function ColumnValueRow({
3853
4056
  ariaLabel: "Column"
3854
4057
  }
3855
4058
  ) }),
3856
- !disabled && /* @__PURE__ */ jsx18(Button9, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
4059
+ !disabled && /* @__PURE__ */ jsx19(Button9, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
3857
4060
  ] }),
3858
- field ? /* @__PURE__ */ jsx18(FieldControl, { field, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ jsx18("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
4061
+ field ? /* @__PURE__ */ jsx19(FieldControl, { field, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ jsx19("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
3859
4062
  ] });
3860
4063
  }
3861
4064
  function RecordPicker({ tableId, value, onChange, disabled }) {
@@ -3867,8 +4070,8 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
3867
4070
  label: rowNameIn(table.data ?? null, row)
3868
4071
  }));
3869
4072
  const missing = Boolean(value) && !records.loading && !records.error && !rows.some((r) => r.id === value);
3870
- return /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
3871
- /* @__PURE__ */ jsx18(
4073
+ return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1", children: [
4074
+ /* @__PURE__ */ jsx19(
3872
4075
  CreatablePicker,
3873
4076
  {
3874
4077
  value: value || null,
@@ -3882,7 +4085,7 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
3882
4085
  ariaLabel: "Record"
3883
4086
  }
3884
4087
  ),
3885
- records.error && /* @__PURE__ */ jsx18(RefusalLine, { error: records.error })
4088
+ records.error && /* @__PURE__ */ jsx19(RefusalLine, { error: records.error })
3886
4089
  ] });
3887
4090
  }
3888
4091
 
@@ -3890,8 +4093,8 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
3890
4093
  import { useEffect as useEffect13, useMemo as useMemo8 } from "react";
3891
4094
  import { isEntityReferenceConfig } from "@ai-matrx/records";
3892
4095
  import { useFields as useFields2, useTable as useTable2 } from "@ai-matrx/records/react";
3893
- import { BasicInput as BasicInput7, Button as Button10, CreatablePicker as CreatablePicker2, cn as cn13 } from "@ai-matrx/design-system";
3894
- import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
4096
+ import { BasicInput as BasicInput7, Button as Button10, CreatablePicker as CreatablePicker2, cn as cn14 } from "@ai-matrx/design-system";
4097
+ import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
3895
4098
  var DATA_BINDING_SHAPES = [
3896
4099
  { value: "collection", label: "The whole table" },
3897
4100
  { value: "reference", label: "One record" },
@@ -3958,9 +4161,9 @@ function DataBindingPicker({ dataSource, userId, binding, onChange, disabled, de
3958
4161
  ...binding.semantic_type === "collection" && defaultRowLimit ? { limit: defaultRowLimit } : {}
3959
4162
  });
3960
4163
  };
3961
- return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-2", children: [
3962
- /* @__PURE__ */ jsx19(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
3963
- /* @__PURE__ */ jsx19(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ jsx19(
4164
+ return /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-2", children: [
4165
+ /* @__PURE__ */ jsx20(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
4166
+ /* @__PURE__ */ jsx20(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ jsx20(
3964
4167
  BindingDetails,
3965
4168
  {
3966
4169
  tableId,
@@ -4024,8 +4227,8 @@ function BindingDetails({
4024
4227
  const fieldOptions = fieldList.map((f) => ({ value: f.key, label: fieldName(f) }));
4025
4228
  const template = binding.transform?.template ?? "";
4026
4229
  const setTemplate = (next) => onChange({ ...binding, transform: { join: "\n", ...binding.transform, name: "list", template: next } });
4027
- return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-2", children: [
4028
- /* @__PURE__ */ jsx19("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ jsx19(
4230
+ return /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-2", children: [
4231
+ /* @__PURE__ */ jsx20("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ jsx20(
4029
4232
  Button10,
4030
4233
  {
4031
4234
  type: "button",
@@ -4039,7 +4242,7 @@ function BindingDetails({
4039
4242
  },
4040
4243
  s.value
4041
4244
  )) }),
4042
- shape !== "collection" && /* @__PURE__ */ jsx19(
4245
+ shape !== "collection" && /* @__PURE__ */ jsx20(
4043
4246
  RecordPicker,
4044
4247
  {
4045
4248
  tableId,
@@ -4048,7 +4251,7 @@ function BindingDetails({
4048
4251
  disabled: Boolean(disabled)
4049
4252
  }
4050
4253
  ),
4051
- shape === "value" && /* @__PURE__ */ jsx19(
4254
+ shape === "value" && /* @__PURE__ */ jsx20(
4052
4255
  CreatablePicker2,
4053
4256
  {
4054
4257
  value: binding.field_key ?? null,
@@ -4062,11 +4265,11 @@ function BindingDetails({
4062
4265
  ariaLabel: "Column"
4063
4266
  }
4064
4267
  ),
4065
- shape !== "value" && /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1", children: [
4066
- /* @__PURE__ */ jsx19(
4268
+ shape !== "value" && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-1", children: [
4269
+ /* @__PURE__ */ jsx20(
4067
4270
  "textarea",
4068
4271
  {
4069
- className: cn13(
4272
+ className: cn14(
4070
4273
  "min-h-[3.5rem] w-full rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs"
4071
4274
  ),
4072
4275
  "aria-label": "Each row reads as",
@@ -4075,7 +4278,7 @@ function BindingDetails({
4075
4278
  onChange: (e) => setTemplate(e.target.value)
4076
4279
  }
4077
4280
  ),
4078
- !disabled && /* @__PURE__ */ jsx19("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ jsx19(
4281
+ !disabled && /* @__PURE__ */ jsx20("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ jsx20(
4079
4282
  Button10,
4080
4283
  {
4081
4284
  type: "button",
@@ -4088,9 +4291,9 @@ function BindingDetails({
4088
4291
  p.token
4089
4292
  )) })
4090
4293
  ] }),
4091
- shape === "collection" && /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
4294
+ shape === "collection" && /* @__PURE__ */ jsxs17("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
4092
4295
  "Up to",
4093
- /* @__PURE__ */ jsx19(
4296
+ /* @__PURE__ */ jsx20(
4094
4297
  BasicInput7,
4095
4298
  {
4096
4299
  type: "number",
@@ -4107,9 +4310,9 @@ function BindingDetails({
4107
4310
  ),
4108
4311
  "rows"
4109
4312
  ] }),
4110
- /* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
4111
- /* @__PURE__ */ jsx19("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
4112
- DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ jsx19(
4313
+ /* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
4314
+ /* @__PURE__ */ jsx20("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
4315
+ DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ jsx20(
4113
4316
  Button10,
4114
4317
  {
4115
4318
  type: "button",
@@ -4133,7 +4336,7 @@ import { useFields as useFields3, useRecord, useTable as useTable3 } from "@ai-m
4133
4336
  // src/values.tsx
4134
4337
  import { formatColumnValue } from "@ai-matrx/design-system/data-table";
4135
4338
  import { formatFieldValue as formatFieldValue3 } from "@ai-matrx/design-system/field-formats";
4136
- import { Badge as Badge5, cn as cn15 } from "@ai-matrx/design-system";
4339
+ import { Badge as Badge5, cn as cn16 } from "@ai-matrx/design-system";
4137
4340
 
4138
4341
  // src/enumLabels.ts
4139
4342
  function exhaustiveValuesOf() {
@@ -4170,10 +4373,10 @@ var ABSENCE_WORD_LABEL = {
4170
4373
  import { wholeValueOf } from "@ai-matrx/records/core";
4171
4374
 
4172
4375
  // src/WholeValue.tsx
4173
- import { useEffect as useEffect14, useState as useState16 } from "react";
4376
+ import { useEffect as useEffect14, useState as useState17 } from "react";
4174
4377
  import { wholeValueSize } from "@ai-matrx/records/core";
4175
4378
  import { BasicTextarea as BasicTextarea3 } from "@ai-matrx/design-system";
4176
- import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
4379
+ import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
4177
4380
  var WHOLE_VALUE_UNBOUND = "The whole text is kept as a file, and this screen has no way to open files yet.";
4178
4381
  function wholeValueLine(pointer) {
4179
4382
  return `Open the whole text (${wholeValueSize(pointer)})`;
@@ -4182,18 +4385,18 @@ function WholeValueCell({ words, pointer }) {
4182
4385
  const host = useRecordsUi();
4183
4386
  const href = host.hrefForFile?.({ fileId: pointer.file_id });
4184
4387
  const line = wholeValueLine(pointer);
4185
- return /* @__PURE__ */ jsxs17("span", { className: "flex min-w-0 items-baseline gap-2", "data-whole-value-file": pointer.file_id, children: [
4186
- /* @__PURE__ */ jsxs17("span", { className: "truncate", title: `The first ${pointer.shown_chars} of ${pointer.chars} characters`, children: [
4388
+ return /* @__PURE__ */ jsxs18("span", { className: "flex min-w-0 items-baseline gap-2", "data-whole-value-file": pointer.file_id, children: [
4389
+ /* @__PURE__ */ jsxs18("span", { className: "truncate", title: `The first ${pointer.shown_chars} of ${pointer.chars} characters`, children: [
4187
4390
  words,
4188
4391
  "\u2026"
4189
4392
  ] }),
4190
- href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ jsx20("a", { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, target: "_blank", rel: "noreferrer", children: line }) : /* @__PURE__ */ jsx20("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${wholeValueSize(pointer)} in a file` })
4393
+ href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ jsx21("a", { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, target: "_blank", rel: "noreferrer", children: line }) : /* @__PURE__ */ jsx21("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${wholeValueSize(pointer)} in a file` })
4191
4394
  ] });
4192
4395
  }
4193
4396
 
4194
4397
  // src/ReferenceChips.tsx
4195
4398
  import { entityRefsOf as entityRefsOf2 } from "@ai-matrx/records";
4196
- import { Badge as Badge4, cn as cn14 } from "@ai-matrx/design-system";
4399
+ import { Badge as Badge4, cn as cn15 } from "@ai-matrx/design-system";
4197
4400
 
4198
4401
  // src/kindValues.ts
4199
4402
  import { tryDecodeDirective } from "@ai-matrx/content-ir/directives";
@@ -4247,7 +4450,7 @@ function kindLabel(kind) {
4247
4450
  }
4248
4451
 
4249
4452
  // src/ReferenceChips.tsx
4250
- import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
4453
+ import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
4251
4454
  function referencesOf(field, value, kind, labels) {
4252
4455
  if (kind === "entity_reference") {
4253
4456
  return entityRefsOf2(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
@@ -4268,11 +4471,11 @@ function ReferenceChip({ reference, waiting }) {
4268
4471
  const host = useRecordsUi();
4269
4472
  const words = reference.label ?? (reference.token === "record" ? waiting ?? "Loading\u2026" : WITHHELD_ENTITY_LABEL);
4270
4473
  const drawn = host.renderReference ? host.renderReference({ ...reference, label: reference.label ?? words }) : null;
4271
- return /* @__PURE__ */ jsxs18(
4474
+ return /* @__PURE__ */ jsxs19(
4272
4475
  Badge4,
4273
4476
  {
4274
4477
  variant: "secondary",
4275
- className: cn14(
4478
+ className: cn15(
4276
4479
  "max-w-full min-w-0 gap-1 px-1.5 py-0 text-[11px] font-normal",
4277
4480
  reference.archived && "opacity-70"
4278
4481
  ),
@@ -4280,15 +4483,15 @@ function ReferenceChip({ reference, waiting }) {
4280
4483
  "data-records-reference-archived": reference.archived ? "" : void 0,
4281
4484
  title: reference.archived ? ARCHIVED_REFERENCE_TIP : words,
4282
4485
  children: [
4283
- drawn ?? /* @__PURE__ */ jsx21("span", { className: "truncate", children: words }),
4284
- reference.archived ? /* @__PURE__ */ jsx21("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
4486
+ drawn ?? /* @__PURE__ */ jsx22("span", { className: "truncate", children: words }),
4487
+ reference.archived ? /* @__PURE__ */ jsx22("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
4285
4488
  ]
4286
4489
  }
4287
4490
  );
4288
4491
  }
4289
4492
  function ReferenceChips({ refs, waiting }) {
4290
- if (refs.length === 0) return /* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: "\u2014" });
4291
- return /* @__PURE__ */ jsx21("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-reference-chips": "", children: refs.map((r) => /* @__PURE__ */ jsx21(ReferenceChip, { reference: r, waiting }, `${r.token}:${r.id}`)) });
4493
+ if (refs.length === 0) return /* @__PURE__ */ jsx22("span", { className: "text-muted-foreground", children: "\u2014" });
4494
+ return /* @__PURE__ */ jsx22("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-reference-chips": "", children: refs.map((r) => /* @__PURE__ */ jsx22(ReferenceChip, { reference: r, waiting }, `${r.token}:${r.id}`)) });
4292
4495
  }
4293
4496
  function KindValueCell({
4294
4497
  kv,
@@ -4297,18 +4500,18 @@ function KindValueCell({
4297
4500
  }) {
4298
4501
  const host = useRecordsUi();
4299
4502
  if (host.renderKind) {
4300
- return /* @__PURE__ */ jsx21("span", { className: "flex min-w-0 max-w-full items-center", "data-records-kind-value": kv.kind, children: host.renderKind({ value: kv.value, kind: kv.kind, where, title }) });
4503
+ return /* @__PURE__ */ jsx22("span", { className: "flex min-w-0 max-w-full items-center", "data-records-kind-value": kv.kind, children: host.renderKind({ value: kv.value, kind: kv.kind, where, title }) });
4301
4504
  }
4302
4505
  const named = kv.items.map(kindItemWords).filter((w) => w !== null);
4303
- return /* @__PURE__ */ jsx21("span", { className: cn14("flex min-w-0 flex-wrap gap-1"), "data-records-kind-value": kv.kind, title: JSON.stringify(kv.value), children: named.length > 0 ? named.map((w, i) => /* @__PURE__ */ jsx21(Badge4, { variant: "secondary", className: "px-1.5 py-0 text-[11px] font-normal", children: w }, `${w}-${i}`)) : /* @__PURE__ */ jsx21(Badge4, { variant: "outline", className: "px-1.5 py-0 text-[11px] font-normal", children: kindLabel(kv.kind) }) });
4506
+ return /* @__PURE__ */ jsx22("span", { className: cn15("flex min-w-0 flex-wrap gap-1"), "data-records-kind-value": kv.kind, title: JSON.stringify(kv.value), children: named.length > 0 ? named.map((w, i) => /* @__PURE__ */ jsx22(Badge4, { variant: "secondary", className: "px-1.5 py-0 text-[11px] font-normal", children: w }, `${w}-${i}`)) : /* @__PURE__ */ jsx22(Badge4, { variant: "outline", className: "px-1.5 py-0 text-[11px] font-normal", children: kindLabel(kv.kind) }) });
4304
4507
  }
4305
4508
 
4306
4509
  // src/values.tsx
4307
4510
  import { newerKindWords } from "@ai-matrx/records";
4308
- import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
4309
- function statusMark(field, item) {
4310
- const mark = statusMarkOf(field, item);
4311
- return mark ? /* @__PURE__ */ jsx22("span", { "aria-label": mark.words, title: mark.words, className: "mr-1", "data-records-status-group": mark.group, children: mark.mark }) : null;
4511
+ import { Fragment as Fragment6, jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
4512
+ function statusMark(field, item, document2) {
4513
+ const mark = statusMarkOf(field, item, document2);
4514
+ return mark ? /* @__PURE__ */ jsx23("span", { "aria-label": mark.words, title: mark.words, className: "mr-1", "data-records-status-group": mark.group, children: mark.mark }) : null;
4312
4515
  }
4313
4516
  function envelopeFor(document2, key) {
4314
4517
  const block = document2?._values;
@@ -4352,32 +4555,32 @@ var ABSENCE_WORDS = ABSENCE_WORD_LABEL;
4352
4555
  function renderValue(field, value, document2, labels, stillWaitingFor) {
4353
4556
  const envelope = envelopeFor(document2, field.key);
4354
4557
  if (envelope?.absent) {
4355
- return /* @__PURE__ */ jsx22("span", { className: "text-xs italic text-muted-foreground", title: `VAL-2: ${envelope.absent}`, children: ABSENCE_WORDS[String(envelope.absent)] ?? String(envelope.absent) });
4558
+ return /* @__PURE__ */ jsx23("span", { className: "text-xs italic text-muted-foreground", title: `VAL-2: ${envelope.absent}`, children: ABSENCE_WORDS[String(envelope.absent)] ?? String(envelope.absent) });
4356
4559
  }
4357
4560
  if (value === null || value === void 0 || value === "") {
4358
4561
  const gone = unresolvedFor(document2, field.key);
4359
4562
  if (gone) {
4360
- return /* @__PURE__ */ jsx22("span", { className: "text-xs italic text-muted-foreground", title: `It pointed at ${gone}`, children: "The record this pointed at no longer exists" });
4563
+ return /* @__PURE__ */ jsx23("span", { className: "text-xs italic text-muted-foreground", title: `It pointed at ${gone}`, children: "The record this pointed at no longer exists" });
4361
4564
  }
4362
4565
  const computed = computedEmptyOf(field, document2);
4363
- if (computed?.sentence) return /* @__PURE__ */ jsx22("span", { className: "text-xs italic text-muted-foreground", children: computed.sentence });
4364
- if (computed?.words) return /* @__PURE__ */ jsx22("span", { "data-records-empty-why": computed.kind, children: computed.words });
4566
+ if (computed?.sentence) return /* @__PURE__ */ jsx23("span", { className: "text-xs italic text-muted-foreground", children: computed.sentence });
4567
+ if (computed?.words) return /* @__PURE__ */ jsx23("span", { "data-records-empty-why": computed.kind, children: computed.words });
4365
4568
  if (computed?.why) {
4366
- return /* @__PURE__ */ jsx22("span", { className: "text-muted-foreground", title: computed.why, "data-records-empty-why": computed.kind, children: "\u2014" });
4569
+ return /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", title: computed.why, "data-records-empty-why": computed.kind, children: "\u2014" });
4367
4570
  }
4368
- return /* @__PURE__ */ jsx22("span", { className: "text-muted-foreground", children: "\u2014" });
4571
+ return /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "\u2014" });
4369
4572
  }
4370
- if (isSignatureField(field)) return /* @__PURE__ */ jsx22(SignatureValue, { value });
4573
+ if (isSignatureField(field)) return /* @__PURE__ */ jsx23(SignatureValue, { value, fieldKey: field.key, document: document2 });
4371
4574
  const newer = newerKindValue(field, value);
4372
4575
  if (newer !== void 0) return newer;
4373
4576
  const whole = typeof value === "string" ? wholeValueOf(document2, field.key) : null;
4374
- if (whole) return /* @__PURE__ */ jsx22(WholeValueCell, { words: value, pointer: whole });
4577
+ if (whole) return /* @__PURE__ */ jsx23(WholeValueCell, { words: value, pointer: whole });
4375
4578
  const kind = editorKindFor(field);
4376
4579
  if (kind === "relation" || kind === "entity_reference") {
4377
- return /* @__PURE__ */ jsx22(ReferenceChips, { refs: referencesOf(field, value, kind, labels), waiting: stillWaitingFor });
4580
+ return /* @__PURE__ */ jsx23(ReferenceChips, { refs: referencesOf(field, value, kind, labels), waiting: stillWaitingFor });
4378
4581
  }
4379
4582
  const kv = kind === "attachment" || kind === "member" ? null : kindValueOf(value);
4380
- if (kv) return /* @__PURE__ */ jsx22(KindValueCell, { kv, where: "cell", title: field.label });
4583
+ if (kv) return /* @__PURE__ */ jsx23(KindValueCell, { kv, where: "cell", title: field.label });
4381
4584
  const chosen = kind === "select" || kind === "multi_select";
4382
4585
  const chipOf = (item) => {
4383
4586
  const look = choiceChipLookOf(field, item, scalarText(field, item, labels));
@@ -4385,17 +4588,17 @@ function renderValue(field, value, document2, labels, stillWaitingFor) {
4385
4588
  };
4386
4589
  if (chosen) {
4387
4590
  const items = Array.isArray(value) ? value : [value];
4388
- return /* @__PURE__ */ jsx22("span", { className: "flex flex-wrap gap-1", "data-records-choice-chips": "", children: items.map((item, i) => {
4591
+ return /* @__PURE__ */ jsx23("span", { className: "flex flex-wrap gap-1", "data-records-choice-chips": "", children: items.map((item, i) => {
4389
4592
  const chip = chipOf(item);
4390
- return /* @__PURE__ */ jsxs19(
4593
+ return /* @__PURE__ */ jsxs20(
4391
4594
  Badge5,
4392
4595
  {
4393
4596
  variant: "outline",
4394
- className: cn15("text-[11px]", chip.className),
4597
+ className: cn16("text-[11px]", chip.className),
4395
4598
  "data-records-choice-chip": "",
4396
4599
  ...chip.tinted ? { "data-records-choice-tint": "" } : {},
4397
4600
  children: [
4398
- statusMark(field, item),
4601
+ statusMark(field, item, Array.isArray(value) ? void 0 : document2),
4399
4602
  scalarText(field, item, labels, Array.isArray(value) ? void 0 : stillWaitingFor)
4400
4603
  ]
4401
4604
  },
@@ -4403,13 +4606,13 @@ function renderValue(field, value, document2, labels, stillWaitingFor) {
4403
4606
  );
4404
4607
  }) });
4405
4608
  }
4406
- if (kind === "attachment") return /* @__PURE__ */ jsx22(AttachmentChips, { value });
4609
+ if (kind === "attachment") return /* @__PURE__ */ jsx23(AttachmentChips, { value });
4407
4610
  if (Array.isArray(value)) {
4408
- return /* @__PURE__ */ jsx22("span", { className: "flex flex-wrap gap-1", children: value.map((item, i) => /* @__PURE__ */ jsx22(Badge5, { variant: "secondary", className: "text-[11px]", children: scalarText(field, item, labels) }, `${String(item)}-${i}`)) });
4611
+ return /* @__PURE__ */ jsx23("span", { className: "flex flex-wrap gap-1", children: value.map((item, i) => /* @__PURE__ */ jsx23(Badge5, { variant: "secondary", className: "text-[11px]", children: scalarText(field, item, labels) }, `${String(item)}-${i}`)) });
4409
4612
  }
4410
4613
  if (kind === "url" && typeof value === "string") {
4411
4614
  const href = value.includes("://") ? value : `https://${value}`;
4412
- return /* @__PURE__ */ jsxs19(
4615
+ return /* @__PURE__ */ jsxs20(
4413
4616
  "a",
4414
4617
  {
4415
4618
  className: "inline-flex min-w-0 max-w-full items-center gap-1 rounded-md border border-border bg-muted/60 px-1.5 py-0.5 text-[11px] text-foreground hover:bg-accent",
@@ -4420,14 +4623,14 @@ function renderValue(field, value, document2, labels, stillWaitingFor) {
4420
4623
  "data-records-link-chip": "",
4421
4624
  onClick: (event) => event.stopPropagation(),
4422
4625
  children: [
4423
- /* @__PURE__ */ jsx22("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2197" }),
4424
- /* @__PURE__ */ jsx22("span", { className: "truncate", children: linkChipText(value) })
4626
+ /* @__PURE__ */ jsx23("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2197" }),
4627
+ /* @__PURE__ */ jsx23("span", { className: "truncate", children: linkChipText(value) })
4425
4628
  ]
4426
4629
  }
4427
4630
  );
4428
4631
  }
4429
4632
  if (kind === "phone" && typeof value === "string" && value.trim() !== "") {
4430
- return /* @__PURE__ */ jsx22(
4633
+ return /* @__PURE__ */ jsx23(
4431
4634
  "a",
4432
4635
  {
4433
4636
  className: "truncate tabular-nums text-primary underline-offset-2 hover:underline",
@@ -4440,12 +4643,12 @@ function renderValue(field, value, document2, labels, stillWaitingFor) {
4440
4643
  );
4441
4644
  }
4442
4645
  if (kind === "email" && typeof value === "string") {
4443
- return /* @__PURE__ */ jsx22("a", { className: "truncate text-primary underline-offset-2 hover:underline", href: `mailto:${value}`, children: value });
4646
+ return /* @__PURE__ */ jsx23("a", { className: "truncate text-primary underline-offset-2 hover:underline", href: `mailto:${value}`, children: value });
4444
4647
  }
4445
4648
  if (typeof value === "boolean") {
4446
- return /* @__PURE__ */ jsx22("span", { className: kind === "checkbox" ? "text-sm" : "", title: value ? "Yes" : "No", children: value ? "\u2713" : "\u2014" });
4649
+ return /* @__PURE__ */ jsx23("span", { className: kind === "checkbox" ? "text-sm" : "", title: value ? "Yes" : "No", children: value ? "\u2713" : "\u2014" });
4447
4650
  }
4448
- return /* @__PURE__ */ jsx22("span", { className: cn15("truncate", kind === "number" || kind === "currency" || kind === "percent" ? "tabular-nums" : ""), children: scalarText(field, value, labels, stillWaitingFor) });
4651
+ return /* @__PURE__ */ jsx23("span", { className: cn16("truncate", kind === "number" || kind === "currency" || kind === "percent" ? "tabular-nums" : ""), children: scalarText(field, value, labels, stillWaitingFor) });
4449
4652
  }
4450
4653
  function scalarText(field, value, labels, stillWaitingFor) {
4451
4654
  if (value === null || value === void 0) return "\u2014";
@@ -4486,13 +4689,13 @@ function scalarText(field, value, labels, stillWaitingFor) {
4486
4689
  }
4487
4690
 
4488
4691
  // src/PickedSummaries.tsx
4489
- import { Fragment as Fragment7, jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
4692
+ import { Fragment as Fragment7, jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
4490
4693
  function TableNameText({ dataSource, tableId }) {
4491
4694
  const tables = useTablesAnywhere(dataSource);
4492
- if (!tableId) return /* @__PURE__ */ jsx23(Fragment7, { children: "\u2014" });
4493
- if (tables.loading) return /* @__PURE__ */ jsx23(Fragment7, { children: "\u2026" });
4494
- if (tables.error) return /* @__PURE__ */ jsx23(Fragment7, { children: "Couldn't load the table's name" });
4495
- return /* @__PURE__ */ jsx23(Fragment7, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
4695
+ if (!tableId) return /* @__PURE__ */ jsx24(Fragment7, { children: "\u2014" });
4696
+ if (tables.loading) return /* @__PURE__ */ jsx24(Fragment7, { children: "\u2026" });
4697
+ if (tables.error) return /* @__PURE__ */ jsx24(Fragment7, { children: "Couldn't load the table's name" });
4698
+ return /* @__PURE__ */ jsx24(Fragment7, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
4496
4699
  }
4497
4700
  function ColumnValuesText({
4498
4701
  dataSource,
@@ -4500,28 +4703,28 @@ function ColumnValuesText({
4500
4703
  tableId,
4501
4704
  value
4502
4705
  }) {
4503
- if (!tableId) return /* @__PURE__ */ jsx23(Fragment7, { children: "\u2014" });
4504
- return /* @__PURE__ */ jsx23(TableScope, { dataSource, userId, tableId, fallback: /* @__PURE__ */ jsx23(Fragment7, { children: "\u2026" }), children: /* @__PURE__ */ jsx23(RecordLabelProvider, { children: /* @__PURE__ */ jsx23(ColumnValuesWords, { tableId, value }) }) });
4706
+ if (!tableId) return /* @__PURE__ */ jsx24(Fragment7, { children: "\u2014" });
4707
+ return /* @__PURE__ */ jsx24(TableScope, { dataSource, userId, tableId, fallback: /* @__PURE__ */ jsx24(Fragment7, { children: "\u2026" }), children: /* @__PURE__ */ jsx24(RecordLabelProvider, { children: /* @__PURE__ */ jsx24(ColumnValuesWords, { tableId, value }) }) });
4505
4708
  }
4506
4709
  function ColumnValuesWords({ tableId, value }) {
4507
4710
  const fields = useFields3(tableId);
4508
4711
  const labels = useRecordLabels(fields.data ?? void 0);
4509
- if (fields.loading) return /* @__PURE__ */ jsx23(Fragment7, { children: "\u2026" });
4510
- if (fields.error) return /* @__PURE__ */ jsx23(Fragment7, { children: "Couldn't load this table's columns" });
4712
+ if (fields.loading) return /* @__PURE__ */ jsx24(Fragment7, { children: "\u2026" });
4713
+ if (fields.error) return /* @__PURE__ */ jsx24(Fragment7, { children: "Couldn't load this table's columns" });
4511
4714
  const parts = [];
4512
4715
  for (const [key, stored] of Object.entries(value)) {
4513
4716
  if (key.startsWith("_")) continue;
4514
4717
  const field = (fields.data ?? []).find((f) => f.key === key);
4515
- if (parts.length) parts.push(/* @__PURE__ */ jsx23("span", { children: ", " }, `${key}-sep`));
4718
+ if (parts.length) parts.push(/* @__PURE__ */ jsx24("span", { children: ", " }, `${key}-sep`));
4516
4719
  parts.push(
4517
- /* @__PURE__ */ jsxs20("span", { children: [
4720
+ /* @__PURE__ */ jsxs21("span", { children: [
4518
4721
  field ? fieldName(field) : "A removed column",
4519
4722
  " is ",
4520
4723
  field ? renderValue(field, stored, void 0, labels) : "\u2014"
4521
4724
  ] }, key)
4522
4725
  );
4523
4726
  }
4524
- return parts.length ? /* @__PURE__ */ jsx23(Fragment7, { children: parts }) : /* @__PURE__ */ jsx23(Fragment7, { children: "\u2014" });
4727
+ return parts.length ? /* @__PURE__ */ jsx24(Fragment7, { children: parts }) : /* @__PURE__ */ jsx24(Fragment7, { children: "\u2014" });
4525
4728
  }
4526
4729
  function RecordNameText({
4527
4730
  dataSource,
@@ -4529,31 +4732,31 @@ function RecordNameText({
4529
4732
  tableId,
4530
4733
  recordId
4531
4734
  }) {
4532
- if (!tableId || !recordId) return /* @__PURE__ */ jsx23(Fragment7, { children: "\u2014" });
4533
- return /* @__PURE__ */ jsx23(TableScope, { dataSource, userId, tableId, fallback: /* @__PURE__ */ jsx23(Fragment7, { children: "\u2026" }), children: /* @__PURE__ */ jsx23(RecordNameWords, { tableId, recordId }) });
4735
+ if (!tableId || !recordId) return /* @__PURE__ */ jsx24(Fragment7, { children: "\u2014" });
4736
+ return /* @__PURE__ */ jsx24(TableScope, { dataSource, userId, tableId, fallback: /* @__PURE__ */ jsx24(Fragment7, { children: "\u2026" }), children: /* @__PURE__ */ jsx24(RecordNameWords, { tableId, recordId }) });
4534
4737
  }
4535
4738
  function RecordNameWords({ tableId, recordId }) {
4536
4739
  const table = useTable3(tableId);
4537
4740
  const record = useRecord(recordId);
4538
- if (record.loading || table.loading) return /* @__PURE__ */ jsx23(Fragment7, { children: "\u2026" });
4539
- if (record.error) return /* @__PURE__ */ jsx23(Fragment7, { children: "Couldn't load this record" });
4540
- if (!record.data) return /* @__PURE__ */ jsx23(Fragment7, { children: "A record you cannot open" });
4541
- return /* @__PURE__ */ jsx23(Fragment7, { children: recordName(record.data.document, table.data?.title_field ?? null) });
4741
+ if (record.loading || table.loading) return /* @__PURE__ */ jsx24(Fragment7, { children: "\u2026" });
4742
+ if (record.error) return /* @__PURE__ */ jsx24(Fragment7, { children: "Couldn't load this record" });
4743
+ if (!record.data) return /* @__PURE__ */ jsx24(Fragment7, { children: "A record you cannot open" });
4744
+ return /* @__PURE__ */ jsx24(Fragment7, { children: recordName(record.data.document, table.data?.title_field ?? null) });
4542
4745
  }
4543
4746
 
4544
4747
  // src/HeldChangeDecision.tsx
4545
- import { useEffect as useEffect15, useState as useState17 } from "react";
4748
+ import { useEffect as useEffect15, useState as useState18 } from "react";
4546
4749
  import { RecordsProvider as RecordsProvider3, useRecordsClient as useRecordsClient3 } from "@ai-matrx/records/react";
4547
4750
  import { Button as Button11 } from "@ai-matrx/design-system";
4548
- import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
4751
+ import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
4549
4752
  function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, onDecided }) {
4550
- return /* @__PURE__ */ jsx24(RecordsProvider3, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ jsx24(Decision, { approvalId, onDecided }) });
4753
+ return /* @__PURE__ */ jsx25(RecordsProvider3, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ jsx25(Decision, { approvalId, onDecided }) });
4551
4754
  }
4552
4755
  function Decision({ approvalId, onDecided }) {
4553
4756
  const client = useRecordsClient3();
4554
- const [may, setMay] = useState17(null);
4555
- const [busy, setBusy] = useState17(null);
4556
- const [error, setError] = useState17(null);
4757
+ const [may, setMay] = useState18(null);
4758
+ const [busy, setBusy] = useState18(null);
4759
+ const [error, setError] = useState18(null);
4557
4760
  useEffect15(() => {
4558
4761
  let live = true;
4559
4762
  void client.workApprovalMayDecide({ approval_id: approvalId }).then((res) => {
@@ -4576,13 +4779,13 @@ function Decision({ approvalId, onDecided }) {
4576
4779
  if (res.ok) onDecided(approve);
4577
4780
  else setError(res.error);
4578
4781
  };
4579
- if (may === null) return /* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
4580
- return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1.5", children: [
4581
- may ? /* @__PURE__ */ jsxs21("div", { className: "flex gap-2", children: [
4582
- /* @__PURE__ */ jsx24(Button11, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : "Approve" }),
4583
- /* @__PURE__ */ jsx24(Button11, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
4584
- ] }) : !error && /* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
4585
- error ? /* @__PURE__ */ jsx24(RefusalLine, { error }) : null
4782
+ if (may === null) return /* @__PURE__ */ jsx25("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
4783
+ return /* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-1.5", children: [
4784
+ may ? /* @__PURE__ */ jsxs22("div", { className: "flex gap-2", children: [
4785
+ /* @__PURE__ */ jsx25(Button11, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : "Approve" }),
4786
+ /* @__PURE__ */ jsx25(Button11, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
4787
+ ] }) : !error && /* @__PURE__ */ jsx25("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
4788
+ error ? /* @__PURE__ */ jsx25(RefusalLine, { error }) : null
4586
4789
  ] });
4587
4790
  }
4588
4791
  export {