@ai-matrx/records-ui 0.103.6 → 0.103.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/pickers.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  // src/TablePickers.tsx
4
- import { useEffect as useEffect12, useMemo as useMemo7, useState as useState16 } from "react";
4
+ import { useEffect as useEffect12, useMemo as useMemo7, useState as useState17 } from "react";
5
5
  import { RecordsProvider as RecordsProvider2, useFields, useRecords, useTable } from "@ai-matrx/records/react";
6
6
  import { Button as Button8, CreatablePicker } from "@ai-matrx/design-system";
7
7
 
@@ -40,7 +40,7 @@ function fieldOptionsOnce(client, fieldId) {
40
40
  }
41
41
 
42
42
  // src/editors.tsx
43
- import { useCallback as useCallback5, useEffect as useEffect10, useLayoutEffect, useRef as useRef11, useState as useState14 } from "react";
43
+ import { useCallback as useCallback5, useEffect as useEffect10, useLayoutEffect as useLayoutEffect2, useRef as useRef12, useState as useState15 } from "react";
44
44
  import { allowsOtherValues, choiceValuesOf, coerceTypedAnswer, newerKindOf as newerKindOf4, decideTypedChoice, isTheChosen, optionKey as optionKey2, rankTypedMatches as rankTypedMatches3, readTypedTime as readTypedTime2, typedDateText as typedDateText2, typedTimeText as typedTimeText2 } from "@ai-matrx/records";
45
45
  import { useOptionalRecordsClient as useOptionalRecordsClient7 } from "@ai-matrx/records/react";
46
46
  import {
@@ -2679,6 +2679,70 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
2679
2679
  ] });
2680
2680
  }
2681
2681
 
2682
+ // src/FloatingRefusal.tsx
2683
+ import { useLayoutEffect, useRef as useRef9, useState as useState11 } from "react";
2684
+ import { createPortal } from "react-dom";
2685
+ import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
2686
+ var GAP = 4;
2687
+ function placeFor(anchor, note) {
2688
+ const a = anchor.getBoundingClientRect();
2689
+ const inGrid = anchor.closest("td") !== null;
2690
+ const height = note?.offsetHeight ?? 20;
2691
+ const width = note?.offsetWidth ?? 0;
2692
+ if (inGrid) {
2693
+ const above = a.top - GAP - height;
2694
+ const top = above >= 0 ? above : a.bottom + GAP;
2695
+ const left = Math.max(GAP, Math.min(a.left, window.innerWidth - width - GAP));
2696
+ return { position: "fixed", top, left };
2697
+ }
2698
+ return { position: "fixed", top: a.top + (a.height - height) / 2, left: Math.max(a.left, a.right - width - 8) };
2699
+ }
2700
+ function FloatingRefusal({ text, why }) {
2701
+ const spot = useRef9(null);
2702
+ const note = useRef9(null);
2703
+ const [style, setStyle] = useState11(null);
2704
+ const [floating, setFloating] = useState11(false);
2705
+ useLayoutEffect(() => {
2706
+ const here = spot.current;
2707
+ if (!here) return;
2708
+ const anchor = here.closest("[data-matrx-cell-editor]");
2709
+ setFloating(anchor !== null);
2710
+ if (!anchor) return;
2711
+ const place = () => setStyle(placeFor(anchor, note.current));
2712
+ place();
2713
+ const frame = requestAnimationFrame(place);
2714
+ window.addEventListener("scroll", place, true);
2715
+ window.addEventListener("resize", place);
2716
+ return () => {
2717
+ cancelAnimationFrame(frame);
2718
+ window.removeEventListener("scroll", place, true);
2719
+ window.removeEventListener("resize", place);
2720
+ };
2721
+ }, [text]);
2722
+ if (!floating) {
2723
+ return /* @__PURE__ */ jsx14("span", { ref: spot, "data-records-typed-refusal": "", role: "status", title: why, className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: text });
2724
+ }
2725
+ return /* @__PURE__ */ jsxs12(Fragment5, { children: [
2726
+ /* @__PURE__ */ jsx14("span", { ref: spot, "data-records-refusal-anchor": "", hidden: true }),
2727
+ typeof document === "undefined" ? null : createPortal(
2728
+ /* @__PURE__ */ jsx14(
2729
+ "span",
2730
+ {
2731
+ ref: note,
2732
+ "data-records-typed-refusal": "",
2733
+ "data-records-floating-refusal": "",
2734
+ role: "status",
2735
+ title: why,
2736
+ style: { ...style ?? { position: "fixed", top: -9999, left: -9999 }, zIndex: 60 },
2737
+ className: "pointer-events-none w-max max-w-[24rem] rounded-md border bg-popover px-1.5 py-0.5 text-[11px] leading-snug text-amber-700 shadow-md dark:text-amber-400",
2738
+ children: text
2739
+ }
2740
+ ),
2741
+ document.body
2742
+ )
2743
+ ] });
2744
+ }
2745
+
2682
2746
  // src/presentation.ts
