@ai-matrx/records-ui 0.116.110 → 0.116.112

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/dist/{SaveToTable-WZ4BELUI.js → SaveToTable-GRDFTAC4.js} +4 -4
  3. package/dist/{chunk-TABDUUEC.js → chunk-DZ4KNUSS.js} +16 -3
  4. package/dist/chunk-DZ4KNUSS.js.map +1 -0
  5. package/dist/{chunk-NS2VEKMS.js → chunk-FZVW6XVB.js} +2 -2
  6. package/dist/{chunk-K7OX6RG6.js → chunk-JTEIYLII.js} +3 -1
  7. package/dist/chunk-JTEIYLII.js.map +1 -0
  8. package/dist/{chunk-TZ2KUSHH.js → chunk-LGQLATW5.js} +30 -9
  9. package/dist/chunk-LGQLATW5.js.map +1 -0
  10. package/dist/{chunk-T7SXM6ZL.js → chunk-N76I4VXM.js} +5 -4
  11. package/dist/{chunk-T7SXM6ZL.js.map → chunk-N76I4VXM.js.map} +1 -1
  12. package/dist/{chunk-D7LNXDKV.js → chunk-Z3EUU2NM.js} +2 -2
  13. package/dist/helpers.cjs +21 -6
  14. package/dist/helpers.cjs.map +1 -1
  15. package/dist/helpers.d.cts +11 -3
  16. package/dist/helpers.d.ts +11 -3
  17. package/dist/helpers.js +21 -6
  18. package/dist/helpers.js.map +1 -1
  19. package/dist/index.cjs +447 -403
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +13 -4
  22. package/dist/index.d.ts +13 -4
  23. package/dist/index.js +247 -240
  24. package/dist/index.js.map +1 -1
  25. package/dist/pickers.cjs +195 -160
  26. package/dist/pickers.cjs.map +1 -1
  27. package/dist/pickers.js +4 -4
  28. package/dist/skeleton.js +3 -3
  29. package/package.json +2 -2
  30. package/dist/chunk-K7OX6RG6.js.map +0 -1
  31. package/dist/chunk-TABDUUEC.js.map +0 -1
  32. package/dist/chunk-TZ2KUSHH.js.map +0 -1
  33. /package/dist/{SaveToTable-WZ4BELUI.js.map → SaveToTable-GRDFTAC4.js.map} +0 -0
  34. /package/dist/{chunk-NS2VEKMS.js.map → chunk-FZVW6XVB.js.map} +0 -0
  35. /package/dist/{chunk-D7LNXDKV.js.map → chunk-Z3EUU2NM.js.map} +0 -0
