@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,154 @@
1
+ import { isCanvasSlot as K, UNGROUPED_KEY as $ } from "../../../lib/layout-ops.js";
2
+ import { titleCase as v } from "../../../lib/utils.js";
3
+ import { normalizedBundle as P, inPageOrder as M } from "../field-zones.js";
4
+ import { readOverrides as g, withKey as R } from "../inspector/model.js";
5
+ import { refuse as W, checked as C, groupsInPageOrder as L } from "../structure-ops.js";
6
+ const s = (l) => typeof l == "string" && l !== "" ? l : null, y = (l) => l.replace(/\r\n?/g, `
7
+ `).trim(), U = (l, n) => `f:${l}:${n ?? ""}`;
8
+ function O(l) {
9
+ if (l.startsWith("s:")) return { kind: "section", group: l.slice(2) };
10
+ const n = /^f:([^:]+):(.*)$/.exec(l);
11
+ return n ? { kind: "field", field: n[1], group: n[2] === "" ? null : n[2] } : null;
12
+ }
13
+ function S(l, n) {
14
+ const i = g(l);
15
+ return {
16
+ label: s(i.label) ?? s(l.label_override) ?? s(n == null ? void 0 : n.label) ?? v(l.field),
17
+ help: s(i.note) ?? s(n == null ? void 0 : n.note) ?? "",
18
+ placeholder: s(i.placeholder) ?? s(n == null ? void 0 : n.placeholder) ?? "",
19
+ ownLabel: s(i.label) !== null || s(l.label_override) !== null,
20
+ ownHelp: s(i.note) !== null,
21
+ ownPlaceholder: s(i.placeholder) !== null
22
+ };
23
+ }
24
+ function x(l, n = []) {
25
+ const i = P(l), h = new Map(n.map((e) => [e.field, e])), f = new Map(L(i).map((e) => [e.key, e])), u = [], c = /* @__PURE__ */ new Set(), b = (e) => {
26
+ var o;
27
+ return e === null || e === $ ? "Ungrouped" : e === "__header__" ? "Header strip" : ((o = f.get(e)) == null ? void 0 : o.label) ?? v(e);
28
+ };
29
+ for (const e of M(
30
+ i,
31
+ i.placements.filter((o) => !K(o) && !o.field.startsWith("__"))
32
+ )) {
33
+ const o = e.group_key;
34
+ if (o && o !== "__header__" && o !== $ && !c.has(o) && f.has(o)) {
35
+ c.add(o);
36
+ const r = f.get(o);
37
+ r && u.push({
38
+ key: `s:${o}`,
39
+ kind: "section",
40
+ section: r.label,
41
+ field: "",
42
+ label: r.label,
43
+ help: "",
44
+ placeholder: ""
45
+ });
46
+ }
47
+ const t = S(e, h.get(e.field));
48
+ u.push({
49
+ key: U(e.field, o),
50
+ kind: "field",
51
+ section: b(o),
52
+ field: e.field,
53
+ label: t.label,
54
+ help: t.help,
55
+ placeholder: t.placeholder
56
+ });
57
+ }
58
+ return u;
59
+ }
60
+ const D = {
61
+ label: "Label",
62
+ help: "Help text",
63
+ placeholder: "Placeholder"
64
+ }, B = (l) => D[l];
65
+ function G(l, n, i) {
66
+ const h = P(l), f = new Map(n.map((t) => [t.field, t])), u = new Map(x(l, n).map((t) => [t.key, t])), c = [], b = [];
67
+ let e = 0, o = 0;
68
+ for (const t of i) {
69
+ const r = u.get(t.key), p = O(t.key);
70
+ if (!r || !p) {
71
+ e++;
72
+ continue;
73
+ }
74
+ const w = p.kind === "section" ? `Section ${r.label}` : `${r.label} · ${r.section}`;
75
+ let a = !1;
76
+ const d = (m, _, k, H) => {
77
+ if (y(_) !== y(k) && !(y(k) === "" && !H)) {
78
+ if (m === "label" && y(k) === "" && p.kind === "section") {
79
+ b.push(`${r.label}: a section needs a name`);
80
+ return;
81
+ }
82
+ a = !0, c.push({
83
+ id: `${t.key}|${m}`,
84
+ key: t.key,
85
+ prop: m,
86
+ where: w,
87
+ before: _,
88
+ after: y(k)
89
+ });
90
+ }
91
+ };
92
+ if (p.kind === "section")
93
+ d("label", r.label, t.label, !0);
94
+ else {
95
+ const m = h.placements.find(
96
+ (k) => k.field === p.field && k.group_key === p.group
97
+ );
98
+ if (!m) {
99
+ e++;
100
+ continue;
101
+ }
102
+ const _ = S(m, f.get(m.field));
103
+ d("label", r.label, t.label, _.ownLabel), d("help", r.help, t.help, _.ownHelp), d("placeholder", r.placeholder, t.placeholder, _.ownPlaceholder);
104
+ }
105
+ a || o++;
106
+ }
107
+ return { changes: c, unknown: e, skipped: b, same: o };
108
+ }
109
+ function I(l, n) {
110
+ var u;
111
+ if (n.length === 0) return W("Pick at least one change");
112
+ const i = [], h = /* @__PURE__ */ new Map();
113
+ for (const c of n) h.set(c.key, [...h.get(c.key) ?? [], c]);
114
+ for (const [c, b] of h) {
115
+ const e = O(c);
116
+ if (!e) continue;
117
+ if (e.kind === "section") {
118
+ const a = (u = b.find((d) => d.prop === "label")) == null ? void 0 : u.after;
119
+ a && i.push({ op: "group_update", key: e.group, patch: { label: a } });
120
+ continue;
121
+ }
122
+ const o = l.placements.find(
123
+ (a) => a.field === e.field && a.group_key === e.group
124
+ );
125
+ if (!o) continue;
126
+ let t = g(o);
127
+ const r = {};
128
+ let p = !1;
129
+ const w = (a, d) => {
130
+ t = R(t ?? {}, a, d === "" ? void 0 : d), p = !0;
131
+ };
132
+ for (const a of b)
133
+ a.prop === "label" ? s(g(o).label) === null && s(o.label_override) !== null ? r.label_override = a.after === "" ? null : a.after : w("label", a.after) : w(a.prop === "help" ? "note" : "placeholder", a.after);
134
+ p && (r.overrides = t), i.push({
135
+ op: "update_placement",
136
+ at: { field: e.field, group_key: e.group },
137
+ patch: r
138
+ });
139
+ }
140
+ const f = n.length;
141
+ return C(l, {
142
+ ok: !0,
143
+ ops: i,
144
+ label: `Apply ${f} ${f === 1 ? "change" : "changes"} from the help text sheet`,
145
+ notes: []
146
+ });
147
+ }
148
+ export {
149
+ G as diffHelpSheet,
150
+ I as helpSheetPlan,
151
+ x as helpSheetRows,
152
+ U as placementKey,
153
+ B as propWord
154
+ };
@@ -0,0 +1,61 @@
1
+ async function r(e) {
2
+ let a = `Something went wrong (${e.status})`;
3
+ try {
4
+ const t = await e.json();
5
+ t.error && (a = t.error);
6
+ } catch {
7
+ }
8
+ return new Error(a);
9
+ }
10
+ function s(e, a) {
11
+ const t = /filename="([^"]+)"/.exec(e.headers.get("Content-Disposition") ?? "");
12
+ return (t == null ? void 0 : t[1]) ?? a;
13
+ }
14
+ async function i(e, a, t) {
15
+ const o = await fetch(`${e.apiBase}${a}`, {
16
+ headers: e.authHeaders,
17
+ credentials: e.credentials
18
+ });
19
+ if (!o.ok) throw await r(o);
20
+ return { blob: await o.blob(), filename: s(o, t) };
21
+ }
22
+ async function l(e, a, t, o) {
23
+ const n = await fetch(`${e.apiBase}${a}`, {
24
+ method: "POST",
25
+ headers: { ...e.authHeaders, "Content-Type": "application/json" },
26
+ credentials: e.credentials,
27
+ body: JSON.stringify(t)
28
+ });
29
+ if (!n.ok) throw await r(n);
30
+ return { blob: await n.blob(), filename: s(n, o) };
31
+ }
32
+ const d = (e, a) => i(e, `/collection-layouts/${a}/spreadsheet-template`, "template.xlsx"), h = (e, a, t = 5e3) => l(e, `/collection-layouts/${a}/spreadsheet-export`, { limit: t }, "records.xlsx"), p = (e, a) => i(e, `/collection-layouts/${a}/blank-form`, "blank-form.pdf"), u = (e, a, t) => l(e, "/collection-layouts/help-sheet/xlsx", { rows: a, name: t }, "help-text.xlsx");
33
+ async function c(e) {
34
+ const a = new Uint8Array(await e.arrayBuffer());
35
+ let t = "";
36
+ for (let o = 0; o < a.length; o += 32768)
37
+ t += String.fromCharCode(...a.subarray(o, o + 32768));
38
+ return btoa(t);
39
+ }
40
+ async function f(e, a) {
41
+ const t = await fetch(`${e.apiBase}/collection-layouts/help-sheet/parse`, {
42
+ method: "POST",
43
+ headers: { ...e.authHeaders, "Content-Type": "application/json" },
44
+ credentials: e.credentials,
45
+ body: JSON.stringify({ file: await c(a) })
46
+ });
47
+ if (!t.ok) throw await r(t);
48
+ return (await t.json()).data.rows;
49
+ }
50
+ function w({ blob: e, filename: a }) {
51
+ const t = URL.createObjectURL(e), o = document.createElement("a");
52
+ o.href = t, o.download = a, document.body.appendChild(o), o.click(), o.remove(), setTimeout(() => URL.revokeObjectURL(t), 1e3);
53
+ }
54
+ export {
55
+ p as downloadBlankForm,
56
+ u as downloadHelpSheet,
57
+ h as downloadRecords,
58
+ d as downloadTemplate,
59
+ f as parseHelpSheetFile,
60
+ w as saveFile
61
+ };
@@ -2,14 +2,26 @@ import "react/jsx-runtime";
2
2
  import "lucide-react";
