@ai-matrx/records-ui 0.116.59 → 0.116.60

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +52 -1
  2. package/dist/{SaveToTable-2TQKEYJA.js → SaveToTable-VPLDWCSU.js} +4 -4
  3. package/dist/{chunk-AJVN4BMI.js → chunk-2YK72GHL.js} +305 -248
  4. package/dist/chunk-2YK72GHL.js.map +1 -0
  5. package/dist/{chunk-NGOPU3AJ.js → chunk-4KWCNW7V.js} +5 -4
  6. package/dist/{chunk-NGOPU3AJ.js.map → chunk-4KWCNW7V.js.map} +1 -1
  7. package/dist/{chunk-MBUW42SM.js → chunk-NBL26U5K.js} +2 -2
  8. package/dist/{chunk-4ZS4WEEE.js → chunk-TEYXG4XD.js} +73 -4
  9. package/dist/chunk-TEYXG4XD.js.map +1 -0
  10. package/dist/{chunk-HAWACXPU.js → chunk-W6FX3XVF.js} +2 -2
  11. package/dist/{chunk-Y6U5OFJX.js → chunk-WXYI4DKC.js} +3 -3
  12. package/dist/data-source.cjs +2 -1
  13. package/dist/data-source.cjs.map +1 -1
  14. package/dist/data-source.js +2 -1
  15. package/dist/data-source.js.map +1 -1
  16. package/dist/helpers.cjs +7 -7
  17. package/dist/helpers.cjs.map +1 -1
  18. package/dist/helpers.js +8 -8
  19. package/dist/helpers.js.map +1 -1
  20. package/dist/index.cjs +732 -616
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +17 -16
  23. package/dist/index.d.ts +17 -16
  24. package/dist/index.js +53 -62
  25. package/dist/index.js.map +1 -1
  26. package/dist/pickers.cjs +106 -96
  27. package/dist/pickers.cjs.map +1 -1
  28. package/dist/pickers.js +4 -4
  29. package/dist/skeleton.js +3 -3
  30. package/package.json +4 -4
  31. package/dist/chunk-4ZS4WEEE.js.map +0 -1
  32. package/dist/chunk-AJVN4BMI.js.map +0 -1
  33. /package/dist/{SaveToTable-2TQKEYJA.js.map → SaveToTable-VPLDWCSU.js.map} +0 -0
  34. /package/dist/{chunk-MBUW42SM.js.map → chunk-NBL26U5K.js.map} +0 -0
  35. /package/dist/{chunk-HAWACXPU.js.map → chunk-W6FX3XVF.js.map} +0 -0
  36. /package/dist/{chunk-Y6U5OFJX.js.map → chunk-WXYI4DKC.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -524,6 +524,74 @@ var init_plainWords = __esm({
524
524
  }
525
525
  });
526
526
 
527
+ // src/personZone.ts
528
+ function valid(z) {
529
+ if (typeof z !== "string" || !z.trim()) return false;
530
+ try {
531
+ new Intl.DateTimeFormat("en-US", { timeZone: z });
532
+ return true;
533
+ } catch {
534
+ return false;
535
+ }
536
+ }
537
+ function setPersonTimeZone(next) {
538
+ const clean = valid(next) ? next : null;
539
+ if (clean === state.zone) return;
540
+ state.zone = clean;
541
+ (0, import_table_style.setColorRuleTimeZone)(clean);
542
+ (0, import_table_style.setDisplayTimeZone)(clean);
543
+ state.listeners.forEach((l) => l());
544
+ }
545
+ function getPersonTimeZone() {
546
+ return state.zone;
547
+ }
548
+ function subscribePersonTimeZone(listener) {
549
+ state.listeners.add(listener);
550
+ return () => {
551
+ state.listeners.delete(listener);
552
+ };
553
+ }
554
+ function personWallNow(at = /* @__PURE__ */ new Date()) {
555
+ const zone = state.zone;
556
+ if (!zone) return at;
557
+ const parts = new Intl.DateTimeFormat("en-US", {
558
+ timeZone: zone,
559
+ year: "numeric",
560
+ month: "2-digit",
561
+ day: "2-digit",
562
+ hour: "2-digit",
563
+ minute: "2-digit",
564
+ second: "2-digit",
565
+ hourCycle: "h23"
566
+ }).formatToParts(at);
567
+ const n = (t) => Number(parts.find((p) => p.type === t)?.value ?? 0);
568
+ return new Date(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
569
+ }
570
+ function instantFromPersonWall(wall) {
571
+ const zone = state.zone;
572
+ if (!zone) return wall;
573
+ const target = Date.UTC(wall.getFullYear(), wall.getMonth(), wall.getDate(), wall.getHours(), wall.getMinutes(), wall.getSeconds(), wall.getMilliseconds());
574
+ let guess = target;
575
+ for (let i = 0; i < 3; i += 1) {
576
+ const seen = personWallNow(new Date(guess));
577
+ const shown5 = Date.UTC(seen.getFullYear(), seen.getMonth(), seen.getDate(), seen.getHours(), seen.getMinutes(), seen.getSeconds(), wall.getMilliseconds());
578
+ guess -= shown5 - target;
579
+ }
580
+ return new Date(guess);
581
+ }
582
+ var import_table_style, import_global_slot, state;
583
+ var init_personZone = __esm({
584
+ "src/personZone.ts"() {
585
+ "use strict";
586
+ import_table_style = require("@ai-matrx/design-system/data-table/table-style");
587
+ import_global_slot = require("@ai-matrx/kit/global-slot");
588
+ state = (0, import_global_slot.globalSlot)("ai-matrx.records-ui.person-time-zone", () => ({
589
+ zone: null,
590
+ listeners: /* @__PURE__ */ new Set()
591
+ }));
592
+ }
593
+ });
594
+
527
595
  // src/choiceLooks.ts
528
596
  function displayFormatOf(field2) {
529
597
  const raw = field2.display_format;
@@ -830,7 +898,7 @@ function carriesTimeOfDay(field2, value) {
830
898
  function timeOfDayWords(value) {
831
899
  if (!hasTimePart(value)) return null;
832
900
  const at = value instanceof Date ? value : new Date(value);
833
- return Number.isNaN(at.getTime()) ? null : at.toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit" });
901
+ return Number.isNaN(at.getTime()) ? null : at.toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit", ...(0, import_field_formats3.momentZoneOptions)(at) });
834
902
  }
835
903
  function hasTimePart(value) {
836
904
  if (value instanceof Date || typeof value === "number") return true;
@@ -871,8 +939,9 @@ function calendarDayOf(value) {
871
939
  } else if (typeof value !== "number" && !(value instanceof Date)) {
872
940
  return null;
873
941
  }
874
- const at = value instanceof Date ? value : new Date(value);
875
- if (Number.isNaN(at.getTime())) return null;
942
+ const instant2 = value instanceof Date ? value : new Date(value);
943
+ if (Number.isNaN(instant2.getTime())) return null;
944
+ const at = personWallNow(instant2);
876
945
  return `${at.getFullYear()}-${pad(at.getMonth() + 1)}-${pad(at.getDate())}`;
877
946
  }
878
947
  function calendarDayLabel(day2) {
@@ -896,11 +965,13 @@ function addDays(day2, n) {
896
965
  function daysBetween(from, to) {
897
966
  return Math.round((dayAt(to).getTime() - dayAt(from).getTime()) / 864e5);
898
967
  }
899
- var import_field_formats2, BARE_CALENDAR_DATE;
968
+ var import_field_formats2, import_field_formats3, BARE_CALENDAR_DATE;
900
969
  var init_dates = __esm({
901
970
  "src/dates.ts"() {
902
971
  "use strict";
903
972
  import_field_formats2 = require("@ai-matrx/design-system/field-formats");
973
+ import_field_formats3 = require("@ai-matrx/design-system/field-formats");
974
+ init_personZone();
904
975
  BARE_CALENDAR_DATE = /^(\d{4})-(\d{2})-(\d{2})(?:[T ]00:00(?::00(?:\.0+)?)?)?$/;
905
976
  }
906
977
  });
@@ -944,7 +1015,7 @@ function ArchivedOrganizationNotice({
944
1015
  setBusy(false);
945
1016
  }
946
1017
  };
947
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1018
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
948
1019
  import_design_system4.Alert,
949
1020
  {
950
1021
  variant: "destructive",
@@ -954,10 +1025,10 @@ function ArchivedOrganizationNotice({
954
1025
  className: (0, import_design_system4.cn)("text-xs", className),
955
1026
  errorFacts: { message: "This organization is archived", title: "This organization is archived", error, origin: "records-ui/ArchivedOrganizationNotice" },
956
1027
  children: [
957
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_design_system4.AlertTitle, { className: "text-xs font-medium", children: "This organization is archived" }),
958
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_design_system4.AlertDescription, { className: "space-y-1 text-xs", children: [
959
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "opacity-80", children: "Nothing was deleted. Everything here comes back the moment an owner of the organization, or a super admin, restores it." }),
960
- mayRestore === true ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1028
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system4.AlertTitle, { className: "text-xs font-medium", children: "This organization is archived" }),
1029
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system4.AlertDescription, { className: "space-y-1 text-xs", children: [
1030
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "opacity-80", children: "Nothing was deleted. Everything here comes back the moment an owner of the organization, or a super admin, restores it." }),
1031
+ mayRestore === true ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
961
1032
  "button",
962
1033
  {
963
1034
  type: "button",
@@ -968,14 +1039,14 @@ function ArchivedOrganizationNotice({
968
1039
  children: busy ? "Restoring..." : "Restore organization"
969
1040
  }
970
1041
  ) : null,
971
- mayRestore === false ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { "data-restore-who": "", className: "opacity-80", children: "Ask an owner of this organization to restore it." }) : null,
972
- failed ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { "data-restore-refused": "", children: failed }) : null
1042
+ mayRestore === false ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { "data-restore-who": "", className: "opacity-80", children: "Ask an owner of this organization to restore it." }) : null,
1043
+ failed ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { "data-restore-refused": "", children: failed }) : null
973
1044
  ] })
974
1045
  ]
975
1046
  }
976
1047
  );
977
1048
  }
978
- var import_react14, import_design_system4, import_jsx_runtime9;
1049
+ var import_react14, import_design_system4, import_jsx_runtime10;
979
1050
  var init_ArchivedOrganizationNotice = __esm({
980
1051
  "src/ArchivedOrganizationNotice.tsx"() {
981
1052
  "use strict";
@@ -983,7 +1054,7 @@ var init_ArchivedOrganizationNotice = __esm({
983
1054
  import_react14 = require("react");
984
1055
  import_design_system4 = require("@ai-matrx/design-system");
985
1056
  init_host();
986
- import_jsx_runtime9 = require("react/jsx-runtime");
1057
+ import_jsx_runtime10 = require("react/jsx-runtime");
987
1058
  }
988
1059
  });
989
1060
 
@@ -1021,14 +1092,14 @@ function RefusalNotice({
1021
1092
  onDiscard,
1022
1093
  onRetry
1023
1094
  }) {
1024
- const archivedOrg = (0, import_core2.archivedOrganizationId)(error);
1095
+ const archivedOrg = (0, import_core3.archivedOrganizationId)(error);
1025
1096
  if (archivedOrg) {
1026
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ArchivedOrganizationNotice, { organizationId: archivedOrg, error, className });
1097
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ArchivedOrganizationNotice, { organizationId: archivedOrg, error, className });
1027
1098
  }
1028
1099
  const said2 = refusalForAPerson(error);
1029
1100
  const plain2 = refusalTimedOut(error) ? { ...said2, sentence: import_design_system6.TIMED_OUT_SENTENCE, storeSaid: true } : said2;
1030
- const doors = onKeepEditing || onDiscard || onRetry ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-wrap items-center gap-1 pt-0.5", "data-refusal-doors": "", children: [
1031
- onRetry ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1101
+ const doors = onKeepEditing || onDiscard || onRetry ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-wrap items-center gap-1 pt-0.5", "data-refusal-doors": "", children: [
1102
+ onRetry ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1032
1103
  "button",
1033
1104
  {
1034
1105
  type: "button",
@@ -1038,7 +1109,7 @@ function RefusalNotice({
1038
1109
  children: "Try again"
1039
1110
  }
1040
1111
  ) : null,
1041
- onKeepEditing ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1112
+ onKeepEditing ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1042
1113
  "button",
1043
1114
  {
1044
1115
  type: "button",
@@ -1048,7 +1119,7 @@ function RefusalNotice({
1048
1119
  children: "Keep editing"
1049
1120
  }
1050
1121
  ) : null,
1051
- onDiscard ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1122
+ onDiscard ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1052
1123
  "button",
1053
1124
  {
1054
1125
  type: "button",
@@ -1059,7 +1130,7 @@ function RefusalNotice({
1059
1130
  }
1060
1131
  ) : null
1061
1132
  ] }) : null;
1062
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1133
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1063
1134
  import_design_system6.Alert,
1064
1135
  {
1065
1136
  variant: "destructive",
@@ -1070,10 +1141,10 @@ function RefusalNotice({
1070
1141
  ...plain2.forEngineers ? { "data-for-engineers": plain2.forEngineers } : {},
1071
1142
  ...error.sqlstate ? { "data-sqlstate": error.sqlstate } : {},
1072
1143
  children: [
1073
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_design_system6.AlertTitle, { className: "text-xs font-medium", children: plain2.storeSaid ? plain2.sentence : plain2.title }),
1074
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_design_system6.AlertDescription, { className: "space-y-1 text-xs", children: [
1075
- plain2.storeSaid || plain2.sentence.replace(/\.$/, "") === plain2.title ? null : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: plain2.sentence }),
1076
- plain2.remedy === "" ? null : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "opacity-80", children: plain2.remedy }),
1144
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_design_system6.AlertTitle, { className: "text-xs font-medium", children: plain2.storeSaid ? plain2.sentence : plain2.title }),
1145
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_design_system6.AlertDescription, { className: "space-y-1 text-xs", children: [
1146
+ plain2.storeSaid || plain2.sentence.replace(/\.$/, "") === plain2.title ? null : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: plain2.sentence }),
1147
+ plain2.remedy === "" ? null : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "opacity-80", children: plain2.remedy }),
1077
1148
  actions,
1078
1149
  doors
1079
1150
  ] })
@@ -1089,38 +1160,38 @@ function RefusalLine({
1089
1160
  const plain2 = refusalForAPerson(error);
1090
1161
  const timedOut = refusalTimedOut(error);
1091
1162
  const line = timedOut ? import_design_system6.TIMED_OUT_SENTENCE : refusalLineForAPerson(error);
1092
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1093
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1163
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1164
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1094
1165
  import_design_system6.ErrorBox,
1095
1166
  {
1096
1167
  "data-refusal-line": "",
1097
1168
  className: (0, import_design_system6.cn)("whitespace-normal break-words text-xs text-destructive [overflow-wrap:anywhere]", className),
1098
- message: (0, import_core2.archivedOrganizationId)(error) ? "This organization is archived. An owner can restore it." : line,
1169
+ message: (0, import_core3.archivedOrganizationId)(error) ? "This organization is archived. An owner can restore it." : line,
1099
1170
  error,
1100
1171
  origin: "records-ui/RefusalLine",
1101
1172
  ...plain2.forEngineers ? { "data-for-engineers": plain2.forEngineers } : {}
1102
1173
  }
1103
1174
  ),
1104
- timedOut && onRetry ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "data-refusal-retry": "", className: "rounded border px-2 py-0.5 text-xs hover:bg-muted", onClick: onRetry, children: "Try again" }) : null
1175
+ timedOut && onRetry ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", "data-refusal-retry": "", className: "rounded border px-2 py-0.5 text-xs hover:bg-muted", onClick: onRetry, children: "Try again" }) : null
1105
1176
  ] });
1106
1177
  }
1107
- var import_core2, import_design_system6, import_jsx_runtime10;
1178
+ var import_core3, import_design_system6, import_jsx_runtime11;
1108
1179
  var init_Refusal = __esm({
1109
1180
  "src/Refusal.tsx"() {
1110
1181
  "use strict";
1111
1182
  "use client";
1112
- import_core2 = require("@ai-matrx/records/core");
1183
+ import_core3 = require("@ai-matrx/records/core");
1113
1184
  import_design_system6 = require("@ai-matrx/design-system");
1114
1185
  init_ArchivedOrganizationNotice();
1115
1186
  init_plainWords();
1116
1187
  init_refusalSaid();
1117
- import_jsx_runtime10 = require("react/jsx-runtime");
1188
+ import_jsx_runtime11 = require("react/jsx-runtime");
1118
1189
  }
1119
1190
  });
1120
1191
 
1121
1192
  // src/personChip.tsx
1122
1193
  function PersonAvatar({ name, size = "sm" }) {
1123
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1194
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1124
1195
  "span",
1125
1196
  {
1126
1197
  "aria-hidden": "true",
@@ -1134,35 +1205,35 @@ function PersonAvatar({ name, size = "sm" }) {
1134
1205
  );
1135
1206
  }
1136
1207
  function PersonChip({ name, onRemove, onOpen, className }) {
1137
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1208
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1138
1209
  "span",
1139
1210
  {
1140
1211
  "data-records-person-chip": "",
1141
1212
  title: name,
1142
1213
  className: (0, import_design_system7.cn)("inline-flex min-w-0 max-w-full items-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-[11px] text-foreground", className),
1143
1214
  children: [
1144
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PersonAvatar, { name }),
1145
- onOpen ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: onOpen, "data-records-person-open": "", className: "min-w-0 truncate hover:underline", children: name }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "min-w-0 truncate", children: name }),
1146
- onRemove ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${name}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
1215
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PersonAvatar, { name }),
1216
+ onOpen ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: onOpen, "data-records-person-open": "", className: "min-w-0 truncate hover:underline", children: name }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "min-w-0 truncate", children: name }),
1217
+ onRemove ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${name}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
1147
1218
  ]
1148
1219
  }
1149
1220
  );
1150
1221
  }
1151
- var import_design_system7, import_format, import_jsx_runtime11, PERSON_INITIALS;
1222
+ var import_design_system7, import_format, import_jsx_runtime12, PERSON_INITIALS;
1152
1223
  var init_personChip = __esm({
1153
1224
  "src/personChip.tsx"() {
1154
1225
  "use strict";
1155
1226
  "use client";
1156
1227
  import_design_system7 = require("@ai-matrx/design-system");
1157
1228
  import_format = require("@ai-matrx/kit/format");
1158
- import_jsx_runtime11 = require("react/jsx-runtime");
1229
+ import_jsx_runtime12 = require("react/jsx-runtime");
1159
1230
  PERSON_INITIALS = { splitHandles: true, dropHonorifics: true };
1160
1231
  }
1161
1232
  });
1162
1233
 
1163
1234
  // src/PickOrAdd.tsx
1164
1235
  function Glyph({ d, className }) {
1165
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, className, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d }) });
1236
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, className, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d }) });
1166
1237
  }
1167
1238
  function useListKeys(args) {
1168
1239
  const { count, resetOn, onPick, onNothing, onClose, onFinish, onBackspaceEmpty, searchEmpty } = args;
@@ -1217,7 +1288,7 @@ function PickRow({
1217
1288
  (0, import_react15.useEffect)(() => {
1218
1289
  if (highlighted) ref.current?.scrollIntoView?.({ block: "nearest" });
1219
1290
  }, [highlighted]);
1220
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1291
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1221
1292
  "button",
1222
1293
  {
1223
1294
  ref,
@@ -1235,14 +1306,14 @@ function PickRow({
1235
1306
  highlighted ? "bg-accent text-accent-foreground" : ""
1236
1307
  ),
1237
1308
  children: [
1238
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "flex size-3.5 shrink-0 items-center justify-center", children: [
1239
- picked ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { "data-pick-tick": "", className: "contents", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Glyph, { d: TICK, className: "size-3.5" }) }) : null,
1240
- icon === "plus" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Glyph, { d: PLUS, className: "size-3.5 text-muted-foreground" }) : null
1309
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex size-3.5 shrink-0 items-center justify-center", children: [
1310
+ picked ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "data-pick-tick": "", className: "contents", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Glyph, { d: TICK, className: "size-3.5" }) }) : null,
1311
+ icon === "plus" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Glyph, { d: PLUS, className: "size-3.5 text-muted-foreground" }) : null
1241
1312
  ] }),
1242
- person ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PersonAvatar, { name: label, size: "md" }) : null,
1243
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "min-w-0 flex-1", children: [
1244
- chip ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: (0, import_design_system8.cn)("inline-flex max-w-full truncate rounded-md border px-1.5 py-0.5 text-xs font-medium", chip), "data-records-choice-chip": "", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "block truncate", children: label }),
1245
- detail ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "block truncate text-xs text-muted-foreground", "data-tell-apart": "", children: detail }) : null
1313
+ person ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PersonAvatar, { name: label, size: "md" }) : null,
1314
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "min-w-0 flex-1", children: [
1315
+ chip ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: (0, import_design_system8.cn)("inline-flex max-w-full truncate rounded-md border px-1.5 py-0.5 text-xs font-medium", chip), "data-records-choice-chip": "", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "block truncate", children: label }),
1316
+ detail ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "block truncate text-xs text-muted-foreground", "data-tell-apart": "", children: detail }) : null
1246
1317
  ] })
1247
1318
  ]
1248
1319
  }
@@ -1250,8 +1321,8 @@ function PickRow({
1250
1321
  }
1251
1322
  function PickChips({ chips }) {
1252
1323
  if (chips.length === 0) return null;
1253
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-wrap gap-1 px-1 pb-1", "data-pick-chips": "", children: chips.map(
1254
- (c) => c.person ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PersonChip, { name: c.label, onRemove: c.onRemove }, c.id) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1324
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex flex-wrap gap-1 px-1 pb-1", "data-pick-chips": "", children: chips.map(
1325
+ (c) => c.person ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PersonChip, { name: c.label, onRemove: c.onRemove }, c.id) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1255
1326
  "span",
1256
1327
  {
1257
1328
  "data-pick-chip": "",
@@ -1261,15 +1332,15 @@ function PickChips({ chips }) {
1261
1332
  c.chip ?? "bg-secondary text-secondary-foreground"
1262
1333
  ),
1263
1334
  children: [
1264
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "min-w-0 truncate", children: c.label }),
1265
- c.onRemove ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1335
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "min-w-0 truncate", children: c.label }),
1336
+ c.onRemove ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1266
1337
  "button",
1267
1338
  {
1268
1339
  type: "button",
1269
1340
  "aria-label": `Remove ${c.label}`,
1270
1341
  onClick: c.onRemove,
1271
1342
  className: "shrink-0 rounded-sm opacity-60 hover:opacity-100",
1272
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Glyph, { d: CROSS, className: "size-3" })
1343
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Glyph, { d: CROSS, className: "size-3" })
1273
1344
  }
1274
1345
  ) : null
1275
1346
  ]
@@ -1324,7 +1395,7 @@ function PickOrAdd({
1324
1395
  searchEmpty: search === ""
1325
1396
  });
1326
1397
  const hasFoot = Boolean(foot) || Boolean(footNote);
1327
- const addRowNode = addRow ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1398
+ const addRowNode = addRow ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1328
1399
  PickRow,
1329
1400
  {
1330
1401
  label: addRow.label,
@@ -1337,9 +1408,9 @@ function PickOrAdd({
1337
1408
  onPoint: () => keys.setHighlight(addAt)
1338
1409
  }
1339
1410
  ) : null;
1340
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system8.Popover, { open, onOpenChange, children: [
1341
- anchored ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system8.PopoverAnchor, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { "data-pick-anchor": "", className: "flex min-h-6 w-full min-w-0 flex-wrap items-center gap-1", "aria-label": triggerLabel, children }) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system8.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_design_system8.Button, { id: triggerId, type: "button", size: "sm", variant: "outline", className: triggerSize === "field" ? "h-9" : void 0, "aria-label": triggerLabel, children: triggerText }) }),
1342
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1411
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_design_system8.Popover, { open, onOpenChange, children: [
1412
+ anchored ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_design_system8.PopoverAnchor, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { "data-pick-anchor": "", className: "flex min-h-6 w-full min-w-0 flex-wrap items-center gap-1", "aria-label": triggerLabel, children }) }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_design_system8.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_design_system8.Button, { id: triggerId, type: "button", size: "sm", variant: "outline", className: triggerSize === "field" ? "h-9" : void 0, "aria-label": triggerLabel, children: triggerText }) }),
1413
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1343
1414
  import_design_system8.PopoverContent,
1344
1415
  {
1345
1416
  sizing: "content",
@@ -1361,8 +1432,8 @@ function PickOrAdd({
1361
1432
  if (anchored) event.preventDefault();
1362
1433
  },
1363
1434
  children: [
1364
- chips ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PickChips, { chips }) : null,
1365
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1435
+ chips ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PickChips, { chips }) : null,
1436
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1366
1437
  import_design_system8.BasicInput,
1367
1438
  {
1368
1439
  value: search,
@@ -1376,9 +1447,9 @@ function PickOrAdd({
1376
1447
  }
1377
1448
  ),
1378
1449
  notice2,
1379
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_design_system8.ScrollArea, { className: "max-h-64", children: [
1380
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { role: "listbox", "aria-label": triggerLabel, "aria-multiselectable": multi ? true : void 0, children: [
1381
- items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1450
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_design_system8.ScrollArea, { className: "max-h-64", children: [
1451
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { role: "listbox", "aria-label": triggerLabel, "aria-multiselectable": multi ? true : void 0, children: [
1452
+ items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1382
1453
  PickRow,
1383
1454
  {
1384
1455
  label: item.label,
@@ -1399,7 +1470,7 @@ function PickOrAdd({
1399
1470
  ] }),
1400
1471
  items.length === 0 && empty ? empty : null
1401
1472
  ] }),
1402
- hasFoot ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mt-1 border-t pt-1", children: [
1473
+ hasFoot ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "mt-1 border-t pt-1", children: [
1403
1474
  foot,
1404
1475
  footNote
1405
1476
  ] }) : null
@@ -1408,7 +1479,7 @@ function PickOrAdd({
1408
1479
  )
1409
1480
  ] });
1410
1481
  }
1411
- var import_react15, import_design_system8, import_jsx_runtime12, TICK, CROSS, PLUS;
1482
+ var import_react15, import_design_system8, import_jsx_runtime13, TICK, CROSS, PLUS;
1412
1483
  var init_PickOrAdd = __esm({
1413
1484
  "src/PickOrAdd.tsx"() {
1414
1485
  "use strict";
@@ -1416,7 +1487,7 @@ var init_PickOrAdd = __esm({
1416
1487
  import_react15 = require("react");
1417
1488
  init_personChip();
1418
1489
  import_design_system8 = require("@ai-matrx/design-system");
1419
- import_jsx_runtime12 = require("react/jsx-runtime");
1490
+ import_jsx_runtime13 = require("react/jsx-runtime");
1420
1491
  TICK = "m5 12 4 4L19 6";
1421
1492
  CROSS = "M18 6 6 18M6 6l12 12";
1422
1493
  PLUS = "M12 5v14M5 12h14";
@@ -1459,7 +1530,7 @@ function PickOne({
1459
1530
  if (options.length > PICK_ONE_SEARCH_AFTER) {
1460
1531
  const q = search.trim().toLowerCase();
1461
1532
  const shown5 = q === "" ? options : options.filter((o) => o.label.toLowerCase().includes(q));
1462
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: (0, import_design_system12.cn)("inline-flex min-w-0", className), "data-records-pick-one": "search", "data-pick-value": value, ...attrs ?? {}, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1533
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: (0, import_design_system12.cn)("inline-flex min-w-0", className), "data-records-pick-one": "search", "data-pick-value": value, ...attrs ?? {}, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1463
1534
  PickOrAdd,
1464
1535
  {
1465
1536
  triggerSize: "compact",
@@ -1485,12 +1556,12 @@ function PickOne({
1485
1556
  setOpen(false);
1486
1557
  setSearch("");
1487
1558
  },
1488
- empty: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No match" })
1559
+ empty: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No match" })
1489
1560
  }
1490
1561
  ) });
1491
1562
  }
1492
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system12.Select, { value: current ? inner(current.value) : "", onValueChange: (v) => onChange(outer(v)), disabled: disabled ?? false, children: [
1493
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1563
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_design_system12.Select, { value: current ? inner(current.value) : "", onValueChange: (v) => onChange(outer(v)), disabled: disabled ?? false, children: [
1564
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1494
1565
  import_design_system12.SelectTrigger,
1495
1566
  {
1496
1567
  id,
@@ -1500,14 +1571,14 @@ function PickOne({
1500
1571
  "data-records-pick-one": "list",
1501
1572
  "data-pick-value": value,
1502
1573
  ...attrs ?? {},
1503
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system12.SelectValue, { placeholder })
1574
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system12.SelectValue, { placeholder })
1504
1575
  }
1505
1576
  ),
1506
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system12.SelectContent, { children: groupsOf(options).map(
1507
- ([group, items]) => group ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system12.SelectGroup, { children: [
1508
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system12.SelectLabel, { children: group }),
1509
- items.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system12.SelectItem, { value: inner(o.value), "data-pick-value": o.value, "data-pick-group": group, children: o.label }, inner(o.value)))
1510
- ] }, group) : items.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system12.SelectItem, { value: inner(o.value), "data-pick-value": o.value, children: o.label }, inner(o.value)))
1577
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system12.SelectContent, { children: groupsOf(options).map(
1578
+ ([group, items]) => group ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_design_system12.SelectGroup, { children: [
1579
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system12.SelectLabel, { children: group }),
1580
+ items.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system12.SelectItem, { value: inner(o.value), "data-pick-value": o.value, "data-pick-group": group, children: o.label }, inner(o.value)))
1581
+ ] }, group) : items.map((o) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system12.SelectItem, { value: inner(o.value), "data-pick-value": o.value, children: o.label }, inner(o.value)))
1511
1582
  ) })