package/dist/pickers.cjs CHANGED
@@ -153,11 +153,19 @@ function peopleSentence(message) {
153
153
  function refusalSentence(error) {
154
154
  return refusalForAPerson(error).sentence;
155
155
  }
156
+ function withoutBuildLabel(sentence) {
157
+ const hit = LEADING_BUILD_LABEL.exec(sentence);
158
+ if (!hit) return { label: null, rest: sentence };
159
+ const rest = sentence.slice(hit[0].length).trim();
160
+ return { label: hit[0].trim(), rest: rest.charAt(0).toUpperCase() + rest.slice(1) };
161
+ }
156
162
  function plainSentence(message) {
157
163
  const dropped = [];
158
164
  const kept2 = [];
159
165
  for (const raw of message.split(/(?<=[.!?])\s+/)) {
160
- const sentence = raw.trim();
166
+ const labelled = withoutBuildLabel(raw.trim());
167
+ if (labelled.label) dropped.push(labelled.label);
168
+ const sentence = labelled.rest;
161
169
  if (sentence === "") continue;
162
170
  const cleaned = withoutMachineClauses(sentence);
163
171
  dropped.push(...cleaned.dropped);
@@ -165,6 +173,9 @@ function plainSentence(message) {
165
173
  }
166
174
  return { kept: kept2.length === 0 ? null : kept2.join(" "), dropped };
167
175
  }
176
+ function readsAsASentence(text) {
177
+ return (text ?? "").trim().split(/\s+/).filter(Boolean).length >= 2;
178
+ }
168
179
  function exampleOf(error) {
169
180
  const detail = error.detail;
170
181
  if (!detail || typeof detail !== "object") return null;
@@ -180,7 +191,7 @@ function refusalForAPerson(error) {
180
191
  const title = timedOut ? TITLE["timed_out"] : TITLE[code] ?? "That was refused";
181
192
  const hintIsForEngineers = isDeveloperHint(String(error.hint ?? ""));
182
193
  const example = exampleOf(error);
183
- const remedy = (example ? `Enter it like ${example}.` : null) ?? (hintIsForEngineers ? null : hint.kept) ?? (timedOut ? REMEDY["timed_out"] : REMEDY[code]) ?? REMEDY["internal"];
194
+ const remedy = (example ? `Enter it like ${example}.` : null) ?? (hintIsForEngineers || !readsAsASentence(hint.kept) ? null : hint.kept) ?? (timedOut ? REMEDY["timed_out"] : REMEDY[code]) ?? REMEDY["internal"];
184
195
  const messageIsForEngineers = isEngineerText(String(error.message ?? ""));
185
196
  const said2 = timedOut ? TIMED_OUT_SAID : (messageIsForEngineers ? "" : message.kept ?? "").trim();
186
197
  const forEngineers = [
@@ -212,7 +223,7 @@ function refusalLineForAPerson(error) {
212
223
  function refusalIsMissingInput(error) {
213
224
  return error.sqlstate === "22023" || error.code === "invalid_argument";
214
225
  }
215
- var MACHINE_IDENTITY, TITLE, REMEDY, ENGINEER_TEXT, TIMED_OUT_SAID;
226
+ var MACHINE_IDENTITY, TITLE, REMEDY, ENGINEER_TEXT, BUILD_LABEL, LEADING_BUILD_LABEL, TIMED_OUT_SAID;
216
227
  var init_plainWords = __esm({
217
228
  "src/plainWords.ts"() {
218
229
  "use strict";
@@ -299,6 +310,8 @@ var init_plainWords = __esm({
299
310
  // the app, arriving on the screen of somebody who cannot act on it.
300
311
  /\bbind\s+[`'"A-Za-z]/i
301
312
  ];
313
+ BUILD_LABEL = String.raw`(?:Test \d+ \([^)]{1,40}\)|[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+|[A-Z]{1,5}\d+[a-z]?)`;
314
+ LEADING_BUILD_LABEL = new RegExp(String.raw`^${BUILD_LABEL}(?:\s*\/\s*${BUILD_LABEL})*:\s+`);
302
315
  TIMED_OUT_SAID = "That took too long. Nothing was lost; try again.";
303
316
  }
304
317
  });
@@ -676,11 +689,12 @@ function personWallNow(at = /* @__PURE__ */ new Date()) {
676
689
  const n = (t) => Number(parts.find((p) => p.type === t)?.value ?? 0);
677
690
  return new Date(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
678
691
  }
679
- var import_table_style2, import_global_slot, state;
692
+ var import_table_style2, import_records2, import_global_slot, state;
680
693
  var init_personZone = __esm({
681
694
  "src/personZone.ts"() {
682
695
  "use strict";
683
696
  import_table_style2 = require("@ai-matrx/design-system/data-table/table-style");
697
+ import_records2 = require("@ai-matrx/records");
684
698
  import_global_slot = require("@ai-matrx/kit/global-slot");
685
699
  state = (0, import_global_slot.globalSlot)("ai-matrx.records-ui.person-time-zone", () => ({
686
700
  zone: null,
@@ -1401,7 +1415,7 @@ function usePickerTables() {
1401
1415
  };
1402
1416
  }, [client, nonce]);
1403
1417
  const data = (0, import_react14.useMemo)(
1404
- () => (0, import_records4.withTablePlacement)(tables.data ?? [], facts === "reading" ? null : facts),
1418
+ () => (0, import_records5.withTablePlacement)(tables.data ?? [], facts === "reading" ? null : facts),
1405
1419
  [tables.data, facts]
1406
1420
  );
1407
1421
  return { loading: tables.loading || facts === "reading", data, reload };
@@ -1420,13 +1434,13 @@ function ShowListsToggle({
1420
1434
  ")"
1421
1435
  ] });
1422
1436
  }
1423
- var import_react14, import_records4, import_react15, import_design_system12, import_jsx_runtime13;
1437
+ var import_react14, import_records5, import_react15, import_design_system12, import_jsx_runtime13;
1424
1438
  var init_tablePicking = __esm({
1425
1439
  "src/tablePicking.tsx"() {
1426
1440
  "use strict";
1427
1441
  "use client";
1428
1442
  import_react14 = require("react");
1429
- import_records4 = require("@ai-matrx/records");
1443
+ import_records5 = require("@ai-matrx/records");
1430
1444
  import_react15 = require("@ai-matrx/records/react");
1431
1445
  import_design_system12 = require("@ai-matrx/design-system");
1432
1446
  init_tablePickerEntries();
@@ -1891,7 +1905,7 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
1891
1905
  cancelled = true;
1892
1906
  };
1893
1907
  }, [client, personTable, picked.length, people.length]);
1894
- const listed = (0, import_records11.rankTypedMatches)(members ?? [], search, memberName);
1908
+ const listed = (0, import_records12.rankTypedMatches)(members ?? [], search, memberName);
1895
1909
  if (!membersPort || !client) {
1896
1910
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: (0, import_design_system27.cn)("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
1897
1911
  }
@@ -1992,13 +2006,13 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
1992
2006
  )
1993
2007
  ] });
1994
2008
  }
1995
- var import_react40, import_records11, import_react41, import_design_system27, import_jsx_runtime31;
2009
+ var import_react40, import_records12, import_react41, import_design_system27, import_jsx_runtime31;
1996
2010
  var init_PersonPicker = __esm({
1997
2011
  "src/PersonPicker.tsx"() {
1998
2012
  "use strict";
1999
2013
  "use client";
2000
2014
  import_react40 = require("react");
2001
- import_records11 = require("@ai-matrx/records");
2015
+ import_records12 = require("@ai-matrx/records");
2002
2016
  import_react41 = require("@ai-matrx/records/react");
2003
2017
  import_design_system27 = require("@ai-matrx/design-system");
2004
2018
  init_PickOrAdd();
@@ -2574,7 +2588,7 @@ function choiceOptionsOf(options) {
2574
2588
  const labels = [];
2575
2589
  for (const option of options) {
2576
2590
  const id = option.id;
2577
- const key = (0, import_records12.optionKey)(option);
2591
+ const key = (0, import_records13.optionKey)(option);
2578
2592
  const label = recordName(option.data, null, "");
2579
2593
  if (label) {
2580
2594
  labels.push(label);
@@ -2586,18 +2600,18 @@ function choiceOptionsOf(options) {
2586
2600
  return { byWord, labels };
2587
2601
  }
2588
2602
  function valueFromPastedText(field, raw, options, relationNames) {
2589
- return (0, import_records12.coerceTypedAnswer)(field, raw, {
2603
+ return (0, import_records13.coerceTypedAnswer)(field, raw, {
2590
2604
  label: fieldName(field),
2591
2605
  ...options ? { options } : {},
2592
2606
  ...relationNames ? { relationNames } : {}
2593
2607
  });
2594
2608
  }
2595
- var import_core4, import_records12;
2609
+ var import_core4, import_records13;
2596
2610
  var init_pasteValues = __esm({
2597
2611
  "src/pasteValues.ts"() {
2598
2612
  "use strict";
2599
2613
  import_core4 = require("@ai-matrx/records/core");
2600
- import_records12 = require("@ai-matrx/records");
2614
+ import_records13 = require("@ai-matrx/records");
2601
2615
  init_names();
2602
2616
  init_names();
2603
2617
  }
@@ -2718,7 +2732,7 @@ function datesOfColumn(rows, header, opts = {}) {
2718
2732
  const raw = String(r[header] ?? "").trim();
2719
2733
  if (raw === "") return;
2720
2734
  filled += 1;
2721
- const got = (0, import_records13.readTypedDate)(raw, { ...opts.withTime ? { withTime: true } : {}, ...opts.locale ? { locale: opts.locale } : {} });
2735
+ const got = (0, import_records14.readTypedDate)(raw, { ...opts.withTime ? { withTime: true } : {}, ...opts.locale ? { locale: opts.locale } : {} });
2722
2736
  if (got.ok) read.set(i, opts.withTime && got.instant ? got.instant : got.day);
2723
2737
  else unreadable.push({ row: i, raw });
2724
2738
  });
@@ -2751,11 +2765,11 @@ function looksLike(rows, header) {
2751
2765
  if (share(isPhone) >= 0.6) return "phone";
2752
2766
  return null;
2753
2767
  }
2754
- var import_records13, IMPORT_KINDS, EMAIL2, PHONE2, URLISH;
2768
+ var import_records14, IMPORT_KINDS, EMAIL2, PHONE2, URLISH;
2755
2769
  var init_importKinds = __esm({
2756
2770
  "src/importKinds.ts"() {
2757
2771
  "use strict";
2758
- import_records13 = require("@ai-matrx/records");
2772
+ import_records14 = require("@ai-matrx/records");
2759
2773
  IMPORT_KINDS = [
2760
2774
  { kind: "text", label: "Text" },
2761
2775
  { kind: "date", label: "Date" },
@@ -2777,7 +2791,7 @@ function titleRepeats(rows, header) {
2777
2791
  const seen = /* @__PURE__ */ new Set();
2778
2792
  let filled = 0;
2779
2793
  for (const r of rows) {
2780
- const key = (0, import_records14.relationNameKey)(String(r[header] ?? ""));
2794
+ const key = (0, import_records15.relationNameKey)(String(r[header] ?? ""));
2781
2795
  if (key === "") continue;
2782
2796
  filled += 1;
2783
2797
  seen.add(key);
@@ -2787,7 +2801,7 @@ function titleRepeats(rows, header) {
2787
2801
  function sameRecordLikely(rows, header, notIdentity) {
2788
2802
  const groups = /* @__PURE__ */ new Map();
2789
2803
  for (const r of rows) {
2790
- const key = (0, import_records14.relationNameKey)(String(r[header] ?? ""));
2804
+ const key = (0, import_records15.relationNameKey)(String(r[header] ?? ""));
2791
2805
  if (key === "") continue;
2792
2806
  const held = groups.get(key);
2793
2807
  if (held) held.push(r);
@@ -2820,7 +2834,7 @@ function combineRows(rows, header) {
2820
2834
  const out = [];
2821
2835
  const outLines = [];
2822
2836
  rows.forEach((r, i) => {
2823
- const key = (0, import_records14.relationNameKey)(String(r[header] ?? ""));
2837
+ const key = (0, import_records15.relationNameKey)(String(r[header] ?? ""));
2824
2838
  if (key === "") {
2825
2839
  out.push({ ...r });
2826
2840
  outLines.push([i + 1]);
@@ -2860,11 +2874,11 @@ function combineRows(rows, header) {
2860
2874
  index.sort((a, b) => a.lines[0] - b.lines[0]);
2861
2875
  return { rows: index.map((e) => e.row), lines: index.map((e) => e.lines), multiValued };
2862
2876
  }
2863
- var import_records14, LIST_JOIN;
2877
+ var import_records15, LIST_JOIN;
2864
2878
  var init_importCombine = __esm({
2865
2879
  "src/importCombine.ts"() {
2866
2880
  "use strict";
2867
- import_records14 = require("@ai-matrx/records");
2881
+ import_records15 = require("@ai-matrx/records");
2868
2882
  LIST_JOIN = "; ";
2869
2883
  }
2870
2884
  });
@@ -3333,13 +3347,13 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
3333
3347
  async (wanted) => {
3334
3348
  const next = /* @__PURE__ */ new Map();
3335
3349
  for (const { header, field } of wanted) {
3336
- const names2 = effectiveRows.flatMap((r) => (0, import_records15.relationNamesIn)(field, String(r[header] ?? "")));
3350
+ const names2 = effectiveRows.flatMap((r) => (0, import_records16.relationNamesIn)(field, String(r[header] ?? "")));
3337
3351
  const got = await client.relationNamesMatch({ table_id: field.relation_target, names: names2 });
3338
3352
  if (!got.ok) {
3339
3353
  setRelationProblem(got.error);
3340
3354
  return null;
3341
3355
  }
3342
- next.set(field.key, (0, import_records15.relationNameIndexOf)(got.data));
3356
+ next.set(field.key, (0, import_records16.relationNameIndexOf)(got.data));
3343
3357
  }
3344
3358
  setRelationProblem(null);
3345
3359
  setRelationIndex(next);
@@ -3363,12 +3377,12 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
3363
3377
  let linked = 0;
3364
3378
  let named = 0;
3365
3379
  effectiveRows.forEach((row, i) => {
3366
- const names2 = (0, import_records15.relationNamesIn)(field, String(row[header] ?? ""));
3380
+ const names2 = (0, import_records16.relationNamesIn)(field, String(row[header] ?? ""));
3367
3381
  if (String(row[header] ?? "").trim() === "") return;
3368
3382
  named += 1;
3369
3383
  let ok = true;
3370
3384
  for (const name of names2) {
3371
- const hits = index.byName.get((0, import_records15.relationNameKey)(name)) ?? [];
3385
+ const hits = index.byName.get((0, import_records16.relationNameKey)(name)) ?? [];
3372
3386
  if (hits.length === 1) continue;
3373
3387
  ok = false;
3374
3388
  if (hits.length === 0) unmatched.set(name, [...unmatched.get(name) ?? [], i + 1]);
@@ -3434,11 +3448,11 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
3434
3448
  const named = index.get(field.key);
3435
3449
  const text = String(row[header] ?? "").trim();
3436
3450
  if (!named || text === "") continue;
3437
- const parts = field.multi ? (0, import_records15.splitListCell)(text) : [text];
3451
+ const parts = field.multi ? (0, import_records16.splitListCell)(text) : [text];
3438
3452
  const ids = [];
3439
3453
  let skip = false;
3440
3454
  for (const part of parts) {
3441
- const hits = (0, import_records15.relationNamesIn)(field, part).length === 0 ? null : named.byName.get((0, import_records15.relationNameKey)(part)) ?? [];
3455
+ const hits = (0, import_records16.relationNamesIn)(field, part).length === 0 ? null : named.byName.get((0, import_records16.relationNameKey)(part)) ?? [];
3442
3456
  if (hits === null) ids.push(part);
3443
3457
  else if (hits.length === 1) ids.push(hits[0].id);
3444
3458
  else if ((hits.length === 0 ? choiceFor(field.key).unmatched : choiceFor(field.key).ambiguous) !== "empty") skip = true;
@@ -3478,7 +3492,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
3478
3492
  setPhase("linking");
3479
3493
  for (const ask of toMerge) {
3480
3494
  for (const [name] of ask.ambiguous) {
3481
- const hits = ask.index.byName.get((0, import_records15.relationNameKey)(name)) ?? [];
3495
+ const hits = ask.index.byName.get((0, import_records16.relationNameKey)(name)) ?? [];
3482
3496
  const winner = hits[0];
3483
3497
  if (!winner) continue;
3484
3498
  for (const loser of hits.slice(1)) {
@@ -4418,7 +4432,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
4418
4432
  table.error ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RefusalNotice, { error: table.error, onRetry: table.reload }) : null
4419
4433
  ] });
4420
4434
  }
4421
- var import_react46, import_react47, import_core6, import_design_system28, import_records15, import_text_case5, import_jsx_runtime32, BATCH, SAMPLES, COLUMNS_PER_CALL, ABSENT, LEAVE, TITLE_COPY, TYPED_VALUES;
4435
+ var import_react46, import_react47, import_core6, import_design_system28, import_records16, import_text_case5, import_jsx_runtime32, BATCH, SAMPLES, COLUMNS_PER_CALL, ABSENT, LEAVE, TITLE_COPY, TYPED_VALUES;
4422
4436
  var init_ImportWizard = __esm({
4423
4437
  "src/ImportWizard.tsx"() {
4424
4438
  "use strict";
@@ -4427,7 +4441,7 @@ var init_ImportWizard = __esm({
4427
4441
  import_react47 = require("@ai-matrx/records/react");
4428
4442
  import_core6 = require("@ai-matrx/records/core");
4429
4443
  import_design_system28 = require("@ai-matrx/design-system");
4430
- import_records15 = require("@ai-matrx/records");
4444
+ import_records16 = require("@ai-matrx/records");
4431
4445
  init_Refusal();
4432
4446
  init_refusals();
4433
4447
  init_importRuleCheck();
@@ -4484,7 +4498,7 @@ var init_tableLanes = __esm({
4484
4498
  });
4485
4499
 
4486
4500
  // src/TablesHome.tsx
4487
- var import_react48, import_react49, import_core7, import_records16, import_design_system29, import_jsx_runtime33;
4501
+ var import_react48, import_react49, import_core7, import_records17, import_design_system29, import_jsx_runtime33;
4488
4502
  var init_TablesHome = __esm({
4489
4503
  "src/TablesHome.tsx"() {
4490
4504
  "use strict";
@@ -4492,7 +4506,7 @@ var init_TablesHome = __esm({
4492
4506
  import_react48 = require("react");
4493
4507
  import_react49 = require("@ai-matrx/records/react");
4494
4508
  import_core7 = require("@ai-matrx/records/core");
4495
- import_records16 = require("@ai-matrx/records");
4509
+ import_records17 = require("@ai-matrx/records");
4496
4510
  import_design_system29 = require("@ai-matrx/design-system");
4497
4511
  init_tableLanes();
4498
4512
  import_jsx_runtime33 = require("react/jsx-runtime");
@@ -5353,7 +5367,7 @@ function AddChoicesInline({ field, onAdded, disabled = false }) {
5353
5367
 
5354
5368
  // src/editors.tsx
5355
5369
  var import_react78 = require("react");
5356
- var import_records29 = require("@ai-matrx/records");
5370
+ var import_records30 = require("@ai-matrx/records");
5357
5371
  var import_react79 = require("@ai-matrx/records/react");
5358
5372
  var import_design_system48 = require("@ai-matrx/design-system");
5359
5373
  init_dates();
@@ -5361,22 +5375,22 @@ init_dates();
5361
5375
  // src/newerKindValues.tsx
5362
5376
  var import_react8 = require("react");
5363
5377
  var import_source = require("@ai-matrx/content-ir/source");
5364
- var import_records2 = require("@ai-matrx/records");
5378
+ var import_records3 = require("@ai-matrx/records");
5365
5379
  var import_design_system6 = require("@ai-matrx/design-system");
5366
5380
  var import_outbound_react = require("@ai-matrx/kit/outbound-react");
5367
5381
  var import_jsx_runtime6 = require("react/jsx-runtime");
5368
5382
  var own = (event) => event.stopPropagation();
5369
5383
  function newerKindValue(field, value, opts = {}) {
5370
- switch ((0, import_records2.newerKindOf)(field)) {
5384
+ switch ((0, import_records3.newerKindOf)(field)) {
5371
5385
  case "duration": {
5372
- const words = (0, import_records2.durationText)(value);
5386
+ const words = (0, import_records3.durationText)(value);
5373
5387
  return words === null ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "tabular-nums", "data-records-duration": "", children: words });
5374
5388
  }
5375
5389
  case "created_by":
5376
5390
  case "modified_by":
5377
- return (0, import_records2.isPersonStamp)(value) ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PersonStampChip, { stamp: value }) : void 0;
5391
+ return (0, import_records3.isPersonStamp)(value) ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PersonStampChip, { stamp: value }) : void 0;
5378
5392
  case "address":
5379
- return (0, import_records2.isAddressValue)(value) || typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AddressLink, { value }) : void 0;
5393
+ return (0, import_records3.isAddressValue)(value) || typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AddressLink, { value }) : void 0;
5380
5394
  case "barcode":
5381
5395
  return typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs", "data-records-barcode": "", title: value, children: [
5382
5396
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u25AE\u25AF\u25AE" }),
@@ -5391,7 +5405,7 @@ function newerKindValue(field, value, opts = {}) {
5391
5405
  }
5392
5406
  }
5393
5407
  function PersonStampChip({ stamp }) {
5394
- const words = (0, import_records2.personStampText)(stamp) ?? import_records2.NOT_A_MEMBER_WORDS;
5408
+ const words = (0, import_records3.personStampText)(stamp) ?? import_records3.NOT_A_MEMBER_WORDS;
5395
5409
  const tier = stamp.actor ?? "user";
5396
5410
  const name = tier === "user" ? stamp.name : null;
5397
5411
  const initial = tier === "system" ? "\u2699" : tier === "agent" ? "\u2726" : name && name.trim() !== "" ? name.trim()[0].toUpperCase() : "?";
@@ -5408,8 +5422,8 @@ function PersonStampChip({ stamp }) {
5408
5422
  ] });
5409
5423
  }
5410
5424
  function AddressLink({ value }) {
5411
- const words = (0, import_records2.addressValueText)(value);
5412
- const href = (0, import_records2.addressMapUrl)(value);
5425
+ const words = (0, import_records3.addressValueText)(value);
5426
+ const href = (0, import_records3.addressMapUrl)(value);
5413
5427
  if (!words || !href) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
5414
5428
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
5415
5429
  import_outbound_react.OutboundLink,
@@ -5428,11 +5442,11 @@ function AddressLink({ value }) {
5428
5442
  }
5429
5443
  var STATUS_GROUP_MARK = { todo: "\u25CB", in_progress: "\u25D0", done: "\u25CF" };
5430
5444
  function statusMarkOf(field, value, document2) {
5431
- if ((0, import_records2.newerKindOf)(field) !== "status" || typeof value !== "string") return null;
5445
+ if ((0, import_records3.newerKindOf)(field) !== "status" || typeof value !== "string") return null;
5432
5446
  const chosen = document2?.["_choices"]?.[field.key];
5433
5447
  const key = chosen && typeof chosen === "object" && typeof chosen.key === "string" ? chosen.key : value;
5434
- const group = (0, import_records2.statusGroupOf)(field, key);
5435
- return { mark: STATUS_GROUP_MARK[group], group, words: import_records2.STATUS_GROUP_WORDS[group] };
5448
+ const group = (0, import_records3.statusGroupOf)(field, key);
5449
+ return { mark: STATUS_GROUP_MARK[group], group, words: import_records3.STATUS_GROUP_WORDS[group] };
5436
5450
  }
5437
5451
  function inline(text, key) {
5438
5452
  const out = [];
@@ -5460,7 +5474,7 @@ function marks(text, key) {
5460
5474
  if (tok.startsWith("**") || tok.startsWith("__")) out.push(/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: tok.slice(2, -2) }, k));
5461
5475
  else if (tok.startsWith("[")) {
5462
5476
  const link = /^\[([^\]]+)\]\(([^)\s]+)\)$/.exec(tok);
5463
- const href = (0, import_records2.safeLinkHref)(link?.[2] ?? "");
5477
+ const href = (0, import_records3.safeLinkHref)(link?.[2] ?? "");
5464
5478
  out.push(
5465
5479
  href ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_outbound_react.OutboundLink, { href, className: "text-primary underline-offset-2 hover:underline", onClick: own, children: link?.[1] }, k) : link?.[1] ?? tok
5466
5480
  );
@@ -5525,7 +5539,7 @@ function SafeMarkdown({ text, clipped }) {
5525
5539
  );
5526
5540
  }
5527
5541
  function newerKindControl(props) {
5528
- switch ((0, import_records2.newerKindOf)(props.field)) {
5542
+ switch ((0, import_records3.newerKindOf)(props.field)) {
5529
5543
  case "duration":
5530
5544
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DurationControl, { ...props });
5531
5545
  case "address":
@@ -5541,10 +5555,10 @@ function newerKindControl(props) {
5541
5555
  }
5542
5556
  }
5543
5557
  function DurationControl({ value, onChange, disabled, id }) {
5544
- const [text, setText] = (0, import_react8.useState)(() => (0, import_records2.durationText)(value) ?? "");
5558
+ const [text, setText] = (0, import_react8.useState)(() => (0, import_records3.durationText)(value) ?? "");
5545
5559
  const [wrong, setWrong] = (0, import_react8.useState)(false);
5546
5560
  (0, import_react8.useEffect)(() => {
5547
- setText((0, import_records2.durationText)(value) ?? "");
5561
+ setText((0, import_records3.durationText)(value) ?? "");
5548
5562
  }, [value]);
5549
5563
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "flex flex-col gap-1", children: [
5550
5564
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
@@ -5564,12 +5578,12 @@ function DurationControl({ value, onChange, disabled, id }) {
5564
5578
  onChange(null);
5565
5579
  return;
5566
5580
  }
5567
- const seconds = (0, import_records2.readTypedDuration)(e.target.value);
5581
+ const seconds = (0, import_records3.readTypedDuration)(e.target.value);
5568
5582
  setWrong(seconds === null);
5569
5583
  if (seconds !== null) onChange(seconds);
5570
5584
  },
5571
5585
  onBlur: () => {
5572
- if (!wrong) setText((0, import_records2.durationText)(value) ?? "");
5586
+ if (!wrong) setText((0, import_records3.durationText)(value) ?? "");
5573
5587
  }
5574
5588
  }
5575
5589
  ),
@@ -5591,13 +5605,13 @@ var ADDRESS_EXAMPLES = {
5591
5605
  country: "US"
5592
5606
  };
5593
5607
  function AddressControl({ value, onChange, disabled, id }) {
5594
- const held = (0, import_records2.isAddressValue)(value) ? value : typeof value === "string" && value.trim() !== "" ? { street: value } : {};
5608
+ const held = (0, import_records3.isAddressValue)(value) ? value : typeof value === "string" && value.trim() !== "" ? { street: value } : {};
5595
5609
  const set = (part, words) => {
5596
5610
  const next = { ...held, [part]: words };
5597
5611
  const kept2 = Object.fromEntries(Object.entries(next).filter(([, v]) => typeof v === "string" && v.trim() !== ""));
5598
5612
  onChange(Object.keys(kept2).length === 0 ? null : kept2);
5599
5613
  };
5600
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { id, className: "grid grid-cols-2 gap-1.5", "data-records-address-control": "", children: import_records2.ADDRESS_PARTS.map((part) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5614
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { id, className: "grid grid-cols-2 gap-1.5", "data-records-address-control": "", children: import_records3.ADDRESS_PARTS.map((part) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5601
5615
  import_design_system6.BasicInput,
5602
5616
  {
5603
5617
  "aria-label": ADDRESS_LABELS[part],
@@ -5678,7 +5692,7 @@ init_names();
5678
5692
 
5679
5693
  // src/RelationPicker.tsx
5680
5694
  var import_react10 = require("react");
5681
- var import_records3 = require("@ai-matrx/records");
5695
+ var import_records4 = require("@ai-matrx/records");
5682
5696
  var import_react11 = require("@ai-matrx/records/react");
5683
5697
  var import_design_system9 = require("@ai-matrx/design-system");
5684
5698
  init_PickOrAdd();
@@ -5949,7 +5963,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
5949
5963
  toggle(createdId);
5950
5964
  };
5951
5965
  const apart = tellApart(rows ?? [], titleOf);
5952
- const visible = (0, import_records3.rankTypedMatches)(rows ?? [], search, (row) => [titleOf(row.id), apart.get(row.id) ?? ""]);
5966
+ const visible = (0, import_records4.rankTypedMatches)(rows ?? [], search, (row) => [titleOf(row.id), apart.get(row.id) ?? ""]);
5953
5967
  const anchored = autoOpen === true;
5954
5968
  const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5955
5969
  RecordChip,
@@ -6083,7 +6097,7 @@ function readableLink(raw) {
6083
6097
  var import_react73 = require("react");
6084
6098
  var import_design_system45 = require("@ai-matrx/design-system");
6085
6099
  var import_data_table6 = require("@ai-matrx/design-system/data-table");
6086
- var import_records27 = require("@ai-matrx/records");
6100
+ var import_records28 = require("@ai-matrx/records");
6087
6101
  var import_react74 = require("@ai-matrx/records/react");
6088
6102
  init_host();
6089
6103
 
@@ -6522,7 +6536,7 @@ function ReferenceBuilder({
6522
6536
  // src/FormulaTextEditor.tsx
6523
6537
  var import_react18 = require("react");
6524
6538
  var import_react19 = require("@ai-matrx/records/react");
6525
- var import_records5 = require("@ai-matrx/records");
6539
+ var import_records6 = require("@ai-matrx/records");
6526
6540
  var import_design_system14 = require("@ai-matrx/design-system");
6527
6541
  init_host();
6528
6542
  init_Refusal();
@@ -6546,7 +6560,7 @@ var NOT_TYPED_BY_NAME = /* @__PURE__ */ new Set([
6546
6560
  function formulaFunctionNames(kinds) {
6547
6561
  return [...new Set(kinds.map((row) => row.node))].filter((node) => node.startsWith("fx.") && !NOT_TYPED_BY_NAME.has(node)).map((node) => node.slice(3).toUpperCase()).sort();
6548
6562
  }
6549
- var STORE_FORMULA_FUNCTION_NAMES = formulaFunctionNames(import_records5.RULE_NODE_KINDS);
6563
+ var STORE_FORMULA_FUNCTION_NAMES = formulaFunctionNames(import_records6.RULE_NODE_KINDS);
6550
6564
  var RESULT_WORD = {
6551
6565
  number: "a number",
6552
6566
  text: "text",
@@ -6913,8 +6927,8 @@ var EMBEDDED_TABLE_CLASS = [
6913
6927
  // src/labels.tsx
6914
6928
  var import_react28 = require("react");
6915
6929
  var import_react29 = require("@ai-matrx/records/react");
6916
- var import_records6 = require("@ai-matrx/records");
6917
6930
  var import_records7 = require("@ai-matrx/records");
6931
+ var import_records8 = require("@ai-matrx/records");
6918
6932
  init_names();
6919
6933
  var import_uuid2 = require("@ai-matrx/kit/uuid");
6920
6934
 
@@ -8145,7 +8159,7 @@ function RecordLabelProvider({ children }) {
8145
8159
  for (const option of result.data ?? []) {
8146
8160
  const words = recordName(option.data, null, "Unnamed choice");
8147
8161
  next[option.id] = words;
8148
- const key = (0, import_records7.optionKey)(option);
8162
+ const key = (0, import_records8.optionKey)(option);
8149
8163
  if (key) next[choiceKeyName(field.id, key)] = words;
8150
8164
  }
8151
8165
  return next;
@@ -8263,7 +8277,7 @@ init_enumLabels();
8263
8277
 
8264
8278
  // src/EntityReferenceControl.tsx
8265
8279
  var import_react31 = require("react");
8266
- var import_records8 = require("@ai-matrx/records");
8280
+ var import_records9 = require("@ai-matrx/records");
8267
8281
  var import_react32 = require("@ai-matrx/records/react");
8268
8282
  var import_design_system20 = require("@ai-matrx/design-system");
8269
8283
  init_PickOrAdd();
@@ -8273,7 +8287,7 @@ var import_jsx_runtime24 = require("react/jsx-runtime");
8273
8287
  var WITHHELD_ENTITY_LABEL = "Something you have not been given access to";
8274
8288
  var ENTITY_REFERENCE_EMPTY = "Nothing is pointed at yet.";
8275
8289
  function entityReferenceText(value) {
8276
- const refs = (0, import_records8.entityRefsOf)(value);
8290
+ const refs = (0, import_records9.entityRefsOf)(value);
8277
8291
  if (refs.length === 0) return "\u2014";
8278
8292
  return refs.map((r) => r.label ?? WITHHELD_ENTITY_LABEL).join(", ");
8279
8293
  }
@@ -8287,7 +8301,7 @@ function EntityReferenceControl(props) {
8287
8301
  return client ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(WithWords, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Chips, { ...props, words: null, picker: null });
8288
8302
  }
8289
8303
  function WithWords(props) {
8290
- const refs = (0, import_react31.useMemo)(() => (0, import_records8.entityRefsOf)(props.value), [props.value]);
8304
+ const refs = (0, import_react31.useMemo)(() => (0, import_records9.entityRefsOf)(props.value), [props.value]);
8291
8305
  const [known, setKnown] = (0, import_react31.useState)([]);
8292
8306
  const withKnown = refs.map((r) => r.label === null ? known.find((k) => k.token === r.token && k.id === r.id) ?? r : r);
8293
8307
  const unlabelled = (0, import_react31.useMemo)(
@@ -8307,14 +8321,14 @@ function WithWords(props) {
8307
8321
  initialSearch: props.initialSearch,
8308
8322
  onTakeOff: (ref) => {
8309
8323
  const rest = withKnown.filter((x) => !(x.token === ref.token && x.id === ref.id));
8310
- props.onChange((0, import_records8.entityRefsToWrite)(rest, Boolean(props.field.multi)));
8324
+ props.onChange((0, import_records9.entityRefsToWrite)(rest, Boolean(props.field.multi)));
8311
8325
  },
8312
8326
  labelOf: (r) => r.label ?? words?.data?.find((w) => w.token === r.token && w.id === r.id)?.label ?? WITHHELD_ENTITY_LABEL,
8313
8327
  onPick: (picked) => {
8314
8328
  setKnown((k) => [...k.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked]);
8315
8329
  const multi = Boolean(props.field.multi);
8316
8330
  const next = multi ? [...withKnown.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked] : [picked];
8317
- props.onChange((0, import_records8.entityRefsToWrite)(next, multi));
8331
+ props.onChange((0, import_records9.entityRefsToWrite)(next, multi));
8318
8332
  }
8319
8333
  }
8320
8334
  );
@@ -8425,7 +8439,7 @@ function Chips({
8425
8439
  words,
8426
8440
  picker
8427
8441
  }) {
8428
- const refs = (0, import_react31.useMemo)(() => (0, import_records8.entityRefsOf)(value), [value]);
8442
+ const refs = (0, import_react31.useMemo)(() => (0, import_records9.entityRefsOf)(value), [value]);
8429
8443
  const labelOf = (token, refId, own3) => {
8430
8444
  if (own3) return own3;
8431
8445
  const read = words?.data?.find((w) => w.token === token && w.id === refId)?.label;
@@ -8449,7 +8463,7 @@ function Chips({
8449
8463
  "aria-label": `Take ${label} off`,
8450
8464
  onClick: () => {
8451
8465
  const rest = refs.filter((x) => !(x.token === r.token && x.id === r.id));
8452
- onChange((0, import_records8.entityRefsToWrite)(rest, multi));
8466
+ onChange((0, import_records9.entityRefsToWrite)(rest, multi));
8453
8467
  },
8454
8468
  children: "\xD7"
8455
8469
  }
@@ -9061,7 +9075,7 @@ function AttachmentControl({
9061
9075
  }
9062
9076
 
9063
9077
  // src/ReferenceChips.tsx
9064
- var import_records9 = require("@ai-matrx/records");
9078
+ var import_records10 = require("@ai-matrx/records");
9065
9079
  var import_design_system26 = require("@ai-matrx/design-system");
9066
9080
  init_host();
9067
9081
  init_kindValues();
@@ -9082,7 +9096,7 @@ function iconOf(pair) {
9082
9096
  }
9083
9097
  function referenceChipsOf(field, value, kind, labels) {
9084
9098
  if (kind === "entity_reference") {
9085
- return (0, import_records9.entityRefsOf)(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
9099
+ return (0, import_records10.entityRefsOf)(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
9086
9100
  }
9087
9101
  const ids = (Array.isArray(value) ? value : [value]).filter(isId).map(String);
9088
9102
  const tableId = typeof field.relation_target === "string" ? field.relation_target : void 0;
@@ -9171,7 +9185,7 @@ function KindValueCell({
9171
9185
  init_kindValues();
9172
9186
 
9173
9187
  // src/formulaNames.ts
9174
- var import_records10 = require("@ai-matrx/records");
9188
+ var import_records11 = require("@ai-matrx/records");
9175
9189
  init_names();
9176
9190
  function fieldRefsOf(expr) {
9177
9191
  const out = [];
@@ -9222,14 +9236,14 @@ function formulaSourceArchived(field, document2) {
9222
9236
  const keys = (field.config ?? {})[FORMULA_INPUT_KEYS];
9223
9237
  if (!Array.isArray(keys) || !document2) return null;
9224
9238
  for (const key of keys) {
9225
- const state2 = (0, import_records10.sourceArchivedOf)(document2[String(key)]);
9239
+ const state2 = (0, import_records11.sourceArchivedOf)(document2[String(key)]);
9226
9240
  if (state2) return state2;
9227
9241
  }
9228
9242
  return null;
9229
9243
  }
9230
9244
 
9231
9245
  // src/values.tsx
9232
- var import_records17 = require("@ai-matrx/records");
9246
+ var import_records18 = require("@ai-matrx/records");
9233
9247
  var import_uuid4 = require("@ai-matrx/kit/uuid");
9234
9248
  init_userIds();
9235
9249
 
@@ -9671,7 +9685,7 @@ function structuredNode(field, structured, room) {
9671
9685
  return room === "cell" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(StructuredCell, { structured, label }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(StructuredValueView, { structured, label });
9672
9686
  }
9673
9687
  function renderValue(field, value, document2, labels, stillWaitingFor, look, room = "cell") {
9674
- const archivedSource = (0, import_records17.sourceArchivedOf)(value);
9688
+ const archivedSource = (0, import_records18.sourceArchivedOf)(value);
9675
9689
  if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SourceArchivedValue, { state: archivedSource });
9676
9690
  const envelope = envelopeFor(document2, field.key);
9677
9691
  if (envelope?.absent) {
@@ -9694,7 +9708,7 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look, roo
9694
9708
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
9695
9709
  }
9696
9710
  if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SignatureValue, { value, fieldKey: field.key, document: document2 });
9697
- if ((0, import_records17.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ButtonValue, { field });
9711
+ if ((0, import_records18.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ButtonValue, { field });
9698
9712
  const newer = newerKindValue(field, value);
9699
9713
  if (newer !== void 0) return newer;
9700
9714
  const whole = typeof value === "string" ? (0, import_core8.wholeValueOf)(document2, field.key) : null;
@@ -9832,10 +9846,10 @@ function personWordsOf(kind, value) {
9832
9846
  }
9833
9847
  function scalarText(field, value, labels, stillWaitingFor) {
9834
9848
  if (value === null || value === void 0) return "\u2014";
9835
- if ((0, import_records17.sourceArchivedOf)(value)) return SOURCE_ARCHIVED_WORDS;
9849
+ if ((0, import_records18.sourceArchivedOf)(value)) return SOURCE_ARCHIVED_WORDS;
9836
9850
  if (isSignatureField(field)) return signatureWords(value) ?? "\u2014";
9837
- if ((0, import_records17.autonumberPrefixOf)(field)) return (0, import_records17.autonumberWords)(field, value) ?? String(value);
9838
- const newerWords = (0, import_records17.newerKindWords)(field, value);
9851
+ if ((0, import_records18.autonumberPrefixOf)(field)) return (0, import_records18.autonumberWords)(field, value) ?? String(value);
9852
+ const newerWords = (0, import_records18.newerKindWords)(field, value);
9839
9853
  if (newerWords !== null) return newerWords;
9840
9854
  const kind = editorKindFor(field);
9841
9855
  if (kind === "entity_reference") return entityReferenceText(value);
@@ -9928,7 +9942,7 @@ function SourceArchivedNotice({ fieldId, tableId }) {
9928
9942
  // src/Condition.tsx
9929
9943
  var import_react57 = require("react");
9930
9944
  var import_design_system34 = require("@ai-matrx/design-system");
9931
- var import_records18 = require("@ai-matrx/records");
9945
+ var import_records19 = require("@ai-matrx/records");
9932
9946
  init_PickOrAdd();
9933
9947
  init_choiceLooks();
9934
9948
  var import_react58 = require("@ai-matrx/records/react");
@@ -10054,7 +10068,7 @@ function ChoiceValues({ field, value, onChange }) {
10054
10068
  let cancelled = false;
10055
10069
  void (0, askOnce_exports.fieldOptionsOnce)(client, field.id).then((got) => {
10056
10070
  if (cancelled) return;
10057
- setChoices(got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records18.optionKey)(o), label: (0, import_records18.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []);
10071
+ setChoices(got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records19.optionKey)(o), label: (0, import_records19.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []);
10058
10072
  });
10059
10073
  return () => {
10060
10074
  cancelled = true;
@@ -10110,7 +10124,7 @@ function ChoiceValue({ field, value, onChange }) {
10110
10124
  void (0, askOnce_exports.fieldOptionsOnce)(client, field.id).then((got) => {
10111
10125
  if (cancelled) return;
10112
10126
  setChoices(
10113
- got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records18.optionKey)(o), label: (0, import_records18.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []
10127
+ got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records19.optionKey)(o), label: (0, import_records19.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []
10114
10128
  );
10115
10129
  });
10116
10130
  return () => {
@@ -10128,7 +10142,7 @@ function ChoiceValue({ field, value, onChange }) {
10128
10142
  }
10129
10143
  );
10130
10144
  }
10131
- const shown2 = (0, import_records18.rankTypedMatches)(choices, search.trim(), (c) => c.label);
10145
+ const shown2 = (0, import_records19.rankTypedMatches)(choices, search.trim(), (c) => c.label);
10132
10146
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "inline-flex min-w-0", "data-records-condition-choice": "", "data-pick-value": value, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
10133
10147
  PickOrAdd,
10134
10148
  {
@@ -10640,7 +10654,7 @@ function ConditionGroup({
10640
10654
 
10641
10655
  // src/FieldRetype.tsx
10642
10656
  var import_react59 = require("react");
10643
- var import_records19 = require("@ai-matrx/records");
10657
+ var import_records20 = require("@ai-matrx/records");
10644
10658
  var import_react60 = require("@ai-matrx/records/react");
10645
10659
  var import_design_system35 = require("@ai-matrx/design-system");
10646
10660
  init_parity();
@@ -10856,7 +10870,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
10856
10870
  return;
10857
10871
  }
10858
10872
  const groups = rows.map((r) => ({ value: r.ids.map((id) => people.get(id)?.name ?? "").join(", "), count: 1 }));
10859
- setPreview((0, import_records19.previewRetype)({ type: to.behaviour, kind: to.kind }, groups, false));
10873
+ setPreview((0, import_records20.previewRetype)({ type: to.behaviour, kind: to.kind }, groups, false));
10860
10874
  }).catch((e) => {
10861
10875
  if (cancelled) return;
10862
10876
  setAsking(false);
@@ -11003,7 +11017,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
11003
11017
 
11004
11018
  // src/FieldRulePreview.tsx
11005
11019
  var import_react61 = require("react");
11006
- var import_records20 = require("@ai-matrx/records");
11020
+ var import_records21 = require("@ai-matrx/records");
11007
11021
  var import_react62 = require("@ai-matrx/records/react");
11008
11022
  init_Refusal();
11009
11023
  init_names();
@@ -11053,7 +11067,7 @@ function FieldRulePreview({ field, tableId, rules }) {
11053
11067
  }
11054
11068
  const numbers = holdsNumbers(field);
11055
11069
  const groups = answer.data.map((row) => ({ value: groupValue(row.groups[field.key] ?? null, numbers), count: row.row_count }));
11056
- setPreview((0, import_records20.previewRuleChange)(latest.current, groups, answer.data.length >= PREVIEW_GROUPS));
11070
+ setPreview((0, import_records21.previewRuleChange)(latest.current, groups, answer.data.length >= PREVIEW_GROUPS));
11057
11071
  }).catch((thrown) => {
11058
11072
  if (cancelled) return;
11059
11073
  setRefusal((0, refusals_exports.refusalFromThrown)(thrown, `${name}'s values could not be counted.`, "The check still applies when you save."));
@@ -11238,7 +11252,7 @@ function PickListLink({
11238
11252
  }
11239
11253
 
11240
11254
  // src/NewerKindQuestions.tsx
11241
- var import_records21 = require("@ai-matrx/records");
11255
+ var import_records22 = require("@ai-matrx/records");
11242
11256
  var import_design_system37 = require("@ai-matrx/design-system");
11243
11257
  var import_jsx_runtime42 = require("react/jsx-runtime");
11244
11258
  var STATUS_STARTING_CHOICES = [
@@ -11259,7 +11273,7 @@ function statusGroupRows(field, rows, keyOfId, changed) {
11259
11273
  if (words === "") continue;
11260
11274
  const ref = r.id ?? words;
11261
11275
  const key = r.id ? keyOfId[r.id] : void 0;
11262
- const held = field && key ? (0, import_records21.statusGroupOf)(field, key) : void 0;
11276
+ const held = field && key ? (0, import_records22.statusGroupOf)(field, key) : void 0;
11263
11277
  out.push({ ref, words, group: changed[ref] ?? held ?? guessStatusGroup(words) });
11264
11278
  }
11265
11279
  return out;
@@ -11275,10 +11289,10 @@ function StatusGroupsQuestion({
11275
11289
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "min-w-0 flex-1 truncate text-sm", children: r.words }),
11276
11290
  /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_design_system37.Select, { value: r.group, onValueChange: (next) => onGroup(r.ref, next), children: [
11277
11291
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectTrigger, { size: "sm", className: "w-36", "aria-label": `Group for ${r.words}`, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectValue, {}) }),
11278
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectContent, { children: import_records21.STATUS_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_design_system37.SelectItem, { value: g, children: [
11292
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectContent, { children: import_records22.STATUS_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_design_system37.SelectItem, { value: g, children: [
11279
11293
  STATUS_GROUP_MARK[g],
11280
11294
  " ",
11281
- import_records21.STATUS_GROUP_WORDS[g]
11295
+ import_records22.STATUS_GROUP_WORDS[g]
11282
11296
  ] }, g)) })
11283
11297
  ] })
11284
11298
  ] }, r.ref))
@@ -11316,7 +11330,7 @@ function BarcodeSymbologyQuestion({ value, onChange }) {
11316
11330
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectTrigger, { size: "sm", "aria-label": "Code type", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectValue, {}) }),
11317
11331
  /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_design_system37.SelectContent, { children: [
11318
11332
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectItem, { value: "any", children: "Any code" }),
11319
- import_records21.BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectItem, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
11333
+ import_records22.BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system37.SelectItem, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
11320
11334
  ] })
11321
11335
  ] })
11322
11336
  ] });
