@ai-matrx/records-ui 0.83.0 → 0.84.0

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
@@ -2114,7 +2114,7 @@ function useGridEditing({ tableId, fields, rows, reload, canWrite, mayWriteRow }
2114
2114
  startedFrom.current = null;
2115
2115
  }, []);
2116
2116
  const writeCellNow = useCallback4(
2117
- async (rowId, key, value, resent = false) => {
2117
+ async (rowId, key, value, base, resent = false) => {
2118
2118
  const id = cellKey(rowId, key);
2119
2119
  setOptimistic((held) => ({ ...held, [id]: value }));
2120
2120
  setSaving((held) => ({ ...held, [id]: true }));
@@ -2161,8 +2161,8 @@ function useGridEditing({ tableId, fields, rows, reload, canWrite, mayWriteRow }
2161
2161
  if (written.error.code === "stale_write") {
2162
2162
  if (conflict) rememberVersion(versions.current, rowId, conflict.current_version);
2163
2163
  else versions.current.delete(rowId);
2164
- if (conflict && !resent && !Object.prototype.hasOwnProperty.call(conflict.contested_fields, key)) {
2165
- await writeCellNow(rowId, key, value, true);
2164
+ if (conflict && !resent && sameValue(conflict.contested_fields[key], base)) {
2165
+ await writeCellNow(rowId, key, value, base, true);
2166
2166
  return;
2167
2167
  }
2168
2168
  }
@@ -2179,9 +2179,9 @@ function useGridEditing({ tableId, fields, rows, reload, canWrite, mayWriteRow }
2179
2179
  [client, reload]
2180
2180
  );
2181
2181
  const writeCell = useCallback4(
2182
- (rowId, key, value) => {
2182
+ (rowId, key, value, base) => {
2183
2183
  const behind = queues.current.get(rowId) ?? Promise.resolve();
2184
- const next = behind.then(() => writeCellNow(rowId, key, value));
2184
+ const next = behind.then(() => writeCellNow(rowId, key, value, base));
2185
2185
  queues.current.set(
2186
2186
  rowId,
2187
2187
  next.then(
@@ -2199,7 +2199,7 @@ function useGridEditing({ tableId, fields, rows, reload, canWrite, mayWriteRow }
2199
2199
  const open = editing;
2200
2200
  if (!open) return;
2201
2201
  const value = typed.current;
2202
- if (!sameValue(startedFrom.current, value)) void writeCell(open.rowId, open.key, value);
2202
+ if (!sameValue(startedFrom.current, value)) void writeCell(open.rowId, open.key, value, startedFrom.current);
2203
2203
  if (!move) {
2204
2204
  setEditing(null);
2205
2205
  setDraft(null);
@@ -2228,7 +2228,7 @@ function useGridEditing({ tableId, fields, rows, reload, canWrite, mayWriteRow }
2228
2228
  (rowId, key) => {
2229
2229
  const held = refusals[cellKey(rowId, key)];
2230
2230
  if (!held) return;
2231
- void writeCell(rowId, key, held.attempted);
2231
+ void writeCell(rowId, key, held.attempted, held.conflict?.contested_fields[key]);
2232
2232
  },
2233
2233
  [refusals, writeCell]
2234
2234
  );
@@ -2324,7 +2324,7 @@ function useGridEditing({ tableId, fields, rows, reload, canWrite, mayWriteRow }
2324
2324
  commit,
2325
2325
  setCell: (rowId, key, value) => {
2326
2326
  if (!writable(rowId)) return;
2327
- void writeCell(rowId, key, value);
2327
+ void writeCell(rowId, key, value, shownValue(rowId, key));
2328
2328
  },
2329
2329
  retry,
2330
2330
  keepTheirs,
@@ -2409,7 +2409,7 @@ function GridCell({
2409
2409
  RefusalNotice,
2410
2410
  {
2411
2411
  error: refusal2.error,
2412
- className: "py-1.5",
2412
+ className: "py-1.5 text-left",
2413
2413
  onDiscard: () => editing.discard(row.id, field.key)
2414
2414
  }
2415
2415
  ) : null
@@ -2523,7 +2523,7 @@ function CellRefusalNotice({
2523
2523
  RefusalNotice,
2524
2524
  {
2525
2525
  error: refusal2.error,
2526
- className: "py-1.5",
2526
+ className: "py-1.5 text-left",
2527
2527
  actions: /* @__PURE__ */ jsxs6("span", { className: "flex flex-col gap-1", "data-refusal-conflict": "", children: [
2528
2528
  /* @__PURE__ */ jsxs6("span", { className: "text-[11px]", children: [
2529
2529
  "Theirs: ",
@@ -2541,7 +2541,7 @@ function CellRefusalNotice({
2541
2541
  RefusalNotice,
2542
2542
  {
2543
2543
  error: refusal2.error,
2544
- className: "py-1.5",
2544
+ className: "py-1.5 text-left",
2545
2545
  ...typed ? { onKeepEditing: () => editing?.keepEditing(row.id, field.key) } : {},
2546
2546
  onDiscard: () => editing?.discard(row.id, field.key)
2547
2547
  }
@@ -6785,7 +6785,7 @@ function TableSettings({
6785
6785
 
6786
6786
  // src/Peek.tsx
6787
6787
  import { useState as useState23 } from "react";
6788
- import { useFields as useFields10, useRecord as useRecord2, useRecordsClient as useRecordsClient11, useTable as useTable7 } from "@ai-matrx/records/react";
6788
+ import { useFields as useFields10, useRecord as useRecord2, useRecordsClient as useRecordsClient12, useTable as useTable7 } from "@ai-matrx/records/react";
6789
6789
  import { AlchemyMenu as AlchemyMenu2 } from "@ai-matrx/alchemy/react";
6790
6790
 
6791
6791
  // src/RecordChat.tsx
@@ -6916,13 +6916,46 @@ function entriesFor(scope) {
6916
6916
  import { Button as Button19, Separator as Separator8, Skeleton as Skeleton5, cn as cn19 } from "@ai-matrx/design-system";
6917
6917
 
6918
6918
  // src/RecordForm.tsx
6919
- import { useEffect as useEffect12, useMemo as useMemo16, useState as useState21 } from "react";
6919
+ import { useEffect as useEffect12, useMemo as useMemo16, useRef as useRef6, useState as useState21 } from "react";
6920
6920
  import {
6921
6921
  useFields as useFields9,
6922
6922
  useRecord,
6923
- useRecordMutation
6923
+ useRecordMutation,
6924
+ useRecordsClient as useRecordsClient11
6924
6925
  } from "@ai-matrx/records/react";
6925
- import { predictWriteRefusals } from "@ai-matrx/records/core";
6926
+ import { asWriteConflict as asWriteConflict3, predictWriteRefusals } from "@ai-matrx/records/core";
6927
+
6928
+ // src/writeOnTheWinningVersion.ts
6929
+ import { asWriteConflict as asWriteConflict2 } from "@ai-matrx/records/core";
6930
+ function sameStoredValue(left, right) {
6931
+ if (left === right) return true;
6932
+ const empty = (v) => v === null || v === void 0 || v === "";
6933
+ if (empty(left) || empty(right)) return empty(left) && empty(right);
6934
+ if (typeof left === "object" || typeof right === "object") {
6935
+ try {
6936
+ return JSON.stringify(left) === JSON.stringify(right);
6937
+ } catch {
6938
+ return false;
6939
+ }
6940
+ }
6941
+ return false;
6942
+ }
6943
+ async function updateOnTheWinningVersion(client, recordId, patch, expectedVersion, base) {
6944
+ const send = (expected) => client.recordUpdate({
6945
+ record_id: recordId,
6946
+ patch,
6947
+ ...expected === null ? {} : { expectedVersion: expected }
6948
+ });
6949
+ const first = await send(expectedVersion);
6950
+ if (first.ok) return first;
6951
+ const conflict = asWriteConflict2(first.error, recordId);
6952
+ if (!conflict) return first;
6953
+ const untouched = base === "always" || Object.keys(patch).every((key) => sameStoredValue(conflict.contested_fields[key], base[key]));
6954
+ if (!untouched) return first;
6955
+ return send(conflict.current_version);
6956
+ }
6957
+
6958
+ // src/RecordForm.tsx
6926
6959
  import { Button as Button17, Separator as Separator7, cn as cn18 } from "@ai-matrx/design-system";
6927
6960
 
6928
6961
  // src/systemTable.ts
@@ -7110,15 +7143,38 @@ function RecordForm({
7110
7143
  const fields = useFields9(tableId, recordType);
7111
7144
  const existing = useRecord(recordId ?? null);
7112
7145
  const mutation = useRecordMutation();
7146
+ const client = useRecordsClient11();
7147
+ const [edit, setEdit] = useState21({
7148
+ saving: false,
7149
+ error: null,
7150
+ conflict: null
7151
+ });
7152
+ const said = {
7153
+ saving: mutation.saving || edit.saving,
7154
+ error: recordId ? edit.error : mutation.error,
7155
+ conflict: recordId ? edit.conflict : mutation.conflict,
7156
+ clearConflict: () => {
7157
+ mutation.clearConflict();
7158
+ setEdit((e) => ({ ...e, conflict: null }));
7159
+ }
7160
+ };
7113
7161
  const [draft, setDraft] = useState21({});
7114
7162
  const [touched, setTouched] = useState21(false);
7115
7163
  const [changed, setChanged] = useState21({});
7116
7164
  const [answered, setAnswered] = useState21(null);
7117
7165
  const loaded = useRecordVersion(recordId ?? null);
7118
7166
  const loadedVersion = loaded.version;
7167
+ const changedRef = useRef6({});
7168
+ changedRef.current = changed;
7119
7169
  useEffect12(() => {
7120
7170
  const document3 = existing.data?.document;
7121
- if (document3) setDraft({ ...document3 });
7171
+ if (!document3) return;
7172
+ const mine = changedRef.current;
7173
+ setDraft((held) => {
7174
+ const next = { ...document3 };
7175
+ for (const key of Object.keys(mine)) next[key] = held[key];
7176
+ return next;
7177
+ });
7122
7178
  }, [existing.data?.record_id, loadedVersion]);
7123
7179
  const document2 = useMemo16(() => {
7124
7180
  const out = {};
@@ -7134,10 +7190,10 @@ function RecordForm({
7134
7190
  );
7135
7191
  if (fields.error) return /* @__PURE__ */ jsx23(RefusalNotice, { error: fields.error, className });
7136
7192
  if (existing.error) return /* @__PURE__ */ jsx23(RefusalNotice, { error: existing.error, className });
7137
- const storeSaid = mutation.error && mutation.error !== answered ? mutation.error : null;
7193
+ const storeSaid = said.error && said.error !== answered ? said.error : null;
7138
7194
  const fieldProblems = predicted.filter((p) => p.field_key);
7139
7195
  const problemsShown = (key) => touched || changed[key] ? fieldProblems.filter((p) => p.field_key === key) : [];
7140
- const storeRefusalIsOnAField = storeSaid !== null && !mutation.conflict && storeSaid.code === "refused_by_rule" && (fields.data ?? []).some((f) => problemsShown(f.key).length > 0);
7196
+ const storeRefusalIsOnAField = storeSaid !== null && !said.conflict && storeSaid.code === "refused_by_rule" && (fields.data ?? []).some((f) => problemsShown(f.key).length > 0);
7141
7197
  const stored = existing.data?.document;
7142
7198
  const focusField = (field) => {
7143
7199
  if (!field) return;
@@ -7168,13 +7224,22 @@ function RecordForm({
7168
7224
  setAnswered(null);
7169
7225
  if (recordId) {
7170
7226
  const version = loadedVersion;
7171
- const moved = await mutation.update({
7172
- record_id: recordId,
7173
- patch: document2,
7174
- ...version === null ? {} : { expectedVersion: version }
7227
+ if (Object.keys(changed).length === 0) {
7228
+ onSaved?.(recordId);
7229
+ return;
7230
+ }
7231
+ const patch = Object.fromEntries(Object.entries(document2).filter(([key]) => changed[key]));
7232
+ setEdit({ saving: true, error: null, conflict: null });
7233
+ const answered2 = await updateOnTheWinningVersion(client, recordId, patch, version, stored ?? {});
7234
+ setEdit({
7235
+ saving: false,
7236
+ error: answered2.ok ? null : answered2.error,
7237
+ conflict: answered2.ok ? null : asWriteConflict3(answered2.error, recordId)
7175
7238
  });
7239
+ const moved = answered2.ok ? answered2.data : null;
7176
7240
  if (moved !== null) {
7177
7241
  loaded.note(moved);
7242
+ setChanged({});
7178
7243
  host.notify?.success("Saved");
7179
7244
  existing.reload();
7180
7245
  onSaved?.(recordId);
@@ -7223,9 +7288,9 @@ function RecordForm({
7223
7288
  RefusalNotice,
7224
7289
  {
7225
7290
  error: storeSaid,
7226
- ...mutation.conflict ? {
7291
+ ...said.conflict ? {
7227
7292
  actions: /* @__PURE__ */ jsxs19("div", { className: "mt-1 space-y-1", children: [
7228
- Object.entries(mutation.conflict.contested_fields).map(([key, theirs]) => {
7293
+ Object.entries(said.conflict.contested_fields).map(([key, theirs]) => {
7229
7294
  const column = (fields.data ?? []).find((f) => f.key === key);
7230
7295
  return /* @__PURE__ */ jsxs19("p", { className: "text-[11px]", children: [
7231
7296
  column ? fieldName(column) : humanize(key),
@@ -7243,9 +7308,9 @@ function RecordForm({
7243
7308
  size: "sm",
7244
7309
  variant: "outline",
7245
7310
  onClick: () => {
7246
- if (mutation.conflict) loaded.note(mutation.conflict.current_version);
7311
+ if (said.conflict) loaded.note(said.conflict.current_version);
7247
7312
  existing.reload();
7248
- mutation.clearConflict();
7313
+ said.clearConflict();
7249
7314
  setAnswered(storeSaid);
7250
7315
  },
7251
7316
  children: "Take theirs and start again"
@@ -7257,7 +7322,7 @@ function RecordForm({
7257
7322
  ) : null,
7258
7323
  /* @__PURE__ */ jsx23(Separator7, {}),
7259
7324
  /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2", children: [
7260
- /* @__PURE__ */ jsx23(Button17, { type: "submit", size: "sm", disabled: mutation.saving, children: mutation.saving ? "Saving\u2026" : recordId ? "Save" : "Create" }),
7325
+ /* @__PURE__ */ jsx23(Button17, { type: "submit", size: "sm", disabled: said.saving, children: said.saving ? "Saving\u2026" : recordId ? "Save" : "Create" }),
7261
7326
  onCancel ? /* @__PURE__ */ jsx23(Button17, { type: "button", size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null
7262
7327
  ] })
7263
7328
  ]
@@ -7357,7 +7422,7 @@ function Peek({ tableId, recordId, onClose, className }) {
7357
7422
  const record = useRecord2(recordId, true);
7358
7423
  const may = useRecordRights(recordId);
7359
7424
  const host = useRecordsUi();
7360
- const organizationId = useRecordsClient11().config.organizationId;
7425
+ const organizationId = useRecordsClient12().config.organizationId;
7361
7426
  const [editing, setEditing] = useState23(false);
7362
7427
  const [talking, setTalking] = useState23(false);
7363
7428
  if (record.error) return /* @__PURE__ */ jsx25(RefusalNotice, { error: record.error, className });
@@ -7452,7 +7517,6 @@ function computedInPlainWords(row, field) {
7452
7517
  }
7453
7518
 
7454
7519
  // src/views.ts
7455
- import { asWriteConflict as asWriteConflict2 } from "@ai-matrx/records/core";
7456
7520
  var VIEW_LAYOUTS = ["grid", "kanban", "calendar", "gallery"];
7457
7521
  var LAYOUT_LABEL = {
7458
7522
  grid: "Grid",
@@ -7577,16 +7641,7 @@ function viewFromRecord(row) {
7577
7641
  };
7578
7642
  }
7579
7643
  async function saveViewPatch(client, viewId, document2, expectedVersion) {
7580
- const send = (expected) => client.recordUpdate({
7581
- record_id: viewId,
7582
- patch: document2,
7583
- ...expected === null ? {} : { expectedVersion: expected }
7584
- });
7585
- const first = await send(expectedVersion);
7586
- if (first.ok) return first;
7587
- const conflict = asWriteConflict2(first.error, viewId);
7588
- if (!conflict) return first;
7589
- return send(conflict.current_version);
7644
+ return updateOnTheWinningVersion(client, viewId, document2, expectedVersion, "always");
7590
7645
  }
7591
7646
  function viewPatchDocument(patch) {
7592
7647
  const out = {};
@@ -7616,15 +7671,15 @@ function parseSorts(raw) {
7616
7671
 
7617
7672
  // src/ViewSwitcher.tsx
7618
7673
  import { useEffect as useEffect15, useMemo as useMemo18, useState as useState25 } from "react";
7619
- import { useFields as useFields12, useRecords as useRecords5, useRecordsClient as useRecordsClient13 } from "@ai-matrx/records/react";
7674
+ import { useFields as useFields12, useRecords as useRecords5, useRecordsClient as useRecordsClient14 } from "@ai-matrx/records/react";
7620
7675
  import { Button as Button21, Skeleton as Skeleton7, cn as cn21 } from "@ai-matrx/design-system";
7621
7676
 
7622
7677
  // src/Pipeline.tsx
7623
- import { useCallback as useCallback10, useEffect as useEffect14, useMemo as useMemo17, useRef as useRef6, useState as useState24 } from "react";
7678
+ import { useCallback as useCallback10, useEffect as useEffect14, useMemo as useMemo17, useRef as useRef7, useState as useState24 } from "react";
7624
7679
  import {
7625
7680
  mayDrag,
7626
7681
  useFields as useFields11,
7627
- useRecordsClient as useRecordsClient12
7682
+ useRecordsClient as useRecordsClient13
7628
7683
  } from "@ai-matrx/records/react";
7629
7684
  import { Button as Button20, Skeleton as Skeleton6, cn as cn20 } from "@ai-matrx/design-system";
7630
7685
  import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
@@ -7658,7 +7713,7 @@ function PipelineBoard({
7658
7713
  onMoved,
7659
7714
  className
7660
7715
  }) {
7661
- const client = useRecordsClient12();
7716
+ const client = useRecordsClient13();
7662
7717
  const fields = useFields11(tableId);
7663
7718
  const [definition, setDefinition] = useState24(null);
7664
7719
  const [columns, setColumns] = useState24([]);
@@ -7668,7 +7723,7 @@ function PipelineBoard({
7668
7723
  const [waiting, setWaiting] = useState24(/* @__PURE__ */ new Map());
7669
7724
  const [dragging, setDragging] = useState24(null);
7670
7725
  const [over, setOver] = useState24(null);
7671
- const alive = useRef6(true);
7726
+ const alive = useRef7(true);
7672
7727
  useEffect14(() => {
7673
7728
  alive.current = true;
7674
7729
  return () => {
@@ -8052,7 +8107,7 @@ function unplacedName(record, field, labels) {
8052
8107
  import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
8053
8108
  var NO_FIELDS = [];
8054
8109
  function useViewRecords(view, pageSize = 200, filter) {
8055
- const client = useRecordsClient13();
8110
+ const client = useRecordsClient14();
8056
8111
  const table = useRecords5(view.ruleId ? null : view.subject, {
8057
8112
  pageSize,
8058
8113
  ...filter ? { filter } : {}
@@ -8190,7 +8245,7 @@ function offerableFields(all, want) {
8190
8245
  });
8191
8246
  }
8192
8247
  function useStageField(tableId) {
8193
- const client = useRecordsClient13();
8248
+ const client = useRecordsClient14();
8194
8249
  const [stage, setStage] = useState25({
8195
8250
  asked: false,
8196
8251
  key: null
@@ -8473,7 +8528,7 @@ import {
8473
8528
  archivedByLine,
8474
8529
  emptyArchiveLine
8475
8530
  } from "@ai-matrx/records";
8476
- import { useFields as useFields13, useRecordsClient as useRecordsClient14, useTable as useTable8 } from "@ai-matrx/records/react";
8531
+ import { useFields as useFields13, useRecordsClient as useRecordsClient15, useTable as useTable8 } from "@ai-matrx/records/react";
8477
8532
  import { Button as Button22, Skeleton as Skeleton8, cn as cn22 } from "@ai-matrx/design-system";
8478
8533
  import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
8479
8534
  var ARCHIVE_MEANS = "Archiving never destroys anything. A record you remove from the grid waits here until somebody brings it back.";
@@ -8492,7 +8547,7 @@ function ArchivedView({
8492
8547
  onRestored,
8493
8548
  className
8494
8549
  }) {
8495
- const client = useRecordsClient14();
8550
+ const client = useRecordsClient15();
8496
8551
  const table = useTable8(tableId);
8497
8552
  const rights = useTableRights(table.data);
8498
8553
  const fields = useFields13(tableId);
@@ -8605,7 +8660,7 @@ import {
8605
8660
  portalConfirmLine,
8606
8661
  portalTitleTypedBack
8607
8662
  } from "@ai-matrx/records";
8608
- import { useRecordsClient as useRecordsClient15 } from "@ai-matrx/records/react";
8663
+ import { useRecordsClient as useRecordsClient16 } from "@ai-matrx/records/react";
8609
8664
  import { BasicInput as BasicInput8, Button as Button23, Skeleton as Skeleton9, cn as cn23 } from "@ai-matrx/design-system";
8610
8665
  import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
8611
8666
  var ARCHIVED_NEVER_DESTROYED = "Archiving never destroys anything. What you put away waits here until somebody brings it back.";
@@ -8650,7 +8705,7 @@ function ArchivedPortals({
8650
8705
  defaultOpen,
8651
8706
  className
8652
8707
  }) {
8653
- const client = useRecordsClient15();
8708
+ const client = useRecordsClient16();
8654
8709
  const [rows, setRows] = useState27(null);
8655
8710
  const [error, setError] = useState27(null);
8656
8711
  const [confirming, setConfirming] = useState27(null);
@@ -8785,13 +8840,13 @@ function ArchivedPortals({
8785
8840
 
8786
8841
  // src/ViewBar.tsx
8787
8842
  import { useCallback as useCallback14, useEffect as useEffect18, useState as useState28 } from "react";
8788
- import { useRecordsClient as useRecordsClient16 } from "@ai-matrx/records/react";
8843
+ import { useRecordsClient as useRecordsClient17 } from "@ai-matrx/records/react";
8789
8844
  import { Button as Button24, Input as Input2, Skeleton as Skeleton10, cn as cn24 } from "@ai-matrx/design-system";
8790
8845
 
8791
8846
  // src/seedOnce.ts
8792
- import { useCallback as useCallback13, useRef as useRef7 } from "react";
8847
+ import { useCallback as useCallback13, useRef as useRef8 } from "react";
8793
8848
  function useSeedGuard() {
8794
- const claimed = useRef7(/* @__PURE__ */ new Set());
8849
+ const claimed = useRef8(/* @__PURE__ */ new Set());
8795
8850
  return useCallback13((name) => {
8796
8851
  if (claimed.current.has(name)) return false;
8797
8852
  claimed.current.add(name);
@@ -8804,7 +8859,7 @@ import { useTable as useTable9 } from "@ai-matrx/records/react";
8804
8859
  import { jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
8805
8860
  var SAVED_VIEWS_UNAVAILABLE = "Saved views are not available in this organization right now, so the layout you pick here is not being kept. Everything else on this table works as usual.";
8806
8861
  function ViewBar({ tableId, activeViewId, onActiveView, seed, className }) {
8807
- const client = useRecordsClient16();
8862
+ const client = useRecordsClient17();
8808
8863
  const claimSeed = useSeedGuard();
8809
8864
  const table = useTable9(tableId);
8810
8865
  const rights = useTableRights(table.data);
@@ -8925,7 +8980,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, className }) {
8925
8980
 
8926
8981
  // src/ProposalRow.tsx
8927
8982
  import { useState as useState29 } from "react";
8928
- import { useRecordsClient as useRecordsClient17 } from "@ai-matrx/records/react";
8983
+ import { useRecordsClient as useRecordsClient18 } from "@ai-matrx/records/react";
8929
8984
  import { Badge as Badge7, Button as Button25, cn as cn25 } from "@ai-matrx/design-system";
8930
8985
  import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
8931
8986
  var ACT_WORD = PROPOSED_CHANGE_ACT_LABEL;
@@ -8938,7 +8993,7 @@ function ProposalRow({
8938
8993
  onSettled,
8939
8994
  className
8940
8995
  }) {
8941
- const client = useRecordsClient17();
8996
+ const client = useRecordsClient18();
8942
8997
  const [settled, setSettled] = useState29(outcome ?? null);
8943
8998
  const [busy, setBusy] = useState29(false);
8944
8999
  const [confirming, setConfirming] = useState29(false);
@@ -9026,13 +9081,13 @@ function ProposalRow({
9026
9081
  }
9027
9082
 
9028
9083
  // src/ActionInbox.tsx
9029
- import { useCallback as useCallback16, useEffect as useEffect20, useMemo as useMemo20, useRef as useRef8, useState as useState31 } from "react";
9030
- import { useRecordsClient as useRecordsClient19 } from "@ai-matrx/records/react";
9084
+ import { useCallback as useCallback16, useEffect as useEffect20, useMemo as useMemo20, useRef as useRef9, useState as useState31 } from "react";
9085
+ import { useRecordsClient as useRecordsClient20 } from "@ai-matrx/records/react";
9031
9086
  import { Badge as Badge9, Button as Button27, Skeleton as Skeleton12, cn as cn27 } from "@ai-matrx/design-system";
9032
9087
 
9033
9088
  // src/ChecklistRunner.tsx
9034
9089
  import { useCallback as useCallback15, useEffect as useEffect19, useMemo as useMemo19, useState as useState30 } from "react";
9035
- import { useRecordsClient as useRecordsClient18, useTable as useTable10 } from "@ai-matrx/records/react";
9090
+ import { useRecordsClient as useRecordsClient19, useTable as useTable10 } from "@ai-matrx/records/react";
9036
9091
  import { Badge as Badge8, BasicInput as BasicInput9, BasicTextarea as BasicTextarea4, Button as Button26, Skeleton as Skeleton11, cn as cn26 } from "@ai-matrx/design-system";
9037
9092
  import { Fragment as Fragment13, jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
9038
9093
  var DUE_WORD = DUE_STATE_LABEL;
@@ -9046,7 +9101,7 @@ function ChecklistRunner({
9046
9101
  offerToStart,
9047
9102
  className
9048
9103
  }) {
9049
- const client = useRecordsClient18();
9104
+ const client = useRecordsClient19();
9050
9105
  const table = useTable10(tableId ?? null);
9051
9106
  const rights = useTableRights(table.data);
9052
9107
  const [runs, setRuns] = useState30(null);
@@ -9295,7 +9350,7 @@ function StepRow({
9295
9350
  );
9296
9351
  }
9297
9352
  function useMyChecklistSteps(limit = 25) {
9298
- const client = useRecordsClient18();
9353
+ const client = useRecordsClient19();
9299
9354
  const me = client.config.actor.user_id ?? null;
9300
9355
  const [steps, setSteps] = useState30([]);
9301
9356
  const [loading, setLoading] = useState30(true);
@@ -9334,7 +9389,7 @@ function useMyChecklistSteps(limit = 25) {
9334
9389
  return { steps, loading, error, refresh };
9335
9390
  }
9336
9391
  function MyChecklistSteps({ className }) {
9337
- const client = useRecordsClient18();
9392
+ const client = useRecordsClient19();
9338
9393
  const { steps, loading, error, refresh } = useMyChecklistSteps();
9339
9394
  const [busy, setBusy] = useState30(null);
9340
9395
  const [refusal2, setRefusal] = useState30(null);
@@ -9373,7 +9428,7 @@ function MyChecklistSteps({ className }) {
9373
9428
  ] });
9374
9429
  }
9375
9430
  function ChecklistsPanel({ tableId, onOpenRecord, className }) {
9376
- const client = useRecordsClient18();
9431
+ const client = useRecordsClient19();
9377
9432
  const table = useTable10(tableId);
9378
9433
  const rights = useTableRights(table.data);
9379
9434
  const [templates, setTemplates] = useState30(null);
@@ -9534,7 +9589,7 @@ function ChecklistTemplateEditor({
9534
9589
  onDone,
9535
9590
  className
9536
9591
  }) {
9537
- const client = useRecordsClient18();
9592
+ const client = useRecordsClient19();
9538
9593
  const [name, setName] = useState30("");
9539
9594
  const [rows, setRows] = useState30([{ ...EMPTY_ROW }]);
9540
9595
  const [refusal2, setRefusal] = useState30(null);
@@ -9747,13 +9802,13 @@ var ACTION_KINDS = ["approval", "assignment", "proposal"];
9747
9802
  var KIND_WORD = WORK_INBOX_KIND_LABEL;
9748
9803
  var DUE_WORD2 = DUE_STATE_LABEL;
9749
9804
  function ActionInbox({ tableId, includeSettled = false, onOpenRecord, className }) {
9750
- const client = useRecordsClient19();
9805
+ const client = useRecordsClient20();
9751
9806
  const [items, setItems] = useState31(null);
9752
9807
  const [error, setError] = useState31(null);
9753
9808
  const [outcome, setOutcome] = useState31({});
9754
9809
  const [busy, setBusy] = useState31(null);
9755
9810
  const [cursor, setCursor] = useState31(0);
9756
- const listRef = useRef8(null);
9811
+ const listRef = useRef9(null);
9757
9812
  const load = useCallback16(async () => {
9758
9813
  const result = await client.workInbox({ limit: 200, includeDecided: includeSettled });
9759
9814
  if (!result.ok) {
@@ -9901,16 +9956,16 @@ function ActionInbox({ tableId, includeSettled = false, onOpenRecord, className
9901
9956
  }
9902
9957
 
9903
9958
  // src/HistoryPanel.tsx
9904
- import { useCallback as useCallback17, useEffect as useEffect21, useRef as useRef9, useState as useState32 } from "react";
9959
+ import { useCallback as useCallback17, useEffect as useEffect21, useRef as useRef10, useState as useState32 } from "react";
9905
9960
  import {
9906
9961
  useFields as useFields14,
9907
- useRecordsClient as useRecordsClient20,
9962
+ useRecordsClient as useRecordsClient21,
9908
9963
  useTable as useTable11
9909
9964
  } from "@ai-matrx/records/react";
9910
9965
  import { Badge as Badge10, Button as Button28, Skeleton as Skeleton13, cn as cn28 } from "@ai-matrx/design-system";
9911
9966
  import { jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
9912
9967
  function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
9913
- const client = useRecordsClient20();
9968
+ const client = useRecordsClient21();
9914
9969
  const table = useTable11(tableId);
9915
9970
  const fields = useFields14(tableId);
9916
9971
  const rights = useTableRights(table.data);
@@ -9919,7 +9974,7 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
9919
9974
  const [open, setOpen] = useState32(null);
9920
9975
  const [pending, setPending] = useState32({ phase: "idle" });
9921
9976
  const [said, setSaid] = useState32(null);
9922
- const listRef = useRef9(null);
9977
+ const listRef = useRef10(null);
9923
9978
  const load = useCallback17(async () => {
9924
9979
  const answered = await client.recordHistory({ record_id: recordId });
9925
9980
  if (!answered.ok) {
@@ -10210,16 +10265,16 @@ function say(value, field) {
10210
10265
  }
10211
10266
 
10212
10267
  // src/CommentThread.tsx
10213
- import { useCallback as useCallback18, useEffect as useEffect22, useMemo as useMemo21, useRef as useRef10, useState as useState33 } from "react";
10268
+ import { useCallback as useCallback18, useEffect as useEffect22, useMemo as useMemo21, useRef as useRef11, useState as useState33 } from "react";
10214
10269
  import {
10215
10270
  useFields as useFields15,
10216
- useRecordsClient as useRecordsClient21,
10271
+ useRecordsClient as useRecordsClient22,
10217
10272
  useTable as useTable12
10218
10273
  } from "@ai-matrx/records/react";
10219
10274
  import { Badge as Badge11, Button as Button29, Skeleton as Skeleton14, Textarea, cn as cn29 } from "@ai-matrx/design-system";
10220
10275
  import { jsx as jsx35, jsxs as jsxs31 } from "react/jsx-runtime";
10221
10276
  function CommentThread({ tableId, recordId, fieldKey, className }) {
10222
- const client = useRecordsClient21();
10277
+ const client = useRecordsClient22();
10223
10278
  const table = useTable12(tableId);
10224
10279
  const fields = useFields15(tableId);
10225
10280
  const host = useRecordsUi();
@@ -10233,7 +10288,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
10233
10288
  const [people, setPeople] = useState33([]);
10234
10289
  const [mentionQuery, setMentionQuery] = useState33(null);
10235
10290
  const [picked, setPicked] = useState33([]);
10236
- const box = useRef10(null);
10291
+ const box = useRef11(null);
10237
10292
  const load = useCallback18(async () => {
10238
10293
  const answered = await client.commentThread({ record_id: recordId, include_resolved: showResolved });
10239
10294
  if (!answered.ok) {
@@ -10456,7 +10511,7 @@ function Line({
10456
10511
  import { useCallback as useCallback19, useEffect as useEffect23, useState as useState34 } from "react";
10457
10512
  import {
10458
10513
  useFields as useFields16,
10459
- useRecordsClient as useRecordsClient22,
10514
+ useRecordsClient as useRecordsClient23,
10460
10515
  useTable as useTable13
10461
10516
  } from "@ai-matrx/records/react";
10462
10517
  import { Badge as Badge12, Button as Button30, Skeleton as Skeleton15, cn as cn30 } from "@ai-matrx/design-system";
@@ -10469,7 +10524,7 @@ function FieldHistoryPanel({
10469
10524
  onOpenRecord,
10470
10525
  className
10471
10526
  }) {
10472
- const client = useRecordsClient22();
10527
+ const client = useRecordsClient23();
10473
10528
  const table = useTable13(tableId);
10474
10529
  const fields = useFields16(tableId);
10475
10530
  const rights = useTableRights(table.data);
@@ -10682,12 +10737,12 @@ function submissionStamp(args) {
10682
10737
 
10683
10738
  // src/PortalBuilder.tsx
10684
10739
  import { useCallback as useCallback20, useEffect as useEffect24, useMemo as useMemo22, useState as useState35 } from "react";
10685
- import { useRecordsClient as useRecordsClient23, useTables as useTables3 } from "@ai-matrx/records/react";
10740
+ import { useRecordsClient as useRecordsClient24, useTables as useTables3 } from "@ai-matrx/records/react";
10686
10741
  import { BasicInput as BasicInput10, Button as Button31, Checkbox as Checkbox5, Label as Label5, Separator as Separator9, Skeleton as Skeleton16, cn as cn31 } from "@ai-matrx/design-system";
10687
10742
  import { Fragment as Fragment15, jsx as jsx37, jsxs as jsxs33 } from "react/jsx-runtime";
10688
10743
  var RESTATING_REPLACES = "Saving replaces what this portal shows: a table you untick stops being visible to every client the moment you save. Who is invited is not touched.";
10689
10744
  function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
10690
- const client = useRecordsClient23();
10745
+ const client = useRecordsClient24();
10691
10746
  const tables = useTables3();
10692
10747
  const [title, setTitle] = useState35("");
10693
10748
  const [clientTableId, setClientTableId] = useState35(null);
@@ -10977,7 +11032,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
10977
11032
 
10978
11033
  // src/PortalsPanel.tsx
10979
11034
  import { useCallback as useCallback21, useEffect as useEffect25, useMemo as useMemo23, useState as useState36 } from "react";
10980
- import { useRecordsClient as useRecordsClient24 } from "@ai-matrx/records/react";
11035
+ import { useRecordsClient as useRecordsClient25 } from "@ai-matrx/records/react";
10981
11036
  import {
10982
11037
  portalArchiveConsequence,
10983
11038
  portalConfirmLine as portalConfirmLine2,
@@ -11048,7 +11103,7 @@ function stateWords(person) {
11048
11103
  }
11049
11104
  var PORTAL_SUGGESTION = "Let each of my customers sign in and see their own jobs and invoices, and nothing else.";
11050
11105
  function PortalsPanel({ tableId, activePortalId, className }) {
11051
- const client = useRecordsClient24();
11106
+ const client = useRecordsClient25();
11052
11107
  const host = useRecordsUi();
11053
11108
  const [portals, setPortals] = useState36(null);
11054
11109
  const [exposures, setExposures] = useState36([]);
@@ -11228,7 +11283,7 @@ function ArchivePortalControl({
11228
11283
  portal,
11229
11284
  onArchived
11230
11285
  }) {
11231
- const client = useRecordsClient24();
11286
+ const client = useRecordsClient25();
11232
11287
  const [asking, setAsking] = useState36(false);
11233
11288
  const [typed, setTyped] = useState36("");
11234
11289
  const [busy, setBusy] = useState36(false);
@@ -11335,7 +11390,7 @@ function PortalDetail({
11335
11390
  origin,
11336
11391
  onChanged
11337
11392
  }) {
11338
- const client = useRecordsClient24();
11393
+ const client = useRecordsClient25();
11339
11394
  const [card, setCard] = useState36(null);
11340
11395
  const [error, setError] = useState36(null);
11341
11396
  const load = useCallback21(async () => {
@@ -11578,7 +11633,7 @@ function Preview({
11578
11633
  ] });
11579
11634
  }
11580
11635
  function Invite({ card, onInvited }) {
11581
- const client = useRecordsClient24();
11636
+ const client = useRecordsClient25();
11582
11637
  const [rows, setRows] = useState36(null);
11583
11638
  const [clientTable, setClientTable] = useState36(null);
11584
11639
  const [search, setSearch] = useState36("");
@@ -11690,7 +11745,7 @@ function Invite({ card, onInvited }) {
11690
11745
 
11691
11746
  // src/DigestScheduler.tsx
11692
11747
  import { useCallback as useCallback22, useEffect as useEffect26, useMemo as useMemo24, useState as useState37 } from "react";
11693
- import { useRecordsClient as useRecordsClient25 } from "@ai-matrx/records/react";
11748
+ import { useRecordsClient as useRecordsClient26 } from "@ai-matrx/records/react";
11694
11749
  import { BasicInput as BasicInput12, Button as Button34, Checkbox as Checkbox6, Label as Label6, Separator as Separator11, Skeleton as Skeleton18, cn as cn34 } from "@ai-matrx/design-system";
11695
11750
  import { Fragment as Fragment17, jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
11696
11751
  var WEEKDAYS = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
@@ -11714,7 +11769,7 @@ function DigestScheduler({
11714
11769
  onClose,
11715
11770
  className
11716
11771
  }) {
11717
- const client = useRecordsClient25();
11772
+ const client = useRecordsClient26();
11718
11773
  const host = useRecordsUi();
11719
11774
  const [views, setViews] = useState37(null);
11720
11775
  const [cadences, setCadences] = useState37([]);
@@ -12006,7 +12061,7 @@ function DigestScheduler({
12006
12061
 
12007
12062
  // src/SubscriptionsPanel.tsx
12008
12063
  import { useCallback as useCallback23, useEffect as useEffect27, useState as useState38 } from "react";
12009
- import { useRecordsClient as useRecordsClient26 } from "@ai-matrx/records/react";
12064
+ import { useRecordsClient as useRecordsClient27 } from "@ai-matrx/records/react";
12010
12065
  import { Badge as Badge14, Button as Button35, Skeleton as Skeleton19, Switch as Switch2, cn as cn35 } from "@ai-matrx/design-system";
12011
12066
  import { jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
12012
12067
  var RULE_NOT_HERE_LINE = "The link named a digest that is not one of yours on this table \u2014 it belongs to somebody else, or it was switched off for good. Yours are listed here; its owner can change theirs.";
@@ -12033,7 +12088,7 @@ function nextSummaryAt(subscription, now) {
12033
12088
  var CHANNEL_WORDS2 = SUBSCRIPTION_CHANNEL_LABEL;
12034
12089
  var DIGEST_SUGGESTION = "Email me a summary of this every Monday at 8 in the morning.";
12035
12090
  function SubscriptionsPanel({ tableId, activeRuleId, className }) {
12036
- const client = useRecordsClient26();
12091
+ const client = useRecordsClient27();
12037
12092
  const [rows, setRows] = useState38(null);
12038
12093
  const [error, setError] = useState38(null);
12039
12094
  const [busy, setBusy] = useState38(null);
@@ -12226,14 +12281,14 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
12226
12281
 
12227
12282
  // src/FormBuilder.tsx
12228
12283
  import { useCallback as useCallback25, useEffect as useEffect30, useMemo as useMemo26, useState as useState41 } from "react";
12229
- import { useFields as useFields18, useRecordsClient as useRecordsClient28, useTable as useTable14 } from "@ai-matrx/records/react";
12284
+ import { useFields as useFields18, useRecordsClient as useRecordsClient29, useTable as useTable14 } from "@ai-matrx/records/react";
12230
12285
 
12231
12286
  // src/publish-gate.ts
12232
12287
  import { useEffect as useEffect28, useState as useState39 } from "react";
12233
- import { useRecordsClient as useRecordsClient27 } from "@ai-matrx/records/react";
12288
+ import { useRecordsClient as useRecordsClient28 } from "@ai-matrx/records/react";
12234
12289
  var PUBLISH_NEEDS_THE_STORE_ON = "This organization has its record store switched off, so publishing would hand you a link that opens nothing. An owner or an administrator turns it on under Database settings, on the unified data screen \u2014 everything you have already built here is kept and starts working the moment they do.";
12235
12290
  function usePublishGate() {
12236
- const client = useRecordsClient27();
12291
+ const client = useRecordsClient28();
12237
12292
  const [storeOpen, setStoreOpen] = useState39(null);
12238
12293
  useEffect28(() => {
12239
12294
  let alive = true;
@@ -12266,7 +12321,7 @@ import {
12266
12321
  } from "@ai-matrx/design-system";
12267
12322
 
12268
12323
  // src/FormRunner.tsx
12269
- import { useCallback as useCallback24, useEffect as useEffect29, useMemo as useMemo25, useRef as useRef11, useState as useState40 } from "react";
12324
+ import { useCallback as useCallback24, useEffect as useEffect29, useMemo as useMemo25, useRef as useRef12, useState as useState40 } from "react";
12270
12325
  import { useFields as useFields17, useOptionalRecordsClient as useOptionalRecordsClient4 } from "@ai-matrx/records/react";
12271
12326
  import { Button as Button36, Progress, Skeleton as Skeleton20, cn as cn36 } from "@ai-matrx/design-system";
12272
12327
  import { Fragment as Fragment18, jsx as jsx42, jsxs as jsxs38 } from "react/jsx-runtime";
@@ -12351,8 +12406,8 @@ function FormStage({
12351
12406
  const [writing, setWriting] = useState40(false);
12352
12407
  const [done, setDone] = useState40(null);
12353
12408
  const [hidden, setHidden] = useState40({});
12354
- const decoy = useRef11("");
12355
- const stage = useRef11(null);
12409
+ const decoy = useRef12("");
12410
+ const stage = useRef12(null);
12356
12411
  const questions = useMemo25(() => {
12357
12412
  const byKey = new Map((fields ?? []).map((f) => [f.key, f]));
12358
12413
  return (form.questions ?? []).map((q) => {
@@ -12616,7 +12671,7 @@ function whyNotAskable(fields, hidden = []) {
12616
12671
  // src/FormBuilder.tsx
12617
12672
  import { Fragment as Fragment19, jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
12618
12673
  function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
12619
- const client = useRecordsClient28();
12674
+ const client = useRecordsClient29();
12620
12675
  const publishGate = usePublishGate();
12621
12676
  const host = useRecordsUi();
12622
12677
  const claimSeed = useSeedGuard();
@@ -13076,13 +13131,13 @@ function groupLabel(groups) {
13076
13131
  import {
13077
13132
  useEffect as useEffect31,
13078
13133
  useId as useId2,
13079
- useRef as useRef12,
13134
+ useRef as useRef13,
13080
13135
  useState as useState42
13081
13136
  } from "react";
13082
13137
  import { cn as cn38 } from "@ai-matrx/design-system";
13083
13138
  import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
13084
13139
  function useMeasuredWidth(fallback = 480) {
13085
- const ref = useRef12(null);
13140
+ const ref = useRef13(null);
13086
13141
  const [width, setWidth] = useState42(fallback);
13087
13142
  useEffect31(() => {
13088
13143
  const node = ref.current;
@@ -13209,11 +13264,11 @@ function isSignatureField(field) {
13209
13264
 
13210
13265
  // src/DocTemplate.tsx
13211
13266
  import { useCallback as useCallback26, useEffect as useEffect32, useState as useState43 } from "react";
13212
- import { useFields as useFields19, useRecordsClient as useRecordsClient29, useTable as useTable15 } from "@ai-matrx/records/react";
13267
+ import { useFields as useFields19, useRecordsClient as useRecordsClient30, useTable as useTable15 } from "@ai-matrx/records/react";
13213
13268
  import { BasicInput as BasicInput14, BasicTextarea as BasicTextarea6, Button as Button38, Label as Label8, Skeleton as Skeleton22, cn as cn39 } from "@ai-matrx/design-system";
13214
13269
  import { jsx as jsx45, jsxs as jsxs41 } from "react/jsx-runtime";
13215
13270
  function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, className }) {
13216
- const client = useRecordsClient29();
13271
+ const client = useRecordsClient30();
13217
13272
  const claimSeed = useSeedGuard();
13218
13273
  const table = useTable15(tableId);
13219
13274
  const rights = useTableRights(table.data);
@@ -13392,18 +13447,18 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
13392
13447
  }
13393
13448
 
13394
13449
  // src/DocRender.tsx
13395
- import { useCallback as useCallback27, useEffect as useEffect33, useRef as useRef13, useState as useState44 } from "react";
13396
- import { useRecordsClient as useRecordsClient30 } from "@ai-matrx/records/react";
13450
+ import { useCallback as useCallback27, useEffect as useEffect33, useRef as useRef14, useState as useState44 } from "react";
13451
+ import { useRecordsClient as useRecordsClient31 } from "@ai-matrx/records/react";
13397
13452
  import { Button as Button39, Skeleton as Skeleton23, cn as cn40 } from "@ai-matrx/design-system";
13398
13453
  import { jsx as jsx46, jsxs as jsxs42 } from "react/jsx-runtime";
13399
13454
  function DocRender({ templateId, recordId, filename, onRendered, className }) {
13400
- const client = useRecordsClient30();
13455
+ const client = useRecordsClient31();
13401
13456
  const [preview, setPreview] = useState44(null);
13402
13457
  const [renders, setRenders] = useState44(null);
13403
13458
  const [showing, setShowing] = useState44(null);
13404
13459
  const [error, setError] = useState44(null);
13405
13460
  const [busy, setBusy] = useState44(null);
13406
- const paper = useRef13(null);
13461
+ const paper = useRef14(null);
13407
13462
  const load = useCallback27(async () => {
13408
13463
  const [body, held] = await Promise.all([
13409
13464
  client.docRenderBody({ template_id: templateId, record_id: recordId }),
@@ -13506,12 +13561,12 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
13506
13561
 
13507
13562
  // src/SignBlock.tsx
13508
13563
  import { useCallback as useCallback28, useEffect as useEffect34, useState as useState45 } from "react";
13509
- import { useFields as useFields20, useRecordsClient as useRecordsClient31 } from "@ai-matrx/records/react";
13564
+ import { useFields as useFields20, useRecordsClient as useRecordsClient32 } from "@ai-matrx/records/react";
13510
13565
  import { BasicInput as BasicInput15, Button as Button40, Skeleton as Skeleton24, cn as cn41 } from "@ai-matrx/design-system";
13511
13566
  import { useTable as useTable16 } from "@ai-matrx/records/react";
13512
13567
  import { jsx as jsx47, jsxs as jsxs43 } from "react/jsx-runtime";
13513
13568
  function SignBlock({ tableId, recordId, render, className }) {
13514
- const client = useRecordsClient31();
13569
+ const client = useRecordsClient32();
13515
13570
  const table = useTable16(tableId);
13516
13571
  const rights = useTableRights(table.data);
13517
13572
  const fields = useFields20(tableId);
@@ -13657,13 +13712,13 @@ function SignBlock({ tableId, recordId, render, className }) {
13657
13712
 
13658
13713
  // src/NotifyRuleEditor.tsx
13659
13714
  import { useCallback as useCallback29, useEffect as useEffect35, useState as useState46 } from "react";
13660
- import { useRecordsClient as useRecordsClient32, useTable as useTable17 } from "@ai-matrx/records/react";
13715
+ import { useRecordsClient as useRecordsClient33, useTable as useTable17 } from "@ai-matrx/records/react";
13661
13716
  import { Button as Button41, Skeleton as Skeleton25, cn as cn42 } from "@ai-matrx/design-system";
13662
13717
  import { jsx as jsx48, jsxs as jsxs44 } from "react/jsx-runtime";
13663
13718
  var CADENCE_WORDS2 = SUBSCRIPTION_CADENCE_LABEL;
13664
13719
  var CHANNEL_WORDS3 = SUBSCRIPTION_CHANNEL_LABEL;
13665
13720
  function NotifyRuleEditor({ tableId, seed, className }) {
13666
- const client = useRecordsClient32();
13721
+ const client = useRecordsClient33();
13667
13722
  const host = useRecordsUi();
13668
13723
  const table = useTable17(tableId);
13669
13724
  const rights = useTableRights(table.data);
@@ -14177,7 +14232,7 @@ function Drawing({
14177
14232
 
14178
14233
  // src/DashboardCanvas.tsx
14179
14234
  import { useCallback as useCallback30, useEffect as useEffect36, useMemo as useMemo28, useState as useState47 } from "react";
14180
- import { useFields as useFields21, useRecordsClient as useRecordsClient33, useTable as useTable18 } from "@ai-matrx/records/react";
14235
+ import { useFields as useFields21, useRecordsClient as useRecordsClient34, useTable as useTable18 } from "@ai-matrx/records/react";
14181
14236
  import {
14182
14237
  BasicInput as BasicInput16,
14183
14238
  Button as Button42,
@@ -14191,7 +14246,7 @@ import {
14191
14246
  } from "@ai-matrx/design-system";
14192
14247
  import { Fragment as Fragment21, jsx as jsx50, jsxs as jsxs46 } from "react/jsx-runtime";
14193
14248
  function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
14194
- const client = useRecordsClient33();
14249
+ const client = useRecordsClient34();
14195
14250
  const host = useRecordsUi();
14196
14251
  const table = useTable18(tableId);
14197
14252
  const rights = useTableRights(table.data);
@@ -14520,7 +14575,7 @@ function GroupingPicker({
14520
14575
 
14521
14576
  // src/FormsPanel.tsx
14522
14577
  import { useCallback as useCallback31, useEffect as useEffect37, useState as useState48 } from "react";
14523
- import { useRecordsClient as useRecordsClient34, useTable as useTable19 } from "@ai-matrx/records/react";
14578
+ import { useRecordsClient as useRecordsClient35, useTable as useTable19 } from "@ai-matrx/records/react";
14524
14579
  import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
14525
14580
  import { Badge as Badge15, Button as Button43, Skeleton as Skeleton27, cn as cn45 } from "@ai-matrx/design-system";
14526
14581
  import { Fragment as Fragment22, jsx as jsx51, jsxs as jsxs47 } from "react/jsx-runtime";
@@ -14532,7 +14587,7 @@ function formSuggestion(tableName2) {
14532
14587
  return `Make me a form that collects new ${subject} entries and tells me when somebody answers.`;
14533
14588
  }
14534
14589
  function FormsPanel({ tableId, activeFormId, className }) {
14535
- const client = useRecordsClient34();
14590
+ const client = useRecordsClient35();
14536
14591
  const publishGate = usePublishGate();
14537
14592
  const host = useRecordsUi();
14538
14593
  const table = useTable19(tableId);
@@ -14689,7 +14744,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
14689
14744
 
14690
14745
  // src/BookingBuilder.tsx
14691
14746
  import { useCallback as useCallback32, useEffect as useEffect38, useMemo as useMemo29, useState as useState49 } from "react";
14692
- import { useFields as useFields22, useRecordsClient as useRecordsClient35, useTable as useTable20 } from "@ai-matrx/records/react";
14747
+ import { useFields as useFields22, useRecordsClient as useRecordsClient36, useTable as useTable20 } from "@ai-matrx/records/react";
14693
14748
  import {
14694
14749
  bookingPath
14695
14750
  } from "@ai-matrx/records";
@@ -14719,7 +14774,7 @@ function draftWindows(availability) {
14719
14774
  });
14720
14775
  }
14721
14776
  function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
14722
- const client = useRecordsClient35();
14777
+ const client = useRecordsClient36();
14723
14778
  const publishGate = usePublishGate();
14724
14779
  const host = useRecordsUi();
14725
14780
  const table = useTable20(tableId);
@@ -15037,7 +15092,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
15037
15092
 
15038
15093
  // src/BookingSlots.tsx
15039
15094
  import { useCallback as useCallback33, useEffect as useEffect39, useMemo as useMemo30, useState as useState50 } from "react";
15040
- import { useRecordsClient as useRecordsClient36, useMyLevels as useMyLevels2 } from "@ai-matrx/records/react";
15095
+ import { useRecordsClient as useRecordsClient37, useMyLevels as useMyLevels2 } from "@ai-matrx/records/react";
15041
15096
  import { bookingPath as bookingPath2 } from "@ai-matrx/records";
15042
15097
  import { Badge as Badge16, Button as Button45, Skeleton as Skeleton29, cn as cn47 } from "@ai-matrx/design-system";
15043
15098
  import { Fragment as Fragment24, jsx as jsx53, jsxs as jsxs49 } from "react/jsx-runtime";
@@ -15049,7 +15104,7 @@ function bookingSuggestion(tableName2) {
15049
15104
  var NO_ADMIN2 = "Opening a booking page lets people with no account take time in your calendar, so it needs the admin level on the table the appointments land in.";
15050
15105
  var STATE_WORDS = BOOKING_PAGE_STATE_LABEL;
15051
15106
  function BookingSlots({ tableId, className }) {
15052
- const client = useRecordsClient36();
15107
+ const client = useRecordsClient37();
15053
15108
  const host = useRecordsUi();
15054
15109
  const [pages, setPages] = useState50(null);
15055
15110
  const [error, setError] = useState50(null);
@@ -15236,18 +15291,18 @@ function nextInWords(page) {
15236
15291
  }
15237
15292
 
15238
15293
  // src/CaptureSheet.tsx
15239
- import { useCallback as useCallback35, useEffect as useEffect41, useRef as useRef15, useState as useState52 } from "react";
15240
- import { useFields as useFields23, useRecordsClient as useRecordsClient38, useTable as useTable21 } from "@ai-matrx/records/react";
15294
+ import { useCallback as useCallback35, useEffect as useEffect41, useRef as useRef16, useState as useState52 } from "react";
15295
+ import { useFields as useFields23, useRecordsClient as useRecordsClient39, useTable as useTable21 } from "@ai-matrx/records/react";
15241
15296
  import { Button as Button47, Input as Input4, Skeleton as Skeleton31, Textarea as Textarea3, cn as cn49 } from "@ai-matrx/design-system";
15242
15297
 
15243
15298
  // src/CaptureRun.tsx
15244
- import { useCallback as useCallback34, useEffect as useEffect40, useMemo as useMemo31, useRef as useRef14, useState as useState51 } from "react";
15299
+ import { useCallback as useCallback34, useEffect as useEffect40, useMemo as useMemo31, useRef as useRef15, useState as useState51 } from "react";
15245
15300
  import {
15246
15301
  coerceTypedAnswer as coerceTypedAnswer2,
15247
15302
  coercionLabel,
15248
15303
  openCaptureQueue
15249
15304
  } from "@ai-matrx/records";
15250
- import { useRecordsClient as useRecordsClient37 } from "@ai-matrx/records/react";
15305
+ import { useRecordsClient as useRecordsClient38 } from "@ai-matrx/records/react";
15251
15306
  import { Button as Button46, Input as Input3, Skeleton as Skeleton30, Textarea as Textarea2, cn as cn48 } from "@ai-matrx/design-system";
15252
15307
  import { jsx as jsx54, jsxs as jsxs50 } from "react/jsx-runtime";
15253
15308
  function controlFor(field) {
@@ -15286,7 +15341,7 @@ function whereWeAre(timeoutMs = 4e3) {
15286
15341
  });
15287
15342
  }
15288
15343
  function CaptureRun({ sheetId, face: given, className }) {
15289
- const client = useRecordsClient37();
15344
+ const client = useRecordsClient38();
15290
15345
  const host = useRecordsUi();
15291
15346
  const [face, setFace] = useState51(given);
15292
15347
  const [loadFailed, setLoadFailed] = useState51(null);
@@ -15299,7 +15354,7 @@ function CaptureRun({ sheetId, face: given, className }) {
15299
15354
  const [items, setItems] = useState51([]);
15300
15355
  const [lastSynced, setLastSynced] = useState51(null);
15301
15356
  const [sending, setSending] = useState51(false);
15302
- const queueRef = useRef14(null);
15357
+ const queueRef = useRef15(null);
15303
15358
  useEffect40(() => {
15304
15359
  const q2 = openCaptureQueue({
15305
15360
  onChange: (c, all) => {
@@ -15666,7 +15721,7 @@ function AdHocCaptureSheet({
15666
15721
  attachmentField,
15667
15722
  className
15668
15723
  }) {
15669
- const client = useRecordsClient38();
15724
+ const client = useRecordsClient39();
15670
15725
  const host = useRecordsUi();
15671
15726
  const table = useTable21(tableId);
15672
15727
  const fields = useFields23(tableId);
@@ -15679,7 +15734,7 @@ function AdHocCaptureSheet({
15679
15734
  const [error, setError] = useState52(null);
15680
15735
  const [uploadError, setUploadError] = useState52(null);
15681
15736
  const [flushing, setFlushing] = useState52(false);
15682
- const queue = useRef15([]);
15737
+ const queue = useRef16([]);
15683
15738
  const keep = useCallback35(
15684
15739
  async (next) => {
15685
15740
  queue.current = next;
@@ -15868,11 +15923,11 @@ function AdHocCaptureSheet({
15868
15923
 
15869
15924
  // src/PortalShell.tsx
15870
15925
  import { useCallback as useCallback36, useEffect as useEffect42, useState as useState53 } from "react";
15871
- import { useRecordsClient as useRecordsClient39 } from "@ai-matrx/records/react";
15926
+ import { useRecordsClient as useRecordsClient40 } from "@ai-matrx/records/react";
15872
15927
  import { Button as Button48, Skeleton as Skeleton32, cn as cn50 } from "@ai-matrx/design-system";
15873
15928
  import { jsx as jsx56, jsxs as jsxs52 } from "react/jsx-runtime";
15874
15929
  function PortalShell({ tableId, form, resourceType = "record", className }) {
15875
- const client = useRecordsClient39();
15930
+ const client = useRecordsClient40();
15876
15931
  const [card, setCard] = useState53(null);
15877
15932
  const [reach, setReach] = useState53(null);
15878
15933
  const [error, setError] = useState53(null);
@@ -15951,7 +16006,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
15951
16006
  ] });
15952
16007
  }
15953
16008
  function PortalRow({ tableId, recordId }) {
15954
- const client = useRecordsClient39();
16009
+ const client = useRecordsClient40();
15955
16010
  const [title, setTitle] = useState53(null);
15956
16011
  useEffect42(() => {
15957
16012
  let cancelled = false;
@@ -15974,11 +16029,11 @@ function PortalRow({ tableId, recordId }) {
15974
16029
 
15975
16030
  // src/PublicViewPage.tsx
15976
16031
  import { useCallback as useCallback37, useEffect as useEffect43, useState as useState54 } from "react";
15977
- import { useRecordsClient as useRecordsClient40 } from "@ai-matrx/records/react";
16032
+ import { useRecordsClient as useRecordsClient41 } from "@ai-matrx/records/react";
15978
16033
  import { Skeleton as Skeleton33, cn as cn51 } from "@ai-matrx/design-system";
15979
16034
  import { jsx as jsx57, jsxs as jsxs53 } from "react/jsx-runtime";
15980
16035
  function PublicViewPage({ slug, className }) {
15981
- const client = useRecordsClient40();
16036
+ const client = useRecordsClient41();
15982
16037
  const [binding, setBinding] = useState54(null);
15983
16038
  const [rows, setRows] = useState54(null);
15984
16039
  const [fields, setFields] = useState54(null);
@@ -16055,7 +16110,7 @@ function PublicRow({ row, fields }) {
16055
16110
 
16056
16111
  // src/EmbedFrame.tsx
16057
16112
  import { useCallback as useCallback38, useEffect as useEffect44, useState as useState55 } from "react";
16058
- import { useRecordsClient as useRecordsClient41 } from "@ai-matrx/records/react";
16113
+ import { useRecordsClient as useRecordsClient42 } from "@ai-matrx/records/react";
16059
16114
  import { Button as Button49, Input as Input5, Skeleton as Skeleton34, Textarea as Textarea4, cn as cn52 } from "@ai-matrx/design-system";
16060
16115
  import { useTable as useTable22 } from "@ai-matrx/records/react";
16061
16116
  import { Fragment as Fragment26, jsx as jsx58, jsxs as jsxs54 } from "react/jsx-runtime";
@@ -16067,7 +16122,7 @@ function EmbedFrame({
16067
16122
  embedUrl,
16068
16123
  className
16069
16124
  }) {
16070
- const client = useRecordsClient41();
16125
+ const client = useRecordsClient42();
16071
16126
  const host = useRecordsUi();
16072
16127
  const table = useTable22(tableId);
16073
16128
  const rights = useTableRights(table.data);
@@ -16161,7 +16216,7 @@ function EmbedFrame({
16161
16216
  ] });
16162
16217
  }
16163
16218
  function useEmbedHandshake(args) {
16164
- const client = useRecordsClient41();
16219
+ const client = useRecordsClient42();
16165
16220
  const [binding, setBinding] = useState55(null);
16166
16221
  const [error, setError] = useState55(null);
16167
16222
  const [loading, setLoading] = useState55(true);
@@ -16223,7 +16278,7 @@ function recordsDataSource(client, fallbackSchema = "custom") {
16223
16278
 
16224
16279
  // src/TablesHome.tsx
16225
16280
  import { useCallback as useCallback39, useEffect as useEffect45, useState as useState56 } from "react";
16226
- import { useRecordsClient as useRecordsClient42, useTables as useTables4 } from "@ai-matrx/records/react";
16281
+ import { useRecordsClient as useRecordsClient43, useTables as useTables4 } from "@ai-matrx/records/react";
16227
16282
  import { BasicInput as BasicInput18, Button as Button50, Skeleton as Skeleton35, cn as cn53 } from "@ai-matrx/design-system";
16228
16283
 
16229
16284
  // src/createTable.ts
@@ -16372,12 +16427,11 @@ function visibilityLaneFor(table) {
16372
16427
  if (table.is_kernel) return null;
16373
16428
  if ((table.slug ?? "").startsWith(APP_TABLE_PREFIX) || keptByTheApp(table)) return null;
16374
16429
  if (table.visibility === "personal") return "mine";
16375
- if (table.visibility === "link") return "community";
16376
- if (table.visibility === "public") return "world";
16430
+ if (table.visibility === "link" || table.visibility === "public") return "world";
16377
16431
  return "organization";
16378
16432
  }
16379
16433
  function TablesHome({ onOpenTable, className }) {
16380
- const client = useRecordsClient42();
16434
+ const client = useRecordsClient43();
16381
16435
  const tables = useTables4();
16382
16436
  const [creating, setCreating] = useState56(false);
16383
16437
  const [name, setName] = useState56("");
@@ -16520,7 +16574,7 @@ function TablesHome({ onOpenTable, className }) {
16520
16574
 
16521
16575
  // src/TablePage.tsx
16522
16576
  import { useCallback as useCallback40, useEffect as useEffect46, useState as useState57 } from "react";
16523
- import { useFields as useFields24, useRecordsClient as useRecordsClient43, useTable as useTable23 } from "@ai-matrx/records/react";
16577
+ import { useFields as useFields24, useRecordsClient as useRecordsClient44, useTable as useTable23 } from "@ai-matrx/records/react";
16524
16578
  import { BottomSheet, Button as Button51, Separator as Separator12, Skeleton as Skeleton36, cn as cn54, useIsMobile } from "@ai-matrx/design-system";
16525
16579
  import { Fragment as Fragment28, jsx as jsx61, jsxs as jsxs56 } from "react/jsx-runtime";
16526
16580
  var RAIL_TITLE = {
@@ -16675,12 +16729,12 @@ function TablePage({
16675
16729
  activeItemId,
16676
16730
  className
16677
16731
  }) {
16678
- const client = useRecordsClient43();
16732
+ const client = useRecordsClient44();
16679
16733
  const table = useTable23(tableId);
16680
16734
  const rights = useTableRights(table.data);
16681
16735
  const pageFields = useFields24(filter ? tableId : null);
16682
16736
  const askedInWords = filter ? filterInWords(filter, pageFields.data ?? []) : null;
16683
- const organizationId = useRecordsClient43().config.organizationId;
16737
+ const organizationId = useRecordsClient44().config.organizationId;
16684
16738
  const [view, setView] = useState57(null);
16685
16739
  const opening = openingRail(activeRecordId, activeRail);
16686
16740
  const opened = openingView(activeView, activeDashboardId);
@@ -17279,6 +17333,7 @@ export {
17279
17333
  mayNotRestoreLine,
17280
17334
  memberName,
17281
17335
  nextInWords,
17336
+ nextSummaryAt,
17282
17337
  openingRail,
17283
17338
  openingView,
17284
17339
  pageViewFromParam,