2683
2747
  import {
2684
2748
  COLOR_ROTATION,
@@ -2746,16 +2810,16 @@ function currencyCodeFor(unit) {
2746
2810
  }
2747
2811
 
2748
2812
  // src/formatControls.tsx
2749
- import { useEffect as useEffect8, useRef as useRef10, useState as useState11 } from "react";
2813
+ import { useEffect as useEffect8, useRef as useRef11, useState as useState12 } from "react";
2750
2814
  import { BasicInput as BasicInput4, BasicTextarea } from "@ai-matrx/design-system";
2751
2815
  import { getFieldFormat as getFieldFormat3, parseFieldInput } from "@ai-matrx/design-system/field-formats";
2752
2816
 
2753
2817
  // src/formattedValue.tsx
2754
- import { useRef as useRef9 } from "react";
2818
+ import { useRef as useRef10 } from "react";
2755
2819
  import { FormattedCell } from "@ai-matrx/design-system/data-table";
2756
2820
  import { formatFieldValue as formatFieldValue2, formatPhone, getFieldFormat as getFieldFormat2 } from "@ai-matrx/design-system/field-formats";
2757
2821
  import { cn as cn11 } from "@ai-matrx/design-system";
2758
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
2822
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
2759
2823
  var LINK = "inline-flex min-w-0 items-center gap-1 text-primary hover:underline";
2760
2824
  var own2 = (event) => event.stopPropagation();
2761
2825
  function numberOf(value) {
@@ -2773,11 +2837,11 @@ function RatingStars({
2773
2837
  label,
2774
2838
  selectFirst
2775
2839
  }) {
2776
- const armed = useRef9(true);
2840
+ const armed = useRef10(true);
2777
2841
  const score = numberOf(value) ?? 0;
2778
2842
  const shown2 = Math.round(score);
2779
2843
  const said = `${shown2} out of ${max}`;
2780
- return /* @__PURE__ */ jsx14(
2844
+ return /* @__PURE__ */ jsx15(
2781
2845
  "span",
2782
2846
  {
2783
2847
  "data-records-rating": "",
@@ -2789,8 +2853,8 @@ function RatingStars({
2789
2853
  children: Array.from({ length: max }, (_, i) => {
2790
2854
  const n = i + 1;
2791
2855
  const lit = n <= shown2;
2792
- const star = /* @__PURE__ */ jsx14("span", { "aria-hidden": true, className: cn11("text-sm leading-none", lit ? "text-amber-400" : "text-muted-foreground/40"), children: "\u2605" });
2793
- return onRate ? /* @__PURE__ */ jsx14(
2856
+ const star = /* @__PURE__ */ jsx15("span", { "aria-hidden": true, className: cn11("text-sm leading-none", lit ? "text-amber-400" : "text-muted-foreground/40"), children: "\u2605" });
2857
+ return onRate ? /* @__PURE__ */ jsx15(
2794
2858
  "button",
2795
2859
  {
2796
2860
  type: "button",
@@ -2815,7 +2879,7 @@ function RatingStars({
2815
2879
  children: star
2816
2880
  },
2817
2881
  n
2818
- ) : /* @__PURE__ */ jsx14("span", { children: star }, n);
2882
+ ) : /* @__PURE__ */ jsx15("span", { children: star }, n);
2819
2883
  })
2820
2884
  }
2821
2885
  );
@@ -2823,13 +2887,13 @@ function RatingStars({
2823
2887
  function rich(id, text, raw, format) {
2824
2888
  switch (id) {
2825
2889
  case "email":
2826
- return /* @__PURE__ */ jsx14("a", { href: `mailto:${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ jsx14("span", { className: "truncate", children: text }) });
2890
+ return /* @__PURE__ */ jsx15("a", { href: `mailto:${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ jsx15("span", { className: "truncate", children: text }) });
2827
2891
  case "url":
2828
- return /* @__PURE__ */ jsx14("a", { href: text.includes("://") ? text : `https://${text}`, target: "_blank", rel: "noopener noreferrer", className: LINK, onClick: own2, children: /* @__PURE__ */ jsx14("span", { className: "truncate", children: text }) });
2892
+ return /* @__PURE__ */ jsx15("a", { href: text.includes("://") ? text : `https://${text}`, target: "_blank", rel: "noopener noreferrer", className: LINK, onClick: own2, children: /* @__PURE__ */ jsx15("span", { className: "truncate", children: text }) });
2829
2893
  case "phone":
2830
- return /* @__PURE__ */ jsx14("a", { href: `tel:${text.replace(/[^\d+]/g, "")}`, className: LINK, onClick: own2, title: text, children: /* @__PURE__ */ jsx14("span", { className: "truncate tabular-nums", children: formatPhone(text) }) });
2894
+ return /* @__PURE__ */ jsx15("a", { href: `tel:${text.replace(/[^\d+]/g, "")}`, className: LINK, onClick: own2, title: text, children: /* @__PURE__ */ jsx15("span", { className: "truncate tabular-nums", children: formatPhone(text) }) });
2831
2895
  case "address":
2832
- return /* @__PURE__ */ jsx14(
2896
+ return /* @__PURE__ */ jsx15(
2833
2897
  "a",
2834
2898
  {
2835
2899
  href: `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(text)}`,
@@ -2838,7 +2902,7 @@ function rich(id, text, raw, format) {
2838
2902
  className: LINK,
2839
2903
  title: "Open in maps",
2840
2904
  onClick: own2,
2841
- children: /* @__PURE__ */ jsx14("span", { className: "truncate", children: text })
2905
+ children: /* @__PURE__ */ jsx15("span", { className: "truncate", children: text })
2842
2906
  }
2843
2907
  );
2844
2908
  case "progress": {
@@ -2846,8 +2910,8 @@ function rich(id, text, raw, format) {
2846
2910
  if (n === null) return void 0;
2847
2911
  const pct = format.options?.percentScale === "fraction" ? n * 100 : n;
2848
2912
  const clamped = Math.max(0, Math.min(100, pct));
2849
- return /* @__PURE__ */ jsxs12("span", { className: "inline-flex w-full min-w-0 items-center gap-2", title: text, children: [
2850
- /* @__PURE__ */ jsx14(
2913
+ return /* @__PURE__ */ jsxs13("span", { className: "inline-flex w-full min-w-0 items-center gap-2", title: text, children: [
2914
+ /* @__PURE__ */ jsx15(
2851
2915
  "span",
2852
2916
  {
2853
2917
  role: "progressbar",
@@ -2855,24 +2919,24 @@ function rich(id, text, raw, format) {
2855
2919
  "aria-valuemax": 100,
2856
2920
  "aria-valuenow": Math.round(clamped),
2857
2921
  className: "h-1.5 min-w-8 flex-1 overflow-hidden rounded-full bg-muted",
2858
- children: /* @__PURE__ */ jsx14("span", { className: cn11("block h-full rounded-full", pct >= 100 ? "bg-emerald-500" : "bg-primary"), style: { width: `${clamped}%` } })
2922
+ children: /* @__PURE__ */ jsx15("span", { className: cn11("block h-full rounded-full", pct >= 100 ? "bg-emerald-500" : "bg-primary"), style: { width: `${clamped}%` } })
2859
2923
  }
2860
2924
  ),
2861
- /* @__PURE__ */ jsx14("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: text })
2925
+ /* @__PURE__ */ jsx15("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: text })
2862
2926
  ] });
2863
2927
  }
2864
2928
  case "color":
2865
- return /* @__PURE__ */ jsxs12("span", { className: "inline-flex items-center gap-1.5", children: [
2866
- /* @__PURE__ */ jsx14("span", { className: "h-4 w-4 shrink-0 rounded border border-border", style: { backgroundColor: text } }),
2867
- /* @__PURE__ */ jsx14("code", { className: "font-mono text-xs", children: text })
2929
+ return /* @__PURE__ */ jsxs13("span", { className: "inline-flex items-center gap-1.5", children: [
2930
+ /* @__PURE__ */ jsx15("span", { className: "h-4 w-4 shrink-0 rounded border border-border", style: { backgroundColor: text } }),
2931
+ /* @__PURE__ */ jsx15("code", { className: "font-mono text-xs", children: text })
2868
2932
  ] });
2869
2933
  case "tags": {
2870
2934
  const items = Array.isArray(raw) ? raw.map(String) : text.split(",").map((s) => s.trim()).filter(Boolean);
2871
2935
  if (items.length === 0) return void 0;
2872
- return /* @__PURE__ */ jsx14("span", { className: "flex flex-wrap items-center gap-1", children: items.map((item, i) => /* @__PURE__ */ jsx14("span", { className: "inline-flex items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs", children: item }, `${item}-${i}`)) });
2936
+ return /* @__PURE__ */ jsx15("span", { className: "flex flex-wrap items-center gap-1", children: items.map((item, i) => /* @__PURE__ */ jsx15("span", { className: "inline-flex items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs", children: item }, `${item}-${i}`)) });
2873
2937
  }
2874
2938
  case "rating":
2875
- return numberOf(raw) === null ? void 0 : /* @__PURE__ */ jsx14(RatingStars, { value: raw, max: format.options?.ratingMax ?? 5 });
2939
+ return numberOf(raw) === null ? void 0 : /* @__PURE__ */ jsx15(RatingStars, { value: raw, max: format.options?.ratingMax ?? 5 });
2876
2940
  default:
2877
2941
  return void 0;
2878
2942
  }
@@ -2887,11 +2951,11 @@ function FormattedValue({
2887
2951
  const score = numberOf(value);
2888
2952
  const max = format.options?.ratingMax ?? 5;
2889
2953
  if (def?.id === "rating" && onRate && (value === null || value === void 0 || value === "" || score !== null && score >= 0 && score <= max)) {
2890
- return /* @__PURE__ */ jsx14(RatingStars, { value, max: format.options?.ratingMax ?? 5, onRate, selectFirst });
2954
+ return /* @__PURE__ */ jsx15(RatingStars, { value, max: format.options?.ratingMax ?? 5, onRate, selectFirst });
2891
2955
  }
2892
2956
  const result = formatFieldValue2(value, format);
2893
- if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ jsx14(FormattedCell, { result });
2894
- return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ jsx14(FormattedCell, { result });
2957
+ if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ jsx15(FormattedCell, { result });
2958
+ return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ jsx15(FormattedCell, { result });
2895
2959
  }
2896
2960
  function linkChipText(raw) {
2897
2961
  try {
@@ -2905,7 +2969,7 @@ function linkChipText(raw) {
2905
2969
  }
2906
2970
 
2907
2971
  // src/formatControls.tsx
2908
- import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
2972
+ import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
2909
2973
  var TYPED_NUMBERS = /* @__PURE__ */ new Set(["currency", "percent", "progress", "decimal", "duration", "file_size", "integer"]);
2910
2974
  function scaled(format) {
2911
2975
  return (format.id === "percent" || format.id === "progress") && format.options?.percentScale === "fraction";
@@ -2922,13 +2986,13 @@ function keptValue(format, raw) {
2922
2986
  return parsed;
2923
2987
  }
2924
2988
  function NumberInFormat({ format, value, onChange, disabled, id }) {
2925
- const [text, setText] = useState11(() => typedText(format, value));
2926
- const lastSent = useRef10(void 0);
2989
+ const [text, setText] = useState12(() => typedText(format, value));
2990
+ const lastSent = useRef11(void 0);
2927
2991
  useEffect8(() => {
2928
2992
  if (value === lastSent.current) return;
2929
2993
  setText(typedText(format, value));
2930
2994
  }, [value, format]);
2931
- return /* @__PURE__ */ jsx15(
2995
+ return /* @__PURE__ */ jsx16(
2932
2996
  BasicInput4,
2933
2997
  {
2934
2998
  id,
@@ -2953,16 +3017,16 @@ function formatControl(args) {
2953
3017
  const text = value === null || value === void 0 ? "" : String(value);
2954
3018
  const commit = (raw) => onChange(raw === "" ? null : parseFieldInput(raw, format));
2955
3019
  if (def.id === "rating") {
2956
- return disabled ? /* @__PURE__ */ jsx15(RatingStars, { value, max: format.options?.ratingMax ?? 5, label }) : /* @__PURE__ */ jsx15("span", { id, className: "inline-flex", children: /* @__PURE__ */ jsx15(RatingStars, { value, max: format.options?.ratingMax ?? 5, label, onRate: (n) => onChange(n) }) });
3020
+ return disabled ? /* @__PURE__ */ jsx16(RatingStars, { value, max: format.options?.ratingMax ?? 5, label }) : /* @__PURE__ */ jsx16("span", { id, className: "inline-flex", children: /* @__PURE__ */ jsx16(RatingStars, { value, max: format.options?.ratingMax ?? 5, label, onRate: (n) => onChange(n) }) });
2957
3021
  }
2958
- if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */ jsx15(NumberInFormat, { ...args });
3022
+ if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */ jsx16(NumberInFormat, { ...args });
2959
3023
  switch (def.editor) {
2960
3024
  // A TIME OF DAY is not this file's: `FieldControl` draws the typed box and its helper
2961
3025
  // (`TypedWordsControl`), never the browser's time control (grids review 3, 2026-09-30).
2962
3026
  case "email":
2963
3027
  case "url":
2964
3028
  case "tel":
2965
- return /* @__PURE__ */ jsx15(
3029
+ return /* @__PURE__ */ jsx16(
2966
3030
  BasicInput4,
2967
3031
  {
2968
3032
  id,
@@ -2974,8 +3038,8 @@ function formatControl(args) {
2974
3038
  }
2975
3039
  );
2976
3040
  case "color":
2977
- return /* @__PURE__ */ jsxs13("span", { className: "flex items-center gap-2", children: [
2978
- /* @__PURE__ */ jsx15(
3041
+ return /* @__PURE__ */ jsxs14("span", { className: "flex items-center gap-2", children: [
3042
+ /* @__PURE__ */ jsx16(
2979
3043
  BasicInput4,
2980
3044
  {
2981
3045
  id: `${id}-swatch`,
@@ -2987,20 +3051,20 @@ function formatControl(args) {
2987
3051
  onChange: (e) => commit(e.target.value)
2988
3052
  }
2989
3053
  ),
2990
- /* @__PURE__ */ jsx15(BasicInput4, { id, value: text, placeholder: "#3b82f6", disabled, onChange: (e) => commit(e.target.value) })
3054
+ /* @__PURE__ */ jsx16(BasicInput4, { id, value: text, placeholder: "#3b82f6", disabled, onChange: (e) => commit(e.target.value) })
2991
3055
  ] });
2992
3056
  case "textarea":
2993
- return /* @__PURE__ */ jsx15(BasicTextarea, { id, rows: 4, value: text, disabled, onChange: (e) => commit(e.target.value) });
3057
+ return /* @__PURE__ */ jsx16(BasicTextarea, { id, rows: 4, value: text, disabled, onChange: (e) => commit(e.target.value) });
2994
3058
  default:
2995
3059
  return null;
2996
3060
  }
2997
3061
  }
2998
3062
 
2999
3063
  // src/typedDateHelper.tsx
3000
- import { useState as useState12 } from "react";
3064
+ import { useState as useState13 } from "react";
3001
3065
  import { Popover as Popover2, PopoverContent as PopoverContent2, PopoverTrigger as PopoverTrigger2, cn as cn12 } from "@ai-matrx/design-system";
3002
3066
  import { readTypedDate, readTypedTime, typedDateText, typedTimeText } from "@ai-matrx/records";
3003
- import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
3067
+ import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
3004
3068
  var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
3005
3069
  var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
3006
3070
  function pad(n) {
@@ -3029,15 +3093,15 @@ function wordsFor(kind, day, time) {
3029
3093
  }
3030
3094
  var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
3031
3095
  function CalendarGlyph() {
3032
- return /* @__PURE__ */ jsxs14("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3033
- /* @__PURE__ */ jsx16("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
3034
- /* @__PURE__ */ jsx16("path", { d: "M16 2v4M8 2v4M3 10h18" })
3096
+ return /* @__PURE__ */ jsxs15("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3097
+ /* @__PURE__ */ jsx17("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
3098
+ /* @__PURE__ */ jsx17("path", { d: "M16 2v4M8 2v4M3 10h18" })
3035
3099
  ] });
3036
3100
  }
3037
3101
  function ClockGlyph() {
3038
- return /* @__PURE__ */ jsxs14("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3039
- /* @__PURE__ */ jsx16("circle", { cx: "12", cy: "12", r: "10" }),
3040
- /* @__PURE__ */ jsx16("path", { d: "M12 6v6l4 2" })
3102
+ return /* @__PURE__ */ jsxs15("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3103
+ /* @__PURE__ */ jsx17("circle", { cx: "12", cy: "12", r: "10" }),
3104
+ /* @__PURE__ */ jsx17("path", { d: "M12 6v6l4 2" })
3041
3105
  ] });
3042
3106
  }
3043
3107
  function TypedDateHelper({
@@ -3047,11 +3111,11 @@ function TypedDateHelper({
3047
3111
  label,
3048
3112
  onPicked
3049
3113
  }) {
3050
- const [open, setOpen] = useState12(false);
3114
+ const [open, setOpen] = useState13(false);
3051
3115
  const held = readBox(text, kind);
3052
3116
  const today = /* @__PURE__ */ new Date();
3053
3117
  const start = held.day ? new Date(Number(held.day.slice(0, 4)), Number(held.day.slice(5, 7)) - 1, 1) : new Date(today.getFullYear(), today.getMonth(), 1);
3054
- const [month, setMonth] = useState12(null);
3118
+ const [month, setMonth] = useState13(null);
3055
3119
  const shown2 = month ?? { y: start.getFullYear(), m: start.getMonth() };
3056
3120
  const first = new Date(shown2.y, shown2.m, 1).getDay();
3057
3121
  const days = new Date(shown2.y, shown2.m + 1, 0).getDate();
@@ -3076,8 +3140,8 @@ function TypedDateHelper({
3076
3140
  const at = new Date(shown2.y, shown2.m + by, 1);
3077
3141
  setMonth({ y: at.getFullYear(), m: at.getMonth() });
3078
3142
  };
3079
- return /* @__PURE__ */ jsxs14(Popover2, { open, onOpenChange: setOpen, children: [
3080
- /* @__PURE__ */ jsx16(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx16(
3143
+ return /* @__PURE__ */ jsxs15(Popover2, { open, onOpenChange: setOpen, children: [
3144
+ /* @__PURE__ */ jsx17(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx17(
3081
3145
  "button",
3082
3146
  {
3083
3147
  type: "button",
@@ -3086,10 +3150,10 @@ function TypedDateHelper({
3086
3150
  "aria-label": kind === "time" ? `Pick a time for ${label}` : `Pick a date for ${label}`,
3087
3151
  title: kind === "time" ? "Pick a time" : "Pick a date",
3088
3152
  className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground",
3089
- children: kind === "time" ? /* @__PURE__ */ jsx16(ClockGlyph, {}) : /* @__PURE__ */ jsx16(CalendarGlyph, {})
3153
+ children: kind === "time" ? /* @__PURE__ */ jsx17(ClockGlyph, {}) : /* @__PURE__ */ jsx17(CalendarGlyph, {})
3090
3154
  }
3091
3155
  ) }),
3092
- /* @__PURE__ */ jsx16(
3156
+ /* @__PURE__ */ jsx17(
3093
3157
  PopoverContent2,
3094
3158
  {
3095
3159
  sizing: "content",
@@ -3099,23 +3163,23 @@ function TypedDateHelper({
3099
3163
  "data-records-date-helper-panel": "",
3100
3164
  onOpenAutoFocus: (e) => e.preventDefault(),
3101
3165
  onCloseAutoFocus: (e) => e.preventDefault(),
3102
- children: /* @__PURE__ */ jsxs14("div", { className: "flex gap-2", children: [
3103
- kind === "time" ? null : /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-1", role: "grid", "aria-label": `${MONTHS[shown2.m]} ${shown2.y}`, children: [
3104
- /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between text-xs font-medium", children: [
3105
- /* @__PURE__ */ jsx16("button", { type: "button", ...keepFocus, "aria-label": "Previous month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(-1), children: "\u2039" }),
3106
- /* @__PURE__ */ jsxs14("span", { children: [
3166
+ children: /* @__PURE__ */ jsxs15("div", { className: "flex gap-2", children: [
3167
+ kind === "time" ? null : /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", role: "grid", "aria-label": `${MONTHS[shown2.m]} ${shown2.y}`, children: [
3168
+ /* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between text-xs font-medium", children: [
3169
+ /* @__PURE__ */ jsx17("button", { type: "button", ...keepFocus, "aria-label": "Previous month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(-1), children: "\u2039" }),
3170
+ /* @__PURE__ */ jsxs15("span", { children: [
3107
3171
  MONTHS[shown2.m],
3108
3172
  " ",
3109
3173
  shown2.y
3110
3174
  ] }),
3111
- /* @__PURE__ */ jsx16("button", { type: "button", ...keepFocus, "aria-label": "Next month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(1), children: "\u203A" })
3175
+ /* @__PURE__ */ jsx17("button", { type: "button", ...keepFocus, "aria-label": "Next month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(1), children: "\u203A" })
3112
3176
  ] }),
3113
- /* @__PURE__ */ jsxs14("div", { className: "grid grid-cols-7 gap-0.5 text-center text-[11px]", children: [
3114
- WEEK.map((w) => /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: w }, w)),
3177
+ /* @__PURE__ */ jsxs15("div", { className: "grid grid-cols-7 gap-0.5 text-center text-[11px]", children: [
3178
+ WEEK.map((w) => /* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: w }, w)),
3115
3179
  cells.map((d, i) => {
3116
- if (d === null) return /* @__PURE__ */ jsx16("span", {}, `blank-${i}`);
3180
+ if (d === null) return /* @__PURE__ */ jsx17("span", {}, `blank-${i}`);
3117
3181
  const key = `${shown2.y}-${pad(shown2.m + 1)}-${pad(d)}`;
3118
- return /* @__PURE__ */ jsx16(
3182
+ return /* @__PURE__ */ jsx17(
3119
3183
  "button",
3120
3184
  {
3121
3185
  type: "button",
@@ -3134,7 +3198,7 @@ function TypedDateHelper({
3134
3198
  })
3135
3199
  ] })
3136
3200
  ] }),
3137
- kind === "date" ? null : /* @__PURE__ */ jsx16("div", { className: "flex max-h-48 flex-col overflow-y-auto pr-1 text-[11px]", "aria-label": "Times", children: times.map((t) => /* @__PURE__ */ jsx16(
3201
+ kind === "date" ? null : /* @__PURE__ */ jsx17("div", { className: "flex max-h-48 flex-col overflow-y-auto pr-1 text-[11px]", "aria-label": "Times", children: times.map((t) => /* @__PURE__ */ jsx17(
3138
3202
  "button",
3139
3203
  {
3140
3204
  type: "button",
@@ -3156,7 +3220,7 @@ function TypedDateHelper({
3156
3220
  }
3157
3221
 
3158
3222
  // src/choiceNudge.ts
3159
- import { useEffect as useEffect9, useState as useState13 } from "react";
3223
+ import { useEffect as useEffect9, useState as useState14 } from "react";
3160
3224
  import { useOptionalRecordsClient as useOptionalRecordsClient6 } from "@ai-matrx/records/react";
3161
3225
  var asked2 = /* @__PURE__ */ new WeakMap();
3162
3226
  function choiceNudgeOf(client) {
@@ -3172,7 +3236,7 @@ function choiceNudgeOf(client) {
3172
3236
  }
3173
3237
  function useChoiceNudge(enabled = true) {
3174
3238
  const client = useOptionalRecordsClient6();
3175
- const [nudge, setNudge] = useState13(null);
3239
+ const [nudge, setNudge] = useState14(null);
3176
3240
  useEffect9(() => {
3177
3241
  if (!enabled || !client) return;
3178
3242
  let live = true;
@@ -3188,7 +3252,7 @@ function useChoiceNudge(enabled = true) {
3188
3252
  }
3189
3253
 
3190
3254
  // src/editors.tsx
3191
- import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
3255
+ import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
3192
3256
  var CHOICE_EDITOR_ADDS_WHAT_IS_TYPED = true;
3193
3257
  function isChoiceAddition(value) {
3194
3258
  return typeof value === "object" && value !== null && value.addingChoices === true;
@@ -3218,12 +3282,12 @@ function ChoiceAskButtons({
3218
3282
  onCancel,
3219
3283
  busy
3220
3284
  }) {
3221
- return /* @__PURE__ */ jsxs15("span", { "data-records-choice-ask": "", "data-records-cell-note": "", role: "group", "aria-label": choiceAskSentence(field, words), className: "flex flex-col gap-1", children: [
3222
- /* @__PURE__ */ jsx17("span", { className: "text-[11px] leading-snug", children: choiceAskSentence(field, words) }),
3223
- /* @__PURE__ */ jsxs15("span", { className: "flex flex-wrap items-center gap-1", children: [
3224
- /* @__PURE__ */ jsx17(Button7, { type: "button", size: "sm", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onAdd, children: "Add" }),
3225
- keepOffered ? /* @__PURE__ */ jsx17(Button7, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onKeep, children: "Keep as typed" }) : null,
3226
- /* @__PURE__ */ jsx17(Button7, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onCancel, children: "Cancel" })
3285
+ return /* @__PURE__ */ jsxs16("span", { "data-records-choice-ask": "", "data-records-cell-note": "", role: "group", "aria-label": choiceAskSentence(field, words), className: "flex flex-col gap-1", children: [
3286
+ /* @__PURE__ */ jsx18("span", { className: "text-[11px] leading-snug", children: choiceAskSentence(field, words) }),
3287
+ /* @__PURE__ */ jsxs16("span", { className: "flex flex-wrap items-center gap-1", children: [
3288
+ /* @__PURE__ */ jsx18(Button7, { type: "button", size: "sm", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onAdd, children: "Add" }),
3289
+ keepOffered ? /* @__PURE__ */ jsx18(Button7, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onKeep, children: "Keep as typed" }) : null,
3290
+ /* @__PURE__ */ jsx18(Button7, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onCancel, children: "Cancel" })
3227
3291
  ] })
3228
3292
  ] });
3229
3293
  }
@@ -3324,22 +3388,22 @@ function openingText(field, value) {
3324
3388
  return format ? typedText(format, value) : String(value);
3325
3389
  }
3326
3390
  function ReadsAsNote({ typed, always, children }) {
3327
- const note = useRef11(null);
3328
- const [repeats, setRepeats] = useState14(false);
3329
- useLayoutEffect(() => {
3391
+ const note = useRef12(null);
3392
+ const [repeats, setRepeats] = useState15(false);
3393
+ useLayoutEffect2(() => {
3330
3394
  if (always) return;
3331
3395
  const words = (t) => (t ?? "").replace(/^Reads as/, "").replace(/\s+/g, "").toLowerCase();
3332
3396
  setRepeats(words(note.current?.textContent) === words(typed));
3333
3397
  }, [typed, always]);
3334
3398
  if (repeats) return null;
3335
- return /* @__PURE__ */ jsx17("span", { ref: note, "data-records-typed-reads-as": "", "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children });
3399
+ return /* @__PURE__ */ jsx18("span", { ref: note, "data-records-typed-reads-as": "", "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children });
3336
3400
  }
3337
3401
  function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCancel }) {
3338
3402
  const client = useOptionalRecordsClient7();
3339
3403
  const kind = String(editorKindFor(field));
3340
3404
  const needsChoices = kind === "select" || kind === "multi_select";
3341
3405
  const nudge = useChoiceNudge(needsChoices);
3342
- const [choices, setChoices] = useState14(null);
3406
+ const [choices, setChoices] = useState15(null);
3343
3407
  useEffect10(() => {
3344
3408
  if (!needsChoices || !client) return;
3345
3409
  let cancelled = false;
@@ -3362,7 +3426,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
3362
3426
  judged: judgeTyped(field, text, needsChoices ? choices : void 0, needsChoices ? nudge : void 0),
3363
3427
  ...value.openedAs !== void 0 ? { openedAs: value.openedAs } : {}
3364
3428
  });
3365
- const box = /* @__PURE__ */ jsx17(
3429
+ const box = /* @__PURE__ */ jsx18(
3366
3430
  BasicInput5,
3367
3431
  {
3368
3432
  id,
@@ -3374,16 +3438,16 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
3374
3438
  onChange: (e) => retype(e.target.value)
3375
3439
  }
3376
3440
  );
3377
- return /* @__PURE__ */ jsxs15("span", { className: "flex flex-col gap-0.5", children: [
3378
- helper && !disabled ? /* @__PURE__ */ jsxs15("span", { className: "flex min-w-0 items-center gap-0.5", children: [
3441
+ return /* @__PURE__ */ jsxs16("span", { className: "flex flex-col gap-0.5", children: [
3442
+ helper && !disabled ? /* @__PURE__ */ jsxs16("span", { className: "flex min-w-0 items-center gap-0.5", children: [
3379
3443
  box,
3380
- /* @__PURE__ */ jsx17(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field), onPicked: onCommit })
3444
+ /* @__PURE__ */ jsx18(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field), onPicked: onCommit })
3381
3445
  ] }) : box,
3382
- judged === null ? /* @__PURE__ */ jsxs15("span", { "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children: [
3446
+ judged === null ? /* @__PURE__ */ jsxs16("span", { "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children: [
3383
3447
  "Reading ",
3384
3448
  fieldName(field),
3385
3449
  "'s choices\u2026"
3386
- ] }) : "ask" in judged ? /* @__PURE__ */ jsx17(
3450
+ ] }) : "ask" in judged ? /* @__PURE__ */ jsx18(
3387
3451
  ChoiceAskButtons,
3388
3452
  {
3389
3453
  field,
@@ -3399,19 +3463,10 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
3399
3463
  },
3400
3464
  onCancel: () => onCancel?.()
3401
3465
  }
3402
- ) : "refusal" in judged ? /* @__PURE__ */ jsxs15("span", { "data-records-cell-note": "", className: "flex flex-col gap-1", children: [
3403
- /* @__PURE__ */ jsx17(
3404
- "span",
3405
- {
3406
- "data-records-typed-refusal": "",
3407
- role: "status",
3408
- title: "why" in judged ? judged.why : void 0,
3409
- className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400",
3410
- children: judged.refusal
3411
- }
3412
- ),
3413
- judged.cancelOnly && onCancel ? /* @__PURE__ */ jsx17("span", { "data-records-choice-ask": "", children: /* @__PURE__ */ jsx17(Button7, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onCancel(), children: "Cancel" }) }) : null
3414
- ] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ jsxs15(ReadsAsNote, { typed: value.text, always: isChoiceAddition(judged.value), children: [
3466
+ ) : "refusal" in judged ? /* @__PURE__ */ jsxs16(Fragment6, { children: [
3467
+ /* @__PURE__ */ jsx18(FloatingRefusal, { text: judged.refusal, why: "why" in judged ? judged.why : void 0 }),
3468
+ judged.cancelOnly && onCancel ? /* @__PURE__ */ jsx18("span", { "data-records-cell-note": "", "data-records-choice-ask": "", children: /* @__PURE__ */ jsx18(Button7, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onCancel(), children: "Cancel" }) }) : null
3469
+ ] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ jsxs16(ReadsAsNote, { typed: value.text, always: isChoiceAddition(judged.value), children: [
3415
3470
  isChoiceAddition(judged.value) ? `Adds ${quoted(judged.value.add)} to the choices for ${fieldName(field)}. ` : null,
3416
3471
  "Reads as",
3417
3472
  " ",
@@ -3422,7 +3477,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
3422
3477
  }).join(", ")
3423
3478
  ) : (() => {
3424
3479
  const shown2 = format ?? (kind === "datetime" ? { id: carriesTimeOfDay(field, judged.value) ? "datetime" : "date" } : void 0);
3425
- return shown2 ? /* @__PURE__ */ jsx17(FormattedValue, { value: judged.value, format: shown2 }) : String(judged.value);
3480
+ return shown2 ? /* @__PURE__ */ jsx18(FormattedValue, { value: judged.value, format: shown2 }) : String(judged.value);
3426
3481
  })()
3427
3482
  ] }, value.text)
3428
3483
  ] });
@@ -3436,12 +3491,12 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3436
3491
  const kind = editorKindFor(field);
3437
3492
  const inputId = id ?? `field-${field.key}`;
3438
3493
  const ownDetails = useOptionalRecordsClient7() === null;
3439
- if (isTypedDraft(value)) return /* @__PURE__ */ jsx17(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
3440
- if (isSignatureField(field)) return /* @__PURE__ */ jsx17(SignaturePad, { id: inputId, value, onChange, disabled });
3494
+ if (isTypedDraft(value)) return /* @__PURE__ */ jsx18(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
3495
+ if (isSignatureField(field)) return /* @__PURE__ */ jsx18(SignaturePad, { id: inputId, value, onChange, disabled });
3441
3496
  const newerControl = newerKindControl({ field, value, onChange, disabled, id: inputId });
3442
3497
  if (newerControl !== void 0) return newerControl;
3443
3498
  const format = formatForField(field);
3444
- if (format && format.id === "time") return /* @__PURE__ */ jsx17(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
3499
+ if (format && format.id === "time") return /* @__PURE__ */ jsx18(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
3445
3500
  if (format && !FORMAT_BLIND_KINDS.has(String(kind))) {
3446
3501
  const own3 = formatControl({ format, value, onChange, disabled, id: inputId, label: fieldName(field), ownDetails });
3447
3502
  if (own3) return own3;
@@ -3450,17 +3505,17 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3450
3505
  case "formula":
3451
3506
  case "lookup":
3452
3507
  case "rollup":
3453
- return /* @__PURE__ */ jsxs15("div", { id: inputId, className: "rounded border border-dashed px-2 py-1.5 text-xs text-muted-foreground", children: [
3508
+ return /* @__PURE__ */ jsxs16("div", { id: inputId, className: "rounded border border-dashed px-2 py-1.5 text-xs text-muted-foreground", children: [
3454
3509
  value === null || value === void 0 ? "\u2014" : String(value),
3455
- /* @__PURE__ */ jsxs15("span", { className: "ml-2 italic", children: [
3510
+ /* @__PURE__ */ jsxs16("span", { className: "ml-2 italic", children: [
3456
3511
  fieldName(field),
3457
3512
  " is worked out by the system, so it cannot be typed in"
3458
3513
  ] })
3459
3514
  ] });
3460
3515
  case "json":
3461
- return /* @__PURE__ */ jsx17(JsonControl, { field, value, onChange, disabled, id: inputId });
3516
+ return /* @__PURE__ */ jsx18(JsonControl, { field, value, onChange, disabled, id: inputId });
3462
3517
  case "long_text":
3463
- return /* @__PURE__ */ jsx17(
3518
+ return /* @__PURE__ */ jsx18(
3464
3519
  BasicTextarea2,
3465
3520
  {
3466
3521
  id: inputId,
@@ -3473,7 +3528,7 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3473
3528
  case "number":
3474
3529
  case "currency":
3475
3530
  case "percent":
3476
- return /* @__PURE__ */ jsx17(
3531
+ return /* @__PURE__ */ jsx18(
3477
3532
  BasicInput5,
3478
3533
  {
3479
3534
  id: inputId,
@@ -3486,11 +3541,11 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3486
3541
  }
3487
3542
  );
3488
3543
  case "datetime":
3489
- return /* @__PURE__ */ jsx17(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
3544
+ return /* @__PURE__ */ jsx18(TypedWordsControl, { field, value, onChange, disabled, id: inputId });
3490
3545
  case "email":
3491
3546
  case "phone":
3492
3547
  case "url":
3493
- return /* @__PURE__ */ jsx17(
3548
+ return /* @__PURE__ */ jsx18(
3494
3549
  BasicInput5,
3495
3550
  {
3496
3551
  id: inputId,
@@ -3502,24 +3557,24 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3502
3557
  }
3503
3558
  );
3504
3559
  case "checkbox":
3505
- return /* @__PURE__ */ jsx17(CheckboxControl, { field, value, onChange, disabled, id: inputId });
3560
+ return /* @__PURE__ */ jsx18(CheckboxControl, { field, value, onChange, disabled, id: inputId });
3506
3561
  case "select":
3507
3562
  case "multi_select":
3508
- return /* @__PURE__ */ jsx17(OptionControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm });
3563
+ return /* @__PURE__ */ jsx18(OptionControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm });
3509
3564
  case "member":
3510
- return /* @__PURE__ */ jsx17(PersonPicker, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
3565
+ return /* @__PURE__ */ jsx18(PersonPicker, { field, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
3511
3566
  case "entity_reference":
3512
- return /* @__PURE__ */ jsx17(EntityReferenceControl, { field, value, onChange, disabled, id: inputId });
3567
+ return /* @__PURE__ */ jsx18(EntityReferenceControl, { field, value, onChange, disabled, id: inputId });
3513
3568
  case "attachment":
3514
3569
  if (hostTakesFiles(host)) {
3515
- return /* @__PURE__ */ jsx17(AttachmentControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose });
3570
+ return /* @__PURE__ */ jsx18(AttachmentControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose });
3516
3571
  }
3517
- return /* @__PURE__ */ jsx17(RelationPicker, { field, value, onChange, disabled, id: inputId });
3572
+ return /* @__PURE__ */ jsx18(RelationPicker, { field, value, onChange, disabled, id: inputId });
3518
3573
  case "relation":
3519
- return /* @__PURE__ */ jsx17(RelationPicker, { field, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel });
3574
+ return /* @__PURE__ */ jsx18(RelationPicker, { field, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel });
3520
3575
  default:
3521
3576
  if (typeof value === "boolean" || field.config?.["kind"] === "boolean") {
3522
- return /* @__PURE__ */ jsx17(
3577
+ return /* @__PURE__ */ jsx18(
3523
3578
  Checkbox,
3524
3579
  {
3525
3580
  id: inputId,
@@ -3529,7 +3584,7 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3529
3584
  }
3530
3585
  );
3531
3586
  }
3532
- return /* @__PURE__ */ jsx17(
3587
+ return /* @__PURE__ */ jsx18(
3533
3588
  BasicInput5,
3534
3589
  {
3535
3590
  id: inputId,
@@ -3542,10 +3597,10 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
3542
3597
  }
3543
3598
  }
3544
3599
  function TypedWordsControl({ field, value, onChange, disabled, id }) {
3545
- const [text, setText] = useState14(() => openingText(field, value));
3546
- const [refusal2, setRefusal] = useState14(null);
3547
- const [why, setWhy] = useState14(void 0);
3548
- const sent = useRef11(value);
3600
+ const [text, setText] = useState15(() => openingText(field, value));
3601
+ const [refusal2, setRefusal] = useState15(null);
3602
+ const [why, setWhy] = useState15(void 0);
3603
+ const sent = useRef12(value);
3549
3604
  useEffect10(() => {
3550
3605
  if (value === sent.current) return;
3551
3606
  sent.current = value;
@@ -3565,9 +3620,9 @@ function TypedWordsControl({ field, value, onChange, disabled, id }) {
3565
3620
  setWhy("why" in judged ? judged.why : void 0);
3566
3621
  }
3567
3622
  };
3568
- return /* @__PURE__ */ jsxs15("span", { className: "flex flex-col gap-0.5", children: [
3569
- /* @__PURE__ */ jsxs15("span", { className: "flex min-w-0 items-center gap-0.5", children: [
3570
- /* @__PURE__ */ jsx17(
3623
+ return /* @__PURE__ */ jsxs16("span", { className: "flex flex-col gap-0.5", children: [
3624
+ /* @__PURE__ */ jsxs16("span", { className: "flex min-w-0 items-center gap-0.5", children: [
3625
+ /* @__PURE__ */ jsx18(
3571
3626
  BasicInput5,
3572
3627
  {
3573
3628
  id,
@@ -3584,9 +3639,9 @@ function TypedWordsControl({ field, value, onChange, disabled, id }) {
3584
3639
  }
3585
3640
  }
3586
3641
  ),
3587
- helper && !disabled ? /* @__PURE__ */ jsx17(TypedDateHelper, { kind: helper, text, onText: retype, label: fieldName(field) }) : null
3642
+ helper && !disabled ? /* @__PURE__ */ jsx18(TypedDateHelper, { kind: helper, text, onText: retype, label: fieldName(field) }) : null
3588
3643
  ] }),
3589
- refusal2 ? /* @__PURE__ */ jsx17("span", { "data-records-typed-refusal": "", "data-records-cell-note": "", role: "status", title: why, className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: refusal2 }) : null
3644
+ refusal2 ? /* @__PURE__ */ jsx18(FloatingRefusal, { text: refusal2, why }) : null
3590
3645
  ] });
3591
3646
  }
3592
3647
  function typedDatePlaceholder(helper) {
@@ -3597,8 +3652,8 @@ function typedDatePlaceholder(helper) {
3597
3652
  }
3598
3653
  function CheckboxControl({ field, value, onChange, disabled, id }) {
3599
3654
  const unanswered = value === null || value === void 0;
3600
- return /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2", children: [
3601
- /* @__PURE__ */ jsx17(
3655
+ return /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
3656
+ /* @__PURE__ */ jsx18(
3602
3657
  Checkbox,
3603
3658
  {
3604
3659
  id,
@@ -3608,9 +3663,9 @@ function CheckboxControl({ field, value, onChange, disabled, id }) {
3608
3663
  onCheckedChange: (next) => onChange(next === true)
3609
3664
  }
3610
3665
  ),
3611
- unanswered ? /* @__PURE__ */ jsx17("span", { className: "text-xs italic text-muted-foreground", children: "not answered yet" }) : /* @__PURE__ */ jsxs15(Fragment5, { children: [
3612
- /* @__PURE__ */ jsx17("span", { className: "text-xs text-muted-foreground", children: value === true ? "Yes" : "No" }),
3613
- field.required ? null : /* @__PURE__ */ jsx17(
3666
+ unanswered ? /* @__PURE__ */ jsx18("span", { className: "text-xs italic text-muted-foreground", children: "not answered yet" }) : /* @__PURE__ */ jsxs16(Fragment6, { children: [
3667
+ /* @__PURE__ */ jsx18("span", { className: "text-xs text-muted-foreground", children: value === true ? "Yes" : "No" }),
3668
+ field.required ? null : /* @__PURE__ */ jsx18(
3614
3669
  Button7,
3615
3670
  {
3616
3671
  size: "sm",
@@ -3626,10 +3681,10 @@ function CheckboxControl({ field, value, onChange, disabled, id }) {
3626
3681
  }
3627
3682
  function JsonControl({ field, value, onChange, disabled, id }) {
3628
3683
  const initial = value === null || value === void 0 ? "" : typeof value === "string" ? value : JSON.stringify(value, null, 2);
3629
- const [text, setText] = useState14(initial);
3630
- const [broken, setBroken] = useState14(null);
3631
- return /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
3632
- /* @__PURE__ */ jsx17(
3684
+ const [text, setText] = useState15(initial);
3685
+ const [broken, setBroken] = useState15(null);
3686
+ return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1", children: [
3687
+ /* @__PURE__ */ jsx18(
3633
3688
  BasicTextarea2,
3634
3689
  {
3635
3690
  id,
@@ -3664,7 +3719,7 @@ function JsonControl({ field, value, onChange, disabled, id }) {
3664
3719
  broken ? (
3665
3720
  // The typed text is still in the box: the notice owns the two doors out. In a grid cell it
3666
3721
  // floats over the table (`data-records-cell-note`), so the row never grows.
3667
- /* @__PURE__ */ jsx17("span", { "data-records-cell-note": "", className: "block", children: /* @__PURE__ */ jsx17(
3722
+ /* @__PURE__ */ jsx18("span", { "data-records-cell-note": "", className: "block", children: /* @__PURE__ */ jsx18(
3668
3723
  RefusalNotice,
3669
3724
  {
3670
3725
  error: broken,
@@ -3689,9 +3744,9 @@ function inTheStoresOrder(options) {
3689
3744
  }
3690
3745
  function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm }) {
3691
3746
  const client = useOptionalRecordsClient7();
3692
- const [options, setOptions] = useState14(null);
3693
- const [refusal2, setRefusal] = useState14(null);
3694
- const [reread, setReread] = useState14(0);
3747
+ const [options, setOptions] = useState15(null);
3748
+ const [refusal2, setRefusal] = useState15(null);
3749
+ const [reread, setReread] = useState15(0);
3695
3750
  useEffect10(() => {
3696
3751
  if (!client) return;
3697
3752
  let cancelled = false;
@@ -3706,11 +3761,11 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3706
3761
  }, [client, field.id, reread]);
3707
3762
  const handed = publicChoicesOf(field);
3708
3763
  if (!client && handed.length > 0) {
3709
- return /* @__PURE__ */ jsx17(ChoiceAnswer, { field, choices: handed, value, onChange, disabled, id });
3764
+ return /* @__PURE__ */ jsx18(ChoiceAnswer, { field, choices: handed, value, onChange, disabled, id });
3710
3765
  }
3711
3766
  if (!client) {
3712
- return /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
3713
- /* @__PURE__ */ jsx17(
3767
+ return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1", children: [
3768
+ /* @__PURE__ */ jsx18(
3714
3769
  BasicInput5,
3715
3770
  {
3716
3771
  id,
@@ -3719,15 +3774,15 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3719
3774
  onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
3720
3775
  }
3721
3776
  ),
3722
- /* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground", children: "This is normally picked from a list. A page answered without an account cannot read that list, so type your answer and whoever receives it will match it up." })
3777
+ /* @__PURE__ */ jsx18("p", { className: "text-xs text-muted-foreground", children: "This is normally picked from a list. A page answered without an account cannot read that list, so type your answer and whoever receives it will match it up." })
3723
3778
  ] });
3724
3779
  }
3725
3780
  if (refusal2)
3726
- return /* @__PURE__ */ jsx17("div", { id, children: /* @__PURE__ */ jsx17(RefusalLine, { error: refusal2 }) });
3727
- if (!options) return /* @__PURE__ */ jsx17("p", { id, className: "text-xs text-muted-foreground", children: "Reading this field's choices\u2026" });
3781
+ return /* @__PURE__ */ jsx18("div", { id, children: /* @__PURE__ */ jsx18(RefusalLine, { error: refusal2 }) });
3782
+ if (!options) return /* @__PURE__ */ jsx18("p", { id, className: "text-xs text-muted-foreground", children: "Reading this field's choices\u2026" });
3728
3783
  if (asForm && options.length > 0) {
3729
3784
  const titled = (option) => recordName(option.data, null, "Unnamed choice");
3730
- return /* @__PURE__ */ jsx17(
3785
+ return /* @__PURE__ */ jsx18(
3731
3786
  ChoiceAnswer,
3732
3787
  {
3733
3788
  field,
@@ -3744,7 +3799,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3744
3799
  );
3745
3800
  }
3746
3801
  if (CHOICE_EDITOR_ADDS_WHAT_IS_TYPED) {
3747
- return /* @__PURE__ */ jsx17(
3802
+ return /* @__PURE__ */ jsx18(
3748
3803
  OpenChoicePicker,
3749
3804
  {
3750
3805
  field,
@@ -3767,13 +3822,13 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3767
3822
  );
3768
3823
  }
3769
3824
  if (options.length === 0) {
3770
- return /* @__PURE__ */ jsx17("p", { id, className: "text-xs text-muted-foreground", children: field.options_table_id ? `${fieldName(field)} takes its choices from a Table that has no records yet \u2014 add the choices there and they appear here.` : `${fieldName(field)} does not name the Table its choices come from yet, so there is nothing to choose. A table admin sets it in the field editor.` });
3825
+ return /* @__PURE__ */ jsx18("p", { id, className: "text-xs text-muted-foreground", children: field.options_table_id ? `${fieldName(field)} takes its choices from a Table that has no records yet \u2014 add the choices there and they appear here.` : `${fieldName(field)} does not name the Table its choices come from yet, so there is nothing to choose. A table admin sets it in the field editor.` });
3771
3826
  }
3772
3827
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
3773
3828
  if (field.multi) {
3774
3829
  const chosen = options.filter((option) => choiceValuesOf(value).some((v) => isTheChosen(option, v)));
3775
3830
  const picked = new Set(chosen.map((option) => optionKey2(option)));
3776
- const toggles = /* @__PURE__ */ jsx17("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ jsx17(
3831
+ const toggles = /* @__PURE__ */ jsx18("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ jsx18(
3777
3832
  Button7,
3778
3833
  {
3779
3834
  type: "button",
@@ -3791,7 +3846,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3791
3846
  option.id
3792
3847
  )) });
3793
3848
  if (!autoOpen) return toggles;
3794
- return /* @__PURE__ */ jsxs15(
3849
+ return /* @__PURE__ */ jsxs16(
3795
3850
  Popover3,
3796
3851
  {
3797
3852
  defaultOpen: true,
@@ -3799,14 +3854,14 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3799
3854
  if (!open) onClose?.();
3800
3855
  },
3801
3856
  children: [
3802
- /* @__PURE__ */ jsx17(PopoverTrigger3, { asChild: true, children: /* @__PURE__ */ jsx17(Button7, { id, type: "button", size: "sm", variant: "outline", className: "h-6 max-w-full truncate", children: chosen.length === 0 ? "Choose" : chosen.map(titleOf).join(", ") }) }),
3803
- /* @__PURE__ */ jsx17(PopoverContent3, { sizing: "content", className: "max-w-[20rem] p-2", align: "start", children: toggles })
3857
+ /* @__PURE__ */ jsx18(PopoverTrigger3, { asChild: true, children: /* @__PURE__ */ jsx18(Button7, { id, type: "button", size: "sm", variant: "outline", className: "h-6 max-w-full truncate", children: chosen.length === 0 ? "Choose" : chosen.map(titleOf).join(", ") }) }),
3858
+ /* @__PURE__ */ jsx18(PopoverContent3, { sizing: "content", className: "max-w-[20rem] p-2", align: "start", children: toggles })
3804
3859
  ]
3805
3860
  }
3806
3861
  );
3807
3862
  }
3808
3863
  const current = options.find((option) => isTheChosen(option, value));
3809
- return /* @__PURE__ */ jsxs15(
3864
+ return /* @__PURE__ */ jsxs16(
3810
3865
  Select2,
3811
3866
  {
3812
3867
  value: current ? optionKey2(current) : "",
@@ -3820,8 +3875,8 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
3820
3875
  }
3821
3876
  } : {},
3822
3877
  children: [
3823
- /* @__PURE__ */ jsx17(SelectTrigger2, { id, size: "sm", children: /* @__PURE__ */ jsx17(SelectValue2, { placeholder: "Choose" }) }),
3824
- /* @__PURE__ */ jsx17(SelectContent2, { children: options.map((option) => /* @__PURE__ */ jsx17(SelectItem2, { value: optionKey2(option), children: titleOf(option) }, option.id)) })
3878
+ /* @__PURE__ */ jsx18(SelectTrigger2, { id, size: "sm", children: /* @__PURE__ */ jsx18(SelectValue2, { placeholder: "Choose" }) }),
3879
+ /* @__PURE__ */ jsx18(SelectContent2, { children: options.map((option) => /* @__PURE__ */ jsx18(SelectItem2, { value: optionKey2(option), children: titleOf(option) }, option.id)) })
3825
3880
  ]
3826
3881
  }
3827
3882
  );
@@ -3843,16 +3898,16 @@ function OpenChoicePicker({
3843
3898
  }) {
3844
3899
  const client = useOptionalRecordsClient7();
3845
3900
  const nudge = useChoiceNudge();
3846
- const [open, setOpenState] = useState14(autoOpen === true);
3847
- const onCloseRef = useRef11(onClose);
3901
+ const [open, setOpenState] = useState15(autoOpen === true);
3902
+ const onCloseRef = useRef12(onClose);
3848
3903
  onCloseRef.current = onClose;
3849
3904
  const setOpen = useCallback5((next) => {
3850
3905
  setOpenState(next);
3851
3906
  if (!next) onCloseRef.current?.();
3852
3907
  }, []);
3853
- const [search, setSearch] = useState14(initialSearch ?? "");
3854
- const [adding, setAdding] = useState14(false);
3855
- const [addRefused, setAddRefused] = useState14(null);
3908
+ const [search, setSearch] = useState15(initialSearch ?? "");
3909
+ const [adding, setAdding] = useState15(false);
3910
+ const [addRefused, setAddRefused] = useState15(null);
3856
3911
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
3857
3912
  const held = withoutAddition(value);
3858
3913
  const current = choiceValuesOf(held.value);
@@ -3910,7 +3965,7 @@ function OpenChoicePicker({
3910
3965
  const pickedOptions = current.map((v) => options.find((o) => isTheChosen(o, v)));
3911
3966
  const cellChips = pickedWords.map((word, i) => {
3912
3967
  const chip = chipOf(pickedOptions[i], word);
3913
- return /* @__PURE__ */ jsx17(Badge3, { variant: "outline", className: cn13("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
3968
+ return /* @__PURE__ */ jsx18(Badge3, { variant: "outline", className: cn13("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
3914
3969
  });
3915
3970
  const headChips = pickedWords.map((word, i) => {
3916
3971
  const option = pickedOptions[i];
@@ -3925,12 +3980,12 @@ function OpenChoicePicker({
3925
3980
  };
3926
3981
  });
3927
3982
  const anchored = autoOpen === true;
3928
- return /* @__PURE__ */ jsxs15("div", { id, className: "flex flex-wrap items-center gap-1", children: [
3983
+ return /* @__PURE__ */ jsxs16("div", { id, className: "flex flex-wrap items-center gap-1", children: [
3929
3984
  anchored || disabled ? null : cellChips,
3930
3985
  disabled ? cellChips : (
3931
3986
  // THE ONE "PICK OR ADD" BUILDER (PickOrAdd.tsx) — the relation picker draws the same one.
3932
3987
  // In a grid cell it hangs from the cell's own chips; no button is drawn in the cell.
3933
- /* @__PURE__ */ jsx17(
3988
+ /* @__PURE__ */ jsx18(
3934
3989
  PickOrAdd,
3935
3990
  {
3936
3991
  anchored,
@@ -3956,14 +4011,14 @@ function OpenChoicePicker({
3956
4011
  const option = options.find((o) => o.id === optionId);
3957
4012
  if (option) choose(optionKey2(option));
3958
4013
  },
3959
- empty: q === "" ? /* @__PURE__ */ jsx17("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
4014
+ empty: q === "" ? /* @__PURE__ */ jsx18("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
3960
4015
  add,
3961
4016
  foot,
3962
- footNote: addRefused ? /* @__PURE__ */ jsx17(RefusalLine, { error: addRefused }) : offList && decided.decision === "not_a_choice" ? (
4017
+ footNote: addRefused ? /* @__PURE__ */ jsx18(RefusalLine, { error: addRefused }) : offList && decided.decision === "not_a_choice" ? (
3963
4018
  // never_add on a column that takes only its choices: said, never a silent nothing.
3964
- /* @__PURE__ */ jsxs15(Fragment5, { children: [
3965
- /* @__PURE__ */ jsx17("p", { "data-records-typed-refusal": "", className: "p-2 text-xs text-muted-foreground", children: notAChoiceSentence(field, [q]) }),
3966
- autoOpen ? /* @__PURE__ */ jsx17("span", { "data-records-choice-ask": "", className: "px-2 pb-1", children: /* @__PURE__ */ jsx17(Button7, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => setOpen(false), children: "Cancel" }) }) : null
4019
+ /* @__PURE__ */ jsxs16(Fragment6, { children: [
4020
+ /* @__PURE__ */ jsx18("p", { "data-records-typed-refusal": "", className: "p-2 text-xs text-muted-foreground", children: notAChoiceSentence(field, [q]) }),
4021
+ autoOpen ? /* @__PURE__ */ jsx18("span", { "data-records-choice-ask": "", className: "px-2 pb-1", children: /* @__PURE__ */ jsx18(Button7, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => setOpen(false), children: "Cancel" }) }) : null
3967
4022
  ] })
3968
4023
  ) : null,
3969
4024
  children: anchored ? cellChips : null
@@ -3983,9 +4038,9 @@ function RecordChip({
3983
4038
  // name. So it caps at its container and ends in an ellipsis with the whole name in
3984
4039
  // its tooltip, rather than being cut mid-word by whatever box it landed in
3985
4040
  // (lane FIX-14, 2026-09-22).
3986
- /* @__PURE__ */ jsxs15(Badge3, { variant: "secondary", className: cn13("max-w-full gap-1 text-[11px]", className), title, children: [
3987
- /* @__PURE__ */ jsx17("span", { className: "min-w-0 truncate", children: title }),
3988
- onRemove ? /* @__PURE__ */ jsx17("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${title}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
4041
+ /* @__PURE__ */ jsxs16(Badge3, { variant: "secondary", className: cn13("max-w-full gap-1 text-[11px]", className), title, children: [
4042
+ /* @__PURE__ */ jsx18("span", { className: "min-w-0 truncate", children: title }),
4043
+ onRemove ? /* @__PURE__ */ jsx18("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${title}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
3989
4044
  ] })
3990
4045
  );
3991
4046
  }
@@ -4008,7 +4063,7 @@ function ChoiceAnswer({
4008
4063
  id,
4009
4064
  isChosen
4010
4065
  }) {
4011
- const [search, setSearch] = useState14("");
4066
+ const [search, setSearch] = useState15("");
4012
4067
  const held = field.multi ? choiceValuesOf(value) : value === null || value === void 0 || value === "" ? [] : [value];
4013
4068
  const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
4014
4069
  const press = (choice) => {
@@ -4023,7 +4078,7 @@ function ChoiceAnswer({
4023
4078
  const option = (choice) => {
4024
4079
  const chosen = on(choice);
4025
4080
  const letter = lettered ? CHOICE_LETTERS[choices.indexOf(choice)] : null;
4026
- return /* @__PURE__ */ jsxs15(
4081
+ return /* @__PURE__ */ jsxs16(
4027
4082
  "button",
4028
4083
  {
4029
4084
  type: "button",
@@ -4038,7 +4093,7 @@ function ChoiceAnswer({
4038
4093
  chosen ? "border-primary bg-primary/10" : "border-primary/30 bg-primary/[0.03] hover:bg-primary/10"
4039
4094
  ),
4040
4095
  children: [
4041
- letter ? /* @__PURE__ */ jsx17(
4096
+ letter ? /* @__PURE__ */ jsx18(
4042
4097
  "kbd",
4043
4098
  {
4044
4099
  "aria-hidden": "true",
@@ -4049,8 +4104,8 @@ function ChoiceAnswer({
4049
4104
  children: letter
4050
4105
  }
4051
4106
  ) : null,
4052
- /* @__PURE__ */ jsx17("span", { className: "min-w-0 flex-1 break-words", children: choice.label }),
4053
- chosen ? /* @__PURE__ */ jsx17("span", { "aria-hidden": "true", className: "shrink-0 text-primary", children: "\u2713" }) : null
4107
+ /* @__PURE__ */ jsx18("span", { className: "min-w-0 flex-1 break-words", children: choice.label }),
4108
+ chosen ? /* @__PURE__ */ jsx18("span", { "aria-hidden": "true", className: "shrink-0 text-primary", children: "\u2713" }) : null
4054
4109
  ]
4055
4110
  },
4056
4111
  choice.key
@@ -4066,12 +4121,12 @@ function ChoiceAnswer({
4066
4121
  };
4067
4122
  const group = { role: field.multi ? "group" : "radiogroup", "aria-label": fieldName(field), onKeyDown };
4068
4123
  if (choices.length <= FORM_SEARCH_AFTER) {
4069
- return /* @__PURE__ */ jsx17("div", { id, className: "flex w-full flex-col gap-2", ...group, children: choices.map(option) });
4124
+ return /* @__PURE__ */ jsx18("div", { id, className: "flex w-full flex-col gap-2", ...group, children: choices.map(option) });
4070
4125
  }
4071
4126
  const q = search.trim().toLowerCase();
4072
4127
  const shown2 = q === "" ? choices : choices.filter((c) => c.label.toLowerCase().includes(q));
4073
- return /* @__PURE__ */ jsxs15("div", { id, className: "flex w-full flex-col gap-2", onKeyDown, children: [
4074
- /* @__PURE__ */ jsx17(
4128
+ return /* @__PURE__ */ jsxs16("div", { id, className: "flex w-full flex-col gap-2", onKeyDown, children: [
4129
+ /* @__PURE__ */ jsx18(
4075
4130
  BasicInput5,
4076
4131
  {
4077
4132
  value: search,
@@ -4082,27 +4137,27 @@ function ChoiceAnswer({
4082
4137
  className: "h-11 text-base sm:h-9 sm:text-sm"
4083
4138
  }
4084
4139
  ),
4085
- /* @__PURE__ */ jsxs15("div", { className: "flex max-h-80 w-full flex-col gap-2 overflow-y-auto", role: group.role, "aria-label": group["aria-label"], children: [
4140
+ /* @__PURE__ */ jsxs16("div", { className: "flex max-h-80 w-full flex-col gap-2 overflow-y-auto", role: group.role, "aria-label": group["aria-label"], children: [
4086
4141
  shown2.map(option),
4087
- shown2.length === 0 ? /* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground", children: "No match" }) : null
4142
+ shown2.length === 0 ? /* @__PURE__ */ jsx18("p", { className: "text-xs text-muted-foreground", children: "No match" }) : null
4088
4143
  ] })
4089
4144
  ] });
4090
4145
  }
4091
4146
 
4092
4147
  // src/RecordsMount.tsx
4093
- import { useRef as useRef12 } from "react";
4148
+ import { useRef as useRef13 } from "react";
4094
4149
  import { RecordsProvider } from "@ai-matrx/records/react";
4095
- import { jsx as jsx18 } from "react/jsx-runtime";
4150
+ import { jsx as jsx19 } from "react/jsx-runtime";
4096
4151
  function personActor(userId) {
4097
4152
  return userId ? { actor: "user", user_id: userId } : { actor: "user" };
4098
4153
  }
4099
4154
 
4100
4155
  // src/tablePicking.tsx
4101
- import { useCallback as useCallback6, useEffect as useEffect11, useMemo as useMemo6, useState as useState15 } from "react";
4156
+ import { useCallback as useCallback6, useEffect as useEffect11, useMemo as useMemo6, useState as useState16 } from "react";
4102
4157
  import { withTablePlacement } from "@ai-matrx/records";
4103
4158
  import { useRecordsClient as useRecordsClient2, useTables } from "@ai-matrx/records/react";
4104
4159
  import { Checkbox as Checkbox2, cn as cn14 } from "@ai-matrx/design-system";
4105
- import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
4160
+ import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
4106
4161
  var APP_TABLE_PREFIX = "records_ui_";
4107
4162
  function isValueSet(table) {
4108
4163
  if (table.kept_for === "choices") return true;
@@ -4145,7 +4200,7 @@ function madeOn(stamp) {
4145
4200
  }
4146
4201
 
4147
4202
  // src/TablePickers.tsx
4148
- import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
4203
+ import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
4149
4204
  var SHARED_FOR_MS = 5e3;
4150
4205
  var sharedReads = /* @__PURE__ */ new WeakMap();
4151
4206
  function readTablesAnywhere(dataSource) {
@@ -4177,7 +4232,7 @@ function readTablesAnywhere(dataSource) {
4177
4232
  return read;
4178
4233
  }
4179
4234
  function useTablesAnywhere(dataSource) {
4180
- const [state, setState] = useState16({ loading: true, error: null, rows: [] });
4235
+ const [state, setState] = useState17({ loading: true, error: null, rows: [] });
4181
4236
  useEffect12(() => {
4182
4237
  let live = true;
4183
4238
  void readTablesAnywhere(dataSource).then((result) => {
@@ -4215,16 +4270,16 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
4215
4270
  hint: t.organization_name,
4216
4271
  keywords: t.organization_name,
4217
4272
  ...twin && second ? {
4218
- render: /* @__PURE__ */ jsxs17("span", { className: "flex min-w-0 flex-col", children: [
4219
- /* @__PURE__ */ jsx20("span", { className: "truncate", children: t.table_name }),
4220
- /* @__PURE__ */ jsx20("span", { className: "truncate text-[11px] text-muted-foreground", children: second })
4273
+ render: /* @__PURE__ */ jsxs18("span", { className: "flex min-w-0 flex-col", children: [
4274
+ /* @__PURE__ */ jsx21("span", { className: "truncate", children: t.table_name }),
4275
+ /* @__PURE__ */ jsx21("span", { className: "truncate text-[11px] text-muted-foreground", children: second })
4221
4276
  ] })
4222
4277
  } : {}
4223
4278
  };
4224
4279
  });
4225
4280
  const missing = Boolean(value) && !list.loading && !list.error && !list.rows.some((t) => t.table_id === value);
4226
- return /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-1", children: [
4227
- /* @__PURE__ */ jsx20(
4281
+ return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1", children: [
4282
+ /* @__PURE__ */ jsx21(
4228
4283
  CreatablePicker,
4229
4284
  {
4230
4285
  value: value || null,
@@ -4238,24 +4293,24 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
4238
4293
  ariaLabel: "Table"
4239
4294
  }
4240
4295
  ),
4241
- list.error && /* @__PURE__ */ jsx20(RefusalLine, { error: refusal("door", list.error, "Try again in a moment.") }),
4242
- missing && /* @__PURE__ */ jsx20("p", { className: "text-[11px] text-destructive", children: "This table is archived or not shared with you." })
4296
+ list.error && /* @__PURE__ */ jsx21(RefusalLine, { error: refusal("door", list.error, "Try again in a moment.") }),
4297
+ missing && /* @__PURE__ */ jsx21("p", { className: "text-[11px] text-destructive", children: "This table is archived or not shared with you." })
4243
4298
  ] });
4244
4299
  }
4245
4300
  function TableScope({ dataSource, userId, tableId, children, fallback = null, unavailable, tables }) {
4246
4301
  const own3 = useTablesAnywhere(dataSource);
4247
4302
  const list = tables ?? own3;
4248
4303
  const organizationId = list.rows.find((t) => t.table_id === tableId)?.organization_id ?? null;
4249
- if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ jsx20(Fragment6, { children: unavailable ?? fallback });
4250
- if (!tableId || !organizationId) return /* @__PURE__ */ jsx20(Fragment6, { children: fallback });
4251
- return /* @__PURE__ */ jsx20(RecordsProvider2, { config: { dataSource, actor: personActor(userId), organizationId }, children });
4304
+ if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ jsx21(Fragment7, { children: unavailable ?? fallback });
4305
+ if (!tableId || !organizationId) return /* @__PURE__ */ jsx21(Fragment7, { children: fallback });
4306
+ return /* @__PURE__ */ jsx21(RecordsProvider2, { config: { dataSource, actor: personActor(userId), organizationId }, children });
4252
4307
  }
4253
4308
  function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
4254
4309
  const fields = useFields(tableId);
4255
4310
  const all = useMemo7(() => fields.data ?? [], [fields.data]);
4256
4311
  const byKey = useMemo7(() => new Map(all.map((f) => [f.key, f])), [all]);
4257
4312
  const keys = Object.keys(value);
4258
- const [adding, setAdding] = useState16(false);
4313
+ const [adding, setAdding] = useState17(false);
4259
4314
  const optionsFor = (current) => all.filter((f) => f.key === current || !(f.key in value)).map((f) => ({ value: f.key, label: fieldName(f) }));
4260
4315
  const rename = (from, to) => {
4261
4316
  if (from === to) return;
@@ -4268,11 +4323,11 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
4268
4323
  void _gone;
4269
4324
  onChange(rest);
4270
4325
  };
4271
- return /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-2", children: [
4272
- fields.error && /* @__PURE__ */ jsx20(RefusalLine, { error: fields.error }),
4326
+ return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2", children: [
4327
+ fields.error && /* @__PURE__ */ jsx21(RefusalLine, { error: fields.error }),
4273
4328
  keys.map((key) => {
4274
4329
  const field = byKey.get(key);
4275
- return /* @__PURE__ */ jsx20(
4330
+ return /* @__PURE__ */ jsx21(
4276
4331
  ColumnValueRow,
4277
4332
  {
4278
4333
  columnKey: key,
@@ -4288,7 +4343,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
4288
4343
  key
4289
4344
  );
4290
4345
  }),
4291
- adding && /* @__PURE__ */ jsx20(
4346
+ adding && /* @__PURE__ */ jsx21(
4292
4347
  ColumnValueRow,
4293
4348
  {
4294
4349
  columnKey: null,
@@ -4305,7 +4360,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
4305
4360
  onRemove: () => setAdding(false)
4306
4361
  }
4307
4362
  ),
4308
- !disabled && !adding && keys.length < all.length && /* @__PURE__ */ jsx20(Button8, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
4363
+ !disabled && !adding && keys.length < all.length && /* @__PURE__ */ jsx21(Button8, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
4309
4364
  ] });
4310
4365
  }
4311
4366
  function ColumnValueRow({
@@ -4321,9 +4376,9 @@ function ColumnValueRow({
4321
4376
  }) {
4322
4377
  const orphan = columnKey !== null && !loading && field === void 0;
4323
4378
  const shown2 = orphan ? [{ value: columnKey, label: columnKey, hint: "Not a column" }, ...options] : options;
4324
- return /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-1 rounded-md border border-border/60 p-2", children: [
4325
- /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
4326
- /* @__PURE__ */ jsx20("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx20(
4379
+ return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1 rounded-md border border-border/60 p-2", children: [
4380
+ /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
4381
+ /* @__PURE__ */ jsx21("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx21(
4327
4382
  CreatablePicker,
4328
4383
  {
4329
4384
  value: columnKey,
@@ -4337,9 +4392,9 @@ function ColumnValueRow({
4337
4392
  ariaLabel: "Column"
4338
4393
  }
4339
4394
  ) }),
4340
- !disabled && /* @__PURE__ */ jsx20(Button8, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
4395
+ !disabled && /* @__PURE__ */ jsx21(Button8, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
4341
4396
  ] }),
4342
- field ? /* @__PURE__ */ jsx20(FieldControl, { field, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ jsx20("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
4397
+ field ? /* @__PURE__ */ jsx21(FieldControl, { field, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ jsx21("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
4343
4398
  ] });
4344
4399
  }
4345
4400
  function RecordPicker({ tableId, value, onChange, disabled }) {
@@ -4351,8 +4406,8 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
4351
4406
  label: rowNameIn(table.data ?? null, row)
4352
4407
  }));
4353
4408
  const missing = Boolean(value) && !records.loading && !records.error && !rows.some((r) => r.id === value);
4354
- return /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-1", children: [
4355
- /* @__PURE__ */ jsx20(
4409
+ return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1", children: [
4410
+ /* @__PURE__ */ jsx21(
4356
4411
  CreatablePicker,
4357
4412
  {
4358
4413
  value: value || null,
@@ -4366,7 +4421,7 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
4366
4421
  ariaLabel: "Record"
4367
4422
  }
4368
4423
  ),
4369
- records.error && /* @__PURE__ */ jsx20(RefusalLine, { error: records.error })
4424
+ records.error && /* @__PURE__ */ jsx21(RefusalLine, { error: records.error })
4370
4425
  ] });
4371
4426
  }
4372
4427
 
@@ -4375,7 +4430,7 @@ import { useEffect as useEffect13, useMemo as useMemo8 } from "react";
4375
4430
  import { isEntityReferenceConfig } from "@ai-matrx/records";
4376
4431
  import { useFields as useFields2, useTable as useTable2 } from "@ai-matrx/records/react";
4377
4432
  import { BasicInput as BasicInput6, Button as Button9, CreatablePicker as CreatablePicker2, cn as cn15 } from "@ai-matrx/design-system";
4378
- import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
4433
+ import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
4379
4434
  var DATA_BINDING_SHAPES = [
4380
4435
  { value: "collection", label: "The whole table" },
4381
4436
  { value: "reference", label: "One record" },
@@ -4442,9 +4497,9 @@ function DataBindingPicker({ dataSource, userId, binding, onChange, disabled, de
4442
4497
  ...binding.semantic_type === "collection" && defaultRowLimit ? { limit: defaultRowLimit } : {}
4443
4498
  });
4444
4499
  };
4445
- return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2", children: [
4446
- /* @__PURE__ */ jsx21(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
4447
- /* @__PURE__ */ jsx21(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ jsx21(
4500
+ return /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-2", children: [
4501
+ /* @__PURE__ */ jsx22(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
4502
+ /* @__PURE__ */ jsx22(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ jsx22(
4448
4503
  BindingDetails,
4449
4504
  {
4450
4505
  tableId,
@@ -4508,8 +4563,8 @@ function BindingDetails({
4508
4563
  const fieldOptions = fieldList.map((f) => ({ value: f.key, label: fieldName(f) }));
4509
4564
  const template = binding.transform?.template ?? "";
4510
4565
  const setTemplate = (next) => onChange({ ...binding, transform: { join: "\n", ...binding.transform, name: "list", template: next } });
4511
- return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2", children: [
4512
- /* @__PURE__ */ jsx21("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ jsx21(
4566
+ return /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-2", children: [
4567
+ /* @__PURE__ */ jsx22("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ jsx22(
4513
4568
  Button9,
4514
4569
  {
4515
4570
  type: "button",
@@ -4523,7 +4578,7 @@ function BindingDetails({
4523
4578
  },
4524
4579
  s.value
4525
4580
  )) }),
4526
- shape !== "collection" && /* @__PURE__ */ jsx21(
4581
+ shape !== "collection" && /* @__PURE__ */ jsx22(
4527
4582
  RecordPicker,
4528
4583
  {
4529
4584
  tableId,
@@ -4532,7 +4587,7 @@ function BindingDetails({
4532
4587
  disabled: Boolean(disabled)
4533
4588
  }
4534
4589
  ),
4535
- shape === "value" && /* @__PURE__ */ jsx21(
4590
+ shape === "value" && /* @__PURE__ */ jsx22(
4536
4591
  CreatablePicker2,
4537
4592
  {
4538
4593
  value: binding.field_key ?? null,
@@ -4546,8 +4601,8 @@ function BindingDetails({
4546
4601
  ariaLabel: "Column"
4547
4602
  }
4548
4603
  ),
4549
- shape !== "value" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1", children: [
4550
- /* @__PURE__ */ jsx21(
4604
+ shape !== "value" && /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-1", children: [
4605
+ /* @__PURE__ */ jsx22(
4551
4606
  "textarea",
4552
4607
  {
4553
4608
  className: cn15(
@@ -4559,7 +4614,7 @@ function BindingDetails({
4559
4614
  onChange: (e) => setTemplate(e.target.value)
4560
4615
  }
4561
4616
  ),
4562
- !disabled && /* @__PURE__ */ jsx21("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ jsx21(
4617
+ !disabled && /* @__PURE__ */ jsx22("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ jsx22(
4563
4618
  Button9,
4564
4619
  {
4565
4620
  type: "button",
@@ -4572,9 +4627,9 @@ function BindingDetails({
4572
4627
  p.token
4573
4628
  )) })
4574
4629
  ] }),
4575
- shape === "collection" && /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
4630
+ shape === "collection" && /* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
4576
4631
  "Up to",
4577
- /* @__PURE__ */ jsx21(
4632
+ /* @__PURE__ */ jsx22(
4578
4633
  BasicInput6,
4579
4634
  {
4580
4635
  type: "number",
@@ -4591,9 +4646,9 @@ function BindingDetails({
4591
4646
  ),
4592
4647
  "rows"
4593
4648
  ] }),
4594
- /* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
4595
- /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
4596
- DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ jsx21(
4649
+ /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
4650
+ /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
4651
+ DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ jsx22(
4597
4652
  Button9,
4598
4653
  {
4599
4654
  type: "button",
@@ -4672,10 +4727,10 @@ var ABSENCE_WORD_LABEL = {
4672
4727
  import { wholeValueOf } from "@ai-matrx/records/core";
4673
4728
 
4674
4729
  // src/WholeValue.tsx
4675
- import { useEffect as useEffect14, useState as useState17 } from "react";
4730
+ import { useEffect as useEffect14, useState as useState18 } from "react";
4676
4731
  import { wholeValueSize } from "@ai-matrx/records/core";
4677
4732
  import { BasicTextarea as BasicTextarea3 } from "@ai-matrx/design-system";
4678
- import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
4733
+ import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
4679
4734
  var WHOLE_VALUE_UNBOUND = "The whole text is kept as a file, and this screen has no way to open files yet.";
4680
4735
  function wholeValueLine(pointer) {
4681
4736
  return `Open the whole text (${wholeValueSize(pointer)})`;
@@ -4684,12 +4739,12 @@ function WholeValueCell({ words, pointer }) {
4684
4739
  const host = useRecordsUi();
4685
4740
  const href = host.hrefForFile?.({ fileId: pointer.file_id });
4686
4741
  const line = wholeValueLine(pointer);
4687
- return /* @__PURE__ */ jsxs19("span", { className: "flex min-w-0 items-baseline gap-2", "data-whole-value-file": pointer.file_id, children: [
4688
- /* @__PURE__ */ jsxs19("span", { className: "truncate", title: `The first ${pointer.shown_chars} of ${pointer.chars} characters`, children: [
4742
+ return /* @__PURE__ */ jsxs20("span", { className: "flex min-w-0 items-baseline gap-2", "data-whole-value-file": pointer.file_id, children: [
4743
+ /* @__PURE__ */ jsxs20("span", { className: "truncate", title: `The first ${pointer.shown_chars} of ${pointer.chars} characters`, children: [
4689
4744
  words,
4690
4745
  "\u2026"
4691
4746
  ] }),
4692
- href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ jsx22("a", { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, target: "_blank", rel: "noreferrer", children: line }) : /* @__PURE__ */ jsx22("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${wholeValueSize(pointer)} in a file` })
4747
+ href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ jsx23("a", { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, target: "_blank", rel: "noreferrer", children: line }) : /* @__PURE__ */ jsx23("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${wholeValueSize(pointer)} in a file` })
4693
4748
  ] });
4694
4749
  }
4695
4750
 
@@ -4752,7 +4807,7 @@ function kindLabel(kind) {
4752
4807
  }
4753
4808
 
4754
4809
  // src/ReferenceChips.tsx
4755
- import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
4810
+ import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
4756
4811
  function glyphOf(icon) {
4757
4812
  const text = (icon ?? "").trim();
4758
4813
  return text !== "" && text.length <= 8 && /[^\u0000-\u007f]/.test(text) ? text : null;
@@ -4785,22 +4840,22 @@ function referencesOf(field, value, kind, labels) {
4785
4840
  var ARCHIVED_REFERENCE_WORD = "Archived";
4786
4841
  var ARCHIVED_REFERENCE_TIP = "In the Archived view; restore it to use it again";
4787
4842
  function PageGlyph() {
4788
- return /* @__PURE__ */ jsxs20("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: 14, height: 14, fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "data-records-page-glyph": "", children: [
4789
- /* @__PURE__ */ jsx23("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
4790
- /* @__PURE__ */ jsx23("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
4791
- /* @__PURE__ */ jsx23("path", { d: "M10 13H8" }),
4792
- /* @__PURE__ */ jsx23("path", { d: "M16 17H8" })
4843
+ return /* @__PURE__ */ jsxs21("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: 14, height: 14, fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "data-records-page-glyph": "", children: [
4844
+ /* @__PURE__ */ jsx24("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
4845
+ /* @__PURE__ */ jsx24("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
4846
+ /* @__PURE__ */ jsx24("path", { d: "M10 13H8" }),
4847
+ /* @__PURE__ */ jsx24("path", { d: "M16 17H8" })
4793
4848
  ] });
4794
4849
  }
4795
4850
  function ReferenceChip({ reference, waiting }) {
4796
4851
  const host = useRecordsUi();
4797
4852
  const look = useEmbeddedLook();
4798
4853
  const pending = reference.label == null && reference.token === "record" && !waiting && !host.renderReference;
4799
- const pendingMark = /* @__PURE__ */ jsx23(Skeleton, { "aria-label": "Loading", "data-records-reference-pending": "", className: "inline-block h-3 w-16 shrink-0 rounded-sm align-middle" });
4854
+ const pendingMark = /* @__PURE__ */ jsx24(Skeleton, { "aria-label": "Loading", "data-records-reference-pending": "", className: "inline-block h-3 w-16 shrink-0 rounded-sm align-middle" });
4800
4855
  const words = reference.label ?? (reference.token === "record" ? waiting ?? "Loading\u2026" : WITHHELD_ENTITY_LABEL);
4801
4856
  const drawn = host.renderReference ? host.renderReference({ ...reference, label: reference.label ?? words }) : null;
4802
4857
  if (look?.plainRelation) {
4803
- return /* @__PURE__ */ jsxs20(
4858
+ return /* @__PURE__ */ jsxs21(
4804
4859
  "span",
4805
4860
  {
4806
4861
  className: cn16(
@@ -4812,14 +4867,14 @@ function ReferenceChip({ reference, waiting }) {
4812
4867
  "data-records-reference-archived": reference.archived ? "" : void 0,
4813
4868
  title: reference.archived ? ARCHIVED_REFERENCE_TIP : words,
4814
4869
  children: [
4815
- /* @__PURE__ */ jsx23("span", { "aria-hidden": "true", "data-records-reference-icon": "", className: "inline-flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: glyphOf(reference.icon) ? /* @__PURE__ */ jsx23("span", { className: "text-sm leading-none", children: reference.icon }) : reference.icon && host.renderIcon?.(reference.icon) || /* @__PURE__ */ jsx23(PageGlyph, {}) }),
4816
- drawn ?? (pending ? pendingMark : /* @__PURE__ */ jsx23("span", { className: "truncate", children: words })),
4817
- reference.archived ? /* @__PURE__ */ jsx23("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
4870
+ /* @__PURE__ */ jsx24("span", { "aria-hidden": "true", "data-records-reference-icon": "", className: "inline-flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: glyphOf(reference.icon) ? /* @__PURE__ */ jsx24("span", { className: "text-sm leading-none", children: reference.icon }) : reference.icon && host.renderIcon?.(reference.icon) || /* @__PURE__ */ jsx24(PageGlyph, {}) }),
4871
+ drawn ?? (pending ? pendingMark : /* @__PURE__ */ jsx24("span", { className: "truncate", children: words })),
4872
+ reference.archived ? /* @__PURE__ */ jsx24("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
4818
4873
  ]
4819
4874
  }
4820
4875
  );
4821
4876
  }
4822
- return /* @__PURE__ */ jsxs20(
4877
+ return /* @__PURE__ */ jsxs21(
4823
4878
  Badge4,
4824
4879
  {
4825
4880
  variant: "secondary",
@@ -4831,15 +4886,15 @@ function ReferenceChip({ reference, waiting }) {
4831
4886
  "data-records-reference-archived": reference.archived ? "" : void 0,
4832
4887
  title: reference.archived ? ARCHIVED_REFERENCE_TIP : words,
4833
4888
  children: [
4834
- drawn ?? (pending ? pendingMark : /* @__PURE__ */ jsx23("span", { className: "truncate", children: words })),
4835
- reference.archived ? /* @__PURE__ */ jsx23("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
4889
+ drawn ?? (pending ? pendingMark : /* @__PURE__ */ jsx24("span", { className: "truncate", children: words })),
4890
+ reference.archived ? /* @__PURE__ */ jsx24("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
4836
4891
  ]
4837
4892
  }
4838
4893
  );
4839
4894
  }
4840
4895
  function ReferenceChips({ refs, waiting }) {
4841
- if (refs.length === 0) return /* @__PURE__ */ jsx23("span", { className: "text-muted-foreground", children: "\u2014" });
4842
- return /* @__PURE__ */ jsx23("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-reference-chips": "", children: refs.map((r) => /* @__PURE__ */ jsx23(ReferenceChip, { reference: r, waiting }, `${r.token}:${r.id}`)) });
4896
+ if (refs.length === 0) return /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "\u2014" });
4897
+ return /* @__PURE__ */ jsx24("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-reference-chips": "", children: refs.map((r) => /* @__PURE__ */ jsx24(ReferenceChip, { reference: r, waiting }, `${r.token}:${r.id}`)) });
4843
4898
  }
4844
4899
  function KindValueCell({
4845
4900
  kv,
@@ -4848,10 +4903,10 @@ function KindValueCell({
4848
4903
  }) {
4849
4904
  const host = useRecordsUi();
4850
4905
  if (host.renderKind) {
4851
- return /* @__PURE__ */ jsx23("span", { className: "flex min-w-0 max-w-full items-center", "data-records-kind-value": kv.kind, children: host.renderKind({ value: kv.value, kind: kv.kind, where, title }) });
4906
+ return /* @__PURE__ */ jsx24("span", { className: "flex min-w-0 max-w-full items-center", "data-records-kind-value": kv.kind, children: host.renderKind({ value: kv.value, kind: kv.kind, where, title }) });
4852
4907
  }
4853
4908
  const named = kv.items.map(kindItemWords).filter((w) => w !== null);
4854
- return /* @__PURE__ */ jsx23("span", { className: cn16("flex min-w-0 flex-wrap gap-1"), "data-records-kind-value": kv.kind, title: JSON.stringify(kv.value), children: named.length > 0 ? named.map((w, i) => /* @__PURE__ */ jsx23(Badge4, { variant: "secondary", className: "px-1.5 py-0 text-[11px] font-normal", children: w }, `${w}-${i}`)) : /* @__PURE__ */ jsx23(Badge4, { variant: "outline", className: "px-1.5 py-0 text-[11px] font-normal", children: kindLabel(kv.kind) }) });
4909
+ return /* @__PURE__ */ jsx24("span", { className: cn16("flex min-w-0 flex-wrap gap-1"), "data-records-kind-value": kv.kind, title: JSON.stringify(kv.value), children: named.length > 0 ? named.map((w, i) => /* @__PURE__ */ jsx24(Badge4, { variant: "secondary", className: "px-1.5 py-0 text-[11px] font-normal", children: w }, `${w}-${i}`)) : /* @__PURE__ */ jsx24(Badge4, { variant: "outline", className: "px-1.5 py-0 text-[11px] font-normal", children: kindLabel(kv.kind) }) });
4855
4910
  }
4856
4911
 
4857
4912
  // src/formulaNames.ts
@@ -4869,10 +4924,10 @@ function formulaSourceArchived(field, document2) {
4869
4924
 
4870
4925
  // src/values.tsx
4871
4926
  import { newerKindWords, sourceArchivedOf as sourceArchivedOf2 } from "@ai-matrx/records";
4872
- import { Fragment as Fragment7, jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
4927
+ import { Fragment as Fragment8, jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
4873
4928
  function statusMark(field, item, document2) {
4874
4929
  const mark = statusMarkOf(field, item, document2);
4875
- return mark ? /* @__PURE__ */ jsx24("span", { "aria-label": mark.words, title: mark.words, className: "mr-1", "data-records-status-group": mark.group, children: mark.mark }) : null;
4930
+ return mark ? /* @__PURE__ */ jsx25("span", { "aria-label": mark.words, title: mark.words, className: "mr-1", "data-records-status-group": mark.group, children: mark.mark }) : null;
4876
4931
  }
4877
4932
  function envelopeFor(document2, key) {
4878
4933
  const block = document2?._values;
@@ -4918,47 +4973,47 @@ function sourceArchivedSentence(state) {
4918
4973
  return state.table ? `${state.label} on ${state.table} is archived` : `${state.label} is archived`;
4919
4974
  }
4920
4975
  function SourceArchivedValue({ state }) {
4921
- return /* @__PURE__ */ jsx24("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(state), "data-records-source-archived": state.field_id ?? "", children: SOURCE_ARCHIVED_WORDS });
4976
+ return /* @__PURE__ */ jsx25("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(state), "data-records-source-archived": state.field_id ?? "", children: SOURCE_ARCHIVED_WORDS });
4922
4977
  }
4923
4978
  var ABSENCE_WORDS = ABSENCE_WORD_LABEL;
4924
4979
  function renderValue(field, value, document2, labels, stillWaitingFor, look) {
4925
4980
  const archivedSource = sourceArchivedOf2(value);
4926
- if (archivedSource) return /* @__PURE__ */ jsx24(SourceArchivedValue, { state: archivedSource });
4981
+ if (archivedSource) return /* @__PURE__ */ jsx25(SourceArchivedValue, { state: archivedSource });
4927
4982
  const envelope = envelopeFor(document2, field.key);
4928
4983
  if (envelope?.absent) {
4929
- return /* @__PURE__ */ jsx24("span", { className: "text-xs italic text-muted-foreground", title: `VAL-2: ${envelope.absent}`, children: ABSENCE_WORDS[String(envelope.absent)] ?? String(envelope.absent) });
4984
+ return /* @__PURE__ */ jsx25("span", { className: "text-xs italic text-muted-foreground", title: `VAL-2: ${envelope.absent}`, children: ABSENCE_WORDS[String(envelope.absent)] ?? String(envelope.absent) });
4930
4985
  }
4931
4986
  if (value === null || value === void 0 || value === "") {
4932
4987
  const gone = unresolvedFor(document2, field.key);
4933
4988
  if (gone) {
4934
- return /* @__PURE__ */ jsx24("span", { className: "text-xs italic text-muted-foreground", title: `It pointed at ${gone}`, children: "The record this pointed at no longer exists" });
4989
+ return /* @__PURE__ */ jsx25("span", { className: "text-xs italic text-muted-foreground", title: `It pointed at ${gone}`, children: "The record this pointed at no longer exists" });
4935
4990
  }
4936
4991
  const archivedInput = formulaSourceArchived(field, document2);
4937
- if (archivedInput) return /* @__PURE__ */ jsx24(SourceArchivedValue, { state: archivedInput });
4992
+ if (archivedInput) return /* @__PURE__ */ jsx25(SourceArchivedValue, { state: archivedInput });
4938
4993
  const computed = computedEmptyOf(field, document2);
4939
- if (computed?.sentence) return /* @__PURE__ */ jsx24("span", { className: "text-xs italic text-muted-foreground", children: computed.sentence });
4940
- if (computed?.words) return /* @__PURE__ */ jsx24("span", { "data-records-empty-why": computed.kind, children: computed.words });
4994
+ if (computed?.sentence) return /* @__PURE__ */ jsx25("span", { className: "text-xs italic text-muted-foreground", children: computed.sentence });
4995
+ if (computed?.words) return /* @__PURE__ */ jsx25("span", { "data-records-empty-why": computed.kind, children: computed.words });
4941
4996
  if (computed?.why) {
4942
- return /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", title: computed.why, "data-records-empty-why": computed.kind, children: "\u2014" });
4997
+ return /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", title: computed.why, "data-records-empty-why": computed.kind, children: "\u2014" });
4943
4998
  }
4944
4999
  if (look?.blankEmpty) return null;
4945
- return /* @__PURE__ */ jsx24("span", { className: "text-muted-foreground", children: "\u2014" });
5000
+ return /* @__PURE__ */ jsx25("span", { className: "text-muted-foreground", children: "\u2014" });
4946
5001
  }
4947
- if (isSignatureField(field)) return /* @__PURE__ */ jsx24(SignatureValue, { value, fieldKey: field.key, document: document2 });
5002
+ if (isSignatureField(field)) return /* @__PURE__ */ jsx25(SignatureValue, { value, fieldKey: field.key, document: document2 });
4948
5003
  const newer = newerKindValue(field, value);
4949
5004
  if (newer !== void 0) return newer;
4950
5005
  const whole = typeof value === "string" ? wholeValueOf(document2, field.key) : null;
4951
- if (whole) return /* @__PURE__ */ jsx24(WholeValueCell, { words: value, pointer: whole });
5006
+ if (whole) return /* @__PURE__ */ jsx25(WholeValueCell, { words: value, pointer: whole });
4952
5007
  const kind = editorKindFor(field);
4953
5008
  if (kind === "relation" || kind === "entity_reference") {
4954
- return /* @__PURE__ */ jsx24(ReferenceChips, { refs: referencesOf(field, value, kind, labels), waiting: stillWaitingFor });
5009
+ return /* @__PURE__ */ jsx25(ReferenceChips, { refs: referencesOf(field, value, kind, labels), waiting: stillWaitingFor });
4955
5010
  }
4956
5011
  if (kind === "member") {
4957
5012
  const ids = (Array.isArray(value) ? value : [value]).filter((v) => v !== null && v !== void 0 && v !== "");
4958
- return /* @__PURE__ */ jsx24("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-person-chips": "", children: ids.map((id, i) => /* @__PURE__ */ jsx24(PersonChip, { name: scalarText(field, id, labels, stillWaitingFor) }, `${String(id)}-${i}`)) });
5013
+ return /* @__PURE__ */ jsx25("span", { className: "flex min-w-0 flex-wrap gap-1", "data-records-person-chips": "", children: ids.map((id, i) => /* @__PURE__ */ jsx25(PersonChip, { name: scalarText(field, id, labels, stillWaitingFor) }, `${String(id)}-${i}`)) });
4959
5014
  }
4960
5015
  const kv = kind === "attachment" ? null : kindValueOf(value);
4961
- if (kv) return /* @__PURE__ */ jsx24(KindValueCell, { kv, where: "cell", title: field.label });
5016
+ if (kv) return /* @__PURE__ */ jsx25(KindValueCell, { kv, where: "cell", title: field.label });
4962
5017
  const chosen = kind === "select" || kind === "multi_select";
4963
5018
  const chipOf = (item) => {
4964
5019
  const chipLook = choiceChipLookOf(field, item, scalarText(field, item, labels));
@@ -4966,9 +5021,9 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look) {
4966
5021
  };
4967
5022
  if (chosen) {
4968
5023
  const items = Array.isArray(value) ? value : [value];
4969
- return /* @__PURE__ */ jsx24("span", { className: "flex flex-wrap gap-1", "data-records-choice-chips": "", children: items.map((item, i) => {
5024
+ return /* @__PURE__ */ jsx25("span", { className: "flex flex-wrap gap-1", "data-records-choice-chips": "", children: items.map((item, i) => {
4970
5025
  const chip = chipOf(item);
4971
- return /* @__PURE__ */ jsxs21(
5026
+ return /* @__PURE__ */ jsxs22(
4972
5027
  Badge5,
4973
5028
  {
4974
5029
  variant: "outline",
@@ -4976,7 +5031,7 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look) {
4976
5031
  "data-records-choice-chip": "",
4977
5032
  ...chip.tinted ? { "data-records-choice-tint": "" } : {},
4978
5033
  children: [
4979
- look?.choiceDot ? /* @__PURE__ */ jsx24("span", { "aria-hidden": "true", "data-matrx-pill-ink": "", "data-records-choice-dot": "", className: cn17("mr-1.5 inline-block size-1.5 shrink-0 rounded-full", chip.dot) }) : null,
5034
+ look?.choiceDot ? /* @__PURE__ */ jsx25("span", { "aria-hidden": "true", "data-matrx-pill-ink": "", "data-records-choice-dot": "", className: cn17("mr-1.5 inline-block size-1.5 shrink-0 rounded-full", chip.dot) }) : null,
4980
5035
  statusMark(field, item, Array.isArray(value) ? void 0 : document2),
4981
5036
  scalarText(field, item, labels, Array.isArray(value) ? void 0 : stillWaitingFor)
4982
5037
  ]
@@ -4985,13 +5040,13 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look) {
4985
5040
  );
4986
5041
  }) });
4987
5042
  }
4988
- if (kind === "attachment") return /* @__PURE__ */ jsx24(AttachmentChips, { value });
5043
+ if (kind === "attachment") return /* @__PURE__ */ jsx25(AttachmentChips, { value });
4989
5044
  if (Array.isArray(value)) {
4990
- return /* @__PURE__ */ jsx24("span", { className: "flex flex-wrap gap-1", children: value.map((item, i) => /* @__PURE__ */ jsx24(Badge5, { variant: "secondary", className: "text-[11px]", children: scalarText(field, item, labels) }, `${String(item)}-${i}`)) });
5045
+ return /* @__PURE__ */ jsx25("span", { className: "flex flex-wrap gap-1", children: value.map((item, i) => /* @__PURE__ */ jsx25(Badge5, { variant: "secondary", className: "text-[11px]", children: scalarText(field, item, labels) }, `${String(item)}-${i}`)) });
4991
5046
  }
4992
5047
  if (kind === "url" && typeof value === "string") {
4993
5048
  const href = value.includes("://") ? value : `https://${value}`;
4994
- return /* @__PURE__ */ jsxs21(
5049
+ return /* @__PURE__ */ jsxs22(
4995
5050
  "a",
4996
5051
  {
4997
5052
  className: "inline-flex min-w-0 max-w-full items-center gap-1 rounded-md border border-border bg-muted/60 px-1.5 py-0.5 text-[11px] text-foreground hover:bg-accent",
@@ -5002,14 +5057,14 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look) {
5002
5057
  "data-records-link-chip": "",
5003
5058
  onClick: (event) => event.stopPropagation(),
5004
5059
  children: [
5005
- /* @__PURE__ */ jsx24("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2197" }),
5006
- /* @__PURE__ */ jsx24("span", { className: "truncate", children: linkChipText(value) })
5060
+ /* @__PURE__ */ jsx25("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2197" }),
5061
+ /* @__PURE__ */ jsx25("span", { className: "truncate", children: linkChipText(value) })
5007
5062
  ]
5008
5063
  }
5009
5064
  );
5010
5065
  }
5011
5066
  if (kind === "phone" && typeof value === "string" && value.trim() !== "") {
5012
- return /* @__PURE__ */ jsx24(
5067
+ return /* @__PURE__ */ jsx25(
5013
5068
  "a",
5014
5069
  {
5015
5070
  className: "truncate tabular-nums text-primary underline-offset-2 hover:underline",
@@ -5022,12 +5077,12 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look) {
5022
5077
  );
5023
5078
  }
5024
5079
  if (kind === "email" && typeof value === "string") {
5025
- return /* @__PURE__ */ jsx24("a", { className: "truncate text-primary underline-offset-2 hover:underline", href: `mailto:${value}`, children: value });
5080
+ return /* @__PURE__ */ jsx25("a", { className: "truncate text-primary underline-offset-2 hover:underline", href: `mailto:${value}`, children: value });
5026
5081
  }
5027
5082
  if (typeof value === "boolean") {
5028
- return /* @__PURE__ */ jsx24("span", { className: kind === "checkbox" ? "text-sm" : "", title: value ? "Yes" : "No", children: value ? "\u2713" : "\u2014" });
5083
+ return /* @__PURE__ */ jsx25("span", { className: kind === "checkbox" ? "text-sm" : "", title: value ? "Yes" : "No", children: value ? "\u2713" : "\u2014" });
5029
5084
  }
5030
- return /* @__PURE__ */ jsx24("span", { className: cn17("truncate", kind === "number" || kind === "currency" || kind === "percent" ? "tabular-nums" : ""), children: scalarText(field, value, labels, stillWaitingFor) });
5085
+ return /* @__PURE__ */ jsx25("span", { className: cn17("truncate", kind === "number" || kind === "currency" || kind === "percent" ? "tabular-nums" : ""), children: scalarText(field, value, labels, stillWaitingFor) });
5031
5086
  }
5032
5087
  function scalarText(field, value, labels, stillWaitingFor) {
5033
5088
  if (value === null || value === void 0) return "\u2014";
@@ -5069,13 +5124,13 @@ function scalarText(field, value, labels, stillWaitingFor) {
5069
5124
  }
5070
5125
 
5071
5126
  // src/PickedSummaries.tsx
5072
- import { Fragment as Fragment8, jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
5127
+ import { Fragment as Fragment9, jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
5073
5128
  function TableNameText({ dataSource, tableId }) {
5074
5129
  const tables = useTablesAnywhere(dataSource);
5075
- if (!tableId) return /* @__PURE__ */ jsx25(Fragment8, { children: "\u2014" });
5076
- if (tables.loading) return /* @__PURE__ */ jsx25(Fragment8, { children: "\u2026" });
5077
- if (tables.error) return /* @__PURE__ */ jsx25(Fragment8, { children: "Couldn't load the table's name" });
5078
- return /* @__PURE__ */ jsx25(Fragment8, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
5130
+ if (!tableId) return /* @__PURE__ */ jsx26(Fragment9, { children: "\u2014" });
5131
+ if (tables.loading) return /* @__PURE__ */ jsx26(Fragment9, { children: "\u2026" });
5132
+ if (tables.error) return /* @__PURE__ */ jsx26(Fragment9, { children: "Couldn't load the table's name" });
5133
+ return /* @__PURE__ */ jsx26(Fragment9, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
5079
5134
  }
5080
5135
  function ColumnValuesText({
5081
5136
  dataSource,
@@ -5083,38 +5138,38 @@ function ColumnValuesText({
5083
5138
  tableId,
5084
5139
  value
5085
5140
  }) {
5086
- if (!tableId) return /* @__PURE__ */ jsx25(Fragment8, { children: "\u2014" });
5087
- return /* @__PURE__ */ jsx25(
5141
+ if (!tableId) return /* @__PURE__ */ jsx26(Fragment9, { children: "\u2014" });
5142
+ return /* @__PURE__ */ jsx26(
5088
5143
  TableScope,
5089
5144
  {
5090
5145
  dataSource,
5091
5146
  userId,
5092
5147
  tableId,
5093
- fallback: /* @__PURE__ */ jsx25(Fragment8, { children: "\u2026" }),
5094
- unavailable: /* @__PURE__ */ jsx25(Fragment8, { children: "Couldn't load this table's columns" }),
5095
- children: /* @__PURE__ */ jsx25(RecordLabelProvider, { children: /* @__PURE__ */ jsx25(ColumnValuesWords, { tableId, value }) })
5148
+ fallback: /* @__PURE__ */ jsx26(Fragment9, { children: "\u2026" }),
5149
+ unavailable: /* @__PURE__ */ jsx26(Fragment9, { children: "Couldn't load this table's columns" }),
5150
+ children: /* @__PURE__ */ jsx26(RecordLabelProvider, { children: /* @__PURE__ */ jsx26(ColumnValuesWords, { tableId, value }) })
5096
5151
  }
5097
5152
  );
5098
5153
  }
5099
5154
  function ColumnValuesWords({ tableId, value }) {
5100
5155
  const fields = useFields3(tableId);
5101
5156
  const labels = useRecordLabels(fields.data ?? void 0);
5102
- if (fields.loading) return /* @__PURE__ */ jsx25(Fragment8, { children: "\u2026" });
5103
- if (fields.error) return /* @__PURE__ */ jsx25(Fragment8, { children: "Couldn't load this table's columns" });
5157
+ if (fields.loading) return /* @__PURE__ */ jsx26(Fragment9, { children: "\u2026" });
5158
+ if (fields.error) return /* @__PURE__ */ jsx26(Fragment9, { children: "Couldn't load this table's columns" });
5104
5159
  const parts = [];
5105
5160
  for (const [key, stored] of Object.entries(value)) {
5106
5161
  if (key.startsWith("_")) continue;
5107
5162
  const field = (fields.data ?? []).find((f) => f.key === key);
5108
- if (parts.length) parts.push(/* @__PURE__ */ jsx25("span", { children: ", " }, `${key}-sep`));
5163
+ if (parts.length) parts.push(/* @__PURE__ */ jsx26("span", { children: ", " }, `${key}-sep`));
5109
5164
  parts.push(
5110
- /* @__PURE__ */ jsxs22("span", { children: [
5165
+ /* @__PURE__ */ jsxs23("span", { children: [
5111
5166
  field ? fieldName(field) : "A removed column",
5112
5167
  " is ",
5113
5168
  field ? renderValue(field, stored, void 0, labels) : "\u2014"
5114
5169
  ] }, key)
5115
5170
  );
5116
5171
  }
5117
- return parts.length ? /* @__PURE__ */ jsx25(Fragment8, { children: parts }) : /* @__PURE__ */ jsx25(Fragment8, { children: "\u2014" });
5172
+ return parts.length ? /* @__PURE__ */ jsx26(Fragment9, { children: parts }) : /* @__PURE__ */ jsx26(Fragment9, { children: "\u2014" });
5118
5173
  }
5119
5174
  function RecordNameText({
5120
5175
  dataSource,
@@ -5122,41 +5177,41 @@ function RecordNameText({
5122
5177
  tableId,
5123
5178
  recordId
5124
5179
  }) {
5125
- if (!tableId || !recordId) return /* @__PURE__ */ jsx25(Fragment8, { children: "\u2014" });
5126
- return /* @__PURE__ */ jsx25(
5180
+ if (!tableId || !recordId) return /* @__PURE__ */ jsx26(Fragment9, { children: "\u2014" });
5181
+ return /* @__PURE__ */ jsx26(
5127
5182
  TableScope,
5128
5183
  {
5129
5184
  dataSource,
5130
5185
  userId,
5131
5186
  tableId,
5132
- fallback: /* @__PURE__ */ jsx25(Fragment8, { children: "\u2026" }),
5133
- unavailable: /* @__PURE__ */ jsx25(Fragment8, { children: "Couldn't load this record" }),
5134
- children: /* @__PURE__ */ jsx25(RecordNameWords, { tableId, recordId })
5187
+ fallback: /* @__PURE__ */ jsx26(Fragment9, { children: "\u2026" }),
5188
+ unavailable: /* @__PURE__ */ jsx26(Fragment9, { children: "Couldn't load this record" }),
5189
+ children: /* @__PURE__ */ jsx26(RecordNameWords, { tableId, recordId })
5135
5190
  }
5136
5191
  );
5137
5192
  }
5138
5193
  function RecordNameWords({ tableId, recordId }) {
5139
5194
  const table = useTable3(tableId);
5140
5195
  const record = useRecord(recordId);
5141
- if (record.loading || table.loading) return /* @__PURE__ */ jsx25(Fragment8, { children: "\u2026" });
5142
- if (record.error) return /* @__PURE__ */ jsx25(Fragment8, { children: "Couldn't load this record" });
5143
- if (!record.data) return /* @__PURE__ */ jsx25(Fragment8, { children: "A record you cannot open" });
5144
- return /* @__PURE__ */ jsx25(Fragment8, { children: recordName(record.data.document, table.data?.title_field ?? null) });
5196
+ if (record.loading || table.loading) return /* @__PURE__ */ jsx26(Fragment9, { children: "\u2026" });
5197
+ if (record.error) return /* @__PURE__ */ jsx26(Fragment9, { children: "Couldn't load this record" });
5198
+ if (!record.data) return /* @__PURE__ */ jsx26(Fragment9, { children: "A record you cannot open" });
5199
+ return /* @__PURE__ */ jsx26(Fragment9, { children: recordName(record.data.document, table.data?.title_field ?? null) });
5145
5200
  }
5146
5201
 
5147
5202
  // src/HeldChangeDecision.tsx
5148
- import { useEffect as useEffect15, useState as useState18 } from "react";
5203
+ import { useEffect as useEffect15, useState as useState19 } from "react";
5149
5204
  import { RecordsProvider as RecordsProvider3, useRecordsClient as useRecordsClient3 } from "@ai-matrx/records/react";
5150
5205
  import { Button as Button10 } from "@ai-matrx/design-system";
5151
- import { jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
5206
+ import { jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
5152
5207
  function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, onDecided }) {
5153
- return /* @__PURE__ */ jsx26(RecordsProvider3, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ jsx26(Decision, { approvalId, onDecided }) });
5208
+ return /* @__PURE__ */ jsx27(RecordsProvider3, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ jsx27(Decision, { approvalId, onDecided }) });
5154
5209
  }
5155
5210
  function Decision({ approvalId, onDecided }) {
5156
5211
  const client = useRecordsClient3();
5157
- const [may, setMay] = useState18(null);
5158
- const [busy, setBusy] = useState18(null);
5159
- const [error, setError] = useState18(null);
5212
+ const [may, setMay] = useState19(null);
5213
+ const [busy, setBusy] = useState19(null);
5214
+ const [error, setError] = useState19(null);
5160
5215
  useEffect15(() => {
5161
5216
  let live = true;
5162
5217
  void client.workApprovalMayDecide({ approval_id: approvalId }).then((res) => {
@@ -5179,13 +5234,13 @@ function Decision({ approvalId, onDecided }) {
5179
5234
  if (res.ok) onDecided(approve);
5180
5235
  else setError(res.error);
5181
5236
  };
5182
- if (may === null) return /* @__PURE__ */ jsx26("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
5183
- return /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-1.5", children: [
5184
- may ? /* @__PURE__ */ jsxs23("div", { className: "flex gap-2", children: [
5185
- /* @__PURE__ */ jsx26(Button10, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : "Approve" }),
5186
- /* @__PURE__ */ jsx26(Button10, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
5187
- ] }) : !error && /* @__PURE__ */ jsx26("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
5188
- error ? /* @__PURE__ */ jsx26(RefusalLine, { error }) : null
5237
+ if (may === null) return /* @__PURE__ */ jsx27("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
5238
+ return /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-1.5", children: [
5239
+ may ? /* @__PURE__ */ jsxs24("div", { className: "flex gap-2", children: [
5240
+ /* @__PURE__ */ jsx27(Button10, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : "Approve" }),
5241
+ /* @__PURE__ */ jsx27(Button10, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
5242
+ ] }) : !error && /* @__PURE__ */ jsx27("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
5243
+ error ? /* @__PURE__ */ jsx27(RefusalLine, { error }) : null
5189
5244
  ] });
5190
5245
  }
5191
5246
  export {