@@ -11679,21 +11693,21 @@ function nextFieldSort(fields) {
11679
11693
 
11680
11694
  // src/FieldEditor.tsx
11681
11695
  init_enumLabels();
11682
- var import_records25 = require("@ai-matrx/records");
11696
+ var import_records26 = require("@ai-matrx/records");
11683
11697
 
11684
11698
  // src/ButtonSettings.tsx
11685
11699
  var import_react67 = require("react");
11686
11700
  var import_design_system42 = require("@ai-matrx/design-system");
11687
11701
  var import_data_table5 = require("@ai-matrx/design-system/data-table");
11688
- var import_records23 = require("@ai-matrx/records");
11702
+ var import_records24 = require("@ai-matrx/records");
11689
11703
  var import_react68 = require("@ai-matrx/records/react");
11690
11704
 
11691
11705
  // src/AccentSwatches.tsx
11692
- var import_records22 = require("@ai-matrx/records");
11706
+ var import_records23 = require("@ai-matrx/records");
11693
11707
  var import_design_system40 = require("@ai-matrx/design-system");
11694
11708
  var import_data_table4 = require("@ai-matrx/design-system/data-table");
11695
11709
  var import_jsx_runtime45 = require("react/jsx-runtime");
11696
- function AccentSwatches({ value, onChange, options = import_records22.PORTAL_ACCENTS, noneLabel = "App color" }) {
11710
+ function AccentSwatches({ value, onChange, options = import_records23.PORTAL_ACCENTS, noneLabel = "App color" }) {
11697
11711
  return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Color", children: [
11698
11712
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
11699
11713
  "button",
@@ -11817,7 +11831,7 @@ var DOES_WORDS = {
11817
11831
  };
11818
11832
  function buttonUrlInWords(url, fields) {
11819
11833
  let out = url;
11820
- for (const id of (0, import_records23.buttonUrlPlaceholders)(url)) {
11834
+ for (const id of (0, import_records24.buttonUrlPlaceholders)(url)) {
11821
11835
  const f = fields.find((x) => x.id === id || x.key === id);
11822
11836
  if (f) out = out.split(`{{${id}}}`).join(`{${fieldName(f)}}`);
11823
11837
  }
@@ -11912,7 +11926,7 @@ function ButtonSettingsEditor({
11912
11926
  }
11913
11927
  ) : null
11914
11928
  ] }),
11915
- value.url && (0, import_records23.buttonUrlPlaceholders)(value.url).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
11929
+ value.url && (0, import_records24.buttonUrlPlaceholders)(value.url).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
11916
11930
  ] }) : null,