1512
1583
  ] });
1513
1584
  }
@@ -1520,7 +1591,7 @@ function groupsOf(options) {
1520
1591
  }
1521
1592
  return out;
1522
1593
  }
1523
- var import_react24, import_design_system12, import_jsx_runtime16, PICK_ONE_SEARCH_AFTER, EMPTY, inner, outer;
1594
+ var import_react24, import_design_system12, import_jsx_runtime17, PICK_ONE_SEARCH_AFTER, EMPTY, inner, outer;
1524
1595
  var init_PickOne = __esm({
1525
1596
  "src/PickOne.tsx"() {
1526
1597
  "use strict";
@@ -1528,7 +1599,7 @@ var init_PickOne = __esm({
1528
1599
  import_react24 = require("react");
1529
1600
  import_design_system12 = require("@ai-matrx/design-system");
1530
1601
  init_PickOrAdd();
1531
- import_jsx_runtime16 = require("react/jsx-runtime");
1602
+ import_jsx_runtime17 = require("react/jsx-runtime");
1532
1603
  PICK_ONE_SEARCH_AFTER = 7;
1533
1604
  EMPTY = "__records_pick_one_empty__";
1534
1605
  inner = (v) => v === "" ? EMPTY : v;
@@ -1585,12 +1656,13 @@ function madeOn(stamp) {
1585
1656
  if (!stamp) return null;
1586
1657
  const at = new Date(stamp);
1587
1658
  if (Number.isNaN(at.getTime())) return null;
1588
- return new Intl.DateTimeFormat(void 0, { month: "short", day: "numeric", year: "numeric" }).format(at);
1659
+ return new Intl.DateTimeFormat(void 0, { month: "short", day: "numeric", year: "numeric", ...(0, import_field_formats8.momentZoneOptions)(at) }).format(at);
1589
1660
  }
1590
- var PLATFORM_TABLE_PREFIX, CHOICES_SUFFIX;
1661
+ var import_field_formats8, PLATFORM_TABLE_PREFIX, CHOICES_SUFFIX;
1591
1662
  var init_tablePickerEntries = __esm({
1592
1663
  "src/tablePickerEntries.ts"() {
1593
1664
  "use strict";
1665
+ import_field_formats8 = require("@ai-matrx/design-system/field-formats");
1594
1666
  PLATFORM_TABLE_PREFIX = "records_ui_";
1595
1667
  CHOICES_SUFFIX = / choices$/i;
1596
1668
  }
@@ -1648,18 +1720,18 @@ function ReadRefusalDock() {
1648
1720
  if (now.length === 0 || docks[0] !== id) return null;
1649
1721
  const retryAll = () => now.forEach((k) => k.retry());
1650
1722
  const first = now[0];
1651
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { "data-read-refusal-dock": "", className: "pointer-events-none fixed inset-x-0 bottom-3 z-50 flex justify-center px-3", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "pointer-events-auto w-full max-w-md rounded-lg border bg-background shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1723
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { "data-read-refusal-dock": "", className: "pointer-events-none fixed inset-x-0 bottom-3 z-50 flex justify-center px-3", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "pointer-events-auto w-full max-w-md rounded-lg border bg-background shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1652
1724
  import_design_system15.ErrorNotice,
1653
1725
  {
1654
1726
  size: "compact",
1655
1727
  error: refusalTimedOut(first.error) ? { code: "timed_out" } : first.error,
1656
1728
  message: refusalTimedOut(first.error) ? null : refusalSaid(first.error),
1657
1729
  operation: `read ${first.key}`,
1658
- actions: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_design_system15.Button, { type: "button", size: "sm", variant: "outline", "data-error-retry": "", onClick: retryAll, children: "Try again" })
1730
+ actions: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_design_system15.Button, { type: "button", size: "sm", variant: "outline", "data-error-retry": "", onClick: retryAll, children: "Try again" })
1659
1731
  }
1660
1732
  ) }) });
1661
1733
  }
1662
- var import_react29, import_design_system15, import_jsx_runtime19, kept, listeners, docks, emit, subscribe, READ_RETRY_PAUSE_MS;
1734
+ var import_react29, import_design_system15, import_jsx_runtime20, kept, listeners, docks, emit, subscribe, READ_RETRY_PAUSE_MS;
1663
1735
  var init_readRefusals = __esm({
1664
1736
  "src/readRefusals.tsx"() {
1665
1737
  "use strict";
@@ -1667,7 +1739,7 @@ var init_readRefusals = __esm({
1667
1739
  import_react29 = require("react");
1668
1740
  import_design_system15 = require("@ai-matrx/design-system");
1669
1741
  init_refusalSaid();
1670
- import_jsx_runtime19 = require("react/jsx-runtime");
1742
+ import_jsx_runtime20 = require("react/jsx-runtime");
1671
1743
  kept = [];
1672
1744
  listeners = /* @__PURE__ */ new Set();
1673
1745
  docks = [];
@@ -1715,14 +1787,14 @@ function ShowListsToggle({
1715
1787
  className
1716
1788
  }) {
1717
1789
  if (count === 0) return null;
1718
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: (0, import_design_system16.cn)("flex items-center gap-1.5 text-[11px] text-muted-foreground", className), children: [
1719
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_design_system16.Checkbox, { checked: on, onCheckedChange: (next) => onChange(next === true), "aria-label": "Show lists" }),
1790
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: (0, import_design_system16.cn)("flex items-center gap-1.5 text-[11px] text-muted-foreground", className), children: [
1791
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_design_system16.Checkbox, { checked: on, onCheckedChange: (next) => onChange(next === true), "aria-label": "Show lists" }),
1720
1792
  "Show lists (",
1721
1793
  count,
1722
1794
  ")"
1723
1795
  ] });
1724
1796
  }
1725
- var import_react30, import_records9, import_react31, import_design_system16, import_jsx_runtime20;
1797
+ var import_react30, import_records9, import_react31, import_design_system16, import_jsx_runtime21;
1726
1798
  var init_tablePicking = __esm({
1727
1799
  "src/tablePicking.tsx"() {
1728
1800
  "use strict";
@@ -1733,7 +1805,7 @@ var init_tablePicking = __esm({
1733
1805
  import_design_system16 = require("@ai-matrx/design-system");
1734
1806
  init_tablePickerEntries();
1735
1807
  init_readRefusals();
1736
- import_jsx_runtime20 = require("react/jsx-runtime");
1808
+ import_jsx_runtime21 = require("react/jsx-runtime");
1737
1809
  }
1738
1810
  });
1739
1811
 
@@ -1807,8 +1879,8 @@ var init_enumLabels = __esm({
1807
1879
  FIELD_SENSITIVITY_LABEL = {
1808
1880
  public: "Anyone who can open the record",
1809
1881
  internal: "People in this organization",
1810
- confidential: "People who have been given the record",
1811
- restricted: "Owners and administrators only"
1882
+ confidential: "Editors and administrators",
1883
+ restricted: "Administrators only"
1812
1884
  };
1813
1885
  CONTEXT_POLICY_LABEL = {
1814
1886
  include: "Yes, an assistant can read it",
@@ -2724,7 +2796,7 @@ function planPastedBlock(args) {
2724
2796
  });
2725
2797
  accepted[key] = judged.value;
2726
2798
  }
2727
- const predicted = (0, import_core5.predictValueRefusals)(args.fields, accepted);
2799
+ const predicted = (0, import_core6.predictValueRefusals)(args.fields, accepted);
2728
2800
  for (const refusal3 of predicted) {
2729
2801
  const key = refusal3.field_key;
2730
2802
  if (key === void 0) continue;
@@ -2864,11 +2936,11 @@ function gridRefusalForPastedCell(field2, value) {
2864
2936
  const judged = valueFromPastedText(field2, value === null ? "" : String(value));
2865
2937
  return "refusal" in judged ? judged.refusal : void 0;
2866
2938
  }
2867
- var import_core5, import_records17, sameWords;
2939
+ var import_core6, import_records17, sameWords;
2868
2940
  var init_pasteValues = __esm({
2869
2941
  "src/pasteValues.ts"() {
2870
2942
  "use strict";
2871
- import_core5 = require("@ai-matrx/records/core");
2943
+ import_core6 = require("@ai-matrx/records/core");
2872
2944
  import_records17 = require("@ai-matrx/records");
2873
2945
  init_dates();
2874
2946
  init_parity();
@@ -2903,7 +2975,7 @@ function refusedCellsOf(fields, rows, mapping, choiceOptions, relationNames) {
2903
2975
  if ("unmatchedNames" in meant) return;
2904
2976
  if ("refusal" in meant) why = meant.refusal;
2905
2977
  else {
2906
- const predicted = (0, import_core6.predictValueRefusals)([field2], { [key]: meant.value }).filter(
2978
+ const predicted = (0, import_core7.predictValueRefusals)([field2], { [key]: meant.value }).filter(
2907
2979
  (p) => p.field_key === void 0 || p.field_key === key
2908
2980
  );
2909
2981
  if (predicted.length > 0) why = predicted[0].message;
@@ -2923,11 +2995,11 @@ function checkImportRules(fields, rows, mapping, choiceOptions, relationNames) {
2923
2995
  }
2924
2996
  return [...verdicts.values()];
2925
2997
  }
2926
- var import_core6;
2998
+ var import_core7;
2927
2999
  var init_importRuleCheck = __esm({
2928
3000
  "src/importRuleCheck.ts"() {
2929
3001
  "use strict";
2930
- import_core6 = require("@ai-matrx/records/core");
3002
+ import_core7 = require("@ai-matrx/records/core");
2931
3003
  init_pasteValues();
2932
3004
  init_parity();
2933
3005
  }
@@ -3497,7 +3569,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
3497
3569
  try {
3498
3570
  const xlsx = file.name.toLowerCase().endsWith(".xlsx");
3499
3571
  const bytes = await file.arrayBuffer();
3500
- const result = xlsx ? await (0, import_core7.importXlsx)(bytes) : (0, import_core7.importCsv)(new TextDecoder().decode(bytes));
3572
+ const result = xlsx ? await (0, import_core8.importXlsx)(bytes) : (0, import_core8.importCsv)(new TextDecoder().decode(bytes));
3501
3573
  await planFrom(result, { name: file.name, bytes: file.size, hash: await sha256(bytes), format: xlsx ? "xlsx" : "csv" });
3502
3574
  } catch (thrown) {
3503
3575
  setProblem(
@@ -4693,14 +4765,14 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
4693
4765
  table.error ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(RefusalNotice, { error: table.error, onRetry: table.reload }) : null
4694
4766
  ] });
4695
4767
  }
4696
- var import_react59, import_react60, import_core7, import_design_system33, import_records20, import_text_case5, import_jsx_runtime40, BATCH, SAMPLES, COLUMNS_PER_CALL, ABSENT, LEAVE, TITLE_COPY, TYPED_VALUES;
4768
+ var import_react59, import_react60, import_core8, import_design_system33, import_records20, import_text_case5, import_jsx_runtime40, BATCH, SAMPLES, COLUMNS_PER_CALL, ABSENT, LEAVE, TITLE_COPY, TYPED_VALUES;
4697
4769
  var init_ImportWizard = __esm({
4698
4770
  "src/ImportWizard.tsx"() {
4699
4771
  "use strict";
4700
4772
  "use client";
4701
4773
  import_react59 = require("react");
4702
4774
  import_react60 = require("@ai-matrx/records/react");
4703
- import_core7 = require("@ai-matrx/records/core");
4775
+ import_core8 = require("@ai-matrx/records/core");
4704
4776
  import_design_system33 = require("@ai-matrx/design-system");
4705
4777
  import_records20 = require("@ai-matrx/records");
4706
4778
  init_Refusal();
@@ -7277,7 +7349,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
7277
7349
  };
7278
7350
  }, [client]);
7279
7351
  const listed = facts.phase === "read" ? (0, import_records25.withTablePlacement)(
7280
- (0, import_core8.withTableFacts)(tables.data ?? [], facts.rows, me),
7352
+ (0, import_core9.withTableFacts)(tables.data ?? [], facts.rows, me),
7281
7353
  facts.rows
7282
7354
  ) : tables.data ?? [];
7283
7355
  const [showEverything, setShowEverything] = (0, import_react72.useState)(false);
@@ -7433,14 +7505,14 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
7433
7505
  }) : null
7434
7506
  ] });
7435
7507
  }
7436
- var import_react72, import_react73, import_core8, import_records25, import_design_system43, import_jsx_runtime50, TABLE_LANES, LANE_TITLE, LANE_EMPTY, SECTIONS_UNKNOWN, VISIBILITY_LANES, VISIBILITY_LANE_TITLE;
7508
+ var import_react72, import_react73, import_core9, import_records25, import_design_system43, import_jsx_runtime50, TABLE_LANES, LANE_TITLE, LANE_EMPTY, SECTIONS_UNKNOWN, VISIBILITY_LANES, VISIBILITY_LANE_TITLE;
7437
7509
  var init_TablesHome = __esm({
7438
7510
  "src/TablesHome.tsx"() {
7439
7511
  "use strict";
7440
7512
  "use client";
7441
7513
  import_react72 = require("react");
7442
7514
  import_react73 = require("@ai-matrx/records/react");
7443
- import_core8 = require("@ai-matrx/records/core");
7515
+ import_core9 = require("@ai-matrx/records/core");
7444
7516
  import_records25 = require("@ai-matrx/records");
7445
7517
  import_design_system43 = require("@ai-matrx/design-system");
7446
7518
  init_NewTableStart();
@@ -8889,57 +8961,8 @@ var import_data_table = require("@ai-matrx/design-system/data-table");
8889
8961
 
8890
8962
  // src/personTime.ts
8891
8963
  var import_react4 = require("react");
8892
-
8893
- // src/personZone.ts
8894
- var import_table_style = require("@ai-matrx/design-system/data-table/table-style");
8895
- var import_global_slot = require("@ai-matrx/kit/global-slot");
8896
- var state = (0, import_global_slot.globalSlot)("ai-matrx.records-ui.person-time-zone", () => ({
8897
- zone: null,
8898
- listeners: /* @__PURE__ */ new Set()
8899
- }));
8900
- function valid(z) {
8901
- if (typeof z !== "string" || !z.trim()) return false;
8902
- try {
8903
- new Intl.DateTimeFormat("en-US", { timeZone: z });
8904
- return true;
8905
- } catch {
8906
- return false;
8907
- }
8908
- }
8909
- function setPersonTimeZone(next) {
8910
- const clean = valid(next) ? next : null;
8911
- if (clean === state.zone) return;
8912
- state.zone = clean;
8913
- (0, import_table_style.setColorRuleTimeZone)(clean);
8914
- state.listeners.forEach((l) => l());
8915
- }
8916
- function getPersonTimeZone() {
8917
- return state.zone;
8918
- }
8919
- function subscribePersonTimeZone(listener) {
8920
- state.listeners.add(listener);
8921
- return () => {
8922
- state.listeners.delete(listener);
8923
- };
8924
- }
8925
- function personWallNow(at = /* @__PURE__ */ new Date()) {
8926
- const zone = state.zone;
8927
- if (!zone) return at;
8928
- const parts = new Intl.DateTimeFormat("en-US", {
8929
- timeZone: zone,
8930
- year: "numeric",
8931
- month: "2-digit",
8932
- day: "2-digit",
8933
- hour: "2-digit",
8934
- minute: "2-digit",
8935
- second: "2-digit",
8936
- hourCycle: "h23"
8937
- }).formatToParts(at);
8938
- const n = (t) => Number(parts.find((p) => p.type === t)?.value ?? 0);
8939
- return new Date(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
8940
- }
8941
-
8942
- // src/personTime.ts
8964
+ init_personZone();
8965
+ init_personZone();
8943
8966
  function usePersonTimeZone() {
8944
8967
  return (0, import_react4.useSyncExternalStore)(
8945
8968
  subscribePersonTimeZone,
@@ -10284,11 +10307,11 @@ function registeredLook(format) {
10284
10307
  // src/looks/tableTokens.tsx
10285
10308
  var import_react10 = require("react");
10286
10309
  var import_react11 = require("@ai-matrx/records/react");
10287
- var import_field_formats4 = require("@ai-matrx/design-system/field-formats");
10310
+ var import_field_formats5 = require("@ai-matrx/design-system/field-formats");
10288
10311
 
10289
10312
  // src/presentation.ts
10290
10313
  var import_table_style3 = require("@ai-matrx/design-system/data-table/table-style");
10291
- var import_field_formats3 = require("@ai-matrx/design-system/field-formats");
10314
+ var import_field_formats4 = require("@ai-matrx/design-system/field-formats");
10292
10315
  var import_field_kinds5 = require("@ai-matrx/records/field-kinds");
10293
10316
  init_parity();
10294
10317
  init_dates();
@@ -10507,7 +10530,7 @@ function shownAsOf(field2) {
10507
10530
  const raw = field2.display_format;
10508
10531
  if (!raw || typeof raw !== "object") return void 0;
10509
10532
  const id = raw.id;
10510
- if (typeof id !== "string" || id === "formula" || !(0, import_field_formats3.getFieldFormat)(id)) return void 0;
10533
+ if (typeof id !== "string" || id === "formula" || !(0, import_field_formats4.getFieldFormat)(id)) return void 0;
10511
10534
  const options = raw.options;
10512
10535
  return options && typeof options === "object" && Object.keys(options).length > 0 ? { id, options } : { id };
10513
10536
  }
@@ -10676,7 +10699,7 @@ function tokensFromRows(rows, fields, titleField) {
10676
10699
  if (value === null || value === void 0 || value === "") continue;
10677
10700
  switch (format.id) {
10678
10701
  case "color_pair": {
10679
- const pair = (0, import_field_formats4.readColorPair)(value);
10702
+ const pair = (0, import_field_formats5.readColorPair)(value);
10680
10703
  if (pair) {
10681
10704
  light[name] = pair.light;
10682
10705
  dark[name] = pair.dark ?? pair.light;
@@ -10689,22 +10712,22 @@ function tokensFromRows(rows, fields, titleField) {
10689
10712
  break;
10690
10713
  }
10691
10714
  case "shadow": {
10692
- const pair = (0, import_field_formats4.readShadowPair)(value);
10715
+ const pair = (0, import_field_formats5.readShadowPair)(value);
10693
10716
  if (pair) {
10694
- light[name] = (0, import_field_formats4.shadowCss)(pair.light);
10695
- dark[name] = (0, import_field_formats4.shadowCss)(pair.dark);
10717
+ light[name] = (0, import_field_formats5.shadowCss)(pair.light);
10718
+ dark[name] = (0, import_field_formats5.shadowCss)(pair.dark);
10696
10719
  }
10697
10720
  break;
10698
10721
  }
10699
10722
  case "opacity": {
10700
- const o = (0, import_field_formats4.readOpacity)(value);
10723
+ const o = (0, import_field_formats5.readOpacity)(value);
10701
10724
  if (o !== null) light[name] = dark[name] = String(o);
10702
10725
  break;
10703
10726
  }
10704
10727
  case "type_style": {
10705
- const style = (0, import_field_formats4.readTypeStyle)(value);
10728
+ const style = (0, import_field_formats5.readTypeStyle)(value);
10706
10729
  if (style) {
10707
- const css = (0, import_field_formats4.typeStyleCss)(style);
10730
+ const css = (0, import_field_formats5.typeStyleCss)(style);
10708
10731
  light[`font-${name}`] = dark[`font-${name}`] = String(css.fontFamily);
10709
10732
  light[`text-${name}`] = dark[`text-${name}`] = `${style.size}px`;
10710
10733
  light[`weight-${name}`] = dark[`weight-${name}`] = String(style.weight);
@@ -10716,7 +10739,7 @@ function tokensFromRows(rows, fields, titleField) {
10716
10739
  break;
10717
10740
  }
10718
10741
  case "motion": {
10719
- const m = (0, import_field_formats4.readMotion)(value);
10742
+ const m = (0, import_field_formats5.readMotion)(value);
10720
10743
  if (m) light[name] = dark[name] = `${m.duration}ms ${m.easing}`;
10721
10744
  break;
10722
10745
  }
@@ -10764,7 +10787,7 @@ function TableTokensProvider({ tableIds, children }) {
10764
10787
  }
10765
10788
 
10766
10789
  // src/labels.tsx
10767
- var import_field_formats5 = require("@ai-matrx/design-system/field-formats");
10790
+ var import_field_formats6 = require("@ai-matrx/design-system/field-formats");
10768
10791
  var import_jsx_runtime8 = require("react/jsx-runtime");
10769
10792
  var LabelContext = (0, import_react12.createContext)({
10770
10793
  // With no provider the resolver is ABSENT, not silently empty: a caller gets
@@ -10803,7 +10826,7 @@ function shownValue(field2, value, labels) {
10803
10826
  if (newerWords !== null) return newerWords;
10804
10827
  const look = value === null || value === void 0 ? void 0 : registeredLook(shownAsOf(field2));
10805
10828
  if (look) {
10806
- const read = (0, import_field_formats5.formatFieldValue)(value, look);
10829
+ const read = (0, import_field_formats6.formatFieldValue)(value, look);
10807
10830
  if (read.ok && !read.empty) return read.text;
10808
10831
  }
10809
10832
  if (!labels || !pointsAtRecords(field2)) return value;
@@ -10989,8 +11012,145 @@ function useLabelWait(field2) {
10989
11012
  // src/gridLook.ts
10990
11013
  init_parity();
10991
11014
 
10992
- // src/tableJson.ts
11015
+ // src/fileExport.ts
10993
11016
  var import_core = require("@ai-matrx/records/core");
11017
+
11018
+ // src/withheldNotice.ts
11019
+ init_names();
11020
+ var WITHHELD_WORD = "Withheld";
11021
+ function withheldNoticeOf(hidden, key) {
11022
+ const notice2 = hidden?.[key];
11023
+ return notice2 && typeof notice2 === "object" ? notice2 : null;
11024
+ }
11025
+ function withheldSentence(field2, notice2) {
11026
+ const extra = notice2;
11027
+ if (typeof extra.says === "string" && extra.says.trim() !== "") return extra.says.trim();
11028
+ const name = fieldName(field2);
11029
+ if (typeof extra.part === "string" && extra.part.trim() !== "" && typeof extra.who === "string" && extra.who.trim() !== "") {
11030
+ return `${name} is in ${extra.part.trim()} \u2014 ${extra.who.trim()} see it.`;
11031
+ }
11032
+ const reason = notice2.reason ? ` It is ${notice2.reason}` : "";
11033
+ const needs = notice2.needs ? `${reason ? "," : " It"} and reading it needs ${notice2.needs}` : "";
11034
+ const or = notice2.or ? `${needs || reason ? ", or" : " It needs"} ${notice2.or}` : "";
11035
+ return `${name} is withheld from you.${reason}${needs}${or}${reason || needs || or ? "." : ""}`;
11036
+ }
11037
+
11038
+ // src/withheld.tsx
11039
+ var import_jsx_runtime9 = require("react/jsx-runtime");
11040
+ function WithheldValue({ field: field2, notice: notice2 }) {
11041
+ const sentence2 = withheldSentence(field2, notice2);
11042
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
11043
+ "span",
11044
+ {
11045
+ "data-records-withheld": field2.key,
11046
+ title: sentence2,
11047
+ "aria-label": `${WITHHELD_WORD}. ${sentence2}`,
11048
+ className: "cursor-help italic text-muted-foreground",
11049
+ children: WITHHELD_WORD
11050
+ }
11051
+ );
11052
+ }
11053
+
11054
+ // src/fileExport.ts
11055
+ var import_field_formats7 = require("@ai-matrx/design-system/field-formats");
11056
+ init_dates();
11057
+ init_personZone();
11058
+ var SHEET_EPOCH_DAYS = 25569;
11059
+ function serialOfWall(y, mo, d, h = 0, mi = 0, s = 0) {
11060
+ return Date.UTC(y, mo, d, h, mi, s) / 864e5 + SHEET_EPOCH_DAYS;
11061
+ }
11062
+ function typedDate(field2, value) {
11063
+ if (!isDateField(field2)) return null;
11064
+ const format = dateFormatFor(field2, value);
11065
+ if (!format) return null;
11066
+ if (typeof value === "string") {
11067
+ const bare = /^(\d{4})-(\d{2})-(\d{2})(?:[T ]00:00(?::00(?:\.0+)?)?)?$/.exec(value.trim());
11068
+ if (bare) return { t: "n", v: serialOfWall(Number(bare[1]), Number(bare[2]) - 1, Number(bare[3])), z: "yyyy-mm-dd" };
11069
+ }
11070
+ if (typeof value !== "string" && typeof value !== "number" && !(value instanceof Date)) return null;
11071
+ const at = value instanceof Date ? value : new Date(value);
11072
+ if (Number.isNaN(at.getTime())) return null;
11073
+ if (format.id === "date") {
11074
+ const day2 = personWallNow(at);
11075
+ return { t: "n", v: serialOfWall(day2.getFullYear(), day2.getMonth(), day2.getDate()), z: "yyyy-mm-dd" };
11076
+ }
11077
+ const w = personWallNow(at);
11078
+ return { t: "n", v: serialOfWall(w.getFullYear(), w.getMonth(), w.getDate(), w.getHours(), w.getMinutes(), w.getSeconds()), z: "yyyy-mm-dd hh:mm" };
11079
+ }
11080
+ function fileCellExtras(field2, stored, shown5) {
11081
+ if (shown5 === null || shown5 === void 0 || shown5 === "") return {};
11082
+ const typed2 = typedDate(field2, stored);
11083
+ if (typed2) {
11084
+ const words2 = dateText(field2, stored);
11085
+ return { typed: typed2, ...words2 !== null ? { text: words2 } : {} };
11086
+ }
11087
+ if (Array.isArray(shown5) && shown5.every((v) => v === null || ["string", "number", "boolean"].includes(typeof v))) {
11088
+ return { text: shown5.filter((v) => v !== null).map(String).join(", ") };
11089
+ }
11090
+ if (typeof shown5 === "number" && Number.isFinite(shown5)) {
11091
+ const look = shownAsOf(field2);
11092
+ const words2 = look && !registeredLook(look) ? (0, import_field_formats7.formatFieldValue)(shown5, look) : null;
11093
+ return { typed: { t: "n", v: shown5 }, ...words2 && words2.ok && !words2.empty ? { text: words2.text } : {} };
11094
+ }
11095
+ return {};
11096
+ }
11097
+ function displayRows(rows) {
11098
+ return rows.map(
11099
+ (row) => Object.fromEntries(
11100
+ Object.entries(row).map(([key, cell2]) => {
11101
+ const text = cell2?.text;
11102
+ return [key, cell2 && text !== void 0 && !cell2.absent_reason ? { ...cell2, value: text } : cell2];
11103
+ })
11104
+ )
11105
+ );
11106
+ }
11107
+ function fileCsv(fields, rows) {
11108
+ return (0, import_core.exportCsv)(fields, displayRows(rows));
11109
+ }
11110
+ function fileMarkdown(fields, rows) {
11111
+ return (0, import_core.exportMarkdown)(fields, displayRows(rows));
11112
+ }
11113
+ async function fileXlsx(fields, rows, sheetLabel = "Records") {
11114
+ const { writeWorkbookBytes } = await import("@ai-matrx/print/xlsx");
11115
+ const words2 = (0, import_core.toAoa)(fields, displayRows(rows));
11116
+ const sheet = words2.map(
11117
+ (line, at) => line.map((text, col) => {
11118
+ if (at === 0) return text;
11119
+ const cell2 = rows[at - 1]?.[fields[col].key];
11120
+ const typed2 = cell2 && !cell2.absent_reason ? cell2.typed : void 0;
11121
+ return typed2 ? { t: typed2.t, v: typed2.v, ...typed2.z ? { z: typed2.z } : {} } : text;
11122
+ })
11123
+ );
11124
+ const name = sheetLabel.replace(/[\\/?*[\]:]/g, " ").trim().slice(0, 31) || "Data";
11125
+ return writeWorkbookBytes({ sheets: [{ name, rows: sheet }] });
11126
+ }
11127
+ function toRows(fields, records, labels) {
11128
+ return records.map((record) => {
11129
+ const document2 = record.document ?? {};
11130
+ const envelopes = document2["_values"] ?? {};
11131
+ const row = {};
11132
+ for (const field2 of fields) {
11133
+ const envelope = envelopes[field2.key];
11134
+ const withheld = withheldNoticeOf(record.hidden, field2.key);
11135
+ const held = withheld && (document2[field2.key] ?? null) === null;
11136
+ const shown5 = held ? `${WITHHELD_WORD}: ${withheldSentence(field2, withheld)}` : shownValue(field2, document2[field2.key] ?? null, labels);
11137
+ row[field2.key] = {
11138
+ field_key: field2.key,
11139
+ value: shown5,
11140
+ // The words the grid shows and the sheet cell, for the human files (`fileExport.ts`).
11141
+ ...held ? {} : fileCellExtras(field2, document2[field2.key] ?? null, shown5),
11142
+ absent_reason: envelope?.absent ?? null,
11143
+ // A VALUE KEPT AS A FILE carries its pointer, so the export writes the whole text
11144
+ // (`withWholeValues`), never the first words passed off as the value.
11145
+ source: (0, import_core.wholeValueOf)(document2, field2.key)
11146
+ };
11147
+ }
11148
+ return row;
11149
+ });
11150
+ }
11151
+
11152
+ // src/tableJson.ts
11153
+ var import_core2 = require("@ai-matrx/records/core");
10994
11154
  var import_delimited = require("@ai-matrx/kit/delimited");
10995
11155
  init_parity();
10996
11156
  init_names();
@@ -11003,7 +11163,7 @@ function storedExportRows(fields, rows) {
11003
11163
  }
11004
11164
  function exportCsvWithRowIds(fields, rows, ids) {
11005
11165
  const head = [ROW_ID_NAME, ...uniqueNames(fields)];
11006
- const body = rows.map((row, at) => [ids[at] ?? "", ...fields.map((f) => (0, import_core.exportCellText)(f, row[f.key]))]);
11166
+ const body = rows.map((row, at) => [ids[at] ?? "", ...fields.map((f) => (0, import_core2.exportCellText)(f, row[f.key]))]);
11007
11167
  return (0, import_delimited.toDelimited)([head, ...body]);
11008
11168
  }
11009
11169
  function jsonCell(value) {
@@ -11209,6 +11369,12 @@ function gridCopyConfig(args) {
11209
11369
  ...viewRows ? { export: () => {
11210
11370
  const visible = viewRows();
11211
11371
  return {
11372
+ // THE TOOLBAR'S OWN "Download" (CSV, TSV, Excel, Copy as table) writes the rows through the same
11373
+ // words the rail writes (`fileExport.ts`): the value as the grid SHOWS it, a date in her zone.
11374
+ sheetColumns: () => fields.map((field2) => ({ id: field2.key, label: fieldName(field2) })),
11375
+ sheetRows: () => displayRows(toRows([...fields], viewRows(), labels)).map(
11376
+ (row) => Object.fromEntries(fields.map((field2) => [field2.key, row[field2.key]?.value ?? null]))
11377
+ ),
11212
11378
  items: [
11213
11379
  { id: "csv-row-ids", label: "CSV with row IDs", build: () => ({ content: exportCsvWithRowIds(fields, stored(visible), ids(visible)), extension: "csv", mime: "text/csv;charset=utf-8", filename: `${tableName2} with row IDs` }) },
11214
11380
  { id: "table-json", label: "JSON with row IDs", build: () => ({ content: exportJson(fields, stored(visible), ids(visible)), extension: "json", mime: "application/json;charset=utf-8", filename: tableName2 }) },
@@ -11271,7 +11437,7 @@ init_host();
11271
11437
  init_host();
11272
11438
  init_names();
11273
11439
  init_Refusal();
11274
- var import_jsx_runtime13 = require("react/jsx-runtime");
11440
+ var import_jsx_runtime14 = require("react/jsx-runtime");
11275
11441
  function personFromRow(row) {
11276
11442
  const data = row.document ?? {};
11277
11443
  const userId = data["user_id"];
@@ -11352,10 +11518,10 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
11352
11518
  }, [client, personTable, picked.length, people.length]);
11353
11519
  const listed = (0, import_records4.rankTypedMatches)(members ?? [], search, memberName);
11354
11520
  if (!membersPort || !client) {
11355
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: (0, import_design_system9.cn)("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
11521
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: (0, import_design_system9.cn)("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
11356
11522
  }
11357
11523
  if (!personTable) {
11358
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: (0, import_design_system9.cn)("text-xs text-muted-foreground", className), children: [
11524
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: (0, import_design_system9.cn)("text-xs text-muted-foreground", className), children: [
11359
11525
  fieldName(field2),
11360
11526
  " 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."
11361
11527
  ] });
@@ -11405,14 +11571,14 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
11405
11571
  picked.map((recordId) => people.find((p) => p.id === recordId)?.userId).filter(Boolean)
11406
11572
  );
11407
11573
  const anchored = autoOpen === true;
11408
- const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PersonChip, { name: nameOfRecord(recordId), ...disabled || anchored ? {} : { onRemove: () => drop(recordId) } }, recordId));
11409
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: (0, import_design_system9.cn)("flex flex-wrap items-center gap-1", className), children: [
11574
+ const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PersonChip, { name: nameOfRecord(recordId), ...disabled || anchored ? {} : { onRemove: () => drop(recordId) } }, recordId));
11575
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: (0, import_design_system9.cn)("flex flex-wrap items-center gap-1", className), children: [
11410
11576
  anchored && !disabled ? null : cellChips,
11411
11577
  disabled ? null : (
11412
11578
  // THE ONE "PICK OR ADD" BUILDER (lane CELL-EDITORS, 2026-10-06): the person list used to carry
11413
11579
  // its own copy of the list's layout and keys; it now draws the same rows, ticks, highlight and
11414
11580
  // head chips as every other picker, and in a grid cell hangs from the cell.
11415
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
11581
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
11416
11582
  PickOrAdd,
11417
11583
  {
11418
11584
  ...anchored && onCancel ? { onEscape: onCancel } : {},
@@ -11440,11 +11606,11 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
11440
11606
  const member = visible.find((m) => m.userId === userId);
11441
11607
  if (member && !busy) void pick(member);
11442
11608
  },
11443
- notice: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
11444
- error ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RefusalLine, { error, className: "p-2" }) : null,
11445
- members === null ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading the members\u2026" }) : null
11609
+ notice: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
11610
+ error ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RefusalLine, { error, className: "p-2" }) : null,
11611
+ members === null ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading the members\u2026" }) : null
11446
11612
  ] }),
11447
- empty: members !== null ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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,
11613
+ empty: members !== null ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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,
11448
11614
  children: anchored ? cellChips : null
11449
11615
  }
11450
11616
  )
@@ -11624,7 +11790,7 @@ async function forgetWrittenWords(client, tableId, key, written) {
11624
11790
  }
11625
11791
 
11626
11792
  // src/FieldRetype.tsx
11627
- var import_jsx_runtime14 = require("react/jsx-runtime");
11793
+ var import_jsx_runtime15 = require("react/jsx-runtime");
11628
11794
  var RETYPE_PREVIEW_DEBOUNCE_MS = 300;
11629
11795
  function scheduleRetypePreview(ask2, ms = RETYPE_PREVIEW_DEBOUNCE_MS) {
11630
11796
  const timer = setTimeout(ask2, ms);
@@ -11753,7 +11919,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
11753
11919
  };
11754
11920
  }, [client, tableId, field2.key, to, person, roster]);
11755
11921
  if (!retypeableFrom(field2)) {
11756
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[11px] text-muted-foreground", "data-records-retype": "not-here", children: whyNotRetypeable(field2) });
11922
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-[11px] text-muted-foreground", "data-records-retype": "not-here", children: whyNotRetypeable(field2) });
11757
11923
  }
11758
11924
  const change = async () => {
11759
11925
  if (!to) return;
@@ -11831,27 +11997,27 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
11831
11997
  (0, import_react21.tableShapeChanged)(tableId);
11832
11998
  onRetyped?.();
11833
11999
  };
11834
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1.5", "data-records-retype": "", children: [
11835
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
11836
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_design_system10.Select, { value: to?.id ?? "", onValueChange: (next) => setTo(targets.find((t) => t.id === next) ?? null), children: [
11837
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system10.SelectTrigger, { size: "sm", "aria-label": "Change what this column holds", className: "w-auto min-w-[12rem]", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system10.SelectValue, { placeholder: "Change what this column holds" }) }),
11838
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system10.SelectContent, { children: targets.map((t) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system10.SelectItem, { value: t.id, children: t.label }, t.id)) })
12000
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-1.5", "data-records-retype": "", children: [
12001
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
12002
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system10.Select, { value: to?.id ?? "", onValueChange: (next) => setTo(targets.find((t) => t.id === next) ?? null), children: [
12003
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.SelectTrigger, { size: "sm", "aria-label": "Change what this column holds", className: "w-auto min-w-[12rem]", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.SelectValue, { placeholder: "Change what this column holds" }) }),
12004
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.SelectContent, { children: targets.map((t) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.SelectItem, { value: t.id, children: t.label }, t.id)) })
11839
12005
  ] }),
11840
- to ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system10.Button, { size: "sm", disabled: busy || asking || preview === null, onClick: () => void change(), "data-records-retype-go": "", children: busy ? "Changing\u2026" : `Change to ${to.label}` }) : null,
11841
- to ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system10.Button, { size: "sm", variant: "ghost", onClick: () => setTo(null), disabled: busy, children: "Cancel" }) : null
12006
+ to ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Button, { size: "sm", disabled: busy || asking || preview === null, onClick: () => void change(), "data-records-retype-go": "", children: busy ? "Changing\u2026" : `Change to ${to.label}` }) : null,
12007
+ to ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system10.Button, { size: "sm", variant: "ghost", onClick: () => setTo(null), disabled: busy, children: "Cancel" }) : null
11842
12008
  ] }),
11843
- to && asking ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
12009
+ to && asking ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
11844
12010
  "Counting ",
11845
12011
  name,
11846
12012
  "'s values\u2026"
11847
12013
  ] }) : null,
11848
- to && preview && limitedHeld !== null ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: "text-[11px] text-muted-foreground", "data-records-retype-preview": "", "data-records-retype-limited": "", children: [
12014
+ to && preview && limitedHeld !== null ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: "text-[11px] text-muted-foreground", "data-records-retype-preview": "", "data-records-retype-limited": "", children: [
11849
12015
  "About ",
11850
12016
  limitedHeld.toLocaleString(),
11851
12017
  " values to change to ",
11852
12018
  to.label.toLowerCase(),
11853
12019
  "; any that do not fit are kept aside with their records, with the reason \u2014 nothing is deleted."
11854
- ] }) : to && preview ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: "text-[11px] text-muted-foreground", "data-records-retype-preview": "", children: [
12020
+ ] }) : to && preview ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: "text-[11px] text-muted-foreground", "data-records-retype-preview": "", children: [
11855
12021
  preview.converts,
11856
12022
  " ",
11857
12023
  preview.converts === 1 ? "value converts" : "values convert",
@@ -11860,8 +12026,8 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
11860
12026
  preview.keptAside > 0 ? `; ${preview.keptAside} ${preview.keptAside === 1 ? "value does" : "values do"} not fit and will be kept aside with ${preview.keptAside === 1 ? "its record" : "their records"}, with the reason \u2014 nothing is deleted` + (preview.examples.length > 0 ? ` (for example ${preview.examples.map((e) => `\u201C${e}\u201D`).join(", ")})` : "") : "",
11861
12027
  preview.partial ? ". Counted over the first 1,000 different values." : "."
11862
12028
  ] }) : null,
