@ai-matrx/records-ui 0.116.6 → 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.cjs CHANGED
@@ -7907,6 +7907,7 @@ __export(src_exports, {
7907
7907
  TablePage: () => TablePage2,
7908
7908
  TablePageSkeleton: () => TablePageSkeleton,
7909
7909
  TablePicker: () => TablePicker,
7910
+ TablePresence: () => TablePresence,
7910
7911
  TableReferenceDialog: () => TableReferenceDialog,
7911
7912
  TableRenameDialog: () => TableRenameDialog,
7912
7913
  TableRestoreRefused: () => TableRestoreRefused,
@@ -8148,6 +8149,7 @@ __export(src_exports, {
8148
8149
  placedSentence: () => placedSentence,
8149
8150
  platformOwned: () => platformOwned,
8150
8151
  pointsAtRecords: () => pointsAtRecords,
8152
+ presenceOutlineCss: () => presenceOutlineCss,
8151
8153
  presentationDocument: () => presentationDocument,
8152
8154
  presentationIsEmpty: () => presentationIsEmpty,
8153
8155
  previewLine: () => previewLine,
@@ -8264,6 +8266,7 @@ __export(src_exports, {
8264
8266
  useRowColorBy: () => useRowColorBy,
8265
8267
  useRowRights: () => useRowRights,
8266
8268
  useStructureHidden: () => useStructureHidden,
8269
+ useTablePresence: () => useTablePresence,
8267
8270
  useTableRights: () => useTableRights,
8268
8271
  useTableToolbarSlot: () => useTableToolbarSlot,
8269
8272
  useTablesAnywhere: () => useTablesAnywhere,
@@ -57487,9 +57490,9 @@ init_WhereItLives();
57487
57490
 
57488
57491
  // src/TablePage.tsx
57489
57492
  var import_clipboard17 = require("@ai-matrx/kit/clipboard");
57490
- var import_react334 = require("react");
57493
+ var import_react335 = require("react");
57491
57494
  var import_records69 = require("@ai-matrx/records");
57492
- var import_react335 = require("@ai-matrx/records/react");
57495
+ var import_react336 = require("@ai-matrx/records/react");
57493
57496
  var import_design_system169 = require("@ai-matrx/design-system");
57494
57497
  init_names();
57495
57498
  var import_text_case23 = require("@ai-matrx/kit/text-case");
@@ -58300,8 +58303,87 @@ init_WhereItLives();
58300
58303
  init_objectActions();
58301
58304
  init_host();
58302
58305
 
58303
- // src/toolbarFit.ts
58306
+ // src/presence.tsx
58304
58307
  var import_react333 = require("react");
58308
+ init_host();
58309
+ var import_jsx_runtime190 = require("react/jsx-runtime");
58310
+ var NO_PEOPLE = [];
58311
+ var MAX_AVATARS = 4;
58312
+ var SAFE = /^[A-Za-z0-9_.:\-]+$/;
58313
+ function useTablePresence(tableId) {
58314
+ const port = useRecordsUi().presence;
58315
+ const [session, setSession] = (0, import_react333.useState)(null);
58316
+ (0, import_react333.useEffect)(() => {
58317
+ if (!port) {
58318
+ setSession(null);
58319
+ return;
58320
+ }
58321
+ const joined = port.join({ tableId });
58322
+ setSession(joined);
58323
+ return () => {
58324
+ joined.close();
58325
+ setSession(null);
58326
+ };
58327
+ }, [port, tableId]);
58328
+ const people = (0, import_react333.useSyncExternalStore)(
58329
+ (listener) => session ? session.subscribe(listener) : () => void 0,
58330
+ () => session ? session.getSnapshot() : NO_PEOPLE,
58331
+ () => NO_PEOPLE
58332
+ );
58333
+ return { session, people };
58334
+ }
58335
+ function presenceOutlineCss(people) {
58336
+ 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(
58337
+ (p) => `td[data-matrx-cell-row="${p.cell.recordId}"][data-matrx-cell-col="${p.cell.fieldKey}"]{outline:2px solid ${p.color};outline-offset:-2px;}`
58338
+ ).join("\n");
58339
+ }
58340
+ function initials(name) {
58341
+ const parts = name.trim().split(/\s+/).filter(Boolean);
58342
+ return ((parts[0]?.[0] ?? "?") + (parts.length > 1 ? parts[parts.length - 1][0] : "")).toUpperCase();
58343
+ }
58344
+ function TablePresence({ tableId }) {
58345
+ const { session, people } = useTablePresence(tableId);
58346
+ const root = (0, import_react333.useRef)(null);
58347
+ const css = (0, import_react333.useMemo)(() => presenceOutlineCss(people), [people]);
58348
+ (0, import_react333.useEffect)(() => {
58349
+ if (!session || typeof MutationObserver === "undefined") return;
58350
+ const scope = document.body;
58351
+ const read = () => {
58352
+ const td = scope.querySelector("td[data-matrx-cell-active]");
58353
+ const recordId = td?.getAttribute("data-matrx-cell-row");
58354
+ const fieldKey = td?.getAttribute("data-matrx-cell-col");
58355
+ session.selectCell(recordId && fieldKey ? { recordId, fieldKey } : null);
58356
+ };
58357
+ const watch = new MutationObserver(read);
58358
+ watch.observe(scope, { subtree: true, attributes: true, attributeFilter: ["data-matrx-cell-active"] });
58359
+ read();
58360
+ return () => watch.disconnect();
58361
+ }, [session]);
58362
+ if (!session) return null;
58363
+ const shown5 = people.slice(0, MAX_AVATARS);
58364
+ const more = people.length - shown5.length;
58365
+ return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("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: [
58366
+ css ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("style", { "data-table-presence-outlines": "", children: css }) : null,
58367
+ shown5.map((p) => /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
58368
+ "span",
58369
+ {
58370
+ title: p.name,
58371
+ "data-table-presence-person": p.name,
58372
+ 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",
58373
+ style: { borderColor: p.color },
58374
+ children: p.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("img", { src: p.avatarUrl, alt: "", className: "h-full w-full object-cover" }) : initials(p.name)
58375
+ },
58376
+ p.key
58377
+ )),
58378
+ more > 0 ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("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: [
58379
+ "+",
58380
+ more
58381
+ ] }) : null
58382
+ ] });
58383
+ }
58384
+
58385
+ // src/toolbarFit.ts
58386
+ var import_react334 = require("react");
58305
58387
  var import_react_dom3 = require("react-dom");
58306
58388
  function widthAtFold(piece, fold) {
58307
58389
  for (let f = Math.min(fold, (piece.byFold?.length ?? 0) - 1); f >= 0; f -= 1) {
@@ -58393,9 +58475,9 @@ function createFitMemory() {
58393
58475
  }
58394
58476
  };
58395
58477
  }
58396
- var useIsoLayoutEffect = typeof window === "undefined" ? import_react333.useEffect : import_react333.useLayoutEffect;
58478
+ var useIsoLayoutEffect = typeof window === "undefined" ? import_react334.useEffect : import_react334.useLayoutEffect;
58397
58479
  function useToolbarFit(row) {
58398
- const [fold, setFold] = (0, import_react333.useState)(0);
58480
+ const [fold, setFold] = (0, import_react334.useState)(0);
58399
58481
  useIsoLayoutEffect(() => {
58400
58482
  if (!row) return;
58401
58483
  const memory = createFitMemory();
@@ -58471,8 +58553,8 @@ function clippedEnds(scrollLeft, clientWidth, scrollWidth) {
58471
58553
  return start && end ? "both" : start ? "start" : end ? "end" : "none";
58472
58554
  }
58473
58555
  function useSlotScroll(slot) {
58474
- const [ends, setEnds] = (0, import_react333.useState)("none");
58475
- (0, import_react333.useEffect)(() => {
58556
+ const [ends, setEnds] = (0, import_react334.useState)("none");
58557
+ (0, import_react334.useEffect)(() => {
58476
58558
  if (!slot) return;
58477
58559
  let pending = 0;
58478
58560
  const read = () => {
@@ -58514,7 +58596,7 @@ function useSlotScroll(slot) {
58514
58596
  // src/TablePage.tsx
58515
58597
  var import_uuid10 = require("@ai-matrx/kit/uuid");
58516
58598
  var import_outbound4 = require("@ai-matrx/kit/outbound");
58517
- var import_jsx_runtime190 = require("react/jsx-runtime");
58599
+ var import_jsx_runtime191 = require("react/jsx-runtime");
58518
58600
  var RAIL_TITLE = {
58519
58601
  settings: "Table settings",
58520
58602
  inbox: "Inbox",
@@ -58531,10 +58613,10 @@ var RAIL_TITLE = {
58531
58613
  export: "Export"
58532
58614
  };
58533
58615
  function LookGlyph() {
58534
- return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
58535
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("path", { d: "M4 7h10M18 7h2M4 17h2M10 17h10" }),
58536
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("circle", { cx: "16", cy: "7", r: "2" }),
58537
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("circle", { cx: "8", cy: "17", r: "2" })
58616
+ return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
58617
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("path", { d: "M4 7h10M18 7h2M4 17h2M10 17h10" }),
58618
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("circle", { cx: "16", cy: "7", r: "2" }),
58619
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("circle", { cx: "8", cy: "17", r: "2" })
58538
58620
  ] });
58539
58621
  }
58540
58622
  function RailFrame({
@@ -58546,7 +58628,7 @@ function RailFrame({
58546
58628
  children
58547
58629
  }) {
58548
58630
  if (phone) {
58549
- return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
58631
+ return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
58550
58632
  import_design_system169.BottomSheet,
58551
58633
  {
58552
58634
  open: true,
@@ -58556,18 +58638,18 @@ function RailFrame({
58556
58638
  title,
58557
58639
  size: "full",
58558
58640
  surface: "solid",
58559
- children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("div", { "data-rail-sheet": "", className: "min-h-0 flex-1 overflow-y-auto px-3 pb-6", children })
58641
+ children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { "data-rail-sheet": "", className: "min-h-0 flex-1 overflow-y-auto px-3 pb-6", children })
58560
58642
  }
58561
58643
  );
58562
58644
  }
58563
- return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
58645
+ return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
58564
58646
  "aside",
58565
58647
  {
58566
58648
  "data-rail-column": "",
58567
58649
  "data-rail-over": over ? "" : void 0,
58568
58650
  "data-matrx-page-scroll": "",
58569
58651
  className: over ? "w-[26rem] shrink-0" : "w-[26rem] shrink-0 overflow-y-auto rounded-md border p-3",
58570
- children: over ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
58652
+ children: over ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
58571
58653
  "div",
58572
58654
  {
58573
58655
  className: (0, import_design_system169.cn)(
@@ -58619,11 +58701,11 @@ function TableNotHere({
58619
58701
  leaveLabel,
58620
58702
  className
58621
58703
  }) {
58622
- const client = (0, import_react335.useRecordsClient)();
58623
- const [archived, setArchived] = (0, import_react334.useState)({ phase: "asking" });
58624
- const [restoring, setRestoring] = (0, import_react334.useState)(false);
58625
- const [refusal3, setRefusal] = (0, import_react334.useState)(null);
58626
- (0, import_react334.useEffect)(() => {
58704
+ const client = (0, import_react336.useRecordsClient)();
58705
+ const [archived, setArchived] = (0, import_react335.useState)({ phase: "asking" });
58706
+ const [restoring, setRestoring] = (0, import_react335.useState)(false);
58707
+ const [refusal3, setRefusal] = (0, import_react335.useState)(null);
58708
+ (0, import_react335.useEffect)(() => {
58627
58709
  let alive = true;
58628
58710
  void client.tableArchived({ table_id: tableId }).then((answered) => {
58629
58711
  if (!alive) return;
@@ -58633,16 +58715,16 @@ function TableNotHere({
58633
58715
  alive = false;
58634
58716
  };
58635
58717
  }, [client, tableId]);
58636
- if (archived.phase === "asking") return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Skeleton, { className: "h-40 w-full" });
58718
+ if (archived.phase === "asking") return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Skeleton, { className: "h-40 w-full" });
58637
58719
  const row = archived.phase === "answered" ? archived.row : null;
58638
58720
  if (row) {
58639
- return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("div", { className: (0, import_design_system169.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
58640
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("p", { className: "text-sm font-medium", children: "This table is archived" }),
58641
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
58642
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records69.archivedByLine)(row) }),
58643
- refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(RefusalNotice, { error: refusal3 }) : null,
58644
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("div", { className: "flex gap-2", children: [
58645
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
58721
+ return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: (0, import_design_system169.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
58722
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-sm font-medium", children: "This table is archived" }),
58723
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
58724
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records69.archivedByLine)(row) }),
58725
+ refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(RefusalNotice, { error: refusal3 }) : null,
58726
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex gap-2", children: [
58727
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
58646
58728
  import_design_system169.Button,
58647
58729
  {
58648
58730
  size: "sm",
@@ -58661,14 +58743,14 @@ function TableNotHere({
58661
58743
  children: restoring ? "Bringing it back\u2026" : "Bring it back"
58662
58744
  }
58663
58745
  ),
58664
- onLeave ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
58746
+ onLeave ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
58665
58747
  ] })
58666
58748
  ] });
58667
58749
  }
58668
- return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("div", { className: (0, import_design_system169.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
58669
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("p", { className: "text-sm font-medium", children: "This table is not here" }),
58670
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_NOT_REACHABLE }),
58671
- onLeave ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
58750
+ return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: (0, import_design_system169.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
58751
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-sm font-medium", children: "This table is not here" }),
58752
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_NOT_REACHABLE }),
58753
+ onLeave ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
58672
58754
  ] });
58673
58755
  }
58674
58756
  var TABLE_NOT_REACHABLE = (
@@ -58824,17 +58906,17 @@ function TablePage({
58824
58906
  onViewAddressChange,
58825
58907
  className
58826
58908
  }) {
58827
- const client = (0, import_react335.useRecordsClient)();
58828
- const table = (0, import_react335.useTable)(tableId);
58909
+ const client = (0, import_react336.useRecordsClient)();
58910
+ const table = (0, import_react336.useTable)(tableId);
58829
58911
  const rights = useTableRights(table.data);
58830
58912
  const structure = useStructureHidden(tableId, table.data?.level);
58831
- const pageFields = (0, import_react335.useFields)(filter ? tableId : null);
58832
- const allFields = (0, import_react335.useFields)(tableId);
58913
+ const pageFields = (0, import_react336.useFields)(filter ? tableId : null);
58914
+ const allFields = (0, import_react336.useFields)(tableId);
58833
58915
  const viewLabels = useRecordLabels(allFields.data ?? void 0);
58834
58916
  const askedInWords = filter ? filterInWords(filter, pageFields.data ?? []) : null;
58835
- const organizationId = (0, import_react335.useRecordsClient)().config.organizationId;
58917
+ const organizationId = (0, import_react336.useRecordsClient)().config.organizationId;
58836
58918
  const publicReadOnly = usePublicReadOnly(client, organizationId, tableId, table.data, rights);
58837
- const seededOpening = (0, import_react335.useSeededAnswer)(
58919
+ const seededOpening = (0, import_react336.useSeededAnswer)(
58838
58920
  `table-page-opening:${tableId}`,
58839
58921
  async (c) => {
58840
58922
  const [listed, looked] = await Promise.all([c.views({ table_id: tableId }), readLooks(c, tableId)]);
@@ -58845,14 +58927,14 @@ function TablePage({
58845
58927
  }
58846
58928
  );
58847
58929
  const seededViews = seededOpening && (seedViews ?? [defaultView(tableId)]).every((spec) => seedIsSatisfied(spec, seededOpening.views)) ? seededOpening.views : void 0;
58848
- const [view, setView] = (0, import_react334.useState)(() => {
58930
+ const [view, setView] = (0, import_react335.useState)(() => {
58849
58931
  if (!seededViews || seededViews.length === 0) return null;
58850
58932
  const asked4 = savedViewFromParam(activeView);
58851
58933
  return seededViews.find((v) => v.id === asked4) ?? (0, import_views2.defaultViewOf)(seededViews) ?? seededViews[0];
58852
58934
  });
58853
- const [looks, setLooks] = (0, import_react334.useState)(() => seededViews ? seededOpening?.looks : void 0);
58854
- const looksSeededFor = (0, import_react334.useRef)(seededViews && seededOpening ? tableId : null);
58855
- (0, import_react334.useEffect)(() => {
58935
+ const [looks, setLooks] = (0, import_react335.useState)(() => seededViews ? seededOpening?.looks : void 0);
58936
+ const looksSeededFor = (0, import_react335.useRef)(seededViews && seededOpening ? tableId : null);
58937
+ (0, import_react335.useEffect)(() => {
58856
58938
  if (looksSeededFor.current === tableId) {
58857
58939
  looksSeededFor.current = null;
58858
58940
  return;
@@ -58869,7 +58951,7 @@ function TablePage({
58869
58951
  }, [client, tableId]);
58870
58952
  const look = view && looks ? looks[view.id] : void 0;
58871
58953
  const shown5 = view ? (0, import_views3.applyLook)(view, look) : null;
58872
- const [viewsEpoch, setViewsEpoch] = (0, import_react334.useState)(0);
58954
+ const [viewsEpoch, setViewsEpoch] = (0, import_react335.useState)(0);
58873
58955
  const opening = openingRail(activeRecordId, activeRail);
58874
58956
  const recordsUi = useRecordsUi();
58875
58957
  const savedFromLink = savedViewFromParam(activeView);
@@ -58877,33 +58959,33 @@ function TablePage({
58877
58959
  const formFromLink = formFromParam(activeView);
58878
58960
  const openedByPackage = openingView(savedFromLink || questionsFromLink || formFromLink ? null : activeView, activeDashboardId);
58879
58961
  const opened = questionsFromLink ? { ...openedByPackage, main: "questions" } : formFromLink ? { ...openedByPackage, main: "form" } : openedByPackage;
58880
- const [views, setViews] = (0, import_react334.useState)(() => seededViews);
58881
- const [pickedViewId, setPickedViewId] = (0, import_react334.useState)(savedFromLink);
58882
- const viewSeen = (0, import_react334.useRef)(null);
58883
- const [viewLinkMissed, setViewLinkMissed] = (0, import_react334.useState)(false);
58962
+ const [views, setViews] = (0, import_react335.useState)(() => seededViews);
58963
+ const [pickedViewId, setPickedViewId] = (0, import_react335.useState)(savedFromLink);
58964
+ const viewSeen = (0, import_react335.useRef)(null);
58965
+ const [viewLinkMissed, setViewLinkMissed] = (0, import_react335.useState)(false);
58884
58966
  const railAsked = typeof activeRail === "string" ? activeRail.trim() : "";
58885
58967
  const railUnknown = railAsked !== "" && railFromParam(railAsked) === null ? railAsked : null;
58886
58968
  const shareFromLink = railFromParam(activeRail) === "share";
58887
58969
  const canShare = useCanShare();
58888
58970
  const itemFor = (which) => railFromParam(activeRail) === which ? activeItemId ?? null : null;
58889
- const [asking, setAsking] = (0, import_react334.useState)(null);
58890
- const [layoutFromLink, setLayoutFromLink] = (0, import_react334.useState)(opened.layout);
58891
- const [surface, setSurface] = (0, import_react334.useState)({
58971
+ const [asking, setAsking] = (0, import_react335.useState)(null);
58972
+ const [layoutFromLink, setLayoutFromLink] = (0, import_react335.useState)(opened.layout);
58973
+ const [surface, setSurface] = (0, import_react335.useState)({
58892
58974
  main: opened.main,
58893
58975
  rail: opening.rail
58894
58976
  });
58895
58977
  const { main, rail } = surface;
58896
- const [questionDraft, setQuestionDraft] = (0, import_react334.useState)(null);
58978
+ const [questionDraft, setQuestionDraft] = (0, import_react335.useState)(null);
58897
58979
  const setRail = (next) => setSurface((now) => ({ ...now, rail: next }));
58898
- const [importEpoch, setImportEpoch] = (0, import_react334.useState)(0);
58899
- const [openRecord, setOpenRecord] = (0, import_react334.useState)(opening.record);
58980
+ const [importEpoch, setImportEpoch] = (0, import_react335.useState)(0);
58981
+ const [openRecord, setOpenRecord] = (0, import_react335.useState)(opening.record);
58900
58982
  const phone = (0, import_design_system169.useIsMobile)();
58901
- const [shareAsked, setShareAsked] = (0, import_react334.useState)(0);
58983
+ const [shareAsked, setShareAsked] = (0, import_react335.useState)(0);
58902
58984
  const { open: renameOpen, setOpen: setRenameOpen, ask: askRename, menuContentProps: renameMenuProps } = useRenameFromMenu();
58903
- const [archiveAsked, setArchiveAsked] = (0, import_react334.useState)(0);
58904
- const pageArchive = (0, import_react335.useTableArchive)(tableId);
58905
- const archiveRunning = (0, import_react334.useRef)(false);
58906
- const archiveFromMenu = (0, import_react334.useCallback)(async () => {
58985
+ const [archiveAsked, setArchiveAsked] = (0, import_react335.useState)(0);
58986
+ const pageArchive = (0, import_react336.useTableArchive)(tableId);
58987
+ const archiveRunning = (0, import_react335.useRef)(false);
58988
+ const archiveFromMenu = (0, import_react335.useCallback)(async () => {
58907
58989
  if (archiveRunning.current) return;
58908
58990
  archiveRunning.current = true;
58909
58991
  try {
@@ -58921,9 +59003,9 @@ function TablePage({
58921
59003
  client,
58922
59004
  tableId,
58923
59005
  name: finished.table_name || table.data?.name || "the table",
58924
- onRestored: () => (0, import_react335.tableShapeChanged)(tableId)
59006
+ onRestored: () => (0, import_react336.tableShapeChanged)(tableId)
58925
59007
  });
58926
- (0, import_react335.tableShapeChanged)(tableId);
59008
+ (0, import_react336.tableShapeChanged)(tableId);
58927
59009
  return;
58928
59010
  }
58929
59011
  setSurface((now) => ({ ...now, main: "records", rail: "settings" }));
@@ -58932,15 +59014,15 @@ function TablePage({
58932
59014
  archiveRunning.current = false;
58933
59015
  }
58934
59016
  }, [pageArchive, client, tableId, table.data, recordsUi.notify]);
58935
- const [moveAsked, setMoveAsked] = (0, import_react334.useState)(0);
59017
+ const [moveAsked, setMoveAsked] = (0, import_react335.useState)(0);
58936
59018
  const canCleanTable = useTableCanBeCleaned(tableId);
58937
- const [duplicateOpen, setDuplicateOpen] = (0, import_react334.useState)(false);
58938
- const [referenceOpen, setReferenceOpen] = (0, import_react334.useState)(false);
58939
- const [subscribeOpen, setSubscribeOpen] = (0, import_react334.useState)(false);
58940
- const [breakDownOpen, setBreakDownOpen] = (0, import_react334.useState)(false);
59019
+ const [duplicateOpen, setDuplicateOpen] = (0, import_react335.useState)(false);
59020
+ const [referenceOpen, setReferenceOpen] = (0, import_react335.useState)(false);
59021
+ const [subscribeOpen, setSubscribeOpen] = (0, import_react335.useState)(false);
59022
+ const [breakDownOpen, setBreakDownOpen] = (0, import_react335.useState)(false);
58941
59023
  const canGetReference = useCanGetReference();
58942
- const [toolbarSlot, setToolbarSlot] = (0, import_react334.useState)(null);
58943
- const [toolbarRow, setToolbarRow] = (0, import_react334.useState)(null);
59024
+ const [toolbarSlot, setToolbarSlot] = (0, import_react335.useState)(null);
59025
+ const [toolbarRow, setToolbarRow] = (0, import_react335.useState)(null);
58944
59026
  const toolbarFold2 = useToolbarFit(toolbarRow);
58945
59027
  const slotClipped = useSlotScroll(toolbarSlot);
58946
59028
  const embedded = pagePresentation2 === "embedded";
@@ -58965,7 +59047,7 @@ function TablePage({
58965
59047
  const skeletonFace = skeletonLayoutFor(
58966
59048
  faceUnknown && !layoutFromLink ? rememberedFace ?? shownLayout : shownLayout
58967
59049
  );
58968
- (0, import_react334.useEffect)(() => {
59050
+ (0, import_react335.useEffect)(() => {
58969
59051
  if (embedded || faceUnknown || main !== "records" || opened.layout || !table.data) return;
58970
59052
  rememberLayout(tableId, shownLayout);
58971
59053
  }, [embedded, faceUnknown, main, shownLayout, tableId, table.data !== void 0]);
@@ -58983,9 +59065,9 @@ function TablePage({
58983
59065
  lookDiffers: view ? (0, import_views3.lookDiffers)(view, look) : false
58984
59066
  };
58985
59067
  const shownSignature = JSON.stringify(shownReport);
58986
- const reportRef = (0, import_react334.useRef)(onShownViewChange);
59068
+ const reportRef = (0, import_react335.useRef)(onShownViewChange);
58987
59069
  reportRef.current = onShownViewChange;
58988
- (0, import_react334.useEffect)(() => {
59070
+ (0, import_react335.useEffect)(() => {
58989
59071
  reportRef.current?.(JSON.parse(shownSignature));
58990
59072
  }, [shownSignature]);
58991
59073
  const pickLayout = (next) => {
@@ -58994,9 +59076,9 @@ function TablePage({
58994
59076
  onViewChanged?.(addressForView(view, next));
58995
59077
  void patchView({ layout: next });
58996
59078
  };
58997
- const reportedRecords = (0, import_react334.useRef)(/* @__PURE__ */ new Set());
58998
- const lastActiveRecord = (0, import_react334.useRef)(activeRecordId ?? null);
58999
- (0, import_react334.useEffect)(() => {
59079
+ const reportedRecords = (0, import_react335.useRef)(/* @__PURE__ */ new Set());
59080
+ const lastActiveRecord = (0, import_react335.useRef)(activeRecordId ?? null);
59081
+ (0, import_react335.useEffect)(() => {
59000
59082
  const before = lastActiveRecord.current;
59001
59083
  lastActiveRecord.current = activeRecordId ?? null;
59002
59084
  if (!activeRecordId) {
@@ -59007,32 +59089,32 @@ function TablePage({
59007
59089
  setOpenRecord(activeRecordId);
59008
59090
  setSurface((now) => ({ ...now, rail: "record" }));
59009
59091
  }, [activeRecordId]);
59010
- const [shownIds, setShownIdsRaw] = (0, import_react334.useState)([]);
59011
- const setShownIds = (0, import_react334.useCallback)(
59092
+ const [shownIds, setShownIdsRaw] = (0, import_react335.useState)([]);
59093
+ const setShownIds = (0, import_react335.useCallback)(
59012
59094
  (next) => setShownIdsRaw((prev) => prev.length === next.length && prev.every((id, i) => id === next[i]) ? prev : next),
59013
59095
  []
59014
59096
  );
59015
- const [recordExpanded, setRecordExpanded] = (0, import_react334.useState)(false);
59016
- const [recordFull, setRecordFull] = (0, import_react334.useState)(false);
59017
- (0, import_react334.useEffect)(() => {
59097
+ const [recordExpanded, setRecordExpanded] = (0, import_react335.useState)(false);
59098
+ const [recordFull, setRecordFull] = (0, import_react335.useState)(false);
59099
+ (0, import_react335.useEffect)(() => {
59018
59100
  if (rail !== "record") setRecordFull(false);
59019
59101
  }, [rail]);
59020
59102
  const shownRecord = rail === "record" ? openRecord : null;
59021
- const reportedRecord = (0, import_react334.useRef)(activeRecordId ?? null);
59022
- (0, import_react334.useEffect)(() => {
59103
+ const reportedRecord = (0, import_react335.useRef)(activeRecordId ?? null);
59104
+ (0, import_react335.useEffect)(() => {
59023
59105
  if (shownRecord === reportedRecord.current) return;
59024
59106
  const how = shownRecord === null ? "close" : reportedRecord.current === null ? "open" : "step";
59025
59107
  reportedRecord.current = shownRecord;
59026
59108
  if (shownRecord) reportedRecords.current.add(shownRecord);
59027
59109
  onRecordChange?.(shownRecord, how);
59028
59110
  }, [shownRecord, onRecordChange]);
59029
- (0, import_react334.useEffect)(() => {
59111
+ (0, import_react335.useEffect)(() => {
59030
59112
  if (activeRecordId) return;
59031
59113
  const named = railFromParam(activeRail);
59032
59114
  if (named === null || named === "share") return;
59033
59115
  setSurface((now) => ({ ...now, rail: named }));
59034
59116
  }, [activeRail, activeRecordId]);
59035
- (0, import_react334.useEffect)(() => {
59117
+ (0, import_react335.useEffect)(() => {
59036
59118
  if (formFromParam(activeView)) {
59037
59119
  setSurface((now) => ({ ...now, main: "form" }));
59038
59120
  return;
@@ -59043,9 +59125,9 @@ function TablePage({
59043
59125
  setLayoutFromLink(isLayout ? named : null);
59044
59126
  setSurface((now) => ({ ...now, main: isLayout ? "records" : named }));
59045
59127
  }, [activeView]);
59046
- const [viewSaveRefused, setViewSaveRefused] = (0, import_react334.useState)(null);
59128
+ const [viewSaveRefused, setViewSaveRefused] = (0, import_react335.useState)(null);
59047
59129
  const viewLocked = view?.presentation?.locked === true;
59048
- const unlockView = (0, import_react334.useCallback)(async () => {
59130
+ const unlockView = (0, import_react335.useCallback)(async () => {
59049
59131
  const current = view;
59050
59132
  if (!current) return;
59051
59133
  const presentation = { ...current.presentation ?? {} };
@@ -59058,10 +59140,10 @@ function TablePage({
59058
59140
  setView({ ...current, presentation });
59059
59141
  setViewsEpoch((n) => n + 1);
59060
59142
  }, [client, tableId, view, recordsUi.notify]);
59061
- const sayLocked = (0, import_react334.useCallback)(() => {
59143
+ const sayLocked = (0, import_react335.useCallback)(() => {
59062
59144
  recordsUi.notify?.success(VIEW_LOCKED_REASON, rights.organise ? { label: "Unlock", run: () => void unlockView() } : void 0);
59063
59145
  }, [recordsUi.notify, unlockView, rights.organise]);
59064
- const patchView = (0, import_react334.useCallback)(
59146
+ const patchView = (0, import_react335.useCallback)(
59065
59147
  async (asked4) => {
59066
59148
  const current = view;
59067
59149
  if (!current) return;
@@ -59077,19 +59159,19 @@ function TablePage({
59077
59159
  },
59078
59160
  [client, tableId, view, looks, viewLocked, sayLocked]
59079
59161
  );
59080
- const arrival = (0, import_react334.useRef)(viewAddress ?? null);
59081
- const [gridQuery, setGridQuery] = (0, import_react334.useState)(null);
59082
- const [addressResetEpoch, setAddressResetEpoch] = (0, import_react334.useState)(0);
59083
- const reportGrid = (0, import_react334.useCallback)((q) => {
59162
+ const arrival = (0, import_react335.useRef)(viewAddress ?? null);
59163
+ const [gridQuery, setGridQuery] = (0, import_react335.useState)(null);
59164
+ const [addressResetEpoch, setAddressResetEpoch] = (0, import_react335.useState)(0);
59165
+ const reportGrid = (0, import_react335.useCallback)((q) => {
59084
59166
  const next = { sort: q.sort, filters: q.filters, search: q.search, page: q.page };
59085
59167
  setGridQuery((held) => sameViewAddress(held, next) ? held : next);
59086
59168
  }, []);
59087
- const addressPort = (0, import_react334.useMemo)(
59169
+ const addressPort = (0, import_react335.useMemo)(
59088
59170
  () => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
59089
59171
  [reportGrid, addressResetEpoch]
59090
59172
  );
59091
- const hiddenApplied = (0, import_react334.useRef)(false);
59092
- (0, import_react334.useEffect)(() => {
59173
+ const hiddenApplied = (0, import_react335.useRef)(false);
59174
+ (0, import_react335.useEffect)(() => {
59093
59175
  const hidden = arrival.current?.hidden;
59094
59176
  if (hiddenApplied.current || !view || !looks || !hidden || hidden.length === 0) return;
59095
59177
  hiddenApplied.current = true;
@@ -59109,10 +59191,10 @@ function TablePage({
59109
59191
  const gridPending = !isViewAddressEmpty({ ...arrival.current ?? {}, hidden: [] });
59110
59192
  const addressReady = Boolean(view && looks) && (gridQuery !== null || !gridPending);
59111
59193
  const addressSignature = JSON.stringify(viewAddressToParams(addressNow));
59112
- const addressReportRef = (0, import_react334.useRef)(onViewAddressChange);
59194
+ const addressReportRef = (0, import_react335.useRef)(onViewAddressChange);
59113
59195
  addressReportRef.current = onViewAddressChange;
59114
- const addressSent = (0, import_react334.useRef)(null);
59115
- (0, import_react334.useEffect)(() => {
59196
+ const addressSent = (0, import_react335.useRef)(null);
59197
+ (0, import_react335.useEffect)(() => {
59116
59198
  if (!addressReady) return;
59117
59199
  if (addressSent.current === null && addressSignature === JSON.stringify(viewAddressToParams(arrival.current))) {
59118
59200
  addressSent.current = addressSignature;
@@ -59124,9 +59206,9 @@ function TablePage({
59124
59206
  }, [addressReady, addressSignature]);
59125
59207
  const queryShowing = !isViewAddressEmpty({ ...gridQuery ?? {}, hidden: [] });
59126
59208
  const lookShowing = Boolean(view && looks && ((0, import_views3.lookDiffers)(view, looks[view.id]) || queryShowing));
59127
- const [lookRefused, setLookRefused] = (0, import_react334.useState)(null);
59128
- const [namingLook, setNamingLook] = (0, import_react334.useState)(false);
59129
- const [lookName, setLookName] = (0, import_react334.useState)("");
59209
+ const [lookRefused, setLookRefused] = (0, import_react335.useState)(null);
59210
+ const [namingLook, setNamingLook] = (0, import_react335.useState)(false);
59211
+ const [lookName, setLookName] = (0, import_react335.useState)("");
59130
59212
  const resetLook = async () => {
59131
59213
  const current = view;
59132
59214
  setAddressResetEpoch((n) => n + 1);
@@ -59191,7 +59273,7 @@ function TablePage({
59191
59273
  setPickedViewId(written.data);
59192
59274
  setViewsEpoch((n) => n + 1);
59193
59275
  };
59194
- const [designateRefused, setDesignateRefused] = (0, import_react334.useState)(null);
59276
+ const [designateRefused, setDesignateRefused] = (0, import_react335.useState)(null);
59195
59277
  const opensAs = view?.isDefault ? view.layout : null;
59196
59278
  const canDesignate = Boolean(
59197
59279
  rights.organise && view && layoutShowing && layoutShowing !== opensAs && (0, import_views2.storeKeepsLayout)(layoutShowing)
@@ -59216,7 +59298,7 @@ function TablePage({
59216
59298
  };
59217
59299
  const footer = footerOf(shown5?.presentation);
59218
59300
  const setFooter = (next) => void patchView({ presentation: { ...shown5?.presentation ?? {}, footer: next } });
59219
- const layoutRadio = /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(
59301
+ const layoutRadio = /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
59220
59302
  import_design_system169.DropdownMenuRadioGroup,
59221
59303
  {
59222
59304
  value: layoutShowing ?? (main === "form" ? FORM_LAYOUT : ""),
@@ -59228,14 +59310,14 @@ function TablePage({
59228
59310
  if (import_views2.VIEW_LAYOUTS.includes(value)) pickLayout(value);
59229
59311
  },
59230
59312
  children: [
59231
- import_views2.VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuRadioItem, { value: option, children: import_views2.LAYOUT_LABEL[option] }, option)),
59232
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuRadioItem, { value: FORM_LAYOUT, "data-layout-form": "", children: FORM_LAYOUT_LABEL })
59313
+ import_views2.VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuRadioItem, { value: option, children: import_views2.LAYOUT_LABEL[option] }, option)),
59314
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuRadioItem, { value: FORM_LAYOUT, "data-layout-form": "", children: FORM_LAYOUT_LABEL })
59233
59315
  ]
59234
59316
  }
59235
59317
  );
59236
- const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59237
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("div", { className: "flex items-center gap-2 text-xs", "data-table-sheet-filter": "", "data-matrx-table-tools-keep-open": "", children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(ViewFilter, { tableId, view: shown5, onApply: (where) => void patchView({ where }) }) }),
59238
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("div", { role: "group", "aria-label": "Layout", className: "flex flex-wrap gap-1 pt-1", "data-table-sheet-layout": "", children: import_views2.VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59318
+ const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59319
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: "flex items-center gap-2 text-xs", "data-table-sheet-filter": "", "data-matrx-table-tools-keep-open": "", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(ViewFilter, { tableId, view: shown5, onApply: (where) => void patchView({ where }) }) }),
59320
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { role: "group", "aria-label": "Layout", className: "flex flex-wrap gap-1 pt-1", "data-table-sheet-layout": "", children: import_views2.VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59239
59321
  import_design_system169.Button,
59240
59322
  {
59241
59323
  size: "sm",
@@ -59247,7 +59329,7 @@ function TablePage({
59247
59329
  },
59248
59330
  option
59249
59331
  )) }),
59250
- rights.share && canShare ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", className: "h-8", onClick: () => setShareAsked((n) => n + 1), "data-table-sheet-share": "", children: "Share\u2026" }) : null
59332
+ rights.share && canShare ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", className: "h-8", onClick: () => setShareAsked((n) => n + 1), "data-table-sheet-share": "", children: "Share\u2026" }) : null
59251
59333
  ] }) : void 0;
59252
59334
  const go = (pressed) => {
59253
59335
  if (!surfaceChosen(surface, pressed)) press(pressed);
@@ -59434,14 +59516,14 @@ function TablePage({
59434
59516
  }
59435
59517
  });
59436
59518
  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;
59437
- const actionsRef = (0, import_react334.useRef)(actions);
59519
+ const actionsRef = (0, import_react335.useRef)(actions);
59438
59520
  actionsRef.current = actions;
59439
- const onActionsRef = (0, import_react334.useRef)(onActions);
59521
+ const onActionsRef = (0, import_react335.useRef)(onActions);
59440
59522
  onActionsRef.current = onActions;
59441
- (0, import_react334.useEffect)(() => {
59523
+ (0, import_react335.useEffect)(() => {
59442
59524
  onActionsRef.current?.(actionsRef.current);
59443
59525
  });
59444
- (0, import_react334.useEffect)(() => {
59526
+ (0, import_react335.useEffect)(() => {
59445
59527
  const onKey = (event) => {
59446
59528
  const asked4 = objectActionForKey(actionsRef.current, event);
59447
59529
  if (!asked4) return;
@@ -59453,9 +59535,9 @@ function TablePage({
59453
59535
  return () => window.removeEventListener("keydown", onKey);
59454
59536
  }, [recordsUi]);
59455
59537
  const openedFromMenu = openedEntry ? { ...openedEntry, label: actions.find((a) => a.id === openedEntry.id)?.label ?? openedEntry.key } : null;
59456
- const pageActions = /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59457
- publicReadOnly ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Badge, { variant: "neutral", className: "shrink-0", "data-public-read-only": "", children: PUBLIC_READ_ONLY }, "public-read-only") : null,
59458
- !phone && rights.read && table.data ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59538
+ const pageActions = /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59539
+ publicReadOnly ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Badge, { variant: "neutral", className: "shrink-0", "data-public-read-only": "", children: PUBLIC_READ_ONLY }, "public-read-only") : null,
59540
+ !phone && rights.read && table.data ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59459
59541
  TableAsk,
59460
59542
  {
59461
59543
  tableId,
@@ -59467,7 +59549,7 @@ function TablePage({
59467
59549
  },
59468
59550
  "ask"
59469
59551
  ) : null,
59470
- organizationId ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("span", { className: shareInMenu ? "hidden" : "flex shrink-0 items-center", "data-toolbar-fit": "share", children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59552
+ organizationId ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: shareInMenu ? "hidden" : "flex shrink-0 items-center", "data-toolbar-fit": "share", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59471
59553
  ShareControl,
59472
59554
  {
59473
59555
  kind: "table",
@@ -59481,28 +59563,28 @@ function TablePage({
59481
59563
  },
59482
59564
  `share-${shareAsked}`
59483
59565
  ) }, "share") : null,
59484
- phone ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59485
- !chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.DropdownMenu, { children: [
59486
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", "aria-label": "Layout", title: "Layout", "data-table-layout-menu": "", children: "Layout" }) }),
59487
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuContent, { align: "end", className: "w-56", children: layoutRadio })
59566
+ phone ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59567
+ !chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.DropdownMenu, { children: [
59568
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", "aria-label": "Layout", title: "Layout", "data-table-layout-menu": "", children: "Layout" }) }),
59569
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuContent, { align: "end", className: "w-56", children: layoutRadio })
59488
59570
  ] }, "phone-layout") : null,
59489
59571
  phoneTableActions(actions)
59490
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.DropdownMenu, { children: [
59491
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", "aria-label": "Table menu", title: "Table menu", "data-table-menu": "", children: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "currentColor", "aria-hidden": "true", children: [
59492
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("circle", { cx: "5", cy: "12", r: "1.75" }),
59493
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("circle", { cx: "12", cy: "12", r: "1.75" }),
59494
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("circle", { cx: "19", cy: "12", r: "1.75" })
59572
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.DropdownMenu, { children: [
59573
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", "aria-label": "Table menu", title: "Table menu", "data-table-menu": "", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "currentColor", "aria-hidden": "true", children: [
59574
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("circle", { cx: "5", cy: "12", r: "1.75" }),
59575
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("circle", { cx: "12", cy: "12", r: "1.75" }),
59576
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("circle", { cx: "19", cy: "12", r: "1.75" })
59495
59577
  ] }) }) }),
59496
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.DropdownMenuContent, { align: "end", className: "w-64", "data-table-menu-content": "", ...renameMenuProps, children: [
59497
- !chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59498
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuLabel, { className: "text-xs text-muted-foreground", children: "Layout" }),
59578
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.DropdownMenuContent, { align: "end", className: "w-64", "data-table-menu-content": "", ...renameMenuProps, children: [
59579
+ !chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59580
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuLabel, { className: "text-xs text-muted-foreground", children: "Layout" }),
59499
59581
  layoutRadio,
59500
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuSeparator, {})
59582
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuSeparator, {})
59501
59583
  ] }) : null,
59502
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(ObjectActionMenuItems, { actions })
59584
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(ObjectActionMenuItems, { actions })
59503
59585
  ] })
59504
59586
  ] }, "menu"),
59505
- moveAsked > 0 && !actionHost?.move ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59587
+ moveAsked > 0 && !actionHost?.move ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59506
59588
  WhereItLives,
59507
59589
  {
59508
59590
  tableId,
@@ -59515,7 +59597,7 @@ function TablePage({
59515
59597
  },
59516
59598
  "move"
59517
59599
  ) : null,
59518
- breakDownOpen ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59600
+ breakDownOpen ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59519
59601
  BreakDownDialog,
59520
59602
  {
59521
59603
  tableId,
@@ -59526,7 +59608,7 @@ function TablePage({
59526
59608
  },
59527
59609
  "break-down"
59528
59610
  ) : null,
59529
- subscribeOpen && recordsUi.calendarFeed && organizationId && view ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59611
+ subscribeOpen && recordsUi.calendarFeed && organizationId && view ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59530
59612
  CalendarSubscribeDialog,
59531
59613
  {
59532
59614
  port: recordsUi.calendarFeed,
@@ -59539,8 +59621,8 @@ function TablePage({
59539
59621
  },
59540
59622
  "subscribe"
59541
59623
  ) : null,
59542
- referenceOpen && table.data ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(TableReferenceDialog, { table: table.data, open: referenceOpen, onOpenChange: setReferenceOpen }, "reference") : null,
59543
- duplicateOpen && table.data ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59624
+ referenceOpen && table.data ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(TableReferenceDialog, { table: table.data, open: referenceOpen, onOpenChange: setReferenceOpen }, "reference") : null,
59625
+ duplicateOpen && table.data ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59544
59626
  TableDuplicateDialog,
59545
59627
  {
59546
59628
  tableId,
@@ -59552,40 +59634,40 @@ function TablePage({
59552
59634
  },
59553
59635
  "duplicate"
59554
59636
  ) : null,
59555
- rights.structure && table.data ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(TableRenameDialog, { tableId, name: table.data.name, open: renameOpen, onOpenChange: setRenameOpen }, "rename") : null
59637
+ rights.structure && table.data ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(TableRenameDialog, { tableId, name: table.data.name, open: renameOpen, onOpenChange: setRenameOpen }, "rename") : null
59556
59638
  ] });
59557
59639
  const headerNode = header && !embedded ? header({ actions: table.data ? pageActions : null, tableName: table.data?.name ?? null }) : null;
59558
- if (table.error) return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59640
+ if (table.error) return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59559
59641
  headerNode,
59560
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(RefusalNotice, { error: table.error })
59642
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(RefusalNotice, { error: table.error })
59561
59643
  ] });
59562
59644
  if (table.loading && !table.data) {
59563
- return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59645
+ return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59564
59646
  headerNode,
59565
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(TablePageSkeleton, { layout: skeletonFace, embedded, tableId, ...className ? { className } : {} })
59647
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(TablePageSkeleton, { layout: skeletonFace, embedded, tableId, ...className ? { className } : {} })
59566
59648
  ] });
59567
59649
  }
59568
59650
  if (!table.data) {
59569
- return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59651
+ return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59570
59652
  headerNode,
59571
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(TableNotHere, { tableId, onLeave, leaveLabel, className })
59653
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(TableNotHere, { tableId, onLeave, leaveLabel, className })
59572
59654
  ] });
59573
59655
  }
59574
59656
  const lookSavable = Boolean(
59575
59657
  rights.write && view && Object.keys(viewPatchDocument((0, import_views3.saveToViewPlan)(view, look ?? {}).patch)).length > 0
59576
59658
  );
59577
- return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(ViewAddressContext.Provider, { value: addressPort, children: [
59578
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("div", { className: (0, import_design_system169.cn)("flex h-full min-h-0 gap-4", className), "data-table-footer": footer, children: [
59659
+ return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(ViewAddressContext.Provider, { value: addressPort, children: [
59660
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: (0, import_design_system169.cn)("flex h-full min-h-0 gap-4", className), "data-table-footer": footer, children: [
59579
59661
  headerNode,
59580
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col gap-2", children: structure.hidden || !structure.settled ? (
59662
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col gap-2", children: structure.hidden || !structure.settled ? (
59581
59663
  /* THE TOOLBAR ROW'S HEIGHT IS KEPT (min-h-8), so the sentence lands exactly where the bar was. */
59582
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59583
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("div", { className: TABLE_TOOLBAR_ROW_CLASS, "data-table-toolbar": "", "aria-hidden": "true" }),
59584
- structure.hidden ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(StructureLocked, {}) : /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(RecordsSkeleton, { layout: skeletonFace, embedded })
59664
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59665
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: TABLE_TOOLBAR_ROW_CLASS, "data-table-toolbar": "", "aria-hidden": "true" }),
59666
+ structure.hidden ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(StructureLocked, {}) : /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(RecordsSkeleton, { layout: skeletonFace, embedded })
59585
59667
  ] })
59586
- ) : /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59587
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(ImportNotice, { tableId, epoch: importEpoch, onOpenImport: () => setRail("import") }),
59588
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(
59668
+ ) : /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59669
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(ImportNotice, { tableId, epoch: importEpoch, onOpenImport: () => setRail("import") }),
59670
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
59589
59671
  "div",
59590
59672
  {
59591
59673
  ref: setToolbarRow,
@@ -59593,7 +59675,7 @@ function TablePage({
59593
59675
  "data-table-toolbar": "",
59594
59676
  "data-table-toolbar-fold": toolbarFold2,
59595
59677
  children: [
59596
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59678
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59597
59679
  ViewBar,
59598
59680
  {
59599
59681
  tableId,
@@ -59620,9 +59702,9 @@ function TablePage({
59620
59702
  },
59621
59703
  ...seededViews && viewsEpoch === 0 ? { initialViews: seededViews } : {},
59622
59704
  seed: seedViews ?? [defaultView(tableId)],
59623
- settings: view && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("div", { className: "flex flex-col gap-0.5 px-1 py-1", role: "radiogroup", "aria-label": FOOTER_WORDS.label, children: [
59624
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("span", { className: "px-1 pb-0.5 text-[11px] font-medium text-muted-foreground", children: FOOTER_WORDS.label }),
59625
- ["sticky", "inline"].map((option) => /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(
59705
+ settings: view && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-0.5 px-1 py-1", role: "radiogroup", "aria-label": FOOTER_WORDS.label, children: [
59706
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "px-1 pb-0.5 text-[11px] font-medium text-muted-foreground", children: FOOTER_WORDS.label }),
59707
+ ["sticky", "inline"].map((option) => /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
59626
59708
  "button",
59627
59709
  {
59628
59710
  type: "button",
@@ -59635,7 +59717,7 @@ function TablePage({
59635
59717
  ),
59636
59718
  onClick: () => setFooter(option),
59637
59719
  children: [
59638
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59720
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59639
59721
  "span",
59640
59722
  {
59641
59723
  "aria-hidden": "true",
@@ -59651,8 +59733,8 @@ function TablePage({
59651
59733
  },
59652
59734
  viewsEpoch
59653
59735
  ),
59654
- chooserInline ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("div", { className: "flex shrink-0 items-center gap-0.5", role: "group", "aria-label": "Layout", "data-toolbar-fit": "chooser", children: [
59655
- import_views2.VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59736
+ chooserInline ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex shrink-0 items-center gap-0.5", role: "group", "aria-label": "Layout", "data-toolbar-fit": "chooser", children: [
59737
+ import_views2.VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59656
59738
  import_design_system169.Button,
59657
59739
  {
59658
59740
  size: "sm",
@@ -59663,7 +59745,7 @@ function TablePage({
59663
59745
  },
59664
59746
  option
59665
59747
  )),
59666
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59748
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59667
59749
  import_design_system169.Button,
59668
59750
  {
59669
59751
  size: "sm",
@@ -59679,20 +59761,20 @@ function TablePage({
59679
59761
  /* THE ROW HAD NO ROOM (lane C, review 2026-09-26 D6: the switcher vanished at 1280 px and
59680
59762
  with the record panel open): the chooser folds to ONE button naming the layout that is
59681
59763
  showing — it never leaves the row. */
59682
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("span", { className: "flex shrink-0 items-center", "data-toolbar-fit": "chooser", "data-layout-chooser-compact": "", children: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.DropdownMenu, { children: [
59683
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.Button, { size: "sm", variant: "outline", className: "h-8 gap-1 px-2 text-xs", "aria-label": `Layout: ${layoutShowingLabel ?? "none"}`, children: [
59764
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "flex shrink-0 items-center", "data-toolbar-fit": "chooser", "data-layout-chooser-compact": "", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.DropdownMenu, { children: [
59765
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.Button, { size: "sm", variant: "outline", className: "h-8 gap-1 px-2 text-xs", "aria-label": `Layout: ${layoutShowingLabel ?? "none"}`, children: [
59684
59766
  layoutShowingLabel ?? "Layout",
59685
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("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__ */ (0, import_jsx_runtime190.jsx)("path", { d: "m6 9 6 6 6-6" }) })
59767
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("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__ */ (0, import_jsx_runtime191.jsx)("path", { d: "m6 9 6 6 6-6" }) })
59686
59768
  ] }) }),
59687
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.DropdownMenuContent, { align: "start", className: "w-44", "data-layout-chooser-menu": "", children: [
59688
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuLabel, { className: "text-xs text-muted-foreground", children: "Layout" }),
59769
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.DropdownMenuContent, { align: "start", className: "w-44", "data-layout-chooser-menu": "", children: [
59770
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuLabel, { className: "text-xs text-muted-foreground", children: "Layout" }),
59689
59771
  layoutRadio
59690
59772
  ] })
59691
59773
  ] }) })
59692
59774
  ) : null,
59693
- main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(ViewFilter, { tableId, view: shown5, onApply: (where) => void patchView({ where }) }) : null,
59694
- lookShowing && main === "records" && !namingLook ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-view-look-folded": "", "data-toolbar-fit": "look", children: [
59695
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59775
+ main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(ViewFilter, { tableId, view: shown5, onApply: (where) => void patchView({ where }) }) : null,
59776
+ lookShowing && main === "records" && !namingLook ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-view-look-folded": "", "data-toolbar-fit": "look", children: [
59777
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59696
59778
  import_design_system169.Button,
59697
59779
  {
59698
59780
  size: "sm",
@@ -59702,36 +59784,36 @@ function TablePage({
59702
59784
  "aria-label": "Reset view",
59703
59785
  onClick: () => void resetLook(),
59704
59786
  "data-view-look-reset-button": "",
59705
- children: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("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: [
59706
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("path", { d: "M3 12a9 9 0 1 0 3-6.7L3 8" }),
59707
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("path", { d: "M3 3v5h5" })
59787
+ children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("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: [
59788
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("path", { d: "M3 12a9 9 0 1 0 3-6.7L3 8" }),
59789
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("path", { d: "M3 3v5h5" })
59708
59790
  ] })
59709
59791
  }
59710
59792
  ),
59711
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.DropdownMenu, { children: [
59712
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.Button, { 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: [
59713
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(LookGlyph, {}),
59714
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("span", { "aria-hidden": "true", className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-primary" })
59793
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.DropdownMenu, { children: [
59794
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.Button, { 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: [
59795
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(LookGlyph, {}),
59796
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { "aria-hidden": "true", className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-primary" })
59715
59797
  ] }) }),
59716
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.DropdownMenuContent, { align: "start", className: "w-60", "data-view-look-menu-content": "", children: [
59717
- lookSavable ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuItem, { onSelect: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
59718
- rights.write ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuItem, { onSelect: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
59719
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuItem, { onSelect: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
59798
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.DropdownMenuContent, { align: "start", className: "w-60", "data-view-look-menu-content": "", children: [
59799
+ lookSavable ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuItem, { onSelect: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
59800
+ rights.write ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuItem, { onSelect: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
59801
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuItem, { onSelect: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
59720
59802
  ] })
59721
59803
  ] })
59722
59804
  ] }) : !lookShowing && main === "records" && view && !phone && !controlsInSheet ? (
59723
59805
  /* The reserved place keeps its full width at every row width (STABLE-TABLES): when it
59724
59806
  shrank on a narrow row, the look arriving on a sort pushed every control after it.
59725
59807
  A row too narrow for it scrolls sideways, as the row already does. */
59726
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("span", { "aria-hidden": "true", className: "invisible flex shrink-0 items-center gap-1 overflow-hidden", "data-view-look-place": "", "data-toolbar-fit-gives": "", children: [
59727
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(LookGlyph, {}) }),
59728
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1 })
59808
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("span", { "aria-hidden": "true", className: "invisible flex shrink-0 items-center gap-1 overflow-hidden", "data-view-look-place": "", "data-toolbar-fit-gives": "", children: [
59809
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(LookGlyph, {}) }),
59810
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1 })
59729
59811
  ] })
59730
- ) : lookShowing && main === "records" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-toolbar-fit": "look", title: LOOK_WORDS.yours, children: [
59731
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("span", { className: "sr-only", children: LOOK_WORDS.yours }),
59732
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("span", { "aria-hidden": "true", className: "h-1.5 w-1.5 shrink-0 rounded-full bg-primary" }),
59733
- lookSavable ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", className: "h-8 px-2 text-xs", onClick: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
59734
- rights.write ? namingLook ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(
59812
+ ) : lookShowing && main === "records" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-toolbar-fit": "look", title: LOOK_WORDS.yours, children: [
59813
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "sr-only", children: LOOK_WORDS.yours }),
59814
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { "aria-hidden": "true", className: "h-1.5 w-1.5 shrink-0 rounded-full bg-primary" }),
59815
+ lookSavable ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", className: "h-8 px-2 text-xs", onClick: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
59816
+ rights.write ? namingLook ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
59735
59817
  "form",
59736
59818
  {
59737
59819
  className: "flex items-center gap-1",
@@ -59740,7 +59822,7 @@ function TablePage({
59740
59822
  void saveLookAsNewView(lookName);
59741
59823
  },
59742
59824
  children: [
59743
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59825
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59744
59826
  import_design_system169.Input,
59745
59827
  {
59746
59828
  autoFocus: true,
@@ -59751,13 +59833,13 @@ function TablePage({
59751
59833
  placeholder: "View name"
59752
59834
  }
59753
59835
  ),
59754
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", type: "submit", className: "h-8 px-2 text-xs", disabled: lookName.trim() === "", children: "Save" })
59836
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", type: "submit", className: "h-8 px-2 text-xs", disabled: lookName.trim() === "", children: "Save" })
59755
59837
  ]
59756
59838
  }
59757
- ) : /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
59758
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
59839
+ ) : /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
59840
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
59759
59841
  ] }) : null,
59760
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59842
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59761
59843
  "div",
59762
59844
  {
59763
59845
  ref: setToolbarSlot,
@@ -59779,8 +59861,9 @@ function TablePage({
59779
59861
  "data-clipped": slotClipped
59780
59862
  }
59781
59863
  ),
59782
- rights.write && view && main === "records" && shownLayout !== "grid" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", className: "shrink-0", onClick: () => show("new-record"), children: "New record" }) : null,
59783
- openedFromMenu ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59864
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(TablePresence, { tableId }),
59865
+ rights.write && view && main === "records" && shownLayout !== "grid" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", className: "shrink-0", onClick: () => show("new-record"), children: "New record" }) : null,
59866
+ openedFromMenu ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59784
59867
  import_design_system169.Button,
59785
59868
  {
59786
59869
  size: "sm",
@@ -59793,18 +59876,18 @@ function TablePage({
59793
59876
  children: openedFromMenu.label
59794
59877
  }
59795
59878
  ) : null,
59796
- header ? null : /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("span", { className: "flex shrink-0 items-center gap-1", "data-table-page-actions": "", children: pageActions })
59879
+ header ? null : /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "flex shrink-0 items-center gap-1", "data-table-page-actions": "", children: pageActions })
59797
59880
  ]
59798
59881
  }
59799
59882
  ),
59800
- designateRefused ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(RefusalNotice, { error: designateRefused }) : null,
59801
- viewSaveRefused ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59883
+ designateRefused ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(RefusalNotice, { error: designateRefused }) : null,
59884
+ viewSaveRefused ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59802
59885
  RefusalNotice,
59803
59886
  {
59804
59887
  error: viewSaveRefused.error,
59805
- actions: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("span", { className: "flex flex-wrap gap-1 pt-0.5", "data-view-save-refused": "", children: [
59806
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", onClick: () => void patchView(viewSaveRefused.patch), children: "Try again" }),
59807
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59888
+ actions: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("span", { className: "flex flex-wrap gap-1 pt-0.5", "data-view-save-refused": "", children: [
59889
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", onClick: () => void patchView(viewSaveRefused.patch), children: "Try again" }),
59890
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59808
59891
  import_design_system169.Button,
59809
59892
  {
59810
59893
  size: "sm",
@@ -59825,8 +59908,8 @@ function TablePage({
59825
59908
  ] })
59826
59909
  }
59827
59910
  ) : null,
59828
- lookRefused ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(RefusalNotice, { error: lookRefused }) : null,
59829
- main === "dashboards" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(DashboardCanvas, { tableId, activeDashboardId: activeDashboardId ?? null }) : main === "form" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto", "data-table-form-view": "", children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(FormsPanel, { tableId, activeFormId: formFromLink && activeItemId && (0, import_uuid10.isUuidShape)(activeItemId) ? activeItemId : null, asView: true }) }) : main === "questions" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59911
+ lookRefused ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(RefusalNotice, { error: lookRefused }) : null,
59912
+ main === "dashboards" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(DashboardCanvas, { tableId, activeDashboardId: activeDashboardId ?? null }) : main === "form" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto", "data-table-form-view": "", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(FormsPanel, { tableId, activeFormId: formFromLink && activeItemId && (0, import_uuid10.isUuidShape)(activeItemId) ? activeItemId : null, asView: true }) }) : main === "questions" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59830
59913
  QuestionPanel,
59831
59914
  {
59832
59915
  tableId,
@@ -59838,7 +59921,7 @@ function TablePage({
59838
59921
  page returns to the records rather than leaving the person looking
59839
59922
  at a list the record is no longer in — and opens it, because the
59840
59923
  thing they just rescued is the thing they came for. */
59841
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59924
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59842
59925
  ArchivedView,
59843
59926
  {
59844
59927
  tableId,
@@ -59850,7 +59933,7 @@ function TablePage({
59850
59933
  }
59851
59934
  }
59852
59935
  )
59853
- ) : /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(TableToolbarSlotContext.Provider, { value: toolbarSlot, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(TableToolbarFoldContext.Provider, { value: toolbarFold2, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(TableToolbarSheetExtrasContext.Provider, { value: sheetExtras, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(
59936
+ ) : /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(TableToolbarSlotContext.Provider, { value: toolbarSlot, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(TableToolbarFoldContext.Provider, { value: toolbarFold2, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(TableToolbarSheetExtrasContext.Provider, { value: sheetExtras, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
59854
59937
  "div",
59855
59938
  {
59856
59939
  className: (0, import_design_system169.cn)(
@@ -59861,10 +59944,10 @@ function TablePage({
59861
59944
  ),
59862
59945
  "data-table-records": "",
59863
59946
  children: [
59864
- railUnknown ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("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,
59865
- shareFromLink && rights.known && (!rights.share || !canShare) ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("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,
59866
- opened.unknown ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("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: (0, import_views2.unknownViewLine)(opened.unknown) }) : null,
59867
- viewLinkMissed ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59947
+ railUnknown ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("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,
59948
+ shareFromLink && rights.known && (!rights.share || !canShare) ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("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,
59949
+ opened.unknown ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("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: (0, import_views2.unknownViewLine)(opened.unknown) }) : null,
59950
+ viewLinkMissed ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59868
59951
  "p",
59869
59952
  {
59870
59953
  "data-records-view-link-missed": "",
@@ -59872,7 +59955,7 @@ function TablePage({
59872
59955
  children: unknownSavedViewLine(view?.name ?? null)
59873
59956
  }
59874
59957
  ) : null,
59875
- cameFrom ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59958
+ cameFrom ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59876
59959
  "p",
59877
59960
  {
59878
59961
  "data-testid": "came-from-a-number",
@@ -59882,7 +59965,7 @@ function TablePage({
59882
59965
  ) : null,
59883
59966
  faceUnknown ? (
59884
59967
  /* REVIEW-FIX 10: a full page paints the rows this table showed last time (else fills). */
59885
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59968
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59886
59969
  RecordsSkeleton,
59887
59970
  {
59888
59971
  layout: skeletonFace,
@@ -59890,7 +59973,7 @@ function TablePage({
59890
59973
  ...embedded ? {} : { rows: rememberedRowCount(`${tableId}:page:last`, 100, "fill") }
59891
59974
  }
59892
59975
  )
59893
- ) : /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59976
+ ) : /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59894
59977
  ViewSwitcher,
59895
59978
  {
59896
59979
  chooser: false,
@@ -59939,13 +60022,13 @@ function TablePage({
59939
60022
  }
59940
60023
  }
59941
60024
  ),
59942
- view || faceUnknown || views === void 0 || views !== null && views.length > 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("p", { className: "text-xs text-muted-foreground", children: VIEW_NOT_SAVED_YET })
60025
+ view || faceUnknown || views === void 0 || views !== null && views.length > 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-xs text-muted-foreground", children: VIEW_NOT_SAVED_YET })
59943
60026
  ]
59944
60027
  }
59945
60028
  ) }) }) })
59946
60029
  ] }) }),
59947
- rail === "none" ? null : /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(RailFrame, { phone, title: RAIL_TITLE[rail], onClose: () => setRail("none"), over: rail === "record" && (recordExpanded || recordFull), full: rail === "record" && recordFull, children: [
59948
- rail === "settings" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
60030
+ rail === "none" ? null : /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(RailFrame, { phone, title: RAIL_TITLE[rail], onClose: () => setRail("none"), over: rail === "record" && (recordExpanded || recordFull), full: rail === "record" && recordFull, children: [
60031
+ rail === "settings" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59949
60032
  TableSettings,
59950
60033
  {
59951
60034
  tableId,
@@ -59962,7 +60045,7 @@ function TablePage({
59962
60045
  } : void 0
59963
60046
  }
59964
60047
  ) : null,
59965
- rail === "inbox" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
60048
+ rail === "inbox" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59966
60049
  ActionInbox,
59967
60050
  {
59968
60051
  tableId,
@@ -59972,9 +60055,9 @@ function TablePage({
59972
60055
  }
59973
60056
  }
59974
60057
  ) : null,
59975
- rail === "forms" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(FormsPanel, { tableId, activeFormId: itemFor("forms") }) : null,
59976
- rail === "bookings" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(BookingSlots, { tableId, activeBookingId: itemFor("bookings") }) : null,
59977
- rail === "checklists" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
60058
+ rail === "forms" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(FormsPanel, { tableId, activeFormId: itemFor("forms") }) : null,
60059
+ rail === "bookings" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(BookingSlots, { tableId, activeBookingId: itemFor("bookings") }) : null,
60060
+ rail === "checklists" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59978
60061
  ChecklistsPanel,
59979
60062
  {
59980
60063
  tableId,
@@ -59984,12 +60067,12 @@ function TablePage({
59984
60067
  }
59985
60068
  }
59986
60069
  ) : null,
59987
- rail === "notifications" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(SubscriptionsPanel, { tableId, activeRuleId: itemFor("notifications") }) : null,
59988
- rail === "portals" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(PortalsPanel, { tableId, activePortalId: itemFor("portals") }) : null,
59989
- rail === "export" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(ExportMenu, { tableId, view: viewReading }) : null,
59990
- rail === "import" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(ImportWizard, { tableId, onWrote: () => setImportEpoch((n) => n + 1), onDone: () => setRail("none") }) : null,
59991
- rail === "field" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(FieldEditor, { tableId, onSaved: () => setRail("none"), onCancel: () => setRail("none") }) : null,
59992
- rail === "new-record" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
60070
+ rail === "notifications" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(SubscriptionsPanel, { tableId, activeRuleId: itemFor("notifications") }) : null,
60071
+ rail === "portals" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(PortalsPanel, { tableId, activePortalId: itemFor("portals") }) : null,
60072
+ rail === "export" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(ExportMenu, { tableId, view: viewReading }) : null,
60073
+ rail === "import" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(ImportWizard, { tableId, onWrote: () => setImportEpoch((n) => n + 1), onDone: () => setRail("none") }) : null,
60074
+ rail === "field" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(FieldEditor, { tableId, onSaved: () => setRail("none"), onCancel: () => setRail("none") }) : null,
60075
+ rail === "new-record" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59993
60076
  RecordForm,
59994
60077
  {
59995
60078
  tableId,
@@ -60000,7 +60083,7 @@ function TablePage({
60000
60083
  onCancel: () => setRail("none")
60001
60084
  }
60002
60085
  ) : null,
60003
- rail === "who-changed" && asking ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
60086
+ rail === "who-changed" && asking ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
60004
60087
  FieldHistoryPanel,
60005
60088
  {
60006
60089
  tableId,
@@ -60013,7 +60096,7 @@ function TablePage({
60013
60096
  }
60014
60097
  }
60015
60098
  ) : null,
60016
- rail === "record" && openRecord ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
60099
+ rail === "record" && openRecord ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
60017
60100
  RecordPanel,
60018
60101
  {
60019
60102
  tableId,
@@ -60033,15 +60116,15 @@ function TablePage({
60033
60116
  ) : null
60034
60117
  ] })
60035
60118
  ] }),
60036
- embedded ? null : /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(GridShortcutsHelp, {})
60119
+ embedded ? null : /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(GridShortcutsHelp, {})
60037
60120
  ] });
60038
60121
  }
60039
60122
  var PUBLIC_READ_ONLY = "Public \xB7 read only";
60040
60123
  function usePublicReadOnly(client, organizationId, tableId, table, rights) {
60041
60124
  const readOnly = rights.known && rights.read && !rights.write;
60042
60125
  const marked = table?.published_to_web;
60043
- const [isPublic, setIsPublic] = (0, import_react334.useState)(false);
60044
- (0, import_react334.useEffect)(() => {
60126
+ const [isPublic, setIsPublic] = (0, import_react335.useState)(false);
60127
+ (0, import_react335.useEffect)(() => {
60045
60128
  if (!readOnly || !table) {
60046
60129
  setIsPublic(false);
60047
60130
  return;
@@ -60067,11 +60150,11 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
60067
60150
  var import_format16 = require("@ai-matrx/kit/format");
60068
60151
  var import_design_system170 = require("@ai-matrx/design-system");
60069
60152
  var import_data_table25 = require("@ai-matrx/design-system/data-table");
60070
- var import_react336 = require("react");
60153
+ var import_react337 = require("react");
60071
60154
  var import_design_system171 = require("@ai-matrx/design-system");
60072
- var import_react337 = require("@ai-matrx/records/react");
60155
+ var import_react338 = require("@ai-matrx/records/react");
60073
60156
  init_plainWords();
60074
- var import_jsx_runtime191 = require("react/jsx-runtime");
60157
+ var import_jsx_runtime192 = require("react/jsx-runtime");
60075
60158
  var entityTitleColumn = entityNameColumn;
60076
60159
  function shown4(v) {
60077
60160
  if (v === null || v === void 0 || v === "") return "";
@@ -60081,15 +60164,15 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
60081
60164
  const choiceColumns = entityChoiceColumns(entity.columns);
60082
60165
  const column = (groupBy ? choiceColumns.find((c) => c.key === groupBy) : void 0) ?? choiceColumns[0] ?? null;
60083
60166
  const title = entityTitleColumn(entity.columns);
60084
- const extra = (0, import_react336.useMemo)(
60167
+ const extra = (0, import_react337.useMemo)(
60085
60168
  () => cardFields ? entity.columns.filter((c) => cardFields.includes(c.key)) : entity.columns.filter((c) => c !== title && c !== column && c.type !== "choice").slice(0, 2),
60086
60169
  [cardFields, entity.columns, title, column]
60087
60170
  );
60088
- const [refused, setRefused] = (0, import_react336.useState)(null);
60089
- const [over, setOver] = (0, import_react336.useState)(null);
60090
- if (entity.error) return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This board could not be read: ${entity.error}` });
60171
+ const [refused, setRefused] = (0, import_react337.useState)(null);
60172
+ const [over, setOver] = (0, import_react337.useState)(null);
60173
+ if (entity.error) return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This board could not be read: ${entity.error}` });
60091
60174
  if (!entity.loading && !column) {
60092
- return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("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.` });
60175
+ return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("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.` });
60093
60176
  }
60094
60177
  if (!column) return null;
60095
60178
  const words2 = column.choices ?? [];
@@ -60107,10 +60190,10 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
60107
60190
  const says = await entity.update(id, column, to);
60108
60191
  if (says) setRefused({ to, says });
60109
60192
  };
60110
- return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: (0, import_design_system171.cn)("flex min-h-40 gap-2 overflow-x-auto pb-1", className), "data-records-entity-board": column.key, children: lanes.map((lane) => {
60193
+ return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("div", { className: (0, import_design_system171.cn)("flex min-h-40 gap-2 overflow-x-auto pb-1", className), "data-records-entity-board": column.key, children: lanes.map((lane) => {
60111
60194
  const cards = rowsOf2(lane.key);
60112
60195
  if (lane.key === "" && cards.length === 0) return null;
60113
- return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
60196
+ return /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(
60114
60197
  "section",
60115
60198
  {
60116
60199
  "aria-label": lane.label,
@@ -60122,12 +60205,12 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
60122
60205
  onDragLeave: writable && lane.key ? () => setOver((o) => o === lane.key ? null : o) : void 0,
60123
60206
  onDrop: writable && lane.key ? (e) => void drop(e, lane.key) : void 0,
60124
60207
  children: [
60125
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("header", { className: "flex items-baseline gap-1.5 px-1 text-xs", children: [
60126
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "truncate font-medium", children: lane.label }),
60127
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "tabular-nums text-muted-foreground", children: cards.length })
60208
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("header", { className: "flex items-baseline gap-1.5 px-1 text-xs", children: [
60209
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "truncate font-medium", children: lane.label }),
60210
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "tabular-nums text-muted-foreground", children: cards.length })
60128
60211
  ] }),
60129
- refused && refused.to === lane.key ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system171.ErrorBox, { 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,
60130
- cards.map((row) => /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
60212
+ refused && refused.to === lane.key ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_design_system171.ErrorBox, { 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,
60213
+ cards.map((row) => /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(
60131
60214
  "article",
60132
60215
  {
60133
60216
  draggable: writable,
@@ -60138,8 +60221,8 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
60138
60221
  className: (0, import_design_system171.cn)("flex flex-col gap-0.5 rounded border bg-card px-2 py-1.5 text-xs shadow-sm", writable && "cursor-grab"),
60139
60222
  "data-records-entity-card": row._id,
60140
60223
  children: [
60141
- onOpenRecord ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("button", { type: "button", className: "truncate text-left font-medium hover:underline", onClick: () => onOpenRecord(row._id), children: (title ? entityValueText(title, entityCellValue(row, title)) : shown4(row._id)) || "Untitled" }) : /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "truncate font-medium", children: (title ? entityValueText(title, entityCellValue(row, title)) : shown4(row._id)) || "Untitled" }),
60142
- extra.map((c) => entityValueText(c, entityCellValue(row, c)) ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "truncate text-muted-foreground", children: entityValueText(c, entityCellValue(row, c)) }, c.key) : null)
60224
+ onOpenRecord ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("button", { type: "button", className: "truncate text-left font-medium hover:underline", onClick: () => onOpenRecord(row._id), children: (title ? entityValueText(title, entityCellValue(row, title)) : shown4(row._id)) || "Untitled" }) : /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "truncate font-medium", children: (title ? entityValueText(title, entityCellValue(row, title)) : shown4(row._id)) || "Untitled" }),
60225
+ extra.map((c) => entityValueText(c, entityCellValue(row, c)) ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "truncate text-muted-foreground", children: entityValueText(c, entityCellValue(row, c)) }, c.key) : null)
60143
60226
  ]
60144
60227
  },
60145
60228
  row._id
@@ -60167,18 +60250,18 @@ function blockOfAnswer(answer, base2, by) {
60167
60250
  return { ...base2, rows };
60168
60251
  }
60169
60252
  function EntityChartBlock({ source, kind: kind2, by, measure, title, where, organization, centerValue, variant, className }) {
60170
- const client = (0, import_react337.useRecordsClient)();
60253
+ const client = (0, import_react338.useRecordsClient)();
60171
60254
  const m = measure ?? { op: "count" };
60172
60255
  const ask2 = JSON.stringify([source.token, by ?? null, m, where ?? null, organization ?? null]);
60173
60256
  const question = (0, import_first_page9.entityChartQuestion)({ by, measure, where, organization });
60174
60257
  const measures = [m.op === "count" ? { op: "count" } : { op: m.op, key: m.of }];
60175
60258
  const base2 = { title: title ?? "", kind: kind2, measures, group_by: by ? [by] : [] };
60176
- const seeded = (0, import_react337.useSeededAnswerAt)(`entity-chart:${ask2}`, (c) => c.drillAsk({ source, question }));
60177
- const [block, setBlock] = (0, import_react336.useState)(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base2, by) : null);
60178
- const seededFor = (0, import_react336.useRef)(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
60179
- (0, import_react336.useEffect)(() => {
60259
+ const seeded = (0, import_react338.useSeededAnswerAt)(`entity-chart:${ask2}`, (c) => c.drillAsk({ source, question }));
60260
+ const [block, setBlock] = (0, import_react337.useState)(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base2, by) : null);
60261
+ const seededFor = (0, import_react337.useRef)(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
60262
+ (0, import_react337.useEffect)(() => {
60180
60263
  const held = seededFor.current;
60181
- if (held && held.ask === `${ask2}|${kind2}|${title ?? ""}` && Date.now() - held.at < import_react337.SEED_FRESH_MS) return;
60264
+ if (held && held.ask === `${ask2}|${kind2}|${title ?? ""}` && Date.now() - held.at < import_react338.SEED_FRESH_MS) return;
60182
60265
  seededFor.current = null;
60183
60266
  let cancelled = false;
60184
60267
  void client.drillAsk({ source, question }).then((answer) => {
@@ -60190,9 +60273,9 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
60190
60273
  };
60191
60274
  }, [client, ask2, kind2, title]);
60192
60275
  if (!block) {
60193
- return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(RecordsSkeleton, { layout: "chart", embedded: variant === "bare", ...className ? { className } : {} });
60276
+ return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(RecordsSkeleton, { layout: "chart", embedded: variant === "bare", ...className ? { className } : {} });
60194
60277
  }
60195
- return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
60278
+ return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
60196
60279
  ChartBlock,
60197
60280
  {
60198
60281
  block,
@@ -60205,7 +60288,7 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
60205
60288
  );
60206
60289
  }
60207
60290
  function EntityTablePage(props) {
60208
- return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(EntityDataScope, { children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(EntityTablePageBody, { ...props }) });
60291
+ return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(EntityDataScope, { children: /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(EntityTablePageBody, { ...props }) });
60209
60292
  }
60210
60293
  function EntityTablePageBody({
60211
60294
  source,
@@ -60221,20 +60304,20 @@ function EntityTablePageBody({
60221
60304
  actions,
60222
60305
  className
60223
60306
  }) {
60224
- const [typed2, setTyped] = (0, import_react336.useState)("");
60307
+ const [typed2, setTyped] = (0, import_react337.useState)("");
60225
60308
  const term = searchOverride ?? typed2;
60226
60309
  const entity = useEntityTable(source.token, { pageSize, search: term });
60227
- const [layout, setLayout] = (0, import_react336.useState)(opened);
60228
- (0, import_react336.useEffect)(() => setLayout(opened), [opened]);
60310
+ const [layout, setLayout] = (0, import_react337.useState)(opened);
60311
+ (0, import_react337.useEffect)(() => setLayout(opened), [opened]);
60229
60312
  const choose = (next) => {
60230
60313
  setLayout(next);
60231
60314
  onLayoutChange?.(next);
60232
60315
  };
60233
60316
  const boardable = entityChoiceColumns(entity.columns).length > 0;
60234
60317
  const nameColumn = entityNameColumn(entity.columns);
60235
- const [naming, setNaming] = (0, import_react336.useState)(null);
60236
- const [adding, setAdding] = (0, import_react336.useState)(false);
60237
- const [addRefused, setAddRefused] = (0, import_react336.useState)(null);
60318
+ const [naming, setNaming] = (0, import_react337.useState)(null);
60319
+ const [adding, setAdding] = (0, import_react337.useState)(false);
60320
+ const [addRefused, setAddRefused] = (0, import_react337.useState)(null);
60238
60321
  const add = async () => {
60239
60322
  const name = (naming ?? "").trim();
60240
60323
  if (!name || !nameColumn || adding) return;
@@ -60246,7 +60329,7 @@ function EntityTablePageBody({
60246
60329
  setNaming(null);
60247
60330
  onOpenRecord?.(made.id);
60248
60331
  };
60249
- const [question, setQuestion] = (0, import_react336.useState)(() => questionFromGrouping(void 0));
60332
+ const [question, setQuestion] = (0, import_react337.useState)(() => questionFromGrouping(void 0));
60250
60333
  const { config: drill } = useDrill({
60251
60334
  source,
60252
60335
  question,
@@ -60255,20 +60338,20 @@ function EntityTablePageBody({
60255
60338
  rowNoun: (entity.label ?? "record").toLowerCase(),
60256
60339
  enabled: layout === "grid"
60257
60340
  });
60258
- return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: (0, import_design_system171.cn)("flex min-w-0 flex-col gap-2", className), "data-records-entity-page": source.token, children: [
60259
- presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
60260
- presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
60261
- presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : (0, import_format16.formatCount)(entity.total) }) : null,
60262
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("span", { className: "ml-auto flex items-center gap-1", children: [
60263
- boardable ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
60264
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system171.Button, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),
60265
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system171.Button, { size: "sm", variant: layout === "board" ? "secondary" : "ghost", "aria-pressed": layout === "board", onClick: () => choose("board"), children: "Board" })
60341
+ return /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: (0, import_design_system171.cn)("flex min-w-0 flex-col gap-2", className), "data-records-entity-page": source.token, children: [
60342
+ presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
60343
+ presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
60344
+ presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : (0, import_format16.formatCount)(entity.total) }) : null,
60345
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("span", { className: "ml-auto flex items-center gap-1", children: [
60346
+ boardable ? /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(import_jsx_runtime192.Fragment, { children: [
60347
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_design_system171.Button, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),
60348
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_design_system171.Button, { size: "sm", variant: layout === "board" ? "secondary" : "ghost", "aria-pressed": layout === "board", onClick: () => choose("board"), children: "Board" })
60266
60349
  ] }) : null,
60267
- entity.creatable && naming === null ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system171.Button, { size: "sm", variant: "ghost", onClick: () => {
60350
+ entity.creatable && naming === null ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_design_system171.Button, { size: "sm", variant: "ghost", onClick: () => {
60268
60351
  setAddRefused(null);
60269
60352
  setNaming("");
60270
60353
  }, children: "New page" }) : null,
60271
- entity.creatable && naming !== null ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
60354
+ entity.creatable && naming !== null ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
60272
60355
  import_design_system171.Input,
60273
60356
  {
60274
60357
  autoFocus: true,
@@ -60298,9 +60381,9 @@ function EntityTablePageBody({
60298
60381
  actions
60299
60382
  ] })
60300
60383
  ] }) : null,
60301
- addRefused ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system171.ErrorBox, { 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,
60302
- entity.error ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
60303
- presentation === "embedded" && searchBox ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: "flex min-w-0 items-center justify-end", "data-records-entity-search": "", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system170.TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
60384
+ addRefused ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_design_system171.ErrorBox, { 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,
60385
+ entity.error ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(import_jsx_runtime192.Fragment, { children: [
60386
+ presentation === "embedded" && searchBox ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("div", { className: "flex min-w-0 items-center justify-end", "data-records-entity-search": "", children: /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_design_system170.TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
60304
60387
  import_design_system170.TapTargetSearchGroup,
60305
60388
  {
60306
60389
  surface: "solid",
@@ -60312,8 +60395,8 @@ function EntityTablePageBody({
60312
60395
  }
60313
60396
  }
60314
60397
  ) }) }) : null,
60315
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(EntityGrid, { entity, pageSize, embedded: presentation === "embedded", ...drill ? { drill } : {} }),
60316
- entity.hasMore ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
60398
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(EntityGrid, { entity, pageSize, embedded: presentation === "embedded", ...drill ? { drill } : {} }),
60399
+ entity.hasMore ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
60317
60400
  import_data_table25.MatrxTableCardShowMore,
60318
60401
  {
60319
60402
  shown: entity.rows.length,
@@ -60327,12 +60410,12 @@ function EntityTablePageBody({
60327
60410
  }
60328
60411
 
60329
60412
  // src/TablePageSource.tsx
60330
- var import_jsx_runtime192 = require("react/jsx-runtime");
60413
+ var import_jsx_runtime193 = require("react/jsx-runtime");
60331
60414
  function TablePage2(props) {
60332
- if (props.source === void 0) return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(TablePage, { ...props });
60415
+ if (props.source === void 0) return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(TablePage, { ...props });
60333
60416
  const { source, layout, onLayoutChange, groupBy, onOpenRecord, ...rest } = props;
60334
- if (source.kind === "table") return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(TablePage, { ...rest, tableId: source.id });
60335
- return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
60417
+ if (source.kind === "table") return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(TablePage, { ...rest, tableId: source.id });
60418
+ return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60336
60419
  EntityTablePage,
60337
60420
  {
60338
60421
  source,
@@ -60359,12 +60442,12 @@ init_ObjectActionMenuItems();
60359
60442
  init_objectActionIcons();
60360
60443
 
60361
60444
  // src/DataBindingPicker.tsx
60362
- var import_react338 = require("react");
60445
+ var import_react339 = require("react");
60363
60446
  var import_records70 = require("@ai-matrx/records");
60364
- var import_react339 = require("@ai-matrx/records/react");
60447
+ var import_react340 = require("@ai-matrx/records/react");
60365
60448
  var import_design_system172 = require("@ai-matrx/design-system");
60366
60449
  init_names();
60367
- var import_jsx_runtime193 = require("react/jsx-runtime");
60450
+ var import_jsx_runtime194 = require("react/jsx-runtime");
60368
60451
  var DATA_BINDING_SHAPES = [
60369
60452
  { value: "collection", label: "The whole table" },
60370
60453
  { value: "reference", label: "One record" },
@@ -60431,9 +60514,9 @@ function DataBindingPicker({ dataSource, userId, binding, onChange, disabled, de
60431
60514
  ...binding.semantic_type === "collection" && defaultRowLimit ? { limit: defaultRowLimit } : {}
60432
60515
  });
60433
60516
  };
60434
- return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)("div", { className: "flex flex-col gap-2", children: [
60435
- /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
60436
- /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60517
+ return /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("div", { className: "flex flex-col gap-2", children: [
60518
+ /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
60519
+ /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60437
60520
  BindingDetails,
60438
60521
  {
60439
60522
  tableId,
@@ -60452,11 +60535,11 @@ function BindingDetails({
60452
60535
  disabled,
60453
60536
  defaultRowLimit
60454
60537
  }) {
60455
- const table = (0, import_react339.useTable)(tableId);
60456
- const fields = (0, import_react339.useFields)(tableId);
60457
- const fieldList = (0, import_react338.useMemo)(() => fields.data ?? [], [fields.data]);
60538
+ const table = (0, import_react340.useTable)(tableId);
60539
+ const fields = (0, import_react340.useFields)(tableId);
60540
+ const fieldList = (0, import_react339.useMemo)(() => fields.data ?? [], [fields.data]);
60458
60541
  const shape = binding.semantic_type;
60459
- (0, import_react338.useEffect)(() => {
60542
+ (0, import_react339.useEffect)(() => {
60460
60543
  if (disabled || shape === "value" || binding.transform || fields.loading || fieldList.length === 0) return;
60461
60544
  onChange({
60462
60545
  ...binding,
@@ -60497,8 +60580,8 @@ function BindingDetails({
60497
60580
  const fieldOptions = fieldList.map((f) => ({ value: f.key, label: fieldName(f) }));
60498
60581
  const template = binding.transform?.template ?? "";
60499
60582
  const setTemplate = (next) => onChange({ ...binding, transform: { join: "\n", ...binding.transform, name: "list", template: next } });
60500
- return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)("div", { className: "flex flex-col gap-2", children: [
60501
- /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60583
+ return /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("div", { className: "flex flex-col gap-2", children: [
60584
+ /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60502
60585
  import_design_system172.Button,
60503
60586
  {
60504
60587
  type: "button",
@@ -60512,7 +60595,7 @@ function BindingDetails({
60512
60595
  },
60513
60596
  s.value
60514
60597
  )) }),
60515
- shape !== "collection" && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60598
+ shape !== "collection" && /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60516
60599
  RecordPicker,
60517
60600
  {
60518
60601
  tableId,
@@ -60521,7 +60604,7 @@ function BindingDetails({
60521
60604
  disabled: Boolean(disabled)
60522
60605
  }
60523
60606
  ),
60524
- shape === "value" && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60607
+ shape === "value" && /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60525
60608
  import_design_system172.CreatablePicker,
60526
60609
  {
60527
60610
  value: binding.field_key ?? null,
@@ -60535,8 +60618,8 @@ function BindingDetails({
60535
60618
  ariaLabel: "Column"
60536
60619
  }
60537
60620
  ),
60538
- shape !== "value" && /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)("div", { className: "flex flex-col gap-1", children: [
60539
- /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60621
+ shape !== "value" && /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("div", { className: "flex flex-col gap-1", children: [
60622
+ /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60540
60623
  "textarea",
60541
60624
  {
60542
60625
  className: (0, import_design_system172.cn)(
@@ -60548,7 +60631,7 @@ function BindingDetails({
60548
60631
  onChange: (e) => setTemplate(e.target.value)
60549
60632
  }
60550
60633
  ),
60551
- !disabled && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60634
+ !disabled && /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60552
60635
  import_design_system172.Button,
60553
60636
  {
60554
60637
  type: "button",
@@ -60561,9 +60644,9 @@ function BindingDetails({
60561
60644
  p.token
60562
60645
  )) })
60563
60646
  ] }),
60564
- shape === "collection" && /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
60647
+ shape === "collection" && /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
60565
60648
  "Up to",
60566
- /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60649
+ /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60567
60650
  import_design_system172.BasicInput,
60568
60651
  {
60569
60652
  type: "number",
@@ -60580,9 +60663,9 @@ function BindingDetails({
60580
60663
  ),
60581
60664
  "rows"
60582
60665
  ] }),
60583
- /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
60584
- /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
60585
- DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60666
+ /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
60667
+ /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
60668
+ DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60586
60669
  import_design_system172.Button,
60587
60670
  {
60588
60671
  type: "button",
@@ -60601,15 +60684,15 @@ function BindingDetails({
60601
60684
  }
60602
60685
 
60603
60686
  // src/PickedSummaries.tsx
60604
- var import_react340 = require("@ai-matrx/records/react");
60687
+ var import_react341 = require("@ai-matrx/records/react");
60605
60688
  init_names();
60606
- var import_jsx_runtime194 = require("react/jsx-runtime");
60689
+ var import_jsx_runtime195 = require("react/jsx-runtime");
60607
60690
  function TableNameText({ dataSource, tableId }) {
60608
60691
  const tables = useTablesAnywhere(dataSource);
60609
- if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2014" });
60610
- if (tables.loading) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2026" });
60611
- if (tables.error) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "Couldn't load the table's name" });
60612
- return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
60692
+ if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2014" });
60693
+ if (tables.loading) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2026" });
60694
+ if (tables.error) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "Couldn't load the table's name" });
60695
+ return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
60613
60696
  }
60614
60697
  function ColumnValuesText({
60615
60698
  dataSource,
@@ -60617,38 +60700,38 @@ function ColumnValuesText({
60617
60700
  tableId,
60618
60701
  value
60619
60702
  }) {
60620
- if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2014" });
60621
- return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60703
+ if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2014" });
60704
+ return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
60622
60705
  TableScope,
60623
60706
  {
60624
60707
  dataSource,
60625
60708
  userId,
60626
60709
  tableId,
60627
- fallback: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2026" }),
60628
- unavailable: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "Couldn't load this table's columns" }),
60629
- children: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(RecordLabelProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(ColumnValuesWords, { tableId, value }) })
60710
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2026" }),
60711
+ unavailable: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "Couldn't load this table's columns" }),
60712
+ children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(RecordLabelProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(ColumnValuesWords, { tableId, value }) })
60630
60713
  }
60631
60714
  );
60632
60715
  }
60633
60716
  function ColumnValuesWords({ tableId, value }) {
60634
- const fields = (0, import_react340.useFields)(tableId);
60717
+ const fields = (0, import_react341.useFields)(tableId);
60635
60718
  const labels = useRecordLabels(fields.data ?? void 0);
60636
- if (fields.loading) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2026" });
60637
- if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "Couldn't load this table's columns" });
60719
+ if (fields.loading) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2026" });
60720
+ if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "Couldn't load this table's columns" });
60638
60721
  const parts = [];
60639
60722
  for (const [key, stored] of Object.entries(value)) {
60640
60723
  if (key.startsWith("_")) continue;
60641
60724
  const field2 = (fields.data ?? []).find((f) => f.key === key);
60642
- if (parts.length) parts.push(/* @__PURE__ */ (0, import_jsx_runtime194.jsx)("span", { children: ", " }, `${key}-sep`));
60725
+ if (parts.length) parts.push(/* @__PURE__ */ (0, import_jsx_runtime195.jsx)("span", { children: ", " }, `${key}-sep`));
60643
60726
  parts.push(
60644
- /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("span", { children: [
60727
+ /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)("span", { children: [
60645
60728
  field2 ? fieldName(field2) : "A removed column",
60646
60729
  " is ",
60647
60730
  field2 ? renderValue(field2, stored, void 0, labels) : "\u2014"
60648
60731
  ] }, key)
60649
60732
  );
60650
60733
  }
60651
- return parts.length ? /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: parts }) : /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2014" });
60734
+ return parts.length ? /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: parts }) : /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2014" });
60652
60735
  }
60653
60736
  function RecordNameText({
60654
60737
  dataSource,
@@ -60656,47 +60739,47 @@ function RecordNameText({
60656
60739
  tableId,
60657
60740
  recordId
60658
60741
  }) {
60659
- if (!tableId || !recordId) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2014" });
60660
- return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60742
+ if (!tableId || !recordId) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2014" });
60743
+ return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
60661
60744
  TableScope,
60662
60745
  {
60663
60746
  dataSource,
60664
60747
  userId,
60665
60748
  tableId,
60666
- fallback: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2026" }),
60667
- unavailable: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "Couldn't load this record" }),
60668
- children: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(RecordNameWords, { tableId, recordId })
60749
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2026" }),
60750
+ unavailable: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "Couldn't load this record" }),
60751
+ children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(RecordNameWords, { tableId, recordId })
60669
60752
  }
60670
60753
  );
60671
60754
  }
60672
60755
  function RecordNameWords({ tableId, recordId }) {
60673
- const table = (0, import_react340.useTable)(tableId);
60674
- const record = (0, import_react340.useRecord)(recordId);
60675
- if (record.loading || table.loading) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2026" });
60676
- if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "Couldn't load this record" });
60677
- if (!record.data) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "A record you cannot open" });
60678
- return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: recordName(record.data.document, table.data?.title_field ?? null) });
60756
+ const table = (0, import_react341.useTable)(tableId);
60757
+ const record = (0, import_react341.useRecord)(recordId);
60758
+ if (record.loading || table.loading) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2026" });
60759
+ if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "Couldn't load this record" });
60760
+ if (!record.data) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "A record you cannot open" });
60761
+ return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: recordName(record.data.document, table.data?.title_field ?? null) });
60679
60762
  }
60680
60763
 
60681
60764
  // src/HeldChangeDecision.tsx
60682
- var import_react341 = require("react");
60683
- var import_react342 = require("@ai-matrx/records/react");
60765
+ var import_react342 = require("react");
60766
+ var import_react343 = require("@ai-matrx/records/react");
60684
60767
  var import_design_system173 = require("@ai-matrx/design-system");
60685
60768
  init_Refusal();
60686
- var import_jsx_runtime195 = require("react/jsx-runtime");
60769
+ var import_jsx_runtime196 = require("react/jsx-runtime");
60687
60770
  function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, onDecided, approveLabel }) {
60688
- return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_react342.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(Decision, { approvalId, onDecided, approveLabel: approveLabel ?? "Approve" }) });
60771
+ return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(import_react343.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(Decision, { approvalId, onDecided, approveLabel: approveLabel ?? "Approve" }) });
60689
60772
  }
60690
60773
  function Decision({
60691
60774
  approvalId,
60692
60775
  onDecided,
60693
60776
  approveLabel
60694
60777
  }) {
60695
- const client = (0, import_react342.useRecordsClient)();
60696
- const [may, setMay] = (0, import_react341.useState)(null);
60697
- const [busy, setBusy] = (0, import_react341.useState)(null);
60698
- const [error, setError] = (0, import_react341.useState)(null);
60699
- (0, import_react341.useEffect)(() => {
60778
+ const client = (0, import_react343.useRecordsClient)();
60779
+ const [may, setMay] = (0, import_react342.useState)(null);
60780
+ const [busy, setBusy] = (0, import_react342.useState)(null);
60781
+ const [error, setError] = (0, import_react342.useState)(null);
60782
+ (0, import_react342.useEffect)(() => {
60700
60783
  let live = true;
60701
60784
  void client.workApprovalMayDecide({ approval_id: approvalId }).then((res) => {
60702
60785
  if (!live) return;
@@ -60718,13 +60801,13 @@ function Decision({
60718
60801
  if (res.ok) onDecided(approve);
60719
60802
  else setError(res.error);
60720
60803
  };
60721
- if (may === null) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
60722
- return /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
60723
- may ? /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)("div", { className: "flex gap-2", children: [
60724
- /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_design_system173.Button, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : approveLabel }),
60725
- /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_design_system173.Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
60726
- ] }) : !error && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
60727
- error ? /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(RefusalLine, { error }) : null
60804
+ if (may === null) return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
60805
+ return /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
60806
+ may ? /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "flex gap-2", children: [
60807
+ /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(import_design_system173.Button, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : approveLabel }),
60808
+ /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(import_design_system173.Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
60809
+ ] }) : !error && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
60810
+ error ? /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(RefusalLine, { error }) : null
60728
60811
  ] });
60729
60812
  }
60730
60813
 
@@ -60732,16 +60815,16 @@ function Decision({
60732
60815
  init_newTableColumns();
60733
60816
 
60734
60817
  // src/CalendarLinks.tsx
60735
- var import_react343 = require("react");
60818
+ var import_react344 = require("react");
60736
60819
  init_Refusal();
60737
60820
  var import_design_system174 = require("@ai-matrx/design-system");
60738
- var import_jsx_runtime196 = require("react/jsx-runtime");
60821
+ var import_jsx_runtime197 = require("react/jsx-runtime");
60739
60822
  var day = (iso) => iso ? new Date(iso).toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" }) : null;
60740
60823
  function CalendarLinks({ port }) {
60741
- const [rows, setRows] = (0, import_react343.useState)(null);
60742
- const [error, setError] = (0, import_react343.useState)(null);
60743
- const [fresh, setFresh] = (0, import_react343.useState)(null);
60744
- const load = (0, import_react343.useCallback)(async () => {
60824
+ const [rows, setRows] = (0, import_react344.useState)(null);
60825
+ const [error, setError] = (0, import_react344.useState)(null);
60826
+ const [fresh, setFresh] = (0, import_react344.useState)(null);
60827
+ const load = (0, import_react344.useCallback)(async () => {
60745
60828
  try {
60746
60829
  setRows(await port.list());
60747
60830
  setError(null);
@@ -60749,7 +60832,7 @@ function CalendarLinks({ port }) {
60749
60832
  setError(asRefusal3(e, "The links could not be read"));
60750
60833
  }
60751
60834
  }, [port]);
60752
- (0, import_react343.useEffect)(() => {
60835
+ (0, import_react344.useEffect)(() => {
60753
60836
  void load();
60754
60837
  }, [load]);
60755
60838
  const act = async (run) => {
@@ -60760,15 +60843,15 @@ function CalendarLinks({ port }) {
60760
60843
  setError(asRefusal3(e, "That didn\u2019t work"));
60761
60844
  }
60762
60845
  };
60763
- if (rows === null && !error) return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("p", { className: "text-sm text-muted-foreground", "data-calendar-links-loading": "", children: "Reading your links\u2026" });
60764
- return /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "flex flex-col gap-2", "data-calendar-links": "", children: [
60765
- error ? /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(RefusalNotice, { error }) : null,
60766
- rows && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("p", { className: "text-sm text-muted-foreground", children: "No calendar links yet." }) : null,
60767
- rows?.map((row) => /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "flex flex-col gap-2 rounded-md border px-3 py-2", "data-calendar-link-row": row.id, children: [
60768
- /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
60769
- /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "min-w-0", children: [
60770
- /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("div", { className: "truncate text-sm font-medium", children: row.title }),
60771
- /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "text-xs text-muted-foreground", children: [
60846
+ if (rows === null && !error) return /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("p", { className: "text-sm text-muted-foreground", "data-calendar-links-loading": "", children: "Reading your links\u2026" });
60847
+ return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "flex flex-col gap-2", "data-calendar-links": "", children: [
60848
+ error ? /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(RefusalNotice, { error }) : null,
60849
+ rows && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("p", { className: "text-sm text-muted-foreground", children: "No calendar links yet." }) : null,
60850
+ rows?.map((row) => /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "flex flex-col gap-2 rounded-md border px-3 py-2", "data-calendar-link-row": row.id, children: [
60851
+ /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
60852
+ /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "min-w-0", children: [
60853
+ /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "truncate text-sm font-medium", children: row.title }),
60854
+ /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "text-xs text-muted-foreground", children: [
60772
60855
  "Made ",
60773
60856
  day(row.created_at),
60774
60857
  " \xB7 ",
@@ -60777,8 +60860,8 @@ function CalendarLinks({ port }) {
60777
60860
  row.expired ? "Expired" : row.expires_at ? `Expires ${day(row.expires_at)}` : "Never expires"
60778
60861
  ] })
60779
60862
  ] }),
60780
- /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "flex shrink-0 gap-2", children: [
60781
- /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
60863
+ /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "flex shrink-0 gap-2", children: [
60864
+ /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
60782
60865
  import_design_system174.Button,
60783
60866
  {
60784
60867
  size: "sm",
@@ -60792,7 +60875,7 @@ function CalendarLinks({ port }) {
60792
60875
  children: "Rotate"
60793
60876
  }
60794
60877
  ),
60795
- /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
60878
+ /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
60796
60879
  import_design_system174.Button,
60797
60880
  {
60798
60881
  size: "sm",
@@ -60808,30 +60891,30 @@ function CalendarLinks({ port }) {
60808
60891
  )
60809
60892
  ] })
60810
60893
  ] }),
60811
- fresh?.id === row.id ? /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(CalendarLinkOnce, { url: fresh.url }) : null
60894
+ fresh?.id === row.id ? /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(CalendarLinkOnce, { url: fresh.url }) : null
60812
60895
  ] }, row.id))
60813
60896
  ] });
60814
60897
  }
60815
60898
 
60816
60899
  // src/TemplatePreview.tsx
60817
- var import_react344 = require("react");
60900
+ var import_react345 = require("react");
60818
60901
  var import_memory = require("@ai-matrx/records/memory");
60819
- var import_react345 = require("@ai-matrx/records/react");
60902
+ var import_react346 = require("@ai-matrx/records/react");
60820
60903
  var import_forms7 = require("@ai-matrx/records/forms");
60821
- var import_jsx_runtime197 = require("react/jsx-runtime");
60904
+ var import_jsx_runtime198 = require("react/jsx-runtime");
60822
60905
  function useTemplatePreview(spec, today) {
60823
- return (0, import_react344.useMemo)(() => (0, import_memory.templatePreview)(spec, today ? { today } : {}), [spec, today]);
60906
+ return (0, import_react345.useMemo)(() => (0, import_memory.templatePreview)(spec, today ? { today } : {}), [spec, today]);
60824
60907
  }
60825
60908
  function TemplatePreview({ spec, today, initialTable, host, aside, booking, className }) {
60826
60909
  const preview = useTemplatePreview(spec, today);
60827
- const bound2 = (0, import_react344.useMemo)(() => ({ ...host, sayLevelNeeded: false }), [host]);
60910
+ const bound2 = (0, import_react345.useMemo)(() => ({ ...host, sayLevelNeeded: false }), [host]);
60828
60911
  const first = preview.tables.find((t) => t.token === initialTable) ?? preview.tables[0];
60829
- const [active, setActive] = (0, import_react344.useState)(first?.id ?? null);
60912
+ const [active, setActive] = (0, import_react345.useState)(first?.id ?? null);
60830
60913
  const table = preview.tables.find((t) => t.id === active) ?? first;
60831
60914
  if (!table) return null;
60832
- return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: ["flex min-w-0 flex-col gap-3", className].filter(Boolean).join(" "), "data-template-preview": preview.tables.length, children: [
60833
- preview.tables.length > 1 || aside ? /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-1.5", role: "tablist", "aria-label": "Tables", children: [
60834
- preview.tables.map((t) => /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(
60915
+ return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: ["flex min-w-0 flex-col gap-3", className].filter(Boolean).join(" "), "data-template-preview": preview.tables.length, children: [
60916
+ preview.tables.length > 1 || aside ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-1.5", role: "tablist", "aria-label": "Tables", children: [
60917
+ preview.tables.map((t) => /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(
60835
60918
  "button",
60836
60919
  {
60837
60920
  type: "button",
@@ -60845,28 +60928,28 @@ function TemplatePreview({ spec, today, initialTable, host, aside, booking, clas
60845
60928
  ].join(" "),
60846
60929
  children: [
60847
60930
  t.name,
60848
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("span", { className: "text-xs tabular-nums text-muted-foreground", children: t.rows })
60931
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { className: "text-xs tabular-nums text-muted-foreground", children: t.rows })
60849
60932
  ]
60850
60933
  },
60851
60934
  t.id
60852
60935
  )),
60853
- aside ? /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "ml-auto", children: aside }) : null
60936
+ aside ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "ml-auto", children: aside }) : null
60854
60937
  ] }) : null,
60855
- /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(RecordsMount, { config: preview.config, host: bound2, children: [
60856
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "min-h-[32rem] min-w-0 overflow-hidden rounded-xl border border-border bg-card", children: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(TablePage, { tableId: table.id }, table.id) }),
60857
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(PreviewForms, { preview, booking }),
60858
- preview.dashboards.length ? /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Dashboards", "data-template-preview-dashboards": preview.dashboards.length, children: [
60859
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("h2", { className: "text-lg font-semibold tracking-tight", children: "Dashboards" }),
60860
- preview.dashboards.map((d) => /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "min-w-0 overflow-hidden rounded-xl border border-border bg-card p-3", "data-template-preview-dashboard": d.token, children: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(DashboardCanvas, { tableId: d.tableId, activeDashboardId: d.id }) }, d.id))
60938
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(RecordsMount, { config: preview.config, host: bound2, children: [
60939
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "min-h-[32rem] min-w-0 overflow-hidden rounded-xl border border-border bg-card", children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(TablePage, { tableId: table.id }, table.id) }),
60940
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(PreviewForms, { preview, booking }),
60941
+ preview.dashboards.length ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Dashboards", "data-template-preview-dashboards": preview.dashboards.length, children: [
60942
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("h2", { className: "text-lg font-semibold tracking-tight", children: "Dashboards" }),
60943
+ preview.dashboards.map((d) => /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "min-w-0 overflow-hidden rounded-xl border border-border bg-card p-3", "data-template-preview-dashboard": d.token, children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(DashboardCanvas, { tableId: d.tableId, activeDashboardId: d.id }) }, d.id))
60861
60944
  ] }) : null
60862
60945
  ] })
60863
60946
  ] });
60864
60947
  }
60865
60948
  function PreviewForms({ preview, booking }) {
60866
- const client = (0, import_react345.useRecordsClient)();
60867
- const [forms, setForms] = (0, import_react344.useState)(null);
60868
- const [pages, setPages] = (0, import_react344.useState)([]);
60869
- (0, import_react344.useEffect)(() => {
60949
+ const client = (0, import_react346.useRecordsClient)();
60950
+ const [forms, setForms] = (0, import_react345.useState)(null);
60951
+ const [pages, setPages] = (0, import_react345.useState)([]);
60952
+ (0, import_react345.useEffect)(() => {
60870
60953
  let gone = false;
60871
60954
  void client.forms().then((answered) => {
60872
60955
  if (!gone) setForms(answered.ok ? answered.data.map(import_forms7.formFromSummary) : []);
@@ -60885,29 +60968,29 @@ function PreviewForms({ preview, booking }) {
60885
60968
  };
60886
60969
  }, [client, preview, booking]);
60887
60970
  if (!forms?.length && !pages.length) return null;
60888
- return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Forms and booking", "data-template-preview-forms": forms?.length ?? 0, children: [
60889
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("h2", { className: "text-lg font-semibold tracking-tight", children: "Forms and booking" }),
60890
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "grid min-w-0 gap-4 md:grid-cols-2", children: (forms ?? []).map((f) => /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-form": f.slug ?? f.id, children: [
60891
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("h3", { className: "mb-3 text-sm font-semibold", children: f.name }),
60892
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(FormRunner, { form: f, preview: true })
60971
+ return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Forms and booking", "data-template-preview-forms": forms?.length ?? 0, children: [
60972
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("h2", { className: "text-lg font-semibold tracking-tight", children: "Forms and booking" }),
60973
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "grid min-w-0 gap-4 md:grid-cols-2", children: (forms ?? []).map((f) => /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-form": f.slug ?? f.id, children: [
60974
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("h3", { className: "mb-3 text-sm font-semibold", children: f.name }),
60975
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(FormRunner, { form: f, preview: true })
60893
60976
  ] }, f.id)) }),
60894
- booking ? pages.map((p) => /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-booking": p.id, children: [
60895
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("h3", { className: "mb-3 text-sm font-semibold", children: String(p.page["title"] ?? "") }),
60977
+ booking ? pages.map((p) => /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-booking": p.id, children: [
60978
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("h3", { className: "mb-3 text-sm font-semibold", children: String(p.page["title"] ?? "") }),
60896
60979
  booking(p.page)
60897
60980
  ] }, p.id)) : null
60898
60981
  ] });
60899
60982
  }
60900
60983
 
60901
60984
  // src/SectionCard.tsx
60902
- var import_react346 = require("react");
60985
+ var import_react347 = require("react");
60903
60986
  var import_field_kinds9 = require("@ai-matrx/records/field-kinds");
60904
- var import_react347 = require("@ai-matrx/records/react");
60987
+ var import_react348 = require("@ai-matrx/records/react");
60905
60988
  var import_design_system175 = require("@ai-matrx/design-system");
60906
60989
  var import_icons2 = require("@ai-matrx/design-system/icons");
60907
60990
  var import_field_formats10 = require("@ai-matrx/design-system/field-formats");
60908
60991
  init_names();
60909
60992
  init_plainWords();
60910
- var import_jsx_runtime198 = require("react/jsx-runtime");
60993
+ var import_jsx_runtime199 = require("react/jsx-runtime");
60911
60994
  var NAME_KEYS3 = ["name", "title", "token", "label"];
60912
60995
  var GROUP_KEYS = ["group", "set", "section", "category"];
60913
60996
  var NOTE_KEYS = ["usage_note", "note", "notes", "usage"];
@@ -60951,12 +61034,12 @@ function columnsOf(values) {
60951
61034
  }
60952
61035
  var same4 = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
60953
61036
  function useDraft(stored, save) {
60954
- const [draft, setDraft] = (0, import_react346.useState)(null);
60955
- const latest = (0, import_react346.useRef)({ draft, save, stored });
60956
- (0, import_react346.useEffect)(() => {
61037
+ const [draft, setDraft] = (0, import_react347.useState)(null);
61038
+ const latest = (0, import_react347.useRef)({ draft, save, stored });
61039
+ (0, import_react347.useEffect)(() => {
60957
61040
  latest.current = { draft, save, stored };
60958
61041
  });
60959
- (0, import_react346.useEffect)(() => {
61042
+ (0, import_react347.useEffect)(() => {
60960
61043
  if (!draft || draft.phase !== "typing") return;
60961
61044
  const timer = setTimeout(() => {
60962
61045
  const sending = draft.value;
@@ -60968,7 +61051,7 @@ function useDraft(stored, save) {
60968
61051
  }, SAVE_AFTER_MS);
60969
61052
  return () => clearTimeout(timer);
60970
61053
  }, [draft]);
60971
- (0, import_react346.useEffect)(
61054
+ (0, import_react347.useEffect)(
60972
61055
  () => () => {
60973
61056
  const held = latest.current;
60974
61057
  if (held.draft && held.draft.phase === "typing") void held.save(held.draft.value);
@@ -60980,9 +61063,9 @@ function useDraft(stored, save) {
60980
61063
  }
60981
61064
  function ChecksLine({ checks, onFix }) {
60982
61065
  if (checks.length === 0) return null;
60983
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { className: "mt-1 flex flex-col items-start gap-1", children: checks.map((check, i) => /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("span", { className: "flex flex-col items-start gap-1", children: [
60984
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { className: "text-xs text-warning-ink", children: check.message }),
60985
- check.fix && onFix ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.Button, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", onClick: () => onFix(check), children: check.fix.label }) : null
61066
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: "mt-1 flex flex-col items-start gap-1", children: checks.map((check, i) => /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("span", { className: "flex flex-col items-start gap-1", children: [
61067
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: "text-xs text-warning-ink", children: check.message }),
61068
+ check.fix && onFix ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.Button, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", onClick: () => onFix(check), children: check.fix.label }) : null
60986
61069
  ] }, i)) });
60987
61070
  }
60988
61071
  function ValueCell({
@@ -60999,16 +61082,16 @@ function ValueCell({
60999
61082
  const fix = onFix ? (check) => onFix({ check, row, field: field2 }) : void 0;
61000
61083
  const id = `section-${row.id}-${field2.key}`;
61001
61084
  const withheld = row.hidden?.[field2.key] ?? null;
61002
- if (withheld) return /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(RecordValue, { field: field2, value: null, withheld });
61085
+ if (withheld) return /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(RecordValue, { field: field2, value: null, withheld });
61003
61086
  if (format?.id === "color_pair") {
61004
61087
  const pair = (0, import_field_formats10.readColorPair)(value) ?? null;
61005
61088
  const contrast = pair ? colorPairContrast(pair, format) : {};
61006
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
61089
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("div", { className: "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
61007
61090
  const side = part === "light" ? pair?.light : pair?.dark ?? void 0;
61008
61091
  const ratio = contrast[part];
61009
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "min-w-0 px-3", children: [
61010
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
61011
- editable ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
61092
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "min-w-0 px-3", children: [
61093
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
61094
+ editable ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
61012
61095
  ColorWell,
61013
61096
  {
61014
61097
  id: `${id}-${part}`,
@@ -61022,10 +61105,10 @@ function ValueCell({
61022
61105
  change(updated.light ? JSON.stringify(updated) : null);
61023
61106
  }
61024
61107
  }
61025
- ) : /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("code", { className: "font-mono text-xs uppercase", children: side ?? (part === "dark" ? "Inherits light" : "\u2014") }),
61026
- ratio !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(ContrastMark, { ratio }) : null
61108
+ ) : /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("code", { className: "font-mono text-xs uppercase", children: side ?? (part === "dark" ? "Inherits light" : "\u2014") }),
61109
+ ratio !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(ContrastMark, { ratio }) : null
61027
61110
  ] }),
61028
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(ChecksLine, { checks: checks.filter((c) => c.part === part), onFix: fix })
61111
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(ChecksLine, { checks: checks.filter((c) => c.part === part), onFix: fix })
61029
61112
  ] }, part);
61030
61113
  }) });
61031
61114
  }
@@ -61033,21 +61116,21 @@ function ValueCell({
61033
61116
  const pictureFirst = format?.id === "type_style" || format?.id === "shadow";
61034
61117
  if (look && pictureFirst) {
61035
61118
  const { Editor, Preview: Preview2 } = look;
61036
- const view = /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(RecordValue, { field: field2, value, withheld: null });
61037
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "min-w-0", children: [
61038
- editable && Editor ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.Popover, { children: [
61039
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("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__ */ (0, import_jsx_runtime198.jsx)("span", { className: "text-muted-foreground", children: "Set" }) : view }) }),
61040
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.PopoverContent, { align: "start", className: "w-80", children: [
61041
- Preview2 ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(Preview2, { value, format }) }) : null,
61042
- Editor ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(Editor, { value, format, onChange: change, id, label: fieldName(field2) }) : null
61119
+ const view = /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(RecordValue, { field: field2, value, withheld: null });
61120
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "min-w-0", children: [
61121
+ editable && Editor ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.Popover, { children: [
61122
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("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__ */ (0, import_jsx_runtime199.jsx)("span", { className: "text-muted-foreground", children: "Set" }) : view }) }),
61123
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.PopoverContent, { align: "start", className: "w-80", children: [
61124
+ Preview2 ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(Preview2, { value, format }) }) : null,
61125
+ Editor ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(Editor, { value, format, onChange: change, id, label: fieldName(field2) }) : null
61043
61126
  ] })
61044
61127
  ] }) : view,
61045
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(ChecksLine, { checks, onFix: fix })
61128
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(ChecksLine, { checks, onFix: fix })
61046
61129
  ] });
61047
61130
  }
61048
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "min-w-0", children: [
61049
- editable ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(FieldControl, { field: field2, value, onChange: change, id, recordId: row.id }) : /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(RecordValue, { field: field2, value, withheld: null }),
61050
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(ChecksLine, { checks, onFix: fix })
61131
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "min-w-0", children: [
61132
+ editable ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(FieldControl, { field: field2, value, onChange: change, id, recordId: row.id }) : /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(RecordValue, { field: field2, value, withheld: null }),
61133
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(ChecksLine, { checks, onFix: fix })
61051
61134
  ] });
61052
61135
  }
61053
61136
  function NoteButton({ row, noteField, editable, save }) {
@@ -61055,8 +61138,8 @@ function NoteButton({ row, noteField, editable, save }) {
61055
61138
  const [value, change] = useDraft(stored, (next) => save(noteField, next));
61056
61139
  const text = typeof value === "string" ? value : "";
61057
61140
  const has = text.trim() !== "";
61058
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.Popover, { children: [
61059
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
61141
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.Popover, { children: [
61142
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
61060
61143
  "button",
61061
61144
  {
61062
61145
  type: "button",
@@ -61066,10 +61149,10 @@ function NoteButton({ row, noteField, editable, save }) {
61066
61149
  "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",
61067
61150
  has ? "text-foreground" : "text-muted-foreground"
61068
61151
  ),
61069
- children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_icons2.StickyNoteIcon, { className: "h-4 w-4" })
61152
+ children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_icons2.StickyNoteIcon, { className: "h-4 w-4" })
61070
61153
  }
61071
61154
  ) }),
61072
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.PopoverContent, { align: "end", className: "w-72", children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
61155
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.PopoverContent, { align: "end", className: "w-72", children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
61073
61156
  import_design_system175.BasicTextarea,
61074
61157
  {
61075
61158
  "aria-label": fieldName(noteField),
@@ -61103,13 +61186,13 @@ function AddDialog({
61103
61186
  }
61104
61187
  return out;
61105
61188
  };
61106
- const [data, setData] = (0, import_react346.useState)(starters);
61107
- const [name, setName] = (0, import_react346.useState)("");
61108
- const [group, setGroup] = (0, import_react346.useState)(startGroup);
61109
- const [newGroup, setNewGroup] = (0, import_react346.useState)("");
61110
- const [note, setNote] = (0, import_react346.useState)("");
61111
- const [busy, setBusy] = (0, import_react346.useState)(false);
61112
- const [seenOpen, setSeenOpen] = (0, import_react346.useState)(open);
61189
+ const [data, setData] = (0, import_react347.useState)(starters);
61190
+ const [name, setName] = (0, import_react347.useState)("");
61191
+ const [group, setGroup] = (0, import_react347.useState)(startGroup);
61192
+ const [newGroup, setNewGroup] = (0, import_react347.useState)("");
61193
+ const [note, setNote] = (0, import_react347.useState)("");
61194
+ const [busy, setBusy] = (0, import_react347.useState)(false);
61195
+ const [seenOpen, setSeenOpen] = (0, import_react347.useState)(open);
61113
61196
  if (seenOpen !== open) {
61114
61197
  setSeenOpen(open);
61115
61198
  if (open) {
@@ -61127,12 +61210,12 @@ function AddDialog({
61127
61210
  const ready = !busy && name.trim() !== "" && (!groupField || group !== "__new" || newGroup.trim() !== "");
61128
61211
  const rowCls = "grid grid-cols-[6.5rem_1fr] items-start gap-3";
61129
61212
  const labelCls = "pt-2 text-sm text-muted-foreground";
61130
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.DialogContent, { className: "max-w-md", children: [
61131
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.DialogTitle, { children: [
61213
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.DialogContent, { className: "max-w-md", children: [
61214
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.DialogTitle, { children: [
61132
61215
  "New ",
61133
61216
  noun
61134
61217
  ] }) }),
61135
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(
61218
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(
61136
61219
  "form",
61137
61220
  {
61138
61221
  className: "flex flex-col gap-3",
@@ -61148,40 +61231,40 @@ function AddDialog({
61148
61231
  if (ok) onOpenChange(false);
61149
61232
  },
61150
61233
  children: [
61151
- preview ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { children: preview }) : null,
61152
- groupField ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: rowCls, children: [
61153
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { className: labelCls, children: fieldName(groupField) }),
61154
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "flex flex-col gap-2", children: [
61155
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.Select, { value: group === UNGROUPED ? "__none" : group, onValueChange: (v) => setGroup(v === "__none" ? UNGROUPED : v), children: [
61156
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.SelectTrigger, { "aria-label": fieldName(groupField), children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.SelectValue, {}) }),
61157
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.SelectContent, { children: [
61158
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.SelectItem, { value: "__none", children: "None" }),
61159
- groups.filter((g) => g !== UNGROUPED).map((g) => /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.SelectItem, { value: g, children: g }, g)),
61160
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.SelectItem, { value: "__new", children: [
61234
+ preview ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("div", { children: preview }) : null,
61235
+ groupField ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: rowCls, children: [
61236
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: labelCls, children: fieldName(groupField) }),
61237
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "flex flex-col gap-2", children: [
61238
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.Select, { value: group === UNGROUPED ? "__none" : group, onValueChange: (v) => setGroup(v === "__none" ? UNGROUPED : v), children: [
61239
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.SelectTrigger, { "aria-label": fieldName(groupField), children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.SelectValue, {}) }),
61240
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.SelectContent, { children: [
61241
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.SelectItem, { value: "__none", children: "None" }),
61242
+ groups.filter((g) => g !== UNGROUPED).map((g) => /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.SelectItem, { value: g, children: g }, g)),
61243
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.SelectItem, { value: "__new", children: [
61161
61244
  "New ",
61162
61245
  fieldName(groupField).toLowerCase(),
61163
61246
  "\u2026"
61164
61247
  ] })
61165
61248
  ] })
61166
61249
  ] }),
61167
- group === "__new" ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.BasicInput, { "aria-label": `New ${fieldName(groupField).toLowerCase()} name`, placeholder: "e.g. Display", value: newGroup, onChange: (e) => setNewGroup(e.target.value) }) : null
61250
+ group === "__new" ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.BasicInput, { "aria-label": `New ${fieldName(groupField).toLowerCase()} name`, placeholder: "e.g. Display", value: newGroup, onChange: (e) => setNewGroup(e.target.value) }) : null
61168
61251
  ] })
61169
61252
  ] }) : null,
61170
- nameField ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: rowCls, children: [
61171
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("label", { htmlFor: "section-add-name", className: labelCls, children: fieldName(nameField) }),
61172
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.BasicInput, { id: "section-add-name", className: "font-mono", autoFocus: true, value: name, onChange: (e) => setName(e.target.value) })
61253
+ nameField ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: rowCls, children: [
61254
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("label", { htmlFor: "section-add-name", className: labelCls, children: fieldName(nameField) }),
61255
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.BasicInput, { id: "section-add-name", className: "font-mono", autoFocus: true, value: name, onChange: (e) => setName(e.target.value) })
61173
61256
  ] }) : null,
61174
- values.map((field2) => /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: rowCls, children: [
61175
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("label", { htmlFor: `section-add-${field2.key}`, className: labelCls, children: fieldName(field2) }),
61176
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(FieldControl, { field: field2, value: data[field2.key] ?? null, onChange: (v) => setData((d) => ({ ...d, [field2.key]: v })), id: `section-add-${field2.key}`, asForm: true })
61257
+ values.map((field2) => /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: rowCls, children: [
61258
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("label", { htmlFor: `section-add-${field2.key}`, className: labelCls, children: fieldName(field2) }),
61259
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(FieldControl, { field: field2, value: data[field2.key] ?? null, onChange: (v) => setData((d) => ({ ...d, [field2.key]: v })), id: `section-add-${field2.key}`, asForm: true })
61177
61260
  ] }, field2.key)),
61178
- noteField ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: rowCls, children: [
61179
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("label", { htmlFor: "section-add-note", className: labelCls, children: fieldName(noteField) }),
61180
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.BasicTextarea, { 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) })
61261
+ noteField ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: rowCls, children: [
61262
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("label", { htmlFor: "section-add-note", className: labelCls, children: fieldName(noteField) }),
61263
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.BasicTextarea, { 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) })
61181
61264
  ] }) : null,
61182
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "flex justify-end gap-2 pt-1", children: [
61183
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.Button, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: "Cancel" }),
61184
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.Button, { type: "submit", disabled: !ready, children: "Add" })
61265
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "flex justify-end gap-2 pt-1", children: [
61266
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.Button, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: "Cancel" }),
61267
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.Button, { type: "submit", disabled: !ready, children: "Add" })
61185
61268
  ] })
61186
61269
  ]
61187
61270
  }
@@ -61190,12 +61273,12 @@ function AddDialog({
61190
61273
  }
61191
61274
  function SectionCard(props) {
61192
61275
  const { tableId, readOnly, noun = "entry", onFix, className } = props;
61193
- const table = (0, import_react347.useTable)(tableId);
61194
- const fieldsRead = (0, import_react347.useFields)(tableId);
61195
- const page = (0, import_react347.useRecordPage)(tableId, { pageSize: 200 });
61196
- const mutation = (0, import_react347.useRecordMutation)();
61197
- const [adding, setAdding] = (0, import_react346.useState)(null);
61198
- const [failed, setFailed] = (0, import_react346.useState)(null);
61276
+ const table = (0, import_react348.useTable)(tableId);
61277
+ const fieldsRead = (0, import_react348.useFields)(tableId);
61278
+ const page = (0, import_react348.useRecordPage)(tableId, { pageSize: 200 });
61279
+ const mutation = (0, import_react348.useRecordMutation)();
61280
+ const [adding, setAdding] = (0, import_react347.useState)(null);
61281
+ const [failed, setFailed] = (0, import_react347.useState)(null);
61199
61282
  const fields = fieldsRead.data ?? [];
61200
61283
  const cols = sectionColumns(fields, table.data?.title_field, props);
61201
61284
  const nameField = fields.find((f) => f.key === cols.name);
@@ -61216,65 +61299,65 @@ function SectionCard(props) {
61216
61299
  const total = page.data?.total ?? null;
61217
61300
  const refused = table.error ?? fieldsRead.error ?? page.error;
61218
61301
  const gridStyle = { gridTemplateColumns: `minmax(8rem, 12rem) repeat(${Math.max(columns.length, 1)}, minmax(0, 1fr)) 2.5rem` };
61219
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("section", { "data-records-section-card": "", className: (0, import_design_system175.cn)("rounded-2xl border border-border bg-card text-card-foreground", className), children: [
61220
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("header", { className: "flex items-start justify-between gap-4 px-6 pt-6 pb-4 sm:px-8 sm:pt-8", children: [
61221
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "min-w-0", children: [
61222
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("h2", { className: "truncate font-serif text-3xl tracking-tight text-foreground", children: title || "\xA0" }),
61223
- props.description ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("p", { className: "mt-2 max-w-prose text-sm text-muted-foreground", children: props.description }) : null
61302
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("section", { "data-records-section-card": "", className: (0, import_design_system175.cn)("rounded-2xl border border-border bg-card text-card-foreground", className), children: [
61303
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("header", { className: "flex items-start justify-between gap-4 px-6 pt-6 pb-4 sm:px-8 sm:pt-8", children: [
61304
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "min-w-0", children: [
61305
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("h2", { className: "truncate font-serif text-3xl tracking-tight text-foreground", children: title || "\xA0" }),
61306
+ props.description ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("p", { className: "mt-2 max-w-prose text-sm text-muted-foreground", children: props.description }) : null
61224
61307
  ] }),
61225
- mayWrite && nameField ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.Button, { type: "button", variant: "outline", size: "sm", onClick: () => setAdding(groups[groups.length - 1]?.key ?? UNGROUPED), children: [
61226
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_icons2.PlusIcon, { className: "h-3.5 w-3.5" }),
61308
+ mayWrite && nameField ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.Button, { type: "button", variant: "outline", size: "sm", onClick: () => setAdding(groups[groups.length - 1]?.key ?? UNGROUPED), children: [
61309
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_icons2.PlusIcon, { className: "h-3.5 w-3.5" }),
61227
61310
  "Add"
61228
61311
  ] }) : null
61229
61312
  ] }),
61230
- refused ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("p", { className: "px-6 pb-6 text-sm text-muted-foreground sm:px-8", children: refusalSentence(refused) }) : page.loading && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "flex flex-col gap-2 px-6 pb-6 sm:px-8", "aria-busy": "true", children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "h-12 rounded-md bg-muted" }, i)) }) : rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("p", { className: "px-6 pb-8 text-sm text-muted-foreground sm:px-8", children: "Nothing here yet." }) : /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "overflow-x-auto pb-4", children: groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { "data-records-section-group": group.key, className: "mb-6 last:mb-0", children: [
61231
- cols.group ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "flex items-center justify-between border-b border-border px-6 py-2.5 sm:px-8", children: [
61232
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { className: "text-sm font-medium text-foreground", children: group.key || "No group" }),
61233
- mayWrite ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
61313
+ refused ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("p", { className: "px-6 pb-6 text-sm text-muted-foreground sm:px-8", children: refusalSentence(refused) }) : page.loading && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("div", { className: "flex flex-col gap-2 px-6 pb-6 sm:px-8", "aria-busy": "true", children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("div", { className: "h-12 rounded-md bg-muted" }, i)) }) : rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("p", { className: "px-6 pb-8 text-sm text-muted-foreground sm:px-8", children: "Nothing here yet." }) : /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("div", { className: "overflow-x-auto pb-4", children: groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { "data-records-section-group": group.key, className: "mb-6 last:mb-0", children: [
61314
+ cols.group ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "flex items-center justify-between border-b border-border px-6 py-2.5 sm:px-8", children: [
61315
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: "text-sm font-medium text-foreground", children: group.key || "No group" }),
61316
+ mayWrite ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
61234
61317
  "button",
61235
61318
  {
61236
61319
  type: "button",
61237
61320
  "aria-label": `Add to ${group.key || "no group"}`,
61238
61321
  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",
61239
61322
  onClick: () => setAdding(group.key),
61240
- children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_icons2.PlusIcon, { className: "h-4 w-4" })
61323
+ children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_icons2.PlusIcon, { className: "h-4 w-4" })
61241
61324
  }
61242
61325
  ) : null
61243
61326
  ] }) : null,
61244
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { role: "table", "aria-label": group.key || title, className: "min-w-[36rem]", children: [
61245
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { role: "row", style: gridStyle, className: "grid border-b border-border text-sm text-muted-foreground", children: [
61246
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { role: "columnheader", className: "border-r border-border px-6 py-3 sm:px-8", children: nameField ? fieldName(nameField) : "Name" }),
61247
- columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { role: "columnheader", className: "truncate px-3 py-3", children: c.header }, `${c.field.key}-${c.part ?? ""}`)),
61248
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", {})
61327
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { role: "table", "aria-label": group.key || title, className: "min-w-[36rem]", children: [
61328
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { role: "row", style: gridStyle, className: "grid border-b border-border text-sm text-muted-foreground", children: [
61329
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { role: "columnheader", className: "border-r border-border px-6 py-3 sm:px-8", children: nameField ? fieldName(nameField) : "Name" }),
61330
+ columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { role: "columnheader", className: "truncate px-3 py-3", children: c.header }, `${c.field.key}-${c.part ?? ""}`)),
61331
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", {})
61249
61332
  ] }),
61250
61333
  group.rows.map((row) => {
61251
61334
  const editable = mayWrite && (0, import_field_kinds9.atLeast)(row.level, "edit_content");
61252
61335
  const rowSave = save(row);
61253
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { role: "row", "data-records-section-row": row.id, style: gridStyle, className: "grid items-center border-b border-border last:border-b-0", children: [
61254
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("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 }),
61255
- cells.map((c) => /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
61336
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { role: "row", "data-records-section-row": row.id, style: gridStyle, className: "grid items-center border-b border-border last:border-b-0", children: [
61337
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("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 }),
61338
+ cells.map((c) => /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
61256
61339
  "div",
61257
61340
  {
61258
61341
  role: "cell",
61259
61342
  style: c.part ? { gridColumn: "span 2" } : void 0,
61260
61343
  className: (0, import_design_system175.cn)("min-w-0 py-2.5", c.part ? "" : "px-3"),
61261
- children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(ValueCell, { row, column: c, editable, save: rowSave, onFix })
61344
+ children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(ValueCell, { row, column: c, editable, save: rowSave, onFix })
61262
61345
  },
61263
61346
  c.field.key
61264
61347
  )),
61265
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { role: "cell", className: "flex justify-center pr-2", children: noteField ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(NoteButton, { row, noteField, editable, save: rowSave }) : null })
61348
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { role: "cell", className: "flex justify-center pr-2", children: noteField ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(NoteButton, { row, noteField, editable, save: rowSave }) : null })
61266
61349
  ] }, row.id);
61267
61350
  })
61268
61351
  ] })
61269
61352
  ] }, group.key || "__ungrouped")) }),
61270
- total !== null && total > rows.length ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("p", { className: "px-6 pb-4 text-sm text-muted-foreground sm:px-8", children: [
61353
+ total !== null && total > rows.length ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("p", { className: "px-6 pb-4 text-sm text-muted-foreground sm:px-8", children: [
61271
61354
  "Showing ",
61272
61355
  rows.length,
61273
61356
  " of ",
61274
61357
  total
61275
61358
  ] }) : null,
61276
- failed ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("p", { className: "px-6 pb-4 text-sm text-warning-ink sm:px-8", children: mutation.error ? refusalSentence(mutation.error) : failed }) : null,
61277
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
61359
+ failed ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("p", { className: "px-6 pb-4 text-sm text-warning-ink sm:px-8", children: mutation.error ? refusalSentence(mutation.error) : failed }) : null,
61360
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
61278
61361
  AddDialog,
61279
61362
  {
61280
61363
  open: adding !== null,