@nivaro/react 0.3.36 → 0.3.37

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