@nivaro/react 0.3.0 → 0.3.1

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 (27) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +341 -0
  4. package/dist/index.js +764 -723
  5. package/dist/shared/components/ClientChaosToolbar.js +410 -0
  6. package/dist/shared/components/LoadErrorNote.js +49 -0
  7. package/dist/shared/components/PretendDown.js +258 -0
  8. package/dist/shared/components/ProfileView.js +54 -49
  9. package/dist/shared/components/QueryErrorState.js +16 -0
  10. package/dist/shared/components/ReportView.js +1351 -1338
  11. package/dist/shared/components/WidgetSlot.js +438 -418
  12. package/dist/shared/components/chaos/DeclareIncidentButton.js +72 -0
  13. package/dist/shared/components/chaos/DrillBanner.js +119 -0
  14. package/dist/shared/components/chaos/DrillTag.js +62 -0
  15. package/dist/shared/components/chaos/GameDayStrip.js +61 -0
  16. package/dist/shared/components/client-chaos-gate.js +51 -0
  17. package/dist/shared/components/integrations/console/SignalCard.js +172 -167
  18. package/dist/shared/components/layout-editor/EditorTopBar.js +108 -105
  19. package/dist/shared/components/layout-editor/LayoutEditor.js +514 -508
  20. package/dist/shared/components/notifications/NotificationAnalyticsView.js +18 -10
  21. package/dist/shared/components/pipeline/PipelineEditorView.js +495 -479
  22. package/dist/shared/components/pipeline/TeamsView.js +184 -169
  23. package/dist/shared/lib/client-chaos.js +359 -0
  24. package/dist/shared/lib/load-error.js +26 -0
  25. package/dist/shared/lib/socket-realtime.js +31 -30
  26. package/dist/shared/lib/worker-socket.js +108 -89
  27. package/package.json +1 -1
@@ -1,91 +1,92 @@
1
- import { jsxs as h, jsx as o, Fragment as de } from "react/jsx-runtime";
2
- import { useQueryClient as er, useQuery as tr } from "@tanstack/react-query";
3
- import { Percent as rr, ListOrdered as or, AlertTriangle as ht, Lock as nr, Plus as ar, BarChart3 as sr, LayoutGrid as ir, Table2 as lr, Grid3x3 as dr, Users as cr } from "lucide-react";
4
- import { useState as R, useEffect as $, useMemo as S, useRef as j, useCallback as C } from "react";
5
- import { createPortal as ur } from "react-dom";
6
- import { toast as vt } from "sonner";
7
- import { useNivaroClient as pr } from "../../context.js";
8
- import { get as mr } from "../../lib/commands.js";
9
- import { HEADER_GROUP_KEY as At, UNGROUPED_KEY as fr } from "../../lib/layout-ops.js";
10
- import { activeFreeze as yr, dayWords as hr } from "../../lib/layout-resolve.js";
11
- import { useMyUserId as vr } from "../../lib/presence-signals.js";
1
+ import { jsxs as y, jsx as o, Fragment as ae } from "react/jsx-runtime";
2
+ import { useQueryClient as rr, useQuery as or } from "@tanstack/react-query";
3
+ import { Percent as nr, ListOrdered as ar, AlertTriangle as vt, Lock as sr, Plus as ir, BarChart3 as lr, LayoutGrid as dr, Table2 as cr, Grid3x3 as ur, Users as pr } from "lucide-react";
4
+ import { useState as R, useEffect as U, useMemo as b, useRef as j, useCallback as C } from "react";
5
+ import { createPortal as mr } from "react-dom";
6
+ import { toast as gt } from "sonner";
7
+ import { useNivaroClient as fr } from "../../context.js";
8
+ import { get as yr } from "../../lib/commands.js";
9
+ import { HEADER_GROUP_KEY as Pt, UNGROUPED_KEY as hr } from "../../lib/layout-ops.js";
10
+ import { activeFreeze as vr, dayWords as gr } from "../../lib/layout-resolve.js";
11
+ import { useMyUserId as kr } from "../../lib/presence-signals.js";
12
12
  import { cn as G } from "../../lib/utils.js";
13
- import { modalHostOf as gr } from "../ui/popover.js";
14
- import { Skeleton as gt } from "../ui/skeleton.js";
15
- import { AddPanel as kr } from "./AddPanel.js";
16
- import { AutoArrangeButton as br } from "./AutoArrange.js";
17
- import { AiToolsButton as wr } from "./ai/AiToolsButton.js";
18
- import { pinsToMarks as xr, mergeMarks as kt } from "./ai/ai-tools-api.js";
19
- import { AiFormsButton as Sr } from "./ai-forms/AiFormsButton.js";
20
- import { AskButton as Cr, AskPanel as Tr } from "./assist/AskPanel.js";
21
- import { useAskThread as Ar } from "./assist/assist-api.js";
22
- import { jumpToSetting as Nr } from "./assist/jump.js";
23
- import { ProposalsButton as Or } from "./assist/ProposalsButton.js";
24
- import { BulkChangesButton as Rr } from "./bulk/BulkChangesButton.js";
25
- import { useMacroRecorder as Lr } from "./bulk/useMacroRecorder.js";
26
- import { bundleToActiveLayout as Nt, previewForRole as Pr, roleMarker as Er } from "./bundle-to-active.js";
27
- import { useCanvasCompare as Fr, CompareBanner as Ir } from "./CanvasCompare.js";
28
- import { changeNotePolicyOf as bt, changeNoteMeta as Kr, changeNoteReady as Dr, ChangeNoteFields as _r, ChangeNoteSave as Mr } from "./ChangeNote.js";
29
- import { PresenceAvatars as Br, DroppedBanner as qr, RecoveryBanner as $r, UnsavedList as Ur } from "./CollabParts.js";
30
- import { CommandPalette as zr } from "./commands/CommandPalette.js";
31
- import { nextSelection as Vr, targetKey as z } from "./design-context.js";
32
- import { WIDTH_LABELS as Hr } from "./field-zones.js";
33
- import { LayoutDndProvider as Wr, useLayoutDnd as jr } from "./dnd/LayoutDndProvider.js";
34
- import { NO_DND as Gr } from "./dnd/node.js";
35
- import { useDraftRecovery as Qr, stagedTip as Jr } from "./draft-recovery.js";
36
- import { canvasRenderer as Yr, EditorCanvas as Zr } from "./EditorCanvas.js";
37
- import { EditorTopBar as Xr } from "./EditorTopBar.js";
38
- import { notesOf as eo, noteKey as to } from "./editor-notes.js";
39
- import { EntryEditorContext as wt } from "./entry/entry-editor-context.js";
40
- import { useTabOrderEditor as ro, TabOrderBar as oo } from "./entry/tab-order.js";
41
- import { useAppIsDark as no, ThemePreviewTool as ao, previewThemeClass as so } from "./entry/theme-preview.js";
42
- import { useRulesView as io, explainMarks as lo, RulesToggle as co, RuleLoopsBanner as uo } from "./explain/CanvasRules.js";
43
- import { useDriverHover as po } from "./explain/driver-hover.js";
44
- import { useCanvasExplain as mo, useDefaultGhosts as fo } from "./explain/use-explain.js";
45
- import { FindReplaceButton as yo } from "./FindReplace.js";
46
- import { OutputsButton as ho } from "./outputs/OutputsButton.js";
47
- import { FormMapButton as vo } from "./FormMapButton.js";
48
- import { useSectionChanges as go } from "./history-api.js";
49
- import { useLayoutEditorHost as ko } from "./host.js";
50
- import { overriddenTargets as bo, overrideMark as wo } from "./inheritance.js";
51
- import { BulkInspector as xo } from "./inspector/BulkInspector.js";
52
- import { requestInspectorTab as So } from "./inspector/tab-request.js";
13
+ import { usePretendDownScope as wr, LAYOUT_PRETEND_SCOPE as kt, layoutPretendDownOptions as br, PretendDownSection as xr } from "../PretendDown.js";
14
+ import { modalHostOf as Sr } from "../ui/popover.js";
15
+ import { Skeleton as wt } from "../ui/skeleton.js";
16
+ import { AddPanel as Cr } from "./AddPanel.js";
17
+ import { AutoArrangeButton as Tr } from "./AutoArrange.js";
18
+ import { AiToolsButton as Or } from "./ai/AiToolsButton.js";
19
+ import { pinsToMarks as Ar, mergeMarks as bt } from "./ai/ai-tools-api.js";
20
+ import { AiFormsButton as Pr } from "./ai-forms/AiFormsButton.js";
21
+ import { AskButton as Nr, AskPanel as Rr } from "./assist/AskPanel.js";
22
+ import { useAskThread as Lr } from "./assist/assist-api.js";
23
+ import { jumpToSetting as Er } from "./assist/jump.js";
24
+ import { ProposalsButton as Dr } from "./assist/ProposalsButton.js";
25
+ import { BulkChangesButton as Fr } from "./bulk/BulkChangesButton.js";
26
+ import { useMacroRecorder as Ir } from "./bulk/useMacroRecorder.js";
27
+ import { bundleToActiveLayout as Nt, previewForRole as Kr, roleMarker as _r } from "./bundle-to-active.js";
28
+ import { useCanvasCompare as Mr, CompareBanner as Br } from "./CanvasCompare.js";
29
+ import { changeNotePolicyOf as xt, changeNoteMeta as qr, changeNoteReady as Ur, ChangeNoteFields as $r, ChangeNoteSave as zr } from "./ChangeNote.js";
30
+ import { PresenceAvatars as Vr, DroppedBanner as Hr, RecoveryBanner as Wr, UnsavedList as jr } from "./CollabParts.js";
31
+ import { CommandPalette as Gr } from "./commands/CommandPalette.js";
32
+ import { nextSelection as Qr, targetKey as z } from "./design-context.js";
33
+ import { WIDTH_LABELS as Yr } from "./field-zones.js";
34
+ import { LayoutDndProvider as Jr, useLayoutDnd as Zr } from "./dnd/LayoutDndProvider.js";
35
+ import { NO_DND as Xr } from "./dnd/node.js";
36
+ import { useDraftRecovery as eo, stagedTip as to } from "./draft-recovery.js";
37
+ import { canvasRenderer as ro, EditorCanvas as oo } from "./EditorCanvas.js";
38
+ import { EditorTopBar as no } from "./EditorTopBar.js";
39
+ import { notesOf as ao, noteKey as so } from "./editor-notes.js";
40
+ import { EntryEditorContext as St } from "./entry/entry-editor-context.js";
41
+ import { useTabOrderEditor as io, TabOrderBar as lo } from "./entry/tab-order.js";
42
+ import { useAppIsDark as co, ThemePreviewTool as uo, previewThemeClass as po } from "./entry/theme-preview.js";
43
+ import { useRulesView as mo, explainMarks as fo, RulesToggle as yo, RuleLoopsBanner as ho } from "./explain/CanvasRules.js";
44
+ import { useDriverHover as vo } from "./explain/driver-hover.js";
45
+ import { useCanvasExplain as go, useDefaultGhosts as ko } from "./explain/use-explain.js";
46
+ import { FindReplaceButton as wo } from "./FindReplace.js";
47
+ import { OutputsButton as bo } from "./outputs/OutputsButton.js";
48
+ import { FormMapButton as xo } from "./FormMapButton.js";
49
+ import { useSectionChanges as So } from "./history-api.js";
50
+ import { useLayoutEditorHost as Co } from "./host.js";
51
+ import { overriddenTargets as To, overrideMark as Oo } from "./inheritance.js";
52
+ import { BulkInspector as Ao } from "./inspector/BulkInspector.js";
53
+ import { requestInspectorTab as Po } from "./inspector/tab-request.js";
53
54
  import { isTyping as $e } from "./is-typing.js";
