@nivaro/react 0.3.36 → 0.3.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/components/slots/CommentsSlot.js +44 -36
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +9 -1
  5. package/dist/shared/components/AgentBadge.js +26 -0
  6. package/dist/shared/components/AgentQuestionsCard.js +198 -0
  7. package/dist/shared/components/ItemEditForm.js +3329 -3263
  8. package/dist/shared/components/McpConnectionScope.js +480 -0
  9. package/dist/shared/components/MyWorkView.js +223 -208
  10. package/dist/shared/components/RecordReadView.js +620 -575
  11. package/dist/shared/components/chat/ChatPanel.js +683 -671
  12. package/dist/shared/components/imports/DownloadSampleButton.js +69 -0
  13. package/dist/shared/components/imports/ImportConsole.js +106 -104
  14. package/dist/shared/components/imports/RunDetailSheet.js +34 -32
  15. package/dist/shared/components/item-edit/FieldAffordances.js +32 -32
  16. package/dist/shared/components/item-edit/FormTour.js +279 -0
  17. package/dist/shared/components/item-edit/GroupSection.js +377 -360
  18. package/dist/shared/components/item-edit/PersonalDefaultControl.js +28 -28
  19. package/dist/shared/components/item-edit/entry/EntryStrip.js +30 -26
  20. package/dist/shared/components/item-edit/form-density.js +36 -0
  21. package/dist/shared/components/item-edit/useFormUsageBeacon.js +59 -46
  22. package/dist/shared/components/item-edit/usePersonalDefaults.js +312 -296
  23. package/dist/shared/components/layout-editor/AddPanel.js +349 -192
  24. package/dist/shared/components/layout-editor/DesignNode.js +126 -112
  25. package/dist/shared/components/layout-editor/EditorTopBar.js +123 -103
  26. package/dist/shared/components/layout-editor/LayoutEditor.js +829 -751
  27. package/dist/shared/components/layout-editor/PlaceTools.js +334 -0
  28. package/dist/shared/components/layout-editor/SlashInsert.js +252 -0
  29. package/dist/shared/components/layout-editor/StructureMenu.js +285 -242
  30. package/dist/shared/components/layout-editor/add-target.js +54 -43
  31. package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +238 -155
  32. package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +1 -1
  33. package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +15 -12
  34. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +347 -189
  35. package/dist/shared/components/layout-editor/dnd/TrashZone.js +60 -32
  36. package/dist/shared/components/layout-editor/dnd/UndoChip.js +76 -0
  37. package/dist/shared/components/layout-editor/dnd/merge-drop.js +33 -0
  38. package/dist/shared/components/layout-editor/dnd/multi-drop.js +87 -0
  39. package/dist/shared/components/layout-editor/dnd/node.js +115 -105
  40. package/dist/shared/components/layout-editor/dnd/sensors.js +23 -0
  41. package/dist/shared/components/layout-editor/dnd/trash-drop.js +34 -28
  42. package/dist/shared/components/layout-editor/dnd/trash-links.js +97 -0
  43. package/dist/shared/components/layout-editor/even-row.js +86 -0
  44. package/dist/shared/components/layout-editor/field-list.js +99 -0
  45. package/dist/shared/components/layout-editor/format-painter.js +102 -0
  46. package/dist/shared/components/layout-editor/grid-guides.js +15 -13
  47. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +150 -132
  48. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +57 -53
  49. package/dist/shared/components/layout-editor/inspector/EvenRowAction.js +31 -0
  50. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +154 -141
  51. package/dist/shared/components/layout-editor/inspector/Inspector.js +209 -178
  52. package/dist/shared/components/layout-editor/inspector/LookTab.js +106 -98
  53. package/dist/shared/components/layout-editor/inspector/RulesTab.js +38 -37
  54. package/dist/shared/components/layout-editor/inspector/kit.js +280 -223
  55. package/dist/shared/components/layout-editor/keyboard-move.js +15 -15
  56. package/dist/shared/components/layout-editor/lint/LabelStyle.js +201 -0
  57. package/dist/shared/components/layout-editor/lint/LintPanel.js +132 -84
  58. package/dist/shared/components/layout-editor/lint/lint-api.js +65 -28
  59. package/dist/shared/components/layout-editor/nav/NavTools.js +14 -12
  60. package/dist/shared/components/layout-editor/nav/ZoomControls.js +145 -0
  61. package/dist/shared/components/layout-editor/nav/useEditorNav.js +34 -32
  62. package/dist/shared/components/layout-editor/nav/view-prefs.js +100 -15
  63. package/dist/shared/components/layout-editor/outputs/LayoutFile.js +89 -0
  64. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +272 -195
  65. package/dist/shared/components/layout-editor/outputs/layout-file-plan.js +176 -0
  66. package/dist/shared/components/layout-editor/outputs/output-api.js +71 -37
  67. package/dist/shared/components/layout-editor/overview/describe-conditions.js +16 -11
  68. package/dist/shared/components/layout-editor/overview/purpose.js +5 -5
  69. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  70. package/dist/shared/components/layout-editor/pin.js +37 -19
  71. package/dist/shared/components/layout-editor/place-clip.js +257 -0
  72. package/dist/shared/components/layout-editor/preview/PreviewModes.js +27 -26
  73. package/dist/shared/components/layout-editor/preview/PreviewPanes.js +148 -117
  74. package/dist/shared/components/layout-editor/preview/SampleRecord.js +113 -0
  75. package/dist/shared/components/layout-editor/preview/preview-model.js +79 -60
  76. package/dist/shared/components/layout-editor/preview/sample-record.js +105 -0
  77. package/dist/shared/components/layout-editor/removed-log.js +151 -0
  78. package/dist/shared/components/layout-editor/reuse/LibraryRows.js +109 -78
  79. package/dist/shared/components/layout-editor/reuse/linked-sections.js +373 -0
  80. package/dist/shared/components/layout-editor/revert-element.js +140 -0
  81. package/dist/shared/components/layout-editor/section-structure.js +193 -170
  82. package/dist/shared/components/layout-editor/settings/EntrySection.js +63 -45
  83. package/dist/shared/components/layout-editor/settings/LayoutSection.js +63 -32
  84. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +179 -137
  85. package/dist/shared/components/layout-editor/settings/WhoSection.js +18 -17
  86. package/dist/shared/components/layout-editor/settings/settings-registry.js +24 -0
  87. package/dist/shared/components/layout-editor/shortcuts.js +21 -16
  88. package/dist/shared/components/layout-editor/structure-ops.js +221 -195
  89. package/dist/shared/components/layout-editor/usage/UsagePanel.js +133 -85
  90. package/dist/shared/components/layout-editor/usage/refusal-lens.js +130 -0
  91. package/dist/shared/components/layout-editor/usage/usage-api.js +12 -11
  92. package/dist/shared/components/panels/CommentPanel.js +47 -45
  93. package/dist/shared/components/panels/RevisionsPanel.js +66 -64
  94. package/dist/shared/components/panels/TaskPanel.js +395 -332
  95. package/dist/shared/components/profile/AgentsPanel.js +196 -147
  96. package/dist/shared/components/profile/ConnectionRollback.js +329 -0
  97. package/dist/shared/components/profile/MyDefaultsCard.js +526 -520
  98. package/dist/shared/lib/entry-config.js +22 -22
  99. package/dist/shared/lib/form-usage-beacon.js +91 -55
  100. package/dist/shared/lib/layout-lint.js +530 -284
  101. package/dist/shared/lib/layout-resolve.js +58 -44
  102. package/package.json +1 -1