11917
11931
  value.do === "add_row" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(AddRowSettings, { value, onChange, tableId, fields }) : null,
11918
11932
  value.do === "run_action" ? !tableId ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-xs text-muted-foreground", children: "Row actions belong to a table" }) : actionsRefused ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RefusalLine, { error: actionsRefused }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-2", "data-records-button-action": "", children: [
@@ -12019,11 +12033,11 @@ function NewRowAction({
12019
12033
  }
12020
12034
 
12021
12035
  // src/FieldEditor.tsx
12022
- var import_records26 = require("@ai-matrx/records");
12036
+ var import_records27 = require("@ai-matrx/records");
12023
12037
 
12024
12038
  // src/RecordTypes.tsx
12025
12039
  var import_react69 = require("react");
12026
- var import_records24 = require("@ai-matrx/records");
12040
+ var import_records25 = require("@ai-matrx/records");
12027
12041
  var import_react70 = require("@ai-matrx/records/react");
12028
12042
  var import_design_system43 = require("@ai-matrx/design-system");
12029
12043
 
@@ -12058,7 +12072,7 @@ function useTypeChoices(typeField) {
12058
12072
  }
12059
12073
  let live = true;
12060
12074
  void client.fieldOptions({ field_id: id }).then((got) => {
12061
- if (live && got.ok) setChoices((got.data ?? []).map((o) => ({ key: (0, import_records24.optionKey)(o), label: (0, import_records24.optionLabel)(o) })));
12075
+ if (live && got.ok) setChoices((got.data ?? []).map((o) => ({ key: (0, import_records25.optionKey)(o), label: (0, import_records25.optionLabel)(o) })));
12062
12076
  });
12063
12077
  return () => {
12064
12078
  live = false;
@@ -12073,7 +12087,7 @@ function AppliesToTypes({
12073
12087
  }) {
12074
12088
  const choices = useTypeChoices(typeField);
12075
12089
  if (!typeField || choices.length === 0) return null;
12076
- const has = (key, label) => value.some((v) => (0, import_records24.fieldAppliesToType)({ applies_to_types: [v] }, key) || (0, import_records24.fieldAppliesToType)({ applies_to_types: [v] }, label));
12090
+ const has = (key, label) => value.some((v) => (0, import_records25.fieldAppliesToType)({ applies_to_types: [v] }, key) || (0, import_records25.fieldAppliesToType)({ applies_to_types: [v] }, label));
12077
12091
  return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col gap-1", "data-records-field-applies-to": "", children: [
12078
12092
  /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-muted-foreground", children: "Applies to" }),
12079
12093
  /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-1", children: choices.map((choice) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-1.5", children: [
@@ -12084,7 +12098,7 @@ function AppliesToTypes({
12084
12098
  "aria-label": `Applies to ${choice.label}`,
12085
12099
  "data-records-field-applies-to-type": choice.key,
12086
12100
  onCheckedChange: (on) => {
12087
- const rest = value.filter((v) => !((0, import_records24.fieldAppliesToType)({ applies_to_types: [v] }, choice.key) || (0, import_records24.fieldAppliesToType)({ applies_to_types: [v] }, choice.label)));
12101
+ const rest = value.filter((v) => !((0, import_records25.fieldAppliesToType)({ applies_to_types: [v] }, choice.key) || (0, import_records25.fieldAppliesToType)({ applies_to_types: [v] }, choice.label)));
12088
12102
  onValue(on === true ? [...rest, choice.key] : rest);
12089
12103
  }
12090
12104
  }
@@ -12097,8 +12111,8 @@ function AppliesToTypes({
12097
12111
  // src/FieldEditor.tsx
12098
12112
  var import_jsx_runtime49 = require("react/jsx-runtime");
12099
12113
  var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
12100
- var SENSITIVITIES = import_records26.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
12101
- var AGENT_VISIBILITY = import_records26.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
12114
+ var SENSITIVITIES = import_records27.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
12115
+ var AGENT_VISIBILITY = import_records27.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
12102
12116
  var ROLLUP_OPERATIONS = ROLLUP_AGG_VALUES.map((value) => ({
12103
12117
  value,
12104
12118
  label: ROLLUP_AGG_LABEL[value]
@@ -12181,7 +12195,7 @@ function FieldEditor(props) {
12181
12195
  const onEntity = entityToken !== null;
12182
12196
  const tableId = props.tableId ?? "";
12183
12197
  const table = (0, import_react72.useTable)(onEntity ? null : tableId);
12184
- const tableFields = (0, import_react72.useFields)(onEntity ? null : tableId, import_records26.EVERY_RECORD_TYPE);
12198
+ const tableFields = (0, import_react72.useFields)(onEntity ? null : tableId, import_records27.EVERY_RECORD_TYPE);
12185
12199
  const entityFields = (0, import_react72.useEntityFields)(entityToken);
12186
12200
  const fields = onEntity ? entityFields : tableFields;
12187
12201
  const tableRights2 = useTableRights(onEntity ? null : table.data);
@@ -12202,27 +12216,27 @@ function FieldEditor(props) {
12202
12216
  const [label, setLabel] = (0, import_react71.useState)(field?.label ?? (copyOf ? `${copyOf.label} (1)` : startAs?.label ?? ""));
12203
12217
  const [type, setType] = (0, import_react71.useState)(() => startAs ? startAs.type : startingType(start));
12204
12218
  const [required, setRequired] = (0, import_react71.useState)(start?.required ?? false);
12205
- const [appliesTo, setAppliesTo] = (0, import_react71.useState)(() => (0, import_records26.typesOfField)(start ?? { applies_to_types: [] }));
12219
+ const [appliesTo, setAppliesTo] = (0, import_react71.useState)(() => (0, import_records27.typesOfField)(start ?? { applies_to_types: [] }));
12206
12220
  const [multi, setMulti] = (0, import_react71.useState)(start?.multi ?? false);
12207
12221
  const [dated, setDated] = (0, import_react71.useState)(start?.dated ?? false);
12208
12222
  const [sensitivity, setSensitivity] = (0, import_react71.useState)(String(start?.sensitivity ?? "internal"));
12209
12223
  const [contextPolicy, setContextPolicy] = (0, import_react71.useState)(String(start?.context_policy ?? "include"));
12210
12224
  const [rules, setRules] = (0, import_react71.useState)(start?.rules ?? []);
12211
12225
  const [startsWith, setStartsWith] = (0, import_react71.useState)(start?.default ?? null);
12212
- const [ratingMax, setRatingMax] = (0, import_react71.useState)(() => start ? (0, import_records26.ratingMaxOf)(start) : 5);
12226
+ const [ratingMax, setRatingMax] = (0, import_react71.useState)(() => start ? (0, import_records27.ratingMaxOf)(start) : 5);
12213
12227
  const savedRules = (0, import_react71.useMemo)(
12214
- () => field ? type === "rating" ? (0, import_records26.rulesWithTopStar)(field.rules ?? [], (0, import_records26.ratingMaxOf)(field)) : field.rules ?? [] : [],
12228
+ () => field ? type === "rating" ? (0, import_records27.rulesWithTopStar)(field.rules ?? [], (0, import_records27.ratingMaxOf)(field)) : field.rules ?? [] : [],
12215
12229
  [field, type]
12216
12230
  );
12217
- const editedRules = (0, import_react71.useMemo)(() => type === "rating" ? (0, import_records26.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
12231
+ const editedRules = (0, import_react71.useMemo)(() => type === "rating" ? (0, import_records27.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
12218
12232
  const [statusGroups, setStatusGroups] = (0, import_react71.useState)({});
12219
12233
  const [statusKeys, setStatusKeys] = (0, import_react71.useState)({});
12220
12234
  const [symbology, setSymbology] = (0, import_react71.useState)(String(start?.config?.["symbology"] ?? ""));
12221
12235
  const descriptionStart = String(start?.config?.["description"] ?? "");
12222
12236
  const [description, setDescription] = (0, import_react71.useState)(descriptionStart);
12223
- const buttonStart = (0, import_react71.useMemo)(() => (0, import_records25.buttonOf)(start) ?? { label: "" }, [start]);
12237
+ const buttonStart = (0, import_react71.useMemo)(() => (0, import_records26.buttonOf)(start) ?? { label: "" }, [start]);
12224
12238
  const [buttonSettings, setButtonSettings] = (0, import_react71.useState)(buttonStart);
12225
- const prefixStart = (0, import_records25.autonumberPrefixOf)(start);
12239
+ const prefixStart = (0, import_records26.autonumberPrefixOf)(start);
12226
12240
  const [numberPrefix, setNumberPrefix] = (0, import_react71.useState)(prefixStart);
12227
12241
  const dependencyStart = start?.config?.["dependency"] === true;
12228
12242
  const watchStart = (0, import_react71.useMemo)(() => watchedFieldsOf(start), [start]);
@@ -12232,6 +12246,8 @@ function FieldEditor(props) {
12232
12246
  const [limitView, setLimitView] = (0, import_react71.useState)(limitViewStart);
12233
12247
  const bindingStart = start?.config?.["binding"] === "snapshot" ? "snapshot" : "live";
12234
12248
  const [binding, setBinding] = (0, import_react71.useState)(bindingStart);
12249
+ const onDeleteStart = start?.on_target_delete === "cascade" || start?.on_target_delete === "restrict" ? start.on_target_delete : "set_null";
12250
+ const [onDelete, setOnDelete] = (0, import_react71.useState)(onDeleteStart);
12235
12251
  const carriesStart = start?.config?.["carries"] === true;
12236
12252
  const [carries, setCarries] = (0, import_react71.useState)(carriesStart);
12237
12253
  const carriesMaxStart = start?.config?.["carries_max"] === "editor" ? "editor" : "viewer";
@@ -12279,7 +12295,7 @@ function FieldEditor(props) {
12279
12295
  if (!field || type !== "status") return;
12280
12296
  let live = true;
12281
12297
  void client.fieldOptions({ field_id: field.id }).then((got) => {
12282
- if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records26.optionKey)(o)])));
12298
+ if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records27.optionKey)(o)])));
12283
12299
  });
12284
12300
  return () => {
12285
12301
  live = false;
@@ -12391,7 +12407,7 @@ function FieldEditor(props) {
12391
12407
  const typeKey = onEntity ? null : table.data?.type_field ?? null;
12392
12408
  const typeField = typeKey ? (fields.data ?? []).find((f) => f.key === typeKey) ?? null : null;
12393
12409
  const offersAppliesTo = Boolean(typeField) && !isTitle && field?.key !== typeKey;
12394
- const appliesToChanged = JSON.stringify(appliesTo) !== JSON.stringify((0, import_records26.typesOfField)(field ?? { applies_to_types: [] }));
12410
+ const appliesToChanged = JSON.stringify(appliesTo) !== JSON.stringify((0, import_records27.typesOfField)(field ?? { applies_to_types: [] }));
12395
12411
  const offersMany = multiApplies(type) && !isTitle;
12396
12412
  if (!mayShape) {
12397
12413
  if (onEntity && entityRights.loading) return null;
@@ -12407,7 +12423,7 @@ function FieldEditor(props) {
12407
12423
  const nameTaken = columnNameTakenBy(label, others.map(fieldName));
12408
12424
  const nameLine = nameTaken ? columnNameTakenLine(nameTaken, noun) : columnNameProblemLine(label, noun);
12409
12425
  const listsChoices = type === "select" || type === "multi_select" || type === "status";
12410
- const buttonMissing = type === "button" && buttonSettings.do ? (0, import_records25.buttonNeeds)(buttonSettings) : null;
12426
+ const buttonMissing = type === "button" && buttonSettings.do ? (0, import_records26.buttonNeeds)(buttonSettings) : null;
12411
12427
  const missing = buttonMissing ?? (editing ? formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(choiceList) : null) : formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(newChoices) : null) ?? (type === "formula" && formulaWritten ? null : whatIsMissing(
12412
12428
  type === "count" ? { type: "rollup", label, options, via, pick, agg: "count", of, relations: totalSources, formulaFields, relationTarget, allowedTypes, noun } : { type, label, options, via, pick, agg, of, relations: sourcesFor(type), formulaFields, relationTarget, allowedTypes, noun }
12413
12429
  )));
@@ -12450,12 +12466,13 @@ function FieldEditor(props) {
12450
12466
  ...statusGroupsChanged ? { status_groups: statusGroupsSent } : {},
12451
12467
  // V11 #4/#10: a rating's top star goes as `max`, the word custom.field_update now takes the way
12452
12468
  // custom.field_declare does; the store writes the max Rule and sets aside any score above it.
12453
- ...type === "rating" && ratingMax !== (0, import_records26.ratingMaxOf)(field) ? { max: ratingMax } : {},
12469
+ ...type === "rating" && ratingMax !== (0, import_records27.ratingMaxOf)(field) ? { max: ratingMax } : {},
12454
12470
  ...type === "barcode" && symbology !== String(field.config?.["symbology"] ?? "") ? { symbology: symbology === "" ? null : symbology } : {},
12455
12471
  ...type === "button" && JSON.stringify(buttonSettings) !== JSON.stringify(buttonStart) ? { button: buttonSettings } : {},
12456
12472
  ...field.type === "relation" && dependency !== dependencyStart ? { dependency } : {},
12457
12473
  ...field.type === "relation" && limitView !== limitViewStart ? { limit_to_view: limitView === "" ? null : limitView } : {},
12458
12474
  ...field.type === "relation" && binding !== bindingStart ? { binding } : {},
12475
+ ...field.type === "relation" && onDelete !== onDeleteStart ? { on_target_delete: onDelete } : {},
12459
12476
  ...field.type === "relation" && carries !== carriesStart ? { carries } : {},
12460
12477
  ...field.type === "relation" && carries && carriesMax !== carriesMaxStart ? { carries_max: carriesMax } : {},
12461
12478
  ...field.type === "relation" && loops !== loopsStart ? { loops } : {},
@@ -12825,6 +12842,24 @@ function FieldEditor(props) {
12825
12842
  ] })
12826
12843
  ] })
12827
12844
  ] }) : null,
12845
+ editing && field?.type === "relation" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1", "data-records-link-on-archive": "", children: [
12846
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Label, { className: "text-xs", children: "When a linked record is archived" }),
12847
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
12848
+ import_design_system44.Select,
12849
+ {
12850
+ value: onDelete,
12851
+ onValueChange: (next) => setOnDelete(next === "cascade" || next === "restrict" ? next : "set_null"),
12852
+ children: [
12853
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectTrigger, { size: "sm", "aria-label": "When a linked record is archived", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectValue, {}) }),
12854
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_design_system44.SelectContent, { children: [
12855
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: "set_null", children: "Keep the link, shown as archived" }),
12856
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: "cascade", children: "Archive this record too" }),
12857
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.SelectItem, { value: "restrict", children: "Refuse while it is linked" })
12858
+ ] })
12859
+ ]
12860
+ }
12861
+ )
12862
+ ] }) : null,
12828
12863
  editing && field?.type === "relation" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col gap-1.5", "data-records-link-carries": "", children: [