54
- import { ARROW_DIRS as Co, altArrowMove as To } from "./keyboard-move.js";
55
- import { LayoutsRail as Ao } from "./LayoutsRail.js";
56
- import { LintButton as No, LintPanel as Oo } from "./lint/LintPanel.js";
57
- import { useLayoutLint as Ro } from "./lint/lint-api.js";
58
- import { FieldStateMatrix as Lo } from "./matrix/FieldStateMatrix.js";
59
- import { RoleSectionMatrix as Po } from "./matrix/RoleSectionMatrix.js";
60
- import { FindTool as Eo, OutlineTool as Fo, ViewTools as Io, ShortcutsTool as Ko } from "./nav/NavTools.js";
61
- import { OutlinePanel as Do } from "./nav/OutlinePanel.js";
62
- import { useEditorNav as _o } from "./nav/useEditorNav.js";
63
- import { COMPACT_ZOOM as Mo } from "./nav/view-prefs.js";
64
- import { useLayoutOverview as Bo, useOverviewFields as qo, useInvalidateLayouts as Ot, useRuleChoiceLabels as $o, useApproxRecordCount as Uo } from "./overview/overview-api.js";
65
- import { purposeSegments as zo, Sentence as Vo } from "./overview/purpose.js";
66
- import { PlacementsTable as Ho } from "./PlacementsTable.js";
67
- import { segTrack as Wo, amberStrip as _e, segOption as jo } from "./panel-style.js";
68
- import { useLayoutPresence as Go, peersByTarget as Qo } from "./presence.js";
69
- import { PreviewModes as Jo } from "./preview/PreviewModes.js";
70
- import { PreviewPanes as Yo } from "./preview/PreviewPanes.js";
71
- import { FormMoreMenu as Zo } from "./reuse/FormMoreMenu.js";
72
- import { useRailCopy as Xo } from "./reuse/useRailCopy.js";
73
- import { StagedByOthers as en } from "./StagedChip.js";
74
- import { StructureActions as tn, usePinMarks as rn } from "./StructureMenu.js";
75
- import { useRolePreview as on } from "./settings/settings-api.js";
76
- import { layoutKindOf as nn } from "./settings/settings-registry.js";
77
- import { useStagedDraft as an, useStagedWriter as sn } from "./staged-api.js";
78
- import { ImpactButton as ln, TestingButton as dn } from "./testing/TestingPanels.js";
79
- import { MenuSeparator as Se, ToolButton as xt } from "./toolbar-kit.js";
80
- import { unsavedText as cn, UnsavedConfirm as un } from "./UnsavedConfirm.js";
81
- import { unsavedKeys as pn, targetFromKey as St, describeTarget as Ct } from "./unsaved-marks.js";
82
- import { UsagePanel as mn } from "./usage/UsagePanel.js";
83
- import { useShowFillRates as fn, useFieldFillRates as yn, usageTodayText as hn, useLayoutUsageToday as vn } from "./usage/usage-api.js";
84
- import { useLayoutDraft as gn, useLayoutBundle as Me, layoutDraftKeys as kn, touchesOverview as bn } from "./useLayoutDraft.js";
85
- import { FormSettings as wn } from "./settings/FormSettings.js";
86
- import { Inspector as xn } from "./inspector/Inspector.js";
87
- function Sn(r) {
88
- $(() => {
55
+ import { ARROW_DIRS as No, altArrowMove as Ro } from "./keyboard-move.js";
56
+ import { LayoutsRail as Lo } from "./LayoutsRail.js";
57
+ import { LintButton as Eo, LintPanel as Do } from "./lint/LintPanel.js";
58
+ import { useLayoutLint as Fo } from "./lint/lint-api.js";
59
+ import { FieldStateMatrix as Io } from "./matrix/FieldStateMatrix.js";
60
+ import { RoleSectionMatrix as Ko } from "./matrix/RoleSectionMatrix.js";
61
+ import { FindTool as _o, OutlineTool as Mo, ViewTools as Bo, ShortcutsTool as qo } from "./nav/NavTools.js";
62
+ import { OutlinePanel as Uo } from "./nav/OutlinePanel.js";
63
+ import { useEditorNav as $o } from "./nav/useEditorNav.js";
64
+ import { COMPACT_ZOOM as zo } from "./nav/view-prefs.js";
65
+ import { useLayoutOverview as Vo, useOverviewFields as Ho, useInvalidateLayouts as Rt, useRuleChoiceLabels as Wo, useApproxRecordCount as jo } from "./overview/overview-api.js";
66
+ import { purposeSegments as Go, Sentence as Qo } from "./overview/purpose.js";
67
+ import { PlacementsTable as Yo } from "./PlacementsTable.js";
68
+ import { segTrack as Jo, amberStrip as Me, segOption as Zo } from "./panel-style.js";
69
+ import { useLayoutPresence as Xo, peersByTarget as en } from "./presence.js";
70
+ import { PreviewModes as tn } from "./preview/PreviewModes.js";
71
+ import { PreviewPanes as rn } from "./preview/PreviewPanes.js";
72
+ import { FormMoreMenu as on } from "./reuse/FormMoreMenu.js";
73
+ import { useRailCopy as nn } from "./reuse/useRailCopy.js";
74
+ import { StagedByOthers as an } from "./StagedChip.js";
75
+ import { StructureActions as sn, usePinMarks as ln } from "./StructureMenu.js";
76
+ import { useRolePreview as dn } from "./settings/settings-api.js";
77
+ import { layoutKindOf as cn } from "./settings/settings-registry.js";
78
+ import { useStagedDraft as un, useStagedWriter as pn } from "./staged-api.js";
79
+ import { ImpactButton as mn, TestingButton as fn } from "./testing/TestingPanels.js";
80
+ import { MenuSeparator as Ce, ToolButton as Ct } from "./toolbar-kit.js";
81
+ import { unsavedText as yn, UnsavedConfirm as hn } from "./UnsavedConfirm.js";
82
+ import { unsavedKeys as vn, targetFromKey as Tt, describeTarget as Ot } from "./unsaved-marks.js";
83
+ import { UsagePanel as gn } from "./usage/UsagePanel.js";
84
+ import { useShowFillRates as kn, useFieldFillRates as wn, usageTodayText as bn, useLayoutUsageToday as xn } from "./usage/usage-api.js";
85
+ import { useLayoutDraft as Sn, useLayoutBundle as Be, layoutDraftKeys as Cn, touchesOverview as Tn } from "./useLayoutDraft.js";
86
+ import { FormSettings as On } from "./settings/FormSettings.js";
87
+ import { Inspector as An } from "./inspector/Inspector.js";
88
+ function Pn(r) {
89
+ U(() => {
89
90
  const l = (s) => {
90
91
  if (!(s.metaKey || s.ctrlKey) || s.altKey) return;
91
92
  const i = s.key.toLowerCase();
@@ -99,13 +100,13 @@ function Sn(r) {
99
100
  return window.addEventListener("keydown", l), () => window.removeEventListener("keydown", l);
100
101
  }, [r.undo, r.redo, r.autosave, r.flush, r.save]);
101
102
  }
102
- function Cn(r, l, s, i, m) {
103
- $(() => {
103
+ function Nn(r, l, s, i, m) {
104
+ U(() => {
104
105
  const d = (c) => {
105
- const v = Co[c.key];
106
+ const v = No[c.key];
106
107
  if (!v || !c.altKey || c.metaKey || c.ctrlKey || c.shiftKey || c.defaultPrevented || !r || l.length !== 1 || i.current || $e(c.target) || document.querySelector('[data-radix-popper-content-wrapper], [role="menu"]')) return;
107
108
  c.preventDefault();
108
- const p = To(r, l[0], v);
109
+ const p = Ro(r, l[0], v);
109
110
  if (!p) return;
110
111
  s(p.ops, { label: p.label }), m(p.next);
111
112
  const u = z(p.next);
@@ -120,43 +121,43 @@ function Cn(r, l, s, i, m) {
120
121
  return window.addEventListener("keydown", d), () => window.removeEventListener("keydown", d);
121
122
  }, [r, l, s, i, m]);
122
123
  }
123
- function Tn(r) {
124
+ function Rn(r) {
124
125
  const l = r.status === "saving" || r.dirty;
125
- $(() => {
126
+ U(() => {
126
127
  if (!l) return;
127
128
  const s = (i) => {
128
129
  r.flush(), i.preventDefault(), i.returnValue = "";
129
130
  };
130
131
  return window.addEventListener("beforeunload", s), () => window.removeEventListener("beforeunload", s);
131
- }, [l, r.flush]), $(() => {
132
+ }, [l, r.flush]), U(() => {
132
133
  const s = () => r.flush();
133
134
  return window.addEventListener("pagehide", s), () => window.removeEventListener("pagehide", s);
134
135
  }, [r.flush]);
135
136
  }
136
- function An(r) {
137
- const l = er(), s = Ot(r);
137
+ function Ln(r) {
138
+ const l = rr(), s = Rt(r);
138
139
  return C(
139
140
  (i, m) => {
140
141
  const d = Number(i.layout.id);
141
- Number.isFinite(d) && l.invalidateQueries({ queryKey: kn.versions(d) }), s({ lazy: !bn(m) });
142
+ Number.isFinite(d) && l.invalidateQueries({ queryKey: Cn.versions(d) }), s({ lazy: !Tn(m) });
142
143
  },
143
144
  [l, s]
144
145
  );
145
146
  }
146
- function Nn(r, l) {
147
- const s = pr();
148
- return tr({
147
+ function En(r, l) {
148
+ const s = fr();
149
+ return or({
149
150
  queryKey: ["layout-editor", "preview-record", r, l],
150
151
  queryFn: () => s.request(
151
- mr(`/items/${encodeURIComponent(r)}/${encodeURIComponent(String(l))}`)
152
+ yr(`/items/${encodeURIComponent(r)}/${encodeURIComponent(String(l))}`)
152
153
  ).then((i) => i.data ?? null),
153
154
  enabled: l != null,
154
155
  staleTime: 3e4
155
156
  });
156
157
  }
157
- function On(r, l) {
158
+ function Dn(r, l) {
158
159
  const s = j(l);
159
- s.current = l, $(() => {
160
+ s.current = l, U(() => {
160
161
  if (!r) return;
161
162
  let i = !1;
162
163
  const m = (d) => {
@@ -182,17 +183,17 @@ function On(r, l) {
182
183
  return document.addEventListener("click", m, !0), () => document.removeEventListener("click", m, !0);
183
184
  }, [r]);
184
185
  }
185
- function Be(r, l, s = null) {
186
+ function qe(r, l, s = null) {
186
187
  const i = (m) => {
187
- if (r.kind === "group") return r.key === fr || m.groups.some((c) => c.key === r.key);
188
- const d = r.kind === "header" ? At : r.group_key;
188
+ if (r.kind === "group") return r.key === hr || m.groups.some((c) => c.key === r.key);
189
+ const d = r.kind === "header" ? Pt : r.group_key;
189
190
  return m.placements.some((c) => c.field === r.field && c.group_key === d);
190
191
  };
191
192
  return i(l) || s != null && i(s);
192
193
  }
193
- function Rn(r, l, s) {
194
+ function Fn(r, l, s) {
194
195
  const i = j(null), m = j(l);
195
- return m.current = l, $(() => {
196
+ return m.current = l, U(() => {
196
197
  var v;
197
198
  if (!r) return;
198
199
  const d = document.activeElement;
@@ -205,7 +206,7 @@ function Rn(r, l, s) {
205
206
  };
206
207
  }, [r, s]), i;
207
208
  }
208
- function Ln({
209
+ function In({
209
210
  collection: r,
210
211
  bundle: l,
211
212
  parent: s,
@@ -219,109 +220,109 @@ function Ln({
219
220
  noDnd: g = !1,
220
221
  record: Q,
221
222
  selected: n,
222
- selection: ye,
223
+ selection: fe,
223
224
  onSelect: t,
224
225
  showHidden: E,
225
226
  fold: te = null,
226
227
  reveal: V = null,
227
- apply: N,
228
- whenIdle: Ce,
229
- fillRate: he,
230
- unsaved: ve,
231
- peers: ce,
232
- compare: y,
228
+ apply: P,
229
+ whenIdle: Te,
230
+ fillRate: ye,
231
+ unsaved: he,
232
+ peers: de,
233
+ compare: h,
233
234
  lastChanges: L
234
235
  }) {
235
- const re = jr(), K = g ? Gr : re, se = Yr(String(l.layout.layout_type ?? "grouped")), ie = (se === "item-edit-form" || se === "read-view") && (y == null ? void 0 : y.diff.bundle) || l, M = S(() => Nt(ie, s), [ie, s]), J = S(
236
- () => s ? bo(l, s) : null,
236
+ const re = Zr(), I = g ? Xr : re, se = ro(String(l.layout.layout_type ?? "grouped")), ie = (se === "item-edit-form" || se === "read-view") && (h == null ? void 0 : h.diff.bundle) || l, M = b(() => Nt(ie, s), [ie, s]), Y = b(
237
+ () => s ? To(l, s) : null,
237
238
  [l, s]
238
- ), H = S(() => J != null && J.size ? (k) => {
239
- const P = J.get(z(k)), oe = (d == null ? void 0 : d(k)) ?? [];
240
- return P ? [...oe, wo(P)] : oe;
241
- } : d, [J, d]), Te = S(
242
- () => Pr(M.active, i, E),
239
+ ), H = b(() => Y != null && Y.size ? (k) => {
240
+ const O = Y.get(z(k)), ge = (d == null ? void 0 : d(k)) ?? [];
241
+ return O ? [...ge, Oo(O)] : ge;
242
+ } : d, [Y, d]), Oe = b(
243
+ () => Kr(M.active, i, E),
243
244
  [M.active, i, E]
244
- ), { data: D = null } = on(r, i), Y = S(
245
- () => i ? Er(D) : void 0,
246
- [i, D]
247
- ), O = S(() => eo(l), [l]), _ = S(
245
+ ), { data: K = null } = dn(r, i), J = b(
246
+ () => i ? _r(K) : void 0,
247
+ [i, K]
248
+ ), N = b(() => ao(l), [l]), _ = b(
248
249
  () => H && v ? (k) => [...H(k), ...v(k)] : H ?? v,
249
250
  [H, v]
250
- ), B = rn(l, _), Ae = S(
251
+ ), B = ln(l, _), Ae = b(
251
252
  () => ({
252
253
  selected: n,
253
- selection: ye,
254
+ selection: fe,
254
255
  onSelect: t,
255
256
  showHidden: E,
256
257
  inheritedFrom: (k) => M.inherited.get(z(k)) ?? null,
257
- dnd: K,
258
- roleMark: Y,
258
+ dnd: I,
259
+ roleMark: J,
259
260
  marks: B,
260
261
  overlay: c,
261
- fillRate: he,
262
+ fillRate: ye,
262
263
  note: (k) => {
263
- const P = to(k);
264
- return P ? O.get(P) ?? null : null;
264
+ const O = so(k);
265
+ return O ? N.get(O) ?? null : null;
265
266
  },
266
267
  fold: te,
267
268
  reveal: V,
268
- unsaved: ve,
269
- peers: ce,
270
- diffMark: y ? (k) => y.diff.marks.get(z(k)) ?? null : void 0,
269
+ unsaved: he,
270
+ peers: de,
271
+ diffMark: h ? (k) => h.diff.marks.get(z(k)) ?? null : void 0,
271
272
  lastChange: L ? (k) => k.kind === "group" ? L[k.key] ?? null : null : void 0,
272
273
  ghost: p,
273
- resizeWidth: g ? void 0 : (k, P) => {
274
- k.kind !== "field" && k.kind !== "slot" || N(
274
+ resizeWidth: g ? void 0 : (k, O) => {
275
+ k.kind !== "field" && k.kind !== "slot" || P(
275
276
  [
276
277
  {
277
278
  op: "update_placement",
278
279
  at: { field: k.field, group_key: k.group_key },
279
- patch: { col_span: P === 12 ? null : P }
280
+ patch: { col_span: O === 12 ? null : O }
280
281
  }
281
282
  ],
282
- { label: `Set the width to ${Hr[P] ?? P}` }
283
+ { label: `Set the width to ${Yr[O] ?? O}` }
283
284
  );
284
285
  }
285
286
  }),
286
287
  [
287
288
  n,
288
- ye,
289
+ fe,
289
290
  t,
290
291
  E,
291
292
  M.inherited,
292
- K,
293
- Y,
293
+ I,
294
+ J,
294
295
  B,
295
296
  c,
296
- he,
297
- O,
297
+ ye,
298
+ N,
298
299
  te,
299
300
  V,
300
- ve,
301
- ce,
302
- y,
301
+ he,
302
+ de,
303
+ h,
303
304
  L,
304
305
  p,
305
- N,
306
+ P,
306
307
  g
307
308
  ]
308
- ), T = po(u);
309
+ ), T = vo(u);
309
310
  return /* @__PURE__ */ o("div", { ref: T, className: "flex min-h-full flex-col", children: /* @__PURE__ */ o(
310
- Zr,
311
+ oo,
311
312
  {
312
313
  collection: r,
313
314
  bundle: ie,
314
- layout: Te,
315
+ layout: Oe,
315
316
  record: Q,
316
317
  stateKey: m,
317
318
  roleId: i,
318
319
  design: Ae,
319
- apply: N,
320
- whenIdle: Ce
320
+ apply: P,
321
+ whenIdle: Te
321
322
  }
322
323
  ) });
323
324
  }
324
- function Pn({
325
+ function Kn({
325
326
  collection: r,
326
327
  name: l,
327
328
  row: s,
@@ -330,19 +331,19 @@ function Pn({
330
331
  fields: d,
331
332
  onDone: c
332
333
  }) {
333
- const v = $o(r, d, m), { data: p } = Uo(r, s, m), u = hn(vn(i).data), g = s ? s.section === "forms" && (s.reason.kind === "default" || s.reason.kind === "fallback") ? [{ text: "used by every record no rule catches" }] : zo(s, d, v) : [];
334
- return g.length > 0 && typeof p == "number" && g.push({ text: ` (≈ ${p.toLocaleString()} ${p === 1 ? "record" : "records"})` }), u && g.push({ text: g.length > 0 ? `; ${u}` : u }), /* @__PURE__ */ h(
334
+ const v = Wo(r, d, m), { data: p } = jo(r, s, m), u = bn(xn(i).data), g = s ? s.section === "forms" && (s.reason.kind === "default" || s.reason.kind === "fallback") ? [{ text: "used by every record no rule catches" }] : Go(s, d, v) : [];
335
+ return g.length > 0 && typeof p == "number" && g.push({ text: ` (≈ ${p.toLocaleString()} ${p === 1 ? "record" : "records"})` }), u && g.push({ text: g.length > 0 ? `; ${u}` : u }), /* @__PURE__ */ y(
335
336
  "div",
336
337
  {
337
338
  "data-editing-banner": "",
338
339
  className: "flex shrink-0 items-center gap-3 border-b border-nvr-cyan/30 bg-nvr-cyan/10 px-4 py-1.5 text-[12.5px] text-slate-700 dark:text-slate-200",
339
340
  children: [
340
- /* @__PURE__ */ h("p", { className: "m-0 min-w-0 flex-1 truncate", children: [
341
+ /* @__PURE__ */ y("p", { className: "m-0 min-w-0 flex-1 truncate", children: [
341
342
  "Editing ",
342
343
  /* @__PURE__ */ o("b", { className: "font-semibold text-slate-900 dark:text-foreground", children: l }),
343
- g.length > 0 && /* @__PURE__ */ h(de, { children: [
344
+ g.length > 0 && /* @__PURE__ */ y(ae, { children: [
344
345
  " — ",
345
- /* @__PURE__ */ o(Vo, { segs: g, muted: !0 })
346
+ /* @__PURE__ */ o(Qo, { segs: g, muted: !0 })
346
347
  ] })
347
348
  ] }),
348
349
  /* @__PURE__ */ o(
@@ -358,8 +359,8 @@ function Pn({
358
359
  }
359
360
  );
360
361
  }
361
- function En({ view: r, onView: l }) {
362
- const s = (i, m, d, c) => /* @__PURE__ */ h(
362
+ function _n({ view: r, onView: l }) {
363
+ const s = (i, m, d, c) => /* @__PURE__ */ y(
363
364
  "button",
364
365
  {
365
366
  type: "button",
@@ -368,37 +369,37 @@ function En({ view: r, onView: l }) {
368
369
  "data-editor-view": i,
369
370
  "data-tip": c,
370
371
  onClick: () => l(i),
371
- className: G(jo(r === i), "inline-flex items-center justify-center gap-1"),
372
+ className: G(Zo(r === i), "inline-flex items-center justify-center gap-1"),
372
373
  children: [
373
374
  /* @__PURE__ */ o(d, { className: "h-3.5 w-3.5 shrink-0" }),
374
375
  /* @__PURE__ */ o("span", { "data-tb-xwide": "", children: m })
375
376
  ]
376
377
  }
377
378
  );
378
- return /* @__PURE__ */ h(
379
+ return /* @__PURE__ */ y(
379
380
  "fieldset",
380
381
  {
381
382
  "aria-label": "Show the form as",
382
- className: G("m-0 min-w-0 shrink-0 border-0", Wo(4)),
383
+ className: G("m-0 min-w-0 shrink-0 border-0", Jo(4)),
383
384
  children: [
384
- s("canvas", "Canvas", ir, "The form as people see it"),
385
- s("table", "Table", lr, "Every field as a row: label, section, width, rules"),
385
+ s("canvas", "Canvas", dr, "The form as people see it"),
386
+ s("table", "Table", cr, "Every field as a row: label, section, width, rules"),
386
387
  s(
387
388
  "states",
388
389
  "States",
389
- dr,
390
+ ur,
390
391
  "Every field by workflow state: editable, read-only, required"
391
392
  ),
392
- s("roles", "Roles", cr, "Every section by role: can edit, read-only, hidden")
393
+ s("roles", "Roles", pr, "Every section by role: can edit, read-only, hidden")
393
394
  ]
394
395
  }
395
396
  );
396
397
  }
397
- const qe = (r) => G(
398
+ const Ue = (r) => G(
398
399
  "inline-flex h-7 items-center gap-1 rounded-md px-2.5 text-[12px] font-medium transition-colors",
399
400
  r ? "bg-accent text-slate-900 dark:text-foreground" : "text-slate-500 hover:bg-muted hover:text-slate-800 dark:text-muted-foreground dark:hover:text-foreground"
400
401
  );
401
- function us({
402
+ function vs({
402
403
  collection: r,
403
404
  layoutId: l,
404
405
  onBack: s,
@@ -408,83 +409,85 @@ function us({
408
409
  portalContainer: c,
409
410
  onDirtyChange: v
410
411
  }) {
411
- var ct, ut, pt, mt, ft, yt;
412
- const p = ko(), [u, g] = R(l);
413
- $(() => g(l), [l]);
414
- const Q = An(r), { draft: n, recorder: ye } = Lr(gn(u, { onSaved: Q })), t = n.bundle, [E, te] = R("layouts"), [V, N] = R("inspector"), [Ce, he] = Ar(), [ve, ce] = R(null), [y, L] = R([]), re = y.length > 0 ? y[y.length - 1] : null, [K, se] = R("canvas"), [ge, ie] = R(!1), [M, J] = fn(), { data: H } = yn(r, M), Te = S(
412
+ var ut, pt, mt, ft, yt, ht;
413
+ const p = Co(), [u, g] = R(l);
414
+ U(() => g(l), [l]);
415
+ const Q = Ln(r), { draft: n, recorder: fe } = Ir(Sn(u, { onSaved: Q })), t = n.bundle, [E, te] = R("layouts"), [V, P] = R("inspector"), [Te, ye] = Lr(), [he, de] = R(null), [h, L] = R([]), re = h.length > 0 ? h[h.length - 1] : null, [I, se] = R("canvas"), [ve, ie] = R(!1), [M, Y] = kn(), { data: H } = wn(r, M), Oe = b(
415
416
  () => M && H && H.total > 0 ? (e) => H.pct.get(e) ?? null : void 0,
416
417
  [M, H]
417
- ), [D, Y] = R({
418
+ ), [K, J] = R({
418
419
  record: d ? { id: d, label: `#${d}` } : null,
419
420
  roleId: null
420
- }), { data: O } = Bo(r), { data: _ = [] } = qo(r), B = O == null ? void 0 : O.rows.find((e) => e.layout_id === u), Ae = (t == null ? void 0 : t.layout.parent_layout_id) != null ? Number(t.layout.parent_layout_id) : null, { data: T = null } = Me(Ae), { data: k = null } = Nn(r, ((ct = D.record) == null ? void 0 : ct.id) ?? null), P = S(
421
+ }), { data: N } = Vo(r), { data: _ = [] } = Ho(r), B = N == null ? void 0 : N.rows.find((e) => e.layout_id === u), Ae = (t == null ? void 0 : t.layout.parent_layout_id) != null ? Number(t.layout.parent_layout_id) : null, { data: T = null } = Be(Ae), { data: k = null } = En(r, ((ut = K.record) == null ? void 0 : ut.id) ?? null), O = b(
421
422
  () => t ? Nt(t, T).active : null,
422
423
  [t, T]
423
- ), oe = Ro(r, t, T), { data: Rt } = Me(u), Z = Fr(t, Rt ?? null, n.unsavedCount, u), { data: Lt } = go(u, t != null), [Ue, Pt] = R([]), Et = S(() => {
424
- const e = xr(Ue), a = /* @__PURE__ */ new WeakMap();
424
+ );
425
+ wr(kt);
426
+ const ge = b(() => br(O), [O]), ke = Fo(r, t, T), { data: Lt } = Be(u), Z = Mr(t, Lt ?? null, n.unsavedCount, u), { data: Et } = So(u, t != null), [ze, Dt] = R([]), Ft = b(() => {
427
+ const e = Ar(ze), a = /* @__PURE__ */ new WeakMap();
425
428
  return (f) => {
426
- if (!f || !e) return kt(f, e);
427
- const b = a.get(f);
428
- if (b) return b;
429
- const I = kt(f, e);
430
- return a.set(f, I), I;
429
+ if (!f || !e) return bt(f, e);
430
+ const w = a.get(f);
431
+ if (w) return w;
432
+ const F = bt(f, e);
433
+ return a.set(f, F), F;
431
434
  };
432
- }, [Ue]), [ue, Ft] = io(), ke = mo(r, P, ue), pe = fo(r, P, ue && !D.record), { data: le } = Me(u), X = yr(((ut = le == null ? void 0 : le.layout) == null ? void 0 : ut.conditions) ?? ((pt = t == null ? void 0 : t.layout) == null ? void 0 : pt.conditions)), F = bt(le == null ? void 0 : le.layout) ?? bt(t == null ? void 0 : t.layout) ?? (X ? "note" : null), [me, Ne] = R({ reason: "", ticket: "" }), [ze, Ve] = R(null), Oe = j(me);
433
- Oe.current = me;
434
- const He = C(async () => {
435
- const e = F ? {
436
- ...Kr(Oe.current),
437
- ...X ? { freeze_override: Oe.current.reason.trim() } : {}
435
+ }, [ze]), [ce, It] = mo(), we = go(r, O, ce), ue = ko(r, O, ce && !K.record), { data: le } = Be(u), X = vr(((pt = le == null ? void 0 : le.layout) == null ? void 0 : pt.conditions) ?? ((mt = t == null ? void 0 : t.layout) == null ? void 0 : mt.conditions)), D = xt(le == null ? void 0 : le.layout) ?? xt(t == null ? void 0 : t.layout) ?? (X ? "note" : null), [pe, Pe] = R({ reason: "", ticket: "" }), [Ve, He] = R(null), Ne = j(pe);
436
+ Ne.current = pe;
437
+ const We = C(async () => {
438
+ const e = D ? {
439
+ ...qr(Ne.current),
440
+ ...X ? { freeze_override: Ne.current.reason.trim() } : {}
438
441
  } : void 0;
439
442
  await n.save(e);
440
443
  const a = n.unsavedOps().length === 0;
441
- return a && e && Ne((f) => ({ ...f, reason: "" })), a;
442
- }, [n.save, n.unsavedOps, F, X]), We = C(() => {
444
+ return a && e && Pe((f) => ({ ...f, reason: "" })), a;
445
+ }, [n.save, n.unsavedOps, D, X]), je = C(() => {
443
446
  var e, a;
444
- return F ? (n.unsavedOps().length > 0 && Ve(
445
- ((e = U.current) == null ? void 0 : e.querySelector("[data-editor-save]")) ?? ((a = U.current) == null ? void 0 : a.querySelector("[data-editor-topbar]")) ?? null
447
+ return D ? (n.unsavedOps().length > 0 && He(
448
+ ((e = $.current) == null ? void 0 : e.querySelector("[data-editor-save]")) ?? ((a = $.current) == null ? void 0 : a.querySelector("[data-editor-topbar]")) ?? null
446
449
  ), Promise.resolve()) : n.save();
447
- }, [F, n.save, n.unsavedOps]);
448
- $(() => {
449
- F && n.autosave && n.setAutosave(!1);
450
- }, [F, n.autosave, n.setAutosave]);
451
- const It = F ? { ...n, save: We, setAutosave: void 0 } : n;
452
- Sn(F ? { ...n, save: We } : n), Tn(n);
453
- const U = j(null), [Kt, je] = R(null), Ge = j(n.dirty);
454
- Ge.current = n.dirty;
455
- const ne = C((e, a, f) => {
456
- var I, fe;
457
- if (!Ge.current) return a();
458
- const b = ((I = U.current) == null ? void 0 : I.querySelector("[data-editor-save]")) ?? ((fe = U.current) == null ? void 0 : fe.querySelector("[data-editor-topbar]")) ?? null;
459
- je({ what: e, go: a, anchor: f ?? b });
460
- }, []), Dt = He;
461
- On(n.dirty, (e, a) => ne("leave this page", e, a)), $(() => {
450
+ }, [D, n.save, n.unsavedOps]);
451
+ U(() => {
452
+ D && n.autosave && n.setAutosave(!1);
453
+ }, [D, n.autosave, n.setAutosave]);
454
+ const Kt = D ? { ...n, save: je, setAutosave: void 0 } : n;
455
+ Pn(D ? { ...n, save: je } : n), Rn(n);
456
+ const $ = j(null), [_t, Ge] = R(null), Qe = j(n.dirty);
457
+ Qe.current = n.dirty;
458
+ const oe = C((e, a, f) => {
459
+ var F, me;
460
+ if (!Qe.current) return a();
461
+ const w = ((F = $.current) == null ? void 0 : F.querySelector("[data-editor-save]")) ?? ((me = $.current) == null ? void 0 : me.querySelector("[data-editor-topbar]")) ?? null;
462
+ Ge({ what: e, go: a, anchor: f ?? w });
463
+ }, []), Mt = We;
464
+ Dn(n.dirty, (e, a) => oe("leave this page", e, a)), U(() => {
462
465
  v == null || v(n.dirty);
463
466
  }, [n.dirty, v]);
464
- const Qe = j(n.unsavedOps);
465
- Qe.current = n.unsavedOps, $(
467
+ const Ye = j(n.unsavedOps);
468
+ Ye.current = n.unsavedOps, U(
466
469
  () => () => {
467
- Qe.current().length > 0 && vt.warning("Unsaved form changes kept — open the form again to save or discard them");
470
+ Ye.current().length > 0 && gt.warning("Unsaved form changes kept — open the form again to save or discard them");
468
471
  },
469
472
  []
470
473
  );
471
- const Je = Ot(r), Ye = C(() => {
474
+ const Je = Rt(r), Ze = C(() => {
472
475
  const e = n.whenIdle();
473
476
  e.then(() => Je()), s(e);
474
477
  }, [n.whenIdle, Je, s]), Re = C(
475
- (e) => ne(i === "overlay" ? "go back to the record" : "leave this form", Ye, e),
476
- [ne, Ye, i]
478
+ (e) => oe(i === "overlay" ? "go back to the record" : "leave this form", Ze, e),
479
+ [oe, Ze, i]
477
480
  );
478
- $(() => {
479
- if (!t || y.length === 0) return;
480
- const e = y.filter((a) => Be(a, t, T));
481
- e.length !== y.length && L(e);
482
- }, [y, t, T]);
483
- const ae = i === "overlay", [Le, _t] = R(null), Pe = j(!1), Mt = C((e) => {
484
- Pe.current = e;
485
- }, []), Bt = Rn(ae && Le != null, () => Re(), Pe), A = C((e, a) => {
486
- L((f) => Vr(f, e, a)), N("inspector");
487
- }, []), Ze = C((e) => L([e]), []), q = ro(t, n.apply), qt = S(() => q.intercept(A), [q.intercept, A]), [Ee, $t] = R(!1), Fe = no(), Ie = S(
481
+ U(() => {
482
+ if (!t || h.length === 0) return;
483
+ const e = h.filter((a) => qe(a, t, T));
484
+ e.length !== h.length && L(e);
485
+ }, [h, t, T]);
486
+ const ne = i === "overlay", [Le, Bt] = R(null), Ee = j(!1), qt = C((e) => {
487
+ Ee.current = e;
488
+ }, []), Ut = Fn(ne && Le != null, () => Re(), Ee), A = C((e, a) => {
489
+ L((f) => Qr(f, e, a)), P("inspector");
490
+ }, []), Xe = C((e) => L([e]), []), q = io(t, n.apply), $t = b(() => q.intercept(A), [q.intercept, A]), [De, zt] = R(!1), Fe = co(), Ie = b(
488
491
  () => ({
489
492
  tabOrderActive: q.active,
490
493
  startTabOrder: () => {
@@ -492,188 +495,188 @@ function us({
492
495
  }
493
496
  }),
494
497
  [q.active, q.start]
495
- ), Xe = C(
498
+ ), et = C(
496
499
  (e, a) => {
497
500
  if (e.kind === "group") return A({ kind: "group", key: e.key });
498
501
  if (e.kind === "tab") {
499
- A(a), (a.kind === "field" || a.kind === "header") && So(a.field, e.tab);
502
+ A(a), (a.kind === "field" || a.kind === "header") && Po(a.field, e.tab);
500
503
  return;
501
504
  }
502
505
  if (e.kind === "pipeline")
503
- return ne(
506
+ return oe(
504
507
  "open the pipeline",
505
508
  () => p.navigate(`/pipelines/${encodeURIComponent(e.id)}`)
506
509
  );
507
- ne(
510
+ oe(
508
511
  "open the field rules",
509
512
  () => p.navigate(`/data-model/${encodeURIComponent(r)}?tab=rules`)
510
513
  );
511
514
  },
512
- [A, ne, p, r]
513
- ), Ut = S(() => {
515
+ [A, oe, p, r]
516
+ ), Vt = b(() => {
514
517
  const e = /* @__PURE__ */ new Map();
515
- for (const [a, f] of pe)
518
+ for (const [a, f] of ue)
516
519
  (f.type === "boolean" || f.text.endsWith(" linked")) && e.set(a, f.text);
517
- return lo(ke, { chips: ue, ghostTags: e, open: Xe });
518
- }, [ke, ue, pe, Xe]), zt = S(
519
- () => pe.size > 0 ? (e) => {
520
+ return fo(we, { chips: ce, ghostTags: e, open: et });
521
+ }, [we, ce, ue, et]), Ht = b(
522
+ () => ue.size > 0 ? (e) => {
520
523
  var a;
521
- return ((a = pe.get(e)) == null ? void 0 : a.text) ?? null;
524
+ return ((a = ue.get(e)) == null ? void 0 : a.text) ?? null;
522
525
  } : void 0,
523
- [pe]
524
- ), Vt = C(
526
+ [ue]
527
+ ), Wt = C(
525
528
  (e) => {
526
- const a = t == null ? void 0 : t.placements.find((b) => b.field === e);
529
+ const a = t == null ? void 0 : t.placements.find((w) => w.field === e);
527
530
  if (!a) return;
528
- const f = a.group_key === At ? { kind: "header", field: e } : { kind: "field", field: e, group_key: a.group_key };
531
+ const f = a.group_key === Pt ? { kind: "header", field: e } : { kind: "field", field: e, group_key: a.group_key };
529
532
  A(f), requestAnimationFrame(
530
533
  () => {
531
- var b, I;
532
- return (I = (b = document.querySelector(`[data-layout-editor] [data-design-target="${CSS.escape(z(f))}"]`)) == null ? void 0 : b.scrollIntoView) == null ? void 0 : I.call(b, { block: "center" });
534
+ var w, F;
535
+ return (F = (w = document.querySelector(`[data-layout-editor] [data-design-target="${CSS.escape(z(f))}"]`)) == null ? void 0 : w.scrollIntoView) == null ? void 0 : F.call(w, { block: "center" });
533
536
  }
534
537
  );
535
538
  },
536
539
  [t, A]
537
540
  );
538
- Cn(t, y, n.apply, Pe, Ze);
539
- const Ke = Go(u, re ? z(re) : null), et = S(() => Qo(Ke), [Ke]), Ht = C(
540
- (e) => (et.get(z(e)) ?? []).map((a) => ({
541
+ Nn(t, h, n.apply, Ee, Xe);
542
+ const Ke = Xo(u, re ? z(re) : null), tt = b(() => en(Ke), [Ke]), jt = C(
543
+ (e) => (tt.get(z(e)) ?? []).map((a) => ({
541
544
  id: a.id,
542
545
  name: a.name,
543
546
  outline: a.tone.outline,
544
547
  chip: a.tone.chip
545
548
  })),
546
- [et]
547
- ), tt = S(() => pn(n.unsavedSteps), [n.unsavedSteps]), Wt = C((e) => tt.has(z(e)), [tt]), [rt, be] = R(null), ot = C((e) => {
548
- se("canvas"), L([e]), N("inspector"), requestAnimationFrame(() => {
549
+ [tt]
550
+ ), rt = b(() => vn(n.unsavedSteps), [n.unsavedSteps]), Gt = C((e) => rt.has(z(e)), [rt]), [ot, be] = R(null), nt = C((e) => {
551
+ se("canvas"), L([e]), P("inspector"), requestAnimationFrame(() => {
549
552
  var f;
550
553
  const a = document.querySelector(
551
554
  `[data-layout-editor] [data-design-target="${CSS.escape(z(e))}"]`
552
555
  );
553
556
  (f = a == null ? void 0 : a.scrollIntoView) == null || f.call(a, { block: "center" }), a == null || a.focus({ preventScroll: !0 });
554
557
  });
555
- }, []), jt = vr(), W = an(u), nt = sn(), Gt = S(
558
+ }, []), Qt = kr(), W = un(u), at = pn(), Yt = b(
556
559
  () => {
557
560
  var e, a;
558
561
  return {
559
562
  settled: W.isFetched || W.isError,
560
563
  draft: ((e = W.data) == null ? void 0 : e.data) ?? null,
561
564
  available: ((a = W.data) == null ? void 0 : a.available) ?? !W.isError,
562
- writer: nt
565
+ writer: at
563
566
  };
564
567
  },
565
- [W.isFetched, W.isError, W.data, nt]
566
- ), we = Qr(n, u, jt, Gt), Qt = C(
567
- (e) => Y((a) => a.roleId === e ? a : { ...a, roleId: e }),
568
+ [W.isFetched, W.isError, W.data, at]
569
+ ), xe = eo(n, u, Qt, Yt), Jt = C(
570
+ (e) => J((a) => a.roleId === e ? a : { ...a, roleId: e }),
568
571
  []
569
572
  ), ee = (e) => {
570
- var b;
571
- if (N("inspector"), e === u) return;
572
- const a = document.activeElement, f = a instanceof HTMLElement && ((b = U.current) != null && b.contains(a)) ? a : null;
573
- ne(
573
+ var w;
574
+ if (P("inspector"), e === u) return;
575
+ const a = document.activeElement, f = a instanceof HTMLElement && ((w = $.current) != null && w.contains(a)) ? a : null;
576
+ oe(
574
577
  "open another form",
575
578
  () => {
576
579
  n.flush(), L([]), g(e), m == null || m(e);
577
580
  },
578
581
  f
579
582
  );
580
- }, Jt = Xo(r, t, (O == null ? void 0 : O.rows) ?? [], ee), Yt = C(
581
- (e) => t ? Nr(e, {
583
+ }, Zt = nn(r, t, (N == null ? void 0 : N.rows) ?? [], ee), Xt = C(
584
+ (e) => t ? Er(e, {
582
585
  bundle: t,
583
- selection: y,
586
+ selection: h,
584
587
  select: (a) => {
585
- L([a]), N("inspector");
588
+ L([a]), P("inspector");
586
589
  },
587
- openSettings: () => N("settings"),
590
+ openSettings: () => P("settings"),
588
591
  openAddPanel: () => te("add"),
589
- root: U.current
592
+ root: $.current
590
593
  }) : Promise.resolve({ ok: !1, message: "The form is still loading" }),
591
- [t, y]
592
- ), at = j(ee);
593
- at.current = ee;
594
- const Zt = C(
594
+ [t, h]
595
+ ), st = j(ee);
596
+ st.current = ee;
597
+ const er = C(
595
598
  (e) => {
596
599
  if (e.kind === "record")
597
- Y((a) => ({ ...a, record: { id: e.id, label: `#${e.id}` } }));
598
- else if (e.kind === "layout") at.current(e.id);
600
+ J((a) => ({ ...a, record: { id: e.id, label: `#${e.id}` } }));
601
+ else if (e.kind === "layout") st.current(e.id);
599
602
  else {
600
- const a = t == null ? void 0 : t.placements.find((b) => b.field === e.field);
601
- if (!a) return vt.info(`${e.label} is not on this form`);
603
+ const a = t == null ? void 0 : t.placements.find((w) => w.field === e.field);
604
+ if (!a) return gt.info(`${e.label} is not on this form`);
602
605
  const f = { kind: "field", field: a.field, group_key: a.group_key };
603
606
  A(f), requestAnimationFrame(
604
607
  () => {
605
- var b, I, fe;
606
- return (fe = (I = (b = U.current) == null ? void 0 : b.querySelector(`[data-design-target="${CSS.escape(z(f))}"]`)) == null ? void 0 : I.scrollIntoView) == null ? void 0 : fe.call(I, { block: "center" });
608
+ var w, F, me;
609
+ return (me = (F = (w = $.current) == null ? void 0 : w.querySelector(`[data-design-target="${CSS.escape(z(f))}"]`)) == null ? void 0 : F.scrollIntoView) == null ? void 0 : me.call(F, { block: "center" });
607
610
  }
608
611
  );
609
612
  }
610
613
  },
611
614
  [t, A]
612
- ), xe = String((t == null ? void 0 : t.layout.name) ?? (B == null ? void 0 : B.name) ?? ""), De = String((t == null ? void 0 : t.layout.layout_type) ?? (B == null ? void 0 : B.layout_type) ?? "grouped"), w = De !== "table" && De !== "file", x = _o({
613
- bodyRef: U,
615
+ ), Se = String((t == null ? void 0 : t.layout.name) ?? (B == null ? void 0 : B.name) ?? ""), _e = String((t == null ? void 0 : t.layout.layout_type) ?? (B == null ? void 0 : B.layout_type) ?? "grouped"), x = _e !== "table" && _e !== "file", S = $o({
616
+ bodyRef: $,
614
617
  bundle: t,
615
618
  parent: T,
616
619
  fields: _,
617
620
  onSelect: A,
618
- showHidden: ge,
621
+ showHidden: ve,
619
622
  setShowHidden: ie,
620
- canvasShown: !(w && K === "table")
621
- }), st = x.outlineOpen && !!t && w, it = p.warning ?? (O == null ? void 0 : O.warning) ?? null, Xt = ae ? {
623
+ canvasShown: !(x && I === "table")
624
+ }), it = S.outlineOpen && !!t && x, lt = p.warning ?? (N == null ? void 0 : N.warning) ?? null, tr = ne ? {
622
625
  role: "dialog",
623
626
  "aria-modal": !0,
624
- "aria-label": `Edit form ${xe}`,
627
+ "aria-label": `Edit form ${Se}`,
625
628
  tabIndex: -1
626
- } : {}, lt = /* @__PURE__ */ h(
629
+ } : {}, dt = /* @__PURE__ */ y(
627
630
  "div",
628
631
  {
629
632
  ref: (e) => {
630
- U.current = e, ae && (Bt.current = e);
633
+ $.current = e, ne && (Ut.current = e);
631
634
  },
632
635
  "data-layout-editor": "",
633
636
  "data-mode": i,
634
- ...Xt,
637
+ ...tr,
635
638
  className: G(
636
639
  "flex min-h-0 flex-col bg-slate-50 outline-none dark:bg-background",
637
- ae ? "fixed inset-0 z-[90]" : "flex-1"
640
+ ne ? "fixed inset-0 z-[90]" : "flex-1"
638
641
  ),
639
642
  children: [
640
643
  /* @__PURE__ */ o(
641
- Xr,
644
+ no,
642
645
  {
643
646
  collection: r,
644
647
  layoutId: u,
645
- layoutName: xe,
646
- layoutType: De,
648
+ layoutName: Se,
649
+ layoutType: _e,
647
650
  row: B,
648
651
  fields: _,
649
- draft: It,
650
- preview: D,
651
- onPreview: Y,
652
- showHidden: ge,
652
+ draft: Kt,
653
+ preview: K,
654
+ onPreview: J,
655
+ showHidden: ve,
653
656
  onShowHidden: ie,
654
657
  onBack: Re,
655
- backLabel: ae ? "Back to record" : "Forms",
658
+ backLabel: ne ? "Back to record" : "Forms",
656
659
  onShowOnCanvas: Z.showVersion,
657
660
  onReviewChanges: Z.toggleReview,
658
- reviewing: ((mt = Z.compare) == null ? void 0 : mt.kind) === "unsaved",
661
+ reviewing: ((ft = Z.compare) == null ? void 0 : ft.kind) === "unsaved",
659
662
  onOpenUnsaved: be,
660
- pendingTip: Jr(we.sync),
661
- presence: /* @__PURE__ */ h(de, { children: [
663
+ pendingTip: to(xe.sync),
664
+ presence: /* @__PURE__ */ y(ae, { children: [
662
665
  /* @__PURE__ */ o(
663
- Br,
666
+ Vr,
664
667
  {
665
668
  peers: Ke,
666
669
  describe: (e) => {
667
- const a = St(e);
668
- return a && t && Be(a, t, T) ? Ct(a, t, _) : null;
670
+ const a = Tt(e);
671
+ return a && t && qe(a, t, T) ? Ot(a, t, _) : null;
669
672
  },
670
673
  onJump: (e) => {
671
- const a = St(e);
672
- a && ot(a);
674
+ const a = Tt(e);
675
+ a && nt(a);
673
676
  }
674
677
  }
675
678
  ),
676
- /* @__PURE__ */ o(en, { others: ((ft = W.data) == null ? void 0 : ft.others) ?? [] })
679
+ /* @__PURE__ */ o(an, { others: ((yt = W.data) == null ? void 0 : yt.others) ?? [] })
677
680
  ] }),
678
681
  onSelectField: (e) => {
679
682
  var a;
@@ -683,84 +686,84 @@ function us({
683
686
  group_key: ((a = t == null ? void 0 : t.placements.find((f) => f.field === e)) == null ? void 0 : a.group_key) ?? null
684
687
  });
685
688
  },
686
- view: t && w ? /* @__PURE__ */ h(de, { children: [
687
- /* @__PURE__ */ o(En, { view: K, onView: se }),
688
- /* @__PURE__ */ o(co, { on: ue, onChange: Ft })
689
+ view: t && x ? /* @__PURE__ */ y(ae, { children: [
690
+ /* @__PURE__ */ o(_n, { view: I, onView: se }),
691
+ /* @__PURE__ */ o(yo, { on: ce, onChange: It })
689
692
  ] }) : null,
690
- tools: /* @__PURE__ */ h(de, { children: [
691
- t && w && /* @__PURE__ */ o(br, { bundle: t, apply: n.apply }),
692
- t && /* @__PURE__ */ o(Eo, { find: x.find }),
693
- t && w && /* @__PURE__ */ o(yo, { bundle: t, apply: n.apply, collection: r }),
694
- t && w && /* @__PURE__ */ o(ho, { bundle: t, apply: n.apply, collection: r }),
695
- /* @__PURE__ */ o(Se, {}),
693
+ tools: /* @__PURE__ */ y(ae, { children: [
694
+ t && x && /* @__PURE__ */ o(Tr, { bundle: t, apply: n.apply }),
695
+ t && /* @__PURE__ */ o(_o, { find: S.find }),
696
+ t && x && /* @__PURE__ */ o(wo, { bundle: t, apply: n.apply, collection: r }),
697
+ t && x && /* @__PURE__ */ o(bo, { bundle: t, apply: n.apply, collection: r }),
698
+ /* @__PURE__ */ o(Ce, {}),
696
699
  t && /* @__PURE__ */ o(
697
- Fo,
700
+ Mo,
698
701
  {
699
- outline: w ? {
700
- open: x.outlineOpen,
701
- onToggle: () => x.setOutlineOpen(!x.outlineOpen)
702
+ outline: x ? {
703
+ open: S.outlineOpen,
704
+ onToggle: () => S.setOutlineOpen(!S.outlineOpen)
702
705
  } : null
703
706
  }
704
707
  ),
705
708
  t && /* @__PURE__ */ o(
706
- Io,
709
+ Bo,
707
710
  {
708
- view: w && K === "canvas" ? {
709
- compact: x.compact,
710
- onCompact: x.setCompact,
711
- onExpandAll: x.expandAll,
712
- onCollapseAll: x.collapseAll
711
+ view: x && I === "canvas" ? {
712
+ compact: S.compact,
713
+ onCompact: S.setCompact,
714
+ onExpandAll: S.expandAll,
715
+ onCollapseAll: S.collapseAll
713
716
  } : null
714
717
  }
715
718
  ),
716
- t && w && /* @__PURE__ */ o(
717
- xt,
719
+ t && x && /* @__PURE__ */ o(
720
+ Ct,
718
721
  {
719
722
  label: "Show how full each field is",
720
- icon: /* @__PURE__ */ o(rr, { className: "h-3.5 w-3.5" }),
723
+ icon: /* @__PURE__ */ o(nr, { className: "h-3.5 w-3.5" }),
721
724
  hint: "The share of records with a value, on each field",
722
725
  checked: M,
723
- onClick: () => J(!M),
726
+ onClick: () => Y(!M),
724
727
  data: { "data-editor-fill-toggle": "" }
725
728
  }
726
729
  ),
727
- t && w && /* @__PURE__ */ o(
728
- xt,
730
+ t && x && /* @__PURE__ */ o(
731
+ Ct,
729
732
  {
730
733
  label: "Set the tab order",
731
- icon: /* @__PURE__ */ o(or, { className: "h-3.5 w-3.5" }),
734
+ icon: /* @__PURE__ */ o(ar, { className: "h-3.5 w-3.5" }),
732
735
  hint: "Click fields in the order Tab should visit them",
733
736
  checked: q.active,
734
737
  onClick: () => q.active ? q.cancel() : Ie.startTabOrder(),
735
738
  data: { "data-editor-tab-order-toggle": "" }
736
739
  }
737
740
  ),
738
- t && w && /* @__PURE__ */ o(
739
- ao,
741
+ t && x && /* @__PURE__ */ o(
742
+ uo,
740
743
  {
741
- on: Ee,
742
- onChange: $t,
744
+ on: De,
745
+ onChange: zt,
743
746
  appDark: Fe,
744
- disabled: K !== "canvas"
747
+ disabled: I !== "canvas"
745
748
  }
746
749
  ),
747
- /* @__PURE__ */ o(Se, {}),
750
+ /* @__PURE__ */ o(Ce, {}),
748
751
  /* @__PURE__ */ o(
749
- Rr,
752
+ Fr,
750
753
  {
751
754
  collection: r,
752
755
  layoutId: u,
753
756
  dirty: n.dirty,
754
- recorder: ye
757
+ recorder: fe
755
758
  }
756
759
  ),
757
- /* @__PURE__ */ o(vo, { bundle: t, collection: r }),
758
- /* @__PURE__ */ o(Se, {}),
759
- t && /* @__PURE__ */ o(Ko, { shortcuts: x.shortcuts })
760
+ /* @__PURE__ */ o(xo, { bundle: t, collection: r }),
761
+ /* @__PURE__ */ o(Ce, {}),
762
+ t && /* @__PURE__ */ o(qo, { shortcuts: S.shortcuts })
760
763
  ] }),
761
- ai: /* @__PURE__ */ h(de, { children: [
762
- t && w && /* @__PURE__ */ o(
763
- Sr,
764
+ ai: /* @__PURE__ */ y(ae, { children: [
765
+ t && x && /* @__PURE__ */ o(
766
+ Pr,
764
767
  {
765
768
  collection: r,
766
769
  layoutId: u,
@@ -769,30 +772,30 @@ function us({
769
772
  }
770
773
  ),
771
774
  t && /* @__PURE__ */ o(
772
- wr,
775
+ Or,
773
776
  {
774
777
  collection: r,
775
778
  layoutId: u,
776
779
  bundle: t,
777
780
  apply: n.apply,
778
- previewRecordShown: D.record != null,
779
- onPins: Pt,
781
+ previewRecordShown: K.record != null,
782
+ onPins: Dt,
780
783
  onSelect: A
781
784
  }
782
785
  ),
783
- /* @__PURE__ */ o(Se, {}),
786
+ /* @__PURE__ */ o(Ce, {}),
784
787
  t && p.isAdmin && /* @__PURE__ */ o(
785
- Cr,
788
+ Nr,
786
789
  {
787
790
  active: V === "ask",
788
- onClick: () => N((e) => e === "ask" ? "inspector" : "ask")
791
+ onClick: () => P((e) => e === "ask" ? "inspector" : "ask")
789
792
  }
790
793
  ),
791
- /* @__PURE__ */ o(zr, { collection: r, layoutId: u, draft: n }),
792
- t && /* @__PURE__ */ o(Or, { layoutId: u, draft: n })
794
+ /* @__PURE__ */ o(Gr, { collection: r, layoutId: u, draft: n }),
795
+ t && /* @__PURE__ */ o(Dr, { layoutId: u, draft: n })
793
796
  ] }),
794
797
  testing: t ? /* @__PURE__ */ o(
795
- dn,
798
+ fn,
796
799
  {
797
800
  collection: r,
798
801
  layoutId: u,
@@ -804,7 +807,7 @@ function us({
804
807
  }
805
808
  ) : null,
806
809
  beforeSave: t ? /* @__PURE__ */ o(
807
- ln,
810
+ mn,
808
811
  {
809
812
  collection: r,
810
813
  layoutId: u,
@@ -815,63 +818,66 @@ function us({
815
818
  fields: _
816
819
  }
817
820
  ) : null,
818
- previewExtra: /* @__PURE__ */ o(
819
- Jo,
820
- {
821
- collection: r,
822
- value: D,
823
- onChange: Y,
824
- layout: P,
825
- fields: _
826
- }
827
- ),
821
+ previewExtra: /* @__PURE__ */ y(ae, { children: [
822
+ /* @__PURE__ */ o(
823
+ tn,
824
+ {
825
+ collection: r,
826
+ value: K,
827
+ onChange: J,
828
+ layout: O,
829
+ fields: _
830
+ }
831
+ ),
832
+ /* @__PURE__ */ o(xr, { scope: kt, options: ge })
833
+ ] }),
828
834
  problems: t && /* @__PURE__ */ o(
829
- No,
835
+ Eo,
830
836
  {
831
- findings: oe.findings,
837
+ findings: ke.findings,
832
838
  active: V === "checks",
833
- onClick: () => N((e) => e === "checks" ? "inspector" : "checks")
839
+ onClick: () => P((e) => e === "checks" ? "inspector" : "checks")
834
840
  }
835
841
  ),
836
842
  more: /* @__PURE__ */ o(
837
- Zo,
843
+ on,
838
844
  {
839
845
  collection: r,
840
846
  bundle: t,
841
- previewRecord: D.record,
847
+ previewRecord: K.record,
842
848
  onOpenLayout: ee
843
849
  }
844
850
  )
845
851
  }
846
852
  ),
847
- ae && /* @__PURE__ */ o(
848
- Pn,
853
+ ne && /* @__PURE__ */ o(
854
+ Kn,
849
855
  {
850
856
  collection: r,
851
857
  layoutId: u,
852
- name: xe,
858
+ name: Se,
853
859
  row: B,
854
- rows: (O == null ? void 0 : O.rows) ?? [],
860
+ rows: (N == null ? void 0 : N.rows) ?? [],
855
861
  fields: _,
856
862
  onDone: Re
857
863
  }
858
864
  ),
859
- n.status === "conflict" && n.dirty && /* @__PURE__ */ h(
865
+ n.status === "conflict" && n.dirty && /* @__PURE__ */ y(
860
866
  "div",
861
867
  {
862
868
  role: "alert",
863
869
  "data-unsaved-conflict": "",
864
870
  className: G(
865
871
  "flex shrink-0 items-center gap-3 border-b px-4 py-1.5 text-[12.5px]",
866
- _e
872
+ Me
867
873
  ),
868
874
  children: [
869
- /* @__PURE__ */ o(ht, { className: "h-3.5 w-3.5 shrink-0" }),
870
- /* @__PURE__ */ h("p", { className: "m-0 min-w-0 flex-1", children: [
875
+ /* @__PURE__ */ o(vt, { className: "h-3.5 w-3.5 shrink-0" }),
876
+ /* @__PURE__ */ y("p", { className: "m-0 min-w-0 flex-1", children: [
871
877
  n.error ?? "Someone else saved this form",
872
878
  ". Save again to try once more, or reload their version."
873
879
  ] }),
874
- /* @__PURE__ */ h(
880
+ /* @__PURE__ */ y(
875
881
  "button",
876
882
  {
877
883
  type: "button",
@@ -880,7 +886,7 @@ function us({
880
886
  className: "inline-flex h-7 shrink-0 items-center rounded-md border border-amber-300 px-2.5 text-[12px] font-medium hover:bg-amber-100 dark:border-amber-500/40 dark:hover:bg-amber-500/15",
881
887
  children: [
882
888
  "Reload (discard my ",
883
- cn(n.unsavedCount),
889
+ yn(n.unsavedCount),
884
890
  ")"
885
891
  ]
886
892
  }
@@ -888,62 +894,62 @@ function us({
888
894
  ]
889
895
  }
890
896
  ),
891
- /* @__PURE__ */ o(qr, { labels: n.dropped, onDismiss: n.clearDropped }),
897
+ /* @__PURE__ */ o(Hr, { labels: n.dropped, onDismiss: n.clearDropped }),
892
898
  /* @__PURE__ */ o(
893
- $r,
899
+ Wr,
894
900
  {
895
- state: we.state,
896
- onRecover: we.recover,
897
- onDismiss: we.dismiss
901
+ state: xe.state,
902
+ onRecover: xe.recover,
903
+ onDismiss: xe.dismiss
898
904
  }
899
905
  ),
900
- it && /* @__PURE__ */ h(
906
+ lt && /* @__PURE__ */ y(
901
907
  "div",
902
908
  {
903
909
  role: "note",
904
910
  className: G(
905
911
  "flex shrink-0 items-center gap-2 border-b px-4 py-1.5 text-[12.5px]",
906
- _e
912
+ Me
907
913
  ),
908
914
  children: [
909
- /* @__PURE__ */ o(ht, { className: "h-3.5 w-3.5 shrink-0" }),
910
- it
915
+ /* @__PURE__ */ o(vt, { className: "h-3.5 w-3.5 shrink-0" }),
916
+ lt
911
917
  ]
912
918
  }
913
919
  ),
914
- X && /* @__PURE__ */ h(
920
+ X && /* @__PURE__ */ y(
915
921
  "div",
916
922
  {
917
923
  role: "note",
918
924
  "data-editor-frozen": X.until,
919
925
  className: G(
920
926
  "flex shrink-0 items-center gap-2 border-b px-4 py-1.5 text-[12.5px]",
921
- _e
927
+ Me
922
928
  ),
923
929
  children: [
924
- /* @__PURE__ */ o(nr, { className: "h-3.5 w-3.5 shrink-0" }),
925
- Tt(X)
930
+ /* @__PURE__ */ o(sr, { className: "h-3.5 w-3.5 shrink-0" }),
931
+ At(X)
926
932
  ]
927
933
  }
928
934
  ),
929
- /* @__PURE__ */ o(uo, { explain: ke, onShow: Vt }),
935
+ /* @__PURE__ */ o(ho, { explain: we, onShow: Wt }),
930
936
  /* @__PURE__ */ o(
931
- Wr,
937
+ Jr,
932
938
  {
933
939
  bundle: t,
934
940
  apply: n.apply,
935
- onDragActive: Mt,
936
- onDropOnLayout: Jt,
937
- children: /* @__PURE__ */ h("div", { className: "flex min-h-0 flex-1 overflow-hidden", children: [
938
- /* @__PURE__ */ h(
941
+ onDragActive: qt,
942
+ onDropOnLayout: Zt,
943
+ children: /* @__PURE__ */ y("div", { className: "flex min-h-0 flex-1 overflow-hidden", children: [
944
+ /* @__PURE__ */ y(
939
945
  "aside",
940
946
  {
941
947
  className: G(
942
948
  "flex w-[260px] shrink-0 flex-col border-r border-slate-200 bg-white dark:border-border dark:bg-card",
943
- st && "hidden"
949
+ it && "hidden"
944
950
  ),
945
951
  children: [
946
- /* @__PURE__ */ h(
952
+ /* @__PURE__ */ y(
947
953
  "div",
948
954
  {
949
955
  role: "tablist",
@@ -957,41 +963,41 @@ function us({
957
963
  role: "tab",
958
964
  "aria-selected": E === "layouts",
959
965
  "data-editor-tab": "layouts",
960
- className: qe(E === "layouts"),
966
+ className: Ue(E === "layouts"),
961
967
  onClick: () => te("layouts"),
962
968
  children: "Forms"
963
969
  }
964
970
  ),
965
- /* @__PURE__ */ h(
971
+ /* @__PURE__ */ y(
966
972
  "button",
967
973
  {
968
974
  type: "button",
969
975
  role: "tab",
970
976
  "aria-selected": E === "add",
971
977
  "data-editor-tab": "add",
972
- className: qe(E === "add"),
978
+ className: Ue(E === "add"),
973
979
  onClick: () => te("add"),
974
980
  disabled: !t,
975
981
  "data-tip": "Add a field, section, panel or widget after the selection",
976
982
  children: [
977
- /* @__PURE__ */ o(ar, { className: "h-3.5 w-3.5" }),
983
+ /* @__PURE__ */ o(ir, { className: "h-3.5 w-3.5" }),
978
984
  "Add"
979
985
  ]
980
986
  }
981
987
  ),
982
- /* @__PURE__ */ h(
988
+ /* @__PURE__ */ y(
983
989
  "button",
984
990
  {
985
991
  type: "button",
986
992
  role: "tab",
987
993
  "aria-selected": E === "usage",
988
994
  "data-editor-tab": "usage",
989
- className: qe(E === "usage"),
995
+ className: Ue(E === "usage"),
990
996
  onClick: () => te("usage"),
991
997
  disabled: !t,
992
998
  "data-tip": "How this form is used and where it slows people down",
993
999
  children: [
994
- /* @__PURE__ */ o(sr, { className: "h-3.5 w-3.5" }),
1000
+ /* @__PURE__ */ o(lr, { className: "h-3.5 w-3.5" }),
995
1001
  "Usage"
996
1002
  ]
997
1003
  }
@@ -1000,7 +1006,7 @@ function us({
1000
1006
  }
1001
1007
  ),
1002
1008
  /* @__PURE__ */ o("div", { className: "min-h-0 flex-1 overflow-y-auto", children: E === "add" && t ? /* @__PURE__ */ o(
1003
- kr,
1009
+ Cr,
1004
1010
  {
1005
1011
  bundle: t,
1006
1012
  collection: r,
@@ -1009,54 +1015,54 @@ function us({
1009
1015
  onSelect: A
1010
1016
  }
1011
1017
  ) : E === "usage" && t ? /* @__PURE__ */ o(
1012
- mn,
1018
+ gn,
1013
1019
  {
1014
1020
  bundle: t,
1015
1021
  collection: r,
1016
1022
  fields: _,
1017
1023
  apply: n.apply,
1018
1024
  showFill: M,
1019
- onShowFill: J,
1025
+ onShowFill: Y,
1020
1026
  onOpenLayout: ee
1021
1027
  }
1022
1028
  ) : /* @__PURE__ */ o(
1023
- Ao,
1029
+ Lo,
1024
1030
  {
1025
1031
  collection: r,
1026
1032
  currentId: u,
1027
1033
  onOpen: ee,
1028
1034
  settingsOpen: V === "settings",
1029
- onSettings: () => N("settings"),
1035
+ onSettings: () => P("settings"),
1030
1036
  dropTargets: !0
1031
1037
  }
1032
1038
  ) })
1033
1039
  ]
1034
1040
  }
1035
1041
  ),
1036
- st && t && /* @__PURE__ */ o(
1042
+ it && t && /* @__PURE__ */ o(
1037
1043
  "aside",
1038
1044
  {
1039
1045
  "data-editor-outline-panel": "",
1040
1046
  className: "flex w-[260px] shrink-0 flex-col border-r border-slate-200 bg-white dark:border-border dark:bg-card",
1041
1047
  children: /* @__PURE__ */ o(
1042
- Do,
1048
+ Uo,
1043
1049
  {
1044
1050
  bundle: t,
1045
- nodes: x.nodes,
1046
- selection: y,
1047
- onPick: x.selectAndReveal,
1048
- onMoved: Ze,
1051
+ nodes: S.nodes,
1052
+ selection: h,
1053
+ onPick: S.selectAndReveal,
1054
+ onMoved: Xe,
1049
1055
  apply: n.apply,
1050
- onClose: () => x.setOutlineOpen(!1)
1056
+ onClose: () => S.setOutlineOpen(!1)
1051
1057
  }
1052
1058
  )
1053
1059
  }
1054
1060
  ),
1055
- /* @__PURE__ */ h("main", { className: "min-w-0 flex-1 overflow-y-auto", children: [
1056
- K === "canvas" && /* @__PURE__ */ o(oo, { editor: q }),
1057
- Z.compare && (K === "canvas" || !w) && /* @__PURE__ */ o(Ir, { compare: Z.compare, onClose: Z.close }),
1058
- t && w && K === "states" ? /* @__PURE__ */ o(
1059
- Lo,
1061
+ /* @__PURE__ */ y("main", { className: "min-w-0 flex-1 overflow-y-auto", children: [
1062
+ I === "canvas" && /* @__PURE__ */ o(lo, { editor: q }),
1063
+ Z.compare && (I === "canvas" || !x) && /* @__PURE__ */ o(Br, { compare: Z.compare, onClose: Z.close }),
1064
+ t && x && I === "states" ? /* @__PURE__ */ o(
1065
+ Io,
1060
1066
  {
1061
1067
  bundle: t,
1062
1068
  parent: T,
@@ -1064,81 +1070,81 @@ function us({
1064
1070
  apply: n.apply,
1065
1071
  onSelect: A
1066
1072
  }
1067
- ) : t && w && K === "roles" ? /* @__PURE__ */ o(
1068
- Po,
1073
+ ) : t && x && I === "roles" ? /* @__PURE__ */ o(
1074
+ Ko,
1069
1075
  {
1070
1076
  bundle: t,
1071
1077
  parent: T,
1072
1078
  apply: n.apply,
1073
1079
  onSelect: A
1074
1080
  }
1075
- ) : t && w && K === "table" ? /* @__PURE__ */ o(
1076
- Ho,
1081
+ ) : t && x && I === "table" ? /* @__PURE__ */ o(
1082
+ Yo,
1077
1083
  {
1078
1084
  bundle: t,
1079
1085
  collection: r,
1080
1086
  apply: n.apply,
1081
1087
  flush: n.flush,
1082
- selection: y,
1088
+ selection: h,
1083
1089
  onSelect: A,
1084
1090
  onSelection: L
1085
1091
  }
1086
1092
  ) : t ? /* @__PURE__ */ o(
1087
1093
  "div",
1088
1094
  {
1089
- "data-canvas-density": x.compact && w ? "compact" : "normal",
1090
- style: x.compact && w ? { zoom: Mo } : void 0,
1095
+ "data-canvas-density": S.compact && x ? "compact" : "normal",
1096
+ style: S.compact && x ? { zoom: zo } : void 0,
1091
1097
  className: G(
1092
1098
  "min-h-full",
1093
- so(Ee, Fe),
1094
- Ee && !Fe && "bg-background text-foreground"
1099
+ po(De, Fe),
1100
+ De && !Fe && "bg-background text-foreground"
1095
1101
  ),
1096
1102
  children: /* @__PURE__ */ o(
1097
- Yo,
1103
+ rn,
1098
1104
  {
1099
1105
  collection: r,
1100
1106
  bundle: t,
1101
1107
  parent: T,
1102
- preview: D,
1103
- onPreview: Y,
1108
+ preview: K,
1109
+ onPreview: J,
1104
1110
  record: k,
1105
1111
  fields: _,
1106
1112
  renderPane: (e) => /* @__PURE__ */ o(
1107
- Ln,
1113
+ In,
1108
1114
  {
1109
1115
  collection: r,
1110
1116
  bundle: t,
1111
1117
  parent: T,
1112
1118
  roleId: e.roleId,
1113
1119
  stateKey: e.stateKey,
1114
- marks: Et(e.marks),
1120
+ marks: Ft(e.marks),
1115
1121
  overlay: q.overlay(e.overlay),
1116
- ruleMarks: Ut,
1117
- ghost: zt,
1118
- deps: ke.deps,
1122
+ ruleMarks: Vt,
1123
+ ghost: Ht,
1124
+ deps: we.deps,
1119
1125
  noDnd: e.noDnd,
1120
1126
  record: e.record,
1121
1127
  selected: re,
1122
- selection: y,
1123
- onSelect: qt,
1124
- showHidden: ge,
1125
- fold: x.fold,
1126
- reveal: x.reveal,
1128
+ selection: h,
1129
+ onSelect: $t,
1130
+ showHidden: ve,
1131
+ fold: S.fold,
1132
+ reveal: S.reveal,
1127
1133
  apply: n.apply,
1128
1134
  whenIdle: n.whenIdle,
1129
- fillRate: Te,
1130
- unsaved: Wt,
1131
- peers: Ht,
1135
+ fillRate: Oe,
1136
+ unsaved: Gt,
1137
+ peers: jt,
1132
1138
  compare: Z.compare,
1133
- lastChanges: Z.compare ? void 0 : Lt
1139
+ lastChanges: Z.compare ? void 0 : Et
1134
1140
  }
1135
1141
  )
1136
1142
  }
1137
1143
  )
1138
1144
  }
1139
- ) : n.error ? /* @__PURE__ */ o("p", { className: "p-6 text-[13px] text-red-700 dark:text-red-300", children: n.error }) : /* @__PURE__ */ h("div", { className: "flex flex-col gap-3 p-6", children: [
1140
- /* @__PURE__ */ o(gt, { className: "h-10 w-full rounded-lg" }),
1141
- /* @__PURE__ */ o(gt, { className: "h-48 w-full rounded-lg" })
1145
+ ) : n.error ? /* @__PURE__ */ o("p", { className: "p-6 text-[13px] text-red-700 dark:text-red-300", children: n.error }) : /* @__PURE__ */ y("div", { className: "flex flex-col gap-3 p-6", children: [
1146
+ /* @__PURE__ */ o(wt, { className: "h-10 w-full rounded-lg" }),
1147
+ /* @__PURE__ */ o(wt, { className: "h-48 w-full rounded-lg" })
1142
1148
  ] })
1143
1149
  ] }),
1144
1150
  /* @__PURE__ */ o(
@@ -1147,54 +1153,54 @@ function us({
1147
1153
  "data-editor-inspector": "",
1148
1154
  className: "flex w-[344px] shrink-0 flex-col overflow-hidden border-l border-slate-200 bg-white dark:border-border dark:bg-card",
1149
1155
  children: t && (V === "ask" ? /* @__PURE__ */ o(
1150
- Tr,
1156
+ Rr,
1151
1157
  {
1152
1158
  layoutId: u,
1153
- layoutName: xe,
1154
- kind: nn(t.layout),
1159
+ layoutName: Se,
1160
+ kind: cn(t.layout),
1155
1161
  bundle: t,
1156
- thread: Ce,
1157
- setThread: he,
1158
- pending: ve,
1159
- onPendingTaken: () => ce(null),
1160
- jump: Yt,
1161
- onCite: Zt,
1162
- recordId: ((yt = D.record) == null ? void 0 : yt.id) ?? null
1162
+ thread: Te,
1163
+ setThread: ye,
1164
+ pending: he,
1165
+ onPendingTaken: () => de(null),
1166
+ jump: Xt,
1167
+ onCite: er,
1168
+ recordId: ((ht = K.record) == null ? void 0 : ht.id) ?? null
1163
1169
  }
1164
1170
  ) : V === "checks" ? /* @__PURE__ */ o(
1165
- Oo,
1171
+ Do,
1166
1172
  {
1167
- findings: oe.findings,
1168
- health: oe.health,
1169
- ready: oe.ready,
1173
+ findings: ke.findings,
1174
+ health: ke.health,
1175
+ ready: ke.ready,
1170
1176
  onSelect: (e) => L([e]),
1171
1177
  apply: n.apply,
1172
- onOpenAiReview: p.aiReviewSlot ? () => N("settings") : void 0
1178
+ onOpenAiReview: p.aiReviewSlot ? () => P("settings") : void 0
1173
1179
  }
1174
1180
  ) : V === "settings" ? /* @__PURE__ */ o(
1175
- wn,
1181
+ On,
1176
1182
  {
1177
1183
  bundle: t,
1178
1184
  apply: n.apply,
1179
1185
  flush: n.flush,
1180
1186
  collection: r,
1181
- previewRoleId: D.roleId,
1182
- onPreviewRoleChange: Qt,
1187
+ previewRoleId: K.roleId,
1188
+ onPreviewRoleChange: Jt,
1183
1189
  onAskWhere: p.isAdmin ? (e) => {
1184
- ce(e), N("ask");
1190
+ de(e), P("ask");
1185
1191
  } : void 0
1186
1192
  }
1187
- ) : y.length > 1 ? /* @__PURE__ */ o(
1188
- xo,
1193
+ ) : h.length > 1 ? /* @__PURE__ */ o(
1194
+ Ao,
1189
1195
  {
1190
1196
  bundle: t,
1191
- selection: y,
1197
+ selection: h,
1192
1198
  apply: n.apply,
1193
1199
  collection: r,
1194
1200
  onSelection: L
1195
1201
  }
1196
1202
  ) : /* @__PURE__ */ o(
1197
- xn,
1203
+ An,
1198
1204
  {
1199
1205
  bundle: t,
1200
1206
  target: re,
@@ -1202,7 +1208,7 @@ function us({
1202
1208
  flush: n.flush,
1203
1209
  collection: r,
1204
1210
  openLayout: ee,
1205
- onSelect: x.selectAndReveal
1211
+ onSelect: S.selectAndReveal
1206
1212
  }
1207
1213
  ))
1208
1214
  }
@@ -1211,53 +1217,53 @@ function us({
1211
1217
  }
1212
1218
  ),
1213
1219
  /* @__PURE__ */ o(
1214
- tn,
1220
+ sn,
1215
1221
  {
1216
1222
  bundle: t,
1217
- selection: y,
1223
+ selection: h,
1218
1224
  apply: n.apply,
1219
1225
  onSelection: L,
1220
- rootRef: U
1226
+ rootRef: $
1221
1227
  }
1222
1228
  ),
1223
1229
  /* @__PURE__ */ o(
1224
- un,
1230
+ hn,
1225
1231
  {
1226
- request: Kt,
1232
+ request: _t,
1227
1233
  count: n.unsavedCount,
1228
- onSave: Dt,
1234
+ onSave: Mt,
1229
1235
  onDiscard: n.discard,
1230
- onKeep: () => je(null),
1231
- note: F ? /* @__PURE__ */ o(_r, { policy: F, value: me, onChange: Ne }) : void 0,
1232
- canSave: Dr(F, me)
1236
+ onKeep: () => Ge(null),
1237
+ note: D ? /* @__PURE__ */ o($r, { policy: D, value: pe, onChange: Pe }) : void 0,
1238
+ canSave: Ur(D, pe)
1233
1239
  }
1234
1240
  ),
1235
- F && ze && /* @__PURE__ */ o(
1236
- Mr,
1241
+ D && Ve && /* @__PURE__ */ o(
1242
+ zr,
1237
1243
  {
1238
1244
  open: !0,
1239
- anchor: ze,
1240
- policy: F,
1241
- intro: X ? Tt(X) : void 0,
1245
+ anchor: Ve,
1246
+ policy: D,
1247
+ intro: X ? At(X) : void 0,
1242
1248
  count: n.unsavedCount,
1243
- value: me,
1244
- onChange: Ne,
1245
- onSave: He,
1246
- onClose: () => Ve(null)
1249
+ value: pe,
1250
+ onChange: Pe,
1251
+ onSave: We,
1252
+ onClose: () => He(null)
1247
1253
  }
1248
1254
  ),
1249
- rt && /* @__PURE__ */ o(
1250
- Ur,
1255
+ ot && /* @__PURE__ */ o(
1256
+ jr,
1251
1257
  {
1252
- anchor: rt,
1258
+ anchor: ot,
1253
1259
  steps: n.unsavedSteps,
1254
- exists: (e) => !!t && Be(e, t, T),
1255
- describe: (e) => Ct(e, t, _),
1260
+ exists: (e) => !!t && qe(e, t, T),
1261
+ describe: (e) => Ot(e, t, _),
1256
1262
  onJump: (e) => {
1257
- be(null), ot(e);
1263
+ be(null), nt(e);
1258
1264
  },
1259
1265
  onSettings: () => {
1260
- be(null), N("settings");
1266
+ be(null), P("settings");
1261
1267
  },
1262
1268
  onClose: () => be(null)
1263
1269
  }
@@ -1265,20 +1271,20 @@ function us({
1265
1271
  ]
1266
1272
  }
1267
1273
  );
1268
- if (!ae)
1269
- return /* @__PURE__ */ o(wt.Provider, { value: Ie, children: lt });
1270
- const dt = c ?? (Le ? gr(Le) ?? document.body : null);
1271
- return /* @__PURE__ */ h(de, { children: [
1272
- /* @__PURE__ */ o("span", { ref: _t, hidden: !0, "data-layout-editor-marker": "" }),
1273
- /* @__PURE__ */ o(wt.Provider, { value: Ie, children: dt && ur(lt, dt) })
1274
+ if (!ne)
1275
+ return /* @__PURE__ */ o(St.Provider, { value: Ie, children: dt });
1276
+ const ct = c ?? (Le ? Sr(Le) ?? document.body : null);
1277
+ return /* @__PURE__ */ y(ae, { children: [
1278
+ /* @__PURE__ */ o("span", { ref: Bt, hidden: !0, "data-layout-editor-marker": "" }),
1279
+ /* @__PURE__ */ o(St.Provider, { value: Ie, children: ct && mr(dt, ct) })
1274
1280
  ] });
1275
1281
  }
1276
- function Tt(r) {
1282
+ function At(r) {
1277
1283
  const l = r.reason.trim() ? `: ${r.reason.trim()}` : "";
1278
- return `Frozen until ${hr(r.until)}${l}. Saving asks for an override note, kept in History.`;
1284
+ return `Frozen until ${gr(r.until)}${l}. Saving asks for an override note, kept in History.`;
1279
1285
  }
1280
1286
  export {
1281
- us as LayoutEditor,
1287
+ vs as LayoutEditor,
1282
1288
  $e as isTyping,
1283
- Be as targetExists
1289
+ qe as targetExists
1284
1290
  };