@ai-matrx/records-ui 0.115.101 → 0.115.103

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.cjs CHANGED
@@ -62,7 +62,7 @@ function choiceWord(value) {
62
62
  return String(value ?? "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
63
63
  }
64
64
  function statusGroupColor(field, value) {
65
- if ((0, import_records.newerKindOf)(field) !== "status" || value === null || value === void 0 || value === "") return void 0;
65
+ if ((0, import_core.newerKindOf)(field) !== "status" || value === null || value === void 0 || value === "") return void 0;
66
66
  const word = choiceWord(value);
67
67
  if (word === "") return void 0;
68
68
  const groups = (field.config ?? {})["status_groups"];
@@ -96,11 +96,11 @@ function choiceChipLookOf(field, ...words) {
96
96
  }
97
97
  return { className: import_table_style.NEUTRAL_CHIP_CLASS, color: null };
98
98
  }
99
- var import_records, import_table_style, STATUS_GROUP_COLOR, NEW_CHOICE_PALETTE;
99
+ var import_core, import_table_style, STATUS_GROUP_COLOR, NEW_CHOICE_PALETTE;
100
100
  var init_choiceLooks = __esm({
101
101
  "src/choiceLooks.ts"() {
102
102
  "use strict";
103
- import_records = require("@ai-matrx/records");
103
+ import_core = require("@ai-matrx/records/core");
104
104
  import_table_style = require("@ai-matrx/design-system/data-table/table-style");
105
105
  STATUS_GROUP_COLOR = { todo: "gray", in_progress: "blue", done: "green" };
106
106
  NEW_CHOICE_PALETTE = ["blue", "green", "amber", "red", "violet", "teal", "slate"];
@@ -314,7 +314,7 @@ function sentenceFor(what, level) {
314
314
  return `You are ${have} here, and it takes ${need} to ${doing[what]}. Ask somebody who is Admin on it to move you up.`;
315
315
  }
316
316
  function whatYouMayDo(level, known = true) {
317
- const may = (what) => known && (0, import_records3.atLeast)(level, NEEDS[what]);
317
+ const may = (what) => known && (0, import_core2.atLeast)(level, NEEDS[what]);
318
318
  return {
319
319
  level: known ? level : null,
320
320
  known,
@@ -343,11 +343,11 @@ function tableIsLocked(table) {
343
343
  function lockedStructure(base) {
344
344
  return { ...base, structure: false, why: (what) => what === "structure" ? DATABASE_LOCKED_REASON : base.why(what) };
345
345
  }
346
- var import_records3, LEVEL_WORD, NEEDS, NOT_YET, NOTHING_AT_ALL, NOT_ANSWERED_YET, KERNEL_REASON, DATABASE_LOCKED_REASON;
346
+ var import_core2, LEVEL_WORD, NEEDS, NOT_YET, NOTHING_AT_ALL, NOT_ANSWERED_YET, KERNEL_REASON, DATABASE_LOCKED_REASON;
347
347
  var init_rights = __esm({
348
348
  "src/rights.ts"() {
349
349
  "use strict";
350
- import_records3 = require("@ai-matrx/records");
350
+ import_core2 = require("@ai-matrx/records/core");
351
351
  LEVEL_WORD = {
352
352
  viewer: "Viewer",
353
353
  commenter: "Commenter",
@@ -529,7 +529,7 @@ function RefusalNotice({
529
529
  onKeepEditing,
530
530
  onDiscard
531
531
  }) {
532
- const archivedOrg = (0, import_core.archivedOrganizationId)(error);
532
+ const archivedOrg = (0, import_core3.archivedOrganizationId)(error);
533
533
  if (archivedOrg) {
534
534
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ArchivedOrganizationNotice, { organizationId: archivedOrg, error, className });
535
535
  }
@@ -585,19 +585,19 @@ function RefusalLine({ error, className }) {
585
585
  {
586
586
  "data-refusal-line": "",
587
587
  className: (0, import_design_system3.cn)("whitespace-normal break-words text-xs text-destructive [overflow-wrap:anywhere]", className),
588
- message: (0, import_core.archivedOrganizationId)(error) ? "This organization is archived. An owner can restore it." : refusalLineForAPerson(error),
588
+ message: (0, import_core3.archivedOrganizationId)(error) ? "This organization is archived. An owner can restore it." : refusalLineForAPerson(error),
589
589
  error,
590
590
  origin: "records-ui/RefusalLine",
591
591
  ...plain.forEngineers ? { "data-for-engineers": plain.forEngineers } : {}
592
592
  }
593
593
  );
594
594
  }
595
- var import_core, import_design_system3, import_jsx_runtime4;
595
+ var import_core3, import_design_system3, import_jsx_runtime4;
596
596
  var init_Refusal = __esm({
597
597
  "src/Refusal.tsx"() {
598
598
  "use strict";
599
599
  "use client";
600
- import_core = require("@ai-matrx/records/core");
600
+ import_core3 = require("@ai-matrx/records/core");
601
601
  import_design_system3 = require("@ai-matrx/design-system");
602
602
  init_ArchivedOrganizationNotice();
603
603
  init_plainWords();
@@ -668,7 +668,7 @@ function declaredAsLook(kind) {
668
668
  return kind in LOOK_KINDS && !storePublishesKind(kind);
669
669
  }
670
670
  function storePublishesKind(kind) {
671
- return import_records5.DECLARABLE_FIELD_KINDS.some((row) => row.kind === kind);
671
+ return import_core4.DECLARABLE_FIELD_KINDS.some((row) => row.kind === kind);
672
672
  }
673
673
  function isSystemFieldKind(id) {
674
674
  return SYSTEM_FIELD_KINDS.includes(id);
@@ -683,18 +683,18 @@ function isRelationFieldType(id) {
683
683
  return id === "relation";
684
684
  }
685
685
  function isParityFieldType(id) {
686
- return import_records5.PARITY_FIELD_TYPES.some((row) => row.parity_type === id);
686
+ return import_core4.PARITY_FIELD_TYPES.some((row) => row.parity_type === id);
687
687
  }
688
- var import_records5, LOOK_KINDS, STORE_PUBLISHES_ENTITY_REFERENCE, SYSTEM_FIELD_KINDS, FIELD_TYPE_CATALOGUE, GATED_KINDS, FIELD_TYPE_CHOICES, FIELD_TYPE_GROUPS, BY_ID, ADD_FIELD_SAVE_LABEL, EDIT_FIELD_SAVE_LABEL;
688
+ var import_core4, LOOK_KINDS, STORE_PUBLISHES_ENTITY_REFERENCE, SYSTEM_FIELD_KINDS, FIELD_TYPE_CATALOGUE, GATED_KINDS, FIELD_TYPE_CHOICES, FIELD_TYPE_GROUPS, BY_ID, ADD_FIELD_SAVE_LABEL, EDIT_FIELD_SAVE_LABEL;
689
689
  var init_fieldTypes = __esm({
690
690
  "src/fieldTypes.ts"() {
691
691
  "use strict";
692
- import_records5 = require("@ai-matrx/records");
692
+ import_core4 = require("@ai-matrx/records/core");
693
693
  LOOK_KINDS = {
694
694
  rating: { plain: "number", look: ({ ratingMax }) => ({ id: "rating", options: { ratingMax } }) },
695
695
  time: { plain: "text", look: () => ({ id: "time" }) }
696
696
  };
697
- STORE_PUBLISHES_ENTITY_REFERENCE = import_records5.DECLARABLE_FIELD_KINDS.some(
697
+ STORE_PUBLISHES_ENTITY_REFERENCE = import_core4.DECLARABLE_FIELD_KINDS.some(
698
698
  (row) => row.kind === "entity_reference"
699
699
  );
700
700
  SYSTEM_FIELD_KINDS = ["autonumber", "created_time", "modified_time"];
@@ -739,7 +739,7 @@ var init_fieldTypes = __esm({
739
739
  { id: "created_by", group: "Worked out", label: "Created by", explanation: "Who made each record. Nobody types it." },
740
740
  { id: "modified_by", group: "Worked out", label: "Last changed by", explanation: "Who last changed each record. Nobody types it." }
741
741
  ];
742
- GATED_KINDS = /* @__PURE__ */ new Set(["entity_reference", ...import_records5.NEWER_FIELD_KINDS]);
742
+ GATED_KINDS = /* @__PURE__ */ new Set(["entity_reference", ...import_core4.NEWER_FIELD_KINDS]);
743
743
  FIELD_TYPE_CHOICES = FIELD_TYPE_CATALOGUE.filter(
744
744
  (c) => !GATED_KINDS.has(c.id) || storePublishesKind(c.id) || c.id in LOOK_KINDS
745
745
  );
@@ -757,12 +757,12 @@ var init_fieldTypes = __esm({
757
757
 
758
758
  // src/parity.ts
759
759
  function editorKindFor(field) {
760
- return (0, import_records6.fieldKindFor)(field, KERNEL);
760
+ return (0, import_core5.fieldKindFor)(field, KERNEL);
761
761
  }
762
762
  function pickableTypeOf(field) {
763
763
  if (isSignatureField(field)) return "signature";
764
- if ((0, import_records7.isButtonField)(field)) return "button";
765
- const newer = (0, import_records6.newerKindOf)(field);
764
+ if ((0, import_core6.isButtonField)(field)) return "button";
765
+ const newer = (0, import_core5.newerKindOf)(field);
766
766
  if (newer) return newer;
767
767
  const look = displayFormatOf(field)?.id;
768
768
  if (look === "rating" && field.type === "range") return "rating";
@@ -786,21 +786,21 @@ function fieldTypeLabel(field) {
786
786
  };
787
787
  return plain[kind] ?? (0, import_text_case.humanizeIdentifier)(kind);
788
788
  }
789
- var import_records6, import_records7, import_text_case, kernelId, KERNEL_FILE_TABLE, KERNEL_PERSON_TABLE, PARITY_MADE_OF, KERNEL;
789
+ var import_core5, import_core6, import_text_case, kernelId, KERNEL_FILE_TABLE, KERNEL_PERSON_TABLE, PARITY_MADE_OF, KERNEL;
790
790
  var init_parity = __esm({
791
791
  "src/parity.ts"() {
792
792
  "use strict";
793
793
  init_choiceLooks();
794
- import_records6 = require("@ai-matrx/records");
795
- import_records7 = require("@ai-matrx/records");
794
+ import_core5 = require("@ai-matrx/records/core");
795
+ import_core6 = require("@ai-matrx/records/core");
796
796
  import_text_case = require("@ai-matrx/kit/text-case");
797
797
  init_docs();
798
798
  init_fieldTypes();
799
- kernelId = (name) => import_records6.KERNEL_TABLES.find((t) => t.name === name)?.id ?? "";
799
+ kernelId = (name) => import_core5.KERNEL_TABLES.find((t) => t.name === name)?.id ?? "";
800
800
  KERNEL_FILE_TABLE = kernelId("File");
801
801
  KERNEL_PERSON_TABLE = kernelId("Person");
802
802
  PARITY_MADE_OF = Object.fromEntries(
803
- import_records6.PARITY_FIELD_TYPES.map((p) => [p.parity_type, p.made_of])
803
+ import_core5.PARITY_FIELD_TYPES.map((p) => [p.parity_type, p.made_of])
804
804
  );
805
805
  KERNEL = { file: KERNEL_FILE_TABLE, person: KERNEL_PERSON_TABLE };
806
806
  }
@@ -1171,11 +1171,11 @@ var init_refusals = __esm({
1171
1171
  });
1172
1172
 
1173
1173
  // src/createTable.ts
1174
- var import_core2;
1174
+ var import_core7;
1175
1175
  var init_createTable = __esm({
1176
1176
  "src/createTable.ts"() {
1177
1177
  "use strict";
1178
- import_core2 = require("@ai-matrx/records/core");
1178
+ import_core7 = require("@ai-matrx/records/core");
1179
1179
  }
1180
1180
  });
1181
1181
 
@@ -1251,7 +1251,7 @@ function usePickerTables() {
1251
1251
  };
1252
1252
  }, [client, nonce]);
1253
1253
  const data = (0, import_react12.useMemo)(
1254
- () => (0, import_records9.withTablePlacement)(tables.data ?? [], facts === "reading" ? null : facts),
1254
+ () => (0, import_records4.withTablePlacement)(tables.data ?? [], facts === "reading" ? null : facts),
1255
1255
  [tables.data, facts]
1256
1256
  );
1257
1257
  return { loading: tables.loading || facts === "reading", data, reload };
@@ -1270,13 +1270,13 @@ function ShowListsToggle({
1270
1270
  ")"
1271
1271
  ] });
1272
1272
  }
1273
- var import_react12, import_records9, import_react13, import_design_system9, import_jsx_runtime10;
1273
+ var import_react12, import_records4, import_react13, import_design_system9, import_jsx_runtime10;
1274
1274
  var init_tablePicking = __esm({
1275
1275
  "src/tablePicking.tsx"() {
1276
1276
  "use strict";
1277
1277
  "use client";
1278
1278
  import_react12 = require("react");
1279
- import_records9 = require("@ai-matrx/records");
1279
+ import_records4 = require("@ai-matrx/records");
1280
1280
  import_react13 = require("@ai-matrx/records/react");
1281
1281
  import_design_system9 = require("@ai-matrx/design-system");
1282
1282
  init_tablePickerEntries();
@@ -2148,7 +2148,7 @@ function choiceOptionsOf(options) {
2148
2148
  const labels = [];
2149
2149
  for (const option of options) {
2150
2150
  const id = option.id;
2151
- const key = (0, import_records18.optionKey)(option);
2151
+ const key = (0, import_records12.optionKey)(option);
2152
2152
  const label = recordName(option.data, null, "");
2153
2153
  if (label) {
2154
2154
  labels.push(label);
@@ -2160,18 +2160,18 @@ function choiceOptionsOf(options) {
2160
2160
  return { byWord, labels };
2161
2161
  }
2162
2162
  function valueFromPastedText(field, raw, options, relationNames) {
2163
- return (0, import_records18.coerceTypedAnswer)(field, raw, {
2163
+ return (0, import_records12.coerceTypedAnswer)(field, raw, {
2164
2164
  label: fieldName(field),
2165
2165
  ...options ? { options } : {},
2166
2166
  ...relationNames ? { relationNames } : {}
2167
2167
  });
2168
2168
  }
2169
- var import_core5, import_records18;
2169
+ var import_core11, import_records12;
2170
2170
  var init_pasteValues = __esm({
2171
2171
  "src/pasteValues.ts"() {
2172
2172
  "use strict";
2173
- import_core5 = require("@ai-matrx/records/core");
2174
- import_records18 = require("@ai-matrx/records");
2173
+ import_core11 = require("@ai-matrx/records/core");
2174
+ import_records12 = require("@ai-matrx/records");
2175
2175
  init_names();
2176
2176
  init_names();
2177
2177
  }
@@ -2202,7 +2202,7 @@ function refusedCellsOf(fields, rows, mapping, choiceOptions, relationNames) {
2202
2202
  if ("unmatchedNames" in meant) return;
2203
2203
  if ("refusal" in meant) why = meant.refusal;
2204
2204
  else {
2205
- const predicted = (0, import_core6.predictValueRefusals)([field], { [key]: meant.value }).filter(
2205
+ const predicted = (0, import_core12.predictValueRefusals)([field], { [key]: meant.value }).filter(
2206
2206
  (p) => p.field_key === void 0 || p.field_key === key
2207
2207
  );
2208
2208
  if (predicted.length > 0) why = predicted[0].message;
@@ -2222,11 +2222,11 @@ function checkImportRules(fields, rows, mapping, choiceOptions, relationNames) {
2222
2222
  }
2223
2223
  return [...verdicts.values()];
2224
2224
  }
2225
- var import_core6;
2225
+ var import_core12;
2226
2226
  var init_importRuleCheck = __esm({
2227
2227
  "src/importRuleCheck.ts"() {
2228
2228
  "use strict";
2229
- import_core6 = require("@ai-matrx/records/core");
2229
+ import_core12 = require("@ai-matrx/records/core");
2230
2230
  init_pasteValues();
2231
2231
  init_parity();
2232
2232
  }
@@ -2292,7 +2292,7 @@ function datesOfColumn(rows, header, opts = {}) {
2292
2292
  const raw = String(r[header] ?? "").trim();
2293
2293
  if (raw === "") return;
2294
2294
  filled += 1;
2295
- const got = (0, import_records19.readTypedDate)(raw, { ...opts.withTime ? { withTime: true } : {}, ...opts.locale ? { locale: opts.locale } : {} });
2295
+ const got = (0, import_records13.readTypedDate)(raw, { ...opts.withTime ? { withTime: true } : {}, ...opts.locale ? { locale: opts.locale } : {} });
2296
2296
  if (got.ok) read.set(i, opts.withTime && got.instant ? got.instant : got.day);
2297
2297
  else unreadable.push({ row: i, raw });
2298
2298
  });
@@ -2325,11 +2325,11 @@ function looksLike(rows, header) {
2325
2325
  if (share(isPhone) >= 0.6) return "phone";
2326
2326
  return null;
2327
2327
  }
2328
- var import_records19, IMPORT_KINDS, EMAIL2, PHONE2, URLISH;
2328
+ var import_records13, IMPORT_KINDS, EMAIL2, PHONE2, URLISH;
2329
2329
  var init_importKinds = __esm({
2330
2330
  "src/importKinds.ts"() {
2331
2331
  "use strict";
2332
- import_records19 = require("@ai-matrx/records");
2332
+ import_records13 = require("@ai-matrx/records");
2333
2333
  IMPORT_KINDS = [
2334
2334
  { kind: "text", label: "Text" },
2335
2335
  { kind: "date", label: "Date" },
@@ -2351,7 +2351,7 @@ function titleRepeats(rows, header) {
2351
2351
  const seen = /* @__PURE__ */ new Set();
2352
2352
  let filled = 0;
2353
2353
  for (const r of rows) {
2354
- const key = (0, import_records20.relationNameKey)(String(r[header] ?? ""));
2354
+ const key = (0, import_records14.relationNameKey)(String(r[header] ?? ""));
2355
2355
  if (key === "") continue;
2356
2356
  filled += 1;
2357
2357
  seen.add(key);
@@ -2361,7 +2361,7 @@ function titleRepeats(rows, header) {
2361
2361
  function sameRecordLikely(rows, header, notIdentity) {
2362
2362
  const groups = /* @__PURE__ */ new Map();
2363
2363
  for (const r of rows) {
2364
- const key = (0, import_records20.relationNameKey)(String(r[header] ?? ""));
2364
+ const key = (0, import_records14.relationNameKey)(String(r[header] ?? ""));
2365
2365
  if (key === "") continue;
2366
2366
  const held = groups.get(key);
2367
2367
  if (held) held.push(r);
@@ -2394,7 +2394,7 @@ function combineRows(rows, header) {
2394
2394
  const out = [];
2395
2395
  const outLines = [];
2396
2396
  rows.forEach((r, i) => {
2397
- const key = (0, import_records20.relationNameKey)(String(r[header] ?? ""));
2397
+ const key = (0, import_records14.relationNameKey)(String(r[header] ?? ""));
2398
2398
  if (key === "") {
2399
2399
  out.push({ ...r });
2400
2400
  outLines.push([i + 1]);
@@ -2434,11 +2434,11 @@ function combineRows(rows, header) {
2434
2434
  index.sort((a, b) => a.lines[0] - b.lines[0]);
2435
2435
  return { rows: index.map((e) => e.row), lines: index.map((e) => e.lines), multiValued };
2436
2436
  }
2437
- var import_records20, LIST_JOIN;
2437
+ var import_records14, LIST_JOIN;
2438
2438
  var init_importCombine = __esm({
2439
2439
  "src/importCombine.ts"() {
2440
2440
  "use strict";
2441
- import_records20 = require("@ai-matrx/records");
2441
+ import_records14 = require("@ai-matrx/records");
2442
2442
  LIST_JOIN = "; ";
2443
2443
  }
2444
2444
  });
@@ -2789,7 +2789,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
2789
2789
  try {
2790
2790
  const xlsx = file.name.toLowerCase().endsWith(".xlsx");
2791
2791
  const bytes = await file.arrayBuffer();
2792
- const result = xlsx ? await (0, import_core7.importXlsx)(bytes) : (0, import_core7.importCsv)(new TextDecoder().decode(bytes));
2792
+ const result = xlsx ? await (0, import_core13.importXlsx)(bytes) : (0, import_core13.importCsv)(new TextDecoder().decode(bytes));
2793
2793
  await planFrom(result, { name: file.name, bytes: file.size, hash: await sha256(bytes), format: xlsx ? "xlsx" : "csv" });
2794
2794
  } catch (thrown) {
2795
2795
  setProblem(
@@ -2900,13 +2900,13 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
2900
2900
  async (wanted) => {
2901
2901
  const next = /* @__PURE__ */ new Map();
2902
2902
  for (const { header, field } of wanted) {
2903
- const names2 = effectiveRows.flatMap((r) => (0, import_records21.relationNamesIn)(field, String(r[header] ?? "")));
2903
+ const names2 = effectiveRows.flatMap((r) => (0, import_records15.relationNamesIn)(field, String(r[header] ?? "")));
2904
2904
  const got = await client.relationNamesMatch({ table_id: field.relation_target, names: names2 });
2905
2905
  if (!got.ok) {
2906
2906
  setRelationProblem(got.error);
2907
2907
  return null;
2908
2908
  }
2909
- next.set(field.key, (0, import_records21.relationNameIndexOf)(got.data));
2909
+ next.set(field.key, (0, import_records15.relationNameIndexOf)(got.data));
2910
2910
  }
2911
2911
  setRelationProblem(null);
2912
2912
  setRelationIndex(next);
@@ -2930,12 +2930,12 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
2930
2930
  let linked = 0;
2931
2931
  let named = 0;
2932
2932
  effectiveRows.forEach((row, i) => {
2933
- const names2 = (0, import_records21.relationNamesIn)(field, String(row[header] ?? ""));
2933
+ const names2 = (0, import_records15.relationNamesIn)(field, String(row[header] ?? ""));
2934
2934
  if (String(row[header] ?? "").trim() === "") return;
2935
2935
  named += 1;
2936
2936
  let ok = true;
2937
2937
  for (const name of names2) {
2938
- const hits = index.byName.get((0, import_records21.relationNameKey)(name)) ?? [];
2938
+ const hits = index.byName.get((0, import_records15.relationNameKey)(name)) ?? [];
2939
2939
  if (hits.length === 1) continue;
2940
2940
  ok = false;
2941
2941
  if (hits.length === 0) unmatched.set(name, [...unmatched.get(name) ?? [], i + 1]);
@@ -3001,11 +3001,11 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
3001
3001
  const named = index.get(field.key);
3002
3002
  const text = String(row[header] ?? "").trim();
3003
3003
  if (!named || text === "") continue;
3004
- const parts = field.multi ? (0, import_records21.splitListCell)(text) : [text];
3004
+ const parts = field.multi ? (0, import_records15.splitListCell)(text) : [text];
3005
3005
  const ids = [];
3006
3006
  let skip = false;
3007
3007
  for (const part of parts) {
3008
- const hits = (0, import_records21.relationNamesIn)(field, part).length === 0 ? null : named.byName.get((0, import_records21.relationNameKey)(part)) ?? [];
3008
+ const hits = (0, import_records15.relationNamesIn)(field, part).length === 0 ? null : named.byName.get((0, import_records15.relationNameKey)(part)) ?? [];
3009
3009
  if (hits === null) ids.push(part);
3010
3010
  else if (hits.length === 1) ids.push(hits[0].id);
3011
3011
  else if ((hits.length === 0 ? choiceFor(field.key).unmatched : choiceFor(field.key).ambiguous) !== "empty") skip = true;
@@ -3045,7 +3045,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
3045
3045
  setPhase("linking");
3046
3046
  for (const ask of toMerge) {
3047
3047
  for (const [name] of ask.ambiguous) {
3048
- const hits = ask.index.byName.get((0, import_records21.relationNameKey)(name)) ?? [];
3048
+ const hits = ask.index.byName.get((0, import_records15.relationNameKey)(name)) ?? [];
3049
3049
  const winner = hits[0];
3050
3050
  if (!winner) continue;
3051
3051
  for (const loser of hits.slice(1)) {
@@ -3985,16 +3985,16 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
3985
3985
  table.error ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RefusalNotice, { error: table.error }) : null
3986
3986
  ] });
3987
3987
  }
3988
- var import_react41, import_react42, import_core7, import_design_system23, import_records21, import_text_case5, import_jsx_runtime25, BATCH, SAMPLES, COLUMNS_PER_CALL, ABSENT, LEAVE, TITLE_COPY, TYPED_VALUES;
3988
+ var import_react41, import_react42, import_core13, import_design_system23, import_records15, import_text_case5, import_jsx_runtime25, BATCH, SAMPLES, COLUMNS_PER_CALL, ABSENT, LEAVE, TITLE_COPY, TYPED_VALUES;
3989
3989
  var init_ImportWizard = __esm({
3990
3990
  "src/ImportWizard.tsx"() {
3991
3991
  "use strict";
3992
3992
  "use client";
3993
3993
  import_react41 = require("react");
3994
3994
  import_react42 = require("@ai-matrx/records/react");
3995
- import_core7 = require("@ai-matrx/records/core");
3995
+ import_core13 = require("@ai-matrx/records/core");
3996
3996
  import_design_system23 = require("@ai-matrx/design-system");
3997
- import_records21 = require("@ai-matrx/records");
3997
+ import_records15 = require("@ai-matrx/records");
3998
3998
  init_Refusal();
3999
3999
  init_refusals();
4000
4000
  init_importRuleCheck();
@@ -4042,15 +4042,15 @@ function shownToOnlyMe(table) {
4042
4042
  if (table.shown_to !== void 0) return table.shown_to === "only_me";
4043
4043
  return table.visibility === "personal";
4044
4044
  }
4045
- var import_react43, import_react44, import_core8, import_records22, import_design_system24, import_jsx_runtime26, PLATFORM_TABLE_PREFIX2;
4045
+ var import_react43, import_react44, import_core14, import_records16, import_design_system24, import_jsx_runtime26, PLATFORM_TABLE_PREFIX2;
4046
4046
  var init_TablesHome = __esm({
4047
4047
  "src/TablesHome.tsx"() {
4048
4048
  "use strict";
4049
4049
  "use client";
4050
4050
  import_react43 = require("react");
4051
4051
  import_react44 = require("@ai-matrx/records/react");
4052
- import_core8 = require("@ai-matrx/records/core");
4053
- import_records22 = require("@ai-matrx/records");
4052
+ import_core14 = require("@ai-matrx/records/core");
4053
+ import_records16 = require("@ai-matrx/records");
4054
4054
  import_design_system24 = require("@ai-matrx/design-system");
4055
4055
  import_jsx_runtime26 = require("react/jsx-runtime");
4056
4056
  PLATFORM_TABLE_PREFIX2 = "records_ui_";
@@ -4093,7 +4093,7 @@ function draftsFor(headers, rows) {
4093
4093
  function keysFor(labels) {
4094
4094
  const used = /* @__PURE__ */ new Set();
4095
4095
  return labels.map((label, i) => {
4096
- const base = (0, import_core2.tokenFor)(label) === "table" && !/table/i.test(label) ? `column_${i + 1}` : (0, import_core2.tokenFor)(label);
4096
+ const base = (0, import_core7.tokenFor)(label) === "table" && !/table/i.test(label) ? `column_${i + 1}` : (0, import_core7.tokenFor)(label);
4097
4097
  let key = base;
4098
4098
  let n = 2;
4099
4099
  while (used.has(key)) key = `${base}_${n++}`;
@@ -4203,7 +4203,7 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
4203
4203
  tableName2 = (name ?? proposedName).trim();
4204
4204
  newId = earlier.tableId;
4205
4205
  const lacking = fields.filter((f) => !earlier.haveKeys.has(f.key));
4206
- const added = await (0, import_core2.addFields)(client, newId, lacking);
4206
+ const added = await (0, import_core7.addFields)(client, newId, lacking);
4207
4207
  if (!added.ok) {
4208
4208
  setProblem(added.error);
4209
4209
  setPhase("ready");
@@ -4211,7 +4211,7 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, ma
4211
4211
  }
4212
4212
  } else {
4213
4213
  tableName2 = freeName(name ?? proposedName, (tables.data ?? []).map((t) => t.name));
4214
- const born = await (0, import_core2.declareTable)(client, { name: tableName2, fields });
4214
+ const born = await (0, import_core7.declareTable)(client, { name: tableName2, fields });
4215
4215
  if (!born.ok) {
4216
4216
  setProblem(born.error);
4217
4217
  setPhase("ready");
@@ -4599,7 +4599,7 @@ var import_design_system4 = require("@ai-matrx/design-system");
4599
4599
 
4600
4600
  // src/ChoiceListEditor.tsx
4601
4601
  var import_react = require("react");
4602
- var import_records2 = require("@ai-matrx/records");
4602
+ var import_records = require("@ai-matrx/records");
4603
4603
  var import_react2 = require("@ai-matrx/records/react");
4604
4604
  var import_design_system = require("@ai-matrx/design-system");
4605
4605
  var import_data_table = require("@ai-matrx/design-system/data-table");
@@ -4610,7 +4610,7 @@ var rowSeed = 0;
4610
4610
  var nextRow = () => `new-${rowSeed += 1}`;
4611
4611
  function choiceRowsFrom(options, field) {
4612
4612
  return inTheStoresOrder([...options]).map((option) => {
4613
- const words = (0, import_records2.optionLabel)(option);
4613
+ const words = (0, import_records.optionLabel)(option);
4614
4614
  const key = option.data?.key;
4615
4615
  const color = field ? storedChoiceColor(field, words) ?? storedChoiceColor(field, key) : void 0;
4616
4616
  return { id: option.id, words, row: option.id, color: color ?? null };
@@ -4780,11 +4780,11 @@ function ChoiceListEditor({
4780
4780
  "div",
4781
4781
  {
4782
4782
  role: "group",
4783
- "aria-label": (0, import_records2.recordsUseSentence)(heldBy(asking), asking.words.trim()),
4783
+ "aria-label": (0, import_records.recordsUseSentence)(heldBy(asking), asking.words.trim()),
4784
4784
  "data-records-choice-removal-ask": "",
4785
4785
  className: "flex flex-col gap-1 rounded border bg-muted/40 p-2",
4786
4786
  children: [
4787
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs", children: (0, import_records2.recordsUseSentence)(heldBy(asking), asking.words.trim()) }),
4787
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs", children: (0, import_records.recordsUseSentence)(heldBy(asking), asking.words.trim()) }),
4788
4788
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
4789
4789
  targets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
4790
4790
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Button, { type: "button", size: "sm", className: "h-7 px-2 text-xs", disabled: moveTo === "", onClick: () => answer({ then: "move", to: moveTo }), children: "Move them to" }),
@@ -4803,7 +4803,7 @@ function ChoiceListEditor({
4803
4803
  ) : null,
4804
4804
  Object.entries(rehome).map(
4805
4805
  ([id, spec]) => removed[id] ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between gap-2 text-[11px] text-muted-foreground", "data-records-choice-rehome": "", children: [
4806
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: (0, import_records2.rehomeSentence)(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
4806
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: (0, import_records.rehomeSentence)(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
4807
4807
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.Button, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 text-[11px]", onClick: () => putBack(id), children: "Put it back" })
4808
4808
  ] }, id) : null
4809
4809
  ),
@@ -4900,7 +4900,7 @@ function AddChoicesInline({ field, onAdded, disabled = false }) {
4900
4900
 
4901
4901
  // src/editors.tsx
4902
4902
  var import_react67 = require("react");
4903
- var import_records34 = require("@ai-matrx/records");
4903
+ var import_records28 = require("@ai-matrx/records");
4904
4904
  var import_react68 = require("@ai-matrx/records/react");
4905
4905
  var import_design_system39 = require("@ai-matrx/design-system");
4906
4906
  init_dates();
@@ -4908,22 +4908,22 @@ init_dates();
4908
4908
  // src/newerKindValues.tsx
4909
4909
  var import_react8 = require("react");
4910
4910
  var import_source = require("@ai-matrx/content-ir/source");
4911
- var import_records4 = require("@ai-matrx/records");
4911
+ var import_records2 = require("@ai-matrx/records");
4912
4912
  var import_design_system5 = require("@ai-matrx/design-system");
4913
4913
  var import_outbound_react = require("@ai-matrx/kit/outbound-react");
4914
4914
  var import_jsx_runtime6 = require("react/jsx-runtime");
4915
4915
  var own = (event) => event.stopPropagation();
4916
4916
  function newerKindValue(field, value, opts = {}) {
4917
- switch ((0, import_records4.newerKindOf)(field)) {
4917
+ switch ((0, import_records2.newerKindOf)(field)) {
4918
4918
  case "duration": {
4919
- const words = (0, import_records4.durationText)(value);
4919
+ const words = (0, import_records2.durationText)(value);
4920
4920
  return words === null ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "tabular-nums", "data-records-duration": "", children: words });
4921
4921
  }
4922
4922
  case "created_by":
4923
4923
  case "modified_by":
4924
- return (0, import_records4.isPersonStamp)(value) ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PersonStampChip, { stamp: value }) : void 0;
4924
+ return (0, import_records2.isPersonStamp)(value) ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PersonStampChip, { stamp: value }) : void 0;
4925
4925
  case "address":
4926
- return (0, import_records4.isAddressValue)(value) || typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AddressLink, { value }) : void 0;
4926
+ return (0, import_records2.isAddressValue)(value) || typeof value === "string" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AddressLink, { value }) : void 0;
4927
4927
  case "barcode":
4928
4928
  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: [
4929
4929
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u25AE\u25AF\u25AE" }),
@@ -4938,7 +4938,7 @@ function newerKindValue(field, value, opts = {}) {
4938
4938
  }
4939
4939
  }
4940
4940
  function PersonStampChip({ stamp }) {
4941
- const words = (0, import_records4.personStampText)(stamp) ?? import_records4.NOT_A_MEMBER_WORDS;
4941
+ const words = (0, import_records2.personStampText)(stamp) ?? import_records2.NOT_A_MEMBER_WORDS;
4942
4942
  const tier = stamp.actor ?? "user";
4943
4943
  const name = tier === "user" ? stamp.name : null;
4944
4944
  const initial = tier === "system" ? "\u2699" : tier === "agent" ? "\u2726" : name && name.trim() !== "" ? name.trim()[0].toUpperCase() : "?";
@@ -4955,8 +4955,8 @@ function PersonStampChip({ stamp }) {
4955
4955
  ] });
4956
4956
  }
4957
4957
  function AddressLink({ value }) {
4958
- const words = (0, import_records4.addressText)(value);
4959
- const href = (0, import_records4.addressMapUrl)(value);
4958
+ const words = (0, import_records2.addressText)(value);
4959
+ const href = (0, import_records2.addressMapUrl)(value);
4960
4960
  if (!words || !href) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
4961
4961
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
4962
4962
  import_outbound_react.OutboundLink,
@@ -4975,11 +4975,11 @@ function AddressLink({ value }) {
4975
4975
  }
4976
4976
  var STATUS_GROUP_MARK = { todo: "\u25CB", in_progress: "\u25D0", done: "\u25CF" };
4977
4977
  function statusMarkOf(field, value, document2) {
4978
- if ((0, import_records4.newerKindOf)(field) !== "status" || typeof value !== "string") return null;
4978
+ if ((0, import_records2.newerKindOf)(field) !== "status" || typeof value !== "string") return null;
4979
4979
  const chosen = document2?.["_choices"]?.[field.key];
4980
4980
  const key = chosen && typeof chosen === "object" && typeof chosen.key === "string" ? chosen.key : value;
4981
- const group = (0, import_records4.statusGroupOf)(field, key);
4982
- return { mark: STATUS_GROUP_MARK[group], group, words: import_records4.STATUS_GROUP_WORDS[group] };
4981
+ const group = (0, import_records2.statusGroupOf)(field, key);
4982
+ return { mark: STATUS_GROUP_MARK[group], group, words: import_records2.STATUS_GROUP_WORDS[group] };
4983
4983
  }
4984
4984
  function inline(text, key) {
4985
4985
  const out = [];
@@ -5007,7 +5007,7 @@ function marks(text, key) {
5007
5007
  if (tok.startsWith("**") || tok.startsWith("__")) out.push(/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: tok.slice(2, -2) }, k));
5008
5008
  else if (tok.startsWith("[")) {
5009
5009
  const link = /^\[([^\]]+)\]\(([^)\s]+)\)$/.exec(tok);
5010
- const href = (0, import_records4.safeLinkHref)(link?.[2] ?? "");
5010
+ const href = (0, import_records2.safeLinkHref)(link?.[2] ?? "");
5011
5011
  out.push(
5012
5012
  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
5013
5013
  );
@@ -5072,7 +5072,7 @@ function SafeMarkdown({ text, clipped }) {
5072
5072
  );
5073
5073
  }
5074
5074
  function newerKindControl(props) {
5075
- switch ((0, import_records4.newerKindOf)(props.field)) {
5075
+ switch ((0, import_records2.newerKindOf)(props.field)) {
5076
5076
  case "duration":
5077
5077
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DurationControl, { ...props });
5078
5078
  case "address":
@@ -5088,10 +5088,10 @@ function newerKindControl(props) {
5088
5088
  }
5089
5089
  }
5090
5090
  function DurationControl({ value, onChange, disabled, id }) {
5091
- const [text, setText] = (0, import_react8.useState)(() => (0, import_records4.durationText)(value) ?? "");
5091
+ const [text, setText] = (0, import_react8.useState)(() => (0, import_records2.durationText)(value) ?? "");
5092
5092
  const [wrong, setWrong] = (0, import_react8.useState)(false);
5093
5093
  (0, import_react8.useEffect)(() => {
5094
- setText((0, import_records4.durationText)(value) ?? "");
5094
+ setText((0, import_records2.durationText)(value) ?? "");
5095
5095
  }, [value]);
5096
5096
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "flex flex-col gap-1", children: [
5097
5097
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
@@ -5111,12 +5111,12 @@ function DurationControl({ value, onChange, disabled, id }) {
5111
5111
  onChange(null);
5112
5112
  return;
5113
5113
  }
5114
- const seconds = (0, import_records4.readTypedDuration)(e.target.value);
5114
+ const seconds = (0, import_records2.readTypedDuration)(e.target.value);
5115
5115
  setWrong(seconds === null);
5116
5116
  if (seconds !== null) onChange(seconds);
5117
5117
  },
5118
5118
  onBlur: () => {
5119
- if (!wrong) setText((0, import_records4.durationText)(value) ?? "");
5119
+ if (!wrong) setText((0, import_records2.durationText)(value) ?? "");
5120
5120
  }
5121
5121
  }
5122
5122
  ),
@@ -5138,13 +5138,13 @@ var ADDRESS_EXAMPLES = {
5138
5138
  country: "US"
5139
5139
  };
5140
5140
  function AddressControl({ value, onChange, disabled, id }) {
5141
- const held = (0, import_records4.isAddressValue)(value) ? value : typeof value === "string" && value.trim() !== "" ? { street: value } : {};
5141
+ const held = (0, import_records2.isAddressValue)(value) ? value : typeof value === "string" && value.trim() !== "" ? { street: value } : {};
5142
5142
  const set = (part, words) => {
5143
5143
  const next = { ...held, [part]: words };
5144
5144
  const kept = Object.fromEntries(Object.entries(next).filter(([, v]) => typeof v === "string" && v.trim() !== ""));
5145
5145
  onChange(Object.keys(kept).length === 0 ? null : kept);
5146
5146
  };
5147
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { id, className: "grid grid-cols-2 gap-1.5", "data-records-address-control": "", children: import_records4.ADDRESS_PARTS.map((part) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5147
+ 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)(
5148
5148
  import_design_system5.BasicInput,
5149
5149
  {
5150
5150
  "aria-label": ADDRESS_LABELS[part],
@@ -5225,7 +5225,7 @@ init_names();
5225
5225
 
5226
5226
  // src/RelationPicker.tsx
5227
5227
  var import_react10 = require("react");
5228
- var import_records8 = require("@ai-matrx/records");
5228
+ var import_records3 = require("@ai-matrx/records");
5229
5229
  var import_react11 = require("@ai-matrx/records/react");
5230
5230
  var import_design_system8 = require("@ai-matrx/design-system");
5231
5231
  init_PickOrAdd();
@@ -5422,7 +5422,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
5422
5422
  toggle(createdId);
5423
5423
  };
5424
5424
  const apart = tellApart(rows ?? [], titleOf);
5425
- const visible = (0, import_records8.rankTypedMatches)(rows ?? [], search, (row) => [titleOf(row.id), apart.get(row.id) ?? ""]);
5425
+ const visible = (0, import_records3.rankTypedMatches)(rows ?? [], search, (row) => [titleOf(row.id), apart.get(row.id) ?? ""]);
5426
5426
  const anchored = autoOpen === true;
5427
5427
  const cellChips = picked.map((recordId) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5428
5428
  RecordChip,
@@ -5545,7 +5545,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
5545
5545
  var import_react62 = require("react");
5546
5546
  var import_design_system36 = require("@ai-matrx/design-system");
5547
5547
  var import_data_table6 = require("@ai-matrx/design-system/data-table");
5548
- var import_records32 = require("@ai-matrx/records");
5548
+ var import_records26 = require("@ai-matrx/records");
5549
5549
  var import_react63 = require("@ai-matrx/records/react");
5550
5550
  init_Refusal();
5551
5551
 
@@ -5587,7 +5587,7 @@ function columnNameProblemLine(name, noun = "column") {
5587
5587
  // src/FieldEditor.tsx
5588
5588
  var import_react60 = require("react");
5589
5589
  var import_react61 = require("@ai-matrx/records/react");
5590
- var import_core10 = require("@ai-matrx/records/core");
5590
+ var import_core16 = require("@ai-matrx/records/core");
5591
5591
  var import_design_system35 = require("@ai-matrx/design-system");
5592
5592
  init_parity();
5593
5593
  init_fieldTypes();
@@ -5595,7 +5595,7 @@ init_fieldTypes();
5595
5595
  // src/ReferenceBuilder.tsx
5596
5596
  var import_react14 = require("react");
5597
5597
  var import_react15 = require("@ai-matrx/records/react");
5598
- var import_core3 = require("@ai-matrx/records/core");
5598
+ var import_core8 = require("@ai-matrx/records/core");
5599
5599
  init_createTable();
5600
5600
  init_Refusal();
5601
5601
  init_tablePicking();
@@ -5684,7 +5684,7 @@ function ReferenceBuilder({
5684
5684
  if (!name || making) return;
5685
5685
  setMaking(true);
5686
5686
  setRefused(null);
5687
- const slug = (0, import_core2.tokenFor)(name);
5687
+ const slug = (0, import_core7.tokenFor)(name);
5688
5688
  const found = await client.tableFind({ slug });
5689
5689
  if (!found.ok) {
5690
5690
  setMaking(false);
@@ -5698,7 +5698,7 @@ function ReferenceBuilder({
5698
5698
  id = existing.id;
5699
5699
  bornName = tableName(existing);
5700
5700
  } else {
5701
- const made = await (0, import_core2.ensureTable)(client, {
5701
+ const made = await (0, import_core7.ensureTable)(client, {
5702
5702
  name,
5703
5703
  slug,
5704
5704
  titleField: "name",
@@ -5717,7 +5717,7 @@ function ReferenceBuilder({
5717
5717
  tables.reload();
5718
5718
  onChange({ targetTableId: id, display: null });
5719
5719
  };
5720
- const mayMakeTable = (0, import_core3.doorReady)(client.config, import_core3.DOORS.tableFind) && (0, import_core3.doorReady)(client.config, import_core3.DOORS.tableEnsure);
5720
+ const mayMakeTable = (0, import_core8.doorReady)(client.config, import_core8.DOORS.tableFind) && (0, import_core8.doorReady)(client.config, import_core8.DOORS.tableEnsure);
5721
5721
  const newTableButton = !mayMakeTable ? null : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
5722
5722
  import_design_system10.Button,
5723
5723
  {
@@ -5931,7 +5931,7 @@ function ReferenceBuilder({
5931
5931
  // src/FormulaTextEditor.tsx
5932
5932
  var import_react16 = require("react");
5933
5933
  var import_react17 = require("@ai-matrx/records/react");
5934
- var import_records10 = require("@ai-matrx/records");
5934
+ var import_records5 = require("@ai-matrx/records");
5935
5935
  var import_design_system11 = require("@ai-matrx/design-system");
5936
5936
  init_host();
5937
5937
  init_Refusal();
@@ -5956,7 +5956,7 @@ var NOT_TYPED_BY_NAME = /* @__PURE__ */ new Set([
5956
5956
  function formulaFunctionNames(kinds) {
5957
5957
  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();
5958
5958
  }
5959
- var FORMULA_FUNCTION_NAMES = formulaFunctionNames(import_records10.RULE_NODE_KINDS);
5959
+ var FORMULA_FUNCTION_NAMES = formulaFunctionNames(import_records5.RULE_NODE_KINDS);
5960
5960
  var RESULT_WORD = {
5961
5961
  number: "a number",
5962
5962
  text: "text",
@@ -6224,7 +6224,7 @@ var import_react20 = require("react");
6224
6224
  // src/presentation.ts
6225
6225
  var import_table_style2 = require("@ai-matrx/design-system/data-table/table-style");
6226
6226
  var import_field_formats2 = require("@ai-matrx/design-system/field-formats");
6227
- var import_records11 = require("@ai-matrx/records");
6227
+ var import_core9 = require("@ai-matrx/records/core");
6228
6228
  init_parity();
6229
6229
  init_dates();
6230
6230
  var DRAWN_KINDS = /* @__PURE__ */ new Set(["select", "multi_select", "relation", "member", "person", "attachment", "file", "entity_reference", "checkbox", "boolean", "signature", "json"]);
@@ -6252,8 +6252,8 @@ function ungroupedForYears(field, format) {
6252
6252
  }
6253
6253
  function formatForField(field) {
6254
6254
  const shownAs = shownAsOf(field);
6255
- if ((0, import_records11.newerKindOf)(field) === "rating" && (!shownAs || shownAs.id === "rating")) {
6256
- return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: (0, import_records11.ratingMaxOf)(field) } };
6255
+ if ((0, import_core9.newerKindOf)(field) === "rating" && (!shownAs || shownAs.id === "rating")) {
6256
+ return { id: "rating", options: { ...shownAs?.options ?? {}, ratingMax: (0, import_core9.ratingMaxOf)(field) } };
6257
6257
  }
6258
6258
  if (shownAs) return ungroupedForYears(field, shownAs);
6259
6259
  const stamp = dateFormatFor(field);
@@ -6318,8 +6318,8 @@ var EMBEDDED_TABLE_CLASS = [
6318
6318
  // src/labels.tsx
6319
6319
  var import_react23 = require("react");
6320
6320
  var import_react24 = require("@ai-matrx/records/react");
6321
- var import_records12 = require("@ai-matrx/records");
6322
- var import_records13 = require("@ai-matrx/records");
6321
+ var import_records6 = require("@ai-matrx/records");
6322
+ var import_records7 = require("@ai-matrx/records");
6323
6323
  init_names();
6324
6324
  var import_uuid2 = require("@ai-matrx/kit/uuid");
6325
6325
 
@@ -6681,7 +6681,7 @@ function RecordLabelProvider({ children }) {
6681
6681
  for (const option of result.data ?? []) {
6682
6682
  const words = recordName(option.data, null, "Unnamed choice");
6683
6683
  next[option.id] = words;
6684
- const key = (0, import_records13.optionKey)(option);
6684
+ const key = (0, import_records7.optionKey)(option);
6685
6685
  if (key) next[choiceKeyName(field.id, key)] = words;
6686
6686
  }
6687
6687
  return next;
@@ -6799,7 +6799,7 @@ init_enumLabels();
6799
6799
 
6800
6800
  // src/EntityReferenceControl.tsx
6801
6801
  var import_react26 = require("react");
6802
- var import_records14 = require("@ai-matrx/records");
6802
+ var import_records8 = require("@ai-matrx/records");
6803
6803
  var import_react27 = require("@ai-matrx/records/react");
6804
6804
  var import_design_system15 = require("@ai-matrx/design-system");
6805
6805
  init_PickOrAdd();
@@ -6809,7 +6809,7 @@ var import_jsx_runtime17 = require("react/jsx-runtime");
6809
6809
  var WITHHELD_ENTITY_LABEL = "Something you have not been given access to";
6810
6810
  var ENTITY_REFERENCE_EMPTY = "Nothing is pointed at yet.";
6811
6811
  function entityReferenceText(value) {
6812
- const refs = (0, import_records14.entityRefsOf)(value);
6812
+ const refs = (0, import_records8.entityRefsOf)(value);
6813
6813
  if (refs.length === 0) return "\u2014";
6814
6814
  return refs.map((r) => r.label ?? WITHHELD_ENTITY_LABEL).join(", ");
6815
6815
  }
@@ -6823,7 +6823,7 @@ function EntityReferenceControl(props) {
6823
6823
  return client ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(WithWords, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Chips, { ...props, words: null, picker: null });
6824
6824
  }
6825
6825
  function WithWords(props) {
6826
- const refs = (0, import_react26.useMemo)(() => (0, import_records14.entityRefsOf)(props.value), [props.value]);
6826
+ const refs = (0, import_react26.useMemo)(() => (0, import_records8.entityRefsOf)(props.value), [props.value]);
6827
6827
  const [known, setKnown] = (0, import_react26.useState)([]);
6828
6828
  const withKnown = refs.map((r) => r.label === null ? known.find((k) => k.token === r.token && k.id === r.id) ?? r : r);
6829
6829
  const unlabelled = (0, import_react26.useMemo)(
@@ -6841,7 +6841,7 @@ function WithWords(props) {
6841
6841
  setKnown((k) => [...k.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked]);
6842
6842
  const multi = Boolean(props.field.multi);
6843
6843
  const next = multi ? [...withKnown.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked] : [picked];
6844
- props.onChange((0, import_records14.entityRefsToWrite)(next, multi));
6844
+ props.onChange((0, import_records8.entityRefsToWrite)(next, multi));
6845
6845
  }
6846
6846
  }
6847
6847
  );
@@ -6930,7 +6930,7 @@ function Chips({
6930
6930
  words,
6931
6931
  picker
6932
6932
  }) {
6933
- const refs = (0, import_react26.useMemo)(() => (0, import_records14.entityRefsOf)(value), [value]);
6933
+ const refs = (0, import_react26.useMemo)(() => (0, import_records8.entityRefsOf)(value), [value]);
6934
6934
  const labelOf = (token, refId, own3) => {
6935
6935
  if (own3) return own3;
6936
6936
  const read = words?.data?.find((w) => w.token === token && w.id === refId)?.label;
@@ -6954,7 +6954,7 @@ function Chips({
6954
6954
  "aria-label": `Take ${label} off`,
6955
6955
  onClick: () => {
6956
6956
  const rest = refs.filter((x) => !(x.token === r.token && x.id === r.id));
6957
- onChange((0, import_records14.entityRefsToWrite)(rest, multi));
6957
+ onChange((0, import_records8.entityRefsToWrite)(rest, multi));
6958
6958
  },
6959
6959
  children: "\xD7"
6960
6960
  }
@@ -6966,18 +6966,18 @@ function Chips({
6966
6966
  }
6967
6967
 
6968
6968
  // src/values.tsx
6969
- var import_core9 = require("@ai-matrx/records/core");
6969
+ var import_core15 = require("@ai-matrx/records/core");
6970
6970
 
6971
6971
  // src/WholeValue.tsx
6972
6972
  var import_react28 = require("react");
6973
- var import_core4 = require("@ai-matrx/records/core");
6973
+ var import_core10 = require("@ai-matrx/records/core");
6974
6974
  var import_design_system16 = require("@ai-matrx/design-system");
6975
6975
  init_host();
6976
6976
  var import_outbound_react2 = require("@ai-matrx/kit/outbound-react");
6977
6977
  var import_jsx_runtime18 = require("react/jsx-runtime");
6978
6978
  var WHOLE_VALUE_UNBOUND = "The whole text is kept as a file, and this screen has no way to open files yet.";
6979
6979
  function wholeValueLine(pointer) {
6980
- return `Open the whole text (${(0, import_core4.wholeValueSize)(pointer)})`;
6980
+ return `Open the whole text (${(0, import_core10.wholeValueSize)(pointer)})`;
6981
6981
  }
6982
6982
  function WholeValueCell({ words, pointer }) {
6983
6983
  const host = useRecordsUi();
@@ -6988,7 +6988,7 @@ function WholeValueCell({ words, pointer }) {
6988
6988
  words,
6989
6989
  "\u2026"
6990
6990
  ] }),
6991
- href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_outbound_react2.OutboundLink, { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, children: line }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0, import_core4.wholeValueSize)(pointer)} in a file` })
6991
+ href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_outbound_react2.OutboundLink, { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, children: line }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0, import_core10.wholeValueSize)(pointer)} in a file` })
6992
6992
  ] });
6993
6993
  }
6994
6994
 
@@ -7527,7 +7527,7 @@ function AttachmentControl({
7527
7527
  }
7528
7528
 
7529
7529
  // src/ReferenceChips.tsx
7530
- var import_records15 = require("@ai-matrx/records");
7530
+ var import_records9 = require("@ai-matrx/records");
7531
7531
  var import_design_system21 = require("@ai-matrx/design-system");
7532
7532
  init_host();
7533
7533
  init_kindValues();
@@ -7548,7 +7548,7 @@ function iconOf(pair) {
7548
7548
  }
7549
7549
  function referencesOf(field, value, kind, labels) {
7550
7550
  if (kind === "entity_reference") {
7551
- return (0, import_records15.entityRefsOf)(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
7551
+ return (0, import_records9.entityRefsOf)(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
7552
7552
  }
7553
7553
  const ids = (Array.isArray(value) ? value : [value]).filter(isId).map(String);
7554
7554
  const tableId = typeof field.relation_target === "string" ? field.relation_target : void 0;
@@ -7637,7 +7637,7 @@ function KindValueCell({
7637
7637
  init_kindValues();
7638
7638
 
7639
7639
  // src/formulaNames.ts
7640
- var import_records16 = require("@ai-matrx/records");
7640
+ var import_records10 = require("@ai-matrx/records");
7641
7641
  init_names();
7642
7642
  function fieldRefsOf(expr) {
7643
7643
  const out = [];
@@ -7688,14 +7688,14 @@ function formulaSourceArchived(field, document2) {
7688
7688
  const keys = (field.config ?? {})[FORMULA_INPUT_KEYS];
7689
7689
  if (!Array.isArray(keys) || !document2) return null;
7690
7690
  for (const key of keys) {
7691
- const state2 = (0, import_records16.sourceArchivedOf)(document2[String(key)]);
7691
+ const state2 = (0, import_records10.sourceArchivedOf)(document2[String(key)]);
7692
7692
  if (state2) return state2;
7693
7693
  }
7694
7694
  return null;
7695
7695
  }
7696
7696
 
7697
7697
  // src/values.tsx
7698
- var import_records23 = require("@ai-matrx/records");
7698
+ var import_records17 = require("@ai-matrx/records");
7699
7699
  var import_uuid4 = require("@ai-matrx/kit/uuid");
7700
7700
 
7701
7701
  // src/userIds.ts
@@ -7745,7 +7745,7 @@ init_host();
7745
7745
 
7746
7746
  // src/PersonPicker.tsx
7747
7747
  var import_react35 = require("react");
7748
- var import_records17 = require("@ai-matrx/records");
7748
+ var import_records11 = require("@ai-matrx/records");
7749
7749
  var import_react36 = require("@ai-matrx/records/react");
7750
7750
  var import_design_system22 = require("@ai-matrx/design-system");
7751
7751
  init_PickOrAdd();
@@ -7833,7 +7833,7 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
7833
7833
  cancelled = true;
7834
7834
  };
7835
7835
  }, [client, personTable, picked.length, people.length]);
7836
- const listed = (0, import_records17.rankTypedMatches)(members ?? [], search, memberName);
7836
+ const listed = (0, import_records11.rankTypedMatches)(members ?? [], search, memberName);
7837
7837
  if (!membersPort || !client) {
7838
7838
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: (0, import_design_system22.cn)("text-xs text-muted-foreground", className), children: NO_MEMBERS_REASON });
7839
7839
  }
@@ -8372,7 +8372,7 @@ function structuredNode(field, structured, room) {
8372
8372
  return room === "cell" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(StructuredCell, { structured, label }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(StructuredValueView, { structured, label });
8373
8373
  }
8374
8374
  function renderValue(field, value, document2, labels, stillWaitingFor, look, room = "cell") {
8375
- const archivedSource = (0, import_records23.sourceArchivedOf)(value);
8375
+ const archivedSource = (0, import_records17.sourceArchivedOf)(value);
8376
8376
  if (archivedSource) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SourceArchivedValue, { state: archivedSource });
8377
8377
  const envelope = envelopeFor(document2, field.key);
8378
8378
  if (envelope?.absent) {
@@ -8395,10 +8395,10 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look, roo
8395
8395
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
8396
8396
  }
8397
8397
  if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SignatureValue, { value, fieldKey: field.key, document: document2 });
8398
- if ((0, import_records23.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ButtonValue, { field });
8398
+ if ((0, import_records17.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ButtonValue, { field });
8399
8399
  const newer = newerKindValue(field, value);
8400
8400
  if (newer !== void 0) return newer;
8401
- const whole = typeof value === "string" ? (0, import_core9.wholeValueOf)(document2, field.key) : null;
8401
+ const whole = typeof value === "string" ? (0, import_core15.wholeValueOf)(document2, field.key) : null;
8402
8402
  if (whole) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(WholeValueCell, { words: value, pointer: whole });
8403
8403
  const kind = editorKindFor(field);
8404
8404
  if (kind === "relation" || kind === "entity_reference") {
@@ -8533,10 +8533,10 @@ function personWordsOf(kind, value) {
8533
8533
  }
8534
8534
  function scalarText(field, value, labels, stillWaitingFor) {
8535
8535
  if (value === null || value === void 0) return "\u2014";
8536
- if ((0, import_records23.sourceArchivedOf)(value)) return SOURCE_ARCHIVED_WORDS;
8536
+ if ((0, import_records17.sourceArchivedOf)(value)) return SOURCE_ARCHIVED_WORDS;
8537
8537
  if (isSignatureField(field)) return signatureWords(value) ?? "\u2014";
8538
- if ((0, import_records23.autonumberPrefixOf)(field)) return (0, import_records23.autonumberWords)(field, value) ?? String(value);
8539
- const newerWords = (0, import_records23.newerKindWords)(field, value);
8538
+ if ((0, import_records17.autonumberPrefixOf)(field)) return (0, import_records17.autonumberWords)(field, value) ?? String(value);
8539
+ const newerWords = (0, import_records17.newerKindWords)(field, value);
8540
8540
  if (newerWords !== null) return newerWords;
8541
8541
  const kind = editorKindFor(field);
8542
8542
  if (kind === "entity_reference") return entityReferenceText(value);
@@ -8629,7 +8629,7 @@ function SourceArchivedNotice({ fieldId, tableId }) {
8629
8629
  // src/Condition.tsx
8630
8630
  var import_react52 = require("react");
8631
8631
  var import_design_system29 = require("@ai-matrx/design-system");
8632
- var import_records24 = require("@ai-matrx/records");
8632
+ var import_records18 = require("@ai-matrx/records");
8633
8633
  init_PickOrAdd();
8634
8634
  init_choiceLooks();
8635
8635
  var import_react53 = require("@ai-matrx/records/react");
@@ -8780,7 +8780,7 @@ function ChoiceValue({ field, value, onChange }) {
8780
8780
  void (0, askOnce_exports.fieldOptionsOnce)(client, field.id).then((got) => {
8781
8781
  if (cancelled) return;
8782
8782
  setChoices(
8783
- got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records24.optionKey)(o), label: (0, import_records24.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []
8783
+ got.ok ? (got.data ?? []).map((o) => ({ key: (0, import_records18.optionKey)(o), label: (0, import_records18.optionLabel)(o) ?? "" })).filter((c) => c.label !== "") : []
8784
8784
  );
8785
8785
  });
8786
8786
  return () => {
@@ -8798,7 +8798,7 @@ function ChoiceValue({ field, value, onChange }) {
8798
8798
  }
8799
8799
  );
8800
8800
  }
8801
- const shown2 = (0, import_records24.rankTypedMatches)(choices, search.trim(), (c) => c.label);
8801
+ const shown2 = (0, import_records18.rankTypedMatches)(choices, search.trim(), (c) => c.label);
8802
8802
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "inline-flex min-w-0", "data-records-condition-choice": "", "data-pick-value": value, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
8803
8803
  PickOrAdd,
8804
8804
  {
@@ -9232,7 +9232,7 @@ function ConditionGroup({
9232
9232
 
9233
9233
  // src/FieldRetype.tsx
9234
9234
  var import_react54 = require("react");
9235
- var import_records25 = require("@ai-matrx/records");
9235
+ var import_records19 = require("@ai-matrx/records");
9236
9236
  var import_react55 = require("@ai-matrx/records/react");
9237
9237
  var import_design_system30 = require("@ai-matrx/design-system");
9238
9238
  init_parity();
@@ -9434,7 +9434,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
9434
9434
  return;
9435
9435
  }
9436
9436
  const groups = rows.map((r) => ({ value: r.ids.map((id) => people.get(id)?.name ?? "").join(", "), count: 1 }));
9437
- setPreview((0, import_records25.previewRetype)({ type: to.behaviour, kind: to.kind }, groups, false));
9437
+ setPreview((0, import_records19.previewRetype)({ type: to.behaviour, kind: to.kind }, groups, false));
9438
9438
  }).catch((e) => {
9439
9439
  if (cancelled) return;
9440
9440
  setAsking(false);
@@ -9452,7 +9452,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
9452
9452
  return;
9453
9453
  }
9454
9454
  const groups = answer.data.map((row) => ({ value: row.groups[field.key] ?? null, count: row.row_count }));
9455
- setPreview((0, import_records25.previewRetype)({ type: to.behaviour, kind: to.kind }, groups, answer.data.length >= PREVIEW_GROUPS));
9455
+ setPreview((0, import_records19.previewRetype)({ type: to.behaviour, kind: to.kind }, groups, answer.data.length >= PREVIEW_GROUPS));
9456
9456
  });
9457
9457
  return () => {
9458
9458
  cancelled = true;
@@ -9564,7 +9564,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
9564
9564
 
9565
9565
  // src/FieldRulePreview.tsx
9566
9566
  var import_react56 = require("react");
9567
- var import_records26 = require("@ai-matrx/records");
9567
+ var import_records20 = require("@ai-matrx/records");
9568
9568
  var import_react57 = require("@ai-matrx/records/react");
9569
9569
  init_Refusal();
9570
9570
  init_names();
@@ -9605,7 +9605,7 @@ function FieldRulePreview({ field, tableId, rules }) {
9605
9605
  }
9606
9606
  const numbers = holdsNumbers(field);
9607
9607
  const groups = answer.data.map((row) => ({ value: groupValue(row.groups[field.key] ?? null, numbers), count: row.row_count }));
9608
- setPreview((0, import_records26.previewRuleChange)(latest.current, groups, answer.data.length >= PREVIEW_GROUPS2));
9608
+ setPreview((0, import_records20.previewRuleChange)(latest.current, groups, answer.data.length >= PREVIEW_GROUPS2));
9609
9609
  });
9610
9610
  }, 300);
9611
9611
  return () => {
@@ -9719,7 +9719,7 @@ function choiceLookForNewList(multi, rows) {
9719
9719
  }
9720
9720
 
9721
9721
  // src/NewerKindQuestions.tsx
9722
- var import_records27 = require("@ai-matrx/records");
9722
+ var import_records21 = require("@ai-matrx/records");
9723
9723
  var import_design_system31 = require("@ai-matrx/design-system");
9724
9724
  var import_jsx_runtime34 = require("react/jsx-runtime");
9725
9725
  var STATUS_STARTING_CHOICES = [
@@ -9740,7 +9740,7 @@ function statusGroupRows(field, rows, keyOfId, changed) {
9740
9740
  if (words === "") continue;
9741
9741
  const ref = r.id ?? words;
9742
9742
  const key = r.id ? keyOfId[r.id] : void 0;
9743
- const held = field && key ? (0, import_records27.statusGroupOf)(field, key) : void 0;
9743
+ const held = field && key ? (0, import_records21.statusGroupOf)(field, key) : void 0;
9744
9744
  out.push({ ref, words, group: changed[ref] ?? held ?? guessStatusGroup(words) });
9745
9745
  }
9746
9746
  return out;
@@ -9756,10 +9756,10 @@ function StatusGroupsQuestion({
9756
9756
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "min-w-0 flex-1 truncate text-sm", children: r.words }),
9757
9757
  /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_design_system31.Select, { value: r.group, onValueChange: (next) => onGroup(r.ref, next), children: [
9758
9758
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system31.SelectTrigger, { size: "sm", className: "w-36", "aria-label": `Group for ${r.words}`, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system31.SelectValue, {}) }),
9759
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system31.SelectContent, { children: import_records27.STATUS_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_design_system31.SelectItem, { value: g, children: [
9759
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system31.SelectContent, { children: import_records21.STATUS_GROUPS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_design_system31.SelectItem, { value: g, children: [
9760
9760
  STATUS_GROUP_MARK[g],
9761
9761
  " ",
9762
- import_records27.STATUS_GROUP_WORDS[g]
9762
+ import_records21.STATUS_GROUP_WORDS[g]
9763
9763
  ] }, g)) })
9764
9764
  ] })
9765
9765
  ] }, r.ref))
@@ -9797,7 +9797,7 @@ function BarcodeSymbologyQuestion({ value, onChange }) {
9797
9797
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system31.SelectTrigger, { size: "sm", "aria-label": "Code type", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system31.SelectValue, {}) }),
9798
9798
  /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_design_system31.SelectContent, { children: [
9799
9799
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system31.SelectItem, { value: "any", children: "Any code" }),
9800
- import_records27.BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system31.SelectItem, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
9800
+ import_records21.BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_design_system31.SelectItem, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
9801
9801
  ] })
9802
9802
  ] })
9803
9803
  ] });
@@ -10122,21 +10122,21 @@ function nextFieldSort(fields) {
10122
10122
 
10123
10123
  // src/FieldEditor.tsx
10124
10124
  init_enumLabels();
10125
- var import_records30 = require("@ai-matrx/records");
10125
+ var import_records24 = require("@ai-matrx/records");
10126
10126
 
10127
10127
  // src/ButtonSettings.tsx
10128
10128
  var import_react58 = require("react");
10129
10129
  var import_design_system34 = require("@ai-matrx/design-system");
10130
10130
  var import_data_table5 = require("@ai-matrx/design-system/data-table");
10131
- var import_records29 = require("@ai-matrx/records");
10131
+ var import_records23 = require("@ai-matrx/records");
10132
10132
  var import_react59 = require("@ai-matrx/records/react");
10133
10133
 
10134
10134
  // src/AccentSwatches.tsx
10135
- var import_records28 = require("@ai-matrx/records");
10135
+ var import_records22 = require("@ai-matrx/records");
10136
10136
  var import_design_system33 = require("@ai-matrx/design-system");
10137
10137
  var import_data_table4 = require("@ai-matrx/design-system/data-table");
10138
10138
  var import_jsx_runtime36 = require("react/jsx-runtime");
10139
- function AccentSwatches({ value, onChange, options = import_records28.PORTAL_ACCENTS, noneLabel = "App colour" }) {
10139
+ function AccentSwatches({ value, onChange, options = import_records22.PORTAL_ACCENTS, noneLabel = "App colour" }) {
10140
10140
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Colour", children: [
10141
10141
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
10142
10142
  "button",
@@ -10182,7 +10182,7 @@ var DOES_WORDS = {
10182
10182
  };
10183
10183
  function buttonUrlInWords(url, fields) {
10184
10184
  let out = url;
10185
- for (const id of (0, import_records29.buttonUrlPlaceholders)(url)) {
10185
+ for (const id of (0, import_records23.buttonUrlPlaceholders)(url)) {
10186
10186
  const f = fields.find((x) => x.id === id || x.key === id);
10187
10187
  if (f) out = out.split(`{{${id}}}`).join(`{${fieldName(f)}}`);
10188
10188
  }
@@ -10277,7 +10277,7 @@ function ButtonSettingsEditor({
10277
10277
  }
10278
10278
  ) : null
10279
10279
  ] }),
10280
- value.url && (0, import_records29.buttonUrlPlaceholders)(value.url).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
10280
+ value.url && (0, import_records23.buttonUrlPlaceholders)(value.url).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
10281
10281
  ] }) : null,
10282
10282
  value.do === "run_action" ? !tableId ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "text-xs text-muted-foreground", children: "Row actions belong to a table" }) : actionsRefused ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(RefusalLine, { error: actionsRefused }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-2", "data-records-button-action": "", children: [
10283
10283
  actions === null || actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
@@ -10383,11 +10383,11 @@ function NewRowAction({
10383
10383
  }
10384
10384
 
10385
10385
  // src/FieldEditor.tsx
10386
- var import_records31 = require("@ai-matrx/records");
10386
+ var import_records25 = require("@ai-matrx/records");
10387
10387
  var import_jsx_runtime38 = require("react/jsx-runtime");
10388
10388
  var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
10389
- var SENSITIVITIES = import_records31.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
10390
- var AGENT_VISIBILITY = import_records31.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
10389
+ var SENSITIVITIES = import_records25.FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
10390
+ var AGENT_VISIBILITY = import_records25.CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
10391
10391
  var ROLLUP_OPERATIONS = ROLLUP_AGG_VALUES.map((value) => ({
10392
10392
  value,
10393
10393
  label: ROLLUP_AGG_LABEL[value]
@@ -10400,7 +10400,7 @@ var FORMULA_OPERATIONS = FORMULA_OP_VALUES.map((value) => ({
10400
10400
  label: FORMULA_OP_LABEL[value],
10401
10401
  joins: FORMULA_OP_JOINS[value]
10402
10402
  }));
10403
- var STORE_BEHAVIOUR = new Map(import_records31.DECLARABLE_FIELD_KINDS.map((row) => [row.kind, row.behavior]));
10403
+ var STORE_BEHAVIOUR = new Map(import_records25.DECLARABLE_FIELD_KINDS.map((row) => [row.kind, row.behavior]));
10404
10404
  function holdsAValueOnAStandardTable(kind) {
10405
10405
  if (isSystemFieldKind(kind)) return false;
10406
10406
  const behaviour = STORE_BEHAVIOUR.get(kind);
@@ -10506,20 +10506,20 @@ function FieldEditor(props) {
10506
10506
  const [contextPolicy, setContextPolicy] = (0, import_react60.useState)(String(start?.context_policy ?? "include"));
10507
10507
  const [rules, setRules] = (0, import_react60.useState)(start?.rules ?? []);
10508
10508
  const [startsWith, setStartsWith] = (0, import_react60.useState)(start?.default ?? null);
10509
- const [ratingMax, setRatingMax] = (0, import_react60.useState)(() => start ? (0, import_records31.ratingMaxOf)(start) : 5);
10509
+ const [ratingMax, setRatingMax] = (0, import_react60.useState)(() => start ? (0, import_records25.ratingMaxOf)(start) : 5);
10510
10510
  const savedRules = (0, import_react60.useMemo)(
10511
- () => field ? type === "rating" ? (0, import_records31.rulesWithTopStar)(field.rules ?? [], (0, import_records31.ratingMaxOf)(field)) : field.rules ?? [] : [],
10511
+ () => field ? type === "rating" ? (0, import_records25.rulesWithTopStar)(field.rules ?? [], (0, import_records25.ratingMaxOf)(field)) : field.rules ?? [] : [],
10512
10512
  [field, type]
10513
10513
  );
10514
- const editedRules = (0, import_react60.useMemo)(() => type === "rating" ? (0, import_records31.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
10514
+ const editedRules = (0, import_react60.useMemo)(() => type === "rating" ? (0, import_records25.rulesWithTopStar)(rules, ratingMax) : rules, [type, rules, ratingMax]);
10515
10515
  const [statusGroups, setStatusGroups] = (0, import_react60.useState)({});
10516
10516
  const [statusKeys, setStatusKeys] = (0, import_react60.useState)({});
10517
10517
  const [symbology, setSymbology] = (0, import_react60.useState)(String(start?.config?.["symbology"] ?? ""));
10518
10518
  const descriptionStart = String(start?.config?.["description"] ?? "");
10519
10519
  const [description, setDescription] = (0, import_react60.useState)(descriptionStart);
10520
- const buttonStart = (0, import_react60.useMemo)(() => (0, import_records30.buttonOf)(start) ?? { label: "" }, [start]);
10520
+ const buttonStart = (0, import_react60.useMemo)(() => (0, import_records24.buttonOf)(start) ?? { label: "" }, [start]);
10521
10521
  const [buttonSettings, setButtonSettings] = (0, import_react60.useState)(buttonStart);
10522
- const prefixStart = (0, import_records30.autonumberPrefixOf)(start);
10522
+ const prefixStart = (0, import_records24.autonumberPrefixOf)(start);
10523
10523
  const [numberPrefix, setNumberPrefix] = (0, import_react60.useState)(prefixStart);
10524
10524
  const dependencyStart = start?.config?.["dependency"] === true;
10525
10525
  const [dependency, setDependency] = (0, import_react60.useState)(dependencyStart);
@@ -10527,7 +10527,7 @@ function FieldEditor(props) {
10527
10527
  if (!field || type !== "status") return;
10528
10528
  let live = true;
10529
10529
  void client.fieldOptions({ field_id: field.id }).then((got) => {
10530
- if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records31.optionKey)(o)])));
10530
+ if (live && got.ok) setStatusKeys(Object.fromEntries((got.data ?? []).map((o) => [String(o.id), (0, import_records25.optionKey)(o)])));
10531
10531
  });
10532
10532
  return () => {
10533
10533
  live = false;
@@ -10650,7 +10650,7 @@ function FieldEditor(props) {
10650
10650
  const nameTaken = columnNameTakenBy(label, others.map(fieldName));
10651
10651
  const nameLine = nameTaken ? columnNameTakenLine(nameTaken, noun) : columnNameProblemLine(label, noun);
10652
10652
  const listsChoices = type === "select" || type === "multi_select" || type === "status";
10653
- const buttonMissing = type === "button" && buttonSettings.do ? (0, import_records30.buttonNeeds)(buttonSettings) : null;
10653
+ const buttonMissing = type === "button" && buttonSettings.do ? (0, import_records24.buttonNeeds)(buttonSettings) : null;
10654
10654
  const missing = buttonMissing ?? (editing ? formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(choiceList) : null) : formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(newChoices) : null) ?? (type === "formula" && formulaWritten ? null : whatIsMissing(
10655
10655
  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 }
10656
10656
  )));
@@ -10692,7 +10692,7 @@ function FieldEditor(props) {
10692
10692
  ...statusGroupsChanged ? { status_groups: statusGroupsSent } : {},
10693
10693
  // V11 #4/#10: a rating's top star goes as `max`, the word custom.field_update now takes the way
10694
10694
  // custom.field_declare does; the store writes the max Rule and sets aside any score above it.
10695
- ...type === "rating" && ratingMax !== (0, import_records31.ratingMaxOf)(field) ? { max: ratingMax } : {},
10695
+ ...type === "rating" && ratingMax !== (0, import_records25.ratingMaxOf)(field) ? { max: ratingMax } : {},
10696
10696
  ...type === "barcode" && symbology !== String(field.config?.["symbology"] ?? "") ? { symbology: symbology === "" ? null : symbology } : {},
10697
10697
  ...type === "button" && JSON.stringify(buttonSettings) !== JSON.stringify(buttonStart) ? { button: buttonSettings } : {},
10698
10698
  ...field.type === "relation" && dependency !== dependencyStart ? { dependency } : {},
@@ -10727,7 +10727,7 @@ function FieldEditor(props) {
10727
10727
  return;
10728
10728
  }
10729
10729
  (0, import_react61.tableShapeChanged)(tableId);
10730
- for (const c of done.data.undo.cells_back) (0, import_core10.announceRecordChanged)(c.record_id);
10730
+ for (const c of done.data.undo.cells_back) (0, import_core16.announceRecordChanged)(c.record_id);
10731
10731
  const n = done.data.rehomed.reduce((sum, r) => sum + r.records, 0);
10732
10732
  setRehome({});
10733
10733
  setRehomed({ said: `Saved. ${n} ${n === 1 ? "record was" : "records were"} changed with the choices.`, undo: done.data.undo });
@@ -11241,7 +11241,7 @@ function FieldEditor(props) {
11241
11241
  return;
11242
11242
  }
11243
11243
  (0, import_react61.tableShapeChanged)(tableId);
11244
- for (const c of undo.cells_back) (0, import_core10.announceRecordChanged)(c.record_id);
11244
+ for (const c of undo.cells_back) (0, import_core16.announceRecordChanged)(c.record_id);
11245
11245
  setChoiceList(null);
11246
11246
  setChoiceListStart(null);
11247
11247
  setRehomed({ said: "Undone. The choices and the records that held them are back as they were.", undo: null });
@@ -11712,7 +11712,7 @@ function runAnswerWords(label, run) {
11712
11712
  var stop2 = (event) => event.stopPropagation();
11713
11713
  function ButtonValue({ field, recordId, inCell }) {
11714
11714
  const client = (0, import_react63.useOptionalRecordsClient)();
11715
- const b = (0, import_records32.buttonOf)(field);
11715
+ const b = (0, import_records26.buttonOf)(field);
11716
11716
  const [busy, setBusy] = (0, import_react62.useState)(false);
11717
11717
  const [said2, setSaid] = (0, import_react62.useState)(null);
11718
11718
  const [settingUp, setSettingUp] = (0, import_react62.useState)(false);
@@ -11720,7 +11720,7 @@ function ButtonValue({ field, recordId, inCell }) {
11720
11720
  (0, import_react62.useEffect)(() => () => void (waitingOn.current += 1), []);
11721
11721
  if (!b) return null;
11722
11722
  const color = (0, import_data_table6.isStyleColor)(b.color) ? import_data_table6.CHOICE_CHIP_CLASS[b.color] : import_data_table6.NEUTRAL_CHIP_CLASS;
11723
- const needs = (0, import_records32.buttonNeeds)(b);
11723
+ const needs = (0, import_records26.buttonNeeds)(b);
11724
11724
  const tableId = field.entity_definition_id;
11725
11725
  const press = async () => {
11726
11726
  if (!client || !recordId) return setSaid({ kind: "public" });
@@ -12012,7 +12012,7 @@ function formatControl(args) {
12012
12012
  // src/typedDateHelper.tsx
12013
12013
  var import_react66 = require("react");
12014
12014
  var import_design_system38 = require("@ai-matrx/design-system");
12015
- var import_records33 = require("@ai-matrx/records");
12015
+ var import_records27 = require("@ai-matrx/records");
12016
12016
  var import_jsx_runtime42 = require("react/jsx-runtime");
12017
12017
  var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
12018
12018
  var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
@@ -12021,12 +12021,12 @@ function pad(n) {
12021
12021
  }
12022
12022
  function readBox(text, kind) {
12023
12023
  if (kind === "time") {
12024
- const t = (0, import_records33.readTypedTime)(text);
12024
+ const t = (0, import_records27.readTypedTime)(text);
12025
12025
  if (!t.ok) return { day: null, time: null };
12026
12026
  const [h, m] = t.value.split(":").map(Number);
12027
12027
  return { day: null, time: { h, m } };
12028
12028
  }
12029
- const read = (0, import_records33.readTypedDate)(text, { withTime: kind === "datetime" });
12029
+ const read = (0, import_records27.readTypedDate)(text, { withTime: kind === "datetime" });
12030
12030
  if (!read.ok) return { day: null, time: null };
12031
12031
  if (kind === "datetime" && read.instant) {
12032
12032
  const at = new Date(read.instant);
@@ -12035,10 +12035,10 @@ function readBox(text, kind) {
12035
12035
  return { day: read.day, time: null };
12036
12036
  }
12037
12037
  function wordsFor2(kind, day, time) {
12038
- if (kind === "time") return time ? (0, import_records33.typedTimeText)(time.h, time.m) : "";
12038
+ if (kind === "time") return time ? (0, import_records27.typedTimeText)(time.h, time.m) : "";
12039
12039
  if (!day) return "";
12040
- const dayText = (0, import_records33.typedDateText)(day);
12041
- return kind === "datetime" && time ? `${dayText} ${(0, import_records33.typedTimeText)(time.h, time.m)}` : dayText;
12040
+ const dayText = (0, import_records27.typedDateText)(day);
12041
+ return kind === "datetime" && time ? `${dayText} ${(0, import_records27.typedTimeText)(time.h, time.m)}` : dayText;
12042
12042
  }
12043
12043
  var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
12044
12044
  function CalendarGlyph() {
@@ -12160,7 +12160,7 @@ function TypedDateHelper({
12160
12160
  held.time && held.time.h === t.h && held.time.m === t.m ? "bg-primary text-primary-foreground" : ""
12161
12161
  ),
12162
12162
  onClick: () => pickTime(t),
12163
- children: (0, import_records33.typedTimeText)(t.h, t.m)
12163
+ children: (0, import_records27.typedTimeText)(t.h, t.m)
12164
12164
  },
12165
12165
  `${t.h}:${t.m}`
12166
12166
  )) })
@@ -12231,21 +12231,21 @@ function judgeTyped(field, text, choices, nudge) {
12231
12231
  const format = formatForField(field);
12232
12232
  if (trimmed === "") return { value: null };
12233
12233
  if (format && format.id === "time") {
12234
- const read2 = (0, import_records34.readTypedTime)(trimmed);
12234
+ const read2 = (0, import_records28.readTypedTime)(trimmed);
12235
12235
  return read2.ok ? { value: read2.value } : { refusal: SHORT_REFUSAL.time, why: `${fieldName(field)} holds a time of day, and ${read2.why}` };
12236
12236
  }
12237
12237
  if (kind === "select" || kind === "multi_select") {
12238
12238
  if (!choices || nudge === null) return null;
12239
12239
  const several = field.multi || kind === "multi_select";
12240
12240
  const words = several ? trimmed.split(/\s*[,;\n]\s*/).filter(Boolean) : [trimmed];
12241
- const allowOther = (0, import_records34.allowsOtherValues)(field);
12241
+ const allowOther = (0, import_records28.allowsOtherValues)(field);
12242
12242
  const parts = [];
12243
12243
  const add = [];
12244
12244
  const ask = [];
12245
12245
  const notChoices = [];
12246
12246
  let keepOffered = allowOther;
12247
12247
  for (const word of words) {
12248
- const decided = (0, import_records34.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
12248
+ const decided = (0, import_records28.decideTypedChoice)({ words: word, options: choices, allowOther, nudge });
12249
12249
  if (decided.decision === "empty") continue;
12250
12250
  if (decided.decision === "chosen") parts.push(decided.key);
12251
12251
  else {
@@ -12278,7 +12278,7 @@ function judgeTyped(field, text, choices, nudge) {
12278
12278
  return usual && digits.length >= 7 && digits.length <= 20 ? { value: trimmed } : { refusal: SHORT_REFUSAL.phone };
12279
12279
  }
12280
12280
  const showsAsPercent = Boolean(format && (format.id === "percent" || format.id === "progress"));
12281
- const read = (0, import_records34.coerceTypedAnswer)(field, text, { label: fieldName(field), showsAsPercent });
12281
+ const read = (0, import_records28.coerceTypedAnswer)(field, text, { label: fieldName(field), showsAsPercent });
12282
12282
  if ("refusal" in read) {
12283
12283
  if (kind === "email" || kind === "url") return { refusal: SHORT_REFUSAL[kind] };
12284
12284
  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;
@@ -12299,12 +12299,12 @@ function openingText(field, value) {
12299
12299
  if (value === null || value === void 0 || value === "") return "";
12300
12300
  const helper = dateHelperKind(field, value);
12301
12301
  if (helper === "time") {
12302
- const read = (0, import_records34.readTypedTime)(String(value));
12302
+ const read = (0, import_records28.readTypedTime)(String(value));
12303
12303
  if (!read.ok) return String(value);
12304
12304
  const [h, m] = read.value.split(":").map(Number);
12305
- return (0, import_records34.typedTimeText)(h, m);
12305
+ return (0, import_records28.typedTimeText)(h, m);
12306
12306
  }
12307
- if (helper) return (0, import_records34.typedDateText)(value, { withTime: helper === "datetime" });
12307
+ if (helper) return (0, import_records28.typedDateText)(value, { withTime: helper === "datetime" });
12308
12308
  const format = formatForField(field);
12309
12309
  return format ? typedText(format, value) : String(value);
12310
12310
  }
@@ -12393,7 +12393,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
12393
12393
  " ",
12394
12394
  needsChoices ? String(
12395
12395
  (Array.isArray(withoutAddition(judged.value).value) ? withoutAddition(judged.value).value : [withoutAddition(judged.value).value]).map((k) => {
12396
- const option = choices?.find((o) => (0, import_records34.optionKey)(o) === k);
12396
+ const option = choices?.find((o) => (0, import_records28.optionKey)(o) === k);
12397
12397
  return option ? recordName(option.data, null, String(k)) : String(k);
12398
12398
  }).join(", ")
12399
12399
  ) : (() => {
@@ -12414,7 +12414,7 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
12414
12414
  const ownDetails = (0, import_react68.useOptionalRecordsClient)() === null;
12415
12415
  if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
12416
12416
  if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
12417
- if ((0, import_records34.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ButtonValue, { field });
12417
+ if ((0, import_records28.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ButtonValue, { field });
12418
12418
  const newerControl = newerKindControl({ field, value, onChange, disabled, id: inputId });
12419
12419
  if (newerControl !== void 0) return newerControl;
12420
12420
  const format = formatForField(field);
@@ -12584,7 +12584,7 @@ function TypedWordsControl({ field, value, onChange, disabled, id }) {
12584
12584
  function typedDatePlaceholder(helper) {
12585
12585
  const time = "h:mm AM";
12586
12586
  if (helper === "time") return time;
12587
- const pattern = (0, import_records34.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
12587
+ const pattern = (0, import_records28.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
12588
12588
  return helper === "datetime" ? `${pattern} ${time}` : pattern;
12589
12589
  }
12590
12590
  function CheckboxControl({ field, value, onChange, disabled, id }) {
@@ -12754,15 +12754,15 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
12754
12754
  ChoiceAnswer,
12755
12755
  {
12756
12756
  field,
12757
- choices: options.map((option) => ({ key: (0, import_records34.optionKey)(option), label: titled(option) })),
12757
+ choices: options.map((option) => ({ key: (0, import_records28.optionKey)(option), label: titled(option) })),
12758
12758
  value,
12759
12759
  onChange,
12760
12760
  disabled,
12761
12761
  id,
12762
12762
  onChosen,
12763
12763
  isChosen: (choice, v) => {
12764
- const option = options.find((o) => (0, import_records34.optionKey)(o) === choice.key);
12765
- return option ? (0, import_records34.isTheChosen)(option, v) : false;
12764
+ const option = options.find((o) => (0, import_records28.optionKey)(o) === choice.key);
12765
+ return option ? (0, import_records28.isTheChosen)(option, v) : false;
12766
12766
  }
12767
12767
  }
12768
12768
  );
@@ -12795,7 +12795,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
12795
12795
  onCancel,
12796
12796
  initialSearch,
12797
12797
  addsChoices,
12798
- allowOther: (0, import_records34.allowsOtherValues)(field),
12798
+ allowOther: (0, import_records28.allowsOtherValues)(field),
12799
12799
  onChoicesChanged: () => {
12800
12800
  if (client) (0, askOnce_exports.forgetAsked)(client, `field_options:${field.id}`);
12801
12801
  setReread((n) => n + 1);
@@ -12809,19 +12809,19 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
12809
12809
  }
12810
12810
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
12811
12811
  if (field.multi) {
12812
- const chosen = options.filter((option) => (0, import_records34.choiceValuesOf)(value).some((v) => (0, import_records34.isTheChosen)(option, v)));
12813
- const picked = new Set(chosen.map((option) => (0, import_records34.optionKey)(option)));
12812
+ const chosen = options.filter((option) => (0, import_records28.choiceValuesOf)(value).some((v) => (0, import_records28.isTheChosen)(option, v)));
12813
+ const picked = new Set(chosen.map((option) => (0, import_records28.optionKey)(option)));
12814
12814
  const toggles = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
12815
12815
  import_design_system39.Button,
12816
12816
  {
12817
12817
  type: "button",
12818
12818
  size: "sm",
12819
- variant: picked.has((0, import_records34.optionKey)(option)) ? "default" : "outline",
12819
+ variant: picked.has((0, import_records28.optionKey)(option)) ? "default" : "outline",
12820
12820
  disabled,
12821
12821
  onClick: () => {
12822
12822
  const next = new Set(picked);
12823
- if (next.has((0, import_records34.optionKey)(option))) next.delete((0, import_records34.optionKey)(option));
12824
- else next.add((0, import_records34.optionKey)(option));
12823
+ if (next.has((0, import_records28.optionKey)(option))) next.delete((0, import_records28.optionKey)(option));
12824
+ else next.add((0, import_records28.optionKey)(option));
12825
12825
  onChange(next.size === 0 ? null : [...next]);
12826
12826
  },
12827
12827
  children: titleOf(option)
@@ -12843,11 +12843,11 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
12843
12843
  }
12844
12844
  );
12845
12845
  }
12846
- const current = options.find((option) => (0, import_records34.isTheChosen)(option, value));
12846
+ const current = options.find((option) => (0, import_records28.isTheChosen)(option, value));
12847
12847
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
12848
12848
  import_design_system39.Select,
12849
12849
  {
12850
- value: current ? (0, import_records34.optionKey)(current) : "",
12850
+ value: current ? (0, import_records28.optionKey)(current) : "",
12851
12851
  disabled: disabled ?? false,
12852
12852
  onValueChange: (next) => onChange(next === "" ? null : next),
12853
12853
  ...autoOpen ? {
@@ -12859,7 +12859,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
12859
12859
  } : {},
12860
12860
  children: [
12861
12861
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectTrigger, { id, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectValue, { placeholder: "Choose" }) }),
12862
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectItem, { value: (0, import_records34.optionKey)(option), children: titleOf(option) }, option.id)) })
12862
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.SelectItem, { value: (0, import_records28.optionKey)(option), children: titleOf(option) }, option.id)) })
12863
12863
  ]
12864
12864
  }
12865
12865
  );
@@ -12893,23 +12893,23 @@ function OpenChoicePicker({
12893
12893
  const [addRefused, setAddRefused] = (0, import_react67.useState)(null);
12894
12894
  const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
12895
12895
  const held = withoutAddition(value);
12896
- const current = (0, import_records34.choiceValuesOf)(held.value);
12896
+ const current = (0, import_records28.choiceValuesOf)(held.value);
12897
12897
  const pickedWords = current.map((v) => {
12898
- const option = options.find((o) => (0, import_records34.isTheChosen)(o, v));
12898
+ const option = options.find((o) => (0, import_records28.isTheChosen)(o, v));
12899
12899
  return option ? titleOf(option) : String(v);
12900
12900
  });
12901
- const chipOf = (option, word) => option ? choiceChipLookOf(field, (0, import_records34.optionKey)(option), titleOf(option)) : choiceChipLookOf(field, word);
12901
+ const chipOf = (option, word) => option ? choiceChipLookOf(field, (0, import_records28.optionKey)(option), titleOf(option)) : choiceChipLookOf(field, word);
12902
12902
  const q = search.trim();
12903
- const visible = (0, import_records34.rankTypedMatches)(options, q, titleOf);
12904
- const decided = (0, import_records34.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
12903
+ const visible = (0, import_records28.rankTypedMatches)(options, q, titleOf);
12904
+ const decided = (0, import_records28.decideTypedChoice)({ words: q, options, allowOther, nudge: nudge ?? "ask" });
12905
12905
  const choose = (word, addingIt = false) => {
12906
12906
  const pending = held.add.filter((w) => w.toLowerCase() !== word.toLowerCase());
12907
12907
  let next;
12908
12908
  let add2 = [...pending];
12909
12909
  if (field.multi) {
12910
12910
  const existing = current.map((v) => {
12911
- const option = options.find((o) => (0, import_records34.isTheChosen)(o, v));
12912
- return option ? (0, import_records34.optionKey)(option) : String(v);
12911
+ const option = options.find((o) => (0, import_records28.isTheChosen)(o, v));
12912
+ return option ? (0, import_records28.optionKey)(option) : String(v);
12913
12913
  });
12914
12914
  const has = existing.some((v) => v.toLowerCase() === word.toLowerCase());
12915
12915
  const list = has ? existing.filter((v) => v.toLowerCase() !== word.toLowerCase()) : [...existing, word];
@@ -12945,7 +12945,7 @@ function OpenChoicePicker({
12945
12945
  const foot = null;
12946
12946
  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;
12947
12947
  const listed = visible;
12948
- const pickedOptions = current.map((v) => options.find((o) => (0, import_records34.isTheChosen)(o, v)));
12948
+ const pickedOptions = current.map((v) => options.find((o) => (0, import_records28.isTheChosen)(o, v)));
12949
12949
  const cellChips = pickedWords.map((word, i) => {
12950
12950
  const chip = chipOf(pickedOptions[i], word);
12951
12951
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_design_system39.Badge, { variant: "outline", className: (0, import_design_system39.cn)("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
@@ -12957,7 +12957,7 @@ function OpenChoicePicker({
12957
12957
  label: word,
12958
12958
  chip: chipOf(option, word).className,
12959
12959
  onRemove: () => {
12960
- if (field.multi) choose(option ? (0, import_records34.optionKey)(option) : String(current[i]));
12960
+ if (field.multi) choose(option ? (0, import_records28.optionKey)(option) : String(current[i]));
12961
12961
  else onChange(null);
12962
12962
  }
12963
12963
  };
@@ -12988,11 +12988,11 @@ function OpenChoicePicker({
12988
12988
  id: option.id,
12989
12989
  label: titleOf(option),
12990
12990
  chip: chipOf(option, titleOf(option)).className,
12991
- picked: current.some((v) => (0, import_records34.isTheChosen)(option, v))
12991
+ picked: current.some((v) => (0, import_records28.isTheChosen)(option, v))
12992
12992
  })),
12993
12993
  onPick: (optionId) => {
12994
12994
  const option = options.find((o) => o.id === optionId);
12995
- if (option) choose((0, import_records34.optionKey)(option));
12995
+ if (option) choose((0, import_records28.optionKey)(option));
12996
12996
  },
12997
12997
  empty: q === "" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
12998
12998
  add,
@@ -13048,7 +13048,7 @@ function ChoiceAnswer({
13048
13048
  onChosen
13049
13049
  }) {
13050
13050
  const [search, setSearch] = (0, import_react67.useState)("");
13051
- const held = field.multi ? (0, import_records34.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
13051
+ const held = field.multi ? (0, import_records28.choiceValuesOf)(value) : value === null || value === void 0 || value === "" ? [] : [value];
13052
13052
  const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
13053
13053
  const press = (choice) => {
13054
13054
  if (!field.multi) {
@@ -13398,7 +13398,7 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
13398
13398
 
13399
13399
  // src/DataBindingPicker.tsx
13400
13400
  var import_react73 = require("react");
13401
- var import_records35 = require("@ai-matrx/records");
13401
+ var import_records29 = require("@ai-matrx/records");
13402
13402
  var import_react74 = require("@ai-matrx/records/react");
13403
13403
  var import_design_system41 = require("@ai-matrx/design-system");
13404
13404
  init_names();
@@ -13433,7 +13433,7 @@ function isCompleteDataBinding(binding) {
13433
13433
  }
13434
13434
  function bindingPlaceholdersFor(field) {
13435
13435
  const label = fieldName(field);
13436
- if ((0, import_records35.isEntityReferenceConfig)(field.config)) {
13436
+ if ((0, import_records29.isEntityReferenceConfig)(field.config)) {
13437
13437
  return [
13438
13438
  { token: `{${field.key}.name}`, label: `${label} \xB7 name` },
13439
13439
  { token: `{${field.key}.id}`, label: `${label} \xB7 id` }