@ai-matrx/records-ui 0.93.7 → 0.93.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2752,7 +2752,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
2752
2752
  if (refusal2)
2753
2753
  return /* @__PURE__ */ jsx12("div", { id, children: /* @__PURE__ */ jsx12(RefusalLine, { error: refusal2 }) });
2754
2754
  if (!options) return /* @__PURE__ */ jsx12("p", { id, className: "text-xs text-muted-foreground", children: "Reading this field's choices\u2026" });
2755
- if (CHOICE_EDITOR_ADDS_WHAT_IS_TYPED && allowsOtherValues(field2)) {
2755
+ if (CHOICE_EDITOR_ADDS_WHAT_IS_TYPED && (allowsOtherValues(field2) || !autoOpen)) {
2756
2756
  return /* @__PURE__ */ jsx12(
2757
2757
  OpenChoicePicker,
2758
2758
  {
@@ -2763,6 +2763,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
2763
2763
  disabled,
2764
2764
  id,
2765
2765
  addsChoices,
2766
+ allowOther: allowsOtherValues(field2),
2766
2767
  onChoicesChanged: () => setReread((n) => n + 1)
2767
2768
  }
2768
2769
  );
@@ -2835,6 +2836,7 @@ function OpenChoicePicker({
2835
2836
  disabled,
2836
2837
  id,
2837
2838
  addsChoices,
2839
+ allowOther = true,
2838
2840
  onChoicesChanged
2839
2841
  }) {
2840
2842
  const client = useOptionalRecordsClient5();
@@ -2852,7 +2854,7 @@ function OpenChoicePicker({
2852
2854
  });
2853
2855
  const q = search.trim();
2854
2856
  const visible = options.filter((o) => q === "" || titleOf(o).toLowerCase().includes(q.toLowerCase()));
2855
- const decided = decideTypedChoice({ words: q, options, allowOther: true, nudge: nudge ?? "ask" });
2857
+ const decided = decideTypedChoice({ words: q, options, allowOther, nudge: nudge ?? "ask" });
2856
2858
  const choose = (word, addingIt = false) => {
2857
2859
  const pending = held.add.filter((w) => w.toLowerCase() !== word.toLowerCase());
2858
2860
  let next;
@@ -2937,7 +2939,10 @@ function OpenChoicePicker({
2937
2939
  empty: q === "" ? /* @__PURE__ */ jsx12("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
2938
2940
  add,
2939
2941
  foot,
2940
- footNote: addRefused ? /* @__PURE__ */ jsx12(RefusalLine, { error: addRefused }) : null
2942
+ footNote: addRefused ? /* @__PURE__ */ jsx12(RefusalLine, { error: addRefused }) : offList && decided.decision === "not_a_choice" ? (
2943
+ // never_add on a column that takes only its choices: said, never a silent nothing.
2944
+ /* @__PURE__ */ jsx12("p", { "data-records-typed-refusal": "", className: "p-2 text-xs text-muted-foreground", children: notAChoiceSentence(field2, [q]) })
2945
+ ) : null
2941
2946
  }
2942
2947
  )
2943
2948
  )
@@ -4641,7 +4646,7 @@ import {
4641
4646
  } from "@ai-matrx/records/react";
4642
4647
  import { asPermissionLevel } from "@ai-matrx/records";
4643
4648
  import { MatrxDataTable, tableStyleIsEmpty as tableStyleIsEmpty2 } from "@ai-matrx/design-system/data-table";
4644
- import { announceRecordChanged as announceRecordChanged3 } from "@ai-matrx/records/core";
4649
+ import { announceRecordChanged as announceRecordChanged4 } from "@ai-matrx/records/core";
4645
4650
 
4646
4651
  // src/archiveWords.ts
4647
4652
  function archiveConfirmSentence(what) {
@@ -4875,7 +4880,7 @@ function EmptyRecords({ words: words2 }) {
4875
4880
 
4876
4881
  // src/gridControls.tsx
4877
4882
  import { useCallback as useCallback9, useEffect as useEffect18, useMemo as useMemo14, useRef as useRef9, useState as useState22 } from "react";
4878
- import { tableShapeChanged, useFieldMutation as useFieldMutation2, useRecordsClient as useRecordsClient12 } from "@ai-matrx/records/react";
4883
+ import { tableShapeChanged as tableShapeChanged2, useFieldMutation as useFieldMutation2, useRecordsClient as useRecordsClient12 } from "@ai-matrx/records/react";
4879
4884
  import {
4880
4885
  BasicInput as BasicInput10,
4881
4886
  Button as Button17,
@@ -4891,20 +4896,21 @@ import {
4891
4896
 
4892
4897
  // src/FieldEditor.tsx
4893
4898
  import { useMemo as useMemo11, useState as useState18 } from "react";
4894
- import { useFieldMutation, useFields as useFields2, useRecords as useRecords2, useRecordsClient as useRecordsClient8, useTable } from "@ai-matrx/records/react";
4899
+ import { tableShapeChanged, useFieldMutation, useFields as useFields2, useRecords as useRecords2, useRecordsClient as useRecordsClient8, useTable } from "@ai-matrx/records/react";
4900
+ import { announceRecordChanged } from "@ai-matrx/records/core";
4895
4901
  import {
4896
4902
  BasicInput as BasicInput9,
4897
4903
  BasicTextarea as BasicTextarea5,
4898
4904
  Button as Button13,
4899
4905
  Checkbox as Checkbox5,
4900
4906
  Label as Label8,
4901
- Select as Select3,
4902
- SelectContent as SelectContent3,
4907
+ Select as Select4,
4908
+ SelectContent as SelectContent4,
4903
4909
  SelectGroup,
4904
- SelectItem as SelectItem3,
4910
+ SelectItem as SelectItem4,
4905
4911
  SelectLabel,
4906
- SelectTrigger as SelectTrigger3,
4907
- SelectValue as SelectValue3,
4912
+ SelectTrigger as SelectTrigger4,
4913
+ SelectValue as SelectValue4,
4908
4914
  Separator,
4909
4915
  cn as cn15
4910
4916
  } from "@ai-matrx/design-system";
@@ -5182,6 +5188,22 @@ function choiceDisplayPatch(field2, rows) {
5182
5188
  const id = held?.id ?? (editorKindFor(field2) === "multi_select" ? "multi_choice" : "choice");
5183
5189
  return { id, options: { ...held?.options ?? {}, choices } };
5184
5190
  }
5191
+ function lookFollowsRenames(field2, look, renames) {
5192
+ if (renames.size === 0) return look;
5193
+ const base = look ?? displayFormatOf(field2);
5194
+ const choices = base && Array.isArray(base.options["choices"]) ? base.options["choices"] : null;
5195
+ if (!base || !choices) return look;
5196
+ let moved = false;
5197
+ const next = choices.map((c) => {
5198
+ const was = typeof c["value"] === "string" ? c["value"] : null;
5199
+ const now = was === null ? void 0 : [...renames].find(([old]) => choiceWord(old) === choiceWord(was))?.[1];
5200
+ if (now === void 0) return c;
5201
+ moved = true;
5202
+ return { ...c, value: now };
5203
+ });
5204
+ if (!moved) return look;
5205
+ return { id: base.id, options: { ...base.options, choices: next } };
5206
+ }
5185
5207
  function ChoiceColorsEditor({
5186
5208
  field: field2,
5187
5209
  rows,
@@ -5252,10 +5274,10 @@ function ChoiceColorsEditor({
5252
5274
 
5253
5275
  // src/ChoiceListEditor.tsx
5254
5276
  import { useEffect as useEffect14, useState as useState17 } from "react";
5255
- import { optionLabel } from "@ai-matrx/records";
5277
+ import { optionLabel, recordsUseSentence, rehomeSentence } from "@ai-matrx/records";
5256
5278
  import { useRecordsClient as useRecordsClient7 } from "@ai-matrx/records/react";
5257
- import { BasicInput as BasicInput8, Button as Button12, Label as Label6 } from "@ai-matrx/design-system";
5258
- import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
5279
+ import { BasicInput as BasicInput8, Button as Button12, Label as Label6, Select as Select3, SelectContent as SelectContent3, SelectItem as SelectItem3, SelectTrigger as SelectTrigger3, SelectValue as SelectValue3 } from "@ai-matrx/design-system";
5280
+ import { Fragment as Fragment6, jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
5259
5281
  var rowSeed = 0;
5260
5282
  var nextRow = () => `new-${rowSeed += 1}`;
5261
5283
  function choiceRowsFrom(options) {
@@ -5283,10 +5305,17 @@ function ChoiceListEditor({
5283
5305
  field: field2,
5284
5306
  rows,
5285
5307
  onRows,
5286
- onStart
5308
+ onStart,
5309
+ allowOther = false,
5310
+ rehome = {},
5311
+ onRehome
5287
5312
  }) {
5288
5313
  const client = useRecordsClient7();
5289
5314
  const [refused, setRefused] = useState17(null);
5315
+ const [usage, setUsage] = useState17(null);
5316
+ const [asking, setAsking] = useState17(null);
5317
+ const [moveTo, setMoveTo] = useState17("");
5318
+ const [removed, setRemoved] = useState17({});
5290
5319
  useEffect14(() => {
5291
5320
  if (rows !== null) return;
5292
5321
  let live = true;
@@ -5304,6 +5333,19 @@ function ChoiceListEditor({
5304
5333
  live = false;
5305
5334
  };
5306
5335
  }, [client, field2.id, rows, onRows, onStart]);
5336
+ useEffect14(() => {
5337
+ if (!onRehome) return;
5338
+ let live = true;
5339
+ void client.fieldChoiceUsage({ field_id: field2.id }).then(
5340
+ (got) => {
5341
+ if (live && got.ok) setUsage(got.data);
5342
+ },
5343
+ () => void 0
5344
+ );
5345
+ return () => {
5346
+ live = false;
5347
+ };
5348
+ }, [client, field2.id, onRehome]);
5307
5349
  if (refused) {
5308
5350
  return /* @__PURE__ */ jsxs19("p", { className: "text-[11px] text-muted-foreground", "data-records-choice-list": "", children: [
5309
5351
  "The choices could not be read, so they are left as they are: ",
@@ -5320,6 +5362,37 @@ function ChoiceListEditor({
5320
5362
  onRows(next);
5321
5363
  };
5322
5364
  const named = (r, i) => r.words.trim() === "" ? `choice ${i + 1}` : `\u201C${r.words.trim()}\u201D`;
5365
+ const heldBy = (r) => r.id && onRehome ? usage?.[r.id]?.records ?? 0 : 0;
5366
+ const remove = (i) => {
5367
+ const r = rows[i];
5368
+ if (heldBy(r) > 0) {
5369
+ setAsking(r);
5370
+ setMoveTo("");
5371
+ return;
5372
+ }
5373
+ onRows(rows.filter((_, j) => j !== i));
5374
+ };
5375
+ const answer = (spec) => {
5376
+ if (!asking?.id || !onRehome) return;
5377
+ const index = rows.findIndex((r) => r.id === asking.id);
5378
+ setRemoved({ ...removed, [asking.id]: { row: asking, index: index < 0 ? rows.length : index } });
5379
+ onRows(rows.filter((r) => r.id !== asking.id));
5380
+ onRehome({ ...rehome, [asking.id]: spec });
5381
+ setAsking(null);
5382
+ };
5383
+ const putBack = (id) => {
5384
+ const was = removed[id];
5385
+ if (!was || !onRehome) return;
5386
+ const next = [...rows];
5387
+ next.splice(Math.min(was.index, next.length), 0, was.row);
5388
+ onRows(next);
5389
+ const { [id]: _gone, ...rest } = rehome;
5390
+ onRehome(rest);
5391
+ const { [id]: _was, ...keep } = removed;
5392
+ setRemoved(keep);
5393
+ };
5394
+ const targets = rows.filter((r) => r.id && r.id !== asking?.id && r.words.trim() !== "");
5395
+ const wordsOf = (id) => rows.find((r) => r.id === id)?.words.trim() ?? usage?.[id]?.words ?? "";
5323
5396
  return /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-1", "data-records-choice-list": "", children: [
5324
5397
  /* @__PURE__ */ jsx23(Label6, { className: "text-xs", children: "The choices" }),
5325
5398
  rows.length === 0 ? /* @__PURE__ */ jsx23("p", { className: "text-xs text-muted-foreground", "data-records-choice-list-empty": "", children: "No choices yet. Add the first one here, or type it into a cell and answer Add." }) : null,
@@ -5335,10 +5408,43 @@ function ChoiceListEditor({
5335
5408
  ),
5336
5409
  /* @__PURE__ */ jsx23(Button12, { 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" }),
5337
5410
  /* @__PURE__ */ jsx23(Button12, { 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" }),
5338
- /* @__PURE__ */ jsx23(Button12, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Remove ${named(r, i)}`, onClick: () => onRows(rows.filter((_, j) => j !== i)), children: "\xD7" })
5411
+ /* @__PURE__ */ jsx23(Button12, { 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" })
5339
5412
  ] }, r.row)) }),
5413
+ asking ? (
5414
+ // THE QUESTION, Notion-style: where do the records that hold it go?
5415
+ /* @__PURE__ */ jsxs19(
5416
+ "div",
5417
+ {
5418
+ role: "group",
5419
+ "aria-label": recordsUseSentence(heldBy(asking), asking.words.trim()),
5420
+ "data-records-choice-removal-ask": "",
5421
+ className: "flex flex-col gap-1 rounded border bg-muted/40 p-2",
5422
+ children: [
5423
+ /* @__PURE__ */ jsx23("p", { className: "text-xs", children: recordsUseSentence(heldBy(asking), asking.words.trim()) }),
5424
+ /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-1", children: [
5425
+ targets.length > 0 ? /* @__PURE__ */ jsxs19(Fragment6, { children: [
5426
+ /* @__PURE__ */ jsx23(Button12, { type: "button", size: "sm", className: "h-7 px-2 text-xs", disabled: moveTo === "", onClick: () => answer({ then: "move", to: moveTo }), children: "Move them to" }),
5427
+ /* @__PURE__ */ jsxs19(Select3, { value: moveTo, onValueChange: setMoveTo, children: [
5428
+ /* @__PURE__ */ jsx23(SelectTrigger3, { size: "sm", className: "h-7 w-36 text-xs", "aria-label": "Another choice", children: /* @__PURE__ */ jsx23(SelectValue3, { placeholder: "Another choice" }) }),
5429
+ /* @__PURE__ */ jsx23(SelectContent3, { children: targets.map((r) => /* @__PURE__ */ jsx23(SelectItem3, { value: r.id, children: r.words.trim() }, r.id)) })
5430
+ ] })
5431
+ ] }) : null,
5432
+ allowOther ? /* @__PURE__ */ jsx23(Button12, { 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,
5433
+ /* @__PURE__ */ jsx23(Button12, { type: "button", size: "sm", variant: "outline", className: "h-7 px-2 text-xs", onClick: () => answer({ then: "clear" }), children: "Clear them" }),
5434
+ /* @__PURE__ */ jsx23(Button12, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-2 text-xs", onClick: () => setAsking(null), children: "Cancel" })
5435
+ ] })
5436
+ ]
5437
+ }
5438
+ )
5439
+ ) : null,
5440
+ Object.entries(rehome).map(
5441
+ ([id, spec]) => removed[id] ? /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between gap-2 text-[11px] text-muted-foreground", "data-records-choice-rehome": "", children: [
5442
+ /* @__PURE__ */ jsx23("span", { children: rehomeSentence(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
5443
+ /* @__PURE__ */ jsx23(Button12, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 text-[11px]", onClick: () => putBack(id), children: "Put it back" })
5444
+ ] }, id) : null
5445
+ ),
5340
5446
  /* @__PURE__ */ jsx23(Button12, { type: "button", size: "sm", variant: "outline", className: "h-7 self-start text-xs", onClick: () => onRows([...rows, { id: null, words: "", row: nextRow() }]), children: "Add a choice" }),
5341
- /* @__PURE__ */ jsx23("p", { className: "text-[11px] text-muted-foreground", children: "Changing a choice\u2019s words changes them in every record that holds it. A removed choice is no longer offered; records that hold it keep it." })
5447
+ /* @__PURE__ */ jsx23("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." })
5342
5448
  ] });
5343
5449
  }
5344
5450
 
@@ -5837,7 +5943,7 @@ function nextFieldSort(fields) {
5837
5943
 
5838
5944
  // src/FieldEditor.tsx
5839
5945
  import { FIELD_SENSITIVITIES, CONTEXT_POLICIES } from "@ai-matrx/records";
5840
- import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
5946
+ import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
5841
5947
  var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
5842
5948
  var SENSITIVITIES = FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
5843
5949
  var AGENT_VISIBILITY = CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
@@ -5879,6 +5985,9 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
5879
5985
  const [optionText, setOptionText] = useState18("");
5880
5986
  const [choiceList, setChoiceList] = useState18(null);
5881
5987
  const [choiceListStart, setChoiceListStart] = useState18(null);
5988
+ const [rehome, setRehome] = useState18({});
5989
+ const [rehomed, setRehomed] = useState18(null);
5990
+ const [rehomeRefused, setRehomeRefused] = useState18(null);
5882
5991
  const [unit, setUnit] = useState18(field2?.unit ?? "$");
5883
5992
  const [withTime, setWithTime] = useState18(String(field2?.config?.["kind"] ?? "date") === "datetime");
5884
5993
  const [via, setVia] = useState18(String(field2?.config?.["via"] ?? ""));
@@ -5921,7 +6030,14 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
5921
6030
  if (missing) return;
5922
6031
  if (editing && field2) {
5923
6032
  const chooses = type === "select" || type === "multi_select";
5924
- const look = chooses ? choiceRows ? choiceDisplayPatch(field2, choiceRows) : null : null;
6033
+ const renames = /* @__PURE__ */ new Map();
6034
+ if (chooses && choiceList && choiceListStart) {
6035
+ for (const was of choiceListStart) {
6036
+ const now = was.id ? choiceList.find((r) => r.id === was.id) : void 0;
6037
+ if (now && now.words.trim() !== "" && now.words.trim() !== was.words.trim()) renames.set(was.words.trim(), now.words.trim());
6038
+ }
6039
+ }
6040
+ const look = chooses ? lookFollowsRenames(field2, choiceRows ? choiceDisplayPatch(field2, choiceRows) : null, renames) : null;
5925
6041
  const shownAs = chooses ? void 0 : formatPatch(field2, showsAs);
5926
6042
  const patch = {
5927
6043
  // The column's look travels in the same settings patch (`display_format`), so a save is
@@ -5965,6 +6081,20 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
5965
6081
  // K2: a re-aimed formula goes WITH its type word, the arm `field_update` reads it in.
5966
6082
  ...type === "formula" && formulaWritten && formulaChanged && formulaText.trim() !== "" ? { type: "formula", formula_text: formulaText.trim() } : {}
5967
6083
  };
6084
+ if (Object.keys(rehome).length > 0 && Array.isArray(patch.options)) {
6085
+ setRehomeRefused(null);
6086
+ const done = await client.fieldUpdateRehomingChoices({ field_id: field2.id, patch, rehome });
6087
+ if (!done.ok) {
6088
+ setRehomeRefused(done.error);
6089
+ return;
6090
+ }
6091
+ tableShapeChanged(tableId);
6092
+ for (const c of done.data.undo.cells_back) announceRecordChanged(c.record_id);
6093
+ const n = done.data.rehomed.reduce((sum, r) => sum + r.records, 0);
6094
+ setRehome({});
6095
+ setRehomed({ said: `Saved. ${n} ${n === 1 ? "record was" : "records were"} changed with the choices.`, undo: done.data.undo });
6096
+ return;
6097
+ }
5968
6098
  const written2 = await mutation.update({ field_id: field2.id, patch });
5969
6099
  if (written2 !== null) onSaved?.();
5970
6100
  return;
@@ -6049,16 +6179,16 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6049
6179
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6050
6180
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "What it holds" }),
6051
6181
  /* @__PURE__ */ jsxs21(
6052
- Select3,
6182
+ Select4,
6053
6183
  {
6054
6184
  value: type,
6055
6185
  disabled: editing,
6056
6186
  onValueChange: (next) => setType(next),
6057
6187
  children: [
6058
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": "What this field holds", children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6059
- /* @__PURE__ */ jsx25(SelectContent3, { children: FIELD_TYPE_GROUPS.map((group) => /* @__PURE__ */ jsxs21(SelectGroup, { children: [
6188
+ /* @__PURE__ */ jsx25(SelectTrigger4, { size: "sm", "aria-label": "What this field holds", children: /* @__PURE__ */ jsx25(SelectValue4, {}) }),
6189
+ /* @__PURE__ */ jsx25(SelectContent4, { children: FIELD_TYPE_GROUPS.map((group) => /* @__PURE__ */ jsxs21(SelectGroup, { children: [
6060
6190
  /* @__PURE__ */ jsx25(SelectLabel, { children: group }),
6061
- FIELD_TYPE_CHOICES.filter((c) => c.group === group).map((c) => /* @__PURE__ */ jsx25(SelectItem3, { value: c.id, children: c.label }, c.id))
6191
+ FIELD_TYPE_CHOICES.filter((c) => c.group === group).map((c) => /* @__PURE__ */ jsx25(SelectItem4, { value: c.id, children: c.label }, c.id))
6062
6192
  ] }, group)) })
6063
6193
  ]
6064
6194
  }
@@ -6135,7 +6265,18 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6135
6265
  relations,
6136
6266
  others,
6137
6267
  existingOptionsTable: Boolean(field2?.options_table_id ?? field2?.config?.["options_table_id"]),
6138
- choiceList: editing && field2 ? /* @__PURE__ */ jsx25(ChoiceListEditor, { field: field2, rows: choiceList, onRows: setChoiceList, onStart: setChoiceListStart }) : null,
6268
+ choiceList: editing && field2 ? /* @__PURE__ */ jsx25(
6269
+ ChoiceListEditor,
6270
+ {
6271
+ field: field2,
6272
+ rows: choiceList,
6273
+ onRows: setChoiceList,
6274
+ onStart: setChoiceListStart,
6275
+ allowOther,
6276
+ rehome,
6277
+ onRehome: setRehome
6278
+ }
6279
+ ) : null,
6139
6280
  allowedTypes,
6140
6281
  setAllowedTypes
6141
6282
  }
@@ -6191,16 +6332,16 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6191
6332
  /* @__PURE__ */ jsxs21("div", { className: "grid gap-3 sm:grid-cols-2", children: [
6192
6333
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6193
6334
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "Who can see what is in it" }),
6194
- /* @__PURE__ */ jsxs21(Select3, { value: sensitivity, onValueChange: setSensitivity, children: [
6195
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": "Who can see what is in it", children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6196
- /* @__PURE__ */ jsx25(SelectContent3, { children: SENSITIVITIES.map((row) => /* @__PURE__ */ jsx25(SelectItem3, { value: row.value, children: row.label }, row.value)) })
6335
+ /* @__PURE__ */ jsxs21(Select4, { value: sensitivity, onValueChange: setSensitivity, children: [
6336
+ /* @__PURE__ */ jsx25(SelectTrigger4, { size: "sm", "aria-label": "Who can see what is in it", children: /* @__PURE__ */ jsx25(SelectValue4, {}) }),
6337
+ /* @__PURE__ */ jsx25(SelectContent4, { children: SENSITIVITIES.map((row) => /* @__PURE__ */ jsx25(SelectItem4, { value: row.value, children: row.label }, row.value)) })
6197
6338
  ] })
6198
6339
  ] }),
6199
6340
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6200
6341
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "Can an assistant read it" }),
6201
- /* @__PURE__ */ jsxs21(Select3, { value: contextPolicy, onValueChange: setContextPolicy, children: [
6202
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": "Can an assistant read it", children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6203
- /* @__PURE__ */ jsx25(SelectContent3, { children: AGENT_VISIBILITY.map((row) => /* @__PURE__ */ jsx25(SelectItem3, { value: row.value, children: row.label }, row.value)) })
6342
+ /* @__PURE__ */ jsxs21(Select4, { value: contextPolicy, onValueChange: setContextPolicy, children: [
6343
+ /* @__PURE__ */ jsx25(SelectTrigger4, { size: "sm", "aria-label": "Can an assistant read it", children: /* @__PURE__ */ jsx25(SelectValue4, {}) }),
6344
+ /* @__PURE__ */ jsx25(SelectContent4, { children: AGENT_VISIBILITY.map((row) => /* @__PURE__ */ jsx25(SelectItem4, { value: row.value, children: row.label }, row.value)) })
6204
6345
  ] })
6205
6346
  ] })
6206
6347
  ] }),
@@ -6223,13 +6364,13 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6223
6364
  rules.length === 0 ? /* @__PURE__ */ jsx25("p", { className: "text-muted-foreground", children: "No checks. Anything this kind of column can hold will be accepted." }) : null,
6224
6365
  rules.map((rule, index) => /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-1", children: [
6225
6366
  /* @__PURE__ */ jsxs21(
6226
- Select3,
6367
+ Select4,
6227
6368
  {
6228
6369
  value: rule.kind,
6229
6370
  onValueChange: (kind) => setRules(rules.map((r, i) => i === index ? { ...r, kind } : r)),
6230
6371
  children: [
6231
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", className: "w-52", "aria-label": `Check ${index + 1}`, children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6232
- /* @__PURE__ */ jsx25(SelectContent3, { children: RULE_KINDS.map((row) => /* @__PURE__ */ jsx25(SelectItem3, { value: row.kind, children: row.label }, row.kind)) })
6372
+ /* @__PURE__ */ jsx25(SelectTrigger4, { size: "sm", className: "w-52", "aria-label": `Check ${index + 1}`, children: /* @__PURE__ */ jsx25(SelectValue4, {}) }),
6373
+ /* @__PURE__ */ jsx25(SelectContent4, { children: RULE_KINDS.map((row) => /* @__PURE__ */ jsx25(SelectItem4, { value: row.kind, children: row.label }, row.kind)) })
6233
6374
  ]
6234
6375
  }
6235
6376
  ),
@@ -6285,6 +6426,36 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6285
6426
  error: refusal("internal", COLUMN_DID_NOT_LAND_SENTENCE, COLUMN_DID_NOT_LAND_REMEDY)
6286
6427
  }
6287
6428
  ) : null,
6429
+ rehomeRefused ? /* @__PURE__ */ jsx25(RefusalNotice, { error: rehomeRefused }) : null,
6430
+ rehomed ? /* @__PURE__ */ jsxs21("div", { "data-records-choice-rehomed": "", className: "flex flex-wrap items-center gap-2 text-[11px]", children: [
6431
+ /* @__PURE__ */ jsx25("span", { children: rehomed.said }),
6432
+ rehomed.undo ? /* @__PURE__ */ jsx25(
6433
+ Button13,
6434
+ {
6435
+ type: "button",
6436
+ size: "sm",
6437
+ variant: "outline",
6438
+ className: "h-6 px-2 text-xs",
6439
+ onClick: () => {
6440
+ const undo = rehomed.undo;
6441
+ if (!undo || !field2) return;
6442
+ void client.fieldUpdateRehomingChoices({ field_id: field2.id, patch: { options: undo.options }, cells_back: undo.cells_back }).then((back) => {
6443
+ if (!back.ok) {
6444
+ setRehomeRefused(back.error);
6445
+ return;
6446
+ }
6447
+ tableShapeChanged(tableId);
6448
+ for (const c of undo.cells_back) announceRecordChanged(c.record_id);
6449
+ setChoiceList(null);
6450
+ setChoiceListStart(null);
6451
+ setRehomed({ said: "Undone. The choices and the records that held them are back as they were.", undo: null });
6452
+ });
6453
+ },
6454
+ children: "Undo"
6455
+ }
6456
+ ) : null,
6457
+ /* @__PURE__ */ jsx25(Button13, { type: "button", size: "sm", className: "h-6 px-2 text-xs", onClick: () => onSaved?.(), children: "Done" })
6458
+ ] }) : null,
6288
6459
  backfillError ? /* @__PURE__ */ jsxs21("div", { "data-records-autonumber-backfill-refused": "", className: "flex flex-col gap-1", children: [
6289
6460
  /* @__PURE__ */ jsx25("p", { className: "text-[11px]", children: "The column is made. The records already in the table were not numbered:" }),
6290
6461
  /* @__PURE__ */ jsx25(RefusalNotice, { error: backfillError })
@@ -6301,7 +6472,7 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6301
6472
  }
6302
6473
  ),
6303
6474
  onCancel ? /* @__PURE__ */ jsx25(Button13, { size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null,
6304
- field2 ? /* @__PURE__ */ jsx25("div", { className: "ml-auto flex items-center gap-2", children: askingToRemove ? /* @__PURE__ */ jsxs21(Fragment6, { children: [
6475
+ field2 ? /* @__PURE__ */ jsx25("div", { className: "ml-auto flex items-center gap-2", children: askingToRemove ? /* @__PURE__ */ jsxs21(Fragment7, { children: [
6305
6476
  /* @__PURE__ */ jsxs21("span", { className: "text-destructive", children: [
6306
6477
  archiveConfirmSentence(`the field \u201C${fieldName(field2)}\u201D`),
6307
6478
  " Its values stay in every record and come back with it."
@@ -6407,7 +6578,7 @@ function TypeQuestions(props) {
6407
6578
  );
6408
6579
  }
6409
6580
  if (type === "select" || type === "multi_select") {
6410
- if (props.choiceList) return /* @__PURE__ */ jsx25(Fragment6, { children: props.choiceList });
6581
+ if (props.choiceList) return /* @__PURE__ */ jsx25(Fragment7, { children: props.choiceList });
6411
6582
  return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6412
6583
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "The choices" }),
6413
6584
  /* @__PURE__ */ jsx25(
@@ -6460,9 +6631,9 @@ function TypeQuestions(props) {
6460
6631
  return /* @__PURE__ */ jsxs21("div", { className: "grid gap-3 sm:grid-cols-2", children: [
6461
6632
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6462
6633
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: type === "rollup" ? "Across the records in" : "Read it from" }),
6463
- /* @__PURE__ */ jsxs21(Select3, { value: props.via, onValueChange: props.setVia, children: [
6464
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": type === "rollup" ? "Across the records in" : "Read it from", children: /* @__PURE__ */ jsx25(SelectValue3, { placeholder: "Choose a column" }) }),
6465
- /* @__PURE__ */ jsx25(SelectContent3, { children: usable.map((f) => /* @__PURE__ */ jsxs21(SelectItem3, { value: f.key, children: [
6634
+ /* @__PURE__ */ jsxs21(Select4, { value: props.via, onValueChange: props.setVia, children: [
6635
+ /* @__PURE__ */ jsx25(SelectTrigger4, { size: "sm", "aria-label": type === "rollup" ? "Across the records in" : "Read it from", children: /* @__PURE__ */ jsx25(SelectValue4, { placeholder: "Choose a column" }) }),
6636
+ /* @__PURE__ */ jsx25(SelectContent4, { children: usable.map((f) => /* @__PURE__ */ jsxs21(SelectItem4, { value: f.key, children: [
6466
6637
  fieldName(f),
6467
6638
  type === "rollup" && !f.multi ? " \u2014 holds one" : ""
6468
6639
  ] }, f.id)) })
@@ -6479,9 +6650,9 @@ function TypeQuestions(props) {
6479
6650
  }
6480
6651
  ) : /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6481
6652
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "What to work out" }),
6482
- /* @__PURE__ */ jsxs21(Select3, { value: props.agg, onValueChange: (v) => props.setAgg(v), children: [
6483
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": "What to work out", children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6484
- /* @__PURE__ */ jsx25(SelectContent3, { children: ROLLUP_OPERATIONS.map((row) => /* @__PURE__ */ jsx25(SelectItem3, { value: row.value, children: row.label }, row.value)) })
6653
+ /* @__PURE__ */ jsxs21(Select4, { value: props.agg, onValueChange: (v) => props.setAgg(v), children: [
6654
+ /* @__PURE__ */ jsx25(SelectTrigger4, { size: "sm", "aria-label": "What to work out", children: /* @__PURE__ */ jsx25(SelectValue4, {}) }),
6655
+ /* @__PURE__ */ jsx25(SelectContent4, { children: ROLLUP_OPERATIONS.map((row) => /* @__PURE__ */ jsx25(SelectItem4, { value: row.value, children: row.label }, row.value)) })
6485
6656
  ] }),
6486
6657
  props.agg !== "count" ? /* @__PURE__ */ jsx25(
6487
6658
  ValueOnTheOtherSide,
@@ -6504,9 +6675,9 @@ function TypeQuestions(props) {
6504
6675
  return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-2", children: [
6505
6676
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6506
6677
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "What to do" }),
6507
- /* @__PURE__ */ jsxs21(Select3, { value: props.formulaOp, onValueChange: props.setFormulaOp, children: [
6508
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", className: "max-w-[18rem]", "aria-label": "What to do", children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6509
- /* @__PURE__ */ jsx25(SelectContent3, { children: FORMULA_OPERATIONS.map((row) => /* @__PURE__ */ jsx25(SelectItem3, { value: row.value, children: row.label }, row.value)) })
6678
+ /* @__PURE__ */ jsxs21(Select4, { value: props.formulaOp, onValueChange: props.setFormulaOp, children: [
6679
+ /* @__PURE__ */ jsx25(SelectTrigger4, { size: "sm", className: "max-w-[18rem]", "aria-label": "What to do", children: /* @__PURE__ */ jsx25(SelectValue4, {}) }),
6680
+ /* @__PURE__ */ jsx25(SelectContent4, { children: FORMULA_OPERATIONS.map((row) => /* @__PURE__ */ jsx25(SelectItem4, { value: row.value, children: row.label }, row.value)) })
6510
6681
  ] })
6511
6682
  ] }),
6512
6683
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
@@ -6565,9 +6736,9 @@ function ValueOnTheOtherSide({
6565
6736
  const body = !relation ? /* @__PURE__ */ jsx25("p", { className: "text-[11px] text-muted-foreground", children: "Choose the column above first." }) : stillAsking ? /* @__PURE__ */ jsx25("p", { className: "text-[11px] text-muted-foreground", children: "Reading that table's columns\u2026" }) : offered.length === 0 ? /* @__PURE__ */ jsxs21("p", { className: "text-[11px] text-muted-foreground", children: [
6566
6737
  fieldName(relation),
6567
6738
  " points at a table that has no columns to read yet. Add one there first."
6568
- ] }) : /* @__PURE__ */ jsxs21(Select3, { value, onValueChange: onChange, children: [
6569
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": label, children: /* @__PURE__ */ jsx25(SelectValue3, { placeholder: "Choose a column" }) }),
6570
- /* @__PURE__ */ jsx25(SelectContent3, { children: offered.map((column) => /* @__PURE__ */ jsx25(SelectItem3, { value: column.key, children: column.name }, column.key)) })
6739
+ ] }) : /* @__PURE__ */ jsxs21(Select4, { value, onValueChange: onChange, children: [
6740
+ /* @__PURE__ */ jsx25(SelectTrigger4, { size: "sm", "aria-label": label, children: /* @__PURE__ */ jsx25(SelectValue4, { placeholder: "Choose a column" }) }),
6741
+ /* @__PURE__ */ jsx25(SelectContent4, { children: offered.map((column) => /* @__PURE__ */ jsx25(SelectItem4, { value: column.key, children: column.name }, column.key)) })
6571
6742
  ] });
6572
6743
  if (compact) return /* @__PURE__ */ jsx25("div", { className: "mt-1 flex flex-col gap-1", children: body });
6573
6744
  return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
@@ -7304,7 +7475,7 @@ function gridCopyConfig(args) {
7304
7475
  }
7305
7476
 
7306
7477
  // src/gridSummaries.tsx
7307
- import { Fragment as Fragment7, jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
7478
+ import { Fragment as Fragment8, jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
7308
7479
  var SUMMARY_ROW_ID = "__records_ui_summary__";
7309
7480
  var SUMMARY_ROW = {
7310
7481
  id: SUMMARY_ROW_ID,
@@ -7404,7 +7575,7 @@ function SummaryCell({
7404
7575
  chosen ? "text-foreground" : "text-muted-foreground opacity-0 hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100"
7405
7576
  ),
7406
7577
  title: chosen && rowCount !== null ? `${label} of ${fieldName(field2)}, worked out by the store over all ${rowCount} record${rowCount === 1 ? "" : "s"} \u2014 not only this page.` : `Summarize ${fieldName(field2)}`,
7407
- children: chosen ? /* @__PURE__ */ jsxs24(Fragment7, { children: [
7578
+ children: chosen ? /* @__PURE__ */ jsxs24(Fragment8, { children: [
7408
7579
  /* @__PURE__ */ jsx28("span", { className: "text-muted-foreground", children: label }),
7409
7580
  shown3 !== null ? /* @__PURE__ */ jsx28("span", { className: "font-medium tabular-nums", children: shown3 }) : /* @__PURE__ */ jsx28("span", { className: "font-medium tabular-nums", children: /* @__PURE__ */ jsx28(RecordValue, { field: field2, value, format: formatForField(field2) }) })
7410
7581
  ] }) : "Summarize"
@@ -7422,7 +7593,7 @@ function SummaryCell({
7422
7593
  },
7423
7594
  op2
7424
7595
  )),
7425
- chosen ? /* @__PURE__ */ jsxs24(Fragment7, { children: [
7596
+ chosen ? /* @__PURE__ */ jsxs24(Fragment8, { children: [
7426
7597
  /* @__PURE__ */ jsx28(DropdownMenuSeparator, {}),
7427
7598
  /* @__PURE__ */ jsx28(DropdownMenuItem, { onSelect: () => onChoose(null), children: "No summary" })
7428
7599
  ] }) : null
@@ -7621,7 +7792,7 @@ function documentOf(row) {
7621
7792
  }
7622
7793
 
7623
7794
  // src/gridControls.tsx
7624
- import { Fragment as Fragment8, jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
7795
+ import { Fragment as Fragment9, jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
7625
7796
  function filterForValue(field2, value) {
7626
7797
  const empty = value === null || value === void 0 || value === "";
7627
7798
  if (empty) return { kind: "text", value: "", mode: "empty" };
@@ -7947,7 +8118,7 @@ function useMergedGridControls(args) {
7947
8118
  return;
7948
8119
  }
7949
8120
  notify?.success(`Each record is named by ${field2 ? fieldName(field2) : columnId} now.`);
7950
- tableShapeChanged(tableId);
8121
+ tableShapeChanged2(tableId);
7951
8122
  args.reloadTable();
7952
8123
  })();
7953
8124
  },
@@ -8004,7 +8175,7 @@ function useMergedGridControls(args) {
8004
8175
  [enabled, order, hidden, keepColumns]
8005
8176
  );
8006
8177
  const close = () => setDialog(null);
8007
- const dialogs = !enabled ? null : /* @__PURE__ */ jsxs25(Fragment8, { children: [
8178
+ const dialogs = !enabled ? null : /* @__PURE__ */ jsxs25(Fragment9, { children: [
8008
8179
  colours.dialogs,
8009
8180
  /* @__PURE__ */ jsx29(
8010
8181
  RowLabelPicker,
@@ -8015,7 +8186,7 @@ function useMergedGridControls(args) {
8015
8186
  tableId,
8016
8187
  fields,
8017
8188
  onSaved: () => {
8018
- tableShapeChanged(tableId);
8189
+ tableShapeChanged2(tableId);
8019
8190
  args.reloadTable();
8020
8191
  },
8021
8192
  notify
@@ -8137,7 +8308,7 @@ function useMergedGridControls(args) {
8137
8308
  columns: columnsControl,
8138
8309
  dialogs,
8139
8310
  addColumn: () => setDialog({ kind: "insert", anchor: null, side: "right" }),
8140
- sheetTools: enabled ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
8311
+ sheetTools: enabled ? /* @__PURE__ */ jsxs25(Fragment9, { children: [
8141
8312
  colours.sheet,
8142
8313
  args.summaries ? /* @__PURE__ */ jsx29(
8143
8314
  SummarySheetControls,
@@ -8323,7 +8494,7 @@ import {
8323
8494
  Switch,
8324
8495
  cn as cn17
8325
8496
  } from "@ai-matrx/design-system";
8326
- import { Fragment as Fragment9, jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
8497
+ import { Fragment as Fragment10, jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
8327
8498
  var NO_ENRICH_REASON = "Having an agent fill this column is not switched on here yet, so this panel does not offer it rather than offering something that cannot happen. Everything else on this panel works. It is on our list, not yours.";
8328
8499
  function cellState(cell) {
8329
8500
  if (!cell || !cell.agent_owned) return "none";
@@ -8685,7 +8856,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
8685
8856
  children: "Show me five rows it would do"
8686
8857
  }
8687
8858
  ),
8688
- host.enrich ? /* @__PURE__ */ jsxs27(Fragment9, { children: [
8859
+ host.enrich ? /* @__PURE__ */ jsxs27(Fragment10, { children: [
8689
8860
  /* @__PURE__ */ jsx31(
8690
8861
  Button19,
8691
8862
  {
@@ -8923,7 +9094,7 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
8923
9094
  // src/PastePreview.tsx
8924
9095
  import { useState as useState25 } from "react";
8925
9096
  import { Badge as Badge7, Button as Button21, Separator as Separator2 } from "@ai-matrx/design-system";
8926
- import { Fragment as Fragment10, jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
9097
+ import { Fragment as Fragment11, jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
8927
9098
  function PastePreview({
8928
9099
  plan,
8929
9100
  noun,
@@ -8951,7 +9122,7 @@ function PastePreview({
8951
9122
  /* @__PURE__ */ jsx33("span", { className: "text-xs text-muted-foreground", "data-matrx-paste-summary": true, children: outcome ? `${outcome.readBack} ${outcome.readBack === 1 ? "value" : "values"} read back` : summarize(plan) })
8952
9123
  ] }),
8953
9124
  /* @__PURE__ */ jsx33(Separator2, {}),
8954
- outcome === null ? /* @__PURE__ */ jsxs29(Fragment10, { children: [
9125
+ outcome === null ? /* @__PURE__ */ jsxs29(Fragment11, { children: [
8955
9126
  nothingToDo ? /* @__PURE__ */ jsx33("p", { className: "text-sm", children: "Nothing in what you pasted can be written to this table. Every cell is listed below with the reason." }) : /* @__PURE__ */ jsxs29("p", { className: "text-sm", children: [
8956
9127
  sentence(plan, noun, nounPlural),
8957
9128
  " The values below are exactly what will be stored, written the way the grid writes them \u2014 a choice column shows the word and stores the option behind it."
@@ -9041,7 +9212,7 @@ function PastePreview({
9041
9212
  }
9042
9213
  function Outcome({ outcome, onClose }) {
9043
9214
  const whole = outcome.missing === 0 && outcome.refusals.length === 0;
9044
- return /* @__PURE__ */ jsxs29(Fragment10, { children: [
9215
+ return /* @__PURE__ */ jsxs29(Fragment11, { children: [
9045
9216
  /* @__PURE__ */ jsx33("p", { className: "text-sm", "data-matrx-paste-outcome": whole ? "whole" : "partial", children: whole ? `All ${outcome.readBack} ${outcome.readBack === 1 ? "value is" : "values are"} in the table \u2014 read back out of it, not just accepted.` : `${outcome.readBack} of ${outcome.readBack + outcome.missing} values are in the table. The rest are not, and nothing was lost from what you copied \u2014 it is still on your clipboard.` }),
9046
9217
  outcome.refusals.length > 0 ? /* @__PURE__ */ jsx33("ul", { className: "flex flex-col gap-1", children: outcome.refusals.slice(0, 8).map((why, index) => /* @__PURE__ */ jsx33("li", { className: "text-xs text-muted-foreground", children: why }, index)) }) : null,
9047
9218
  /* @__PURE__ */ jsx33("div", { className: "flex justify-end pt-1", children: /* @__PURE__ */ jsx33(Button21, { size: "sm", onClick: onClose, children: "Close" }) })
@@ -9444,14 +9615,14 @@ function withOpenRecord(columns, onOpen, nameOf, place = "end") {
9444
9615
  // src/toolbarSlot.tsx
9445
9616
  import { createContext as createContext4, useContext as useContext4 } from "react";
9446
9617
  import { createPortal } from "react-dom";
9447
- import { Fragment as Fragment11, jsx as jsx36 } from "react/jsx-runtime";
9618
+ import { Fragment as Fragment12, jsx as jsx36 } from "react/jsx-runtime";
9448
9619
  var TableToolbarSlotContext = createContext4(void 0);
9449
9620
  function useTableToolbarSlot() {
9450
9621
  return useContext4(TableToolbarSlotContext);
9451
9622
  }
9452
9623
  function InTableToolbar({ children }) {
9453
9624
  const slot = useTableToolbarSlot();
9454
- if (slot === void 0) return /* @__PURE__ */ jsx36(Fragment11, { children });
9625
+ if (slot === void 0) return /* @__PURE__ */ jsx36(Fragment12, { children });
9455
9626
  if (slot === null) return null;
9456
9627
  return createPortal(children, slot);
9457
9628
  }
@@ -9479,7 +9650,7 @@ import {
9479
9650
  DropdownMenuSeparator as DropdownMenuSeparator2,
9480
9651
  DropdownMenuTrigger as DropdownMenuTrigger2
9481
9652
  } from "@ai-matrx/design-system";
9482
- import { Fragment as Fragment12, jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
9653
+ import { Fragment as Fragment13, jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
9483
9654
  function useStoreGridLayout(tableId) {
9484
9655
  const client = useRecordsClient16();
9485
9656
  const [answer, setAnswer] = useState27({
@@ -9567,7 +9738,7 @@ function GridLayoutMenu({
9567
9738
  ]
9568
9739
  }
9569
9740
  ) : null,
9570
- anyOwn ? /* @__PURE__ */ jsxs32(Fragment12, { children: [
9741
+ anyOwn ? /* @__PURE__ */ jsxs32(Fragment13, { children: [
9571
9742
  /* @__PURE__ */ jsx37(DropdownMenuSeparator2, {}),
9572
9743
  /* @__PURE__ */ jsx37(
9573
9744
  DropdownMenuItem2,
@@ -9586,10 +9757,10 @@ function GridLayoutMenu({
9586
9757
  // src/gridUndo.tsx
9587
9758
  import { useCallback as useCallback13, useEffect as useEffect23, useLayoutEffect, useMemo as useMemo18, useRef as useRef11, useState as useState28, useSyncExternalStore } from "react";
9588
9759
  import { useRecordsClient as useRecordsClient17 } from "@ai-matrx/records/react";
9589
- import { announceRecordChanged } from "@ai-matrx/records/core";
9760
+ import { announceRecordChanged as announceRecordChanged2 } from "@ai-matrx/records/core";
9590
9761
  import { Button as Button24 } from "@ai-matrx/design-system";
9591
9762
  import { createUndoStack, popRedo, popUndo, pushUndo } from "@ai-matrx/design-system/data-table";
9592
- import { Fragment as Fragment13, jsx as jsx38, jsxs as jsxs33 } from "react/jsx-runtime";
9763
+ import { Fragment as Fragment14, jsx as jsx38, jsxs as jsxs33 } from "react/jsx-runtime";
9593
9764
  function changesFor(step2, direction) {
9594
9765
  const byRow = /* @__PURE__ */ new Map();
9595
9766
  for (const cell of step2.cells) {
@@ -9654,7 +9825,7 @@ function useGridUndo(args) {
9654
9825
  }
9655
9826
  forget(step2.cells.map((c) => ({ rowId: c.rowId, key: c.key })));
9656
9827
  for (const id of /* @__PURE__ */ new Set([...step2.cells.map((c) => c.rowId), ...step2.created ?? [], ...step2.archived ?? []])) {
9657
- announceRecordChanged(id);
9828
+ announceRecordChanged2(id);
9658
9829
  }
9659
9830
  setHeld(() => {
9660
9831
  let stack = taken.stack;
@@ -9728,7 +9899,7 @@ function UndoRedoLive({ source }) {
9728
9899
  function UndoRedoPair({ face, onUndo, onRedo }) {
9729
9900
  const undo = { depth: { back: face.back, forward: face.forward }, busy: face.busy };
9730
9901
  if (undo.depth.back === 0 && undo.depth.forward === 0) return null;
9731
- return /* @__PURE__ */ jsxs33(Fragment13, { children: [
9902
+ return /* @__PURE__ */ jsxs33(Fragment14, { children: [
9732
9903
  /* @__PURE__ */ jsxs33(
9733
9904
  Button24,
9734
9905
  {
@@ -10180,7 +10351,7 @@ function useGridAssist(args) {
10180
10351
  // src/gridBulk.tsx
10181
10352
  import { useCallback as useCallback15, useMemo as useMemo20, useState as useState31 } from "react";
10182
10353
  import { useRecordsClient as useRecordsClient18 } from "@ai-matrx/records/react";
10183
- import { announceRecordChanged as announceRecordChanged2 } from "@ai-matrx/records/core";
10354
+ import { announceRecordChanged as announceRecordChanged3 } from "@ai-matrx/records/core";
10184
10355
  import {
10185
10356
  Button as Button26,
10186
10357
  ConfirmDialog as ConfirmDialog3,
@@ -10192,7 +10363,7 @@ import {
10192
10363
  DialogTitle as DialogTitle5,
10193
10364
  Label as Label11
10194
10365
  } from "@ai-matrx/design-system";
10195
- import { Fragment as Fragment14, jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
10366
+ import { Fragment as Fragment15, jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
10196
10367
  function countOf(n, one, many) {
10197
10368
  return `${n} ${n === 1 ? one : many}`;
10198
10369
  }
@@ -10247,7 +10418,7 @@ function useGridBulk(args) {
10247
10418
  setRefusal(done.error);
10248
10419
  return null;
10249
10420
  }
10250
- for (const change of changes) if ("record_id" in change && change.record_id) announceRecordChanged2(change.record_id);
10421
+ for (const change of changes) if ("record_id" in change && change.record_id) announceRecordChanged3(change.record_id);
10251
10422
  return done.data;
10252
10423
  },
10253
10424
  [client, tableId]
@@ -10320,8 +10491,8 @@ function BulkActions({
10320
10491
  setAsking(null);
10321
10492
  if (ok) onDone();
10322
10493
  };
10323
- return /* @__PURE__ */ jsxs35(Fragment14, { children: [
10324
- typeable.length > 0 ? /* @__PURE__ */ jsxs35(Fragment14, { children: [
10494
+ return /* @__PURE__ */ jsxs35(Fragment15, { children: [
10495
+ typeable.length > 0 ? /* @__PURE__ */ jsxs35(Fragment15, { children: [
10325
10496
  /* @__PURE__ */ jsx41(Button26, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "set", disabled: bulk.busy, onClick: () => open("set"), children: "Set a column" }),
10326
10497
  /* @__PURE__ */ jsx41(Button26, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "clear", disabled: bulk.busy, onClick: () => open("clear"), children: "Clear a column" }),
10327
10498
  ids.length > 1 ? /* @__PURE__ */ jsx41(Button26, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "fill", disabled: bulk.busy, onClick: () => open("fill"), children: "Fill down" }) : null
@@ -10955,7 +11126,7 @@ function HandOrderDialog({
10955
11126
  }
10956
11127
 
10957
11128
  // src/Grid.tsx
10958
- import { Fragment as Fragment15, jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
11129
+ import { Fragment as Fragment16, jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
10959
11130
  var NO_COLUMNS_YET = "This table has no columns yet";
10960
11131
  var NO_COLUMNS_WHY = "A column is what a record holds \u2014 a name, a date, an amount, a person. Add the first one and the grid appears with it; everything else on this page works the moment it exists.";
10961
11132
  var NO_SUMMARIES = Object.freeze({});
@@ -11389,7 +11560,7 @@ function Grid({
11389
11560
  }))
11390
11561
  );
11391
11562
  editing.forget(cells);
11392
- for (const u of updates) announceRecordChanged3(u.row.recordId);
11563
+ for (const u of updates) announceRecordChanged4(u.row.recordId);
11393
11564
  const lines = updates.length + creates.length;
11394
11565
  undo.push({ label: `Pasted ${lines} ${lines === 1 ? "row" : "rows"}`, cells, created });
11395
11566
  const expected = [
@@ -11745,7 +11916,7 @@ function Grid({
11745
11916
  const hasTalk = Boolean(host.talkToRecord);
11746
11917
  const hasAgent = Boolean(host.runAgentAction);
11747
11918
  const rowActions = useCallback16(
11748
- (row) => /* @__PURE__ */ jsxs37(Fragment15, { children: [
11919
+ (row) => /* @__PURE__ */ jsxs37(Fragment16, { children: [
11749
11920
  canWrite && mayWriteRow(row.id) ? tableActions.runnable.map((action) => /* @__PURE__ */ jsx43(
11750
11921
  ActionButton,
11751
11922
  {
@@ -12038,7 +12209,7 @@ function Grid({
12038
12209
  * — the table's own (clear, copy/export, group, columns), these, the search, the sort and
12039
12210
  * the page's filter, layout and share — in ONE "Tools" sheet. Never dropped.
12040
12211
  */
12041
- actions: /* @__PURE__ */ jsxs37(Fragment15, { children: [
12212
+ actions: /* @__PURE__ */ jsxs37(Fragment16, { children: [
12042
12213
  manual ? /* @__PURE__ */ jsx43(
12043
12214
  SortStateControl,
12044
12215
  {
@@ -12082,7 +12253,7 @@ function Grid({
12082
12253
  ...merged ? {
12083
12254
  overflow: {
12084
12255
  mode: phone ? "sheet" : toolbarFold2 >= 3 ? "menu" : "inline",
12085
- pinned: /* @__PURE__ */ jsxs37(Fragment15, { children: [
12256
+ pinned: /* @__PURE__ */ jsxs37(Fragment16, { children: [
12086
12257
  /* @__PURE__ */ jsx43(UndoRedoLive, { source: undoSource }),
12087
12258
  Boolean(editable) && rights.write ? /* @__PURE__ */ jsx43(Button28, { size: "sm", className: "shrink-0", disabled: added.busy, onClick: () => addRowRef.current(), children: added.busy ? "Adding\u2026" : "New record" }) : null
12088
12259
  ] }),
@@ -12315,7 +12486,7 @@ function Grid({
12315
12486
  rights.structure && onAddField ? /* @__PURE__ */ jsx43(Button28, { size: "sm", onClick: onAddField, children: "Add your first column" }) : /* @__PURE__ */ jsx43("p", { className: "max-w-prose text-xs text-muted-foreground", children: rights.why("structure") })
12316
12487
  ]
12317
12488
  }
12318
- ) : /* @__PURE__ */ jsxs37(Fragment15, { children: [
12489
+ ) : /* @__PURE__ */ jsxs37(Fragment16, { children: [
12319
12490
  /* @__PURE__ */ jsx43(
12320
12491
  "div",
12321
12492
  {
@@ -12349,7 +12520,7 @@ function Grid({
12349
12520
  onSelectedIdsChange: setSelectedIds,
12350
12521
  noun,
12351
12522
  isRowSelectable,
12352
- actions: (_selected, ids) => /* @__PURE__ */ jsxs37(Fragment15, { children: [
12523
+ actions: (_selected, ids) => /* @__PURE__ */ jsxs37(Fragment16, { children: [
12353
12524
  merged ? /* @__PURE__ */ jsx43(
12354
12525
  BulkActions,
12355
12526
  {
@@ -12701,11 +12872,11 @@ import {
12701
12872
  import {
12702
12873
  Badge as Badge8,
12703
12874
  Button as Button30,
12704
- Select as Select4,
12705
- SelectContent as SelectContent4,
12706
- SelectItem as SelectItem4,
12707
- SelectTrigger as SelectTrigger4,
12708
- SelectValue as SelectValue4,
12875
+ Select as Select5,
12876
+ SelectContent as SelectContent5,
12877
+ SelectItem as SelectItem5,
12878
+ SelectTrigger as SelectTrigger5,
12879
+ SelectValue as SelectValue5,
12709
12880
  Separator as Separator3,
12710
12881
  cn as cn22
12711
12882
  } from "@ai-matrx/design-system";
@@ -12748,7 +12919,7 @@ function checkImportRules(fields, rows, mapping) {
12748
12919
  }
12749
12920
 
12750
12921
  // src/ImportWizard.tsx
12751
- import { Fragment as Fragment16, jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
12922
+ import { Fragment as Fragment17, jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
12752
12923
  var BATCH = 250;
12753
12924
  var SAMPLES = 40;
12754
12925
  var ABSENT = "__absent__";
@@ -13027,7 +13198,7 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13027
13198
  accept: ".csv,.xlsx",
13028
13199
  disabled: busy,
13029
13200
  chosenName: fileName || null,
13030
- hint: /* @__PURE__ */ jsx45(Fragment16, { children: "A spreadsheet or CSV whose FIRST ROW is the column names \u2014 Job Number, Customer, Scheduled Date \u2014 and one row per record under it. Every column is shown back to you with what this table made of it, and nothing is written until you press Import." }),
13201
+ hint: /* @__PURE__ */ jsx45(Fragment17, { children: "A spreadsheet or CSV whose FIRST ROW is the column names \u2014 Job Number, Customer, Scheduled Date \u2014 and one row per record under it. Every column is shown back to you with what this table made of it, and nothing is written until you press Import." }),
13031
13202
  onFile: (file) => void take(file),
13032
13203
  ...fileName ? {
13033
13204
  onClear: () => {
@@ -13047,11 +13218,11 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13047
13218
  fileName ? `${fileName} has been sent to this table` : "This file has been sent to this table",
13048
13219
  ledger && !ledger.final ? ", but the run stopped part-way. Importing it again would write the rows that already landed a second time, so fix the file (or keep only the rows below the ones that landed) and choose it again." : ". What landed and what was refused is below. To import another file, choose it above."
13049
13220
  ] }) : null,
13050
- plan && parsed && !afterWrite ? /* @__PURE__ */ jsxs39(Fragment16, { children: [
13221
+ plan && parsed && !afterWrite ? /* @__PURE__ */ jsxs39(Fragment17, { children: [
13051
13222
  titleKey ? /* @__PURE__ */ jsxs39("div", { className: "flex flex-wrap items-center gap-2 rounded border bg-muted/40 px-2 py-1.5", children: [
13052
13223
  /* @__PURE__ */ jsx45("span", { className: "font-medium", children: "What each record is called" }),
13053
13224
  /* @__PURE__ */ jsxs39(
13054
- Select4,
13225
+ Select5,
13055
13226
  {
13056
13227
  value: titleMappedTo ?? "",
13057
13228
  disabled: busy,
@@ -13067,15 +13238,15 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13067
13238
  },
13068
13239
  children: [
13069
13240
  /* @__PURE__ */ jsx45(
13070
- SelectTrigger4,
13241
+ SelectTrigger5,
13071
13242
  {
13072
13243
  size: "sm",
13073
13244
  "aria-label": "Which column each record is named by",
13074
13245
  className: "min-w-[14rem]",
13075
- children: /* @__PURE__ */ jsx45(SelectValue4, { placeholder: "\u2014 choose the column \u2014" })
13246
+ children: /* @__PURE__ */ jsx45(SelectValue5, { placeholder: "\u2014 choose the column \u2014" })
13076
13247
  }
13077
13248
  ),
13078
- /* @__PURE__ */ jsx45(SelectContent4, { children: plan.columns.map((c) => /* @__PURE__ */ jsx45(SelectItem4, { value: c.header, children: c.header }, c.header)) })
13249
+ /* @__PURE__ */ jsx45(SelectContent5, { children: plan.columns.map((c) => /* @__PURE__ */ jsx45(SelectItem5, { value: c.header, children: c.header }, c.header)) })
13079
13250
  ]
13080
13251
  }
13081
13252
  ),
@@ -13095,7 +13266,7 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13095
13266
  /* @__PURE__ */ jsx45("span", { className: "min-w-[8rem] flex-1 break-words font-medium", children: column.header }),
13096
13267
  /* @__PURE__ */ jsx45("span", { className: "text-muted-foreground", children: "goes to" }),
13097
13268
  /* @__PURE__ */ jsxs39(
13098
- Select4,
13269
+ Select5,
13099
13270
  {
13100
13271
  value: to || ABSENT,
13101
13272
  disabled: busy,
@@ -13109,18 +13280,18 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13109
13280
  },
13110
13281
  children: [
13111
13282
  /* @__PURE__ */ jsx45(
13112
- SelectTrigger4,
13283
+ SelectTrigger5,
13113
13284
  {
13114
13285
  size: "sm",
13115
13286
  "aria-label": `Where ${column.header} goes`,
13116
13287
  "data-goes-to": column.header,
13117
13288
  className: "min-w-[14rem] flex-1",
13118
- children: /* @__PURE__ */ jsx45(SelectValue4, {})
13289
+ children: /* @__PURE__ */ jsx45(SelectValue5, {})
13119
13290
  }
13120
13291
  ),
13121
- /* @__PURE__ */ jsxs39(SelectContent4, { children: [
13122
- /* @__PURE__ */ jsx45(SelectItem4, { value: ABSENT, children: absent }),
13123
- plan.fields.map((f) => /* @__PURE__ */ jsx45(SelectItem4, { value: f.key, children: f.label || f.key }, f.field_id))
13292
+ /* @__PURE__ */ jsxs39(SelectContent5, { children: [
13293
+ /* @__PURE__ */ jsx45(SelectItem5, { value: ABSENT, children: absent }),
13294
+ plan.fields.map((f) => /* @__PURE__ */ jsx45(SelectItem5, { value: f.key, children: f.label || f.key }, f.field_id))
13124
13295
  ] })
13125
13296
  ]
13126
13297
  }
@@ -13278,12 +13449,12 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13278
13449
  ] }) : null
13279
13450
  ] }) : null,
13280
13451
  alreadyRan ? /* @__PURE__ */ jsx45("p", { className: "text-muted-foreground", children: alreadyRan }) : null,
13281
- outcomes.length > 0 || summary || ledger ? /* @__PURE__ */ jsxs39(Fragment16, { children: [
13452
+ outcomes.length > 0 || summary || ledger ? /* @__PURE__ */ jsxs39(Fragment17, { children: [
13282
13453
  /* @__PURE__ */ jsx45(Separator3, {}),
13283
13454
  /* @__PURE__ */ jsxs39("div", { className: "flex flex-wrap items-center gap-2", children: [
13284
13455
  /* @__PURE__ */ jsx45("span", { children: ledger ? `${ledger.written} landed \xB7 ${ledger.duplicate} already here \xB7 ${ledger.refused} refused, of ${ledger.seen} row${ledger.seen === 1 ? "" : "s"} offered` : `${counts.landed} landed \xB7 ${counts.duplicate} already here \xB7 ${counts.refused} refused` }),
13285
13456
  ledger && !ledger.final && phase !== "writing" ? /* @__PURE__ */ jsx45("span", { className: "text-destructive", children: "The run stopped here, so the rest of the file was never offered \u2014 these are the rows that were dealt with before it stopped, not the whole file." }) : null,
13286
- (ledger ? ledger.refused + ledger.duplicate : counts.refused + counts.duplicate) > 0 ? /* @__PURE__ */ jsxs39(Fragment16, { children: [
13457
+ (ledger ? ledger.refused + ledger.duplicate : counts.refused + counts.duplicate) > 0 ? /* @__PURE__ */ jsxs39(Fragment17, { children: [
13287
13458
  /* @__PURE__ */ jsx45("button", { type: "button", className: cn22("underline underline-offset-2", show === "all" && "font-medium"), onClick: () => setShow("all"), children: "everything that did not land" }),
13288
13459
  /* @__PURE__ */ jsx45("button", { type: "button", className: cn22("underline underline-offset-2", show === "refused" && "font-medium"), onClick: () => setShow("refused"), children: "refused" }),
13289
13460
  /* @__PURE__ */ jsx45("button", { type: "button", className: cn22("underline underline-offset-2", show === "duplicate" && "font-medium"), onClick: () => setShow("duplicate"), children: "already here" })
@@ -13339,7 +13510,7 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13339
13510
  ] }) : null
13340
13511
  ] }) : null,
13341
13512
  runsProblem ? /* @__PURE__ */ jsx45(RefusalNotice, { error: runsProblem }) : null,
13342
- runs && runs.length > 0 ? /* @__PURE__ */ jsxs39(Fragment16, { children: [
13513
+ runs && runs.length > 0 ? /* @__PURE__ */ jsxs39(Fragment17, { children: [
13343
13514
  /* @__PURE__ */ jsx45(Separator3, {}),
13344
13515
  /* @__PURE__ */ jsx45("p", { className: "font-medium", children: "Imports into this table" }),
13345
13516
  /* @__PURE__ */ jsx45("ul", { className: "flex flex-col gap-1", children: runs.map((r) => /* @__PURE__ */ jsxs39("li", { className: "flex flex-col gap-1", children: [
@@ -13371,7 +13542,7 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13371
13542
  }
13372
13543
  ) : null
13373
13544
  ] }),
13374
- openRun === r.import_id ? runProblem ? /* @__PURE__ */ jsx45(RefusalNotice, { error: runProblem }) : runRows ? /* @__PURE__ */ jsxs39(Fragment16, { children: [
13545
+ openRun === r.import_id ? runProblem ? /* @__PURE__ */ jsx45(RefusalNotice, { error: runProblem }) : runRows ? /* @__PURE__ */ jsxs39(Fragment17, { children: [
13375
13546
  runRows.note ? /* @__PURE__ */ jsx45("p", { className: "text-muted-foreground", children: runRows.note }) : null,
13376
13547
  /* @__PURE__ */ jsx45("div", { className: "max-h-64 overflow-auto rounded border", children: /* @__PURE__ */ jsxs39("table", { className: "w-full", children: [
13377
13548
  /* @__PURE__ */ jsx45("thead", { className: "sticky top-0 bg-muted", children: /* @__PURE__ */ jsxs39("tr", { children: [
@@ -13415,11 +13586,11 @@ import {
13415
13586
  import {
13416
13587
  BasicInput as BasicInput11,
13417
13588
  Button as Button31,
13418
- Select as Select5,
13419
- SelectContent as SelectContent5,
13420
- SelectItem as SelectItem5,
13421
- SelectTrigger as SelectTrigger5,
13422
- SelectValue as SelectValue5,
13589
+ Select as Select6,
13590
+ SelectContent as SelectContent6,
13591
+ SelectItem as SelectItem6,
13592
+ SelectTrigger as SelectTrigger6,
13593
+ SelectValue as SelectValue6,
13423
13594
  Separator as Separator4,
13424
13595
  cn as cn23
13425
13596
  } from "@ai-matrx/design-system";
@@ -13499,6 +13670,7 @@ function CustomFieldsSection({
13499
13670
  const [newLabel, setNewLabel] = useState36("");
13500
13671
  const [newType, setNewType] = useState36("text");
13501
13672
  const [draft, setDraft] = useState36({});
13673
+ const [removing, setRemoving] = useState36(null);
13502
13674
  const fields = useMemo24(() => read.data?.fields ?? [], [read.data]);
13503
13675
  const mayAdd = rights.data?.may_declare === true;
13504
13676
  const live = useRef15({ fields, rights: rights.data, loading: rights.loading, reload: read.reload });
@@ -13645,9 +13817,9 @@ function CustomFieldsSection({
13645
13817
  ] }),
13646
13818
  /* @__PURE__ */ jsxs40("div", { className: "flex flex-col gap-1", children: [
13647
13819
  /* @__PURE__ */ jsx46("span", { className: "text-muted-foreground", children: "Holds" }),
13648
- /* @__PURE__ */ jsxs40(Select5, { value: newType, onValueChange: setNewType, children: [
13649
- /* @__PURE__ */ jsx46(SelectTrigger5, { size: "sm", "aria-label": "What this field holds", children: /* @__PURE__ */ jsx46(SelectValue5, {}) }),
13650
- /* @__PURE__ */ jsx46(SelectContent5, { children: ADDABLE_TYPES.map((t) => /* @__PURE__ */ jsx46(SelectItem5, { value: t.value, children: t.label }, t.value)) })
13820
+ /* @__PURE__ */ jsxs40(Select6, { value: newType, onValueChange: setNewType, children: [
13821
+ /* @__PURE__ */ jsx46(SelectTrigger6, { size: "sm", "aria-label": "What this field holds", children: /* @__PURE__ */ jsx46(SelectValue6, {}) }),
13822
+ /* @__PURE__ */ jsx46(SelectContent6, { children: ADDABLE_TYPES.map((t) => /* @__PURE__ */ jsx46(SelectItem6, { value: t.value, children: t.label }, t.value)) })
13651
13823
  ] })
13652
13824
  ] }),
13653
13825
  /* @__PURE__ */ jsx46(Button31, { size: "sm", type: "submit", disabled: mutation.saving || newLabel.trim() === "", children: mutation.saving ? "Adding\u2026" : "Add" })
@@ -13658,7 +13830,46 @@ function CustomFieldsSection({
13658
13830
  const field2 = asField(f);
13659
13831
  const id = `cf-${recordId}-${f.key}`;
13660
13832
  return /* @__PURE__ */ jsxs40("div", { className: "flex min-w-0 flex-col gap-1", children: [
13661
- /* @__PURE__ */ jsx46(FieldLabel, { field: field2, htmlFor: id }),
13833
+ /* @__PURE__ */ jsxs40("div", { className: "flex items-center gap-2", children: [
13834
+ /* @__PURE__ */ jsx46(FieldLabel, { field: field2, htmlFor: id }),
13835
+ mayAdd && removing !== f.id ? /* @__PURE__ */ jsx46(
13836
+ Button31,
13837
+ {
13838
+ size: "sm",
13839
+ variant: "ghost",
13840
+ className: "ml-auto h-6 px-2 text-xs text-muted-foreground",
13841
+ onClick: () => setRemoving(f.id),
13842
+ children: "Remove field"
13843
+ }
13844
+ ) : null
13845
+ ] }),
13846
+ removing === f.id ? /* @__PURE__ */ jsxs40("div", { className: "flex flex-wrap items-center gap-2", children: [
13847
+ /* @__PURE__ */ jsxs40("span", { className: "text-destructive", children: [
13848
+ archiveConfirmSentence(`the field \u201C${f.label}\u201D`),
13849
+ " It is removed for everyone in this organization; its values stay in every record and come back with it."
13850
+ ] }),
13851
+ /* @__PURE__ */ jsx46(
13852
+ Button31,
13853
+ {
13854
+ size: "sm",
13855
+ variant: "destructive",
13856
+ disabled: mutation.saving,
13857
+ onClick: async () => {
13858
+ const gone = await mutation.retire({ field_id: f.id });
13859
+ setRemoving(null);
13860
+ if (gone) {
13861
+ setDraft((d) => {
13862
+ const { [f.key]: _dropped, ...rest } = d;
13863
+ return rest;
13864
+ });
13865
+ read.reload();
13866
+ }
13867
+ },
13868
+ children: "Remove it"
13869
+ }
13870
+ ),
13871
+ /* @__PURE__ */ jsx46(Button31, { size: "sm", variant: "ghost", onClick: () => setRemoving(null), children: "Keep it" })
13872
+ ] }) : null,
13662
13873
  /* @__PURE__ */ jsx46(
13663
13874
  FieldControl,
13664
13875
  {
@@ -13687,7 +13898,7 @@ import { BasicInput as BasicInput13, BasicTextarea as BasicTextarea7, Button as
13687
13898
  // src/Condition.tsx
13688
13899
  import { useState as useState37 } from "react";
13689
13900
  import { BasicInput as BasicInput12, Button as Button32 } from "@ai-matrx/design-system";
13690
- import { Fragment as Fragment17, jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
13901
+ import { Fragment as Fragment18, jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
13691
13902
  var CONDITION_OPS = [
13692
13903
  { op: "eq", label: "is" },
13693
13904
  { op: "ne", label: "is not" },
@@ -13798,7 +14009,7 @@ function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", cla
13798
14009
  ]
13799
14010
  }
13800
14011
  ),
13801
- onField ? /* @__PURE__ */ jsxs41(Fragment17, { children: [
14012
+ onField ? /* @__PURE__ */ jsxs41(Fragment18, { children: [
13802
14013
  /* @__PURE__ */ jsx47(
13803
14014
  "select",
13804
14015
  {
@@ -14331,11 +14542,11 @@ import {
14331
14542
  Button as Button34,
14332
14543
  Checkbox as Checkbox6,
14333
14544
  Label as Label12,
14334
- Select as Select6,
14335
- SelectContent as SelectContent6,
14336
- SelectItem as SelectItem6,
14337
- SelectTrigger as SelectTrigger6,
14338
- SelectValue as SelectValue6,
14545
+ Select as Select7,
14546
+ SelectContent as SelectContent7,
14547
+ SelectItem as SelectItem7,
14548
+ SelectTrigger as SelectTrigger7,
14549
+ SelectValue as SelectValue7,
14339
14550
  cn as cn26
14340
14551
  } from "@ai-matrx/design-system";
14341
14552
 
@@ -14837,7 +15048,7 @@ function ActionForm({
14837
15048
  rows.length > 0 ? /* @__PURE__ */ jsxs44("div", { className: "ml-auto flex items-center gap-1", children: [
14838
15049
  /* @__PURE__ */ jsx50("span", { className: "text-muted-foreground", children: "Start from a record" }),
14839
15050
  /* @__PURE__ */ jsxs44(
14840
- Select6,
15051
+ Select7,
14841
15052
  {
14842
15053
  value: "",
14843
15054
  onValueChange: (id) => {
@@ -14855,8 +15066,8 @@ function ActionForm({
14855
15066
  setPreviewId(row.id);
14856
15067
  },
14857
15068
  children: [
14858
- /* @__PURE__ */ jsx50(SelectTrigger6, { size: "sm", "aria-label": "Start from a record", children: /* @__PURE__ */ jsx50(SelectValue6, { placeholder: "Pick one" }) }),
14859
- /* @__PURE__ */ jsx50(SelectContent6, { children: rows.map((row) => /* @__PURE__ */ jsx50(SelectItem6, { value: row.id, children: rowName2(row) }, row.id)) })
15069
+ /* @__PURE__ */ jsx50(SelectTrigger7, { size: "sm", "aria-label": "Start from a record", children: /* @__PURE__ */ jsx50(SelectValue7, { placeholder: "Pick one" }) }),
15070
+ /* @__PURE__ */ jsx50(SelectContent7, { children: rows.map((row) => /* @__PURE__ */ jsx50(SelectItem7, { value: row.id, children: rowName2(row) }, row.id)) })
14860
15071
  ]
14861
15072
  }
14862
15073
  )
@@ -14864,16 +15075,16 @@ function ActionForm({
14864
15075
  ] }),
14865
15076
  draft.steps.length === 0 ? /* @__PURE__ */ jsx50("p", { className: "text-muted-foreground", children: "Nothing yet. Add a change, or start from a record and remove the columns it should leave alone." }) : null,
14866
15077
  draft.steps.map((step2, index) => /* @__PURE__ */ jsxs44("div", { className: "flex flex-wrap items-center gap-1", "data-records-action-step": index, children: [
14867
- /* @__PURE__ */ jsxs44(Select6, { value: step2.field, onValueChange: (v) => setStep(index, { field: v }), children: [
14868
- /* @__PURE__ */ jsx50(SelectTrigger6, { size: "sm", "aria-label": `Column for change ${index + 1}`, children: /* @__PURE__ */ jsx50(SelectValue6, { placeholder: "Column" }) }),
14869
- /* @__PURE__ */ jsx50(SelectContent6, { children: settable.map((f) => /* @__PURE__ */ jsx50(SelectItem6, { value: f.id, children: fieldName(f) }, f.id)) })
15078
+ /* @__PURE__ */ jsxs44(Select7, { value: step2.field, onValueChange: (v) => setStep(index, { field: v }), children: [
15079
+ /* @__PURE__ */ jsx50(SelectTrigger7, { size: "sm", "aria-label": `Column for change ${index + 1}`, children: /* @__PURE__ */ jsx50(SelectValue7, { placeholder: "Column" }) }),
15080
+ /* @__PURE__ */ jsx50(SelectContent7, { children: settable.map((f) => /* @__PURE__ */ jsx50(SelectItem7, { value: f.id, children: fieldName(f) }, f.id)) })
14870
15081
  ] }),
14871
- /* @__PURE__ */ jsxs44(Select6, { value: step2.set, onValueChange: (v) => setStep(index, { set: v }), children: [
14872
- /* @__PURE__ */ jsx50(SelectTrigger6, { size: "sm", "aria-label": `How change ${index + 1} sets it`, children: /* @__PURE__ */ jsx50(SelectValue6, {}) }),
14873
- /* @__PURE__ */ jsxs44(SelectContent6, { children: [
14874
- /* @__PURE__ */ jsx50(SelectItem6, { value: "value", children: "Set to" }),
14875
- /* @__PURE__ */ jsx50(SelectItem6, { value: "clear", children: "Clear" }),
14876
- /* @__PURE__ */ jsx50(SelectItem6, { value: "compute", children: "Work out" })
15082
+ /* @__PURE__ */ jsxs44(Select7, { value: step2.set, onValueChange: (v) => setStep(index, { set: v }), children: [
15083
+ /* @__PURE__ */ jsx50(SelectTrigger7, { size: "sm", "aria-label": `How change ${index + 1} sets it`, children: /* @__PURE__ */ jsx50(SelectValue7, {}) }),
15084
+ /* @__PURE__ */ jsxs44(SelectContent7, { children: [
15085
+ /* @__PURE__ */ jsx50(SelectItem7, { value: "value", children: "Set to" }),
15086
+ /* @__PURE__ */ jsx50(SelectItem7, { value: "clear", children: "Clear" }),
15087
+ /* @__PURE__ */ jsx50(SelectItem7, { value: "compute", children: "Work out" })
14877
15088
  ] })
14878
15089
  ] }),
14879
15090
  step2.set === "value" ? /* @__PURE__ */ jsx50(
@@ -14918,9 +15129,9 @@ function ActionForm({
14918
15129
  /* @__PURE__ */ jsxs44("div", { className: "flex flex-wrap items-center gap-1", children: [
14919
15130
  /* @__PURE__ */ jsx50("span", { className: "font-medium", children: "Before and after" }),
14920
15131
  /* @__PURE__ */ jsx50("span", { className: "text-muted-foreground", children: "on" }),
14921
- /* @__PURE__ */ jsxs44(Select6, { value: previewRow.id, onValueChange: (v) => setPreviewId(v), children: [
14922
- /* @__PURE__ */ jsx50(SelectTrigger6, { size: "sm", "aria-label": "Record to preview on", children: /* @__PURE__ */ jsx50(SelectValue6, {}) }),
14923
- /* @__PURE__ */ jsx50(SelectContent6, { children: rows.map((row) => /* @__PURE__ */ jsx50(SelectItem6, { value: row.id, children: rowName2(row) }, row.id)) })
15132
+ /* @__PURE__ */ jsxs44(Select7, { value: previewRow.id, onValueChange: (v) => setPreviewId(v), children: [
15133
+ /* @__PURE__ */ jsx50(SelectTrigger7, { size: "sm", "aria-label": "Record to preview on", children: /* @__PURE__ */ jsx50(SelectValue7, {}) }),
15134
+ /* @__PURE__ */ jsx50(SelectContent7, { children: rows.map((row) => /* @__PURE__ */ jsx50(SelectItem7, { value: row.id, children: rowName2(row) }, row.id)) })
14924
15135
  ] })
14925
15136
  ] }),
14926
15137
  /* @__PURE__ */ jsx50(
@@ -14955,15 +15166,15 @@ function ActionForm({
14955
15166
  colors.length > 0 ? /* @__PURE__ */ jsxs44("div", { className: "flex items-center gap-1", children: [
14956
15167
  /* @__PURE__ */ jsx50("span", { className: "text-muted-foreground", children: "Color" }),
14957
15168
  /* @__PURE__ */ jsxs44(
14958
- Select6,
15169
+ Select7,
14959
15170
  {
14960
15171
  value: draft.color || NO_COLOR,
14961
15172
  onValueChange: (v) => setDraft((d) => ({ ...d, color: v === NO_COLOR ? "" : v })),
14962
15173
  children: [
14963
- /* @__PURE__ */ jsx50(SelectTrigger6, { size: "sm", "aria-label": "Button color", children: /* @__PURE__ */ jsx50(SelectValue6, {}) }),
14964
- /* @__PURE__ */ jsxs44(SelectContent6, { children: [
14965
- /* @__PURE__ */ jsx50(SelectItem6, { value: NO_COLOR, children: "None" }),
14966
- colors.map((c) => /* @__PURE__ */ jsx50(SelectItem6, { value: c, children: c.charAt(0).toUpperCase() + c.slice(1) }, c))
15174
+ /* @__PURE__ */ jsx50(SelectTrigger7, { size: "sm", "aria-label": "Button color", children: /* @__PURE__ */ jsx50(SelectValue7, {}) }),
15175
+ /* @__PURE__ */ jsxs44(SelectContent7, { children: [
15176
+ /* @__PURE__ */ jsx50(SelectItem7, { value: NO_COLOR, children: "None" }),
15177
+ colors.map((c) => /* @__PURE__ */ jsx50(SelectItem7, { value: c, children: c.charAt(0).toUpperCase() + c.slice(1) }, c))
14967
15178
  ] })
14968
15179
  ]
14969
15180
  }
@@ -14988,7 +15199,7 @@ function ActionForm({
14988
15199
  }
14989
15200
 
14990
15201
  // src/TableSettings.tsx
14991
- import { Fragment as Fragment18, jsx as jsx51, jsxs as jsxs45 } from "react/jsx-runtime";
15202
+ import { Fragment as Fragment19, jsx as jsx51, jsxs as jsxs45 } from "react/jsx-runtime";
14992
15203
  function TableSettings({
14993
15204
  tableId,
14994
15205
  proposals,
@@ -15160,7 +15371,7 @@ function TableSettings({
15160
15371
  /* @__PURE__ */ jsx51(Separator6, {}),
15161
15372
  /* @__PURE__ */ jsxs45("div", { className: "flex flex-col gap-1", children: [
15162
15373
  /* @__PURE__ */ jsx51("span", { className: "font-medium", children: "This table" }),
15163
- askingToDelete ? /* @__PURE__ */ jsxs45(Fragment18, { children: [
15374
+ askingToDelete ? /* @__PURE__ */ jsxs45(Fragment19, { children: [
15164
15375
  /* @__PURE__ */ jsxs45("p", { className: "text-muted-foreground", "data-archive-confirm": "table", children: [
15165
15376
  archiveConfirmSentence(table.data ? `the table \u201C${tableName(table.data)}\u201D` : "this table"),
15166
15377
  " ",
@@ -15181,10 +15392,10 @@ function TableSettings({
15181
15392
  archive.slowedDown ? " The store is busy, so it is taking smaller passes \u2014 it will still finish." : ""
15182
15393
  ] }) : null,
15183
15394
  archive.interrupted && archive.progress ? /* @__PURE__ */ jsx51("p", { className: "text-muted-foreground", children: archive.error ? `That pass did not finish, so the rest is still here. ${archive.progress.archived_total.toLocaleString()} record${archive.progress.archived_total === 1 ? " is" : "s are"} already archived and ${archive.progress.remaining.toLocaleString()} ${archive.progress.remaining === 1 ? "is" : "are"} left. Nothing was lost \u2014 carry on and it picks up where it stopped.` : `Stopped. ${archive.progress.archived_total.toLocaleString()} record${archive.progress.archived_total === 1 ? " is" : "s are"} archived and ${archive.progress.remaining.toLocaleString()} ${archive.progress.remaining === 1 ? "is" : "are"} left. Carry on whenever you like \u2014 it picks up where it stopped.` }) : null,
15184
- /* @__PURE__ */ jsx51("div", { className: "flex gap-1", children: archive.running ? /* @__PURE__ */ jsxs45(Fragment18, { children: [
15395
+ /* @__PURE__ */ jsx51("div", { className: "flex gap-1", children: archive.running ? /* @__PURE__ */ jsxs45(Fragment19, { children: [
15185
15396
  /* @__PURE__ */ jsx51(Button35, { size: "sm", variant: "destructive", disabled: true, children: "Archiving\u2026" }),
15186
15397
  /* @__PURE__ */ jsx51(Button35, { size: "sm", variant: "ghost", onClick: () => archive.stop(), children: "Stop" })
15187
- ] }) : /* @__PURE__ */ jsxs45(Fragment18, { children: [
15398
+ ] }) : /* @__PURE__ */ jsxs45(Fragment19, { children: [
15188
15399
  /* @__PURE__ */ jsx51(Button35, { size: "sm", variant: "destructive", onClick: () => void startArchive(), children: archive.interrupted ? "Carry on archiving" : "Archive this table" }),
15189
15400
  /* @__PURE__ */ jsx51(Button35, { size: "sm", variant: "ghost", onClick: () => setAskingToDelete(false), children: "Keep it" })
15190
15401
  ] }) })
@@ -15780,7 +15991,7 @@ function asWords(value) {
15780
15991
  // src/ShareControl.tsx
15781
15992
  import { useEffect as useEffect36, useState as useState45 } from "react";
15782
15993
  import { Button as Button37 } from "@ai-matrx/design-system";
15783
- import { Fragment as Fragment19, jsx as jsx54, jsxs as jsxs48 } from "react/jsx-runtime";
15994
+ import { Fragment as Fragment20, jsx as jsx54, jsxs as jsxs48 } from "react/jsx-runtime";
15784
15995
  function useCanShare() {
15785
15996
  return typeof useRecordsUi().share === "function";
15786
15997
  }
@@ -15807,7 +16018,7 @@ function ShareControl({
15807
16018
  const mayShare = may ?? asked2.share;
15808
16019
  if (!host.share) return null;
15809
16020
  if (!mayShare) return null;
15810
- return /* @__PURE__ */ jsxs48(Fragment19, { children: [
16021
+ return /* @__PURE__ */ jsxs48(Fragment20, { children: [
15811
16022
  /* @__PURE__ */ jsx54(
15812
16023
  Button37,
15813
16024
  {
@@ -15832,7 +16043,7 @@ function ShareControl({
15832
16043
  }
15833
16044
 
15834
16045
  // src/Peek.tsx
15835
- import { Fragment as Fragment20, jsx as jsx55, jsxs as jsxs49 } from "react/jsx-runtime";
16046
+ import { Fragment as Fragment21, jsx as jsx55, jsxs as jsxs49 } from "react/jsx-runtime";
15836
16047
  function Peek({ tableId, recordId, onClose, className }) {
15837
16048
  const table = useTable7(tableId);
15838
16049
  const fields = useFields11(tableId);
@@ -15890,7 +16101,7 @@ function Peek({ tableId, recordId, onClose, className }) {
15890
16101
  onClose ? /* @__PURE__ */ jsx55(Button38, { size: "sm", variant: "ghost", className: "ml-auto", onClick: onClose, "aria-label": "Close", children: "\xD7" }) : null
15891
16102
  ] }),
15892
16103
  /* @__PURE__ */ jsx55(Separator8, {}),
15893
- talking && host.chat ? /* @__PURE__ */ jsxs49(Fragment20, { children: [
16104
+ talking && host.chat ? /* @__PURE__ */ jsxs49(Fragment21, { children: [
15894
16105
  /* @__PURE__ */ jsx55(RecordChat, { tableId, recordId, className: "min-h-[22rem]" }),
15895
16106
  /* @__PURE__ */ jsx55(Separator8, {})
15896
16107
  ] }) : null,
@@ -15912,11 +16123,11 @@ function Peek({ tableId, recordId, onClose, className }) {
15912
16123
  ] }),
15913
16124
  /* @__PURE__ */ jsx55("dd", { className: "min-w-0", children: /* @__PURE__ */ jsx55(RecordValue, { field: field2, value: document2?.[field2.key], document: document2, withheld: withheldNoticeOf(record.data?.hidden, field2.key) }) })
15914
16125
  ] }, field2.id)) }),
15915
- record.data?.computedUnavailable ? /* @__PURE__ */ jsxs49(Fragment20, { children: [
16126
+ record.data?.computedUnavailable ? /* @__PURE__ */ jsxs49(Fragment21, { children: [
15916
16127
  /* @__PURE__ */ jsx55(Separator8, {}),
15917
16128
  /* @__PURE__ */ jsx55("p", { className: "text-muted-foreground", children: "Nothing here can say which columns the system worked out for itself: that part of the record is not readable from your seat. Everything above is the record as it stands." })
15918
16129
  ] }) : null,
15919
- record.data?.computed?.length ? /* @__PURE__ */ jsxs49(Fragment20, { children: [
16130
+ record.data?.computed?.length ? /* @__PURE__ */ jsxs49(Fragment21, { children: [
15920
16131
  /* @__PURE__ */ jsx55(Separator8, {}),
15921
16132
  /* @__PURE__ */ jsxs49("div", { className: "flex flex-col gap-1", children: [
15922
16133
  /* @__PURE__ */ jsx55("span", { className: "font-medium", children: "Worked out by the system" }),
@@ -16049,7 +16260,7 @@ import {
16049
16260
  } from "@ai-matrx/design-system/data-table";
16050
16261
 
16051
16262
  // src/CardDates.tsx
16052
- import { Fragment as Fragment21, jsx as jsx56, jsxs as jsxs50 } from "react/jsx-runtime";
16263
+ import { Fragment as Fragment22, jsx as jsx56, jsxs as jsxs50 } from "react/jsx-runtime";
16053
16264
  function cardDateFields(all, titleField, hiddenFields) {
16054
16265
  const hidden = new Set(hiddenFields ?? []);
16055
16266
  return all.filter(
@@ -16064,7 +16275,7 @@ function CardDates({ record, fields }) {
16064
16275
  return value !== null && value !== void 0 && value !== "";
16065
16276
  });
16066
16277
  if (held.length === 0) return null;
16067
- return /* @__PURE__ */ jsx56(Fragment21, { children: held.map((field2) => /* @__PURE__ */ jsxs50(
16278
+ return /* @__PURE__ */ jsx56(Fragment22, { children: held.map((field2) => /* @__PURE__ */ jsxs50(
16068
16279
  "span",
16069
16280
  {
16070
16281
  className: "mt-0.5 flex min-w-0 items-baseline gap-1 text-[11px] text-muted-foreground",
@@ -16770,7 +16981,7 @@ function batchSentence(moved, waiting, notMoved, label) {
16770
16981
  }
16771
16982
 
16772
16983
  // src/ViewSwitcher.tsx
16773
- import { Fragment as Fragment22, jsx as jsx58, jsxs as jsxs52 } from "react/jsx-runtime";
16984
+ import { Fragment as Fragment23, jsx as jsx58, jsxs as jsxs52 } from "react/jsx-runtime";
16774
16985
  var NO_FIELDS = [];
16775
16986
  function useViewRecords(view, pageSize = 200, filter, viewId) {
16776
16987
  const client = useRecordsClient32();
@@ -17382,7 +17593,7 @@ function Card2({
17382
17593
  onClick: () => onOpenRecord?.(record.id),
17383
17594
  title: withheld ?? label,
17384
17595
  ...withheld && field2 ? { "data-records-withheld": field2.key } : {},
17385
- children: dates && dates.length > 0 ? /* @__PURE__ */ jsxs52(Fragment22, { children: [
17596
+ children: dates && dates.length > 0 ? /* @__PURE__ */ jsxs52(Fragment23, { children: [
17386
17597
  /* @__PURE__ */ jsx58("span", { className: "block truncate", children: label }),
17387
17598
  /* @__PURE__ */ jsx58(CardDates, { record, fields: dates })
17388
17599
  ] }) : label
@@ -18004,7 +18215,7 @@ import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/dat
18004
18215
  import { useCallback as useCallback25, useEffect as useEffect42, useMemo as useMemo32, useState as useState53 } from "react";
18005
18216
  import { useRecordsClient as useRecordsClient37, useTable as useTable10 } from "@ai-matrx/records/react";
18006
18217
  import { Badge as Badge13, BasicInput as BasicInput16, BasicTextarea as BasicTextarea9, Button as Button45, Skeleton as Skeleton11, cn as cn37 } from "@ai-matrx/design-system";
18007
- import { Fragment as Fragment23, jsx as jsx63, jsxs as jsxs57 } from "react/jsx-runtime";
18218
+ import { Fragment as Fragment24, jsx as jsx63, jsxs as jsxs57 } from "react/jsx-runtime";
18008
18219
  var DUE_WORD = DUE_STATE_LABEL;
18009
18220
  var REQUIRES_WORD = CHECKLIST_REQUIREMENT_LABEL;
18010
18221
  var NO_TEMPLATES = "No checklist has been written for this table yet. Ask an agent for one in a sentence \u2014 the steps, who each belongs to, and how many days in each is due \u2014 and it is stored whole, judged before a single step is written.";
@@ -18419,7 +18630,7 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
18419
18630
  /* @__PURE__ */ jsxs57("p", { className: "mt-1 text-xs", children: [
18420
18631
  /* @__PURE__ */ jsx63("span", { className: "font-medium", children: t.steps }),
18421
18632
  " steps",
18422
- t.roles > 0 ? /* @__PURE__ */ jsxs57(Fragment23, { children: [
18633
+ t.roles > 0 ? /* @__PURE__ */ jsxs57(Fragment24, { children: [
18423
18634
  " \xB7 ",
18424
18635
  /* @__PURE__ */ jsx63("span", { className: "font-medium", children: t.roles }),
18425
18636
  " roles"
@@ -18444,7 +18655,7 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
18444
18655
  }
18445
18656
  ) : null
18446
18657
  ] }, t.template_id)) }),
18447
- runs && runs.length > 0 ? /* @__PURE__ */ jsxs57(Fragment23, { children: [
18658
+ runs && runs.length > 0 ? /* @__PURE__ */ jsxs57(Fragment24, { children: [
18448
18659
  /* @__PURE__ */ jsx63("h4", { className: "text-xs font-medium text-muted-foreground", children: "Runs" }),
18449
18660
  /* @__PURE__ */ jsx63("ul", { className: "flex flex-col gap-1.5", "data-testid": "checklist-runs", children: runs.map((run) => /* @__PURE__ */ jsxs57("li", { className: "rounded border p-2 text-xs", children: [
18450
18661
  /* @__PURE__ */ jsxs57("div", { className: "flex items-center gap-2", children: [
@@ -18726,7 +18937,7 @@ function roleKey(said) {
18726
18937
  }
18727
18938
 
18728
18939
  // src/ActionInbox.tsx
18729
- import { Fragment as Fragment24, jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
18940
+ import { Fragment as Fragment25, jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
18730
18941
  var ACTION_KINDS = ["approval", "assignment", "proposal"];
18731
18942
  var KIND_WORD2 = WORK_INBOX_KIND_LABEL;
18732
18943
  var DUE_WORD2 = DUE_STATE_LABEL;
@@ -19351,7 +19562,7 @@ function ActionInbox({
19351
19562
  /* @__PURE__ */ jsxs58("div", { className: "flex flex-col gap-0.5", "data-testid": "inbox-closed", children: [
19352
19563
  /* @__PURE__ */ jsxs58("p", { className: "text-[11px] text-muted-foreground", children: [
19353
19564
  item.state === "withdrawn" ? item.decided_by_name ? `Withdrawn when ${item.decided_by_name} archived it` : "Withdrawn when what it would change was archived" : `${WORK_APPROVAL_STATE_LABEL[item.state] ?? item.state}${item.decided_by_name ? ` by ${item.decided_by_name}` : ""}`,
19354
- item.decided_at ? /* @__PURE__ */ jsxs58(Fragment24, { children: [
19565
+ item.decided_at ? /* @__PURE__ */ jsxs58(Fragment25, { children: [
19355
19566
  " \xB7 ",
19356
19567
  /* @__PURE__ */ jsx64("time", { dateTime: item.decided_at, children: whenWords2(item.decided_at) })
19357
19568
  ] }) : null
@@ -19523,7 +19734,7 @@ function ActionInbox({
19523
19734
  onSteps,
19524
19735
  actions: (stepId) => {
19525
19736
  const title = items?.find((i) => i.item_id === stepId)?.title ?? "this step";
19526
- return /* @__PURE__ */ jsxs58(Fragment24, { children: [
19737
+ return /* @__PURE__ */ jsxs58(Fragment25, { children: [
19527
19738
  snoozing === stepId ? snoozeChoices().map((c) => /* @__PURE__ */ jsx64(
19528
19739
  Button46,
19529
19740
  {
@@ -20107,7 +20318,7 @@ import {
20107
20318
  useTable as useTable13
20108
20319
  } from "@ai-matrx/records/react";
20109
20320
  import { Badge as Badge17, Button as Button49, Skeleton as Skeleton15, cn as cn41 } from "@ai-matrx/design-system";
20110
- import { Fragment as Fragment25, jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
20321
+ import { Fragment as Fragment26, jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
20111
20322
  function FieldHistoryPanel({
20112
20323
  tableId,
20113
20324
  fieldKey,
@@ -20202,7 +20413,7 @@ function FieldHistoryPanel({
20202
20413
  /* @__PURE__ */ jsx67("span", { className: "mx-1 text-muted-foreground", children: "\u2192" }),
20203
20414
  /* @__PURE__ */ jsx67("strong", { className: "font-medium", children: say(row.after, void 0) })
20204
20415
  ] }),
20205
- /* @__PURE__ */ jsx67("span", { className: "shrink-0 text-muted-foreground", children: row.actor.kind === "agent" ? /* @__PURE__ */ jsxs61(Fragment25, { children: [
20416
+ /* @__PURE__ */ jsx67("span", { className: "shrink-0 text-muted-foreground", children: row.actor.kind === "agent" ? /* @__PURE__ */ jsxs61(Fragment26, { children: [
20206
20417
  /* @__PURE__ */ jsx67(Badge17, { variant: "outline", className: "mr-1 text-[10px]", children: "agent" }),
20207
20418
  "for ",
20208
20419
  row.actor.on_behalf_of?.name ?? "a person"
@@ -20350,7 +20561,7 @@ function submissionStamp(args) {
20350
20561
  import { useCallback as useCallback30, useEffect as useEffect47, useMemo as useMemo35, useState as useState58 } from "react";
20351
20562
  import { useRecordsClient as useRecordsClient42, useTables as useTables3 } from "@ai-matrx/records/react";
20352
20563
  import { BasicInput as BasicInput17, Button as Button50, Checkbox as Checkbox8, Label as Label13, Separator as Separator9, Skeleton as Skeleton16, cn as cn42 } from "@ai-matrx/design-system";
20353
- import { Fragment as Fragment26, jsx as jsx68, jsxs as jsxs62 } from "react/jsx-runtime";
20564
+ import { Fragment as Fragment27, jsx as jsx68, jsxs as jsxs62 } from "react/jsx-runtime";
20354
20565
  var RESTATING_REPLACES = "Saving replaces what this portal shows: a table you untick stops being visible to every client the moment you save. Who is invited is not touched.";
20355
20566
  function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
20356
20567
  const client = useRecordsClient42();
@@ -20501,7 +20712,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
20501
20712
  ),
20502
20713
  /* @__PURE__ */ jsx68("span", { className: "text-xs text-muted-foreground", children: "One record in this table is one client. Their sign-in is a one-time link emailed to them \u2014 a portal never holds a password." })
20503
20714
  ] }),
20504
- clientTableId ? /* @__PURE__ */ jsxs62(Fragment26, { children: [
20715
+ clientTableId ? /* @__PURE__ */ jsxs62(Fragment27, { children: [
20505
20716
  /* @__PURE__ */ jsx68(Separator9, {}),
20506
20717
  /* @__PURE__ */ jsxs62("div", { className: "flex flex-col gap-2", children: [
20507
20718
  /* @__PURE__ */ jsx68(Label13, { className: "text-xs font-medium", children: "What they can see" }),
@@ -20597,7 +20808,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
20597
20808
  " yet."
20598
20809
  ] }) : null
20599
20810
  ] }) : null,
20600
- savedId ? /* @__PURE__ */ jsxs62(Fragment26, { children: [
20811
+ savedId ? /* @__PURE__ */ jsxs62(Fragment27, { children: [
20601
20812
  /* @__PURE__ */ jsx68(Separator9, {}),
20602
20813
  /* @__PURE__ */ jsxs62("div", { className: "flex flex-col gap-2", children: [
20603
20814
  /* @__PURE__ */ jsx68(Label13, { className: "text-xs font-medium", children: "Invite a client" }),
@@ -20974,7 +21185,7 @@ function PortalLookEditor({ card, onSaved, className }) {
20974
21185
  }
20975
21186
 
20976
21187
  // src/PortalsPanel.tsx
20977
- import { Fragment as Fragment27, jsx as jsx71, jsxs as jsxs65 } from "react/jsx-runtime";
21188
+ import { Fragment as Fragment28, jsx as jsx71, jsxs as jsxs65 } from "react/jsx-runtime";
20978
21189
  var PORTAL_NOT_HERE_LINE = "The link named a portal this table is not part of \u2014 it may have been archived, or it shows other tables. The portals this table is in are listed here.";
20979
21190
  function revokeConsequence(person, portalTitle) {
20980
21191
  const who = person.client ? `${person.email} (${person.client})` : person.email;
@@ -21084,7 +21295,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
21084
21295
  buildLabel: elsewhere > 0 ? "Build a new portal" : "Build the portal",
21085
21296
  children: [
21086
21297
  "A portal is how one of your clients signs in and sees the records that name them \u2014 their jobs, their invoices \u2014 and nothing else.",
21087
- elsewhere > 0 ? /* @__PURE__ */ jsxs65(Fragment27, { children: [
21298
+ elsewhere > 0 ? /* @__PURE__ */ jsxs65(Fragment28, { children: [
21088
21299
  " ",
21089
21300
  "This table is not in",
21090
21301
  " ",
@@ -21212,7 +21423,7 @@ function ArchivePortalControl({
21212
21423
  if (said) {
21213
21424
  return /* @__PURE__ */ jsx71("span", { className: "text-xs text-muted-foreground", "data-testid": "portal-archived-said", children: said });
21214
21425
  }
21215
- return /* @__PURE__ */ jsxs65(Fragment27, { children: [
21426
+ return /* @__PURE__ */ jsxs65(Fragment28, { children: [
21216
21427
  /* @__PURE__ */ jsx71(
21217
21428
  Button53,
21218
21429
  {
@@ -21260,7 +21471,7 @@ function ArchivePortalControl({
21260
21471
  function CopyLink({ url, what }) {
21261
21472
  const [copied, setCopied] = useState60(false);
21262
21473
  const [shown3, setShown] = useState60(false);
21263
- return /* @__PURE__ */ jsxs65(Fragment27, { children: [
21474
+ return /* @__PURE__ */ jsxs65(Fragment28, { children: [
21264
21475
  /* @__PURE__ */ jsx71(
21265
21476
  Button53,
21266
21477
  {
@@ -21404,13 +21615,13 @@ function PortalCardView({
21404
21615
  ] })
21405
21616
  ] }, exposed.table_id))
21406
21617
  ] }),
21407
- look ? /* @__PURE__ */ jsxs65(Fragment27, { children: [
21618
+ look ? /* @__PURE__ */ jsxs65(Fragment28, { children: [
21408
21619
  /* @__PURE__ */ jsx71(Separator10, {}),
21409
21620
  look
21410
21621
  ] }) : null,
21411
21622
  /* @__PURE__ */ jsx71(Separator10, {}),
21412
21623
  /* @__PURE__ */ jsx71(People, { card, onRevoke, onPreview, origin }),
21413
- invite ? /* @__PURE__ */ jsxs65(Fragment27, { children: [
21624
+ invite ? /* @__PURE__ */ jsxs65(Fragment28, { children: [
21414
21625
  /* @__PURE__ */ jsx71(Separator10, {}),
21415
21626
  invite
21416
21627
  ] }) : null
@@ -21609,7 +21820,7 @@ function Invite({ card, onInvited }) {
21609
21820
  /* @__PURE__ */ jsx71("p", { className: "text-xs text-muted-foreground", children: "Pick the client they are, and say where to send their sign-in link. They get nothing until they follow it." }),
21610
21821
  error ? /* @__PURE__ */ jsx71(RefusalNotice, { error }) : null,
21611
21822
  said ? /* @__PURE__ */ jsx71("p", { className: "text-xs text-muted-foreground", children: said }) : null,
21612
- rows === null ? /* @__PURE__ */ jsx71(Skeleton17, { className: "h-9 w-full" }) : /* @__PURE__ */ jsxs65(Fragment27, { children: [
21823
+ rows === null ? /* @__PURE__ */ jsx71(Skeleton17, { className: "h-9 w-full" }) : /* @__PURE__ */ jsxs65(Fragment28, { children: [
21613
21824
  /* @__PURE__ */ jsx71(
21614
21825
  BasicInput19,
21615
21826
  {
@@ -21665,7 +21876,7 @@ function Invite({ card, onInvited }) {
21665
21876
  import { useCallback as useCallback32, useEffect as useEffect50, useMemo as useMemo38, useState as useState61 } from "react";
21666
21877
  import { useRecordsClient as useRecordsClient45 } from "@ai-matrx/records/react";
21667
21878
  import { BasicInput as BasicInput20, Button as Button54, Checkbox as Checkbox9, Label as Label14, Separator as Separator11, Skeleton as Skeleton18, cn as cn46 } from "@ai-matrx/design-system";
21668
- import { Fragment as Fragment28, jsx as jsx72, jsxs as jsxs66 } from "react/jsx-runtime";
21879
+ import { Fragment as Fragment29, jsx as jsx72, jsxs as jsxs66 } from "react/jsx-runtime";
21669
21880
  var WEEKDAYS = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
21670
21881
  var CADENCE_WORDS = {
21671
21882
  instant: "the moment something arrives",
@@ -21884,7 +22095,7 @@ function DigestScheduler({
21884
22095
  ] }),
21885
22096
  /* @__PURE__ */ jsxs66("div", { className: "flex flex-col gap-1.5", children: [
21886
22097
  /* @__PURE__ */ jsx72(Label14, { className: "text-xs font-medium", children: "Who to send it to" }),
21887
- members === null ? /* @__PURE__ */ jsx72(Skeleton18, { className: "h-8 w-full" }) : members.length === 0 ? /* @__PURE__ */ jsx72("p", { className: "text-xs text-muted-foreground", children: "Nobody else is offered here, so this will be addressed to you. Who the people are is the platform's answer and this screen reaches it through its host's `members` port, which is not bound here." }) : /* @__PURE__ */ jsxs66(Fragment28, { children: [
22098
+ members === null ? /* @__PURE__ */ jsx72(Skeleton18, { className: "h-8 w-full" }) : members.length === 0 ? /* @__PURE__ */ jsx72("p", { className: "text-xs text-muted-foreground", children: "Nobody else is offered here, so this will be addressed to you. Who the people are is the platform's answer and this screen reaches it through its host's `members` port, which is not bound here." }) : /* @__PURE__ */ jsxs66(Fragment29, { children: [
21888
22099
  /* @__PURE__ */ jsx72("div", { className: "flex flex-wrap gap-x-4 gap-y-1.5", children: members.map((m) => /* @__PURE__ */ jsxs66("label", { className: "flex items-center gap-1.5 text-xs", children: [
21889
22100
  /* @__PURE__ */ jsx72(
21890
22101
  Checkbox9,
@@ -21926,7 +22137,7 @@ function DigestScheduler({
21926
22137
  ),
21927
22138
  /* @__PURE__ */ jsx72("span", { className: "text-xs text-muted-foreground", children: "A send inside these hours waits until they end \u2014 it is never dropped." })
21928
22139
  ] }) : null,
21929
- outcomes ? /* @__PURE__ */ jsxs66(Fragment28, { children: [
22140
+ outcomes ? /* @__PURE__ */ jsxs66(Fragment29, { children: [
21930
22141
  /* @__PURE__ */ jsx72(Separator11, {}),
21931
22142
  /* @__PURE__ */ jsx72("div", { className: "flex flex-col gap-1.5", children: outcomes.map((o) => /* @__PURE__ */ jsx72("div", { className: "text-xs", children: o.ruleId ? /* @__PURE__ */ jsxs66("span", { children: [
21932
22143
  o.who,
@@ -22421,7 +22632,7 @@ import {
22421
22632
  import { useCallback as useCallback35, useEffect as useEffect54, useMemo as useMemo39, useRef as useRef22, useState as useState65 } from "react";
22422
22633
  import { useFields as useFields18, useOptionalRecordsClient as useOptionalRecordsClient7 } from "@ai-matrx/records/react";
22423
22634
  import { Button as Button57, Progress, Skeleton as Skeleton21, cn as cn49 } from "@ai-matrx/design-system";
22424
- import { Fragment as Fragment29, jsx as jsx75, jsxs as jsxs69 } from "react/jsx-runtime";
22635
+ import { Fragment as Fragment30, jsx as jsx75, jsxs as jsxs69 } from "react/jsx-runtime";
22425
22636
  function authored(host, text, where) {
22426
22637
  return host.renderText ? host.renderText(text, where) : text;
22427
22638
  }
@@ -22797,7 +23008,7 @@ function Question({
22797
23008
  return /* @__PURE__ */ jsxs69("div", { className: "flex flex-col gap-1.5", children: [
22798
23009
  /* @__PURE__ */ jsx75(FieldLabel, { field: { ...field2, label: question.ask, required: question.required }, htmlFor: id }),
22799
23010
  question.help ? /* @__PURE__ */ jsx75("p", { className: "text-xs text-muted-foreground", children: authored(host, question.help, "form-help") }) : null,
22800
- isAttachment && !upload ? /* @__PURE__ */ jsx75("p", { className: "rounded border border-dashed px-2 py-1 text-xs text-muted-foreground", children: NO_UPLOAD_REASON }) : isAttachment ? /* @__PURE__ */ jsxs69(Fragment29, { children: [
23011
+ isAttachment && !upload ? /* @__PURE__ */ jsx75("p", { className: "rounded border border-dashed px-2 py-1 text-xs text-muted-foreground", children: NO_UPLOAD_REASON }) : isAttachment ? /* @__PURE__ */ jsxs69(Fragment30, { children: [
22801
23012
  /* @__PURE__ */ jsx75(
22802
23013
  "input",
22803
23014
  {
@@ -23101,7 +23312,7 @@ function whyNotAskable(fields, hidden = []) {
23101
23312
  }
23102
23313
 
23103
23314
  // src/FormBuilder.tsx
23104
- import { Fragment as Fragment30, jsx as jsx77, jsxs as jsxs71 } from "react/jsx-runtime";
23315
+ import { Fragment as Fragment31, jsx as jsx77, jsxs as jsxs71 } from "react/jsx-runtime";
23105
23316
  function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
23106
23317
  const client = useRecordsClient50();
23107
23318
  const publishGate = usePublishGate();
@@ -23286,7 +23497,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
23286
23497
  }
23287
23498
  }
23288
23499
  ) : null,
23289
- !draft ? /* @__PURE__ */ jsx77("p", { className: "text-xs text-muted-foreground", children: (fields.data ?? []).length === 0 ? "This table has no fields yet, so there is nothing a form could ask for. Add a field first \u2014 every question is one of this table's own fields." : 'No form collects into this table yet. "New form" makes one, or you ask an agent for the whole thing in a sentence.' }) : /* @__PURE__ */ jsxs71(Fragment30, { children: [
23500
+ !draft ? /* @__PURE__ */ jsx77("p", { className: "text-xs text-muted-foreground", children: (fields.data ?? []).length === 0 ? "This table has no fields yet, so there is nothing a form could ask for. Add a field first \u2014 every question is one of this table's own fields." : 'No form collects into this table yet. "New form" makes one, or you ask an agent for the whole thing in a sentence.' }) : /* @__PURE__ */ jsxs71(Fragment31, { children: [
23290
23501
  /* @__PURE__ */ jsx77(
23291
23502
  PublishRow,
23292
23503
  {
@@ -23499,7 +23710,7 @@ function PublishRow({
23499
23710
  children: busy ? "\u2026" : open ? "Unpublish" : "Publish"
23500
23711
  }
23501
23712
  ) : null,
23502
- state !== "draft" ? /* @__PURE__ */ jsxs71(Fragment30, { children: [
23713
+ state !== "draft" ? /* @__PURE__ */ jsxs71(Fragment31, { children: [
23503
23714
  /* @__PURE__ */ jsx77(
23504
23715
  "a",
23505
23716
  {
@@ -24332,7 +24543,7 @@ import {
24332
24543
  } from "@ai-matrx/records";
24333
24544
  import { mapPgError } from "@ai-matrx/records/core";
24334
24545
  import { cn as cn56 } from "@ai-matrx/design-system";
24335
- import { Fragment as Fragment31, jsx as jsx82, jsxs as jsxs76 } from "react/jsx-runtime";
24546
+ import { Fragment as Fragment32, jsx as jsx82, jsxs as jsxs76 } from "react/jsx-runtime";
24336
24547
  var priorKey = (key) => `prior__${key}`;
24337
24548
  function Trend({ pct, aimingUp, className }) {
24338
24549
  if (pct === null || pct === void 0) return null;
@@ -24483,7 +24694,7 @@ function ChartBlock({ block, subject, className }) {
24483
24694
  ] }),
24484
24695
  block.compare_refused ? /* @__PURE__ */ jsx82("p", { className: "px-1 text-xs text-muted-foreground", children: block.compare_refused }) : null,
24485
24696
  !block.refused && targetNote(target) ? /* @__PURE__ */ jsx82("p", { className: "px-1 text-xs text-muted-foreground", children: targetNote(target) }) : null,
24486
- block.refused ? /* @__PURE__ */ jsx82(RefusalNotice, { error: asRefusal2(block) }) : needs ? /* @__PURE__ */ jsx82("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: needs }) : kind === "stuck" ? /* @__PURE__ */ jsx82(StuckList, { rows: block.rows ?? [] }) : points.length === 0 ? /* @__PURE__ */ jsx82("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: "The store answered this question with no groups at all, so there is nothing to draw yet." }) : /* @__PURE__ */ jsx82(Fragment31, { children: kind === "number" ? /* @__PURE__ */ jsx82(BigNumber, { points, measure: primary, onDrill: drill, block }) : kind === "table" ? /* @__PURE__ */ jsx82(GroupTable, { points, series, onDrill: drill }) : /* @__PURE__ */ jsxs76(Fragment31, { children: [
24697
+ block.refused ? /* @__PURE__ */ jsx82(RefusalNotice, { error: asRefusal2(block) }) : needs ? /* @__PURE__ */ jsx82("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: needs }) : kind === "stuck" ? /* @__PURE__ */ jsx82(StuckList, { rows: block.rows ?? [] }) : points.length === 0 ? /* @__PURE__ */ jsx82("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: "The store answered this question with no groups at all, so there is nothing to draw yet." }) : /* @__PURE__ */ jsx82(Fragment32, { children: kind === "number" ? /* @__PURE__ */ jsx82(BigNumber, { points, measure: primary, onDrill: drill, block }) : kind === "table" ? /* @__PURE__ */ jsx82(GroupTable, { points, series, onDrill: drill }) : /* @__PURE__ */ jsxs76(Fragment32, { children: [
24487
24698
  /* @__PURE__ */ jsx82(Drawing, { kind, points, series, config, onDrill: drill, goal }),
24488
24699
  /* @__PURE__ */ jsx82(Values, { points, measure: primary, config, onDrill: drill, compared, aimingUp: !!target })
24489
24700
  ] }) })
@@ -24503,7 +24714,7 @@ function BigNumber({
24503
24714
  const windows = block.compare ?? null;
24504
24715
  const target = block.target ?? null;
24505
24716
  const priorTotal = block.totals?.prior;
24506
- const body = /* @__PURE__ */ jsxs76(Fragment31, { children: [
24717
+ const body = /* @__PURE__ */ jsxs76(Fragment32, { children: [
24507
24718
  /* @__PURE__ */ jsxs76("span", { className: "flex items-baseline gap-2", children: [
24508
24719
  /* @__PURE__ */ jsx82("span", { className: "text-2xl font-semibold tabular-nums", children: pretty(total) }),
24509
24720
  windows ? /* @__PURE__ */ jsx82(Trend, { pct: block.totals?.change_pct, aimingUp: !!target, className: "text-sm" }) : null
@@ -24547,7 +24758,7 @@ function Values({
24547
24758
  aimingUp
24548
24759
  }) {
24549
24760
  return /* @__PURE__ */ jsx82("ul", { className: "flex flex-wrap gap-x-2 gap-y-0.5", children: points.map((point) => {
24550
- const text = /* @__PURE__ */ jsxs76(Fragment31, { children: [
24761
+ const text = /* @__PURE__ */ jsxs76(Fragment32, { children: [
24551
24762
  /* @__PURE__ */ jsx82(
24552
24763
  "span",
24553
24764
  {
@@ -24727,10 +24938,10 @@ function Drawing({
24727
24938
  margin: { top: 6, right: 6, bottom: 0, left: 0 },
24728
24939
  children: [
24729
24940
  /* @__PURE__ */ jsx82(CartesianGrid, { vertical: horizontal, horizontal: !horizontal }),
24730
- horizontal ? /* @__PURE__ */ jsxs76(Fragment31, { children: [
24941
+ horizontal ? /* @__PURE__ */ jsxs76(Fragment32, { children: [
24731
24942
  /* @__PURE__ */ jsx82(XAxis, { type: "number", ...axis }),
24732
24943
  /* @__PURE__ */ jsx82(YAxis, { type: "category", dataKey: "label", width: 88, ...axis })
24733
- ] }) : /* @__PURE__ */ jsxs76(Fragment31, { children: [
24944
+ ] }) : /* @__PURE__ */ jsxs76(Fragment32, { children: [
24734
24945
  /* @__PURE__ */ jsx82(XAxis, { dataKey: "label", ...axis }),
24735
24946
  /* @__PURE__ */ jsx82(YAxis, { width: 44, ...axis })
24736
24947
  ] }),
@@ -24760,15 +24971,15 @@ import { useFields as useFields22, useRecordsClient as useRecordsClient54, useTa
24760
24971
  import {
24761
24972
  BasicInput as BasicInput25,
24762
24973
  Button as Button63,
24763
- Select as Select7,
24764
- SelectContent as SelectContent7,
24765
- SelectItem as SelectItem7,
24766
- SelectTrigger as SelectTrigger7,
24767
- SelectValue as SelectValue7,
24974
+ Select as Select8,
24975
+ SelectContent as SelectContent8,
24976
+ SelectItem as SelectItem8,
24977
+ SelectTrigger as SelectTrigger8,
24978
+ SelectValue as SelectValue8,
24768
24979
  Skeleton as Skeleton27,
24769
24980
  cn as cn57
24770
24981
  } from "@ai-matrx/design-system";
24771
- import { Fragment as Fragment32, jsx as jsx83, jsxs as jsxs77 } from "react/jsx-runtime";
24982
+ import { Fragment as Fragment33, jsx as jsx83, jsxs as jsxs77 } from "react/jsx-runtime";
24772
24983
  function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
24773
24984
  const client = useRecordsClient54();
24774
24985
  const host = useRecordsUi();
@@ -24943,15 +25154,15 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
24943
25154
  rights.admin ? /* @__PURE__ */ jsx83(Button63, { size: "sm", variant: "ghost", onClick: () => void create(), children: "New dashboard" }) : null,
24944
25155
  board ? /* @__PURE__ */ jsxs77("span", { className: "ml-auto flex items-center gap-1", children: [
24945
25156
  (board.blocks ?? []).some((b) => !!b.bucket) ? /* @__PURE__ */ jsxs77(
24946
- Select7,
25157
+ Select8,
24947
25158
  {
24948
25159
  value: grain ?? "saved",
24949
25160
  onValueChange: (v) => setGrain(v === "saved" ? null : v),
24950
25161
  children: [
24951
- /* @__PURE__ */ jsx83(SelectTrigger7, { size: "sm", "aria-label": "Date grain for every chart on this dashboard", className: "h-7 min-w-[8rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue7, {}) }),
24952
- /* @__PURE__ */ jsxs77(SelectContent7, { children: [
24953
- /* @__PURE__ */ jsx83(SelectItem7, { value: "saved", children: "By the saved grain" }),
24954
- Object.keys(GRAIN_LABEL).map((g) => /* @__PURE__ */ jsxs77(SelectItem7, { value: g, children: [
25162
+ /* @__PURE__ */ jsx83(SelectTrigger8, { size: "sm", "aria-label": "Date grain for every chart on this dashboard", className: "h-7 min-w-[8rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue8, {}) }),
25163
+ /* @__PURE__ */ jsxs77(SelectContent8, { children: [
25164
+ /* @__PURE__ */ jsx83(SelectItem8, { value: "saved", children: "By the saved grain" }),
25165
+ Object.keys(GRAIN_LABEL).map((g) => /* @__PURE__ */ jsxs77(SelectItem8, { value: g, children: [
24955
25166
  "By ",
24956
25167
  GRAIN_LABEL[g].toLowerCase()
24957
25168
  ] }, g))
@@ -24978,7 +25189,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
24978
25189
  children: scheduling ? "Done" : "Send on a schedule"
24979
25190
  }
24980
25191
  ),
24981
- rights.admin && askingToRemove === board.id ? /* @__PURE__ */ jsxs77(Fragment32, { children: [
25192
+ rights.admin && askingToRemove === board.id ? /* @__PURE__ */ jsxs77(Fragment33, { children: [
24982
25193
  /* @__PURE__ */ jsx83("span", { className: "text-xs text-destructive", children: archiveConfirmSentence(`the dashboard \u201C${board.name}\u201D`) }),
24983
25194
  /* @__PURE__ */ jsx83(Button63, { size: "sm", variant: "destructive", onClick: () => void remove(board), children: "Remove it" }),
24984
25195
  /* @__PURE__ */ jsx83(Button63, { size: "sm", variant: "ghost", onClick: () => setAskingToRemove(null), children: "Keep it" })
@@ -25021,7 +25232,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
25021
25232
  !host.onReask ? /* @__PURE__ */ jsx83("p", { className: "text-xs text-muted-foreground", children: NO_REASK_REASON }) : null
25022
25233
  ] }) : null,
25023
25234
  notKept ? /* @__PURE__ */ jsx83("p", { role: "status", "data-records-dashboard-not-kept": "", className: "text-xs text-amber-700 dark:text-amber-400", children: notKept }) : null,
25024
- !board ? /* @__PURE__ */ jsx83("p", { className: "text-xs text-muted-foreground", children: rights.admin ? "No dashboard looks at this table yet. \u201CNew dashboard\u201D makes one, or ask an agent for the one you want and it writes the whole thing." : rights.why("structure") }) : run === null ? /* @__PURE__ */ jsx83(Skeleton27, { className: "h-64 w-full" }) : run.blocks.length === 0 ? /* @__PURE__ */ jsx83("p", { className: "text-xs text-muted-foreground", children: "This dashboard has no blocks yet. Each one is a single question the store answers \u2014 grouped, bucketed and measured inside the read door." }) : /* @__PURE__ */ jsxs77(Fragment32, { children: [
25235
+ !board ? /* @__PURE__ */ jsx83("p", { className: "text-xs text-muted-foreground", children: rights.admin ? "No dashboard looks at this table yet. \u201CNew dashboard\u201D makes one, or ask an agent for the one you want and it writes the whole thing." : rights.why("structure") }) : run === null ? /* @__PURE__ */ jsx83(Skeleton27, { className: "h-64 w-full" }) : run.blocks.length === 0 ? /* @__PURE__ */ jsx83("p", { className: "text-xs text-muted-foreground", children: "This dashboard has no blocks yet. Each one is a single question the store answers \u2014 grouped, bucketed and measured inside the read door." }) : /* @__PURE__ */ jsxs77(Fragment33, { children: [
25025
25236
  /* @__PURE__ */ jsx83("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3", children: run.blocks.map((block, index) => /* @__PURE__ */ jsxs77("div", { className: "flex min-w-0 flex-col gap-1", children: [
25026
25237
  /* @__PURE__ */ jsx83(ChartBlock, { block, subject: tableId }),
25027
25238
  rights.admin && board.blocks[index] ? /* @__PURE__ */ jsxs77("div", { className: "flex flex-wrap items-center gap-1 text-xs", children: [
@@ -25127,20 +25338,20 @@ function GroupingPicker({
25127
25338
  return /* @__PURE__ */ jsx83("span", { className: "text-muted-foreground", children: "This table has no columns yet, so there is nothing to group this block by." });
25128
25339
  }
25129
25340
  const known = choices.some((c) => c.field.key === current);
25130
- return /* @__PURE__ */ jsxs77(Fragment32, { children: [
25341
+ return /* @__PURE__ */ jsxs77(Fragment33, { children: [
25131
25342
  /* @__PURE__ */ jsx83("label", { className: "text-muted-foreground", htmlFor: `block-group-${block.title}`, children: "Group by" }),
25132
- /* @__PURE__ */ jsxs77(Select7, { value: known ? current : "", onValueChange: onPick, children: [
25343
+ /* @__PURE__ */ jsxs77(Select8, { value: known ? current : "", onValueChange: onPick, children: [
25133
25344
  /* @__PURE__ */ jsx83(
25134
- SelectTrigger7,
25345
+ SelectTrigger8,
25135
25346
  {
25136
25347
  size: "sm",
25137
25348
  id: `block-group-${block.title}`,
25138
25349
  "aria-label": `Which column ${block.title} is grouped by`,
25139
25350
  className: "h-7 min-w-[10rem] text-xs",
25140
- children: /* @__PURE__ */ jsx83(SelectValue7, { placeholder: "Choose a column" })
25351
+ children: /* @__PURE__ */ jsx83(SelectValue8, { placeholder: "Choose a column" })
25141
25352
  }
25142
25353
  ),
25143
- /* @__PURE__ */ jsx83(SelectContent7, { children: choices.map(({ field: field2, unusual }) => /* @__PURE__ */ jsx83(SelectItem7, { value: field2.key, children: unusual ? `${fieldName(field2)} \u2014 ${UNUSUAL_FIELD_NOTE}` : fieldName(field2) }, field2.key)) })
25354
+ /* @__PURE__ */ jsx83(SelectContent8, { children: choices.map(({ field: field2, unusual }) => /* @__PURE__ */ jsx83(SelectItem8, { value: field2.key, children: unusual ? `${fieldName(field2)} \u2014 ${UNUSUAL_FIELD_NOTE}` : fieldName(field2) }, field2.key)) })
25144
25355
  ] }),
25145
25356
  known ? null : /* @__PURE__ */ jsx83("span", { className: "text-muted-foreground", children: "The column this block was grouped by is no longer on this table \u2014 choose another." })
25146
25357
  ] });
@@ -25224,9 +25435,9 @@ function CompareControl({
25224
25435
  // that has one does not lose it by being shown.
25225
25436
  (k) => k !== "range" || current === "range"
25226
25437
  );
25227
- return /* @__PURE__ */ jsxs77(Fragment32, { children: [
25438
+ return /* @__PURE__ */ jsxs77(Fragment33, { children: [
25228
25439
  /* @__PURE__ */ jsxs77(
25229
- Select7,
25440
+ Select8,
25230
25441
  {
25231
25442
  value: current ?? "none",
25232
25443
  onValueChange: (v) => {
@@ -25240,22 +25451,22 @@ function CompareControl({
25240
25451
  });
25241
25452
  },
25242
25453
  children: [
25243
- /* @__PURE__ */ jsx83(SelectTrigger7, { size: "sm", "aria-label": `What ${block.title} is compared with`, className: "h-7 w-auto min-w-[9rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue7, {}) }),
25244
- /* @__PURE__ */ jsxs77(SelectContent7, { children: [
25245
- /* @__PURE__ */ jsx83(SelectItem7, { value: "none", children: "No comparison" }),
25246
- kinds.map((k) => /* @__PURE__ */ jsx83(SelectItem7, { value: k, children: COMPARE_LABEL[k] }, k))
25454
+ /* @__PURE__ */ jsx83(SelectTrigger8, { size: "sm", "aria-label": `What ${block.title} is compared with`, className: "h-7 w-auto min-w-[9rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue8, {}) }),
25455
+ /* @__PURE__ */ jsxs77(SelectContent8, { children: [
25456
+ /* @__PURE__ */ jsx83(SelectItem8, { value: "none", children: "No comparison" }),
25457
+ kinds.map((k) => /* @__PURE__ */ jsx83(SelectItem8, { value: k, children: COMPARE_LABEL[k] }, k))
25247
25458
  ] })
25248
25459
  ]
25249
25460
  }
25250
25461
  ),
25251
25462
  current && !explicitWindow ? /* @__PURE__ */ jsxs77(
25252
- Select7,
25463
+ Select8,
25253
25464
  {
25254
25465
  value: period,
25255
25466
  onValueChange: (v) => onChange({ ...block.compare ?? { against: current, key }, period: v }),
25256
25467
  children: [
25257
- /* @__PURE__ */ jsx83(SelectTrigger7, { size: "sm", "aria-label": `Which period ${block.title} shows`, className: "h-7 w-auto min-w-[7rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue7, {}) }),
25258
- /* @__PURE__ */ jsx83(SelectContent7, { children: Object.keys(GRAIN_LABEL).map((g) => /* @__PURE__ */ jsxs77(SelectItem7, { value: g, children: [
25468
+ /* @__PURE__ */ jsx83(SelectTrigger8, { size: "sm", "aria-label": `Which period ${block.title} shows`, className: "h-7 w-auto min-w-[7rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue8, {}) }),
25469
+ /* @__PURE__ */ jsx83(SelectContent8, { children: Object.keys(GRAIN_LABEL).map((g) => /* @__PURE__ */ jsxs77(SelectItem8, { value: g, children: [
25259
25470
  "This ",
25260
25471
  GRAIN_LABEL[g].toLowerCase()
25261
25472
  ] }, g)) })
@@ -25286,9 +25497,9 @@ function TargetControl({
25286
25497
  if (draft.trim() === "" || !Number.isFinite(n) || n === savedValue) return;
25287
25498
  onChange({ value: n, label: label && saved === "value" ? label : "Target", ...per ? { per } : {} });
25288
25499
  }
25289
- return /* @__PURE__ */ jsxs77(Fragment32, { children: [
25500
+ return /* @__PURE__ */ jsxs77(Fragment33, { children: [
25290
25501
  /* @__PURE__ */ jsxs77(
25291
- Select7,
25502
+ Select8,
25292
25503
  {
25293
25504
  value: mode,
25294
25505
  onValueChange: (v) => {
@@ -25297,11 +25508,11 @@ function TargetControl({
25297
25508
  if (next === "none" && saved !== "none") onChange(null);
25298
25509
  },
25299
25510
  children: [
25300
- /* @__PURE__ */ jsx83(SelectTrigger7, { size: "sm", "aria-label": `The target ${block.title} aims for`, className: "h-7 w-auto min-w-[8rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue7, {}) }),
25301
- /* @__PURE__ */ jsxs77(SelectContent7, { children: [
25302
- /* @__PURE__ */ jsx83(SelectItem7, { value: "none", children: "No target" }),
25303
- /* @__PURE__ */ jsx83(SelectItem7, { value: "value", children: "A target number" }),
25304
- columns.length > 0 ? /* @__PURE__ */ jsx83(SelectItem7, { value: "field", children: "A goal column" }) : null
25511
+ /* @__PURE__ */ jsx83(SelectTrigger8, { size: "sm", "aria-label": `The target ${block.title} aims for`, className: "h-7 w-auto min-w-[8rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue8, {}) }),
25512
+ /* @__PURE__ */ jsxs77(SelectContent8, { children: [
25513
+ /* @__PURE__ */ jsx83(SelectItem8, { value: "none", children: "No target" }),
25514
+ /* @__PURE__ */ jsx83(SelectItem8, { value: "value", children: "A target number" }),
25515
+ columns.length > 0 ? /* @__PURE__ */ jsx83(SelectItem8, { value: "field", children: "A goal column" }) : null
25305
25516
  ] })
25306
25517
  ]
25307
25518
  }
@@ -25322,7 +25533,7 @@ function TargetControl({
25322
25533
  }
25323
25534
  ) : null,
25324
25535
  mode === "field" ? /* @__PURE__ */ jsxs77(
25325
- Select7,
25536
+ Select8,
25326
25537
  {
25327
25538
  value: block.target && "field" in block.target && block.target.field ? block.target.field : "",
25328
25539
  onValueChange: (key) => {
@@ -25331,8 +25542,8 @@ function TargetControl({
25331
25542
  onChange({ field: key, op: "sum", label: fieldName(picked) });
25332
25543
  },
25333
25544
  children: [
25334
- /* @__PURE__ */ jsx83(SelectTrigger7, { size: "sm", "aria-label": `Which column holds the goal for ${block.title}`, className: "h-7 w-auto min-w-[9rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue7, { placeholder: "Choose a column" }) }),
25335
- /* @__PURE__ */ jsx83(SelectContent7, { children: columns.map((f) => /* @__PURE__ */ jsx83(SelectItem7, { value: f.key, children: fieldName(f) }, f.key)) })
25545
+ /* @__PURE__ */ jsx83(SelectTrigger8, { size: "sm", "aria-label": `Which column holds the goal for ${block.title}`, className: "h-7 w-auto min-w-[9rem] text-xs", children: /* @__PURE__ */ jsx83(SelectValue8, { placeholder: "Choose a column" }) }),
25546
+ /* @__PURE__ */ jsx83(SelectContent8, { children: columns.map((f) => /* @__PURE__ */ jsx83(SelectItem8, { value: f.key, children: fieldName(f) }, f.key)) })
25336
25547
  ]
25337
25548
  }
25338
25549
  ) : null
@@ -25344,7 +25555,7 @@ import { useCallback as useCallback42, useEffect as useEffect62, useState as use
25344
25555
  import { useRecordsClient as useRecordsClient55, useTable as useTable20 } from "@ai-matrx/records/react";
25345
25556
  import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
25346
25557
  import { Badge as Badge20, Button as Button64, Skeleton as Skeleton28, cn as cn58 } from "@ai-matrx/design-system";
25347
- import { Fragment as Fragment33, jsx as jsx84, jsxs as jsxs78 } from "react/jsx-runtime";
25558
+ import { Fragment as Fragment34, jsx as jsx84, jsxs as jsxs78 } from "react/jsx-runtime";
25348
25559
  var FORM_NOT_HERE_LINE = "The link named a form this table does not have \u2014 it may have been removed, or it belongs to another table. The forms this table does have are listed here.";
25349
25560
  var WHAT_A_FORM_IS = "A form asks for this table's own fields, and its answers land here as ordinary records stamped with the form they came through.";
25350
25561
  var NO_ADMIN = "This table has no forms. Making one needs the admin level on it, because a form decides what people with no account may add here.";
@@ -25465,12 +25676,12 @@ function FormsPanel({ tableId, activeFormId, className }) {
25465
25676
  /* @__PURE__ */ jsxs78("p", { className: "mt-1.5 text-xs", children: [
25466
25677
  /* @__PURE__ */ jsx84("span", { className: "font-medium", children: form.in_table }),
25467
25678
  " in the table",
25468
- form.held > 0 ? /* @__PURE__ */ jsxs78(Fragment33, { children: [
25679
+ form.held > 0 ? /* @__PURE__ */ jsxs78(Fragment34, { children: [
25469
25680
  " \xB7 ",
25470
25681
  /* @__PURE__ */ jsx84("span", { className: "font-medium", children: form.held }),
25471
25682
  " waiting for someone"
25472
25683
  ] }) : null,
25473
- form.rejected > 0 ? /* @__PURE__ */ jsxs78(Fragment33, { children: [
25684
+ form.rejected > 0 ? /* @__PURE__ */ jsxs78(Fragment34, { children: [
25474
25685
  " \xB7 ",
25475
25686
  /* @__PURE__ */ jsx84("span", { className: "font-medium", children: form.rejected }),
25476
25687
  " turned away"
@@ -25515,7 +25726,7 @@ import {
25515
25726
  bookingPath
25516
25727
  } from "@ai-matrx/records";
25517
25728
  import { BasicInput as BasicInput26, BasicTextarea as BasicTextarea12, Button as Button65, Checkbox as Checkbox12, Label as Label18, Skeleton as Skeleton29, cn as cn59 } from "@ai-matrx/design-system";
25518
- import { Fragment as Fragment34, jsx as jsx85, jsxs as jsxs79 } from "react/jsx-runtime";
25729
+ import { Fragment as Fragment35, jsx as jsx85, jsxs as jsxs79 } from "react/jsx-runtime";
25519
25730
  var STORE_ANSWERS_THESE = ["slot", "status", "booked_with"];
25520
25731
  var DAYS = [
25521
25732
  { weekday: 1, label: "Mon" },
@@ -25756,7 +25967,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
25756
25967
  ),
25757
25968
  DAYS[i]?.label
25758
25969
  ] }),
25759
- w.on ? /* @__PURE__ */ jsxs79(Fragment34, { children: [
25970
+ w.on ? /* @__PURE__ */ jsxs79(Fragment35, { children: [
25760
25971
  /* @__PURE__ */ jsx85(
25761
25972
  BasicInput26,
25762
25973
  {
@@ -25861,7 +26072,7 @@ import { useCallback as useCallback44, useEffect as useEffect64, useMemo as useM
25861
26072
  import { useRecordsClient as useRecordsClient57, useMyLevels as useMyLevels2 } from "@ai-matrx/records/react";
25862
26073
  import { bookingPath as bookingPath2 } from "@ai-matrx/records";
25863
26074
  import { Badge as Badge21, Button as Button66, Skeleton as Skeleton30, cn as cn60 } from "@ai-matrx/design-system";
25864
- import { Fragment as Fragment35, jsx as jsx86, jsxs as jsxs80 } from "react/jsx-runtime";
26075
+ import { Fragment as Fragment36, jsx as jsx86, jsxs as jsxs80 } from "react/jsx-runtime";
25865
26076
  var BOOKING_NOT_HERE_LINE = "The link named a booking page this table does not have \u2014 it may have been closed for good, or it writes into another table. The booking pages this table does have are listed here.";
25866
26077
  var WHAT_A_BOOKING_PAGE_IS = "A booking page offers times you are free and writes each appointment into this table as an ordinary record.";
25867
26078
  function bookingSuggestion(tableName2) {
@@ -26001,12 +26212,12 @@ function BookingSlots({ tableId, activeBookingId, className }) {
26001
26212
  " \xB7 ",
26002
26213
  /* @__PURE__ */ jsx86("span", { className: "font-medium", children: page.booked }),
26003
26214
  " booked in all",
26004
- page.held > 0 ? /* @__PURE__ */ jsxs80(Fragment35, { children: [
26215
+ page.held > 0 ? /* @__PURE__ */ jsxs80(Fragment36, { children: [
26005
26216
  " \xB7 ",
26006
26217
  /* @__PURE__ */ jsx86("span", { className: "font-medium", children: page.held }),
26007
26218
  " being held right now"
26008
26219
  ] }) : null,
26009
- page.cancelled > 0 ? /* @__PURE__ */ jsxs80(Fragment35, { children: [
26220
+ page.cancelled > 0 ? /* @__PURE__ */ jsxs80(Fragment36, { children: [
26010
26221
  " \xB7 ",
26011
26222
  /* @__PURE__ */ jsx86("span", { className: "font-medium", children: page.cancelled }),
26012
26223
  " cancelled"
@@ -26463,7 +26674,7 @@ function CaptureRun({ sheetId, face: given, className }) {
26463
26674
  }
26464
26675
 
26465
26676
  // src/CaptureSheet.tsx
26466
- import { Fragment as Fragment36, jsx as jsx88, jsxs as jsxs82 } from "react/jsx-runtime";
26677
+ import { Fragment as Fragment37, jsx as jsx88, jsxs as jsxs82 } from "react/jsx-runtime";
26467
26678
  var CAPTURE_MODES = ["reading", "photo", "voice"];
26468
26679
  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.";
26469
26680
  function mintClientKey() {
@@ -26640,7 +26851,7 @@ function AdHocCaptureSheet({
26640
26851
  " ",
26641
26852
  /* @__PURE__ */ jsx88("code", { children: "attachmentField" }),
26642
26853
  "."
26643
- ] }) : /* @__PURE__ */ jsxs82(Fragment36, { children: [
26854
+ ] }) : /* @__PURE__ */ jsxs82(Fragment37, { children: [
26644
26855
  /* @__PURE__ */ jsx88(
26645
26856
  "input",
26646
26857
  {
@@ -26894,7 +27105,7 @@ import { useCallback as useCallback49, useEffect as useEffect69, useState as use
26894
27105
  import { useRecordsClient as useRecordsClient62 } from "@ai-matrx/records/react";
26895
27106
  import { Button as Button70, Input as Input5, Skeleton as Skeleton35, Textarea as Textarea4, cn as cn65 } from "@ai-matrx/design-system";
26896
27107
  import { useTable as useTable23 } from "@ai-matrx/records/react";
26897
- import { Fragment as Fragment37, jsx as jsx91, jsxs as jsxs85 } from "react/jsx-runtime";
27108
+ import { Fragment as Fragment38, jsx as jsx91, jsxs as jsxs85 } from "react/jsx-runtime";
26898
27109
  function EmbedFrame({
26899
27110
  tableId,
26900
27111
  formId,
@@ -26978,7 +27189,7 @@ function EmbedFrame({
26978
27189
  " will not pass."
26979
27190
  ] })
26980
27191
  ] }),
26981
- !secret ? /* @__PURE__ */ jsx91(Button70, { size: "sm", className: "self-start", disabled: busy || parsed.length === 0, onClick: () => void issue(), children: busy ? "Issuing\u2026" : "Issue embed" }) : /* @__PURE__ */ jsxs85(Fragment37, { children: [
27192
+ !secret ? /* @__PURE__ */ jsx91(Button70, { size: "sm", className: "self-start", disabled: busy || parsed.length === 0, onClick: () => void issue(), children: busy ? "Issuing\u2026" : "Issue embed" }) : /* @__PURE__ */ jsxs85(Fragment38, { children: [
26982
27193
  /* @__PURE__ */ jsx91("p", { className: "rounded border px-2 py-1 text-xs text-muted-foreground", children: "Copy this now. Only its digest is stored, so nobody \u2014 including us \u2014 can show it to you again; if it is lost, issue a new one and replace the old." }),
26983
27194
  /* @__PURE__ */ jsx91(Textarea4, { "aria-label": "Embed snippet", readOnly: true, rows: 3, className: "font-mono text-[11px]", value: snippet ?? "" }),
26984
27195
  /* @__PURE__ */ jsxs85("div", { className: "flex gap-2", children: [
@@ -27388,7 +27599,7 @@ function SharedNameAddress({
27388
27599
  }
27389
27600
 
27390
27601
  // src/TablesHome.tsx
27391
- import { Fragment as Fragment38, jsx as jsx95, jsxs as jsxs88 } from "react/jsx-runtime";
27602
+ import { Fragment as Fragment39, jsx as jsx95, jsxs as jsxs88 } from "react/jsx-runtime";
27392
27603
  var TABLE_LANES = ["mine", "organization", "system", "community", "app"];
27393
27604
  var LANE_TITLE = {
27394
27605
  mine: "Mine",
@@ -27516,7 +27727,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, classNa
27516
27727
  [client, name, onOpenTable, tables]
27517
27728
  );
27518
27729
  return /* @__PURE__ */ jsxs88("div", { className: cn67("flex min-h-0 flex-col gap-4", className), children: [
27519
- /* @__PURE__ */ jsx95("div", { className: "flex items-center gap-2", children: creating ? /* @__PURE__ */ jsxs88(Fragment38, { children: [
27730
+ /* @__PURE__ */ jsx95("div", { className: "flex items-center gap-2", children: creating ? /* @__PURE__ */ jsxs88(Fragment39, { children: [
27520
27731
  /* @__PURE__ */ jsx95(
27521
27732
  BasicInput27,
27522
27733
  {
@@ -27543,7 +27754,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, classNa
27543
27754
  }
27544
27755
  ),
27545
27756
  /* @__PURE__ */ jsx95(Button73, { size: "sm", variant: "ghost", onClick: () => setCreating(false), children: "Cancel" })
27546
- ] }) : /* @__PURE__ */ jsxs88(Fragment38, { children: [
27757
+ ] }) : /* @__PURE__ */ jsxs88(Fragment39, { children: [
27547
27758
  /* @__PURE__ */ jsx95(Button73, { size: "sm", onClick: () => setCreating(true), children: "New table" }),
27548
27759
  /* @__PURE__ */ jsx95(
27549
27760
  Button73,
@@ -27957,7 +28168,7 @@ function useSlotScroll(slot) {
27957
28168
  }
27958
28169
 
27959
28170
  // src/TablePage.tsx
27960
- import { Fragment as Fragment39, jsx as jsx97, jsxs as jsxs90 } from "react/jsx-runtime";
28171
+ import { Fragment as Fragment40, jsx as jsx97, jsxs as jsxs90 } from "react/jsx-runtime";
27961
28172
  var RAIL_TITLE = {
27962
28173
  settings: "Table settings",
27963
28174
  inbox: "Inbox",
@@ -28189,7 +28400,7 @@ function MenuEntry({
28189
28400
  onPress,
28190
28401
  separatorBefore
28191
28402
  }) {
28192
- return /* @__PURE__ */ jsxs90(Fragment39, { children: [
28403
+ return /* @__PURE__ */ jsxs90(Fragment40, { children: [
28193
28404
  separatorBefore ? /* @__PURE__ */ jsx97(DropdownMenuSeparator3, {}) : null,
28194
28405
  /* @__PURE__ */ jsx97(DropdownMenuCheckboxItem2, { checked, onSelect: () => onPress(), children: label })
28195
28406
  ] });
@@ -28464,7 +28675,7 @@ function TablePage({
28464
28675
  ]
28465
28676
  }
28466
28677
  );
28467
- const sheetExtras = controlsInSheet && main === "records" && !hostLayout && shownLayout === "grid" ? /* @__PURE__ */ jsxs90(Fragment39, { children: [
28678
+ const sheetExtras = controlsInSheet && main === "records" && !hostLayout && shownLayout === "grid" ? /* @__PURE__ */ jsxs90(Fragment40, { children: [
28468
28679
  /* @__PURE__ */ jsx97("div", { className: "flex items-center gap-2 text-xs", "data-table-sheet-filter": "", "data-matrx-table-tools-keep-open": "", children: /* @__PURE__ */ jsx97(ViewFilter, { tableId, view: shown3, onApply: (where) => void patchView({ where }) }) }),
28469
28680
  /* @__PURE__ */ jsxs90("div", { role: "group", "aria-label": "Layout", className: "flex flex-wrap gap-1 pt-1", "data-table-sheet-layout": "", children: [
28470
28681
  VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx97(
@@ -28494,7 +28705,7 @@ function TablePage({
28494
28705
  ] }),
28495
28706
  rights.share && canShare ? /* @__PURE__ */ jsx97(Button75, { size: "sm", variant: "ghost", className: "h-8", onClick: () => setShareAsked((n) => n + 1), "data-table-sheet-share": "", children: "Share\u2026" }) : null
28496
28707
  ] }) : void 0;
28497
- const pageActions = /* @__PURE__ */ jsxs90(Fragment39, { children: [
28708
+ const pageActions = /* @__PURE__ */ jsxs90(Fragment40, { children: [
28498
28709
  /* @__PURE__ */ jsx97(
28499
28710
  ShareControl,
28500
28711
  {
@@ -28515,7 +28726,7 @@ function TablePage({
28515
28726
  /* @__PURE__ */ jsx97("circle", { cx: "19", cy: "12", r: "1.75" })
28516
28727
  ] }) }) }),
28517
28728
  /* @__PURE__ */ jsxs90(DropdownMenuContent4, { align: "end", className: "w-56", "data-table-menu-content": "", children: [
28518
- !chooserInline && !chooserCompact ? /* @__PURE__ */ jsxs90(Fragment39, { children: [
28729
+ !chooserInline && !chooserCompact ? /* @__PURE__ */ jsxs90(Fragment40, { children: [
28519
28730
  /* @__PURE__ */ jsx97(DropdownMenuLabel3, { className: "text-xs text-muted-foreground", children: "Layout" }),
28520
28731
  layoutRadio,
28521
28732
  /* @__PURE__ */ jsx97(DropdownMenuSeparator3, {})
@@ -28530,15 +28741,15 @@ function TablePage({
28530
28741
  },
28531
28742
  entry.key
28532
28743
  )),
28533
- phone && rights.share && canShare ? /* @__PURE__ */ jsxs90(Fragment39, { children: [
28744
+ phone && rights.share && canShare ? /* @__PURE__ */ jsxs90(Fragment40, { children: [
28534
28745
  /* @__PURE__ */ jsx97(DropdownMenuSeparator3, {}),
28535
28746
  /* @__PURE__ */ jsx97(DropdownMenuItem4, { onSelect: () => setShareAsked((n) => n + 1), "data-table-menu-share": "", children: "Share\u2026" })
28536
28747
  ] }) : null,
28537
- canDesignate ? /* @__PURE__ */ jsxs90(Fragment39, { children: [
28748
+ canDesignate ? /* @__PURE__ */ jsxs90(Fragment40, { children: [
28538
28749
  /* @__PURE__ */ jsx97(DropdownMenuSeparator3, {}),
28539
28750
  /* @__PURE__ */ jsx97(DropdownMenuItem4, { onSelect: () => void designate(), "data-table-designate": layoutShowing ?? "", children: makeDefaultLabel(layoutShowingLabel) })
28540
28751
  ] }) : null,
28541
- menuExtras && menuExtras.length > 0 ? /* @__PURE__ */ jsxs90(Fragment39, { children: [
28752
+ menuExtras && menuExtras.length > 0 ? /* @__PURE__ */ jsxs90(Fragment40, { children: [
28542
28753
  /* @__PURE__ */ jsx97(DropdownMenuSeparator3, {}),
28543
28754
  menuExtras.map((extra) => /* @__PURE__ */ jsx97(DropdownMenuItem4, { onSelect: () => extra.onSelect(), "data-table-menu-extra": extra.key, children: extra.label }, extra.key))
28544
28755
  ] }) : null
@@ -28546,16 +28757,16 @@ function TablePage({
28546
28757
  ] }, "menu")
28547
28758
  ] });
28548
28759
  const headerNode = header ? header({ actions: table.data ? pageActions : null, tableName: table.data?.name ?? null }) : null;
28549
- if (table.error) return /* @__PURE__ */ jsxs90(Fragment39, { children: [
28760
+ if (table.error) return /* @__PURE__ */ jsxs90(Fragment40, { children: [
28550
28761
  headerNode,
28551
28762
  /* @__PURE__ */ jsx97(RefusalNotice, { error: table.error })
28552
28763
  ] });
28553
- if (table.loading) return /* @__PURE__ */ jsxs90(Fragment39, { children: [
28764
+ if (table.loading) return /* @__PURE__ */ jsxs90(Fragment40, { children: [
28554
28765
  headerNode,
28555
28766
  /* @__PURE__ */ jsx97(Skeleton38, { className: "h-40 w-full" })
28556
28767
  ] });
28557
28768
  if (!table.data) {
28558
- return /* @__PURE__ */ jsxs90(Fragment39, { children: [
28769
+ return /* @__PURE__ */ jsxs90(Fragment40, { children: [
28559
28770
  headerNode,
28560
28771
  /* @__PURE__ */ jsx97(TableNotHere, { tableId, onLeave, leaveLabel, className })
28561
28772
  ] });