12829
12864
  /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1.5 text-sm", title: "Whoever can see a linked record can also see this one", children: [
12830
12865
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_design_system44.Checkbox, { checked: carries, "aria-label": "Carries access", onCheckedChange: (v) => setCarries(v === true) }),
@@ -13607,7 +13642,7 @@ function waitingRunsOf(pressed) {
13607
13642
  var stop2 = (event) => event.stopPropagation();
13608
13643
  function ButtonValue({ field, recordId, inCell, beforeSave }) {
13609
13644
  const client = (0, import_react74.useOptionalRecordsClient)();
13610
- const b = (0, import_records27.buttonOf)(field);
13645
+ const b = (0, import_records28.buttonOf)(field);
13611
13646
  const [busy, setBusy] = (0, import_react73.useState)(false);
13612
13647
  const [said2, setSaid] = (0, import_react73.useState)(null);
13613
13648
  const [settingUp, setSettingUp] = (0, import_react73.useState)(false);
@@ -13625,7 +13660,7 @@ function ButtonValue({ field, recordId, inCell, beforeSave }) {
13625
13660
  /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { id: `${field.key}-before-save`, className: "whitespace-nowrap text-xs text-muted-foreground", children: "Save the record first" })
13626
13661
  ] });
13627
13662
  }