11863
- refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RefusalNotice, { error: refusal3 }) : null,
11864
- said2 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { role: "status", className: "text-[11px] text-muted-foreground", "data-records-retype-done": "", children: said2 }) : null
12029
+ refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(RefusalNotice, { error: refusal3 }) : null,
12030
+ said2 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { role: "status", className: "text-[11px] text-muted-foreground", "data-records-retype-done": "", children: said2 }) : null
11865
12031
  ] });
11866
12032
  }
11867
12033
 
@@ -12276,7 +12442,7 @@ init_host();
12276
12442
  init_Refusal();
12277
12443
  init_plainWords();
12278
12444
  init_names();
12279
- var import_jsx_runtime15 = require("react/jsx-runtime");
12445
+ var import_jsx_runtime16 = require("react/jsx-runtime");
12280
12446
  var NOT_TYPED_BY_NAME = /* @__PURE__ */ new Set([
12281
12447
  "fx.add",
12282
12448
  "fx.sub",
@@ -12384,10 +12550,10 @@ function FormulaTextEditor({
12384
12550
  const at = Math.max(0, Math.min(parsed.position ?? 0, parsed.text.length));
12385
12551
  return { before: parsed.text.slice(0, at), after: parsed.text.slice(at) };
12386
12552
  }, [parsed]);
12387
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { "data-records-formula-editor": "", className: (0, import_design_system11.cn)("flex flex-col gap-1.5", className), children: [
12388
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1", children: [
12389
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system11.Label, { className: "text-xs", children: "The formula" }),
12390
- host.formulaHelp ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "data-records-formula-help": "", className: "ml-auto", children: host.formulaHelp({
12553
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { "data-records-formula-editor": "", className: (0, import_design_system11.cn)("flex flex-col gap-1.5", className), children: [
12554
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1", children: [
12555
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.Label, { className: "text-xs", children: "The formula" }),
12556
+ host.formulaHelp ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { "data-records-formula-help": "", className: "ml-auto", children: host.formulaHelp({
12391
12557
  tableId,
12392
12558
  text,
12393
12559
  columns,
@@ -12397,7 +12563,7 @@ function FormulaTextEditor({
12397
12563
  ...purpose ? { purpose } : {}
12398
12564
  }) }) : null
12399
12565
  ] }),
12400
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
12566
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
12401
12567
  import_design_system11.BasicTextarea,
12402
12568
  {
12403
12569
  ref: box,
@@ -12409,44 +12575,44 @@ function FormulaTextEditor({
12409
12575
  onChange: (e) => onText(e.target.value)
12410
12576
  }
12411
12577
  ),
12412
- parsed?.ok ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { "data-records-formula-ok": "", className: "text-[11px] text-muted-foreground", children: [
12578
+ parsed?.ok ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { "data-records-formula-ok": "", className: "text-[11px] text-muted-foreground", children: [
12413
12579
  "Reads ",
12414
12580
  parsed.references.length === 0 ? "no column" : parsed.references.map((r) => r.name).join(", "),
12415
12581
  " \xB7 gives ",
12416
12582
  RESULT_WORD[parsed.result_type] ?? "an answer",
12417
12583
  "."
12418
12584
  ] }) : null,
12419
- parsed?.ok && parsed.record_id ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { "data-records-formula-sample": "", className: "truncate text-[11px]", title: sampleWords(parsed), children: [
12420
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "text-muted-foreground", children: [
12585
+ parsed?.ok && parsed.record_id ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { "data-records-formula-sample": "", className: "truncate text-[11px]", title: sampleWords(parsed), children: [
12586
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "text-muted-foreground", children: [
12421
12587
  sampleRecordId ? "This record" : "First row",
12422
12588
  ": "
12423
12589
  ] }),
12424
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: (0, import_design_system11.cn)("font-mono", parsed.error ? "text-muted-foreground" : "text-foreground"), children: sampleWords(parsed) })
12590
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: (0, import_design_system11.cn)("font-mono", parsed.error ? "text-muted-foreground" : "text-foreground"), children: sampleWords(parsed) })
12425
12591
  ] }) : null,
12426
12592
  parsed && !parsed.ok ? (
12427
12593
  // NOT A REFUSAL, SO NOT RED: nothing was pressed. It is the store's reading of the
12428
12594
  // text as it stands, drawn the way the panel draws what Save is still waiting for.
12429
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { "data-records-formula-mistake": "", role: "status", className: "text-[11px] text-foreground", children: [
12430
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: parsed.error }),
12431
- where ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: "mt-0.5 font-mono text-foreground", children: [
12595
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { "data-records-formula-mistake": "", role: "status", className: "text-[11px] text-foreground", children: [
12596
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: parsed.error }),
12597
+ where ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "mt-0.5 font-mono text-foreground", children: [
12432
12598
  where.before,
12433
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "bg-amber-500/30 px-0.5", children: "\u258F" }),
12599
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "bg-amber-500/30 px-0.5", children: "\u258F" }),
12434
12600
  where.after
12435
12601
  ] }) : null
12436
12602
  ] })
12437
12603
  ) : null,
12438
- error ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(RefusalLine, { error }) : null,
12439
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
12440
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Columns:" }),
12441
- columns.map((f) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system11.Button, { type: "button", size: "sm", variant: "outline", className: "h-6 px-1.5 text-[11px]", onClick: () => insert(`{${fieldName(f)}}`), children: fieldName(f) }, f.id))
12604
+ error ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RefusalLine, { error }) : null,
12605
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
12606
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Columns:" }),
12607
+ columns.map((f) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.Button, { type: "button", size: "sm", variant: "outline", className: "h-6 px-1.5 text-[11px]", onClick: () => insert(`{${fieldName(f)}}`), children: fieldName(f) }, f.id))
12442
12608
  ] }),
12443
- STORE_FORMULA_FUNCTION_NAMES.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("details", { className: "text-[11px] text-muted-foreground", children: [
12444
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("summary", { className: "cursor-pointer", children: [
12609
+ STORE_FORMULA_FUNCTION_NAMES.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("details", { className: "text-[11px] text-muted-foreground", children: [
12610
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("summary", { className: "cursor-pointer", children: [
12445
12611
  "Functions you can use (",
12446
12612
  STORE_FORMULA_FUNCTION_NAMES.length,
12447
12613
  ")"
12448
12614
  ] }),
12449
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "mt-1 flex flex-wrap gap-1", children: STORE_FORMULA_FUNCTION_NAMES.map((name) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system11.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 font-mono text-[11px]", onClick: () => insert(`${name}()`), children: name }, name)) })
12615
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "mt-1 flex flex-wrap gap-1", children: STORE_FORMULA_FUNCTION_NAMES.map((name) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system11.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 font-mono text-[11px]", onClick: () => insert(`${name}()`), children: name }, name)) })
12450
12616
  ] }) : null
12451
12617
  ] });
12452
12618
  }
@@ -12461,7 +12627,7 @@ init_recordVersions();
12461
12627
  init_writeOnTheWinningVersion();
12462
12628
  init_plainWords();
12463
12629
  init_PickOne();
12464
- var import_jsx_runtime17 = require("react/jsx-runtime");
12630
+ var import_jsx_runtime18 = require("react/jsx-runtime");
12465
12631
  function labelColumns(fields) {
12466
12632
  return [...fields].filter((f) => rowLabelRefusal(f) === void 0).sort(compareFieldOrder);
12467
12633
  }
@@ -12552,14 +12718,14 @@ function RowLabelPicker({
12552
12718
  onOpenChange(false);
12553
12719
  onSaved();
12554
12720
  };
12555
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system13.Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_design_system13.DialogContent, { className: "sm:max-w-lg", "data-records-row-label-picker": "", children: [
12556
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_design_system13.DialogHeader, { children: [
12557
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system13.DialogTitle, { children: "What names each record" }),
12558
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system13.DialogDescription, { children: "The name every link, peek, copy, reference and agent calls a record by." })
12721
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_design_system13.DialogContent, { className: "sm:max-w-lg", "data-records-row-label-picker": "", children: [
12722
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_design_system13.DialogHeader, { children: [
12723
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.DialogTitle, { children: "What names each record" }),
12724
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.DialogDescription, { children: "The name every link, peek, copy, reference and agent calls a record by." })
12559
12725
  ] }),
12560
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1", role: "group", "aria-label": "How records are named", children: [
12561
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system13.Button, { type: "button", size: "sm", variant: mode === "column" ? "secondary" : "ghost", "aria-pressed": mode === "column", onClick: () => setMode("column"), children: "One column" }),
12562
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12726
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", role: "group", "aria-label": "How records are named", children: [
12727
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.Button, { type: "button", size: "sm", variant: mode === "column" ? "secondary" : "ghost", "aria-pressed": mode === "column", onClick: () => setMode("column"), children: "One column" }),
12728
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12563
12729
  import_design_system13.Button,
12564
12730
  {
12565
12731
  type: "button",
@@ -12572,9 +12738,9 @@ function RowLabelPicker({
12572
12738
  }
12573
12739
  )
12574
12740
  ] }),
12575
- mode === "column" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "flex flex-col gap-1 text-xs", children: [
12741
+ mode === "column" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "flex flex-col gap-1 text-xs", children: [
12576
12742
  "Column",
12577
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12743
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12578
12744
  PickOne,
12579
12745
  {
12580
12746
  label: "Column",
@@ -12585,9 +12751,9 @@ function RowLabelPicker({
12585
12751
  options: columns.map((f) => ({ value: f.key, label: `${fieldName(f)}${f.key === current && !keptFormula ? " (now)" : ""}` }))
12586
12752
  }
12587
12753
  ),
12588
- keptFormula ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Replaces the formula that names records now" }) : null
12589
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-1 text-xs", "data-records-row-label-formula": "", children: [
12590
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12754
+ keptFormula ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Replaces the formula that names records now" }) : null
12755
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1 text-xs", "data-records-row-label-formula": "", children: [
12756
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12591
12757
  FormulaTextEditor,
12592
12758
  {
12593
12759
  tableId,
@@ -12601,22 +12767,22 @@ function RowLabelPicker({
12601
12767
  kept2 && kept2.formula && !kept2.valid ? (
12602
12768
  // HONEST ABOUT A STALE FORMULA: a column it read was renamed or retired, so records are
12603
12769
  // named by the column until it is fixed.
12604
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { "data-records-row-label-stale": "", role: "status", className: "text-[11px] text-foreground", children: [
12770
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { "data-records-row-label-stale": "", role: "status", className: "text-[11px] text-foreground", children: [
12605
12771
  kept2.error ?? "This formula no longer reads.",
12606
12772
  " Records are named by their column until it is fixed."
12607
12773
  ] })
12608
12774
  ) : null,
12609
- formulaTooLong ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "text-[11px] text-foreground", children: [
12775
+ formulaTooLong ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { className: "text-[11px] text-foreground", children: [
12610
12776
  "Up to ",
12611
12777
  import_records7.ROW_LABEL_FORMULA_MAX_LENGTH,
12612
12778
  " characters"
12613
12779
  ] }) : null
12614
12780
  ] }),
12615
- kept2 && !mayChange ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { "data-records-row-label-not-yours": "", className: "text-xs text-muted-foreground", children: ROW_LABEL_NOT_YOURS }) : null,
12616
- refused ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { "data-records-row-label-refused": "", className: "text-xs text-destructive", children: refused }) : null,
12617
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_design_system13.DialogFooter, { children: [
12618
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_design_system13.Button, { type: "button", size: "sm", variant: "ghost", onClick: () => onOpenChange(false), children: "Cancel" }),
12619
- mode === "column" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12781
+ kept2 && !mayChange ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { "data-records-row-label-not-yours": "", className: "text-xs text-muted-foreground", children: ROW_LABEL_NOT_YOURS }) : null,
12782
+ refused ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { "data-records-row-label-refused": "", className: "text-xs text-destructive", children: refused }) : null,
12783
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_design_system13.DialogFooter, { children: [
12784
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system13.Button, { type: "button", size: "sm", variant: "ghost", onClick: () => onOpenChange(false), children: "Cancel" }),
12785
+ mode === "column" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12620
12786
  import_design_system13.Button,
12621
12787
  {
12622
12788
  type: "button",
@@ -12626,7 +12792,7 @@ function RowLabelPicker({
12626
12792
  onClick: () => void saveColumn(),
12627
12793
  children: busy ? "Saving\u2026" : "Use this column"
12628
12794
  }
12629
- ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12795
+ ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12630
12796
  import_design_system13.Button,
12631
12797
  {
12632
12798
  type: "button",
@@ -12647,7 +12813,7 @@ init_PickOne();
12647
12813
  init_plainWords();
12648
12814
  init_recordVersions();
12649
12815
  init_writeOnTheWinningVersion();
12650
- var import_jsx_runtime18 = require("react/jsx-runtime");
12816
+ var import_jsx_runtime19 = require("react/jsx-runtime");
12651
12817
  function rowLabelChoices(fields) {
12652
12818
  return fields.filter((f) => rowLabelRefusal(f) === void 0).map((f) => ({ value: f.key, label: fieldName(f) }));
12653
12819
  }
@@ -12729,14 +12895,14 @@ function RowLabelSetting({
12729
12895
  (0, import_react28.tableShapeChanged)(tableId);
12730
12896
  onSaved?.();
12731
12897
  };
12732
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1", "data-table-row-label-setting": "", children: [
12733
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-muted-foreground", children: "Row label" }),
12734
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", role: "group", "aria-label": "How records are named", children: [
12735
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system14.Button, { type: "button", size: "sm", variant: mode === "column" ? "secondary" : "ghost", "aria-pressed": mode === "column", onClick: () => setMode("column"), children: "One column" }),
12736
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system14.Button, { type: "button", size: "sm", variant: mode === "formula" ? "secondary" : "ghost", "aria-pressed": mode === "formula", "data-table-row-label-joined": "", onClick: () => setMode("formula"), children: "A formula" })
12898
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1", "data-table-row-label-setting": "", children: [
12899
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-muted-foreground", children: "Row label" }),
12900
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", role: "group", "aria-label": "How records are named", children: [
12901
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_design_system14.Button, { type: "button", size: "sm", variant: mode === "column" ? "secondary" : "ghost", "aria-pressed": mode === "column", onClick: () => setMode("column"), children: "One column" }),
12902
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_design_system14.Button, { type: "button", size: "sm", variant: mode === "formula" ? "secondary" : "ghost", "aria-pressed": mode === "formula", "data-table-row-label-joined": "", onClick: () => setMode("formula"), children: "A formula" })
12737
12903
  ] }),
12738
- mode === "column" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
12739
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12904
+ mode === "column" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
12905
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
12740
12906
  PickOne,
12741
12907
  {
12742
12908
  value: keptFormula ? "" : table.title_field ?? "",
@@ -12757,19 +12923,19 @@ function RowLabelSetting({
12757
12923
  attrs: { "data-table-row-label": "" }
12758
12924
  }
12759
12925
  ),
12760
- keptFormula ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Choosing a column replaces the formula that names records now." }) : null
12761
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1", "data-table-row-label-formula": "", children: [
12762
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormulaTextEditor, { tableId, text: formula, onText: setFormula, onChecked: setFormulaOk, columns: fields, purpose: ROW_LABEL_FORMULA_PURPOSE }),
12763
- kept2 && kept2.formula && !kept2.valid ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { "data-table-row-label-stale": "", role: "status", className: "text-[11px] text-foreground", children: [
12926
+ keptFormula ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Choosing a column replaces the formula that names records now." }) : null
12927
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1", "data-table-row-label-formula": "", children: [
12928
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(FormulaTextEditor, { tableId, text: formula, onText: setFormula, onChecked: setFormulaOk, columns: fields, purpose: ROW_LABEL_FORMULA_PURPOSE }),
12929
+ kept2 && kept2.formula && !kept2.valid ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("p", { "data-table-row-label-stale": "", role: "status", className: "text-[11px] text-foreground", children: [
12764
12930
  kept2.error ?? "This formula no longer reads.",
12765
12931
  " Records are named by their column until it is fixed."
12766
12932
  ] }) : null,
12767
- tooLong ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { className: "text-[11px] text-foreground", children: [
12933
+ tooLong ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("p", { className: "text-[11px] text-foreground", children: [
12768
12934
  "Up to ",
12769
12935
  import_records8.ROW_LABEL_FORMULA_MAX_LENGTH,
12770
12936
  " characters"
12771
12937
  ] }) : null,
12772
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12938
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
12773
12939
  import_design_system14.Button,
12774
12940
  {
12775
12941
  type: "button",
@@ -12781,8 +12947,8 @@ function RowLabelSetting({
12781
12947
  }
12782
12948
  ) })
12783
12949
  ] }),
12784
- kept2 && !mayChange ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { "data-table-row-label-not-yours": "", className: "text-muted-foreground", children: ROW_LABEL_NOT_YOURS }) : null,
12785
- refused ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-destructive", children: refused }) : null
12950
+ kept2 && !mayChange ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { "data-table-row-label-not-yours": "", className: "text-muted-foreground", children: ROW_LABEL_NOT_YOURS }) : null,
12951
+ refused ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-destructive", children: refused }) : null
12786
12952
  ] });