3
3
  import "react";
4
4
  import "sonner";
5
- const t = [
5
+ import { post as l } from "../../../lib/commands.js";
6
+ import { barBtn as n } from "../toolbar-kit.js";
7
+ const u = [
6
8
  { type: "grouped", label: "Form", detail: "What people fill in and edit" },
7
9
  { type: "summary", label: "Summary", detail: "Read mode for a saved record" },
8
10
  { type: "detail", label: "Detail", detail: "The panel a list opens when you drill in" },
9
11
  { type: "file", label: "PDF", detail: "A PDF generated from the record" },
10
12
  { type: "addendum", label: "Addendum", detail: "The form for a change to a saved record" },
11
13
  { type: "table", label: "Grid columns", detail: "Columns when shown as a grid in another record" }
12
- ];
14
+ ], y = n, b = "inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-md bg-nvr-cyan px-3 text-[12.5px] font-semibold text-white transition-opacity hover:opacity-90 disabled:opacity-50";
15
+ async function h(o, i) {
16
+ var a;
17
+ const e = await o.request(
18
+ l("/collection-layouts", i)
19
+ ), t = ((a = e == null ? void 0 : e.data) == null ? void 0 : a.id) ?? (e == null ? void 0 : e.id);
20
+ return typeof t == "number" ? t : t != null ? Number(t) : null;
21
+ }
13
22
  export {
14
- t as LAYOUT_TYPES
23
+ u as LAYOUT_TYPES,
24
+ y as btnOutline,
25
+ b as btnPrimary,
26
+ h as createLayout
15
27
  };