13628
- const needs = (0, import_records27.buttonNeeds)(b);
13663
+ const needs = (0, import_records28.buttonNeeds)(b);
13629
13664
  const tableId = field.entity_definition_id;
13630
13665
  const press = async () => {
13631
13666
  if (!client || !recordId) return setSaid({ kind: "public" });
@@ -13973,7 +14008,7 @@ function formatControl(args) {
13973
14008
  // src/typedDateHelper.tsx
13974
14009
  var import_react77 = require("react");
13975
14010
  var import_design_system47 = require("@ai-matrx/design-system");
13976
- var import_records28 = require("@ai-matrx/records");
14011
+ var import_records29 = require("@ai-matrx/records");
13977
14012
  var import_jsx_runtime53 = require("react/jsx-runtime");
13978
14013
  var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
13979
14014
  var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
@@ -13982,24 +14017,24 @@ function pad(n) {
13982
14017
  }
13983
14018
  function readBox(text, kind) {
13984
14019
  if (kind === "time") {
13985
- const t = (0, import_records28.readTypedTime)(text);
14020
+ const t = (0, import_records29.readTypedTime)(text);
13986
14021
  if (!t.ok) return { day: null, time: null };
13987
14022
  const [h, m] = t.value.split(":").map(Number);
13988
14023
  return { day: null, time: { h, m } };
13989
14024
  }
13990
- const read = (0, import_records28.readTypedDate)(text, { withTime: kind === "datetime" });
14025
+ const read = (0, import_records29.readTypedDate)(text, { withTime: kind === "datetime" });
13991
14026
  if (!read.ok) return { day: null, time: null };
13992
14027
  if (kind === "datetime" && read.instant) {
13993
- const wall = (0, import_records28.wallPartsInZone)(new Date(read.instant));
14028
+ const wall = (0, import_records29.wallPartsInZone)(new Date(read.instant));
13994
14029
  return { day: read.day, time: { h: wall.hour, m: wall.minute } };
13995
14030
  }
13996
14031
  return { day: read.day, time: null };
13997
14032
  }
13998
14033
  function wordsFor2(kind, day, time) {
13999
- if (kind === "time") return time ? (0, import_records28.typedTimeText)(time.h, time.m) : "";
14034
+ if (kind === "time") return time ? (0, import_records29.typedTimeText)(time.h, time.m) : "";
14000
14035
  if (!day) return "";
14001
- const dayText = (0, import_records28.typedDateText)(day);
14002
- return kind === "datetime" && time ? `${dayText} ${(0, import_records28.typedTimeText)(time.h, time.m)}` : dayText;
14036
+ const dayText = (0, import_records29.typedDateText)(day);
14037
+ return kind === "datetime" && time ? `${dayText} ${(0, import_records29.typedTimeText)(time.h, time.m)}` : dayText;
14003
14038
  }
14004
14039
  var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
14005
14040
  function CalendarGlyph() {
@@ -14121,7 +14156,7 @@ function TypedDateHelper({
14121
14156
  held.time && held.time.h === t.h && held.time.m === t.m ? "bg-primary text-primary-foreground" : ""
14122
14157
  ),
14123
14158
  onClick: () => pickTime(t),
14124
- children: (0, import_records28.typedTimeText)(t.h, t.m)
14159
+ children: (0, import_records29.typedTimeText)(t.h, t.m)
14125
14160
  },
14126
14161
  `${t.h}:${t.m}`
14127
14162
  )) })