12787
12953
  }
12788
12954
  function TableDetails({
@@ -12821,11 +12987,11 @@ function TableDetails({
12821
12987
  (0, import_react28.tableShapeChanged)(tableId);
12822
12988
  onSaved?.();
12823
12989
  };
12824
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-2", "data-table-details": "", children: [
12825
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-medium", children: "About this table" }),
12826
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-1", children: [
12827
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("label", { className: "text-muted-foreground", htmlFor: `table-description-${tableId}`, children: "Description" }),
12828
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12990
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-2", "data-table-details": "", children: [
12991
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-medium", children: "About this table" }),
12992
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1", children: [
12993
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { className: "text-muted-foreground", htmlFor: `table-description-${tableId}`, children: "Description" }),
12994
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
12829
12995
  import_design_system14.Textarea,
12830
12996
  {
12831
12997
  id: `table-description-${tableId}`,
@@ -12835,8 +13001,8 @@ function TableDetails({
12835
13001
  "data-table-description": ""
12836
13002
  }
12837
13003
  ),
12838
- text.trim() !== kept2.trim() ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex gap-2", children: [
12839
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13004
+ text.trim() !== kept2.trim() ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex gap-2", children: [
13005
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
12840
13006
  import_design_system14.Button,
12841
13007
  {
12842
13008
  size: "sm",
@@ -12846,10 +13012,10 @@ function TableDetails({
12846
13012
  children: "Save"
12847
13013
  }
12848
13014
  ),
12849
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_design_system14.Button, { size: "sm", variant: "ghost", disabled: busy, onClick: () => setText(kept2), children: "Cancel" })
13015
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_design_system14.Button, { size: "sm", variant: "ghost", disabled: busy, onClick: () => setText(kept2), children: "Cancel" })
12850
13016
  ] }) : null
12851
13017
  ] }),
12852
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13018
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
12853
13019
  RowLabelSetting,
12854
13020
  {
12855
13021
  tableId,
@@ -12861,9 +13027,9 @@ function TableDetails({
12861
13027
  onSaved
12862
13028
  }
12863
13029
  ),
12864
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between gap-2", "data-table-lock": "", children: [
12865
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-muted-foreground", children: "Lock database" }),
12866
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13030
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between gap-2", "data-table-lock": "", children: [
13031
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-muted-foreground", children: "Lock database" }),
13032
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
12867
13033
  import_design_system14.Button,
12868
13034
  {
12869
13035
  size: "sm",
@@ -12875,7 +13041,7 @@ function TableDetails({
12875
13041
  }
12876
13042
  )
12877
13043
  ] }),
12878
- refused ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-destructive", children: refused }) : null
13044
+ refused ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-destructive", children: refused }) : null
12879
13045
  ] });
12880
13046
  }
12881
13047
  async function saveTableDescription(client, tableId, text) {
@@ -12903,13 +13069,13 @@ init_names();
12903
13069
  // src/ReferenceBuilder.tsx
12904
13070
  var import_react32 = require("react");
12905
13071
  var import_react33 = require("@ai-matrx/records/react");
12906
- var import_core3 = require("@ai-matrx/records/core");
13072
+ var import_core4 = require("@ai-matrx/records/core");
12907
13073
  init_createTable();
12908
13074
  init_Refusal();
12909
13075
  init_tablePicking();
12910
13076
  var import_design_system17 = require("@ai-matrx/design-system");
12911
13077
  init_names();
12912
- var import_jsx_runtime21 = require("react/jsx-runtime");
13078
+ var import_jsx_runtime22 = require("react/jsx-runtime");
12913
13079
  var DEFAULT_SEPARATOR = " ";
12914
13080
  var NEW_TABLE = "__records_ui_new_table__";
12915
13081
  var LINK_TARGET_FIELDS = [
@@ -13006,7 +13172,7 @@ function ReferenceBuilder({
13006
13172
  id = existing.id;
13007
13173
  bornName = tableName(existing);
13008
13174
  } else {
13009
- const made = await (0, import_core3.ensureTable)(client, {
13175
+ const made = await (0, import_core4.ensureTable)(client, {
13010
13176
  name,
13011
13177
  slug,
13012
13178
  titleField: "name",
@@ -13025,8 +13191,8 @@ function ReferenceBuilder({
13025
13191
  tables.reload();
13026
13192
  onChange({ targetTableId: id, display: null });
13027
13193
  };
13028
- const mayMakeTable = (0, import_core3.doorReady)(client.config, import_core3.DOORS.tableFind) && (0, import_core3.doorReady)(client.config, import_core3.DOORS.tableEnsure);
13029
- const newTableButton = !mayMakeTable ? null : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13194
+ const mayMakeTable = (0, import_core4.doorReady)(client.config, import_core4.DOORS.tableFind) && (0, import_core4.doorReady)(client.config, import_core4.DOORS.tableEnsure);
13195
+ const newTableButton = !mayMakeTable ? null : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13030
13196
  import_design_system17.Button,
13031
13197
  {
13032
13198
  type: "button",
@@ -13056,15 +13222,15 @@ function ReferenceBuilder({
13056
13222
  next.splice(to, 0, next.splice(at, 1)[0]);
13057
13223
  setDisplay({ columns: next, separator });
13058
13224
  };
13059
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: (0, import_design_system17.cn)("flex max-w-[26rem] flex-col gap-3", className), children: [
13060
- !lockTarget && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1", children: [
13061
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
13062
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_design_system17.Label, { className: "text-xs", children: "The table it points at" }),
13063
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ShowListsToggle, { count: picking.listCount, on: showLists, onChange: setShowLists })
13225
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: (0, import_design_system17.cn)("flex max-w-[26rem] flex-col gap-3", className), children: [
13226
+ !lockTarget && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-1", children: [
13227
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
13228
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system17.Label, { className: "text-xs", children: "The table it points at" }),
13229
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ShowListsToggle, { count: picking.listCount, on: showLists, onChange: setShowLists })
13064
13230
  ] }),
13065
- naming !== null ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1", "data-new-link-table": "", children: [
13066
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
13067
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13231
+ naming !== null ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-1", "data-new-link-table": "", children: [
13232
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1", children: [
13233
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13068
13234
  import_design_system17.BasicInput,
13069
13235
  {
13070
13236
  autoFocus: true,
@@ -13087,7 +13253,7 @@ function ReferenceBuilder({
13087
13253
  className: "h-7 text-xs"
13088
13254
  }
13089
13255
  ),
13090
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13256
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13091
13257
  import_design_system17.Button,
13092
13258
  {
13093
13259
  type: "button",
@@ -13097,7 +13263,7 @@ function ReferenceBuilder({
13097
13263
  children: making ? "Creating\u2026" : "Create"
13098
13264
  }
13099
13265
  ),
13100
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13266
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13101
13267
  import_design_system17.Button,
13102
13268
  {
13103
13269
  type: "button",
@@ -13112,11 +13278,11 @@ function ReferenceBuilder({
13112
13278
  }
13113
13279
  )
13114
13280
  ] }),
13115
- refused ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(RefusalNotice, { error: refused }) : null
13116
- ] }) : tables.loading && offered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Reading your tables\u2026" }) : offered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
13117
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No tables yet." }),
13281
+ refused ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(RefusalNotice, { error: refused }) : null
13282
+ ] }) : tables.loading && offered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Reading your tables\u2026" }) : offered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
13283
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No tables yet." }),
13118
13284
  newTableButton
13119
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
13285
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
13120
13286
  import_design_system17.Select,
13121
13287
  {
13122
13288
  value: value.targetTableId,
@@ -13129,25 +13295,25 @@ function ReferenceBuilder({
13129
13295
  onChange({ targetTableId: next, display: null });
13130
13296
  },
13131
13297
  children: [
13132
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_design_system17.SelectTrigger, { size: "sm", "aria-label": "The table this column points at", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_design_system17.SelectValue, { placeholder: "Choose a table" }) }),
13133
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_design_system17.SelectContent, { children: [
13134
- offered.map((t) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_design_system17.SelectItem, { value: t.id, children: [
13298
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system17.SelectTrigger, { size: "sm", "aria-label": "The table this column points at", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system17.SelectValue, { placeholder: "Choose a table" }) }),
13299
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_design_system17.SelectContent, { children: [
13300
+ offered.map((t) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_design_system17.SelectItem, { value: t.id, children: [
13135
13301
  t.label,
13136
13302
  t.id === tableId ? " \u2014 this table" : ""
13137
13303
  ] }, t.id)),
13138
- mayMakeTable ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_design_system17.SelectItem, { value: NEW_TABLE, children: "New table\u2026" }) : null
13304
+ mayMakeTable ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system17.SelectItem, { value: NEW_TABLE, children: "New table\u2026" }) : null
13139
13305
  ] })
13140
13306
  ]
13141
13307
  }
13142
13308
  )
13143
13309
  ] }),
13144
- target && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1", children: [
13145
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
13146
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_design_system17.Label, { className: "text-xs", children: "Shown as" }),
13147
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[11px] text-muted-foreground", children: titleField ? `${titleField} \u2014 what ${targetTable ? tableName(targetTable) : "that table"} is titled by` : "whatever each record is named by" })
13310
+ target && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-1", children: [
13311
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
13312
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system17.Label, { className: "text-xs", children: "Shown as" }),
13313
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-[11px] text-muted-foreground", children: titleField ? `${titleField} \u2014 what ${targetTable ? tableName(targetTable) : "that table"} is titled by` : "whatever each record is named by" })
13148
13314
  ] }),
13149
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-[11px] text-muted-foreground", children: [
13150
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13315
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-[11px] text-muted-foreground", children: [
13316
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13151
13317
  import_design_system17.Checkbox,
13152
13318
  {
13153
13319
  checked: overriding,
@@ -13162,10 +13328,10 @@ function ReferenceBuilder({
13162
13328
  "Show different columns, or more than one"
13163
13329
  ] })
13164
13330
  ] }),
13165
- target && overriding && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-col gap-2 rounded-md border border-border p-2", children: columns.loading ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Reading that table's columns\u2026" }) : columns.keys.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "That table has no columns to show yet. Give it one, then come back \u2014 until then this column shows whatever each record is named by." }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
13166
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-1", children: columns.keys.map((key) => {
13331
+ target && overriding && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex flex-col gap-2 rounded-md border border-border p-2", children: columns.loading ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Reading that table's columns\u2026" }) : columns.keys.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "That table has no columns to show yet. Give it one, then come back \u2014 until then this column shows whatever each record is named by." }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
13332
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex flex-wrap gap-1", children: columns.keys.map((key) => {
13167
13333
  const on = chosen.includes(key);
13168
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
13334
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
13169
13335
  import_design_system17.Button,
13170
13336
  {
13171
13337
  type: "button",
@@ -13181,11 +13347,11 @@ function ReferenceBuilder({
13181
13347
  key
13182
13348
  );
13183
13349
  }) }),
13184
- chosen.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
13185
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Order" }),
13186
- chosen.map((key, at) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "flex items-center gap-0.5", children: [
13187
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[11px]", children: key }),
13188
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13350
+ chosen.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
13351
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "Order" }),
13352
+ chosen.map((key, at) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "flex items-center gap-0.5", children: [
13353
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-[11px]", children: key }),
13354
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13189
13355
  import_design_system17.Button,
13190
13356
  {
13191
13357
  type: "button",
@@ -13197,7 +13363,7 @@ function ReferenceBuilder({
13197
13363
  children: "\u2190"
13198
13364
  }
13199
13365
  ),
13200
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13366
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13201
13367
  import_design_system17.Button,
13202
13368
  {
13203
13369
  type: "button",
@@ -13211,9 +13377,9 @@ function ReferenceBuilder({
13211
13377
  )
13212
13378
  ] }, key))
13213
13379
  ] }),
13214
- chosen.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
13215
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_design_system17.Label, { className: "text-xs whitespace-nowrap", children: "Joined by" }),
13216
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13380
+ chosen.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
13381
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system17.Label, { className: "text-xs whitespace-nowrap", children: "Joined by" }),
13382
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13217
13383
  import_design_system17.BasicInput,
13218
13384
  {
13219
13385
  value: separator,
@@ -13222,12 +13388,12 @@ function ReferenceBuilder({
13222
13388
  className: "h-7 w-28 text-xs"
13223
13389
  }
13224
13390
  ),
13225
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "a space by default" })
13391
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "a space by default" })
13226
13392
  ] })
13227
13393
  ] }) }),
13228
- target && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-0.5", children: [
13229
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_design_system17.Label, { className: "text-xs", children: "It will read" }),
13230
- preview.loading ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Reading a few of its records\u2026" }) : (preview.data?.rows?.length ?? 0) === 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "That table has no records yet, so there is nothing to show here \u2014 this column will still work, and the first record added is the first thing it offers." }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("ul", { className: "flex flex-col gap-0.5", children: (preview.data?.rows ?? []).map((row) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("li", { className: "truncate text-[11px] text-foreground", children: previewWords(
13394
+ target && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-0.5", children: [
13395
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system17.Label, { className: "text-xs", children: "It will read" }),
13396
+ preview.loading ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Reading a few of its records\u2026" }) : (preview.data?.rows?.length ?? 0) === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "That table has no records yet, so there is nothing to show here \u2014 this column will still work, and the first record added is the first thing it offers." }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ul", { className: "flex flex-col gap-0.5", children: (preview.data?.rows ?? []).map((row) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("li", { className: "truncate text-[11px] text-foreground", children: previewWords(
13231
13397
  row.document,
13232
13398
  display,
13233
13399
  titleField
@@ -13239,7 +13405,7 @@ function ReferenceBuilder({
13239
13405
  // src/gridEditing.tsx
13240
13406
  var import_react100 = require("react");
13241
13407
  var import_records37 = require("@ai-matrx/records");
13242
- var import_core11 = require("@ai-matrx/records/core");
13408
+ var import_core12 = require("@ai-matrx/records/core");
13243
13409
  var import_react101 = require("@ai-matrx/records/react");
13244
13410
  var import_design_system59 = require("@ai-matrx/design-system");
13245
13411
 
@@ -13256,7 +13422,7 @@ var import_design_system18 = require("@ai-matrx/design-system");
13256
13422
  var import_data_table2 = require("@ai-matrx/design-system/data-table");
13257
13423
  init_choiceLooks();
13258
13424
  init_plainWords();
13259
- var import_jsx_runtime22 = require("react/jsx-runtime");
13425
+ var import_jsx_runtime23 = require("react/jsx-runtime");
13260
13426
  var rowSeed = 0;
13261
13427
  var nextRow = () => `new-${rowSeed += 1}`;
13262
13428
  function choiceRowsFrom(options, field2) {
@@ -13337,12 +13503,12 @@ function ChoiceListEditor({
13337
13503
  };
13338
13504
  }, [client, fieldId, onRehome]);
13339
13505
  if (refused) {
13340
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { className: "text-[11px] text-muted-foreground", "data-records-choice-list": "", children: [
13506
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("p", { className: "text-[11px] text-muted-foreground", "data-records-choice-list": "", children: [
13341
13507
  "The choices could not be read, so they are left as they are: ",
13342
13508
  refused
13343
13509
  ] });
13344
13510
  }
13345
- if (rows === null) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Reading this column\u2019s choices\u2026" });
13511
+ if (rows === null) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Reading this column\u2019s choices\u2026" });
13346
13512
  const set = (index, words2) => onRows(rows.map((r, i) => i === index ? { ...r, words: words2 } : r));
13347
13513
  const paint = (index, color) => onRows(rows.map((r, i) => i === index ? { ...r, color } : r));
13348
13514
  const addRow = () => {
@@ -13400,12 +13566,12 @@ function ChoiceListEditor({
13400
13566
  };
13401
13567
  const targets = rows.filter((r) => r.id && r.id !== asking?.id && r.words.trim() !== "");
13402
13568
  const wordsOf = (id) => rows.find((r) => r.id === id)?.words.trim() ?? usage?.[id]?.words ?? "";
13403
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-1", "data-records-choice-list": "", children: [
13404
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.Label, { className: "text-xs", children: "The choices" }),
13405
- rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-xs text-muted-foreground", "data-records-choice-list-empty": "", children: "No choices yet." }) : null,
13406
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ul", { className: "flex flex-col gap-1", children: rows.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("li", { className: "flex items-center gap-1", "data-records-choice-row": "", children: [
13407
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ChoiceSwatch, { words: r.words.trim() === "" ? `choice ${i + 1}` : r.words.trim(), color: r.color ?? null, onColor: (c) => paint(i, c) }),
13408
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13569
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-1", "data-records-choice-list": "", children: [
13570
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system18.Label, { className: "text-xs", children: "The choices" }),
13571
+ rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs text-muted-foreground", "data-records-choice-list-empty": "", children: "No choices yet." }) : null,
13572
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("ul", { className: "flex flex-col gap-1", children: rows.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("li", { className: "flex items-center gap-1", "data-records-choice-row": "", children: [
13573
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ChoiceSwatch, { words: r.words.trim() === "" ? `choice ${i + 1}` : r.words.trim(), color: r.color ?? null, onColor: (c) => paint(i, c) }),
13574
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
13409
13575
  import_design_system18.BasicInput,
13410
13576
  {
13411
13577
  value: r.words,
@@ -13421,13 +13587,13 @@ function ChoiceListEditor({
13421
13587
  onKeyDown: enterAdds(i)
13422
13588
  }
13423
13589
  ),
13424
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.Button, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Move ${named(r, i)} up`, disabled: i === 0, onClick: () => move(i, -1), children: "\u2191" }),
13425
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.Button, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Move ${named(r, i)} down`, disabled: i === rows.length - 1, onClick: () => move(i, 1), children: "\u2193" }),
13426
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.Button, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Remove ${named(r, i)}`, onClick: () => remove(i), children: "\xD7" })
13590
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system18.Button, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Move ${named(r, i)} up`, disabled: i === 0, onClick: () => move(i, -1), children: "\u2191" }),
13591
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system18.Button, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Move ${named(r, i)} down`, disabled: i === rows.length - 1, onClick: () => move(i, 1), children: "\u2193" }),
13592
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system18.Button, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Remove ${named(r, i)}`, onClick: () => remove(i), children: "\xD7" })
13427
13593
  ] }, r.row)) }),
13428
13594
  asking ? (
13429
13595
  // THE QUESTION, Notion-style: where do the records that hold it go?
13430
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
13596
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
13431
13597
  "div",
13432
13598
  {
13433
13599
  role: "group",
@@ -13435,31 +13601,31 @@ function ChoiceListEditor({
13435
13601
  "data-records-choice-removal-ask": "",
13436
13602
  className: "flex flex-col gap-1 rounded border bg-muted/40 p-2",
13437
13603
  children: [
13438
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-xs", children: (0, import_records10.recordsUseSentence)(heldBy(asking), asking.words.trim()) }),
13439
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
13440
- targets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
13441
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.Button, { type: "button", size: "sm", className: "h-7 px-2 text-xs", disabled: moveTo === "", onClick: () => answer({ then: "move", to: moveTo }), children: "Move them to" }),
13442
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_design_system18.Select, { value: moveTo, onValueChange: setMoveTo, children: [
13443
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.SelectTrigger, { size: "sm", className: "h-7 w-36 text-xs", "aria-label": "Another choice", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.SelectValue, { placeholder: "Another choice" }) }),
13444
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.SelectContent, { children: targets.map((r) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.SelectItem, { value: r.id, children: r.words.trim() }, r.id)) })
13604
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs", children: (0, import_records10.recordsUseSentence)(heldBy(asking), asking.words.trim()) }),
13605
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
13606
+ targets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
13607
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system18.Button, { type: "button", size: "sm", className: "h-7 px-2 text-xs", disabled: moveTo === "", onClick: () => answer({ then: "move", to: moveTo }), children: "Move them to" }),
13608
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_design_system18.Select, { value: moveTo, onValueChange: setMoveTo, children: [
13609
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system18.SelectTrigger, { size: "sm", className: "h-7 w-36 text-xs", "aria-label": "Another choice", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system18.SelectValue, { placeholder: "Another choice" }) }),
13610
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system18.SelectContent, { children: targets.map((r) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system18.SelectItem, { value: r.id, children: r.words.trim() }, r.id)) })
13445
13611
  ] })
13446
13612
  ] }) : null,
13447
- allowOther ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.Button, { type: "button", size: "sm", variant: "outline", className: "h-7 px-2 text-xs", onClick: () => answer({ then: "keep" }), children: "Keep the words as other values" }) : null,
13448
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.Button, { type: "button", size: "sm", variant: "outline", className: "h-7 px-2 text-xs", onClick: () => answer({ then: "clear" }), children: "Clear them" }),
13449
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.Button, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-2 text-xs", onClick: () => setAsking(null), children: "Cancel" })
13613
+ allowOther ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system18.Button, { type: "button", size: "sm", variant: "outline", className: "h-7 px-2 text-xs", onClick: () => answer({ then: "keep" }), children: "Keep the words as other values" }) : null,
13614
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system18.Button, { type: "button", size: "sm", variant: "outline", className: "h-7 px-2 text-xs", onClick: () => answer({ then: "clear" }), children: "Clear them" }),
13615
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system18.Button, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-2 text-xs", onClick: () => setAsking(null), children: "Cancel" })
13450
13616
  ] })
13451
13617
  ]
13452
13618
  }
13453
13619
  )
13454
13620
  ) : null,
13455
13621
  Object.entries(rehome).map(
13456
- ([id, spec]) => removed[id] ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between gap-2 text-[11px] text-muted-foreground", "data-records-choice-rehome": "", children: [
13457
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: (0, import_records10.rehomeSentence)(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
13458
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 text-[11px]", onClick: () => putBack(id), children: "Put it back" })
13622
+ ([id, spec]) => removed[id] ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between gap-2 text-[11px] text-muted-foreground", "data-records-choice-rehome": "", children: [
13623
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: (0, import_records10.rehomeSentence)(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
13624
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system18.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 text-[11px]", onClick: () => putBack(id), children: "Put it back" })
13459
13625
  ] }, id) : null
13460
13626
  ),
13461
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.Button, { type: "button", size: "sm", variant: "outline", className: "h-7 self-start text-xs", onClick: addRow, children: "Add a choice" }),
13462
- isNew ? null : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Changing a choice\u2019s words changes them in every record that holds it. Removing a choice that records hold asks where those records go." })
13627
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system18.Button, { type: "button", size: "sm", variant: "outline", className: "h-7 self-start text-xs", onClick: addRow, children: "Add a choice" }),
13628
+ isNew ? null : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Changing a choice\u2019s words changes them in every record that holds it. Removing a choice that records hold asks where those records go." })
13463
13629
  ] });
13464
13630
  }
13465
13631
  function ChoiceSwatch({ words: words2, color, onColor }) {
@@ -13468,8 +13634,8 @@ function ChoiceSwatch({ words: words2, color, onColor }) {
13468
13634
  onColor(next);
13469
13635
  setOpen(false);
13470
13636
  };
13471
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_design_system18.Popover, { open, onOpenChange: setOpen, children: [
13472
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13637
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_design_system18.Popover, { open, onOpenChange: setOpen, children: [
13638
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system18.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
13473
13639
  "button",
13474
13640
  {
13475
13641
  type: "button",
@@ -13482,8 +13648,8 @@ function ChoiceSwatch({ words: words2, color, onColor }) {
13482
13648
  )
13483
13649
  }
13484
13650
  ) }),
13485
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_design_system18.PopoverContent, { sizing: "content", align: "start", className: "p-2", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1", role: "radiogroup", "aria-label": `Color for ${words2}`, children: [
13486
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13651
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system18.PopoverContent, { sizing: "content", align: "start", className: "p-2", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-1", role: "radiogroup", "aria-label": `Color for ${words2}`, children: [
13652
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
13487
13653
  "button",
13488
13654
  {
13489
13655
  type: "button",
@@ -13495,7 +13661,7 @@ function ChoiceSwatch({ words: words2, color, onColor }) {
13495
13661
  className: (0, import_design_system18.cn)("h-5 w-5 rounded-full border border-border bg-background", color === null && "ring-2 ring-ring ring-offset-1")
13496
13662
  }
13497
13663
  ),
13498
- import_data_table2.STYLE_COLORS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13664
+ import_data_table2.STYLE_COLORS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
13499
13665
  "button",
13500
13666
  {
13501
13667
  type: "button",
@@ -13515,7 +13681,7 @@ function ChoiceSwatch({ words: words2, color, onColor }) {
13515
13681
 
13516
13682
  // src/AddChoicesInline.tsx
13517
13683
  init_Refusal();
13518
- var import_jsx_runtime23 = require("react/jsx-runtime");
13684
+ var import_jsx_runtime24 = require("react/jsx-runtime");
13519
13685
  function AddChoicesInline({ field: field2, onAdded, disabled = false }) {
13520
13686
  const client = (0, import_react37.useOptionalRecordsClient)();
13521
13687
  const [open, setOpen] = (0, import_react36.useState)(false);
@@ -13538,13 +13704,13 @@ function AddChoicesInline({ field: field2, onAdded, disabled = false }) {
13538
13704
  setRows([newChoiceRow([])]);
13539
13705
  onAdded();
13540
13706
  };
13541
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_design_system19.Popover, { open, onOpenChange: setOpen, children: [
13542
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system19.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system19.Button, { type: "button", size: "sm", variant: "outline", className: "h-7 self-start text-xs", disabled, "data-records-add-choices": "", children: "Add choices" }) }),
13543
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_design_system19.PopoverContent, { className: "w-72 space-y-2 p-3", align: "start", children: [
13544
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ChoiceListEditor, { isNew: true, rows, onRows: setRows }),
13545
- missing ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-[11px] text-muted-foreground", children: missing }) : null,
13546
- refused ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(RefusalLine, { error: refused }) : null,
13547
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_design_system19.Button, { type: "button", size: "sm", className: "h-7 text-xs", disabled: saving || words2.length === 0 || missing !== null, onClick: () => void save(), children: "Save choices" })
13707
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_design_system19.Popover, { open, onOpenChange: setOpen, children: [
13708
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_design_system19.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_design_system19.Button, { type: "button", size: "sm", variant: "outline", className: "h-7 self-start text-xs", disabled, "data-records-add-choices": "", children: "Add choices" }) }),
13709
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_design_system19.PopoverContent, { className: "w-72 space-y-2 p-3", align: "start", children: [
13710
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChoiceListEditor, { isNew: true, rows, onRows: setRows }),
13711
+ missing ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-[11px] text-muted-foreground", children: missing }) : null,
13712
+ refused ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(RefusalLine, { error: refused }) : null,
13713
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_design_system19.Button, { type: "button", size: "sm", className: "h-7 text-xs", disabled: saving || words2.length === 0 || missing !== null, onClick: () => void save(), children: "Save choices" })
13548
13714
  ] })
13549
13715
  ] });
