@ai-matrx/records-ui 0.93.8 → 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";
@@ -5268,10 +5274,10 @@ function ChoiceColorsEditor({
5268
5274
 
5269
5275
  // src/ChoiceListEditor.tsx
5270
5276
  import { useEffect as useEffect14, useState as useState17 } from "react";
5271
- import { optionLabel } from "@ai-matrx/records";
5277
+ import { optionLabel, recordsUseSentence, rehomeSentence } from "@ai-matrx/records";
5272
5278
  import { useRecordsClient as useRecordsClient7 } from "@ai-matrx/records/react";
5273
- import { BasicInput as BasicInput8, Button as Button12, Label as Label6 } from "@ai-matrx/design-system";
5274
- 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";
5275
5281
  var rowSeed = 0;
5276
5282
  var nextRow = () => `new-${rowSeed += 1}`;
5277
5283
  function choiceRowsFrom(options) {
@@ -5299,10 +5305,17 @@ function ChoiceListEditor({
5299
5305
  field: field2,
5300
5306
  rows,
5301
5307
  onRows,
5302
- onStart
5308
+ onStart,
5309
+ allowOther = false,
5310
+ rehome = {},
5311
+ onRehome
5303
5312
  }) {
5304
5313
  const client = useRecordsClient7();
5305
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({});
5306
5319
  useEffect14(() => {
5307
5320
  if (rows !== null) return;
5308
5321
  let live = true;
@@ -5320,6 +5333,19 @@ function ChoiceListEditor({
5320
5333
  live = false;
5321
5334
  };
5322
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]);
5323
5349
  if (refused) {
5324
5350
  return /* @__PURE__ */ jsxs19("p", { className: "text-[11px] text-muted-foreground", "data-records-choice-list": "", children: [
5325
5351
  "The choices could not be read, so they are left as they are: ",
@@ -5336,6 +5362,37 @@ function ChoiceListEditor({
5336
5362
  onRows(next);
5337
5363
  };
5338
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 ?? "";
5339
5396
  return /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-1", "data-records-choice-list": "", children: [
5340
5397
  /* @__PURE__ */ jsx23(Label6, { className: "text-xs", children: "The choices" }),
5341
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,
@@ -5351,10 +5408,43 @@ function ChoiceListEditor({
5351
5408
  ),
5352
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" }),
5353
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" }),
5354
- /* @__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" })
5355
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
+ ),
5356
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" }),
5357
- /* @__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." })
5358
5448
  ] });
5359
5449
  }
5360
5450
 
@@ -5853,7 +5943,7 @@ function nextFieldSort(fields) {
5853
5943
 
5854
5944
  // src/FieldEditor.tsx
5855
5945
  import { FIELD_SENSITIVITIES, CONTEXT_POLICIES } from "@ai-matrx/records";
5856
- 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";
5857
5947
  var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
5858
5948
  var SENSITIVITIES = FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
5859
5949
  var AGENT_VISIBILITY = CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
@@ -5895,6 +5985,9 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
5895
5985
  const [optionText, setOptionText] = useState18("");
5896
5986
  const [choiceList, setChoiceList] = useState18(null);
5897
5987
  const [choiceListStart, setChoiceListStart] = useState18(null);
5988
+ const [rehome, setRehome] = useState18({});
5989
+ const [rehomed, setRehomed] = useState18(null);
5990
+ const [rehomeRefused, setRehomeRefused] = useState18(null);
5898
5991
  const [unit, setUnit] = useState18(field2?.unit ?? "$");
5899
5992
  const [withTime, setWithTime] = useState18(String(field2?.config?.["kind"] ?? "date") === "datetime");
5900
5993
  const [via, setVia] = useState18(String(field2?.config?.["via"] ?? ""));
@@ -5988,6 +6081,20 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
5988
6081
  // K2: a re-aimed formula goes WITH its type word, the arm `field_update` reads it in.
5989
6082
  ...type === "formula" && formulaWritten && formulaChanged && formulaText.trim() !== "" ? { type: "formula", formula_text: formulaText.trim() } : {}
5990
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
+ }
5991
6098
  const written2 = await mutation.update({ field_id: field2.id, patch });
5992
6099
  if (written2 !== null) onSaved?.();
5993
6100
  return;
@@ -6072,16 +6179,16 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6072
6179
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6073
6180
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "What it holds" }),
6074
6181
  /* @__PURE__ */ jsxs21(
6075
- Select3,
6182
+ Select4,
6076
6183
  {
6077
6184
  value: type,
6078
6185
  disabled: editing,
6079
6186
  onValueChange: (next) => setType(next),
6080
6187
  children: [
6081
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": "What this field holds", children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6082
- /* @__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: [
6083
6190
  /* @__PURE__ */ jsx25(SelectLabel, { children: group }),
6084
- 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))
6085
6192
  ] }, group)) })
6086
6193
  ]
6087
6194
  }
@@ -6158,7 +6265,18 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6158
6265
  relations,
6159
6266
  others,
6160
6267
  existingOptionsTable: Boolean(field2?.options_table_id ?? field2?.config?.["options_table_id"]),
6161
- 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,
6162
6280
  allowedTypes,
6163
6281
  setAllowedTypes
6164
6282
  }
@@ -6214,16 +6332,16 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6214
6332
  /* @__PURE__ */ jsxs21("div", { className: "grid gap-3 sm:grid-cols-2", children: [
6215
6333
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6216
6334
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "Who can see what is in it" }),
6217
- /* @__PURE__ */ jsxs21(Select3, { value: sensitivity, onValueChange: setSensitivity, children: [
6218
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": "Who can see what is in it", children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6219
- /* @__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)) })
6220
6338
  ] })
6221
6339
  ] }),
6222
6340
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6223
6341
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "Can an assistant read it" }),
6224
- /* @__PURE__ */ jsxs21(Select3, { value: contextPolicy, onValueChange: setContextPolicy, children: [
6225
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": "Can an assistant read it", children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6226
- /* @__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)) })
6227
6345
  ] })
6228
6346
  ] })
6229
6347
  ] }),
@@ -6246,13 +6364,13 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6246
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,
6247
6365
  rules.map((rule, index) => /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-1", children: [
6248
6366
  /* @__PURE__ */ jsxs21(
6249
- Select3,
6367
+ Select4,
6250
6368
  {
6251
6369
  value: rule.kind,
6252
6370
  onValueChange: (kind) => setRules(rules.map((r, i) => i === index ? { ...r, kind } : r)),
6253
6371
  children: [
6254
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", className: "w-52", "aria-label": `Check ${index + 1}`, children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6255
- /* @__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)) })
6256
6374
  ]
6257
6375
  }
6258
6376
  ),
@@ -6308,6 +6426,36 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6308
6426
  error: refusal("internal", COLUMN_DID_NOT_LAND_SENTENCE, COLUMN_DID_NOT_LAND_REMEDY)
6309
6427
  }
6310
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,
6311
6459
  backfillError ? /* @__PURE__ */ jsxs21("div", { "data-records-autonumber-backfill-refused": "", className: "flex flex-col gap-1", children: [
6312
6460
  /* @__PURE__ */ jsx25("p", { className: "text-[11px]", children: "The column is made. The records already in the table were not numbered:" }),
6313
6461
  /* @__PURE__ */ jsx25(RefusalNotice, { error: backfillError })
@@ -6324,7 +6472,7 @@ function FieldEditor({ tableId, field: field2, onSaved, onCancel, onRemoved, cla
6324
6472
  }
6325
6473
  ),
6326
6474
  onCancel ? /* @__PURE__ */ jsx25(Button13, { size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null,
6327
- 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: [
6328
6476
  /* @__PURE__ */ jsxs21("span", { className: "text-destructive", children: [
6329
6477
  archiveConfirmSentence(`the field \u201C${fieldName(field2)}\u201D`),
6330
6478
  " Its values stay in every record and come back with it."
@@ -6430,7 +6578,7 @@ function TypeQuestions(props) {
6430
6578
  );
6431
6579
  }
6432
6580
  if (type === "select" || type === "multi_select") {
6433
- if (props.choiceList) return /* @__PURE__ */ jsx25(Fragment6, { children: props.choiceList });
6581
+ if (props.choiceList) return /* @__PURE__ */ jsx25(Fragment7, { children: props.choiceList });
6434
6582
  return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6435
6583
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "The choices" }),
6436
6584
  /* @__PURE__ */ jsx25(
@@ -6483,9 +6631,9 @@ function TypeQuestions(props) {
6483
6631
  return /* @__PURE__ */ jsxs21("div", { className: "grid gap-3 sm:grid-cols-2", children: [
6484
6632
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6485
6633
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: type === "rollup" ? "Across the records in" : "Read it from" }),
6486
- /* @__PURE__ */ jsxs21(Select3, { value: props.via, onValueChange: props.setVia, children: [
6487
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": type === "rollup" ? "Across the records in" : "Read it from", children: /* @__PURE__ */ jsx25(SelectValue3, { placeholder: "Choose a column" }) }),
6488
- /* @__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: [
6489
6637
  fieldName(f),
6490
6638
  type === "rollup" && !f.multi ? " \u2014 holds one" : ""
6491
6639
  ] }, f.id)) })
@@ -6502,9 +6650,9 @@ function TypeQuestions(props) {
6502
6650
  }
6503
6651
  ) : /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6504
6652
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "What to work out" }),
6505
- /* @__PURE__ */ jsxs21(Select3, { value: props.agg, onValueChange: (v) => props.setAgg(v), children: [
6506
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": "What to work out", children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6507
- /* @__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)) })
6508
6656
  ] }),
6509
6657
  props.agg !== "count" ? /* @__PURE__ */ jsx25(
6510
6658
  ValueOnTheOtherSide,
@@ -6527,9 +6675,9 @@ function TypeQuestions(props) {
6527
6675
  return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-2", children: [
6528
6676
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
6529
6677
  /* @__PURE__ */ jsx25(Label8, { className: "text-xs", children: "What to do" }),
6530
- /* @__PURE__ */ jsxs21(Select3, { value: props.formulaOp, onValueChange: props.setFormulaOp, children: [
6531
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", className: "max-w-[18rem]", "aria-label": "What to do", children: /* @__PURE__ */ jsx25(SelectValue3, {}) }),
6532
- /* @__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)) })
6533
6681
  ] })
6534
6682
  ] }),
6535
6683
  /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
@@ -6588,9 +6736,9 @@ function ValueOnTheOtherSide({
6588
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: [
6589
6737
  fieldName(relation),
6590
6738
  " points at a table that has no columns to read yet. Add one there first."
6591
- ] }) : /* @__PURE__ */ jsxs21(Select3, { value, onValueChange: onChange, children: [
6592
- /* @__PURE__ */ jsx25(SelectTrigger3, { size: "sm", "aria-label": label, children: /* @__PURE__ */ jsx25(SelectValue3, { placeholder: "Choose a column" }) }),
6593
- /* @__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)) })
6594
6742
  ] });
6595
6743
  if (compact) return /* @__PURE__ */ jsx25("div", { className: "mt-1 flex flex-col gap-1", children: body });
6596
6744
  return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
@@ -7327,7 +7475,7 @@ function gridCopyConfig(args) {
7327
7475
  }
7328
7476
 
7329
7477
  // src/gridSummaries.tsx
7330
- 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";
7331
7479
  var SUMMARY_ROW_ID = "__records_ui_summary__";
7332
7480
  var SUMMARY_ROW = {
7333
7481
  id: SUMMARY_ROW_ID,
@@ -7427,7 +7575,7 @@ function SummaryCell({
7427
7575
  chosen ? "text-foreground" : "text-muted-foreground opacity-0 hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100"
7428
7576
  ),
7429
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)}`,
7430
- children: chosen ? /* @__PURE__ */ jsxs24(Fragment7, { children: [
7578
+ children: chosen ? /* @__PURE__ */ jsxs24(Fragment8, { children: [
7431
7579
  /* @__PURE__ */ jsx28("span", { className: "text-muted-foreground", children: label }),
7432
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) }) })
7433
7581
  ] }) : "Summarize"
@@ -7445,7 +7593,7 @@ function SummaryCell({
7445
7593
  },
7446
7594
  op2
7447
7595
  )),
7448
- chosen ? /* @__PURE__ */ jsxs24(Fragment7, { children: [
7596
+ chosen ? /* @__PURE__ */ jsxs24(Fragment8, { children: [
7449
7597
  /* @__PURE__ */ jsx28(DropdownMenuSeparator, {}),
7450
7598
  /* @__PURE__ */ jsx28(DropdownMenuItem, { onSelect: () => onChoose(null), children: "No summary" })
7451
7599
  ] }) : null
@@ -7644,7 +7792,7 @@ function documentOf(row) {
7644
7792
  }
7645
7793
 
7646
7794
  // src/gridControls.tsx
7647
- 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";
7648
7796
  function filterForValue(field2, value) {
7649
7797
  const empty = value === null || value === void 0 || value === "";
7650
7798
  if (empty) return { kind: "text", value: "", mode: "empty" };
@@ -7970,7 +8118,7 @@ function useMergedGridControls(args) {
7970
8118
  return;
7971
8119
  }
7972
8120
  notify?.success(`Each record is named by ${field2 ? fieldName(field2) : columnId} now.`);
7973
- tableShapeChanged(tableId);
8121
+ tableShapeChanged2(tableId);
7974
8122
  args.reloadTable();
7975
8123
  })();
7976
8124
  },
@@ -8027,7 +8175,7 @@ function useMergedGridControls(args) {
8027
8175
  [enabled, order, hidden, keepColumns]
8028
8176
  );
8029
8177
  const close = () => setDialog(null);
8030
- const dialogs = !enabled ? null : /* @__PURE__ */ jsxs25(Fragment8, { children: [
8178
+ const dialogs = !enabled ? null : /* @__PURE__ */ jsxs25(Fragment9, { children: [
8031
8179
  colours.dialogs,
8032
8180
  /* @__PURE__ */ jsx29(
8033
8181
  RowLabelPicker,
@@ -8038,7 +8186,7 @@ function useMergedGridControls(args) {
8038
8186
  tableId,
8039
8187
  fields,
8040
8188
  onSaved: () => {
8041
- tableShapeChanged(tableId);
8189
+ tableShapeChanged2(tableId);
8042
8190
  args.reloadTable();
8043
8191
  },
8044
8192
  notify
@@ -8160,7 +8308,7 @@ function useMergedGridControls(args) {
8160
8308
  columns: columnsControl,
8161
8309
  dialogs,
8162
8310
  addColumn: () => setDialog({ kind: "insert", anchor: null, side: "right" }),
8163
- sheetTools: enabled ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
8311
+ sheetTools: enabled ? /* @__PURE__ */ jsxs25(Fragment9, { children: [
8164
8312
  colours.sheet,
8165
8313
  args.summaries ? /* @__PURE__ */ jsx29(
8166
8314
  SummarySheetControls,
@@ -8346,7 +8494,7 @@ import {
8346
8494
  Switch,
8347
8495
  cn as cn17
8348
8496
  } from "@ai-matrx/design-system";
8349
- 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";
8350
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.";
8351
8499
  function cellState(cell) {
8352
8500
  if (!cell || !cell.agent_owned) return "none";
@@ -8708,7 +8856,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
8708
8856
  children: "Show me five rows it would do"
8709
8857
  }
8710
8858
  ),
8711
- host.enrich ? /* @__PURE__ */ jsxs27(Fragment9, { children: [
8859
+ host.enrich ? /* @__PURE__ */ jsxs27(Fragment10, { children: [
8712
8860
  /* @__PURE__ */ jsx31(
8713
8861
  Button19,
8714
8862
  {
@@ -8946,7 +9094,7 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
8946
9094
  // src/PastePreview.tsx
8947
9095
  import { useState as useState25 } from "react";
8948
9096
  import { Badge as Badge7, Button as Button21, Separator as Separator2 } from "@ai-matrx/design-system";
8949
- 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";
8950
9098
  function PastePreview({
8951
9099
  plan,
8952
9100
  noun,
@@ -8974,7 +9122,7 @@ function PastePreview({
8974
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) })
8975
9123
  ] }),
8976
9124
  /* @__PURE__ */ jsx33(Separator2, {}),
8977
- outcome === null ? /* @__PURE__ */ jsxs29(Fragment10, { children: [
9125
+ outcome === null ? /* @__PURE__ */ jsxs29(Fragment11, { children: [
8978
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: [
8979
9127
  sentence(plan, noun, nounPlural),
8980
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."
@@ -9064,7 +9212,7 @@ function PastePreview({
9064
9212
  }
9065
9213
  function Outcome({ outcome, onClose }) {
9066
9214
  const whole = outcome.missing === 0 && outcome.refusals.length === 0;
9067
- return /* @__PURE__ */ jsxs29(Fragment10, { children: [
9215
+ return /* @__PURE__ */ jsxs29(Fragment11, { children: [
9068
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.` }),
9069
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,
9070
9218
  /* @__PURE__ */ jsx33("div", { className: "flex justify-end pt-1", children: /* @__PURE__ */ jsx33(Button21, { size: "sm", onClick: onClose, children: "Close" }) })
@@ -9467,14 +9615,14 @@ function withOpenRecord(columns, onOpen, nameOf, place = "end") {
9467
9615
  // src/toolbarSlot.tsx
9468
9616
  import { createContext as createContext4, useContext as useContext4 } from "react";
9469
9617
  import { createPortal } from "react-dom";
9470
- import { Fragment as Fragment11, jsx as jsx36 } from "react/jsx-runtime";
9618
+ import { Fragment as Fragment12, jsx as jsx36 } from "react/jsx-runtime";
9471
9619
  var TableToolbarSlotContext = createContext4(void 0);
9472
9620
  function useTableToolbarSlot() {
9473
9621
  return useContext4(TableToolbarSlotContext);
9474
9622
  }
9475
9623
  function InTableToolbar({ children }) {
9476
9624
  const slot = useTableToolbarSlot();
9477
- if (slot === void 0) return /* @__PURE__ */ jsx36(Fragment11, { children });
9625
+ if (slot === void 0) return /* @__PURE__ */ jsx36(Fragment12, { children });
9478
9626
  if (slot === null) return null;
9479
9627
  return createPortal(children, slot);
9480
9628
  }
@@ -9502,7 +9650,7 @@ import {
9502
9650
  DropdownMenuSeparator as DropdownMenuSeparator2,
9503
9651
  DropdownMenuTrigger as DropdownMenuTrigger2
9504
9652
  } from "@ai-matrx/design-system";
9505
- 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";
9506
9654
  function useStoreGridLayout(tableId) {
9507
9655
  const client = useRecordsClient16();
9508
9656
  const [answer, setAnswer] = useState27({
@@ -9590,7 +9738,7 @@ function GridLayoutMenu({
9590
9738
  ]
9591
9739
  }
9592
9740
  ) : null,
9593
- anyOwn ? /* @__PURE__ */ jsxs32(Fragment12, { children: [
9741
+ anyOwn ? /* @__PURE__ */ jsxs32(Fragment13, { children: [
9594
9742
  /* @__PURE__ */ jsx37(DropdownMenuSeparator2, {}),
9595
9743
  /* @__PURE__ */ jsx37(
9596
9744
  DropdownMenuItem2,
@@ -9609,10 +9757,10 @@ function GridLayoutMenu({
9609
9757
  // src/gridUndo.tsx
9610
9758
  import { useCallback as useCallback13, useEffect as useEffect23, useLayoutEffect, useMemo as useMemo18, useRef as useRef11, useState as useState28, useSyncExternalStore } from "react";
9611
9759
  import { useRecordsClient as useRecordsClient17 } from "@ai-matrx/records/react";
9612
- import { announceRecordChanged } from "@ai-matrx/records/core";
9760
+ import { announceRecordChanged as announceRecordChanged2 } from "@ai-matrx/records/core";
9613
9761
  import { Button as Button24 } from "@ai-matrx/design-system";
9614
9762
  import { createUndoStack, popRedo, popUndo, pushUndo } from "@ai-matrx/design-system/data-table";
9615
- 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";
9616
9764
  function changesFor(step2, direction) {
9617
9765
  const byRow = /* @__PURE__ */ new Map();
9618
9766
  for (const cell of step2.cells) {
@@ -9677,7 +9825,7 @@ function useGridUndo(args) {
9677
9825
  }
9678
9826
  forget(step2.cells.map((c) => ({ rowId: c.rowId, key: c.key })));
9679
9827
  for (const id of /* @__PURE__ */ new Set([...step2.cells.map((c) => c.rowId), ...step2.created ?? [], ...step2.archived ?? []])) {
9680
- announceRecordChanged(id);
9828
+ announceRecordChanged2(id);
9681
9829
  }
9682
9830
  setHeld(() => {
9683
9831
  let stack = taken.stack;
@@ -9751,7 +9899,7 @@ function UndoRedoLive({ source }) {
9751
9899
  function UndoRedoPair({ face, onUndo, onRedo }) {
9752
9900
  const undo = { depth: { back: face.back, forward: face.forward }, busy: face.busy };
9753
9901
  if (undo.depth.back === 0 && undo.depth.forward === 0) return null;
9754
- return /* @__PURE__ */ jsxs33(Fragment13, { children: [
9902
+ return /* @__PURE__ */ jsxs33(Fragment14, { children: [
9755
9903
  /* @__PURE__ */ jsxs33(
9756
9904
  Button24,
9757
9905
  {
@@ -10203,7 +10351,7 @@ function useGridAssist(args) {
10203
10351
  // src/gridBulk.tsx
10204
10352
  import { useCallback as useCallback15, useMemo as useMemo20, useState as useState31 } from "react";
10205
10353
  import { useRecordsClient as useRecordsClient18 } from "@ai-matrx/records/react";
10206
- import { announceRecordChanged as announceRecordChanged2 } from "@ai-matrx/records/core";
10354
+ import { announceRecordChanged as announceRecordChanged3 } from "@ai-matrx/records/core";
10207
10355
  import {
10208
10356
  Button as Button26,
10209
10357
  ConfirmDialog as ConfirmDialog3,
@@ -10215,7 +10363,7 @@ import {
10215
10363
  DialogTitle as DialogTitle5,
10216
10364
  Label as Label11
10217
10365
  } from "@ai-matrx/design-system";
10218
- 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";
10219
10367
  function countOf(n, one, many) {
10220
10368
  return `${n} ${n === 1 ? one : many}`;
10221
10369
  }
@@ -10270,7 +10418,7 @@ function useGridBulk(args) {
10270
10418
  setRefusal(done.error);
10271
10419
  return null;
10272
10420
  }
10273
- 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);
10274
10422
  return done.data;
10275
10423
  },
10276
10424
  [client, tableId]
@@ -10343,8 +10491,8 @@ function BulkActions({
10343
10491
  setAsking(null);
10344
10492
  if (ok) onDone();
10345
10493
  };
10346
- return /* @__PURE__ */ jsxs35(Fragment14, { children: [
10347
- typeable.length > 0 ? /* @__PURE__ */ jsxs35(Fragment14, { children: [
10494
+ return /* @__PURE__ */ jsxs35(Fragment15, { children: [
10495
+ typeable.length > 0 ? /* @__PURE__ */ jsxs35(Fragment15, { children: [
10348
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" }),
10349
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" }),
10350
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
@@ -10978,7 +11126,7 @@ function HandOrderDialog({
10978
11126
  }
10979
11127
 
10980
11128
  // src/Grid.tsx
10981
- 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";
10982
11130
  var NO_COLUMNS_YET = "This table has no columns yet";
10983
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.";
10984
11132
  var NO_SUMMARIES = Object.freeze({});
@@ -11412,7 +11560,7 @@ function Grid({
11412
11560
  }))
11413
11561
  );
11414
11562
  editing.forget(cells);
11415
- for (const u of updates) announceRecordChanged3(u.row.recordId);
11563
+ for (const u of updates) announceRecordChanged4(u.row.recordId);
11416
11564
  const lines = updates.length + creates.length;
11417
11565
  undo.push({ label: `Pasted ${lines} ${lines === 1 ? "row" : "rows"}`, cells, created });
11418
11566
  const expected = [
@@ -11768,7 +11916,7 @@ function Grid({
11768
11916
  const hasTalk = Boolean(host.talkToRecord);
11769
11917
  const hasAgent = Boolean(host.runAgentAction);
11770
11918
  const rowActions = useCallback16(
11771
- (row) => /* @__PURE__ */ jsxs37(Fragment15, { children: [
11919
+ (row) => /* @__PURE__ */ jsxs37(Fragment16, { children: [
11772
11920
  canWrite && mayWriteRow(row.id) ? tableActions.runnable.map((action) => /* @__PURE__ */ jsx43(
11773
11921
  ActionButton,
11774
11922
  {
@@ -12061,7 +12209,7 @@ function Grid({
12061
12209
  * — the table's own (clear, copy/export, group, columns), these, the search, the sort and
12062
12210
  * the page's filter, layout and share — in ONE "Tools" sheet. Never dropped.
12063
12211
  */
12064
- actions: /* @__PURE__ */ jsxs37(Fragment15, { children: [
12212
+ actions: /* @__PURE__ */ jsxs37(Fragment16, { children: [
12065
12213
  manual ? /* @__PURE__ */ jsx43(
12066
12214
  SortStateControl,
12067
12215
  {
@@ -12105,7 +12253,7 @@ function Grid({
12105
12253
  ...merged ? {
12106
12254
  overflow: {
12107
12255
  mode: phone ? "sheet" : toolbarFold2 >= 3 ? "menu" : "inline",
12108
- pinned: /* @__PURE__ */ jsxs37(Fragment15, { children: [
12256
+ pinned: /* @__PURE__ */ jsxs37(Fragment16, { children: [
12109
12257
  /* @__PURE__ */ jsx43(UndoRedoLive, { source: undoSource }),
12110
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
12111
12259
  ] }),
@@ -12338,7 +12486,7 @@ function Grid({
12338
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") })
12339
12487
  ]
12340
12488
  }
12341
- ) : /* @__PURE__ */ jsxs37(Fragment15, { children: [
12489
+ ) : /* @__PURE__ */ jsxs37(Fragment16, { children: [
12342
12490
  /* @__PURE__ */ jsx43(
12343
12491
  "div",
12344
12492
  {
@@ -12372,7 +12520,7 @@ function Grid({
12372
12520
  onSelectedIdsChange: setSelectedIds,
12373
12521
  noun,
12374
12522
  isRowSelectable,
12375
- actions: (_selected, ids) => /* @__PURE__ */ jsxs37(Fragment15, { children: [
12523
+ actions: (_selected, ids) => /* @__PURE__ */ jsxs37(Fragment16, { children: [
12376
12524
  merged ? /* @__PURE__ */ jsx43(
12377
12525
  BulkActions,
12378
12526
  {
@@ -12724,11 +12872,11 @@ import {
12724
12872
  import {
12725
12873
  Badge as Badge8,
12726
12874
  Button as Button30,
12727
- Select as Select4,
12728
- SelectContent as SelectContent4,
12729
- SelectItem as SelectItem4,
12730
- SelectTrigger as SelectTrigger4,
12731
- SelectValue as SelectValue4,
12875
+ Select as Select5,
12876
+ SelectContent as SelectContent5,
12877
+ SelectItem as SelectItem5,
12878
+ SelectTrigger as SelectTrigger5,
12879
+ SelectValue as SelectValue5,
12732
12880
  Separator as Separator3,
12733
12881
  cn as cn22
12734
12882
  } from "@ai-matrx/design-system";
@@ -12771,7 +12919,7 @@ function checkImportRules(fields, rows, mapping) {
12771
12919
  }
12772
12920
 
12773
12921
  // src/ImportWizard.tsx
12774
- 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";
12775
12923
  var BATCH = 250;
12776
12924
  var SAMPLES = 40;
12777
12925
  var ABSENT = "__absent__";
@@ -13050,7 +13198,7 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13050
13198
  accept: ".csv,.xlsx",
13051
13199
  disabled: busy,
13052
13200
  chosenName: fileName || null,
13053
- 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." }),
13054
13202
  onFile: (file) => void take(file),
13055
13203
  ...fileName ? {
13056
13204
  onClear: () => {
@@ -13070,11 +13218,11 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13070
13218
  fileName ? `${fileName} has been sent to this table` : "This file has been sent to this table",
13071
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."
13072
13220
  ] }) : null,
13073
- plan && parsed && !afterWrite ? /* @__PURE__ */ jsxs39(Fragment16, { children: [
13221
+ plan && parsed && !afterWrite ? /* @__PURE__ */ jsxs39(Fragment17, { children: [
13074
13222
  titleKey ? /* @__PURE__ */ jsxs39("div", { className: "flex flex-wrap items-center gap-2 rounded border bg-muted/40 px-2 py-1.5", children: [
13075
13223
  /* @__PURE__ */ jsx45("span", { className: "font-medium", children: "What each record is called" }),
13076
13224
  /* @__PURE__ */ jsxs39(
13077
- Select4,
13225
+ Select5,
13078
13226
  {
13079
13227
  value: titleMappedTo ?? "",
13080
13228
  disabled: busy,
@@ -13090,15 +13238,15 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13090
13238
  },
13091
13239
  children: [
13092
13240
  /* @__PURE__ */ jsx45(
13093
- SelectTrigger4,
13241
+ SelectTrigger5,
13094
13242
  {
13095
13243
  size: "sm",
13096
13244
  "aria-label": "Which column each record is named by",
13097
13245
  className: "min-w-[14rem]",
13098
- children: /* @__PURE__ */ jsx45(SelectValue4, { placeholder: "\u2014 choose the column \u2014" })
13246
+ children: /* @__PURE__ */ jsx45(SelectValue5, { placeholder: "\u2014 choose the column \u2014" })
13099
13247
  }
13100
13248
  ),
13101
- /* @__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)) })
13102
13250
  ]
13103
13251
  }
13104
13252
  ),
@@ -13118,7 +13266,7 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13118
13266
  /* @__PURE__ */ jsx45("span", { className: "min-w-[8rem] flex-1 break-words font-medium", children: column.header }),
13119
13267
  /* @__PURE__ */ jsx45("span", { className: "text-muted-foreground", children: "goes to" }),
13120
13268
  /* @__PURE__ */ jsxs39(
13121
- Select4,
13269
+ Select5,
13122
13270
  {
13123
13271
  value: to || ABSENT,
13124
13272
  disabled: busy,
@@ -13132,18 +13280,18 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13132
13280
  },
13133
13281
  children: [
13134
13282
  /* @__PURE__ */ jsx45(
13135
- SelectTrigger4,
13283
+ SelectTrigger5,
13136
13284
  {
13137
13285
  size: "sm",
13138
13286
  "aria-label": `Where ${column.header} goes`,
13139
13287
  "data-goes-to": column.header,
13140
13288
  className: "min-w-[14rem] flex-1",
13141
- children: /* @__PURE__ */ jsx45(SelectValue4, {})
13289
+ children: /* @__PURE__ */ jsx45(SelectValue5, {})
13142
13290
  }
13143
13291
  ),
13144
- /* @__PURE__ */ jsxs39(SelectContent4, { children: [
13145
- /* @__PURE__ */ jsx45(SelectItem4, { value: ABSENT, children: absent }),
13146
- 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))
13147
13295
  ] })
13148
13296
  ]
13149
13297
  }
@@ -13301,12 +13449,12 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13301
13449
  ] }) : null
13302
13450
  ] }) : null,
13303
13451
  alreadyRan ? /* @__PURE__ */ jsx45("p", { className: "text-muted-foreground", children: alreadyRan }) : null,
13304
- outcomes.length > 0 || summary || ledger ? /* @__PURE__ */ jsxs39(Fragment16, { children: [
13452
+ outcomes.length > 0 || summary || ledger ? /* @__PURE__ */ jsxs39(Fragment17, { children: [
13305
13453
  /* @__PURE__ */ jsx45(Separator3, {}),
13306
13454
  /* @__PURE__ */ jsxs39("div", { className: "flex flex-wrap items-center gap-2", children: [
13307
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` }),
13308
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,
13309
- (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: [
13310
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" }),
13311
13459
  /* @__PURE__ */ jsx45("button", { type: "button", className: cn22("underline underline-offset-2", show === "refused" && "font-medium"), onClick: () => setShow("refused"), children: "refused" }),
13312
13460
  /* @__PURE__ */ jsx45("button", { type: "button", className: cn22("underline underline-offset-2", show === "duplicate" && "font-medium"), onClick: () => setShow("duplicate"), children: "already here" })
@@ -13362,7 +13510,7 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13362
13510
  ] }) : null
13363
13511
  ] }) : null,
13364
13512
  runsProblem ? /* @__PURE__ */ jsx45(RefusalNotice, { error: runsProblem }) : null,
13365
- runs && runs.length > 0 ? /* @__PURE__ */ jsxs39(Fragment16, { children: [
13513
+ runs && runs.length > 0 ? /* @__PURE__ */ jsxs39(Fragment17, { children: [
13366
13514
  /* @__PURE__ */ jsx45(Separator3, {}),
13367
13515
  /* @__PURE__ */ jsx45("p", { className: "font-medium", children: "Imports into this table" }),
13368
13516
  /* @__PURE__ */ jsx45("ul", { className: "flex flex-col gap-1", children: runs.map((r) => /* @__PURE__ */ jsxs39("li", { className: "flex flex-col gap-1", children: [
@@ -13394,7 +13542,7 @@ function ImportWizard({ tableId, onDone, onWrote, className }) {
13394
13542
  }
13395
13543
  ) : null
13396
13544
  ] }),
13397
- 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: [
13398
13546
  runRows.note ? /* @__PURE__ */ jsx45("p", { className: "text-muted-foreground", children: runRows.note }) : null,
13399
13547
  /* @__PURE__ */ jsx45("div", { className: "max-h-64 overflow-auto rounded border", children: /* @__PURE__ */ jsxs39("table", { className: "w-full", children: [
13400
13548
  /* @__PURE__ */ jsx45("thead", { className: "sticky top-0 bg-muted", children: /* @__PURE__ */ jsxs39("tr", { children: [
@@ -13438,11 +13586,11 @@ import {
13438
13586
  import {
13439
13587
  BasicInput as BasicInput11,
13440
13588
  Button as Button31,
13441
- Select as Select5,
13442
- SelectContent as SelectContent5,
13443
- SelectItem as SelectItem5,
13444
- SelectTrigger as SelectTrigger5,
13445
- SelectValue as SelectValue5,
13589
+ Select as Select6,
13590
+ SelectContent as SelectContent6,
13591
+ SelectItem as SelectItem6,
13592
+ SelectTrigger as SelectTrigger6,
13593
+ SelectValue as SelectValue6,
13446
13594
  Separator as Separator4,
13447
13595
  cn as cn23
13448
13596
  } from "@ai-matrx/design-system";
@@ -13522,6 +13670,7 @@ function CustomFieldsSection({
13522
13670
  const [newLabel, setNewLabel] = useState36("");
13523
13671
  const [newType, setNewType] = useState36("text");
13524
13672
  const [draft, setDraft] = useState36({});
13673
+ const [removing, setRemoving] = useState36(null);
13525
13674
  const fields = useMemo24(() => read.data?.fields ?? [], [read.data]);
13526
13675
  const mayAdd = rights.data?.may_declare === true;
13527
13676
  const live = useRef15({ fields, rights: rights.data, loading: rights.loading, reload: read.reload });
@@ -13668,9 +13817,9 @@ function CustomFieldsSection({
13668
13817
  ] }),
13669
13818
  /* @__PURE__ */ jsxs40("div", { className: "flex flex-col gap-1", children: [
13670
13819
  /* @__PURE__ */ jsx46("span", { className: "text-muted-foreground", children: "Holds" }),
13671
- /* @__PURE__ */ jsxs40(Select5, { value: newType, onValueChange: setNewType, children: [
13672
- /* @__PURE__ */ jsx46(SelectTrigger5, { size: "sm", "aria-label": "What this field holds", children: /* @__PURE__ */ jsx46(SelectValue5, {}) }),
13673
- /* @__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)) })
13674
13823
  ] })
13675
13824
  ] }),
13676
13825
  /* @__PURE__ */ jsx46(Button31, { size: "sm", type: "submit", disabled: mutation.saving || newLabel.trim() === "", children: mutation.saving ? "Adding\u2026" : "Add" })
@@ -13681,7 +13830,46 @@ function CustomFieldsSection({
13681
13830
  const field2 = asField(f);
13682
13831
  const id = `cf-${recordId}-${f.key}`;
13683
13832
  return /* @__PURE__ */ jsxs40("div", { className: "flex min-w-0 flex-col gap-1", children: [
13684
- /* @__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,
13685
13873
  /* @__PURE__ */ jsx46(
13686
13874
  FieldControl,
13687
13875
  {
@@ -13710,7 +13898,7 @@ import { BasicInput as BasicInput13, BasicTextarea as BasicTextarea7, Button as
13710
13898
  // src/Condition.tsx
13711
13899
  import { useState as useState37 } from "react";
13712
13900
  import { BasicInput as BasicInput12, Button as Button32 } from "@ai-matrx/design-system";
13713
- 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";
13714
13902
  var CONDITION_OPS = [
13715
13903
  { op: "eq", label: "is" },
13716
13904
  { op: "ne", label: "is not" },
@@ -13821,7 +14009,7 @@ function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", cla
13821
14009
  ]
13822
14010
  }
13823
14011
  ),
13824
- onField ? /* @__PURE__ */ jsxs41(Fragment17, { children: [
14012
+ onField ? /* @__PURE__ */ jsxs41(Fragment18, { children: [
13825
14013
  /* @__PURE__ */ jsx47(
13826
14014
  "select",
13827
14015
  {
@@ -14354,11 +14542,11 @@ import {
14354
14542
  Button as Button34,
14355
14543
  Checkbox as Checkbox6,
14356
14544
  Label as Label12,
14357
- Select as Select6,
14358
- SelectContent as SelectContent6,
14359
- SelectItem as SelectItem6,
14360
- SelectTrigger as SelectTrigger6,
14361
- SelectValue as SelectValue6,
14545
+ Select as Select7,
14546
+ SelectContent as SelectContent7,
14547
+ SelectItem as SelectItem7,
14548
+ SelectTrigger as SelectTrigger7,
14549
+ SelectValue as SelectValue7,
14362
14550
  cn as cn26
14363
14551
  } from "@ai-matrx/design-system";
14364
14552
 
@@ -14860,7 +15048,7 @@ function ActionForm({
14860
15048
  rows.length > 0 ? /* @__PURE__ */ jsxs44("div", { className: "ml-auto flex items-center gap-1", children: [
14861
15049
  /* @__PURE__ */ jsx50("span", { className: "text-muted-foreground", children: "Start from a record" }),
14862
15050
  /* @__PURE__ */ jsxs44(
14863
- Select6,
15051
+ Select7,
14864
15052
  {
14865
15053
  value: "",
14866
15054
  onValueChange: (id) => {
@@ -14878,8 +15066,8 @@ function ActionForm({
14878
15066
  setPreviewId(row.id);
14879
15067
  },
14880
15068
  children: [
14881
- /* @__PURE__ */ jsx50(SelectTrigger6, { size: "sm", "aria-label": "Start from a record", children: /* @__PURE__ */ jsx50(SelectValue6, { placeholder: "Pick one" }) }),
14882
- /* @__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)) })
14883
15071
  ]
14884
15072
  }
14885
15073
  )
@@ -14887,16 +15075,16 @@ function ActionForm({
14887
15075
  ] }),
14888
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,
14889
15077
  draft.steps.map((step2, index) => /* @__PURE__ */ jsxs44("div", { className: "flex flex-wrap items-center gap-1", "data-records-action-step": index, children: [
14890
- /* @__PURE__ */ jsxs44(Select6, { value: step2.field, onValueChange: (v) => setStep(index, { field: v }), children: [
14891
- /* @__PURE__ */ jsx50(SelectTrigger6, { size: "sm", "aria-label": `Column for change ${index + 1}`, children: /* @__PURE__ */ jsx50(SelectValue6, { placeholder: "Column" }) }),
14892
- /* @__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)) })
14893
15081
  ] }),
14894
- /* @__PURE__ */ jsxs44(Select6, { value: step2.set, onValueChange: (v) => setStep(index, { set: v }), children: [
14895
- /* @__PURE__ */ jsx50(SelectTrigger6, { size: "sm", "aria-label": `How change ${index + 1} sets it`, children: /* @__PURE__ */ jsx50(SelectValue6, {}) }),
14896
- /* @__PURE__ */ jsxs44(SelectContent6, { children: [
14897
- /* @__PURE__ */ jsx50(SelectItem6, { value: "value", children: "Set to" }),
14898
- /* @__PURE__ */ jsx50(SelectItem6, { value: "clear", children: "Clear" }),
14899
- /* @__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" })
14900
15088
  ] })
14901
15089
  ] }),
14902
15090
  step2.set === "value" ? /* @__PURE__ */ jsx50(
@@ -14941,9 +15129,9 @@ function ActionForm({
14941
15129
  /* @__PURE__ */ jsxs44("div", { className: "flex flex-wrap items-center gap-1", children: [
14942
15130
  /* @__PURE__ */ jsx50("span", { className: "font-medium", children: "Before and after" }),
14943
15131
  /* @__PURE__ */ jsx50("span", { className: "text-muted-foreground", children: "on" }),
14944
- /* @__PURE__ */ jsxs44(Select6, { value: previewRow.id, onValueChange: (v) => setPreviewId(v), children: [
14945
- /* @__PURE__ */ jsx50(SelectTrigger6, { size: "sm", "aria-label": "Record to preview on", children: /* @__PURE__ */ jsx50(SelectValue6, {}) }),
14946
- /* @__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)) })
14947
15135
  ] })
14948
15136
  ] }),
14949
15137
  /* @__PURE__ */ jsx50(
@@ -14978,15 +15166,15 @@ function ActionForm({
14978
15166
  colors.length > 0 ? /* @__PURE__ */ jsxs44("div", { className: "flex items-center gap-1", children: [
14979
15167
  /* @__PURE__ */ jsx50("span", { className: "text-muted-foreground", children: "Color" }),
14980
15168
  /* @__PURE__ */ jsxs44(
14981
- Select6,
15169
+ Select7,
14982
15170
  {
14983
15171
  value: draft.color || NO_COLOR,
14984
15172
  onValueChange: (v) => setDraft((d) => ({ ...d, color: v === NO_COLOR ? "" : v })),
14985
15173
  children: [
14986
- /* @__PURE__ */ jsx50(SelectTrigger6, { size: "sm", "aria-label": "Button color", children: /* @__PURE__ */ jsx50(SelectValue6, {}) }),
14987
- /* @__PURE__ */ jsxs44(SelectContent6, { children: [
14988
- /* @__PURE__ */ jsx50(SelectItem6, { value: NO_COLOR, children: "None" }),
14989
- 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))
14990
15178
  ] })
14991
15179
  ]
14992
15180
  }
@@ -15011,7 +15199,7 @@ function ActionForm({
15011
15199
  }
15012
15200
 
15013
15201
  // src/TableSettings.tsx
15014
- 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";
15015
15203
  function TableSettings({
15016
15204
  tableId,
15017
15205
  proposals,
@@ -15183,7 +15371,7 @@ function TableSettings({
15183
15371
  /* @__PURE__ */ jsx51(Separator6, {}),
15184
15372
  /* @__PURE__ */ jsxs45("div", { className: "flex flex-col gap-1", children: [
15185
15373
  /* @__PURE__ */ jsx51("span", { className: "font-medium", children: "This table" }),
15186
- askingToDelete ? /* @__PURE__ */ jsxs45(Fragment18, { children: [
15374
+ askingToDelete ? /* @__PURE__ */ jsxs45(Fragment19, { children: [
15187
15375
  /* @__PURE__ */ jsxs45("p", { className: "text-muted-foreground", "data-archive-confirm": "table", children: [
15188
15376
  archiveConfirmSentence(table.data ? `the table \u201C${tableName(table.data)}\u201D` : "this table"),
15189
15377
  " ",
@@ -15204,10 +15392,10 @@ function TableSettings({
15204
15392
  archive.slowedDown ? " The store is busy, so it is taking smaller passes \u2014 it will still finish." : ""
15205
15393
  ] }) : null,
15206
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,
15207
- /* @__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: [
15208
15396
  /* @__PURE__ */ jsx51(Button35, { size: "sm", variant: "destructive", disabled: true, children: "Archiving\u2026" }),
15209
15397
  /* @__PURE__ */ jsx51(Button35, { size: "sm", variant: "ghost", onClick: () => archive.stop(), children: "Stop" })
15210
- ] }) : /* @__PURE__ */ jsxs45(Fragment18, { children: [
15398
+ ] }) : /* @__PURE__ */ jsxs45(Fragment19, { children: [
15211
15399
  /* @__PURE__ */ jsx51(Button35, { size: "sm", variant: "destructive", onClick: () => void startArchive(), children: archive.interrupted ? "Carry on archiving" : "Archive this table" }),
15212
15400
  /* @__PURE__ */ jsx51(Button35, { size: "sm", variant: "ghost", onClick: () => setAskingToDelete(false), children: "Keep it" })
15213
15401
  ] }) })
@@ -15803,7 +15991,7 @@ function asWords(value) {
15803
15991
  // src/ShareControl.tsx
15804
15992
  import { useEffect as useEffect36, useState as useState45 } from "react";
15805
15993
  import { Button as Button37 } from "@ai-matrx/design-system";
15806
- 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";
15807
15995
  function useCanShare() {
15808
15996
  return typeof useRecordsUi().share === "function";
15809
15997
  }
@@ -15830,7 +16018,7 @@ function ShareControl({
15830
16018
  const mayShare = may ?? asked2.share;
15831
16019
  if (!host.share) return null;
15832
16020
  if (!mayShare) return null;
15833
- return /* @__PURE__ */ jsxs48(Fragment19, { children: [
16021
+ return /* @__PURE__ */ jsxs48(Fragment20, { children: [
15834
16022
  /* @__PURE__ */ jsx54(
15835
16023
  Button37,
15836
16024
  {
@@ -15855,7 +16043,7 @@ function ShareControl({
15855
16043
  }
15856
16044
 
15857
16045
  // src/Peek.tsx
15858
- 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";
15859
16047
  function Peek({ tableId, recordId, onClose, className }) {
15860
16048
  const table = useTable7(tableId);
15861
16049
  const fields = useFields11(tableId);
@@ -15913,7 +16101,7 @@ function Peek({ tableId, recordId, onClose, className }) {
15913
16101
  onClose ? /* @__PURE__ */ jsx55(Button38, { size: "sm", variant: "ghost", className: "ml-auto", onClick: onClose, "aria-label": "Close", children: "\xD7" }) : null
15914
16102
  ] }),
15915
16103
  /* @__PURE__ */ jsx55(Separator8, {}),
15916
- talking && host.chat ? /* @__PURE__ */ jsxs49(Fragment20, { children: [
16104
+ talking && host.chat ? /* @__PURE__ */ jsxs49(Fragment21, { children: [
15917
16105
  /* @__PURE__ */ jsx55(RecordChat, { tableId, recordId, className: "min-h-[22rem]" }),
15918
16106
  /* @__PURE__ */ jsx55(Separator8, {})
15919
16107
  ] }) : null,
@@ -15935,11 +16123,11 @@ function Peek({ tableId, recordId, onClose, className }) {
15935
16123
  ] }),
15936
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) }) })
15937
16125
  ] }, field2.id)) }),
15938
- record.data?.computedUnavailable ? /* @__PURE__ */ jsxs49(Fragment20, { children: [
16126
+ record.data?.computedUnavailable ? /* @__PURE__ */ jsxs49(Fragment21, { children: [
15939
16127
  /* @__PURE__ */ jsx55(Separator8, {}),
15940
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." })
15941
16129
  ] }) : null,
15942
- record.data?.computed?.length ? /* @__PURE__ */ jsxs49(Fragment20, { children: [
16130
+ record.data?.computed?.length ? /* @__PURE__ */ jsxs49(Fragment21, { children: [
15943
16131
  /* @__PURE__ */ jsx55(Separator8, {}),
15944
16132
  /* @__PURE__ */ jsxs49("div", { className: "flex flex-col gap-1", children: [
15945
16133
  /* @__PURE__ */ jsx55("span", { className: "font-medium", children: "Worked out by the system" }),
@@ -16072,7 +16260,7 @@ import {
16072
16260
  } from "@ai-matrx/design-system/data-table";
16073
16261
 
16074
16262
  // src/CardDates.tsx
16075
- 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";
16076
16264
  function cardDateFields(all, titleField, hiddenFields) {
16077
16265
  const hidden = new Set(hiddenFields ?? []);
16078
16266
  return all.filter(
@@ -16087,7 +16275,7 @@ function CardDates({ record, fields }) {
16087
16275
  return value !== null && value !== void 0 && value !== "";
16088
16276
  });
16089
16277
  if (held.length === 0) return null;
16090
- return /* @__PURE__ */ jsx56(Fragment21, { children: held.map((field2) => /* @__PURE__ */ jsxs50(
16278
+ return /* @__PURE__ */ jsx56(Fragment22, { children: held.map((field2) => /* @__PURE__ */ jsxs50(
16091
16279
  "span",
16092
16280
  {
16093
16281
  className: "mt-0.5 flex min-w-0 items-baseline gap-1 text-[11px] text-muted-foreground",
@@ -16793,7 +16981,7 @@ function batchSentence(moved, waiting, notMoved, label) {
16793
16981
  }
16794
16982
 
16795
16983
  // src/ViewSwitcher.tsx
16796
- 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";
16797
16985
  var NO_FIELDS = [];
16798
16986
  function useViewRecords(view, pageSize = 200, filter, viewId) {
16799
16987
  const client = useRecordsClient32();
@@ -17405,7 +17593,7 @@ function Card2({
17405
17593
  onClick: () => onOpenRecord?.(record.id),
17406
17594
  title: withheld ?? label,
17407
17595
  ...withheld && field2 ? { "data-records-withheld": field2.key } : {},
17408
- children: dates && dates.length > 0 ? /* @__PURE__ */ jsxs52(Fragment22, { children: [
17596
+ children: dates && dates.length > 0 ? /* @__PURE__ */ jsxs52(Fragment23, { children: [
17409
17597
  /* @__PURE__ */ jsx58("span", { className: "block truncate", children: label }),
17410
17598
  /* @__PURE__ */ jsx58(CardDates, { record, fields: dates })
17411
17599
  ] }) : label
@@ -18027,7 +18215,7 @@ import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/dat
18027
18215
  import { useCallback as useCallback25, useEffect as useEffect42, useMemo as useMemo32, useState as useState53 } from "react";
18028
18216
  import { useRecordsClient as useRecordsClient37, useTable as useTable10 } from "@ai-matrx/records/react";
18029
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";
18030
- 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";
18031
18219
  var DUE_WORD = DUE_STATE_LABEL;
18032
18220
  var REQUIRES_WORD = CHECKLIST_REQUIREMENT_LABEL;
18033
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.";
@@ -18442,7 +18630,7 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
18442
18630
  /* @__PURE__ */ jsxs57("p", { className: "mt-1 text-xs", children: [
18443
18631
  /* @__PURE__ */ jsx63("span", { className: "font-medium", children: t.steps }),
18444
18632
  " steps",
18445
- t.roles > 0 ? /* @__PURE__ */ jsxs57(Fragment23, { children: [
18633
+ t.roles > 0 ? /* @__PURE__ */ jsxs57(Fragment24, { children: [
18446
18634
  " \xB7 ",
18447
18635
  /* @__PURE__ */ jsx63("span", { className: "font-medium", children: t.roles }),
18448
18636
  " roles"
@@ -18467,7 +18655,7 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
18467
18655
  }
18468
18656
  ) : null
18469
18657
  ] }, t.template_id)) }),
18470
- runs && runs.length > 0 ? /* @__PURE__ */ jsxs57(Fragment23, { children: [
18658
+ runs && runs.length > 0 ? /* @__PURE__ */ jsxs57(Fragment24, { children: [
18471
18659
  /* @__PURE__ */ jsx63("h4", { className: "text-xs font-medium text-muted-foreground", children: "Runs" }),
18472
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: [
18473
18661
  /* @__PURE__ */ jsxs57("div", { className: "flex items-center gap-2", children: [
@@ -18749,7 +18937,7 @@ function roleKey(said) {
18749
18937
  }
18750
18938
 
18751
18939
  // src/ActionInbox.tsx
18752
- 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";
18753
18941
  var ACTION_KINDS = ["approval", "assignment", "proposal"];
18754
18942
  var KIND_WORD2 = WORK_INBOX_KIND_LABEL;
18755
18943
  var DUE_WORD2 = DUE_STATE_LABEL;
@@ -19374,7 +19562,7 @@ function ActionInbox({
19374
19562
  /* @__PURE__ */ jsxs58("div", { className: "flex flex-col gap-0.5", "data-testid": "inbox-closed", children: [
19375
19563
  /* @__PURE__ */ jsxs58("p", { className: "text-[11px] text-muted-foreground", children: [
19376
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}` : ""}`,
19377
- item.decided_at ? /* @__PURE__ */ jsxs58(Fragment24, { children: [
19565
+ item.decided_at ? /* @__PURE__ */ jsxs58(Fragment25, { children: [
19378
19566
  " \xB7 ",
19379
19567
  /* @__PURE__ */ jsx64("time", { dateTime: item.decided_at, children: whenWords2(item.decided_at) })
19380
19568
  ] }) : null
@@ -19546,7 +19734,7 @@ function ActionInbox({
19546
19734
  onSteps,
19547
19735
  actions: (stepId) => {
19548
19736
  const title = items?.find((i) => i.item_id === stepId)?.title ?? "this step";
19549
- return /* @__PURE__ */ jsxs58(Fragment24, { children: [
19737
+ return /* @__PURE__ */ jsxs58(Fragment25, { children: [
19550
19738
  snoozing === stepId ? snoozeChoices().map((c) => /* @__PURE__ */ jsx64(
19551
19739
  Button46,
19552
19740
  {
@@ -20130,7 +20318,7 @@ import {
20130
20318
  useTable as useTable13
20131
20319
  } from "@ai-matrx/records/react";
20132
20320
  import { Badge as Badge17, Button as Button49, Skeleton as Skeleton15, cn as cn41 } from "@ai-matrx/design-system";
20133
- 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";
20134
20322
  function FieldHistoryPanel({
20135
20323
  tableId,
20136
20324
  fieldKey,
@@ -20225,7 +20413,7 @@ function FieldHistoryPanel({
20225
20413
  /* @__PURE__ */ jsx67("span", { className: "mx-1 text-muted-foreground", children: "\u2192" }),
20226
20414
  /* @__PURE__ */ jsx67("strong", { className: "font-medium", children: say(row.after, void 0) })
20227
20415
  ] }),
20228
- /* @__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: [
20229
20417
  /* @__PURE__ */ jsx67(Badge17, { variant: "outline", className: "mr-1 text-[10px]", children: "agent" }),
20230
20418
  "for ",
20231
20419
  row.actor.on_behalf_of?.name ?? "a person"
@@ -20373,7 +20561,7 @@ function submissionStamp(args) {
20373
20561
  import { useCallback as useCallback30, useEffect as useEffect47, useMemo as useMemo35, useState as useState58 } from "react";
20374
20562
  import { useRecordsClient as useRecordsClient42, useTables as useTables3 } from "@ai-matrx/records/react";
20375
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";
20376
- 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";
20377
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.";
20378
20566
  function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
20379
20567
  const client = useRecordsClient42();
@@ -20524,7 +20712,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
20524
20712
  ),
20525
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." })
20526
20714
  ] }),
20527
- clientTableId ? /* @__PURE__ */ jsxs62(Fragment26, { children: [
20715
+ clientTableId ? /* @__PURE__ */ jsxs62(Fragment27, { children: [
20528
20716
  /* @__PURE__ */ jsx68(Separator9, {}),
20529
20717
  /* @__PURE__ */ jsxs62("div", { className: "flex flex-col gap-2", children: [
20530
20718
  /* @__PURE__ */ jsx68(Label13, { className: "text-xs font-medium", children: "What they can see" }),
@@ -20620,7 +20808,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
20620
20808
  " yet."
20621
20809
  ] }) : null
20622
20810
  ] }) : null,
20623
- savedId ? /* @__PURE__ */ jsxs62(Fragment26, { children: [
20811
+ savedId ? /* @__PURE__ */ jsxs62(Fragment27, { children: [
20624
20812
  /* @__PURE__ */ jsx68(Separator9, {}),
20625
20813
  /* @__PURE__ */ jsxs62("div", { className: "flex flex-col gap-2", children: [
20626
20814
  /* @__PURE__ */ jsx68(Label13, { className: "text-xs font-medium", children: "Invite a client" }),
@@ -20997,7 +21185,7 @@ function PortalLookEditor({ card, onSaved, className }) {
20997
21185
  }
20998
21186
 
20999
21187
  // src/PortalsPanel.tsx
21000
- 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";
21001
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.";
21002
21190
  function revokeConsequence(person, portalTitle) {
21003
21191
  const who = person.client ? `${person.email} (${person.client})` : person.email;
@@ -21107,7 +21295,7 @@ function PortalsPanel({ tableId, activePortalId, className }) {
21107
21295
  buildLabel: elsewhere > 0 ? "Build a new portal" : "Build the portal",
21108
21296
  children: [
21109
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.",
21110
- elsewhere > 0 ? /* @__PURE__ */ jsxs65(Fragment27, { children: [
21298
+ elsewhere > 0 ? /* @__PURE__ */ jsxs65(Fragment28, { children: [
21111
21299
  " ",
21112
21300
  "This table is not in",
21113
21301
  " ",
@@ -21235,7 +21423,7 @@ function ArchivePortalControl({
21235
21423
  if (said) {
21236
21424
  return /* @__PURE__ */ jsx71("span", { className: "text-xs text-muted-foreground", "data-testid": "portal-archived-said", children: said });
21237
21425
  }
21238
- return /* @__PURE__ */ jsxs65(Fragment27, { children: [
21426
+ return /* @__PURE__ */ jsxs65(Fragment28, { children: [
21239
21427
  /* @__PURE__ */ jsx71(
21240
21428
  Button53,
21241
21429
  {
@@ -21283,7 +21471,7 @@ function ArchivePortalControl({
21283
21471
  function CopyLink({ url, what }) {
21284
21472
  const [copied, setCopied] = useState60(false);
21285
21473
  const [shown3, setShown] = useState60(false);
21286
- return /* @__PURE__ */ jsxs65(Fragment27, { children: [
21474
+ return /* @__PURE__ */ jsxs65(Fragment28, { children: [
21287
21475
  /* @__PURE__ */ jsx71(
21288
21476
  Button53,
21289
21477
  {
@@ -21427,13 +21615,13 @@ function PortalCardView({
21427
21615
  ] })
21428
21616
  ] }, exposed.table_id))
21429
21617
  ] }),
21430
- look ? /* @__PURE__ */ jsxs65(Fragment27, { children: [
21618
+ look ? /* @__PURE__ */ jsxs65(Fragment28, { children: [
21431
21619
  /* @__PURE__ */ jsx71(Separator10, {}),
21432
21620
  look
21433
21621
  ] }) : null,
21434
21622
  /* @__PURE__ */ jsx71(Separator10, {}),
21435
21623
  /* @__PURE__ */ jsx71(People, { card, onRevoke, onPreview, origin }),
21436
- invite ? /* @__PURE__ */ jsxs65(Fragment27, { children: [
21624
+ invite ? /* @__PURE__ */ jsxs65(Fragment28, { children: [
21437
21625
  /* @__PURE__ */ jsx71(Separator10, {}),
21438
21626
  invite
21439
21627
  ] }) : null
@@ -21632,7 +21820,7 @@ function Invite({ card, onInvited }) {
21632
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." }),
21633
21821
  error ? /* @__PURE__ */ jsx71(RefusalNotice, { error }) : null,
21634
21822
  said ? /* @__PURE__ */ jsx71("p", { className: "text-xs text-muted-foreground", children: said }) : null,
21635
- 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: [
21636
21824
  /* @__PURE__ */ jsx71(
21637
21825
  BasicInput19,
21638
21826
  {
@@ -21688,7 +21876,7 @@ function Invite({ card, onInvited }) {
21688
21876
  import { useCallback as useCallback32, useEffect as useEffect50, useMemo as useMemo38, useState as useState61 } from "react";
21689
21877
  import { useRecordsClient as useRecordsClient45 } from "@ai-matrx/records/react";
21690
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";
21691
- 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";
21692
21880
  var WEEKDAYS = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
21693
21881
  var CADENCE_WORDS = {
21694
21882
  instant: "the moment something arrives",
@@ -21907,7 +22095,7 @@ function DigestScheduler({
21907
22095
  ] }),
21908
22096
  /* @__PURE__ */ jsxs66("div", { className: "flex flex-col gap-1.5", children: [
21909
22097
  /* @__PURE__ */ jsx72(Label14, { className: "text-xs font-medium", children: "Who to send it to" }),
21910
- 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: [
21911
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: [
21912
22100
  /* @__PURE__ */ jsx72(
21913
22101
  Checkbox9,
@@ -21949,7 +22137,7 @@ function DigestScheduler({
21949
22137
  ),
21950
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." })
21951
22139
  ] }) : null,
21952
- outcomes ? /* @__PURE__ */ jsxs66(Fragment28, { children: [
22140
+ outcomes ? /* @__PURE__ */ jsxs66(Fragment29, { children: [
21953
22141
  /* @__PURE__ */ jsx72(Separator11, {}),
21954
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: [
21955
22143
  o.who,
@@ -22444,7 +22632,7 @@ import {
22444
22632
  import { useCallback as useCallback35, useEffect as useEffect54, useMemo as useMemo39, useRef as useRef22, useState as useState65 } from "react";
22445
22633
  import { useFields as useFields18, useOptionalRecordsClient as useOptionalRecordsClient7 } from "@ai-matrx/records/react";
22446
22634
  import { Button as Button57, Progress, Skeleton as Skeleton21, cn as cn49 } from "@ai-matrx/design-system";
22447
- 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";
22448
22636
  function authored(host, text, where) {
22449
22637
  return host.renderText ? host.renderText(text, where) : text;
22450
22638
  }
@@ -22820,7 +23008,7 @@ function Question({
22820
23008
  return /* @__PURE__ */ jsxs69("div", { className: "flex flex-col gap-1.5", children: [
22821
23009
  /* @__PURE__ */ jsx75(FieldLabel, { field: { ...field2, label: question.ask, required: question.required }, htmlFor: id }),
22822
23010
  question.help ? /* @__PURE__ */ jsx75("p", { className: "text-xs text-muted-foreground", children: authored(host, question.help, "form-help") }) : null,
22823
- 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: [
22824
23012
  /* @__PURE__ */ jsx75(
22825
23013
  "input",
22826
23014
  {
@@ -23124,7 +23312,7 @@ function whyNotAskable(fields, hidden = []) {
23124
23312
  }
23125
23313
 
23126
23314
  // src/FormBuilder.tsx
23127
- 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";
23128
23316
  function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
23129
23317
  const client = useRecordsClient50();
23130
23318
  const publishGate = usePublishGate();
@@ -23309,7 +23497,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
23309
23497
  }
23310
23498
  }
23311
23499
  ) : null,
23312
- !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: [
23313
23501
  /* @__PURE__ */ jsx77(
23314
23502
  PublishRow,
23315
23503
  {
@@ -23522,7 +23710,7 @@ function PublishRow({
23522
23710
  children: busy ? "\u2026" : open ? "Unpublish" : "Publish"
23523
23711
  }
23524
23712
  ) : null,
23525
- state !== "draft" ? /* @__PURE__ */ jsxs71(Fragment30, { children: [
23713
+ state !== "draft" ? /* @__PURE__ */ jsxs71(Fragment31, { children: [
23526
23714
  /* @__PURE__ */ jsx77(
23527
23715
  "a",
23528
23716
  {
@@ -24355,7 +24543,7 @@ import {
24355
24543
  } from "@ai-matrx/records";
24356
24544
  import { mapPgError } from "@ai-matrx/records/core";
24357
24545
  import { cn as cn56 } from "@ai-matrx/design-system";
24358
- 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";
24359
24547
  var priorKey = (key) => `prior__${key}`;
24360
24548
  function Trend({ pct, aimingUp, className }) {
24361
24549
  if (pct === null || pct === void 0) return null;
@@ -24506,7 +24694,7 @@ function ChartBlock({ block, subject, className }) {
24506
24694
  ] }),
24507
24695
  block.compare_refused ? /* @__PURE__ */ jsx82("p", { className: "px-1 text-xs text-muted-foreground", children: block.compare_refused }) : null,
24508
24696
  !block.refused && targetNote(target) ? /* @__PURE__ */ jsx82("p", { className: "px-1 text-xs text-muted-foreground", children: targetNote(target) }) : null,
24509
- 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: [
24510
24698
  /* @__PURE__ */ jsx82(Drawing, { kind, points, series, config, onDrill: drill, goal }),
24511
24699
  /* @__PURE__ */ jsx82(Values, { points, measure: primary, config, onDrill: drill, compared, aimingUp: !!target })
24512
24700
  ] }) })
@@ -24526,7 +24714,7 @@ function BigNumber({
24526
24714
  const windows = block.compare ?? null;
24527
24715
  const target = block.target ?? null;
24528
24716
  const priorTotal = block.totals?.prior;
24529
- const body = /* @__PURE__ */ jsxs76(Fragment31, { children: [
24717
+ const body = /* @__PURE__ */ jsxs76(Fragment32, { children: [
24530
24718
  /* @__PURE__ */ jsxs76("span", { className: "flex items-baseline gap-2", children: [
24531
24719
  /* @__PURE__ */ jsx82("span", { className: "text-2xl font-semibold tabular-nums", children: pretty(total) }),
24532
24720
  windows ? /* @__PURE__ */ jsx82(Trend, { pct: block.totals?.change_pct, aimingUp: !!target, className: "text-sm" }) : null
@@ -24570,7 +24758,7 @@ function Values({
24570
24758
  aimingUp
24571
24759
  }) {
24572
24760
  return /* @__PURE__ */ jsx82("ul", { className: "flex flex-wrap gap-x-2 gap-y-0.5", children: points.map((point) => {
24573
- const text = /* @__PURE__ */ jsxs76(Fragment31, { children: [
24761
+ const text = /* @__PURE__ */ jsxs76(Fragment32, { children: [
24574
24762
  /* @__PURE__ */ jsx82(
24575
24763
  "span",
24576
24764
  {
@@ -24750,10 +24938,10 @@ function Drawing({
24750
24938
  margin: { top: 6, right: 6, bottom: 0, left: 0 },
24751
24939
  children: [
24752
24940
  /* @__PURE__ */ jsx82(CartesianGrid, { vertical: horizontal, horizontal: !horizontal }),
24753
- horizontal ? /* @__PURE__ */ jsxs76(Fragment31, { children: [
24941
+ horizontal ? /* @__PURE__ */ jsxs76(Fragment32, { children: [
24754
24942
  /* @__PURE__ */ jsx82(XAxis, { type: "number", ...axis }),
24755
24943
  /* @__PURE__ */ jsx82(YAxis, { type: "category", dataKey: "label", width: 88, ...axis })
24756
- ] }) : /* @__PURE__ */ jsxs76(Fragment31, { children: [
24944
+ ] }) : /* @__PURE__ */ jsxs76(Fragment32, { children: [
24757
24945
  /* @__PURE__ */ jsx82(XAxis, { dataKey: "label", ...axis }),
24758
24946
  /* @__PURE__ */ jsx82(YAxis, { width: 44, ...axis })
24759
24947
  ] }),
@@ -24783,15 +24971,15 @@ import { useFields as useFields22, useRecordsClient as useRecordsClient54, useTa
24783
24971
  import {
24784
24972
  BasicInput as BasicInput25,
24785
24973
  Button as Button63,
24786
- Select as Select7,
24787
- SelectContent as SelectContent7,
24788
- SelectItem as SelectItem7,
24789
- SelectTrigger as SelectTrigger7,
24790
- SelectValue as SelectValue7,
24974
+ Select as Select8,
24975
+ SelectContent as SelectContent8,
24976
+ SelectItem as SelectItem8,
24977
+ SelectTrigger as SelectTrigger8,
24978
+ SelectValue as SelectValue8,
24791
24979
  Skeleton as Skeleton27,
24792
24980
  cn as cn57
24793
24981
  } from "@ai-matrx/design-system";
24794
- 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";
24795
24983
  function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
24796
24984
  const client = useRecordsClient54();
24797
24985
  const host = useRecordsUi();
@@ -24966,15 +25154,15 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
24966
25154
  rights.admin ? /* @__PURE__ */ jsx83(Button63, { size: "sm", variant: "ghost", onClick: () => void create(), children: "New dashboard" }) : null,
24967
25155
  board ? /* @__PURE__ */ jsxs77("span", { className: "ml-auto flex items-center gap-1", children: [
24968
25156
  (board.blocks ?? []).some((b) => !!b.bucket) ? /* @__PURE__ */ jsxs77(
24969
- Select7,
25157
+ Select8,
24970
25158
  {
24971
25159
  value: grain ?? "saved",
24972
25160
  onValueChange: (v) => setGrain(v === "saved" ? null : v),
24973
25161
  children: [
24974
- /* @__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, {}) }),
24975
- /* @__PURE__ */ jsxs77(SelectContent7, { children: [
24976
- /* @__PURE__ */ jsx83(SelectItem7, { value: "saved", children: "By the saved grain" }),
24977
- 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: [
24978
25166
  "By ",
24979
25167
  GRAIN_LABEL[g].toLowerCase()
24980
25168
  ] }, g))
@@ -25001,7 +25189,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
25001
25189
  children: scheduling ? "Done" : "Send on a schedule"
25002
25190
  }
25003
25191
  ),
25004
- rights.admin && askingToRemove === board.id ? /* @__PURE__ */ jsxs77(Fragment32, { children: [
25192
+ rights.admin && askingToRemove === board.id ? /* @__PURE__ */ jsxs77(Fragment33, { children: [
25005
25193
  /* @__PURE__ */ jsx83("span", { className: "text-xs text-destructive", children: archiveConfirmSentence(`the dashboard \u201C${board.name}\u201D`) }),
25006
25194
  /* @__PURE__ */ jsx83(Button63, { size: "sm", variant: "destructive", onClick: () => void remove(board), children: "Remove it" }),
25007
25195
  /* @__PURE__ */ jsx83(Button63, { size: "sm", variant: "ghost", onClick: () => setAskingToRemove(null), children: "Keep it" })
@@ -25044,7 +25232,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
25044
25232
  !host.onReask ? /* @__PURE__ */ jsx83("p", { className: "text-xs text-muted-foreground", children: NO_REASK_REASON }) : null
25045
25233
  ] }) : null,
25046
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,
25047
- !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: [
25048
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: [
25049
25237
  /* @__PURE__ */ jsx83(ChartBlock, { block, subject: tableId }),
25050
25238
  rights.admin && board.blocks[index] ? /* @__PURE__ */ jsxs77("div", { className: "flex flex-wrap items-center gap-1 text-xs", children: [
@@ -25150,20 +25338,20 @@ function GroupingPicker({
25150
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." });
25151
25339
  }
25152
25340
  const known = choices.some((c) => c.field.key === current);
25153
- return /* @__PURE__ */ jsxs77(Fragment32, { children: [
25341
+ return /* @__PURE__ */ jsxs77(Fragment33, { children: [
25154
25342
  /* @__PURE__ */ jsx83("label", { className: "text-muted-foreground", htmlFor: `block-group-${block.title}`, children: "Group by" }),
25155
- /* @__PURE__ */ jsxs77(Select7, { value: known ? current : "", onValueChange: onPick, children: [
25343
+ /* @__PURE__ */ jsxs77(Select8, { value: known ? current : "", onValueChange: onPick, children: [
25156
25344
  /* @__PURE__ */ jsx83(
25157
- SelectTrigger7,
25345
+ SelectTrigger8,
25158
25346
  {
25159
25347
  size: "sm",
25160
25348
  id: `block-group-${block.title}`,
25161
25349
  "aria-label": `Which column ${block.title} is grouped by`,
25162
25350
  className: "h-7 min-w-[10rem] text-xs",
25163
- children: /* @__PURE__ */ jsx83(SelectValue7, { placeholder: "Choose a column" })
25351
+ children: /* @__PURE__ */ jsx83(SelectValue8, { placeholder: "Choose a column" })
25164
25352
  }
25165
25353
  ),
25166
- /* @__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)) })
25167
25355
  ] }),
25168
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." })
25169
25357
  ] });
@@ -25247,9 +25435,9 @@ function CompareControl({
25247
25435
  // that has one does not lose it by being shown.
25248
25436
  (k) => k !== "range" || current === "range"
25249
25437
  );
25250
- return /* @__PURE__ */ jsxs77(Fragment32, { children: [
25438
+ return /* @__PURE__ */ jsxs77(Fragment33, { children: [
25251
25439
  /* @__PURE__ */ jsxs77(
25252
- Select7,
25440
+ Select8,
25253
25441
  {
25254
25442
  value: current ?? "none",
25255
25443
  onValueChange: (v) => {
@@ -25263,22 +25451,22 @@ function CompareControl({
25263
25451
  });
25264
25452
  },
25265
25453
  children: [
25266
- /* @__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, {}) }),
25267
- /* @__PURE__ */ jsxs77(SelectContent7, { children: [
25268
- /* @__PURE__ */ jsx83(SelectItem7, { value: "none", children: "No comparison" }),
25269
- 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))
25270
25458
  ] })
25271
25459
  ]
25272
25460
  }
25273
25461
  ),
25274
25462
  current && !explicitWindow ? /* @__PURE__ */ jsxs77(
25275
- Select7,
25463
+ Select8,
25276
25464
  {
25277
25465
  value: period,
25278
25466
  onValueChange: (v) => onChange({ ...block.compare ?? { against: current, key }, period: v }),
25279
25467
  children: [
25280
- /* @__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, {}) }),
25281
- /* @__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: [
25282
25470
  "This ",
25283
25471
  GRAIN_LABEL[g].toLowerCase()
25284
25472
  ] }, g)) })
@@ -25309,9 +25497,9 @@ function TargetControl({
25309
25497
  if (draft.trim() === "" || !Number.isFinite(n) || n === savedValue) return;
25310
25498
  onChange({ value: n, label: label && saved === "value" ? label : "Target", ...per ? { per } : {} });
25311
25499
  }
25312
- return /* @__PURE__ */ jsxs77(Fragment32, { children: [
25500
+ return /* @__PURE__ */ jsxs77(Fragment33, { children: [
25313
25501
  /* @__PURE__ */ jsxs77(
25314
- Select7,
25502
+ Select8,
25315
25503
  {
25316
25504
  value: mode,
25317
25505
  onValueChange: (v) => {
@@ -25320,11 +25508,11 @@ function TargetControl({
25320
25508
  if (next === "none" && saved !== "none") onChange(null);
25321
25509
  },
25322
25510
  children: [
25323
- /* @__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, {}) }),
25324
- /* @__PURE__ */ jsxs77(SelectContent7, { children: [
25325
- /* @__PURE__ */ jsx83(SelectItem7, { value: "none", children: "No target" }),
25326
- /* @__PURE__ */ jsx83(SelectItem7, { value: "value", children: "A target number" }),
25327
- 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
25328
25516
  ] })
25329
25517
  ]
25330
25518
  }
@@ -25345,7 +25533,7 @@ function TargetControl({
25345
25533
  }
25346
25534
  ) : null,
25347
25535
  mode === "field" ? /* @__PURE__ */ jsxs77(
25348
- Select7,
25536
+ Select8,
25349
25537
  {
25350
25538
  value: block.target && "field" in block.target && block.target.field ? block.target.field : "",
25351
25539
  onValueChange: (key) => {
@@ -25354,8 +25542,8 @@ function TargetControl({
25354
25542
  onChange({ field: key, op: "sum", label: fieldName(picked) });
25355
25543
  },
25356
25544
  children: [
25357
- /* @__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" }) }),
25358
- /* @__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)) })
25359
25547
  ]
25360
25548
  }
25361
25549
  ) : null
@@ -25367,7 +25555,7 @@ import { useCallback as useCallback42, useEffect as useEffect62, useState as use
25367
25555
  import { useRecordsClient as useRecordsClient55, useTable as useTable20 } from "@ai-matrx/records/react";
25368
25556
  import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
25369
25557
  import { Badge as Badge20, Button as Button64, Skeleton as Skeleton28, cn as cn58 } from "@ai-matrx/design-system";
25370
- 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";
25371
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.";
25372
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.";
25373
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.";
@@ -25488,12 +25676,12 @@ function FormsPanel({ tableId, activeFormId, className }) {
25488
25676
  /* @__PURE__ */ jsxs78("p", { className: "mt-1.5 text-xs", children: [
25489
25677
  /* @__PURE__ */ jsx84("span", { className: "font-medium", children: form.in_table }),
25490
25678
  " in the table",
25491
- form.held > 0 ? /* @__PURE__ */ jsxs78(Fragment33, { children: [
25679
+ form.held > 0 ? /* @__PURE__ */ jsxs78(Fragment34, { children: [
25492
25680
  " \xB7 ",
25493
25681
  /* @__PURE__ */ jsx84("span", { className: "font-medium", children: form.held }),
25494
25682
  " waiting for someone"
25495
25683
  ] }) : null,
25496
- form.rejected > 0 ? /* @__PURE__ */ jsxs78(Fragment33, { children: [
25684
+ form.rejected > 0 ? /* @__PURE__ */ jsxs78(Fragment34, { children: [
25497
25685
  " \xB7 ",
25498
25686
  /* @__PURE__ */ jsx84("span", { className: "font-medium", children: form.rejected }),
25499
25687
  " turned away"
@@ -25538,7 +25726,7 @@ import {
25538
25726
  bookingPath
25539
25727
  } from "@ai-matrx/records";
25540
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";
25541
- 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";
25542
25730
  var STORE_ANSWERS_THESE = ["slot", "status", "booked_with"];
25543
25731
  var DAYS = [
25544
25732
  { weekday: 1, label: "Mon" },
@@ -25779,7 +25967,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
25779
25967
  ),
25780
25968
  DAYS[i]?.label
25781
25969
  ] }),
25782
- w.on ? /* @__PURE__ */ jsxs79(Fragment34, { children: [
25970
+ w.on ? /* @__PURE__ */ jsxs79(Fragment35, { children: [
25783
25971
  /* @__PURE__ */ jsx85(
25784
25972
  BasicInput26,
25785
25973
  {
@@ -25884,7 +26072,7 @@ import { useCallback as useCallback44, useEffect as useEffect64, useMemo as useM
25884
26072
  import { useRecordsClient as useRecordsClient57, useMyLevels as useMyLevels2 } from "@ai-matrx/records/react";
25885
26073
  import { bookingPath as bookingPath2 } from "@ai-matrx/records";
25886
26074
  import { Badge as Badge21, Button as Button66, Skeleton as Skeleton30, cn as cn60 } from "@ai-matrx/design-system";
25887
- 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";
25888
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.";
25889
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.";
25890
26078
  function bookingSuggestion(tableName2) {
@@ -26024,12 +26212,12 @@ function BookingSlots({ tableId, activeBookingId, className }) {
26024
26212
  " \xB7 ",
26025
26213
  /* @__PURE__ */ jsx86("span", { className: "font-medium", children: page.booked }),
26026
26214
  " booked in all",
26027
- page.held > 0 ? /* @__PURE__ */ jsxs80(Fragment35, { children: [
26215
+ page.held > 0 ? /* @__PURE__ */ jsxs80(Fragment36, { children: [
26028
26216
  " \xB7 ",
26029
26217
  /* @__PURE__ */ jsx86("span", { className: "font-medium", children: page.held }),
26030
26218
  " being held right now"
26031
26219
  ] }) : null,
26032
- page.cancelled > 0 ? /* @__PURE__ */ jsxs80(Fragment35, { children: [
26220
+ page.cancelled > 0 ? /* @__PURE__ */ jsxs80(Fragment36, { children: [
26033
26221
  " \xB7 ",
26034
26222
  /* @__PURE__ */ jsx86("span", { className: "font-medium", children: page.cancelled }),
26035
26223
  " cancelled"
@@ -26486,7 +26674,7 @@ function CaptureRun({ sheetId, face: given, className }) {
26486
26674
  }
26487
26675
 
26488
26676
  // src/CaptureSheet.tsx
26489
- 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";
26490
26678
  var CAPTURE_MODES = ["reading", "photo", "voice"];
26491
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.";
26492
26680
  function mintClientKey() {
@@ -26663,7 +26851,7 @@ function AdHocCaptureSheet({
26663
26851
  " ",
26664
26852
  /* @__PURE__ */ jsx88("code", { children: "attachmentField" }),
26665
26853
  "."
26666
- ] }) : /* @__PURE__ */ jsxs82(Fragment36, { children: [
26854
+ ] }) : /* @__PURE__ */ jsxs82(Fragment37, { children: [
26667
26855
  /* @__PURE__ */ jsx88(
26668
26856
  "input",
26669
26857
  {
@@ -26917,7 +27105,7 @@ import { useCallback as useCallback49, useEffect as useEffect69, useState as use
26917
27105
  import { useRecordsClient as useRecordsClient62 } from "@ai-matrx/records/react";
26918
27106
  import { Button as Button70, Input as Input5, Skeleton as Skeleton35, Textarea as Textarea4, cn as cn65 } from "@ai-matrx/design-system";
26919
27107
  import { useTable as useTable23 } from "@ai-matrx/records/react";
26920
- 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";
26921
27109
  function EmbedFrame({
26922
27110
  tableId,
26923
27111
  formId,
@@ -27001,7 +27189,7 @@ function EmbedFrame({
27001
27189
  " will not pass."
27002
27190
  ] })
27003
27191
  ] }),
27004
- !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: [
27005
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." }),
27006
27194
  /* @__PURE__ */ jsx91(Textarea4, { "aria-label": "Embed snippet", readOnly: true, rows: 3, className: "font-mono text-[11px]", value: snippet ?? "" }),
27007
27195
  /* @__PURE__ */ jsxs85("div", { className: "flex gap-2", children: [
@@ -27411,7 +27599,7 @@ function SharedNameAddress({
27411
27599
  }
27412
27600
 
27413
27601
  // src/TablesHome.tsx
27414
- 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";
27415
27603
  var TABLE_LANES = ["mine", "organization", "system", "community", "app"];
27416
27604
  var LANE_TITLE = {
27417
27605
  mine: "Mine",
@@ -27539,7 +27727,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, classNa
27539
27727
  [client, name, onOpenTable, tables]
27540
27728
  );
27541
27729
  return /* @__PURE__ */ jsxs88("div", { className: cn67("flex min-h-0 flex-col gap-4", className), children: [
27542
- /* @__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: [
27543
27731
  /* @__PURE__ */ jsx95(
27544
27732
  BasicInput27,
27545
27733
  {
@@ -27566,7 +27754,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, classNa
27566
27754
  }
27567
27755
  ),
27568
27756
  /* @__PURE__ */ jsx95(Button73, { size: "sm", variant: "ghost", onClick: () => setCreating(false), children: "Cancel" })
27569
- ] }) : /* @__PURE__ */ jsxs88(Fragment38, { children: [
27757
+ ] }) : /* @__PURE__ */ jsxs88(Fragment39, { children: [
27570
27758
  /* @__PURE__ */ jsx95(Button73, { size: "sm", onClick: () => setCreating(true), children: "New table" }),
27571
27759
  /* @__PURE__ */ jsx95(
27572
27760
  Button73,
@@ -27980,7 +28168,7 @@ function useSlotScroll(slot) {
27980
28168
  }
27981
28169
 
27982
28170
  // src/TablePage.tsx
27983
- 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";
27984
28172
  var RAIL_TITLE = {
27985
28173
  settings: "Table settings",
27986
28174
  inbox: "Inbox",
@@ -28212,7 +28400,7 @@ function MenuEntry({
28212
28400
  onPress,
28213
28401
  separatorBefore
28214
28402
  }) {
28215
- return /* @__PURE__ */ jsxs90(Fragment39, { children: [
28403
+ return /* @__PURE__ */ jsxs90(Fragment40, { children: [
28216
28404
  separatorBefore ? /* @__PURE__ */ jsx97(DropdownMenuSeparator3, {}) : null,
28217
28405
  /* @__PURE__ */ jsx97(DropdownMenuCheckboxItem2, { checked, onSelect: () => onPress(), children: label })
28218
28406
  ] });
@@ -28487,7 +28675,7 @@ function TablePage({
28487
28675
  ]
28488
28676
  }
28489
28677
  );
28490
- 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: [
28491
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 }) }) }),
28492
28680
  /* @__PURE__ */ jsxs90("div", { role: "group", "aria-label": "Layout", className: "flex flex-wrap gap-1 pt-1", "data-table-sheet-layout": "", children: [
28493
28681
  VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx97(
@@ -28517,7 +28705,7 @@ function TablePage({
28517
28705
  ] }),
28518
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
28519
28707
  ] }) : void 0;
28520
- const pageActions = /* @__PURE__ */ jsxs90(Fragment39, { children: [
28708
+ const pageActions = /* @__PURE__ */ jsxs90(Fragment40, { children: [
28521
28709
  /* @__PURE__ */ jsx97(
28522
28710
  ShareControl,
28523
28711
  {
@@ -28538,7 +28726,7 @@ function TablePage({
28538
28726
  /* @__PURE__ */ jsx97("circle", { cx: "19", cy: "12", r: "1.75" })
28539
28727
  ] }) }) }),
28540
28728
  /* @__PURE__ */ jsxs90(DropdownMenuContent4, { align: "end", className: "w-56", "data-table-menu-content": "", children: [
28541
- !chooserInline && !chooserCompact ? /* @__PURE__ */ jsxs90(Fragment39, { children: [
28729
+ !chooserInline && !chooserCompact ? /* @__PURE__ */ jsxs90(Fragment40, { children: [
28542
28730
  /* @__PURE__ */ jsx97(DropdownMenuLabel3, { className: "text-xs text-muted-foreground", children: "Layout" }),
28543
28731
  layoutRadio,
28544
28732
  /* @__PURE__ */ jsx97(DropdownMenuSeparator3, {})
@@ -28553,15 +28741,15 @@ function TablePage({
28553
28741
  },
28554
28742
  entry.key
28555
28743
  )),
28556
- phone && rights.share && canShare ? /* @__PURE__ */ jsxs90(Fragment39, { children: [
28744
+ phone && rights.share && canShare ? /* @__PURE__ */ jsxs90(Fragment40, { children: [
28557
28745
  /* @__PURE__ */ jsx97(DropdownMenuSeparator3, {}),
28558
28746
  /* @__PURE__ */ jsx97(DropdownMenuItem4, { onSelect: () => setShareAsked((n) => n + 1), "data-table-menu-share": "", children: "Share\u2026" })
28559
28747
  ] }) : null,
28560
- canDesignate ? /* @__PURE__ */ jsxs90(Fragment39, { children: [
28748
+ canDesignate ? /* @__PURE__ */ jsxs90(Fragment40, { children: [
28561
28749
  /* @__PURE__ */ jsx97(DropdownMenuSeparator3, {}),
28562
28750
  /* @__PURE__ */ jsx97(DropdownMenuItem4, { onSelect: () => void designate(), "data-table-designate": layoutShowing ?? "", children: makeDefaultLabel(layoutShowingLabel) })
28563
28751
  ] }) : null,
28564
- menuExtras && menuExtras.length > 0 ? /* @__PURE__ */ jsxs90(Fragment39, { children: [
28752
+ menuExtras && menuExtras.length > 0 ? /* @__PURE__ */ jsxs90(Fragment40, { children: [
28565
28753
  /* @__PURE__ */ jsx97(DropdownMenuSeparator3, {}),
28566
28754
  menuExtras.map((extra) => /* @__PURE__ */ jsx97(DropdownMenuItem4, { onSelect: () => extra.onSelect(), "data-table-menu-extra": extra.key, children: extra.label }, extra.key))
28567
28755
  ] }) : null
@@ -28569,16 +28757,16 @@ function TablePage({
28569
28757
  ] }, "menu")
28570
28758
  ] });
28571
28759
  const headerNode = header ? header({ actions: table.data ? pageActions : null, tableName: table.data?.name ?? null }) : null;
28572
- if (table.error) return /* @__PURE__ */ jsxs90(Fragment39, { children: [
28760
+ if (table.error) return /* @__PURE__ */ jsxs90(Fragment40, { children: [
28573
28761
  headerNode,
28574
28762
  /* @__PURE__ */ jsx97(RefusalNotice, { error: table.error })
28575
28763
  ] });
28576
- if (table.loading) return /* @__PURE__ */ jsxs90(Fragment39, { children: [
28764
+ if (table.loading) return /* @__PURE__ */ jsxs90(Fragment40, { children: [
28577
28765
  headerNode,
28578
28766
  /* @__PURE__ */ jsx97(Skeleton38, { className: "h-40 w-full" })
28579
28767
  ] });
28580
28768
  if (!table.data) {
28581
- return /* @__PURE__ */ jsxs90(Fragment39, { children: [
28769
+ return /* @__PURE__ */ jsxs90(Fragment40, { children: [
28582
28770
  headerNode,
28583
28771
  /* @__PURE__ */ jsx97(TableNotHere, { tableId, onLeave, leaveLabel, className })
28584
28772
  ] });