@@ -14192,21 +14227,21 @@ function judgeTyped(field, text, choices, nudge) {
14192
14227
  const format = formatForField(field);
14193
14228
  if (trimmed === "") return { value: null };
14194
14229
  if (format && format.id === "time") {
14195
- const read2 = (0, import_records29.readTypedTime)(trimmed);
14230
+ const read2 = (0, import_records30.readTypedTime)(trimmed);
14196
14231
  return read2.ok ? { value: read2.value } : { refusal: SHORT_REFUSAL.time, why: `${fieldName(field)} holds a time of day, and ${read2.why}` };
14197
14232
  }
14198
14233
  if (kind === "select" || kind === "multi_select") {
14199
14234
  if (!choices || nudge === null) return null;
14200
14235
  const several = field.multi || kind === "multi_select";
14201
14236
  const words = several ? trimmed.split(/\s*[,;\n]\s*/).filter(Boolean) : [trimmed];
14202
- const allowOther = (0, import_records29.allowsOtherValues)(field);
14237
+ const allowOther = (0, import_records30.allowsOtherValues)(field);
14203
14238
  const parts = [];
14204
14239
  const add = [];
14205
14240
  const ask = [];
14206
14241
  const notChoices = [];
14207
14242
  let keepOffered = allowOther;
14208
14243
  for (const word of words) {
14209
- const decided = (0, import_records29.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
14244
+ const decided = (0, import_records30.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
14210
14245
  if (decided.decision === "empty") continue;
14211
14246
  if (decided.decision === "chosen") parts.push(decided.key);
14212
14247
  else {
@@ -14239,7 +14274,7 @@ function judgeTyped(field, text, choices, nudge) {
14239
14274
  return usual && digits.length >= 7 && digits.length <= 20 ? { value: trimmed } : { refusal: SHORT_REFUSAL.phone };
14240
14275
  }
14241
14276
  const showsAsPercent = Boolean(format && (format.id === "percent" || format.id === "progress"));
14242
- const read = (0, import_records29.coerceTypedAnswer)(field, text, { label: fieldName(field), showsAsPercent });
14277
+ const read = (0, import_records30.coerceTypedAnswer)(field, text, { label: fieldName(field), showsAsPercent });
14243
14278
  if ("refusal" in read) {
14244
14279
  if (kind === "email" || kind === "url") return { refusal: SHORT_REFUSAL[kind] };
14245
14280
  const short = kind === "datetime" ? SHORT_REFUSAL.date : kind === "number" || kind === "currency" || kind === "percent" || showsAsPercent ? SHORT_REFUSAL.number : read.refusal.length <= 32 ? read.refusal : SHORT_REFUSAL.value;
@@ -14260,12 +14295,12 @@ function openingText(field, value) {
14260
14295
  if (value === null || value === void 0 || value === "") return "";
14261
14296
  const helper = dateHelperKind(field, value);
14262
14297
  if (helper === "time") {
14263
- const read = (0, import_records29.readTypedTime)(String(value));
14298
+ const read = (0, import_records30.readTypedTime)(String(value));
14264
14299
  if (!read.ok) return String(value);
14265
14300
  const [h, m] = read.value.split(":").map(Number);
14266
- return (0, import_records29.typedTimeText)(h, m);
14301
+ return (0, import_records30.typedTimeText)(h, m);
14267
14302
  }
14268
- if (helper) return (0, import_records29.typedDateText)(value, { withTime: helper === "datetime" });
14303
+ if (helper) return (0, import_records30.typedDateText)(value, { withTime: helper === "datetime" });
14269
14304
  const format = formatForField(field);
14270
14305
  return format ? typedText(format, value) : String(value);
14271
14306
  }
@@ -14354,7 +14389,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
14354
14389
  " ",
14355
14390
  needsChoices ? String(
14356
14391
  (Array.isArray(withoutAddition(judged.value).value) ? withoutAddition(judged.value).value : [withoutAddition(judged.value).value]).map((k) => {
14357
- const option = choices?.find((o) => (0, import_records29.optionKey)(o) === k);
14392
+ const option = choices?.find((o) => (0, import_records30.optionKey)(o) === k);
14358
14393
  return option ? recordName(option.data, null, String(k)) : String(k);
14359
14394
  }).join(", ")
14360
14395
  ) : (() => {
@@ -14375,7 +14410,7 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
14375
14410
  const ownDetails = (0, import_react79.useOptionalRecordsClient)() === null;
14376
14411
  if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
14377
14412
  if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
14378
- if ((0, import_records29.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ButtonValue, { field, recordId: recordId ?? null, beforeSave: !recordId });
14413
+ if ((0, import_records30.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ButtonValue, { field, recordId: recordId ?? null, beforeSave: !recordId });
14379
14414
  const newerControl = newerKindControl({ field, value, onChange, disabled, id: inputId });
14380
14415
  if (newerControl !== void 0) return newerControl;
14381
14416
  const format = formatForField(field);
@@ -14545,7 +14580,7 @@ function TypedWordsControl({ field, value, onChange, disabled, id }) {
14545
14580
  function typedDatePlaceholder(helper) {
14546
14581
  const time = "h:mm AM";
14547
14582
  if (helper === "time") return time;
14548
- const pattern = (0, import_records29.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
14583
+ const pattern = (0, import_records30.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
14549
14584
  return helper === "datetime" ? `${pattern} ${time}` : pattern;
14550
14585
  }
14551
14586
  function CheckboxControl({ field, value, onChange, disabled, id }) {
@@ -14715,15 +14750,15 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
14715
14750
  ChoiceAnswer,
14716
14751
  {
14717
14752
  field,
14718
- choices: options.map((option) => ({ key: (0, import_records29.optionKey)(option), label: titled(option) })),
14753
+ choices: options.map((option) => ({ key: (0, import_records30.optionKey)(option), label: titled(option) })),
14719
14754
  value,
14720
14755
  onChange,
14721
14756
  disabled,
14722
14757
  id,
14723
14758
  onChosen,
14724
14759
  isChosen: (choice, v) => {
14725
- const option = options.find((o) => (0, import_records29.optionKey)(o) === choice.key);
14726
- return option ? (0, import_records29.isTheChosen)(option, v) : false;
14760
+ const option = options.find((o) => (0, import_records30.optionKey)(o) === choice.key);
14761
+ return option ? (0, import_records30.isTheChosen)(option, v) : false;
14727
14762
  }
14728
14763
  }
14729
14764
  );
@@ -14756,7 +14791,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
14756
14791
  onCancel,
14757
14792
  initialSearch,
14758
14793
  addsChoices,
14759
- allowOther: (0, import_records29.allowsOtherValues)(field),
14794
+ allowOther: (0, import_records30.allowsOtherValues)(field),
14760
14795
  onChoicesChanged: () => {
14761
14796
  if (client) (0, askOnce_exports.forgetAsked)(client, `field_options:${field.id}`);
14762
14797
  setReread((n) => n + 1);
@@ -14770,19 +14805,19 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
14770
14805
  }
14771
14806
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
14772
14807
  if (field.multi) {
14773
- const chosen = options.filter((option) => (0, import_records29.choiceValuesOf)(value).some((v) => (0, import_records29.isTheChosen)(option, v)));
14774
- const picked = new Set(chosen.map((option) => (0, import_records29.optionKey)(option)));
14808
+ const chosen = options.filter((option) => (0, import_records30.choiceValuesOf)(value).some((v) => (0, import_records30.isTheChosen)(option, v)));
14809
+ const picked = new Set(chosen.map((option) => (0, import_records30.optionKey)(option)));
14775
14810
  const toggles = /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
14776
14811
  import_design_system48.Button,
14777
14812
  {
14778
14813
  type: "button",
14779
14814
  size: "sm",
14780
- variant: picked.has((0, import_records29.optionKey)(option)) ? "default" : "outline",
14815
+ variant: picked.has((0, import_records30.optionKey)(option)) ? "default" : "outline",
14781
14816
  disabled,
14782
14817
  onClick: () => {
14783
14818
  const next = new Set(picked);
14784
- if (next.has((0, import_records29.optionKey)(option))) next.delete((0, import_records29.optionKey)(option));
14785
- else next.add((0, import_records29.optionKey)(option));
14819
+ if (next.has((0, import_records30.optionKey)(option))) next.delete((0, import_records30.optionKey)(option));
14820
+ else next.add((0, import_records30.optionKey)(option));
14786
14821
  onChange(next.size === 0 ? null : [...next]);
14787
14822
  },
14788
14823
  children: titleOf(option)
@@ -14804,11 +14839,11 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
14804
14839
  }
14805
14840
  );
14806
14841
  }
14807
- const current = options.find((option) => (0, import_records29.isTheChosen)(option, value));
14842
+ const current = options.find((option) => (0, import_records30.isTheChosen)(option, value));
14808
14843
  return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
14809
14844
  import_design_system48.Select,
14810
14845
  {
14811
- value: current ? (0, import_records29.optionKey)(current) : "",
14846
+ value: current ? (0, import_records30.optionKey)(current) : "",
14812
14847
  disabled: disabled ?? false,
14813
14848
  onValueChange: (next) => onChange(next === "" ? null : next),
14814
14849
  ...autoOpen ? {
@@ -14820,7 +14855,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
14820
14855
  } : {},
14821
14856
  children: [
14822
14857
  /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.SelectValue, { placeholder: "Choose" }) }),
14823
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.SelectItem, { value: (0, import_records29.optionKey)(option), children: titleOf(option) }, option.id)) })
14858
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.SelectItem, { value: (0, import_records30.optionKey)(option), children: titleOf(option) }, option.id)) })
14824
14859
  ]
14825
14860
  }
14826
14861
  );
@@ -14854,23 +14889,23 @@ function OpenChoicePicker({
14854
14889
  const [addRefused, setAddRefused] = (0, import_react78.useState)(null);
14855
14890
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
14856
14891
  const held = withoutAddition(value);
14857
- const current = (0, import_records29.choiceValuesOf)(held.value);
14892
+ const current = (0, import_records30.choiceValuesOf)(held.value);
14858
14893
  const pickedWords = current.map((v) => {
14859
- const option = options.find((o) => (0, import_records29.isTheChosen)(o, v));
14894
+ const option = options.find((o) => (0, import_records30.isTheChosen)(o, v));
14860
14895
  return option ? titleOf(option) : String(v);
14861
14896
  });
14862
- const chipOf = (option, word) => option ? choiceChipLookOf(field, (0, import_records29.optionKey)(option), titleOf(option)) : choiceChipLookOf(field, word);
14897
+ const chipOf = (option, word) => option ? choiceChipLookOf(field, (0, import_records30.optionKey)(option), titleOf(option)) : choiceChipLookOf(field, word);
14863
14898
  const q = search.trim();
14864
- const visible = (0, import_records29.rankTypedMatches)(options, q, titleOf);
14865
- const decided = (0, import_records29.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
14899
+ const visible = (0, import_records30.rankTypedMatches)(options, q, titleOf);
14900
+ const decided = (0, import_records30.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
14866
14901
  const choose = (word, addingIt = false) => {
14867
14902
  const pending = held.add.filter((w) => w.toLowerCase() !== word.toLowerCase());
14868
14903
  let next;
14869
14904
  let add2 = [...pending];
14870
14905
  if (field.multi) {
14871
14906
  const existing = current.map((v) => {
14872
- const option = options.find((o) => (0, import_records29.isTheChosen)(o, v));
14873
- return option ? (0, import_records29.optionKey)(option) : String(v);
14907
+ const option = options.find((o) => (0, import_records30.isTheChosen)(o, v));
14908
+ return option ? (0, import_records30.optionKey)(option) : String(v);
14874
14909
  });
14875
14910
  const has = existing.some((v) => v.toLowerCase() === word.toLowerCase());
14876
14911
  const list = has ? existing.filter((v) => v.toLowerCase() !== word.toLowerCase()) : [...existing, word];
@@ -14906,7 +14941,7 @@ function OpenChoicePicker({
14906
14941
  const foot = null;
14907
14942
  const add = offList && (decided.decision === "ask" || decided.decision === "add") ? { label: `Create \u201C${q}\u201D`, onAdd: addTyped, disabled: adding } : offList && decided.decision === "keep_as_typed" ? { label: `Use \u201C${q}\u201D`, onAdd: () => choose(q) } : null;
14908
14943
  const listed = visible;
14909
- const pickedOptions = current.map((v) => options.find((o) => (0, import_records29.isTheChosen)(o, v)));
14944
+ const pickedOptions = current.map((v) => options.find((o) => (0, import_records30.isTheChosen)(o, v)));
14910
14945
  const cellChips = pickedWords.map((word, i) => {
14911
14946
  const chip = chipOf(pickedOptions[i], word);
14912
14947
  return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system48.Badge, { variant: "outline", className: (0, import_design_system48.cn)("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
@@ -14918,7 +14953,7 @@ function OpenChoicePicker({
14918
14953
  label: word,
14919
14954
  chip: chipOf(option, word).className,
14920
14955
  onRemove: () => {
14921
- if (field.multi) choose(option ? (0, import_records29.optionKey)(option) : String(current[i]));
14956
+ if (field.multi) choose(option ? (0, import_records30.optionKey)(option) : String(current[i]));
14922
14957
  else onChange(null);
14923
14958
  }
14924
14959
  };
@@ -14949,11 +14984,11 @@ function OpenChoicePicker({
14949
14984
  id: option.id,
14950
14985
  label: titleOf(option),
14951
14986
  chip: chipOf(option, titleOf(option)).className,
14952
- picked: current.some((v) => (0, import_records29.isTheChosen)(option, v))
14987
+ picked: current.some((v) => (0, import_records30.isTheChosen)(option, v))
14953
14988
  })),
14954
14989
  onPick: (optionId) => {
14955
14990
  const option = options.find((o) => o.id === optionId);
14956
- if (option) choose((0, import_records29.optionKey)(option));
14991
+ if (option) choose((0, import_records30.optionKey)(option));
14957
14992
  },
14958
14993
  empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
14959
14994
  add,
@@ -15009,7 +15044,7 @@ function ChoiceAnswer({
15009
15044
  onChosen
15010
15045
  }) {
15011
15046
  const [search, setSearch] = (0, import_react78.useState)("");
15012
- const held = field.multi ? (0, import_records29.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
15047
+ const held = field.multi ? (0, import_records30.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
15013
15048
  const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
15014
15049
  const press = (choice) => {
15015
15050
  if (!field.multi) {
@@ -15362,7 +15397,7 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
15362
15397
 
15363
15398
  // src/DataBindingPicker.tsx
15364
15399
  var import_react84 = require("react");
15365
- var import_records30 = require("@ai-matrx/records");
15400
+ var import_records31 = require("@ai-matrx/records");
15366
15401
  var import_react85 = require("@ai-matrx/records/react");
15367
15402
  var import_design_system50 = require("@ai-matrx/design-system");
15368
15403
  init_names();
@@ -15397,7 +15432,7 @@ function isCompleteDataBinding(binding) {
15397
15432
  }
15398
15433
  function bindingPlaceholdersFor(field) {
15399
15434
  const label = fieldName(field);
15400
- if ((0, import_records30.isEntityReferenceConfig)(field.config)) {
15435
+ if ((0, import_records31.isEntityReferenceConfig)(field.config)) {
15401
15436
  return [
15402
15437
  { token: `{${field.key}.name}`, label: `${label} \xB7 name` },
15403
15438
  { token: `{${field.key}.id}`, label: `${label} \xB7 id` }