@ai-matrx/records-ui 0.116.5 → 0.116.7

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
@@ -169,7 +169,7 @@ import {
169
169
  withoutAddition,
170
170
  withoutLeadingBlank,
171
171
  workedOutErrorFor
172
- } from "./chunk-PF2SAQEH.js";
172
+ } from "./chunk-IYJVE222.js";
173
173
  import {
174
174
  CHART_PLOT_PX,
175
175
  RECORDS_GRID_ROW_PX,
@@ -183,7 +183,7 @@ import {
183
183
  rememberedRowCount,
184
184
  skeletonLayoutFor,
185
185
  useRememberedLayout
186
- } from "./chunk-MDLXUALP.js";
186
+ } from "./chunk-6WDNTT2G.js";
187
187
  import {
188
188
  DEFAULT_FOOTER,
189
189
  EMBEDDED_LOOK,
@@ -270,7 +270,7 @@ import {
270
270
  visibilityLaneFor,
271
271
  whyNotAskable,
272
272
  writeOnTheWinningVersion_exports
273
- } from "./chunk-5NPKASE5.js";
273
+ } from "./chunk-HUPBD4JF.js";
274
274
  import {
275
275
  ACTION_CHECKING_ACCESS_REASON,
276
276
  ACTION_NOT_HERE_REASON,
@@ -377,7 +377,7 @@ import {
377
377
  useRowRights,
378
378
  useTableRights,
379
379
  withoutInternalCodes
380
- } from "./chunk-IIAT5WYZ.js";
380
+ } from "./chunk-RQL7QRGR.js";
381
381
  import {
382
382
  FEWEST_KEY_VALUE_PAIRS,
383
383
  FEWEST_LIST_ITEMS,
@@ -37996,7 +37996,7 @@ function useEmbedHandshake(args) {
37996
37996
 
37997
37997
  // src/TablePage.tsx
37998
37998
  import { copyText as copyText13 } from "@ai-matrx/kit/clipboard";
37999
- import { useCallback as useCallback60, useEffect as useEffect101, useMemo as useMemo70, useRef as useRef49, useState as useState116 } from "react";
37999
+ import { useCallback as useCallback60, useEffect as useEffect102, useMemo as useMemo71, useRef as useRef50, useState as useState117 } from "react";
38000
38000
  import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
38001
38001
  import { tableShapeChanged as tableShapeChanged11, useFields as useFields34, useRecordsClient as useRecordsClient90, useSeededAnswer, useTable as useTable36, useTableArchive as useTableArchive2 } from "@ai-matrx/records/react";
38002
38002
  import {
@@ -38809,8 +38809,86 @@ function phoneTableActions(actions) {
38809
38809
  return out;
38810
38810
  }
38811
38811
 
38812
+ // src/presence.tsx
38813
+ import { useEffect as useEffect100, useMemo as useMemo70, useRef as useRef49, useState as useState115, useSyncExternalStore as useSyncExternalStore4 } from "react";
38814
+ import { jsx as jsx127, jsxs as jsxs120 } from "react/jsx-runtime";
38815
+ var NO_PEOPLE = [];
38816
+ var MAX_AVATARS = 4;
38817
+ var SAFE = /^[A-Za-z0-9_.:\-]+$/;
38818
+ function useTablePresence(tableId) {
38819
+ const port = useRecordsUi().presence;
38820
+ const [session, setSession] = useState115(null);
38821
+ useEffect100(() => {
38822
+ if (!port) {
38823
+ setSession(null);
38824
+ return;
38825
+ }
38826
+ const joined = port.join({ tableId });
38827
+ setSession(joined);
38828
+ return () => {
38829
+ joined.close();
38830
+ setSession(null);
38831
+ };
38832
+ }, [port, tableId]);
38833
+ const people = useSyncExternalStore4(
38834
+ (listener) => session ? session.subscribe(listener) : () => void 0,
38835
+ () => session ? session.getSnapshot() : NO_PEOPLE,
38836
+ () => NO_PEOPLE
38837
+ );
38838
+ return { session, people };
38839
+ }
38840
+ function presenceOutlineCss(people) {
38841
+ return people.filter((p) => p.cell && SAFE.test(p.cell.recordId) && SAFE.test(p.cell.fieldKey) && /^hsl\([0-9 %.]+\)$|^#[0-9a-fA-F]{3,8}$/.test(p.color)).map(
38842
+ (p) => `td[data-matrx-cell-row="${p.cell.recordId}"][data-matrx-cell-col="${p.cell.fieldKey}"]{outline:2px solid ${p.color};outline-offset:-2px;}`
38843
+ ).join("\n");
38844
+ }
38845
+ function initials(name) {
38846
+ const parts = name.trim().split(/\s+/).filter(Boolean);
38847
+ return ((parts[0]?.[0] ?? "?") + (parts.length > 1 ? parts[parts.length - 1][0] : "")).toUpperCase();
38848
+ }
38849
+ function TablePresence({ tableId }) {
38850
+ const { session, people } = useTablePresence(tableId);
38851
+ const root = useRef49(null);
38852
+ const css = useMemo70(() => presenceOutlineCss(people), [people]);
38853
+ useEffect100(() => {
38854
+ if (!session || typeof MutationObserver === "undefined") return;
38855
+ const scope = document.body;
38856
+ const read = () => {
38857
+ const td = scope.querySelector("td[data-matrx-cell-active]");
38858
+ const recordId = td?.getAttribute("data-matrx-cell-row");
38859
+ const fieldKey = td?.getAttribute("data-matrx-cell-col");
38860
+ session.selectCell(recordId && fieldKey ? { recordId, fieldKey } : null);
38861
+ };
38862
+ const watch = new MutationObserver(read);
38863
+ watch.observe(scope, { subtree: true, attributes: true, attributeFilter: ["data-matrx-cell-active"] });
38864
+ read();
38865
+ return () => watch.disconnect();
38866
+ }, [session]);
38867
+ if (!session) return null;
38868
+ const shown4 = people.slice(0, MAX_AVATARS);
38869
+ const more = people.length - shown4.length;
38870
+ return /* @__PURE__ */ jsxs120("span", { ref: root, className: "flex shrink-0 items-center -space-x-1.5", "data-table-presence": "", "data-count": people.length, "aria-label": people.length ? `${people.length} other ${people.length === 1 ? "person is" : "people are"} looking at this table` : void 0, children: [
38871
+ css ? /* @__PURE__ */ jsx127("style", { "data-table-presence-outlines": "", children: css }) : null,
38872
+ shown4.map((p) => /* @__PURE__ */ jsx127(
38873
+ "span",
38874
+ {
38875
+ title: p.name,
38876
+ "data-table-presence-person": p.name,
38877
+ className: "inline-flex h-6 w-6 items-center justify-center overflow-hidden rounded-full border-2 bg-muted text-[10px] font-medium text-foreground",
38878
+ style: { borderColor: p.color },
38879
+ children: p.avatarUrl ? /* @__PURE__ */ jsx127("img", { src: p.avatarUrl, alt: "", className: "h-full w-full object-cover" }) : initials(p.name)
38880
+ },
38881
+ p.key
38882
+ )),
38883
+ more > 0 ? /* @__PURE__ */ jsxs120("span", { className: "inline-flex h-6 min-w-6 items-center justify-center rounded-full border border-border bg-muted px-1 text-[10px]", "data-table-presence-more": "", children: [
38884
+ "+",
38885
+ more
38886
+ ] }) : null
38887
+ ] });
38888
+ }
38889
+
38812
38890
  // src/toolbarFit.ts
38813
- import { useEffect as useEffect100, useLayoutEffect as useLayoutEffect3, useState as useState115 } from "react";
38891
+ import { useEffect as useEffect101, useLayoutEffect as useLayoutEffect3, useState as useState116 } from "react";
38814
38892
  import { flushSync } from "react-dom";
38815
38893
  function widthAtFold(piece, fold) {
38816
38894
  for (let f = Math.min(fold, (piece.byFold?.length ?? 0) - 1); f >= 0; f -= 1) {
@@ -38902,9 +38980,9 @@ function createFitMemory() {
38902
38980
  }
38903
38981
  };
38904
38982
  }
38905
- var useIsoLayoutEffect = typeof window === "undefined" ? useEffect100 : useLayoutEffect3;
38983
+ var useIsoLayoutEffect = typeof window === "undefined" ? useEffect101 : useLayoutEffect3;
38906
38984
  function useToolbarFit(row) {
38907
- const [fold, setFold] = useState115(0);
38985
+ const [fold, setFold] = useState116(0);
38908
38986
  useIsoLayoutEffect(() => {
38909
38987
  if (!row) return;
38910
38988
  const memory = createFitMemory();
@@ -38980,8 +39058,8 @@ function clippedEnds(scrollLeft, clientWidth, scrollWidth) {
38980
39058
  return start && end ? "both" : start ? "start" : end ? "end" : "none";
38981
39059
  }
38982
39060
  function useSlotScroll(slot) {
38983
- const [ends, setEnds] = useState115("none");
38984
- useEffect100(() => {
39061
+ const [ends, setEnds] = useState116("none");
39062
+ useEffect101(() => {
38985
39063
  if (!slot) return;
38986
39064
  let pending = 0;
38987
39065
  const read = () => {
@@ -39023,7 +39101,7 @@ function useSlotScroll(slot) {
39023
39101
  // src/TablePage.tsx
39024
39102
  import { isUuidShape as isUuidShape3 } from "@ai-matrx/kit/uuid";
39025
39103
  import { openOutbound as openOutbound3 } from "@ai-matrx/kit/outbound";
39026
- import { Fragment as Fragment56, jsx as jsx127, jsxs as jsxs120 } from "react/jsx-runtime";
39104
+ import { Fragment as Fragment56, jsx as jsx128, jsxs as jsxs121 } from "react/jsx-runtime";
39027
39105
  var RAIL_TITLE = {
39028
39106
  settings: "Table settings",
39029
39107
  inbox: "Inbox",
@@ -39040,10 +39118,10 @@ var RAIL_TITLE = {
39040
39118
  export: "Export"
39041
39119
  };
39042
39120
  function LookGlyph() {
39043
- return /* @__PURE__ */ jsxs120("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
39044
- /* @__PURE__ */ jsx127("path", { d: "M4 7h10M18 7h2M4 17h2M10 17h10" }),
39045
- /* @__PURE__ */ jsx127("circle", { cx: "16", cy: "7", r: "2" }),
39046
- /* @__PURE__ */ jsx127("circle", { cx: "8", cy: "17", r: "2" })
39121
+ return /* @__PURE__ */ jsxs121("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
39122
+ /* @__PURE__ */ jsx128("path", { d: "M4 7h10M18 7h2M4 17h2M10 17h10" }),
39123
+ /* @__PURE__ */ jsx128("circle", { cx: "16", cy: "7", r: "2" }),
39124
+ /* @__PURE__ */ jsx128("circle", { cx: "8", cy: "17", r: "2" })
39047
39125
  ] });
39048
39126
  }
39049
39127
  function RailFrame({
@@ -39055,7 +39133,7 @@ function RailFrame({
39055
39133
  children
39056
39134
  }) {
39057
39135
  if (phone) {
39058
- return /* @__PURE__ */ jsx127(
39136
+ return /* @__PURE__ */ jsx128(
39059
39137
  BottomSheet,
39060
39138
  {
39061
39139
  open: true,
@@ -39065,18 +39143,18 @@ function RailFrame({
39065
39143
  title,
39066
39144
  size: "full",
39067
39145
  surface: "solid",
39068
- children: /* @__PURE__ */ jsx127("div", { "data-rail-sheet": "", className: "min-h-0 flex-1 overflow-y-auto px-3 pb-6", children })
39146
+ children: /* @__PURE__ */ jsx128("div", { "data-rail-sheet": "", className: "min-h-0 flex-1 overflow-y-auto px-3 pb-6", children })
39069
39147
  }
39070
39148
  );
39071
39149
  }
39072
- return /* @__PURE__ */ jsx127(
39150
+ return /* @__PURE__ */ jsx128(
39073
39151
  "aside",
39074
39152
  {
39075
39153
  "data-rail-column": "",
39076
39154
  "data-rail-over": over ? "" : void 0,
39077
39155
  "data-matrx-page-scroll": "",
39078
39156
  className: over ? "w-[26rem] shrink-0" : "w-[26rem] shrink-0 overflow-y-auto rounded-md border p-3",
39079
- children: over ? /* @__PURE__ */ jsx127(
39157
+ children: over ? /* @__PURE__ */ jsx128(
39080
39158
  "div",
39081
39159
  {
39082
39160
  className: cn71(
@@ -39129,10 +39207,10 @@ function TableNotHere({
39129
39207
  className
39130
39208
  }) {
39131
39209
  const client = useRecordsClient90();
39132
- const [archived, setArchived] = useState116({ phase: "asking" });
39133
- const [restoring, setRestoring] = useState116(false);
39134
- const [refusal3, setRefusal] = useState116(null);
39135
- useEffect101(() => {
39210
+ const [archived, setArchived] = useState117({ phase: "asking" });
39211
+ const [restoring, setRestoring] = useState117(false);
39212
+ const [refusal3, setRefusal] = useState117(null);
39213
+ useEffect102(() => {
39136
39214
  let alive = true;
39137
39215
  void client.tableArchived({ table_id: tableId }).then((answered) => {
39138
39216
  if (!alive) return;
@@ -39142,16 +39220,16 @@ function TableNotHere({
39142
39220
  alive = false;
39143
39221
  };
39144
39222
  }, [client, tableId]);
39145
- if (archived.phase === "asking") return /* @__PURE__ */ jsx127(Skeleton43, { className: "h-40 w-full" });
39223
+ if (archived.phase === "asking") return /* @__PURE__ */ jsx128(Skeleton43, { className: "h-40 w-full" });
39146
39224
  const row = archived.phase === "answered" ? archived.row : null;
39147
39225
  if (row) {
39148
- return /* @__PURE__ */ jsxs120("div", { className: cn71("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
39149
- /* @__PURE__ */ jsx127("p", { className: "text-sm font-medium", children: "This table is archived" }),
39150
- /* @__PURE__ */ jsx127("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
39151
- /* @__PURE__ */ jsx127("p", { className: "text-xs text-muted-foreground", children: archivedByLine2(row) }),
39152
- refusal3 ? /* @__PURE__ */ jsx127(RefusalNotice, { error: refusal3 }) : null,
39153
- /* @__PURE__ */ jsxs120("div", { className: "flex gap-2", children: [
39154
- /* @__PURE__ */ jsx127(
39226
+ return /* @__PURE__ */ jsxs121("div", { className: cn71("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
39227
+ /* @__PURE__ */ jsx128("p", { className: "text-sm font-medium", children: "This table is archived" }),
39228
+ /* @__PURE__ */ jsx128("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
39229
+ /* @__PURE__ */ jsx128("p", { className: "text-xs text-muted-foreground", children: archivedByLine2(row) }),
39230
+ refusal3 ? /* @__PURE__ */ jsx128(RefusalNotice, { error: refusal3 }) : null,
39231
+ /* @__PURE__ */ jsxs121("div", { className: "flex gap-2", children: [
39232
+ /* @__PURE__ */ jsx128(
39155
39233
  Button97,
39156
39234
  {
39157
39235
  size: "sm",
@@ -39170,14 +39248,14 @@ function TableNotHere({
39170
39248
  children: restoring ? "Bringing it back\u2026" : "Bring it back"
39171
39249
  }
39172
39250
  ),
39173
- onLeave ? /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
39251
+ onLeave ? /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
39174
39252
  ] })
39175
39253
  ] });
39176
39254
  }
39177
- return /* @__PURE__ */ jsxs120("div", { className: cn71("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
39178
- /* @__PURE__ */ jsx127("p", { className: "text-sm font-medium", children: "This table is not here" }),
39179
- /* @__PURE__ */ jsx127("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_NOT_REACHABLE }),
39180
- onLeave ? /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
39255
+ return /* @__PURE__ */ jsxs121("div", { className: cn71("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
39256
+ /* @__PURE__ */ jsx128("p", { className: "text-sm font-medium", children: "This table is not here" }),
39257
+ /* @__PURE__ */ jsx128("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_NOT_REACHABLE }),
39258
+ onLeave ? /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
39181
39259
  ] });
39182
39260
  }
39183
39261
  var TABLE_NOT_REACHABLE = (
@@ -39354,14 +39432,14 @@ function TablePage({
39354
39432
  }
39355
39433
  );
39356
39434
  const seededViews = seededOpening && (seedViews ?? [defaultView(tableId)]).every((spec) => seedIsSatisfied(spec, seededOpening.views)) ? seededOpening.views : void 0;
39357
- const [view, setView] = useState116(() => {
39435
+ const [view, setView] = useState117(() => {
39358
39436
  if (!seededViews || seededViews.length === 0) return null;
39359
39437
  const asked2 = savedViewFromParam(activeView);
39360
39438
  return seededViews.find((v) => v.id === asked2) ?? defaultViewOf(seededViews) ?? seededViews[0];
39361
39439
  });
39362
- const [looks, setLooks] = useState116(() => seededViews ? seededOpening?.looks : void 0);
39363
- const looksSeededFor = useRef49(seededViews && seededOpening ? tableId : null);
39364
- useEffect101(() => {
39440
+ const [looks, setLooks] = useState117(() => seededViews ? seededOpening?.looks : void 0);
39441
+ const looksSeededFor = useRef50(seededViews && seededOpening ? tableId : null);
39442
+ useEffect102(() => {
39365
39443
  if (looksSeededFor.current === tableId) {
39366
39444
  looksSeededFor.current = null;
39367
39445
  return;
@@ -39378,7 +39456,7 @@ function TablePage({
39378
39456
  }, [client, tableId]);
39379
39457
  const look = view && looks ? looks[view.id] : void 0;
39380
39458
  const shown4 = view ? applyLook(view, look) : null;
39381
- const [viewsEpoch, setViewsEpoch] = useState116(0);
39459
+ const [viewsEpoch, setViewsEpoch] = useState117(0);
39382
39460
  const opening = openingRail(activeRecordId, activeRail);
39383
39461
  const recordsUi = useRecordsUi();
39384
39462
  const savedFromLink = savedViewFromParam(activeView);
@@ -39386,32 +39464,32 @@ function TablePage({
39386
39464
  const formFromLink = formFromParam(activeView);
39387
39465
  const openedByPackage = openingView(savedFromLink || questionsFromLink || formFromLink ? null : activeView, activeDashboardId);
39388
39466
  const opened = questionsFromLink ? { ...openedByPackage, main: "questions" } : formFromLink ? { ...openedByPackage, main: "form" } : openedByPackage;
39389
- const [views, setViews] = useState116(() => seededViews);
39390
- const [pickedViewId, setPickedViewId] = useState116(savedFromLink);
39391
- const viewSeen = useRef49(null);
39392
- const [viewLinkMissed, setViewLinkMissed] = useState116(false);
39467
+ const [views, setViews] = useState117(() => seededViews);
39468
+ const [pickedViewId, setPickedViewId] = useState117(savedFromLink);
39469
+ const viewSeen = useRef50(null);
39470
+ const [viewLinkMissed, setViewLinkMissed] = useState117(false);
39393
39471
  const railAsked = typeof activeRail === "string" ? activeRail.trim() : "";
39394
39472
  const railUnknown = railAsked !== "" && railFromParam(railAsked) === null ? railAsked : null;
39395
39473
  const shareFromLink = railFromParam(activeRail) === "share";
39396
39474
  const canShare = useCanShare();
39397
39475
  const itemFor = (which) => railFromParam(activeRail) === which ? activeItemId ?? null : null;
39398
- const [asking, setAsking] = useState116(null);
39399
- const [layoutFromLink, setLayoutFromLink] = useState116(opened.layout);
39400
- const [surface, setSurface] = useState116({
39476
+ const [asking, setAsking] = useState117(null);
39477
+ const [layoutFromLink, setLayoutFromLink] = useState117(opened.layout);
39478
+ const [surface, setSurface] = useState117({
39401
39479
  main: opened.main,
39402
39480
  rail: opening.rail
39403
39481
  });
39404
39482
  const { main, rail } = surface;
39405
- const [questionDraft, setQuestionDraft] = useState116(null);
39483
+ const [questionDraft, setQuestionDraft] = useState117(null);
39406
39484
  const setRail = (next) => setSurface((now) => ({ ...now, rail: next }));
39407
- const [importEpoch, setImportEpoch] = useState116(0);
39408
- const [openRecord, setOpenRecord] = useState116(opening.record);
39485
+ const [importEpoch, setImportEpoch] = useState117(0);
39486
+ const [openRecord, setOpenRecord] = useState117(opening.record);
39409
39487
  const phone = useIsMobile2();
39410
- const [shareAsked, setShareAsked] = useState116(0);
39488
+ const [shareAsked, setShareAsked] = useState117(0);
39411
39489
  const { open: renameOpen, setOpen: setRenameOpen, ask: askRename, menuContentProps: renameMenuProps } = useRenameFromMenu();
39412
- const [archiveAsked, setArchiveAsked] = useState116(0);
39490
+ const [archiveAsked, setArchiveAsked] = useState117(0);
39413
39491
  const pageArchive = useTableArchive2(tableId);
39414
- const archiveRunning = useRef49(false);
39492
+ const archiveRunning = useRef50(false);
39415
39493
  const archiveFromMenu = useCallback60(async () => {
39416
39494
  if (archiveRunning.current) return;
39417
39495
  archiveRunning.current = true;
@@ -39441,15 +39519,15 @@ function TablePage({
39441
39519
  archiveRunning.current = false;
39442
39520
  }
39443
39521
  }, [pageArchive, client, tableId, table.data, recordsUi.notify]);
39444
- const [moveAsked, setMoveAsked] = useState116(0);
39522
+ const [moveAsked, setMoveAsked] = useState117(0);
39445
39523
  const canCleanTable = useTableCanBeCleaned(tableId);
39446
- const [duplicateOpen, setDuplicateOpen] = useState116(false);
39447
- const [referenceOpen, setReferenceOpen] = useState116(false);
39448
- const [subscribeOpen, setSubscribeOpen] = useState116(false);
39449
- const [breakDownOpen, setBreakDownOpen] = useState116(false);
39524
+ const [duplicateOpen, setDuplicateOpen] = useState117(false);
39525
+ const [referenceOpen, setReferenceOpen] = useState117(false);
39526
+ const [subscribeOpen, setSubscribeOpen] = useState117(false);
39527
+ const [breakDownOpen, setBreakDownOpen] = useState117(false);
39450
39528
  const canGetReference = useCanGetReference();
39451
- const [toolbarSlot, setToolbarSlot] = useState116(null);
39452
- const [toolbarRow, setToolbarRow] = useState116(null);
39529
+ const [toolbarSlot, setToolbarSlot] = useState117(null);
39530
+ const [toolbarRow, setToolbarRow] = useState117(null);
39453
39531
  const toolbarFold2 = useToolbarFit(toolbarRow);
39454
39532
  const slotClipped = useSlotScroll(toolbarSlot);
39455
39533
  const embedded = pagePresentation2 === "embedded";
@@ -39474,7 +39552,7 @@ function TablePage({
39474
39552
  const skeletonFace = skeletonLayoutFor(
39475
39553
  faceUnknown && !layoutFromLink ? rememberedFace ?? shownLayout : shownLayout
39476
39554
  );
39477
- useEffect101(() => {
39555
+ useEffect102(() => {
39478
39556
  if (embedded || faceUnknown || main !== "records" || opened.layout || !table.data) return;
39479
39557
  rememberLayout(tableId, shownLayout);
39480
39558
  }, [embedded, faceUnknown, main, shownLayout, tableId, table.data !== void 0]);
@@ -39492,9 +39570,9 @@ function TablePage({
39492
39570
  lookDiffers: view ? lookDiffers(view, look) : false
39493
39571
  };
39494
39572
  const shownSignature = JSON.stringify(shownReport);
39495
- const reportRef = useRef49(onShownViewChange);
39573
+ const reportRef = useRef50(onShownViewChange);
39496
39574
  reportRef.current = onShownViewChange;
39497
- useEffect101(() => {
39575
+ useEffect102(() => {
39498
39576
  reportRef.current?.(JSON.parse(shownSignature));
39499
39577
  }, [shownSignature]);
39500
39578
  const pickLayout = (next) => {
@@ -39503,9 +39581,9 @@ function TablePage({
39503
39581
  onViewChanged?.(addressForView(view, next));
39504
39582
  void patchView({ layout: next });
39505
39583
  };
39506
- const reportedRecords = useRef49(/* @__PURE__ */ new Set());
39507
- const lastActiveRecord = useRef49(activeRecordId ?? null);
39508
- useEffect101(() => {
39584
+ const reportedRecords = useRef50(/* @__PURE__ */ new Set());
39585
+ const lastActiveRecord = useRef50(activeRecordId ?? null);
39586
+ useEffect102(() => {
39509
39587
  const before = lastActiveRecord.current;
39510
39588
  lastActiveRecord.current = activeRecordId ?? null;
39511
39589
  if (!activeRecordId) {
@@ -39516,32 +39594,32 @@ function TablePage({
39516
39594
  setOpenRecord(activeRecordId);
39517
39595
  setSurface((now) => ({ ...now, rail: "record" }));
39518
39596
  }, [activeRecordId]);
39519
- const [shownIds, setShownIdsRaw] = useState116([]);
39597
+ const [shownIds, setShownIdsRaw] = useState117([]);
39520
39598
  const setShownIds = useCallback60(
39521
39599
  (next) => setShownIdsRaw((prev) => prev.length === next.length && prev.every((id, i) => id === next[i]) ? prev : next),
39522
39600
  []
39523
39601
  );
39524
- const [recordExpanded, setRecordExpanded] = useState116(false);
39525
- const [recordFull, setRecordFull] = useState116(false);
39526
- useEffect101(() => {
39602
+ const [recordExpanded, setRecordExpanded] = useState117(false);
39603
+ const [recordFull, setRecordFull] = useState117(false);
39604
+ useEffect102(() => {
39527
39605
  if (rail !== "record") setRecordFull(false);
39528
39606
  }, [rail]);
39529
39607
  const shownRecord = rail === "record" ? openRecord : null;
39530
- const reportedRecord = useRef49(activeRecordId ?? null);
39531
- useEffect101(() => {
39608
+ const reportedRecord = useRef50(activeRecordId ?? null);
39609
+ useEffect102(() => {
39532
39610
  if (shownRecord === reportedRecord.current) return;
39533
39611
  const how = shownRecord === null ? "close" : reportedRecord.current === null ? "open" : "step";
39534
39612
  reportedRecord.current = shownRecord;
39535
39613
  if (shownRecord) reportedRecords.current.add(shownRecord);
39536
39614
  onRecordChange?.(shownRecord, how);
39537
39615
  }, [shownRecord, onRecordChange]);
39538
- useEffect101(() => {
39616
+ useEffect102(() => {
39539
39617
  if (activeRecordId) return;
39540
39618
  const named = railFromParam(activeRail);
39541
39619
  if (named === null || named === "share") return;
39542
39620
  setSurface((now) => ({ ...now, rail: named }));
39543
39621
  }, [activeRail, activeRecordId]);
39544
- useEffect101(() => {
39622
+ useEffect102(() => {
39545
39623
  if (formFromParam(activeView)) {
39546
39624
  setSurface((now) => ({ ...now, main: "form" }));
39547
39625
  return;
@@ -39552,7 +39630,7 @@ function TablePage({
39552
39630
  setLayoutFromLink(isLayout ? named : null);
39553
39631
  setSurface((now) => ({ ...now, main: isLayout ? "records" : named }));
39554
39632
  }, [activeView]);
39555
- const [viewSaveRefused, setViewSaveRefused] = useState116(null);
39633
+ const [viewSaveRefused, setViewSaveRefused] = useState117(null);
39556
39634
  const viewLocked = view?.presentation?.locked === true;
39557
39635
  const unlockView = useCallback60(async () => {
39558
39636
  const current = view;
@@ -39586,19 +39664,19 @@ function TablePage({
39586
39664
  },
39587
39665
  [client, tableId, view, looks, viewLocked, sayLocked]
39588
39666
  );
39589
- const arrival = useRef49(viewAddress ?? null);
39590
- const [gridQuery, setGridQuery] = useState116(null);
39591
- const [addressResetEpoch, setAddressResetEpoch] = useState116(0);
39667
+ const arrival = useRef50(viewAddress ?? null);
39668
+ const [gridQuery, setGridQuery] = useState117(null);
39669
+ const [addressResetEpoch, setAddressResetEpoch] = useState117(0);
39592
39670
  const reportGrid = useCallback60((q) => {
39593
39671
  const next = { sort: q.sort, filters: q.filters, search: q.search, page: q.page };
39594
39672
  setGridQuery((held) => sameViewAddress(held, next) ? held : next);
39595
39673
  }, []);
39596
- const addressPort = useMemo70(
39674
+ const addressPort = useMemo71(
39597
39675
  () => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
39598
39676
  [reportGrid, addressResetEpoch]
39599
39677
  );
39600
- const hiddenApplied = useRef49(false);
39601
- useEffect101(() => {
39678
+ const hiddenApplied = useRef50(false);
39679
+ useEffect102(() => {
39602
39680
  const hidden = arrival.current?.hidden;
39603
39681
  if (hiddenApplied.current || !view || !looks || !hidden || hidden.length === 0) return;
39604
39682
  hiddenApplied.current = true;
@@ -39618,10 +39696,10 @@ function TablePage({
39618
39696
  const gridPending = !isViewAddressEmpty({ ...arrival.current ?? {}, hidden: [] });
39619
39697
  const addressReady = Boolean(view && looks) && (gridQuery !== null || !gridPending);
39620
39698
  const addressSignature = JSON.stringify(viewAddressToParams(addressNow));
39621
- const addressReportRef = useRef49(onViewAddressChange);
39699
+ const addressReportRef = useRef50(onViewAddressChange);
39622
39700
  addressReportRef.current = onViewAddressChange;
39623
- const addressSent = useRef49(null);
39624
- useEffect101(() => {
39701
+ const addressSent = useRef50(null);
39702
+ useEffect102(() => {
39625
39703
  if (!addressReady) return;
39626
39704
  if (addressSent.current === null && addressSignature === JSON.stringify(viewAddressToParams(arrival.current))) {
39627
39705
  addressSent.current = addressSignature;
@@ -39633,9 +39711,9 @@ function TablePage({
39633
39711
  }, [addressReady, addressSignature]);
39634
39712
  const queryShowing = !isViewAddressEmpty({ ...gridQuery ?? {}, hidden: [] });
39635
39713
  const lookShowing = Boolean(view && looks && (lookDiffers(view, looks[view.id]) || queryShowing));
39636
- const [lookRefused, setLookRefused] = useState116(null);
39637
- const [namingLook, setNamingLook] = useState116(false);
39638
- const [lookName, setLookName] = useState116("");
39714
+ const [lookRefused, setLookRefused] = useState117(null);
39715
+ const [namingLook, setNamingLook] = useState117(false);
39716
+ const [lookName, setLookName] = useState117("");
39639
39717
  const resetLook = async () => {
39640
39718
  const current = view;
39641
39719
  setAddressResetEpoch((n) => n + 1);
@@ -39700,7 +39778,7 @@ function TablePage({
39700
39778
  setPickedViewId(written.data);
39701
39779
  setViewsEpoch((n) => n + 1);
39702
39780
  };
39703
- const [designateRefused, setDesignateRefused] = useState116(null);
39781
+ const [designateRefused, setDesignateRefused] = useState117(null);
39704
39782
  const opensAs = view?.isDefault ? view.layout : null;
39705
39783
  const canDesignate = Boolean(
39706
39784
  rights.organise && view && layoutShowing && layoutShowing !== opensAs && storeKeepsLayout(layoutShowing)
@@ -39725,7 +39803,7 @@ function TablePage({
39725
39803
  };
39726
39804
  const footer = footerOf(shown4?.presentation);
39727
39805
  const setFooter = (next) => void patchView({ presentation: { ...shown4?.presentation ?? {}, footer: next } });
39728
- const layoutRadio = /* @__PURE__ */ jsxs120(
39806
+ const layoutRadio = /* @__PURE__ */ jsxs121(
39729
39807
  DropdownMenuRadioGroup3,
39730
39808
  {
39731
39809
  value: layoutShowing ?? (main === "form" ? FORM_LAYOUT : ""),
@@ -39737,14 +39815,14 @@ function TablePage({
39737
39815
  if (VIEW_LAYOUTS.includes(value)) pickLayout(value);
39738
39816
  },
39739
39817
  children: [
39740
- VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx127(DropdownMenuRadioItem3, { value: option, children: LAYOUT_LABEL[option] }, option)),
39741
- /* @__PURE__ */ jsx127(DropdownMenuRadioItem3, { value: FORM_LAYOUT, "data-layout-form": "", children: FORM_LAYOUT_LABEL })
39818
+ VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx128(DropdownMenuRadioItem3, { value: option, children: LAYOUT_LABEL[option] }, option)),
39819
+ /* @__PURE__ */ jsx128(DropdownMenuRadioItem3, { value: FORM_LAYOUT, "data-layout-form": "", children: FORM_LAYOUT_LABEL })
39742
39820
  ]
39743
39821
  }
39744
39822
  );
39745
- const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ jsxs120(Fragment56, { children: [
39746
- /* @__PURE__ */ jsx127("div", { className: "flex items-center gap-2 text-xs", "data-table-sheet-filter": "", "data-matrx-table-tools-keep-open": "", children: /* @__PURE__ */ jsx127(ViewFilter, { tableId, view: shown4, onApply: (where) => void patchView({ where }) }) }),
39747
- /* @__PURE__ */ jsx127("div", { role: "group", "aria-label": "Layout", className: "flex flex-wrap gap-1 pt-1", "data-table-sheet-layout": "", children: VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx127(
39823
+ const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ jsxs121(Fragment56, { children: [
39824
+ /* @__PURE__ */ jsx128("div", { className: "flex items-center gap-2 text-xs", "data-table-sheet-filter": "", "data-matrx-table-tools-keep-open": "", children: /* @__PURE__ */ jsx128(ViewFilter, { tableId, view: shown4, onApply: (where) => void patchView({ where }) }) }),
39825
+ /* @__PURE__ */ jsx128("div", { role: "group", "aria-label": "Layout", className: "flex flex-wrap gap-1 pt-1", "data-table-sheet-layout": "", children: VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx128(
39748
39826
  Button97,
39749
39827
  {
39750
39828
  size: "sm",
@@ -39756,7 +39834,7 @@ function TablePage({
39756
39834
  },
39757
39835
  option
39758
39836
  )) }),
39759
- rights.share && canShare ? /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "ghost", className: "h-8", onClick: () => setShareAsked((n) => n + 1), "data-table-sheet-share": "", children: "Share\u2026" }) : null
39837
+ rights.share && canShare ? /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "ghost", className: "h-8", onClick: () => setShareAsked((n) => n + 1), "data-table-sheet-share": "", children: "Share\u2026" }) : null
39760
39838
  ] }) : void 0;
39761
39839
  const go = (pressed) => {
39762
39840
  if (!surfaceChosen(surface, pressed)) press(pressed);
@@ -39943,14 +40021,14 @@ function TablePage({
39943
40021
  }
39944
40022
  });
39945
40023
  const openedEntry = ACTION_PRESS.find((entry) => entry.press.main !== void 0 && entry.press.main === main) ?? ACTION_PRESS.find((entry) => entry.press.rail !== void 0 && entry.press.rail === rail) ?? null;
39946
- const actionsRef = useRef49(actions);
40024
+ const actionsRef = useRef50(actions);
39947
40025
  actionsRef.current = actions;
39948
- const onActionsRef = useRef49(onActions);
40026
+ const onActionsRef = useRef50(onActions);
39949
40027
  onActionsRef.current = onActions;
39950
- useEffect101(() => {
40028
+ useEffect102(() => {
39951
40029
  onActionsRef.current?.(actionsRef.current);
39952
40030
  });
39953
- useEffect101(() => {
40031
+ useEffect102(() => {
39954
40032
  const onKey = (event) => {
39955
40033
  const asked2 = objectActionForKey(actionsRef.current, event);
39956
40034
  if (!asked2) return;
@@ -39962,9 +40040,9 @@ function TablePage({
39962
40040
  return () => window.removeEventListener("keydown", onKey);
39963
40041
  }, [recordsUi]);
39964
40042
  const openedFromMenu = openedEntry ? { ...openedEntry, label: actions.find((a) => a.id === openedEntry.id)?.label ?? openedEntry.key } : null;
39965
- const pageActions = /* @__PURE__ */ jsxs120(Fragment56, { children: [
39966
- publicReadOnly ? /* @__PURE__ */ jsx127(Badge18, { variant: "neutral", className: "shrink-0", "data-public-read-only": "", children: PUBLIC_READ_ONLY }, "public-read-only") : null,
39967
- !phone && rights.read && table.data ? /* @__PURE__ */ jsx127(
40043
+ const pageActions = /* @__PURE__ */ jsxs121(Fragment56, { children: [
40044
+ publicReadOnly ? /* @__PURE__ */ jsx128(Badge18, { variant: "neutral", className: "shrink-0", "data-public-read-only": "", children: PUBLIC_READ_ONLY }, "public-read-only") : null,
40045
+ !phone && rights.read && table.data ? /* @__PURE__ */ jsx128(
39968
40046
  TableAsk,
39969
40047
  {
39970
40048
  tableId,
@@ -39976,7 +40054,7 @@ function TablePage({
39976
40054
  },
39977
40055
  "ask"
39978
40056
  ) : null,
39979
- organizationId ? /* @__PURE__ */ jsx127("span", { className: shareInMenu ? "hidden" : "flex shrink-0 items-center", "data-toolbar-fit": "share", children: /* @__PURE__ */ jsx127(
40057
+ organizationId ? /* @__PURE__ */ jsx128("span", { className: shareInMenu ? "hidden" : "flex shrink-0 items-center", "data-toolbar-fit": "share", children: /* @__PURE__ */ jsx128(
39980
40058
  ShareControl,
39981
40059
  {
39982
40060
  kind: "table",
@@ -39990,28 +40068,28 @@ function TablePage({
39990
40068
  },
39991
40069
  `share-${shareAsked}`
39992
40070
  ) }, "share") : null,
39993
- phone ? /* @__PURE__ */ jsxs120(Fragment56, { children: [
39994
- !chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ jsxs120(DropdownMenu9, { children: [
39995
- /* @__PURE__ */ jsx127(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "ghost", "aria-label": "Layout", title: "Layout", "data-table-layout-menu": "", children: "Layout" }) }),
39996
- /* @__PURE__ */ jsx127(DropdownMenuContent9, { align: "end", className: "w-56", children: layoutRadio })
40071
+ phone ? /* @__PURE__ */ jsxs121(Fragment56, { children: [
40072
+ !chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ jsxs121(DropdownMenu9, { children: [
40073
+ /* @__PURE__ */ jsx128(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "ghost", "aria-label": "Layout", title: "Layout", "data-table-layout-menu": "", children: "Layout" }) }),
40074
+ /* @__PURE__ */ jsx128(DropdownMenuContent9, { align: "end", className: "w-56", children: layoutRadio })
39997
40075
  ] }, "phone-layout") : null,
39998
40076
  phoneTableActions(actions)
39999
- ] }) : /* @__PURE__ */ jsxs120(DropdownMenu9, { children: [
40000
- /* @__PURE__ */ jsx127(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "ghost", "aria-label": "Table menu", title: "Table menu", "data-table-menu": "", children: /* @__PURE__ */ jsxs120("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "currentColor", "aria-hidden": "true", children: [
40001
- /* @__PURE__ */ jsx127("circle", { cx: "5", cy: "12", r: "1.75" }),
40002
- /* @__PURE__ */ jsx127("circle", { cx: "12", cy: "12", r: "1.75" }),
40003
- /* @__PURE__ */ jsx127("circle", { cx: "19", cy: "12", r: "1.75" })
40077
+ ] }) : /* @__PURE__ */ jsxs121(DropdownMenu9, { children: [
40078
+ /* @__PURE__ */ jsx128(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "ghost", "aria-label": "Table menu", title: "Table menu", "data-table-menu": "", children: /* @__PURE__ */ jsxs121("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "currentColor", "aria-hidden": "true", children: [
40079
+ /* @__PURE__ */ jsx128("circle", { cx: "5", cy: "12", r: "1.75" }),
40080
+ /* @__PURE__ */ jsx128("circle", { cx: "12", cy: "12", r: "1.75" }),
40081
+ /* @__PURE__ */ jsx128("circle", { cx: "19", cy: "12", r: "1.75" })
40004
40082
  ] }) }) }),
40005
- /* @__PURE__ */ jsxs120(DropdownMenuContent9, { align: "end", className: "w-64", "data-table-menu-content": "", ...renameMenuProps, children: [
40006
- !chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ jsxs120(Fragment56, { children: [
40007
- /* @__PURE__ */ jsx127(DropdownMenuLabel3, { className: "text-xs text-muted-foreground", children: "Layout" }),
40083
+ /* @__PURE__ */ jsxs121(DropdownMenuContent9, { align: "end", className: "w-64", "data-table-menu-content": "", ...renameMenuProps, children: [
40084
+ !chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ jsxs121(Fragment56, { children: [
40085
+ /* @__PURE__ */ jsx128(DropdownMenuLabel3, { className: "text-xs text-muted-foreground", children: "Layout" }),
40008
40086
  layoutRadio,
40009
- /* @__PURE__ */ jsx127(DropdownMenuSeparator4, {})
40087
+ /* @__PURE__ */ jsx128(DropdownMenuSeparator4, {})
40010
40088
  ] }) : null,
40011
- /* @__PURE__ */ jsx127(ObjectActionMenuItems, { actions })
40089
+ /* @__PURE__ */ jsx128(ObjectActionMenuItems, { actions })
40012
40090
  ] })
40013
40091
  ] }, "menu"),
40014
- moveAsked > 0 && !actionHost?.move ? /* @__PURE__ */ jsx127(
40092
+ moveAsked > 0 && !actionHost?.move ? /* @__PURE__ */ jsx128(
40015
40093
  WhereItLives,
40016
40094
  {
40017
40095
  tableId,
@@ -40024,7 +40102,7 @@ function TablePage({
40024
40102
  },
40025
40103
  "move"
40026
40104
  ) : null,
40027
- breakDownOpen ? /* @__PURE__ */ jsx127(
40105
+ breakDownOpen ? /* @__PURE__ */ jsx128(
40028
40106
  BreakDownDialog,
40029
40107
  {
40030
40108
  tableId,
@@ -40035,7 +40113,7 @@ function TablePage({
40035
40113
  },
40036
40114
  "break-down"
40037
40115
  ) : null,
40038
- subscribeOpen && recordsUi.calendarFeed && organizationId && view ? /* @__PURE__ */ jsx127(
40116
+ subscribeOpen && recordsUi.calendarFeed && organizationId && view ? /* @__PURE__ */ jsx128(
40039
40117
  CalendarSubscribeDialog,
40040
40118
  {
40041
40119
  port: recordsUi.calendarFeed,
@@ -40048,8 +40126,8 @@ function TablePage({
40048
40126
  },
40049
40127
  "subscribe"
40050
40128
  ) : null,
40051
- referenceOpen && table.data ? /* @__PURE__ */ jsx127(TableReferenceDialog, { table: table.data, open: referenceOpen, onOpenChange: setReferenceOpen }, "reference") : null,
40052
- duplicateOpen && table.data ? /* @__PURE__ */ jsx127(
40129
+ referenceOpen && table.data ? /* @__PURE__ */ jsx128(TableReferenceDialog, { table: table.data, open: referenceOpen, onOpenChange: setReferenceOpen }, "reference") : null,
40130
+ duplicateOpen && table.data ? /* @__PURE__ */ jsx128(
40053
40131
  TableDuplicateDialog,
40054
40132
  {
40055
40133
  tableId,
@@ -40061,40 +40139,40 @@ function TablePage({
40061
40139
  },
40062
40140
  "duplicate"
40063
40141
  ) : null,
40064
- rights.structure && table.data ? /* @__PURE__ */ jsx127(TableRenameDialog, { tableId, name: table.data.name, open: renameOpen, onOpenChange: setRenameOpen }, "rename") : null
40142
+ rights.structure && table.data ? /* @__PURE__ */ jsx128(TableRenameDialog, { tableId, name: table.data.name, open: renameOpen, onOpenChange: setRenameOpen }, "rename") : null
40065
40143
  ] });
40066
40144
  const headerNode = header && !embedded ? header({ actions: table.data ? pageActions : null, tableName: table.data?.name ?? null }) : null;
40067
- if (table.error) return /* @__PURE__ */ jsxs120(Fragment56, { children: [
40145
+ if (table.error) return /* @__PURE__ */ jsxs121(Fragment56, { children: [
40068
40146
  headerNode,
40069
- /* @__PURE__ */ jsx127(RefusalNotice, { error: table.error })
40147
+ /* @__PURE__ */ jsx128(RefusalNotice, { error: table.error })
40070
40148
  ] });
40071
40149
  if (table.loading && !table.data) {
40072
- return /* @__PURE__ */ jsxs120(Fragment56, { children: [
40150
+ return /* @__PURE__ */ jsxs121(Fragment56, { children: [
40073
40151
  headerNode,
40074
- /* @__PURE__ */ jsx127(TablePageSkeleton, { layout: skeletonFace, embedded, tableId, ...className ? { className } : {} })
40152
+ /* @__PURE__ */ jsx128(TablePageSkeleton, { layout: skeletonFace, embedded, tableId, ...className ? { className } : {} })
40075
40153
  ] });
40076
40154
  }
40077
40155
  if (!table.data) {
40078
- return /* @__PURE__ */ jsxs120(Fragment56, { children: [
40156
+ return /* @__PURE__ */ jsxs121(Fragment56, { children: [
40079
40157
  headerNode,
40080
- /* @__PURE__ */ jsx127(TableNotHere, { tableId, onLeave, leaveLabel, className })
40158
+ /* @__PURE__ */ jsx128(TableNotHere, { tableId, onLeave, leaveLabel, className })
40081
40159
  ] });
40082
40160
  }
40083
40161
  const lookSavable = Boolean(
40084
40162
  rights.write && view && Object.keys(viewPatchDocument(saveToViewPlan(view, look ?? {}).patch)).length > 0
40085
40163
  );
40086
- return /* @__PURE__ */ jsxs120(ViewAddressContext.Provider, { value: addressPort, children: [
40087
- /* @__PURE__ */ jsxs120("div", { className: cn71("flex h-full min-h-0 gap-4", className), "data-table-footer": footer, children: [
40164
+ return /* @__PURE__ */ jsxs121(ViewAddressContext.Provider, { value: addressPort, children: [
40165
+ /* @__PURE__ */ jsxs121("div", { className: cn71("flex h-full min-h-0 gap-4", className), "data-table-footer": footer, children: [
40088
40166
  headerNode,
40089
- /* @__PURE__ */ jsx127("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col gap-2", children: structure.hidden || !structure.settled ? (
40167
+ /* @__PURE__ */ jsx128("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col gap-2", children: structure.hidden || !structure.settled ? (
40090
40168
  /* THE TOOLBAR ROW'S HEIGHT IS KEPT (min-h-8), so the sentence lands exactly where the bar was. */
40091
- /* @__PURE__ */ jsxs120(Fragment56, { children: [
40092
- /* @__PURE__ */ jsx127("div", { className: TABLE_TOOLBAR_ROW_CLASS, "data-table-toolbar": "", "aria-hidden": "true" }),
40093
- structure.hidden ? /* @__PURE__ */ jsx127(StructureLocked, {}) : /* @__PURE__ */ jsx127(RecordsSkeleton, { layout: skeletonFace, embedded })
40169
+ /* @__PURE__ */ jsxs121(Fragment56, { children: [
40170
+ /* @__PURE__ */ jsx128("div", { className: TABLE_TOOLBAR_ROW_CLASS, "data-table-toolbar": "", "aria-hidden": "true" }),
40171
+ structure.hidden ? /* @__PURE__ */ jsx128(StructureLocked, {}) : /* @__PURE__ */ jsx128(RecordsSkeleton, { layout: skeletonFace, embedded })
40094
40172
  ] })
40095
- ) : /* @__PURE__ */ jsxs120(Fragment56, { children: [
40096
- /* @__PURE__ */ jsx127(ImportNotice, { tableId, epoch: importEpoch, onOpenImport: () => setRail("import") }),
40097
- /* @__PURE__ */ jsxs120(
40173
+ ) : /* @__PURE__ */ jsxs121(Fragment56, { children: [
40174
+ /* @__PURE__ */ jsx128(ImportNotice, { tableId, epoch: importEpoch, onOpenImport: () => setRail("import") }),
40175
+ /* @__PURE__ */ jsxs121(
40098
40176
  "div",
40099
40177
  {
40100
40178
  ref: setToolbarRow,
@@ -40102,7 +40180,7 @@ function TablePage({
40102
40180
  "data-table-toolbar": "",
40103
40181
  "data-table-toolbar-fold": toolbarFold2,
40104
40182
  children: [
40105
- /* @__PURE__ */ jsx127(
40183
+ /* @__PURE__ */ jsx128(
40106
40184
  ViewBar,
40107
40185
  {
40108
40186
  tableId,
@@ -40129,9 +40207,9 @@ function TablePage({
40129
40207
  },
40130
40208
  ...seededViews && viewsEpoch === 0 ? { initialViews: seededViews } : {},
40131
40209
  seed: seedViews ?? [defaultView(tableId)],
40132
- settings: view && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ jsxs120("div", { className: "flex flex-col gap-0.5 px-1 py-1", role: "radiogroup", "aria-label": FOOTER_WORDS.label, children: [
40133
- /* @__PURE__ */ jsx127("span", { className: "px-1 pb-0.5 text-[11px] font-medium text-muted-foreground", children: FOOTER_WORDS.label }),
40134
- ["sticky", "inline"].map((option) => /* @__PURE__ */ jsxs120(
40210
+ settings: view && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ jsxs121("div", { className: "flex flex-col gap-0.5 px-1 py-1", role: "radiogroup", "aria-label": FOOTER_WORDS.label, children: [
40211
+ /* @__PURE__ */ jsx128("span", { className: "px-1 pb-0.5 text-[11px] font-medium text-muted-foreground", children: FOOTER_WORDS.label }),
40212
+ ["sticky", "inline"].map((option) => /* @__PURE__ */ jsxs121(
40135
40213
  "button",
40136
40214
  {
40137
40215
  type: "button",
@@ -40144,7 +40222,7 @@ function TablePage({
40144
40222
  ),
40145
40223
  onClick: () => setFooter(option),
40146
40224
  children: [
40147
- /* @__PURE__ */ jsx127(
40225
+ /* @__PURE__ */ jsx128(
40148
40226
  "span",
40149
40227
  {
40150
40228
  "aria-hidden": "true",
@@ -40160,8 +40238,8 @@ function TablePage({
40160
40238
  },
40161
40239
  viewsEpoch
40162
40240
  ),
40163
- chooserInline ? /* @__PURE__ */ jsxs120("div", { className: "flex shrink-0 items-center gap-0.5", role: "group", "aria-label": "Layout", "data-toolbar-fit": "chooser", children: [
40164
- VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx127(
40241
+ chooserInline ? /* @__PURE__ */ jsxs121("div", { className: "flex shrink-0 items-center gap-0.5", role: "group", "aria-label": "Layout", "data-toolbar-fit": "chooser", children: [
40242
+ VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx128(
40165
40243
  Button97,
40166
40244
  {
40167
40245
  size: "sm",
@@ -40172,7 +40250,7 @@ function TablePage({
40172
40250
  },
40173
40251
  option
40174
40252
  )),
40175
- /* @__PURE__ */ jsx127(
40253
+ /* @__PURE__ */ jsx128(
40176
40254
  Button97,
40177
40255
  {
40178
40256
  size: "sm",
@@ -40188,20 +40266,20 @@ function TablePage({
40188
40266
  /* THE ROW HAD NO ROOM (lane C, review 2026-09-26 D6: the switcher vanished at 1280 px and
40189
40267
  with the record panel open): the chooser folds to ONE button naming the layout that is
40190
40268
  showing — it never leaves the row. */
40191
- /* @__PURE__ */ jsx127("span", { className: "flex shrink-0 items-center", "data-toolbar-fit": "chooser", "data-layout-chooser-compact": "", children: /* @__PURE__ */ jsxs120(DropdownMenu9, { children: [
40192
- /* @__PURE__ */ jsx127(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsxs120(Button97, { size: "sm", variant: "outline", className: "h-8 gap-1 px-2 text-xs", "aria-label": `Layout: ${layoutShowingLabel ?? "none"}`, children: [
40269
+ /* @__PURE__ */ jsx128("span", { className: "flex shrink-0 items-center", "data-toolbar-fit": "chooser", "data-layout-chooser-compact": "", children: /* @__PURE__ */ jsxs121(DropdownMenu9, { children: [
40270
+ /* @__PURE__ */ jsx128(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsxs121(Button97, { size: "sm", variant: "outline", className: "h-8 gap-1 px-2 text-xs", "aria-label": `Layout: ${layoutShowingLabel ?? "none"}`, children: [
40193
40271
  layoutShowingLabel ?? "Layout",
40194
- /* @__PURE__ */ jsx127("svg", { viewBox: "0 0 24 24", className: "h-3.5 w-3.5 opacity-70", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx127("path", { d: "m6 9 6 6 6-6" }) })
40272
+ /* @__PURE__ */ jsx128("svg", { viewBox: "0 0 24 24", className: "h-3.5 w-3.5 opacity-70", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ jsx128("path", { d: "m6 9 6 6 6-6" }) })
40195
40273
  ] }) }),
40196
- /* @__PURE__ */ jsxs120(DropdownMenuContent9, { align: "start", className: "w-44", "data-layout-chooser-menu": "", children: [
40197
- /* @__PURE__ */ jsx127(DropdownMenuLabel3, { className: "text-xs text-muted-foreground", children: "Layout" }),
40274
+ /* @__PURE__ */ jsxs121(DropdownMenuContent9, { align: "start", className: "w-44", "data-layout-chooser-menu": "", children: [
40275
+ /* @__PURE__ */ jsx128(DropdownMenuLabel3, { className: "text-xs text-muted-foreground", children: "Layout" }),
40198
40276
  layoutRadio
40199
40277
  ] })
40200
40278
  ] }) })
40201
40279
  ) : null,
40202
- main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */ jsx127(ViewFilter, { tableId, view: shown4, onApply: (where) => void patchView({ where }) }) : null,
40203
- lookShowing && main === "records" && !namingLook ? /* @__PURE__ */ jsxs120("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-view-look-folded": "", "data-toolbar-fit": "look", children: [
40204
- /* @__PURE__ */ jsx127(
40280
+ main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */ jsx128(ViewFilter, { tableId, view: shown4, onApply: (where) => void patchView({ where }) }) : null,
40281
+ lookShowing && main === "records" && !namingLook ? /* @__PURE__ */ jsxs121("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-view-look-folded": "", "data-toolbar-fit": "look", children: [
40282
+ /* @__PURE__ */ jsx128(
40205
40283
  Button97,
40206
40284
  {
40207
40285
  size: "sm",
@@ -40211,36 +40289,36 @@ function TablePage({
40211
40289
  "aria-label": "Reset view",
40212
40290
  onClick: () => void resetLook(),
40213
40291
  "data-view-look-reset-button": "",
40214
- children: /* @__PURE__ */ jsxs120("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
40215
- /* @__PURE__ */ jsx127("path", { d: "M3 12a9 9 0 1 0 3-6.7L3 8" }),
40216
- /* @__PURE__ */ jsx127("path", { d: "M3 3v5h5" })
40292
+ children: /* @__PURE__ */ jsxs121("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
40293
+ /* @__PURE__ */ jsx128("path", { d: "M3 12a9 9 0 1 0 3-6.7L3 8" }),
40294
+ /* @__PURE__ */ jsx128("path", { d: "M3 3v5h5" })
40217
40295
  ] })
40218
40296
  }
40219
40297
  ),
40220
- /* @__PURE__ */ jsxs120(DropdownMenu9, { children: [
40221
- /* @__PURE__ */ jsx127(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsxs120(Button97, { size: "sm", variant: "outline", className: "relative h-8 w-8 shrink-0 px-0", title: LOOK_WORDS.folded, "aria-label": LOOK_WORDS.folded, "data-view-look-menu": "", children: [
40222
- /* @__PURE__ */ jsx127(LookGlyph, {}),
40223
- /* @__PURE__ */ jsx127("span", { "aria-hidden": "true", className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-primary" })
40298
+ /* @__PURE__ */ jsxs121(DropdownMenu9, { children: [
40299
+ /* @__PURE__ */ jsx128(DropdownMenuTrigger9, { asChild: true, children: /* @__PURE__ */ jsxs121(Button97, { size: "sm", variant: "outline", className: "relative h-8 w-8 shrink-0 px-0", title: LOOK_WORDS.folded, "aria-label": LOOK_WORDS.folded, "data-view-look-menu": "", children: [
40300
+ /* @__PURE__ */ jsx128(LookGlyph, {}),
40301
+ /* @__PURE__ */ jsx128("span", { "aria-hidden": "true", className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-primary" })
40224
40302
  ] }) }),
40225
- /* @__PURE__ */ jsxs120(DropdownMenuContent9, { align: "start", className: "w-60", "data-view-look-menu-content": "", children: [
40226
- lookSavable ? /* @__PURE__ */ jsx127(DropdownMenuItem7, { onSelect: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
40227
- rights.write ? /* @__PURE__ */ jsx127(DropdownMenuItem7, { onSelect: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
40228
- /* @__PURE__ */ jsx127(DropdownMenuItem7, { onSelect: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
40303
+ /* @__PURE__ */ jsxs121(DropdownMenuContent9, { align: "start", className: "w-60", "data-view-look-menu-content": "", children: [
40304
+ lookSavable ? /* @__PURE__ */ jsx128(DropdownMenuItem7, { onSelect: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
40305
+ rights.write ? /* @__PURE__ */ jsx128(DropdownMenuItem7, { onSelect: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
40306
+ /* @__PURE__ */ jsx128(DropdownMenuItem7, { onSelect: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
40229
40307
  ] })
40230
40308
  ] })
40231
40309
  ] }) : !lookShowing && main === "records" && view && !phone && !controlsInSheet ? (
40232
40310
  /* The reserved place keeps its full width at every row width (STABLE-TABLES): when it
40233
40311
  shrank on a narrow row, the look arriving on a sort pushed every control after it.
40234
40312
  A row too narrow for it scrolls sideways, as the row already does. */
40235
- /* @__PURE__ */ jsxs120("span", { "aria-hidden": "true", className: "invisible flex shrink-0 items-center gap-1 overflow-hidden", "data-view-look-place": "", "data-toolbar-fit-gives": "", children: [
40236
- /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1, children: /* @__PURE__ */ jsx127(LookGlyph, {}) }),
40237
- /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1 })
40313
+ /* @__PURE__ */ jsxs121("span", { "aria-hidden": "true", className: "invisible flex shrink-0 items-center gap-1 overflow-hidden", "data-view-look-place": "", "data-toolbar-fit-gives": "", children: [
40314
+ /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1, children: /* @__PURE__ */ jsx128(LookGlyph, {}) }),
40315
+ /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1 })
40238
40316
  ] })
40239
- ) : lookShowing && main === "records" ? /* @__PURE__ */ jsxs120("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-toolbar-fit": "look", title: LOOK_WORDS.yours, children: [
40240
- /* @__PURE__ */ jsx127("span", { className: "sr-only", children: LOOK_WORDS.yours }),
40241
- /* @__PURE__ */ jsx127("span", { "aria-hidden": "true", className: "h-1.5 w-1.5 shrink-0 rounded-full bg-primary" }),
40242
- lookSavable ? /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "outline", className: "h-8 px-2 text-xs", onClick: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
40243
- rights.write ? namingLook ? /* @__PURE__ */ jsxs120(
40317
+ ) : lookShowing && main === "records" ? /* @__PURE__ */ jsxs121("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-toolbar-fit": "look", title: LOOK_WORDS.yours, children: [
40318
+ /* @__PURE__ */ jsx128("span", { className: "sr-only", children: LOOK_WORDS.yours }),
40319
+ /* @__PURE__ */ jsx128("span", { "aria-hidden": "true", className: "h-1.5 w-1.5 shrink-0 rounded-full bg-primary" }),
40320
+ lookSavable ? /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "outline", className: "h-8 px-2 text-xs", onClick: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
40321
+ rights.write ? namingLook ? /* @__PURE__ */ jsxs121(
40244
40322
  "form",
40245
40323
  {
40246
40324
  className: "flex items-center gap-1",
@@ -40249,7 +40327,7 @@ function TablePage({
40249
40327
  void saveLookAsNewView(lookName);
40250
40328
  },
40251
40329
  children: [
40252
- /* @__PURE__ */ jsx127(
40330
+ /* @__PURE__ */ jsx128(
40253
40331
  Input11,
40254
40332
  {
40255
40333
  autoFocus: true,
@@ -40260,13 +40338,13 @@ function TablePage({
40260
40338
  placeholder: "View name"
40261
40339
  }
40262
40340
  ),
40263
- /* @__PURE__ */ jsx127(Button97, { size: "sm", type: "submit", className: "h-8 px-2 text-xs", disabled: lookName.trim() === "", children: "Save" })
40341
+ /* @__PURE__ */ jsx128(Button97, { size: "sm", type: "submit", className: "h-8 px-2 text-xs", disabled: lookName.trim() === "", children: "Save" })
40264
40342
  ]
40265
40343
  }
40266
- ) : /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
40267
- /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
40344
+ ) : /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
40345
+ /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
40268
40346
  ] }) : null,
40269
- /* @__PURE__ */ jsx127(
40347
+ /* @__PURE__ */ jsx128(
40270
40348
  "div",
40271
40349
  {
40272
40350
  ref: setToolbarSlot,
@@ -40288,8 +40366,9 @@ function TablePage({
40288
40366
  "data-clipped": slotClipped
40289
40367
  }
40290
40368
  ),
40291
- rights.write && view && main === "records" && shownLayout !== "grid" ? /* @__PURE__ */ jsx127(Button97, { size: "sm", className: "shrink-0", onClick: () => show("new-record"), children: "New record" }) : null,
40292
- openedFromMenu ? /* @__PURE__ */ jsx127(
40369
+ /* @__PURE__ */ jsx128(TablePresence, { tableId }),
40370
+ rights.write && view && main === "records" && shownLayout !== "grid" ? /* @__PURE__ */ jsx128(Button97, { size: "sm", className: "shrink-0", onClick: () => show("new-record"), children: "New record" }) : null,
40371
+ openedFromMenu ? /* @__PURE__ */ jsx128(
40293
40372
  Button97,
40294
40373
  {
40295
40374
  size: "sm",
@@ -40302,18 +40381,18 @@ function TablePage({
40302
40381
  children: openedFromMenu.label
40303
40382
  }
40304
40383
  ) : null,
40305
- header ? null : /* @__PURE__ */ jsx127("span", { className: "flex shrink-0 items-center gap-1", "data-table-page-actions": "", children: pageActions })
40384
+ header ? null : /* @__PURE__ */ jsx128("span", { className: "flex shrink-0 items-center gap-1", "data-table-page-actions": "", children: pageActions })
40306
40385
  ]
40307
40386
  }
40308
40387
  ),
40309
- designateRefused ? /* @__PURE__ */ jsx127(RefusalNotice, { error: designateRefused }) : null,
40310
- viewSaveRefused ? /* @__PURE__ */ jsx127(
40388
+ designateRefused ? /* @__PURE__ */ jsx128(RefusalNotice, { error: designateRefused }) : null,
40389
+ viewSaveRefused ? /* @__PURE__ */ jsx128(
40311
40390
  RefusalNotice,
40312
40391
  {
40313
40392
  error: viewSaveRefused.error,
40314
- actions: /* @__PURE__ */ jsxs120("span", { className: "flex flex-wrap gap-1 pt-0.5", "data-view-save-refused": "", children: [
40315
- /* @__PURE__ */ jsx127(Button97, { size: "sm", variant: "outline", onClick: () => void patchView(viewSaveRefused.patch), children: "Try again" }),
40316
- /* @__PURE__ */ jsx127(
40393
+ actions: /* @__PURE__ */ jsxs121("span", { className: "flex flex-wrap gap-1 pt-0.5", "data-view-save-refused": "", children: [
40394
+ /* @__PURE__ */ jsx128(Button97, { size: "sm", variant: "outline", onClick: () => void patchView(viewSaveRefused.patch), children: "Try again" }),
40395
+ /* @__PURE__ */ jsx128(
40317
40396
  Button97,
40318
40397
  {
40319
40398
  size: "sm",
@@ -40334,8 +40413,8 @@ function TablePage({
40334
40413
  ] })
40335
40414
  }
40336
40415
  ) : null,
40337
- lookRefused ? /* @__PURE__ */ jsx127(RefusalNotice, { error: lookRefused }) : null,
40338
- main === "dashboards" ? /* @__PURE__ */ jsx127(DashboardCanvas, { tableId, activeDashboardId: activeDashboardId ?? null }) : main === "form" ? /* @__PURE__ */ jsx127("div", { className: "min-h-0 flex-1 overflow-y-auto", "data-table-form-view": "", children: /* @__PURE__ */ jsx127(FormsPanel, { tableId, activeFormId: formFromLink && activeItemId && isUuidShape3(activeItemId) ? activeItemId : null, asView: true }) }) : main === "questions" ? /* @__PURE__ */ jsx127(
40416
+ lookRefused ? /* @__PURE__ */ jsx128(RefusalNotice, { error: lookRefused }) : null,
40417
+ main === "dashboards" ? /* @__PURE__ */ jsx128(DashboardCanvas, { tableId, activeDashboardId: activeDashboardId ?? null }) : main === "form" ? /* @__PURE__ */ jsx128("div", { className: "min-h-0 flex-1 overflow-y-auto", "data-table-form-view": "", children: /* @__PURE__ */ jsx128(FormsPanel, { tableId, activeFormId: formFromLink && activeItemId && isUuidShape3(activeItemId) ? activeItemId : null, asView: true }) }) : main === "questions" ? /* @__PURE__ */ jsx128(
40339
40418
  QuestionPanel,
40340
40419
  {
40341
40420
  tableId,
@@ -40347,7 +40426,7 @@ function TablePage({
40347
40426
  page returns to the records rather than leaving the person looking
40348
40427
  at a list the record is no longer in — and opens it, because the
40349
40428
  thing they just rescued is the thing they came for. */
40350
- /* @__PURE__ */ jsx127(
40429
+ /* @__PURE__ */ jsx128(
40351
40430
  ArchivedView,
40352
40431
  {
40353
40432
  tableId,
@@ -40359,7 +40438,7 @@ function TablePage({
40359
40438
  }
40360
40439
  }
40361
40440
  )
40362
- ) : /* @__PURE__ */ jsx127(TableToolbarSlotContext.Provider, { value: toolbarSlot, children: /* @__PURE__ */ jsx127(TableToolbarFoldContext.Provider, { value: toolbarFold2, children: /* @__PURE__ */ jsx127(TableToolbarSheetExtrasContext.Provider, { value: sheetExtras, children: /* @__PURE__ */ jsxs120(
40441
+ ) : /* @__PURE__ */ jsx128(TableToolbarSlotContext.Provider, { value: toolbarSlot, children: /* @__PURE__ */ jsx128(TableToolbarFoldContext.Provider, { value: toolbarFold2, children: /* @__PURE__ */ jsx128(TableToolbarSheetExtrasContext.Provider, { value: sheetExtras, children: /* @__PURE__ */ jsxs121(
40363
40442
  "div",
40364
40443
  {
40365
40444
  className: cn71(
@@ -40370,10 +40449,10 @@ function TablePage({
40370
40449
  ),
40371
40450
  "data-table-records": "",
40372
40451
  children: [
40373
- railUnknown ? /* @__PURE__ */ jsx127("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: unknownRailLine(railUnknown) }) : null,
40374
- shareFromLink && rights.known && (!rights.share || !canShare) ? /* @__PURE__ */ jsx127("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: canShare ? SHARE_NOT_YOURS_LINE : shareUnavailableReason() }) : null,
40375
- opened.unknown ? /* @__PURE__ */ jsx127("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: unknownViewLine(opened.unknown) }) : null,
40376
- viewLinkMissed ? /* @__PURE__ */ jsx127(
40452
+ railUnknown ? /* @__PURE__ */ jsx128("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: unknownRailLine(railUnknown) }) : null,
40453
+ shareFromLink && rights.known && (!rights.share || !canShare) ? /* @__PURE__ */ jsx128("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: canShare ? SHARE_NOT_YOURS_LINE : shareUnavailableReason() }) : null,
40454
+ opened.unknown ? /* @__PURE__ */ jsx128("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: unknownViewLine(opened.unknown) }) : null,
40455
+ viewLinkMissed ? /* @__PURE__ */ jsx128(
40377
40456
  "p",
40378
40457
  {
40379
40458
  "data-records-view-link-missed": "",
@@ -40381,7 +40460,7 @@ function TablePage({
40381
40460
  children: unknownSavedViewLine(view?.name ?? null)
40382
40461
  }
40383
40462
  ) : null,
40384
- cameFrom ? /* @__PURE__ */ jsx127(
40463
+ cameFrom ? /* @__PURE__ */ jsx128(
40385
40464
  "p",
40386
40465
  {
40387
40466
  "data-testid": "came-from-a-number",
@@ -40391,7 +40470,7 @@ function TablePage({
40391
40470
  ) : null,
40392
40471
  faceUnknown ? (
40393
40472
  /* REVIEW-FIX 10: a full page paints the rows this table showed last time (else fills). */
40394
- /* @__PURE__ */ jsx127(
40473
+ /* @__PURE__ */ jsx128(
40395
40474
  RecordsSkeleton,
40396
40475
  {
40397
40476
  layout: skeletonFace,
@@ -40399,7 +40478,7 @@ function TablePage({
40399
40478
  ...embedded ? {} : { rows: rememberedRowCount(`${tableId}:page:last`, 100, "fill") }
40400
40479
  }
40401
40480
  )
40402
- ) : /* @__PURE__ */ jsx127(
40481
+ ) : /* @__PURE__ */ jsx128(
40403
40482
  ViewSwitcher,
40404
40483
  {
40405
40484
  chooser: false,
@@ -40448,13 +40527,13 @@ function TablePage({
40448
40527
  }
40449
40528
  }
40450
40529
  ),
40451
- view || faceUnknown || views === void 0 || views !== null && views.length > 0 ? null : /* @__PURE__ */ jsx127("p", { className: "text-xs text-muted-foreground", children: VIEW_NOT_SAVED_YET })
40530
+ view || faceUnknown || views === void 0 || views !== null && views.length > 0 ? null : /* @__PURE__ */ jsx128("p", { className: "text-xs text-muted-foreground", children: VIEW_NOT_SAVED_YET })
40452
40531
  ]
40453
40532
  }
40454
40533
  ) }) }) })
40455
40534
  ] }) }),
40456
- rail === "none" ? null : /* @__PURE__ */ jsxs120(RailFrame, { phone, title: RAIL_TITLE[rail], onClose: () => setRail("none"), over: rail === "record" && (recordExpanded || recordFull), full: rail === "record" && recordFull, children: [
40457
- rail === "settings" ? /* @__PURE__ */ jsx127(
40535
+ rail === "none" ? null : /* @__PURE__ */ jsxs121(RailFrame, { phone, title: RAIL_TITLE[rail], onClose: () => setRail("none"), over: rail === "record" && (recordExpanded || recordFull), full: rail === "record" && recordFull, children: [
40536
+ rail === "settings" ? /* @__PURE__ */ jsx128(
40458
40537
  TableSettings,
40459
40538
  {
40460
40539
  tableId,
@@ -40471,7 +40550,7 @@ function TablePage({
40471
40550
  } : void 0
40472
40551
  }
40473
40552
  ) : null,
40474
- rail === "inbox" ? /* @__PURE__ */ jsx127(
40553
+ rail === "inbox" ? /* @__PURE__ */ jsx128(
40475
40554
  ActionInbox,
40476
40555
  {
40477
40556
  tableId,
@@ -40481,9 +40560,9 @@ function TablePage({
40481
40560
  }
40482
40561
  }
40483
40562
  ) : null,
40484
- rail === "forms" ? /* @__PURE__ */ jsx127(FormsPanel, { tableId, activeFormId: itemFor("forms") }) : null,
40485
- rail === "bookings" ? /* @__PURE__ */ jsx127(BookingSlots, { tableId, activeBookingId: itemFor("bookings") }) : null,
40486
- rail === "checklists" ? /* @__PURE__ */ jsx127(
40563
+ rail === "forms" ? /* @__PURE__ */ jsx128(FormsPanel, { tableId, activeFormId: itemFor("forms") }) : null,
40564
+ rail === "bookings" ? /* @__PURE__ */ jsx128(BookingSlots, { tableId, activeBookingId: itemFor("bookings") }) : null,
40565
+ rail === "checklists" ? /* @__PURE__ */ jsx128(
40487
40566
  ChecklistsPanel,
40488
40567
  {
40489
40568
  tableId,
@@ -40493,12 +40572,12 @@ function TablePage({
40493
40572
  }
40494
40573
  }
40495
40574
  ) : null,
40496
- rail === "notifications" ? /* @__PURE__ */ jsx127(SubscriptionsPanel, { tableId, activeRuleId: itemFor("notifications") }) : null,
40497
- rail === "portals" ? /* @__PURE__ */ jsx127(PortalsPanel, { tableId, activePortalId: itemFor("portals") }) : null,
40498
- rail === "export" ? /* @__PURE__ */ jsx127(ExportMenu, { tableId, view: viewReading }) : null,
40499
- rail === "import" ? /* @__PURE__ */ jsx127(ImportWizard, { tableId, onWrote: () => setImportEpoch((n) => n + 1), onDone: () => setRail("none") }) : null,
40500
- rail === "field" ? /* @__PURE__ */ jsx127(FieldEditor, { tableId, onSaved: () => setRail("none"), onCancel: () => setRail("none") }) : null,
40501
- rail === "new-record" ? /* @__PURE__ */ jsx127(
40575
+ rail === "notifications" ? /* @__PURE__ */ jsx128(SubscriptionsPanel, { tableId, activeRuleId: itemFor("notifications") }) : null,
40576
+ rail === "portals" ? /* @__PURE__ */ jsx128(PortalsPanel, { tableId, activePortalId: itemFor("portals") }) : null,
40577
+ rail === "export" ? /* @__PURE__ */ jsx128(ExportMenu, { tableId, view: viewReading }) : null,
40578
+ rail === "import" ? /* @__PURE__ */ jsx128(ImportWizard, { tableId, onWrote: () => setImportEpoch((n) => n + 1), onDone: () => setRail("none") }) : null,
40579
+ rail === "field" ? /* @__PURE__ */ jsx128(FieldEditor, { tableId, onSaved: () => setRail("none"), onCancel: () => setRail("none") }) : null,
40580
+ rail === "new-record" ? /* @__PURE__ */ jsx128(
40502
40581
  RecordForm,
40503
40582
  {
40504
40583
  tableId,
@@ -40509,7 +40588,7 @@ function TablePage({
40509
40588
  onCancel: () => setRail("none")
40510
40589
  }
40511
40590
  ) : null,
40512
- rail === "who-changed" && asking ? /* @__PURE__ */ jsx127(
40591
+ rail === "who-changed" && asking ? /* @__PURE__ */ jsx128(
40513
40592
  FieldHistoryPanel,
40514
40593
  {
40515
40594
  tableId,
@@ -40522,7 +40601,7 @@ function TablePage({
40522
40601
  }
40523
40602
  }
40524
40603
  ) : null,
40525
- rail === "record" && openRecord ? /* @__PURE__ */ jsx127(
40604
+ rail === "record" && openRecord ? /* @__PURE__ */ jsx128(
40526
40605
  RecordPanel,
40527
40606
  {
40528
40607
  tableId,
@@ -40542,15 +40621,15 @@ function TablePage({
40542
40621
  ) : null
40543
40622
  ] })
40544
40623
  ] }),
40545
- embedded ? null : /* @__PURE__ */ jsx127(GridShortcutsHelp, {})
40624
+ embedded ? null : /* @__PURE__ */ jsx128(GridShortcutsHelp, {})
40546
40625
  ] });
40547
40626
  }
40548
40627
  var PUBLIC_READ_ONLY = "Public \xB7 read only";
40549
40628
  function usePublicReadOnly(client, organizationId, tableId, table, rights) {
40550
40629
  const readOnly = rights.known && rights.read && !rights.write;
40551
40630
  const marked = table?.published_to_web;
40552
- const [isPublic, setIsPublic] = useState116(false);
40553
- useEffect101(() => {
40631
+ const [isPublic, setIsPublic] = useState117(false);
40632
+ useEffect102(() => {
40554
40633
  if (!readOnly || !table) {
40555
40634
  setIsPublic(false);
40556
40635
  return;
@@ -40576,10 +40655,10 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
40576
40655
  import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
40577
40656
  import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
40578
40657
  import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
40579
- import { useEffect as useEffect102, useMemo as useMemo71, useRef as useRef50, useState as useState117 } from "react";
40658
+ import { useEffect as useEffect103, useMemo as useMemo72, useRef as useRef51, useState as useState118 } from "react";
40580
40659
  import { Button as Button98, ErrorBox as ErrorBox5, Input as Input12, cn as cn72 } from "@ai-matrx/design-system";
40581
40660
  import { SEED_FRESH_MS, useRecordsClient as useRecordsClient91, useSeededAnswerAt } from "@ai-matrx/records/react";
40582
- import { Fragment as Fragment57, jsx as jsx128, jsxs as jsxs121 } from "react/jsx-runtime";
40661
+ import { Fragment as Fragment57, jsx as jsx129, jsxs as jsxs122 } from "react/jsx-runtime";
40583
40662
  var entityTitleColumn = entityNameColumn;
40584
40663
  function shown3(v) {
40585
40664
  if (v === null || v === void 0 || v === "") return "";
@@ -40589,15 +40668,15 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
40589
40668
  const choiceColumns = entityChoiceColumns(entity.columns);
40590
40669
  const column = (groupBy ? choiceColumns.find((c) => c.key === groupBy) : void 0) ?? choiceColumns[0] ?? null;
40591
40670
  const title = entityTitleColumn(entity.columns);
40592
- const extra = useMemo71(
40671
+ const extra = useMemo72(
40593
40672
  () => cardFields ? entity.columns.filter((c) => cardFields.includes(c.key)) : entity.columns.filter((c) => c !== title && c !== column && c.type !== "choice").slice(0, 2),
40594
40673
  [cardFields, entity.columns, title, column]
40595
40674
  );
40596
- const [refused, setRefused] = useState117(null);
40597
- const [over, setOver] = useState117(null);
40598
- if (entity.error) return /* @__PURE__ */ jsx128("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This board could not be read: ${entity.error}` });
40675
+ const [refused, setRefused] = useState118(null);
40676
+ const [over, setOver] = useState118(null);
40677
+ if (entity.error) return /* @__PURE__ */ jsx129("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This board could not be read: ${entity.error}` });
40599
40678
  if (!entity.loading && !column) {
40600
- return /* @__PURE__ */ jsx128("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `${entity.label ?? "This table"} has no choice column to make a board of.` });
40679
+ return /* @__PURE__ */ jsx129("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `${entity.label ?? "This table"} has no choice column to make a board of.` });
40601
40680
  }
40602
40681
  if (!column) return null;
40603
40682
  const words2 = column.choices ?? [];
@@ -40615,10 +40694,10 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
40615
40694
  const says = await entity.update(id, column, to);
40616
40695
  if (says) setRefused({ to, says });
40617
40696
  };
40618
- return /* @__PURE__ */ jsx128("div", { className: cn72("flex min-h-40 gap-2 overflow-x-auto pb-1", className), "data-records-entity-board": column.key, children: lanes.map((lane) => {
40697
+ return /* @__PURE__ */ jsx129("div", { className: cn72("flex min-h-40 gap-2 overflow-x-auto pb-1", className), "data-records-entity-board": column.key, children: lanes.map((lane) => {
40619
40698
  const cards = rowsOf(lane.key);
40620
40699
  if (lane.key === "" && cards.length === 0) return null;
40621
- return /* @__PURE__ */ jsxs121(
40700
+ return /* @__PURE__ */ jsxs122(
40622
40701
  "section",
40623
40702
  {
40624
40703
  "aria-label": lane.label,
@@ -40630,12 +40709,12 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
40630
40709
  onDragLeave: writable && lane.key ? () => setOver((o) => o === lane.key ? null : o) : void 0,
40631
40710
  onDrop: writable && lane.key ? (e) => void drop(e, lane.key) : void 0,
40632
40711
  children: [
40633
- /* @__PURE__ */ jsxs121("header", { className: "flex items-baseline gap-1.5 px-1 text-xs", children: [
40634
- /* @__PURE__ */ jsx128("span", { className: "truncate font-medium", children: lane.label }),
40635
- /* @__PURE__ */ jsx128("span", { className: "tabular-nums text-muted-foreground", children: cards.length })
40712
+ /* @__PURE__ */ jsxs122("header", { className: "flex items-baseline gap-1.5 px-1 text-xs", children: [
40713
+ /* @__PURE__ */ jsx129("span", { className: "truncate font-medium", children: lane.label }),
40714
+ /* @__PURE__ */ jsx129("span", { className: "tabular-nums text-muted-foreground", children: cards.length })
40636
40715
  ] }),
40637
- refused && refused.to === lane.key ? /* @__PURE__ */ jsx128(ErrorBox5, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: refused.says, operation: "Move a card", origin: "records-ui/entityViews" }) : null,
40638
- cards.map((row) => /* @__PURE__ */ jsxs121(
40716
+ refused && refused.to === lane.key ? /* @__PURE__ */ jsx129(ErrorBox5, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: refused.says, operation: "Move a card", origin: "records-ui/entityViews" }) : null,
40717
+ cards.map((row) => /* @__PURE__ */ jsxs122(
40639
40718
  "article",
40640
40719
  {
40641
40720
  draggable: writable,
@@ -40646,8 +40725,8 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
40646
40725
  className: cn72("flex flex-col gap-0.5 rounded border bg-card px-2 py-1.5 text-xs shadow-sm", writable && "cursor-grab"),
40647
40726
  "data-records-entity-card": row._id,
40648
40727
  children: [
40649
- onOpenRecord ? /* @__PURE__ */ jsx128("button", { type: "button", className: "truncate text-left font-medium hover:underline", onClick: () => onOpenRecord(row._id), children: (title ? entityValueText(title, entityCellValue(row, title)) : shown3(row._id)) || "Untitled" }) : /* @__PURE__ */ jsx128("span", { className: "truncate font-medium", children: (title ? entityValueText(title, entityCellValue(row, title)) : shown3(row._id)) || "Untitled" }),
40650
- extra.map((c) => entityValueText(c, entityCellValue(row, c)) ? /* @__PURE__ */ jsx128("span", { className: "truncate text-muted-foreground", children: entityValueText(c, entityCellValue(row, c)) }, c.key) : null)
40728
+ onOpenRecord ? /* @__PURE__ */ jsx129("button", { type: "button", className: "truncate text-left font-medium hover:underline", onClick: () => onOpenRecord(row._id), children: (title ? entityValueText(title, entityCellValue(row, title)) : shown3(row._id)) || "Untitled" }) : /* @__PURE__ */ jsx129("span", { className: "truncate font-medium", children: (title ? entityValueText(title, entityCellValue(row, title)) : shown3(row._id)) || "Untitled" }),
40729
+ extra.map((c) => entityValueText(c, entityCellValue(row, c)) ? /* @__PURE__ */ jsx129("span", { className: "truncate text-muted-foreground", children: entityValueText(c, entityCellValue(row, c)) }, c.key) : null)
40651
40730
  ]
40652
40731
  },
40653
40732
  row._id
@@ -40682,9 +40761,9 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
40682
40761
  const measures = [m.op === "count" ? { op: "count" } : { op: m.op, key: m.of }];
40683
40762
  const base = { title: title ?? "", kind: kind2, measures, group_by: by ? [by] : [] };
40684
40763
  const seeded = useSeededAnswerAt(`entity-chart:${ask2}`, (c) => c.drillAsk({ source, question }));
40685
- const [block, setBlock] = useState117(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base, by) : null);
40686
- const seededFor = useRef50(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
40687
- useEffect102(() => {
40764
+ const [block, setBlock] = useState118(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base, by) : null);
40765
+ const seededFor = useRef51(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
40766
+ useEffect103(() => {
40688
40767
  const held = seededFor.current;
40689
40768
  if (held && held.ask === `${ask2}|${kind2}|${title ?? ""}` && Date.now() - held.at < SEED_FRESH_MS) return;
40690
40769
  seededFor.current = null;
@@ -40698,9 +40777,9 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
40698
40777
  };
40699
40778
  }, [client, ask2, kind2, title]);
40700
40779
  if (!block) {
40701
- return /* @__PURE__ */ jsx128(RecordsSkeleton, { layout: "chart", embedded: variant === "bare", ...className ? { className } : {} });
40780
+ return /* @__PURE__ */ jsx129(RecordsSkeleton, { layout: "chart", embedded: variant === "bare", ...className ? { className } : {} });
40702
40781
  }
40703
- return /* @__PURE__ */ jsx128(
40782
+ return /* @__PURE__ */ jsx129(
40704
40783
  ChartBlock,
40705
40784
  {
40706
40785
  block,
@@ -40713,7 +40792,7 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
40713
40792
  );
40714
40793
  }
40715
40794
  function EntityTablePage(props) {
40716
- return /* @__PURE__ */ jsx128(EntityDataScope, { children: /* @__PURE__ */ jsx128(EntityTablePageBody, { ...props }) });
40795
+ return /* @__PURE__ */ jsx129(EntityDataScope, { children: /* @__PURE__ */ jsx129(EntityTablePageBody, { ...props }) });
40717
40796
  }
40718
40797
  function EntityTablePageBody({
40719
40798
  source,
@@ -40729,20 +40808,20 @@ function EntityTablePageBody({
40729
40808
  actions,
40730
40809
  className
40731
40810
  }) {
40732
- const [typed2, setTyped] = useState117("");
40811
+ const [typed2, setTyped] = useState118("");
40733
40812
  const term = searchOverride ?? typed2;
40734
40813
  const entity = useEntityTable(source.token, { pageSize, search: term });
40735
- const [layout, setLayout] = useState117(opened);
40736
- useEffect102(() => setLayout(opened), [opened]);
40814
+ const [layout, setLayout] = useState118(opened);
40815
+ useEffect103(() => setLayout(opened), [opened]);
40737
40816
  const choose = (next) => {
40738
40817
  setLayout(next);
40739
40818
  onLayoutChange?.(next);
40740
40819
  };
40741
40820
  const boardable = entityChoiceColumns(entity.columns).length > 0;
40742
40821
  const nameColumn = entityNameColumn(entity.columns);
40743
- const [naming, setNaming] = useState117(null);
40744
- const [adding, setAdding] = useState117(false);
40745
- const [addRefused, setAddRefused] = useState117(null);
40822
+ const [naming, setNaming] = useState118(null);
40823
+ const [adding, setAdding] = useState118(false);
40824
+ const [addRefused, setAddRefused] = useState118(null);
40746
40825
  const add = async () => {
40747
40826
  const name = (naming ?? "").trim();
40748
40827
  if (!name || !nameColumn || adding) return;
@@ -40754,7 +40833,7 @@ function EntityTablePageBody({
40754
40833
  setNaming(null);
40755
40834
  onOpenRecord?.(made.id);
40756
40835
  };
40757
- const [question, setQuestion] = useState117(() => questionFromGrouping(void 0));
40836
+ const [question, setQuestion] = useState118(() => questionFromGrouping(void 0));
40758
40837
  const { config: drill } = useDrill({
40759
40838
  source,
40760
40839
  question,
@@ -40763,20 +40842,20 @@ function EntityTablePageBody({
40763
40842
  rowNoun: (entity.label ?? "record").toLowerCase(),
40764
40843
  enabled: layout === "grid"
40765
40844
  });
40766
- return /* @__PURE__ */ jsxs121("div", { className: cn72("flex min-w-0 flex-col gap-2", className), "data-records-entity-page": source.token, children: [
40767
- presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ jsxs121("div", { className: "flex min-w-0 items-center gap-2", children: [
40768
- presentation === "page" ? /* @__PURE__ */ jsx128("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
40769
- presentation === "page" ? /* @__PURE__ */ jsx128("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : formatCount8(entity.total) }) : null,
40770
- /* @__PURE__ */ jsxs121("span", { className: "ml-auto flex items-center gap-1", children: [
40771
- boardable ? /* @__PURE__ */ jsxs121(Fragment57, { children: [
40772
- /* @__PURE__ */ jsx128(Button98, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),
40773
- /* @__PURE__ */ jsx128(Button98, { size: "sm", variant: layout === "board" ? "secondary" : "ghost", "aria-pressed": layout === "board", onClick: () => choose("board"), children: "Board" })
40845
+ return /* @__PURE__ */ jsxs122("div", { className: cn72("flex min-w-0 flex-col gap-2", className), "data-records-entity-page": source.token, children: [
40846
+ presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ jsxs122("div", { className: "flex min-w-0 items-center gap-2", children: [
40847
+ presentation === "page" ? /* @__PURE__ */ jsx129("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
40848
+ presentation === "page" ? /* @__PURE__ */ jsx129("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : formatCount8(entity.total) }) : null,
40849
+ /* @__PURE__ */ jsxs122("span", { className: "ml-auto flex items-center gap-1", children: [
40850
+ boardable ? /* @__PURE__ */ jsxs122(Fragment57, { children: [
40851
+ /* @__PURE__ */ jsx129(Button98, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),
40852
+ /* @__PURE__ */ jsx129(Button98, { size: "sm", variant: layout === "board" ? "secondary" : "ghost", "aria-pressed": layout === "board", onClick: () => choose("board"), children: "Board" })
40774
40853
  ] }) : null,
40775
- entity.creatable && naming === null ? /* @__PURE__ */ jsx128(Button98, { size: "sm", variant: "ghost", onClick: () => {
40854
+ entity.creatable && naming === null ? /* @__PURE__ */ jsx129(Button98, { size: "sm", variant: "ghost", onClick: () => {
40776
40855
  setAddRefused(null);
40777
40856
  setNaming("");
40778
40857
  }, children: "New page" }) : null,
40779
- entity.creatable && naming !== null ? /* @__PURE__ */ jsx128(
40858
+ entity.creatable && naming !== null ? /* @__PURE__ */ jsx129(
40780
40859
  Input12,
40781
40860
  {
40782
40861
  autoFocus: true,
@@ -40806,9 +40885,9 @@ function EntityTablePageBody({
40806
40885
  actions
40807
40886
  ] })
40808
40887
  ] }) : null,
40809
- addRefused ? /* @__PURE__ */ jsx128(ErrorBox5, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: addRefused, operation: "Add a row", origin: "records-ui/entityViews" }) : null,
40810
- entity.error ? /* @__PURE__ */ jsx128("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ jsx128(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ jsxs121(Fragment57, { children: [
40811
- presentation === "embedded" && searchBox ? /* @__PURE__ */ jsx128("div", { className: "flex min-w-0 items-center justify-end", "data-records-entity-search": "", children: /* @__PURE__ */ jsx128(TooltipProvider, { children: /* @__PURE__ */ jsx128(
40888
+ addRefused ? /* @__PURE__ */ jsx129(ErrorBox5, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: addRefused, operation: "Add a row", origin: "records-ui/entityViews" }) : null,
40889
+ entity.error ? /* @__PURE__ */ jsx129("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ jsx129(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ jsxs122(Fragment57, { children: [
40890
+ presentation === "embedded" && searchBox ? /* @__PURE__ */ jsx129("div", { className: "flex min-w-0 items-center justify-end", "data-records-entity-search": "", children: /* @__PURE__ */ jsx129(TooltipProvider, { children: /* @__PURE__ */ jsx129(
40812
40891
  TapTargetSearchGroup2,
40813
40892
  {
40814
40893
  surface: "solid",
@@ -40820,8 +40899,8 @@ function EntityTablePageBody({
40820
40899
  }
40821
40900
  }
40822
40901
  ) }) }) : null,
40823
- /* @__PURE__ */ jsx128(EntityGrid, { entity, pageSize, embedded: presentation === "embedded", ...drill ? { drill } : {} }),
40824
- entity.hasMore ? /* @__PURE__ */ jsx128(
40902
+ /* @__PURE__ */ jsx129(EntityGrid, { entity, pageSize, embedded: presentation === "embedded", ...drill ? { drill } : {} }),
40903
+ entity.hasMore ? /* @__PURE__ */ jsx129(
40825
40904
  MatrxTableCardShowMore3,
40826
40905
  {
40827
40906
  shown: entity.rows.length,
@@ -40835,12 +40914,12 @@ function EntityTablePageBody({
40835
40914
  }
40836
40915
 
40837
40916
  // src/TablePageSource.tsx
40838
- import { jsx as jsx129 } from "react/jsx-runtime";
40917
+ import { jsx as jsx130 } from "react/jsx-runtime";
40839
40918
  function TablePage2(props) {
40840
- if (props.source === void 0) return /* @__PURE__ */ jsx129(TablePage, { ...props });
40919
+ if (props.source === void 0) return /* @__PURE__ */ jsx130(TablePage, { ...props });
40841
40920
  const { source, layout, onLayoutChange, groupBy, onOpenRecord, ...rest } = props;
40842
- if (source.kind === "table") return /* @__PURE__ */ jsx129(TablePage, { ...rest, tableId: source.id });
40843
- return /* @__PURE__ */ jsx129(
40921
+ if (source.kind === "table") return /* @__PURE__ */ jsx130(TablePage, { ...rest, tableId: source.id });
40922
+ return /* @__PURE__ */ jsx130(
40844
40923
  EntityTablePage,
40845
40924
  {
40846
40925
  source,
@@ -40859,14 +40938,14 @@ function TablePage2(props) {
40859
40938
  }
40860
40939
 
40861
40940
  // src/CalendarLinks.tsx
40862
- import { useCallback as useCallback61, useEffect as useEffect103, useState as useState118 } from "react";
40941
+ import { useCallback as useCallback61, useEffect as useEffect104, useState as useState119 } from "react";
40863
40942
  import { Button as Button99 } from "@ai-matrx/design-system";
40864
- import { jsx as jsx130, jsxs as jsxs122 } from "react/jsx-runtime";
40943
+ import { jsx as jsx131, jsxs as jsxs123 } from "react/jsx-runtime";
40865
40944
  var day = (iso) => iso ? new Date(iso).toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" }) : null;
40866
40945
  function CalendarLinks({ port }) {
40867
- const [rows, setRows] = useState118(null);
40868
- const [error, setError] = useState118(null);
40869
- const [fresh, setFresh] = useState118(null);
40946
+ const [rows, setRows] = useState119(null);
40947
+ const [error, setError] = useState119(null);
40948
+ const [fresh, setFresh] = useState119(null);
40870
40949
  const load = useCallback61(async () => {
40871
40950
  try {
40872
40951
  setRows(await port.list());
@@ -40875,7 +40954,7 @@ function CalendarLinks({ port }) {
40875
40954
  setError(asRefusal3(e, "The links could not be read"));
40876
40955
  }
40877
40956
  }, [port]);
40878
- useEffect103(() => {
40957
+ useEffect104(() => {
40879
40958
  void load();
40880
40959
  }, [load]);
40881
40960
  const act = async (run) => {
@@ -40886,15 +40965,15 @@ function CalendarLinks({ port }) {
40886
40965
  setError(asRefusal3(e, "That didn\u2019t work"));
40887
40966
  }
40888
40967
  };
40889
- if (rows === null && !error) return /* @__PURE__ */ jsx130("p", { className: "text-sm text-muted-foreground", "data-calendar-links-loading": "", children: "Reading your links\u2026" });
40890
- return /* @__PURE__ */ jsxs122("div", { className: "flex flex-col gap-2", "data-calendar-links": "", children: [
40891
- error ? /* @__PURE__ */ jsx130(RefusalNotice, { error }) : null,
40892
- rows && rows.length === 0 ? /* @__PURE__ */ jsx130("p", { className: "text-sm text-muted-foreground", children: "No calendar links yet." }) : null,
40893
- rows?.map((row) => /* @__PURE__ */ jsxs122("div", { className: "flex flex-col gap-2 rounded-md border px-3 py-2", "data-calendar-link-row": row.id, children: [
40894
- /* @__PURE__ */ jsxs122("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
40895
- /* @__PURE__ */ jsxs122("div", { className: "min-w-0", children: [
40896
- /* @__PURE__ */ jsx130("div", { className: "truncate text-sm font-medium", children: row.title }),
40897
- /* @__PURE__ */ jsxs122("div", { className: "text-xs text-muted-foreground", children: [
40968
+ if (rows === null && !error) return /* @__PURE__ */ jsx131("p", { className: "text-sm text-muted-foreground", "data-calendar-links-loading": "", children: "Reading your links\u2026" });
40969
+ return /* @__PURE__ */ jsxs123("div", { className: "flex flex-col gap-2", "data-calendar-links": "", children: [
40970
+ error ? /* @__PURE__ */ jsx131(RefusalNotice, { error }) : null,
40971
+ rows && rows.length === 0 ? /* @__PURE__ */ jsx131("p", { className: "text-sm text-muted-foreground", children: "No calendar links yet." }) : null,
40972
+ rows?.map((row) => /* @__PURE__ */ jsxs123("div", { className: "flex flex-col gap-2 rounded-md border px-3 py-2", "data-calendar-link-row": row.id, children: [
40973
+ /* @__PURE__ */ jsxs123("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
40974
+ /* @__PURE__ */ jsxs123("div", { className: "min-w-0", children: [
40975
+ /* @__PURE__ */ jsx131("div", { className: "truncate text-sm font-medium", children: row.title }),
40976
+ /* @__PURE__ */ jsxs123("div", { className: "text-xs text-muted-foreground", children: [
40898
40977
  "Made ",
40899
40978
  day(row.created_at),
40900
40979
  " \xB7 ",
@@ -40903,8 +40982,8 @@ function CalendarLinks({ port }) {
40903
40982
  row.expired ? "Expired" : row.expires_at ? `Expires ${day(row.expires_at)}` : "Never expires"
40904
40983
  ] })
40905
40984
  ] }),
40906
- /* @__PURE__ */ jsxs122("div", { className: "flex shrink-0 gap-2", children: [
40907
- /* @__PURE__ */ jsx130(
40985
+ /* @__PURE__ */ jsxs123("div", { className: "flex shrink-0 gap-2", children: [
40986
+ /* @__PURE__ */ jsx131(
40908
40987
  Button99,
40909
40988
  {
40910
40989
  size: "sm",
@@ -40918,7 +40997,7 @@ function CalendarLinks({ port }) {
40918
40997
  children: "Rotate"
40919
40998
  }
40920
40999
  ),
40921
- /* @__PURE__ */ jsx130(
41000
+ /* @__PURE__ */ jsx131(
40922
41001
  Button99,
40923
41002
  {
40924
41003
  size: "sm",
@@ -40934,30 +41013,30 @@ function CalendarLinks({ port }) {
40934
41013
  )
40935
41014
  ] })
40936
41015
  ] }),
40937
- fresh?.id === row.id ? /* @__PURE__ */ jsx130(CalendarLinkOnce, { url: fresh.url }) : null
41016
+ fresh?.id === row.id ? /* @__PURE__ */ jsx131(CalendarLinkOnce, { url: fresh.url }) : null
40938
41017
  ] }, row.id))
40939
41018
  ] });
40940
41019
  }
40941
41020
 
40942
41021
  // src/TemplatePreview.tsx
40943
- import { useEffect as useEffect104, useMemo as useMemo72, useState as useState119 } from "react";
41022
+ import { useEffect as useEffect105, useMemo as useMemo73, useState as useState120 } from "react";
40944
41023
  import { templatePreview } from "@ai-matrx/records/memory";
40945
41024
  import { useRecordsClient as useRecordsClient92 } from "@ai-matrx/records/react";
40946
41025
  import { formFromSummary as formFromSummary3 } from "@ai-matrx/records/forms";
40947
- import { jsx as jsx131, jsxs as jsxs123 } from "react/jsx-runtime";
41026
+ import { jsx as jsx132, jsxs as jsxs124 } from "react/jsx-runtime";
40948
41027
  function useTemplatePreview(spec, today) {
40949
- return useMemo72(() => templatePreview(spec, today ? { today } : {}), [spec, today]);
41028
+ return useMemo73(() => templatePreview(spec, today ? { today } : {}), [spec, today]);
40950
41029
  }
40951
41030
  function TemplatePreview({ spec, today, initialTable, host, aside, booking, className }) {
40952
41031
  const preview = useTemplatePreview(spec, today);
40953
- const bound = useMemo72(() => ({ ...host, sayLevelNeeded: false }), [host]);
41032
+ const bound = useMemo73(() => ({ ...host, sayLevelNeeded: false }), [host]);
40954
41033
  const first = preview.tables.find((t) => t.token === initialTable) ?? preview.tables[0];
40955
- const [active, setActive] = useState119(first?.id ?? null);
41034
+ const [active, setActive] = useState120(first?.id ?? null);
40956
41035
  const table = preview.tables.find((t) => t.id === active) ?? first;
40957
41036
  if (!table) return null;
40958
- return /* @__PURE__ */ jsxs123("div", { className: ["flex min-w-0 flex-col gap-3", className].filter(Boolean).join(" "), "data-template-preview": preview.tables.length, children: [
40959
- preview.tables.length > 1 || aside ? /* @__PURE__ */ jsxs123("div", { className: "flex min-w-0 flex-wrap items-center gap-1.5", role: "tablist", "aria-label": "Tables", children: [
40960
- preview.tables.map((t) => /* @__PURE__ */ jsxs123(
41037
+ return /* @__PURE__ */ jsxs124("div", { className: ["flex min-w-0 flex-col gap-3", className].filter(Boolean).join(" "), "data-template-preview": preview.tables.length, children: [
41038
+ preview.tables.length > 1 || aside ? /* @__PURE__ */ jsxs124("div", { className: "flex min-w-0 flex-wrap items-center gap-1.5", role: "tablist", "aria-label": "Tables", children: [
41039
+ preview.tables.map((t) => /* @__PURE__ */ jsxs124(
40961
41040
  "button",
40962
41041
  {
40963
41042
  type: "button",
@@ -40971,28 +41050,28 @@ function TemplatePreview({ spec, today, initialTable, host, aside, booking, clas
40971
41050
  ].join(" "),
40972
41051
  children: [
40973
41052
  t.name,
40974
- /* @__PURE__ */ jsx131("span", { className: "text-xs tabular-nums text-muted-foreground", children: t.rows })
41053
+ /* @__PURE__ */ jsx132("span", { className: "text-xs tabular-nums text-muted-foreground", children: t.rows })
40975
41054
  ]
40976
41055
  },
40977
41056
  t.id
40978
41057
  )),
40979
- aside ? /* @__PURE__ */ jsx131("div", { className: "ml-auto", children: aside }) : null
41058
+ aside ? /* @__PURE__ */ jsx132("div", { className: "ml-auto", children: aside }) : null
40980
41059
  ] }) : null,
40981
- /* @__PURE__ */ jsxs123(RecordsMount, { config: preview.config, host: bound, children: [
40982
- /* @__PURE__ */ jsx131("div", { className: "min-h-[32rem] min-w-0 overflow-hidden rounded-xl border border-border bg-card", children: /* @__PURE__ */ jsx131(TablePage, { tableId: table.id }, table.id) }),
40983
- /* @__PURE__ */ jsx131(PreviewForms, { preview, booking }),
40984
- preview.dashboards.length ? /* @__PURE__ */ jsxs123("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Dashboards", "data-template-preview-dashboards": preview.dashboards.length, children: [
40985
- /* @__PURE__ */ jsx131("h2", { className: "text-lg font-semibold tracking-tight", children: "Dashboards" }),
40986
- preview.dashboards.map((d) => /* @__PURE__ */ jsx131("div", { className: "min-w-0 overflow-hidden rounded-xl border border-border bg-card p-3", "data-template-preview-dashboard": d.token, children: /* @__PURE__ */ jsx131(DashboardCanvas, { tableId: d.tableId, activeDashboardId: d.id }) }, d.id))
41060
+ /* @__PURE__ */ jsxs124(RecordsMount, { config: preview.config, host: bound, children: [
41061
+ /* @__PURE__ */ jsx132("div", { className: "min-h-[32rem] min-w-0 overflow-hidden rounded-xl border border-border bg-card", children: /* @__PURE__ */ jsx132(TablePage, { tableId: table.id }, table.id) }),
41062
+ /* @__PURE__ */ jsx132(PreviewForms, { preview, booking }),
41063
+ preview.dashboards.length ? /* @__PURE__ */ jsxs124("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Dashboards", "data-template-preview-dashboards": preview.dashboards.length, children: [
41064
+ /* @__PURE__ */ jsx132("h2", { className: "text-lg font-semibold tracking-tight", children: "Dashboards" }),
41065
+ preview.dashboards.map((d) => /* @__PURE__ */ jsx132("div", { className: "min-w-0 overflow-hidden rounded-xl border border-border bg-card p-3", "data-template-preview-dashboard": d.token, children: /* @__PURE__ */ jsx132(DashboardCanvas, { tableId: d.tableId, activeDashboardId: d.id }) }, d.id))
40987
41066
  ] }) : null
40988
41067
  ] })
40989
41068
  ] });
40990
41069
  }
40991
41070
  function PreviewForms({ preview, booking }) {
40992
41071
  const client = useRecordsClient92();
40993
- const [forms, setForms] = useState119(null);
40994
- const [pages, setPages] = useState119([]);
40995
- useEffect104(() => {
41072
+ const [forms, setForms] = useState120(null);
41073
+ const [pages, setPages] = useState120([]);
41074
+ useEffect105(() => {
40996
41075
  let gone = false;
40997
41076
  void client.forms().then((answered) => {
40998
41077
  if (!gone) setForms(answered.ok ? answered.data.map(formFromSummary3) : []);
@@ -41011,21 +41090,21 @@ function PreviewForms({ preview, booking }) {
41011
41090
  };
41012
41091
  }, [client, preview, booking]);
41013
41092
  if (!forms?.length && !pages.length) return null;
41014
- return /* @__PURE__ */ jsxs123("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Forms and booking", "data-template-preview-forms": forms?.length ?? 0, children: [
41015
- /* @__PURE__ */ jsx131("h2", { className: "text-lg font-semibold tracking-tight", children: "Forms and booking" }),
41016
- /* @__PURE__ */ jsx131("div", { className: "grid min-w-0 gap-4 md:grid-cols-2", children: (forms ?? []).map((f) => /* @__PURE__ */ jsxs123("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-form": f.slug ?? f.id, children: [
41017
- /* @__PURE__ */ jsx131("h3", { className: "mb-3 text-sm font-semibold", children: f.name }),
41018
- /* @__PURE__ */ jsx131(FormRunner, { form: f, preview: true })
41093
+ return /* @__PURE__ */ jsxs124("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Forms and booking", "data-template-preview-forms": forms?.length ?? 0, children: [
41094
+ /* @__PURE__ */ jsx132("h2", { className: "text-lg font-semibold tracking-tight", children: "Forms and booking" }),
41095
+ /* @__PURE__ */ jsx132("div", { className: "grid min-w-0 gap-4 md:grid-cols-2", children: (forms ?? []).map((f) => /* @__PURE__ */ jsxs124("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-form": f.slug ?? f.id, children: [
41096
+ /* @__PURE__ */ jsx132("h3", { className: "mb-3 text-sm font-semibold", children: f.name }),
41097
+ /* @__PURE__ */ jsx132(FormRunner, { form: f, preview: true })
41019
41098
  ] }, f.id)) }),
41020
- booking ? pages.map((p) => /* @__PURE__ */ jsxs123("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-booking": p.id, children: [
41021
- /* @__PURE__ */ jsx131("h3", { className: "mb-3 text-sm font-semibold", children: String(p.page["title"] ?? "") }),
41099
+ booking ? pages.map((p) => /* @__PURE__ */ jsxs124("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-booking": p.id, children: [
41100
+ /* @__PURE__ */ jsx132("h3", { className: "mb-3 text-sm font-semibold", children: String(p.page["title"] ?? "") }),
41022
41101
  booking(p.page)
41023
41102
  ] }, p.id)) : null
41024
41103
  ] });
41025
41104
  }
41026
41105
 
41027
41106
  // src/SectionCard.tsx
41028
- import { useEffect as useEffect105, useRef as useRef51, useState as useState120 } from "react";
41107
+ import { useEffect as useEffect106, useRef as useRef52, useState as useState121 } from "react";
41029
41108
  import { atLeast } from "@ai-matrx/records/field-kinds";
41030
41109
  import { useFields as useFields35, useRecordMutation as useRecordMutation3, useRecordPage as useRecordPage4, useTable as useTable37 } from "@ai-matrx/records/react";
41031
41110
  import {
@@ -41048,7 +41127,7 @@ import {
41048
41127
  } from "@ai-matrx/design-system";
41049
41128
  import { PlusIcon, StickyNoteIcon } from "@ai-matrx/design-system/icons";
41050
41129
  import { readColorPair } from "@ai-matrx/design-system/field-formats";
41051
- import { jsx as jsx132, jsxs as jsxs124 } from "react/jsx-runtime";
41130
+ import { jsx as jsx133, jsxs as jsxs125 } from "react/jsx-runtime";
41052
41131
  var NAME_KEYS2 = ["name", "title", "token", "label"];
41053
41132
  var GROUP_KEYS = ["group", "set", "section", "category"];
41054
41133
  var NOTE_KEYS = ["usage_note", "note", "notes", "usage"];
@@ -41092,12 +41171,12 @@ function columnsOf(values) {
41092
41171
  }
41093
41172
  var same3 = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
41094
41173
  function useDraft(stored, save) {
41095
- const [draft, setDraft] = useState120(null);
41096
- const latest = useRef51({ draft, save, stored });
41097
- useEffect105(() => {
41174
+ const [draft, setDraft] = useState121(null);
41175
+ const latest = useRef52({ draft, save, stored });
41176
+ useEffect106(() => {
41098
41177
  latest.current = { draft, save, stored };
41099
41178
  });
41100
- useEffect105(() => {
41179
+ useEffect106(() => {
41101
41180
  if (!draft || draft.phase !== "typing") return;
41102
41181
  const timer = setTimeout(() => {
41103
41182
  const sending = draft.value;
@@ -41109,7 +41188,7 @@ function useDraft(stored, save) {
41109
41188
  }, SAVE_AFTER_MS);
41110
41189
  return () => clearTimeout(timer);
41111
41190
  }, [draft]);
41112
- useEffect105(
41191
+ useEffect106(
41113
41192
  () => () => {
41114
41193
  const held = latest.current;
41115
41194
  if (held.draft && held.draft.phase === "typing") void held.save(held.draft.value);
@@ -41121,9 +41200,9 @@ function useDraft(stored, save) {
41121
41200
  }
41122
41201
  function ChecksLine({ checks, onFix }) {
41123
41202
  if (checks.length === 0) return null;
41124
- return /* @__PURE__ */ jsx132("span", { className: "mt-1 flex flex-col items-start gap-1", children: checks.map((check, i) => /* @__PURE__ */ jsxs124("span", { className: "flex flex-col items-start gap-1", children: [
41125
- /* @__PURE__ */ jsx132("span", { className: "text-xs text-warning-ink", children: check.message }),
41126
- check.fix && onFix ? /* @__PURE__ */ jsx132(Button100, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", onClick: () => onFix(check), children: check.fix.label }) : null
41203
+ return /* @__PURE__ */ jsx133("span", { className: "mt-1 flex flex-col items-start gap-1", children: checks.map((check, i) => /* @__PURE__ */ jsxs125("span", { className: "flex flex-col items-start gap-1", children: [
41204
+ /* @__PURE__ */ jsx133("span", { className: "text-xs text-warning-ink", children: check.message }),
41205
+ check.fix && onFix ? /* @__PURE__ */ jsx133(Button100, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", onClick: () => onFix(check), children: check.fix.label }) : null
41127
41206
  ] }, i)) });
41128
41207
  }
41129
41208
  function ValueCell({
@@ -41140,16 +41219,16 @@ function ValueCell({
41140
41219
  const fix = onFix ? (check) => onFix({ check, row, field }) : void 0;
41141
41220
  const id = `section-${row.id}-${field.key}`;
41142
41221
  const withheld = row.hidden?.[field.key] ?? null;
41143
- if (withheld) return /* @__PURE__ */ jsx132(RecordValue, { field, value: null, withheld });
41222
+ if (withheld) return /* @__PURE__ */ jsx133(RecordValue, { field, value: null, withheld });
41144
41223
  if (format?.id === "color_pair") {
41145
41224
  const pair = readColorPair(value) ?? null;
41146
41225
  const contrast = pair ? colorPairContrast(pair, format) : {};
41147
- return /* @__PURE__ */ jsx132("div", { className: "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
41226
+ return /* @__PURE__ */ jsx133("div", { className: "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
41148
41227
  const side = part === "light" ? pair?.light : pair?.dark ?? void 0;
41149
41228
  const ratio = contrast[part];
41150
- return /* @__PURE__ */ jsxs124("div", { className: "min-w-0 px-3", children: [
41151
- /* @__PURE__ */ jsxs124("div", { className: "flex min-w-0 items-center gap-2", children: [
41152
- editable ? /* @__PURE__ */ jsx132(
41229
+ return /* @__PURE__ */ jsxs125("div", { className: "min-w-0 px-3", children: [
41230
+ /* @__PURE__ */ jsxs125("div", { className: "flex min-w-0 items-center gap-2", children: [
41231
+ editable ? /* @__PURE__ */ jsx133(
41153
41232
  ColorWell,
41154
41233
  {
41155
41234
  id: `${id}-${part}`,
@@ -41163,10 +41242,10 @@ function ValueCell({
41163
41242
  change(updated.light ? JSON.stringify(updated) : null);
41164
41243
  }
41165
41244
  }
41166
- ) : /* @__PURE__ */ jsx132("code", { className: "font-mono text-xs uppercase", children: side ?? (part === "dark" ? "Inherits light" : "\u2014") }),
41167
- ratio !== void 0 ? /* @__PURE__ */ jsx132(ContrastMark, { ratio }) : null
41245
+ ) : /* @__PURE__ */ jsx133("code", { className: "font-mono text-xs uppercase", children: side ?? (part === "dark" ? "Inherits light" : "\u2014") }),
41246
+ ratio !== void 0 ? /* @__PURE__ */ jsx133(ContrastMark, { ratio }) : null
41168
41247
  ] }),
41169
- /* @__PURE__ */ jsx132(ChecksLine, { checks: checks.filter((c) => c.part === part), onFix: fix })
41248
+ /* @__PURE__ */ jsx133(ChecksLine, { checks: checks.filter((c) => c.part === part), onFix: fix })
41170
41249
  ] }, part);
41171
41250
  }) });
41172
41251
  }
@@ -41174,21 +41253,21 @@ function ValueCell({
41174
41253
  const pictureFirst = format?.id === "type_style" || format?.id === "shadow";
41175
41254
  if (look && pictureFirst) {
41176
41255
  const { Editor, Preview: Preview2 } = look;
41177
- const view = /* @__PURE__ */ jsx132(RecordValue, { field, value, withheld: null });
41178
- return /* @__PURE__ */ jsxs124("div", { className: "min-w-0", children: [
41179
- editable && Editor ? /* @__PURE__ */ jsxs124(Popover12, { children: [
41180
- /* @__PURE__ */ jsx132(PopoverTrigger12, { asChild: true, children: /* @__PURE__ */ jsx132("button", { type: "button", className: "block w-full min-w-0 rounded-md px-1 py-0.5 text-left hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: value === null || value === void 0 || value === "" ? /* @__PURE__ */ jsx132("span", { className: "text-muted-foreground", children: "Set" }) : view }) }),
41181
- /* @__PURE__ */ jsxs124(PopoverContent12, { align: "start", className: "w-80", children: [
41182
- Preview2 ? /* @__PURE__ */ jsx132("div", { className: "mb-3", children: /* @__PURE__ */ jsx132(Preview2, { value, format }) }) : null,
41183
- Editor ? /* @__PURE__ */ jsx132(Editor, { value, format, onChange: change, id, label: fieldName(field) }) : null
41256
+ const view = /* @__PURE__ */ jsx133(RecordValue, { field, value, withheld: null });
41257
+ return /* @__PURE__ */ jsxs125("div", { className: "min-w-0", children: [
41258
+ editable && Editor ? /* @__PURE__ */ jsxs125(Popover12, { children: [
41259
+ /* @__PURE__ */ jsx133(PopoverTrigger12, { asChild: true, children: /* @__PURE__ */ jsx133("button", { type: "button", className: "block w-full min-w-0 rounded-md px-1 py-0.5 text-left hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: value === null || value === void 0 || value === "" ? /* @__PURE__ */ jsx133("span", { className: "text-muted-foreground", children: "Set" }) : view }) }),
41260
+ /* @__PURE__ */ jsxs125(PopoverContent12, { align: "start", className: "w-80", children: [
41261
+ Preview2 ? /* @__PURE__ */ jsx133("div", { className: "mb-3", children: /* @__PURE__ */ jsx133(Preview2, { value, format }) }) : null,
41262
+ Editor ? /* @__PURE__ */ jsx133(Editor, { value, format, onChange: change, id, label: fieldName(field) }) : null
41184
41263
  ] })
41185
41264
  ] }) : view,
41186
- /* @__PURE__ */ jsx132(ChecksLine, { checks, onFix: fix })
41265
+ /* @__PURE__ */ jsx133(ChecksLine, { checks, onFix: fix })
41187
41266
  ] });
41188
41267
  }
41189
- return /* @__PURE__ */ jsxs124("div", { className: "min-w-0", children: [
41190
- editable ? /* @__PURE__ */ jsx132(FieldControl, { field, value, onChange: change, id, recordId: row.id }) : /* @__PURE__ */ jsx132(RecordValue, { field, value, withheld: null }),
41191
- /* @__PURE__ */ jsx132(ChecksLine, { checks, onFix: fix })
41268
+ return /* @__PURE__ */ jsxs125("div", { className: "min-w-0", children: [
41269
+ editable ? /* @__PURE__ */ jsx133(FieldControl, { field, value, onChange: change, id, recordId: row.id }) : /* @__PURE__ */ jsx133(RecordValue, { field, value, withheld: null }),
41270
+ /* @__PURE__ */ jsx133(ChecksLine, { checks, onFix: fix })
41192
41271
  ] });
41193
41272
  }
41194
41273
  function NoteButton({ row, noteField, editable, save }) {
@@ -41196,8 +41275,8 @@ function NoteButton({ row, noteField, editable, save }) {
41196
41275
  const [value, change] = useDraft(stored, (next) => save(noteField, next));
41197
41276
  const text = typeof value === "string" ? value : "";
41198
41277
  const has = text.trim() !== "";
41199
- return /* @__PURE__ */ jsxs124(Popover12, { children: [
41200
- /* @__PURE__ */ jsx132(PopoverTrigger12, { asChild: true, children: /* @__PURE__ */ jsx132(
41278
+ return /* @__PURE__ */ jsxs125(Popover12, { children: [
41279
+ /* @__PURE__ */ jsx133(PopoverTrigger12, { asChild: true, children: /* @__PURE__ */ jsx133(
41201
41280
  "button",
41202
41281
  {
41203
41282
  type: "button",
@@ -41207,10 +41286,10 @@ function NoteButton({ row, noteField, editable, save }) {
41207
41286
  "inline-flex h-7 w-7 items-center justify-center rounded-md hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
41208
41287
  has ? "text-foreground" : "text-muted-foreground"
41209
41288
  ),
41210
- children: /* @__PURE__ */ jsx132(StickyNoteIcon, { className: "h-4 w-4" })
41289
+ children: /* @__PURE__ */ jsx133(StickyNoteIcon, { className: "h-4 w-4" })
41211
41290
  }
41212
41291
  ) }),
41213
- /* @__PURE__ */ jsx132(PopoverContent12, { align: "end", className: "w-72", children: /* @__PURE__ */ jsx132(
41292
+ /* @__PURE__ */ jsx133(PopoverContent12, { align: "end", className: "w-72", children: /* @__PURE__ */ jsx133(
41214
41293
  BasicTextarea8,
41215
41294
  {
41216
41295
  "aria-label": fieldName(noteField),
@@ -41244,13 +41323,13 @@ function AddDialog({
41244
41323
  }
41245
41324
  return out;
41246
41325
  };
41247
- const [data, setData] = useState120(starters);
41248
- const [name, setName] = useState120("");
41249
- const [group, setGroup] = useState120(startGroup);
41250
- const [newGroup, setNewGroup] = useState120("");
41251
- const [note, setNote] = useState120("");
41252
- const [busy, setBusy] = useState120(false);
41253
- const [seenOpen, setSeenOpen] = useState120(open);
41326
+ const [data, setData] = useState121(starters);
41327
+ const [name, setName] = useState121("");
41328
+ const [group, setGroup] = useState121(startGroup);
41329
+ const [newGroup, setNewGroup] = useState121("");
41330
+ const [note, setNote] = useState121("");
41331
+ const [busy, setBusy] = useState121(false);
41332
+ const [seenOpen, setSeenOpen] = useState121(open);
41254
41333
  if (seenOpen !== open) {
41255
41334
  setSeenOpen(open);
41256
41335
  if (open) {
@@ -41268,12 +41347,12 @@ function AddDialog({
41268
41347
  const ready = !busy && name.trim() !== "" && (!groupField || group !== "__new" || newGroup.trim() !== "");
41269
41348
  const rowCls = "grid grid-cols-[6.5rem_1fr] items-start gap-3";
41270
41349
  const labelCls = "pt-2 text-sm text-muted-foreground";
41271
- return /* @__PURE__ */ jsx132(Dialog21, { open, onOpenChange, children: /* @__PURE__ */ jsxs124(DialogContent21, { className: "max-w-md", children: [
41272
- /* @__PURE__ */ jsx132(DialogHeader21, { children: /* @__PURE__ */ jsxs124(DialogTitle21, { children: [
41350
+ return /* @__PURE__ */ jsx133(Dialog21, { open, onOpenChange, children: /* @__PURE__ */ jsxs125(DialogContent21, { className: "max-w-md", children: [
41351
+ /* @__PURE__ */ jsx133(DialogHeader21, { children: /* @__PURE__ */ jsxs125(DialogTitle21, { children: [
41273
41352
  "New ",
41274
41353
  noun
41275
41354
  ] }) }),
41276
- /* @__PURE__ */ jsxs124(
41355
+ /* @__PURE__ */ jsxs125(
41277
41356
  "form",
41278
41357
  {
41279
41358
  className: "flex flex-col gap-3",
@@ -41289,40 +41368,40 @@ function AddDialog({
41289
41368
  if (ok) onOpenChange(false);
41290
41369
  },
41291
41370
  children: [
41292
- preview ? /* @__PURE__ */ jsx132("div", { children: preview }) : null,
41293
- groupField ? /* @__PURE__ */ jsxs124("div", { className: rowCls, children: [
41294
- /* @__PURE__ */ jsx132("span", { className: labelCls, children: fieldName(groupField) }),
41295
- /* @__PURE__ */ jsxs124("div", { className: "flex flex-col gap-2", children: [
41296
- /* @__PURE__ */ jsxs124(Select20, { value: group === UNGROUPED ? "__none" : group, onValueChange: (v) => setGroup(v === "__none" ? UNGROUPED : v), children: [
41297
- /* @__PURE__ */ jsx132(SelectTrigger13, { "aria-label": fieldName(groupField), children: /* @__PURE__ */ jsx132(SelectValue13, {}) }),
41298
- /* @__PURE__ */ jsxs124(SelectContent13, { children: [
41299
- /* @__PURE__ */ jsx132(SelectItem13, { value: "__none", children: "None" }),
41300
- groups.filter((g) => g !== UNGROUPED).map((g) => /* @__PURE__ */ jsx132(SelectItem13, { value: g, children: g }, g)),
41301
- /* @__PURE__ */ jsxs124(SelectItem13, { value: "__new", children: [
41371
+ preview ? /* @__PURE__ */ jsx133("div", { children: preview }) : null,
41372
+ groupField ? /* @__PURE__ */ jsxs125("div", { className: rowCls, children: [
41373
+ /* @__PURE__ */ jsx133("span", { className: labelCls, children: fieldName(groupField) }),
41374
+ /* @__PURE__ */ jsxs125("div", { className: "flex flex-col gap-2", children: [
41375
+ /* @__PURE__ */ jsxs125(Select20, { value: group === UNGROUPED ? "__none" : group, onValueChange: (v) => setGroup(v === "__none" ? UNGROUPED : v), children: [
41376
+ /* @__PURE__ */ jsx133(SelectTrigger13, { "aria-label": fieldName(groupField), children: /* @__PURE__ */ jsx133(SelectValue13, {}) }),
41377
+ /* @__PURE__ */ jsxs125(SelectContent13, { children: [
41378
+ /* @__PURE__ */ jsx133(SelectItem13, { value: "__none", children: "None" }),
41379
+ groups.filter((g) => g !== UNGROUPED).map((g) => /* @__PURE__ */ jsx133(SelectItem13, { value: g, children: g }, g)),
41380
+ /* @__PURE__ */ jsxs125(SelectItem13, { value: "__new", children: [
41302
41381
  "New ",
41303
41382
  fieldName(groupField).toLowerCase(),
41304
41383
  "\u2026"
41305
41384
  ] })
41306
41385
  ] })
41307
41386
  ] }),
41308
- group === "__new" ? /* @__PURE__ */ jsx132(BasicInput24, { "aria-label": `New ${fieldName(groupField).toLowerCase()} name`, placeholder: "e.g. Display", value: newGroup, onChange: (e) => setNewGroup(e.target.value) }) : null
41387
+ group === "__new" ? /* @__PURE__ */ jsx133(BasicInput24, { "aria-label": `New ${fieldName(groupField).toLowerCase()} name`, placeholder: "e.g. Display", value: newGroup, onChange: (e) => setNewGroup(e.target.value) }) : null
41309
41388
  ] })
41310
41389
  ] }) : null,
41311
- nameField ? /* @__PURE__ */ jsxs124("div", { className: rowCls, children: [
41312
- /* @__PURE__ */ jsx132("label", { htmlFor: "section-add-name", className: labelCls, children: fieldName(nameField) }),
41313
- /* @__PURE__ */ jsx132(BasicInput24, { id: "section-add-name", className: "font-mono", autoFocus: true, value: name, onChange: (e) => setName(e.target.value) })
41390
+ nameField ? /* @__PURE__ */ jsxs125("div", { className: rowCls, children: [
41391
+ /* @__PURE__ */ jsx133("label", { htmlFor: "section-add-name", className: labelCls, children: fieldName(nameField) }),
41392
+ /* @__PURE__ */ jsx133(BasicInput24, { id: "section-add-name", className: "font-mono", autoFocus: true, value: name, onChange: (e) => setName(e.target.value) })
41314
41393
  ] }) : null,
41315
- values.map((field) => /* @__PURE__ */ jsxs124("div", { className: rowCls, children: [
41316
- /* @__PURE__ */ jsx132("label", { htmlFor: `section-add-${field.key}`, className: labelCls, children: fieldName(field) }),
41317
- /* @__PURE__ */ jsx132(FieldControl, { field, value: data[field.key] ?? null, onChange: (v) => setData((d) => ({ ...d, [field.key]: v })), id: `section-add-${field.key}`, asForm: true })
41394
+ values.map((field) => /* @__PURE__ */ jsxs125("div", { className: rowCls, children: [
41395
+ /* @__PURE__ */ jsx133("label", { htmlFor: `section-add-${field.key}`, className: labelCls, children: fieldName(field) }),
41396
+ /* @__PURE__ */ jsx133(FieldControl, { field, value: data[field.key] ?? null, onChange: (v) => setData((d) => ({ ...d, [field.key]: v })), id: `section-add-${field.key}`, asForm: true })
41318
41397
  ] }, field.key)),
41319
- noteField ? /* @__PURE__ */ jsxs124("div", { className: rowCls, children: [
41320
- /* @__PURE__ */ jsx132("label", { htmlFor: "section-add-note", className: labelCls, children: fieldName(noteField) }),
41321
- /* @__PURE__ */ jsx132(BasicTextarea8, { id: "section-add-note", rows: 2, placeholder: name.trim() ? `When should ${name.trim()} be used?` : "When should it be used?", value: note, onChange: (e) => setNote(e.target.value) })
41398
+ noteField ? /* @__PURE__ */ jsxs125("div", { className: rowCls, children: [
41399
+ /* @__PURE__ */ jsx133("label", { htmlFor: "section-add-note", className: labelCls, children: fieldName(noteField) }),
41400
+ /* @__PURE__ */ jsx133(BasicTextarea8, { id: "section-add-note", rows: 2, placeholder: name.trim() ? `When should ${name.trim()} be used?` : "When should it be used?", value: note, onChange: (e) => setNote(e.target.value) })
41322
41401
  ] }) : null,
41323
- /* @__PURE__ */ jsxs124("div", { className: "flex justify-end gap-2 pt-1", children: [
41324
- /* @__PURE__ */ jsx132(Button100, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: "Cancel" }),
41325
- /* @__PURE__ */ jsx132(Button100, { type: "submit", disabled: !ready, children: "Add" })
41402
+ /* @__PURE__ */ jsxs125("div", { className: "flex justify-end gap-2 pt-1", children: [
41403
+ /* @__PURE__ */ jsx133(Button100, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: "Cancel" }),
41404
+ /* @__PURE__ */ jsx133(Button100, { type: "submit", disabled: !ready, children: "Add" })
41326
41405
  ] })
41327
41406
  ]
41328
41407
  }
@@ -41335,8 +41414,8 @@ function SectionCard(props) {
41335
41414
  const fieldsRead = useFields35(tableId);
41336
41415
  const page = useRecordPage4(tableId, { pageSize: 200 });
41337
41416
  const mutation = useRecordMutation3();
41338
- const [adding, setAdding] = useState120(null);
41339
- const [failed, setFailed] = useState120(null);
41417
+ const [adding, setAdding] = useState121(null);
41418
+ const [failed, setFailed] = useState121(null);
41340
41419
  const fields = fieldsRead.data ?? [];
41341
41420
  const cols = sectionColumns(fields, table.data?.title_field, props);
41342
41421
  const nameField = fields.find((f) => f.key === cols.name);
@@ -41357,65 +41436,65 @@ function SectionCard(props) {
41357
41436
  const total = page.data?.total ?? null;
41358
41437
  const refused = table.error ?? fieldsRead.error ?? page.error;
41359
41438
  const gridStyle = { gridTemplateColumns: `minmax(8rem, 12rem) repeat(${Math.max(columns.length, 1)}, minmax(0, 1fr)) 2.5rem` };
41360
- return /* @__PURE__ */ jsxs124("section", { "data-records-section-card": "", className: cn73("rounded-2xl border border-border bg-card text-card-foreground", className), children: [
41361
- /* @__PURE__ */ jsxs124("header", { className: "flex items-start justify-between gap-4 px-6 pt-6 pb-4 sm:px-8 sm:pt-8", children: [
41362
- /* @__PURE__ */ jsxs124("div", { className: "min-w-0", children: [
41363
- /* @__PURE__ */ jsx132("h2", { className: "truncate font-serif text-3xl tracking-tight text-foreground", children: title || "\xA0" }),
41364
- props.description ? /* @__PURE__ */ jsx132("p", { className: "mt-2 max-w-prose text-sm text-muted-foreground", children: props.description }) : null
41439
+ return /* @__PURE__ */ jsxs125("section", { "data-records-section-card": "", className: cn73("rounded-2xl border border-border bg-card text-card-foreground", className), children: [
41440
+ /* @__PURE__ */ jsxs125("header", { className: "flex items-start justify-between gap-4 px-6 pt-6 pb-4 sm:px-8 sm:pt-8", children: [
41441
+ /* @__PURE__ */ jsxs125("div", { className: "min-w-0", children: [
41442
+ /* @__PURE__ */ jsx133("h2", { className: "truncate font-serif text-3xl tracking-tight text-foreground", children: title || "\xA0" }),
41443
+ props.description ? /* @__PURE__ */ jsx133("p", { className: "mt-2 max-w-prose text-sm text-muted-foreground", children: props.description }) : null
41365
41444
  ] }),
41366
- mayWrite && nameField ? /* @__PURE__ */ jsxs124(Button100, { type: "button", variant: "outline", size: "sm", onClick: () => setAdding(groups[groups.length - 1]?.key ?? UNGROUPED), children: [
41367
- /* @__PURE__ */ jsx132(PlusIcon, { className: "h-3.5 w-3.5" }),
41445
+ mayWrite && nameField ? /* @__PURE__ */ jsxs125(Button100, { type: "button", variant: "outline", size: "sm", onClick: () => setAdding(groups[groups.length - 1]?.key ?? UNGROUPED), children: [
41446
+ /* @__PURE__ */ jsx133(PlusIcon, { className: "h-3.5 w-3.5" }),
41368
41447
  "Add"
41369
41448
  ] }) : null
41370
41449
  ] }),
41371
- refused ? /* @__PURE__ */ jsx132("p", { className: "px-6 pb-6 text-sm text-muted-foreground sm:px-8", children: refusalSentence(refused) }) : page.loading && rows.length === 0 ? /* @__PURE__ */ jsx132("div", { className: "flex flex-col gap-2 px-6 pb-6 sm:px-8", "aria-busy": "true", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx132("div", { className: "h-12 rounded-md bg-muted" }, i)) }) : rows.length === 0 ? /* @__PURE__ */ jsx132("p", { className: "px-6 pb-8 text-sm text-muted-foreground sm:px-8", children: "Nothing here yet." }) : /* @__PURE__ */ jsx132("div", { className: "overflow-x-auto pb-4", children: groups.map((group) => /* @__PURE__ */ jsxs124("div", { "data-records-section-group": group.key, className: "mb-6 last:mb-0", children: [
41372
- cols.group ? /* @__PURE__ */ jsxs124("div", { className: "flex items-center justify-between border-b border-border px-6 py-2.5 sm:px-8", children: [
41373
- /* @__PURE__ */ jsx132("span", { className: "text-sm font-medium text-foreground", children: group.key || "No group" }),
41374
- mayWrite ? /* @__PURE__ */ jsx132(
41450
+ refused ? /* @__PURE__ */ jsx133("p", { className: "px-6 pb-6 text-sm text-muted-foreground sm:px-8", children: refusalSentence(refused) }) : page.loading && rows.length === 0 ? /* @__PURE__ */ jsx133("div", { className: "flex flex-col gap-2 px-6 pb-6 sm:px-8", "aria-busy": "true", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx133("div", { className: "h-12 rounded-md bg-muted" }, i)) }) : rows.length === 0 ? /* @__PURE__ */ jsx133("p", { className: "px-6 pb-8 text-sm text-muted-foreground sm:px-8", children: "Nothing here yet." }) : /* @__PURE__ */ jsx133("div", { className: "overflow-x-auto pb-4", children: groups.map((group) => /* @__PURE__ */ jsxs125("div", { "data-records-section-group": group.key, className: "mb-6 last:mb-0", children: [
41451
+ cols.group ? /* @__PURE__ */ jsxs125("div", { className: "flex items-center justify-between border-b border-border px-6 py-2.5 sm:px-8", children: [
41452
+ /* @__PURE__ */ jsx133("span", { className: "text-sm font-medium text-foreground", children: group.key || "No group" }),
41453
+ mayWrite ? /* @__PURE__ */ jsx133(
41375
41454
  "button",
41376
41455
  {
41377
41456
  type: "button",
41378
41457
  "aria-label": `Add to ${group.key || "no group"}`,
41379
41458
  className: "inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
41380
41459
  onClick: () => setAdding(group.key),
41381
- children: /* @__PURE__ */ jsx132(PlusIcon, { className: "h-4 w-4" })
41460
+ children: /* @__PURE__ */ jsx133(PlusIcon, { className: "h-4 w-4" })
41382
41461
  }
41383
41462
  ) : null
41384
41463
  ] }) : null,
41385
- /* @__PURE__ */ jsxs124("div", { role: "table", "aria-label": group.key || title, className: "min-w-[36rem]", children: [
41386
- /* @__PURE__ */ jsxs124("div", { role: "row", style: gridStyle, className: "grid border-b border-border text-sm text-muted-foreground", children: [
41387
- /* @__PURE__ */ jsx132("span", { role: "columnheader", className: "border-r border-border px-6 py-3 sm:px-8", children: nameField ? fieldName(nameField) : "Name" }),
41388
- columns.map((c) => /* @__PURE__ */ jsx132("span", { role: "columnheader", className: "truncate px-3 py-3", children: c.header }, `${c.field.key}-${c.part ?? ""}`)),
41389
- /* @__PURE__ */ jsx132("span", {})
41464
+ /* @__PURE__ */ jsxs125("div", { role: "table", "aria-label": group.key || title, className: "min-w-[36rem]", children: [
41465
+ /* @__PURE__ */ jsxs125("div", { role: "row", style: gridStyle, className: "grid border-b border-border text-sm text-muted-foreground", children: [
41466
+ /* @__PURE__ */ jsx133("span", { role: "columnheader", className: "border-r border-border px-6 py-3 sm:px-8", children: nameField ? fieldName(nameField) : "Name" }),
41467
+ columns.map((c) => /* @__PURE__ */ jsx133("span", { role: "columnheader", className: "truncate px-3 py-3", children: c.header }, `${c.field.key}-${c.part ?? ""}`)),
41468
+ /* @__PURE__ */ jsx133("span", {})
41390
41469
  ] }),
41391
41470
  group.rows.map((row) => {
41392
41471
  const editable = mayWrite && atLeast(row.level, "edit_content");
41393
41472
  const rowSave = save(row);
41394
- return /* @__PURE__ */ jsxs124("div", { role: "row", "data-records-section-row": row.id, style: gridStyle, className: "grid items-center border-b border-border last:border-b-0", children: [
41395
- /* @__PURE__ */ jsx132("span", { role: "cell", className: "truncate self-stretch border-r border-border px-6 py-4 font-mono text-sm text-foreground sm:px-8", children: nameField ? String((row.document ?? {})[nameField.key] ?? "") : row.id }),
41396
- cells.map((c) => /* @__PURE__ */ jsx132(
41473
+ return /* @__PURE__ */ jsxs125("div", { role: "row", "data-records-section-row": row.id, style: gridStyle, className: "grid items-center border-b border-border last:border-b-0", children: [
41474
+ /* @__PURE__ */ jsx133("span", { role: "cell", className: "truncate self-stretch border-r border-border px-6 py-4 font-mono text-sm text-foreground sm:px-8", children: nameField ? String((row.document ?? {})[nameField.key] ?? "") : row.id }),
41475
+ cells.map((c) => /* @__PURE__ */ jsx133(
41397
41476
  "div",
41398
41477
  {
41399
41478
  role: "cell",
41400
41479
  style: c.part ? { gridColumn: "span 2" } : void 0,
41401
41480
  className: cn73("min-w-0 py-2.5", c.part ? "" : "px-3"),
41402
- children: /* @__PURE__ */ jsx132(ValueCell, { row, column: c, editable, save: rowSave, onFix })
41481
+ children: /* @__PURE__ */ jsx133(ValueCell, { row, column: c, editable, save: rowSave, onFix })
41403
41482
  },
41404
41483
  c.field.key
41405
41484
  )),
41406
- /* @__PURE__ */ jsx132("span", { role: "cell", className: "flex justify-center pr-2", children: noteField ? /* @__PURE__ */ jsx132(NoteButton, { row, noteField, editable, save: rowSave }) : null })
41485
+ /* @__PURE__ */ jsx133("span", { role: "cell", className: "flex justify-center pr-2", children: noteField ? /* @__PURE__ */ jsx133(NoteButton, { row, noteField, editable, save: rowSave }) : null })
41407
41486
  ] }, row.id);
41408
41487
  })
41409
41488
  ] })
41410
41489
  ] }, group.key || "__ungrouped")) }),
41411
- total !== null && total > rows.length ? /* @__PURE__ */ jsxs124("p", { className: "px-6 pb-4 text-sm text-muted-foreground sm:px-8", children: [
41490
+ total !== null && total > rows.length ? /* @__PURE__ */ jsxs125("p", { className: "px-6 pb-4 text-sm text-muted-foreground sm:px-8", children: [
41412
41491
  "Showing ",
41413
41492
  rows.length,
41414
41493
  " of ",
41415
41494
  total
41416
41495
  ] }) : null,
41417
- failed ? /* @__PURE__ */ jsx132("p", { className: "px-6 pb-4 text-sm text-warning-ink sm:px-8", children: mutation.error ? refusalSentence(mutation.error) : failed }) : null,
41418
- /* @__PURE__ */ jsx132(
41496
+ failed ? /* @__PURE__ */ jsx133("p", { className: "px-6 pb-4 text-sm text-warning-ink sm:px-8", children: mutation.error ? refusalSentence(mutation.error) : failed }) : null,
41497
+ /* @__PURE__ */ jsx133(
41419
41498
  AddDialog,
41420
41499
  {
41421
41500
  open: adding !== null,
@@ -41732,6 +41811,7 @@ export {
41732
41811
  TablePage2 as TablePage,
41733
41812
  TablePageSkeleton,
41734
41813
  TablePicker,
41814
+ TablePresence,
41735
41815
  TableReferenceDialog,
41736
41816
  TableRenameDialog,
41737
41817
  TableRestoreRefused,
@@ -41973,6 +42053,7 @@ export {
41973
42053
  placedSentence,
41974
42054
  platformOwned,
41975
42055
  pointsAtRecords,
42056
+ presenceOutlineCss,
41976
42057
  presentationDocument,
41977
42058
  presentationIsEmpty,
41978
42059
  previewLine,
@@ -42089,6 +42170,7 @@ export {
42089
42170
  useRowColorBy,
42090
42171
  useRowRights,
42091
42172
  useStructureHidden,
42173
+ useTablePresence,
42092
42174
  useTableRights,
42093
42175
  useTableToolbarSlot,
42094
42176
  useTablesAnywhere,