@@ -1,100 +1,122 @@
1
- import { isCanvasSlot as R, UNGROUPED_KEY as S, applyLayoutOps as C, GROUP_PATCH_KEYS as Y } from "../../lib/layout-ops.js";
2
1
  import { withGroupStructure as j } from "../../lib/form-structure.js";
3
- import { titleCase as I } from "../../lib/utils.js";
2
+ import { isCanvasSlot as R, applyLayoutOps as C, UNGROUPED_KEY as P, GROUP_PATCH_KEYS as J } from "../../lib/layout-ops.js";
3
+ import { titleCase as x } from "../../lib/utils.js";
4
4
  import { newGroupKey as H } from "./add-target.js";
5
- import { normalizedBundle as T, inPageOrder as K, plural as g, selectedPlacements as J, moveToZoneOps as Z, zoneItems as U, FIELD_HOLDERS as X } from "./field-zones.js";
6
- import { readOverrides as D, withKey as q, asArray as P, placementPatchOf as Q } from "./inspector/model.js";
7
- import { isPinned as F, withPin as G } from "./pin.js";
8
- import { PIN_KEY as Ue, pinLocked as Ae, pinnedZone as Le } from "./pin.js";
9
- import { humanizeOpError as V } from "./useLayoutDraft.js";
10
- const y = (o) => ({ ok: !1, reason: o });
5
+ import { normalizedBundle as S, inPageOrder as K, plural as g, selectedPlacements as Z, moveToZoneOps as X, zoneItems as U, FIELD_HOLDERS as q } from "./field-zones.js";
6
+ import { readOverrides as B, withKey as Q, asArray as O, placementPatchOf as V } from "./inspector/model.js";
7
+ import { isPinned as D, withPin as F, placementOf as G, isPlacementPinned as ee, withPlacementPin as te, unpinnedPatch as oe } from "./pin.js";
8
+ import { PIN_KEY as He, pinLocked as Ke, pinnedZone as Be } from "./pin.js";
9
+ import { humanizeOpError as ne } from "./useLayoutDraft.js";
10
+ const k = (o) => ({ ok: !1, reason: o });
11
11
  function m(o, e) {
12
- if (e.ops.length === 0) return y("Nothing would change");
12
+ if (e.ops.length === 0) return k("Nothing would change");
13
13
  try {
14
14
  return C(o, e.ops), e;
15
15
  } catch (t) {
16
- return y(V(t.message));
16
+ return k(ne(t.message));
17
17
  }
18
18
  }