13550
13716
  }
@@ -13562,28 +13728,28 @@ var import_source = require("@ai-matrx/content-ir/source");
13562
13728
  var import_records11 = require("@ai-matrx/records");
13563
13729
  var import_design_system20 = require("@ai-matrx/design-system");
13564
13730
  var import_outbound_react = require("@ai-matrx/kit/outbound-react");
13565
- var import_jsx_runtime24 = require("react/jsx-runtime");
13731
+ var import_jsx_runtime25 = require("react/jsx-runtime");
13566
13732
  var own = (event) => event.stopPropagation();
13567
13733
  function newerKindValue(field2, value, opts = {}) {
13568
13734
  switch ((0, import_records11.newerKindOf)(field2)) {
13569
13735
  case "duration": {
13570
13736
  const words2 = (0, import_records11.durationText)(value);
13571
- return words2 === null ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "tabular-nums", "data-records-duration": "", children: words2 });
13737
+ return words2 === null ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "tabular-nums", "data-records-duration": "", children: words2 });
13572
13738
  }
13573
13739
  case "created_by":
13574
13740
  case "modified_by":
13575
- return (0, import_records11.isPersonStamp)(value) ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PersonStampChip, { stamp: value }) : void 0;
13741
+ return (0, import_records11.isPersonStamp)(value) ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PersonStampChip, { stamp: value }) : void 0;
13576
13742
  case "address":
13577
- return (0, import_records11.isAddressValue)(value) || typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AddressLink, { value }) : void 0;
13743
+ return (0, import_records11.isAddressValue)(value) || typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AddressLink, { value }) : void 0;
13578
13744
  case "barcode":
13579
- return typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs", "data-records-barcode": "", title: value, children: [
13580
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u25AE\u25AF\u25AE" }),
13581
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate", children: value })
13745
+ return typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs", "data-records-barcode": "", title: value, children: [
13746
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u25AE\u25AF\u25AE" }),
13747
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate", children: value })
13582
13748
  ] }) : void 0;
13583
13749
  case "rich_text":
13584
- return typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SafeMarkdown, { text: value, clipped: opts.inCell === true }) : void 0;
13750
+ return typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SafeMarkdown, { text: value, clipped: opts.inCell === true }) : void 0;
13585
13751
  case "count":
13586
- return typeof value === "number" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "tabular-nums", children: value.toLocaleString() }) : void 0;
13752
+ return typeof value === "number" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "tabular-nums", children: value.toLocaleString() }) : void 0;
13587
13753
  default:
13588
13754
  return void 0;
13589
13755
  }
@@ -13593,8 +13759,8 @@ function PersonStampChip({ stamp }) {
13593
13759
  const tier = stamp.actor ?? "user";
13594
13760
  const name = tier === "user" ? stamp.name : null;
13595
13761
  const initial = tier === "system" ? "\u2699" : tier === "agent" ? "\u2726" : name && name.trim() !== "" ? name.trim()[0].toUpperCase() : "?";
13596
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-1.5", "data-records-person-stamp": tier, children: [
13597
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13762
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-1.5", "data-records-person-stamp": tier, children: [
13763
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13598
13764
  "span",
13599
13765
  {
13600
13766
  "aria-hidden": "true",
@@ -13602,14 +13768,14 @@ function PersonStampChip({ stamp }) {
13602
13768
  children: initial
13603
13769
  }
13604
13770
  ),
13605
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: (0, import_design_system20.cn)("truncate", tier === "user" && !name ? "italic text-muted-foreground" : ""), children: words2 })
13771
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: (0, import_design_system20.cn)("truncate", tier === "user" && !name ? "italic text-muted-foreground" : ""), children: words2 })
13606
13772
  ] });
13607
13773
  }
13608
13774
  function AddressLink({ value }) {
13609
13775
  const words2 = (0, import_records11.addressValueText)(value);
13610
13776
  const href = (0, import_records11.addressMapUrl)(value);
13611
- if (!words2 || !href) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
13612
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
13777
+ if (!words2 || !href) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
13778
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
13613
13779
  import_outbound_react.OutboundLink,
13614
13780
  {
13615
13781
  href,
@@ -13618,8 +13784,8 @@ function AddressLink({ value }) {
13618
13784
  "data-records-address": "",
13619
13785
  onClick: own,
13620
13786
  children: [
13621
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "aria-hidden": "true", children: "\u2316" }),
13622
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate", children: words2 })
13787
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { "aria-hidden": "true", children: "\u2316" }),
13788
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate", children: words2 })
13623
13789
  ]
13624
13790
  }
13625
13791
  );
@@ -13639,7 +13805,7 @@ function inline(text, key) {
13639
13805
  for (const r of (0, import_source.findInlineCodeSpans)(text)) {
13640
13806
  if (r.start < at) continue;
13641
13807
  if (r.start > at) out.push(...marks(text.slice(at, r.start), `${key}-m${n++}`));
13642
- out.push(/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("code", { className: "rounded bg-muted px-1 font-mono text-[0.9em]", children: (0, import_source.codeSpanText)(text.slice(r.start, r.end)) }, `${key}-c${n++}`));
13808
+ out.push(/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("code", { className: "rounded bg-muted px-1 font-mono text-[0.9em]", children: (0, import_source.codeSpanText)(text.slice(r.start, r.end)) }, `${key}-c${n++}`));
13643
13809
  at = r.end;
13644
13810
  }
13645
13811
  if (at < text.length) out.push(...marks(text.slice(at), `${key}-m${n++}`));
@@ -13655,14 +13821,14 @@ function marks(text, key) {
13655
13821
  if (at > last) out.push(text.slice(last, at));
13656
13822
  const tok = m[0];
13657
13823
  const k = `${key}-${i++}`;
13658
- if (tok.startsWith("**") || tok.startsWith("__")) out.push(/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("strong", { children: tok.slice(2, -2) }, k));
13824
+ if (tok.startsWith("**") || tok.startsWith("__")) out.push(/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("strong", { children: tok.slice(2, -2) }, k));
13659
13825
  else if (tok.startsWith("[")) {
13660
13826
  const link = /^\[([^\]]+)\]\(([^)\s]+)\)$/.exec(tok);
13661
13827
  const href = (0, import_records11.safeLinkHref)(link?.[2] ?? "");
13662
13828
  out.push(
13663
- href ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_outbound_react.OutboundLink, { href, className: "text-primary underline-offset-2 hover:underline", onClick: own, children: link?.[1] }, k) : link?.[1] ?? tok
13829
+ href ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_outbound_react.OutboundLink, { href, className: "text-primary underline-offset-2 hover:underline", onClick: own, children: link?.[1] }, k) : link?.[1] ?? tok
13664
13830
  );
13665
- } else out.push(/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("em", { children: tok.slice(1, -1) }, k));
13831
+ } else out.push(/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("em", { children: tok.slice(1, -1) }, k));
13666
13832
  last = at + tok.length;
13667
13833
  }
13668
13834
  if (last < text.length) out.push(text.slice(last));
@@ -13675,15 +13841,15 @@ function SafeMarkdown({ text, clipped }) {
13675
13841
  let para = [];
13676
13842
  const flushPara = () => {
13677
13843
  if (para.length > 0) {
13678
- blocks.push(/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { children: inline(para.join(" "), `p${blocks.length}`) }, `p${blocks.length}`));
13844
+ blocks.push(/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: inline(para.join(" "), `p${blocks.length}`) }, `p${blocks.length}`));
13679
13845
  para = [];
13680
13846
  }
13681
13847
  };
13682
13848
  const flushList = () => {
13683
13849
  if (list) {
13684
- const items = list.items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("li", { children: inline(item, `l${blocks.length}-${i}`) }, i));
13850
+ const items = list.items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("li", { children: inline(item, `l${blocks.length}-${i}`) }, i));
13685
13851
  blocks.push(
13686
- list.ordered ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ol", { className: "ml-4 list-decimal", children: items }, `o${blocks.length}`) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ul", { className: "ml-4 list-disc", children: items }, `u${blocks.length}`)
13852
+ list.ordered ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ol", { className: "ml-4 list-decimal", children: items }, `o${blocks.length}`) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ul", { className: "ml-4 list-disc", children: items }, `u${blocks.length}`)
13687
13853
  );
13688
13854
  list = null;
13689
13855
  }
@@ -13702,7 +13868,7 @@ function SafeMarkdown({ text, clipped }) {
13702
13868
  } else if (heading) {
13703
13869
  flushPara();
13704
13870
  flushList();
13705
- blocks.push(/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "font-semibold", children: inline(heading[2], `h${blocks.length}`) }, `h${blocks.length}`));
13871
+ blocks.push(/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "font-semibold", children: inline(heading[2], `h${blocks.length}`) }, `h${blocks.length}`));
13706
13872
  } else if (line.trim() === "") {
13707
13873
  flushPara();
13708
13874
  flushList();
@@ -13713,7 +13879,7 @@ function SafeMarkdown({ text, clipped }) {
13713
13879
  }
13714
13880
  flushPara();
13715
13881
  flushList();
13716
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13882
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13717
13883
  "span",
13718
13884
  {
13719
13885
  className: (0, import_design_system20.cn)("block min-w-0 space-y-1 whitespace-normal text-sm", clipped ? "max-h-[4.5em] overflow-hidden" : ""),
@@ -13725,15 +13891,15 @@ function SafeMarkdown({ text, clipped }) {
13725
13891
  function newerKindControl(props) {
13726
13892
  switch ((0, import_records11.newerKindOf)(props.field)) {
13727
13893
  case "duration":
13728
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DurationControl, { ...props });
13894
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DurationControl, { ...props });
13729
13895
  case "address":
13730
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AddressControl, { ...props });
13896
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AddressControl, { ...props });
13731
13897
  case "barcode":
13732
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(BarcodeControl, { ...props });
13898
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(BarcodeControl, { ...props });
13733
13899
  case "created_by":
13734
13900
  case "modified_by":
13735
13901
  case "count":
13736
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { id: props.id, className: "rounded border border-dashed px-2 py-1.5 text-xs text-muted-foreground", children: props.value === null || props.value === void 0 ? "\u2014" : newerKindValue(props.field, props.value) });
13902
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { id: props.id, className: "rounded border border-dashed px-2 py-1.5 text-xs text-muted-foreground", children: props.value === null || props.value === void 0 ? "\u2014" : newerKindValue(props.field, props.value) });
13737
13903
  default:
13738
13904
  return void 0;
13739
13905
  }
@@ -13744,8 +13910,8 @@ function DurationControl({ value, onChange, disabled, id }) {
13744
13910
  (0, import_react38.useEffect)(() => {
13745
13911
  setText((0, import_records11.durationText)(value) ?? "");
13746
13912
  }, [value]);
13747
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "flex flex-col gap-1", children: [
13748
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13913
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex flex-col gap-1", children: [
13914
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13749
13915
  import_design_system20.BasicInput,
13750
13916
  {
13751
13917
  id,
@@ -13771,7 +13937,7 @@ function DurationControl({ value, onChange, disabled, id }) {
13771
13937
  }
13772
13938
  }
13773
13939
  ),
13774
- wrong ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-[11px] text-destructive", children: "Write it like 45 min, 1:30 or 1h 30m." }) : null
13940
+ wrong ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-[11px] text-destructive", children: "Write it like 45 min, 1:30 or 1h 30m." }) : null
13775
13941
  ] });
13776
13942
  }
13777
13943
  var ADDRESS_LABELS = {
@@ -13795,7 +13961,7 @@ function AddressControl({ value, onChange, disabled, id }) {
13795
13961
  const kept2 = Object.fromEntries(Object.entries(next).filter(([, v]) => typeof v === "string" && v.trim() !== ""));
13796
13962
  onChange(Object.keys(kept2).length === 0 ? null : kept2);
13797
13963
  };
13798
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { id, className: "grid grid-cols-2 gap-1.5", "data-records-address-control": "", children: import_records11.ADDRESS_PARTS.map((part) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13964
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { id, className: "grid grid-cols-2 gap-1.5", "data-records-address-control": "", children: import_records11.ADDRESS_PARTS.map((part) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13799
13965
  import_design_system20.BasicInput,
13800
13966
  {
13801
13967
  "aria-label": ADDRESS_LABELS[part],
@@ -13817,9 +13983,9 @@ function BarcodeControl({ value, onChange, disabled, id }) {
13817
13983
  const file = (0, import_react38.useRef)(null);
13818
13984
  const [said2, setSaid] = (0, import_react38.useState)(null);
13819
13985
  const Detect = barcodeDetector();
13820
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "flex flex-col gap-1", children: [
13821
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "flex items-center gap-1.5", children: [
13822
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13986
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex flex-col gap-1", children: [
13987
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex items-center gap-1.5", children: [
13988
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13823
13989
  import_design_system20.BasicInput,
13824
13990
  {
13825
13991
  id,
@@ -13830,8 +13996,8 @@ function BarcodeControl({ value, onChange, disabled, id }) {
13830
13996
  onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
13831
13997
  }
13832
13998
  ),
13833
- Detect && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
13834
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
13999
+ Detect && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
14000
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13835
14001
  "button",
13836
14002
  {
13837
14003
  type: "button",
@@ -13840,7 +14006,7 @@ function BarcodeControl({ value, onChange, disabled, id }) {
13840
14006
  children: "Scan"
13841
14007
  }
13842
14008
  ),
13843
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
14009
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13844
14010
  "input",
13845
14011
  {
13846
14012
  ref: file,
@@ -13866,7 +14032,7 @@ function BarcodeControl({ value, onChange, disabled, id }) {
13866
14032
  )
13867
14033
  ] }) : null
13868
14034
  ] }),
13869
- said2 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-[11px] text-muted-foreground", children: said2 }) : null
14035
+ said2 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-[11px] text-muted-foreground", children: said2 }) : null
13870
14036
  ] });
13871
14037
  }
13872
14038
 
@@ -13921,7 +14087,7 @@ function tellApart(rows, nameOf3) {
13921
14087
  }
13922
14088
 
13923
14089
  // src/RelationPicker.tsx
13924
- var import_jsx_runtime25 = (
14090
+ var import_jsx_runtime26 = (
13925
14091
  // The Field's own name is already printed above this control by
13926
14092
  // `FieldLabel`, so the sentence does not say it a second time.
13927
14093
  require("react/jsx-runtime")
@@ -14012,10 +14178,10 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
14012
14178
  };
14013
14179
  }, [client, open, allowCreate, target, targetRefusal, field2.relation_target]);
14014
14180
  if (!client) {
14015
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { id, className: (0, import_design_system21.cn)("text-xs text-muted-foreground", className), children: NO_STORE_ON_THIS_SCREEN_REASON });
14181
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { id, className: (0, import_design_system21.cn)("text-xs text-muted-foreground", className), children: NO_STORE_ON_THIS_SCREEN_REASON });
14016
14182
  }
14017
14183
  if (!field2.relation_target) {
14018
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
14184
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
14019
14185
  fieldName(field2),
14020
14186
  " points at records, but it does not say which Table yet, so there is nothing to pick from. A table admin sets its target in the field editor."
14021
14187
  ] });
@@ -14075,7 +14241,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
14075
14241
  const apart = tellApart(rows ?? [], titleOf);
14076
14242
  const visible = (0, import_records12.rankTypedMatches)(rows ?? [], search, (row) => [titleOf(row.id), apart.get(row.id) ?? ""]);
14077
14243
  const anchored = autoOpen === true;
14078
- const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
14244
+ const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
14079
14245
  RecordChip,
14080
14246
  {
14081
14247
  title: titleOf(recordId),
@@ -14085,12 +14251,12 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
14085
14251
  ));
14086
14252
  return (
14087
14253
  // Never wider than where it is drawn (a grid cell beside a sticky column: B3-07) — chips truncate, the button wraps.
14088
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: (0, import_design_system21.cn)("flex min-w-0 max-w-full flex-wrap items-center gap-1", className), children: [
14254
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: (0, import_design_system21.cn)("flex min-w-0 max-w-full flex-wrap items-center gap-1", className), children: [
14089
14255
  anchored && !disabled ? null : cellChips,
14090
14256
  disabled ? null : (
14091
14257
  // THE ONE "PICK OR ADD" BUILDER (PickOrAdd.tsx) — the choice editor draws the same one.
14092
14258
  // In a grid cell it hangs from the cell's own chips; what is picked heads the list with its ×.
14093
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
14259
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
14094
14260
  PickOrAdd,
14095
14261
  {
14096
14262
  anchored,
@@ -14113,17 +14279,17 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
14113
14279
  attrs: { "data-relation-candidate": row.id }
14114
14280
  })),
14115
14281
  onPick: toggle,
14116
- notice: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
14117
- refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RefusalLine, { error: refusal3, className: "p-2" }) : null,
14118
- !rows && !refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading\u2026" }) : null,
14119
- full ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("p", { className: "p-2 text-xs text-muted-foreground", children: [
14282
+ notice: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
14283
+ refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RefusalLine, { error: refusal3, className: "p-2" }) : null,
14284
+ !rows && !refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading\u2026" }) : null,
14285
+ full ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { className: "p-2 text-xs text-muted-foreground", children: [
14120
14286
  fieldName(field2),
14121
14287
  " can point at ",
14122
14288
  field2.relation_max,
14123
14289
  " at most. Remove one to add another."
14124
14290
  ] }) : null
14125
14291
  ] }),
14126
- empty: rows ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Nothing in that table matches." }) : null,
14292
+ empty: rows ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Nothing in that table matches." }) : null,
14127
14293
  add: allowCreate && !full && !targetRefusal && target && !creating ? {
14128
14294
  label: search.trim() !== "" ? `Create \u201C${search.trim()}\u201D` : `New ${targetWord}`,
14129
14295
  disabled: busy,
@@ -14138,8 +14304,8 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
14138
14304
  }
14139
14305
  }
14140
14306
  } : null,
14141
- foot: !allowCreate || full ? void 0 : targetRefusal ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RefusalLine, { error: targetRefusal, className: "p-2" }) : !target ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading that table\u2026" }) : creating ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1 p-1", children: [
14142
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
14307
+ foot: !allowCreate || full ? void 0 : targetRefusal ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RefusalLine, { error: targetRefusal, className: "p-2" }) : !target ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading that table\u2026" }) : creating ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1 p-1", children: [
14308
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
14143
14309
  import_design_system21.BasicInput,
14144
14310
  {
14145
14311
  autoFocus: true,
@@ -14156,7 +14322,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
14156
14322
  "aria-label": `Name the new ${targetWord}`
14157
14323
  }
14158
14324
  ),
14159
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
14325
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
14160
14326
  import_design_system21.Button,
14161
14327
  {
14162
14328
  type: "button",
@@ -14171,7 +14337,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
14171
14337
  footNote: allowCreate && !full && createRefusal ? (
14172
14338
  // The typed title is still in the search box: the notice owns the
14173
14339
  // two doors out (lane REFUSAL-SWEEP).
14174
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
14340
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
14175
14341
  RefusalNotice,
14176
14342
  {
14177
14343
  error: createRefusal,
@@ -14212,7 +14378,7 @@ init_host();
14212
14378
  // src/gridOpen.tsx
14213
14379
  var import_react41 = require("react");
14214
14380
  var import_outbound = require("@ai-matrx/kit/outbound");
14215
- var import_jsx_runtime26 = require("react/jsx-runtime");
14381
+ var import_jsx_runtime27 = require("react/jsx-runtime");
14216
14382
  var TITLE_OWN_CONTROLS = 'input, textarea, select, button, a[href], [role="combobox"], [contenteditable="true"], [contenteditable=""]';
14217
14383
  var TitleCellOpensContext = (0, import_react41.createContext)(false);
14218
14384
  var OpenRecordHereContext = (0, import_react41.createContext)(null);
@@ -14242,7 +14408,7 @@ function withOpenRecord(columns, onOpen, nameOf3, place = "end", hrefOf, openOnl
14242
14408
  if (href && (event.metaKey || event.ctrlKey)) (0, import_outbound.openOutbound)(href, "_blank", "noopener");
14243
14409
  else (openOnly ?? onOpen)(row.id);
14244
14410
  };
14245
- const handle = (row) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
14411
+ const handle = (row) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
14246
14412
  "button",
14247
14413
  {
14248
14414
  type: "button",
@@ -14256,8 +14422,8 @@ function withOpenRecord(columns, onOpen, nameOf3, place = "end", hrefOf, openOnl
14256
14422
  },
14257
14423
  onDoubleClick: (event) => event.stopPropagation(),
14258
14424
  children: [
14259
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", width: "12", height: "12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "M9.5 2.5h4v4M13.5 2.5 8.5 7.5M6.5 3.5h-3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-3" }) }),
14260
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "[@media(hover:none)]:sr-only", children: "Open" })
14425
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", width: "12", height: "12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "M9.5 2.5h4v4M13.5 2.5 8.5 7.5M6.5 3.5h-3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-3" }) }),
14426
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "[@media(hover:none)]:sr-only", children: "Open" })
14261
14427
  ]
14262
14428
  }
14263
14429
  );
@@ -14269,7 +14435,7 @@ function withOpenRecord(columns, onOpen, nameOf3, place = "end", hrefOf, openOnl
14269
14435
  };
14270
14436
  return {
14271
14437
  ...column,
14272
- cell: (row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
14438
+ cell: (row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
14273
14439
  "span",
14274
14440
  {
14275
14441
  className: index === 0 ? "relative flex min-w-0 items-center gap-1" : "contents",
@@ -14280,9 +14446,9 @@ function withOpenRecord(columns, onOpen, nameOf3, place = "end", hrefOf, openOnl
14280
14446
  event.stopPropagation();
14281
14447
  onOpen(row.id);
14282
14448
  },
14283
- children: index === 0 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
14449
+ children: index === 0 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
14284
14450
  place === "start" ? handle(row) : null,
14285
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
14451
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
14286
14452
  "span",
14287
14453
  {
14288
14454
  className: "min-w-0 flex-1 decoration-muted-foreground/60 underline-offset-2 hover:underline",
@@ -14297,7 +14463,7 @@ function withOpenRecord(columns, onOpen, nameOf3, place = "end", hrefOf, openOnl
14297
14463
  event.stopPropagation();
14298
14464
  openFrom(row, event);
14299
14465
  },
14300
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TitleCellOpensContext.Provider, { value: true, children: render(row, rowIndex) })
14466
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TitleCellOpensContext.Provider, { value: true, children: render(row, rowIndex) })
14301
14467
  }
14302
14468
  ),
14303
14469
  place === "end" ? handle(row) : null
@@ -14349,12 +14515,12 @@ function columnNameProblemLine(name, noun = "column") {
14349
14515
  // src/FieldEditor.tsx
14350
14516
  var import_react88 = require("react");
14351
14517
  var import_react89 = require("@ai-matrx/records/react");
14352
- var import_core10 = require("@ai-matrx/records/core");
14518
+ var import_core11 = require("@ai-matrx/records/core");
14353
14519
  var import_design_system54 = require("@ai-matrx/design-system");
14354
14520
 
14355
14521
  // src/WatchFieldsPicker.tsx
14356
14522
  var import_design_system22 = require("@ai-matrx/design-system");
14357
- var import_jsx_runtime27 = require("react/jsx-runtime");
14523
+ var import_jsx_runtime28 = require("react/jsx-runtime");
14358
14524
  function watchedFieldsOf(field2) {
14359
14525
  const list = field2?.config?.["only_fields"];
14360
14526
  return Array.isArray(list) ? list.filter((k) => typeof k === "string") : [];
@@ -14370,15 +14536,15 @@ function watchable(field2) {
14370
14536
  }
14371
14537
  function WatchFieldsPicker({ fields, value, onChange }) {
14372
14538
  const choices = fields.filter(watchable);
14373
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("fieldset", { className: "flex flex-col gap-1", "data-records-watch-fields": "", children: [
14374
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_design_system22.Label, { className: "text-xs", children: "Changes to" }),
14375
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap gap-x-3 gap-y-1", children: [
14376
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", children: [
14377
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_design_system22.Checkbox, { checked: value.length === 0, "aria-label": "Any field", onCheckedChange: (v) => v === true && onChange([]) }),
14378
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Any field" })
14539
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("fieldset", { className: "flex flex-col gap-1", "data-records-watch-fields": "", children: [
14540
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_design_system22.Label, { className: "text-xs", children: "Changes to" }),
14541
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap gap-x-3 gap-y-1", children: [
14542
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", children: [
14543
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_design_system22.Checkbox, { checked: value.length === 0, "aria-label": "Any field", onCheckedChange: (v) => v === true && onChange([]) }),
14544
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Any field" })
14379
14545
  ] }),
14380
- choices.map((f) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", children: [
14381
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
14546
+ choices.map((f) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", children: [
14547
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
14382
14548
  import_design_system22.Checkbox,
14383
14549
  {
14384
14550
  checked: value.includes(f.key),
@@ -14387,7 +14553,7 @@ function WatchFieldsPicker({ fields, value, onChange }) {
14387
14553
  onCheckedChange: (v) => onChange(v === true ? [...value.filter((k) => k !== f.key), f.key] : value.filter((k) => k !== f.key))
14388
14554
  }
14389
14555
  ),
14390
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: f.label })
14556
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: f.label })
14391
14557
  ] }, f.id))
14392
14558
  ] })
14393
14559
  ] });
@@ -14402,7 +14568,7 @@ var import_react42 = require("react");
14402
14568
  var import_react43 = require("@ai-matrx/records/react");
14403
14569
  var import_design_system23 = require("@ai-matrx/design-system");
14404
14570
  init_Refusal();
14405
- var import_jsx_runtime28 = require("react/jsx-runtime");
14571
+ var import_jsx_runtime29 = require("react/jsx-runtime");
14406
14572
  var ENTITY_REFERENCE_KINDS_MISSING = "Choose at least one kind of thing this column points at.";
14407
14573
  function entityReferenceSpec(input) {
14408
14574
  const seen = /* @__PURE__ */ new Set();
@@ -14453,11 +14619,11 @@ function EntityReferenceKindPicker({ value, onChange, locked = false, className
14453
14619
  if (on) onChange(chosen.has(token2) ? [...value] : [...value, token2]);
14454
14620
  else onChange(value.filter((t) => t !== token2));
14455
14621
  };
14456
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: (0, import_design_system23.cn)("flex flex-col gap-2", className), children: [
14457
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_design_system23.Label, { className: "text-xs", children: "What it points at" }),
14458
- value.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-wrap gap-1", "aria-label": "Chosen kinds", children: value.map((token2) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_design_system23.Badge, { variant: "secondary", className: "gap-1 text-[11px]", children: [
14622
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: (0, import_design_system23.cn)("flex flex-col gap-2", className), children: [
14623
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_design_system23.Label, { className: "text-xs", children: "What it points at" }),
14624
+ value.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex flex-wrap gap-1", "aria-label": "Chosen kinds", children: value.map((token2) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_design_system23.Badge, { variant: "secondary", className: "gap-1 text-[11px]", children: [
14459
14625
  labelOf.get(token2) ?? token2,
14460
- locked ? null : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
14626
+ locked ? null : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
14461
14627
  "button",
14462
14628
  {
14463
14629
  type: "button",
@@ -14468,8 +14634,8 @@ function EntityReferenceKindPicker({ value, onChange, locked = false, className
14468
14634
  }
14469
14635
  )
14470
14636
  ] }, token2)) }) : null,
