@nivaro/react 0.2.53 → 0.2.55

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 (294) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +99 -98
  3. package/dist/index.d.ts +452 -4
  4. package/dist/index.js +644 -618
  5. package/dist/layout-editor.d.ts +252 -2
  6. package/dist/shared/components/BackgroundRunOffer.js +117 -0
  7. package/dist/shared/components/BroadcastView.js +214 -213
  8. package/dist/shared/components/CollectionBrowserView.js +2592 -2695
  9. package/dist/shared/components/FormWhatsNew.js +60 -0
  10. package/dist/shared/components/ItemEditForm.js +3968 -3618
  11. package/dist/shared/components/JobsTray.js +100 -55
  12. package/dist/shared/components/MyWorkView.js +91 -89
  13. package/dist/shared/components/NotificationBell.js +80 -79
  14. package/dist/shared/components/ProfileView.js +568 -520
  15. package/dist/shared/components/RecordCompare.js +254 -0
  16. package/dist/shared/components/RecordReadView.js +598 -543
  17. package/dist/shared/components/ReportView.js +578 -543
  18. package/dist/shared/components/RowPresence.js +91 -0
  19. package/dist/shared/components/TipLayer.js +27 -27
  20. package/dist/shared/components/WidgetSlot.js +474 -458
  21. package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
  22. package/dist/shared/components/ai/AskPanel.js +139 -119
  23. package/dist/shared/components/ai/FirstWeekCard.js +126 -0
  24. package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
  25. package/dist/shared/components/bulk/bulk-field-options.js +45 -0
  26. package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
  27. package/dist/shared/components/chat/ChannelArchive.js +326 -0
  28. package/dist/shared/components/chat/ChannelExtras.js +141 -121
  29. package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
  30. package/dist/shared/components/chat/ChatPanel.js +1695 -1733
  31. package/dist/shared/components/chat/Composer.js +357 -303
  32. package/dist/shared/components/chat/MessageActions.js +92 -0
  33. package/dist/shared/components/chat/MessageFormat.js +290 -264
  34. package/dist/shared/components/chat/OutboxBubbles.js +146 -0
  35. package/dist/shared/components/chat/RequestIdCard.js +135 -0
  36. package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
  37. package/dist/shared/components/chat/RoomParts.js +213 -274
  38. package/dist/shared/components/chat/ScreenClip.js +184 -0
  39. package/dist/shared/components/chat/chat-core.js +402 -483
  40. package/dist/shared/components/chat/chat-drafts.js +59 -0
  41. package/dist/shared/components/chat/chat-emoji.js +348 -0
  42. package/dist/shared/components/chat/chat-local-time.js +41 -0
  43. package/dist/shared/components/chat/chat-outbox.js +303 -0
  44. package/dist/shared/components/chat/chat-window.js +163 -0
  45. package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
  46. package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
  47. package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
  48. package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
  49. package/dist/shared/components/help-videos/api.js +80 -67
  50. package/dist/shared/components/help-videos/editor/DetailsTab.js +147 -130
  51. package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
  52. package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
  53. package/dist/shared/components/item-edit/FieldAffordances.js +9 -8
  54. package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
  55. package/dist/shared/components/item-edit/FieldRow.js +382 -320
  56. package/dist/shared/components/item-edit/FormHelpVideoButton.js +59 -0
  57. package/dist/shared/components/item-edit/GroupSection.js +786 -639
  58. package/dist/shared/components/item-edit/HeaderTools.js +59 -56
  59. package/dist/shared/components/item-edit/InlineTableField.js +3 -1
  60. package/dist/shared/components/item-edit/LayoutContentBlock.js +47 -24
  61. package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
  62. package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
  63. package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
  64. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
  65. package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
  66. package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
  67. package/dist/shared/components/item-edit/lazy-sections.js +36 -0
  68. package/dist/shared/components/item-edit/lock-why.js +94 -0
  69. package/dist/shared/components/item-edit/picker-miss.js +26 -0
  70. package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
  71. package/dist/shared/components/item-edit/useFormUsageBeacon.js +65 -0
  72. package/dist/shared/components/layout-editor/AddPanel.js +226 -151
  73. package/dist/shared/components/layout-editor/ArrangeButton.js +34 -0
  74. package/dist/shared/components/layout-editor/AutoArrange.js +86 -0
  75. package/dist/shared/components/layout-editor/CanvasCompare.js +79 -0
  76. package/dist/shared/components/layout-editor/ChangeNote.js +147 -0
  77. package/dist/shared/components/layout-editor/CollabParts.js +175 -0
  78. package/dist/shared/components/layout-editor/DesignNode.js +311 -116
  79. package/dist/shared/components/layout-editor/EditorCanvas.js +30 -26
  80. package/dist/shared/components/layout-editor/EditorTopBar.js +463 -175
  81. package/dist/shared/components/layout-editor/FindReplace.js +188 -0
  82. package/dist/shared/components/layout-editor/FormMapButton.js +141 -0
  83. package/dist/shared/components/layout-editor/HistoryPanel.js +250 -109
  84. package/dist/shared/components/layout-editor/LayoutEditor.js +1196 -305
  85. package/dist/shared/components/layout-editor/LayoutsRail.js +94 -67
  86. package/dist/shared/components/layout-editor/NoteMarker.js +38 -0
  87. package/dist/shared/components/layout-editor/PlacementsTable.js +187 -0
  88. package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
  89. package/dist/shared/components/layout-editor/ScheduleChange.js +106 -0
  90. package/dist/shared/components/layout-editor/SessionHistory.js +84 -0
  91. package/dist/shared/components/layout-editor/StagedChip.js +22 -0
  92. package/dist/shared/components/layout-editor/StructureMenu.js +464 -0
  93. package/dist/shared/components/layout-editor/UnsavedConfirm.js +103 -0
  94. package/dist/shared/components/layout-editor/ai/AiToolsButton.js +625 -0
  95. package/dist/shared/components/layout-editor/ai/ChangeCheck.js +153 -0
  96. package/dist/shared/components/layout-editor/ai/ai-tools-api.js +80 -0
  97. package/dist/shared/components/layout-editor/ai/assist-ops.js +38 -0
  98. package/dist/shared/components/layout-editor/ai/autofill-ops.js +73 -0
  99. package/dist/shared/components/layout-editor/ai/canvas-capture.js +41 -0
  100. package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +271 -0
  101. package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +182 -0
  102. package/dist/shared/components/layout-editor/ai-forms/MeaningSuggestions.js +109 -0
  103. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +170 -0
  104. package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +40 -0
  105. package/dist/shared/components/layout-editor/ai-forms/pending.js +25 -0
  106. package/dist/shared/components/layout-editor/ai-forms/plan.js +263 -0
  107. package/dist/shared/components/layout-editor/ai-rules/AiAskPopover.js +160 -0
  108. package/dist/shared/components/layout-editor/ai-rules/CascadeWriter.js +175 -0
  109. package/dist/shared/components/layout-editor/ai-rules/FieldRuleWriter.js +97 -0
  110. package/dist/shared/components/layout-editor/ai-rules/RuleWriter.js +94 -0
  111. package/dist/shared/components/layout-editor/ai-rules/ValidationSuggest.js +153 -0
  112. package/dist/shared/components/layout-editor/ai-rules/api.js +6 -0
  113. package/dist/shared/components/layout-editor/ai-text/AiTextTools.js +383 -0
  114. package/dist/shared/components/layout-editor/ai-text/text-ops.js +125 -0
  115. package/dist/shared/components/layout-editor/assist/AskPanel.js +278 -0
  116. package/dist/shared/components/layout-editor/assist/ExplainDiff.js +93 -0
  117. package/dist/shared/components/layout-editor/assist/ProposalsButton.js +150 -0
  118. package/dist/shared/components/layout-editor/assist/assist-api.js +63 -0
  119. package/dist/shared/components/layout-editor/assist/jump.js +142 -0
  120. package/dist/shared/components/layout-editor/assist/settings-index.js +118 -0
  121. package/dist/shared/components/layout-editor/auto-arrange.js +101 -0
  122. package/dist/shared/components/layout-editor/bulk/BulkChangesButton.js +221 -0
  123. package/dist/shared/components/layout-editor/bulk/BulkRun.js +237 -0
  124. package/dist/shared/components/layout-editor/bulk/MacrosPanel.js +230 -0
  125. package/dist/shared/components/layout-editor/bulk/bulk-api.js +65 -0
  126. package/dist/shared/components/layout-editor/bulk/field-labels.js +22 -0
  127. package/dist/shared/components/layout-editor/bulk/macro-record.js +142 -0
  128. package/dist/shared/components/layout-editor/bulk/useMacroRecorder.js +65 -0
  129. package/dist/shared/components/layout-editor/bundle-to-active.js +1 -0
  130. package/dist/shared/components/layout-editor/canvas-diff.js +157 -0
  131. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +388 -0
  132. package/dist/shared/components/layout-editor/collab/collab-api.js +80 -0
  133. package/dist/shared/components/layout-editor/commands/CommandPalette.js +221 -0
  134. package/dist/shared/components/layout-editor/commands/intents.js +214 -0
  135. package/dist/shared/components/layout-editor/commands/parse.js +242 -0
  136. package/dist/shared/components/layout-editor/design-context.js +26 -6
  137. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +181 -164
  138. package/dist/shared/components/layout-editor/dnd/collision.js +25 -23
  139. package/dist/shared/components/layout-editor/dnd/node.js +69 -57
  140. package/dist/shared/components/layout-editor/dnd/rail-drop.js +56 -0
  141. package/dist/shared/components/layout-editor/draft-recovery.js +131 -0
  142. package/dist/shared/components/layout-editor/editor-notes.js +78 -0
  143. package/dist/shared/components/layout-editor/editors/swap-config.js +1 -0
  144. package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
  145. package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
  146. package/dist/shared/components/layout-editor/entry/presets.js +71 -0
  147. package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
  148. package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
  149. package/dist/shared/components/layout-editor/explain/CanvasRules.js +142 -0
  150. package/dist/shared/components/layout-editor/explain/default-ghosts.js +81 -0
  151. package/dist/shared/components/layout-editor/explain/driver-hover.js +62 -0
  152. package/dist/shared/components/layout-editor/explain/field-sources.js +246 -0
  153. package/dist/shared/components/layout-editor/explain/rule-graph.js +215 -0
  154. package/dist/shared/components/layout-editor/explain/use-explain.js +132 -0
  155. package/dist/shared/components/layout-editor/field-zones.js +116 -0
  156. package/dist/shared/components/layout-editor/form-map.js +138 -0
  157. package/dist/shared/components/layout-editor/grid-guides.js +142 -0
  158. package/dist/shared/components/layout-editor/history-api.js +87 -0
  159. package/dist/shared/components/layout-editor/inheritance.js +55 -0
  160. package/dist/shared/components/layout-editor/inspect/inspect-api.js +66 -0
  161. package/dist/shared/components/layout-editor/inspect/picker-preview.js +48 -0
  162. package/dist/shared/components/layout-editor/inspect/width-fit.js +87 -0
  163. package/dist/shared/components/layout-editor/inspector/AiFillSetting.js +85 -0
  164. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
  165. package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +36 -0
  166. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +179 -0
  167. package/dist/shared/components/layout-editor/inspector/ColumnFit.js +112 -0
  168. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +291 -141
  169. package/dist/shared/components/layout-editor/inspector/HelpTab.js +174 -0
  170. package/dist/shared/components/layout-editor/inspector/Inspector.js +282 -180
  171. package/dist/shared/components/layout-editor/inspector/LookTab.js +166 -109
  172. package/dist/shared/components/layout-editor/inspector/OverrideNotice.js +61 -0
  173. package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
  174. package/dist/shared/components/layout-editor/inspector/PickerPreview.js +134 -0
  175. package/dist/shared/components/layout-editor/inspector/PickerTab.js +146 -118
  176. package/dist/shared/components/layout-editor/inspector/RulesTab.js +162 -111
  177. package/dist/shared/components/layout-editor/inspector/Translations.js +156 -0
  178. package/dist/shared/components/layout-editor/inspector/kit.js +71 -70
  179. package/dist/shared/components/layout-editor/inspector/tab-request.js +21 -0
  180. package/dist/shared/components/layout-editor/is-typing.js +9 -0
  181. package/dist/shared/components/layout-editor/keyboard-move.js +66 -0
  182. package/dist/shared/components/layout-editor/lint/LintPanel.js +190 -0
  183. package/dist/shared/components/layout-editor/lint/lint-api.js +52 -0
  184. package/dist/shared/components/layout-editor/load-error.js +37 -0
  185. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +305 -0
  186. package/dist/shared/components/layout-editor/matrix/MatrixGrid.js +181 -0
  187. package/dist/shared/components/layout-editor/matrix/RoleSectionMatrix.js +147 -0
  188. package/dist/shared/components/layout-editor/matrix/matrix-api.js +48 -0
  189. package/dist/shared/components/layout-editor/matrix/role-matrix.js +36 -0
  190. package/dist/shared/components/layout-editor/matrix/state-matrix.js +145 -0
  191. package/dist/shared/components/layout-editor/nav/FindPanel.js +109 -0
  192. package/dist/shared/components/layout-editor/nav/NavTools.js +114 -0
  193. package/dist/shared/components/layout-editor/nav/OutlinePanel.js +228 -0
  194. package/dist/shared/components/layout-editor/nav/ShortcutSheet.js +31 -0
  195. package/dist/shared/components/layout-editor/nav/find.js +20 -0
  196. package/dist/shared/components/layout-editor/nav/tree.js +142 -0
  197. package/dist/shared/components/layout-editor/nav/useEditorNav.js +101 -0
  198. package/dist/shared/components/layout-editor/nav/view-prefs.js +34 -0
  199. package/dist/shared/components/layout-editor/ops/ChangeRequestsPanel.js +143 -0
  200. package/dist/shared/components/layout-editor/ops/DependencyDiagram.js +179 -0
  201. package/dist/shared/components/layout-editor/ops/LayoutOpsBlocks.js +92 -0
  202. package/dist/shared/components/layout-editor/ops/PromotePanel.js +287 -0
  203. package/dist/shared/components/layout-editor/ops/ops-api.js +122 -0
  204. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
  205. package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
  206. package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
  207. package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -3
  208. package/dist/shared/components/layout-editor/overview/describe-conditions.js +24 -14
  209. package/dist/shared/components/layout-editor/overview/overview-api.js +105 -88
  210. package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
  211. package/dist/shared/components/layout-editor/panel-style.js +8 -7
  212. package/dist/shared/components/layout-editor/parity-keys.json.js +4 -0
  213. package/dist/shared/components/layout-editor/pin.js +25 -0
  214. package/dist/shared/components/layout-editor/presence.js +111 -0
  215. package/dist/shared/components/layout-editor/preview/PreviewModes.js +224 -0
  216. package/dist/shared/components/layout-editor/preview/PreviewPanes.js +262 -0
  217. package/dist/shared/components/layout-editor/preview/preview-api.js +57 -0
  218. package/dist/shared/components/layout-editor/preview/preview-model.js +157 -0
  219. package/dist/shared/components/layout-editor/restore-piece.js +192 -0
  220. package/dist/shared/components/layout-editor/reuse/FieldMapStep.js +70 -0
  221. package/dist/shared/components/layout-editor/reuse/FormMoreMenu.js +127 -0
  222. package/dist/shared/components/layout-editor/reuse/LibraryRows.js +150 -0
  223. package/dist/shared/components/layout-editor/reuse/NewFormStart.js +20 -0
  224. package/dist/shared/components/layout-editor/reuse/SectionReuseActions.js +291 -0
  225. package/dist/shared/components/layout-editor/reuse/field-match.js +77 -0
  226. package/dist/shared/components/layout-editor/reuse/reuse-api.js +73 -0
  227. package/dist/shared/components/layout-editor/reuse/seed.js +13 -0
  228. package/dist/shared/components/layout-editor/reuse/useFormFromRecord.js +43 -0
  229. package/dist/shared/components/layout-editor/reuse/useRailCopy.js +34 -0
  230. package/dist/shared/components/layout-editor/section-structure.js +241 -0
  231. package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
  232. package/dist/shared/components/layout-editor/settings/FormSettings.js +125 -103
  233. package/dist/shared/components/layout-editor/settings/InheritanceSection.js +1 -1
  234. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
  235. package/dist/shared/components/layout-editor/settings/ToolsSection.js +215 -105
  236. package/dist/shared/components/layout-editor/settings/WhoSection.js +139 -100
  237. package/dist/shared/components/layout-editor/settings/controls.js +8 -8
  238. package/dist/shared/components/layout-editor/settings/settings-registry.js +142 -21
  239. package/dist/shared/components/layout-editor/shortcuts.js +88 -0
  240. package/dist/shared/components/layout-editor/show-when.js +35 -0
  241. package/dist/shared/components/layout-editor/slot-names.js +4 -3
  242. package/dist/shared/components/layout-editor/staged-api.js +64 -0
  243. package/dist/shared/components/layout-editor/structure-ops.js +403 -0
  244. package/dist/shared/components/layout-editor/testing/CostLimitSetting.js +42 -0
  245. package/dist/shared/components/layout-editor/testing/TestingPanels.js +556 -0
  246. package/dist/shared/components/layout-editor/testing/testing-api.js +67 -0
  247. package/dist/shared/components/layout-editor/testing/testing-model.js +406 -0
  248. package/dist/shared/components/layout-editor/testing/use-record-check.js +44 -0
  249. package/dist/shared/components/layout-editor/toolbar-kit.js +242 -0
  250. package/dist/shared/components/layout-editor/unsaved-marks.js +72 -0
  251. package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
  252. package/dist/shared/components/layout-editor/usage/FillChip.js +27 -0
  253. package/dist/shared/components/layout-editor/usage/UsagePanel.js +232 -0
  254. package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
  255. package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
  256. package/dist/shared/components/layout-editor/usage/suggest-sections.js +55 -0
  257. package/dist/shared/components/layout-editor/usage/usage-api.js +104 -0
  258. package/dist/shared/components/layout-editor/useLayoutDraft.js +573 -306
  259. package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
  260. package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
  261. package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
  262. package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
  263. package/dist/shared/components/profile/AgentsPanel.js +479 -0
  264. package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
  265. package/dist/shared/components/support/SuggestFormChange.js +143 -0
  266. package/dist/shared/components/support/SupportAnalytics.js +171 -0
  267. package/dist/shared/components/support/SupportView.js +75 -73
  268. package/dist/shared/lib/ai-fill.js +37 -0
  269. package/dist/shared/lib/background-runs.js +150 -0
  270. package/dist/shared/lib/delivery-ack.js +9 -0
  271. package/dist/shared/lib/entry-badge-style.js +13 -0
  272. package/dist/shared/lib/entry-config.js +71 -0
  273. package/dist/shared/lib/form-sections.js +64 -0
  274. package/dist/shared/lib/form-structure.js +99 -0
  275. package/dist/shared/lib/form-usage-beacon.js +133 -0
  276. package/dist/shared/lib/jobs-tray.js +25 -23
  277. package/dist/shared/lib/keyset-pager.js +37 -0
  278. package/dist/shared/lib/layout-i18n.js +66 -0
  279. package/dist/shared/lib/layout-lint.js +490 -0
  280. package/dist/shared/lib/layout-ops.js +116 -110
  281. package/dist/shared/lib/layout-resolve.js +113 -0
  282. package/dist/shared/lib/placement-behaviour.js +144 -0
  283. package/dist/shared/lib/prefetch.js +149 -0
  284. package/dist/shared/lib/presence-hooks.js +199 -0
  285. package/dist/shared/lib/record-outbox.js +82 -81
  286. package/dist/shared/lib/replay-socket.js +93 -0
  287. package/dist/shared/lib/request-gate.js +51 -50
  288. package/dist/shared/lib/room-gaps.js +96 -0
  289. package/dist/shared/lib/screenshot.js +54 -28
  290. package/dist/shared/lib/search-log.js +27 -0
  291. package/dist/shared/lib/socket-realtime.js +101 -80
  292. package/dist/shared/lib/visible-when.js +34 -0
  293. package/dist/shared/lib/worker-socket.js +200 -0
  294. package/package.json +1 -1