19
- const d = (o) => o.label || I(o.key), _ = (o, e) => o.groups.find((t) => t.key === e) ?? null, O = (o, e) => o.groups.filter((t) => t.parent_key === e).sort((t, n) => t.sort - n.sort);
20
- function x(o, e) {
19
+ const d = (o) => o.label || x(o.key), _ = (o, e) => o.groups.find((t) => t.key === e) ?? null, T = (o, e) => o.groups.filter((t) => t.parent_key === e).sort((t, n) => t.sort - n.sort);
20
+ function M(o, e) {
21
21
  const t = e.parent_key ? _(o, e.parent_key) : null;
22
22
  return (t ? t.tab_mode : o.layout.tab_mode) === "steps" ? "steps" : "tabs";
23
23
  }
24
- function ee(o, e) {
25
- return e.type === "tab" ? x(o, e) === "steps" ? "step" : "tab" : e.type === "container" ? e.tab_mode === "steps" ? "steps holder" : "tabs holder" : e.type === "content" ? "text block" : e.type === "metadata" ? "record info section" : "section";
24
+ function se(o, e) {
25
+ return e.type === "tab" ? M(o, e) === "steps" ? "step" : "tab" : e.type === "container" ? e.tab_mode === "steps" ? "steps holder" : "tabs holder" : e.type === "content" ? "text block" : e.type === "metadata" ? "record info section" : "section";
26
26
  }
27
- function _e(o, e, t) {
27
+ function we(o, e, t) {
28
28
  const n = _(o, e);
29
- return n ? F(n) === t ? y(t ? "Already pinned" : "Not pinned") : m(o, {
29
+ return n ? D(n) === t ? k(t ? "Already pinned" : "Not pinned") : m(o, {
30
30
  ok: !0,
31
- ops: [{ op: "group_update", key: e, patch: { swap_config: G(n.swap_config, t) } }],
31
+ ops: [{ op: "group_update", key: e, patch: { swap_config: F(n.swap_config, t) } }],
32
32
  label: `${t ? "Pin" : "Unpin"} ${d(n)}`,
33
33
  notes: []
34
- }) : y("That section is no longer on this form");
34
+ }) : k("That section is no longer on this form");
35
35
  }
36
- function te(o) {
36
+ function re(o, e) {
37
+ return !e || e.kind === "group" ? "Select a field first" : G(o, e) ? null : "This comes from the parent form: override it here first";
38
+ }
39
+ function ve(o, e, t) {
40
+ const n = re(o, e);
41
+ if (n || !e || e.kind === "group") return k(n ?? "Select a field first");
42
+ const i = G(o, e);
43
+ if (ee(i) === t) return k(t ? "Already pinned" : "Not pinned");
44
+ const r = i.label_override || x(e.field.replace(/^__|__$/g, ""));
45
+ return m(o, {
46
+ ok: !0,
47
+ ops: [
48
+ {
49
+ op: "update_placement",
50
+ at: { field: i.field, group_key: i.group_key },
51
+ patch: { overrides: te(i.overrides, t) }
52
+ }
53
+ ],
54
+ label: `${t ? "Pin" : "Unpin"} ${r}`,
55
+ notes: []
56
+ });
57
+ }
58
+ function ie(o) {
37
59
  const e = {};
38
- for (const t of Y) t !== "label" && (e[t] = o[t]);
60
+ for (const t of J) t !== "label" && (e[t] = o[t]);
39
61
  return e;
40
62
  }
41
- function oe(o, e) {
42
- return e ? e.kind === "header" ? "A header tile shows once in the header strip" : e.kind === "slot" && R(e) ? "This panel shows once on a form" : e.kind === "field" || e.kind === "slot" ? "A field shows once per section. Duplicate its section, or add the field to another section from Add" : e.key === S ? "Ungrouped is not a section" : _(o, e.key) ? null : "This comes from the parent form: override it here first" : "Select a section or field first";
63
+ function le(o, e) {
64
+ return e ? e.kind === "header" ? "A header tile shows once in the header strip" : e.kind === "slot" && R(e) ? "This panel shows once on a form" : e.kind === "field" || e.kind === "slot" ? "A field shows once per section. Duplicate its section, or add the field to another section from Add" : e.key === P ? "Ungrouped is not a section" : _(o, e.key) ? null : "This comes from the parent form: override it here first" : "Select a section or field first";
43
65
  }
44
- function be(o, e) {
45
- const t = oe(o, e);
46
- if (t) return y(t);
47
- const n = T(o), a = _(n, e.key), r = new Set(n.groups.map((c) => c.key)), i = [];
48
- let l = 0;
49
- const u = (c, p, v, w) => {
66
+ function Pe(o, e) {
67
+ const t = le(o, e);
68
+ if (t) return k(t);
69
+ const n = S(o), i = _(n, e.key), r = new Set(n.groups.map((c) => c.key)), l = [];
70
+ let a = 0;
71
+ const u = (c, p, v, $) => {
50
72
  let h = `${c.key}_copy`;
51
- for (let k = 2; r.has(h); k++) h = `${c.key}_copy_${k}`;
73
+ for (let y = 2; r.has(h); y++) h = `${c.key}_copy_${y}`;
52
74
  r.add(h);
53
- const b = te(c);
54
- return b.swap_config = j(G(c.swap_config, !1), { sticky: !1 }), i.push({
75
+ const b = ie(c);
76
+ return b.swap_config = j(F(c.swap_config, !1), { sticky: !1 }), l.push({
55
77
  op: "group_create",
56
78
  key: h,
57
- label: w,
79
+ label: $,
58
80
  group_type: c.type,
59
81
  parent_key: p,
60
82
  index: v,
61
83
  patch: b
62
- }), U(n, c.key).forEach((k, M) => {
63
- k.field.startsWith("__") || l++, i.push({
84
+ }), U(n, c.key).forEach((y, I) => {
85
+ y.field.startsWith("__") || a++, l.push({
64
86
  op: "place",
65
- field: k.field,
87
+ field: y.field,
66
88
  group_key: h,
67
- index: M,
68
- patch: Q(k)
89
+ index: I,
90
+ patch: oe(V(y))
69
91
  });
70
- }), O(n, c.key).forEach((k, M) => {
71
- u(k, h, M, k.label);
92
+ }), T(n, c.key).forEach((y, I) => {
93
+ u(y, h, I, y.label);
72
94
  }), h;
73
- }, f = u(a, a.parent_key, a.sort + 1, `${d(a)} (copy)`), s = l ? [`Its ${g(l, "field")} now ${l === 1 ? "shows" : "show"} in both copies`] : [];
95
+ }, f = u(i, i.parent_key, i.sort + 1, `${d(i)} (copy)`), s = a ? [`Its ${g(a, "field")} now ${a === 1 ? "shows" : "show"} in both copies`] : [];
74
96
  return m(o, {
75
97
  ok: !0,
76
- ops: i,
77
- label: `Duplicate ${d(a)}`,
98
+ ops: l,
99
+ label: `Duplicate ${d(i)}`,
78
100
  notes: s,
79
101
  select: { kind: "group", key: f }
80
102
  });
81
103
  }
82
- function ge(o, e) {
83
- const t = T(o);
84
- if (t.layout.layout_type === "table") return y("Table layouts have no sections");
85
- const n = K(t, J(t, e));
86
- if (n.length === 0) return y("Select one or more fields first");
87
- const a = n[0], r = a.group_key ? _(t, a.group_key) : null;
88
- if (a.group_key && !r) return y("Those fields are not in a section of this form");
89
- const i = (r == null ? void 0 : r.type) === "tab", l = (r == null ? void 0 : r.parent_key) ?? null, u = r && i ? x(t, r) : null, f = u === "steps" ? "step" : u === "tabs" ? "tab" : "section", s = r ?? _(t, S), c = s ? s.sort + 1 : Number.MAX_SAFE_INTEGER, p = H(t, f), v = {
104
+ function Se(o, e) {
105
+ const t = S(o);
106
+ if (t.layout.layout_type === "table") return k("Table layouts have no sections");
107
+ const n = K(t, Z(t, e));
108
+ if (n.length === 0) return k("Select one or more fields first");
109
+ const i = n[0], r = i.group_key ? _(t, i.group_key) : null;
110
+ if (i.group_key && !r) return k("Those fields are not in a section of this form");
111
+ const l = (r == null ? void 0 : r.type) === "tab", a = (r == null ? void 0 : r.parent_key) ?? null, u = r && l ? M(t, r) : null, f = u === "steps" ? "step" : u === "tabs" ? "tab" : "section", s = r ?? _(t, P), c = s ? s.sort + 1 : Number.MAX_SAFE_INTEGER, p = H(t, f), v = {
90
112
  op: "group_create",
91
113
  key: p,
92
114
  label: `New ${f}`,
93
- group_type: i ? "tab" : "section",
94
- parent_key: l,
115
+ group_type: l ? "tab" : "section",
116
+ parent_key: a,
95
117
  index: c
96
- }, w = C(t, [v]), h = Z(w, n, p), b = [], k = n.length - h.ops.length;
97
- return k > 0 && b.push(`${g(k, "field")} placed twice ${k === 1 ? "goes" : "go"} in once`), m(o, {
118
+ }, $ = C(t, [v]), h = X($, n, p), b = [], y = n.length - h.ops.length;
119
+ return y > 0 && b.push(`${g(y, "field")} placed twice ${y === 1 ? "goes" : "go"} in once`), m(o, {
98
120
  ok: !0,
99
121
  ops: [v, ...h.ops],
100
122
  label: `Wrap ${g(h.ops.length, "field")} in a new ${f}`,
@@ -102,47 +124,47 @@ function ge(o, e) {
102
124
  select: { kind: "group", key: p }
103
125
  });
104
126
  }
105
- function ne(o, e) {
106
- if (e === S) return "Ungrouped is not a section";
127
+ function ae(o, e) {
128
+ if (e === P) return "Ungrouped is not a section";
107
129
  const t = _(o, e);
108
- return t ? t.type === "container" ? "Use Convert to turn its tabs into sections" : X.has(t.type) ? null : "Only sections, tabs and steps hold fields" : "This comes from the parent form: override it here first";
130
+ return t ? t.type === "container" ? "Use Convert to turn its tabs into sections" : q.has(t.type) ? null : "Only sections, tabs and steps hold fields" : "This comes from the parent form: override it here first";
109
131
  }
110
- function me(o, e) {
111
- const t = ne(o, e);
112
- if (t) return y(t);
113
- const n = T(o), a = _(n, e), r = U(n, e), i = new Set(U(n, null).map((c) => c.field)), l = [], u = [], f = a.parent_key === null && i.size === 0 && !!_(n, S);
114
- f && r.length > 0 && l.push({ op: "group_move", key: S, parent_key: null, index: a.sort }), l.push({ op: "group_remove", key: e, placements: "ungroup" }), r.length === 0 ? u.push("It holds no fields") : f ? u.push("Its fields stay where they are, as ungrouped fields") : u.push(`Its ${g(r.length, "field")} move to the end of Ungrouped`);
115
- const s = r.filter((c) => i.has(c.field)).length;
132
+ function Te(o, e) {
133
+ const t = ae(o, e);
134
+ if (t) return k(t);
135
+ const n = S(o), i = _(n, e), r = U(n, e), l = new Set(U(n, null).map((c) => c.field)), a = [], u = [], f = i.parent_key === null && l.size === 0 && !!_(n, P);
136
+ f && r.length > 0 && a.push({ op: "group_move", key: P, parent_key: null, index: i.sort }), a.push({ op: "group_remove", key: e, placements: "ungroup" }), r.length === 0 ? u.push("It holds no fields") : f ? u.push("Its fields stay where they are, as ungrouped fields") : u.push(`Its ${g(r.length, "field")} move to the end of Ungrouped`);
137
+ const s = r.filter((c) => l.has(c.field)).length;
116
138
  return s > 0 && u.push(
117
139
  `${g(s, "field")} already in Ungrouped ${s === 1 ? "stays" : "stay"} once`
118
140
  ), m(o, {
119
141
  ok: !0,
120
- ops: l,
121
- label: `Unwrap ${d(a)}`,
142
+ ops: a,
143
+ label: `Unwrap ${d(i)}`,
122
144
  notes: u,
123
- select: { kind: "group", key: S }
145
+ select: { kind: "group", key: P }
124
146
  });
125
147
  }
126
- function se(o) {
148
+ function pe(o) {
127
149
  const e = [];
128
- return o.is_collapsed && e.push("“Starts collapsed” does not apply to tabs or steps (kept, unused)"), P(o.summary_fields).length && e.push("The collapsed summary does not apply to tabs or steps (kept, unused)"), e;
150
+ return o.is_collapsed && e.push("“Starts collapsed” does not apply to tabs or steps (kept, unused)"), O(o.summary_fields).length && e.push("The collapsed summary does not apply to tabs or steps (kept, unused)"), e;
129
151
  }
130
- function B(o) {
152
+ function W(o) {
131
153
  const e = [];
132
- return P(o.visible_when).length && e.push("Its “Only when” rule works on steps and tabs only (kept, unused)"), P(o.skip_if_filled).length && e.push("“Skip when filled” works on steps only (kept, unused)"), e;
154
+ return O(o.visible_when).length && e.push("Its “Only when” rule works on steps and tabs only (kept, unused)"), O(o.skip_if_filled).length && e.push("“Skip when filled” works on steps only (kept, unused)"), e;
133
155
  }
134
156
  function A(o, e, t) {
135
- const n = t === "steps" ? "step" : "tab", a = o.groups.filter((u) => u.parent_key === null).sort((u, f) => u.sort - f.sort), r = a[a.indexOf(e) - 1], i = se(e), l = [{ op: "group_update", key: e.key, patch: { type: "tab" } }];
136
- if ((r == null ? void 0 : r.type) === "container" && (r.tab_mode === "steps" ? "steps" : "tabs") === t && !F(r))
137
- l.push({
157
+ const n = t === "steps" ? "step" : "tab", i = o.groups.filter((u) => u.parent_key === null).sort((u, f) => u.sort - f.sort), r = i[i.indexOf(e) - 1], l = pe(e), a = [{ op: "group_update", key: e.key, patch: { type: "tab" } }];
158
+ if ((r == null ? void 0 : r.type) === "container" && (r.tab_mode === "steps" ? "steps" : "tabs") === t && !D(r))
159
+ a.push({
138
160
  op: "group_move",
139
161
  key: e.key,
140
162
  parent_key: r.key,
141
- index: O(o, r.key).length
142
- }), i.unshift(`Joins ${d(r)} as its last ${n}`);
163
+ index: T(o, r.key).length
164
+ }), l.unshift(`Joins ${d(r)} as its last ${n}`);
143
165
  else {
144
166
  const u = H(o, t);
145
- l.unshift({
167
+ a.unshift({
146
168
  op: "group_create",
147
169
  key: u,
148
170
  label: t === "steps" ? "Steps" : "Tabs",
@@ -150,101 +172,101 @@ function A(o, e, t) {
150
172
  parent_key: null,
151
173
  index: e.sort,
152
174
  patch: { tab_mode: t }
153
- }), l.push({ op: "group_move", key: e.key, parent_key: u, index: 0 }), i.unshift(`A new ${t} holder takes its place, with it as the first ${n}`);
175
+ }), a.push({ op: "group_move", key: e.key, parent_key: u, index: 0 }), l.unshift(`A new ${t} holder takes its place, with it as the first ${n}`);
154
176
  }
155
177
  return m(o, {
156
178
  ok: !0,
157
- ops: l,
179
+ ops: a,
158
180
  label: `Make ${d(e)} a ${n}`,
159
- notes: i,
181
+ notes: l,
160
182
  select: { kind: "group", key: e.key }
161
183
  });
162
184
  }
163
- function L(o, e, t) {
164
- const n = O(o, e.key), a = t ? [t] : n, r = [];
165
- a.forEach((f, s) => {
185
+ function N(o, e, t) {
186
+ const n = T(o, e.key), i = t ? [t] : n, r = [];
187
+ i.forEach((f, s) => {
166
188
  r.push({ op: "group_move", key: f.key, parent_key: null, index: e.sort + 1 + s }), r.push({ op: "group_update", key: f.key, patch: { type: "section" } });
167
189
  });
168
- const i = a.flatMap(
169
- (f) => B(f).map((s) => a.length > 1 ? `${d(f)}: ${s}` : s)
190
+ const l = i.flatMap(
191
+ (f) => W(f).map((s) => i.length > 1 ? `${d(f)}: ${s}` : s)
170
192
  );
171
- a.length === n.length && (r.push({ op: "group_remove", key: e.key, placements: "ungroup" }), i.unshift(`${d(e)} is removed: it would be empty`)), t ? i.unshift(`Moves out of ${d(e)}, just below it`) : i.unshift(`${g(n.length, "tab")} become sections below one another`);
172
- const u = t ? `Make ${d(t)} a section` : `Turn the ${x(o, n[0] ?? e) === "steps" ? "steps" : "tabs"} of ${d(e)} into sections`;
193
+ i.length === n.length && (r.push({ op: "group_remove", key: e.key, placements: "ungroup" }), l.unshift(`${d(e)} is removed: it would be empty`)), t ? l.unshift(`Moves out of ${d(e)}, just below it`) : l.unshift(`${g(n.length, "tab")} become sections below one another`);
194
+ const u = t ? `Make ${d(t)} a section` : `Turn the ${M(o, n[0] ?? e) === "steps" ? "steps" : "tabs"} of ${d(e)} into sections`;
173
195
  return m(o, {
174
196
  ok: !0,
175
197
  ops: r,
176
198
  label: u,
177
- notes: i,
199
+ notes: l,
178
200
  select: { kind: "group", key: (t ?? n[0] ?? e).key }
179
201
  });
180
202
  }
181
203
  function E(o, e, t, n) {
182
- const a = n === "steps" ? "steps" : "tabs", r = t ? O(o, t.key) : o.groups.filter((s) => s.parent_key === null && s.type === "tab"), i = r.filter((s) => s.key !== e.key).length, l = [];
183
- e.type === "tab" && i > 0 ? l.push(
184
- t ? `All ${r.length} tabs of ${d(t)} become ${a}: a holder shows its tabs one way` : `All ${r.length} tabs at the top of the form become ${a}: the form shows them one way`
185
- ) : r.length > 0 && l.push(`${g(r.length, "tab")} show as ${a}`), n === "steps" && o.layout.validate_before_next && l.push("People must complete each step before the next");
204
+ const i = n === "steps" ? "steps" : "tabs", r = t ? T(o, t.key) : o.groups.filter((s) => s.parent_key === null && s.type === "tab"), l = r.filter((s) => s.key !== e.key).length, a = [];
205
+ e.type === "tab" && l > 0 ? a.push(
206
+ t ? `All ${r.length} tabs of ${d(t)} become ${i}: a holder shows its tabs one way` : `All ${r.length} tabs at the top of the form become ${i}: the form shows them one way`
207
+ ) : r.length > 0 && a.push(`${g(r.length, "tab")} show as ${i}`), n === "steps" && o.layout.validate_before_next && a.push("People must complete each step before the next");
186
208
  const u = t ? [{ op: "group_update", key: t.key, patch: { tab_mode: n } }] : [{ op: "layout_update", patch: { tab_mode: n } }], f = e.type === "tab" ? d(e) : d(t ?? e);
187
209
  return m(o, {
188
210
  ok: !0,
189
211
  ops: u,
190
- label: e.type === "tab" ? `Make ${f} a ${a.slice(0, -1)}` : `Show ${f} as ${a}`,
191
- notes: l,
212
+ label: e.type === "tab" ? `Make ${f} a ${i.slice(0, -1)}` : `Show ${f} as ${i}`,
213
+ notes: a,
192
214
  select: { kind: "group", key: e.key }
193
215
  });
194
216
  }
195
- function we(o, e) {
196
- const t = T(o), n = _(t, e);
217
+ function Oe(o, e) {
218
+ const t = S(o), n = _(t, e);
197
219
  if (!n) return [];
198
- const a = n.parent_key ? _(t, n.parent_key) : null, r = [];
220
+ const i = n.parent_key ? _(t, n.parent_key) : null, r = [];
199
221
  if (n.type === "section" && n.parent_key === null)
200
222
  r.push({ to: "tab", title: "Make it a tab", plan: A(t, n, "tabs") }), r.push({ to: "step", title: "Make it a step", plan: A(t, n, "steps") });
201
223
  else if (n.type === "tab") {
202
- const i = x(t, n);
224
+ const l = M(t, n);
203
225
  r.push({
204
226
  to: "section",
205
227
  title: "Make it a section",
206
- plan: a ? L(t, a, n) : m(t, {
228
+ plan: i ? N(t, i, n) : m(t, {
207
229
  ok: !0,
208
230
  ops: [{ op: "group_update", key: n.key, patch: { type: "section" } }],
209
231
  label: `Make ${d(n)} a section`,
210
- notes: B(n),
232
+ notes: W(n),
211
233
  select: { kind: "group", key: n.key }
212
234
  })
213
235
  }), r.push(
214
- i === "tabs" ? { to: "step", title: "Make it a step", plan: E(t, n, a, "steps") } : { to: "tab", title: "Make it a tab", plan: E(t, n, a, "tabs") }
236
+ l === "tabs" ? { to: "step", title: "Make it a step", plan: E(t, n, i, "steps") } : { to: "tab", title: "Make it a tab", plan: E(t, n, i, "tabs") }
215
237
  );
216
238
  } else if (n.type === "container") {
217
- const i = n.tab_mode === "steps" ? "steps" : "tabs";
239
+ const l = n.tab_mode === "steps" ? "steps" : "tabs";
218
240
  r.push(
219
- i === "tabs" ? { to: "steps", title: "Turn its tabs into steps", plan: E(t, n, n, "steps") } : { to: "tabs", title: "Turn its steps into tabs", plan: E(t, n, n, "tabs") }
241
+ l === "tabs" ? { to: "steps", title: "Turn its tabs into steps", plan: E(t, n, n, "steps") } : { to: "tabs", title: "Turn its steps into tabs", plan: E(t, n, n, "tabs") }
220
242
  ), r.push({
221
243
  to: "sections",
222
- title: `Turn its ${i} into sections`,
223
- plan: O(t, n.key).length ? L(t, n) : y(`It holds no ${i}`)
244
+ title: `Turn its ${l} into sections`,
245
+ plan: T(t, n.key).length ? N(t, n) : k(`It holds no ${l}`)
224
246
  });
225
247
  }
226
248
  return r;
227
249
  }
228
- const re = ["visible_when", "hidden_for_roles", "locked_for_roles"], $e = {
250
+ const ce = ["visible_when", "hidden_for_roles", "locked_for_roles"], Ee = {
229
251
  visible_when: "Only when (step conditions)",
230
252
  hidden_for_roles: "Hidden for roles",
231
253
  locked_for_roles: "Read-only for roles"
232
- }, W = /* @__PURE__ */ new Set(["section", "metadata", "tab"]), ve = (o, e) => P(o[e]).length > 0, N = (o) => JSON.stringify(P(o));
233
- function Se(o) {
234
- return W.has(o.type) ? re.filter((e) => e !== "visible_when" || o.type === "tab") : [];
254
+ }, z = /* @__PURE__ */ new Set(["section", "metadata", "tab"]), xe = (o, e) => O(o[e]).length > 0, L = (o) => JSON.stringify(O(o));
255
+ function Me(o) {
256
+ return z.has(o.type) ? ce.filter((e) => e !== "visible_when" || o.type === "tab") : [];
235
257
  }
236
- function Te(o, e) {
237
- return z(T(o)).filter(
238
- (t) => t.key !== e && W.has(t.type)
258
+ function Ie(o, e) {
259
+ return Y(S(o)).filter(
260
+ (t) => t.key !== e && z.has(t.type)
239
261
  );
240
262
  }
241
- function Oe(o, e, t, n) {
242
- const a = _(o, e);
243
- if (!a) return y("That section is no longer on this form");
244
- if (n.length === 0) return y("Pick at least one rule");
245
- if (t.length === 0) return y("Pick the sections to copy onto");
246
- const r = [], i = [];
247
- let l = 0, u = 0;
263
+ function Ue(o, e, t, n) {
264
+ const i = _(o, e);
265
+ if (!i) return k("That section is no longer on this form");
266
+ if (n.length === 0) return k("Pick at least one rule");
267
+ if (t.length === 0) return k("Pick the sections to copy onto");
268
+ const r = [], l = [];
269
+ let a = 0, u = 0;
248
270
  for (const f of t) {
249
271
  const s = _(o, f);
250
272
  if (!s) continue;
@@ -254,20 +276,20 @@ function Oe(o, e, t, n) {
254
276
  u++;
255
277
  continue;
256
278
  }
257
- N(s[p]) !== N(a[p]) && (c[p] = a[p]);
279
+ L(s[p]) !== L(i[p]) && (c[p] = i[p]);
258
280
  }
259
- Object.keys(c).length ? r.push({ op: "group_update", key: f, patch: c }) : l++;
281
+ Object.keys(c).length ? r.push({ op: "group_update", key: f, patch: c }) : a++;
260
282
  }
261
- return u && i.push(
283
+ return u && l.push(
262
284
  `Step conditions skipped on ${g(u, "section")}: they work on steps and tabs only`
263
- ), l && i.push(`${g(l, "section")} already ${l === 1 ? "has" : "have"} these rules`), m(o, {
285
+ ), a && l.push(`${g(a, "section")} already ${a === 1 ? "has" : "have"} these rules`), m(o, {
264
286
  ok: !0,
265
287
  ops: r,
266
- label: `Copy the rules of ${d(a)} to ${g(r.length, "section")}`,
267
- notes: i
288
+ label: `Copy the rules of ${d(i)} to ${g(r.length, "section")}`,
289
+ notes: l
268
290
  });
269
291
  }
270
- const Pe = {
292
+ const Ae = {
271
293
  group_label: "Section name",
272
294
  text_block: "Text block",
273
295
  label: "Field label on this form",
@@ -275,27 +297,27 @@ const Pe = {
275
297
  help: "Help text on this form",
276
298
  field_label: "Field label (sets this form’s own)",
277
299
  field_help: "Help text (sets this form’s own)"
278
- }, ie = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
279
- function le(o, e) {
280
- return o ? new RegExp(ie(o), e ? "g" : "gi") : null;
300
+ }, ue = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
301
+ function fe(o, e) {
302
+ return o ? new RegExp(ue(o), e ? "g" : "gi") : null;
281
303
  }
282
- const $ = (o) => typeof o == "string" && o !== "" ? o : null;
283
- function Ee(o, e, t, n = {}) {
284
- const a = le(e, !!n.matchCase);
285
- if (!a) return [];
286
- const r = T(o), i = [], l = (s) => {
304
+ const w = (o) => typeof o == "string" && o !== "" ? o : null;
305
+ function Ne(o, e, t, n = {}) {
306
+ const i = fe(e, !!n.matchCase);
307
+ if (!i) return [];
308
+ const r = S(o), l = [], a = (s) => {
287
309
  var p;
288
- const c = ((p = s.before.match(a)) == null ? void 0 : p.length) ?? 0;
289
- c !== 0 && i.push({ ...s, after: s.before.replace(a, () => t), count: c });
310
+ const c = ((p = s.before.match(i)) == null ? void 0 : p.length) ?? 0;
311
+ c !== 0 && l.push({ ...s, after: s.before.replace(i, () => t), count: c });
290
312
  };
291
- for (const s of z(r))
292
- l({
313
+ for (const s of Y(r))
314
+ a({
293
315
  id: `group:${s.key}`,
294
316
  kind: "group_label",
295
317
  group: s.key,
296
- where: ae(r, s),
318
+ where: de(r, s),
297
319
  before: s.label
298
- }), s.type === "content" && $(s.content) && l({
320
+ }), s.type === "content" && w(s.content) && a({
299
321
  id: `content:${s.key}`,
300
322
  kind: "text_block",
301
323
  group: s.key,
@@ -306,98 +328,102 @@ function Ee(o, e, t, n = {}) {
306
328
  if (s === null) return "Ungrouped";
307
329
  if (s === "__header__") return "Header strip";
308
330
  const c = _(r, s);
309
- return c ? d(c) : I(s);
331
+ return c ? d(c) : x(s);
310
332
  };
311
333
  for (const s of K(
312
334
  r,
313
335
  r.placements.filter((c) => !R(c))
314
336
  )) {
315
- const c = D(s), p = u.get(s.field), w = `${$(c.label) ?? $(s.label_override) ?? $(p == null ? void 0 : p.label) ?? I(s.field)} · ${f(s.group_key)}`, h = { field: s.field, group_key: s.group_key }, b = (k) => `${k}:${s.field}:${s.group_key ?? ""}`;
316
- $(c.label) ? l({ id: b("label"), kind: "label", at: h, where: w, before: c.label }) : $(s.label_override) ? l({
337
+ const c = B(s), p = u.get(s.field), $ = `${w(c.label) ?? w(s.label_override) ?? w(p == null ? void 0 : p.label) ?? x(s.field)} · ${f(s.group_key)}`, h = { field: s.field, group_key: s.group_key }, b = (y) => `${y}:${s.field}:${s.group_key ?? ""}`;
338
+ w(c.label) ? a({ id: b("label"), kind: "label", at: h, where: $, before: c.label }) : w(s.label_override) ? a({
317
339
  id: b("label_override"),
318
340
  kind: "label_override",
319
341
  at: h,
320
- where: w,
342
+ where: $,
321
343
  before: s.label_override
322
- }) : $(p == null ? void 0 : p.label) && !s.field.startsWith("__") && l({
344
+ }) : w(p == null ? void 0 : p.label) && !s.field.startsWith("__") && a({
323
345
  id: b("field_label"),
324
346
  kind: "field_label",
325
347
  at: h,
326
- where: w,
348
+ where: $,
327
349
  before: p == null ? void 0 : p.label
328
- }), $(c.note) ? l({ id: b("help"), kind: "help", at: h, where: w, before: c.note }) : $(p == null ? void 0 : p.note) && !s.field.startsWith("__") && l({ id: b("field_help"), kind: "field_help", at: h, where: w, before: p == null ? void 0 : p.note });
350
+ }), w(c.note) ? a({ id: b("help"), kind: "help", at: h, where: $, before: c.note }) : w(p == null ? void 0 : p.note) && !s.field.startsWith("__") && a({ id: b("field_help"), kind: "field_help", at: h, where: $, before: p == null ? void 0 : p.note });
329
351
  }
330
- return i;
352
+ return l;
331
353
  }
332
- function z(o) {
333
- return o.groups.filter((t) => t.parent_key === null && t.key !== S).sort((t, n) => t.sort - n.sort).flatMap((t) => [t, ...O(o, t.key)]);
354
+ function Y(o) {
355
+ return o.groups.filter((t) => t.parent_key === null && t.key !== P).sort((t, n) => t.sort - n.sort).flatMap((t) => [t, ...T(o, t.key)]);
334
356
  }
335
- function ae(o, e) {
336
- const t = ee(o, e);
357
+ function de(o, e) {
358
+ const t = se(o, e);
337
359
  return `${t[0].toUpperCase()}${t.slice(1)}`;
338
360
  }
339
- function xe(o, e) {
340
- if (e.length === 0) return y("Pick at least one match");
361
+ function Le(o, e) {
362
+ if (e.length === 0) return k("Pick at least one match");
341
363
  const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
342
- for (const i of e)
343
- if (i.group) {
344
- const l = t.get(i.group) ?? {};
345
- i.kind === "group_label" ? l.label = i.after : l.content = i.after, t.set(i.group, l);
346
- } else if (i.at) {
347
- const l = `${i.at.field}\0${i.at.group_key ?? ""}`;
348
- n.set(l, [...n.get(l) ?? [], i]);
364
+ for (const l of e)
365
+ if (l.group) {
366
+ const a = t.get(l.group) ?? {};
367
+ l.kind === "group_label" ? a.label = l.after : a.content = l.after, t.set(l.group, a);
368
+ } else if (l.at) {
369
+ const a = `${l.at.field}\0${l.at.group_key ?? ""}`;
370
+ n.set(a, [...n.get(a) ?? [], l]);
349
371
  }
350
- const a = [];
351
- for (const [i, l] of t) a.push({ op: "group_update", key: i, patch: l });
352
- for (const i of n.values()) {
353
- const l = i[0].at, u = o.placements.find(
354
- (p) => p.field === l.field && p.group_key === l.group_key
372
+ const i = [];
373
+ for (const [l, a] of t) i.push({ op: "group_update", key: l, patch: a });
374
+ for (const l of n.values()) {
375
+ const a = l[0].at, u = o.placements.find(
376
+ (p) => p.field === a.field && p.group_key === a.group_key
355
377
  );
356
378
  if (!u) continue;
357
- let f = D(u);
379
+ let f = B(u);
358
380
  const s = {};
359
381
  let c = !1;
360
- for (const p of i)
382
+ for (const p of l)
361
383
  if (p.kind === "label_override") s.label_override = p.after;
362
384
  else {
363
385
  const v = p.kind === "label" || p.kind === "field_label" ? "label" : "note";
364
- f = q(f ?? {}, v, p.after === "" ? void 0 : p.after), c = !0;
386
+ f = Q(f ?? {}, v, p.after === "" ? void 0 : p.after), c = !0;
365
387
  }
366
- c && (s.overrides = f), a.push({ op: "update_placement", at: l, patch: s });
388
+ c && (s.overrides = f), i.push({ op: "update_placement", at: a, patch: s });
367
389
  }
368
- const r = e.reduce((i, l) => i + l.count, 0);
390
+ const r = e.reduce((l, a) => l + a.count, 0);
369
391
  return m(o, {
370
392
  ok: !0,
371
- ops: a,
393
+ ops: i,
372
394
  label: `Replace ${g(r, "match", "matches")} in labels`,
373
395
  notes: []
374
396
  });
375
397
  }
376
398
  export {
377
- Pe as HIT_KIND_LABELS,
378
- Ue as PIN_KEY,
379
- re as RULE_KEYS,
380
- $e as RULE_LABELS,
399
+ Ae as HIT_KIND_LABELS,
400
+ He as PIN_KEY,
401
+ ce as RULE_KEYS,
402
+ Ee as RULE_LABELS,
381
403
  m as checked,
382
- we as convertChoices,
383
- Oe as copyRulesPlan,
384
- oe as duplicateBlocked,
385
- be as duplicatePlan,
386
- Ee as findHits,
404
+ Oe as convertChoices,
405
+ Ue as copyRulesPlan,
406
+ le as duplicateBlocked,
407
+ Pe as duplicatePlan,
408
+ re as fieldPinBlocked,
409
+ ve as fieldPinPlan,
410
+ Ne as findHits,
387
411
  d as groupName,
388
- z as groupsInPageOrder,
389
- F as isPinned,
390
- ee as kindWord,
391
- Ae as pinLocked,
392
- _e as pinPlan,
393
- Le as pinnedZone,
394
- y as refuse,
395
- xe as replacePlan,
396
- ve as ruleSet,
397
- Te as ruleTargets,
398
- Se as rulesOf,
399
- ne as unwrapBlocked,
400
- me as unwrapPlan,
401
- G as withPin,
402
- ge as wrapPlan
412
+ Y as groupsInPageOrder,
413
+ D as isPinned,
414
+ ee as isPlacementPinned,
415
+ se as kindWord,
416
+ Ke as pinLocked,
417
+ we as pinPlan,
418
+ Be as pinnedZone,
419
+ k as refuse,
420
+ Le as replacePlan,
421
+ xe as ruleSet,
422
+ Ie as ruleTargets,
423
+ Me as rulesOf,
424
+ ae as unwrapBlocked,
425
+ Te as unwrapPlan,
426
+ F as withPin,
427
+ te as withPlacementPin,
428
+ Se as wrapPlan
403
429
  };