14471
- locked ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "The kinds an existing column points at are kept as they are; add a new column to point at others." }) : error ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(RefusalNotice, { error }) : loading ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_design_system23.Skeleton, { className: "h-24 w-full" }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
14472
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
14637
+ locked ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "The kinds an existing column points at are kept as they are; add a new column to point at others." }) : error ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(RefusalNotice, { error }) : loading ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_design_system23.Skeleton, { className: "h-24 w-full" }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
14638
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
14473
14639
  import_design_system23.BasicInput,
14474
14640
  {
14475
14641
  "aria-label": "Find a kind of thing",
@@ -14479,14 +14645,14 @@ function EntityReferenceKindPicker({ value, onChange, locked = false, className
14479
14645
  onChange: (e) => setQuery(e.target.value)
14480
14646
  }
14481
14647
  ),
14482
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "max-h-56 overflow-y-auto rounded-md border border-border p-2", role: "group", "aria-label": "Kinds of thing", children: groups.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
14648
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "max-h-56 overflow-y-auto rounded-md border border-border p-2", role: "group", "aria-label": "Kinds of thing", children: groups.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
14483
14649
  "No kind of thing matches \u201C",
14484
14650
  query.trim(),
14485
14651
  "\u201D."
14486
- ] }) : groups.map(([category, kinds]) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "mb-2 last:mb-0", children: [
14487
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "mb-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: category }),
14488
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "grid grid-cols-1 gap-1 sm:grid-cols-2", children: kinds.map((k) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1.5 text-xs", children: [
14489
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
14652
+ ] }) : groups.map(([category, kinds]) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "mb-2 last:mb-0", children: [
14653
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "mb-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: category }),
14654
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "grid grid-cols-1 gap-1 sm:grid-cols-2", children: kinds.map((k) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1.5 text-xs", children: [
14655
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
14490
14656
  import_design_system23.Checkbox,
14491
14657
  {
14492
14658
  checked: chosen.has(k.token),
@@ -14497,7 +14663,7 @@ function EntityReferenceKindPicker({ value, onChange, locked = false, className
14497
14663
  k.label
14498
14664
  ] }, k.token)) })
14499
14665
  ] }, category)) }),
14500
- value.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-[11px] text-muted-foreground", children: ENTITY_REFERENCE_KINDS_MISSING }) : null
14666
+ value.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-[11px] text-muted-foreground", children: ENTITY_REFERENCE_KINDS_MISSING }) : null
14501
14667
  ] })
14502
14668
  ] });
14503
14669
  }
@@ -14519,45 +14685,7 @@ function withoutLeadingBlank(text) {
14519
14685
  // src/values.tsx
14520
14686
  init_personChip();
14521
14687
  var import_data_table4 = require("@ai-matrx/design-system/data-table");
14522
- var import_field_formats7 = require("@ai-matrx/design-system/field-formats");
14523
-
14524
- // src/withheldNotice.ts
14525
- init_names();
14526
- var WITHHELD_WORD = "Withheld";
14527
- function withheldNoticeOf(hidden, key) {
14528
- const notice2 = hidden?.[key];
14529
- return notice2 && typeof notice2 === "object" ? notice2 : null;
14530
- }
14531
- function withheldSentence(field2, notice2) {
14532
- const extra = notice2;
14533
- if (typeof extra.says === "string" && extra.says.trim() !== "") return extra.says.trim();
14534
- const name = fieldName(field2);
14535
- if (typeof extra.part === "string" && extra.part.trim() !== "" && typeof extra.who === "string" && extra.who.trim() !== "") {
14536
- return `${name} is in ${extra.part.trim()} \u2014 ${extra.who.trim()} see it.`;
14537
- }
14538
- const reason = notice2.reason ? ` It is ${notice2.reason}` : "";
14539
- const needs = notice2.needs ? `${reason ? "," : " It"} and reading it needs ${notice2.needs}` : "";
14540
- const or = notice2.or ? `${needs || reason ? ", or" : " It needs"} ${notice2.or}` : "";
14541
- return `${name} is withheld from you.${reason}${needs}${or}${reason || needs || or ? "." : ""}`;
14542
- }
14543
-
14544
- // src/withheld.tsx
14545
- var import_jsx_runtime29 = require("react/jsx-runtime");
14546
- function WithheldValue({ field: field2, notice: notice2 }) {
14547
- const sentence2 = withheldSentence(field2, notice2);
14548
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
14549
- "span",
14550
- {
14551
- "data-records-withheld": field2.key,
14552
- title: sentence2,
14553
- "aria-label": `${WITHHELD_WORD}. ${sentence2}`,
14554
- className: "cursor-help italic text-muted-foreground",
14555
- children: WITHHELD_WORD
14556
- }
14557
- );
14558
- }
14559
-
14560
- // src/values.tsx
14688
+ var import_field_formats11 = require("@ai-matrx/design-system/field-formats");
14561
14689
  init_names();
14562
14690
  var import_design_system46 = require("@ai-matrx/design-system");
14563
14691
  init_parity();
@@ -14781,11 +14909,11 @@ function Chips({
14781
14909
  }
14782
14910
 
14783
14911
  // src/values.tsx
14784
- var import_core9 = require("@ai-matrx/records/core");
14912
+ var import_core10 = require("@ai-matrx/records/core");
14785
14913
 
14786
14914
  // src/WholeValue.tsx
14787
14915
  var import_react47 = require("react");
14788
- var import_core4 = require("@ai-matrx/records/core");
14916
+ var import_core5 = require("@ai-matrx/records/core");
14789
14917
  var import_design_system25 = require("@ai-matrx/design-system");
14790
14918
  init_host();
14791
14919
  init_names();
@@ -14793,7 +14921,7 @@ var import_outbound_react2 = require("@ai-matrx/kit/outbound-react");
14793
14921
  var import_jsx_runtime31 = require("react/jsx-runtime");
14794
14922
  var WHOLE_VALUE_UNBOUND = "The whole text is kept as a file, and this screen has no way to open files yet.";
14795
14923
  function wholeValueLine(pointer) {
14796
- return `Open the whole text (${(0, import_core4.wholeValueSize)(pointer)})`;
14924
+ return `Open the whole text (${(0, import_core5.wholeValueSize)(pointer)})`;
14797
14925
  }
14798
14926
  function WholeValueCell({ words: words2, pointer }) {
14799
14927
  const host = useRecordsUi();
@@ -14804,12 +14932,12 @@ function WholeValueCell({ words: words2, pointer }) {
14804
14932
  words2,
14805
14933
  "\u2026"
14806
14934
  ] }),
14807
- href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_outbound_react2.OutboundLink, { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, children: line }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0, import_core4.wholeValueSize)(pointer)} in a file` })
14935
+ href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_outbound_react2.OutboundLink, { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, children: line }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0, import_core5.wholeValueSize)(pointer)} in a file` })
14808
14936
  ] });
14809
14937
  }
14810
14938
  var WHOLE_VALUE_NOT_EDITABLE_HERE = "The whole text is kept as a file. Open it to read it; this screen cannot load it to edit.";
14811
14939
  function wholeValueOpening(pointer) {
14812
- return `Opening the whole text (${(0, import_core4.wholeValueSize)(pointer)})\u2026`;
14940
+ return `Opening the whole text (${(0, import_core5.wholeValueSize)(pointer)})\u2026`;
14813
14941
  }
