@ai-matrx/records-ui 0.115.99 → 0.115.101

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
@@ -10284,7 +10284,7 @@ function ReferenceBuilder({
10284
10284
  }
10285
10285
 
10286
10286
  // src/gridEditing.tsx
10287
- import { useCallback as useCallback15, useEffect as useEffect35, useMemo as useMemo20, useRef as useRef26, useState as useState46 } from "react";
10287
+ import { useCallback as useCallback15, useContext as useContext7, useEffect as useEffect35, useMemo as useMemo20, useRef as useRef26, useState as useState46 } from "react";
10288
10288
  import { isButtonField as isButtonField4 } from "@ai-matrx/records";
10289
10289
  import { asWriteConflict, wholeValueOf as wholeValueOf2 } from "@ai-matrx/records/core";
10290
10290
  import { useRecordsClient as useRecordsClient21 } from "@ai-matrx/records/react";
@@ -13993,6 +13993,8 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
13993
13993
  if (Array.isArray(value)) {
13994
13994
  return /* @__PURE__ */ jsx44("span", { className: "flex flex-wrap gap-1", children: value.map((item, i) => /* @__PURE__ */ jsx44(Badge8, { variant: "secondary", className: "text-[11px]", children: scalarText(field2, item, labels) }, `${String(item)}-${i}`)) });
13995
13995
  }
13996
+ const pictureAt = imageAddressOf(field2, value);
13997
+ if (pictureAt) return /* @__PURE__ */ jsx44(ImageUrlValue, { url: pictureAt, alt: field2.label || field2.key, room });
13996
13998
  if (kind2 === "url" && typeof value === "string") {
13997
13999
  const href = value.includes("://") ? value : `https://${value}`;
13998
14000
  return /* @__PURE__ */ jsx44(LinkPreviewCard, { url: href, children: /* @__PURE__ */ jsxs39(
@@ -14031,6 +14033,41 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look, ro
14031
14033
  }
14032
14034
  return /* @__PURE__ */ jsx44("span", { className: cn29("truncate", kind2 === "number" || kind2 === "currency" || kind2 === "percent" ? "tabular-nums" : ""), children: scalarText(field2, value, labels, stillWaitingFor) });
14033
14035
  }
14036
+ function isImageUrl2(value) {
14037
+ const text = value.trim();
14038
+ if (!/^https?:\/\/[^\s]+$/i.test(text)) return false;
14039
+ let url;
14040
+ try {
14041
+ url = new URL(text);
14042
+ } catch {
14043
+ return false;
14044
+ }
14045
+ return /\.(png|jpe?g|gif|webp|avif|svg|bmp|ico)$/i.test(url.pathname) || /\/(images?|img)\//i.test(url.pathname);
14046
+ }
14047
+ function imageAddressOf(field2, value) {
14048
+ if (typeof value !== "string") return null;
14049
+ const kind2 = editorKindFor(field2);
14050
+ if (kind2 !== "text" && kind2 !== "url") return null;
14051
+ const text = value.trim();
14052
+ if (isImageUrl2(text)) return text;
14053
+ const named = /(^|[^a-z])(logo|image|img|photo|picture|avatar|thumbnail|headshot)s?([^a-z]|$)/i.test(`${field2.label ?? ""} ${field2.key}`);
14054
+ return named && /^https?:\/\/[^\s]+$/i.test(text) ? text : null;
14055
+ }
14056
+ function ImageUrlValue({ url, alt, room }) {
14057
+ const host = useRecordsUi();
14058
+ const box = room === "full" ? "size-24" : "size-6";
14059
+ return /* @__PURE__ */ jsx44(
14060
+ OutboundLink6,
14061
+ {
14062
+ className: cn29("inline-flex shrink-0 overflow-hidden rounded-md border border-border bg-muted/40", host.fileImage ? box : "min-w-0 max-w-full items-center gap-1 px-1.5 py-0.5 text-[11px] text-foreground hover:bg-accent"),
14063
+ href: url,
14064
+ title: url,
14065
+ "data-records-image-url": "",
14066
+ onClick: (event) => event.stopPropagation(),
14067
+ children: host.fileImage ? host.fileImage({ fileId: url, alt }) : /* @__PURE__ */ jsx44("span", { className: "truncate", children: linkChipText(url) })
14068
+ }
14069
+ );
14070
+ }
14034
14071
  function LivePersonChip({ id, name }) {
14035
14072
  const open = useRecordsUi().openPerson;
14036
14073
  return /* @__PURE__ */ jsx44(PersonChip, { name, ...open ? { onOpen: () => void openStoredPerson(id, open) } : {} });
@@ -14155,6 +14192,8 @@ function RecordValue({
14155
14192
  }
14156
14193
  }
14157
14194
  }
14195
+ const pictureAt = value !== null && value !== void 0 && !wholeValueOf(document2, field2.key) && !envelopeFor(document2, field2.key)?.absent ? imageAddressOf(field2, value) : null;
14196
+ if (pictureAt) return /* @__PURE__ */ jsx44(ImageUrlValue, { url: pictureAt, alt: field2.label || field2.key, room });
14158
14197
  const shown5 = format ?? formatForField(field2);
14159
14198
  const shape = shown5 && (shown5.id === "date" || shown5.id === "datetime") && isDateField(field2) ? dateFormatFor(field2, value) : void 0;
14160
14199
  const dated = shape ? { ...shape, ...shown5?.options ? { options: shown5.options } : {} } : void 0;
@@ -18579,6 +18618,104 @@ function useWhoChanged(fieldKey, recordId) {
18579
18618
  init_names();
18580
18619
  init_host();
18581
18620
 
18621
+ // src/gridOpen.tsx
18622
+ import { createContext as createContext7 } from "react";
18623
+ import { openOutbound as openOutbound2 } from "@ai-matrx/kit/outbound";
18624
+ import { Fragment as Fragment21, jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
18625
+ var TITLE_OWN_CONTROLS = 'input, textarea, select, button, a[href], [role="combobox"], [contenteditable="true"], [contenteditable=""]';
18626
+ var TitleCellOpensContext = createContext7(false);
18627
+ function openRecordLabel(name) {
18628
+ return `Open ${name}`;
18629
+ }
18630
+ function opensOnKey(event) {
18631
+ if (event.key !== " " || event.altKey || event.ctrlKey || event.metaKey) return false;
18632
+ const target = event.target;
18633
+ if (!target) return false;
18634
+ const tag = target.tagName;
18635
+ if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || tag === "BUTTON") return false;
18636
+ if (target.isContentEditable) {
18637
+ const editor = target.closest('[contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"]');
18638
+ const inside = event.currentTarget;
18639
+ if (!editor || !inside || inside.contains(editor)) return false;
18640
+ }
18641
+ return true;
18642
+ }
18643
+ function withOpenRecord(columns, onOpen, nameOf3, place = "end", hrefOf, openOnly) {
18644
+ if (!onOpen) return columns;
18645
+ return columns.map((column, index) => {
18646
+ const original = column.cell;
18647
+ const render = (row, rowIndex) => original ? original(row, rowIndex) : String(row[column.id ?? ""] ?? "");
18648
+ const openFrom = (row, event) => {
18649
+ const href = hrefOf?.(row);
18650
+ if (href && (event.metaKey || event.ctrlKey)) openOutbound2(href, "_blank", "noopener");
18651
+ else (openOnly ?? onOpen)(row.id);
18652
+ };
18653
+ const handle = (row) => /* @__PURE__ */ jsxs53(
18654
+ "button",
18655
+ {
18656
+ type: "button",
18657
+ "data-records-open-record": row.id,
18658
+ "aria-label": openRecordLabel(nameOf3(row)),
18659
+ title: `${openRecordLabel(nameOf3(row))} (Space) \xB7 \u2318-click: new tab`,
18660
+ className: "absolute right-0 top-1/2 z-10 inline-flex h-6 -translate-y-1/2 items-center gap-1 rounded border border-border bg-card px-1.5 text-xs font-medium leading-none text-foreground no-underline opacity-0 shadow-sm hover:bg-muted focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/matrx-row:opacity-100 [@media(hover:none)]:opacity-100",
18661
+ onClick: (event) => {
18662
+ event.stopPropagation();
18663
+ openFrom(row, event);
18664
+ },
18665
+ onDoubleClick: (event) => event.stopPropagation(),
18666
+ children: [
18667
+ /* @__PURE__ */ jsx59("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", width: "12", height: "12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx59("path", { d: "M9.5 2.5h4v4M13.5 2.5 8.5 7.5M6.5 3.5h-3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-3" }) }),
18668
+ "Open"
18669
+ ]
18670
+ }
18671
+ );
18672
+ const titleTarget = (event) => {
18673
+ const target = event.target;
18674
+ if (!target || typeof target.closest !== "function") return false;
18675
+ const hit = target.closest(TITLE_OWN_CONTROLS);
18676
+ return hit === null || !event.currentTarget.contains(hit);
18677
+ };
18678
+ return {
18679
+ ...column,
18680
+ cell: (row, rowIndex) => /* @__PURE__ */ jsx59(
18681
+ "span",
18682
+ {
18683
+ className: index === 0 ? "relative flex min-w-0 items-center gap-1" : "contents",
18684
+ "data-records-opens-on-space": row.id,
18685
+ onKeyDown: (event) => {
18686
+ if (!opensOnKey(event)) return;
18687
+ event.preventDefault();
18688
+ event.stopPropagation();
18689
+ onOpen(row.id);
18690
+ },
18691
+ children: index === 0 ? /* @__PURE__ */ jsxs53(Fragment21, { children: [
18692
+ place === "start" ? handle(row) : null,
18693
+ /* @__PURE__ */ jsx59(
18694
+ "span",
18695
+ {
18696
+ className: "min-w-0 flex-1 decoration-muted-foreground/60 underline-offset-2 hover:underline",
18697
+ "data-clickable": "",
18698
+ "data-records-opens-on-click": row.id,
18699
+ onClickCapture: (event) => {
18700
+ if (!titleTarget(event)) return;
18701
+ openFrom(row, event);
18702
+ },
18703
+ onDoubleClickCapture: (event) => {
18704
+ if (!titleTarget(event)) return;
18705
+ event.stopPropagation();
18706
+ openFrom(row, event);
18707
+ },
18708
+ children: /* @__PURE__ */ jsx59(TitleCellOpensContext.Provider, { value: true, children: render(row, rowIndex) })
18709
+ }
18710
+ ),
18711
+ place === "end" ? handle(row) : null
18712
+ ] }) : render(row, rowIndex)
18713
+ }
18714
+ )
18715
+ };
18716
+ });
18717
+ }
18718
+
18582
18719
  // src/gridHeldKeys.ts
18583
18720
  function isHeldKey(e) {
18584
18721
  if (e.metaKey || e.ctrlKey || e.altKey) return false;
@@ -18699,7 +18836,7 @@ function useWhenBackOnline(resend) {
18699
18836
  }
18700
18837
 
18701
18838
  // src/gridEditing.tsx
18702
- import { jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
18839
+ import { jsx as jsx60, jsxs as jsxs54 } from "react/jsx-runtime";
18703
18840
  var FLOATING_CELL_NOTE_CLASS = "[&_[data-records-cell-note]]:absolute [&_[data-records-cell-note]]:bottom-full [&_[data-records-cell-note]]:left-0 [&_[data-records-cell-note]]:z-[26] [&_[data-records-cell-note]]:mb-1 [&_[data-records-cell-note]]:w-max [&_[data-records-cell-note]]:max-w-[24rem] [&_[data-records-cell-note]]:rounded-md [&_[data-records-cell-note]]:border [&_[data-records-cell-note]]:bg-popover [&_[data-records-cell-note]]:px-1.5 [&_[data-records-cell-note]]:py-0.5 [&_[data-records-cell-note]]:shadow-md";
18704
18841
  var FLOATING_CELL_TRAY_CLASS = "absolute left-0 top-full z-[26] mt-1 flex w-max max-w-[24rem] flex-col items-start gap-1";
18705
18842
  var FLOATING_CELL_TRAY_PIECE_CLASS = "rounded-md border bg-popover px-1.5 py-0.5 shadow-md";
@@ -19327,6 +19464,7 @@ function GridCell({
19327
19464
  clickOpens = false
19328
19465
  }) {
19329
19466
  const ui = useRecordsUi();
19467
+ const titleOpens = useContext7(TitleCellOpensContext);
19330
19468
  const saidAt = useRef26(0);
19331
19469
  const sayWhyNot = () => {
19332
19470
  if (Date.now() - saidAt.current < 4e3) return;
@@ -19390,9 +19528,9 @@ function GridCell({
19390
19528
  const refusal3 = editing ? editing.refusalOf(row.id, field2.key) : null;
19391
19529
  const editable = Boolean(editing) && canWrite && fieldIsEditable(field2);
19392
19530
  if (open && editing) {
19393
- return /* @__PURE__ */ jsxs53("span", { "data-records-open-cell": "", className: "relative block w-full min-w-0", children: [
19394
- /* @__PURE__ */ jsxs53("span", { "aria-hidden": "true", inert: true, "data-records-cell-ghost": "", className: "pointer-events-none invisible flex w-full min-w-0 select-none items-center gap-1", children: [
19395
- /* @__PURE__ */ jsx59("span", { className: "block min-w-0 flex-1 truncate px-1 py-0.5", children: /* @__PURE__ */ jsx59(
19531
+ return /* @__PURE__ */ jsxs54("span", { "data-records-open-cell": "", className: "relative block w-full min-w-0", children: [
19532
+ /* @__PURE__ */ jsxs54("span", { "aria-hidden": "true", inert: true, "data-records-cell-ghost": "", className: "pointer-events-none invisible flex w-full min-w-0 select-none items-center gap-1", children: [
19533
+ /* @__PURE__ */ jsx60("span", { className: "block min-w-0 flex-1 truncate px-1 py-0.5", children: /* @__PURE__ */ jsx60(
19396
19534
  RecordValue,
19397
19535
  {
19398
19536
  inCell: true,
@@ -19404,11 +19542,11 @@ function GridCell({
19404
19542
  ...format ? { format } : {}
19405
19543
  }
19406
19544
  ) }),
19407
- onAskWhoChanged ? /* @__PURE__ */ jsx59(WhoBadge, { field: field2, row, onAskWhoChanged: () => {
19545
+ onAskWhoChanged ? /* @__PURE__ */ jsx60(WhoBadge, { field: field2, row, onAskWhoChanged: () => {
19408
19546
  }, onPressedTwice: () => {
19409
19547
  } }) : null
19410
19548
  ] }),
19411
- /* @__PURE__ */ jsx59(
19549
+ /* @__PURE__ */ jsx60(
19412
19550
  OpenCell,
19413
19551
  {
19414
19552
  field: field2,
@@ -19424,7 +19562,7 @@ function GridCell({
19424
19562
  // state they are in, so only Discard is offered. It is INSIDE the open
19425
19563
  // cell, so pressing Discard is not "focus left the cell" — which would
19426
19564
  // commit the refused value one more time on its way out.
19427
- refusal3 && !refusal3.conflict ? /* @__PURE__ */ jsx59(
19565
+ refusal3 && !refusal3.conflict ? /* @__PURE__ */ jsx60(
19428
19566
  RefusalNotice,
19429
19567
  {
19430
19568
  error: refusal3.error,
@@ -19439,8 +19577,8 @@ function GridCell({
19439
19577
  }
19440
19578
  if (editorKindFor(field2) === "checkbox") {
19441
19579
  const answered = value === true || value === false;
19442
- return /* @__PURE__ */ jsxs53("span", { "data-matrx-cell-control": "", className: "relative flex h-full w-full flex-wrap items-center gap-1.5", children: [
19443
- /* @__PURE__ */ jsx59(
19580
+ return /* @__PURE__ */ jsxs54("span", { "data-matrx-cell-control": "", className: "relative flex h-full w-full flex-wrap items-center gap-1.5", children: [
19581
+ /* @__PURE__ */ jsx60(
19444
19582
  Checkbox8,
19445
19583
  {
19446
19584
  checked: value === true,
@@ -19451,15 +19589,15 @@ function GridCell({
19451
19589
  onCheckedChange: (next) => editing?.setCell(row.id, field2.key, next === true)
19452
19590
  }
19453
19591
  ),
19454
- answered ? null : /* @__PURE__ */ jsx59("span", { className: "text-xs text-muted-foreground", title: "nobody has answered this yet", children: "\u2014" }),
19455
- refusal3 ? /* @__PURE__ */ jsx59(CellRefusalNotice, { refusal: refusal3, field: field2, row, editing, typed: false }) : null
19592
+ answered ? null : /* @__PURE__ */ jsx60("span", { className: "text-xs text-muted-foreground", title: "nobody has answered this yet", children: "\u2014" }),
19593
+ refusal3 ? /* @__PURE__ */ jsx60(CellRefusalNotice, { refusal: refusal3, field: field2, row, editing, typed: false }) : null
19456
19594
  ] });
19457
19595
  }
19458
19596
  if (editable && format?.id === "rating") {
19459
- return /* @__PURE__ */ jsxs53("span", { "data-matrx-cell-control": "", className: "relative flex h-full w-full flex-wrap items-center gap-1.5", children: [
19460
- /* @__PURE__ */ jsx59(FormattedValue, { value, format, onRate: (next) => editing?.setCell(row.id, field2.key, next), selectFirst: true }),
19461
- state2 === "saving" ? /* @__PURE__ */ jsx59("span", { "data-records-cell-saving": "", className: "pointer-events-none absolute right-1 top-1/2 z-10 -translate-y-1/2 rounded bg-card/90 px-1 text-[10px] text-muted-foreground", children: "Saving\u2026" }) : null,
19462
- refusal3 ? /* @__PURE__ */ jsx59(CellRefusalNotice, { refusal: refusal3, field: field2, row, editing, typed: false }) : null
19597
+ return /* @__PURE__ */ jsxs54("span", { "data-matrx-cell-control": "", className: "relative flex h-full w-full flex-wrap items-center gap-1.5", children: [
19598
+ /* @__PURE__ */ jsx60(FormattedValue, { value, format, onRate: (next) => editing?.setCell(row.id, field2.key, next), selectFirst: true }),
19599
+ state2 === "saving" ? /* @__PURE__ */ jsx60("span", { "data-records-cell-saving": "", className: "pointer-events-none absolute right-1 top-1/2 z-10 -translate-y-1/2 rounded bg-card/90 px-1 text-[10px] text-muted-foreground", children: "Saving\u2026" }) : null,
19600
+ refusal3 ? /* @__PURE__ */ jsx60(CellRefusalNotice, { refusal: refusal3, field: field2, row, editing, typed: false }) : null
19463
19601
  ] });
19464
19602
  }
19465
19603
  const openThisCell = (event) => {
@@ -19491,15 +19629,15 @@ function GridCell({
19491
19629
  // control IS the cell" marker, which overrides the `w-max` shrink that
19492
19630
  // `data-matrx-cell-control` alone earns and which was beating this `w-full`
19493
19631
  // — a 20px click target inside a 251px cell, measured.
19494
- /* @__PURE__ */ jsxs53(
19632
+ /* @__PURE__ */ jsxs54(
19495
19633
  "span",
19496
19634
  {
19497
19635
  "data-matrx-cell-control": "",
19498
19636
  "data-matrx-cell-fill": "",
19499
19637
  className: "group/cell relative flex h-full w-full min-w-0 flex-col justify-center gap-0.5",
19500
19638
  children: [
19501
- /* @__PURE__ */ jsxs53("span", { className: "flex w-full min-w-0 items-center gap-1", children: [
19502
- /* @__PURE__ */ jsx59(
19639
+ /* @__PURE__ */ jsxs54("span", { className: "flex w-full min-w-0 items-center gap-1", children: [
19640
+ /* @__PURE__ */ jsx60(
19503
19641
  "span",
19504
19642
  {
19505
19643
  ref: closedControl,
@@ -19507,7 +19645,7 @@ function GridCell({
19507
19645
  "aria-label": editable ? `Edit ${fieldName(field2)}` : void 0,
19508
19646
  title: cellMark ? cellMark : editable ? (
19509
19647
  // The words match the gesture (WALK3-FIX): one click opens a record-page field.
19510
- clickOpens ? `${fieldName(field2)} \u2014 click to edit` : `${fieldName(field2)} \u2014 double-click or press Enter to edit`
19648
+ clickOpens ? `${fieldName(field2)} \u2014 click to edit` : titleOpens ? "Click to open \xB7 Enter to edit" : `${fieldName(field2)} \u2014 double-click or press Enter to edit`
19511
19649
  ) : fieldIsEditable(field2) ? (
19512
19650
  // NOT A DEAD CONTROL AND NOT A SILENT ONE: the cell is plain
19513
19651
  // text, and hovering it says exactly why, in the level's own
@@ -19552,7 +19690,7 @@ function GridCell({
19552
19690
  if (!editable && (event.key === "Enter" || event.key === "F2" || isTypedCharacter(event))) sayWhyNot();
19553
19691
  },
19554
19692
  tabIndex: editable || onAskWhoChanged ? 0 : void 0,
19555
- children: /* @__PURE__ */ jsx59(
19693
+ children: /* @__PURE__ */ jsx60(
19556
19694
  RecordValue,
19557
19695
  {
19558
19696
  inCell: true,
@@ -19567,7 +19705,7 @@ function GridCell({
19567
19705
  )
19568
19706
  }
19569
19707
  ),
19570
- onAskWhoChanged ? /* @__PURE__ */ jsx59(
19708
+ onAskWhoChanged ? /* @__PURE__ */ jsx60(
19571
19709
  WhoBadge,
19572
19710
  {
19573
19711
  field: field2,
@@ -19581,8 +19719,8 @@ function GridCell({
19581
19719
  }
19582
19720
  ) : null
19583
19721
  ] }),
19584
- state2 === "saving" ? /* @__PURE__ */ jsx59("span", { "data-records-cell-saving": "", className: "pointer-events-none absolute right-1 top-1/2 z-10 -translate-y-1/2 rounded bg-card/90 px-1 text-[10px] text-muted-foreground", children: "Saving\u2026" }) : null,
19585
- refusal3 ? /* @__PURE__ */ jsx59(CellRefusalNotice, { refusal: refusal3, field: field2, row, editing, typed: true }) : null
19722
+ state2 === "saving" ? /* @__PURE__ */ jsx60("span", { "data-records-cell-saving": "", className: "pointer-events-none absolute right-1 top-1/2 z-10 -translate-y-1/2 rounded bg-card/90 px-1 text-[10px] text-muted-foreground", children: "Saving\u2026" }) : null,
19723
+ refusal3 ? /* @__PURE__ */ jsx60(CellRefusalNotice, { refusal: refusal3, field: field2, row, editing, typed: true }) : null
19586
19724
  ]
19587
19725
  }
19588
19726
  )
@@ -19599,31 +19737,31 @@ function CellRefusalNotice({
19599
19737
  const line = refusal3.unsent ? UNSENT_LINE : refusalLineForAPerson(refusal3.error);
19600
19738
  const notice = refusal3.unsent ? (
19601
19739
  // NOT SENT, NOT REFUSED: what was typed is still in the cell; it goes again once online.
19602
- /* @__PURE__ */ jsxs53("div", { className: "flex flex-col gap-1.5 px-3 py-2 text-xs", "data-records-cell-unsent": "", children: [
19603
- /* @__PURE__ */ jsx59("span", { className: "font-medium", children: UNSENT_LINE }),
19604
- /* @__PURE__ */ jsx59("span", { className: "max-w-[16rem] truncate text-muted-foreground", title: valueInALine(refusal3.attempted), children: valueInALine(refusal3.attempted) }),
19605
- /* @__PURE__ */ jsxs53("span", { className: "flex flex-wrap gap-1", children: [
19606
- /* @__PURE__ */ jsx59(Button30, { size: "sm", variant: "outline", className: "h-6", "data-records-cell-try-now": "", onClick: () => editing?.tryNow(row.id, field2.key), children: "Try now" }),
19607
- /* @__PURE__ */ jsx59(Button30, { size: "sm", variant: "ghost", className: "h-6", "data-records-cell-discard": "", onClick: () => editing?.discard(row.id, field2.key), children: "Discard" })
19740
+ /* @__PURE__ */ jsxs54("div", { className: "flex flex-col gap-1.5 px-3 py-2 text-xs", "data-records-cell-unsent": "", children: [
19741
+ /* @__PURE__ */ jsx60("span", { className: "font-medium", children: UNSENT_LINE }),
19742
+ /* @__PURE__ */ jsx60("span", { className: "max-w-[16rem] truncate text-muted-foreground", title: valueInALine(refusal3.attempted), children: valueInALine(refusal3.attempted) }),
19743
+ /* @__PURE__ */ jsxs54("span", { className: "flex flex-wrap gap-1", children: [
19744
+ /* @__PURE__ */ jsx60(Button30, { size: "sm", variant: "outline", className: "h-6", "data-records-cell-try-now": "", onClick: () => editing?.tryNow(row.id, field2.key), children: "Try now" }),
19745
+ /* @__PURE__ */ jsx60(Button30, { size: "sm", variant: "ghost", className: "h-6", "data-records-cell-discard": "", onClick: () => editing?.discard(row.id, field2.key), children: "Discard" })
19608
19746
  ] })
19609
19747
  ] })
19610
- ) : refusal3.conflict ? /* @__PURE__ */ jsx59(
19748
+ ) : refusal3.conflict ? /* @__PURE__ */ jsx60(
19611
19749
  RefusalNotice,
19612
19750
  {
19613
19751
  error: refusal3.error,
19614
19752
  className: "py-1.5 text-left",
19615
- actions: /* @__PURE__ */ jsxs53("span", { className: "flex flex-col gap-1", "data-refusal-conflict": "", children: [
19616
- /* @__PURE__ */ jsxs53("span", { className: "text-[11px]", children: [
19753
+ actions: /* @__PURE__ */ jsxs54("span", { className: "flex flex-col gap-1", "data-refusal-conflict": "", children: [
19754
+ /* @__PURE__ */ jsxs54("span", { className: "text-[11px]", children: [
19617
19755
  "Theirs: ",
19618
- /* @__PURE__ */ jsx59("strong", { children: formatTheirs(refusal3.conflict, field2.key) })
19756
+ /* @__PURE__ */ jsx60("strong", { children: formatTheirs(refusal3.conflict, field2.key) })
19619
19757
  ] }),
19620
- /* @__PURE__ */ jsxs53("span", { className: "flex flex-wrap gap-1", children: [
19621
- /* @__PURE__ */ jsx59(Button30, { size: "sm", variant: "outline", onClick: () => editing?.retry(row.id, field2.key), children: "Try again" }),
19622
- /* @__PURE__ */ jsx59(Button30, { size: "sm", variant: "ghost", onClick: () => editing?.keepTheirs(row.id, field2.key), children: "Keep theirs" })
19758
+ /* @__PURE__ */ jsxs54("span", { className: "flex flex-wrap gap-1", children: [
19759
+ /* @__PURE__ */ jsx60(Button30, { size: "sm", variant: "outline", onClick: () => editing?.retry(row.id, field2.key), children: "Try again" }),
19760
+ /* @__PURE__ */ jsx60(Button30, { size: "sm", variant: "ghost", onClick: () => editing?.keepTheirs(row.id, field2.key), children: "Keep theirs" })
19623
19761
  ] })
19624
19762
  ] })
19625
19763
  }
19626
- ) : /* @__PURE__ */ jsx59(
19764
+ ) : /* @__PURE__ */ jsx60(
19627
19765
  RefusalNotice,
19628
19766
  {
19629
19767
  error: refusal3.error,
@@ -19632,8 +19770,8 @@ function CellRefusalNotice({
19632
19770
  onDiscard: () => editing?.discard(row.id, field2.key)
19633
19771
  }
19634
19772
  );
19635
- return /* @__PURE__ */ jsxs53(Popover10, { open, onOpenChange: setOpen, children: [
19636
- /* @__PURE__ */ jsx59(PopoverTrigger10, { asChild: true, children: /* @__PURE__ */ jsx59(
19773
+ return /* @__PURE__ */ jsxs54(Popover10, { open, onOpenChange: setOpen, children: [
19774
+ /* @__PURE__ */ jsx60(PopoverTrigger10, { asChild: true, children: /* @__PURE__ */ jsx60(
19637
19775
  "button",
19638
19776
  {
19639
19777
  type: "button",
@@ -19645,7 +19783,7 @@ function CellRefusalNotice({
19645
19783
  children: "!"
19646
19784
  }
19647
19785
  ) }),
19648
- /* @__PURE__ */ jsx59(
19786
+ /* @__PURE__ */ jsx60(
19649
19787
  PopoverContent10,
19650
19788
  {
19651
19789
  sizing: "content",
@@ -19672,7 +19810,7 @@ function WhoBadge({
19672
19810
  // by CSS, so copying the page, a range or the cell never carries "who?". It is a pointer
19673
19811
  // shortcut beside the value; the keyboard asks the same question with Option-Shift-H and the
19674
19812
  // cell's right-click menu, so it stays out of the tab order and the accessibility tree.
19675
- /* @__PURE__ */ jsx59(
19813
+ /* @__PURE__ */ jsx60(
19676
19814
  "button",
19677
19815
  {
19678
19816
  type: "button",
@@ -19695,9 +19833,9 @@ function WhoBadge({
19695
19833
  event.stopPropagation();
19696
19834
  onPressedTwice();
19697
19835
  },
19698
- children: who.badge ? null : /* @__PURE__ */ jsxs53("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "12", height: "12", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "data-records-who-glyph": "", children: [
19699
- /* @__PURE__ */ jsx59("circle", { cx: "12", cy: "12", r: "9" }),
19700
- /* @__PURE__ */ jsx59("path", { d: "M12 7v5l3 2" })
19836
+ children: who.badge ? null : /* @__PURE__ */ jsxs54("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "12", height: "12", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "data-records-who-glyph": "", children: [
19837
+ /* @__PURE__ */ jsx60("circle", { cx: "12", cy: "12", r: "9" }),
19838
+ /* @__PURE__ */ jsx60("path", { d: "M12 7v5l3 2" })
19701
19839
  ] })
19702
19840
  }
19703
19841
  )
@@ -19816,7 +19954,7 @@ function OpenCell({
19816
19954
  once(() => onCommit(null, "blur"));
19817
19955
  }
19818
19956
  } : {};
19819
- return /* @__PURE__ */ jsxs53(
19957
+ return /* @__PURE__ */ jsxs54(
19820
19958
  "span",
19821
19959
  {
19822
19960
  ref: host,
@@ -19876,7 +20014,7 @@ function OpenCell({
19876
20014
  },
19877
20015
  ...blur,
19878
20016
  children: [
19879
- /* @__PURE__ */ jsx59(
20017
+ /* @__PURE__ */ jsx60(
19880
20018
  FieldControl,
19881
20019
  {
19882
20020
  field: field2,
@@ -19891,12 +20029,12 @@ function OpenCell({
19891
20029
  recordId
19892
20030
  }
19893
20031
  ),
19894
- /* @__PURE__ */ jsxs53("span", { "data-records-cell-tray": "", className: FLOATING_CELL_TRAY_CLASS, children: [
19895
- picker || asksAboutAChoice(draft) ? null : blurCommits ? null : /* @__PURE__ */ jsxs53("span", { className: cn35("flex items-center gap-1", FLOATING_CELL_TRAY_PIECE_CLASS), children: [
19896
- /* @__PURE__ */ jsx59(Button30, { size: "sm", onClick: () => once(() => onCommit(null, "pick")), children: "Save" }),
19897
- /* @__PURE__ */ jsx59(Button30, { size: "sm", variant: "ghost", onClick: () => once(() => onCancel("pick")), children: "Cancel" })
20032
+ /* @__PURE__ */ jsxs54("span", { "data-records-cell-tray": "", className: FLOATING_CELL_TRAY_CLASS, children: [
20033
+ picker || asksAboutAChoice(draft) ? null : blurCommits ? null : /* @__PURE__ */ jsxs54("span", { className: cn35("flex items-center gap-1", FLOATING_CELL_TRAY_PIECE_CLASS), children: [
20034
+ /* @__PURE__ */ jsx60(Button30, { size: "sm", onClick: () => once(() => onCommit(null, "pick")), children: "Save" }),
20035
+ /* @__PURE__ */ jsx60(Button30, { size: "sm", variant: "ghost", onClick: () => once(() => onCancel("pick")), children: "Cancel" })
19898
20036
  ] }),
19899
- below ? /* @__PURE__ */ jsx59("span", { className: "block bg-popover shadow-md", children: below }) : null
20037
+ below ? /* @__PURE__ */ jsx60("span", { className: "block bg-popover shadow-md", children: below }) : null
19900
20038
  ] })
19901
20039
  ]
19902
20040
  }
@@ -19945,7 +20083,7 @@ function rememberLayout(tableId, layout) {
19945
20083
  import { useSyncExternalStore as useSyncExternalStore3 } from "react";
19946
20084
  import { cn as cn36, Skeleton as Skeleton6 } from "@ai-matrx/design-system";
19947
20085
  import { MatrxDataTable } from "@ai-matrx/design-system/data-table";
19948
- import { Fragment as Fragment21, jsx as jsx60, jsxs as jsxs54 } from "react/jsx-runtime";
20086
+ import { Fragment as Fragment22, jsx as jsx61, jsxs as jsxs55 } from "react/jsx-runtime";
19949
20087
  var NEVER = () => () => {
19950
20088
  };
19951
20089
  function useRememberedPageRows(tableId) {
@@ -19988,7 +20126,7 @@ var PLACEHOLDER_COLUMNS = ["a", "b", "c", "d", "e", "f"].map((id) => ({
19988
20126
  }));
19989
20127
  var NO_ROWS2 = [];
19990
20128
  function GridSkeleton({ embedded, rows }) {
19991
- return /* @__PURE__ */ jsx60(
20129
+ return /* @__PURE__ */ jsx61(
19992
20130
  MatrxDataTable,
19993
20131
  {
19994
20132
  ...embedded ? {} : { className: "min-h-0 flex-1" },
@@ -20015,75 +20153,75 @@ function GridSkeleton({ embedded, rows }) {
20015
20153
  var CHART_PLOT_PX = 140;
20016
20154
  var RECORDS_GRID_ROW_PX = 35;
20017
20155
  function Cards({ count, className }) {
20018
- return /* @__PURE__ */ jsx60(Fragment21, { children: Array.from({ length: count }, (_, i) => /* @__PURE__ */ jsx60(Skeleton6, { shape: "block", className }, i)) });
20156
+ return /* @__PURE__ */ jsx61(Fragment22, { children: Array.from({ length: count }, (_, i) => /* @__PURE__ */ jsx61(Skeleton6, { shape: "block", className }, i)) });
20019
20157
  }
20020
20158
  function BodySkeleton({ layout, embedded, rows }) {
20021
20159
  const lineCount = rows === "fill" ? 12 : rows;
20022
20160
  switch (layout) {
20023
20161
  case "grid":
20024
20162
  case "home":
20025
- return /* @__PURE__ */ jsx60(GridSkeleton, { embedded, rows });
20163
+ return /* @__PURE__ */ jsx61(GridSkeleton, { embedded, rows });
20026
20164
  case "kanban":
20027
- return /* @__PURE__ */ jsx60("div", { className: "flex min-h-0 flex-1 gap-2 overflow-hidden pb-2", "data-records-skeleton-part": "body", children: Array.from({ length: 4 }, (_, c) => /* @__PURE__ */ jsxs54("div", { className: "flex w-64 shrink-0 flex-col gap-2 rounded-lg bg-muted/40 p-2", children: [
20028
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "line", width: "1/2", className: "my-1.5" }),
20029
- /* @__PURE__ */ jsx60(Cards, { count: 3 - c % 2, className: "h-24" })
20165
+ return /* @__PURE__ */ jsx61("div", { className: "flex min-h-0 flex-1 gap-2 overflow-hidden pb-2", "data-records-skeleton-part": "body", children: Array.from({ length: 4 }, (_, c) => /* @__PURE__ */ jsxs55("div", { className: "flex w-64 shrink-0 flex-col gap-2 rounded-lg bg-muted/40 p-2", children: [
20166
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "line", width: "1/2", className: "my-1.5" }),
20167
+ /* @__PURE__ */ jsx61(Cards, { count: 3 - c % 2, className: "h-24" })
20030
20168
  ] }, c)) });
20031
20169
  case "gallery":
20032
- return /* @__PURE__ */ jsx60(
20170
+ return /* @__PURE__ */ jsx61(
20033
20171
  "div",
20034
20172
  {
20035
20173
  className: "grid min-h-0 flex-1 auto-rows-min grid-cols-[repeat(auto-fill,minmax(14rem,1fr))] gap-3 overflow-hidden",
20036
20174
  "data-records-skeleton-part": "body",
20037
- children: /* @__PURE__ */ jsx60(Cards, { count: 8, className: "h-48" })
20175
+ children: /* @__PURE__ */ jsx61(Cards, { count: 8, className: "h-48" })
20038
20176
  }
20039
20177
  );
20040
20178
  case "list":
20041
- return /* @__PURE__ */ jsx60("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden", "data-records-skeleton-part": "body", children: Array.from({ length: lineCount }, (_, i) => /* @__PURE__ */ jsxs54("div", { className: "flex h-9 items-center gap-3 border-b border-border/60 px-2", children: [
20042
- /* @__PURE__ */ jsx60(Skeleton6, { className: "size-4" }),
20043
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "line", width: i % 3 === 0 ? "1/2" : i % 3 === 1 ? "2/3" : "1/3" })
20179
+ return /* @__PURE__ */ jsx61("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden", "data-records-skeleton-part": "body", children: Array.from({ length: lineCount }, (_, i) => /* @__PURE__ */ jsxs55("div", { className: "flex h-9 items-center gap-3 border-b border-border/60 px-2", children: [
20180
+ /* @__PURE__ */ jsx61(Skeleton6, { className: "size-4" }),
20181
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "line", width: i % 3 === 0 ? "1/2" : i % 3 === 1 ? "2/3" : "1/3" })
20044
20182
  ] }, i)) });
20045
20183
  case "calendar":
20046
- return /* @__PURE__ */ jsxs54("div", { className: "flex min-h-0 flex-1 flex-col gap-2 overflow-hidden", "data-records-skeleton-part": "body", children: [
20047
- /* @__PURE__ */ jsx60("div", { className: "grid grid-cols-7 gap-px", children: Array.from({ length: 7 }, (_, i) => /* @__PURE__ */ jsx60(Skeleton6, { shape: "line", width: "1/3", className: "mx-auto my-1" }, i)) }),
20048
- /* @__PURE__ */ jsx60("div", { className: "grid flex-1 grid-cols-7 grid-rows-5 gap-px overflow-hidden rounded-md border border-border bg-border", children: Array.from({ length: 35 }, (_, i) => /* @__PURE__ */ jsx60("div", { className: "bg-card p-1.5", children: /* @__PURE__ */ jsx60(Skeleton6, { shape: "line", width: "1/3" }) }, i)) })
20184
+ return /* @__PURE__ */ jsxs55("div", { className: "flex min-h-0 flex-1 flex-col gap-2 overflow-hidden", "data-records-skeleton-part": "body", children: [
20185
+ /* @__PURE__ */ jsx61("div", { className: "grid grid-cols-7 gap-px", children: Array.from({ length: 7 }, (_, i) => /* @__PURE__ */ jsx61(Skeleton6, { shape: "line", width: "1/3", className: "mx-auto my-1" }, i)) }),
20186
+ /* @__PURE__ */ jsx61("div", { className: "grid flex-1 grid-cols-7 grid-rows-5 gap-px overflow-hidden rounded-md border border-border bg-border", children: Array.from({ length: 35 }, (_, i) => /* @__PURE__ */ jsx61("div", { className: "bg-card p-1.5", children: /* @__PURE__ */ jsx61(Skeleton6, { shape: "line", width: "1/3" }) }, i)) })
20049
20187
  ] });
20050
20188
  case "timeline":
20051
- return /* @__PURE__ */ jsxs54("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden rounded-md border border-border", "data-records-skeleton-part": "body", children: [
20052
- /* @__PURE__ */ jsx60("div", { className: "flex h-9 items-center gap-6 border-b border-border px-3", children: Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ jsx60(Skeleton6, { shape: "line", width: "sm", className: "w-16" }, i)) }),
20053
- Array.from({ length: Math.min(lineCount, 8) }, (_, i) => /* @__PURE__ */ jsx60("div", { className: "flex h-10 items-center border-b border-border/60 px-3", children: /* @__PURE__ */ jsx60(Skeleton6, { className: "h-6 rounded-md", style: { marginLeft: `${i * 13 % 45}%`, width: `${20 + i * 7 % 25}%` } }) }, i))
20189
+ return /* @__PURE__ */ jsxs55("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden rounded-md border border-border", "data-records-skeleton-part": "body", children: [
20190
+ /* @__PURE__ */ jsx61("div", { className: "flex h-9 items-center gap-6 border-b border-border px-3", children: Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ jsx61(Skeleton6, { shape: "line", width: "sm", className: "w-16" }, i)) }),
20191
+ Array.from({ length: Math.min(lineCount, 8) }, (_, i) => /* @__PURE__ */ jsx61("div", { className: "flex h-10 items-center border-b border-border/60 px-3", children: /* @__PURE__ */ jsx61(Skeleton6, { className: "h-6 rounded-md", style: { marginLeft: `${i * 13 % 45}%`, width: `${20 + i * 7 % 25}%` } }) }, i))
20054
20192
  ] });
20055
20193
  case "record":
20056
- return /* @__PURE__ */ jsxs54("div", { className: "flex min-h-0 flex-1 flex-col gap-2 overflow-hidden", "data-records-skeleton-part": "body", children: [
20057
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "title", width: "1/2", className: "h-8", "data-records-skeleton-part": "title" }),
20058
- /* @__PURE__ */ jsxs54("div", { className: "flex h-[38px] items-center gap-2", "data-records-skeleton-part": "actions", children: [
20059
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "control", width: "sm", className: "h-8" }),
20060
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "control", width: "sm", className: "h-8" })
20194
+ return /* @__PURE__ */ jsxs55("div", { className: "flex min-h-0 flex-1 flex-col gap-2 overflow-hidden", "data-records-skeleton-part": "body", children: [
20195
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "title", width: "1/2", className: "h-8", "data-records-skeleton-part": "title" }),
20196
+ /* @__PURE__ */ jsxs55("div", { className: "flex h-[38px] items-center gap-2", "data-records-skeleton-part": "actions", children: [
20197
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "control", width: "sm", className: "h-8" }),
20198
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "control", width: "sm", className: "h-8" })
20061
20199
  ] }),
20062
- /* @__PURE__ */ jsx60("div", { className: "h-px w-full shrink-0 bg-border" }),
20063
- /* @__PURE__ */ jsx60("div", { className: "grid grid-cols-[minmax(6rem,12rem)_1fr] gap-x-3 gap-y-0.5", "data-records-skeleton-part": "fields", children: Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ jsxs54("div", { className: "contents", children: [
20064
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "line", width: "2/3", className: "my-[7px]" }),
20065
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "row", className: "h-7" })
20200
+ /* @__PURE__ */ jsx61("div", { className: "h-px w-full shrink-0 bg-border" }),
20201
+ /* @__PURE__ */ jsx61("div", { className: "grid grid-cols-[minmax(6rem,12rem)_1fr] gap-x-3 gap-y-0.5", "data-records-skeleton-part": "fields", children: Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ jsxs55("div", { className: "contents", children: [
20202
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "line", width: "2/3", className: "my-[7px]" }),
20203
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "row", className: "h-7" })
20066
20204
  ] }, i)) }),
20067
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "block", height: "lg" })
20205
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "block", height: "lg" })
20068
20206
  ] });
20069
20207
  case "form":
20070
- return /* @__PURE__ */ jsxs54("div", { className: "flex min-h-0 flex-1 flex-col gap-4 overflow-hidden", "data-records-skeleton-part": "body", children: [
20071
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "title", width: "1/2" }),
20072
- /* @__PURE__ */ jsx60("div", { className: "grid grid-cols-[minmax(6rem,12rem)_1fr] gap-x-3 gap-y-1.5", children: Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ jsxs54("div", { className: "contents", children: [
20073
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "line", width: "2/3", className: "my-1.5" }),
20074
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "row", className: "h-7" })
20208
+ return /* @__PURE__ */ jsxs55("div", { className: "flex min-h-0 flex-1 flex-col gap-4 overflow-hidden", "data-records-skeleton-part": "body", children: [
20209
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "title", width: "1/2" }),
20210
+ /* @__PURE__ */ jsx61("div", { className: "grid grid-cols-[minmax(6rem,12rem)_1fr] gap-x-3 gap-y-1.5", children: Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ jsxs55("div", { className: "contents", children: [
20211
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "line", width: "2/3", className: "my-1.5" }),
20212
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "row", className: "h-7" })
20075
20213
  ] }, i)) }),
20076
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "control", width: "sm" })
20214
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "control", width: "sm" })
20077
20215
  ] });
20078
20216
  case "chart":
20079
- return /* @__PURE__ */ jsxs54("div", { className: "flex flex-col gap-2", "data-records-skeleton-part": "body", children: [
20080
- embedded ? null : /* @__PURE__ */ jsx60(Skeleton6, { shape: "line", width: "1/3" }),
20081
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "block", style: { height: CHART_PLOT_PX } })
20217
+ return /* @__PURE__ */ jsxs55("div", { className: "flex flex-col gap-2", "data-records-skeleton-part": "body", children: [
20218
+ embedded ? null : /* @__PURE__ */ jsx61(Skeleton6, { shape: "line", width: "1/3" }),
20219
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "block", style: { height: CHART_PLOT_PX } })
20082
20220
  ] });
20083
20221
  }
20084
20222
  }
20085
20223
  function RecordsSkeleton({ layout = "grid", embedded = false, rows, className }) {
20086
- return /* @__PURE__ */ jsx60(
20224
+ return /* @__PURE__ */ jsx61(
20087
20225
  "div",
20088
20226
  {
20089
20227
  role: "status",
@@ -20091,7 +20229,7 @@ function RecordsSkeleton({ layout = "grid", embedded = false, rows, className })
20091
20229
  "aria-busy": "true",
20092
20230
  "data-records-skeleton": layout,
20093
20231
  className: cn36("flex min-h-0 flex-col", !embedded && "flex-1", className),
20094
- children: /* @__PURE__ */ jsx60(BodySkeleton, { layout, embedded, rows: rows ?? (embedded ? 5 : "fill") })
20232
+ children: /* @__PURE__ */ jsx61(BodySkeleton, { layout, embedded, rows: rows ?? (embedded ? 5 : "fill") })
20095
20233
  }
20096
20234
  );
20097
20235
  }
@@ -20106,17 +20244,17 @@ function TablePageSkeleton({
20106
20244
  const rememberedFace = useRememberedLayout(embedded || layoutAsked ? void 0 : tableId);
20107
20245
  const layout = layoutAsked ?? skeletonLayoutFor(rememberedFace);
20108
20246
  const painted = rows ?? (remembered === "fill" ? void 0 : remembered);
20109
- return /* @__PURE__ */ jsx60("div", { className: cn36(TABLE_PAGE_FRAME_CLASS, className), "data-records-skeleton-page": layout, children: /* @__PURE__ */ jsxs54("div", { className: TABLE_PAGE_COLUMN_CLASS, children: [
20110
- /* @__PURE__ */ jsxs54("div", { className: TABLE_TOOLBAR_ROW_CLASS, "data-table-toolbar": "", "data-records-skeleton-part": "toolbar", "aria-hidden": "true", children: [
20111
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "control", width: "sm", className: "w-28" }),
20112
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "control", className: "w-16" }),
20113
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "control", className: "w-16" }),
20114
- /* @__PURE__ */ jsxs54("div", { className: "ml-auto flex items-center gap-1.5", children: [
20115
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "control", width: "md" }),
20116
- /* @__PURE__ */ jsx60(Skeleton6, { shape: "control", className: "w-24" })
20247
+ return /* @__PURE__ */ jsx61("div", { className: cn36(TABLE_PAGE_FRAME_CLASS, className), "data-records-skeleton-page": layout, children: /* @__PURE__ */ jsxs55("div", { className: TABLE_PAGE_COLUMN_CLASS, children: [
20248
+ /* @__PURE__ */ jsxs55("div", { className: TABLE_TOOLBAR_ROW_CLASS, "data-table-toolbar": "", "data-records-skeleton-part": "toolbar", "aria-hidden": "true", children: [
20249
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "control", width: "sm", className: "w-28" }),
20250
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "control", className: "w-16" }),
20251
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "control", className: "w-16" }),
20252
+ /* @__PURE__ */ jsxs55("div", { className: "ml-auto flex items-center gap-1.5", children: [
20253
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "control", width: "md" }),
20254
+ /* @__PURE__ */ jsx61(Skeleton6, { shape: "control", className: "w-24" })
20117
20255
  ] })
20118
20256
  ] }),
20119
- /* @__PURE__ */ jsx60("div", { className: "flex min-h-0 flex-1 flex-col gap-2", "data-table-records": "", children: /* @__PURE__ */ jsx60(RecordsSkeleton, { layout, embedded, ...painted !== void 0 ? { rows: painted } : {} }) })
20257
+ /* @__PURE__ */ jsx61("div", { className: "flex min-h-0 flex-1 flex-col gap-2", "data-table-records": "", children: /* @__PURE__ */ jsx61(RecordsSkeleton, { layout, embedded, ...painted !== void 0 ? { rows: painted } : {} }) })
20120
20258
  ] }) });
20121
20259
  }
20122
20260
 
@@ -20194,7 +20332,7 @@ function useTableDecorations(tableId, revision) {
20194
20332
  import { stableFilterKey } from "@ai-matrx/records";
20195
20333
  import { Button as Button31 } from "@ai-matrx/design-system";
20196
20334
  import { formatCount as formatCount2 } from "@ai-matrx/kit/format";
20197
- import { jsx as jsx61, jsxs as jsxs55 } from "react/jsx-runtime";
20335
+ import { jsx as jsx62, jsxs as jsxs56 } from "react/jsx-runtime";
20198
20336
  function lockedRowsWords(count) {
20199
20337
  return `${formatCount2(count)} ${count === 1 ? "record" : "records"} you can't open`;
20200
20338
  }
@@ -20227,7 +20365,7 @@ function emptyWords(args) {
20227
20365
  cause,
20228
20366
  title: typed2 !== "" ? `No matches for \u201C${typed2}\u201D` : NO_ROWS_MATCH,
20229
20367
  ...args.onClear ? {
20230
- action: /* @__PURE__ */ jsx61(Button31, { type: "button", variant: "outline", size: "sm", "data-records-clear-filters": "", onClick: args.onClear, children: searchOnly ? "Clear search" : "Clear filters" })
20368
+ action: /* @__PURE__ */ jsx62(Button31, { type: "button", variant: "outline", size: "sm", "data-records-clear-filters": "", onClick: args.onClear, children: searchOnly ? "Clear search" : "Clear filters" })
20231
20369
  } : {}
20232
20370
  };
20233
20371
  }
@@ -20239,15 +20377,15 @@ function emptyWords(args) {
20239
20377
  };
20240
20378
  }
20241
20379
  function EmptyRecords({ words: words2 }) {
20242
- return /* @__PURE__ */ jsxs55(
20380
+ return /* @__PURE__ */ jsxs56(
20243
20381
  "div",
20244
20382
  {
20245
20383
  className: "flex flex-col items-center gap-1.5 rounded border border-dashed p-6 text-center",
20246
20384
  "data-records-empty": words2.cause,
20247
20385
  role: "status",
20248
20386
  children: [
20249
- /* @__PURE__ */ jsx61("p", { className: "text-sm font-medium", children: words2.title }),
20250
- words2.description ? /* @__PURE__ */ jsx61("p", { className: "text-xs text-muted-foreground", children: words2.description }) : null,
20387
+ /* @__PURE__ */ jsx62("p", { className: "text-sm font-medium", children: words2.title }),
20388
+ words2.description ? /* @__PURE__ */ jsx62("p", { className: "text-xs text-muted-foreground", children: words2.description }) : null,
20251
20389
  words2.action ?? null
20252
20390
  ]
20253
20391
  }
@@ -20332,7 +20470,7 @@ import {
20332
20470
  DialogHeader as DialogHeader4,
20333
20471
  DialogTitle as DialogTitle4
20334
20472
  } from "@ai-matrx/design-system";
20335
- import { jsx as jsx62, jsxs as jsxs56 } from "react/jsx-runtime";
20473
+ import { jsx as jsx63, jsxs as jsxs57 } from "react/jsx-runtime";
20336
20474
  function mergeConsequence(other, survivor) {
20337
20475
  return `\u201C${other}\u201D goes into \u201C${survivor}\u201D: its links move here and its other values are kept as alternates. Undo puts it back.`;
20338
20476
  }
@@ -20391,16 +20529,16 @@ function MergeRecordDialog({ tableId, record, open, onOpenChange, onMerged }) {
20391
20529
  }
20392
20530
  });
20393
20531
  };
20394
- return /* @__PURE__ */ jsx62(Dialog4, { open, onOpenChange: close, children: /* @__PURE__ */ jsxs56(DialogContent4, { className: "sm:max-w-md", "data-records-merge": record.id, children: [
20395
- /* @__PURE__ */ jsxs56(DialogHeader4, { children: [
20396
- /* @__PURE__ */ jsxs56(DialogTitle4, { children: [
20532
+ return /* @__PURE__ */ jsx63(Dialog4, { open, onOpenChange: close, children: /* @__PURE__ */ jsxs57(DialogContent4, { className: "sm:max-w-md", "data-records-merge": record.id, children: [
20533
+ /* @__PURE__ */ jsxs57(DialogHeader4, { children: [
20534
+ /* @__PURE__ */ jsxs57(DialogTitle4, { children: [
20397
20535
  "Merge into \u201C",
20398
20536
  record.name,
20399
20537
  "\u201D"
20400
20538
  ] }),
20401
- /* @__PURE__ */ jsx62(DialogDescription2, { children: other ? mergeConsequence(otherName, record.name) : "Pick the record to merge into this one." })
20539
+ /* @__PURE__ */ jsx63(DialogDescription2, { children: other ? mergeConsequence(otherName, record.name) : "Pick the record to merge into this one." })
20402
20540
  ] }),
20403
- /* @__PURE__ */ jsx62(
20541
+ /* @__PURE__ */ jsx63(
20404
20542
  CreatablePicker,
20405
20543
  {
20406
20544
  value: other,
@@ -20413,10 +20551,10 @@ function MergeRecordDialog({ tableId, record, open, onOpenChange, onMerged }) {
20413
20551
  ariaLabel: "Record to merge"
20414
20552
  }
20415
20553
  ),
20416
- refusal3 ? /* @__PURE__ */ jsx62(RefusalNotice, { error: refusal3 }) : null,
20417
- /* @__PURE__ */ jsxs56(DialogFooter, { children: [
20418
- /* @__PURE__ */ jsx62(Button32, { variant: "ghost", size: "sm", onClick: () => close(false), disabled: busy, children: "Cancel" }),
20419
- /* @__PURE__ */ jsx62(Button32, { size: "sm", onClick: () => void merge(), disabled: !other || busy, "data-records-merge-go": "", children: busy ? "Merging\u2026" : "Merge" })
20554
+ refusal3 ? /* @__PURE__ */ jsx63(RefusalNotice, { error: refusal3 }) : null,
20555
+ /* @__PURE__ */ jsxs57(DialogFooter, { children: [
20556
+ /* @__PURE__ */ jsx63(Button32, { variant: "ghost", size: "sm", onClick: () => close(false), disabled: busy, children: "Cancel" }),
20557
+ /* @__PURE__ */ jsx63(Button32, { size: "sm", onClick: () => void merge(), disabled: !other || busy, "data-records-merge-go": "", children: busy ? "Merging\u2026" : "Merge" })
20420
20558
  ] })
20421
20559
  ] }) });
20422
20560
  }
@@ -20507,7 +20645,7 @@ function recordActions(input) {
20507
20645
 
20508
20646
  // src/SplitRecordDialog.tsx
20509
20647
  init_recordVersions();
20510
- import { jsx as jsx63, jsxs as jsxs57 } from "react/jsx-runtime";
20648
+ import { jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
20511
20649
  function valueWords(value) {
20512
20650
  if (value === null || value === void 0) return "";
20513
20651
  const text = typeof value === "string" ? value : typeof value === "object" ? JSON.stringify(value) : String(value);
@@ -20610,21 +20748,21 @@ function SplitRecordDialog({ tableId, record, document: document2, open, onOpenC
20610
20748
  };
20611
20749
  const stays = filled.filter((f) => !moving.has(f.key));
20612
20750
  const moves = filled.filter((f) => moving.has(f.key));
20613
- return /* @__PURE__ */ jsx63(Dialog5, { open, onOpenChange: close, children: /* @__PURE__ */ jsxs57(DialogContent5, { className: "sm:max-w-lg", "data-records-split": record.id, children: [
20614
- /* @__PURE__ */ jsxs57(DialogHeader5, { children: [
20615
- /* @__PURE__ */ jsxs57(DialogTitle5, { children: [
20751
+ return /* @__PURE__ */ jsx64(Dialog5, { open, onOpenChange: close, children: /* @__PURE__ */ jsxs58(DialogContent5, { className: "sm:max-w-lg", "data-records-split": record.id, children: [
20752
+ /* @__PURE__ */ jsxs58(DialogHeader5, { children: [
20753
+ /* @__PURE__ */ jsxs58(DialogTitle5, { children: [
20616
20754
  "Split \u201C",
20617
20755
  record.name,
20618
20756
  "\u201D"
20619
20757
  ] }),
20620
- /* @__PURE__ */ jsx63(DialogDescription3, { children: "Move to the new record" })
20758
+ /* @__PURE__ */ jsx64(DialogDescription3, { children: "Move to the new record" })
20621
20759
  ] }),
20622
- /* @__PURE__ */ jsx63("div", { className: "min-h-32", children: fields.loading && !fields.data ? /* @__PURE__ */ jsxs57("div", { className: "flex flex-col gap-2", "data-records-split-loading": "", children: [
20623
- /* @__PURE__ */ jsx63(Skeleton7, { className: "h-6 w-full" }),
20624
- /* @__PURE__ */ jsx63(Skeleton7, { className: "h-6 w-full" }),
20625
- /* @__PURE__ */ jsx63(Skeleton7, { className: "h-6 w-full" })
20626
- ] }) : filled.length === 0 ? /* @__PURE__ */ jsx63("p", { className: "text-sm text-muted-foreground", "data-records-split-empty": "", children: "No values to move" }) : /* @__PURE__ */ jsx63("ul", { className: "flex max-h-56 flex-col gap-1 overflow-y-auto", "data-records-split-fields": "", children: filled.map((f) => /* @__PURE__ */ jsx63("li", { children: /* @__PURE__ */ jsxs57("label", { className: "flex min-w-0 items-center gap-2 text-sm", children: [
20627
- /* @__PURE__ */ jsx63(
20760
+ /* @__PURE__ */ jsx64("div", { className: "min-h-32", children: fields.loading && !fields.data ? /* @__PURE__ */ jsxs58("div", { className: "flex flex-col gap-2", "data-records-split-loading": "", children: [
20761
+ /* @__PURE__ */ jsx64(Skeleton7, { className: "h-6 w-full" }),
20762
+ /* @__PURE__ */ jsx64(Skeleton7, { className: "h-6 w-full" }),
20763
+ /* @__PURE__ */ jsx64(Skeleton7, { className: "h-6 w-full" })
20764
+ ] }) : filled.length === 0 ? /* @__PURE__ */ jsx64("p", { className: "text-sm text-muted-foreground", "data-records-split-empty": "", children: "No values to move" }) : /* @__PURE__ */ jsx64("ul", { className: "flex max-h-56 flex-col gap-1 overflow-y-auto", "data-records-split-fields": "", children: filled.map((f) => /* @__PURE__ */ jsx64("li", { children: /* @__PURE__ */ jsxs58("label", { className: "flex min-w-0 items-center gap-2 text-sm", children: [
20765
+ /* @__PURE__ */ jsx64(
20628
20766
  Checkbox9,
20629
20767
  {
20630
20768
  checked: moving.has(f.key),
@@ -20633,23 +20771,23 @@ function SplitRecordDialog({ tableId, record, document: document2, open, onOpenC
20633
20771
  "data-records-split-field": f.key
20634
20772
  }
20635
20773
  ),
20636
- /* @__PURE__ */ jsx63("span", { className: "shrink-0 font-medium", children: fieldName(f) }),
20637
- /* @__PURE__ */ jsx63("span", { className: "min-w-0 truncate text-muted-foreground", children: valueWords(doc[f.key]) })
20774
+ /* @__PURE__ */ jsx64("span", { className: "shrink-0 font-medium", children: fieldName(f) }),
20775
+ /* @__PURE__ */ jsx64("span", { className: "min-w-0 truncate text-muted-foreground", children: valueWords(doc[f.key]) })
20638
20776
  ] }) }, f.key)) }) }),
20639
- /* @__PURE__ */ jsxs57("div", { className: "grid grid-cols-2 gap-3 text-xs", "data-records-split-preview": "", children: [
20640
- /* @__PURE__ */ jsxs57("div", { children: [
20641
- /* @__PURE__ */ jsx63("div", { className: "mb-1 font-medium text-muted-foreground", children: "Stays" }),
20642
- /* @__PURE__ */ jsx63("ul", { "data-records-split-stays": "", children: stays.map((f) => /* @__PURE__ */ jsx63("li", { className: "truncate", children: fieldName(f) }, f.key)) })
20777
+ /* @__PURE__ */ jsxs58("div", { className: "grid grid-cols-2 gap-3 text-xs", "data-records-split-preview": "", children: [
20778
+ /* @__PURE__ */ jsxs58("div", { children: [
20779
+ /* @__PURE__ */ jsx64("div", { className: "mb-1 font-medium text-muted-foreground", children: "Stays" }),
20780
+ /* @__PURE__ */ jsx64("ul", { "data-records-split-stays": "", children: stays.map((f) => /* @__PURE__ */ jsx64("li", { className: "truncate", children: fieldName(f) }, f.key)) })
20643
20781
  ] }),
20644
- /* @__PURE__ */ jsxs57("div", { children: [
20645
- /* @__PURE__ */ jsx63("div", { className: "mb-1 font-medium text-muted-foreground", children: "Moves" }),
20646
- /* @__PURE__ */ jsx63("ul", { "data-records-split-moves": "", children: moves.map((f) => /* @__PURE__ */ jsx63("li", { className: "truncate", children: fieldName(f) }, f.key)) })
20782
+ /* @__PURE__ */ jsxs58("div", { children: [
20783
+ /* @__PURE__ */ jsx64("div", { className: "mb-1 font-medium text-muted-foreground", children: "Moves" }),
20784
+ /* @__PURE__ */ jsx64("ul", { "data-records-split-moves": "", children: moves.map((f) => /* @__PURE__ */ jsx64("li", { className: "truncate", children: fieldName(f) }, f.key)) })
20647
20785
  ] })
20648
20786
  ] }),
20649
- refusal3 ? /* @__PURE__ */ jsx63(RefusalNotice, { error: refusal3 }) : null,
20650
- /* @__PURE__ */ jsxs57(DialogFooter2, { children: [
20651
- /* @__PURE__ */ jsx63(Button33, { variant: "ghost", size: "sm", onClick: () => close(false), disabled: busy, children: "Cancel" }),
20652
- /* @__PURE__ */ jsx63(Button33, { size: "sm", onClick: () => void split(), disabled: moving.size === 0 || busy, "data-records-split-go": "", children: busy ? "Splitting\u2026" : "Split" })
20787
+ refusal3 ? /* @__PURE__ */ jsx64(RefusalNotice, { error: refusal3 }) : null,
20788
+ /* @__PURE__ */ jsxs58(DialogFooter2, { children: [
20789
+ /* @__PURE__ */ jsx64(Button33, { variant: "ghost", size: "sm", onClick: () => close(false), disabled: busy, children: "Cancel" }),
20790
+ /* @__PURE__ */ jsx64(Button33, { size: "sm", onClick: () => void split(), disabled: moving.size === 0 || busy, "data-records-split-go": "", children: busy ? "Splitting\u2026" : "Split" })
20653
20791
  ] })
20654
20792
  ] }) });
20655
20793
  }
@@ -20765,7 +20903,7 @@ function PersonNamesBridge() {
20765
20903
  // src/RecordsMount.tsx
20766
20904
  init_host();
20767
20905
  init_rights();
20768
- import { jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
20906
+ import { jsx as jsx65, jsxs as jsxs59 } from "react/jsx-runtime";
20769
20907
  var STORE_DECIDES_REASON = "This host offers exactly what the record store says this person may do: the level comes back with the table on the read door, so a control they cannot use is never drawn in the first place.";
20770
20908
  function storeDecidesRights(_table) {
20771
20909
  return NO_RIGHTS;
@@ -20778,8 +20916,8 @@ function RecordsMount({
20778
20916
  }) {
20779
20917
  const bound2 = useShallowStableHost(host);
20780
20918
  void letTheStoreDecideRights;
20781
- return /* @__PURE__ */ jsx64(RecordsProvider, { config, children: /* @__PURE__ */ jsx64(RecordsUiProvider, { value: bound2, children: /* @__PURE__ */ jsxs58(RecordLabelProvider, { children: [
20782
- /* @__PURE__ */ jsx64(PersonNamesBridge, {}),
20919
+ return /* @__PURE__ */ jsx65(RecordsProvider, { config, children: /* @__PURE__ */ jsx65(RecordsUiProvider, { value: bound2, children: /* @__PURE__ */ jsxs59(RecordLabelProvider, { children: [
20920
+ /* @__PURE__ */ jsx65(PersonNamesBridge, {}),
20783
20921
  children
20784
20922
  ] }) }) });
20785
20923
  }
@@ -20805,7 +20943,7 @@ init_tablePicking();
20805
20943
  init_Refusal();
20806
20944
  init_refusals();
20807
20945
  init_plainWords();
20808
- import { Fragment as Fragment22, jsx as jsx65, jsxs as jsxs59 } from "react/jsx-runtime";
20946
+ import { Fragment as Fragment23, jsx as jsx66, jsxs as jsxs60 } from "react/jsx-runtime";
20809
20947
  var SHARED_FOR_MS = 5e3;
20810
20948
  var sharedReads = /* @__PURE__ */ new WeakMap();
20811
20949
  function readTablesAnywhere(dataSource) {
@@ -20875,16 +21013,16 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
20875
21013
  hint: t.organization_name,
20876
21014
  keywords: t.organization_name,
20877
21015
  ...twin && second ? {
20878
- render: /* @__PURE__ */ jsxs59("span", { className: "flex min-w-0 flex-col", children: [
20879
- /* @__PURE__ */ jsx65("span", { className: "truncate", children: t.table_name }),
20880
- /* @__PURE__ */ jsx65("span", { className: "truncate text-[11px] text-muted-foreground", children: second })
21016
+ render: /* @__PURE__ */ jsxs60("span", { className: "flex min-w-0 flex-col", children: [
21017
+ /* @__PURE__ */ jsx66("span", { className: "truncate", children: t.table_name }),
21018
+ /* @__PURE__ */ jsx66("span", { className: "truncate text-[11px] text-muted-foreground", children: second })
20881
21019
  ] })
20882
21020
  } : {}
20883
21021
  };
20884
21022
  });
20885
21023
  const missing = Boolean(value) && !list.loading && !list.error && !list.rows.some((t) => t.table_id === value);
20886
- return /* @__PURE__ */ jsxs59("div", { className: "flex flex-col gap-1", children: [
20887
- /* @__PURE__ */ jsx65(
21024
+ return /* @__PURE__ */ jsxs60("div", { className: "flex flex-col gap-1", children: [
21025
+ /* @__PURE__ */ jsx66(
20888
21026
  CreatablePicker2,
20889
21027
  {
20890
21028
  value: value || null,
@@ -20898,17 +21036,17 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
20898
21036
  ariaLabel: "Table"
20899
21037
  }
20900
21038
  ),
20901
- list.error && /* @__PURE__ */ jsx65(RefusalLine, { error: (0, refusals_exports.refusal)("door", list.error, "Try again in a moment.") }),
20902
- missing && /* @__PURE__ */ jsx65("p", { className: "text-[11px] text-destructive", children: "This table is archived or not shared with you." })
21039
+ list.error && /* @__PURE__ */ jsx66(RefusalLine, { error: (0, refusals_exports.refusal)("door", list.error, "Try again in a moment.") }),
21040
+ missing && /* @__PURE__ */ jsx66("p", { className: "text-[11px] text-destructive", children: "This table is archived or not shared with you." })
20903
21041
  ] });
20904
21042
  }
20905
21043
  function TableScope({ dataSource, userId, tableId, children, fallback = null, unavailable, tables }) {
20906
21044
  const own3 = useTablesAnywhere(dataSource);
20907
21045
  const list = tables ?? own3;
20908
21046
  const organizationId = list.rows.find((t) => t.table_id === tableId)?.organization_id ?? null;
20909
- if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ jsx65(Fragment22, { children: unavailable ?? fallback });
20910
- if (!tableId || !organizationId) return /* @__PURE__ */ jsx65(Fragment22, { children: fallback });
20911
- return /* @__PURE__ */ jsx65(RecordsProvider2, { config: { dataSource, actor: personActor(userId), organizationId }, children });
21047
+ if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ jsx66(Fragment23, { children: unavailable ?? fallback });
21048
+ if (!tableId || !organizationId) return /* @__PURE__ */ jsx66(Fragment23, { children: fallback });
21049
+ return /* @__PURE__ */ jsx66(RecordsProvider2, { config: { dataSource, actor: personActor(userId), organizationId }, children });
20912
21050
  }
20913
21051
  function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
20914
21052
  const fields = useFields6(tableId);
@@ -20928,11 +21066,11 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
20928
21066
  void _gone;
20929
21067
  onChange(rest);
20930
21068
  };
20931
- return /* @__PURE__ */ jsxs59("div", { className: "flex flex-col gap-2", children: [
20932
- fields.error && /* @__PURE__ */ jsx65(RefusalLine, { error: fields.error }),
21069
+ return /* @__PURE__ */ jsxs60("div", { className: "flex flex-col gap-2", children: [
21070
+ fields.error && /* @__PURE__ */ jsx66(RefusalLine, { error: fields.error }),
20933
21071
  keys.map((key) => {
20934
21072
  const field2 = byKey.get(key);
20935
- return /* @__PURE__ */ jsx65(
21073
+ return /* @__PURE__ */ jsx66(
20936
21074
  ColumnValueRow,
20937
21075
  {
20938
21076
  columnKey: key,
@@ -20948,7 +21086,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
20948
21086
  key
20949
21087
  );
20950
21088
  }),
20951
- adding && /* @__PURE__ */ jsx65(
21089
+ adding && /* @__PURE__ */ jsx66(
20952
21090
  ColumnValueRow,
20953
21091
  {
20954
21092
  columnKey: null,
@@ -20965,7 +21103,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
20965
21103
  onRemove: () => setAdding(false)
20966
21104
  }
20967
21105
  ),
20968
- !disabled && !adding && keys.length < all.length && /* @__PURE__ */ jsx65(Button34, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
21106
+ !disabled && !adding && keys.length < all.length && /* @__PURE__ */ jsx66(Button34, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
20969
21107
  ] });
20970
21108
  }
20971
21109
  function ColumnValueRow({
@@ -20981,9 +21119,9 @@ function ColumnValueRow({
20981
21119
  }) {
20982
21120
  const orphan = columnKey !== null && !loading && field2 === void 0;
20983
21121
  const shown5 = orphan ? [{ value: columnKey, label: columnKey, hint: "Not a column" }, ...options] : options;
20984
- return /* @__PURE__ */ jsxs59("div", { className: "flex flex-col gap-1 rounded-md border border-border/60 p-2", children: [
20985
- /* @__PURE__ */ jsxs59("div", { className: "flex items-center gap-2", children: [
20986
- /* @__PURE__ */ jsx65("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx65(
21122
+ return /* @__PURE__ */ jsxs60("div", { className: "flex flex-col gap-1 rounded-md border border-border/60 p-2", children: [
21123
+ /* @__PURE__ */ jsxs60("div", { className: "flex items-center gap-2", children: [
21124
+ /* @__PURE__ */ jsx66("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx66(
20987
21125
  CreatablePicker2,
20988
21126
  {
20989
21127
  value: columnKey,
@@ -20997,9 +21135,9 @@ function ColumnValueRow({
20997
21135
  ariaLabel: "Column"
20998
21136
  }
20999
21137
  ) }),
21000
- !disabled && /* @__PURE__ */ jsx65(Button34, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
21138
+ !disabled && /* @__PURE__ */ jsx66(Button34, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
21001
21139
  ] }),
21002
- field2 ? /* @__PURE__ */ jsx65(FieldControl, { field: field2, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ jsx65("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
21140
+ field2 ? /* @__PURE__ */ jsx66(FieldControl, { field: field2, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ jsx66("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
21003
21141
  ] });
21004
21142
  }
21005
21143
  function RecordPicker({ tableId, value, onChange, disabled }) {
@@ -21011,8 +21149,8 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
21011
21149
  label: rowNameIn(table.data ?? null, row)
21012
21150
  }));
21013
21151
  const missing = Boolean(value) && !records.loading && !records.error && !rows.some((r) => r.id === value);
21014
- return /* @__PURE__ */ jsxs59("div", { className: "flex flex-col gap-1", children: [
21015
- /* @__PURE__ */ jsx65(
21152
+ return /* @__PURE__ */ jsxs60("div", { className: "flex flex-col gap-1", children: [
21153
+ /* @__PURE__ */ jsx66(
21016
21154
  CreatablePicker2,
21017
21155
  {
21018
21156
  value: value || null,
@@ -21026,12 +21164,12 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
21026
21164
  ariaLabel: "Record"
21027
21165
  }
21028
21166
  ),
21029
- records.error && /* @__PURE__ */ jsx65(RefusalLine, { error: records.error })
21167
+ records.error && /* @__PURE__ */ jsx66(RefusalLine, { error: records.error })
21030
21168
  ] });
21031
21169
  }
21032
21170
 
21033
21171
  // src/ExtractParentDialog.tsx
21034
- import { jsx as jsx66, jsxs as jsxs60 } from "react/jsx-runtime";
21172
+ import { jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
21035
21173
  function extractConsequence(record, parentTable) {
21036
21174
  return `\u201C${record}\u201D will sit under the new ${parentTable} record`;
21037
21175
  }
@@ -21152,21 +21290,21 @@ function ExtractParentDialog({ tableId, record, document: document2, open, onOpe
21152
21290
  }
21153
21291
  });
21154
21292
  };
21155
- return /* @__PURE__ */ jsx66(Dialog6, { open, onOpenChange: close, children: /* @__PURE__ */ jsxs60(DialogContent6, { className: "sm:max-w-md", "data-records-extract-parent": record.id, children: [
21156
- /* @__PURE__ */ jsxs60(DialogHeader6, { children: [
21157
- /* @__PURE__ */ jsxs60(DialogTitle6, { children: [
21293
+ return /* @__PURE__ */ jsx67(Dialog6, { open, onOpenChange: close, children: /* @__PURE__ */ jsxs61(DialogContent6, { className: "sm:max-w-md", "data-records-extract-parent": record.id, children: [
21294
+ /* @__PURE__ */ jsxs61(DialogHeader6, { children: [
21295
+ /* @__PURE__ */ jsxs61(DialogTitle6, { children: [
21158
21296
  "Extract parent of \u201C",
21159
21297
  record.name,
21160
21298
  "\u201D"
21161
21299
  ] }),
21162
- /* @__PURE__ */ jsx66(DialogDescription4, { children: parentId ? extractConsequence(record.name, parentName) : "Pick the parent table" })
21300
+ /* @__PURE__ */ jsx67(DialogDescription4, { children: parentId ? extractConsequence(record.name, parentName) : "Pick the parent table" })
21163
21301
  ] }),
21164
- /* @__PURE__ */ jsx66(TablePicker, { dataSource: client.config.dataSource, value: parentId, onChange: pick, tables: pickable, disabled: busy }),
21165
- /* @__PURE__ */ jsx66("div", { className: "min-h-24", "data-records-extract-values": "", children: !parentId ? null : loadingShared ? /* @__PURE__ */ jsxs60("div", { className: "flex flex-col gap-2", children: [
21166
- /* @__PURE__ */ jsx66(Skeleton8, { className: "h-6 w-full" }),
21167
- /* @__PURE__ */ jsx66(Skeleton8, { className: "h-6 w-full" })
21168
- ] }) : shared.length === 0 ? /* @__PURE__ */ jsx66("p", { className: "text-sm text-muted-foreground", "data-records-extract-none": "", children: "No matching values" }) : /* @__PURE__ */ jsx66("ul", { className: "flex max-h-48 flex-col gap-1 overflow-y-auto", children: shared.map((f) => /* @__PURE__ */ jsx66("li", { children: /* @__PURE__ */ jsxs60("label", { className: "flex min-w-0 items-center gap-2 text-sm", children: [
21169
- /* @__PURE__ */ jsx66(
21302
+ /* @__PURE__ */ jsx67(TablePicker, { dataSource: client.config.dataSource, value: parentId, onChange: pick, tables: pickable, disabled: busy }),
21303
+ /* @__PURE__ */ jsx67("div", { className: "min-h-24", "data-records-extract-values": "", children: !parentId ? null : loadingShared ? /* @__PURE__ */ jsxs61("div", { className: "flex flex-col gap-2", children: [
21304
+ /* @__PURE__ */ jsx67(Skeleton8, { className: "h-6 w-full" }),
21305
+ /* @__PURE__ */ jsx67(Skeleton8, { className: "h-6 w-full" })
21306
+ ] }) : shared.length === 0 ? /* @__PURE__ */ jsx67("p", { className: "text-sm text-muted-foreground", "data-records-extract-none": "", children: "No matching values" }) : /* @__PURE__ */ jsx67("ul", { className: "flex max-h-48 flex-col gap-1 overflow-y-auto", children: shared.map((f) => /* @__PURE__ */ jsx67("li", { children: /* @__PURE__ */ jsxs61("label", { className: "flex min-w-0 items-center gap-2 text-sm", children: [
21307
+ /* @__PURE__ */ jsx67(
21170
21308
  Checkbox10,
21171
21309
  {
21172
21310
  checked: copying.has(f.key),
@@ -21175,10 +21313,10 @@ function ExtractParentDialog({ tableId, record, document: document2, open, onOpe
21175
21313
  "data-records-extract-field": f.key
21176
21314
  }
21177
21315
  ),
21178
- /* @__PURE__ */ jsx66("span", { className: "shrink-0 font-medium", children: fieldName(f) }),
21179
- /* @__PURE__ */ jsx66("span", { className: "min-w-0 truncate text-muted-foreground", children: valueWords(doc[f.key]) })
21316
+ /* @__PURE__ */ jsx67("span", { className: "shrink-0 font-medium", children: fieldName(f) }),
21317
+ /* @__PURE__ */ jsx67("span", { className: "min-w-0 truncate text-muted-foreground", children: valueWords(doc[f.key]) })
21180
21318
  ] }) }, f.key)) }) }),
21181
- parentId ? /* @__PURE__ */ jsx66(
21319
+ parentId ? /* @__PURE__ */ jsx67(
21182
21320
  Input2,
21183
21321
  {
21184
21322
  value: parentNameTyped,
@@ -21189,10 +21327,10 @@ function ExtractParentDialog({ tableId, record, document: document2, open, onOpe
21189
21327
  "data-records-extract-name": ""
21190
21328
  }
21191
21329
  ) : null,
21192
- refusal3 ? /* @__PURE__ */ jsx66(RefusalNotice, { error: refusal3 }) : null,
21193
- /* @__PURE__ */ jsxs60(DialogFooter3, { children: [
21194
- /* @__PURE__ */ jsx66(Button35, { variant: "ghost", size: "sm", onClick: () => close(false), disabled: busy, children: "Cancel" }),
21195
- /* @__PURE__ */ jsx66(Button35, { size: "sm", onClick: () => void extract(), disabled: !parentId || loadingShared || busy || !hasChoice, "data-records-extract-go": "", children: busy ? "Extracting\u2026" : "Extract" })
21330
+ refusal3 ? /* @__PURE__ */ jsx67(RefusalNotice, { error: refusal3 }) : null,
21331
+ /* @__PURE__ */ jsxs61(DialogFooter3, { children: [
21332
+ /* @__PURE__ */ jsx67(Button35, { variant: "ghost", size: "sm", onClick: () => close(false), disabled: busy, children: "Cancel" }),
21333
+ /* @__PURE__ */ jsx67(Button35, { size: "sm", onClick: () => void extract(), disabled: !parentId || loadingShared || busy || !hasChoice, "data-records-extract-go": "", children: busy ? "Extracting\u2026" : "Extract" })
21196
21334
  ] })
21197
21335
  ] }) });
21198
21336
  }
@@ -21226,7 +21364,7 @@ import {
21226
21364
  STYLE_COLORS as STYLE_COLORS4,
21227
21365
  STYLE_COLOR_LABELS as STYLE_COLOR_LABELS3
21228
21366
  } from "@ai-matrx/design-system/data-table";
21229
- import { jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
21367
+ import { jsx as jsx68, jsxs as jsxs62 } from "react/jsx-runtime";
21230
21368
  function isChoiceField(field2) {
21231
21369
  const kind2 = String(editorKindFor(field2));
21232
21370
  return kind2 === "select" || kind2 === "multi_select";
@@ -21519,7 +21657,7 @@ function useGridColours(args) {
21519
21657
  },
21520
21658
  [enabled, decorations.data, refusal3, write]
21521
21659
  );
21522
- const dialogs = enabled ? /* @__PURE__ */ jsx67(
21660
+ const dialogs = enabled ? /* @__PURE__ */ jsx68(
21523
21661
  ColourRulesDialog,
21524
21662
  {
21525
21663
  open: rulesOpen !== null,
@@ -21546,12 +21684,12 @@ function useGridColours(args) {
21546
21684
  ) : null;
21547
21685
  const colourable = fields.filter(colourableBy);
21548
21686
  const byId = decorations.data?.color_by?.field ?? null;
21549
- const sheet = enabled ? /* @__PURE__ */ jsxs61("div", { className: "flex flex-col gap-1.5", "data-records-grid-sheet-colours": "", children: [
21550
- /* @__PURE__ */ jsx67("span", { className: "text-xs font-medium text-muted-foreground", children: "Colours" }),
21551
- mayColour ? /* @__PURE__ */ jsxs61("div", { className: "flex items-center gap-2", children: [
21552
- /* @__PURE__ */ jsxs61("label", { className: "flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground", children: [
21553
- /* @__PURE__ */ jsx67("span", { className: "shrink-0", children: "Colour rows by" }),
21554
- /* @__PURE__ */ jsx67(
21687
+ const sheet = enabled ? /* @__PURE__ */ jsxs62("div", { className: "flex flex-col gap-1.5", "data-records-grid-sheet-colours": "", children: [
21688
+ /* @__PURE__ */ jsx68("span", { className: "text-xs font-medium text-muted-foreground", children: "Colours" }),
21689
+ mayColour ? /* @__PURE__ */ jsxs62("div", { className: "flex items-center gap-2", children: [
21690
+ /* @__PURE__ */ jsxs62("label", { className: "flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground", children: [
21691
+ /* @__PURE__ */ jsx68("span", { className: "shrink-0", children: "Colour rows by" }),
21692
+ /* @__PURE__ */ jsx68(
21555
21693
  PickOne,
21556
21694
  {
21557
21695
  label: "Colour rows by",
@@ -21565,8 +21703,8 @@ function useGridColours(args) {
21565
21703
  }
21566
21704
  )
21567
21705
  ] }),
21568
- /* @__PURE__ */ jsx67(Button36, { type: "button", size: "sm", variant: "outline", className: "h-10 shrink-0", onClick: () => setRulesOpen(colourable[0]?.key ?? fields[0]?.key ?? ""), children: "Colour rules\u2026" })
21569
- ] }) : /* @__PURE__ */ jsx67("p", { className: "text-xs text-muted-foreground", children: whyNot })
21706
+ /* @__PURE__ */ jsx68(Button36, { type: "button", size: "sm", variant: "outline", className: "h-10 shrink-0", onClick: () => setRulesOpen(colourable[0]?.key ?? fields[0]?.key ?? ""), children: "Colour rules\u2026" })
21707
+ ] }) : /* @__PURE__ */ jsx68("p", { className: "text-xs text-muted-foreground", children: whyNot })
21570
21708
  ] }) : null;
21571
21709
  return { headerItem, cellItem, cellsItem, rowItem, dialogs, sheet };
21572
21710
  }
@@ -21614,15 +21752,15 @@ function ColourRulesDialog({
21614
21752
  onClose();
21615
21753
  };
21616
21754
  const first = startField ?? fields[0]?.key ?? "";
21617
- return /* @__PURE__ */ jsx67(Dialog7, { open, onOpenChange: (next) => !next ? close() : void 0, children: /* @__PURE__ */ jsxs61(DialogContent7, { className: "sm:max-w-2xl", "data-records-colour-rules": "", children: [
21618
- /* @__PURE__ */ jsxs61(DialogHeader7, { children: [
21619
- /* @__PURE__ */ jsx67(DialogTitle7, { children: "Colour rules" }),
21620
- /* @__PURE__ */ jsx67(DialogDescription5, { children: scope === "view" ? "The first rule a row matches wins. These rules belong to this view alone, and a date can be tested against today." : "The first rule a row matches wins. A rule tints the whole row, or only the cell it reads. Everyone who opens this table sees them." })
21755
+ return /* @__PURE__ */ jsx68(Dialog7, { open, onOpenChange: (next) => !next ? close() : void 0, children: /* @__PURE__ */ jsxs62(DialogContent7, { className: "sm:max-w-2xl", "data-records-colour-rules": "", children: [
21756
+ /* @__PURE__ */ jsxs62(DialogHeader7, { children: [
21757
+ /* @__PURE__ */ jsx68(DialogTitle7, { children: "Colour rules" }),
21758
+ /* @__PURE__ */ jsx68(DialogDescription5, { children: scope === "view" ? "The first rule a row matches wins. These rules belong to this view alone, and a date can be tested against today." : "The first rule a row matches wins. A rule tints the whole row, or only the cell it reads. Everyone who opens this table sees them." })
21621
21759
  ] }),
21622
- /* @__PURE__ */ jsxs61("div", { className: "flex flex-col gap-2", children: [
21623
- viewRules ? /* @__PURE__ */ jsxs61("div", { className: "flex items-center gap-1.5 text-xs", "data-records-colour-rules-scope": "", children: [
21624
- /* @__PURE__ */ jsx67("span", { className: "text-muted-foreground", children: "Keep them on" }),
21625
- /* @__PURE__ */ jsx67(
21760
+ /* @__PURE__ */ jsxs62("div", { className: "flex flex-col gap-2", children: [
21761
+ viewRules ? /* @__PURE__ */ jsxs62("div", { className: "flex items-center gap-1.5 text-xs", "data-records-colour-rules-scope": "", children: [
21762
+ /* @__PURE__ */ jsx68("span", { className: "text-muted-foreground", children: "Keep them on" }),
21763
+ /* @__PURE__ */ jsx68(
21626
21764
  PickOne,
21627
21765
  {
21628
21766
  label: "Where the rules are kept",
@@ -21639,10 +21777,10 @@ function ColourRulesDialog({
21639
21777
  }
21640
21778
  )
21641
21779
  ] }) : null,
21642
- rows.length === 0 ? /* @__PURE__ */ jsx67("p", { className: "text-xs text-muted-foreground", children: "No rules yet." }) : null,
21643
- rows.map((rule, i) => /* @__PURE__ */ jsxs61("div", { className: "flex flex-wrap items-center gap-1.5 text-xs", "data-records-colour-rule": "", children: [
21644
- /* @__PURE__ */ jsx67("span", { className: "text-muted-foreground", children: i === 0 ? "When" : "Else when" }),
21645
- /* @__PURE__ */ jsx67(
21780
+ rows.length === 0 ? /* @__PURE__ */ jsx68("p", { className: "text-xs text-muted-foreground", children: "No rules yet." }) : null,
21781
+ rows.map((rule, i) => /* @__PURE__ */ jsxs62("div", { className: "flex flex-wrap items-center gap-1.5 text-xs", "data-records-colour-rule": "", children: [
21782
+ /* @__PURE__ */ jsx68("span", { className: "text-muted-foreground", children: i === 0 ? "When" : "Else when" }),
21783
+ /* @__PURE__ */ jsx68(
21646
21784
  PickOne,
21647
21785
  {
21648
21786
  label: "Column",
@@ -21652,7 +21790,7 @@ function ColourRulesDialog({
21652
21790
  options: fields.map((f) => ({ value: f.key, label: fieldName(f) }))
21653
21791
  }
21654
21792
  ),
21655
- /* @__PURE__ */ jsx67(
21793
+ /* @__PURE__ */ jsx68(
21656
21794
  PickOne,
21657
21795
  {
21658
21796
  label: "Test",
@@ -21666,7 +21804,7 @@ function ColourRulesDialog({
21666
21804
  }))
21667
21805
  }
21668
21806
  ),
21669
- OPS_WITH_VALUE.includes(rule.op) && choicesOf(rule.field) ? /* @__PURE__ */ jsx67(
21807
+ OPS_WITH_VALUE.includes(rule.op) && choicesOf(rule.field) ? /* @__PURE__ */ jsx68(
21670
21808
  PickOne,
21671
21809
  {
21672
21810
  label: "Choice",
@@ -21677,7 +21815,7 @@ function ColourRulesDialog({
21677
21815
  onChange: (picked) => set(i, { value: picked }),
21678
21816
  options: choicesOf(rule.field).map((option) => ({ value: option.id, label: option.label }))
21679
21817
  }
21680
- ) : OPS_WITH_VALUE.includes(rule.op) ? /* @__PURE__ */ jsx67(
21818
+ ) : OPS_WITH_VALUE.includes(rule.op) ? /* @__PURE__ */ jsx68(
21681
21819
  "input",
21682
21820
  {
21683
21821
  "aria-label": "Value",
@@ -21687,8 +21825,8 @@ function ColourRulesDialog({
21687
21825
  onChange: (e) => set(i, { value: e.target.value })
21688
21826
  }
21689
21827
  ) : null,
21690
- /* @__PURE__ */ jsx67("span", { className: "text-muted-foreground", children: "tint" }),
21691
- /* @__PURE__ */ jsx67(
21828
+ /* @__PURE__ */ jsx68("span", { className: "text-muted-foreground", children: "tint" }),
21829
+ /* @__PURE__ */ jsx68(
21692
21830
  PickOne,
21693
21831
  {
21694
21832
  label: "Tint",
@@ -21701,7 +21839,7 @@ function ColourRulesDialog({
21701
21839
  ]
21702
21840
  }
21703
21841
  ),
21704
- /* @__PURE__ */ jsx67(
21842
+ /* @__PURE__ */ jsx68(
21705
21843
  PickOne,
21706
21844
  {
21707
21845
  label: "Colour",
@@ -21712,9 +21850,9 @@ function ColourRulesDialog({
21712
21850
  options: STYLE_COLORS4.map((c) => ({ value: c, label: STYLE_COLOR_LABELS3[c] }))
21713
21851
  }
21714
21852
  ),
21715
- /* @__PURE__ */ jsx67(Button36, { type: "button", size: "sm", variant: "ghost", onClick: () => setDrafts(rows.filter((_, j) => j !== i)), children: "Remove" })
21853
+ /* @__PURE__ */ jsx68(Button36, { type: "button", size: "sm", variant: "ghost", onClick: () => setDrafts(rows.filter((_, j) => j !== i)), children: "Remove" })
21716
21854
  ] }, rule.id ?? `new-${i}`)),
21717
- /* @__PURE__ */ jsx67("div", { children: /* @__PURE__ */ jsx67(
21855
+ /* @__PURE__ */ jsx68("div", { children: /* @__PURE__ */ jsx68(
21718
21856
  Button36,
21719
21857
  {
21720
21858
  type: "button",
@@ -21726,9 +21864,9 @@ function ColourRulesDialog({
21726
21864
  }
21727
21865
  ) })
21728
21866
  ] }),
21729
- /* @__PURE__ */ jsxs61(DialogFooter4, { children: [
21730
- /* @__PURE__ */ jsx67(Button36, { type: "button", size: "sm", variant: "ghost", onClick: close, children: "Cancel" }),
21731
- /* @__PURE__ */ jsx67(
21867
+ /* @__PURE__ */ jsxs62(DialogFooter4, { children: [
21868
+ /* @__PURE__ */ jsx68(Button36, { type: "button", size: "sm", variant: "ghost", onClick: close, children: "Cancel" }),
21869
+ /* @__PURE__ */ jsx68(
21732
21870
  Button36,
21733
21871
  {
21734
21872
  type: "button",
@@ -21766,7 +21904,7 @@ init_recordVersions();
21766
21904
  init_writeOnTheWinningVersion();
21767
21905
  init_plainWords();
21768
21906
  init_PickOne();
21769
- import { jsx as jsx68, jsxs as jsxs62 } from "react/jsx-runtime";
21907
+ import { jsx as jsx69, jsxs as jsxs63 } from "react/jsx-runtime";
21770
21908
  function labelColumns(fields) {
21771
21909
  return [...fields].filter((f) => rowLabelRefusal(f) === void 0).sort(compareFieldOrder);
21772
21910
  }
@@ -21857,14 +21995,14 @@ function RowLabelPicker({
21857
21995
  onOpenChange(false);
21858
21996
  onSaved();
21859
21997
  };
21860
- return /* @__PURE__ */ jsx68(Dialog8, { open, onOpenChange, children: /* @__PURE__ */ jsxs62(DialogContent8, { className: "sm:max-w-lg", "data-records-row-label-picker": "", children: [
21861
- /* @__PURE__ */ jsxs62(DialogHeader8, { children: [
21862
- /* @__PURE__ */ jsx68(DialogTitle8, { children: "What names each record" }),
21863
- /* @__PURE__ */ jsx68(DialogDescription6, { children: "The name every link, peek, copy, reference and agent calls a record by." })
21998
+ return /* @__PURE__ */ jsx69(Dialog8, { open, onOpenChange, children: /* @__PURE__ */ jsxs63(DialogContent8, { className: "sm:max-w-lg", "data-records-row-label-picker": "", children: [
21999
+ /* @__PURE__ */ jsxs63(DialogHeader8, { children: [
22000
+ /* @__PURE__ */ jsx69(DialogTitle8, { children: "What names each record" }),
22001
+ /* @__PURE__ */ jsx69(DialogDescription6, { children: "The name every link, peek, copy, reference and agent calls a record by." })
21864
22002
  ] }),
21865
- /* @__PURE__ */ jsxs62("div", { className: "flex items-center gap-1", role: "group", "aria-label": "How records are named", children: [
21866
- /* @__PURE__ */ jsx68(Button37, { type: "button", size: "sm", variant: mode === "column" ? "secondary" : "ghost", "aria-pressed": mode === "column", onClick: () => setMode("column"), children: "One column" }),
21867
- /* @__PURE__ */ jsx68(
22003
+ /* @__PURE__ */ jsxs63("div", { className: "flex items-center gap-1", role: "group", "aria-label": "How records are named", children: [
22004
+ /* @__PURE__ */ jsx69(Button37, { type: "button", size: "sm", variant: mode === "column" ? "secondary" : "ghost", "aria-pressed": mode === "column", onClick: () => setMode("column"), children: "One column" }),
22005
+ /* @__PURE__ */ jsx69(
21868
22006
  Button37,
21869
22007
  {
21870
22008
  type: "button",
@@ -21877,9 +22015,9 @@ function RowLabelPicker({
21877
22015
  }
21878
22016
  )
21879
22017
  ] }),
21880
- mode === "column" ? /* @__PURE__ */ jsxs62("label", { className: "flex flex-col gap-1 text-xs", children: [
22018
+ mode === "column" ? /* @__PURE__ */ jsxs63("label", { className: "flex flex-col gap-1 text-xs", children: [
21881
22019
  "Column",
21882
- /* @__PURE__ */ jsx68(
22020
+ /* @__PURE__ */ jsx69(
21883
22021
  PickOne,
21884
22022
  {
21885
22023
  label: "Column",
@@ -21890,9 +22028,9 @@ function RowLabelPicker({
21890
22028
  options: columns.map((f) => ({ value: f.key, label: `${fieldName(f)}${f.key === current && !keptFormula ? " (now)" : ""}` }))
21891
22029
  }
21892
22030
  ),
21893
- keptFormula ? /* @__PURE__ */ jsx68("span", { className: "text-[11px] text-muted-foreground", children: "Replaces the formula that names records now" }) : null
21894
- ] }) : /* @__PURE__ */ jsxs62("div", { className: "flex flex-col gap-1 text-xs", "data-records-row-label-formula": "", children: [
21895
- /* @__PURE__ */ jsx68(
22031
+ keptFormula ? /* @__PURE__ */ jsx69("span", { className: "text-[11px] text-muted-foreground", children: "Replaces the formula that names records now" }) : null
22032
+ ] }) : /* @__PURE__ */ jsxs63("div", { className: "flex flex-col gap-1 text-xs", "data-records-row-label-formula": "", children: [
22033
+ /* @__PURE__ */ jsx69(
21896
22034
  FormulaTextEditor,
21897
22035
  {
21898
22036
  tableId,
@@ -21906,22 +22044,22 @@ function RowLabelPicker({
21906
22044
  kept && kept.formula && !kept.valid ? (
21907
22045
  // HONEST ABOUT A STALE FORMULA: a column it read was renamed or retired, so records are
21908
22046
  // named by the column until it is fixed.
21909
- /* @__PURE__ */ jsxs62("p", { "data-records-row-label-stale": "", role: "status", className: "text-[11px] text-foreground", children: [
22047
+ /* @__PURE__ */ jsxs63("p", { "data-records-row-label-stale": "", role: "status", className: "text-[11px] text-foreground", children: [
21910
22048
  kept.error ?? "This formula no longer reads.",
21911
22049
  " Records are named by their column until it is fixed."
21912
22050
  ] })
21913
22051
  ) : null,
21914
- formulaTooLong ? /* @__PURE__ */ jsxs62("p", { className: "text-[11px] text-foreground", children: [
22052
+ formulaTooLong ? /* @__PURE__ */ jsxs63("p", { className: "text-[11px] text-foreground", children: [
21915
22053
  "Up to ",
21916
22054
  ROW_LABEL_FORMULA_MAX_LENGTH,
21917
22055
  " characters"
21918
22056
  ] }) : null
21919
22057
  ] }),
21920
- kept && !mayChange ? /* @__PURE__ */ jsx68("p", { "data-records-row-label-not-yours": "", className: "text-xs text-muted-foreground", children: ROW_LABEL_NOT_YOURS }) : null,
21921
- refused ? /* @__PURE__ */ jsx68("p", { "data-records-row-label-refused": "", className: "text-xs text-destructive", children: refused }) : null,
21922
- /* @__PURE__ */ jsxs62(DialogFooter5, { children: [
21923
- /* @__PURE__ */ jsx68(Button37, { type: "button", size: "sm", variant: "ghost", onClick: () => onOpenChange(false), children: "Cancel" }),
21924
- mode === "column" ? /* @__PURE__ */ jsx68(
22058
+ kept && !mayChange ? /* @__PURE__ */ jsx69("p", { "data-records-row-label-not-yours": "", className: "text-xs text-muted-foreground", children: ROW_LABEL_NOT_YOURS }) : null,
22059
+ refused ? /* @__PURE__ */ jsx69("p", { "data-records-row-label-refused": "", className: "text-xs text-destructive", children: refused }) : null,
22060
+ /* @__PURE__ */ jsxs63(DialogFooter5, { children: [
22061
+ /* @__PURE__ */ jsx69(Button37, { type: "button", size: "sm", variant: "ghost", onClick: () => onOpenChange(false), children: "Cancel" }),
22062
+ mode === "column" ? /* @__PURE__ */ jsx69(
21925
22063
  Button37,
21926
22064
  {
21927
22065
  type: "button",
@@ -21931,7 +22069,7 @@ function RowLabelPicker({
21931
22069
  onClick: () => void saveColumn(),
21932
22070
  children: busy ? "Saving\u2026" : "Use this column"
21933
22071
  }
21934
- ) : /* @__PURE__ */ jsx68(
22072
+ ) : /* @__PURE__ */ jsx69(
21935
22073
  Button37,
21936
22074
  {
21937
22075
  type: "button",
@@ -21975,7 +22113,7 @@ init_names();
21975
22113
  import { useEffect as useEffect42, useState as useState55 } from "react";
21976
22114
  import { useRecordsClient as useRecordsClient29 } from "@ai-matrx/records/react";
21977
22115
  import { cn as cn37 } from "@ai-matrx/design-system";
21978
- import { jsx as jsx69, jsxs as jsxs63 } from "react/jsx-runtime";
22116
+ import { jsx as jsx70, jsxs as jsxs64 } from "react/jsx-runtime";
21979
22117
  function isComputed(field2) {
21980
22118
  const kind2 = String(field2.type);
21981
22119
  return kind2 === "formula" || kind2 === "lookup" || kind2 === "rollup" || field2.source === "formula";
@@ -22059,8 +22197,8 @@ function ActionRowPreview({
22059
22197
  if (cell2.computed && cell2.how === null) return { text: words(cell2.before) || "empty", note: false };
22060
22198
  return { text: words(cell2.after) || "empty", note: false };
22061
22199
  };
22062
- return /* @__PURE__ */ jsxs63("div", { className: "flex flex-col gap-1", "data-records-action-row-preview": "", children: [
22063
- /* @__PURE__ */ jsx69("div", { className: "max-w-full overflow-x-auto rounded border", children: /* @__PURE__ */ jsxs63(
22200
+ return /* @__PURE__ */ jsxs64("div", { className: "flex flex-col gap-1", "data-records-action-row-preview": "", children: [
22201
+ /* @__PURE__ */ jsx70("div", { className: "max-w-full overflow-x-auto rounded border", children: /* @__PURE__ */ jsxs64(
22064
22202
  "div",
22065
22203
  {
22066
22204
  role: "table",
@@ -22068,9 +22206,9 @@ function ActionRowPreview({
22068
22206
  className: "grid w-max min-w-full text-xs",
22069
22207
  style: { gridTemplateColumns: `4rem repeat(${preview.cells.length}, minmax(7rem, 12rem))` },
22070
22208
  children: [
22071
- /* @__PURE__ */ jsxs63("div", { role: "row", className: "contents", children: [
22072
- /* @__PURE__ */ jsx69("span", { role: "columnheader", className: "sticky left-0 bg-muted/60 px-2 py-1" }),
22073
- preview.cells.map((cell2) => /* @__PURE__ */ jsx69(
22209
+ /* @__PURE__ */ jsxs64("div", { role: "row", className: "contents", children: [
22210
+ /* @__PURE__ */ jsx70("span", { role: "columnheader", className: "sticky left-0 bg-muted/60 px-2 py-1" }),
22211
+ preview.cells.map((cell2) => /* @__PURE__ */ jsx70(
22074
22212
  "span",
22075
22213
  {
22076
22214
  role: "columnheader",
@@ -22081,11 +22219,11 @@ function ActionRowPreview({
22081
22219
  cell2.key
22082
22220
  ))
22083
22221
  ] }),
22084
- ["before", "after"].map((which) => /* @__PURE__ */ jsxs63("div", { role: "row", className: "contents", "data-preview-row": which, children: [
22085
- /* @__PURE__ */ jsx69("span", { role: "rowheader", className: "sticky left-0 border-t bg-background px-2 py-1 font-medium text-muted-foreground", children: which === "before" ? "Now" : "After" }),
22222
+ ["before", "after"].map((which) => /* @__PURE__ */ jsxs64("div", { role: "row", className: "contents", "data-preview-row": which, children: [
22223
+ /* @__PURE__ */ jsx70("span", { role: "rowheader", className: "sticky left-0 border-t bg-background px-2 py-1 font-medium text-muted-foreground", children: which === "before" ? "Now" : "After" }),
22086
22224
  preview.cells.map((cell2) => {
22087
22225
  const shown5 = which === "before" ? { text: words(cell2.before) || "empty", note: false } : afterWords(cell2);
22088
- return /* @__PURE__ */ jsx69(
22226
+ return /* @__PURE__ */ jsx70(
22089
22227
  "span",
22090
22228
  {
22091
22229
  role: "cell",
@@ -22108,7 +22246,7 @@ function ActionRowPreview({
22108
22246
  ]
22109
22247
  }
22110
22248
  ) }),
22111
- /* @__PURE__ */ jsx69("p", { className: "text-[11px] text-muted-foreground", "data-records-action-preview-count": "", children: preview.changedCount === 0 ? "Nothing on this record would change: every value is already what the action sets." : `${preview.changedCount} of ${preview.cells.length} ${preview.cells.length === 1 ? "cell changes" : "cells change"}. Worked-out columns are worked out by the store when it runs.` })
22249
+ /* @__PURE__ */ jsx70("p", { className: "text-[11px] text-muted-foreground", "data-records-action-preview-count": "", children: preview.changedCount === 0 ? "Nothing on this record would change: every value is already what the action sets." : `${preview.changedCount} of ${preview.cells.length} ${preview.cells.length === 1 ? "cell changes" : "cells change"}. Worked-out columns are worked out by the store when it runs.` })
22112
22250
  ] });
22113
22251
  }
22114
22252
 
@@ -22124,7 +22262,7 @@ import { useCallback as useCallback18, useEffect as useEffect43, useMemo as useM
22124
22262
  import { useRecordsClient as useRecordsClient30, useRowActions } from "@ai-matrx/records/react";
22125
22263
  import { actionRefusals } from "@ai-matrx/records";
22126
22264
  import { Button as Button38, ConfirmDialog as ConfirmDialog2, cn as cn38 } from "@ai-matrx/design-system";
22127
- import { jsx as jsx70, jsxs as jsxs64 } from "react/jsx-runtime";
22265
+ import { jsx as jsx71, jsxs as jsxs65 } from "react/jsx-runtime";
22128
22266
  var EMPTY_ACTIONS = [];
22129
22267
  var actionListeners = /* @__PURE__ */ new Map();
22130
22268
  function rowActionsChanged(tableId) {
@@ -22276,7 +22414,7 @@ function ActionButton({
22276
22414
  onPress,
22277
22415
  className
22278
22416
  }) {
22279
- return /* @__PURE__ */ jsx70(
22417
+ return /* @__PURE__ */ jsx71(
22280
22418
  Button38,
22281
22419
  {
22282
22420
  size: "sm",
@@ -22298,7 +22436,7 @@ function ActionOutcomeNotice({
22298
22436
  onUndo,
22299
22437
  onDismiss
22300
22438
  }) {
22301
- return /* @__PURE__ */ jsxs64(
22439
+ return /* @__PURE__ */ jsxs65(
22302
22440
  "div",
22303
22441
  {
22304
22442
  role: "status",
@@ -22308,10 +22446,10 @@ function ActionOutcomeNotice({
22308
22446
  outcome.kind === "refused" ? "border-destructive/40 bg-destructive/5" : "border-border bg-muted/40"
22309
22447
  ),
22310
22448
  children: [
22311
- /* @__PURE__ */ jsxs64("div", { className: "flex items-center gap-2", children: [
22312
- /* @__PURE__ */ jsx70("span", { children: outcome.says }),
22313
- outcome.kind === "ran" && outcome.undo ? /* @__PURE__ */ jsx70(Button38, { size: "sm", variant: "outline", className: "ml-auto h-6", onClick: onUndo, children: "Undo" }) : null,
22314
- /* @__PURE__ */ jsx70(
22449
+ /* @__PURE__ */ jsxs65("div", { className: "flex items-center gap-2", children: [
22450
+ /* @__PURE__ */ jsx71("span", { children: outcome.says }),
22451
+ outcome.kind === "ran" && outcome.undo ? /* @__PURE__ */ jsx71(Button38, { size: "sm", variant: "outline", className: "ml-auto h-6", onClick: onUndo, children: "Undo" }) : null,
22452
+ /* @__PURE__ */ jsx71(
22315
22453
  Button38,
22316
22454
  {
22317
22455
  size: "sm",
@@ -22322,13 +22460,13 @@ function ActionOutcomeNotice({
22322
22460
  }
22323
22461
  )
22324
22462
  ] }),
22325
- outcome.kind === "ran" && !outcome.undo && outcome.undoWhyNot ? /* @__PURE__ */ jsx70("span", { className: "text-muted-foreground", children: outcome.undoWhyNot }) : null,
22326
- outcome.kind === "refused" ? outcome.refusals.length > 0 ? /* @__PURE__ */ jsx70("ul", { className: "list-disc pl-4", "data-records-action-refusals": "", children: outcome.refusals.map((r) => /* @__PURE__ */ jsxs64("li", { children: [
22463
+ outcome.kind === "ran" && !outcome.undo && outcome.undoWhyNot ? /* @__PURE__ */ jsx71("span", { className: "text-muted-foreground", children: outcome.undoWhyNot }) : null,
22464
+ outcome.kind === "refused" ? outcome.refusals.length > 0 ? /* @__PURE__ */ jsx71("ul", { className: "list-disc pl-4", "data-records-action-refusals": "", children: outcome.refusals.map((r) => /* @__PURE__ */ jsxs65("li", { children: [
22327
22465
  (r.record ?? "A record") + (r.field ? ` \xB7 ${r.field}` : ""),
22328
22466
  ": ",
22329
22467
  r.says
22330
- ] }, `${r.record_id}:${r.field_id ?? ""}`)) }) : /* @__PURE__ */ jsx70(RefusalLine, { error: outcome.error }) : null,
22331
- outcome.kind === "undone" && outcome.failures.length > 0 ? /* @__PURE__ */ jsx70("ul", { className: "list-disc pl-4", children: outcome.failures.map((f, i) => /* @__PURE__ */ jsx70("li", { children: f }, i)) }) : null
22468
+ ] }, `${r.record_id}:${r.field_id ?? ""}`)) }) : /* @__PURE__ */ jsx71(RefusalLine, { error: outcome.error }) : null,
22469
+ outcome.kind === "undone" && outcome.failures.length > 0 ? /* @__PURE__ */ jsx71("ul", { className: "list-disc pl-4", children: outcome.failures.map((f, i) => /* @__PURE__ */ jsx71("li", { children: f }, i)) }) : null
22332
22470
  ]
22333
22471
  }
22334
22472
  );
@@ -22340,7 +22478,7 @@ function ActionConfirm({
22340
22478
  nounPlural
22341
22479
  }) {
22342
22480
  const held = runner.asking;
22343
- return /* @__PURE__ */ jsx70(
22481
+ return /* @__PURE__ */ jsx71(
22344
22482
  ConfirmDialog2,
22345
22483
  {
22346
22484
  open: held !== null,
@@ -22383,7 +22521,7 @@ function rowActionMenuItems(args) {
22383
22521
  }
22384
22522
 
22385
22523
  // src/RowActionsEditor.tsx
22386
- import { jsx as jsx71, jsxs as jsxs65 } from "react/jsx-runtime";
22524
+ import { jsx as jsx72, jsxs as jsxs66 } from "react/jsx-runtime";
22387
22525
  function settableFields(fields) {
22388
22526
  return [...fields].filter((f) => f.type !== "formula" && f.source !== "formula").sort((a, b) => (a.sort ?? 0) - (b.sort ?? 0));
22389
22527
  }
@@ -22566,7 +22704,7 @@ function RowActionsSection({
22566
22704
  }, [startAdding, addStarted, loaded, readError]);
22567
22705
  if (editing) {
22568
22706
  const original = editing === "new" ? null : editing;
22569
- return /* @__PURE__ */ jsx71(
22707
+ return /* @__PURE__ */ jsx72(
22570
22708
  ActionForm,
22571
22709
  {
22572
22710
  tableId,
@@ -22590,11 +22728,11 @@ function RowActionsSection({
22590
22728
  }
22591
22729
  );
22592
22730
  }
22593
- return /* @__PURE__ */ jsxs65("div", { className: cn39("flex flex-col gap-2", className), "data-records-row-actions-editor": "", children: [
22594
- /* @__PURE__ */ jsxs65("div", { className: "flex items-center gap-2", children: [
22595
- /* @__PURE__ */ jsx71("span", { className: "font-medium", children: "Row actions" }),
22596
- loaded && !readError ? /* @__PURE__ */ jsx71("span", { className: "text-muted-foreground", children: actions.length }) : null,
22597
- /* @__PURE__ */ jsx71(
22731
+ return /* @__PURE__ */ jsxs66("div", { className: cn39("flex flex-col gap-2", className), "data-records-row-actions-editor": "", children: [
22732
+ /* @__PURE__ */ jsxs66("div", { className: "flex items-center gap-2", children: [
22733
+ /* @__PURE__ */ jsx72("span", { className: "font-medium", children: "Row actions" }),
22734
+ loaded && !readError ? /* @__PURE__ */ jsx72("span", { className: "text-muted-foreground", children: actions.length }) : null,
22735
+ /* @__PURE__ */ jsx72(
22598
22736
  Button39,
22599
22737
  {
22600
22738
  size: "sm",
@@ -22609,41 +22747,41 @@ function RowActionsSection({
22609
22747
  }
22610
22748
  )
22611
22749
  ] }),
22612
- /* @__PURE__ */ jsx71("p", { className: "text-muted-foreground", children: "A button on every row: it changes that record in one click, or hands it to an agent with your words." }),
22613
- readError ? /* @__PURE__ */ jsx71(RefusalNotice, { error: readError }) : null,
22614
- saveError ? /* @__PURE__ */ jsx71(RefusalNotice, { error: saveError }) : null,
22615
- retiring ? /* @__PURE__ */ jsxs65("div", { className: "flex flex-wrap items-center gap-2 rounded border border-destructive/40 px-2 py-1.5", children: [
22616
- /* @__PURE__ */ jsxs65("span", { className: "text-destructive", children: [
22750
+ /* @__PURE__ */ jsx72("p", { className: "text-muted-foreground", children: "A button on every row: it changes that record in one click, or hands it to an agent with your words." }),
22751
+ readError ? /* @__PURE__ */ jsx72(RefusalNotice, { error: readError }) : null,
22752
+ saveError ? /* @__PURE__ */ jsx72(RefusalNotice, { error: saveError }) : null,
22753
+ retiring ? /* @__PURE__ */ jsxs66("div", { className: "flex flex-wrap items-center gap-2 rounded border border-destructive/40 px-2 py-1.5", children: [
22754
+ /* @__PURE__ */ jsxs66("span", { className: "text-destructive", children: [
22617
22755
  "Retiring ",
22618
22756
  retiring.name,
22619
22757
  " takes its button off every row of this table. Records it already changed stay as they are."
22620
22758
  ] }),
22621
- /* @__PURE__ */ jsx71(Button39, { size: "sm", variant: "destructive", disabled: saving, onClick: () => void retire(retiring), children: saving ? "Retiring\u2026" : "Retire it" }),
22622
- /* @__PURE__ */ jsx71(Button39, { size: "sm", variant: "ghost", onClick: () => setRetiring(null), children: "Keep it" })
22759
+ /* @__PURE__ */ jsx72(Button39, { size: "sm", variant: "destructive", disabled: saving, onClick: () => void retire(retiring), children: saving ? "Retiring\u2026" : "Retire it" }),
22760
+ /* @__PURE__ */ jsx72(Button39, { size: "sm", variant: "ghost", onClick: () => setRetiring(null), children: "Keep it" })
22623
22761
  ] }) : null,
22624
- retired ? /* @__PURE__ */ jsxs65("div", { role: "status", className: "flex flex-wrap items-center gap-2 rounded border px-2 py-1.5", children: [
22625
- /* @__PURE__ */ jsxs65("span", { children: [
22762
+ retired ? /* @__PURE__ */ jsxs66("div", { role: "status", className: "flex flex-wrap items-center gap-2 rounded border px-2 py-1.5", children: [
22763
+ /* @__PURE__ */ jsxs66("span", { children: [
22626
22764
  retired.action.name,
22627
22765
  " is retired."
22628
22766
  ] }),
22629
- /* @__PURE__ */ jsx71(Button39, { size: "sm", variant: "outline", className: "ml-auto", disabled: saving, onClick: () => void putBack(), children: "Put it back" }),
22630
- /* @__PURE__ */ jsx71(Button39, { size: "sm", variant: "ghost", onClick: () => setRetired(null), children: "Dismiss" })
22767
+ /* @__PURE__ */ jsx72(Button39, { size: "sm", variant: "outline", className: "ml-auto", disabled: saving, onClick: () => void putBack(), children: "Put it back" }),
22768
+ /* @__PURE__ */ jsx72(Button39, { size: "sm", variant: "ghost", onClick: () => setRetired(null), children: "Dismiss" })
22631
22769
  ] }) : null,
22632
- loaded && !readError ? /* @__PURE__ */ jsxs65("ul", { className: "divide-y rounded border", children: [
22633
- actions.map((action3, index) => /* @__PURE__ */ jsxs65(
22770
+ loaded && !readError ? /* @__PURE__ */ jsxs66("ul", { className: "divide-y rounded border", children: [
22771
+ actions.map((action3, index) => /* @__PURE__ */ jsxs66(
22634
22772
  "li",
22635
22773
  {
22636
22774
  "data-records-declared-action": action3.id,
22637
22775
  className: "flex flex-wrap items-center gap-x-2 gap-y-1 px-2 py-1.5",
22638
22776
  children: [
22639
- /* @__PURE__ */ jsxs65("span", { className: "min-w-[8rem] flex-1 break-words", children: [
22640
- /* @__PURE__ */ jsx71("span", { className: "font-medium", children: action3.name }),
22641
- /* @__PURE__ */ jsx71("span", { className: "block text-muted-foreground", children: describe(action3, allFields) })
22777
+ /* @__PURE__ */ jsxs66("span", { className: "min-w-[8rem] flex-1 break-words", children: [
22778
+ /* @__PURE__ */ jsx72("span", { className: "font-medium", children: action3.name }),
22779
+ /* @__PURE__ */ jsx72("span", { className: "block text-muted-foreground", children: describe(action3, allFields) })
22642
22780
  ] }),
22643
- action3.kind === "agent" ? /* @__PURE__ */ jsx71(Badge10, { variant: "secondary", className: "text-[10px] font-normal", children: "asks an agent" }) : null,
22644
- action3.confirm ? /* @__PURE__ */ jsx71(Badge10, { variant: "outline", className: "text-[10px] font-normal", children: "asks first" }) : null,
22645
- action3.kind !== "agent" && action3.runnable === false ? /* @__PURE__ */ jsx71(Badge10, { variant: "outline", className: "text-[10px] font-normal text-destructive", children: "a column it changes is gone" }) : null,
22646
- /* @__PURE__ */ jsx71(
22781
+ action3.kind === "agent" ? /* @__PURE__ */ jsx72(Badge10, { variant: "secondary", className: "text-[10px] font-normal", children: "asks an agent" }) : null,
22782
+ action3.confirm ? /* @__PURE__ */ jsx72(Badge10, { variant: "outline", className: "text-[10px] font-normal", children: "asks first" }) : null,
22783
+ action3.kind !== "agent" && action3.runnable === false ? /* @__PURE__ */ jsx72(Badge10, { variant: "outline", className: "text-[10px] font-normal text-destructive", children: "a column it changes is gone" }) : null,
22784
+ /* @__PURE__ */ jsx72(
22647
22785
  Button39,
22648
22786
  {
22649
22787
  size: "sm",
@@ -22654,7 +22792,7 @@ function RowActionsSection({
22654
22792
  children: "\u2191"
22655
22793
  }
22656
22794
  ),
22657
- /* @__PURE__ */ jsx71(
22795
+ /* @__PURE__ */ jsx72(
22658
22796
  Button39,
22659
22797
  {
22660
22798
  size: "sm",
@@ -22665,8 +22803,8 @@ function RowActionsSection({
22665
22803
  children: "\u2193"
22666
22804
  }
22667
22805
  ),
22668
- /* @__PURE__ */ jsx71(Button39, { size: "sm", variant: "ghost", title: `Edit ${action3.name}`, onClick: () => setEditing(action3), children: "Edit" }),
22669
- /* @__PURE__ */ jsx71(
22806
+ /* @__PURE__ */ jsx72(Button39, { size: "sm", variant: "ghost", title: `Edit ${action3.name}`, onClick: () => setEditing(action3), children: "Edit" }),
22807
+ /* @__PURE__ */ jsx72(
22670
22808
  Button39,
22671
22809
  {
22672
22810
  size: "sm",
@@ -22684,9 +22822,9 @@ function RowActionsSection({
22684
22822
  },
22685
22823
  action3.id ?? action3.name
22686
22824
  )),
22687
- actions.length === 0 ? /* @__PURE__ */ jsx71("li", { className: "px-2 py-2 text-muted-foreground", children: "This table has no row actions yet." }) : null
22825
+ actions.length === 0 ? /* @__PURE__ */ jsx72("li", { className: "px-2 py-2 text-muted-foreground", children: "This table has no row actions yet." }) : null
22688
22826
  ] }) : null,
22689
- stale > 0 ? /* @__PURE__ */ jsxs65("p", { className: "text-muted-foreground", children: [
22827
+ stale > 0 ? /* @__PURE__ */ jsxs66("p", { className: "text-muted-foreground", children: [
22690
22828
  stale === 1 ? "One action names" : `${stale} actions name`,
22691
22829
  " a column this table no longer has, so",
22692
22830
  " ",
@@ -22737,11 +22875,11 @@ function ActionForm({
22737
22875
  const first = settable2.find((f) => doc[f.key] !== null && doc[f.key] !== void 0 && doc[f.key] !== "");
22738
22876
  return first ? shown2(doc[first.key]) : row.id;
22739
22877
  };
22740
- return /* @__PURE__ */ jsxs65("div", { className: cn39("flex flex-col gap-3 text-xs", className), "data-records-action-form": "", children: [
22741
- /* @__PURE__ */ jsx71("span", { className: "font-medium", children: original ? `Row action \xB7 ${original.name}` : "New row action" }),
22742
- /* @__PURE__ */ jsxs65("label", { className: "flex flex-col gap-1", children: [
22743
- /* @__PURE__ */ jsx71(Label13, { className: "text-xs", children: "Name" }),
22744
- /* @__PURE__ */ jsx71(
22878
+ return /* @__PURE__ */ jsxs66("div", { className: cn39("flex flex-col gap-3 text-xs", className), "data-records-action-form": "", children: [
22879
+ /* @__PURE__ */ jsx72("span", { className: "font-medium", children: original ? `Row action \xB7 ${original.name}` : "New row action" }),
22880
+ /* @__PURE__ */ jsxs66("label", { className: "flex flex-col gap-1", children: [
22881
+ /* @__PURE__ */ jsx72(Label13, { className: "text-xs", children: "Name" }),
22882
+ /* @__PURE__ */ jsx72(
22745
22883
  BasicInput15,
22746
22884
  {
22747
22885
  value: draft.name,
@@ -22751,12 +22889,12 @@ function ActionForm({
22751
22889
  onChange: (e) => setDraft((d) => ({ ...d, name: e.target.value }))
22752
22890
  }
22753
22891
  ),
22754
- /* @__PURE__ */ jsx71("span", { className: "text-[11px] text-muted-foreground", children: "The words on the button." })
22892
+ /* @__PURE__ */ jsx72("span", { className: "text-[11px] text-muted-foreground", children: "The words on the button." })
22755
22893
  ] }),
22756
- /* @__PURE__ */ jsxs65("div", { className: "flex flex-col gap-1", children: [
22757
- /* @__PURE__ */ jsx71(Label13, { className: "text-xs", children: "What it does" }),
22758
- /* @__PURE__ */ jsxs65("div", { className: "flex gap-1", children: [
22759
- /* @__PURE__ */ jsx71(
22894
+ /* @__PURE__ */ jsxs66("div", { className: "flex flex-col gap-1", children: [
22895
+ /* @__PURE__ */ jsx72(Label13, { className: "text-xs", children: "What it does" }),
22896
+ /* @__PURE__ */ jsxs66("div", { className: "flex gap-1", children: [
22897
+ /* @__PURE__ */ jsx72(
22760
22898
  Button39,
22761
22899
  {
22762
22900
  size: "sm",
@@ -22766,7 +22904,7 @@ function ActionForm({
22766
22904
  children: "Changes the record"
22767
22905
  }
22768
22906
  ),
22769
- /* @__PURE__ */ jsx71(
22907
+ /* @__PURE__ */ jsx72(
22770
22908
  Button39,
22771
22909
  {
22772
22910
  size: "sm",
@@ -22778,9 +22916,9 @@ function ActionForm({
22778
22916
  )
22779
22917
  ] })
22780
22918
  ] }),
22781
- draft.kind === "agent" ? /* @__PURE__ */ jsxs65("label", { className: "flex flex-col gap-1", children: [
22782
- /* @__PURE__ */ jsx71(Label13, { className: "text-xs", children: "What to ask" }),
22783
- /* @__PURE__ */ jsx71(
22919
+ draft.kind === "agent" ? /* @__PURE__ */ jsxs66("label", { className: "flex flex-col gap-1", children: [
22920
+ /* @__PURE__ */ jsx72(Label13, { className: "text-xs", children: "What to ask" }),
22921
+ /* @__PURE__ */ jsx72(
22784
22922
  BasicTextarea6,
22785
22923
  {
22786
22924
  value: draft.prompt,
@@ -22789,13 +22927,13 @@ function ActionForm({
22789
22927
  onChange: (e) => setDraft((d) => ({ ...d, prompt: e.target.value }))
22790
22928
  }
22791
22929
  ),
22792
- /* @__PURE__ */ jsx71("span", { className: "text-[11px] text-muted-foreground", children: "The agent is handed the record with these words, and answers in the record's chat." })
22793
- ] }) : /* @__PURE__ */ jsxs65("div", { className: "flex flex-col gap-2", children: [
22794
- /* @__PURE__ */ jsxs65("div", { className: "flex flex-wrap items-center gap-2", children: [
22795
- /* @__PURE__ */ jsx71(Label13, { className: "text-xs", children: "What it changes" }),
22796
- rows.length > 0 ? /* @__PURE__ */ jsxs65("div", { className: "ml-auto flex items-center gap-1", children: [
22797
- /* @__PURE__ */ jsx71("span", { className: "text-muted-foreground", children: "Start from a record" }),
22798
- /* @__PURE__ */ jsxs65(
22930
+ /* @__PURE__ */ jsx72("span", { className: "text-[11px] text-muted-foreground", children: "The agent is handed the record with these words, and answers in the record's chat." })
22931
+ ] }) : /* @__PURE__ */ jsxs66("div", { className: "flex flex-col gap-2", children: [
22932
+ /* @__PURE__ */ jsxs66("div", { className: "flex flex-wrap items-center gap-2", children: [
22933
+ /* @__PURE__ */ jsx72(Label13, { className: "text-xs", children: "What it changes" }),
22934
+ rows.length > 0 ? /* @__PURE__ */ jsxs66("div", { className: "ml-auto flex items-center gap-1", children: [
22935
+ /* @__PURE__ */ jsx72("span", { className: "text-muted-foreground", children: "Start from a record" }),
22936
+ /* @__PURE__ */ jsxs66(
22799
22937
  Select12,
22800
22938
  {
22801
22939
  value: "",
@@ -22814,28 +22952,28 @@ function ActionForm({
22814
22952
  setPreviewId(row.id);
22815
22953
  },
22816
22954
  children: [
22817
- /* @__PURE__ */ jsx71(SelectTrigger11, { size: "sm", "aria-label": "Start from a record", children: /* @__PURE__ */ jsx71(SelectValue11, { placeholder: "Pick one" }) }),
22818
- /* @__PURE__ */ jsx71(SelectContent11, { children: rows.map((row) => /* @__PURE__ */ jsx71(SelectItem11, { value: row.id, children: rowName2(row) }, row.id)) })
22955
+ /* @__PURE__ */ jsx72(SelectTrigger11, { size: "sm", "aria-label": "Start from a record", children: /* @__PURE__ */ jsx72(SelectValue11, { placeholder: "Pick one" }) }),
22956
+ /* @__PURE__ */ jsx72(SelectContent11, { children: rows.map((row) => /* @__PURE__ */ jsx72(SelectItem11, { value: row.id, children: rowName2(row) }, row.id)) })
22819
22957
  ]
22820
22958
  }
22821
22959
  )
22822
22960
  ] }) : null
22823
22961
  ] }),
22824
- draft.steps.length === 0 ? /* @__PURE__ */ jsx71("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,
22825
- draft.steps.map((step2, index) => /* @__PURE__ */ jsxs65("div", { className: "flex flex-wrap items-center gap-1", "data-records-action-step": index, children: [
22826
- /* @__PURE__ */ jsxs65(Select12, { value: step2.field, onValueChange: (v) => setStep(index, { field: v }), children: [
22827
- /* @__PURE__ */ jsx71(SelectTrigger11, { size: "sm", "aria-label": `Column for change ${index + 1}`, children: /* @__PURE__ */ jsx71(SelectValue11, { placeholder: "Column" }) }),
22828
- /* @__PURE__ */ jsx71(SelectContent11, { children: settable2.map((f) => /* @__PURE__ */ jsx71(SelectItem11, { value: f.id, children: fieldName(f) }, f.id)) })
22962
+ draft.steps.length === 0 ? /* @__PURE__ */ jsx72("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,
22963
+ draft.steps.map((step2, index) => /* @__PURE__ */ jsxs66("div", { className: "flex flex-wrap items-center gap-1", "data-records-action-step": index, children: [
22964
+ /* @__PURE__ */ jsxs66(Select12, { value: step2.field, onValueChange: (v) => setStep(index, { field: v }), children: [
22965
+ /* @__PURE__ */ jsx72(SelectTrigger11, { size: "sm", "aria-label": `Column for change ${index + 1}`, children: /* @__PURE__ */ jsx72(SelectValue11, { placeholder: "Column" }) }),
22966
+ /* @__PURE__ */ jsx72(SelectContent11, { children: settable2.map((f) => /* @__PURE__ */ jsx72(SelectItem11, { value: f.id, children: fieldName(f) }, f.id)) })
22829
22967
  ] }),
22830
- /* @__PURE__ */ jsxs65(Select12, { value: step2.set, onValueChange: (v) => setStep(index, { set: v }), children: [
22831
- /* @__PURE__ */ jsx71(SelectTrigger11, { size: "sm", "aria-label": `How change ${index + 1} sets it`, children: /* @__PURE__ */ jsx71(SelectValue11, {}) }),
22832
- /* @__PURE__ */ jsxs65(SelectContent11, { children: [
22833
- /* @__PURE__ */ jsx71(SelectItem11, { value: "value", children: "Set to" }),
22834
- /* @__PURE__ */ jsx71(SelectItem11, { value: "clear", children: "Clear" }),
22835
- /* @__PURE__ */ jsx71(SelectItem11, { value: "compute", children: "Work out" })
22968
+ /* @__PURE__ */ jsxs66(Select12, { value: step2.set, onValueChange: (v) => setStep(index, { set: v }), children: [
22969
+ /* @__PURE__ */ jsx72(SelectTrigger11, { size: "sm", "aria-label": `How change ${index + 1} sets it`, children: /* @__PURE__ */ jsx72(SelectValue11, {}) }),
22970
+ /* @__PURE__ */ jsxs66(SelectContent11, { children: [
22971
+ /* @__PURE__ */ jsx72(SelectItem11, { value: "value", children: "Set to" }),
22972
+ /* @__PURE__ */ jsx72(SelectItem11, { value: "clear", children: "Clear" }),
22973
+ /* @__PURE__ */ jsx72(SelectItem11, { value: "compute", children: "Work out" })
22836
22974
  ] })
22837
22975
  ] }),
22838
- step2.set === "value" ? /* @__PURE__ */ jsx71(
22976
+ step2.set === "value" ? /* @__PURE__ */ jsx72(
22839
22977
  BasicInput15,
22840
22978
  {
22841
22979
  className: "h-7 w-40",
@@ -22846,7 +22984,7 @@ function ActionForm({
22846
22984
  ) : step2.set === "compute" ? (
22847
22985
  // THE ONE FORMULA BOX (Sheet parity): the store checks it as it is typed, and the host's
22848
22986
  // "Help with this…" (`formulaHelp`) sees this table's columns and puts its answer back.
22849
- /* @__PURE__ */ jsx71(
22987
+ /* @__PURE__ */ jsx72(
22850
22988
  FormulaTextEditor,
22851
22989
  {
22852
22990
  className: "basis-full",
@@ -22863,7 +23001,7 @@ function ActionForm({
22863
23001
  }
22864
23002
  )
22865
23003
  ) : null,
22866
- /* @__PURE__ */ jsx71(
23004
+ /* @__PURE__ */ jsx72(
22867
23005
  Button39,
22868
23006
  {
22869
23007
  size: "sm",
@@ -22874,7 +23012,7 @@ function ActionForm({
22874
23012
  }
22875
23013
  )
22876
23014
  ] }, index)),
22877
- /* @__PURE__ */ jsx71("div", { children: /* @__PURE__ */ jsx71(
23015
+ /* @__PURE__ */ jsx72("div", { children: /* @__PURE__ */ jsx72(
22878
23016
  Button39,
22879
23017
  {
22880
23018
  size: "sm",
@@ -22883,16 +23021,16 @@ function ActionForm({
22883
23021
  children: "Add a change"
22884
23022
  }
22885
23023
  ) }),
22886
- previewRow && draft.steps.length > 0 && complete ? /* @__PURE__ */ jsxs65("div", { className: "flex flex-col gap-1 rounded border px-2 py-1.5", "data-records-action-preview": "", children: [
22887
- /* @__PURE__ */ jsxs65("div", { className: "flex flex-wrap items-center gap-1", children: [
22888
- /* @__PURE__ */ jsx71("span", { className: "font-medium", children: "Before and after" }),
22889
- /* @__PURE__ */ jsx71("span", { className: "text-muted-foreground", children: "on" }),
22890
- /* @__PURE__ */ jsxs65(Select12, { value: previewRow.id, onValueChange: (v) => setPreviewId(v), children: [
22891
- /* @__PURE__ */ jsx71(SelectTrigger11, { size: "sm", "aria-label": "Record to preview on", children: /* @__PURE__ */ jsx71(SelectValue11, {}) }),
22892
- /* @__PURE__ */ jsx71(SelectContent11, { children: rows.map((row) => /* @__PURE__ */ jsx71(SelectItem11, { value: row.id, children: rowName2(row) }, row.id)) })
23024
+ previewRow && draft.steps.length > 0 && complete ? /* @__PURE__ */ jsxs66("div", { className: "flex flex-col gap-1 rounded border px-2 py-1.5", "data-records-action-preview": "", children: [
23025
+ /* @__PURE__ */ jsxs66("div", { className: "flex flex-wrap items-center gap-1", children: [
23026
+ /* @__PURE__ */ jsx72("span", { className: "font-medium", children: "Before and after" }),
23027
+ /* @__PURE__ */ jsx72("span", { className: "text-muted-foreground", children: "on" }),
23028
+ /* @__PURE__ */ jsxs66(Select12, { value: previewRow.id, onValueChange: (v) => setPreviewId(v), children: [
23029
+ /* @__PURE__ */ jsx72(SelectTrigger11, { size: "sm", "aria-label": "Record to preview on", children: /* @__PURE__ */ jsx72(SelectValue11, {}) }),
23030
+ /* @__PURE__ */ jsx72(SelectContent11, { children: rows.map((row) => /* @__PURE__ */ jsx72(SelectItem11, { value: row.id, children: rowName2(row) }, row.id)) })
22893
23031
  ] })
22894
23032
  ] }),
22895
- /* @__PURE__ */ jsx71(
23033
+ /* @__PURE__ */ jsx72(
22896
23034
  ActionRowPreview,
22897
23035
  {
22898
23036
  tableId,
@@ -22901,9 +23039,9 @@ function ActionForm({
22901
23039
  )
22902
23040
  ] }) : null
22903
23041
  ] }),
22904
- /* @__PURE__ */ jsxs65("div", { className: "flex flex-wrap items-center gap-4", children: [
22905
- /* @__PURE__ */ jsxs65("label", { className: "flex items-center gap-1.5", children: [
22906
- /* @__PURE__ */ jsx71(
23042
+ /* @__PURE__ */ jsxs66("div", { className: "flex flex-wrap items-center gap-4", children: [
23043
+ /* @__PURE__ */ jsxs66("label", { className: "flex items-center gap-1.5", children: [
23044
+ /* @__PURE__ */ jsx72(
22907
23045
  Checkbox11,
22908
23046
  {
22909
23047
  checked: draft.confirm,
@@ -22913,36 +23051,36 @@ function ActionForm({
22913
23051
  ),
22914
23052
  "Ask before running"
22915
23053
  ] }),
22916
- host.iconPicker ? /* @__PURE__ */ jsxs65("div", { className: "flex items-center gap-1", "data-records-action-icon": "", children: [
22917
- /* @__PURE__ */ jsx71("span", { className: "shrink-0 whitespace-nowrap text-muted-foreground", children: "Icon" }),
23054
+ host.iconPicker ? /* @__PURE__ */ jsxs66("div", { className: "flex items-center gap-1", "data-records-action-icon": "", children: [
23055
+ /* @__PURE__ */ jsx72("span", { className: "shrink-0 whitespace-nowrap text-muted-foreground", children: "Icon" }),
22918
23056
  host.iconPicker({
22919
23057
  value: draft.icon ?? "",
22920
23058
  label: "Button icon",
22921
23059
  onChange: (name) => setDraft((d) => ({ ...d, icon: name || void 0 }))
22922
23060
  })
22923
23061
  ] }) : null,
22924
- colors.length > 0 ? /* @__PURE__ */ jsxs65("div", { className: "flex items-center gap-1", children: [
22925
- /* @__PURE__ */ jsx71("span", { className: "shrink-0 whitespace-nowrap text-muted-foreground", children: "Color" }),
22926
- /* @__PURE__ */ jsxs65(
23062
+ colors.length > 0 ? /* @__PURE__ */ jsxs66("div", { className: "flex items-center gap-1", children: [
23063
+ /* @__PURE__ */ jsx72("span", { className: "shrink-0 whitespace-nowrap text-muted-foreground", children: "Color" }),
23064
+ /* @__PURE__ */ jsxs66(
22927
23065
  Select12,
22928
23066
  {
22929
23067
  value: draft.color || NO_COLOR,
22930
23068
  onValueChange: (v) => setDraft((d) => ({ ...d, color: v === NO_COLOR ? "" : v })),
22931
23069
  children: [
22932
- /* @__PURE__ */ jsx71(SelectTrigger11, { size: "sm", "aria-label": "Button color", children: /* @__PURE__ */ jsx71(SelectValue11, {}) }),
22933
- /* @__PURE__ */ jsxs65(SelectContent11, { children: [
22934
- /* @__PURE__ */ jsx71(SelectItem11, { value: NO_COLOR, children: "None" }),
22935
- colors.map((c) => /* @__PURE__ */ jsx71(SelectItem11, { value: c, children: c.charAt(0).toUpperCase() + c.slice(1) }, c))
23070
+ /* @__PURE__ */ jsx72(SelectTrigger11, { size: "sm", "aria-label": "Button color", children: /* @__PURE__ */ jsx72(SelectValue11, {}) }),
23071
+ /* @__PURE__ */ jsxs66(SelectContent11, { children: [
23072
+ /* @__PURE__ */ jsx72(SelectItem11, { value: NO_COLOR, children: "None" }),
23073
+ colors.map((c) => /* @__PURE__ */ jsx72(SelectItem11, { value: c, children: c.charAt(0).toUpperCase() + c.slice(1) }, c))
22936
23074
  ] })
22937
23075
  ]
22938
23076
  }
22939
23077
  )
22940
23078
  ] }) : null
22941
23079
  ] }),
22942
- error ? /* @__PURE__ */ jsx71(RefusalNotice, { error }) : null,
22943
- !complete ? /* @__PURE__ */ jsx71("p", { className: "text-muted-foreground", children: "Every change needs its column before the action can be saved." }) : null,
22944
- /* @__PURE__ */ jsxs65("div", { className: "flex gap-1", children: [
22945
- /* @__PURE__ */ jsx71(
23080
+ error ? /* @__PURE__ */ jsx72(RefusalNotice, { error }) : null,
23081
+ !complete ? /* @__PURE__ */ jsx72("p", { className: "text-muted-foreground", children: "Every change needs its column before the action can be saved." }) : null,
23082
+ /* @__PURE__ */ jsxs66("div", { className: "flex gap-1", children: [
23083
+ /* @__PURE__ */ jsx72(
22946
23084
  Button39,
22947
23085
  {
22948
23086
  size: "sm",
@@ -22951,18 +23089,18 @@ function ActionForm({
22951
23089
  children: saving ? "Saving\u2026" : original ? "Save action" : "Add action"
22952
23090
  }
22953
23091
  ),
22954
- /* @__PURE__ */ jsx71(Button39, { size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" })
23092
+ /* @__PURE__ */ jsx72(Button39, { size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" })
22955
23093
  ] })
22956
23094
  ] });
22957
23095
  }
22958
23096
 
22959
23097
  // src/gridActionsHeader.tsx
22960
- import { jsx as jsx72, jsxs as jsxs66 } from "react/jsx-runtime";
23098
+ import { jsx as jsx73, jsxs as jsxs67 } from "react/jsx-runtime";
22961
23099
  var ADD_COLUMN_LABEL = "Add a column";
22962
23100
  var ROW_ACTIONS_MENU_LABEL = "Row actions\u2026";
22963
23101
  function ActionsHeaderControls({ onAddColumn }) {
22964
23102
  if (!onAddColumn) return null;
22965
- return /* @__PURE__ */ jsx72(
23103
+ return /* @__PURE__ */ jsx73(
22966
23104
  Button40,
22967
23105
  {
22968
23106
  type: "button",
@@ -22977,7 +23115,7 @@ function ActionsHeaderControls({ onAddColumn }) {
22977
23115
  event.stopPropagation();
22978
23116
  onAddColumn();
22979
23117
  },
22980
- children: /* @__PURE__ */ jsx72("span", { "aria-hidden": true, className: "text-sm leading-none", children: "+" })
23118
+ children: /* @__PURE__ */ jsx73("span", { "aria-hidden": true, className: "text-sm leading-none", children: "+" })
22981
23119
  }
22982
23120
  );
22983
23121
  }
@@ -22986,9 +23124,9 @@ function RowActionsDialog({
22986
23124
  open,
22987
23125
  onOpenChange
22988
23126
  }) {
22989
- return /* @__PURE__ */ jsx72(Dialog9, { open, onOpenChange, children: /* @__PURE__ */ jsxs66(DialogContent9, { className: "max-h-[85dvh] overflow-y-auto sm:max-w-xl", "data-records-actions-header-editor": "", children: [
22990
- /* @__PURE__ */ jsx72(DialogHeader9, { children: /* @__PURE__ */ jsx72(DialogTitle9, { children: "Row actions" }) }),
22991
- open ? /* @__PURE__ */ jsx72(RowActionsSection, { tableId, className: "text-xs" }) : null
23127
+ return /* @__PURE__ */ jsx73(Dialog9, { open, onOpenChange, children: /* @__PURE__ */ jsxs67(DialogContent9, { className: "max-h-[85dvh] overflow-y-auto sm:max-w-xl", "data-records-actions-header-editor": "", children: [
23128
+ /* @__PURE__ */ jsx73(DialogHeader9, { children: /* @__PURE__ */ jsx73(DialogTitle9, { children: "Row actions" }) }),
23129
+ open ? /* @__PURE__ */ jsx73(RowActionsSection, { tableId, className: "text-xs" }) : null
22992
23130
  ] }) });
22993
23131
  }
22994
23132
 
@@ -23013,7 +23151,7 @@ import {
23013
23151
  init_parity();
23014
23152
  init_names();
23015
23153
  init_PickOne();
23016
- import { Fragment as Fragment23, jsx as jsx73, jsxs as jsxs67 } from "react/jsx-runtime";
23154
+ import { Fragment as Fragment24, jsx as jsx74, jsxs as jsxs68 } from "react/jsx-runtime";
23017
23155
  var SUMMARY_ROW_ID = "__records_ui_summary__";
23018
23156
  var SUMMARY_ROW = {
23019
23157
  id: SUMMARY_ROW_ID,
@@ -23109,8 +23247,8 @@ function SummaryCell({
23109
23247
  const label = chosen ? words2(chosen, "footer") : null;
23110
23248
  const isDate4 = editorKindFor(field2) === "datetime";
23111
23249
  const shown5 = chosen === void 0 ? null : summaries.loading && value === void 0 ? "\u2026" : value === null || value === void 0 ? "\u2014" : chosen === "count" || chosen === "filled" || chosen === "empty" || chosen === "unique" ? String(value) : chosen === "percent_empty" || chosen === "percent_filled" ? `${Number(value.toFixed(2))}%` : chosen === "range" && isDate4 ? `${Math.round(value)} day${Math.round(value) === 1 ? "" : "s"}` : null;
23112
- return /* @__PURE__ */ jsxs67(DropdownMenu2, { onOpenChange: (open) => open ? summaries.askOperations() : void 0, children: [
23113
- /* @__PURE__ */ jsx73(DropdownMenuTrigger2, { asChild: true, children: /* @__PURE__ */ jsx73(
23250
+ return /* @__PURE__ */ jsxs68(DropdownMenu2, { onOpenChange: (open) => open ? summaries.askOperations() : void 0, children: [
23251
+ /* @__PURE__ */ jsx74(DropdownMenuTrigger2, { asChild: true, children: /* @__PURE__ */ jsx74(
23114
23252
  Button41,
23115
23253
  {
23116
23254
  size: "sm",
@@ -23124,18 +23262,18 @@ function SummaryCell({
23124
23262
  chosen ? "text-foreground" : "text-muted-foreground opacity-0 hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100"
23125
23263
  ),
23126
23264
  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)}`,
23127
- children: chosen ? /* @__PURE__ */ jsxs67(Fragment23, { children: [
23128
- /* @__PURE__ */ jsx73("span", { className: "text-muted-foreground", children: label }),
23265
+ children: chosen ? /* @__PURE__ */ jsxs68(Fragment24, { children: [
23266
+ /* @__PURE__ */ jsx74("span", { className: "text-muted-foreground", children: label }),
23129
23267
  summaries.withheld[field2.key] ? (
23130
23268
  // AGG-WITHHELD: the store withheld this column from her — say so, never a bare dash.
23131
- /* @__PURE__ */ jsx73("span", { className: "font-medium", children: /* @__PURE__ */ jsx73(WithheldValue, { field: field2, notice: summaries.withheld[field2.key] }) })
23132
- ) : shown5 !== null ? /* @__PURE__ */ jsx73("span", { className: "font-medium tabular-nums", children: shown5 }) : /* @__PURE__ */ jsx73("span", { className: "font-medium tabular-nums", children: /* @__PURE__ */ jsx73(RecordValue, { field: field2, value, format: formatForField(field2) }) })
23269
+ /* @__PURE__ */ jsx74("span", { className: "font-medium", children: /* @__PURE__ */ jsx74(WithheldValue, { field: field2, notice: summaries.withheld[field2.key] }) })
23270
+ ) : shown5 !== null ? /* @__PURE__ */ jsx74("span", { className: "font-medium tabular-nums", children: shown5 }) : /* @__PURE__ */ jsx74("span", { className: "font-medium tabular-nums", children: /* @__PURE__ */ jsx74(RecordValue, { field: field2, value, format: formatForField(field2) }) })
23133
23271
  ] }) : calculate ? "Calculate" : "Summarize"
23134
23272
  }
23135
23273
  ) }),
23136
- /* @__PURE__ */ jsxs67(DropdownMenuContent2, { align: "start", children: [
23137
- /* @__PURE__ */ jsx73(DropdownMenuLabel, { className: "text-xs", children: fieldName(field2) }),
23138
- offered === null ? /* @__PURE__ */ jsx73(DropdownMenuLabel, { className: "text-xs font-normal text-muted-foreground", children: "Asking the store which measures it offers\u2026" }) : offered.length === 0 ? /* @__PURE__ */ jsx73(DropdownMenuLabel, { className: "text-xs font-normal text-muted-foreground", children: "The store offers no measure for this column." }) : offered.map((op2) => /* @__PURE__ */ jsx73(
23274
+ /* @__PURE__ */ jsxs68(DropdownMenuContent2, { align: "start", children: [
23275
+ /* @__PURE__ */ jsx74(DropdownMenuLabel, { className: "text-xs", children: fieldName(field2) }),
23276
+ offered === null ? /* @__PURE__ */ jsx74(DropdownMenuLabel, { className: "text-xs font-normal text-muted-foreground", children: "Asking the store which measures it offers\u2026" }) : offered.length === 0 ? /* @__PURE__ */ jsx74(DropdownMenuLabel, { className: "text-xs font-normal text-muted-foreground", children: "The store offers no measure for this column." }) : offered.map((op2) => /* @__PURE__ */ jsx74(
23139
23277
  DropdownMenuItem2,
23140
23278
  {
23141
23279
  "data-records-summary-choice": op2,
@@ -23145,9 +23283,9 @@ function SummaryCell({
23145
23283
  },
23146
23284
  op2
23147
23285
  )),
23148
- chosen ? /* @__PURE__ */ jsxs67(Fragment23, { children: [
23149
- /* @__PURE__ */ jsx73(DropdownMenuSeparator2, {}),
23150
- /* @__PURE__ */ jsx73(DropdownMenuItem2, { onSelect: () => onChoose(null), children: calculate ? "None" : "No summary" })
23286
+ chosen ? /* @__PURE__ */ jsxs68(Fragment24, { children: [
23287
+ /* @__PURE__ */ jsx74(DropdownMenuSeparator2, {}),
23288
+ /* @__PURE__ */ jsx74(DropdownMenuItem2, { onSelect: () => onChoose(null), children: calculate ? "None" : "No summary" })
23151
23289
  ] }) : null
23152
23290
  ] })
23153
23291
  ] });
@@ -23183,10 +23321,10 @@ function SummarySheetControls({
23183
23321
  const offered = field2 && operations ? measuresFor(field2, operations, field2.key === firstKey) : null;
23184
23322
  const current = columnKey ? chosen[columnKey] : void 0;
23185
23323
  const control = "h-10 min-w-0 flex-1 text-base";
23186
- return /* @__PURE__ */ jsxs67("div", { className: "flex flex-col gap-1.5", "data-records-grid-sheet-summaries": "", children: [
23187
- /* @__PURE__ */ jsx73("span", { className: "text-xs font-medium text-muted-foreground", children: "Summaries" }),
23188
- /* @__PURE__ */ jsxs67("div", { className: "flex items-center gap-2", children: [
23189
- /* @__PURE__ */ jsx73("span", { className: "contents", onFocusCapture: askOperations, onPointerDownCapture: askOperations, children: /* @__PURE__ */ jsx73(
23324
+ return /* @__PURE__ */ jsxs68("div", { className: "flex flex-col gap-1.5", "data-records-grid-sheet-summaries": "", children: [
23325
+ /* @__PURE__ */ jsx74("span", { className: "text-xs font-medium text-muted-foreground", children: "Summaries" }),
23326
+ /* @__PURE__ */ jsxs68("div", { className: "flex items-center gap-2", children: [
23327
+ /* @__PURE__ */ jsx74("span", { className: "contents", onFocusCapture: askOperations, onPointerDownCapture: askOperations, children: /* @__PURE__ */ jsx74(
23190
23328
  PickOne,
23191
23329
  {
23192
23330
  label: "Summarize which column",
@@ -23203,7 +23341,7 @@ function SummarySheetControls({
23203
23341
  }))
23204
23342
  }
23205
23343
  ) }),
23206
- field2 ? offered === null ? /* @__PURE__ */ jsx73("span", { className: "text-xs text-muted-foreground", children: "Asking the store which measures it offers\u2026" }) : offered.length === 0 ? /* @__PURE__ */ jsx73("span", { className: "text-xs text-muted-foreground", children: "The store offers no measure for this column." }) : /* @__PURE__ */ jsx73(
23344
+ field2 ? offered === null ? /* @__PURE__ */ jsx74("span", { className: "text-xs text-muted-foreground", children: "Asking the store which measures it offers\u2026" }) : offered.length === 0 ? /* @__PURE__ */ jsx74("span", { className: "text-xs text-muted-foreground", children: "The store offers no measure for this column." }) : /* @__PURE__ */ jsx74(
23207
23345
  PickOne,
23208
23346
  {
23209
23347
  label: "Summarize as",
@@ -23354,7 +23492,7 @@ function planTableClean(rows, keys, enabled) {
23354
23492
  // src/ColumnCleanDialog.tsx
23355
23493
  init_names();
23356
23494
  init_plainWords();
23357
- import { jsx as jsx74, jsxs as jsxs68 } from "react/jsx-runtime";
23495
+ import { jsx as jsx75, jsxs as jsxs69 } from "react/jsx-runtime";
23358
23496
  var PAGE2 = 500;
23359
23497
  var SHOWN = 6;
23360
23498
  function cleanBulkPlan(field2, cells) {
@@ -23437,14 +23575,14 @@ function ColumnCleanDialog({
23437
23575
  onClose();
23438
23576
  }
23439
23577
  };
23440
- return /* @__PURE__ */ jsx74(Dialog10, { open: true, onOpenChange: (open) => !open && !busy ? onClose() : void 0, children: /* @__PURE__ */ jsxs68(DialogContent10, { className: "sm:max-w-lg", "data-column-clean": "", children: [
23441
- /* @__PURE__ */ jsxs68(DialogHeader10, { children: [
23442
- /* @__PURE__ */ jsx74(DialogTitle10, { children: title }),
23443
- /* @__PURE__ */ jsx74(DialogDescription7, { className: "sr-only", children: whole ? "Tidy the text in every text column." : "Tidy the text in every row of this column." })
23578
+ return /* @__PURE__ */ jsx75(Dialog10, { open: true, onOpenChange: (open) => !open && !busy ? onClose() : void 0, children: /* @__PURE__ */ jsxs69(DialogContent10, { className: "sm:max-w-lg", "data-column-clean": "", children: [
23579
+ /* @__PURE__ */ jsxs69(DialogHeader10, { children: [
23580
+ /* @__PURE__ */ jsx75(DialogTitle10, { children: title }),
23581
+ /* @__PURE__ */ jsx75(DialogDescription7, { className: "sr-only", children: whole ? "Tidy the text in every text column." : "Tidy the text in every row of this column." })
23444
23582
  ] }),
23445
- failed ? /* @__PURE__ */ jsx74("p", { className: "text-sm text-destructive", children: failed }) : !plan ? /* @__PURE__ */ jsx74("p", { className: "text-sm text-muted-foreground", "data-column-clean-scanning": "", children: "Reading every row\u2026" }) : /* @__PURE__ */ jsxs68("div", { className: "flex flex-col gap-3", children: [
23446
- /* @__PURE__ */ jsx74("div", { className: "flex flex-col gap-1.5", children: CLEAN_OPERATIONS.map((op2) => /* @__PURE__ */ jsxs68(Label14, { className: "flex items-center gap-2 text-sm font-normal", children: [
23447
- /* @__PURE__ */ jsx74(
23583
+ failed ? /* @__PURE__ */ jsx75("p", { className: "text-sm text-destructive", children: failed }) : !plan ? /* @__PURE__ */ jsx75("p", { className: "text-sm text-muted-foreground", "data-column-clean-scanning": "", children: "Reading every row\u2026" }) : /* @__PURE__ */ jsxs69("div", { className: "flex flex-col gap-3", children: [
23584
+ /* @__PURE__ */ jsx75("div", { className: "flex flex-col gap-1.5", children: CLEAN_OPERATIONS.map((op2) => /* @__PURE__ */ jsxs69(Label14, { className: "flex items-center gap-2 text-sm font-normal", children: [
23585
+ /* @__PURE__ */ jsx75(
23448
23586
  "input",
23449
23587
  {
23450
23588
  type: "checkbox",
@@ -23458,42 +23596,42 @@ function ColumnCleanDialog({
23458
23596
  })
23459
23597
  }
23460
23598
  ),
23461
- /* @__PURE__ */ jsx74("span", { className: "flex-1", children: op2.label }),
23462
- /* @__PURE__ */ jsx74("span", { className: "text-xs tabular-nums text-muted-foreground", children: plan.perOperation[op2.id] })
23599
+ /* @__PURE__ */ jsx75("span", { className: "flex-1", children: op2.label }),
23600
+ /* @__PURE__ */ jsx75("span", { className: "text-xs tabular-nums text-muted-foreground", children: plan.perOperation[op2.id] })
23463
23601
  ] }, op2.id)) }),
23464
- /* @__PURE__ */ jsx74("div", { className: "rounded-md border", "data-column-clean-review": "", children: plan.cells.length === 0 ? /* @__PURE__ */ jsx74("p", { className: "px-3 py-2 text-sm text-muted-foreground", children: "Nothing to clean." }) : whole ? (
23602
+ /* @__PURE__ */ jsx75("div", { className: "rounded-md border", "data-column-clean-review": "", children: plan.cells.length === 0 ? /* @__PURE__ */ jsx75("p", { className: "px-3 py-2 text-sm text-muted-foreground", children: "Nothing to clean." }) : whole ? (
23465
23603
  // ONE REVIEW, GROUPED BY TYPE OF CHANGE (the Sheet's CellCleanupReviewDialog).
23466
- /* @__PURE__ */ jsx74("div", { className: "max-h-72 divide-y overflow-y-auto text-xs", "data-table-clean-groups": "", children: plan.byOperation.map((group) => /* @__PURE__ */ jsxs68("div", { className: "flex flex-col gap-1 px-3 py-1.5", "data-table-clean-group": group.id, children: [
23467
- /* @__PURE__ */ jsxs68("span", { className: "flex items-center gap-2 font-medium", children: [
23468
- /* @__PURE__ */ jsx74("span", { className: "flex-1", children: group.label }),
23469
- /* @__PURE__ */ jsx74("span", { className: "tabular-nums text-muted-foreground", children: group.cells.length })
23604
+ /* @__PURE__ */ jsx75("div", { className: "max-h-72 divide-y overflow-y-auto text-xs", "data-table-clean-groups": "", children: plan.byOperation.map((group) => /* @__PURE__ */ jsxs69("div", { className: "flex flex-col gap-1 px-3 py-1.5", "data-table-clean-group": group.id, children: [
23605
+ /* @__PURE__ */ jsxs69("span", { className: "flex items-center gap-2 font-medium", children: [
23606
+ /* @__PURE__ */ jsx75("span", { className: "flex-1", children: group.label }),
23607
+ /* @__PURE__ */ jsx75("span", { className: "tabular-nums text-muted-foreground", children: group.cells.length })
23470
23608
  ] }),
23471
- group.cells.slice(0, 3).map((c) => /* @__PURE__ */ jsxs68("span", { className: "grid grid-cols-[6rem_1fr_1fr] gap-2", children: [
23472
- /* @__PURE__ */ jsx74("span", { className: "truncate text-muted-foreground", children: nameOf3(c.key) }),
23473
- /* @__PURE__ */ jsx74("span", { className: "truncate text-muted-foreground line-through", children: c.before }),
23474
- /* @__PURE__ */ jsx74("span", { className: "truncate", children: c.after })
23609
+ group.cells.slice(0, 3).map((c) => /* @__PURE__ */ jsxs69("span", { className: "grid grid-cols-[6rem_1fr_1fr] gap-2", children: [
23610
+ /* @__PURE__ */ jsx75("span", { className: "truncate text-muted-foreground", children: nameOf3(c.key) }),
23611
+ /* @__PURE__ */ jsx75("span", { className: "truncate text-muted-foreground line-through", children: c.before }),
23612
+ /* @__PURE__ */ jsx75("span", { className: "truncate", children: c.after })
23475
23613
  ] }, `${c.rowId}:${c.key}`)),
23476
- group.cells.length > 3 ? /* @__PURE__ */ jsxs68("span", { className: "text-muted-foreground", children: [
23614
+ group.cells.length > 3 ? /* @__PURE__ */ jsxs69("span", { className: "text-muted-foreground", children: [
23477
23615
  "+",
23478
23616
  group.cells.length - 3,
23479
23617
  " more"
23480
23618
  ] }) : null
23481
23619
  ] }, group.id)) })
23482
- ) : /* @__PURE__ */ jsxs68("ul", { className: "divide-y text-xs", children: [
23483
- plan.cells.slice(0, SHOWN).map((c) => /* @__PURE__ */ jsxs68("li", { className: "grid grid-cols-2 gap-2 px-3 py-1.5", children: [
23484
- /* @__PURE__ */ jsx74("span", { className: "truncate text-muted-foreground line-through", children: c.before }),
23485
- /* @__PURE__ */ jsx74("span", { className: "truncate", children: c.after })
23620
+ ) : /* @__PURE__ */ jsxs69("ul", { className: "divide-y text-xs", children: [
23621
+ plan.cells.slice(0, SHOWN).map((c) => /* @__PURE__ */ jsxs69("li", { className: "grid grid-cols-2 gap-2 px-3 py-1.5", children: [
23622
+ /* @__PURE__ */ jsx75("span", { className: "truncate text-muted-foreground line-through", children: c.before }),
23623
+ /* @__PURE__ */ jsx75("span", { className: "truncate", children: c.after })
23486
23624
  ] }, c.rowId)),
23487
- plan.cells.length > SHOWN ? /* @__PURE__ */ jsxs68("li", { className: "px-3 py-1.5 text-muted-foreground", children: [
23625
+ plan.cells.length > SHOWN ? /* @__PURE__ */ jsxs69("li", { className: "px-3 py-1.5 text-muted-foreground", children: [
23488
23626
  "+",
23489
23627
  plan.cells.length - SHOWN,
23490
23628
  " more"
23491
23629
  ] }) : null
23492
23630
  ] }) })
23493
23631
  ] }),
23494
- /* @__PURE__ */ jsxs68(DialogFooter6, { children: [
23495
- /* @__PURE__ */ jsx74(Button42, { variant: "ghost", onClick: onClose, disabled: busy, children: "Cancel" }),
23496
- /* @__PURE__ */ jsx74(Button42, { onClick: () => void apply(), disabled: busy || !plan || plan.cells.length === 0, "data-column-clean-apply": "", children: plan && plan.cells.length > 0 ? `Clean ${plan.cells.length} ${plan.cells.length === 1 ? "cell" : "cells"}` : "Clean" })
23632
+ /* @__PURE__ */ jsxs69(DialogFooter6, { children: [
23633
+ /* @__PURE__ */ jsx75(Button42, { variant: "ghost", onClick: onClose, disabled: busy, children: "Cancel" }),
23634
+ /* @__PURE__ */ jsx75(Button42, { onClick: () => void apply(), disabled: busy || !plan || plan.cells.length === 0, "data-column-clean-apply": "", children: plan && plan.cells.length > 0 ? `Clean ${plan.cells.length} ${plan.cells.length === 1 ? "cell" : "cells"}` : "Clean" })
23497
23635
  ] })
23498
23636
  ] }) });
23499
23637
  }
@@ -23516,7 +23654,7 @@ import {
23516
23654
  Label as Label15
23517
23655
  } from "@ai-matrx/design-system";
23518
23656
  init_plainWords();
23519
- import { jsx as jsx75, jsxs as jsxs69 } from "react/jsx-runtime";
23657
+ import { jsx as jsx76, jsxs as jsxs70 } from "react/jsx-runtime";
23520
23658
  function NewFromTemplateMenu(props) {
23521
23659
  const client = useRecordsClient34();
23522
23660
  const [templates, setTemplates] = useState60(null);
@@ -23524,9 +23662,9 @@ function NewFromTemplateMenu(props) {
23524
23662
  setTemplates(null);
23525
23663
  void client.rowTemplates({ table_id: props.tableId }).then((answer) => setTemplates(answer.ok ? answer.data : []));
23526
23664
  }, [client, props.tableId]);
23527
- return /* @__PURE__ */ jsxs69(DropdownMenu3, { onOpenChange: (open) => open ? read() : void 0, children: [
23528
- /* @__PURE__ */ jsx75(DropdownMenuTrigger3, { asChild: true, children: /* @__PURE__ */ jsx75(Button43, { size: "sm", variant: "outline", className: "shrink-0", disabled: props.busy, "data-records-new-from-template": "", children: "From template" }) }),
23529
- /* @__PURE__ */ jsx75(DropdownMenuContent3, { align: "end", className: "text-xs", children: templates === null ? /* @__PURE__ */ jsx75(DropdownMenuItem3, { disabled: true, className: "text-xs", children: "Reading templates\u2026" }) : templates.length === 0 ? /* @__PURE__ */ jsx75(DropdownMenuItem3, { disabled: true, className: "text-xs", children: "No templates yet. Save a row as one from its menu." }) : templates.map((t) => /* @__PURE__ */ jsx75(DropdownMenuItem3, { className: "text-xs", onSelect: () => props.onPick({ ...t.values }), children: t.name }, t.template_id)) })
23665
+ return /* @__PURE__ */ jsxs70(DropdownMenu3, { onOpenChange: (open) => open ? read() : void 0, children: [
23666
+ /* @__PURE__ */ jsx76(DropdownMenuTrigger3, { asChild: true, children: /* @__PURE__ */ jsx76(Button43, { size: "sm", variant: "outline", className: "shrink-0", disabled: props.busy, "data-records-new-from-template": "", children: "From template" }) }),
23667
+ /* @__PURE__ */ jsx76(DropdownMenuContent3, { align: "end", className: "text-xs", children: templates === null ? /* @__PURE__ */ jsx76(DropdownMenuItem3, { disabled: true, className: "text-xs", children: "Reading templates\u2026" }) : templates.length === 0 ? /* @__PURE__ */ jsx76(DropdownMenuItem3, { disabled: true, className: "text-xs", children: "No templates yet. Save a row as one from its menu." }) : templates.map((t) => /* @__PURE__ */ jsx76(DropdownMenuItem3, { className: "text-xs", onSelect: () => props.onPick({ ...t.values }), children: t.name }, t.template_id)) })
23530
23668
  ] });
23531
23669
  }
23532
23670
  function templateValuesOf(row, fields, titleField) {
@@ -23562,9 +23700,9 @@ function SaveAsTemplateDialog(props) {
23562
23700
  props.notify?.success(`Saved template ${name.trim()}.`);
23563
23701
  props.onClose();
23564
23702
  };
23565
- return /* @__PURE__ */ jsx75(Dialog11, { open: props.row !== null, onOpenChange: (open) => !open ? props.onClose() : void 0, children: /* @__PURE__ */ jsxs69(DialogContent11, { className: "sm:max-w-sm", children: [
23566
- /* @__PURE__ */ jsx75(DialogHeader11, { children: /* @__PURE__ */ jsx75(DialogTitle11, { children: "Save as template" }) }),
23567
- /* @__PURE__ */ jsxs69(
23703
+ return /* @__PURE__ */ jsx76(Dialog11, { open: props.row !== null, onOpenChange: (open) => !open ? props.onClose() : void 0, children: /* @__PURE__ */ jsxs70(DialogContent11, { className: "sm:max-w-sm", children: [
23704
+ /* @__PURE__ */ jsx76(DialogHeader11, { children: /* @__PURE__ */ jsx76(DialogTitle11, { children: "Save as template" }) }),
23705
+ /* @__PURE__ */ jsxs70(
23568
23706
  "form",
23569
23707
  {
23570
23708
  className: "flex flex-col gap-2",
@@ -23573,12 +23711,12 @@ function SaveAsTemplateDialog(props) {
23573
23711
  void save();
23574
23712
  },
23575
23713
  children: [
23576
- /* @__PURE__ */ jsx75(Label15, { className: "text-xs", htmlFor: "records-grid-template-name", children: "Template name" }),
23577
- /* @__PURE__ */ jsx75(BasicInput16, { id: "records-grid-template-name", autoFocus: true, value: name, onChange: (e) => setName(e.target.value) }),
23578
- refused ? /* @__PURE__ */ jsx75("p", { className: "text-xs text-destructive", children: refused }) : null,
23579
- /* @__PURE__ */ jsxs69(DialogFooter7, { children: [
23580
- /* @__PURE__ */ jsx75(Button43, { type: "button", variant: "ghost", size: "sm", onClick: props.onClose, children: "Cancel" }),
23581
- /* @__PURE__ */ jsx75(Button43, { type: "submit", size: "sm", disabled: busy || name.trim() === "", children: "Save" })
23714
+ /* @__PURE__ */ jsx76(Label15, { className: "text-xs", htmlFor: "records-grid-template-name", children: "Template name" }),
23715
+ /* @__PURE__ */ jsx76(BasicInput16, { id: "records-grid-template-name", autoFocus: true, value: name, onChange: (e) => setName(e.target.value) }),
23716
+ refused ? /* @__PURE__ */ jsx76("p", { className: "text-xs text-destructive", children: refused }) : null,
23717
+ /* @__PURE__ */ jsxs70(DialogFooter7, { children: [
23718
+ /* @__PURE__ */ jsx76(Button43, { type: "button", variant: "ghost", size: "sm", onClick: props.onClose, children: "Cancel" }),
23719
+ /* @__PURE__ */ jsx76(Button43, { type: "submit", size: "sm", disabled: busy || name.trim() === "", children: "Save" })
23582
23720
  ] })
23583
23721
  ]
23584
23722
  }
@@ -23601,7 +23739,7 @@ import {
23601
23739
  DialogTitle as DialogTitle12
23602
23740
  } from "@ai-matrx/design-system";
23603
23741
  init_host();
23604
- import { jsx as jsx76, jsxs as jsxs70 } from "react/jsx-runtime";
23742
+ import { jsx as jsx77, jsxs as jsxs71 } from "react/jsx-runtime";
23605
23743
  function isTextColumn(field2) {
23606
23744
  if (!field2) return false;
23607
23745
  const kind2 = editorKindFor(field2);
@@ -23649,22 +23787,22 @@ function WholeTextDialog({
23649
23787
  if (draft !== startingText) onSave(target.rowId, target.key, draft === "" ? null : draft);
23650
23788
  onClose();
23651
23789
  };
23652
- return /* @__PURE__ */ jsx76(Dialog12, { open, onOpenChange: (next) => !next ? onClose() : void 0, children: /* @__PURE__ */ jsxs70(DialogContent12, { className: "sm:max-w-2xl", "data-records-whole-text": "", children: [
23653
- /* @__PURE__ */ jsxs70(DialogHeader12, { children: [
23654
- /* @__PURE__ */ jsx76(DialogTitle12, { children: title }),
23655
- /* @__PURE__ */ jsxs70(DialogDescription8, { children: [
23790
+ return /* @__PURE__ */ jsx77(Dialog12, { open, onOpenChange: (next) => !next ? onClose() : void 0, children: /* @__PURE__ */ jsxs71(DialogContent12, { className: "sm:max-w-2xl", "data-records-whole-text": "", children: [
23791
+ /* @__PURE__ */ jsxs71(DialogHeader12, { children: [
23792
+ /* @__PURE__ */ jsx77(DialogTitle12, { children: title }),
23793
+ /* @__PURE__ */ jsxs71(DialogDescription8, { children: [
23656
23794
  target ? `${target.rowTitle} \xB7 ` : "",
23657
23795
  mayWrite ? "Cmd-Enter saves, Escape closes without saving." : whyNot
23658
23796
  ] })
23659
23797
  ] }),
23660
- ready && renderText ? /* @__PURE__ */ jsxs70("div", { className: "flex items-center gap-1", role: "tablist", "aria-label": "How the text shows", children: [
23661
- /* @__PURE__ */ jsx76(Button44, { size: "sm", variant: reading ? "ghost" : "secondary", role: "tab", "aria-selected": !reading, onClick: () => setReading(false), "data-records-whole-text-mode": "words", children: mayWrite ? "Edit" : "Words" }),
23662
- /* @__PURE__ */ jsx76(Button44, { size: "sm", variant: reading ? "secondary" : "ghost", role: "tab", "aria-selected": reading, onClick: () => setReading(true), "data-records-whole-text-mode": "preview", children: "Preview" })
23798
+ ready && renderText ? /* @__PURE__ */ jsxs71("div", { className: "flex items-center gap-1", role: "tablist", "aria-label": "How the text shows", children: [
23799
+ /* @__PURE__ */ jsx77(Button44, { size: "sm", variant: reading ? "ghost" : "secondary", role: "tab", "aria-selected": !reading, onClick: () => setReading(false), "data-records-whole-text-mode": "words", children: mayWrite ? "Edit" : "Words" }),
23800
+ /* @__PURE__ */ jsx77(Button44, { size: "sm", variant: reading ? "secondary" : "ghost", role: "tab", "aria-selected": reading, onClick: () => setReading(true), "data-records-whole-text-mode": "preview", children: "Preview" })
23663
23801
  ] }) : null,
23664
- ready && reading && renderText ? /* @__PURE__ */ jsx76("div", { className: "max-h-[60vh] min-h-[8rem] overflow-auto rounded-md border px-3 py-2 text-sm", "data-records-whole-text-preview": "", children: draft ? renderText(draft, "cell") : /* @__PURE__ */ jsx76("span", { className: "text-muted-foreground", children: "\u2014" }) }) : ready && textBox ? (
23802
+ ready && reading && renderText ? /* @__PURE__ */ jsx77("div", { className: "max-h-[60vh] min-h-[8rem] overflow-auto rounded-md border px-3 py-2 text-sm", "data-records-whole-text-preview": "", children: draft ? renderText(draft, "cell") : /* @__PURE__ */ jsx77("span", { className: "text-muted-foreground", children: "\u2014" }) }) : ready && textBox ? (
23665
23803
  // THE HOST'S TEXT BOX (`textBox`): the same words, with its "…" menu (Clean up, Help with
23666
23804
  // this…, Copy, Save, Share). What its menu puts in the box is unsaved until Save.
23667
- /* @__PURE__ */ jsx76("div", { "data-records-whole-text-box": "", children: textBox({
23805
+ /* @__PURE__ */ jsx77("div", { "data-records-whole-text-box": "", children: textBox({
23668
23806
  value: draft ?? "",
23669
23807
  onChange: (next) => {
23670
23808
  setDraft(next);
@@ -23682,7 +23820,7 @@ function WholeTextDialog({
23682
23820
  }
23683
23821
  }
23684
23822
  }) })
23685
- ) : ready ? /* @__PURE__ */ jsx76(
23823
+ ) : ready ? /* @__PURE__ */ jsx77(
23686
23824
  BasicTextarea7,
23687
23825
  {
23688
23826
  autoFocus: true,
@@ -23702,10 +23840,10 @@ function WholeTextDialog({
23702
23840
  }
23703
23841
  }
23704
23842
  }
23705
- ) : /* @__PURE__ */ jsx76("p", { className: "text-sm text-muted-foreground", "data-records-whole-text-state": whole.state, children: target?.pointer ? whole.state === "loading" ? wholeValueOpening(target.pointer) : whole.state === "failed" ? `The whole text could not be opened (${whole.why}).` : WHOLE_VALUE_NOT_EDITABLE_HERE : null }),
23706
- cleanNote ? /* @__PURE__ */ jsx76("p", { className: "text-xs text-muted-foreground", children: cleanNote }) : null,
23707
- /* @__PURE__ */ jsxs70(DialogFooter8, { className: "gap-2", children: [
23708
- canClean && mayWrite ? /* @__PURE__ */ jsx76(
23843
+ ) : /* @__PURE__ */ jsx77("p", { className: "text-sm text-muted-foreground", "data-records-whole-text-state": whole.state, children: target?.pointer ? whole.state === "loading" ? wholeValueOpening(target.pointer) : whole.state === "failed" ? `The whole text could not be opened (${whole.why}).` : WHOLE_VALUE_NOT_EDITABLE_HERE : null }),
23844
+ cleanNote ? /* @__PURE__ */ jsx77("p", { className: "text-xs text-muted-foreground", children: cleanNote }) : null,
23845
+ /* @__PURE__ */ jsxs71(DialogFooter8, { className: "gap-2", children: [
23846
+ canClean && mayWrite ? /* @__PURE__ */ jsx77(
23709
23847
  Button44,
23710
23848
  {
23711
23849
  variant: "outline",
@@ -23719,8 +23857,8 @@ function WholeTextDialog({
23719
23857
  children: "Clean HTML"
23720
23858
  }
23721
23859
  ) : null,
23722
- /* @__PURE__ */ jsx76(Button44, { variant: "ghost", onClick: onClose, children: mayWrite ? "Cancel" : "Close" }),
23723
- mayWrite && ready ? /* @__PURE__ */ jsx76(Button44, { onClick: save, "data-records-whole-text-save": "", children: "Save" }) : null
23860
+ /* @__PURE__ */ jsx77(Button44, { variant: "ghost", onClick: onClose, children: mayWrite ? "Cancel" : "Close" }),
23861
+ mayWrite && ready ? /* @__PURE__ */ jsx77(Button44, { onClick: save, "data-records-whole-text-save": "", children: "Save" }) : null
23724
23862
  ] })
23725
23863
  ] }) });
23726
23864
  }
@@ -23731,7 +23869,7 @@ init_parity();
23731
23869
  init_pasteValues();
23732
23870
  init_host();
23733
23871
  init_plainWords();
23734
- import { Fragment as Fragment24, jsx as jsx77, jsxs as jsxs71 } from "react/jsx-runtime";
23872
+ import { Fragment as Fragment25, jsx as jsx78, jsxs as jsxs72 } from "react/jsx-runtime";
23735
23873
  var VALUE_COUNTS_FRESH_MS = 1e4;
23736
23874
  var CLEAN_TABLE_LABEL = "Clean table\u2026";
23737
23875
  function filterForValue(field2, value) {
@@ -24296,7 +24434,7 @@ function useMergedGridControls(args) {
24296
24434
  [enabled, order, hidden, keepColumns]
24297
24435
  );
24298
24436
  const close = () => setDialog(null);
24299
- const dialogs = !enabled ? null : /* @__PURE__ */ jsxs71(Fragment24, { children: [
24437
+ const dialogs = !enabled ? null : /* @__PURE__ */ jsxs72(Fragment25, { children: [
24300
24438
  colours.dialogs,
24301
24439
  dialog?.kind === "access" && columnAccess ? columnAccess({
24302
24440
  tableId,
@@ -24305,8 +24443,8 @@ function useMergedGridControls(args) {
24305
24443
  onClose: () => setDialog(null),
24306
24444
  onChanged: () => tableShapeChanged6(tableId)
24307
24445
  }) : null,
24308
- /* @__PURE__ */ jsx77(RowActionsDialog, { tableId, open: rowActionsOpen, onOpenChange: setRowActionsOpen }),
24309
- /* @__PURE__ */ jsx77(
24446
+ /* @__PURE__ */ jsx78(RowActionsDialog, { tableId, open: rowActionsOpen, onOpenChange: setRowActionsOpen }),
24447
+ /* @__PURE__ */ jsx78(
24310
24448
  RowLabelPicker,
24311
24449
  {
24312
24450
  open: labelling,
@@ -24321,7 +24459,7 @@ function useMergedGridControls(args) {
24321
24459
  notify
24322
24460
  }
24323
24461
  ),
24324
- /* @__PURE__ */ jsx77(
24462
+ /* @__PURE__ */ jsx78(
24325
24463
  SaveAsTemplateDialog,
24326
24464
  {
24327
24465
  tableId,
@@ -24332,12 +24470,12 @@ function useMergedGridControls(args) {
24332
24470
  notify
24333
24471
  }
24334
24472
  ),
24335
- /* @__PURE__ */ jsx77(Dialog13, { open: dialog?.kind === "rename", onOpenChange: (open) => !open ? close() : void 0, children: /* @__PURE__ */ jsxs71(DialogContent13, { className: "sm:max-w-sm", children: [
24336
- /* @__PURE__ */ jsxs71(DialogHeader13, { children: [
24337
- /* @__PURE__ */ jsx77(DialogTitle13, { children: "Rename column" }),
24338
- /* @__PURE__ */ jsx77(DialogDescription9, { children: "The name people read at the top of the column. What it holds does not change." })
24473
+ /* @__PURE__ */ jsx78(Dialog13, { open: dialog?.kind === "rename", onOpenChange: (open) => !open ? close() : void 0, children: /* @__PURE__ */ jsxs72(DialogContent13, { className: "sm:max-w-sm", children: [
24474
+ /* @__PURE__ */ jsxs72(DialogHeader13, { children: [
24475
+ /* @__PURE__ */ jsx78(DialogTitle13, { children: "Rename column" }),
24476
+ /* @__PURE__ */ jsx78(DialogDescription9, { children: "The name people read at the top of the column. What it holds does not change." })
24339
24477
  ] }),
24340
- /* @__PURE__ */ jsxs71(
24478
+ /* @__PURE__ */ jsxs72(
24341
24479
  "form",
24342
24480
  {
24343
24481
  className: "flex flex-col gap-2",
@@ -24358,18 +24496,18 @@ function useMergedGridControls(args) {
24358
24496
  });
24359
24497
  },
24360
24498
  children: [
24361
- /* @__PURE__ */ jsx77(Label16, { className: "text-xs", htmlFor: "records-grid-rename", children: "Name" }),
24362
- /* @__PURE__ */ jsx77(BasicInput17, { id: "records-grid-rename", autoFocus: true, value: renameTo, onChange: (e) => setRenameTo(e.target.value) }),
24363
- mutation.error ? /* @__PURE__ */ jsx77(RefusalNotice, { error: mutation.error }) : null,
24364
- /* @__PURE__ */ jsxs71(DialogFooter9, { children: [
24365
- /* @__PURE__ */ jsx77(Button45, { type: "button", variant: "ghost", size: "sm", onClick: close, children: "Cancel" }),
24366
- /* @__PURE__ */ jsx77(Button45, { type: "submit", size: "sm", disabled: renameTo.trim() === "", children: "Rename" })
24499
+ /* @__PURE__ */ jsx78(Label16, { className: "text-xs", htmlFor: "records-grid-rename", children: "Name" }),
24500
+ /* @__PURE__ */ jsx78(BasicInput17, { id: "records-grid-rename", autoFocus: true, value: renameTo, onChange: (e) => setRenameTo(e.target.value) }),
24501
+ mutation.error ? /* @__PURE__ */ jsx78(RefusalNotice, { error: mutation.error }) : null,
24502
+ /* @__PURE__ */ jsxs72(DialogFooter9, { children: [
24503
+ /* @__PURE__ */ jsx78(Button45, { type: "button", variant: "ghost", size: "sm", onClick: close, children: "Cancel" }),
24504
+ /* @__PURE__ */ jsx78(Button45, { type: "submit", size: "sm", disabled: renameTo.trim() === "", children: "Rename" })
24367
24505
  ] })
24368
24506
  ]
24369
24507
  }
24370
24508
  )
24371
24509
  ] }) }),
24372
- /* @__PURE__ */ jsx77(
24510
+ /* @__PURE__ */ jsx78(
24373
24511
  Dialog13,
24374
24512
  {
24375
24513
  open: dialog?.kind === "settings" || dialog?.kind === "insert",
@@ -24379,12 +24517,12 @@ function useMergedGridControls(args) {
24379
24517
  close();
24380
24518
  }
24381
24519
  },
24382
- children: /* @__PURE__ */ jsxs71(DialogContent13, { className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl", children: [
24383
- /* @__PURE__ */ jsxs71(DialogHeader13, { children: [
24384
- /* @__PURE__ */ jsx77(DialogTitle13, { children: columnDialog?.kind === "settings" ? `Column settings \xB7 ${fieldName(columnDialog.field)}` : columnDialog?.kind === "insert" && columnDialog.anchor ? `Add column ${columnDialog.side === "left" ? "left" : "right"} of ${fieldOf2(columnDialog.anchor) ? fieldName(fieldOf2(columnDialog.anchor)) : columnDialog.anchor}` : ADD_FIELD_OPEN_LABEL }),
24385
- /* @__PURE__ */ jsx77(DialogDescription9, { className: "sr-only", children: "Name, type and look" })
24520
+ children: /* @__PURE__ */ jsxs72(DialogContent13, { className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl", children: [
24521
+ /* @__PURE__ */ jsxs72(DialogHeader13, { children: [
24522
+ /* @__PURE__ */ jsx78(DialogTitle13, { children: columnDialog?.kind === "settings" ? `Column settings \xB7 ${fieldName(columnDialog.field)}` : columnDialog?.kind === "insert" && columnDialog.anchor ? `Add column ${columnDialog.side === "left" ? "left" : "right"} of ${fieldOf2(columnDialog.anchor) ? fieldName(fieldOf2(columnDialog.anchor)) : columnDialog.anchor}` : ADD_FIELD_OPEN_LABEL }),
24523
+ /* @__PURE__ */ jsx78(DialogDescription9, { className: "sr-only", children: "Name, type and look" })
24386
24524
  ] }),
24387
- columnDialog?.kind === "settings" ? /* @__PURE__ */ jsx77(
24525
+ columnDialog?.kind === "settings" ? /* @__PURE__ */ jsx78(
24388
24526
  FieldEditor,
24389
24527
  {
24390
24528
  tableId,
@@ -24401,7 +24539,7 @@ function useMergedGridControls(args) {
24401
24539
  onCancel: close
24402
24540
  },
24403
24541
  `${columnDialog.field.id}-${insertEpoch.current}`
24404
- ) : columnDialog?.kind === "insert" ? /* @__PURE__ */ jsx77(
24542
+ ) : columnDialog?.kind === "insert" ? /* @__PURE__ */ jsx78(
24405
24543
  FieldEditor,
24406
24544
  {
24407
24545
  tableId,
@@ -24419,7 +24557,7 @@ function useMergedGridControls(args) {
24419
24557
  ] })
24420
24558
  }
24421
24559
  ),
24422
- dialog?.kind === "merge" ? /* @__PURE__ */ jsx77(
24560
+ dialog?.kind === "merge" ? /* @__PURE__ */ jsx78(
24423
24561
  MergeRecordDialog,
24424
24562
  {
24425
24563
  tableId,
@@ -24430,7 +24568,7 @@ function useMergedGridControls(args) {
24430
24568
  }
24431
24569
  }
24432
24570
  ) : null,
24433
- dialog?.kind === "split" ? /* @__PURE__ */ jsx77(
24571
+ dialog?.kind === "split" ? /* @__PURE__ */ jsx78(
24434
24572
  SplitRecordDialog,
24435
24573
  {
24436
24574
  tableId,
@@ -24442,7 +24580,7 @@ function useMergedGridControls(args) {
24442
24580
  }
24443
24581
  }
24444
24582
  ) : null,
24445
- dialog?.kind === "extract-parent" ? /* @__PURE__ */ jsx77(
24583
+ dialog?.kind === "extract-parent" ? /* @__PURE__ */ jsx78(
24446
24584
  ExtractParentDialog,
24447
24585
  {
24448
24586
  tableId,
@@ -24454,7 +24592,7 @@ function useMergedGridControls(args) {
24454
24592
  }
24455
24593
  }
24456
24594
  ) : null,
24457
- /* @__PURE__ */ jsx77(
24595
+ /* @__PURE__ */ jsx78(
24458
24596
  Dialog13,
24459
24597
  {
24460
24598
  modal: true,
@@ -24462,18 +24600,18 @@ function useMergedGridControls(args) {
24462
24600
  onOpenChange: (open) => {
24463
24601
  if (!open) close();
24464
24602
  },
24465
- children: /* @__PURE__ */ jsxs71(DialogContent13, { className: "sm:max-w-lg", children: [
24466
- /* @__PURE__ */ jsxs71(DialogHeader13, { children: [
24467
- /* @__PURE__ */ jsx77(DialogTitle13, { children: dialog?.kind === "retype" ? `Change type \xB7 ${fieldName(dialog.field)}` : "Change type" }),
24468
- /* @__PURE__ */ jsx77(DialogDescription9, { children: "Values that fit convert. The rest stay with their records, in History." })
24603
+ children: /* @__PURE__ */ jsxs72(DialogContent13, { className: "sm:max-w-lg", children: [
24604
+ /* @__PURE__ */ jsxs72(DialogHeader13, { children: [
24605
+ /* @__PURE__ */ jsx78(DialogTitle13, { children: dialog?.kind === "retype" ? `Change type \xB7 ${fieldName(dialog.field)}` : "Change type" }),
24606
+ /* @__PURE__ */ jsx78(DialogDescription9, { children: "Values that fit convert. The rest stay with their records, in History." })
24469
24607
  ] }),
24470
- dialog?.kind === "retype" ? /* @__PURE__ */ jsx77(FieldRetype, { field: dialog.field, tableId }, dialog.field.id) : null
24608
+ dialog?.kind === "retype" ? /* @__PURE__ */ jsx78(FieldRetype, { field: dialog.field, tableId }, dialog.field.id) : null
24471
24609
  ] })
24472
24610
  }
24473
24611
  ),
24474
- dialog?.kind === "cleanTable" && args.bulkApply ? /* @__PURE__ */ jsx77(ColumnCleanDialog, { tableId, fields: fields.filter((f) => isTextColumn(f) && fieldIsEditable(f)), onApply: args.bulkApply, onClose: close, notify }) : null,
24475
- dialog?.kind === "clean" && args.bulkApply ? /* @__PURE__ */ jsx77(ColumnCleanDialog, { tableId, field: dialog.field, ...dialog.row ? { row: dialog.row } : {}, onApply: args.bulkApply, onClose: close, notify }) : null,
24476
- /* @__PURE__ */ jsx77(
24612
+ dialog?.kind === "cleanTable" && args.bulkApply ? /* @__PURE__ */ jsx78(ColumnCleanDialog, { tableId, fields: fields.filter((f) => isTextColumn(f) && fieldIsEditable(f)), onApply: args.bulkApply, onClose: close, notify }) : null,
24613
+ dialog?.kind === "clean" && args.bulkApply ? /* @__PURE__ */ jsx78(ColumnCleanDialog, { tableId, field: dialog.field, ...dialog.row ? { row: dialog.row } : {}, onApply: args.bulkApply, onClose: close, notify }) : null,
24614
+ /* @__PURE__ */ jsx78(
24477
24615
  ConfirmDialog3,
24478
24616
  {
24479
24617
  open: dialog?.kind === "backlink",
@@ -24501,7 +24639,7 @@ function useMergedGridControls(args) {
24501
24639
  }
24502
24640
  }
24503
24641
  ),
24504
- /* @__PURE__ */ jsx77(
24642
+ /* @__PURE__ */ jsx78(
24505
24643
  ConfirmDialog3,
24506
24644
  {
24507
24645
  open: dialog?.kind === "delete",
@@ -24536,9 +24674,9 @@ function useMergedGridControls(args) {
24536
24674
  columns: columnsControl,
24537
24675
  dialogs,
24538
24676
  addColumn: () => setDialog({ kind: "insert", anchor: null, side: "right" }),
24539
- sheetTools: enabled ? /* @__PURE__ */ jsxs71(Fragment24, { children: [
24677
+ sheetTools: enabled ? /* @__PURE__ */ jsxs72(Fragment25, { children: [
24540
24678
  colours.sheet,
24541
- args.summaries ? /* @__PURE__ */ jsx77(
24679
+ args.summaries ? /* @__PURE__ */ jsx78(
24542
24680
  SummarySheetControls,
24543
24681
  {
24544
24682
  fields: order.filter((k) => !hidden.includes(k)).map(fieldOf2).filter((f) => Boolean(f)),
@@ -24637,7 +24775,7 @@ init_Refusal();
24637
24775
  import { Button as Button46, Separator as Separator3, cn as cn41 } from "@ai-matrx/design-system";
24638
24776
  import { mapPgError } from "@ai-matrx/records/core";
24639
24777
  init_plainWords();
24640
- import { jsx as jsx78, jsxs as jsxs72 } from "react/jsx-runtime";
24778
+ import { jsx as jsx79, jsxs as jsxs73 } from "react/jsx-runtime";
24641
24779
  function isEmptyValue(value) {
24642
24780
  return value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0;
24643
24781
  }
@@ -24871,11 +25009,11 @@ function CustomFieldsSection({
24871
25009
  if (!read.loading && !read.error && fields.length === 0 && !mayAdd && !rights.data) return null;
24872
25010
  const storeReason = rights.data?.reason ?? null;
24873
25011
  const reason = storeReason && entityLabel && rights.data?.label ? storeReason.split(rights.data.label).join(entityLabel) : storeReason;
24874
- const cannotAdd = rights.data && !rights.data.may_declare ? /* @__PURE__ */ jsxs72("div", { className: "flex min-w-0 flex-wrap items-center gap-2", "data-records-custom-fields-cannot-add": "", children: [
24875
- reason ? /* @__PURE__ */ jsx78("p", { className: "min-w-0 text-[11px] text-muted-foreground", children: reason }) : null,
24876
- onMakeOwnTable ? /* @__PURE__ */ jsx78(Button46, { size: "sm", variant: "ghost", className: "ml-auto", onClick: onMakeOwnTable, children: "Make your own table" }) : null
25012
+ const cannotAdd = rights.data && !rights.data.may_declare ? /* @__PURE__ */ jsxs73("div", { className: "flex min-w-0 flex-wrap items-center gap-2", "data-records-custom-fields-cannot-add": "", children: [
25013
+ reason ? /* @__PURE__ */ jsx79("p", { className: "min-w-0 text-[11px] text-muted-foreground", children: reason }) : null,
25014
+ onMakeOwnTable ? /* @__PURE__ */ jsx79(Button46, { size: "sm", variant: "ghost", className: "ml-auto", onClick: onMakeOwnTable, children: "Make your own table" }) : null
24877
25015
  ] }) : null;
24878
- const editor = adding ? /* @__PURE__ */ jsx78(
25016
+ const editor = adding ? /* @__PURE__ */ jsx79(
24879
25017
  FieldEditor,
24880
25018
  {
24881
25019
  entityToken,
@@ -24887,24 +25025,24 @@ function CustomFieldsSection({
24887
25025
  onCancel: () => setAdding(false)
24888
25026
  }
24889
25027
  ) : null;
24890
- if (read.error) return /* @__PURE__ */ jsx78(RefusalLine, { error: read.error, className });
25028
+ if (read.error) return /* @__PURE__ */ jsx79(RefusalLine, { error: read.error, className });
24891
25029
  const values = read.data?.custom ?? {};
24892
25030
  const empty = fields.length === 0;
24893
25031
  if (empty && !adding) {
24894
- return /* @__PURE__ */ jsxs72("section", { className: cn41("flex min-w-0 flex-col gap-1 text-xs", className), children: [
24895
- /* @__PURE__ */ jsxs72("div", { className: "flex min-w-0 items-center gap-2", children: [
24896
- /* @__PURE__ */ jsx78("h3", { className: "text-sm font-medium", children: title }),
24897
- !read.loading ? /* @__PURE__ */ jsx78("span", { className: "text-muted-foreground", children: "None yet" }) : null,
24898
- mayAdd ? /* @__PURE__ */ jsx78(Button46, { size: "sm", variant: "ghost", className: "ml-auto", onClick: () => setAdding(true), children: "Add field" }) : null
25032
+ return /* @__PURE__ */ jsxs73("section", { className: cn41("flex min-w-0 flex-col gap-1 text-xs", className), children: [
25033
+ /* @__PURE__ */ jsxs73("div", { className: "flex min-w-0 items-center gap-2", children: [
25034
+ /* @__PURE__ */ jsx79("h3", { className: "text-sm font-medium", children: title }),
25035
+ !read.loading ? /* @__PURE__ */ jsx79("span", { className: "text-muted-foreground", children: "None yet" }) : null,
25036
+ mayAdd ? /* @__PURE__ */ jsx79(Button46, { size: "sm", variant: "ghost", className: "ml-auto", onClick: () => setAdding(true), children: "Add field" }) : null
24899
25037
  ] }),
24900
25038
  cannotAdd
24901
25039
  ] });
24902
25040
  }
24903
- return /* @__PURE__ */ jsxs72("section", { className: cn41("flex min-w-0 flex-col gap-2 text-xs", className), children: [
24904
- /* @__PURE__ */ jsxs72("div", { className: "flex items-center gap-2", children: [
24905
- /* @__PURE__ */ jsx78("h3", { className: "text-sm font-medium", children: title }),
24906
- !empty ? /* @__PURE__ */ jsx78("span", { className: "text-muted-foreground", children: fields.length }) : null,
24907
- fields.length > 0 ? /* @__PURE__ */ jsx78(
25041
+ return /* @__PURE__ */ jsxs73("section", { className: cn41("flex min-w-0 flex-col gap-2 text-xs", className), children: [
25042
+ /* @__PURE__ */ jsxs73("div", { className: "flex items-center gap-2", children: [
25043
+ /* @__PURE__ */ jsx79("h3", { className: "text-sm font-medium", children: title }),
25044
+ !empty ? /* @__PURE__ */ jsx79("span", { className: "text-muted-foreground", children: fields.length }) : null,
25045
+ fields.length > 0 ? /* @__PURE__ */ jsx79(
24908
25046
  Button46,
24909
25047
  {
24910
25048
  size: "sm",
@@ -24918,7 +25056,7 @@ function CustomFieldsSection({
24918
25056
  children: editing ? "Cancel" : "Edit"
24919
25057
  }
24920
25058
  ) : null,
24921
- mayAdd && !editing && !adding ? /* @__PURE__ */ jsx78(
25059
+ mayAdd && !editing && !adding ? /* @__PURE__ */ jsx79(
24922
25060
  Button46,
24923
25061
  {
24924
25062
  size: "sm",
@@ -24928,7 +25066,7 @@ function CustomFieldsSection({
24928
25066
  children: "Add field"
24929
25067
  }
24930
25068
  ) : null,
24931
- editing ? /* @__PURE__ */ jsx78(
25069
+ editing ? /* @__PURE__ */ jsx79(
24932
25070
  Button46,
24933
25071
  {
24934
25072
  size: "sm",
@@ -24950,18 +25088,18 @@ function CustomFieldsSection({
24950
25088
  }
24951
25089
  ) : null
24952
25090
  ] }),
24953
- /* @__PURE__ */ jsx78(Separator3, {}),
24954
- writeError ? /* @__PURE__ */ jsx78(RefusalLine, { error: writeError }) : null,
24955
- mutation.error ? /* @__PURE__ */ jsx78(RefusalLine, { error: mutation.error }) : null,
25091
+ /* @__PURE__ */ jsx79(Separator3, {}),
25092
+ writeError ? /* @__PURE__ */ jsx79(RefusalLine, { error: writeError }) : null,
25093
+ mutation.error ? /* @__PURE__ */ jsx79(RefusalLine, { error: mutation.error }) : null,
24956
25094
  cannotAdd,
24957
25095
  editor,
24958
- editing ? /* @__PURE__ */ jsx78("div", { className: "flex flex-col gap-3", children: fields.map((f) => {
25096
+ editing ? /* @__PURE__ */ jsx79("div", { className: "flex flex-col gap-3", children: fields.map((f) => {
24959
25097
  const field2 = asField(f);
24960
25098
  const id = `cf-${recordId}-${f.key}`;
24961
- return /* @__PURE__ */ jsxs72("div", { className: "flex min-w-0 flex-col gap-1", children: [
24962
- /* @__PURE__ */ jsxs72("div", { className: "flex items-center gap-2", children: [
24963
- /* @__PURE__ */ jsx78(FieldLabel, { field: field2, htmlFor: id }),
24964
- mayAdd && removing !== f.id ? /* @__PURE__ */ jsx78(
25099
+ return /* @__PURE__ */ jsxs73("div", { className: "flex min-w-0 flex-col gap-1", children: [
25100
+ /* @__PURE__ */ jsxs73("div", { className: "flex items-center gap-2", children: [
25101
+ /* @__PURE__ */ jsx79(FieldLabel, { field: field2, htmlFor: id }),
25102
+ mayAdd && removing !== f.id ? /* @__PURE__ */ jsx79(
24965
25103
  Button46,
24966
25104
  {
24967
25105
  size: "sm",
@@ -24972,12 +25110,12 @@ function CustomFieldsSection({
24972
25110
  }
24973
25111
  ) : null
24974
25112
  ] }),
24975
- removing === f.id ? /* @__PURE__ */ jsxs72("div", { className: "flex flex-wrap items-center gap-2", children: [
24976
- /* @__PURE__ */ jsxs72("span", { className: "text-destructive", children: [
25113
+ removing === f.id ? /* @__PURE__ */ jsxs73("div", { className: "flex flex-wrap items-center gap-2", children: [
25114
+ /* @__PURE__ */ jsxs73("span", { className: "text-destructive", children: [
24977
25115
  archiveConfirmSentence(`the field \u201C${f.label}\u201D`),
24978
25116
  " It is removed for everyone in this organization; its values stay in every record and come back with it."
24979
25117
  ] }),
24980
- /* @__PURE__ */ jsx78(
25118
+ /* @__PURE__ */ jsx79(
24981
25119
  Button46,
24982
25120
  {
24983
25121
  size: "sm",
@@ -24997,9 +25135,9 @@ function CustomFieldsSection({
24997
25135
  children: "Remove it"
24998
25136
  }
24999
25137
  ),
25000
- /* @__PURE__ */ jsx78(Button46, { size: "sm", variant: "ghost", onClick: () => setRemoving(null), children: "Keep it" })
25138
+ /* @__PURE__ */ jsx79(Button46, { size: "sm", variant: "ghost", onClick: () => setRemoving(null), children: "Keep it" })
25001
25139
  ] }) : null,
25002
- noticeOf(f) ? /* @__PURE__ */ jsx78(WithheldValue, { field: field2, notice: noticeOf(f) }) : /* @__PURE__ */ jsx78(
25140
+ noticeOf(f) ? /* @__PURE__ */ jsx79(WithheldValue, { field: field2, notice: noticeOf(f) }) : /* @__PURE__ */ jsx79(
25003
25141
  FieldControl,
25004
25142
  {
25005
25143
  id,
@@ -25009,9 +25147,9 @@ function CustomFieldsSection({
25009
25147
  }
25010
25148
  )
25011
25149
  ] }, f.id);
25012
- }) }) : /* @__PURE__ */ jsx78("dl", { className: "grid grid-cols-[minmax(6rem,12rem)_1fr] gap-x-3 gap-y-1.5", children: fields.map((f) => /* @__PURE__ */ jsxs72("div", { className: "contents", children: [
25013
- /* @__PURE__ */ jsx78("dt", { className: "flex items-baseline gap-1 truncate text-muted-foreground", children: f.label }),
25014
- /* @__PURE__ */ jsx78("dd", { className: "min-w-0", children: noticeOf(f) ? /* @__PURE__ */ jsx78(WithheldValue, { field: asField(f), notice: noticeOf(f) }) : cellKey === f.key ? /* @__PURE__ */ jsx78(
25150
+ }) }) : /* @__PURE__ */ jsx79("dl", { className: "grid grid-cols-[minmax(6rem,12rem)_1fr] gap-x-3 gap-y-1.5", children: fields.map((f) => /* @__PURE__ */ jsxs73("div", { className: "contents", children: [
25151
+ /* @__PURE__ */ jsx79("dt", { className: "flex items-baseline gap-1 truncate text-muted-foreground", children: f.label }),
25152
+ /* @__PURE__ */ jsx79("dd", { className: "min-w-0", children: noticeOf(f) ? /* @__PURE__ */ jsx79(WithheldValue, { field: asField(f), notice: noticeOf(f) }) : cellKey === f.key ? /* @__PURE__ */ jsx79(
25015
25153
  "div",
25016
25154
  {
25017
25155
  className: "min-w-0",
@@ -25032,7 +25170,7 @@ function CustomFieldsSection({
25032
25170
  if (e.relatedTarget?.closest?.("[data-matrx-cell-editor], [role=listbox], [role=dialog]")) return;
25033
25171
  void saveCell(f.key);
25034
25172
  },
25035
- children: /* @__PURE__ */ jsx78(
25173
+ children: /* @__PURE__ */ jsx79(
25036
25174
  FieldControl,
25037
25175
  {
25038
25176
  id: `cf-${recordId}-${f.key}`,
@@ -25045,7 +25183,7 @@ function CustomFieldsSection({
25045
25183
  }
25046
25184
  )
25047
25185
  }
25048
- ) : /* @__PURE__ */ jsx78(
25186
+ ) : /* @__PURE__ */ jsx79(
25049
25187
  "button",
25050
25188
  {
25051
25189
  type: "button",
@@ -25057,7 +25195,7 @@ function CustomFieldsSection({
25057
25195
  setCellValue(values[f.key]);
25058
25196
  setCellKey(f.key);
25059
25197
  },
25060
- children: isEmptyValue(values[f.key]) ? /* @__PURE__ */ jsx78("span", { className: "text-muted-foreground", children: "\u2014" }) : /* @__PURE__ */ jsx78(CustomValue, { field: asField(f), value: values[f.key] })
25198
+ children: isEmptyValue(values[f.key]) ? /* @__PURE__ */ jsx79("span", { className: "text-muted-foreground", children: "\u2014" }) : /* @__PURE__ */ jsx79(CustomValue, { field: asField(f), value: values[f.key] })
25061
25199
  }
25062
25200
  ) })
25063
25201
  ] }, f.id)) })
@@ -25066,7 +25204,7 @@ function CustomFieldsSection({
25066
25204
 
25067
25205
  // src/StandardRecordForm.tsx
25068
25206
  init_Refusal();
25069
- import { jsx as jsx79, jsxs as jsxs73 } from "react/jsx-runtime";
25207
+ import { jsx as jsx80, jsxs as jsxs74 } from "react/jsx-runtime";
25070
25208
  function standardTokenOf(token2) {
25071
25209
  return token2.startsWith("entity:") ? token2.slice("entity:".length) : token2;
25072
25210
  }
@@ -25115,14 +25253,14 @@ function StandardRecordForm({ token: token2, recordId, columns, onSaved, classNa
25115
25253
  read.reload();
25116
25254
  onSaved?.(recordId);
25117
25255
  };
25118
- if (read.error) return /* @__PURE__ */ jsx79(RefusalLine, { error: read.error, className });
25119
- return /* @__PURE__ */ jsxs73("div", { className: cn42("flex min-w-0 flex-col gap-2 text-xs", className), "data-records-standard-form": entityToken, children: [
25120
- /* @__PURE__ */ jsx79("dl", { className: "grid grid-cols-[minmax(5rem,7rem)_1fr] gap-x-3 gap-y-1", children: columns.map((column) => {
25256
+ if (read.error) return /* @__PURE__ */ jsx80(RefusalLine, { error: read.error, className });
25257
+ return /* @__PURE__ */ jsxs74("div", { className: cn42("flex min-w-0 flex-col gap-2 text-xs", className), "data-records-standard-form": entityToken, children: [
25258
+ /* @__PURE__ */ jsx80("dl", { className: "grid grid-cols-[minmax(5rem,7rem)_1fr] gap-x-3 gap-y-1", children: columns.map((column) => {
25121
25259
  const id = `std-${recordId}-${column.key}`;
25122
25260
  const value = stored[column.key];
25123
- return /* @__PURE__ */ jsxs73("div", { className: "contents", children: [
25124
- /* @__PURE__ */ jsx79("dt", { className: "truncate py-1 text-right text-muted-foreground", children: /* @__PURE__ */ jsx79("label", { htmlFor: id, children: column.label }) }),
25125
- /* @__PURE__ */ jsx79("dd", { className: "min-w-0", children: cellKey === column.key ? column.multiline ? /* @__PURE__ */ jsx79(
25261
+ return /* @__PURE__ */ jsxs74("div", { className: "contents", children: [
25262
+ /* @__PURE__ */ jsx80("dt", { className: "truncate py-1 text-right text-muted-foreground", children: /* @__PURE__ */ jsx80("label", { htmlFor: id, children: column.label }) }),
25263
+ /* @__PURE__ */ jsx80("dd", { className: "min-w-0", children: cellKey === column.key ? column.multiline ? /* @__PURE__ */ jsx80(
25126
25264
  Textarea3,
25127
25265
  {
25128
25266
  id,
@@ -25140,7 +25278,7 @@ function StandardRecordForm({ token: token2, recordId, columns, onSaved, classNa
25140
25278
  if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) void save(column);
25141
25279
  }
25142
25280
  }
25143
- ) : /* @__PURE__ */ jsx79(
25281
+ ) : /* @__PURE__ */ jsx80(
25144
25282
  Input3,
25145
25283
  {
25146
25284
  id,
@@ -25158,7 +25296,7 @@ function StandardRecordForm({ token: token2, recordId, columns, onSaved, classNa
25158
25296
  if (e.key === "Enter") void save(column);
25159
25297
  }
25160
25298
  }
25161
- ) : /* @__PURE__ */ jsx79(
25299
+ ) : /* @__PURE__ */ jsx80(
25162
25300
  "button",
25163
25301
  {
25164
25302
  type: "button",
@@ -25168,23 +25306,23 @@ function StandardRecordForm({ token: token2, recordId, columns, onSaved, classNa
25168
25306
  "aria-label": `Edit ${column.label}`,
25169
25307
  "data-records-standard-value": column.key,
25170
25308
  onClick: () => open(column.key),
25171
- children: isEmpty(value) ? /* @__PURE__ */ jsx79("span", { className: "text-muted-foreground", children: "\u2014" }) : String(value)
25309
+ children: isEmpty(value) ? /* @__PURE__ */ jsx80("span", { className: "text-muted-foreground", children: "\u2014" }) : String(value)
25172
25310
  }
25173
25311
  ) })
25174
25312
  ] }, column.key);
25175
25313
  }) }),
25176
- error ? /* @__PURE__ */ jsx79(RefusalLine, { error }) : null,
25314
+ error ? /* @__PURE__ */ jsx80(RefusalLine, { error }) : null,
25177
25315
  children,
25178
- /* @__PURE__ */ jsx79(CustomFieldsSection, { entityToken, recordId, ...custom ?? {} })
25316
+ /* @__PURE__ */ jsx80(CustomFieldsSection, { entityToken, recordId, ...custom ?? {} })
25179
25317
  ] });
25180
25318
  }
25181
25319
 
25182
25320
  // src/RecordForm.tsx
25183
- import { jsx as jsx80, jsxs as jsxs74 } from "react/jsx-runtime";
25321
+ import { jsx as jsx81, jsxs as jsxs75 } from "react/jsx-runtime";
25184
25322
  function RecordForm(props) {
25185
25323
  if (props.token) {
25186
25324
  if (!props.recordId) {
25187
- return /* @__PURE__ */ jsx80(
25325
+ return /* @__PURE__ */ jsx81(
25188
25326
  RefusalNotice,
25189
25327
  {
25190
25328
  error: { code: "refused_by_rule", message: "A standard record is opened here, never created." },
@@ -25192,7 +25330,7 @@ function RecordForm(props) {
25192
25330
  }
25193
25331
  );
25194
25332
  }
25195
- return /* @__PURE__ */ jsx80(
25333
+ return /* @__PURE__ */ jsx81(
25196
25334
  StandardRecordForm,
25197
25335
  {
25198
25336
  token: props.token,
@@ -25205,7 +25343,7 @@ function RecordForm(props) {
25205
25343
  }
25206
25344
  );
25207
25345
  }
25208
- return /* @__PURE__ */ jsx80(CustomRecordForm, { ...props, tableId: props.tableId });
25346
+ return /* @__PURE__ */ jsx81(CustomRecordForm, { ...props, tableId: props.tableId });
25209
25347
  }
25210
25348
  function CustomRecordForm({
25211
25349
  tableId,
@@ -25293,8 +25431,8 @@ function CustomRecordForm({
25293
25431
  () => fields.data ? predictWriteRefusals({ fields: fields.data, document: document2, ...recordType ? { recordType } : {} }) : [],
25294
25432
  [fields.data, document2, recordType]
25295
25433
  );
25296
- if (fields.error) return /* @__PURE__ */ jsx80(RefusalNotice, { error: fields.error, className });
25297
- if (existing.error) return /* @__PURE__ */ jsx80(RefusalNotice, { error: existing.error, className });
25434
+ if (fields.error) return /* @__PURE__ */ jsx81(RefusalNotice, { error: fields.error, className });
25435
+ if (existing.error) return /* @__PURE__ */ jsx81(RefusalNotice, { error: existing.error, className });
25298
25436
  const storeSaid = said2.error && said2.error !== answered ? said2.error : null;
25299
25437
  const fieldProblems = predicted.filter((p) => p.field_key);
25300
25438
  const problemsShown = (key) => touched || changed2[key] ? fieldProblems.filter((p) => p.field_key === key) : [];
@@ -25359,7 +25497,7 @@ function CustomRecordForm({
25359
25497
  onSaved?.(written);
25360
25498
  }
25361
25499
  };
25362
- return /* @__PURE__ */ jsxs74(
25500
+ return /* @__PURE__ */ jsxs75(
25363
25501
  "form",
25364
25502
  {
25365
25503
  className: cn43("flex min-w-0 flex-col gap-3", className),
@@ -25368,7 +25506,7 @@ function CustomRecordForm({
25368
25506
  void save();
25369
25507
  },
25370
25508
  children: [
25371
- /* @__PURE__ */ jsx80("div", { className: "grid gap-3 sm:grid-cols-2", children: (fields.data ?? []).map((field2) => /* @__PURE__ */ jsx80(
25509
+ /* @__PURE__ */ jsx81("div", { className: "grid gap-3 sm:grid-cols-2", children: (fields.data ?? []).map((field2) => /* @__PURE__ */ jsx81(
25372
25510
  FieldRow,
25373
25511
  {
25374
25512
  recordId,
@@ -25386,31 +25524,31 @@ function CustomRecordForm({
25386
25524
  },
25387
25525
  field2.id
25388
25526
  )) }),
25389
- touched ? predicted.filter((p) => !p.field_key).map((p) => /* @__PURE__ */ jsx80(
25527
+ touched ? predicted.filter((p) => !p.field_key).map((p) => /* @__PURE__ */ jsx81(
25390
25528
  RefusalNotice,
25391
25529
  {
25392
25530
  error: { code: "refused_by_rule", message: p.message }
25393
25531
  },
25394
25532
  p.message
25395
25533
  )) : null,
25396
- storeSaid && !storeRefusalIsOnAField ? /* @__PURE__ */ jsx80(
25534
+ storeSaid && !storeRefusalIsOnAField ? /* @__PURE__ */ jsx81(
25397
25535
  RefusalNotice,
25398
25536
  {
25399
25537
  error: storeSaid,
25400
25538
  ...said2.conflict ? {
25401
- actions: /* @__PURE__ */ jsxs74("div", { className: "mt-1 space-y-1", children: [
25539
+ actions: /* @__PURE__ */ jsxs75("div", { className: "mt-1 space-y-1", children: [
25402
25540
  Object.entries(said2.conflict.contested_fields).map(([key, theirs]) => {
25403
25541
  const column = (fields.data ?? []).find((f) => f.key === key);
25404
- return /* @__PURE__ */ jsxs74("p", { className: "text-[11px]", children: [
25542
+ return /* @__PURE__ */ jsxs75("p", { className: "text-[11px]", children: [
25405
25543
  column ? fieldName(column) : humanizeIdentifier9(key),
25406
25544
  ": yours",
25407
25545
  " ",
25408
- /* @__PURE__ */ jsx80("strong", { children: asWords(draft[key]) }),
25546
+ /* @__PURE__ */ jsx81("strong", { children: asWords(draft[key]) }),
25409
25547
  " \xB7 theirs ",
25410
- /* @__PURE__ */ jsx80("strong", { children: asWords(theirs) })
25548
+ /* @__PURE__ */ jsx81("strong", { children: asWords(theirs) })
25411
25549
  ] }, key);
25412
25550
  }),
25413
- /* @__PURE__ */ jsx80(
25551
+ /* @__PURE__ */ jsx81(
25414
25552
  Button47,
25415
25553
  {
25416
25554
  type: "button",
@@ -25430,10 +25568,10 @@ function CustomRecordForm({
25430
25568
  } : { onKeepEditing: () => keepEditing(), onDiscard: () => discard() }
25431
25569
  }
25432
25570
  ) : null,
25433
- /* @__PURE__ */ jsx80(Separator4, {}),
25434
- /* @__PURE__ */ jsxs74("div", { className: "flex items-center gap-2", children: [
25435
- /* @__PURE__ */ jsx80(Button47, { type: "submit", size: "sm", disabled: said2.saving, children: said2.saving ? "Saving\u2026" : recordId ? "Save" : "Create" }),
25436
- onCancel ? /* @__PURE__ */ jsx80(Button47, { type: "button", size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null
25571
+ /* @__PURE__ */ jsx81(Separator4, {}),
25572
+ /* @__PURE__ */ jsxs75("div", { className: "flex items-center gap-2", children: [
25573
+ /* @__PURE__ */ jsx81(Button47, { type: "submit", size: "sm", disabled: said2.saving, children: said2.saving ? "Saving\u2026" : recordId ? "Save" : "Create" }),
25574
+ onCancel ? /* @__PURE__ */ jsx81(Button47, { type: "button", size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null
25437
25575
  ] })
25438
25576
  ]
25439
25577
  }
@@ -25452,14 +25590,14 @@ function FieldRow({
25452
25590
  const id = `field-${field2.id}`;
25453
25591
  const storedWords = document2?.[field2.key];
25454
25592
  const whole = typeof storedWords === "string" ? wholeValueOf3(document2, field2.key) : null;
25455
- return /* @__PURE__ */ jsxs74("div", { className: cn43("flex min-w-0 flex-col gap-1", whole && "sm:col-span-2"), children: [
25456
- /* @__PURE__ */ jsx80(FieldLabel, { field: field2, htmlFor: id, children: /* @__PURE__ */ jsx80(ProvenanceBadge, { document: document2, fieldKey: field2.key }) }),
25593
+ return /* @__PURE__ */ jsxs75("div", { className: cn43("flex min-w-0 flex-col gap-1", whole && "sm:col-span-2"), children: [
25594
+ /* @__PURE__ */ jsx81(FieldLabel, { field: field2, htmlFor: id, children: /* @__PURE__ */ jsx81(ProvenanceBadge, { document: document2, fieldKey: field2.key }) }),
25457
25595
  whole ? (
25458
25596
  // A TEXT KEPT AS A FILE opens WHOLE, never as the 1000 characters its cell holds —
25459
25597
  // saving those would cut the value (lane BIG-VALUES-WRITE).
25460
- /* @__PURE__ */ jsx80(WholeValueEditor, { field: field2, pointer: whole, words: String(storedWords ?? ""), value, onChange, id })
25461
- ) : /* @__PURE__ */ jsx80(FieldControl, { field: field2, value, onChange, id, recordId }),
25462
- problems.map((problem, index) => /* @__PURE__ */ jsx80(
25598
+ /* @__PURE__ */ jsx81(WholeValueEditor, { field: field2, pointer: whole, words: String(storedWords ?? ""), value, onChange, id })
25599
+ ) : /* @__PURE__ */ jsx81(FieldControl, { field: field2, value, onChange, id, recordId }),
25600
+ problems.map((problem, index) => /* @__PURE__ */ jsx81(
25463
25601
  RefusalNotice,
25464
25602
  {
25465
25603
  error: { code: "refused_by_rule", message: problem.message },
@@ -25478,7 +25616,7 @@ function asWords(value) {
25478
25616
  }
25479
25617
 
25480
25618
  // src/gridAddRow.tsx
25481
- import { Fragment as Fragment25, jsx as jsx81, jsxs as jsxs75 } from "react/jsx-runtime";
25619
+ import { Fragment as Fragment26, jsx as jsx82, jsxs as jsxs76 } from "react/jsx-runtime";
25482
25620
  var ADD_ROW_ID = "__records_ui_add_row__";
25483
25621
  var ADD_ROW = {
25484
25622
  id: ADD_ROW_ID,
@@ -25567,7 +25705,7 @@ function withAddRowCells(columns, line) {
25567
25705
  });
25568
25706
  }
25569
25707
  function AddRowLine({ onAdd, busy, label = "Add row" }) {
25570
- return /* @__PURE__ */ jsxs75(
25708
+ return /* @__PURE__ */ jsxs76(
25571
25709
  "button",
25572
25710
  {
25573
25711
  type: "button",
@@ -25579,7 +25717,7 @@ function AddRowLine({ onAdd, busy, label = "Add row" }) {
25579
25717
  },
25580
25718
  className: "-mx-1 flex w-max items-center gap-1.5 whitespace-nowrap rounded px-1 text-xs font-normal text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60",
25581
25719
  children: [
25582
- /* @__PURE__ */ jsx81("span", { "aria-hidden": "true", className: "text-sm leading-none", children: "+" }),
25720
+ /* @__PURE__ */ jsx82("span", { "aria-hidden": "true", className: "text-sm leading-none", children: "+" }),
25583
25721
  busy ? "Adding\u2026" : label
25584
25722
  ]
25585
25723
  }
@@ -25590,7 +25728,7 @@ function addColumnColumn(onAdd) {
25590
25728
  return {
25591
25729
  id: ADD_COLUMN_ID,
25592
25730
  label: "Add a column",
25593
- header: /* @__PURE__ */ jsx81(
25731
+ header: /* @__PURE__ */ jsx82(
25594
25732
  "button",
25595
25733
  {
25596
25734
  type: "button",
@@ -25618,7 +25756,7 @@ function addColumnColumn(onAdd) {
25618
25756
  };
25619
25757
  }
25620
25758
  function AddFirstRowButton({ onAdd, busy }) {
25621
- return /* @__PURE__ */ jsx81(Button48, { size: "sm", "data-records-add-first-row": "", disabled: busy, onClick: onAdd, children: busy ? "Adding\u2026" : "Add the first row" });
25759
+ return /* @__PURE__ */ jsx82(Button48, { size: "sm", "data-records-add-first-row": "", disabled: busy, onClick: onAdd, children: busy ? "Adding\u2026" : "Add the first row" });
25622
25760
  }
25623
25761
  var NEW_RECORD_FORM_LABEL = "Fill in a form\u2026";
25624
25762
  function NewRecordControl({
@@ -25638,11 +25776,11 @@ function NewRecordControl({
25638
25776
  setFormInitial(ask2.initial);
25639
25777
  setFormOpen(true);
25640
25778
  }, [ask2]);
25641
- return /* @__PURE__ */ jsxs75(Fragment25, { children: [
25642
- /* @__PURE__ */ jsxs75("div", { className: "inline-flex shrink-0", "data-records-new-record": "", children: [
25643
- /* @__PURE__ */ jsx81(Button48, { size: "sm", className: "rounded-r-none", disabled: busy, onClick: onAdd, children: busy ? "Adding\u2026" : "New record" }),
25644
- /* @__PURE__ */ jsxs75(DropdownMenu4, { children: [
25645
- /* @__PURE__ */ jsx81(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsx81(
25779
+ return /* @__PURE__ */ jsxs76(Fragment26, { children: [
25780
+ /* @__PURE__ */ jsxs76("div", { className: "inline-flex shrink-0", "data-records-new-record": "", children: [
25781
+ /* @__PURE__ */ jsx82(Button48, { size: "sm", className: "rounded-r-none", disabled: busy, onClick: onAdd, children: busy ? "Adding\u2026" : "New record" }),
25782
+ /* @__PURE__ */ jsxs76(DropdownMenu4, { children: [
25783
+ /* @__PURE__ */ jsx82(DropdownMenuTrigger4, { asChild: true, children: /* @__PURE__ */ jsx82(
25646
25784
  Button48,
25647
25785
  {
25648
25786
  size: "sm",
@@ -25650,21 +25788,21 @@ function NewRecordControl({
25650
25788
  disabled: busy,
25651
25789
  "aria-label": "More ways to add",
25652
25790
  "data-records-new-record-more": "",
25653
- children: /* @__PURE__ */ jsx81("span", { "aria-hidden": true, className: "text-xs leading-none", children: "\u25BE" })
25791
+ children: /* @__PURE__ */ jsx82("span", { "aria-hidden": true, className: "text-xs leading-none", children: "\u25BE" })
25654
25792
  }
25655
25793
  ) }),
25656
- /* @__PURE__ */ jsxs75(DropdownMenuContent4, { align: "end", className: "text-xs", children: [
25657
- /* @__PURE__ */ jsx81(DropdownMenuItem4, { className: "text-xs", onSelect: onAdd, children: "Blank row" }),
25658
- /* @__PURE__ */ jsx81(DropdownMenuItem4, { className: "text-xs", "data-records-new-record-form-open": "", onSelect: () => setFormOpen(true), children: NEW_RECORD_FORM_LABEL })
25794
+ /* @__PURE__ */ jsxs76(DropdownMenuContent4, { align: "end", className: "text-xs", children: [
25795
+ /* @__PURE__ */ jsx82(DropdownMenuItem4, { className: "text-xs", onSelect: onAdd, children: "Blank row" }),
25796
+ /* @__PURE__ */ jsx82(DropdownMenuItem4, { className: "text-xs", "data-records-new-record-form-open": "", onSelect: () => setFormOpen(true), children: NEW_RECORD_FORM_LABEL })
25659
25797
  ] })
25660
25798
  ] })
25661
25799
  ] }),
25662
- /* @__PURE__ */ jsx81(Dialog14, { open: formOpen, onOpenChange: setFormOpen, children: /* @__PURE__ */ jsxs75(DialogContent14, { className: "max-h-[85dvh] overflow-y-auto sm:max-w-2xl", "data-records-new-record-form": "", children: [
25663
- /* @__PURE__ */ jsx81(DialogHeader14, { children: /* @__PURE__ */ jsxs75(DialogTitle14, { children: [
25800
+ /* @__PURE__ */ jsx82(Dialog14, { open: formOpen, onOpenChange: setFormOpen, children: /* @__PURE__ */ jsxs76(DialogContent14, { className: "max-h-[85dvh] overflow-y-auto sm:max-w-2xl", "data-records-new-record-form": "", children: [
25801
+ /* @__PURE__ */ jsx82(DialogHeader14, { children: /* @__PURE__ */ jsxs76(DialogTitle14, { children: [
25664
25802
  "New ",
25665
25803
  noun
25666
25804
  ] }) }),
25667
- formOpen ? /* @__PURE__ */ jsx81(
25805
+ formOpen ? /* @__PURE__ */ jsx82(
25668
25806
  RecordForm,
25669
25807
  {
25670
25808
  tableId,
@@ -26347,7 +26485,7 @@ import {
26347
26485
  cn as cn44
26348
26486
  } from "@ai-matrx/design-system";
26349
26487
  import { formatRelativeTime as formatRelativeTime2 } from "@ai-matrx/kit/format";
26350
- import { Fragment as Fragment26, jsx as jsx82, jsxs as jsxs76 } from "react/jsx-runtime";
26488
+ import { Fragment as Fragment27, jsx as jsx83, jsxs as jsxs77 } from "react/jsx-runtime";
26351
26489
  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.";
26352
26490
  function cellState(cell2) {
26353
26491
  if (!cell2 || !cell2.agent_owned) return "none";
@@ -26366,9 +26504,9 @@ function EnrichBadge({ cell: cell2, onPin, className }) {
26366
26504
  const read = Array.isArray(source.read) ? source.read : [];
26367
26505
  const alternates = cell2.alternates ?? [];
26368
26506
  const word = state2 === "yours" ? "yours" : state2 === "unsure" ? "unsure" : "agent";
26369
- return /* @__PURE__ */ jsxs76(HoverCard2, { children: [
26370
- /* @__PURE__ */ jsx82(HoverCardTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs76("span", { className: cn44("inline-flex items-center gap-1 align-middle", className), children: [
26371
- /* @__PURE__ */ jsx82(
26507
+ return /* @__PURE__ */ jsxs77(HoverCard2, { children: [
26508
+ /* @__PURE__ */ jsx83(HoverCardTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs77("span", { className: cn44("inline-flex items-center gap-1 align-middle", className), children: [
26509
+ /* @__PURE__ */ jsx83(
26372
26510
  Badge11,
26373
26511
  {
26374
26512
  variant: state2 === "yours" ? "secondary" : "outline",
@@ -26376,40 +26514,40 @@ function EnrichBadge({ cell: cell2, onPin, className }) {
26376
26514
  children: word
26377
26515
  }
26378
26516
  ),
26379
- cell2.stale ? /* @__PURE__ */ jsx82(Badge11, { variant: "outline", className: "text-[10px] font-normal leading-none opacity-70", children: "stale" }) : null
26517
+ cell2.stale ? /* @__PURE__ */ jsx83(Badge11, { variant: "outline", className: "text-[10px] font-normal leading-none opacity-70", children: "stale" }) : null
26380
26518
  ] }) }),
26381
- /* @__PURE__ */ jsxs76(HoverCardContent2, { className: "w-80 space-y-2 text-xs", children: [
26382
- /* @__PURE__ */ jsx82("p", { className: "font-medium", children: state2 === "yours" ? "You typed this one in" : state2 === "unsure" ? "A model had candidates and committed to none" : "Filled in by a model" }),
26383
- state2 !== "yours" && cell2.on_behalf_of ? /* @__PURE__ */ jsxs76("p", { className: "text-muted-foreground", children: [
26519
+ /* @__PURE__ */ jsxs77(HoverCardContent2, { className: "w-80 space-y-2 text-xs", children: [
26520
+ /* @__PURE__ */ jsx83("p", { className: "font-medium", children: state2 === "yours" ? "You typed this one in" : state2 === "unsure" ? "A model had candidates and committed to none" : "Filled in by a model" }),
26521
+ state2 !== "yours" && cell2.on_behalf_of ? /* @__PURE__ */ jsxs77("p", { className: "text-muted-foreground", children: [
26384
26522
  "Acting for ",
26385
26523
  cell2.on_behalf_of,
26386
26524
  cell2.written_at ? `, ${ago(cell2.written_at)}` : "",
26387
26525
  "."
26388
- ] }) : cell2.written_at ? /* @__PURE__ */ jsxs76("p", { className: "text-muted-foreground", children: [
26526
+ ] }) : cell2.written_at ? /* @__PURE__ */ jsxs77("p", { className: "text-muted-foreground", children: [
26389
26527
  "Written ",
26390
26528
  ago(cell2.written_at),
26391
26529
  "."
26392
26530
  ] }) : null,
26393
- source.model ? /* @__PURE__ */ jsxs76("p", { className: "text-muted-foreground", children: [
26531
+ source.model ? /* @__PURE__ */ jsxs77("p", { className: "text-muted-foreground", children: [
26394
26532
  String(source.model),
26395
26533
  source.model_version ? ` (${String(source.model_version)})` : "",
26396
26534
  typeof source.confidence === "number" ? ` \xB7 ${Math.round(source.confidence * 100)}% sure` : ""
26397
26535
  ] }) : null,
26398
- source.note ? /* @__PURE__ */ jsx82("p", { className: "text-muted-foreground", children: String(source.note) }) : null,
26399
- read.length > 0 ? /* @__PURE__ */ jsxs76("div", { children: [
26400
- /* @__PURE__ */ jsx82("p", { className: "text-muted-foreground", children: "What it read" }),
26401
- /* @__PURE__ */ jsx82("ul", { className: "list-inside list-disc", children: read.slice(0, 4).map((r, i) => /* @__PURE__ */ jsx82("li", { className: "truncate", children: String(r.title ?? r.url ?? "") }, i)) })
26536
+ source.note ? /* @__PURE__ */ jsx83("p", { className: "text-muted-foreground", children: String(source.note) }) : null,
26537
+ read.length > 0 ? /* @__PURE__ */ jsxs77("div", { children: [
26538
+ /* @__PURE__ */ jsx83("p", { className: "text-muted-foreground", children: "What it read" }),
26539
+ /* @__PURE__ */ jsx83("ul", { className: "list-inside list-disc", children: read.slice(0, 4).map((r, i) => /* @__PURE__ */ jsx83("li", { className: "truncate", children: String(r.title ?? r.url ?? "") }, i)) })
26402
26540
  ] }) : null,
26403
- alternates.length > 0 ? /* @__PURE__ */ jsxs76("div", { children: [
26404
- /* @__PURE__ */ jsx82("p", { className: "text-muted-foreground", children: state2 === "unsure" ? "What it considered" : "What it nearly said instead" }),
26405
- /* @__PURE__ */ jsx82("ul", { className: "list-inside list-decimal", children: alternates.slice(0, 4).map((a, i) => /* @__PURE__ */ jsx82("li", { children: String(a.value ?? "") }, i)) })
26541
+ alternates.length > 0 ? /* @__PURE__ */ jsxs77("div", { children: [
26542
+ /* @__PURE__ */ jsx83("p", { className: "text-muted-foreground", children: state2 === "unsure" ? "What it considered" : "What it nearly said instead" }),
26543
+ /* @__PURE__ */ jsx83("ul", { className: "list-inside list-decimal", children: alternates.slice(0, 4).map((a, i) => /* @__PURE__ */ jsx83("li", { children: String(a.value ?? "") }, i)) })
26406
26544
  ] }) : null,
26407
- cell2.stale && cell2.due_at ? /* @__PURE__ */ jsxs76("p", { className: "text-muted-foreground", children: [
26545
+ cell2.stale && cell2.due_at ? /* @__PURE__ */ jsxs77("p", { className: "text-muted-foreground", children: [
26408
26546
  "Past its date \u2014 it was due to be looked at again ",
26409
26547
  ago(cell2.due_at),
26410
26548
  ". The value is still here; nothing was overwritten."
26411
26549
  ] }) : null,
26412
- onPin ? /* @__PURE__ */ jsx82(
26550
+ onPin ? /* @__PURE__ */ jsx83(
26413
26551
  Button49,
26414
26552
  {
26415
26553
  size: "sm",
@@ -26532,30 +26670,30 @@ function EnrichPanel({ tableId, fieldId, className }) {
26532
26670
  },
26533
26671
  [host, load, tableId]
26534
26672
  );
26535
- if (error) return /* @__PURE__ */ jsx82(RefusalNotice, { error, className });
26536
- if (rows === null) return /* @__PURE__ */ jsx82(Skeleton9, { className: cn44("h-40 w-full", className) });
26673
+ if (error) return /* @__PURE__ */ jsx83(RefusalNotice, { error, className });
26674
+ if (rows === null) return /* @__PURE__ */ jsx83(Skeleton9, { className: cn44("h-40 w-full", className) });
26537
26675
  if (shown5.length === 0 && fieldId) {
26538
26676
  const target = (fields.data ?? []).find((f) => f.id === fieldId);
26539
26677
  const setup = draft[fieldId] ?? { instruction: "", every: "30" };
26540
26678
  if (!rights.admin) {
26541
- return /* @__PURE__ */ jsxs76("div", { className: cn44("space-y-2 p-4 text-sm", className), children: [
26542
- /* @__PURE__ */ jsxs76("p", { className: "font-medium", children: [
26679
+ return /* @__PURE__ */ jsxs77("div", { className: cn44("space-y-2 p-4 text-sm", className), children: [
26680
+ /* @__PURE__ */ jsxs77("p", { className: "font-medium", children: [
26543
26681
  "Nothing fills ",
26544
26682
  target?.name ?? "this column",
26545
26683
  " in automatically."
26546
26684
  ] }),
26547
- /* @__PURE__ */ jsx82("p", { className: "text-muted-foreground", children: "An admin on this table sets that up." })
26685
+ /* @__PURE__ */ jsx83("p", { className: "text-muted-foreground", children: "An admin on this table sets that up." })
26548
26686
  ] });
26549
26687
  }
26550
- return /* @__PURE__ */ jsxs76("div", { className: cn44("space-y-3 p-4 text-sm", className), children: [
26551
- /* @__PURE__ */ jsxs76("p", { className: "font-medium", children: [
26688
+ return /* @__PURE__ */ jsxs77("div", { className: cn44("space-y-3 p-4 text-sm", className), children: [
26689
+ /* @__PURE__ */ jsxs77("p", { className: "font-medium", children: [
26552
26690
  "Let a model keep ",
26553
26691
  target?.name ?? "this column",
26554
26692
  " filled in"
26555
26693
  ] }),
26556
- /* @__PURE__ */ jsxs76("div", { className: "space-y-1", children: [
26557
- /* @__PURE__ */ jsx82(Label17, { className: "text-xs", htmlFor: "new-instruction", children: "What goes in this column" }),
26558
- /* @__PURE__ */ jsx82(
26694
+ /* @__PURE__ */ jsxs77("div", { className: "space-y-1", children: [
26695
+ /* @__PURE__ */ jsx83(Label17, { className: "text-xs", htmlFor: "new-instruction", children: "What goes in this column" }),
26696
+ /* @__PURE__ */ jsx83(
26559
26697
  Input4,
26560
26698
  {
26561
26699
  id: "new-instruction",
@@ -26564,11 +26702,11 @@ function EnrichPanel({ tableId, fieldId, className }) {
26564
26702
  onChange: (e) => setDraft((prev) => ({ ...prev, [fieldId]: { ...setup, instruction: e.target.value } }))
26565
26703
  }
26566
26704
  ),
26567
- /* @__PURE__ */ jsx82("p", { className: "text-[11px] text-muted-foreground", children: "This sentence is what the model is asked. It is set up switched OFF \u2014 nothing is written into anybody's records until you turn it on." })
26705
+ /* @__PURE__ */ jsx83("p", { className: "text-[11px] text-muted-foreground", children: "This sentence is what the model is asked. It is set up switched OFF \u2014 nothing is written into anybody's records until you turn it on." })
26568
26706
  ] }),
26569
- /* @__PURE__ */ jsxs76("div", { className: "space-y-1", children: [
26570
- /* @__PURE__ */ jsx82(Label17, { className: "text-xs", htmlFor: "new-every", children: "Look at each one again after" }),
26571
- /* @__PURE__ */ jsx82(
26707
+ /* @__PURE__ */ jsxs77("div", { className: "space-y-1", children: [
26708
+ /* @__PURE__ */ jsx83(Label17, { className: "text-xs", htmlFor: "new-every", children: "Look at each one again after" }),
26709
+ /* @__PURE__ */ jsx83(
26572
26710
  Input4,
26573
26711
  {
26574
26712
  id: "new-every",
@@ -26578,7 +26716,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
26578
26716
  }
26579
26717
  )
26580
26718
  ] }),
26581
- /* @__PURE__ */ jsx82(
26719
+ /* @__PURE__ */ jsx83(
26582
26720
  Button49,
26583
26721
  {
26584
26722
  size: "sm",
@@ -26594,26 +26732,26 @@ function EnrichPanel({ tableId, fieldId, className }) {
26594
26732
  children: "Set it up"
26595
26733
  }
26596
26734
  ),
26597
- outcome ? /* @__PURE__ */ jsx82("p", { className: "text-xs text-muted-foreground", children: outcome.message }) : null
26735
+ outcome ? /* @__PURE__ */ jsx83("p", { className: "text-xs text-muted-foreground", children: outcome.message }) : null
26598
26736
  ] });
26599
26737
  }
26600
26738
  if (shown5.length === 0) {
26601
- return /* @__PURE__ */ jsxs76("div", { className: cn44("space-y-2 p-4 text-sm", className), children: [
26602
- /* @__PURE__ */ jsx82("p", { className: "font-medium", children: "No column here is filled in by a model." }),
26603
- /* @__PURE__ */ jsx82("p", { className: "text-muted-foreground", children: rights.admin ? "Open a column's menu and choose \u201CLet AI fill\u201D to set one up \u2014 or just ask for it in plain words and the agent will." : "An admin on this table sets that up." })
26739
+ return /* @__PURE__ */ jsxs77("div", { className: cn44("space-y-2 p-4 text-sm", className), children: [
26740
+ /* @__PURE__ */ jsx83("p", { className: "font-medium", children: "No column here is filled in by a model." }),
26741
+ /* @__PURE__ */ jsx83("p", { className: "text-muted-foreground", children: rights.admin ? "Open a column's menu and choose \u201CLet AI fill\u201D to set one up \u2014 or just ask for it in plain words and the agent will." : "An admin on this table sets that up." })
26604
26742
  ] });
26605
26743
  }
26606
- return /* @__PURE__ */ jsx82("div", { className: cn44("space-y-6 p-4", className), children: shown5.map((row) => {
26744
+ return /* @__PURE__ */ jsx83("div", { className: cn44("space-y-6 p-4", className), children: shown5.map((row) => {
26607
26745
  const d = draft[row.field_id] ?? {
26608
26746
  instruction: row.enrichment?.instruction ?? "",
26609
26747
  every: row.review_interval_days ? String(row.review_interval_days) : ""
26610
26748
  };
26611
26749
  const field2 = fieldByKey.get(row.field_key);
26612
- return /* @__PURE__ */ jsxs76("section", { className: "space-y-3 rounded-md border p-3", children: [
26613
- /* @__PURE__ */ jsxs76("header", { className: "flex items-center justify-between gap-2", children: [
26614
- /* @__PURE__ */ jsxs76("div", { className: "min-w-0", children: [
26615
- /* @__PURE__ */ jsx82("h3", { className: "truncate text-sm font-medium", children: row.label }),
26616
- /* @__PURE__ */ jsxs76("p", { className: "text-xs text-muted-foreground", children: [
26750
+ return /* @__PURE__ */ jsxs77("section", { className: "space-y-3 rounded-md border p-3", children: [
26751
+ /* @__PURE__ */ jsxs77("header", { className: "flex items-center justify-between gap-2", children: [
26752
+ /* @__PURE__ */ jsxs77("div", { className: "min-w-0", children: [
26753
+ /* @__PURE__ */ jsx83("h3", { className: "truncate text-sm font-medium", children: row.label }),
26754
+ /* @__PURE__ */ jsxs77("p", { className: "text-xs text-muted-foreground", children: [
26617
26755
  row.rows_filled,
26618
26756
  " of ",
26619
26757
  row.rows_total,
@@ -26623,8 +26761,8 @@ function EnrichPanel({ tableId, fieldId, className }) {
26623
26761
  row.rows_absent > 0 ? ` \xB7 ${row.rows_absent} nothing to find` : ""
26624
26762
  ] })
26625
26763
  ] }),
26626
- rights.admin ? /* @__PURE__ */ jsxs76("label", { className: "flex shrink-0 items-center gap-2 text-xs", children: [
26627
- /* @__PURE__ */ jsx82(
26764
+ rights.admin ? /* @__PURE__ */ jsxs77("label", { className: "flex shrink-0 items-center gap-2 text-xs", children: [
26765
+ /* @__PURE__ */ jsx83(
26628
26766
  Switch2,
26629
26767
  {
26630
26768
  checked: row.enabled,
@@ -26633,11 +26771,11 @@ function EnrichPanel({ tableId, fieldId, className }) {
26633
26771
  }
26634
26772
  ),
26635
26773
  row.enabled ? "On" : "Off"
26636
- ] }) : /* @__PURE__ */ jsx82(Badge11, { variant: "outline", className: "text-[10px] font-normal", children: row.enabled ? "on" : "off" })
26774
+ ] }) : /* @__PURE__ */ jsx83(Badge11, { variant: "outline", className: "text-[10px] font-normal", children: row.enabled ? "on" : "off" })
26637
26775
  ] }),
26638
- /* @__PURE__ */ jsxs76("div", { className: "space-y-1", children: [
26639
- /* @__PURE__ */ jsx82(Label17, { className: "text-xs", htmlFor: `instr-${row.field_id}`, children: "What goes in this column" }),
26640
- /* @__PURE__ */ jsx82(
26776
+ /* @__PURE__ */ jsxs77("div", { className: "space-y-1", children: [
26777
+ /* @__PURE__ */ jsx83(Label17, { className: "text-xs", htmlFor: `instr-${row.field_id}`, children: "What goes in this column" }),
26778
+ /* @__PURE__ */ jsx83(
26641
26779
  Input4,
26642
26780
  {
26643
26781
  id: `instr-${row.field_id}`,
@@ -26650,19 +26788,19 @@ function EnrichPanel({ tableId, fieldId, className }) {
26650
26788
  }))
26651
26789
  }
26652
26790
  ),
26653
- /* @__PURE__ */ jsx82("p", { className: "text-[11px] text-muted-foreground", children: "This sentence is what the model is asked, so write it the way you would say it to a person." })
26791
+ /* @__PURE__ */ jsx83("p", { className: "text-[11px] text-muted-foreground", children: "This sentence is what the model is asked, so write it the way you would say it to a person." })
26654
26792
  ] }),
26655
- /* @__PURE__ */ jsxs76("div", { className: "grid grid-cols-2 gap-3", children: [
26656
- /* @__PURE__ */ jsxs76("div", { className: "space-y-1", children: [
26657
- /* @__PURE__ */ jsx82(Label17, { className: "text-xs", children: "It may look at" }),
26658
- /* @__PURE__ */ jsxs76("p", { className: "text-xs", children: [
26793
+ /* @__PURE__ */ jsxs77("div", { className: "grid grid-cols-2 gap-3", children: [
26794
+ /* @__PURE__ */ jsxs77("div", { className: "space-y-1", children: [
26795
+ /* @__PURE__ */ jsx83(Label17, { className: "text-xs", children: "It may look at" }),
26796
+ /* @__PURE__ */ jsxs77("p", { className: "text-xs", children: [
26659
26797
  (row.enrichment?.inputs ?? []).length > 0 ? (row.enrichment?.inputs ?? []).map((k) => fieldByKey.get(k)?.name ?? k).join(", ") : "nothing else on the record",
26660
26798
  row.enrichment?.web_search ? " \xB7 and the open web" : ""
26661
26799
  ] })
26662
26800
  ] }),
26663
- /* @__PURE__ */ jsxs76("div", { className: "space-y-1", children: [
26664
- /* @__PURE__ */ jsx82(Label17, { className: "text-xs", htmlFor: `every-${row.field_id}`, children: "Look at each one again after" }),
26665
- /* @__PURE__ */ jsx82(
26801
+ /* @__PURE__ */ jsxs77("div", { className: "space-y-1", children: [
26802
+ /* @__PURE__ */ jsx83(Label17, { className: "text-xs", htmlFor: `every-${row.field_id}`, children: "Look at each one again after" }),
26803
+ /* @__PURE__ */ jsx83(
26666
26804
  Input4,
26667
26805
  {
26668
26806
  id: `every-${row.field_id}`,
@@ -26675,15 +26813,15 @@ function EnrichPanel({ tableId, fieldId, className }) {
26675
26813
  }))
26676
26814
  }
26677
26815
  ),
26678
- /* @__PURE__ */ jsx82("p", { className: "text-[11px] text-muted-foreground", children: d.every ? `${d.every} days` : NEVER2 })
26816
+ /* @__PURE__ */ jsx83("p", { className: "text-[11px] text-muted-foreground", children: d.every ? `${d.every} days` : NEVER2 })
26679
26817
  ] })
26680
26818
  ] }),
26681
- /* @__PURE__ */ jsxs76("p", { className: "text-xs text-muted-foreground", children: [
26819
+ /* @__PURE__ */ jsxs77("p", { className: "text-xs text-muted-foreground", children: [
26682
26820
  row.runs === 0 ? "It has not run yet, so it has cost nothing." : `${row.runs} run${row.runs === 1 ? "" : "s"}` + (costInPoints(Number(row.cost_cents), host.pointsRate) !== null ? ` \xB7 ${costInPoints(Number(row.cost_cents), host.pointsRate)} so far` : "") + (row.cost_per_row_cents !== null && costInPoints(Number(row.cost_per_row_cents), host.pointsRate) !== null ? ` \xB7 ${costInPoints(Number(row.cost_per_row_cents), host.pointsRate)} a row` : "") + (row.last_run_at ? ` \xB7 last ran ${ago(row.last_run_at)}` : ""),
26683
26821
  row.enrichment?.model ? ` \xB7 ${row.enrichment.model}` : ""
26684
26822
  ] }),
26685
- rights.admin ? /* @__PURE__ */ jsxs76("div", { className: "flex flex-wrap gap-2", children: [
26686
- /* @__PURE__ */ jsx82(
26823
+ rights.admin ? /* @__PURE__ */ jsxs77("div", { className: "flex flex-wrap gap-2", children: [
26824
+ /* @__PURE__ */ jsx83(
26687
26825
  Button49,
26688
26826
  {
26689
26827
  size: "sm",
@@ -26696,7 +26834,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
26696
26834
  children: "Save"
26697
26835
  }
26698
26836
  ),
26699
- /* @__PURE__ */ jsx82(
26837
+ /* @__PURE__ */ jsx83(
26700
26838
  Button49,
26701
26839
  {
26702
26840
  size: "sm",
@@ -26706,8 +26844,8 @@ function EnrichPanel({ tableId, fieldId, className }) {
26706
26844
  children: "Show me five rows it would do"
26707
26845
  }
26708
26846
  ),
26709
- host.enrich ? /* @__PURE__ */ jsxs76(Fragment26, { children: [
26710
- /* @__PURE__ */ jsx82(
26847
+ host.enrich ? /* @__PURE__ */ jsxs77(Fragment27, { children: [
26848
+ /* @__PURE__ */ jsx83(
26711
26849
  Button49,
26712
26850
  {
26713
26851
  size: "sm",
@@ -26717,7 +26855,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
26717
26855
  children: "Preview on five rows"
26718
26856
  }
26719
26857
  ),
26720
- /* @__PURE__ */ jsx82(
26858
+ /* @__PURE__ */ jsx83(
26721
26859
  Button49,
26722
26860
  {
26723
26861
  size: "sm",
@@ -26728,34 +26866,34 @@ function EnrichPanel({ tableId, fieldId, className }) {
26728
26866
  )
26729
26867
  ] }) : null
26730
26868
  ] }) : null,
26731
- !host.enrich && rights.admin ? /* @__PURE__ */ jsx82("p", { className: "text-[11px] text-muted-foreground", children: NO_ENRICH_REASON }) : null,
26732
- preview && preview.length > 0 ? /* @__PURE__ */ jsxs76("div", { className: "rounded border p-2 text-xs", children: [
26733
- /* @__PURE__ */ jsxs76("p", { className: "mb-1 font-medium", children: [
26869
+ !host.enrich && rights.admin ? /* @__PURE__ */ jsx83("p", { className: "text-[11px] text-muted-foreground", children: NO_ENRICH_REASON }) : null,
26870
+ preview && preview.length > 0 ? /* @__PURE__ */ jsxs77("div", { className: "rounded border p-2 text-xs", children: [
26871
+ /* @__PURE__ */ jsxs77("p", { className: "mb-1 font-medium", children: [
26734
26872
  "The next ",
26735
26873
  preview.length,
26736
26874
  " it would do, and why:"
26737
26875
  ] }),
26738
- /* @__PURE__ */ jsx82("ul", { className: "space-y-1", children: preview.map((p) => /* @__PURE__ */ jsxs76("li", { className: "flex justify-between gap-2", children: [
26739
- /* @__PURE__ */ jsx82("span", { className: "truncate", children: p.title }),
26740
- /* @__PURE__ */ jsx82("span", { className: "shrink-0 text-muted-foreground", children: p.reason })
26876
+ /* @__PURE__ */ jsx83("ul", { className: "space-y-1", children: preview.map((p) => /* @__PURE__ */ jsxs77("li", { className: "flex justify-between gap-2", children: [
26877
+ /* @__PURE__ */ jsx83("span", { className: "truncate", children: p.title }),
26878
+ /* @__PURE__ */ jsx83("span", { className: "shrink-0 text-muted-foreground", children: p.reason })
26741
26879
  ] }, p.record_id)) }),
26742
- preview[0]?.trimmed_to ? /* @__PURE__ */ jsxs76("p", { className: "mt-1 text-muted-foreground", children: [
26880
+ preview[0]?.trimmed_to ? /* @__PURE__ */ jsxs77("p", { className: "mt-1 text-muted-foreground", children: [
26743
26881
  "This organization does at most ",
26744
26882
  preview[0].trimmed_to,
26745
26883
  " in one go."
26746
26884
  ] }) : null
26747
26885
  ] }) : null,
26748
- outcome?.ok && outcome.fieldId === row.field_id && outcome.wouldWrite && outcome.wouldWrite.length > 0 ? /* @__PURE__ */ jsx82("ul", { className: "space-y-1 rounded border p-2 text-xs", "data-testid": "enrich-would-write", children: outcome.wouldWrite.map((w) => /* @__PURE__ */ jsxs76("li", { className: "flex justify-between gap-2", children: [
26749
- /* @__PURE__ */ jsx82("span", { className: "truncate text-muted-foreground", children: preview?.find((p) => p.record_id === w.record_id)?.title ?? w.record_id.slice(0, 8) }),
26750
- /* @__PURE__ */ jsx82("span", { className: "min-w-0 truncate text-right", children: w.absent ? w.absent === "conflicting" ? "Sources disagree" : "Nothing found" : String(w.value ?? "") })
26886
+ outcome?.ok && outcome.fieldId === row.field_id && outcome.wouldWrite && outcome.wouldWrite.length > 0 ? /* @__PURE__ */ jsx83("ul", { className: "space-y-1 rounded border p-2 text-xs", "data-testid": "enrich-would-write", children: outcome.wouldWrite.map((w) => /* @__PURE__ */ jsxs77("li", { className: "flex justify-between gap-2", children: [
26887
+ /* @__PURE__ */ jsx83("span", { className: "truncate text-muted-foreground", children: preview?.find((p) => p.record_id === w.record_id)?.title ?? w.record_id.slice(0, 8) }),
26888
+ /* @__PURE__ */ jsx83("span", { className: "min-w-0 truncate text-right", children: w.absent ? w.absent === "conflicting" ? "Sources disagree" : "Nothing found" : String(w.value ?? "") })
26751
26889
  ] }, w.record_id)) }) : null,
26752
- outcome && (outcome.fieldId === void 0 || outcome.fieldId === row.field_id) ? outcome.ok ? /* @__PURE__ */ jsxs76("p", { className: "text-xs text-muted-foreground", "data-testid": "enrich-outcome", children: [
26890
+ outcome && (outcome.fieldId === void 0 || outcome.fieldId === row.field_id) ? outcome.ok ? /* @__PURE__ */ jsxs77("p", { className: "text-xs text-muted-foreground", "data-testid": "enrich-outcome", children: [
26753
26891
  outcome.message,
26754
26892
  costInPoints(outcome.costCents, host.pointsRate) !== null ? ` \xB7 ${costInPoints(outcome.costCents, host.pointsRate)}` : ""
26755
26893
  ] }) : (
26756
26894
  // A run that did not happen is a refusal, with a heading and a remedy,
26757
26895
  // never the host's words in red (lane REFUSAL-SWEEP).
26758
- /* @__PURE__ */ jsx82(
26896
+ /* @__PURE__ */ jsx83(
26759
26897
  RefusalLine,
26760
26898
  {
26761
26899
  error: (0, refusals_exports.refusal)(
@@ -26825,7 +26963,7 @@ init_parity();
26825
26963
  init_names();
26826
26964
  import { humanizeIdentifier as humanizeIdentifier10 } from "@ai-matrx/kit/text-case";
26827
26965
  init_choiceLooks();
26828
- import { jsx as jsx83, jsxs as jsxs77 } from "react/jsx-runtime";
26966
+ import { jsx as jsx84, jsxs as jsxs78 } from "react/jsx-runtime";
26829
26967
  function workedOutFrom(field2) {
26830
26968
  const kind2 = editorKindFor(field2);
26831
26969
  if (kind2 !== "formula" && kind2 !== "lookup" && kind2 !== "rollup") return null;
@@ -26880,7 +27018,7 @@ function columnLabel(fields, columnId2) {
26880
27018
  return field2 ? fieldName(field2) : humanizeIdentifier10(columnId2);
26881
27019
  }
26882
27020
  function AddFieldButton({ onClick }) {
26883
- return /* @__PURE__ */ jsx83(
27021
+ return /* @__PURE__ */ jsx84(
26884
27022
  Button50,
26885
27023
  {
26886
27024
  size: "sm",
@@ -26902,22 +27040,22 @@ function Pager({
26902
27040
  const from = page * pageSize;
26903
27041
  const last = total === null ? rows < pageSize : from + rows >= total;
26904
27042
  if (page === 0 && last) return null;
26905
- return /* @__PURE__ */ jsxs77("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
26906
- /* @__PURE__ */ jsx83(Button50, { size: "sm", variant: "ghost", disabled: page === 0, onClick: () => onPage(page - 1), children: "Previous" }),
26907
- /* @__PURE__ */ jsxs77("span", { children: [
27043
+ return /* @__PURE__ */ jsxs78("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
27044
+ /* @__PURE__ */ jsx84(Button50, { size: "sm", variant: "ghost", disabled: page === 0, onClick: () => onPage(page - 1), children: "Previous" }),
27045
+ /* @__PURE__ */ jsxs78("span", { children: [
26908
27046
  from + 1,
26909
27047
  "\u2013",
26910
27048
  from + rows,
26911
27049
  total === null ? "" : ` of ${total}`
26912
27050
  ] }),
26913
- /* @__PURE__ */ jsx83(Button50, { size: "sm", variant: "ghost", disabled: last, onClick: () => onPage(page + 1), children: "Next" })
27051
+ /* @__PURE__ */ jsx84(Button50, { size: "sm", variant: "ghost", disabled: last, onClick: () => onPage(page + 1), children: "Next" })
26914
27052
  ] });
26915
27053
  }
26916
27054
  function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoChanged, enrich) {
26917
27055
  const name = fieldName(field2);
26918
27056
  const format = cellFormatFor(field2, look?.format);
26919
27057
  const workedOut = workedOutFrom(field2);
26920
- const syncedMark = field2.source === "synced" ? /* @__PURE__ */ jsx83(
27058
+ const syncedMark = field2.source === "synced" ? /* @__PURE__ */ jsx84(
26921
27059
  "span",
26922
27060
  {
26923
27061
  "data-records-synced": field2.key,
@@ -26928,25 +27066,25 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
26928
27066
  }
26929
27067
  ) : null;
26930
27068
  const restricted = field2.sensitivity === "confidential" || field2.sensitivity === "restricted";
26931
- const lockMark = restricted ? /* @__PURE__ */ jsx83(
27069
+ const lockMark = restricted ? /* @__PURE__ */ jsx84(
26932
27070
  "span",
26933
27071
  {
26934
27072
  "data-records-restricted": field2.key,
26935
27073
  title: "Fewer people see this column",
26936
27074
  "aria-label": "Fewer people see this column",
26937
27075
  className: "inline-flex text-muted-foreground",
26938
- children: /* @__PURE__ */ jsxs77("svg", { viewBox: "0 0 24 24", width: "11", height: "11", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
26939
- /* @__PURE__ */ jsx83("rect", { x: "4", y: "11", width: "16", height: "10", rx: "2" }),
26940
- /* @__PURE__ */ jsx83("path", { d: "M8 11V7a4 4 0 0 1 8 0v4" })
27076
+ children: /* @__PURE__ */ jsxs78("svg", { viewBox: "0 0 24 24", width: "11", height: "11", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
27077
+ /* @__PURE__ */ jsx84("rect", { x: "4", y: "11", width: "16", height: "10", rx: "2" }),
27078
+ /* @__PURE__ */ jsx84("path", { d: "M8 11V7a4 4 0 0 1 8 0v4" })
26941
27079
  ] })
26942
27080
  }
26943
27081
  ) : null;
26944
27082
  const withSynced = (inner2) => {
26945
- const header = lockMark ? /* @__PURE__ */ jsxs77("span", { className: "inline-flex items-center gap-1", children: [
27083
+ const header = lockMark ? /* @__PURE__ */ jsxs78("span", { className: "inline-flex items-center gap-1", children: [
26946
27084
  inner2,
26947
27085
  lockMark
26948
27086
  ] }) : inner2;
26949
- return syncedMark ? /* @__PURE__ */ jsxs77("span", { className: "inline-flex items-center gap-1", children: [
27087
+ return syncedMark ? /* @__PURE__ */ jsxs78("span", { className: "inline-flex items-center gap-1", children: [
26950
27088
  syncedMark,
26951
27089
  header
26952
27090
  ] }) : header;
@@ -26961,8 +27099,8 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
26961
27099
  header: withSynced(
26962
27100
  look?.rowLabel ? (
26963
27101
  // THE COLUMN THAT NAMES EACH RECORD says so (tranche 6i, the older grid's key marker).
26964
- /* @__PURE__ */ jsxs77("span", { className: "inline-flex items-center gap-1", children: [
26965
- /* @__PURE__ */ jsx83(
27102
+ /* @__PURE__ */ jsxs78("span", { className: "inline-flex items-center gap-1", children: [
27103
+ /* @__PURE__ */ jsx84(
26966
27104
  "span",
26967
27105
  {
26968
27106
  "data-records-row-label": field2.key,
@@ -26977,10 +27115,10 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
26977
27115
  ) : workedOut && stampMarkOf(field2) ? (
26978
27116
  // A STAMP OR A RECORD NUMBER (walk 2026-10-08 D7): kept by the store, but nobody wrote a formula
26979
27117
  // for it, so its header wears its own mark — a clock, a person, a number sign — never "fx".
26980
- /* @__PURE__ */ jsx83("span", { className: "inline-flex items-center", title: workedOut, "data-records-stamp": stampMarkOf(field2), children: withTypeMark(field2, name) })
26981
- ) : workedOut ? /* @__PURE__ */ jsxs77("span", { className: "inline-flex items-center gap-1", children: [
27118
+ /* @__PURE__ */ jsx84("span", { className: "inline-flex items-center", title: workedOut, "data-records-stamp": stampMarkOf(field2), children: withTypeMark(field2, name) })
27119
+ ) : workedOut ? /* @__PURE__ */ jsxs78("span", { className: "inline-flex items-center gap-1", children: [
26982
27120
  name,
26983
- /* @__PURE__ */ jsx83(
27121
+ /* @__PURE__ */ jsx84(
26984
27122
  "span",
26985
27123
  {
26986
27124
  "data-records-worked-out": field2.key,
@@ -27023,7 +27161,7 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
27023
27161
  * at viewer. It rendered zero of them. The shell is drawn whenever there
27024
27162
  * is an editor OR a question to ask; a null session simply has no editor.
27025
27163
  */
27026
- editing || onAskWhoChanged ? /* @__PURE__ */ jsx83(
27164
+ editing || onAskWhoChanged ? /* @__PURE__ */ jsx84(
27027
27165
  GridCell,
27028
27166
  {
27029
27167
  field: field2,
@@ -27034,8 +27172,8 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
27034
27172
  ...format ? { format } : {},
27035
27173
  ...onAskWhoChanged ? { onAskWhoChanged } : {}
27036
27174
  }
27037
- ) : /* @__PURE__ */ jsxs77("span", { className: "inline-flex items-center gap-1", children: [
27038
- /* @__PURE__ */ jsx83(
27175
+ ) : /* @__PURE__ */ jsxs78("span", { className: "inline-flex items-center gap-1", children: [
27176
+ /* @__PURE__ */ jsx84(
27039
27177
  RecordValue,
27040
27178
  {
27041
27179
  inCell: true,
@@ -27047,7 +27185,7 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
27047
27185
  ...format ? { format } : {}
27048
27186
  }
27049
27187
  ),
27050
- enrich ? /* @__PURE__ */ jsx83(
27188
+ enrich ? /* @__PURE__ */ jsx84(
27051
27189
  EnrichBadge,
27052
27190
  {
27053
27191
  cell: enrich.cellFor(row.id),
@@ -27111,8 +27249,8 @@ function withTypeMark(field2, header) {
27111
27249
  const stamp = stampMarkOf(field2);
27112
27250
  const kind2 = stamp ?? editorKindFor(field2);
27113
27251
  const parts = (stamp ? STAMP_ICON[stamp] : TYPE_ICON[editorKindFor(field2)]) ?? TYPE_ICON.text;
27114
- return /* @__PURE__ */ jsxs77("span", { className: "inline-flex min-w-0 items-center gap-1.5", "data-records-type-mark": kind2, title: fieldHelpText(field2), children: [
27115
- /* @__PURE__ */ jsx83(
27252
+ return /* @__PURE__ */ jsxs78("span", { className: "inline-flex min-w-0 items-center gap-1.5", "data-records-type-mark": kind2, title: fieldHelpText(field2), children: [
27253
+ /* @__PURE__ */ jsx84(
27116
27254
  "svg",
27117
27255
  {
27118
27256
  xmlns: "http://www.w3.org/2000/svg",
@@ -27129,7 +27267,7 @@ function withTypeMark(field2, header) {
27129
27267
  "data-records-type-icon": kind2,
27130
27268
  children: parts.map(([tag, attrs], i) => {
27131
27269
  const El = tag;
27132
- return /* @__PURE__ */ jsx83(El, { ...attrs }, i);
27270
+ return /* @__PURE__ */ jsx84(El, { ...attrs }, i);
27133
27271
  })
27134
27272
  }
27135
27273
  ),
@@ -27156,7 +27294,7 @@ import { useFields as useFields11, useOptionalRecordsClient as useOptionalRecord
27156
27294
  import { Button as Button51, Dialog as Dialog15, DialogContent as DialogContent15, DialogHeader as DialogHeader15, DialogTitle as DialogTitle15, Popover as Popover11, PopoverContent as PopoverContent11, PopoverTrigger as PopoverTrigger11, Separator as Separator5, Skeleton as Skeleton10, cn as cn45 } from "@ai-matrx/design-system";
27157
27295
  init_host();
27158
27296
  init_Refusal();
27159
- import { Fragment as Fragment27, jsx as jsx84, jsxs as jsxs78 } from "react/jsx-runtime";
27297
+ import { Fragment as Fragment28, jsx as jsx85, jsxs as jsxs79 } from "react/jsx-runtime";
27160
27298
  function reverseColumnId(column) {
27161
27299
  return `${REVERSE_COLUMN_PREFIX}${column.key}`;
27162
27300
  }
@@ -27176,25 +27314,25 @@ function ReverseLinkChips({
27176
27314
  loading,
27177
27315
  clamp
27178
27316
  }) {
27179
- if (!answer && loading) return /* @__PURE__ */ jsx84(Skeleton10, { className: "h-4 w-24", "data-records-reverse-loading": "" });
27180
- if (!answer || answer.total === 0) return /* @__PURE__ */ jsx84("span", { className: "text-muted-foreground", children: "\u2014" });
27317
+ if (!answer && loading) return /* @__PURE__ */ jsx85(Skeleton10, { className: "h-4 w-24", "data-records-reverse-loading": "" });
27318
+ if (!answer || answer.total === 0) return /* @__PURE__ */ jsx85("span", { className: "text-muted-foreground", children: "\u2014" });
27181
27319
  const refs = refsOf(column, answer);
27182
27320
  const more = answer.total - refs.length;
27183
27321
  if (clamp) {
27184
- return /* @__PURE__ */ jsx84(
27322
+ return /* @__PURE__ */ jsx85(
27185
27323
  ClampedChips,
27186
27324
  {
27187
27325
  dataAttr: column.key,
27188
- items: refs.map((r) => ({ key: r.id, node: /* @__PURE__ */ jsx84(ReferenceChip, { reference: r }) })),
27326
+ items: refs.map((r) => ({ key: r.id, node: /* @__PURE__ */ jsx85(ReferenceChip, { reference: r }) })),
27189
27327
  total: answer.total,
27190
- all: /* @__PURE__ */ jsx84(ReverseAllLinks, { column, tableId: clamp.tableId, recordId: clamp.recordId, first: refs, total: answer.total }),
27328
+ all: /* @__PURE__ */ jsx85(ReverseAllLinks, { column, tableId: clamp.tableId, recordId: clamp.recordId, first: refs, total: answer.total }),
27191
27329
  className
27192
27330
  }
27193
27331
  );
27194
27332
  }
27195
- return /* @__PURE__ */ jsxs78("span", { className: cn45("flex min-w-0 flex-wrap items-center gap-1", className), "data-records-reverse-cell": column.key, children: [
27196
- refs.map((r) => /* @__PURE__ */ jsx84(ReferenceChip, { reference: r }, r.id)),
27197
- more > 0 ? /* @__PURE__ */ jsxs78("span", { className: "shrink-0 text-[11px] text-muted-foreground", title: `${more} more`, "data-records-reverse-more": "", children: [
27333
+ return /* @__PURE__ */ jsxs79("span", { className: cn45("flex min-w-0 flex-wrap items-center gap-1", className), "data-records-reverse-cell": column.key, children: [
27334
+ refs.map((r) => /* @__PURE__ */ jsx85(ReferenceChip, { reference: r }, r.id)),
27335
+ more > 0 ? /* @__PURE__ */ jsxs79("span", { className: "shrink-0 text-[11px] text-muted-foreground", title: `${more} more`, "data-records-reverse-more": "", children: [
27198
27336
  "+",
27199
27337
  more
27200
27338
  ] }) : null
@@ -27213,10 +27351,10 @@ function ReverseAllLinks({
27213
27351
  const answer = read.data?.[column.key]?.[recordId];
27214
27352
  const refs = answer ? refsOf(column, answer) : first;
27215
27353
  const rest = total - refs.length;
27216
- return /* @__PURE__ */ jsxs78("span", { className: "flex flex-col gap-1.5", "data-records-reverse-all": column.key, children: [
27217
- /* @__PURE__ */ jsx84("span", { className: "flex flex-wrap gap-1", children: refs.map((r) => /* @__PURE__ */ jsx84(ReferenceChip, { reference: r }, r.id)) }),
27218
- read.error ? /* @__PURE__ */ jsx84(RefusalNotice, { error: read.error }) : null,
27219
- rest > 0 && !read.loading ? /* @__PURE__ */ jsxs78("span", { className: "text-[11px] text-muted-foreground", children: [
27354
+ return /* @__PURE__ */ jsxs79("span", { className: "flex flex-col gap-1.5", "data-records-reverse-all": column.key, children: [
27355
+ /* @__PURE__ */ jsx85("span", { className: "flex flex-wrap gap-1", children: refs.map((r) => /* @__PURE__ */ jsx85(ReferenceChip, { reference: r }, r.id)) }),
27356
+ read.error ? /* @__PURE__ */ jsx85(RefusalNotice, { error: read.error }) : null,
27357
+ rest > 0 && !read.loading ? /* @__PURE__ */ jsxs79("span", { className: "text-[11px] text-muted-foreground", children: [
27220
27358
  "+",
27221
27359
  rest,
27222
27360
  " more in the record panel"
@@ -27243,7 +27381,7 @@ function useReverseGridColumns(tableId, rowIds) {
27243
27381
  sortRefusal: `Kept on ${column.source_table_name}, so it cannot sort here.`,
27244
27382
  filter: false,
27245
27383
  copyValue: (row) => (held.answers?.[column.key]?.[row.id]?.links ?? []).map((l) => l.words).join(", "),
27246
- cell: (row) => row.id === SUMMARY_ROW_ID || row.id === ADD_ROW_ID ? null : /* @__PURE__ */ jsx84(ReverseCell, { held, column, rowId: row.id, tableId }),
27384
+ cell: (row) => row.id === SUMMARY_ROW_ID || row.id === ADD_ROW_ID ? null : /* @__PURE__ */ jsx85(ReverseCell, { held, column, rowId: row.id, tableId }),
27247
27385
  headerClassName: "whitespace-nowrap",
27248
27386
  className: "align-middle",
27249
27387
  ...{ title: `Linked from ${column.source_table_name}` }
@@ -27281,9 +27419,9 @@ function ReverseCell({ held, column, rowId, tableId }) {
27281
27419
  const readReading = () => held.reading;
27282
27420
  const answer = useSyncExternalStore5(subscribe, readAnswer, readAnswer);
27283
27421
  const reading = useSyncExternalStore5(subscribe, readReading, readReading);
27284
- const chips = /* @__PURE__ */ jsx84(ReverseLinkChips, { column, answer, loading: reading, clamp: { tableId, recordId: rowId } });
27422
+ const chips = /* @__PURE__ */ jsx85(ReverseLinkChips, { column, answer, loading: reading, clamp: { tableId, recordId: rowId } });
27285
27423
  if (column.read_only) return chips;
27286
- return /* @__PURE__ */ jsx84(ReverseLinksEditCell, { tableId, recordId: rowId, column, chips });
27424
+ return /* @__PURE__ */ jsx85(ReverseLinksEditCell, { tableId, recordId: rowId, column, chips });
27287
27425
  }
27288
27426
  var reverseCellOpeners = /* @__PURE__ */ new Map();
27289
27427
  function openReverseCell(rowId, columnId2) {
@@ -27315,8 +27453,8 @@ function ReverseLinksEditor({ tableId, recordId, column, autoOpen, onClose }) {
27315
27453
  const read = useReverseLinks(tableId, one, ids, REVERSE_LINKS_EDIT_MAX);
27316
27454
  const answer = read.data?.[column.key]?.[recordId];
27317
27455
  const [refused, setRefused] = useState70(null);
27318
- if (read.error) return /* @__PURE__ */ jsx84(RefusalNotice, { error: read.error });
27319
- if (!field2 || !answer || !client) return /* @__PURE__ */ jsx84(Skeleton10, { className: "h-7 w-40", "data-records-reverse-editor-loading": "" });
27456
+ if (read.error) return /* @__PURE__ */ jsx85(RefusalNotice, { error: read.error });
27457
+ if (!field2 || !answer || !client) return /* @__PURE__ */ jsx85(Skeleton10, { className: "h-7 w-40", "data-records-reverse-editor-loading": "" });
27320
27458
  const current = answer.links.map((l) => l.id);
27321
27459
  const write = async (next) => {
27322
27460
  const want = (Array.isArray(next) ? next : next ? [next] : []).map(String);
@@ -27327,9 +27465,9 @@ function ReverseLinksEditor({ tableId, recordId, column, autoOpen, onClose }) {
27327
27465
  setRefused(done.ok ? null : done.error);
27328
27466
  if (done.ok) read.reload();
27329
27467
  };
27330
- return /* @__PURE__ */ jsxs78("span", { className: "flex min-w-0 flex-col gap-1", "data-records-reverse-editor": column.key, children: [
27331
- /* @__PURE__ */ jsx84(RelationPicker, { field: field2, value: current, onChange: (next) => void write(next), autoOpen, onClose, excludeId: recordId }),
27332
- refused ? /* @__PURE__ */ jsx84(RefusalNotice, { error: refused }) : null
27468
+ return /* @__PURE__ */ jsxs79("span", { className: "flex min-w-0 flex-col gap-1", "data-records-reverse-editor": column.key, children: [
27469
+ /* @__PURE__ */ jsx85(RelationPicker, { field: field2, value: current, onChange: (next) => void write(next), autoOpen, onClose, excludeId: recordId }),
27470
+ refused ? /* @__PURE__ */ jsx85(RefusalNotice, { error: refused }) : null
27333
27471
  ] });
27334
27472
  }
27335
27473
  var REVERSE_LINKS_EDIT_MAX = 50;
@@ -27342,8 +27480,8 @@ function ReverseLinksEditCell({ tableId, recordId, column, chips }) {
27342
27480
  reverseCellOpeners.delete(key);
27343
27481
  };
27344
27482
  }, [key]);
27345
- return /* @__PURE__ */ jsxs78(Popover11, { open, onOpenChange: setOpen, children: [
27346
- /* @__PURE__ */ jsx84(PopoverTrigger11, { asChild: true, children: /* @__PURE__ */ jsx84(
27483
+ return /* @__PURE__ */ jsxs79(Popover11, { open, onOpenChange: setOpen, children: [
27484
+ /* @__PURE__ */ jsx85(PopoverTrigger11, { asChild: true, children: /* @__PURE__ */ jsx85(
27347
27485
  "span",
27348
27486
  {
27349
27487
  role: "button",
@@ -27366,21 +27504,21 @@ function ReverseLinksEditCell({ tableId, recordId, column, chips }) {
27366
27504
  setOpen(true);
27367
27505
  }
27368
27506
  },
27369
- children: /* @__PURE__ */ jsx84("span", { className: "min-w-0 flex-1", children: chips })
27507
+ children: /* @__PURE__ */ jsx85("span", { className: "min-w-0 flex-1", children: chips })
27370
27508
  }
27371
27509
  ) }),
27372
- /* @__PURE__ */ jsx84(PopoverContent11, { sizing: "content", align: "start", className: "w-80 p-2", children: open ? /* @__PURE__ */ jsx84(ReverseLinksEditor, { tableId, recordId, column, autoOpen: true, onClose: () => setOpen(false) }) : null })
27510
+ /* @__PURE__ */ jsx85(PopoverContent11, { sizing: "content", align: "start", className: "w-80 p-2", children: open ? /* @__PURE__ */ jsx85(ReverseLinksEditor, { tableId, recordId, column, autoOpen: true, onClose: () => setOpen(false) }) : null })
27373
27511
  ] });
27374
27512
  }
27375
27513
  var EMPTY_COLUMNS = [];
27376
27514
  function ReverseLinksSections({ tableId, recordId }) {
27377
27515
  const reverse = useReverseColumns3(tableId);
27378
- if (reverse.error) return reverse.error.code === "door_absent" ? null : /* @__PURE__ */ jsx84(RefusalNotice, { error: reverse.error });
27516
+ if (reverse.error) return reverse.error.code === "door_absent" ? null : /* @__PURE__ */ jsx85(RefusalNotice, { error: reverse.error });
27379
27517
  const columns = reverse.data ?? [];
27380
27518
  if (columns.length === 0) return null;
27381
- return /* @__PURE__ */ jsxs78(Fragment27, { children: [
27382
- /* @__PURE__ */ jsx84(Separator5, {}),
27383
- /* @__PURE__ */ jsx84("div", { className: "flex flex-col gap-3", "data-records-reverse-sections": "", children: columns.map((column) => /* @__PURE__ */ jsx84(ReverseLinksSection, { tableId, recordId, column }, column.key)) })
27519
+ return /* @__PURE__ */ jsxs79(Fragment28, { children: [
27520
+ /* @__PURE__ */ jsx85(Separator5, {}),
27521
+ /* @__PURE__ */ jsx85("div", { className: "flex flex-col gap-3", "data-records-reverse-sections": "", children: columns.map((column) => /* @__PURE__ */ jsx85(ReverseLinksSection, { tableId, recordId, column }, column.key)) })
27384
27522
  ] });
27385
27523
  }
27386
27524
  function ReverseLinksSection({ tableId, recordId, column }) {
@@ -27390,26 +27528,26 @@ function ReverseLinksSection({ tableId, recordId, column }) {
27390
27528
  const first = useReverseLinks(tableId, one, ids, Math.min(shown5, 50));
27391
27529
  const answer = first.data?.[column.key]?.[recordId];
27392
27530
  const [adding, setAdding] = useState70(false);
27393
- return /* @__PURE__ */ jsxs78("section", { className: "flex min-w-0 flex-col gap-1.5", "data-records-reverse-section": column.key, children: [
27394
- /* @__PURE__ */ jsxs78("div", { className: "flex items-center gap-2", children: [
27395
- /* @__PURE__ */ jsx84("h4", { className: "truncate text-xs font-medium", title: column.label, children: column.label }),
27396
- answer && answer.total > 0 ? /* @__PURE__ */ jsx84("span", { className: "text-[11px] text-muted-foreground", children: answer.total }) : null,
27397
- /* @__PURE__ */ jsx84(AddLinkedButton, { column, onAdd: () => setAdding(true) })
27531
+ return /* @__PURE__ */ jsxs79("section", { className: "flex min-w-0 flex-col gap-1.5", "data-records-reverse-section": column.key, children: [
27532
+ /* @__PURE__ */ jsxs79("div", { className: "flex items-center gap-2", children: [
27533
+ /* @__PURE__ */ jsx85("h4", { className: "truncate text-xs font-medium", title: column.label, children: column.label }),
27534
+ answer && answer.total > 0 ? /* @__PURE__ */ jsx85("span", { className: "text-[11px] text-muted-foreground", children: answer.total }) : null,
27535
+ /* @__PURE__ */ jsx85(AddLinkedButton, { column, onAdd: () => setAdding(true) })
27398
27536
  ] }),
27399
- first.error ? /* @__PURE__ */ jsx84(RefusalNotice, { error: first.error }) : column.read_only ? /* @__PURE__ */ jsx84(ReverseLinkChips, { column, answer, loading: first.loading }) : /* @__PURE__ */ jsx84(ReverseLinksEditor, { tableId, recordId, column }),
27400
- answer && answer.total > answer.links.length && answer.links.length < 50 ? /* @__PURE__ */ jsxs78(Button51, { size: "sm", variant: "ghost", className: "self-start px-1 text-[11px]", onClick: () => setShown((n) => n + REVERSE_PANEL_PAGE), children: [
27537
+ first.error ? /* @__PURE__ */ jsx85(RefusalNotice, { error: first.error }) : column.read_only ? /* @__PURE__ */ jsx85(ReverseLinkChips, { column, answer, loading: first.loading }) : /* @__PURE__ */ jsx85(ReverseLinksEditor, { tableId, recordId, column }),
27538
+ answer && answer.total > answer.links.length && answer.links.length < 50 ? /* @__PURE__ */ jsxs79(Button51, { size: "sm", variant: "ghost", className: "self-start px-1 text-[11px]", onClick: () => setShown((n) => n + REVERSE_PANEL_PAGE), children: [
27401
27539
  "Show ",
27402
27540
  Math.min(REVERSE_PANEL_PAGE, answer.total - answer.links.length),
27403
27541
  " more"
27404
27542
  ] }) : null,
27405
- adding ? /* @__PURE__ */ jsx84(AddLinkedDialog, { column, targetId: recordId, onClose: () => setAdding(false), onSaved: () => first.reload() }) : null
27543
+ adding ? /* @__PURE__ */ jsx85(AddLinkedDialog, { column, targetId: recordId, onClose: () => setAdding(false), onSaved: () => first.reload() }) : null
27406
27544
  ] });
27407
27545
  }
27408
27546
  function AddLinkedButton({ column, onAdd }) {
27409
27547
  const source = useTable9(column.source_table_id);
27410
27548
  const rights = useTableRights(source.data);
27411
27549
  if (!rights.known || !rights.write) return null;
27412
- return /* @__PURE__ */ jsx84(
27550
+ return /* @__PURE__ */ jsx85(
27413
27551
  Button51,
27414
27552
  {
27415
27553
  size: "sm",
@@ -27432,12 +27570,12 @@ function AddLinkedDialog({
27432
27570
  const fields = useFields11(column.source_table_id);
27433
27571
  const field2 = (fields.data ?? []).find((f) => f.id === column.source_field_id);
27434
27572
  const initial = field2 ? { [field2.key]: field2.multi ? [targetId] : targetId } : null;
27435
- return /* @__PURE__ */ jsx84(Dialog15, { open: true, onOpenChange: (next) => !next ? onClose() : void 0, children: /* @__PURE__ */ jsxs78(DialogContent15, { className: "sm:max-w-lg", "data-records-reverse-dialog": column.key, children: [
27436
- /* @__PURE__ */ jsx84(DialogHeader15, { children: /* @__PURE__ */ jsxs78(DialogTitle15, { children: [
27573
+ return /* @__PURE__ */ jsx85(Dialog15, { open: true, onOpenChange: (next) => !next ? onClose() : void 0, children: /* @__PURE__ */ jsxs79(DialogContent15, { className: "sm:max-w-lg", "data-records-reverse-dialog": column.key, children: [
27574
+ /* @__PURE__ */ jsx85(DialogHeader15, { children: /* @__PURE__ */ jsxs79(DialogTitle15, { children: [
27437
27575
  "Add to ",
27438
27576
  column.source_table_name
27439
27577
  ] }) }),
27440
- fields.error ? /* @__PURE__ */ jsx84(RefusalNotice, { error: fields.error }) : initial ? /* @__PURE__ */ jsx84(
27578
+ fields.error ? /* @__PURE__ */ jsx85(RefusalNotice, { error: fields.error }) : initial ? /* @__PURE__ */ jsx85(
27441
27579
  RecordForm,
27442
27580
  {
27443
27581
  tableId: column.source_table_id,
@@ -27453,7 +27591,7 @@ function AddLinkedDialog({
27453
27591
  }
27454
27592
 
27455
27593
  // src/subItems.tsx
27456
- import { jsx as jsx85, jsxs as jsxs79 } from "react/jsx-runtime";
27594
+ import { jsx as jsx86, jsxs as jsxs80 } from "react/jsx-runtime";
27457
27595
  function subItemsField(fields, tableId) {
27458
27596
  for (const f of fields ?? []) {
27459
27597
  const config = f.config ?? {};
@@ -27517,8 +27655,8 @@ function withSubItems(columns, tree, collapsed, onToggle, onAddSubItem) {
27517
27655
  const d = tree.depth.get(row.id);
27518
27656
  if (d === void 0) return drawn;
27519
27657
  const open = !collapsed.has(row.id);
27520
- return /* @__PURE__ */ jsxs79("span", { className: "flex min-w-0 items-center gap-0.5", style: { paddingLeft: d * SUB_ITEM_INDENT_PX }, "data-records-sub-item-depth": d, children: [
27521
- tree.parents.has(row.id) ? /* @__PURE__ */ jsx85(
27658
+ return /* @__PURE__ */ jsxs80("span", { className: "flex min-w-0 items-center gap-0.5", style: { paddingLeft: d * SUB_ITEM_INDENT_PX }, "data-records-sub-item-depth": d, children: [
27659
+ tree.parents.has(row.id) ? /* @__PURE__ */ jsx86(
27522
27660
  "button",
27523
27661
  {
27524
27662
  type: "button",
@@ -27532,9 +27670,9 @@ function withSubItems(columns, tree, collapsed, onToggle, onAddSubItem) {
27532
27670
  },
27533
27671
  children: open ? "\u25BE" : "\u25B8"
27534
27672
  }
27535
- ) : /* @__PURE__ */ jsx85("span", { className: "w-4 shrink-0", "aria-hidden": true }),
27536
- /* @__PURE__ */ jsx85("span", { className: "min-w-0 flex-1", children: drawn }),
27537
- onAddSubItem ? /* @__PURE__ */ jsx85(
27673
+ ) : /* @__PURE__ */ jsx86("span", { className: "w-4 shrink-0", "aria-hidden": true }),
27674
+ /* @__PURE__ */ jsx86("span", { className: "min-w-0 flex-1", children: drawn }),
27675
+ onAddSubItem ? /* @__PURE__ */ jsx86(
27538
27676
  "button",
27539
27677
  {
27540
27678
  type: "button",
@@ -27564,7 +27702,7 @@ init_Refusal();
27564
27702
  init_refusals();
27565
27703
  import { useState as useState71 } from "react";
27566
27704
  import { Badge as Badge12, Button as Button52, Separator as Separator6 } from "@ai-matrx/design-system";
27567
- import { Fragment as Fragment28, jsx as jsx86, jsxs as jsxs80 } from "react/jsx-runtime";
27705
+ import { Fragment as Fragment29, jsx as jsx87, jsxs as jsxs81 } from "react/jsx-runtime";
27568
27706
  function PastePreview({
27569
27707
  plan,
27570
27708
  noun,
@@ -27579,7 +27717,7 @@ function PastePreview({
27579
27717
  const [adding, setAdding] = useState71(null);
27580
27718
  const [addFailed, setAddFailed] = useState71(null);
27581
27719
  const nothingToDo = plan.cells === 0;
27582
- return /* @__PURE__ */ jsx86(
27720
+ return /* @__PURE__ */ jsx87(
27583
27721
  "div",
27584
27722
  {
27585
27723
  role: "dialog",
@@ -27593,50 +27731,50 @@ function PastePreview({
27593
27731
  event.stopPropagation();
27594
27732
  if (!busy) onCancel();
27595
27733
  },
27596
- children: /* @__PURE__ */ jsxs80("div", { className: "flex max-h-[80vh] w-full max-w-2xl flex-col gap-3 overflow-auto rounded-lg border bg-background p-4 shadow-lg", children: [
27597
- /* @__PURE__ */ jsxs80("div", { className: "flex items-baseline justify-between gap-3", children: [
27598
- /* @__PURE__ */ jsx86("h2", { className: "text-sm font-medium", children: outcome ? "What was written" : "Before this is written" }),
27599
- /* @__PURE__ */ jsx86("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) })
27734
+ children: /* @__PURE__ */ jsxs81("div", { className: "flex max-h-[80vh] w-full max-w-2xl flex-col gap-3 overflow-auto rounded-lg border bg-background p-4 shadow-lg", children: [
27735
+ /* @__PURE__ */ jsxs81("div", { className: "flex items-baseline justify-between gap-3", children: [
27736
+ /* @__PURE__ */ jsx87("h2", { className: "text-sm font-medium", children: outcome ? "What was written" : "Before this is written" }),
27737
+ /* @__PURE__ */ jsx87("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) })
27600
27738
  ] }),
27601
- /* @__PURE__ */ jsx86(Separator6, {}),
27602
- outcome === null ? /* @__PURE__ */ jsxs80(Fragment28, { children: [
27603
- nothingToDo ? /* @__PURE__ */ jsx86("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__ */ jsxs80("p", { className: "text-sm", children: [
27739
+ /* @__PURE__ */ jsx87(Separator6, {}),
27740
+ outcome === null ? /* @__PURE__ */ jsxs81(Fragment29, { children: [
27741
+ nothingToDo ? /* @__PURE__ */ jsx87("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__ */ jsxs81("p", { className: "text-sm", children: [
27604
27742
  sentence(plan, noun, nounPlural),
27605
27743
  " 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."
27606
27744
  ] }),
27607
- plan.header ? /* @__PURE__ */ jsxs80("p", { className: "text-xs text-muted-foreground", "data-matrx-paste-header": true, children: [
27745
+ plan.header ? /* @__PURE__ */ jsxs81("p", { className: "text-xs text-muted-foreground", "data-matrx-paste-header": true, children: [
27608
27746
  "The first line named columns, so it matched by name and is not written.",
27609
27747
  plan.header.unmatched.length > 0 ? ` Not in this table, so left out: ${plan.header.unmatched.join(", ")}.` : ""
27610
27748
  ] }) : null,
27611
- plan.droppedLines ? /* @__PURE__ */ jsxs80("p", { className: "text-xs text-muted-foreground", "data-matrx-paste-dropped": true, children: [
27749
+ plan.droppedLines ? /* @__PURE__ */ jsxs81("p", { className: "text-xs text-muted-foreground", "data-matrx-paste-dropped": true, children: [
27612
27750
  plural4(plan.droppedLines, "line", "lines"),
27613
27751
  " past the last row ",
27614
27752
  plan.droppedLines === 1 ? "was" : "were",
27615
27753
  " left out."
27616
27754
  ] }) : null,
27617
- /* @__PURE__ */ jsx86(PlanTable, { plan }),
27618
- plan.refusals.length > 0 ? /* @__PURE__ */ jsxs80("div", { "data-matrx-paste-refusals": true, className: "flex flex-col gap-1", children: [
27619
- /* @__PURE__ */ jsx86("p", { className: "text-xs font-medium", children: plan.refusals.length === 1 ? "One cell will be left alone:" : `${plan.refusals.length} cells will be left alone:` }),
27620
- /* @__PURE__ */ jsx86("ul", { className: "flex flex-col gap-1", children: plan.refusals.slice(0, 12).map((refusal3, index) => /* @__PURE__ */ jsxs80("li", { className: "text-xs text-muted-foreground", children: [
27621
- /* @__PURE__ */ jsx86("span", { className: "font-medium", children: refusal3.fromLine > 0 ? `Row ${refusal3.fromLine}, ${refusal3.column}` : refusal3.column }),
27755
+ /* @__PURE__ */ jsx87(PlanTable, { plan }),
27756
+ plan.refusals.length > 0 ? /* @__PURE__ */ jsxs81("div", { "data-matrx-paste-refusals": true, className: "flex flex-col gap-1", children: [
27757
+ /* @__PURE__ */ jsx87("p", { className: "text-xs font-medium", children: plan.refusals.length === 1 ? "One cell will be left alone:" : `${plan.refusals.length} cells will be left alone:` }),
27758
+ /* @__PURE__ */ jsx87("ul", { className: "flex flex-col gap-1", children: plan.refusals.slice(0, 12).map((refusal3, index) => /* @__PURE__ */ jsxs81("li", { className: "text-xs text-muted-foreground", children: [
27759
+ /* @__PURE__ */ jsx87("span", { className: "font-medium", children: refusal3.fromLine > 0 ? `Row ${refusal3.fromLine}, ${refusal3.column}` : refusal3.column }),
27622
27760
  " \u2014 ",
27623
27761
  refusal3.why
27624
27762
  ] }, index)) }),
27625
- plan.refusals.length > 12 ? /* @__PURE__ */ jsxs80("p", { className: "text-xs text-muted-foreground", children: [
27763
+ plan.refusals.length > 12 ? /* @__PURE__ */ jsxs81("p", { className: "text-xs text-muted-foreground", children: [
27626
27764
  plan.refusals.length - 12,
27627
27765
  " more of the same kinds."
27628
27766
  ] }) : null
27629
27767
  ] }) : null,
27630
- onAddOptions && plan.unmatchedOptions.length > 0 ? /* @__PURE__ */ jsxs80("div", { "data-matrx-paste-add-options": true, className: "flex flex-col gap-2", children: [
27631
- plan.unmatchedOptions.map((group) => /* @__PURE__ */ jsxs80("div", { className: "flex flex-wrap items-center gap-2", children: [
27632
- /* @__PURE__ */ jsxs80("p", { className: "text-xs", children: [
27633
- /* @__PURE__ */ jsx86("span", { className: "font-medium", children: group.column }),
27768
+ onAddOptions && plan.unmatchedOptions.length > 0 ? /* @__PURE__ */ jsxs81("div", { "data-matrx-paste-add-options": true, className: "flex flex-col gap-2", children: [
27769
+ plan.unmatchedOptions.map((group) => /* @__PURE__ */ jsxs81("div", { className: "flex flex-wrap items-center gap-2", children: [
27770
+ /* @__PURE__ */ jsxs81("p", { className: "text-xs", children: [
27771
+ /* @__PURE__ */ jsx87("span", { className: "font-medium", children: group.column }),
27634
27772
  " does not offer",
27635
27773
  " ",
27636
27774
  group.words.map((w) => `\u201C${w}\u201D`).join(", "),
27637
27775
  "."
27638
27776
  ] }),
27639
- /* @__PURE__ */ jsx86(
27777
+ /* @__PURE__ */ jsx87(
27640
27778
  Button52,
27641
27779
  {
27642
27780
  type: "button",
@@ -27662,9 +27800,9 @@ function PastePreview({
27662
27800
  }
27663
27801
  )
27664
27802
  ] }, group.fieldKey)),
27665
- addFailed ? /* @__PURE__ */ jsx86(RefusalLine, { error: addFailed }) : null
27803
+ addFailed ? /* @__PURE__ */ jsx87(RefusalLine, { error: addFailed }) : null
27666
27804
  ] }) : null,
27667
- plan.pastRightEdge > 0 ? /* @__PURE__ */ jsxs80("p", { className: "text-xs text-muted-foreground", children: [
27805
+ plan.pastRightEdge > 0 ? /* @__PURE__ */ jsxs81("p", { className: "text-xs text-muted-foreground", children: [
27668
27806
  plan.pastRightEdge,
27669
27807
  " ",
27670
27808
  plan.pastRightEdge === 1 ? "value was" : "values were",
@@ -27672,9 +27810,9 @@ function PastePreview({
27672
27810
  plan.pastRightEdge === 1 ? "it" : "them",
27673
27811
  ". Add the columns first and paste again."
27674
27812
  ] }) : null,
27675
- /* @__PURE__ */ jsxs80("div", { className: "flex items-center justify-end gap-2 pt-1", children: [
27676
- /* @__PURE__ */ jsx86(Button52, { size: "sm", variant: "ghost", onClick: onCancel, disabled: busy, autoFocus: nothingToDo, children: "Cancel" }),
27677
- onFillExisting && plan.creates > 0 && plan.updates > 0 ? /* @__PURE__ */ jsx86(
27813
+ /* @__PURE__ */ jsxs81("div", { className: "flex items-center justify-end gap-2 pt-1", children: [
27814
+ /* @__PURE__ */ jsx87(Button52, { size: "sm", variant: "ghost", onClick: onCancel, disabled: busy, autoFocus: nothingToDo, children: "Cancel" }),
27815
+ onFillExisting && plan.creates > 0 && plan.updates > 0 ? /* @__PURE__ */ jsx87(
27678
27816
  Button52,
27679
27817
  {
27680
27818
  size: "sm",
@@ -27685,7 +27823,7 @@ function PastePreview({
27685
27823
  children: "Fill only the existing rows"
27686
27824
  }
27687
27825
  ) : null,
27688
- /* @__PURE__ */ jsx86(
27826
+ /* @__PURE__ */ jsx87(
27689
27827
  Button52,
27690
27828
  {
27691
27829
  size: "sm",
@@ -27700,17 +27838,17 @@ function PastePreview({
27700
27838
  }
27701
27839
  )
27702
27840
  ] })
27703
- ] }) : /* @__PURE__ */ jsx86(Outcome, { outcome, onClose: onCancel })
27841
+ ] }) : /* @__PURE__ */ jsx87(Outcome, { outcome, onClose: onCancel })
27704
27842
  ] })
27705
27843
  }
27706
27844
  );
27707
27845
  }
27708
27846
  function Outcome({ outcome, onClose }) {
27709
27847
  const whole = outcome.missing === 0 && outcome.refusals.length === 0;
27710
- return /* @__PURE__ */ jsxs80(Fragment28, { children: [
27711
- /* @__PURE__ */ jsx86("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.` }),
27712
- outcome.refusals.length > 0 ? /* @__PURE__ */ jsx86("ul", { className: "flex flex-col gap-1", children: outcome.refusals.slice(0, 8).map((why, index) => /* @__PURE__ */ jsx86("li", { className: "text-xs text-muted-foreground", children: why }, index)) }) : null,
27713
- /* @__PURE__ */ jsx86("div", { className: "flex justify-end pt-1", children: /* @__PURE__ */ jsx86(Button52, { size: "sm", onClick: onClose, autoFocus: true, children: "Close" }) })
27848
+ return /* @__PURE__ */ jsxs81(Fragment29, { children: [
27849
+ /* @__PURE__ */ jsx87("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.` }),
27850
+ outcome.refusals.length > 0 ? /* @__PURE__ */ jsx87("ul", { className: "flex flex-col gap-1", children: outcome.refusals.slice(0, 8).map((why, index) => /* @__PURE__ */ jsx87("li", { className: "text-xs text-muted-foreground", children: why }, index)) }) : null,
27851
+ /* @__PURE__ */ jsx87("div", { className: "flex justify-end pt-1", children: /* @__PURE__ */ jsx87(Button52, { size: "sm", onClick: onClose, autoFocus: true, children: "Close" }) })
27714
27852
  ] });
27715
27853
  }
27716
27854
  function PlanTable({ plan }) {
@@ -27719,24 +27857,24 @@ function PlanTable({ plan }) {
27719
27857
  if (shown5.length === 0 || keys.length === 0) return null;
27720
27858
  const columnName = /* @__PURE__ */ new Map();
27721
27859
  for (const row of shown5) for (const cell2 of row.cells) if (!columnName.has(cell2.key)) columnName.set(cell2.key, cell2.column);
27722
- return /* @__PURE__ */ jsxs80("div", { className: "overflow-auto rounded border", children: [
27723
- /* @__PURE__ */ jsxs80("table", { className: "w-full text-xs", "data-matrx-paste-plan": true, children: [
27724
- /* @__PURE__ */ jsx86("thead", { className: "bg-muted/50", children: /* @__PURE__ */ jsxs80("tr", { children: [
27725
- /* @__PURE__ */ jsx86("th", { className: "px-2 py-1 text-left font-medium", children: "Row" }),
27726
- keys.map((key) => /* @__PURE__ */ jsx86("th", { className: "px-2 py-1 text-left font-medium", children: columnName.get(key) ?? key }, key))
27860
+ return /* @__PURE__ */ jsxs81("div", { className: "overflow-auto rounded border", children: [
27861
+ /* @__PURE__ */ jsxs81("table", { className: "w-full text-xs", "data-matrx-paste-plan": true, children: [
27862
+ /* @__PURE__ */ jsx87("thead", { className: "bg-muted/50", children: /* @__PURE__ */ jsxs81("tr", { children: [
27863
+ /* @__PURE__ */ jsx87("th", { className: "px-2 py-1 text-left font-medium", children: "Row" }),
27864
+ keys.map((key) => /* @__PURE__ */ jsx87("th", { className: "px-2 py-1 text-left font-medium", children: columnName.get(key) ?? key }, key))
27727
27865
  ] }) }),
27728
- /* @__PURE__ */ jsx86("tbody", { children: shown5.map((row) => /* @__PURE__ */ jsxs80("tr", { className: "border-t", children: [
27729
- /* @__PURE__ */ jsxs80("td", { className: "whitespace-nowrap px-2 py-1", children: [
27866
+ /* @__PURE__ */ jsx87("tbody", { children: shown5.map((row) => /* @__PURE__ */ jsxs81("tr", { className: "border-t", children: [
27867
+ /* @__PURE__ */ jsxs81("td", { className: "whitespace-nowrap px-2 py-1", children: [
27730
27868
  row.fromLine,
27731
- row.recordId === null ? /* @__PURE__ */ jsx86(Badge12, { variant: "outline", className: "ml-1", children: "new" }) : null
27869
+ row.recordId === null ? /* @__PURE__ */ jsx87(Badge12, { variant: "outline", className: "ml-1", children: "new" }) : null
27732
27870
  ] }),
27733
27871
  keys.map((key) => {
27734
27872
  const cell2 = row.cells.find((c) => c.key === key);
27735
- if (!cell2) return /* @__PURE__ */ jsx86("td", { className: "px-2 py-1" }, key);
27873
+ if (!cell2) return /* @__PURE__ */ jsx87("td", { className: "px-2 py-1" }, key);
27736
27874
  if (cell2.refusal !== null) {
27737
- return /* @__PURE__ */ jsx86("td", { className: "px-2 py-1 text-muted-foreground line-through", children: cell2.raw }, key);
27875
+ return /* @__PURE__ */ jsx87("td", { className: "px-2 py-1 text-muted-foreground line-through", children: cell2.raw }, key);
27738
27876
  }
27739
- return /* @__PURE__ */ jsx86("td", { className: "px-2 py-1", children: cell2.value === null ? /* @__PURE__ */ jsx86("span", { className: "text-muted-foreground", children: "cleared" }) : (
27877
+ return /* @__PURE__ */ jsx87("td", { className: "px-2 py-1", children: cell2.value === null ? /* @__PURE__ */ jsx87("span", { className: "text-muted-foreground", children: "cleared" }) : (
27740
27878
  // THE WORDS, NOT THE ID. A choice column stores the option
27741
27879
  // record's id and the person pasted a word; showing the id
27742
27880
  // here made this panel print
@@ -27747,7 +27885,7 @@ function PlanTable({ plan }) {
27747
27885
  })
27748
27886
  ] }, row.fromLine)) })
27749
27887
  ] }),
27750
- plan.rows.length > shown5.length ? /* @__PURE__ */ jsxs80("p", { className: "px-2 py-1 text-xs text-muted-foreground", children: [
27888
+ plan.rows.length > shown5.length ? /* @__PURE__ */ jsxs81("p", { className: "px-2 py-1 text-xs text-muted-foreground", children: [
27751
27889
  "\u2026and ",
27752
27890
  plan.rows.length - shown5.length,
27753
27891
  " more rows the same way."
@@ -27804,8 +27942,8 @@ init_host();
27804
27942
  init_rights();
27805
27943
  init_names();
27806
27944
  init_plainWords();
27807
- import { openOutbound as openOutbound2 } from "@ai-matrx/kit/outbound";
27808
- import { Fragment as Fragment29, jsx as jsx87, jsxs as jsxs81 } from "react/jsx-runtime";
27945
+ import { openOutbound as openOutbound3 } from "@ai-matrx/kit/outbound";
27946
+ import { Fragment as Fragment30, jsx as jsx88, jsxs as jsxs82 } from "react/jsx-runtime";
27809
27947
  function duplicateValues(fields, document2) {
27810
27948
  const data = {};
27811
27949
  for (const field2 of fields) {
@@ -27838,7 +27976,7 @@ function useRecordActionHost({ tableId, row, onOpenRecord, onChanged, onMerge, o
27838
27976
  // The record's panel carries its history under it — on its page, or in the table's rail.
27839
27977
  ...href ? { history: () => navigate ? navigate(href) : window.location.assign(href) } : onOpenRecord ? { history: (r) => onOpenRecord(r.id) } : {},
27840
27978
  openInNewTab: (url) => {
27841
- openOutbound2(url, "_blank", "noopener");
27979
+ openOutbound3(url, "_blank", "noopener");
27842
27980
  },
27843
27981
  copyText: async (url) => {
27844
27982
  if (await copyText3(url)) {
@@ -27900,7 +28038,7 @@ function useRecordActionHost({ tableId, row, onOpenRecord, onChanged, onMerge, o
27900
28038
  }
27901
28039
  function ContextActionItem({ action: action3 }) {
27902
28040
  const disabled = action3.disabledReason !== void 0;
27903
- return /* @__PURE__ */ jsxs81(
28041
+ return /* @__PURE__ */ jsxs82(
27904
28042
  ContextMenuItem,
27905
28043
  {
27906
28044
  disabled,
@@ -27911,26 +28049,26 @@ function ContextActionItem({ action: action3 }) {
27911
28049
  "data-object-action": action3.id,
27912
28050
  className: action3.destructive ? "text-destructive focus:text-destructive" : void 0,
27913
28051
  children: [
27914
- /* @__PURE__ */ jsx87(ObjectActionGlyph, { name: action3.icon, className: "mr-2 h-4 w-4 shrink-0" }),
27915
- /* @__PURE__ */ jsxs81("span", { className: "flex min-w-0 flex-col", children: [
27916
- /* @__PURE__ */ jsx87("span", { children: action3.label }),
27917
- disabled ? /* @__PURE__ */ jsx87("span", { className: "truncate text-xs text-muted-foreground", "data-object-action-reason": "", children: action3.disabledReason }) : null
28052
+ /* @__PURE__ */ jsx88(ObjectActionGlyph, { name: action3.icon, className: "mr-2 h-4 w-4 shrink-0" }),
28053
+ /* @__PURE__ */ jsxs82("span", { className: "flex min-w-0 flex-col", children: [
28054
+ /* @__PURE__ */ jsx88("span", { children: action3.label }),
28055
+ disabled ? /* @__PURE__ */ jsx88("span", { className: "truncate text-xs text-muted-foreground", "data-object-action-reason": "", children: action3.disabledReason }) : null
27918
28056
  ] }),
27919
- action3.shortcut ? /* @__PURE__ */ jsx87(ContextMenuShortcut, { children: action3.shortcut }) : null
28057
+ action3.shortcut ? /* @__PURE__ */ jsx88(ContextMenuShortcut, { children: action3.shortcut }) : null
27920
28058
  ]
27921
28059
  }
27922
28060
  );
27923
28061
  }
27924
28062
  function ObjectActionContextMenuItems({ actions }) {
27925
- return /* @__PURE__ */ jsx87(Fragment29, { children: toDropdownEntries(actions).map((entry) => {
27926
- if (entry.kind === "separator") return /* @__PURE__ */ jsx87(ContextMenuSeparator, {}, entry.id);
27927
- if (entry.kind === "item") return /* @__PURE__ */ jsx87(ContextActionItem, { action: entry.action }, entry.action.id);
27928
- return /* @__PURE__ */ jsxs81(ContextMenuSub, { children: [
27929
- /* @__PURE__ */ jsxs81(ContextMenuSubTrigger, { "data-object-action-group": entry.id, children: [
27930
- entry.icon ? /* @__PURE__ */ jsx87(ObjectActionGlyph, { name: entry.icon, className: "mr-2 h-4 w-4 shrink-0" }) : null,
28063
+ return /* @__PURE__ */ jsx88(Fragment30, { children: toDropdownEntries(actions).map((entry) => {
28064
+ if (entry.kind === "separator") return /* @__PURE__ */ jsx88(ContextMenuSeparator, {}, entry.id);
28065
+ if (entry.kind === "item") return /* @__PURE__ */ jsx88(ContextActionItem, { action: entry.action }, entry.action.id);
28066
+ return /* @__PURE__ */ jsxs82(ContextMenuSub, { children: [
28067
+ /* @__PURE__ */ jsxs82(ContextMenuSubTrigger, { "data-object-action-group": entry.id, children: [
28068
+ entry.icon ? /* @__PURE__ */ jsx88(ObjectActionGlyph, { name: entry.icon, className: "mr-2 h-4 w-4 shrink-0" }) : null,
27931
28069
  entry.label
27932
28070
  ] }),
27933
- /* @__PURE__ */ jsx87(ContextMenuSubContent, { children: entry.actions.map((a) => /* @__PURE__ */ jsx87(ContextActionItem, { action: a }, a.id)) })
28071
+ /* @__PURE__ */ jsx88(ContextMenuSubContent, { children: entry.actions.map((a) => /* @__PURE__ */ jsx88(ContextActionItem, { action: a }, a.id)) })
27934
28072
  ] }, entry.id);
27935
28073
  }) });
27936
28074
  }
@@ -27947,11 +28085,11 @@ function RecordActionMenu({ tableId, row, name, onOpenRecord, onChanged, childre
27947
28085
  () => recordActions({ record: { id: row.id, tableId, name }, rights, host: actionHost }),
27948
28086
  [row.id, tableId, name, rights, actionHost]
27949
28087
  );
27950
- return /* @__PURE__ */ jsxs81(ContextMenu, { children: [
27951
- /* @__PURE__ */ jsx87(ContextMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs81("div", { className: cn46("group/record-card relative", className), "data-record-actions": row.id, children: [
28088
+ return /* @__PURE__ */ jsxs82(ContextMenu, { children: [
28089
+ /* @__PURE__ */ jsx88(ContextMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs82("div", { className: cn46("group/record-card relative", className), "data-record-actions": row.id, children: [
27952
28090
  children,
27953
- /* @__PURE__ */ jsxs81(DropdownMenu5, { children: [
27954
- /* @__PURE__ */ jsx87(DropdownMenuTrigger5, { asChild: true, children: /* @__PURE__ */ jsx87(
28091
+ /* @__PURE__ */ jsxs82(DropdownMenu5, { children: [
28092
+ /* @__PURE__ */ jsx88(DropdownMenuTrigger5, { asChild: true, children: /* @__PURE__ */ jsx88(
27955
28093
  "button",
27956
28094
  {
27957
28095
  type: "button",
@@ -27959,18 +28097,18 @@ function RecordActionMenu({ tableId, row, name, onOpenRecord, onChanged, childre
27959
28097
  title: "More",
27960
28098
  "data-record-actions-trigger": row.id,
27961
28099
  className: "absolute right-0.5 top-0.5 flex h-6 w-6 items-center justify-center rounded bg-background/90 text-muted-foreground opacity-0 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/record-card:opacity-100 data-[state=open]:opacity-100 [@media(hover:none)]:opacity-100",
27962
- children: /* @__PURE__ */ jsxs81("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "currentColor", "aria-hidden": "true", children: [
27963
- /* @__PURE__ */ jsx87("circle", { cx: "5", cy: "12", r: "1.75" }),
27964
- /* @__PURE__ */ jsx87("circle", { cx: "12", cy: "12", r: "1.75" }),
27965
- /* @__PURE__ */ jsx87("circle", { cx: "19", cy: "12", r: "1.75" })
28100
+ children: /* @__PURE__ */ jsxs82("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "currentColor", "aria-hidden": "true", children: [
28101
+ /* @__PURE__ */ jsx88("circle", { cx: "5", cy: "12", r: "1.75" }),
28102
+ /* @__PURE__ */ jsx88("circle", { cx: "12", cy: "12", r: "1.75" }),
28103
+ /* @__PURE__ */ jsx88("circle", { cx: "19", cy: "12", r: "1.75" })
27966
28104
  ] })
27967
28105
  }
27968
28106
  ) }),
27969
- /* @__PURE__ */ jsx87(DropdownMenuContent5, { align: "end", className: "w-56", children: /* @__PURE__ */ jsx87(ObjectActionMenuItems, { actions }) })
28107
+ /* @__PURE__ */ jsx88(DropdownMenuContent5, { align: "end", className: "w-56", children: /* @__PURE__ */ jsx88(ObjectActionMenuItems, { actions }) })
27970
28108
  ] })
27971
28109
  ] }) }),
27972
- /* @__PURE__ */ jsx87(ContextMenuContent, { className: "w-56", children: /* @__PURE__ */ jsx87(ObjectActionContextMenuItems, { actions }) }),
27973
- merging ? /* @__PURE__ */ jsx87(
28110
+ /* @__PURE__ */ jsx88(ContextMenuContent, { className: "w-56", children: /* @__PURE__ */ jsx88(ObjectActionContextMenuItems, { actions }) }),
28111
+ merging ? /* @__PURE__ */ jsx88(
27974
28112
  MergeRecordDialog,
27975
28113
  {
27976
28114
  tableId,
@@ -27980,7 +28118,7 @@ function RecordActionMenu({ tableId, row, name, onOpenRecord, onChanged, childre
27980
28118
  onMerged: onChanged
27981
28119
  }
27982
28120
  ) : null,
27983
- splitting ? /* @__PURE__ */ jsx87(
28121
+ splitting ? /* @__PURE__ */ jsx88(
27984
28122
  SplitRecordDialog,
27985
28123
  {
27986
28124
  tableId,
@@ -27991,7 +28129,7 @@ function RecordActionMenu({ tableId, row, name, onOpenRecord, onChanged, childre
27991
28129
  onChanged
27992
28130
  }
27993
28131
  ) : null,
27994
- extracting ? /* @__PURE__ */ jsx87(
28132
+ extracting ? /* @__PURE__ */ jsx88(
27995
28133
  ExtractParentDialog,
27996
28134
  {
27997
28135
  tableId,
@@ -28005,118 +28143,17 @@ function RecordActionMenu({ tableId, row, name, onOpenRecord, onChanged, childre
28005
28143
  ] });
28006
28144
  }
28007
28145
 
28008
- // src/gridOpen.tsx
28009
- import { openOutbound as openOutbound3 } from "@ai-matrx/kit/outbound";
28010
- import { Fragment as Fragment30, jsx as jsx88, jsxs as jsxs82 } from "react/jsx-runtime";
28011
- var TITLE_OWN_CONTROLS = 'input, textarea, select, button, a[href], [role="combobox"], [contenteditable="true"], [contenteditable=""]';
28012
- function openRecordLabel(name) {
28013
- return `Open ${name}`;
28014
- }
28015
- function opensOnKey(event) {
28016
- if (event.key !== " " || event.altKey || event.ctrlKey || event.metaKey) return false;
28017
- const target = event.target;
28018
- if (!target) return false;
28019
- const tag = target.tagName;
28020
- if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || tag === "BUTTON") return false;
28021
- if (target.isContentEditable) {
28022
- const editor = target.closest('[contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"]');
28023
- const inside = event.currentTarget;
28024
- if (!editor || !inside || inside.contains(editor)) return false;
28025
- }
28026
- return true;
28027
- }
28028
- function withOpenRecord(columns, onOpen, nameOf3, place = "end", hrefOf, navigate) {
28029
- if (!onOpen) return columns;
28030
- return columns.map((column, index) => {
28031
- const original = column.cell;
28032
- const render = (row, rowIndex) => original ? original(row, rowIndex) : String(row[column.id ?? ""] ?? "");
28033
- const openFrom = (row, event) => {
28034
- const href = hrefOf?.(row);
28035
- if (!href) {
28036
- onOpen(row.id);
28037
- return;
28038
- }
28039
- if (event.metaKey || event.ctrlKey) openOutbound3(href, "_blank", "noopener");
28040
- else if (navigate) navigate(href);
28041
- else window.location.assign(href);
28042
- };
28043
- const handle = (row) => /* @__PURE__ */ jsxs82(
28044
- "button",
28045
- {
28046
- type: "button",
28047
- "data-records-open-record": row.id,
28048
- "aria-label": openRecordLabel(nameOf3(row)),
28049
- title: `${openRecordLabel(nameOf3(row))} (Space)`,
28050
- className: "absolute right-0 top-1/2 z-10 inline-flex h-6 -translate-y-1/2 items-center gap-1 rounded border border-border bg-card px-1.5 text-xs font-medium leading-none text-foreground no-underline opacity-0 shadow-sm hover:bg-muted focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/matrx-row:opacity-100 [@media(hover:none)]:opacity-100",
28051
- onClick: (event) => {
28052
- event.stopPropagation();
28053
- openFrom(row, event);
28054
- },
28055
- onDoubleClick: (event) => event.stopPropagation(),
28056
- children: [
28057
- /* @__PURE__ */ jsx88("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", width: "12", height: "12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx88("path", { d: "M9.5 2.5h4v4M13.5 2.5 8.5 7.5M6.5 3.5h-3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-3" }) }),
28058
- "Open"
28059
- ]
28060
- }
28061
- );
28062
- const titleTarget = (event) => {
28063
- const target = event.target;
28064
- if (!target || typeof target.closest !== "function") return false;
28065
- const hit = target.closest(TITLE_OWN_CONTROLS);
28066
- return hit === null || !event.currentTarget.contains(hit);
28067
- };
28068
- return {
28069
- ...column,
28070
- cell: (row, rowIndex) => /* @__PURE__ */ jsx88(
28071
- "span",
28072
- {
28073
- className: index === 0 ? "relative flex min-w-0 items-center gap-1" : "contents",
28074
- "data-records-opens-on-space": row.id,
28075
- onKeyDown: (event) => {
28076
- if (!opensOnKey(event)) return;
28077
- event.preventDefault();
28078
- event.stopPropagation();
28079
- onOpen(row.id);
28080
- },
28081
- children: index === 0 ? /* @__PURE__ */ jsxs82(Fragment30, { children: [
28082
- place === "start" ? handle(row) : null,
28083
- /* @__PURE__ */ jsx88(
28084
- "span",
28085
- {
28086
- className: "min-w-0 flex-1 decoration-muted-foreground/60 underline-offset-2 hover:underline",
28087
- "data-clickable": "",
28088
- "data-records-opens-on-click": row.id,
28089
- onClick: (event) => {
28090
- if (!titleTarget(event)) return;
28091
- openFrom(row, event);
28092
- },
28093
- onDoubleClickCapture: (event) => {
28094
- if (!titleTarget(event)) return;
28095
- event.stopPropagation();
28096
- openFrom(row, event);
28097
- },
28098
- children: render(row, rowIndex)
28099
- }
28100
- ),
28101
- place === "end" ? handle(row) : null
28102
- ] }) : render(row, rowIndex)
28103
- }
28104
- )
28105
- };
28106
- });
28107
- }
28108
-
28109
28146
  // src/Grid.tsx
28110
28147
  init_ImportWizard();
28111
28148
  init_tableShape();
28112
28149
 
28113
28150
  // src/toolbarSlot.tsx
28114
- import { createContext as createContext7, useContext as useContext7 } from "react";
28151
+ import { createContext as createContext8, useContext as useContext8 } from "react";
28115
28152
  import { createPortal as createPortal2 } from "react-dom";
28116
28153
  import { Fragment as Fragment31, jsx as jsx89 } from "react/jsx-runtime";
28117
- var TableToolbarSlotContext = createContext7(void 0);
28154
+ var TableToolbarSlotContext = createContext8(void 0);
28118
28155
  function useTableToolbarSlot() {
28119
- return useContext7(TableToolbarSlotContext);
28156
+ return useContext8(TableToolbarSlotContext);
28120
28157
  }
28121
28158
  function InTableToolbar({ children }) {
28122
28159
  const slot = useTableToolbarSlot();
@@ -28124,13 +28161,13 @@ function InTableToolbar({ children }) {
28124
28161
  if (slot === null) return null;
28125
28162
  return createPortal2(children, slot);
28126
28163
  }
28127
- var TableToolbarFoldContext = createContext7(0);
28164
+ var TableToolbarFoldContext = createContext8(0);
28128
28165
  function useTableToolbarFold() {
28129
- return useContext7(TableToolbarFoldContext);
28166
+ return useContext8(TableToolbarFoldContext);
28130
28167
  }
28131
- var TableToolbarSheetExtrasContext = createContext7(void 0);
28168
+ var TableToolbarSheetExtrasContext = createContext8(void 0);
28132
28169
  function useTableToolbarSheetExtras() {
28133
- return useContext7(TableToolbarSheetExtrasContext);
28170
+ return useContext8(TableToolbarSheetExtrasContext);
28134
28171
  }
28135
28172
 
28136
28173
  // src/GridLayoutMenu.tsx
@@ -28262,15 +28299,15 @@ function GridLayoutMenu({
28262
28299
  }
28263
28300
 
28264
28301
  // src/newRowValues.tsx
28265
- import { createContext as createContext8, useContext as useContext8 } from "react";
28302
+ import { createContext as createContext9, useContext as useContext9 } from "react";
28266
28303
  import { Fragment as Fragment33, jsx as jsx91 } from "react/jsx-runtime";
28267
- var NewRowValuesContext = createContext8(null);
28304
+ var NewRowValuesContext = createContext9(null);
28268
28305
  function NewRowValuesProvider({ values, children }) {
28269
28306
  if (!values || Object.keys(values).length === 0) return /* @__PURE__ */ jsx91(Fragment33, { children });
28270
28307
  return /* @__PURE__ */ jsx91(NewRowValuesContext.Provider, { value: values, children });
28271
28308
  }
28272
28309
  function useNewRowValues() {
28273
- return useContext8(NewRowValuesContext);
28310
+ return useContext9(NewRowValuesContext);
28274
28311
  }
28275
28312
  function withNewRowValues(preset, data) {
28276
28313
  return { ...preset ?? {}, ...data ?? {} };
@@ -29847,7 +29884,7 @@ function StructureLocked({ className }) {
29847
29884
  init_PickOne();
29848
29885
 
29849
29886
  // src/viewAddress.ts
29850
- import { createContext as createContext9, useContext as useContext9 } from "react";
29887
+ import { createContext as createContext10, useContext as useContext10 } from "react";
29851
29888
  var VIEW_ADDRESS_KEYS = ["sort", "cf", "q", "hide", "page"];
29852
29889
  function isViewAddressEmpty(state2) {
29853
29890
  if (!state2) return true;
@@ -29901,8 +29938,8 @@ function viewAddressFromParams(get) {
29901
29938
  function sameViewAddress(a, b) {
29902
29939
  return JSON.stringify(viewAddressToParams(a)) === JSON.stringify(viewAddressToParams(b));
29903
29940
  }
29904
- var ViewAddressContext = createContext9(null);
29905
- var useViewAddress = () => useContext9(ViewAddressContext);
29941
+ var ViewAddressContext = createContext10(null);
29942
+ var useViewAddress = () => useContext10(ViewAddressContext);
29906
29943
 
29907
29944
  // src/Grid.tsx
29908
29945
  import { Fragment as Fragment36, jsx as jsx99, jsxs as jsxs89 } from "react/jsx-runtime";
@@ -29953,7 +29990,6 @@ function GridBody({
29953
29990
  const fills = footer === "sticky";
29954
29991
  const host = useRecordsUi();
29955
29992
  const hrefForRecord = host.hrefForRecord;
29956
- const navigate = host.navigate;
29957
29993
  const client = useRecordsClient50();
29958
29994
  const table = useTable11(tableId);
29959
29995
  const fields = useFields13(tableId);
@@ -31150,9 +31186,9 @@ function GridBody({
31150
31186
  (row) => recordNameIn(table.data, row.document ?? {}),
31151
31187
  // The merged grid's handle sits at the START of the row, where Airtable's expand sits.
31152
31188
  merged ? "start" : "end",
31153
- // ⤢ opens the record's own page when the host has one; Space keeps the peek.
31189
+ // ⌘/Ctrl-click opens the record's own page in a new tab; every other way in opens the panel.
31154
31190
  hrefForRecord && table.data ? (row) => hrefForRecord({ table: table.data, recordId: row.id }) : void 0,
31155
- navigate
31191
+ onOpenRecord
31156
31192
  ),
31157
31193
  // REL-9: the tables that link HERE, as read-only columns after the table's own
31158
31194
  // (`ReverseColumns.tsx`). Virtual — never a Field, so no menu, filter or paste reaches them.
@@ -31162,7 +31198,7 @@ function GridBody({
31162
31198
  ),
31163
31199
  mayAddRow ? () => footerNow.current.addLine() : null
31164
31200
  ),
31165
- [treeColumns, reverseGridColumns, onOpenRecord, table.data, merged, mayAddRow, hrefForRecord, navigate]
31201
+ [treeColumns, reverseGridColumns, onOpenRecord, table.data, merged, mayAddRow, hrefForRecord]
31166
31202
  );
31167
31203
  const isRowSelectable = useCallback32((row) => row.id !== SUMMARY_ROW.id && mayWriteRow(row.id), [mayWriteRow]);
31168
31204
  const viewRowsNow = useRef42([]);
@@ -52628,7 +52664,7 @@ init_Refusal();
52628
52664
  init_host();
52629
52665
 
52630
52666
  // src/PageCanvas.tsx
52631
- import { createContext as createContext10, useContext as useContext10, useEffect as useEffect119, useMemo as useMemo78, useState as useState139 } from "react";
52667
+ import { createContext as createContext11, useContext as useContext11, useEffect as useEffect119, useMemo as useMemo78, useState as useState139 } from "react";
52632
52668
  import {
52633
52669
  useFields as useFields35,
52634
52670
  useRecordPage as useRecordPage3,
@@ -52725,10 +52761,10 @@ function RecordStepper({ neighbors, onStep, expanded, onToggleExpand }) {
52725
52761
 
52726
52762
  // src/PageCanvas.tsx
52727
52763
  import { Fragment as Fragment66, jsx as jsx165, jsxs as jsxs153 } from "react/jsx-runtime";
52728
- var InterfaceDoorContext = createContext10(null);
52764
+ var InterfaceDoorContext = createContext11(null);
52729
52765
  var InterfaceDoorProvider = InterfaceDoorContext.Provider;
52730
52766
  function useInterfaceDoor() {
52731
- return useContext10(InterfaceDoorContext);
52767
+ return useContext11(InterfaceDoorContext);
52732
52768
  }
52733
52769
  function doorField(f) {
52734
52770
  return {