@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,88 @@
1
+ const l = ["Editing", "Moving", "Finding", "Saving", "View"], r = [
2
+ { id: "undo", area: "Editing", keys: [["mod", "z"]], label: "Undo" },
3
+ {
4
+ id: "redo",
5
+ area: "Editing",
6
+ keys: [
7
+ ["shift", "mod", "z"],
8
+ ["ctrl", "y"]
9
+ ],
10
+ label: "Redo"
11
+ },
12
+ { id: "duplicate", area: "Editing", keys: [["mod", "d"]], label: "Duplicate the selection" },
13
+ {
14
+ id: "select-more",
15
+ area: "Editing",
16
+ keys: [
17
+ ["shift", "click"],
18
+ ["mod", "click"]
19
+ ],
20
+ label: "Select several fields"
21
+ },
22
+ {
23
+ id: "alt-move",
24
+ area: "Moving",
25
+ keys: [
26
+ ["alt", "↑"],
27
+ ["alt", "↓"]
28
+ ],
29
+ label: "Move the selection up or down one place"
30
+ },
31
+ {
32
+ id: "alt-move-across",
33
+ area: "Moving",
34
+ keys: [
35
+ ["alt", "←"],
36
+ ["alt", "→"]
37
+ ],
38
+ label: "Move a field to the previous or next section; a tab or step left or right"
39
+ },
40
+ {
41
+ id: "keyboard-drag",
42
+ area: "Moving",
43
+ keys: [["space"]],
44
+ label: "Pick up the focused field or section, arrows to move it, Space to drop"
45
+ },
46
+ { id: "cancel-drag", area: "Moving", keys: [["esc"]], label: "Cancel a drag" },
47
+ { id: "find", area: "Finding", keys: [["mod", "f"]], label: "Find a field on the form" },
48
+ { id: "palette", area: "Finding", keys: [["mod", "k"]], label: "Open the command palette" },
49
+ { id: "save", area: "Saving", keys: [["mod", "s"]], label: "Save changes" },
50
+ { id: "shortcuts", area: "View", keys: [["?"]], label: "Show these shortcuts" },
51
+ {
52
+ id: "close",
53
+ area: "View",
54
+ keys: [["esc"]],
55
+ label: "Close the editor (record page), or the open popover"
56
+ }
57
+ ];
58
+ function d() {
59
+ return l.map((e) => ({
60
+ area: e,
61
+ items: r.filter((a) => a.area === e)
62
+ })).filter((e) => e.items.length > 0);
63
+ }
64
+ function s() {
65
+ var a;
66
+ if (typeof navigator > "u") return !0;
67
+ const e = ((a = navigator.userAgentData) == null ? void 0 : a.platform) ?? navigator.platform ?? navigator.userAgent;
68
+ return /mac|iphone|ipad|ipod/i.test(e ?? "");
69
+ }
70
+ const i = {
71
+ mod: "⌘",
72
+ shift: "⇧",
73
+ alt: "⌥",
74
+ ctrl: "Ctrl",
75
+ esc: "Esc",
76
+ space: "Space",
77
+ click: "click"
78
+ }, n = { ...i, mod: "Ctrl", shift: "Shift", alt: "Alt" };
79
+ function c(e, a = s()) {
80
+ const o = a ? i : n;
81
+ return e.map((t) => o[t] ?? (t.length === 1 ? t.toUpperCase() : t));
82
+ }
83
+ export {
84
+ l as SHORTCUT_AREAS,
85
+ s as isMacLike,
86
+ c as keyLabels,
87
+ d as shortcutGroups
88
+ };
@@ -0,0 +1,35 @@
1
+ import { titleCase as d } from "../../lib/utils.js";
2
+ import { segmentsText as g, describeConditions as h } from "./overview/describe-conditions.js";
3
+ const b = (t) => t.length <= 1 ? t[0] ?? "" : `${t.slice(0, -1).join(", ")} or ${t[t.length - 1]}`;
4
+ function v(t, l, r = {}) {
5
+ var s;
6
+ const o = typeof t == "string" ? m(t) : t;
7
+ if (!Array.isArray(o) || !o.length) return null;
8
+ const n = [], f = new Map(l.map((e) => [e.field, e]));
9
+ for (const e of o) {
10
+ if (!(e != null && e.field)) continue;
11
+ if (e.op === "in") {
12
+ const p = ((s = f.get(e.field)) == null ? void 0 : s.label) || d(e.field), a = String(e.value ?? "").split(",").map((i) => i.trim()).filter(Boolean).map((i) => {
13
+ var u;
14
+ return ((u = r[e.field]) == null ? void 0 : u[i]) ?? i;
15
+ });
16
+ n.push(`${p} is ${b(a)}`);
17
+ continue;
18
+ }
19
+ const c = { field: e.field, op: e.op ?? "eq", value: e.value };
20
+ n.push(g(h([c], l, r)));
21
+ }
22
+ return n.length ? n.join(" and ") : null;
23
+ }
24
+ function m(t) {
25
+ try {
26
+ return JSON.parse(t);
27
+ } catch {
28
+ return null;
29
+ }
30
+ }
31
+ export {
32
+ v as describeShowWhen,
33
+ b as orList,
34
+ m as safeParse
35
+ };
@@ -8,13 +8,14 @@ const r = {
8
8
  __subtitle__: "Subtitle",
9
9
  __addendums__: "Addendums",
10
10
  __referenced_by__: "Referenced by",
11
- __related_records__: "Related records"
11
+ __related_records__: "Related records",
12
+ __ungrouped_pos__: "Fields outside sections"
12
13
  };