14814
14942
  function useWholeText(pointer) {
14815
14943
  const host = useRecordsUi();
@@ -14880,12 +15008,12 @@ function WholeValueEditor({
14880
15008
 
14881
15009
  // src/values.tsx
14882
15010
  init_choiceLooks();
14883
- var import_field_formats8 = require("@ai-matrx/design-system/field-formats");
15011
+ var import_field_formats12 = require("@ai-matrx/design-system/field-formats");
14884
15012
 
14885
15013
  // src/formattedValue.tsx
14886
15014
  var import_react49 = require("react");
14887
15015
  var import_data_table3 = require("@ai-matrx/design-system/data-table");
14888
- var import_field_formats6 = require("@ai-matrx/design-system/field-formats");
15016
+ var import_field_formats9 = require("@ai-matrx/design-system/field-formats");
14889
15017
  var import_design_system27 = require("@ai-matrx/design-system");
14890
15018
  var import_outbound_react3 = require("@ai-matrx/kit/outbound-react");
14891
15019
 
@@ -15011,7 +15139,7 @@ function rich(id, text, raw, format) {
15011
15139
  case "url":
15012
15140
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(LinkPreviewCard, { url: text.includes("://") ? text : `https://${text}`, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_outbound_react3.OutboundLink, { href: text.includes("://") ? text : `https://${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "truncate", children: text }) }) });
15013
15141
  case "phone":
15014
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("a", { href: `tel:${text.replace(/[^\d+]/g, "")}`, className: LINK, onClick: own2, title: text, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "truncate tabular-nums", children: (0, import_field_formats6.formatPhone)(text) }) });
15142
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("a", { href: `tel:${text.replace(/[^\d+]/g, "")}`, className: LINK, onClick: own2, title: text, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "truncate tabular-nums", children: (0, import_field_formats9.formatPhone)(text) }) });
15015
15143
  case "address":
15016
15144
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
15017
15145
  import_outbound_react3.OutboundLink,
@@ -15065,13 +15193,13 @@ function FormattedValue({
15065
15193
  onRate,
15066
15194
  selectFirst
15067
15195
  }) {
15068
- const def = (0, import_field_formats6.getFieldFormat)(format.id);
15196
+ const def = (0, import_field_formats9.getFieldFormat)(format.id);
15069
15197
  const score = numberOf3(value);
15070
15198
  const max = format.options?.ratingMax ?? 5;
15071
15199
  if (def?.id === "rating" && onRate && (value === null || value === void 0 || value === "" || score !== null && score >= 0 && score <= max)) {
15072
15200
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, onRate, selectFirst });
15073
15201
  }
15074
- const result = (0, import_field_formats6.formatFieldValue)(value, format);
15202
+ const result = (0, import_field_formats9.formatFieldValue)(value, format);
15075
15203
  if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_data_table3.FormattedCell, { result });
15076
15204
  const look = fieldLookFor(def.id);
15077
15205
  if (look) {
@@ -16031,6 +16159,7 @@ var import_text_case6 = require("@ai-matrx/kit/text-case");
16031
16159
  init_host();
16032
16160
  init_kindValues();
16033
16161
  init_tableShape();
16162
+ var import_field_formats10 = require("@ai-matrx/design-system/field-formats");
16034
16163
  var import_jsx_runtime52 = require("react/jsx-runtime");
16035
16164
  var SaveToTable2 = (0, import_react76.lazy)(() => Promise.resolve().then(() => (init_SaveToTable(), SaveToTable_exports)).then((m) => ({ default: m.SaveToTable })));
16036
16165
  var LONGEST_READ = 5e5;
@@ -16139,7 +16268,7 @@ function dateWords(v) {
16139
16268
  return Number.isNaN(local.getTime()) ? null : local.toLocaleDateString(void 0, { dateStyle: "medium" });
16140
16269
  }
16141
16270
  const at = new Date(v);
16142
- return Number.isNaN(at.getTime()) ? null : at.toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short" });
16271
+ return Number.isNaN(at.getTime()) ? null : at.toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short", ...(0, import_field_formats10.momentZoneOptions)(v) });
16143
16272
  }
16144
16273
  function stop(event) {
16145
16274
  event.stopPropagation();
@@ -16443,7 +16572,7 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
16443
16572
  if ((0, import_records26.isButtonField)(field2)) return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ButtonValue, { field: field2 });
16444
16573
  const newer = newerKindValue(field2, value);
16445
16574
  if (newer !== void 0) return newer;
16446
- const whole = typeof value === "string" ? (0, import_core9.wholeValueOf)(document2, field2.key) : null;
16575
+ const whole = typeof value === "string" ? (0, import_core10.wholeValueOf)(document2, field2.key) : null;
16447
16576
  if (whole) return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(WholeValueCell, { words: value, pointer: whole });
16448
16577
  const kind2 = editorKindFor(field2);
16449
16578
  if (kind2 === "relation" || kind2 === "entity_reference") {
@@ -16515,7 +16644,7 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
16515
16644
  title: value,
16516
16645
  "data-records-phone": "",
16517
16646
  onClick: (event) => event.stopPropagation(),
16518
- children: (0, import_field_formats8.formatPhone)(value)
16647
+ children: (0, import_field_formats12.formatPhone)(value)
16519
16648
  }
16520
16649
  );
16521
16650
  }
@@ -16601,7 +16730,7 @@ function scalarText(field2, value, labels, stillWaitingFor) {
16601
16730
  }
16602
16731
  const shownAs = shownAsOf(field2);
16603
16732
  if (shownAs) {
16604
- const said2 = (0, import_field_formats7.formatFieldValue)(value, shownAs.id === "number" && isYearField(field2) && isYearValue(value) ? formatForField(field2) ?? shownAs : shownAs);
16733
+ const said2 = (0, import_field_formats11.formatFieldValue)(value, shownAs.id === "number" && isYearField(field2) && isYearValue(value) ? formatForField(field2) ?? shownAs : shownAs);
16605
16734
  if (said2.ok && !said2.empty) return said2.text;
16606
16735
  }
16607
16736
  if (typeof value === "number") {
@@ -16621,7 +16750,7 @@ function scalarText(field2, value, labels, stillWaitingFor) {
16621
16750
  function ProvenanceBadge({ document: document2, fieldKey }) {
16622
16751
  const envelope = envelopeFor(document2, fieldKey);
16623
16752
  if (!envelope?.src) return null;
16624
- if ((0, import_core9.wholeValueOf)(document2, fieldKey)) return null;
16753
+ if ((0, import_core10.wholeValueOf)(document2, fieldKey)) return null;
16625
16754
  const sources = document2?._sources;
16626
16755
  const source = sources?.[envelope.src];
16627
16756
  const label = source ? Object.values(source).map(String).join(" \xB7 ") : envelope.src;
@@ -16660,11 +16789,11 @@ function RecordValue({
16660
16789
  if (newer !== void 0) return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_jsx_runtime53.Fragment, { children: newer });
16661
16790
  }
16662
16791
  const room = inCell && !roomy ? "cell" : "full";
16663
- if (value !== null && value !== void 0 && !(0, import_core9.wholeValueOf)(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent) {
16792
+ if (value !== null && value !== void 0 && !(0, import_core10.wholeValueOf)(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent) {
16664
16793
  const structured = structuredValueOf(field2, value);
16665
16794
  if (structured) return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_jsx_runtime53.Fragment, { children: structuredNode(field2, structured, room) });
16666
16795
  }
16667
- if (inCell && ui.grid === "merged" && ui.renderText && typeof value === "string" && value.trim() !== "" && editorKindFor(field2) === "long_text" && !shownAsOf(field2) && !(0, import_core9.wholeValueOf)(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent && // A long-text cell holding a kind is drawn by the kind system below, not as markdown.
16796
+ if (inCell && ui.grid === "merged" && ui.renderText && typeof value === "string" && value.trim() !== "" && editorKindFor(field2) === "long_text" && !shownAsOf(field2) && !(0, import_core10.wholeValueOf)(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent && // A long-text cell holding a kind is drawn by the kind system below, not as markdown.
16668
16797
  !kindValueOf(value)) {
16669
16798
  return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "block h-[1.5em] min-w-0 overflow-hidden whitespace-normal [[data-matrx-cell-lines]:not([data-matrx-cell-lines=one])_&]:h-auto", "data-records-cell-text": "", children: ui.renderText(withoutLeadingBlank(value), "cell") });
16670
16799
  }
@@ -16686,7 +16815,7 @@ function RecordValue({
16686
16815
  }
16687
16816
  }
16688
16817
  }
16689
- const pictureAt = value !== null && value !== void 0 && !(0, import_core9.wholeValueOf)(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent ? imageAddressOf(field2, value) : null;
16818
+ const pictureAt = value !== null && value !== void 0 && !(0, import_core10.wholeValueOf)(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent ? imageAddressOf(field2, value) : null;
16690
16819
  if (pictureAt) return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ImageUrlValue, { url: pictureAt, alt: field2.label || field2.key, room });
16691
16820
  const shown5 = format ?? formatForField(field2);
16692
16821
  const shape = shown5 && (shown5.id === "date" || shown5.id === "datetime") && isDateField(field2) ? dateFormatFor(field2, value) : void 0;
@@ -17640,7 +17769,7 @@ function BarcodeSymbologyQuestion({ value, onChange }) {
17640
17769
 
17641
17770
  // src/FieldFormatPicker.tsx
17642
17771
  var import_design_system50 = require("@ai-matrx/design-system");
17643
- var import_field_formats9 = require("@ai-matrx/design-system/field-formats");
17772
+ var import_field_formats13 = require("@ai-matrx/design-system/field-formats");
17644
17773
  init_PickOne();
17645
17774
  init_choiceLooks();
17646
17775
  init_parity();
@@ -17706,7 +17835,7 @@ function formatMenu(field2) {
17706
17835
  if (base2 === null) return { groups: [], otherKinds: [] };
17707
17836
  if (base2 === "formula") {
17708
17837
  const groups2 = [];
17709
- for (const def of import_field_formats9.FIELD_FORMAT_LIST) {
17838
+ for (const def of import_field_formats13.FIELD_FORMAT_LIST) {
17710
17839
  if (neverALook(def) || KIND_WORD[def.id] || def.id === "boolean") continue;
17711
17840
  const bucket = groups2.find((g) => g.group === def.group);
17712
17841
  if (bucket) bucket.formats.push(def);
@@ -17714,10 +17843,10 @@ function formatMenu(field2) {
17714
17843
  }
17715
17844
  return { groups: groups2, otherKinds: [] };
17716
17845
  }
17717
- const groups = (0, import_field_formats9.groupedFormatsForBase)(base2).map((g) => ({ group: g.group, formats: g.formats.filter((d) => !neverALook(d) && !KIND_WORD[d.id]) })).filter((g) => g.formats.length > 0);
17846
+ const groups = (0, import_field_formats13.groupedFormatsForBase)(base2).map((g) => ({ group: g.group, formats: g.formats.filter((d) => !neverALook(d) && !KIND_WORD[d.id]) })).filter((g) => g.formats.length > 0);
17718
17847
  const own3 = new Set(groups.flatMap((g) => g.formats.map((d) => d.id)));
17719
17848
  const otherKinds = [];
17720
- for (const def of import_field_formats9.FIELD_FORMAT_LIST) {
17849
+ for (const def of import_field_formats13.FIELD_FORMAT_LIST) {
17721
17850
  if (own3.has(def.id) || neverALook(def)) continue;
17722
17851
  const word = KIND_WORD[def.id] ?? PLAIN_WORD[def.base];
17723
17852
  if (word) otherKinds.push({ def, word });
@@ -17726,7 +17855,7 @@ function formatMenu(field2) {
17726
17855
  }
17727
17856
  function startingChoice(field2) {
17728
17857
  const held = displayFormatOf(field2);
17729
- if (!held || !(0, import_field_formats9.getFieldFormat)(held.id) || held.id === "formula") return { format: null, retype: null };
17858
+ if (!held || !(0, import_field_formats13.getFieldFormat)(held.id) || held.id === "formula") return { format: null, retype: null };
17730
17859
  return {
17731
17860
  format: Object.keys(held.options).length > 0 ? { id: held.id, options: held.options } : { id: held.id },
17732
17861
  retype: null
@@ -17756,7 +17885,7 @@ function FieldFormatPicker({
17756
17885
  }) {
17757
17886
  const { groups, otherKinds } = formatMenu(field2);
17758
17887
  if (groups.length === 0 && otherKinds.length === 0) return null;
17759
- const active = value.format ? (0, import_field_formats9.getFieldFormat)(value.format.id) : null;
17888
+ const active = value.format ? (0, import_field_formats13.getFieldFormat)(value.format.id) : null;
17760
17889
  const options = value.format?.options ?? {};
17761
17890
  const optionKeys = active?.optionKeys ?? [];
17762
17891
  const retypedTo = value.retype ? otherKinds.find((k) => k.def.id === value.format?.id) : void 0;
@@ -18687,7 +18816,7 @@ function FieldEditor(props) {
18687
18816
  return;
18688
18817
  }
18689
18818
  (0, import_react89.tableShapeChanged)(tableId);
18690
- for (const c of done.data.undo.cells_back) (0, import_core10.announceRecordChanged)(c.record_id);
18819
+ for (const c of done.data.undo.cells_back) (0, import_core11.announceRecordChanged)(c.record_id);
18691
18820
  const n = done.data.rehomed.reduce((sum, r) => sum + r.records, 0);
18692
18821
  setRehome({});
18693
18822
  setRehomed({ said: `Saved. ${n} ${n === 1 ? "record was" : "records were"} changed with the choices.`, undo: done.data.undo });
@@ -19233,7 +19362,7 @@ function FieldEditor(props) {
19233
19362
  return;
19234
19363
  }
19235
19364
  (0, import_react89.tableShapeChanged)(tableId);
19236
- for (const c of undo.cells_back) (0, import_core10.announceRecordChanged)(c.record_id);
19365
+ for (const c of undo.cells_back) (0, import_core11.announceRecordChanged)(c.record_id);
19237
19366
  setChoiceList(null);
19238
19367
  setChoiceListStart(null);
19239
19368
  setRehomed({ said: "Undone. The choices and the records that held them are back as they were.", undo: null });
@@ -20008,7 +20137,7 @@ init_refusals();
20008
20137
  // src/formatControls.tsx
20009
20138
  var import_react93 = require("react");
20010
20139
  var import_design_system56 = require("@ai-matrx/design-system");
20011
- var import_field_formats10 = require("@ai-matrx/design-system/field-formats");
20140
+ var import_field_formats14 = require("@ai-matrx/design-system/field-formats");
20012
20141
  var import_jsx_runtime65 = require("react/jsx-runtime");
20013
20142
  var TYPED_NUMBERS = /* @__PURE__ */ new Set(["currency", "percent", "progress", "decimal", "duration", "file_size", "integer"]);
20014
20143
  function scaled(format) {
@@ -20021,7 +20150,7 @@ function typedText(format, value) {
20021
20150
  }
20022
20151
  function keptValue(format, raw) {
20023
20152
  if (raw.trim() === "") return null;
20024
- const parsed = (0, import_field_formats10.parseFieldInput)(raw, format);
20153
+ const parsed = (0, import_field_formats14.parseFieldInput)(raw, format);
20025
20154
  if (typeof parsed === "number" && scaled(format)) return Math.round(parsed / 100 * 1e9) / 1e9;
20026
20155
  return parsed;
20027
20156
  }
@@ -20051,7 +20180,7 @@ function NumberInFormat({ format, value, onChange, disabled, id }) {
20051
20180
  );
20052
20181
  }
20053
20182
  function formatControl(args) {
20054
- const def = (0, import_field_formats10.getFieldFormat)(args.format.id);
20183
+ const def = (0, import_field_formats14.getFieldFormat)(args.format.id);
20055
20184
  if (!def) return null;
20056
20185
  const { format, value, onChange, disabled, id, label, ownDetails } = args;
20057
20186
  const look = fieldLookFor(def.id);
@@ -20060,7 +20189,7 @@ function formatControl(args) {
20060
20189
  return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Editor, { value, format, onChange, disabled, id, label });
20061
20190
  }
20062
20191
  const text = value === null || value === void 0 ? "" : String(value);
20063
- const commit = (raw) => onChange(raw === "" ? null : (0, import_field_formats10.parseFieldInput)(raw, format));
20192
+ const commit = (raw) => onChange(raw === "" ? null : (0, import_field_formats14.parseFieldInput)(raw, format));
20064
20193
  if (def.id === "rating") {
20065
20194
  return disabled ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, label }) : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { id, className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, label, onRate: (n) => onChange(n) }) });
20066
20195
  }
@@ -20126,8 +20255,8 @@ function readBox(text, kind2) {
20126
20255
  const read = (0, import_records35.readTypedDate)(text, { withTime: kind2 === "datetime" });
20127
20256
  if (!read.ok) return { day: null, time: null };
20128
20257
  if (kind2 === "datetime" && read.instant) {
20129
- const at = new Date(read.instant);
20130
- return { day: read.day, time: { h: at.getHours(), m: at.getMinutes() } };
20258
+ const wall = (0, import_records35.wallPartsInZone)(new Date(read.instant));
20259
+ return { day: read.day, time: { h: wall.hour, m: wall.minute } };
20131
20260
  }
20132
20261
  return { day: read.day, time: null };
20133
20262
  }
@@ -21295,7 +21424,9 @@ init_host();
21295
21424
 
21296
21425
  // src/whoChanged.ts
21297
21426
  var import_format4 = require("@ai-matrx/kit/format");
21427
+ var import_global_slot2 = require("@ai-matrx/kit/global-slot");
21298
21428
  var import_text_case8 = require("@ai-matrx/kit/text-case");
21429
+ var displayZone = (0, import_global_slot2.globalSlot)("ai-matrx.design-system.display-time-zone", () => ({ zone: null }));
21299
21430
  var SOMEBODY = "somebody in this organization";
21300
21431
  var THE_SYSTEM = "Matrx";
21301
21432
  function actorWords(actor, resolve) {
@@ -21314,7 +21445,7 @@ function whenWords(at, now = /* @__PURE__ */ new Date()) {
21314
21445
  const age = now.getTime() - then.getTime();
21315
21446
  if (!Number.isFinite(age)) return "at an unknown time";
21316
21447
  if (age < 30 * 864e5) return (0, import_format4.formatRelativeTime)(then, { style: "intl", now: now.getTime() });
21317
- return then.toLocaleDateString();
21448
+ return then.toLocaleDateString(void 0, displayZone.zone ? { timeZone: displayZone.zone } : void 0);
21318
21449
  }
21319
21450
  var OPERATION_WORDS = {
21320
21451
  created: "Created",
@@ -21694,7 +21825,7 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
21694
21825
  }
21695
21826
  const held = optimistic[cellKey(address.rowId, address.key)];
21696
21827
  const document2 = rows.find((r) => r.id === address.rowId)?.document;
21697
- const pointer = held === void 0 && typeof current === "string" ? (0, import_core11.wholeValueOf)(document2, address.key) : null;
21828
+ const pointer = held === void 0 && typeof current === "string" ? (0, import_core12.wholeValueOf)(document2, address.key) : null;
21698
21829
  if (pointer) {
21699
21830
  const read = host.readFileText;
21700
21831
  if (!read) return;
@@ -21846,7 +21977,7 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
21846
21977
  delete next[id];
21847
21978
  return next;
21848
21979
  });
21849
- const conflict = (0, import_core11.asWriteConflict)(written.error, rowId);
21980
+ const conflict = (0, import_core12.asWriteConflict)(written.error, rowId);
21850
21981
  if (written.error.code === "stale_write") {
21851
21982
  if (conflict) rememberVersion(versions.current, rowId, conflict.current_version);
21852
21983
  else versions.current.delete(rowId);
@@ -21934,7 +22065,7 @@ function useGridEditing({ tableId, fields, rows, reload, reloadAfterWrite, canWr
21934
22065
  }
21935
22066
  const starting = shownValue2(next.rowId, next.key);
21936
22067
  const nextDocument = rows.find((r) => r.id === next.rowId)?.document;
21937
- if (typeof starting === "string" && optimistic[cellKey(next.rowId, next.key)] === void 0 && (0, import_core11.wholeValueOf)(nextDocument, next.key)) {
22068
+ if (typeof starting === "string" && optimistic[cellKey(next.rowId, next.key)] === void 0 && (0, import_core12.wholeValueOf)(nextDocument, next.key)) {
21938
22069
  setEditing(null);
21939
22070
  setDraft(null);
21940
22071
  typed2.current = null;
@@ -23051,7 +23182,7 @@ var import_react184 = require("@ai-matrx/records/react");
23051
23182
  var import_records47 = require("@ai-matrx/records");
23052
23183
  var import_records48 = require("@ai-matrx/records");
23053
23184
  var import_data_table14 = require("@ai-matrx/design-system/data-table");
23054
- var import_core19 = require("@ai-matrx/records/core");
23185
+ var import_core20 = require("@ai-matrx/records/core");
23055
23186
 
23056
23187
  // src/tableDecorations.ts
23057
23188
  var import_react105 = require("react");
@@ -23198,7 +23329,7 @@ function useTableCanBeCleaned(tableId) {
23198
23329
 
23199
23330
  // src/gridControls.tsx
23200
23331
  var import_clipboard3 = require("@ai-matrx/kit/clipboard");
23201
- var import_core13 = require("@ai-matrx/records/core");
23332
+ var import_core14 = require("@ai-matrx/records/core");
23202
23333
  var import_react143 = require("react");
23203
23334
  var import_react144 = require("@ai-matrx/records/react");
23204
23335
  var import_design_system78 = require("@ai-matrx/design-system");
@@ -24124,11 +24255,11 @@ init_names();
24124
24255
  var import_react116 = require("react");
24125
24256
 
24126
24257
  // src/dataSource.ts
24127
- var import_global_slot2 = require("@ai-matrx/kit/global-slot");
24258
+ var import_global_slot3 = require("@ai-matrx/kit/global-slot");
24128
24259
  function personActor(userId) {
24129
24260
  return userId ? { actor: "user", user_id: userId } : { actor: "user" };
24130
24261
  }
24131
- var dataSources = (0, import_global_slot2.globalSlot)("ai-matrx.records-ui.data-sources", () => /* @__PURE__ */ new WeakMap());
24262
+ var dataSources = (0, import_global_slot3.globalSlot)("ai-matrx.records-ui.data-sources", () => /* @__PURE__ */ new WeakMap());
24132
24263
  function recordsDataSource(client, fallbackSchema = "custom") {
24133
24264
  let bySchema = dataSources.get(client);
24134
24265
  if (!bySchema) {
@@ -24244,6 +24375,7 @@ init_tablePicking();
24244
24375
  init_Refusal();
24245
24376
  init_refusals();
24246
24377
  init_plainWords();
24378
+ var import_field_formats15 = require("@ai-matrx/design-system/field-formats");
24247
24379
  var import_jsx_runtime76 = require("react/jsx-runtime");
24248
24380
  var SHARED_FOR_MS = 5e3;
24249
24381
  var sharedReads = /* @__PURE__ */ new WeakMap();
@@ -24303,7 +24435,7 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
24303
24435
  const pickerOptions = options.map((t) => {
24304
24436
  const twin = (sameName2.get(`${t.organization_id}|${t.table_name.trim().toLowerCase()}`) ?? 0) > 1;
24305
24437
  const row = t;
24306
- const secondOf = (r) => [r.created_by_name ? `by ${r.created_by_name}` : null, r.updated_at ? `changed ${new Date(r.updated_at).toLocaleDateString()}` : null].filter(Boolean).join(" \xB7 ");
24438
+ const secondOf = (r) => [r.created_by_name ? `by ${r.created_by_name}` : null, r.updated_at ? `changed ${new Date(r.updated_at).toLocaleDateString(void 0, (0, import_field_formats15.momentZoneOptions)(r.updated_at))}` : null].filter(Boolean).join(" \xB7 ");
24307
24439
  const base2 = secondOf(row);
24308
24440
  const alike = options.filter((o) => o.organization_id === t.organization_id && o.table_name.trim().toLowerCase() === t.table_name.trim().toLowerCase() && secondOf(o) === base2).length;
24309
24441
  const second = alike > 1 ? [base2, `#${t.table_id.slice(0, 4)}`].filter(Boolean).join(" \xB7 ") : base2;
@@ -24639,7 +24771,7 @@ function ExtractParentDialog({ tableId, record, document: document2, open, onOpe
24639
24771
  // src/printLayouts.tsx
24640
24772
  var import_react126 = require("react");
24641
24773
  var import_react127 = require("@ai-matrx/records/react");
24642
- var import_core12 = require("@ai-matrx/print/core");
24774
+ var import_core13 = require("@ai-matrx/print/core");
24643
24775
  var import_design_system68 = require("@ai-matrx/design-system");
24644
24776
 
24645
24777
  // src/DocTemplate.tsx
@@ -25128,7 +25260,7 @@ function layoutPagesDocument(layoutName, pages) {
25128
25260
  return `<section class="layout-page layout-page-set" data-layout-page="">${noteHtml}${regionHtml("header", split.settings.header, logo)}<div class="layout-text">${escapeText(split.body)}</div>${regionHtml("footer", split.settings.footer)}</section>`;
25129
25261
  }).join("");
25130
25262
  const pageCss = sheet ? layoutPageCss(sheet) : "";
25131
- return (0, import_core12.buildPrintDocument)(body, layoutName, `${LAYOUT_STYLES}${pageCss}`);
25263
+ return (0, import_core13.buildPrintDocument)(body, layoutName, `${LAYOUT_STYLES}${pageCss}`);
25132
25264
  }
25133
25265
  function PrintWithLayoutDialog({ tableId, recordIds, names: names2, open, onOpenChange }) {
25134
25266
  const client = (0, import_react127.useRecordsClient)();
@@ -25158,7 +25290,7 @@ function PrintWithLayoutDialog({ tableId, recordIds, names: names2, open, onOpen
25158
25290
  if (!layout) return;
25159
25291
  setBusy(true);
25160
25292
  setNote(null);
25161
- const pending = (0, import_core12.openPendingPrintWindow)(layout.name);
25293
+ const pending = (0, import_core13.openPendingPrintWindow)(layout.name);
25162
25294
  const pages = [];
25163
25295
  for (const id of recordIds) {
25164
25296
  const body = await client.docRenderBody({ template_id: layout.id, record_id: id });
@@ -27617,7 +27749,7 @@ function useMergedGridControls(args) {
27617
27749
  const fieldsRef = (0, import_react143.useRef)(fields);
27618
27750
  fieldsRef.current = fields;
27619
27751
  const [choiceCounts, setChoiceCounts] = (0, import_react143.useState)({});
27620
- (0, import_react143.useEffect)(() => (0, import_core13.onRecordChanged)(() => (0, askOnce_exports.forgetAsked)(client, `value_counts:${tableId}:`)), [client, tableId]);
27752
+ (0, import_react143.useEffect)(() => (0, import_core14.onRecordChanged)(() => (0, askOnce_exports.forgetAsked)(client, `value_counts:${tableId}:`)), [client, tableId]);
27621
27753
  (0, import_react143.useEffect)(() => {
27622
27754
  if (!enabled || choiceKeys.length === 0) {
27623
27755
  setChoiceCounts({});
@@ -28401,7 +28533,7 @@ var import_design_system82 = require("@ai-matrx/design-system");
28401
28533
  // src/RecordForm.tsx
28402
28534
  var import_react149 = require("react");
28403
28535
  var import_react150 = require("@ai-matrx/records/react");
28404
- var import_core15 = require("@ai-matrx/records/core");
28536
+ var import_core16 = require("@ai-matrx/records/core");
28405
28537
  init_writeOnTheWinningVersion();
28406
28538
  var import_design_system81 = require("@ai-matrx/design-system");
28407
28539
  init_Refusal();
@@ -28420,7 +28552,7 @@ var import_react145 = require("react");
28420
28552
  var import_react146 = require("@ai-matrx/records/react");
28421
28553
  var import_design_system79 = require("@ai-matrx/design-system");
28422
28554
  init_Refusal();
28423
- var import_core14 = require("@ai-matrx/records/core");
28555
+ var import_core15 = require("@ai-matrx/records/core");
28424
28556
  init_plainWords();
28425
28557
  var import_jsx_runtime91 = require("react/jsx-runtime");
28426
28558
  function isEmptyValue(value) {
@@ -28489,7 +28621,7 @@ async function writeStandardRowValues(client, args) {
28489
28621
  { schema: config.schema ?? "custom" }
28490
28622
  );
28491
28623
  if (!old.error) return { ok: true };
28492
- const error = (0, import_core14.mapPgError)(old.error, "entityValueWrite");
28624
+ const error = (0, import_core15.mapPgError)(old.error, "entityValueWrite");
28493
28625
  return { ok: false, error: doorIsAbsent(error) && first && first.error.code !== "door_absent" ? first.error : error };
28494
28626
  }
28495
28627
  function doorIsAbsent(error) {
@@ -29073,7 +29205,7 @@ function CustomRecordForm({
29073
29205
  return out;
29074
29206
  }, [draft]);
29075
29207
  const predicted = (0, import_react149.useMemo)(
29076
- () => fields.data ? (0, import_core15.predictWriteRefusals)({ fields: fields.data, document: document2, ...recordType ? { recordType } : {} }) : [],
29208
+ () => fields.data ? (0, import_core16.predictWriteRefusals)({ fields: fields.data, document: document2, ...recordType ? { recordType } : {} }) : [],
29077
29209
  [fields.data, document2, recordType]
29078
29210
  );
29079
29211
  if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(RefusalNotice, { error: fields.error, onRetry: fields.reload, className });
@@ -29123,7 +29255,7 @@ function CustomRecordForm({
29123
29255
  setEdit({
29124
29256
  saving: false,
29125
29257
  error: answered2.ok ? null : answered2.error,
29126
- conflict: answered2.ok ? null : (0, import_core15.asWriteConflict)(answered2.error, recordId)
29258
+ conflict: answered2.ok ? null : (0, import_core16.asWriteConflict)(answered2.error, recordId)
29127
29259
  });
29128
29260
  const moved = answered2.ok ? answered2.data : null;
29129
29261
  if (moved !== null) {
@@ -29234,7 +29366,7 @@ function FieldRow({
29234
29366
  }) {
29235
29367
  const id = `field-${field2.id}`;
29236
29368
  const storedWords = document2?.[field2.key];
29237
- const whole = typeof storedWords === "string" ? (0, import_core15.wholeValueOf)(document2, field2.key) : null;
29369
+ const whole = typeof storedWords === "string" ? (0, import_core16.wholeValueOf)(document2, field2.key) : null;
29238
29370
  return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: (0, import_design_system81.cn)("flex min-w-0 flex-col gap-1", whole && "sm:col-span-2"), children: [
29239
29371
  /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(FieldLabel, { field: field2, htmlFor: id, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ProvenanceBadge, { document: document2, fieldKey: field2.key }) }),
29240
29372
  whole ? (
@@ -31846,7 +31978,7 @@ function useGroupLabel(fields, groupKey, thenKeys = []) {
31846
31978
  // src/gridUndo.tsx
31847
31979
  var import_react171 = require("react");
31848
31980
  var import_react172 = require("@ai-matrx/records/react");
31849
- var import_core16 = require("@ai-matrx/records/core");
31981
+ var import_core17 = require("@ai-matrx/records/core");
31850
31982
  var import_design_system90 = require("@ai-matrx/design-system");
31851
31983
  init_plainWords();
31852
31984
  var import_data_table13 = require("@ai-matrx/design-system/data-table");
@@ -31942,7 +32074,7 @@ function useGridUndo(args) {
31942
32074
  }
31943
32075
  forget(step2.cells.map((c) => ({ rowId: c.rowId, key: c.key })));
31944
32076
  for (const id of /* @__PURE__ */ new Set([...step2.cells.map((c) => c.rowId), ...step2.created ?? [], ...step2.archived ?? []])) {
31945
- (0, import_core16.announceRecordChanged)(id);
32077
+ (0, import_core17.announceRecordChanged)(id);
31946
32078
  }
31947
32079
  setHeld(() => {
31948
32080
  let stack = taken.stack;
@@ -32239,7 +32371,7 @@ function useRowFollowsItsMove(args) {
32239
32371
  // src/gridAssist.tsx
32240
32372
  var import_clipboard5 = require("@ai-matrx/kit/clipboard");
32241
32373
  var import_react175 = require("react");
32242
- var import_core17 = require("@ai-matrx/records/core");
32374
+ var import_core18 = require("@ai-matrx/records/core");
32243
32375
  var import_workspace = require("@ai-matrx/alchemy/react/workspace");
32244
32376
 
32245
32377
  // src/gridAgentContext.ts
@@ -32371,7 +32503,7 @@ function useGridAssist(args) {
32371
32503
  const copyRecordReference = (0, import_react175.useCallback)(
32372
32504
  (rowId) => {
32373
32505
  void (async () => {
32374
- const text = JSON.stringify({ __kind: (0, import_core17.tableKindSlug)(tableId), _record_id: rowId });
32506
+ const text = JSON.stringify({ __kind: (0, import_core18.tableKindSlug)(tableId), _record_id: rowId });
32375
32507
  if (!await (0, import_clipboard5.copyText)(text)) {
32376
32508
  say2(false, "This browser did not let the page write to the clipboard.");
32377
32509
  return;
@@ -32427,7 +32559,7 @@ function useGridAssist(args) {
32427
32559
  if (!row) return;
32428
32560
  const document2 = row.document ?? {};
32429
32561
  const value = editing.valueFor(row, fieldOf2(key));
32430
- const pointer = typeof document2[key] === "string" ? (0, import_core17.wholeValueOf)(document2, key) : null;
32562
+ const pointer = typeof document2[key] === "string" ? (0, import_core18.wholeValueOf)(document2, key) : null;
32431
32563
  setWhole({ rowId, key, rowTitle: titleOf(row), value, pointer });
32432
32564
  },
32433
32565
  [rowOf, fieldOf2, titleOf, editing]
@@ -32523,7 +32655,7 @@ function useGridAssist(args) {
32523
32655
  // src/gridBulk.tsx
32524
32656
  var import_react176 = require("react");
32525
32657
  var import_react177 = require("@ai-matrx/records/react");
32526
- var import_core18 = require("@ai-matrx/records/core");
32658
+ var import_core19 = require("@ai-matrx/records/core");
32527
32659
  init_recordVersions();
32528
32660
  var import_design_system91 = require("@ai-matrx/design-system");
32529
32661
  init_names();
@@ -32592,7 +32724,7 @@ function useGridBulk(args) {
32592
32724
  return null;
32593
32725
  }
32594
32726
  for (const result of done.data ?? []) if (result.op === "update") versions.wrote(result.id, result.version);
32595
- for (const change of changes) if ("record_id" in change && change.record_id) (0, import_core18.announceRecordChanged)(change.record_id);
32727
+ for (const change of changes) if ("record_id" in change && change.record_id) (0, import_core19.announceRecordChanged)(change.record_id);
32596
32728
  return done.data;
32597
32729
  },
32598
32730
  [client, tableId, versions, reload]
@@ -33936,7 +34068,7 @@ function GridBody({
33936
34068
  }))
33937
34069
  );
33938
34070
  editing.forget(cells);
33939
- for (const u of updates) (0, import_core19.announceRecordChanged)(u.row.recordId);
34071
+ for (const u of updates) (0, import_core20.announceRecordChanged)(u.row.recordId);
33940
34072
  const lines2 = updates.length + creates.length;
33941
34073
  undo.push({ label: `Pasted ${lines2} ${lines2 === 1 ? "row" : "rows"}`, cells, created });
33942
34074
  const expected = [
@@ -34229,7 +34361,7 @@ function GridBody({
34229
34361
  const values = presetValues ? withNewRowValues(presetValues, given) : given;
34230
34362
  setAddRefused(null);
34231
34363
  if (formHosted && fields.data) {
34232
- const wouldRefuse = (0, import_core19.predictWriteRefusals)({ fields: fields.data, document: values ?? {} });
34364
+ const wouldRefuse = (0, import_core20.predictWriteRefusals)({ fields: fields.data, document: values ?? {} });
34233
34365
  if (wouldRefuse.length > 0) {
34234
34366
  setFormAsk((held) => ({ n: (held?.n ?? 0) + 1, initial: { ...values ?? {} } }));
34235
34367
  return;
@@ -36275,6 +36407,7 @@ function AddBody({ tableId }) {
36275
36407
  // src/Peek.tsx
36276
36408
  init_parity();
36277
36409
  var import_text_case14 = require("@ai-matrx/kit/text-case");
36410
+ var import_field_formats16 = require("@ai-matrx/design-system/field-formats");
36278
36411
  var import_jsx_runtime119 = require("react/jsx-runtime");
36279
36412
  function drawnBelowOnPage(field2, bodyKey) {
36280
36413
  return field2.key === bodyKey || editorKindFor(field2) === "relation";
@@ -36301,7 +36434,7 @@ function Peek({ tableId, recordId, onClose, className, onPage = false }) {
36301
36434
  const document2 = record.data?.document;
36302
36435
  if (document2 && (0, import_records51.isLockedStub)({ document: document2, level: null })) {
36303
36436
  const filed = document2["submitted_at"];
36304
- const when = typeof filed === "string" && !Number.isNaN(Date.parse(filed)) ? new Date(filed).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" }) : null;
36437
+ const when = typeof filed === "string" && !Number.isNaN(Date.parse(filed)) ? new Date(filed).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric", ...(0, import_field_formats16.momentZoneOptions)(filed) }) : null;
36305
36438
  return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("p", { className: (0, import_design_system100.cn)("text-sm text-muted-foreground", className), "data-records-locked-record": "", children: [
36306
36439
  "You can't open this record",
36307
36440
  when ? `. Filed ${when}.` : "."
@@ -36449,7 +36582,7 @@ function computedInPlainWords(row, field2) {
36449
36582
  const name = field2 ? fieldName(field2) : (0, import_text_case14.humanizeIdentifier)(row.field_key);
36450
36583
  const shown5 = row.value === null || row.value === void 0 || row.value === "" ? "nothing" : field2 ? scalarText(field2, row.value) : String(row.value);
36451
36584
  const when = new Date(row.computed_at);
36452
- const at = Number.isNaN(when.getTime()) ? "" : ` on ${when.toLocaleDateString()}`;
36585
+ const at = Number.isNaN(when.getTime()) ? "" : ` on ${when.toLocaleDateString(void 0, (0, import_field_formats16.momentZoneOptions)(when))}`;
36453
36586
  return `${name}: ${shown5}${at}`;
36454
36587
  }
36455
36588
 
@@ -36848,6 +36981,7 @@ function MigrationLog({ entries, readError, canUndo, whyNotUndo, onUndone, class
36848
36981
  }
36849
36982
 
36850
36983
  // src/HistoryPanel.tsx
36984
+ var import_field_formats17 = require("@ai-matrx/design-system/field-formats");
36851
36985
  var import_jsx_runtime123 = require("react/jsx-runtime");
36852
36986
  function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
36853
36987
  usePeopleTick();
@@ -37325,9 +37459,9 @@ function whenText(at) {
37325
37459
  if (Number.isNaN(age)) return "\u2014";
37326
37460
  if (age < 864e5) return (0, import_format9.formatRelativeTime)(then, { style: "intl" });
37327
37461
  if (age < 7 * 864e5) {
37328
- return then.toLocaleString(void 0, { weekday: "short", hour: "numeric", minute: "2-digit" });
37462
+ return then.toLocaleString(void 0, { weekday: "short", hour: "numeric", minute: "2-digit", ...(0, import_field_formats17.momentZoneOptions)(then) });
37329
37463
  }
37330
- return then.toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" });
37464
+ return then.toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric", ...(0, import_field_formats17.momentZoneOptions)(then) });
37331
37465
  }
37332
37466
  function say(value, field2) {
37333
37467
  if (value === null || value === void 0 || value === "") return "nothing";
@@ -39020,7 +39154,7 @@ var import_clipboard7 = require("@ai-matrx/kit/clipboard");
39020
39154
  var import_download2 = require("@ai-matrx/kit/download");
39021
39155
  var import_react220 = require("react");
39022
39156
  var import_react221 = require("@ai-matrx/records/react");
39023
- var import_core20 = require("@ai-matrx/records/core");
39157
+ var import_core21 = require("@ai-matrx/records/core");
39024
39158
  init_host();
39025
39159
 
39026
39160
  // src/viewExport.ts
@@ -39080,30 +39214,6 @@ var import_design_system111 = require("@ai-matrx/design-system");
39080
39214
  init_Refusal();
39081
39215
  init_refusals();
39082
39216
  var import_jsx_runtime131 = require("react/jsx-runtime");
39083
- function toRows(fields, records, labels) {
39084
- return records.map((record) => {
39085
- const document2 = record.document ?? {};
39086
- const envelopes = document2["_values"] ?? {};
39087
- const row = {};
39088
- for (const field2 of fields) {
39089
- const envelope = envelopes[field2.key];
39090
- const withheld = withheldNoticeOf(record.hidden, field2.key);
39091
- const held = withheld && (document2[field2.key] ?? null) === null;
39092
- row[field2.key] = {
39093
- field_key: field2.key,
39094
- value: held ? `${WITHHELD_WORD}: ${withheldSentence(field2, withheld)}` : (
39095
- // A drawn signature reads "Signed" here through the same resolver copy uses (`shownValue`).
39096
- shownValue(field2, document2[field2.key] ?? null, labels)
39097
- ),
39098
- absent_reason: envelope?.absent ?? null,
39099
- // A VALUE KEPT AS A FILE carries its pointer, so the export writes the whole text
39100
- // (`withWholeValues`), never the first words passed off as the value.
39101
- source: (0, import_core20.wholeValueOf)(document2, field2.key)
39102
- };
39103
- }
39104
- return row;
39105
- });
39106
- }
39107
39217
  function fileNameOf(name) {
39108
39218
  return name.replace(/[\\/:*?"<>|\u0000-\u001f]+/g, " ").replace(/\s+/g, " ").trim();
39109
39219
  }
@@ -39129,7 +39239,7 @@ async function rowsForFile(args) {
39129
39239
  );
39130
39240
  const lookup = ((field2, id) => labels(field2, id) ?? learned.get(`${field2.id}:${id}`) ?? null);
39131
39241
  const read = host.readFileText;
39132
- return (0, import_core20.withWholeValues)(toRows(all, records, lookup), read ? (fileId) => read({ fileId }) : null);
39242
+ return (0, import_core21.withWholeValues)(toRows(all, records, lookup), read ? (fileId) => read({ fileId }) : null);
39133
39243
  }
39134
39244
  function ExportMenu({ tableId, rows, label, className, view }) {
39135
39245
  const client = (0, import_react221.useRecordsClient)();
@@ -39185,7 +39295,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
39185
39295
  {
39186
39296
  size: "sm",
39187
39297
  variant: "outline",
39188
- onClick: () => void exported().then((rows2) => download(`${name}.csv`, "text/csv;charset=utf-8", (0, import_core20.exportCsv)(columns, rows2))).catch(
39298
+ onClick: () => void exported().then((rows2) => download(`${name}.csv`, "text/csv;charset=utf-8", fileCsv(columns, rows2))).catch(
39189
39299
  (thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The CSV could not be written.", "Try again in a moment."))
39190
39300
  ),
39191
39301
  children: "CSV"
@@ -39206,7 +39316,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
39206
39316
  );
39207
39317
  setFailure(null);
39208
39318
  try {
39209
- exported().then((rows2) => (0, import_core20.exportXlsx)(columns, rows2, name)).then(
39319
+ exported().then((rows2) => fileXlsx(columns, rows2, name)).then(
39210
39320
  (bytes) => download(
39211
39321
  `${name}.xlsx`,
39212
39322
  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
@@ -39225,7 +39335,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
39225
39335
  {
39226
39336
  size: "sm",
39227
39337
  variant: "outline",
39228
- onClick: () => void exported().then((rows2) => download(`${name}.md`, "text/markdown;charset=utf-8", (0, import_core20.exportMarkdown)(columns, rows2))).catch(
39338
+ onClick: () => void exported().then((rows2) => download(`${name}.md`, "text/markdown;charset=utf-8", fileMarkdown(columns, rows2))).catch(
39229
39339
  (thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The Markdown could not be written.", "The CSV beside this button carries the same rows."))
39230
39340
  ),
39231
39341
  children: "Markdown"
@@ -39237,7 +39347,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
39237
39347
  size: "sm",
39238
39348
  variant: "outline",
39239
39349
  onClick: () => void exported().then(async (rows2) => {
39240
- if (await (0, import_clipboard7.copyText)((0, import_core20.exportMarkdown)(columns, rows2))) host.notify?.success("Markdown copied");
39350
+ if (await (0, import_clipboard7.copyText)(fileMarkdown(columns, rows2))) host.notify?.success("Markdown copied");
39241
39351
  else host.notify?.error("Couldn\u2019t copy the Markdown");
39242
39352
  }).catch(
39243
39353
  (thrown) => setFailure((0, refusals_exports.refusalFromThrown)(thrown, "The Markdown could not be written.", "The CSV beside this button carries the same rows."))
@@ -39271,7 +39381,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
39271
39381
  sourceId: `records:${tableId}`,
39272
39382
  size: "xs",
39273
39383
  json: () => records.map((r) => r.document),
39274
- human: () => (0, import_core20.exportCsv)(columns, toRows(columns, records, labels))
39384
+ human: () => fileCsv(columns, toRows(columns, records, labels))
39275
39385
  }
39276
39386
  ),
39277
39387
  viewHeld && "rows" in viewHeld && viewHeld.cut ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { className: "text-xs text-muted-foreground", children: cutWords(viewHeld.rows.length) }) : null,
@@ -41981,7 +42091,8 @@ function instant(value) {
41981
42091
  const at = value instanceof Date ? value : new Date(value);
41982
42092
  return Number.isNaN(at.getTime()) ? null : at;
41983
42093
  }
41984
- function minuteOfDay(at) {
42094
+ function minuteOfDay(instantAt) {
42095
+ const at = personWallNow(instantAt);
41985
42096
  return at.getHours() * 60 + at.getMinutes();
41986
42097
  }
41987
42098
  function timeLabel(minutes) {
@@ -41997,15 +42108,16 @@ function rescheduledValue(before, toDay, toMinute, moments = false) {
41997
42108
  if (toMinute !== null) {
41998
42109
  const at = dayDate(toDay);
41999
42110
  at.setHours(0, toMinute, 0, 0);
42000
- return at.toISOString();
42111
+ return instantFromPersonWall(at).toISOString();
42001
42112
  }
42002
42113
  const was = instant(before);
42003
42114
  if (was) {
42004
42115
  const at = dayDate(toDay);
42005
- at.setHours(was.getHours(), was.getMinutes(), was.getSeconds(), was.getMilliseconds());
42006
- return at.toISOString();
42116
+ const wasWall = personWallNow(was);
42117
+ at.setHours(wasWall.getHours(), wasWall.getMinutes(), wasWall.getSeconds(), wasWall.getMilliseconds());
42118
+ return instantFromPersonWall(at).toISOString();
42007
42119
  }
42008
- return moments ? dayDate(toDay).toISOString() : toDay;
42120
+ return moments ? instantFromPersonWall(dayDate(toDay)).toISOString() : toDay;
42009
42121
  }
42010
42122
  function shiftedEnd(end, startBefore, startAfter) {
42011
42123
  if (end === null || end === void 0 || end === "") return null;
@@ -42385,7 +42497,7 @@ function CalendarView({
42385
42497
  at.setHours(0, from, 0, 0);
42386
42498
  const end = new Date(dayDate(day2).getTime());
42387
42499
  end.setHours(0, to, 0, 0);
42388
- void createAt(at.toISOString(), end.toISOString(), `${calendarDayLabel(day2)}, ${timeLabel(from)}`);
42500
+ void createAt(instantFromPersonWall(at).toISOString(), instantFromPersonWall(end).toISOString(), `${calendarDayLabel(day2)}, ${timeLabel(from)}`);
42389
42501
  };
42390
42502
  window.addEventListener("pointermove", onMove);
42391
42503
  window.addEventListener("pointerup", onUp);
@@ -44676,7 +44788,7 @@ var import_design_system130 = require("@ai-matrx/design-system");
44676
44788
  var import_react265 = require("react");
44677
44789
  var import_recharts = require("recharts");
44678
44790
  var import_records57 = require("@ai-matrx/records");
44679
- var import_core21 = require("@ai-matrx/records/core");
44791
+ var import_core22 = require("@ai-matrx/records/core");
44680
44792
  var import_design_system129 = require("@ai-matrx/design-system");
44681
44793
  var import_format11 = require("@ai-matrx/kit/format");
44682
44794
  init_Refusal();
@@ -45031,7 +45143,7 @@ function useMeasureWords(key, tableId) {
45031
45143
 
45032
45144
  // src/chartFormat.tsx
45033
45145
  var import_react263 = require("react");
45034
- var import_field_formats11 = require("@ai-matrx/design-system/field-formats");
45146
+ var import_field_formats18 = require("@ai-matrx/design-system/field-formats");
45035
45147
  var NUMERIC_LOOKS = /* @__PURE__ */ new Set(["number", "decimal", "currency", "percent", "integer", "progress"]);
45036
45148
  function chartFormatFor(measureKey7, fields) {
45037
45149
  const at = measureKey7.indexOf("_");
@@ -45044,7 +45156,7 @@ function chartFormatFor(measureKey7, fields) {
45044
45156
  if (!look || !NUMERIC_LOOKS.has(look.id)) return null;
45045
45157
  if (look.id === "number" && (!look.options || Object.keys(look.options).length === 0)) return null;
45046
45158
  const full = (n) => {
45047
- const said2 = (0, import_field_formats11.formatFieldValue)(n, look);
45159
+ const said2 = (0, import_field_formats18.formatFieldValue)(n, look);
45048
45160
  return said2.ok && said2.text !== "" ? said2.text : String(n);
45049
45161
  };
45050
45162
  const options = look.options ?? {};
@@ -45237,7 +45349,7 @@ function prettyPlain(n) {
45237
45349
  return Number.isInteger(n) ? n.toLocaleString() : n.toLocaleString(void 0, { maximumFractionDigits: 2 });
45238
45350
  }
45239
45351
  function asRefusal2(block) {
45240
- return (0, import_core21.mapPgError)(
45352
+ return (0, import_core22.mapPgError)(
45241
45353
  {
45242
45354
  message: block.refused ?? "",
45243
45355
  ...block.sqlstate ? { code: block.sqlstate } : {}
@@ -48523,7 +48635,7 @@ var import_react279 = require("react");
48523
48635
  var import_react280 = require("@ai-matrx/records/react");
48524
48636
  var import_design_system137 = require("@ai-matrx/design-system");
48525
48637
  var import_controls7 = require("@ai-matrx/design-system/controls");
48526
- var import_core22 = require("@dnd-kit/core");
48638
+ var import_core23 = require("@dnd-kit/core");
48527
48639
  var import_sortable = require("@dnd-kit/sortable");
48528
48640
  var import_utilities = require("@dnd-kit/utilities");
48529
48641
  init_Refusal();
@@ -48605,7 +48717,7 @@ function seedIsSatisfied(seed, views) {
48605
48717
  return seed.isDefault === true && views.some((v) => v.isDefault);
48606
48718
  }
48607
48719
  function SectionBox({ id, children, ...rest }) {
48608
- const { setNodeRef, isOver } = (0, import_core22.useDroppable)({ id });
48720
+ const { setNodeRef, isOver } = (0, import_core23.useDroppable)({ id });
48609
48721
  return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)("div", { ref: setNodeRef, className: (0, import_design_system137.cn)("rounded-sm", isOver && "bg-accent/40"), ...rest, children });
48610
48722
  }
48611
48723
  function SortableRow({ id, disabled, children }) {
@@ -48660,7 +48772,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
48660
48772
  const [renamingSection, setRenamingSection] = (0, import_react279.useState)(null);
48661
48773
  const [dragging, setDragging] = (0, import_react279.useState)(false);
48662
48774
  const justDragged = (0, import_react279.useRef)(false);
48663
- const sensors = (0, import_core22.useSensors)((0, import_core22.useSensor)(import_core22.PointerSensor, { activationConstraint: { distance: 6 } }));
48775
+ const sensors = (0, import_core23.useSensors)((0, import_core23.useSensor)(import_core23.PointerSensor, { activationConstraint: { distance: 6 } }));
48664
48776
  async function dropped(event) {
48665
48777
  setDragging(false);
48666
48778
  justDragged.current = true;
@@ -48915,7 +49027,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
48915
49027
  ) }),
48916
49028
  /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(import_design_system137.PopoverContent, { sizing: "content", align: "start", className: "w-64 p-1", "data-view-picker-content": "", children: [
48917
49029
  /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)("div", { role: "group", "aria-label": "Saved views", className: "flex max-h-[50dvh] flex-col overflow-y-auto", children: [
48918
- /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(import_core22.DndContext, { sensors, collisionDetection: import_core22.closestCenter, onDragStart: () => setDragging(true), onDragCancel: () => setDragging(false), onDragEnd: (e) => void dropped(e), children: (() => {
49030
+ /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(import_core23.DndContext, { sensors, collisionDetection: import_core23.closestCenter, onDragStart: () => setDragging(true), onDragCancel: () => setDragging(false), onDragEnd: (e) => void dropped(e), children: (() => {
48919
49031
  const groups = (0, import_views2.groupViewsBySection)(views);
48920
49032
  return groups.some((g) => g.name === null) || !dragging ? groups : [{ name: null, views: [] }, ...groups];
48921
49033
  })().map((group) => /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(SectionBox, { id: (0, import_views2.sectionDropId)(group.name), role: "group", "aria-label": group.name ?? "Views", "data-view-section": group.name ?? "", children: [
@@ -49240,6 +49352,7 @@ var import_data_table24 = require("@ai-matrx/design-system/data-table");
49240
49352
  var import_format13 = require("@ai-matrx/kit/format");
49241
49353
  init_Refusal();
49242
49354
  init_enumLabels();
49355
+ var import_field_formats19 = require("@ai-matrx/design-system/field-formats");
49243
49356
  var import_jsx_runtime162 = require("react/jsx-runtime");
49244
49357
  var ACTION_KINDS = ["approval", "assignment", "proposal"];
49245
49358
  var KIND_WORD2 = WORK_INBOX_KIND_LABEL;
@@ -49283,7 +49396,7 @@ function groupInbox(items, by) {
49283
49396
  function whenWords2(iso) {
49284
49397
  const d = new Date(iso);
49285
49398
  if (Number.isNaN(d.getTime())) return iso;
49286
- return d.toLocaleString(void 0, { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" });
49399
+ return d.toLocaleString(void 0, { month: "short", day: "numeric", hour: "numeric", minute: "2-digit", ...(0, import_field_formats19.momentZoneOptions)(d) });
49287
49400
  }
49288
49401
  var HOLD_STORE = "records-ui:held-decisions";
49289
49402
  function readHolds() {
@@ -52562,7 +52675,7 @@ var import_drafts = require("@ai-matrx/kit/drafts");
52562
52675
  var import_design_system151 = require("@ai-matrx/design-system");
52563
52676
  var import_controls10 = require("@ai-matrx/design-system/controls");
52564
52677
  var import_react303 = require("react");
52565
- var import_core23 = require("@dnd-kit/core");
52678
+ var import_core24 = require("@dnd-kit/core");
52566
52679
  var import_sortable2 = require("@dnd-kit/sortable");
52567
52680
  var import_utilities2 = require("@dnd-kit/utilities");
52568
52681
  var import_react304 = require("@ai-matrx/records/react");
@@ -53521,6 +53634,7 @@ init_plainWords();
53521
53634
  init_publicQuestions();
53522
53635
  var import_forms3 = require("@ai-matrx/records/forms");
53523
53636
  var import_outbound_react8 = require("@ai-matrx/kit/outbound-react");
53637
+ var import_field_formats20 = require("@ai-matrx/design-system/field-formats");
53524
53638
  var import_jsx_runtime174 = require("react/jsx-runtime");
53525
53639
  function freshFormName(base2, taken) {
53526
53640
  const names2 = new Set(taken.map((n) => n.trim().toLowerCase()));
@@ -53889,7 +54003,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
53889
54003
  /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)("span", { children: [
53890
54004
  "Unsaved changes from",
53891
54005
  " ",
53892
- new Date(restoredAt).toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short" }),
54006
+ new Date(restoredAt).toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short", ...(0, import_field_formats20.momentZoneOptions)(restoredAt) }),
53893
54007
  " restored"
53894
54008
  ] }),
53895
54009
  /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
@@ -54214,9 +54328,9 @@ function QuestionList({
54214
54328
  onQuestions,
54215
54329
  onQuestion
54216
54330
  }) {
54217
- const sensors = (0, import_core23.useSensors)(
54218
- (0, import_core23.useSensor)(import_core23.PointerSensor, { activationConstraint: { distance: 4 } }),
54219
- (0, import_core23.useSensor)(import_core23.KeyboardSensor, { coordinateGetter: import_sortable2.sortableKeyboardCoordinates })
54331
+ const sensors = (0, import_core24.useSensors)(
54332
+ (0, import_core24.useSensor)(import_core24.PointerSensor, { activationConstraint: { distance: 4 } }),
54333
+ (0, import_core24.useSensor)(import_core24.KeyboardSensor, { coordinateGetter: import_sortable2.sortableKeyboardCoordinates })
54220
54334
  );
54221
54335
  const askable = askableFields([...fields]);
54222
54336
  const unasked = askable.filter((f) => !draft.questions.some((q) => q.field === f.key));
@@ -54238,7 +54352,7 @@ function QuestionList({
54238
54352
  /* @__PURE__ */ (0, import_jsx_runtime174.jsx)("span", { className: "font-medium text-foreground", children: "Questions" }),
54239
54353
  /* @__PURE__ */ (0, import_jsx_runtime174.jsx)("span", { className: "tabular-nums", children: draft.questions.length })
54240
54354
  ] }),
54241
- /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(import_core23.DndContext, { sensors, collisionDetection: import_core23.closestCenter, onDragEnd: dragEnd, children: /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(import_sortable2.SortableContext, { items: draft.questions.map((q) => q.field), strategy: import_sortable2.verticalListSortingStrategy, children: draft.questions.map((question, index) => /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
54355
+ /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(import_core24.DndContext, { sensors, collisionDetection: import_core24.closestCenter, onDragEnd: dragEnd, children: /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(import_sortable2.SortableContext, { items: draft.questions.map((q) => q.field), strategy: import_sortable2.verticalListSortingStrategy, children: draft.questions.map((question, index) => /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
54242
54356
  QuestionRow,
54243
54357
  {
54244
54358
  index,
@@ -55097,7 +55211,7 @@ init_Refusal();
55097
55211
  init_host();
55098
55212
 
55099
55213
  // src/DashboardGrid.tsx
55100
- var import_core24 = require("@dnd-kit/core");
55214
+ var import_core25 = require("@dnd-kit/core");
55101
55215
  var import_sortable3 = require("@dnd-kit/sortable");
55102
55216
  var import_utilities3 = require("@dnd-kit/utilities");
55103
55217
  var import_design_system156 = require("@ai-matrx/design-system");
@@ -55154,7 +55268,7 @@ function withBlockIds(blocks) {
55154
55268
  // src/DashboardGrid.tsx
55155
55269
  var import_jsx_runtime178 = require("react/jsx-runtime");
55156
55270
  var dashboardCollision = (args) => {
55157
- const under = (0, import_core24.pointerWithin)(args);
55271
+ const under = (0, import_core25.pointerWithin)(args);
55158
55272
  if (under.length > 0) return under;
55159
55273
  const at = args.collisionRect;
55160
55274
  return args.droppableContainers.flatMap((container) => {
@@ -55164,9 +55278,9 @@ var dashboardCollision = (args) => {
55164
55278
  }).sort((a, b) => a.data.value - b.data.value);
55165
55279
  };
55166
55280
  function DashboardGrid({ items, arranging, onMove, onSpan }) {
55167
- const sensors = (0, import_core24.useSensors)(
55168
- (0, import_core24.useSensor)(import_core24.PointerSensor, { activationConstraint: { distance: 4 } }),
55169
- (0, import_core24.useSensor)(import_core24.KeyboardSensor, { coordinateGetter: import_sortable3.sortableKeyboardCoordinates })
55281
+ const sensors = (0, import_core25.useSensors)(
55282
+ (0, import_core25.useSensor)(import_core25.PointerSensor, { activationConstraint: { distance: 4 } }),
55283
+ (0, import_core25.useSensor)(import_core25.KeyboardSensor, { coordinateGetter: import_sortable3.sortableKeyboardCoordinates })
55170
55284
  );
55171
55285
  const ids = items.map((item) => item.id);
55172
55286
  function dragEnd(event) {
@@ -55176,7 +55290,7 @@ function DashboardGrid({ items, arranging, onMove, onSpan }) {
55176
55290
  }
55177
55291
  const grid = /* @__PURE__ */ (0, import_jsx_runtime178.jsx)("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-12", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(GridCell2, { item, index, arranging, onSpan }, item.id)) });
55178
55292
  if (!arranging) return grid;
55179
- return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(import_core24.DndContext, { sensors, collisionDetection: dashboardCollision, onDragEnd: dragEnd, children: /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(import_sortable3.SortableContext, { items: ids, strategy: import_sortable3.rectSortingStrategy, children: grid }) });
55293
+ return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(import_core25.DndContext, { sensors, collisionDetection: dashboardCollision, onDragEnd: dragEnd, children: /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(import_sortable3.SortableContext, { items: ids, strategy: import_sortable3.rectSortingStrategy, children: grid }) });
55180
55294
  }
55181
55295
  function GridCell2({
55182
55296
  item,
@@ -57290,7 +57404,7 @@ init_host();
57290
57404
  // src/PageCanvas.tsx
57291
57405
  var import_react320 = require("react");
57292
57406
  var import_react321 = require("@ai-matrx/records/react");
57293
- var import_core25 = require("@ai-matrx/records/core");
57407
+ var import_core26 = require("@ai-matrx/records/core");
57294
57408
  var import_download3 = require("@ai-matrx/kit/download");
57295
57409
  var import_format14 = require("@ai-matrx/kit/format");
57296
57410
  var import_design_system161 = require("@ai-matrx/design-system");
@@ -57375,7 +57489,7 @@ function useDoorRows(door, elementId, recordId) {
57375
57489
  );
57376
57490
  }
57377
57491
  function downloadCsv(name, fields, rows) {
57378
- (0, import_download3.downloadFile)(`${fileNameOf(name) || "export"}.csv`, (0, import_core25.exportCsv)(fields, toRows(fields, rows)), "text/csv");
57492
+ (0, import_download3.downloadFile)(`${fileNameOf(name) || "export"}.csv`, fileCsv(fields, toRows(fields, rows)), "text/csv");
57379
57493
  }
57380
57494
  function CsvButton({ name, fields, rows }) {
57381
57495
  if (rows.length === 0) return null;
@@ -57528,7 +57642,7 @@ function useMemberRows(block, viewerUserId, extra, mineOn, enabled) {
57528
57642
  ...q.sort.length > 0 ? { sort: q.sort } : {}
57529
57643
  });
57530
57644
  const reload = page.reload;
57531
- (0, import_react320.useEffect)(() => (0, import_core25.onRecordChanged)(() => reload()), [reload]);
57645
+ (0, import_react320.useEffect)(() => (0, import_core26.onRecordChanged)(() => reload()), [reload]);
57532
57646
  return { q, page };
57533
57647
  }
57534
57648
  function BlockBody(inner2) {
@@ -58457,7 +58571,7 @@ function onePerKey3(all) {
58457
58571
  }
58458
58572
 
58459
58573
  // src/printPage.ts
58460
- var import_core26 = require("@ai-matrx/print/core");
58574
+ var import_core27 = require("@ai-matrx/print/core");
58461
58575
  var PAGE_PRINT_STYLES = `
58462
58576
  .page-print-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
58463
58577
  .page-print-grid > * { grid-column: span 12; break-inside: avoid; }
@@ -58468,7 +58582,7 @@ function printRecordsPage(element, title) {
58468
58582
  const copy = element.cloneNode(true);
58469
58583
  copy.querySelectorAll("button, input, select, textarea, iframe, [data-records-page-settings], [data-records-page-csv]").forEach((n) => n.remove());
58470
58584
  copy.classList.add("page-print-grid");
58471
- return (0, import_core26.openPrintWindow)((0, import_core26.buildPrintDocument)(`<h1>${escapeText2(title)}</h1>${copy.innerHTML}`, title, PAGE_PRINT_STYLES), title);
58585
+ return (0, import_core27.openPrintWindow)((0, import_core27.buildPrintDocument)(`<h1>${escapeText2(title)}</h1>${copy.innerHTML}`, title, PAGE_PRINT_STYLES), title);
58472
58586
  }
58473
58587
  function escapeText2(text) {
58474
58588
  return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
@@ -59231,6 +59345,7 @@ var import_design_system165 = require("@ai-matrx/design-system");
59231
59345
  init_host();
59232
59346
  init_Refusal();
59233
59347
  init_refusals();
59348
+ var import_field_formats21 = require("@ai-matrx/design-system/field-formats");
59234
59349
  var import_jsx_runtime187 = require("react/jsx-runtime");
59235
59350
  function controlFor(field2) {
59236
59351
  if (!field2) return "text";
@@ -59434,7 +59549,7 @@ function CaptureRun({ sheetId, face: given, className }) {
59434
59549
  counts.refused,
59435
59550
  " to fix"
59436
59551
  ] }) : null,
59437
- /* @__PURE__ */ (0, import_jsx_runtime187.jsx)("span", { className: "ml-auto", "data-testid": "capture-last-synced", children: lastSynced ? `Last synced ${new Date(lastSynced).toLocaleTimeString()}` : "Not synced yet" }),
59552
+ /* @__PURE__ */ (0, import_jsx_runtime187.jsx)("span", { className: "ml-auto", "data-testid": "capture-last-synced", children: lastSynced ? `Last synced ${new Date(lastSynced).toLocaleTimeString(void 0, (0, import_field_formats21.momentZoneOptions)(lastSynced))}` : "Not synced yet" }),
59438
59553
  waiting > 0 || counts.refused > 0 ? /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(
59439
59554
  import_design_system165.Button,
59440
59555
  {
@@ -59449,7 +59564,7 @@ function CaptureRun({ sheetId, face: given, className }) {
59449
59564
  ) : null
59450
59565
  ] });
59451
59566
  const queuePanel = items.filter((i) => i.state !== "landed").length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime187.jsx)("ul", { className: "flex flex-col gap-1 rounded border p-2", "data-testid": "capture-queue", children: items.filter((i) => i.state !== "landed").map((i) => /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)("li", { className: "flex items-start gap-2 text-[11px]", children: [
59452
- /* @__PURE__ */ (0, import_jsx_runtime187.jsx)("span", { className: "tabular-nums text-muted-foreground", children: new Date(i.captured_at).toLocaleTimeString() }),
59567
+ /* @__PURE__ */ (0, import_jsx_runtime187.jsx)("span", { className: "tabular-nums text-muted-foreground", children: new Date(i.captured_at).toLocaleTimeString(void 0, (0, import_field_formats21.momentZoneOptions)(i.captured_at)) }),
59453
59568
  i.state === "refused" ? (
59454
59569
  // THE STORE REFUSED THIS ONE: a refusal line, heading and remedy
59455
59570
  // both — never its raw words in red (lane REFUSAL-SWEEP).
@@ -59633,6 +59748,7 @@ function CaptureRun({ sheetId, face: given, className }) {
59633
59748
  }
59634
59749
 
59635
59750
  // src/CaptureSheet.tsx
59751
+ var import_field_formats22 = require("@ai-matrx/design-system/field-formats");
59636
59752
  var import_jsx_runtime188 = require("react/jsx-runtime");
59637
59753
  var CAPTURE_MODES = ["reading", "photo", "voice"];
59638
59754
  var IN_MEMORY_QUEUE_REASON = "Anything you capture while offline is held only in this page until it can be sent, and it is lost if you close the tab. Keep this page open until you are back on a connection. It is said here rather than discovered later.";
@@ -59861,7 +59977,7 @@ function AdHocCaptureSheet({
59861
59977
  )
59862
59978
  ] }),
59863
59979
  /* @__PURE__ */ (0, import_jsx_runtime188.jsx)("ul", { className: "flex flex-col gap-0.5", children: pending.map((item) => /* @__PURE__ */ (0, import_jsx_runtime188.jsxs)("li", { className: "text-[11px] text-muted-foreground", children: [
59864
- new Date(item.capturedAt).toLocaleTimeString(),
59980
+ new Date(item.capturedAt).toLocaleTimeString(void 0, (0, import_field_formats22.momentZoneOptions)(item.capturedAt)),
59865
59981
  " \xB7 ",
59866
59982
  item.attempts,
59867
59983
  " tried",
@@ -60333,9 +60449,8 @@ function CalendarSubscribeDialog({
60333
60449
 
60334
60450
  // src/viewShare.ts
60335
60451
  var import_clipboard15 = require("@ai-matrx/kit/clipboard");
60336
- var import_core27 = require("@ai-matrx/print/core");
60452
+ var import_core28 = require("@ai-matrx/print/core");
60337
60453
  var import_markdown = require("@ai-matrx/print/markdown");
60338
- var import_core28 = require("@ai-matrx/records/core");
60339
60454
  init_objectActions();
60340
60455
  var NO_VIEW_REASON = "No saved view yet";
60341
60456
  function viewLink(tableId, viewId, origin) {
@@ -60372,7 +60487,7 @@ async function downloadViewCsv(args) {
60372
60487
  const columns = viewColumns(fields, view.presentation);
60373
60488
  const rows = await rowsForFile({ client, host, fields: columns, records: read.rows, labels });
60374
60489
  const name = fileNameOf(args.tableName) || "records";
60375
- download(`${name}.csv`, "text/csv;charset=utf-8", (0, import_core28.exportCsv)(columns, rows));
60490
+ download(`${name}.csv`, "text/csv;charset=utf-8", fileCsv(columns, rows));
60376
60491
  host.notify?.success(read.cut ? cutWords(read.rows.length) : "CSV downloaded");
60377
60492
  }
60378
60493
  function downloadMarkdownAction(args) {
@@ -60401,7 +60516,7 @@ async function readViewMarkdown(args) {
60401
60516
  if ("error" in read) return null;
60402
60517
  const columns = viewColumns(fields, view.presentation);
60403
60518
  const rows = await rowsForFile({ client, host, fields: columns, records: read.rows, labels });
60404
- return { markdown: (0, import_core28.exportMarkdown)(columns, rows), cut: read.cut, count: read.rows.length };
60519
+ return { markdown: fileMarkdown(columns, rows), cut: read.cut, count: read.rows.length };
60405
60520
  }
60406
60521
  async function downloadViewMarkdown(args) {
60407
60522
  const table = await readViewMarkdown(args);
@@ -60459,7 +60574,7 @@ async function runTablePageAction(kind2, args) {
60459
60574
  }
60460
60575
  const page = (0, import_markdown.renderMarkdownDocument)(markdown, { title, withPrintActions: kind2 === "html-preview" });
60461
60576
  if (kind2 === "html-preview") {
60462
- (0, import_core27.openPrintWindow)(page, title);
60577
+ (0, import_core28.openPrintWindow)(page, title);
60463
60578
  if (note) args.host.notify?.success(note);
60464
60579
  } else if (kind2 === "copy-html-page") {
60465
60580
  if (await (0, import_clipboard15.copyText)(page)) args.host.notify?.success(note ?? "HTML page copied");
@@ -63591,8 +63706,9 @@ var import_react358 = require("react");
63591
63706
  init_Refusal();
63592
63707
  var import_versions2 = require("@ai-matrx/records/versions");
63593
63708
  var import_design_system182 = require("@ai-matrx/design-system");
63709
+ var import_field_formats23 = require("@ai-matrx/design-system/field-formats");
63594
63710
  var import_jsx_runtime206 = require("react/jsx-runtime");
63595
- var day = (iso) => iso ? new Date(iso).toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" }) : null;
63711
+ var day = (iso) => iso ? new Date(iso).toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric", ...(0, import_field_formats23.momentZoneOptions)(iso) }) : null;
63596
63712
  function CalendarLinks({ port }) {
63597
63713
  const [rows, setRows] = (0, import_react358.useState)(null);
63598
63714
  const [error, setError] = (0, import_react358.useState)(null);
@@ -63760,7 +63876,7 @@ var import_field_kinds9 = require("@ai-matrx/records/field-kinds");
63760
63876
  var import_react364 = require("@ai-matrx/records/react");
63761
63877
  var import_design_system184 = require("@ai-matrx/design-system");
63762
63878
  var import_icons3 = require("@ai-matrx/design-system/icons");
63763
- var import_field_formats12 = require("@ai-matrx/design-system/field-formats");
63879
+ var import_field_formats24 = require("@ai-matrx/design-system/field-formats");
63764
63880
  var import_controls14 = require("@ai-matrx/design-system/controls");
63765
63881
  init_names();
63766
63882
  init_plainWords();
@@ -64179,7 +64295,7 @@ function ValueCell({
64179
64295
  const withheld = row.hidden?.[field2.key] ?? null;
64180
64296
  if (withheld) return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(RecordValue, { field: field2, value: null, withheld });
64181
64297
  if (format?.id === "color_pair") {
64182
- const pair = (0, import_field_formats12.readColorPair)(value) ?? null;
64298
+ const pair = (0, import_field_formats24.readColorPair)(value) ?? null;
64183
64299
  const contrast = pair ? colorPairContrast(pair, format, context) : {};
64184
64300
  return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)("div", { className: stacked ? "flex min-w-0 flex-col gap-1.5" : "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
64185
64301
  const side = part === "light" ? pair?.light : pair?.dark ?? void 0;
@@ -64209,13 +64325,13 @@ function ValueCell({
64209
64325
  }) });
64210
64326
  }
64211
64327
  if (format?.id === "shadow") {
64212
- const pair = (0, import_field_formats12.readShadowPair)(value);
64328
+ const pair = (0, import_field_formats24.readShadowPair)(value);
64213
64329
  const ownDark = typeof value === "string" && value.includes('"dark"');
64214
64330
  const pack = (l) => l.length === 1 ? l[0] : { layers: l };
64215
64331
  const write = (light, dark) => change(JSON.stringify(dark ? { light: pack(light), dark: pack(dark) } : pack(light)));
64216
64332
  return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)("div", { className: stacked ? "flex min-w-0 flex-col gap-1.5" : "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
64217
64333
  const layers = pair ? pair[part] : null;
64218
- const words2 = !layers ? "Set" : part === "dark" && !ownDark ? "Same as light" : (0, import_field_formats12.shadowWords)(layers);
64334
+ const words2 = !layers ? "Set" : part === "dark" && !ownDark ? "Same as light" : (0, import_field_formats24.shadowWords)(layers);
64219
64335
  const inner2 = /* @__PURE__ */ (0, import_jsx_runtime209.jsxs)("span", { className: "flex min-w-0 items-center gap-2", children: [
64220
64336
  layers ? /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(ShadowSwatch, { layers, theme: part }) : null,
64221
64337
  /* @__PURE__ */ (0, import_jsx_runtime209.jsx)("span", { className: (0, import_design_system184.cn)("truncate text-xs", part === "dark" && !ownDark ? "text-muted-foreground" : "text-foreground"), children: words2 })
@@ -64307,14 +64423,14 @@ function resolveReadsOn(row, rows, keys) {
64307
64423
  if (matches2.length === 0) return { on, problem: "missing", target: null };
64308
64424
  if (matches2.length > 1) return { on, problem: "duplicate", target: null };
64309
64425
  const target = matches2[0];
64310
- if (keys.color && !(0, import_field_formats12.readColorPair)((target.document ?? {})[keys.color])) return { on, problem: "no-colour", target };
64426
+ if (keys.color && !(0, import_field_formats24.readColorPair)((target.document ?? {})[keys.color])) return { on, problem: "no-colour", target };
64311
64427
  return { on, problem: null, target };
64312
64428
  }
64313
64429
  function groundOf(row, rows, keys) {
64314
64430
  if (!keys.readsOn || !keys.name || !keys.color) return {};
64315
64431
  const { on, problem, target } = resolveReadsOn(row, rows, keys);
64316
64432
  if (!on || problem || !target) return { ground: null };
64317
- const pair = (0, import_field_formats12.readColorPair)((target.document ?? {})[keys.color]);
64433
+ const pair = (0, import_field_formats24.readColorPair)((target.document ?? {})[keys.color]);
64318
64434
  return pair ? { ground: { light: pair.light, dark: pair.dark ?? pair.light, label: on } } : { ground: null };
64319
64435
  }
64320
64436
  function RowComments({ tableId, row, count, onClosed }) {