@@ -0,0 +1,106 @@
1
+ import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
+ import { CalendarClock as A } from "lucide-react";
3
+ import { useState as u } from "react";
4
+ import { toast as g } from "sonner";
5
+ import { formatDateTime as N } from "../../lib/utils.js";
6
+ import { Popover as D, PopoverContent as _ } from "../ui/popover.js";
7
+ import { toLocalInput as x, useLayoutSchedules as L, useScheduleActions as j, fromLocalInput as b } from "./history-api.js";
8
+ import { ToolButton as O, barBtn as P } from "./toolbar-kit.js";
9
+ import { unsavedText as T } from "./UnsavedConfirm.js";
10
+ import { useLayoutBundle as $, parseSaveFailure as B } from "./useLayoutDraft.js";
11
+ const y = "h-8 w-full rounded-md border border-slate-200 bg-white px-2.5 text-[12.5px] text-slate-800 outline-none placeholder:text-slate-400 focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-foreground dark:placeholder:text-muted-foreground", v = "mb-1 block text-[11.5px] font-semibold text-slate-600 dark:text-muted-foreground";
12
+ function F(o = /* @__PURE__ */ new Date()) {
13
+ const n = new Date(o);
14
+ return n.setDate(n.getDate() + 1), n.setHours(9, 0, 0, 0), n;
15
+ }
16
+ function W(o) {
17
+ return N(o.run_at);
18
+ }
19
+ function R({
20
+ collection: o,
21
+ layoutId: n,
22
+ draft: s
23
+ }) {
24
+ const [h, r] = u(!1), [l, w] = u(() => x(F())), [p, m] = u(""), { data: d } = $(n), { data: k = [] } = L(o, h), { create: i } = j(o), f = k.filter((e) => e.layout_id === n && e.status === "pending"), c = s.unsavedCount, C = () => {
25
+ const e = b(l);
26
+ !e || !d || i.mutate(
27
+ { layoutId: n, ops: s.unsavedOps(), base_rev: d.rev, run_at: e, note: p },
28
+ {
29
+ onSuccess: () => {
30
+ s.discard(), r(!1), m(""), g.success(`Scheduled for ${N(e)}`);
31
+ },
32
+ onError: (S) => g.error(B(S, "Not scheduled").message)
33
+ }
34
+ );
35
+ };
36
+ return /* @__PURE__ */ a(D, { open: h, onOpenChange: r, children: [
37
+ /* @__PURE__ */ t(
38
+ O,
39
+ {
40
+ popover: !0,
41
+ onOpen: () => r(!0),
42
+ label: "Schedule…",
43
+ icon: /* @__PURE__ */ t(A, { className: "h-3.5 w-3.5" }),
44
+ tip: "Apply these changes at a later time instead of now",
45
+ hint: "Apply these changes at a later time",
46
+ disabled: c === 0,
47
+ data: { "data-editor-schedule": "" }
48
+ }
49
+ ),
50
+ /* @__PURE__ */ a(_, { align: "end", className: "w-[320px] p-3", "data-schedule-popover": "", children: [
51
+ /* @__PURE__ */ a("p", { className: "mb-2 text-[12.5px] text-slate-700 dark:text-foreground", children: [
52
+ "Apply your ",
53
+ T(c),
54
+ " later. They leave the editor now and nobody sees them until then."
55
+ ] }),
56
+ /* @__PURE__ */ t("label", { className: v, htmlFor: "layout-schedule-when", children: "When" }),
57
+ /* @__PURE__ */ t(
58
+ "input",
59
+ {
60
+ id: "layout-schedule-when",
61
+ type: "datetime-local",
62
+ value: l,
63
+ min: x(/* @__PURE__ */ new Date()),
64
+ onChange: (e) => w(e.target.value),
65
+ className: y
66
+ }
67
+ ),
68
+ /* @__PURE__ */ t("label", { className: `${v} mt-2`, htmlFor: "layout-schedule-note", children: "Note (optional)" }),
69
+ /* @__PURE__ */ t(
70
+ "input",
71
+ {
72
+ id: "layout-schedule-note",
73
+ value: p,
74
+ maxLength: 255,
75
+ placeholder: "e.g. New fields for the April release",
76
+ onChange: (e) => m(e.target.value),
77
+ className: y
78
+ }
79
+ ),
80
+ /* @__PURE__ */ t("p", { className: "mt-2 text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", children: "If someone changes this layout before then, your changes still apply when they fit. If one no longer fits, nothing is applied and you are told." }),
81
+ f.length > 0 && /* @__PURE__ */ a("p", { className: "mt-2 text-[11.5px] text-slate-600 dark:text-slate-300", children: [
82
+ "Already scheduled for this form:",
83
+ " ",
84
+ f.map((e) => `${W(e)} (${e.created_by_name ?? "an admin"})`).join(", ")
85
+ ] }),
86
+ /* @__PURE__ */ a("div", { className: "mt-3 flex justify-end gap-2", children: [
87
+ /* @__PURE__ */ t("button", { type: "button", className: P, onClick: () => r(!1), children: "Cancel" }),
88
+ /* @__PURE__ */ t(
89
+ "button",
90
+ {
91
+ type: "button",
92
+ "data-schedule-confirm": "",
93
+ disabled: i.isPending || !b(l) || !d || c === 0,
94
+ onClick: C,
95
+ className: "inline-flex h-8 items-center rounded-md bg-nvr-cyan px-3 text-[12.5px] font-medium text-white transition-opacity hover:opacity-90 disabled:opacity-50",
96
+ children: i.isPending ? "Scheduling…" : "Schedule"
97
+ }
98
+ )
99
+ ] })
100
+ ] })
101
+ ] });
102
+ }
103
+ export {
104
+ R as ScheduleChange,
105
+ W as scheduleWhen
106
+ };
@@ -0,0 +1,84 @@
1
+ import { jsxs as n, jsx as t } from "react/jsx-runtime";
2
+ import { cn as o } from "../../lib/utils.js";
3
+ function p({
4
+ session: c,
5
+ onJump: r
6
+ }) {
7
+ const { done: e, undone: d } = c;
8
+ if (e.length === 0 && d.length === 0) return null;
9
+ const i = "flex w-full items-center gap-2 rounded px-2 py-1 text-left text-[12px] transition-colors hover:bg-muted";
10
+ return /* @__PURE__ */ n("section", { "data-session-history": "", "aria-label": "This session", children: [
11
+ /* @__PURE__ */ t("p", { className: "mb-1 text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "This session" }),
12
+ /* @__PURE__ */ n("ol", { className: "max-h-56 space-y-px overflow-y-auto", children: [
13
+ /* @__PURE__ */ t("li", { children: /* @__PURE__ */ n(
14
+ "button",
15
+ {
16
+ type: "button",
17
+ "data-session-step": "start",
18
+ disabled: e.length === 0,
19
+ "aria-current": e.length === 0 ? "step" : void 0,
20
+ onClick: () => r(-e.length),
21
+ className: o(
22
+ i,
23
+ "text-slate-500 dark:text-slate-400",
24
+ e.length === 0 && "bg-accent font-medium text-slate-900 dark:text-foreground"
25
+ ),
26
+ "data-tip": "The layout as it was when you opened it (or since the last reload)",
27
+ children: [
28
+ /* @__PURE__ */ t("span", { className: "min-w-0 flex-1", children: "Start of session" }),
29
+ e.length === 0 && /* @__PURE__ */ t("span", { className: "shrink-0 text-[10.5px]", children: "now" })
30
+ ]
31
+ }
32
+ ) }),
33
+ e.map((s, a) => {
34
+ const l = a === e.length - 1;
35
+ return (
36
+ // biome-ignore lint/suspicious/noArrayIndexKey: steps are positional
37
+ /* @__PURE__ */ t("li", { children: /* @__PURE__ */ n(
38
+ "button",
39
+ {
40
+ type: "button",
41
+ "data-session-step": a,
42
+ "data-step-state": s.state,
43
+ "aria-current": l ? "step" : void 0,
44
+ disabled: l,
45
+ onClick: () => r(-(e.length - 1 - a)),
46
+ className: o(
47
+ i,
48
+ "text-slate-700 dark:text-slate-200",
49
+ l && "bg-accent font-medium text-slate-900 dark:text-foreground"
50
+ ),
51
+ children: [
52
+ /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children: s.label }),
53
+ s.state === "unsaved" && /* @__PURE__ */ t("span", { className: "shrink-0 rounded bg-nvr-cyan/10 px-1 text-[10.5px] text-slate-700 dark:text-foreground", children: "unsaved" }),
54
+ s.state === "saving" && /* @__PURE__ */ t("span", { className: "shrink-0 text-[10.5px] text-slate-500 dark:text-slate-400", children: "saving…" }),
55
+ s.state === "saved" && /* @__PURE__ */ t("span", { className: "shrink-0 text-[10.5px] text-slate-400 dark:text-slate-500", children: "saved" }),
56
+ l && /* @__PURE__ */ t("span", { className: "shrink-0 text-[10.5px] text-slate-500 dark:text-slate-400", children: "now" })
57
+ ]
58
+ }
59
+ ) }, `d${a}`)
60
+ );
61
+ }),
62
+ d.map((s, a) => (
63
+ // biome-ignore lint/suspicious/noArrayIndexKey: steps are positional
64
+ /* @__PURE__ */ t("li", { children: /* @__PURE__ */ n(
65
+ "button",
66
+ {
67
+ type: "button",
68
+ "data-session-undone": a,
69
+ onClick: () => r(a + 1),
70
+ className: o(i, "text-slate-400 dark:text-slate-500"),
71
+ "data-tip": "Undone: click to redo up to here",
72
+ children: [
73
+ /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate line-through decoration-slate-300 dark:decoration-slate-600", children: s.label }),
74
+ /* @__PURE__ */ t("span", { className: "shrink-0 text-[10.5px]", children: "undone" })
75
+ ]
76
+ }
77
+ ) }, `u${a}`)
78
+ ))
79
+ ] })
80
+ ] });
81
+ }
82
+ export {
83
+ p as SessionHistory
84
+ };
@@ -0,0 +1,22 @@
1
+ import { jsxs as l, jsx as i } from "react/jsx-runtime";
2
+ import { PencilLine as r } from "lucide-react";
3
+ import { formatRelative as d } from "../../lib/utils.js";
4
+ function g({ others: e }) {
5
+ if (e.length === 0) return null;
6
+ const n = (t) => `${t.step_count} unsaved ${t.step_count === 1 ? "change" : "changes"}`, a = e.map((t) => `${t.name}: ${n(t)}, ${d(t.saved_at)}`), s = e.length === 1 ? `${e[0].name.split(" ")[0]} is drafting` : `${e.length} people are drafting`;
7
+ return /* @__PURE__ */ l(
8
+ "span",
9
+ {
10
+ "data-staged-others": e.length,
11
+ "data-tip": `${a.join(" · ")}. Only they see those changes until they save.`,
12
+ className: "inline-flex h-6 shrink-0 items-center gap-1 whitespace-nowrap rounded-full bg-slate-100 px-2 text-[11px] font-medium text-slate-600 dark:bg-muted dark:text-muted-foreground",
13
+ children: [
14
+ /* @__PURE__ */ i(r, { className: "h-3 w-3" }),
15
+ s
16
+ ]
17
+ }
18
+ );
19
+ }
20
+ export {
21
+ g as StagedByOthers
22
+ };
@@ -0,0 +1,464 @@
1
+ import { jsxs as p, jsx as t, Fragment as Y } from "react/jsx-runtime";
2
+ import { CopyPlus as F, Group as X, SquareSplitVertical as z, Columns3 as Q, Merge as Z, Ungroup as ee, Shuffle as te, ClipboardCopy as ne, PinOff as re, Pin as oe, ArrowLeft as se } from "lucide-react";
3
+ import { useState as O, useRef as ie, useCallback as ae, useEffect as R, useMemo as w } from "react";
4
+ import { toast as A } from "sonner";
5
+ import { stickyGroupKey as le } from "../../lib/form-structure.js";
6
+ import { UNGROUPED_KEY as ce, isCanvasSlot as de } from "../../lib/layout-ops.js";
7
+ import { cn as $, titleCase as ue } from "../../lib/utils.js";
8
+ import { Checkbox as L } from "../ui/checkbox.js";
9
+ import { Popover as pe, PopoverAnchor as me, PopoverContent as fe } from "../ui/popover.js";
10
+ import { STRUCTURE_MENU_EVENT as j, duplicateKeys as he } from "./ArrangeButton.js";
11
+ import { ArrangeButton as dt, openStructureMenu as ut } from "./ArrangeButton.js";
12
+ import { readOverrides as ge } from "./inspector/model.js";
13
+ import { isTyping as ke } from "./is-typing.js";
14
+ import { splitPlan as xe, splitBlocked as ye, rowPlan as ve, rowBlocked as we, joinTarget as Ne, joinPlan as be, joinBlocked as Ce } from "./section-structure.js";
15
+ import { tintCard as Pe, effectText as S } from "./panel-style.js";
16
+ import { duplicatePlan as U, convertChoices as M, groupName as N, rulesOf as K, ruleSet as V, ruleTargets as Se, copyRulesPlan as Ee, RULE_LABELS as Ae, kindWord as T, wrapPlan as Oe, duplicateBlocked as $e, unwrapPlan as Te, unwrapBlocked as _e, pinPlan as De } from "./structure-ops.js";
17
+ import { isPinned as P } from "./pin.js";
18
+ function Re(e) {
19
+ if (!e) return null;
20
+ const s = e.indexOf(":"), o = e.slice(0, s), c = e.slice(s + 1);
21
+ if (o === "group") return { kind: "group", key: c };
22
+ if (o === "header") return { kind: "header", field: c };
23
+ if (o !== "field" && o !== "slot") return null;
24
+ const r = c.lastIndexOf(":"), n = c.slice(r + 1);
25
+ return { kind: o, field: c.slice(0, r), group_key: n === "" ? null : n };
26
+ }
27
+ const Le = (e, s) => ({
28
+ getBoundingClientRect: () => new DOMRect(e, s, 0, 0)
29
+ });
30
+ function it(e, s) {
31
+ return w(() => {
32
+ const o = new Set(e.groups.filter((r) => P(r)).map((r) => r.key)), c = le(
33
+ [...e.groups].filter((r) => r.parent_key === null).sort((r, n) => r.sort - n.sort)
34
+ );
35
+ return (r) => {
36
+ const n = (s == null ? void 0 : s(r)) ?? [];
37
+ if (r.kind !== "group") return n;
38
+ const i = r.key === c ? [
39
+ ...n,
40
+ {
41
+ text: "Sticks to the top",
42
+ tone: "slate",
43
+ tip: "People see this section stay at the top of the form while they scroll the rest (not on phones)."
44
+ }
45
+ ] : n;
46
+ return o.has(r.key) ? [
47
+ ...i,
48
+ {
49
+ text: "Pinned",
50
+ tone: "slate",
51
+ icon: "pin",
52
+ tip: "Pinned in the editor: it does not drag and takes no drops. The form people see is unchanged."
53
+ }
54
+ ] : i;
55
+ };
56
+ }, [e.groups, s]);
57
+ }
58
+ function at({
59
+ bundle: e,
60
+ selection: s,
61
+ apply: o,
62
+ onSelection: c,
63
+ rootRef: r
64
+ }) {
65
+ var h, x;
66
+ const [n, i] = O(null), m = ie({ bundle: e, selection: s, apply: o, onSelection: c });
67
+ m.current = { bundle: e, selection: s, apply: o, onSelection: c };
68
+ const g = ae((d, u = {}) => d.ok ? (m.current.apply(d.ops, { label: d.label }), d.select && m.current.onSelection([d.select]), u.toastNotes && d.notes.length && A.success(d.label, { description: d.notes.join(". ") }), i(null), !0) : (A(d.reason), !1), []);
69
+ R(() => {
70
+ const d = (u) => {
71
+ if (!(u.metaKey || u.ctrlKey) || u.altKey || u.shiftKey || u.key.toLowerCase() !== "d") return;
72
+ const { bundle: a, selection: l } = m.current;
73
+ if (!(!a || l.length === 0 || ke(u.target) || u.defaultPrevented) && !document.querySelector('[data-radix-popper-content-wrapper], [role="menu"]')) {
74
+ if (u.preventDefault(), l.length > 1) {
75
+ A("Duplicate works on one section at a time");
76
+ return;
77
+ }
78
+ g(U(a, l[0]), { toastNotes: !0 });
79
+ }
80
+ };
81
+ return window.addEventListener("keydown", d), () => window.removeEventListener("keydown", d);
82
+ }, [g]), R(() => {
83
+ const d = (l) => {
84
+ var f;
85
+ return !!l && !!((f = r.current) != null && f.contains(l));
86
+ }, u = (l) => {
87
+ var C, D;
88
+ const f = ((D = (C = l.target) == null ? void 0 : C.closest) == null ? void 0 : D.call(C, "[data-design-target]")) ?? null;
89
+ if (!d(f) || !(f != null && f.closest("[data-design-canvas]")) || !m.current.bundle) return;
90
+ const v = Re(f.getAttribute("data-design-target"));
91
+ if (!v) return;
92
+ l.preventDefault();
93
+ const b = m.current.selection, G = f.getAttribute("data-design-target"), _ = b.some((J) => Be(J) === G), H = _ && b.length > 1 ? b : [v];
94
+ (!_ || b.length <= 1) && m.current.onSelection([v]);
95
+ const I = l.button !== 2 && l.clientX === 0 && l.clientY === 0;
96
+ i({
97
+ targets: H,
98
+ anchor: I ? f : Le(l.clientX, l.clientY),
99
+ view: "menu"
100
+ });
101
+ }, a = (l) => {
102
+ const f = l.target;
103
+ if (!d(f)) return;
104
+ const v = l.detail;
105
+ i({ targets: v.targets, anchor: f, view: v.view ?? "menu" });
106
+ };
107
+ return document.addEventListener("contextmenu", u, !0), document.addEventListener(j, a), () => {
108
+ document.removeEventListener("contextmenu", u, !0), document.removeEventListener(j, a);
109
+ };
110
+ }, [r]);
111
+ const k = w(() => ({ current: (n == null ? void 0 : n.anchor) ?? null }), [n]);
112
+ return !n || !e ? null : /* @__PURE__ */ p(pe, { open: !0, onOpenChange: (d) => !d && i(null), children: [
113
+ /* @__PURE__ */ t(me, { virtualRef: k }),
114
+ /* @__PURE__ */ t(
115
+ fe,
116
+ {
117
+ align: "start",
118
+ className: "w-[300px] p-1.5",
119
+ "data-structure-menu": n.view,
120
+ onOpenAutoFocus: (d) => {
121
+ var u, a;
122
+ d.preventDefault(), (a = (u = d.currentTarget) == null ? void 0 : u.querySelector(
123
+ '[role="menuitem"]:not([aria-disabled="true"]), input, button'
124
+ )) == null || a.focus();
125
+ },
126
+ children: n.view === "convert" && ((h = n.targets[0]) == null ? void 0 : h.kind) === "group" ? /* @__PURE__ */ t(
127
+ Ve,
128
+ {
129
+ bundle: e,
130
+ groupKey: n.targets[0].key,
131
+ onBack: () => i({ ...n, view: "menu" }),
132
+ run: g
133
+ }
134
+ ) : n.view === "rules" && ((x = n.targets[0]) == null ? void 0 : x.kind) === "group" ? /* @__PURE__ */ t(
135
+ We,
136
+ {
137
+ bundle: e,
138
+ groupKey: n.targets[0].key,
139
+ onBack: () => i({ ...n, view: "menu" }),
140
+ run: g
141
+ }
142
+ ) : /* @__PURE__ */ t(
143
+ Ke,
144
+ {
145
+ bundle: e,
146
+ targets: n.targets,
147
+ run: g,
148
+ onView: (d) => i({ ...n, view: d })
149
+ }
150
+ )
151
+ }
152
+ )
153
+ ] });
154
+ }
155
+ const je = (e) => (s) => {
156
+ const o = e.placements.find((r) => r.field === s), c = ge(o).label;
157
+ return typeof c == "string" && c || (o == null ? void 0 : o.label_override) || ue(s);
158
+ };
159
+ function Be(e) {
160
+ return e.kind === "group" ? `group:${e.key}` : e.kind === "header" ? `header:${e.field}` : `${e.kind}:${e.field}:${e.group_key ?? ""}`;
161
+ }
162
+ const Ue = "flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-[12.5px] text-slate-700 outline-none transition-colors hover:bg-muted focus-visible:bg-muted dark:text-foreground aria-disabled:cursor-not-allowed aria-disabled:opacity-45 aria-disabled:hover:bg-transparent";
163
+ function y({
164
+ icon: e,
165
+ children: s,
166
+ hint: o,
167
+ blocked: c,
168
+ onPick: r,
169
+ ...n
170
+ }) {
171
+ return /* @__PURE__ */ p(
172
+ "button",
173
+ {
174
+ type: "button",
175
+ role: "menuitem",
176
+ "aria-disabled": c ? !0 : void 0,
177
+ "data-tip": c ?? void 0,
178
+ onClick: () => {
179
+ c || r();
180
+ },
181
+ className: Ue,
182
+ ...n,
183
+ children: [
184
+ /* @__PURE__ */ t("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center text-slate-500 dark:text-muted-foreground [&_svg]:h-3.5 [&_svg]:w-3.5", children: e }),
185
+ /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children: s }),
186
+ o && /* @__PURE__ */ t("kbd", { className: "shrink-0 font-sans text-[11px] text-slate-400 dark:text-muted-foreground", children: o })
187
+ ]
188
+ }
189
+ );
190
+ }
191
+ function Me(e) {
192
+ var n;
193
+ if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key)) return;
194
+ const o = Array.from(e.currentTarget.querySelectorAll('[role="menuitem"]'));
195
+ if (o.length === 0) return;
196
+ e.preventDefault();
197
+ const c = o.indexOf(document.activeElement), r = e.key === "Home" ? 0 : e.key === "End" ? o.length - 1 : (c + (e.key === "ArrowDown" ? 1 : -1) + o.length) % o.length;
198
+ (n = o[r]) == null || n.focus();
199
+ }
200
+ function Ke({
201
+ bundle: e,
202
+ targets: s,
203
+ run: o,
204
+ onView: c
205
+ }) {
206
+ const r = s.length === 1 ? s[0] : null, n = (r == null ? void 0 : r.kind) === "group" && r.key !== ce ? e.groups.find((h) => h.key === r.key) ?? null : null, i = s.filter(
207
+ (h) => (h.kind === "field" || h.kind === "slot") && !de(h)
208
+ ), m = i.length ? Oe(e, i) : null, g = r ? $e(e, r) : "Duplicate works on one section at a time", k = n ? `${N(n)} · ${T(e, n)}` : i.length > 1 ? `${i.length} selected` : null;
209
+ return /* @__PURE__ */ p("div", { role: "menu", "aria-label": "Arrange", onKeyDown: Me, className: "flex flex-col", children: [
210
+ k && /* @__PURE__ */ t("p", { className: $(S, "truncate px-2 pb-1 pt-0.5"), children: k }),
211
+ /* @__PURE__ */ t(
212
+ y,
213
+ {
214
+ icon: /* @__PURE__ */ t(F, {}),
215
+ hint: he(),
216
+ blocked: g,
217
+ "data-structure-action": "duplicate",
218
+ onPick: () => o(U(e, r), { toastNotes: !0 }),
219
+ children: "Duplicate"
220
+ }
221
+ ),
222
+ m && /* @__PURE__ */ t(
223
+ y,
224
+ {
225
+ icon: /* @__PURE__ */ t(X, {}),
226
+ blocked: m.ok ? null : m.reason,
227
+ "data-structure-action": "wrap",
228
+ onPick: () => o(m),
229
+ children: m.ok ? m.label.replace(/^Wrap \d+ fields?/, "Wrap") : "Wrap in a new section"
230
+ }
231
+ ),
232
+ r && (r.kind === "field" || r.kind === "slot") && r.group_key !== null && /* @__PURE__ */ t(
233
+ y,
234
+ {
235
+ icon: /* @__PURE__ */ t(z, {}),
236
+ blocked: ye(e, r),
237
+ "data-structure-action": "split",
238
+ onPick: () => o(xe(e, r), { toastNotes: !0 }),
239
+ children: "Split the section here"
240
+ }
241
+ ),
242
+ i.length > 1 && /* @__PURE__ */ t(
243
+ y,
244
+ {
245
+ icon: /* @__PURE__ */ t(Q, {}),
246
+ blocked: we(e, i),
247
+ "data-structure-action": "row",
248
+ onPick: () => o(ve(e, i, je(e)), { toastNotes: !0 }),
249
+ children: "Put side by side under one label"
250
+ }
251
+ ),
252
+ n && /* @__PURE__ */ p(Y, { children: [
253
+ /* @__PURE__ */ t(
254
+ y,
255
+ {
256
+ icon: /* @__PURE__ */ t(Z, {}),
257
+ blocked: Ce(e, n.key),
258
+ "data-structure-action": "join",
259
+ onPick: () => o(be(e, n.key), { toastNotes: !0 }),
260
+ children: (() => {
261
+ const h = Ne(e, n.key);
262
+ return h ? `Join with ${N(h)}` : "Join with the next section";
263
+ })()
264
+ }
265
+ ),
266
+ /* @__PURE__ */ p(
267
+ y,
268
+ {
269
+ icon: /* @__PURE__ */ t(ee, {}),
270
+ blocked: _e(e, n.key),
271
+ "data-structure-action": "unwrap",
272
+ onPick: () => o(Te(e, n.key), { toastNotes: !0 }),
273
+ children: [
274
+ "Unwrap: keep its fields, drop the ",
275
+ T(e, n)
276
+ ]
277
+ }
278
+ ),
279
+ /* @__PURE__ */ t(
280
+ y,
281
+ {
282
+ icon: /* @__PURE__ */ t(te, {}),
283
+ blocked: M(e, n.key).length ? null : "Only sections, tabs, steps and their holders convert",
284
+ "data-structure-action": "convert",
285
+ onPick: () => c("convert"),
286
+ children: "Convert to…"
287
+ }
288
+ ),
289
+ /* @__PURE__ */ t(
290
+ y,
291
+ {
292
+ icon: /* @__PURE__ */ t(ne, {}),
293
+ blocked: K(n).length ? null : "Only sections, tabs and steps have these rules",
294
+ "data-structure-action": "rules",
295
+ onPick: () => c("rules"),
296
+ children: "Copy rules to other sections…"
297
+ }
298
+ ),
299
+ /* @__PURE__ */ t(
300
+ y,
301
+ {
302
+ icon: P(n) ? /* @__PURE__ */ t(re, {}) : /* @__PURE__ */ t(oe, {}),
303
+ "data-structure-action": "pin",
304
+ onPick: () => o(De(e, n.key, !P(n))),
305
+ children: P(n) ? "Unpin" : "Pin in the editor (no dragging)"
306
+ }
307
+ )
308
+ ] }),
309
+ !n && i.length === 0 && /* @__PURE__ */ t("p", { className: $(S, "px-2 py-1"), children: "Select a section or fields to duplicate, wrap or convert." })
310
+ ] });
311
+ }
312
+ function E({ title: e, onBack: s }) {
313
+ return /* @__PURE__ */ p("div", { className: "flex items-center gap-1.5 px-1 pb-1.5", children: [
314
+ /* @__PURE__ */ t(
315
+ "button",
316
+ {
317
+ type: "button",
318
+ "aria-label": "Back",
319
+ onClick: s,
320
+ className: "inline-flex h-6 w-6 items-center justify-center rounded text-slate-500 hover:bg-muted hover:text-slate-900 dark:text-muted-foreground dark:hover:text-foreground",
321
+ children: /* @__PURE__ */ t(se, { className: "h-3.5 w-3.5" })
322
+ }
323
+ ),
324
+ /* @__PURE__ */ t("p", { className: "min-w-0 flex-1 truncate text-[13px] font-semibold text-slate-900 dark:text-foreground", children: e })
325
+ ] });
326
+ }
327
+ const q = "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 disabled:pointer-events-none disabled:opacity-40";
328
+ function W({ notes: e }) {
329
+ return e.length === 0 ? null : /* @__PURE__ */ t("ul", { className: "mt-1 list-disc space-y-0.5 pl-4 text-[12px] leading-snug text-slate-600 dark:text-muted-foreground", children: e.map((s) => /* @__PURE__ */ t("li", { children: s }, s)) });
330
+ }
331
+ function Ve({
332
+ bundle: e,
333
+ groupKey: s,
334
+ onBack: o,
335
+ run: c
336
+ }) {
337
+ const r = e.groups.find((i) => i.key === s), n = w(() => M(e, s), [e, s]);
338
+ return r ? /* @__PURE__ */ p("div", { "data-structure-convert": "", className: "flex flex-col", children: [
339
+ /* @__PURE__ */ t(E, { title: `Convert ${N(r)}`, onBack: o }),
340
+ /* @__PURE__ */ t("div", { className: "space-y-1.5", children: n.map((i) => /* @__PURE__ */ p("div", { "data-convert-choice": i.to, className: $(Pe, "p-2.5"), children: [
341
+ /* @__PURE__ */ p("div", { className: "flex items-center gap-2", children: [
342
+ /* @__PURE__ */ t("p", { className: "min-w-0 flex-1 text-[12.5px] font-medium text-slate-900 dark:text-foreground", children: i.title }),
343
+ /* @__PURE__ */ t(
344
+ "button",
345
+ {
346
+ type: "button",
347
+ disabled: !i.plan.ok,
348
+ onClick: () => c(i.plan),
349
+ className: q,
350
+ children: "Convert"
351
+ }
352
+ )
353
+ ] }),
354
+ i.plan.ok ? /* @__PURE__ */ t(W, { notes: i.plan.notes }) : /* @__PURE__ */ t("p", { className: "mt-1 text-[12px] leading-snug text-amber-700 dark:text-amber-300", children: i.plan.reason })
355
+ ] }, i.to)) })
356
+ ] }) : /* @__PURE__ */ t(E, { title: "That section is no longer here", onBack: o });
357
+ }
358
+ const qe = (e, s) => {
359
+ if (!V(e, s)) return "none: clears it";
360
+ try {
361
+ const o = JSON.parse(String(e[s])).length;
362
+ return s === "visible_when" ? `${o} condition${o === 1 ? "" : "s"}` : `${o} role${o === 1 ? "" : "s"}`;
363
+ } catch {
364
+ return "set";
365
+ }
366
+ }, B = "h-4 w-4 rounded border-slate-300 data-[state=checked]:border-nvr-cyan data-[state=checked]:bg-nvr-cyan data-[state=checked]:text-white dark:border-slate-600 [&_svg]:h-3 [&_svg]:w-3";
367
+ function We({
368
+ bundle: e,
369
+ groupKey: s,
370
+ onBack: o,
371
+ run: c
372
+ }) {
373
+ const r = e.groups.find((a) => a.key === s), n = r ? K(r) : [], [i, m] = O(() => {
374
+ const a = r ? n.filter((l) => V(r, l)) : [];
375
+ return a.length ? a : n;
376
+ }), g = w(() => Se(e, s), [e, s]), [k, h] = O([]), x = w(
377
+ () => Ee(e, s, k, i),
378
+ [e, s, k, i]
379
+ );
380
+ if (!r) return /* @__PURE__ */ t(E, { title: "That section is no longer here", onBack: o });
381
+ const d = (a, l) => a.includes(l) ? a.filter((f) => f !== l) : [...a, l], u = k.length === g.length && g.length > 0;
382
+ return /* @__PURE__ */ p("div", { "data-structure-rules": "", className: "flex flex-col", children: [
383
+ /* @__PURE__ */ t(E, { title: `Copy the rules of ${N(r)}`, onBack: o }),
384
+ /* @__PURE__ */ p("fieldset", { className: "m-0 min-w-0 border-0 p-0 px-1", children: [
385
+ /* @__PURE__ */ t("legend", { className: "pb-1 text-[12px] font-medium text-slate-700 dark:text-foreground", children: "Rules" }),
386
+ n.map((a) => (
387
+ // biome-ignore lint/a11y/noLabelWithoutControl: the Radix checkbox is the control
388
+ /* @__PURE__ */ p("label", { className: "flex items-center gap-2 py-0.5 text-[12.5px]", children: [
389
+ /* @__PURE__ */ t(
390
+ L,
391
+ {
392
+ checked: i.includes(a),
393
+ onCheckedChange: () => m((l) => d(l, a)),
394
+ className: B
395
+ }
396
+ ),
397
+ /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate text-slate-800 dark:text-foreground", children: Ae[a] }),
398
+ /* @__PURE__ */ t("span", { className: "shrink-0 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: qe(r, a) })
399
+ ] }, a)
400
+ ))
401
+ ] }),
402
+ /* @__PURE__ */ p("fieldset", { className: "m-0 mt-2 min-w-0 border-0 p-0 px-1", children: [
403
+ /* @__PURE__ */ p("div", { className: "flex items-center pb-1", children: [
404
+ /* @__PURE__ */ t("legend", { className: "flex-1 text-[12px] font-medium text-slate-700 dark:text-foreground", children: "Onto" }),
405
+ /* @__PURE__ */ t(
406
+ "button",
407
+ {
408
+ type: "button",
409
+ onClick: () => h(u ? [] : g.map((a) => a.key)),
410
+ className: "text-[12px] font-medium text-sky-700 hover:underline dark:text-nvr-cyan",
411
+ children: u ? "None" : "All"
412
+ }
413
+ )
414
+ ] }),
415
+ /* @__PURE__ */ p("div", { className: "max-h-[200px] overflow-y-auto", children: [
416
+ g.length === 0 && /* @__PURE__ */ t("p", { className: S, children: "No other sections on this form." }),
417
+ g.map((a) => (
418
+ // biome-ignore lint/a11y/noLabelWithoutControl: the Radix checkbox is the control
419
+ /* @__PURE__ */ p(
420
+ "label",
421
+ {
422
+ "data-rules-target": a.key,
423
+ className: "flex items-center gap-2 py-0.5 text-[12.5px]",
424
+ children: [
425
+ /* @__PURE__ */ t(
426
+ L,
427
+ {
428
+ checked: k.includes(a.key),
429
+ onCheckedChange: () => h((l) => d(l, a.key)),
430
+ className: B
431
+ }
432
+ ),
433
+ /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate text-slate-800 dark:text-foreground", children: N(a) }),
434
+ /* @__PURE__ */ t("span", { className: "shrink-0 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: T(e, a) })
435
+ ]
436
+ },
437
+ a.key
438
+ )
439
+ ))
440
+ ] })
441
+ ] }),
442
+ /* @__PURE__ */ p("div", { className: "mt-2 border-t border-slate-100 px-1 pt-2 dark:border-border", children: [
443
+ x.ok ? /* @__PURE__ */ t(W, { notes: x.notes }) : k.length > 0 && /* @__PURE__ */ t("p", { className: S, children: x.reason }),
444
+ /* @__PURE__ */ t("div", { className: "mt-2 flex justify-end", children: /* @__PURE__ */ t(
445
+ "button",
446
+ {
447
+ type: "button",
448
+ disabled: !x.ok,
449
+ "data-rules-apply": "",
450
+ onClick: () => c(x),
451
+ className: q,
452
+ children: x.ok ? `Copy to ${x.ops.length}` : "Copy"
453
+ }
454
+ ) })
455
+ ] })
456
+ ] });
457
+ }
458
+ export {
459
+ dt as ArrangeButton,
460
+ at as StructureActions,
461
+ ut as openStructureMenu,
462
+ Re as parseTargetKey,
463
+ it as usePinMarks
464
+ };