13
- function s(_) {
14
+ function n(_) {
14
15
  if (r[_]) return r[_];
15
16
  const e = _.match(/^__ext_([a-z][a-z0-9-]*)__$/);
16
17
  return e ? t(e[1].replace(/-/g, "_")) : /^__widget_\d+__$/.test(_) ? "Widget" : t(_.replace(/^_+|_+$/g, ""));
17
18
  }
18
19
  export {
19
- s as slotName
20
+ n as slotName
20
21
  };
@@ -0,0 +1,64 @@
1
+ import { useQuery as p, useQueryClient as y } from "@tanstack/react-query";
2
+ import { useCallback as c, useMemo as f } from "react";
3
+ import { useNivaroClient as u } from "../../context.js";
4
+ import { get as g, post as l } from "../../lib/commands.js";
5
+ const i = {
6
+ mine: (s) => ["layout-editor", "staged", s]
7
+ }, m = (s) => {
8
+ const t = s;
9
+ return !!t && typeof t.label == "string" && Array.isArray(t.ops);
10
+ };
11
+ function v(s) {
12
+ const t = s ?? {}, e = t.data, o = e && typeof e == "object" && !Array.isArray(e) && typeof e.base_rev == "string" && Array.isArray(e.steps) && e.steps.length > 0 && e.steps.every(m) ? {
13
+ steps: e.steps,
14
+ base_rev: e.base_rev,
15
+ saved_at: typeof e.saved_at == "string" ? e.saved_at : (/* @__PURE__ */ new Date()).toISOString()
16
+ } : null, n = Array.isArray(t.others) ? t.others.filter((r) => {
17
+ const a = r;
18
+ return !!a && typeof a.user_id == "string" && typeof a.name == "string";
19
+ }) : [];
20
+ return { data: o, others: n, available: t.available !== !1 };
21
+ }
22
+ function h(s, t = !0) {
23
+ const e = u();
24
+ return p({
25
+ queryKey: i.mine(s),
26
+ queryFn: () => e.request(g(`/collection-layouts/${s}/staged`)).then(v),
27
+ enabled: t,
28
+ staleTime: 3e4,
29
+ refetchOnWindowFocus: !1,
30
+ retry: !1
31
+ });
32
+ }
33
+ function S() {
34
+ const s = u(), t = y(), e = c(
35
+ async (n, r) => {
36
+ await s.request(
37
+ l(`/collection-layouts/${n}/staged`, {
38
+ steps: r.steps.map((a) => ({ label: a.label, ops: a.ops })),
39
+ base_rev: r.baseRev
40
+ })
41
+ ), t.setQueryData(i.mine(n), (a) => ({
42
+ data: { steps: r.steps, base_rev: r.baseRev, saved_at: (/* @__PURE__ */ new Date()).toISOString() },
43
+ others: (a == null ? void 0 : a.others) ?? [],
44
+ available: !0
45
+ }));
46
+ },
47
+ [s, t]
48
+ ), o = c(
49
+ async (n) => {
50
+ await s.request(l(`/collection-layouts/${n}/staged/clear`)), t.setQueryData(
51
+ i.mine(n),
52
+ (r) => r && { ...r, data: null }
53
+ );
54
+ },
55
+ [s, t]
56
+ );
57
+ return f(() => ({ write: e, clear: o }), [e, o]);
58
+ }
59
+ export {
60
+ v as parseStagedAnswer,
61
+ i as stagedKeys,
62
+ h as useStagedDraft,
63
+ S as useStagedWriter
64
+ };
@@ -0,0 +1,403 @@
1
+ import { isCanvasSlot as R, UNGROUPED_KEY as S, applyLayoutOps as C, GROUP_PATCH_KEYS as Y } from "../../lib/layout-ops.js";
2
+ import { withGroupStructure as j } from "../../lib/form-structure.js";
3
+ import { titleCase as I } from "../../lib/utils.js";
4
+ import { newGroupKey as H } from "./add-target.js";
5
+ import { normalizedBundle as T, inPageOrder as K, plural as g, selectedPlacements as J, moveToZoneOps as Z, zoneItems as U, FIELD_HOLDERS as X } from "./field-zones.js";
6
+ import { readOverrides as D, withKey as q, asArray as P, placementPatchOf as Q } from "./inspector/model.js";
7
+ import { isPinned as F, withPin as G } from "./pin.js";
8
+ import { PIN_KEY as Ue, pinLocked as Ae, pinnedZone as Le } from "./pin.js";
9
+ import { humanizeOpError as V } from "./useLayoutDraft.js";
10
+ const y = (o) => ({ ok: !1, reason: o });
11
+ function m(o, e) {
12
+ if (e.ops.length === 0) return y("Nothing would change");
13
+ try {
14
+ return C(o, e.ops), e;
15
+ } catch (t) {
16
+ return y(V(t.message));
17
+ }
18
+ }
19
+ const d = (o) => o.label || I(o.key), _ = (o, e) => o.groups.find((t) => t.key === e) ?? null, O = (o, e) => o.groups.filter((t) => t.parent_key === e).sort((t, n) => t.sort - n.sort);
20
+ function x(o, e) {
21
+ const t = e.parent_key ? _(o, e.parent_key) : null;
22
+ return (t ? t.tab_mode : o.layout.tab_mode) === "steps" ? "steps" : "tabs";
23
+ }
24
+ function ee(o, e) {
25
+ return e.type === "tab" ? x(o, e) === "steps" ? "step" : "tab" : e.type === "container" ? e.tab_mode === "steps" ? "steps holder" : "tabs holder" : e.type === "content" ? "text block" : e.type === "metadata" ? "record info section" : "section";
26
+ }
27
+ function _e(o, e, t) {
28
+ const n = _(o, e);
29
+ return n ? F(n) === t ? y(t ? "Already pinned" : "Not pinned") : m(o, {
30
+ ok: !0,
31
+ ops: [{ op: "group_update", key: e, patch: { swap_config: G(n.swap_config, t) } }],
32
+ label: `${t ? "Pin" : "Unpin"} ${d(n)}`,
33
+ notes: []
34
+ }) : y("That section is no longer on this form");
35
+ }
36
+ function te(o) {
37
+ const e = {};
38
+ for (const t of Y) t !== "label" && (e[t] = o[t]);
39
+ return e;
40
+ }
41
+ function oe(o, e) {
42
+ return e ? e.kind === "header" ? "A header tile shows once in the header strip" : e.kind === "slot" && R(e) ? "This panel shows once on a form" : e.kind === "field" || e.kind === "slot" ? "A field shows once per section. Duplicate its section, or add the field to another section from Add" : e.key === S ? "Ungrouped is not a section" : _(o, e.key) ? null : "This comes from the parent form: override it here first" : "Select a section or field first";
43
+ }
44
+ function be(o, e) {
45
+ const t = oe(o, e);
46
+ if (t) return y(t);
47
+ const n = T(o), a = _(n, e.key), r = new Set(n.groups.map((c) => c.key)), i = [];
48
+ let l = 0;
49
+ const u = (c, p, v, w) => {
50
+ let h = `${c.key}_copy`;
51
+ for (let k = 2; r.has(h); k++) h = `${c.key}_copy_${k}`;
52
+ r.add(h);
53
+ const b = te(c);
54
+ return b.swap_config = j(G(c.swap_config, !1), { sticky: !1 }), i.push({
55
+ op: "group_create",
56
+ key: h,
57
+ label: w,
58
+ group_type: c.type,
59
+ parent_key: p,
60
+ index: v,
61
+ patch: b
62
+ }), U(n, c.key).forEach((k, M) => {
63
+ k.field.startsWith("__") || l++, i.push({
64
+ op: "place",
65
+ field: k.field,
66
+ group_key: h,
67
+ index: M,
68
+ patch: Q(k)
69
+ });
70
+ }), O(n, c.key).forEach((k, M) => {
71
+ u(k, h, M, k.label);
72
+ }), h;
73
+ }, f = u(a, a.parent_key, a.sort + 1, `${d(a)} (copy)`), s = l ? [`Its ${g(l, "field")} now ${l === 1 ? "shows" : "show"} in both copies`] : [];
74
+ return m(o, {
75
+ ok: !0,
76
+ ops: i,
77
+ label: `Duplicate ${d(a)}`,
78
+ notes: s,
79
+ select: { kind: "group", key: f }
80
+ });
81
+ }
82
+ function ge(o, e) {
83
+ const t = T(o);
84
+ if (t.layout.layout_type === "table") return y("Table layouts have no sections");
85
+ const n = K(t, J(t, e));
86
+ if (n.length === 0) return y("Select one or more fields first");
87
+ const a = n[0], r = a.group_key ? _(t, a.group_key) : null;
88
+ if (a.group_key && !r) return y("Those fields are not in a section of this form");
89
+ const i = (r == null ? void 0 : r.type) === "tab", l = (r == null ? void 0 : r.parent_key) ?? null, u = r && i ? x(t, r) : null, f = u === "steps" ? "step" : u === "tabs" ? "tab" : "section", s = r ?? _(t, S), c = s ? s.sort + 1 : Number.MAX_SAFE_INTEGER, p = H(t, f), v = {
90
+ op: "group_create",
91
+ key: p,
92
+ label: `New ${f}`,
93
+ group_type: i ? "tab" : "section",
94
+ parent_key: l,
95
+ index: c
96
+ }, w = C(t, [v]), h = Z(w, n, p), b = [], k = n.length - h.ops.length;
97
+ return k > 0 && b.push(`${g(k, "field")} placed twice ${k === 1 ? "goes" : "go"} in once`), m(o, {
98
+ ok: !0,
99
+ ops: [v, ...h.ops],
100
+ label: `Wrap ${g(h.ops.length, "field")} in a new ${f}`,
101
+ notes: b,
102
+ select: { kind: "group", key: p }
103
+ });
104
+ }
105
+ function ne(o, e) {
106
+ if (e === S) return "Ungrouped is not a section";
107
+ const t = _(o, e);
108
+ return t ? t.type === "container" ? "Use Convert to turn its tabs into sections" : X.has(t.type) ? null : "Only sections, tabs and steps hold fields" : "This comes from the parent form: override it here first";
109
+ }
110
+ function me(o, e) {
111
+ const t = ne(o, e);
112
+ if (t) return y(t);
113
+ const n = T(o), a = _(n, e), r = U(n, e), i = new Set(U(n, null).map((c) => c.field)), l = [], u = [], f = a.parent_key === null && i.size === 0 && !!_(n, S);
114
+ f && r.length > 0 && l.push({ op: "group_move", key: S, parent_key: null, index: a.sort }), l.push({ op: "group_remove", key: e, placements: "ungroup" }), r.length === 0 ? u.push("It holds no fields") : f ? u.push("Its fields stay where they are, as ungrouped fields") : u.push(`Its ${g(r.length, "field")} move to the end of Ungrouped`);
115
+ const s = r.filter((c) => i.has(c.field)).length;
116
+ return s > 0 && u.push(
117
+ `${g(s, "field")} already in Ungrouped ${s === 1 ? "stays" : "stay"} once`
118
+ ), m(o, {
119
+ ok: !0,
120
+ ops: l,
121
+ label: `Unwrap ${d(a)}`,
122
+ notes: u,
123
+ select: { kind: "group", key: S }
124
+ });
125
+ }
126
+ function se(o) {
127
+ const e = [];
128
+ return o.is_collapsed && e.push("“Starts collapsed” does not apply to tabs or steps (kept, unused)"), P(o.summary_fields).length && e.push("The collapsed summary does not apply to tabs or steps (kept, unused)"), e;
129
+ }
130
+ function B(o) {
131
+ const e = [];
132
+ return P(o.visible_when).length && e.push("Its “Only when” rule works on steps and tabs only (kept, unused)"), P(o.skip_if_filled).length && e.push("“Skip when filled” works on steps only (kept, unused)"), e;
133
+ }
134
+ function A(o, e, t) {
135
+ const n = t === "steps" ? "step" : "tab", a = o.groups.filter((u) => u.parent_key === null).sort((u, f) => u.sort - f.sort), r = a[a.indexOf(e) - 1], i = se(e), l = [{ op: "group_update", key: e.key, patch: { type: "tab" } }];
136
+ if ((r == null ? void 0 : r.type) === "container" && (r.tab_mode === "steps" ? "steps" : "tabs") === t && !F(r))
137
+ l.push({
138
+ op: "group_move",
139
+ key: e.key,
140
+ parent_key: r.key,
141
+ index: O(o, r.key).length
142
+ }), i.unshift(`Joins ${d(r)} as its last ${n}`);
143
+ else {
144
+ const u = H(o, t);
145
+ l.unshift({
146
+ op: "group_create",
147
+ key: u,
148
+ label: t === "steps" ? "Steps" : "Tabs",
149
+ group_type: "container",
150
+ parent_key: null,
151
+ index: e.sort,
152
+ patch: { tab_mode: t }
153
+ }), l.push({ op: "group_move", key: e.key, parent_key: u, index: 0 }), i.unshift(`A new ${t} holder takes its place, with it as the first ${n}`);
154
+ }
155
+ return m(o, {
156
+ ok: !0,
157
+ ops: l,
158
+ label: `Make ${d(e)} a ${n}`,
159
+ notes: i,
160
+ select: { kind: "group", key: e.key }
161
+ });
162
+ }
163
+ function L(o, e, t) {
164
+ const n = O(o, e.key), a = t ? [t] : n, r = [];
165
+ a.forEach((f, s) => {
166
+ r.push({ op: "group_move", key: f.key, parent_key: null, index: e.sort + 1 + s }), r.push({ op: "group_update", key: f.key, patch: { type: "section" } });
167
+ });
168
+ const i = a.flatMap(
169
+ (f) => B(f).map((s) => a.length > 1 ? `${d(f)}: ${s}` : s)
170
+ );
171
+ a.length === n.length && (r.push({ op: "group_remove", key: e.key, placements: "ungroup" }), i.unshift(`${d(e)} is removed: it would be empty`)), t ? i.unshift(`Moves out of ${d(e)}, just below it`) : i.unshift(`${g(n.length, "tab")} become sections below one another`);
172
+ const u = t ? `Make ${d(t)} a section` : `Turn the ${x(o, n[0] ?? e) === "steps" ? "steps" : "tabs"} of ${d(e)} into sections`;
173
+ return m(o, {
174
+ ok: !0,
175
+ ops: r,
176
+ label: u,
177
+ notes: i,
178
+ select: { kind: "group", key: (t ?? n[0] ?? e).key }
179
+ });
180
+ }
181
+ function E(o, e, t, n) {
182
+ const a = n === "steps" ? "steps" : "tabs", r = t ? O(o, t.key) : o.groups.filter((s) => s.parent_key === null && s.type === "tab"), i = r.filter((s) => s.key !== e.key).length, l = [];
183
+ e.type === "tab" && i > 0 ? l.push(
184
+ t ? `All ${r.length} tabs of ${d(t)} become ${a}: a holder shows its tabs one way` : `All ${r.length} tabs at the top of the form become ${a}: the form shows them one way`
185
+ ) : r.length > 0 && l.push(`${g(r.length, "tab")} show as ${a}`), n === "steps" && o.layout.validate_before_next && l.push("People must complete each step before the next");
186
+ const u = t ? [{ op: "group_update", key: t.key, patch: { tab_mode: n } }] : [{ op: "layout_update", patch: { tab_mode: n } }], f = e.type === "tab" ? d(e) : d(t ?? e);
187
+ return m(o, {
188
+ ok: !0,
189
+ ops: u,
190
+ label: e.type === "tab" ? `Make ${f} a ${a.slice(0, -1)}` : `Show ${f} as ${a}`,
191
+ notes: l,
192
+ select: { kind: "group", key: e.key }
193
+ });
194
+ }
195
+ function we(o, e) {
196
+ const t = T(o), n = _(t, e);
197
+ if (!n) return [];
198
+ const a = n.parent_key ? _(t, n.parent_key) : null, r = [];
199
+ if (n.type === "section" && n.parent_key === null)
200
+ r.push({ to: "tab", title: "Make it a tab", plan: A(t, n, "tabs") }), r.push({ to: "step", title: "Make it a step", plan: A(t, n, "steps") });
201
+ else if (n.type === "tab") {
202
+ const i = x(t, n);
203
+ r.push({
204
+ to: "section",
205
+ title: "Make it a section",
206
+ plan: a ? L(t, a, n) : m(t, {
207
+ ok: !0,
208
+ ops: [{ op: "group_update", key: n.key, patch: { type: "section" } }],
209
+ label: `Make ${d(n)} a section`,
210
+ notes: B(n),
211
+ select: { kind: "group", key: n.key }
212
+ })
213
+ }), r.push(
214
+ i === "tabs" ? { to: "step", title: "Make it a step", plan: E(t, n, a, "steps") } : { to: "tab", title: "Make it a tab", plan: E(t, n, a, "tabs") }
215
+ );
216
+ } else if (n.type === "container") {
217
+ const i = n.tab_mode === "steps" ? "steps" : "tabs";
218
+ r.push(
219
+ i === "tabs" ? { to: "steps", title: "Turn its tabs into steps", plan: E(t, n, n, "steps") } : { to: "tabs", title: "Turn its steps into tabs", plan: E(t, n, n, "tabs") }
220
+ ), r.push({
221
+ to: "sections",
222
+ title: `Turn its ${i} into sections`,
223
+ plan: O(t, n.key).length ? L(t, n) : y(`It holds no ${i}`)
224
+ });
225
+ }
226
+ return r;
227
+ }
228
+ const re = ["visible_when", "hidden_for_roles", "locked_for_roles"], $e = {
229
+ visible_when: "Only when (step conditions)",
230
+ hidden_for_roles: "Hidden for roles",
231
+ locked_for_roles: "Read-only for roles"
232
+ }, W = /* @__PURE__ */ new Set(["section", "metadata", "tab"]), ve = (o, e) => P(o[e]).length > 0, N = (o) => JSON.stringify(P(o));
233
+ function Se(o) {
234
+ return W.has(o.type) ? re.filter((e) => e !== "visible_when" || o.type === "tab") : [];
235
+ }
236
+ function Te(o, e) {
237
+ return z(T(o)).filter(
238
+ (t) => t.key !== e && W.has(t.type)
239
+ );
240
+ }
241
+ function Oe(o, e, t, n) {
242
+ const a = _(o, e);
243
+ if (!a) return y("That section is no longer on this form");
244
+ if (n.length === 0) return y("Pick at least one rule");
245
+ if (t.length === 0) return y("Pick the sections to copy onto");
246
+ const r = [], i = [];
247
+ let l = 0, u = 0;
248
+ for (const f of t) {
249
+ const s = _(o, f);
250
+ if (!s) continue;
251
+ const c = {};
252
+ for (const p of n) {
253
+ if (p === "visible_when" && s.type !== "tab") {
254
+ u++;
255
+ continue;
256
+ }
257
+ N(s[p]) !== N(a[p]) && (c[p] = a[p]);
258
+ }
259
+ Object.keys(c).length ? r.push({ op: "group_update", key: f, patch: c }) : l++;
260
+ }
261
+ return u && i.push(
262
+ `Step conditions skipped on ${g(u, "section")}: they work on steps and tabs only`
263
+ ), l && i.push(`${g(l, "section")} already ${l === 1 ? "has" : "have"} these rules`), m(o, {
264
+ ok: !0,
265
+ ops: r,
266
+ label: `Copy the rules of ${d(a)} to ${g(r.length, "section")}`,
267
+ notes: i
268
+ });
269
+ }
270
+ const Pe = {
271
+ group_label: "Section name",
272
+ text_block: "Text block",
273
+ label: "Field label on this form",
274
+ label_override: "Field label on this form",
275
+ help: "Help text on this form",
276
+ field_label: "Field label (sets this form’s own)",
277
+ field_help: "Help text (sets this form’s own)"
278
+ }, ie = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
279
+ function le(o, e) {
280
+ return o ? new RegExp(ie(o), e ? "g" : "gi") : null;
281
+ }
282
+ const $ = (o) => typeof o == "string" && o !== "" ? o : null;
283
+ function Ee(o, e, t, n = {}) {
284
+ const a = le(e, !!n.matchCase);
285
+ if (!a) return [];
286
+ const r = T(o), i = [], l = (s) => {
287
+ var p;
288
+ const c = ((p = s.before.match(a)) == null ? void 0 : p.length) ?? 0;
289
+ c !== 0 && i.push({ ...s, after: s.before.replace(a, () => t), count: c });
290
+ };
291
+ for (const s of z(r))
292
+ l({
293
+ id: `group:${s.key}`,
294
+ kind: "group_label",
295
+ group: s.key,
296
+ where: ae(r, s),
297
+ before: s.label
298
+ }), s.type === "content" && $(s.content) && l({
299
+ id: `content:${s.key}`,
300
+ kind: "text_block",
301
+ group: s.key,
302
+ where: d(s),
303
+ before: s.content
304
+ });
305
+ const u = new Map((n.globals ?? []).map((s) => [s.field, s])), f = (s) => {
306
+ if (s === null) return "Ungrouped";
307
+ if (s === "__header__") return "Header strip";
308
+ const c = _(r, s);
309
+ return c ? d(c) : I(s);
310
+ };
311
+ for (const s of K(
312
+ r,
313
+ r.placements.filter((c) => !R(c))
314
+ )) {
315
+ const c = D(s), p = u.get(s.field), w = `${$(c.label) ?? $(s.label_override) ?? $(p == null ? void 0 : p.label) ?? I(s.field)} · ${f(s.group_key)}`, h = { field: s.field, group_key: s.group_key }, b = (k) => `${k}:${s.field}:${s.group_key ?? ""}`;
316
+ $(c.label) ? l({ id: b("label"), kind: "label", at: h, where: w, before: c.label }) : $(s.label_override) ? l({
317
+ id: b("label_override"),
318
+ kind: "label_override",
319
+ at: h,
320
+ where: w,
321
+ before: s.label_override
322
+ }) : $(p == null ? void 0 : p.label) && !s.field.startsWith("__") && l({
323
+ id: b("field_label"),
324
+ kind: "field_label",
325
+ at: h,
326
+ where: w,
327
+ before: p == null ? void 0 : p.label
328
+ }), $(c.note) ? l({ id: b("help"), kind: "help", at: h, where: w, before: c.note }) : $(p == null ? void 0 : p.note) && !s.field.startsWith("__") && l({ id: b("field_help"), kind: "field_help", at: h, where: w, before: p == null ? void 0 : p.note });
329
+ }
330
+ return i;
331
+ }
332
+ function z(o) {
333
+ return o.groups.filter((t) => t.parent_key === null && t.key !== S).sort((t, n) => t.sort - n.sort).flatMap((t) => [t, ...O(o, t.key)]);
334
+ }
335
+ function ae(o, e) {
336
+ const t = ee(o, e);
337
+ return `${t[0].toUpperCase()}${t.slice(1)}`;
338
+ }
339
+ function xe(o, e) {
340
+ if (e.length === 0) return y("Pick at least one match");
341
+ const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
342
+ for (const i of e)
343
+ if (i.group) {
344
+ const l = t.get(i.group) ?? {};
345
+ i.kind === "group_label" ? l.label = i.after : l.content = i.after, t.set(i.group, l);
346
+ } else if (i.at) {
347
+ const l = `${i.at.field}\0${i.at.group_key ?? ""}`;
348
+ n.set(l, [...n.get(l) ?? [], i]);
349
+ }
350
+ const a = [];
351
+ for (const [i, l] of t) a.push({ op: "group_update", key: i, patch: l });
352
+ for (const i of n.values()) {
353
+ const l = i[0].at, u = o.placements.find(
354
+ (p) => p.field === l.field && p.group_key === l.group_key
355
+ );
356
+ if (!u) continue;
357
+ let f = D(u);
358
+ const s = {};
359
+ let c = !1;
360
+ for (const p of i)
361
+ if (p.kind === "label_override") s.label_override = p.after;
362
+ else {
363
+ const v = p.kind === "label" || p.kind === "field_label" ? "label" : "note";
364
+ f = q(f ?? {}, v, p.after === "" ? void 0 : p.after), c = !0;
365
+ }
366
+ c && (s.overrides = f), a.push({ op: "update_placement", at: l, patch: s });
367
+ }
368
+ const r = e.reduce((i, l) => i + l.count, 0);
369
+ return m(o, {
370
+ ok: !0,
371
+ ops: a,
372
+ label: `Replace ${g(r, "match", "matches")} in labels`,
373
+ notes: []
374
+ });
375
+ }
376
+ export {
377
+ Pe as HIT_KIND_LABELS,
378
+ Ue as PIN_KEY,
379
+ re as RULE_KEYS,
380
+ $e as RULE_LABELS,
381
+ m as checked,
382
+ we as convertChoices,
383
+ Oe as copyRulesPlan,
384
+ oe as duplicateBlocked,
385
+ be as duplicatePlan,
386
+ Ee as findHits,
387
+ d as groupName,
388
+ z as groupsInPageOrder,
389
+ F as isPinned,
390
+ ee as kindWord,
391
+ Ae as pinLocked,
392
+ _e as pinPlan,
393
+ Le as pinnedZone,
394
+ y as refuse,
395
+ xe as replacePlan,
396
+ ve as ruleSet,
397
+ Te as ruleTargets,
398
+ Se as rulesOf,
399
+ ne as unwrapBlocked,
400
+ me as unwrapPlan,
401
+ G as withPin,
402
+ ge as wrapPlan
403
+ };
@@ -0,0 +1,42 @@
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { useState as u, useEffect as g } from "react";
3
+ import { cn as a } from "../../../lib/utils.js";
4
+ import { Setting as f, inputCls as p } from "../settings/controls.js";
5
+ import { readTesting as S, DEFAULT_COST_LIMIT as d, testingPatch as h } from "./testing-model.js";
6
+ function y(r) {
7
+ const { layout: s } = r, l = S(s.conditions), o = l.cost_limit, [n, e] = u(o == null ? "" : String(o));
8
+ g(() => e(o == null ? "" : String(o)), [o]);
9
+ const c = () => {
10
+ const t = Number(n.trim()), i = n.trim() === "" || !Number.isFinite(t) || t <= 0 ? null : Math.round(t);
11
+ if (i === o) return e(i == null ? "" : String(i));
12
+ r.set(
13
+ h(s.conditions, { ...l, cost_limit: i }),
14
+ i == null ? "Reset the form cost limit" : `Set the form cost limit to ${i}`
15
+ );
16
+ };
17
+ return /* @__PURE__ */ m(
18
+ f,
19
+ {
20
+ k: "tool.cost_limit",
21
+ htmlFor: "setting-cost_limit",
22
+ control: /* @__PURE__ */ m(
23
+ "input",
24
+ {
25
+ id: "setting-cost_limit",
26
+ inputMode: "numeric",
27
+ value: n,
28
+ placeholder: String(d),
29
+ onChange: (t) => e(t.target.value.replace(/[^0-9]/g, "")),
30
+ onBlur: c,
31
+ onKeyDown: (t) => {
32
+ t.key === "Enter" && t.target.blur();
33
+ },
34
+ className: a(p, "w-24 font-mono")
35
+ }
36
+ )
37
+ }
38
+ );
39
+ }
40
+ export {
41
+ y as CostLimitSetting
42
+ };