@@ -6,6 +6,9 @@ const $ = /^\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}(?:\s*([*+])\s*(-?\d+(?:\.\d+)
6
6
  lte: "is at most",
7
7
  contains: "contains"
8
8
  };
9
+ function C(t) {
10
+ return t.map((e) => e.text).join("");
11
+ }
9
12
  function q(t) {
10
13
  if (!t) return null;
11
14
  if (typeof t == "object") return t;
@@ -17,7 +20,7 @@ function q(t) {
17
20
  return null;
18
21
  }
19
22
  }
20
- function C(t) {
23
+ function v(t) {
21
24
  var o;
22
25
  const e = {};
23
26
  for (const n of t) {
@@ -45,7 +48,7 @@ function S(t) {
45
48
  const e = /^(is|has)\s+(.+)$/i.exec(t), o = e && e[1].toLowerCase() === "has" ? "has" : "is", s = (e ? e[2] : t).split(/\s+/).map((r) => /^[A-Z][a-z][a-z-]*$/.test(r) ? r.toLowerCase() : r).join(" ");
46
49
  return { verb: o, name: s };
47
50
  }
48
- function E(t, e, o, n) {
51
+ function j(t, e, o, n) {
49
52
  var r;
50
53
  if (e == null || e === "") return "empty";
51
54
  if (typeof e == "string") {
@@ -57,7 +60,7 @@ function E(t, e, o, n) {
57
60
  }
58
61
  return ((r = n[t]) == null ? void 0 : r[String(e)]) ?? String(e);
59
62
  }
60
- function L(t, e, o) {
63
+ function E(t, e, o) {
61
64
  var l;
62
65
  const n = x(t.field, e), s = { text: n, strong: !0 };
63
66
  if (t.op === "nnull") return [s, { text: " is set" }];
@@ -70,7 +73,7 @@ function L(t, e, o) {
70
73
  const h = t.op === "eq" ? u : !u, { verb: p, name: a } = S(n), y = p === "has" ? `no ${a}` : `not ${a}`;
71
74
  return [{ text: `${p} ` }, { text: h ? a : y, strong: !0 }, ...i];
72
75
  }
73
- const f = E(t.field, t.value, e, o);
76
+ const f = j(t.field, t.value, e, o);
74
77
  if (t.op === "eq") return [{ text: `${n} is ` }, { text: f, strong: !0 }];
75
78
  if (t.op === "neq")
76
79
  return [{ text: `${n} is not ` }, { text: f, strong: !0 }, ...i];
@@ -83,23 +86,23 @@ function g(t) {
83
86
  n > 0 && e.push({ text: " and " }), e.push(...o);
84
87
  }), e;
85
88
  }
86
- function O(t, e, o) {
89
+ function L(t, e, o) {
87
90
  if (!(t != null && t.length)) return [];
88
91
  const n = new Map(e.map((s) => [s.field, s]));
89
- return g(t.map((s) => L(s, n, o)));
92
+ return g(t.map((s) => E(s, n, o)));
90
93
  }
91
- function R(t) {
94
+ function O(t) {
92
95
  return t.length ? [
93
96
  { text: "for " },
94
97
  ...g(t.map((e) => [{ text: e, strong: !0 }])),
95
98
  { text: " only" }
96
99
  ] : [];
97
100
  }
98
- function v(t, e, o) {
99
- const n = R(t.role_names ?? []);
101
+ function z(t, e, o) {
102
+ const n = O(t.role_names ?? []);
100
103
  switch (t.kind) {
101
104
  case "record_rule": {
102
- const s = O(t.rules, e, o);
105
+ const s = L(t.rules, e, o);
103
106
  return n.length ? s.length ? [...s, { text: ", " }, ...n] : n : s;
104
107
  }
105
108
  case "role":
@@ -108,14 +111,21 @@ function v(t, e, o) {
108
111
  case "fallback":
109
112
  return [{ text: "anything else", strong: !0 }];
110
113
  case "type_use":
114
+ case "ab":
111
115
  return t.type_use ? [{ text: t.type_use }] : [];
116
+ case "phone":
117
+ return [
118
+ { text: "on small screens, instead of " },
119
+ { text: t.phone_of_name ?? "its form", strong: !0 }
120
+ ];
112
121
  default:
113
122
  return [];
114
123
  }
115
124
  }
116
125
  export {
117
- C as choiceLabelsFrom,
118
- O as describeConditions,
119
- v as describeReason,
120
- R as describeRoles
126
+ v as choiceLabelsFrom,
127
+ L as describeConditions,
128
+ z as describeReason,
129
+ O as describeRoles,
130
+ C as segmentsText
121
131
  };
@@ -1,141 +1,158 @@
1
- import { useQuery as q, useQueryClient as _, useQueries as T } from "@tanstack/react-query";
2
- import { useCallback as F, useMemo as h } from "react";
3
- import { useNivaroClient as d, useItemEditAuth as w } from "../../../context.js";
4
- import { get as f } from "../../../lib/commands.js";
5
- import { USER_SYSTEM_COLS as C, userDisplayLabel as $, renderDisplayTemplate as O } from "../../pipeline/relations.js";
6
- import { collectionMetaKey as L, useCollectionBody as K } from "../collection-meta.js";
7
- import { choiceLabelsFrom as E } from "./describe-conditions.js";
8
- import { recordCountFilter as N } from "./record-count.js";
9
- const m = {
1
+ import { useQuery as h, useQueryClient as _, useQueries as K } from "@tanstack/react-query";
2
+ import { useCallback as S, useMemo as g } from "react";
3
+ import { useNivaroClient as p, useItemEditAuth as T } from "../../../context.js";
4
+ import { get as d } from "../../../lib/commands.js";
5
+ import { USER_SYSTEM_COLS as w, userDisplayLabel as C, renderDisplayTemplate as $ } from "../../pipeline/relations.js";
6
+ import { collectionMetaKey as L, useCollectionBody as F } from "../collection-meta.js";
7
+ import { choiceLabelsFrom as O } from "./describe-conditions.js";
8
+ import { recordCountFilter as A } from "./record-count.js";
9
+ const v = {
10
10
  overview: (e) => ["layout-editor", "overview", e],
11
11
  fields: (e) => ["layout-editor", "fields", e],
12
12
  meta: (e) => L(e),
13
13
  roles: () => ["layout-editor", "roles"]
14
14
  };
15
- function Q(e, l) {
15
+ function j(e, r) {
16
16
  if (!e || typeof e != "object") return null;
17
- if (l in e) return e;
17
+ if (r in e) return e;
18
18
  const t = e.data;
19
19
  return t && typeof t == "object" ? t : null;
20
20
  }
21
21
  function U(e) {
22
- const l = d();
23
- return q({
24
- queryKey: m.overview(e),
22
+ const r = p();
23
+ return h({
24
+ queryKey: v.overview(e),
25
25
  queryFn: async () => {
26
- const t = await l.request(f("/collection-layouts/overview", { collection: e })), n = Q(t, "rows");
26
+ const t = await r.request(d("/collection-layouts/overview", { collection: e })), n = j(t, "rows");
27
27
  return { rows: (n == null ? void 0 : n.rows) ?? [], warning: (n == null ? void 0 : n.warning) ?? null };
28
28
  },
29
29
  staleTime: 15e3
30
30
  });
31
31
  }
32
- function b(e) {
33
- const l = d();
34
- return q({
35
- queryKey: m.fields(e),
36
- queryFn: () => l.request(f(`/field-config/${e}`)).then((t) => t.data ?? []),
32
+ function x(e) {
33
+ const r = p();
34
+ return h({
35
+ queryKey: v.fields(e),
36
+ queryFn: () => r.request(d(`/field-config/${e}`)).then((t) => t.data ?? []),
37
37
  staleTime: 6e4
38
38
  });
39
39
  }
40
- function x(e, l) {
41
- const t = K(e, {
42
- enabled: l,
40
+ function z(e, r) {
41
+ const t = F(e, {
42
+ enabled: r,
43
43
  select: (n) => typeof (n == null ? void 0 : n.display_template) == "string" ? n.display_template : null
44
44
  });
45
45
  return t.isError ? { ...t, data: null } : t;
46
46
  }
47
- function z(e) {
48
- const l = d();
49
- return q({
50
- queryKey: m.roles(),
51
- queryFn: () => l.request(f("/roles")).then((t) => (t.data ?? []).map((n) => ({ id: String(n.id), name: String(n.name) }))),
47
+ function B(e) {
48
+ const r = p();
49
+ return h({
50
+ queryKey: v.roles(),
51
+ queryFn: () => r.request(d("/roles")).then((t) => (t.data ?? []).map((n) => ({ id: String(n.id), name: String(n.name) }))),
52
52
  enabled: e,
53
53
  staleTime: 5 * 6e4
54
54
  });
55
55
  }
56
- function B(e) {
57
- const l = _();
58
- return F(
56
+ function V(e) {
57
+ const r = _();
58
+ return S(
59
59
  (t) => {
60
60
  const n = t != null && t.lazy ? "none" : "active";
61
- for (const y of [
62
- m.overview(e),
61
+ for (const s of [
62
+ v.overview(e),
63
+ ["layout-editor", "health", e],
63
64
  ["collection-layouts", e],
64
65
  ["active-layout", e]
65
66
  ])
66
- l.invalidateQueries({ queryKey: y, refetchType: n });
67
+ r.invalidateQueries({ queryKey: s, refetchType: n });
67
68
  },
68
- [l, e]
69
+ [r, e]
69
70
  );
70
71
  }
71
- function Y(e, l, t, n = !0) {
72
- const y = d(), { userId: v } = w(), i = l ? N(l, t) : null;
73
- return q({
74
- queryKey: ["layout-editor", "record-count", v, e, i],
75
- queryFn: () => y.request(
76
- f(`/items/${e}`, {
72
+ function Y(e, r) {
73
+ var i, q;
74
+ const t = e, n = (t == null ? void 0 : t.status) ?? ((i = t == null ? void 0 : t.response) == null ? void 0 : i.status) ?? null, s = ((q = t == null ? void 0 : t.response) == null ? void 0 : q.data) ?? (t == null ? void 0 : t.response), f = typeof (s == null ? void 0 : s.error) == "string" && s.error || typeof (s == null ? void 0 : s.message) == "string" && s.message || r, o = Array.isArray(s == null ? void 0 : s.references) ? s.references.filter((m) => m && typeof m.label == "string") : [];
75
+ return { status: n, message: f, references: o };
76
+ }
77
+ function G(e, r, t, n = !0) {
78
+ const s = p(), { userId: f } = T(), o = r ? A(r, t) : null;
79
+ return h({
80
+ queryKey: ["layout-editor", "record-count", f, e, o],
81
+ queryFn: () => s.request(
82
+ d(`/items/${e}`, {
77
83
  limit: 1,
78
- ...i && Object.keys(i).length ? { filter: JSON.stringify(i) } : {}
84
+ ...o && Object.keys(o).length ? { filter: JSON.stringify(o) } : {}
79
85
  })
80
- ).then((s) => typeof (s == null ? void 0 : s.total) == "number" ? s.total : null),
81
- enabled: n && !!l && i != null,
86
+ ).then((i) => typeof (i == null ? void 0 : i.total) == "number" ? i.total : null),
87
+ enabled: n && !!r && o != null,
82
88
  staleTime: 6e4,
83
89
  retry: !1
84
90
  });
85
91
  }
86
- function G(e, l, t) {
87
- const n = d(), y = _(), { data: v = [] } = K(e, {
88
- select: (r) => Array.isArray(r == null ? void 0 : r.relations) ? r.relations : []
89
- }), i = h(() => E(l), [l]), s = h(() => {
90
- const r = /* @__PURE__ */ new Map();
91
- for (const c of t)
92
- for (const o of c.reason.rules ?? []) {
93
- if (o.op !== "eq" && o.op !== "neq" || o.value == null || o.value === "" || i[o.field] || typeof o.value == "string" && o.value.includes("{{")) continue;
94
- const u = v.find(
95
- (p) => p.many_collection === e && p.many_field === o.field && p.junction_field == null && !!p.one_collection
96
- );
97
- if (!(u != null && u.one_collection)) continue;
98
- const a = String(o.value);
99
- r.set(`${o.field}:${a}`, { field: o.field, value: a, related: u.one_collection });
100
- }
101
- return [...r.values()];
102
- }, [t, v, i, e]), S = T({
103
- queries: s.map((r) => ({
104
- queryKey: ["layout-editor", "rule-label", r.related, r.value],
92
+ function H(e, r, t) {
93
+ const n = g(() => {
94
+ const s = [];
95
+ for (const f of t)
96
+ for (const o of f.reason.rules ?? [])
97
+ (o.op === "eq" || o.op === "neq") && s.push({ field: o.field, value: o.value });
98
+ return s;
99
+ }, [t]);
100
+ return E(e, r, n);
101
+ }
102
+ function E(e, r, t) {
103
+ const n = p(), s = _(), { data: f = [] } = F(e, {
104
+ select: (l) => Array.isArray(l == null ? void 0 : l.relations) ? l.relations : []
105
+ }), o = g(() => O(r), [r]), i = g(() => {
106
+ const l = /* @__PURE__ */ new Map();
107
+ for (const u of t) {
108
+ if (u.value == null || u.value === "" || o[u.field] || typeof u.value == "object" || typeof u.value == "string" && u.value.includes("{{")) continue;
109
+ const a = f.find(
110
+ (c) => c.many_collection === e && c.many_field === u.field && c.junction_field == null && !!c.one_collection
111
+ );
112
+ if (!(a != null && a.one_collection)) continue;
113
+ const y = String(u.value);
114
+ l.set(`${u.field}:${y}`, { field: u.field, value: y, related: a.one_collection });
115
+ }
116
+ return [...l.values()];
117
+ }, [t, f, o, e]), q = K({
118
+ queries: i.map((l) => ({
119
+ queryKey: ["layout-editor", "rule-label", l.related, l.value],
105
120
  queryFn: async () => {
106
- const c = C.has(r.related), o = await n.request(
107
- c ? f(`/users/${r.value}`) : f(`/items/${r.related}/${r.value}`, { fields: "*" })
108
- ).then((a) => a.data);
109
- if (!o) return null;
110
- if (c) return $(o);
111
- const u = await y.fetchQuery({
112
- queryKey: m.meta(r.related),
121
+ const u = w.has(l.related), a = await n.request(
122
+ u ? d(`/users/${l.value}`) : d(`/items/${l.related}/${l.value}`, { fields: "*" })
123
+ ).then((c) => c.data);
124
+ if (!a) return null;
125
+ if (u) return C(a);
126
+ const y = await s.fetchQuery({
127
+ queryKey: v.meta(l.related),
113
128
  queryFn: () => n.request(
114
- f(`/collections/${r.related}`)
115
- ).then((a) => a.data),
129
+ d(`/collections/${l.related}`)
130
+ ).then((c) => c.data),
116
131
  staleTime: 5 * 6e4
117
132
  });
118
- return O((u == null ? void 0 : u.display_template) ?? null, o) || null;
133
+ return $((y == null ? void 0 : y.display_template) ?? null, a) || null;
119
134
  },
120
135
  staleTime: 30 * 6e4,
121
136
  retry: !1
122
137
  }))
123
- }), g = JSON.stringify(S.map((r) => r.data ?? null));
124
- return h(() => {
125
- const r = JSON.parse(g), c = { ...i };
126
- return s.forEach((o, u) => {
127
- const a = r[u];
128
- a && (c[o.field] = { ...c[o.field] ?? {}, [o.value]: a });
129
- }), c;
130
- }, [i, s, g]);
138
+ }), m = JSON.stringify(q.map((l) => l.data ?? null));
139
+ return g(() => {
140
+ const l = JSON.parse(m), u = { ...o };
141
+ return i.forEach((a, y) => {
142
+ const c = l[y];
143
+ c && (u[a.field] = { ...u[a.field] ?? {}, [a.value]: c });
144
+ }), u;
145
+ }, [o, i, m]);
131
146
  }
132
147
  export {
133
- m as overviewKeys,
134
- Y as useApproxRecordCount,
135
- x as useDisplayTemplate,
136
- B as useInvalidateLayouts,
148
+ Y as apiFailure,
149
+ v as overviewKeys,
150
+ G as useApproxRecordCount,
151
+ z as useDisplayTemplate,
152
+ V as useInvalidateLayouts,
137
153
  U as useLayoutOverview,
138
- b as useOverviewFields,
139
- z as useRoleNames,
140
- G as useRuleChoiceLabels
154
+ x as useOverviewFields,
155
+ B as useRoleNames,
156
+ H as useRuleChoiceLabels,
157
+ E as useValueLabels
141
158
  };
@@ -1,5 +1,6 @@
1
- import { jsx as l } from "react/jsx-runtime";
2
- import { Fragment as a } from "react";
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import "lucide-react";
3
+ import { Fragment as l } from "react";
3
4
  import { cn as i } from "../../../lib/utils.js";
4
5
  import { describeReason as d } from "./describe-conditions.js";
5
6
  const o = {
@@ -9,19 +10,19 @@ const o = {
9
10
  addendum: "Addendum form",
10
11
  table: "Grid columns"
11
12
  };
12
- function m({ segs: e, muted: n }) {
13
- return e.length ? /* @__PURE__ */ l("span", { className: n ? "text-slate-500 dark:text-muted-foreground" : void 0, children: e.map(
13
+ function c({ segs: e, muted: n }) {
14
+ return e.length ? /* @__PURE__ */ a("span", { className: n ? "text-slate-500 dark:text-muted-foreground" : void 0, children: e.map(
14
15
  (r, t) => r.strong ? (
15
16
  // biome-ignore lint/suspicious/noArrayIndexKey: segments are positional
16
- /* @__PURE__ */ l("b", { className: "font-semibold text-slate-900 dark:text-foreground", children: r.text }, t)
17
+ /* @__PURE__ */ a("b", { className: "font-semibold text-slate-900 dark:text-foreground", children: r.text }, t)
17
18
  ) : (
18
19
  // biome-ignore lint/suspicious/noArrayIndexKey: segments are positional
19
- /* @__PURE__ */ l(a, { children: r.text }, t)
20
+ /* @__PURE__ */ a(l, { children: r.text }, t)
20
21
  )
21
- ) }) : /* @__PURE__ */ l("span", { className: "text-slate-400 dark:text-muted-foreground", children: "—" });
22
+ ) }) : /* @__PURE__ */ a("span", { className: "text-slate-400 dark:text-muted-foreground", children: "—" });
22
23
  }
23
- function x({ tone: e, children: n }) {
24
- return /* @__PURE__ */ l(
24
+ function b({ tone: e, children: n }) {
25
+ return /* @__PURE__ */ a(
25
26
  "span",
26
27
  {
27
28
  className: i(
@@ -29,14 +30,15 @@ function x({ tone: e, children: n }) {
29
30
  e === "default" && "bg-nvr-cyan/15 text-[#0089ad] dark:text-nvr-cyan",
30
31
  e === "rule" && "bg-indigo-50 text-indigo-700 dark:bg-indigo-500/15 dark:text-indigo-300",
31
32
  e === "role" && "bg-amber-50 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300",
32
- (e === "link" || e === "view") && "bg-slate-100 text-slate-600 dark:bg-muted dark:text-muted-foreground"
33
+ (e === "link" || e === "view") && "bg-slate-100 text-slate-600 dark:bg-muted dark:text-muted-foreground",
34
+ e === "frozen" && "gap-1 bg-amber-50 text-amber-800 dark:bg-amber-500/15 dark:text-amber-200"
33
35
  ),
34
36
  children: n
35
37
  }
36
38
  );
37
39
  }
38
40
  function k(e) {
39
- return e.section === "forms" ? e.is_default ? { tone: "default", text: "default" } : e.reason.kind === "record_rule" ? { tone: "rule", text: "rule" } : e.reason.kind === "role" ? { tone: "role", text: "role" } : null : e.section === "link_only" ? { tone: "link", text: "link only" } : e.section === "other_views" && e.is_default ? { tone: "default", text: "default" } : null;
41
+ return e.section === "forms" ? e.is_default ? { tone: "default", text: "default" } : e.reason.kind === "record_rule" ? { tone: "rule", text: "rule" } : e.reason.kind === "role" ? { tone: "role", text: "role" } : e.reason.kind === "ab" ? { tone: "role", text: "A/B" } : e.reason.kind === "phone" ? { tone: "view", text: "phone" } : null : e.section === "link_only" ? { tone: "link", text: "link only" } : e.section === "other_views" && e.is_default ? { tone: "default", text: "default" } : null;
40
42
  }
41
43
  function p(e, n, r) {
42
44
  switch (e.section) {
@@ -54,8 +56,8 @@ function p(e, n, r) {
54
56
  }
55
57
  }
56
58
  export {
57
- x as Pill,
58
- m as Sentence,
59
+ b as Pill,
60
+ c as Sentence,
59
61
  o as TYPE_USE,
60
62
  p as purposeSegments,
61
63
  k as rowPill