@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
@@ -1,44 +1,45 @@
1
- import { jsxs as s, jsx as t, Fragment as T } from "react/jsx-runtime";
2
- import { useQueryClient as M, useQuery as f, useMutation as S } from "@tanstack/react-query";
1
+ import { jsxs as n, jsx as t, Fragment as T } from "react/jsx-runtime";
2
+ import { useQueryClient as $, useQuery as f, useMutation as S } from "@tanstack/react-query";
3
3
  import { Plus as V, Search as P, LifeBuoy as I } from "lucide-react";
4
- import { useState as c, useRef as U, useEffect as K } from "react";
5
- import { useNivaroClient as $, useItemEditAuth as W } from "../../context.js";
4
+ import { useState as c, useRef as U, useEffect as M } from "react";
5
+ import { useNivaroClient as R, useItemEditAuth as W } from "../../context.js";
6
6
  import { get as v, patch as Y, post as z, del as H } from "../../lib/commands.js";
7
7
  import { useLiveOps as J } from "../../lib/live-ops.js";
8
8
  import { RelationCombobox as X } from "../item-edit/RelationCombobox.js";
9
9
  import { SimpleSelect as Z } from "../ui/SimpleSelect.js";
10
- import { SupportRequestDialog as ee } from "./SupportRequestDialog.js";
11
- import { StatusPill as te, TicketDetailSheet as ae } from "./TicketDetailSheet.js";
12
- function re(l) {
10
+ import { SupportAnalytics as ee } from "./SupportAnalytics.js";
11
+ import { SupportRequestDialog as te } from "./SupportRequestDialog.js";
12
+ import { StatusPill as ae, TicketDetailSheet as re } from "./TicketDetailSheet.js";
13
+ function se(l) {
13
14
  if (!l) return "";
14
15
  const i = Math.round((Date.now() - new Date(l).getTime()) / 6e4);
15
16
  if (i < 60) return `${Math.max(i, 1)}m ago`;
16
- const o = Math.round(i / 60);
17
- return o < 48 ? `${o}h ago` : `${Math.round(o / 24)}d ago`;
17
+ const d = Math.round(i / 60);
18
+ return d < 48 ? `${d}h ago` : `${Math.round(d / 24)}d ago`;
18
19
  }
19
- function be({
20
+ function ye({
20
21
  initialTicketId: l,
21
22
  onTicketChange: i,
22
- className: o
23
+ className: d
23
24
  }) {
24
- const p = $(), m = M(), h = W(), x = !!(h != null && h.isAdmin), [n, b] = c("mine"), y = U(!1), a = (e) => {
25
+ const p = R(), m = $(), h = W(), x = !!(h != null && h.isAdmin), [s, b] = c("mine"), y = U(!1), a = (e) => {
25
26
  y.current = !0, b(e);
26
- }, [r, _] = c(l ?? null), [R, C] = c(!1), [k, F] = c("open"), [g, Q] = c("unassigned"), [N, O] = c("");
27
- K(() => {
27
+ }, [r, _] = c(l ?? null), [Q, C] = c(!1), [k, A] = c("open"), [g, O] = c("unassigned"), [N, j] = c("");
28
+ M(() => {
28
29
  l != null && _(l);
29
30
  }, [l]);
30
- const { data: d } = f({
31
+ const { data: o } = f({
31
32
  queryKey: ["support-summary"],
32
33
  queryFn: () => p.request(v("/support/summary")).then((e) => e.data)
33
- }), j = !!(d != null && d.desk);
34
+ }), F = !!(o != null && o.desk);
34
35
  J("support", () => {
35
36
  m.invalidateQueries({ queryKey: ["support-tickets"] }), m.invalidateQueries({ queryKey: ["support-summary"] }), m.invalidateQueries({ queryKey: ["support-ticket"] });
36
37
  });
37
- const [A, B] = c(!1);
38
- K(() => {
39
- !A && d && (d.desk && !y.current && b("desk"), B(!0));
40
- }, [d, A]);
41
- const w = n === "desk" ? {
38
+ const [D, B] = c(!1);
39
+ M(() => {
40
+ !D && o && (o.desk && !y.current && b("desk"), B(!0));
41
+ }, [o, D]);
42
+ const w = s === "desk" ? {
42
43
  scope: "desk",
43
44
  status: g === "closed" ? "closed" : "open",
44
45
  ...g === "unassigned" ? { assignee: "unassigned" } : {},
@@ -48,25 +49,26 @@ function be({
48
49
  const { data: u, isLoading: E } = f({
49
50
  queryKey: ["support-tickets", w],
50
51
  queryFn: () => p.request(v("/support/tickets", w)),
51
- enabled: n !== "types"
52
+ enabled: s !== "types" && s !== "analytics"
52
53
  }), q = (e) => {
53
54
  _(e), i == null || i(e);
54
55
  }, G = [
55
- { key: "mine", label: "My requests", count: d == null ? void 0 : d.mine_open },
56
- ...j ? [{ key: "desk", label: "Desk", count: d == null ? void 0 : d.unassigned }] : [],
56
+ { key: "mine", label: "My requests", count: o == null ? void 0 : o.mine_open },
57
+ ...F ? [{ key: "desk", label: "Desk", count: o == null ? void 0 : o.unassigned }] : [],
58
+ ...F ? [{ key: "analytics", label: "Analytics" }] : [],
57
59
  ...x ? [{ key: "types", label: "Request types" }] : []
58
60
  ];
59
- return /* @__PURE__ */ s("div", { className: o, "data-support-view": !0, children: [
60
- /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
61
- /* @__PURE__ */ t("div", { className: "flex items-center gap-1", role: "tablist", children: G.map((e) => /* @__PURE__ */ s(
61
+ return /* @__PURE__ */ n("div", { className: d, "data-support-view": !0, children: [
62
+ /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
63
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-1", role: "tablist", children: G.map((e) => /* @__PURE__ */ n(
62
64
  "button",
63
65
  {
64
66
  type: "button",
65
67
  role: "tab",
66
- "aria-selected": n === e.key,
68
+ "aria-selected": s === e.key,
67
69
  "data-support-tab": e.key,
68
70
  onClick: () => a(e.key),
69
- className: n === e.key ? "inline-flex h-8 items-center gap-1.5 rounded-md bg-nvr-cyan/10 px-3 text-[12.5px] font-medium text-nvr-navy dark:text-nvr-cyan" : "inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-[12.5px] text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-white/5",
71
+ className: s === e.key ? "inline-flex h-8 items-center gap-1.5 rounded-md bg-nvr-cyan/10 px-3 text-[12.5px] font-medium text-nvr-navy dark:text-nvr-cyan" : "inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-[12.5px] text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-white/5",
70
72
  children: [
71
73
  e.label,
72
74
  e.count ? /* @__PURE__ */ t("span", { className: "rounded-full bg-slate-200 px-1.5 text-[10.5px] font-semibold tabular-nums text-slate-700 dark:bg-white/10 dark:text-slate-200", children: e.count }) : null
@@ -74,7 +76,7 @@ function be({
74
76
  },
75
77
  e.key
76
78
  )) }),
77
- /* @__PURE__ */ s(
79
+ /* @__PURE__ */ n(
78
80
  "button",
79
81
  {
80
82
  type: "button",
@@ -88,9 +90,9 @@ function be({
88
90
  }
89
91
  )
90
92
  ] }),
91
- n === "types" ? /* @__PURE__ */ t(se, {}) : /* @__PURE__ */ s(T, { children: [
92
- /* @__PURE__ */ s("div", { className: "mt-4 flex flex-wrap items-center gap-2", children: [
93
- (n === "desk" ? [
93
+ s === "types" ? /* @__PURE__ */ t(ne, {}) : s === "analytics" ? /* @__PURE__ */ t(ee, {}) : /* @__PURE__ */ n(T, { children: [
94
+ /* @__PURE__ */ n("div", { className: "mt-4 flex flex-wrap items-center gap-2", children: [
95
+ (s === "desk" ? [
94
96
  ["unassigned", "Not picked up"],
95
97
  ["me", "Mine"],
96
98
  ["open", "All open"],
@@ -99,27 +101,27 @@ function be({
99
101
  ["open", "Open"],
100
102
  ["closed", "Closed"]
101
103
  ]).map(([e, L]) => {
102
- const D = n === "desk" ? g === e : k === e;
104
+ const K = s === "desk" ? g === e : k === e;
103
105
  return /* @__PURE__ */ t(
104
106
  "button",
105
107
  {
106
108
  type: "button",
107
109
  "data-support-filter": e,
108
- "aria-pressed": D,
109
- onClick: () => n === "desk" ? Q(e) : F(e),
110
- className: D ? "h-7 rounded-full border border-nvr-cyan/60 bg-nvr-cyan/10 px-2.5 text-[12px] font-medium text-nvr-navy dark:text-nvr-cyan" : "h-7 rounded-full border border-slate-200 px-2.5 text-[12px] text-slate-600 hover:border-slate-300 dark:border-border dark:text-slate-300",
110
+ "aria-pressed": K,
111
+ onClick: () => s === "desk" ? O(e) : A(e),
112
+ className: K ? "h-7 rounded-full border border-nvr-cyan/60 bg-nvr-cyan/10 px-2.5 text-[12px] font-medium text-nvr-navy dark:text-nvr-cyan" : "h-7 rounded-full border border-slate-200 px-2.5 text-[12px] text-slate-600 hover:border-slate-300 dark:border-border dark:text-slate-300",
111
113
  children: L
112
114
  },
113
115
  e
114
116
  );
115
117
  }),
116
- /* @__PURE__ */ s("label", { className: "ml-auto flex h-8 items-center gap-1.5 rounded-md border border-slate-200 bg-white px-2 dark:border-border dark:bg-background", children: [
118
+ /* @__PURE__ */ n("label", { className: "ml-auto flex h-8 items-center gap-1.5 rounded-md border border-slate-200 bg-white px-2 dark:border-border dark:bg-background", children: [
117
119
  /* @__PURE__ */ t(P, { className: "h-3.5 w-3.5 text-slate-400" }),
118
120
  /* @__PURE__ */ t(
119
121
  "input",
120
122
  {
121
123
  value: N,
122
- onChange: (e) => O(e.target.value),
124
+ onChange: (e) => j(e.target.value),
123
125
  placeholder: "Search requests",
124
126
  "aria-label": "Search requests",
125
127
  className: "w-48 bg-transparent text-[12.5px] text-slate-900 outline-none dark:text-slate-100"
@@ -133,7 +135,7 @@ function be({
133
135
  className: "h-10 animate-pulse rounded bg-[hsl(var(--nvr-skeleton))]"
134
136
  },
135
137
  e
136
- )) }) : u != null && u.data.length ? /* @__PURE__ */ t("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", "data-support-list": !0, children: u.data.map((e) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ s(
138
+ )) }) : u != null && u.data.length ? /* @__PURE__ */ t("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", "data-support-list": !0, children: u.data.map((e) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ n(
137
139
  "button",
138
140
  {
139
141
  type: "button",
@@ -141,9 +143,9 @@ function be({
141
143
  onClick: () => q(e.id),
142
144
  className: "grid w-full grid-cols-[1fr_auto] items-start gap-3 px-4 py-2.5 text-left hover:bg-slate-50 dark:hover:bg-white/5",
143
145
  children: [
144
- /* @__PURE__ */ s("span", { className: "min-w-0", children: [
145
- /* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
146
- /* @__PURE__ */ s("span", { className: "font-mono text-[11px] text-slate-400", children: [
146
+ /* @__PURE__ */ n("span", { className: "min-w-0", children: [
147
+ /* @__PURE__ */ n("span", { className: "flex items-center gap-2", children: [
148
+ /* @__PURE__ */ n("span", { className: "font-mono text-[11px] text-slate-400", children: [
147
149
  "#",
148
150
  e.id
149
151
  ] }),
@@ -153,23 +155,23 @@ function be({
153
155
  /* @__PURE__ */ t("span", { className: "mt-0.5 block truncate text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
154
156
  e.record_label ?? "General Support",
155
157
  e.category_name,
156
- n === "desk" ? e.requester_name : null,
158
+ s === "desk" ? e.requester_name : null,
157
159
  e.assignee_name ? `with ${e.assignee_name}` : null,
158
160
  e.replies ? `${e.replies} repl${e.replies === 1 ? "y" : "ies"}` : null
159
161
  ].filter(Boolean).join(" · ") })
160
162
  ] }),
161
- /* @__PURE__ */ s("span", { className: "flex flex-col items-end gap-1", children: [
162
- /* @__PURE__ */ t(te, { status: e.status, label: e.status_label }),
163
- /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400", children: re(e.updated_at ?? e.created_at) })
163
+ /* @__PURE__ */ n("span", { className: "flex flex-col items-end gap-1", children: [
164
+ /* @__PURE__ */ t(ae, { status: e.status, label: e.status_label }),
165
+ /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400", children: se(e.updated_at ?? e.created_at) })
164
166
  ] })
165
167
  ]
166
168
  }
167
- ) }, e.id)) }) : /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-2 px-6 py-12 text-center", children: [
169
+ ) }, e.id)) }) : /* @__PURE__ */ n("div", { className: "flex flex-col items-center gap-2 px-6 py-12 text-center", children: [
168
170
  /* @__PURE__ */ t(I, { className: "h-6 w-6 text-slate-300" }),
169
- /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-700 dark:text-slate-200", children: n === "desk" ? g === "unassigned" ? "Every request has been picked up." : "Nothing here." : k === "open" ? "You have no open requests." : "No closed requests yet." }),
170
- n === "mine" && /* @__PURE__ */ t("p", { className: "max-w-sm text-[12px] text-slate-500 dark:text-muted-foreground", children: "Use Get help for anything general, or Request a change from a record's ⋯ menu to ask for a change to that record." })
171
+ /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-700 dark:text-slate-200", children: s === "desk" ? g === "unassigned" ? "Every request has been picked up." : "Nothing here." : k === "open" ? "You have no open requests." : "No closed requests yet." }),
172
+ s === "mine" && /* @__PURE__ */ t("p", { className: "max-w-sm text-[12px] text-slate-500 dark:text-muted-foreground", children: "Use Get help for anything general, or Request a change from a record's ⋯ menu to ask for a change to that record." })
171
173
  ] }) }),
172
- u && u.total > u.data.length && /* @__PURE__ */ s("p", { className: "mt-2 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
174
+ u && u.total > u.data.length && /* @__PURE__ */ n("p", { className: "mt-2 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
173
175
  "Showing ",
174
176
  u.data.length,
175
177
  " of ",
@@ -178,30 +180,30 @@ function be({
178
180
  ] })
179
181
  ] }),
180
182
  /* @__PURE__ */ t(
181
- ee,
183
+ te,
182
184
  {
183
- open: R,
185
+ open: Q,
184
186
  onOpenChange: C,
185
187
  onCreated: (e) => {
186
- a("mine"), F("open"), q(e.id);
188
+ a("mine"), A("open"), q(e.id);
187
189
  }
188
190
  }
189
191
  ),
190
- /* @__PURE__ */ t(ae, { ticketId: r, onOpenChange: (e) => !e && q(null) })
192
+ /* @__PURE__ */ t(re, { ticketId: r, onOpenChange: (e) => !e && q(null) })
191
193
  ] });
192
194
  }
193
- function se() {
194
- const l = $(), i = M(), [o, p] = c(""), { data: m = [] } = f({
195
+ function ne() {
196
+ const l = R(), i = $(), [d, p] = c(""), { data: m = [] } = f({
195
197
  queryKey: ["support-categories", "all"],
196
198
  queryFn: () => l.request(v("/support/categories", { all: "1" })).then((a) => a.data ?? [])
197
199
  }), { data: h = [] } = f({
198
200
  queryKey: ["support-teams"],
199
201
  queryFn: () => l.request(v("/user-groups")).then((a) => a.data ?? []).catch(() => [])
200
- }), x = () => void i.invalidateQueries({ queryKey: ["support-categories"] }), n = S({
202
+ }), x = () => void i.invalidateQueries({ queryKey: ["support-categories"] }), s = S({
201
203
  mutationFn: ({ id: a, body: r }) => l.request(Y(`/support/categories/${a}`, r)),
202
204
  onSuccess: x
203
205
  }), b = S({
204
- mutationFn: () => l.request(z("/support/categories", { name: o.trim() })),
206
+ mutationFn: () => l.request(z("/support/categories", { name: d.trim() })),
205
207
  onSuccess: () => {
206
208
  p(""), x();
207
209
  }
@@ -209,10 +211,10 @@ function se() {
209
211
  mutationFn: (a) => l.request(H(`/support/categories/${a}`)),
210
212
  onSuccess: x
211
213
  });
212
- return /* @__PURE__ */ s("div", { className: "mt-4 space-y-3", "data-support-types-editor": !0, children: [
214
+ return /* @__PURE__ */ n("div", { className: "mt-4 space-y-3", "data-support-types-editor": !0, children: [
213
215
  /* @__PURE__ */ t("p", { className: "max-w-2xl text-[12.5px] text-slate-500 dark:text-muted-foreground", children: "The kinds of request people pick from. A type tied to a collection is offered on those records only; without one it is offered everywhere, including General Support. With no team a request goes to every administrator; a default assignee skips the desk entirely." }),
214
- /* @__PURE__ */ t("div", { className: "overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ s("table", { className: "w-full text-[12.5px]", children: [
215
- /* @__PURE__ */ t("thead", { className: "bg-slate-50 text-left text-[11px] uppercase tracking-wide text-slate-500 dark:bg-white/5 dark:text-muted-foreground", children: /* @__PURE__ */ s("tr", { children: [
216
+ /* @__PURE__ */ t("div", { className: "overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ n("table", { className: "w-full text-[12.5px]", children: [
217
+ /* @__PURE__ */ t("thead", { className: "bg-slate-50 text-left text-[11px] uppercase tracking-wide text-slate-500 dark:bg-white/5 dark:text-muted-foreground", children: /* @__PURE__ */ n("tr", { children: [
216
218
  /* @__PURE__ */ t("th", { className: "px-3 py-2 font-medium", children: "Type" }),
217
219
  /* @__PURE__ */ t("th", { className: "px-3 py-2 font-medium", children: "For records in" }),
218
220
  /* @__PURE__ */ t("th", { className: "px-3 py-2 font-medium", children: "Team" }),
@@ -220,12 +222,12 @@ function se() {
220
222
  /* @__PURE__ */ t("th", { className: "px-3 py-2 font-medium", children: "Active" }),
221
223
  /* @__PURE__ */ t("th", { className: "px-3 py-2" })
222
224
  ] }) }),
223
- /* @__PURE__ */ t("tbody", { className: "divide-y divide-slate-100 dark:divide-border/60", children: m.map((a) => /* @__PURE__ */ s("tr", { "data-support-type-row": a.id, children: [
225
+ /* @__PURE__ */ t("tbody", { className: "divide-y divide-slate-100 dark:divide-border/60", children: m.map((a) => /* @__PURE__ */ n("tr", { "data-support-type-row": a.id, children: [
224
226
  /* @__PURE__ */ t("td", { className: "px-3 py-2", children: /* @__PURE__ */ t(
225
227
  "input",
226
228
  {
227
229
  defaultValue: a.name,
228
- onBlur: (r) => r.target.value.trim() && r.target.value !== a.name && n.mutate({ id: a.id, body: { name: r.target.value } }),
230
+ onBlur: (r) => r.target.value.trim() && r.target.value !== a.name && s.mutate({ id: a.id, body: { name: r.target.value } }),
229
231
  "aria-label": "Type name",
230
232
  className: "w-full bg-transparent font-medium text-slate-900 outline-none focus:underline dark:text-slate-100"
231
233
  }
@@ -235,7 +237,7 @@ function se() {
235
237
  {
236
238
  defaultValue: a.collection ?? "",
237
239
  placeholder: "Anywhere",
238
- onBlur: (r) => (r.target.value || null) !== a.collection && n.mutate({ id: a.id, body: { collection: r.target.value || null } }),
240
+ onBlur: (r) => (r.target.value || null) !== a.collection && s.mutate({ id: a.id, body: { collection: r.target.value || null } }),
239
241
  "aria-label": "Collection",
240
242
  className: "w-full bg-transparent font-mono text-[12px] text-slate-700 outline-none dark:text-slate-300"
241
243
  }
@@ -244,7 +246,7 @@ function se() {
244
246
  Z,
245
247
  {
246
248
  value: a.team_id != null ? String(a.team_id) : "",
247
- onChange: (r) => n.mutate({ id: a.id, body: { team_id: r ? Number(r) : null } }),
249
+ onChange: (r) => s.mutate({ id: a.id, body: { team_id: r ? Number(r) : null } }),
248
250
  options: [
249
251
  { value: "", label: "Administrators" },
250
252
  ...h.map((r) => ({ value: String(r.id), label: r.name }))
@@ -257,7 +259,7 @@ function se() {
257
259
  {
258
260
  collection: "nivaro_users",
259
261
  value: a.default_assignee,
260
- onChange: (r) => n.mutate({ id: a.id, body: { default_assignee: r ? String(r) : null } }),
262
+ onChange: (r) => s.mutate({ id: a.id, body: { default_assignee: r ? String(r) : null } }),
261
263
  placeholder: "Nobody"
262
264
  }
263
265
  ) }),
@@ -266,7 +268,7 @@ function se() {
266
268
  {
267
269
  type: "checkbox",
268
270
  checked: a.is_active,
269
- onChange: (r) => n.mutate({ id: a.id, body: { is_active: r.target.checked } }),
271
+ onChange: (r) => s.mutate({ id: a.id, body: { is_active: r.target.checked } }),
270
272
  "aria-label": "Active"
271
273
  }
272
274
  ) }),
@@ -281,18 +283,18 @@ function se() {
281
283
  ) })
282
284
  ] }, a.id)) })
283
285
  ] }) }),
284
- /* @__PURE__ */ s(
286
+ /* @__PURE__ */ n(
285
287
  "form",
286
288
  {
287
289
  className: "flex items-center gap-2",
288
290
  onSubmit: (a) => {
289
- a.preventDefault(), o.trim() && b.mutate();
291
+ a.preventDefault(), d.trim() && b.mutate();
290
292
  },
291
293
  children: [
292
294
  /* @__PURE__ */ t(
293
295
  "input",
294
296
  {
295
- value: o,
297
+ value: d,
296
298
  onChange: (a) => p(a.target.value),
297
299
  placeholder: "New type, e.g. Vendor change",
298
300
  "aria-label": "New type name",
@@ -303,7 +305,7 @@ function se() {
303
305
  "button",
304
306
  {
305
307
  type: "submit",
306
- disabled: !o.trim() || b.isPending,
308
+ disabled: !d.trim() || b.isPending,
307
309
  className: "h-8 rounded-md border border-nvr-cyan/60 bg-nvr-cyan/10 px-3 text-[12.5px] font-medium text-nvr-navy disabled:opacity-50 dark:text-nvr-cyan",
308
310
  children: "Add type"
309
311
  }
@@ -314,5 +316,5 @@ function se() {
314
316
  ] });
315
317
  }
316
318
  export {
317
- be as SupportView
319
+ ye as SupportView
318
320
  };
@@ -0,0 +1,37 @@
1
+ const i = "ai_generate", u = 2e3, l = /\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/g;
2
+ function p(o) {
3
+ let t = o;
4
+ for (let s = 0; s < 4 && typeof t == "string"; s++)
5
+ try {
6
+ t = JSON.parse(t);
7
+ } catch {
8
+ return null;
9
+ }
10
+ const e = t == null ? void 0 : t[i];
11
+ if (!e || typeof e != "object" || Array.isArray(e)) return null;
12
+ const r = e, n = typeof r.prompt == "string" && r.prompt.trim() ? r.prompt.slice(0, 2e3) : null, c = n ? a(n) : Array.isArray(r.tokens) ? r.tokens.filter((s) => typeof s == "string") : [];
13
+ return {
14
+ enabled: r.enabled === !0,
15
+ prompt: n,
16
+ hasPrompt: !!n || r.has_prompt === !0,
17
+ tokens: c
18
+ };
19
+ }
20
+ function a(o) {
21
+ const t = [];
22
+ for (const e of o.matchAll(l)) t.includes(e[1]) || t.push(e[1]);
23
+ return t;
24
+ }
25
+ const f = "autofill_check";
26
+ function A(o, t, e) {
27
+ const r = p(o);
28
+ return r ? { show: r.enabled && r.hasPrompt, perField: !0 } : { show: e && !!t, perField: !1 };
29
+ }
30
+ export {
31
+ i as AI_FILL_KEY,
32
+ f as AUTOFILL_CHECK_KEY,
33
+ u as PROMPT_MAX,
34
+ a as promptTokens,
35
+ p as readAiFill,
36
+ A as showsAiButton
37
+ };
@@ -0,0 +1,150 @@
1
+ import { useQueryClient as p } from "@tanstack/react-query";
2
+ import { useRef as A, useState as h, useEffect as f, useCallback as O, useMemo as D } from "react";
3
+ import { useOptionalNivaroClient as L } from "../context.js";
4
+ import { get as $, post as N } from "./commands.js";
5
+ import { useLiveEvent as Q } from "./live.js";
6
+ const P = 2500, T = 8e3, x = 4e3, K = "nvr:bgrun:";
7
+ function W(e) {
8
+ return `${e.method} ${e.url} ${e.body === void 0 ? "" : JSON.stringify(e.body)}`;
9
+ }
10
+ function M(e) {
11
+ let t = 5381;
12
+ for (let d = 0; d < e.length; d++) t = (t << 5) + t + e.charCodeAt(d) | 0;
13
+ return `${K}${(t >>> 0).toString(36)}:${e.length}`;
14
+ }
15
+ function Y(e) {
16
+ try {
17
+ return sessionStorage.getItem(M(e));
18
+ } catch {
19
+ return null;
20
+ }
21
+ }
22
+ function R(e, t) {
23
+ try {
24
+ t ? sessionStorage.setItem(M(e), t) : sessionStorage.removeItem(M(e));
25
+ } catch {
26
+ }
27
+ }
28
+ function j(e, t) {
29
+ return e >= T ? !0 : e >= P && !!(t != null && t.slow);
30
+ }
31
+ function U(e, t) {
32
+ return !t || t <= 0 ? null : Math.max(0, Math.min(0.95, e / t));
33
+ }
34
+ function V(e) {
35
+ const t = Math.max(0, Math.round(e / 1e3));
36
+ return `${Math.floor(t / 60)}:${String(t % 60).padStart(2, "0")}`;
37
+ }
38
+ function Z(e) {
39
+ const t = L(), d = p(), r = e.request ? W(e.request) : null, S = A(e);
40
+ S.current = e;
41
+ const [m, w] = h(0), [g, k] = h(
42
+ null
43
+ ), [u, y] = h(null), [a, i] = h("idle"), [F, b] = h(null), E = A(null);
44
+ f(() => {
45
+ w(0), k(null), y(null), b(null), i("idle"), E.current = null;
46
+ }, [r]), f(() => {
47
+ if (!e.pending || !r || u) return;
48
+ const n = Date.now(), o = setInterval(() => w(Date.now() - n), 500);
49
+ return () => {
50
+ clearInterval(o), w(0);
51
+ };
52
+ }, [e.pending, r, u]), f(() => {
53
+ !t || !r || !e.request || m < P || E.current === r || (E.current = r, t.request(
54
+ $("/background-runs/estimate", {
55
+ method: e.request.method,
56
+ url: e.request.url
57
+ })
58
+ ).then((n) => k(n.data)).catch(() => k({ slow: !1, typical_ms: null })));
59
+ }, [t, r, m, e.request]), f(() => {
60
+ a !== "idle" || u || !e.pending || j(m, g) && i("offer");
61
+ }, [a, u, e.pending, m, g]), f(() => {
62
+ !e.pending && a === "offer" && i("idle");
63
+ }, [e.pending, a]);
64
+ const q = O(
65
+ async (n) => {
66
+ if (!t || !r) return;
67
+ if (R(r, null), n.status === "error") {
68
+ b(n.error ?? "The run failed"), i("error");
69
+ return;
70
+ }
71
+ const { queryKey: o, select: c, onResult: s, onGone: I } = S.current;
72
+ try {
73
+ const _ = await t.request($(`/background-runs/${n.id}/result`));
74
+ o && d.setQueryData(o, c ? c(_) : _), s == null || s(_);
75
+ } catch {
76
+ o && d.invalidateQueries({ queryKey: o }), I == null || I();
77
+ }
78
+ i("done");
79
+ },
80
+ [t, r, d]
81
+ );
82
+ f(() => {
83
+ if (!t || !r) return;
84
+ const n = Y(r);
85
+ if (!n) return;
86
+ let o = !1;
87
+ return t.request($(`/background-runs/${n}`)).then((c) => {
88
+ o || (y(c.data), c.data.status === "running" ? i("running") : q(c.data));
89
+ }).catch(() => R(r, null)), () => {
90
+ o = !0;
91
+ };
92
+ }, [t, r, q]);
93
+ const C = O(() => {
94
+ const { request: n, label: o } = S.current;
95
+ if (!t || !n || !r) return;
96
+ i("starting"), b(null);
97
+ const c = typeof window < "u" ? `${window.location.pathname}${window.location.search}` : null;
98
+ t.request(
99
+ N("/background-runs", {
100
+ method: n.method,
101
+ url: n.url,
102
+ ...n.body !== void 0 ? { body: n.body } : {},
103
+ label: o,
104
+ href: c
105
+ })
106
+ ).then((s) => {
107
+ R(r, s.data.id), y(s.data), i("running");
108
+ }).catch((s) => {
109
+ b((s == null ? void 0 : s.message) || "Could not start the run"), i("error");
110
+ });
111
+ }, [t, r]), l = (u == null ? void 0 : u.id) ?? null, v = O(async () => {
112
+ if (!(!t || !l))
113
+ try {
114
+ const n = await t.request($(`/background-runs/${l}`));
115
+ y(n.data), n.data.status !== "running" && await q(n.data);
116
+ } catch {
117
+ }
118
+ }, [t, l, q]);
119
+ return Q(
120
+ "job:progress",
121
+ (n) => {
122
+ !l || (n == null ? void 0 : n.key) !== `bgrun:${l}` || (n.status === "completed" || n.status === "error") && v();
123
+ },
124
+ { includeOwn: !0, enabled: !!l && a === "running" }
125
+ ), f(() => {
126
+ if (!l || a !== "running") return;
127
+ v();
128
+ const n = setInterval(() => void v(), x);
129
+ return () => clearInterval(n);
130
+ }, [l, a, v]), D(
131
+ () => ({
132
+ phase: a,
133
+ typicalMs: (u == null ? void 0 : u.expected_ms) ?? (g == null ? void 0 : g.typical_ms) ?? null,
134
+ run: u,
135
+ error: F,
136
+ start: C
137
+ }),
138
+ [a, u, g, F, C]
139
+ );
140
+ }
141
+ export {
142
+ P as OFFER_AFTER_MS,
143
+ T as OFFER_ANYWAY_MS,
144
+ V as clock,
145
+ W as requestSignature,
146
+ U as runProgress,
147
+ j as shouldOffer,
148
+ M as signatureKey,
149
+ Z as useBackgroundRun
150
+ };
@@ -0,0 +1,9 @@
1
+ import { serverNow as t } from "./server-clock.js";
2
+ function o(r) {
3
+ if (!r || typeof r != "object") return null;
4
+ const e = r;
5
+ return typeof e._seq != "number" || typeof e._st != "number" ? null : { seq: e._seq, st: e._st, rx: t() };
6
+ }
7
+ export {
8
+ o as deliveryAckFor
9
+ };
@@ -0,0 +1,13 @@
1
+ const r = {
2
+ slate: "border border-slate-300 bg-slate-100 text-slate-700 dark:border-slate-600 dark:bg-slate-700/40 dark:text-slate-200",
3
+ blue: "border border-blue-300 bg-blue-100 text-blue-800 dark:border-blue-500/50 dark:bg-blue-500/20 dark:text-blue-200",
4
+ cyan: "border border-cyan-300 bg-cyan-100 text-cyan-800 dark:border-cyan-500/50 dark:bg-cyan-500/20 dark:text-cyan-200",
5
+ emerald: "border border-emerald-300 bg-emerald-100 text-emerald-800 dark:border-emerald-500/50 dark:bg-emerald-500/20 dark:text-emerald-200",
6
+ amber: "border border-amber-300 bg-amber-100 text-amber-900 dark:border-amber-500/50 dark:bg-amber-500/20 dark:text-amber-200",
7
+ orange: "border border-orange-300 bg-orange-100 text-orange-800 dark:border-orange-500/50 dark:bg-orange-500/20 dark:text-orange-200",
8
+ rose: "border border-rose-300 bg-rose-100 text-rose-800 dark:border-rose-500/50 dark:bg-rose-500/20 dark:text-rose-200",
9
+ violet: "border border-violet-300 bg-violet-100 text-violet-800 dark:border-violet-500/50 dark:bg-violet-500/20 dark:text-violet-200"
10
+ }, a = (e) => r[e] ?? r.slate;
11
+ export {
12
+ a as badgeClasses
13
+ };
@@ -0,0 +1,71 @@
1
+ const p = 3, u = 50, E = 16, A = 20, g = 200, l = [
2
+ "slate",
3
+ "blue",
4
+ "cyan",
5
+ "emerald",
6
+ "amber",
7
+ "orange",
8
+ "rose",
9
+ "violet"
10
+ ], a = ["width", "required", "help", "placeholder", "input", "lock"], o = (e) => !!e && typeof e == "object" && !Array.isArray(e), _ = /^[A-Za-z_][A-Za-z0-9_.]*$/;
11
+ function f(e) {
12
+ if (!o(e)) return null;
13
+ const t = typeof e.name == "string" ? e.name.replace(/\s+/g, " ").trim().slice(0, 60) : "", s = typeof e.id == "string" ? e.id.replace(/[^A-Za-z0-9_-]/g, "").slice(0, 40) : "";
14
+ if (!t || !s) return null;
15
+ const r = (Array.isArray(e.parts) ? e.parts : []).filter(
16
+ (c) => a.includes(c)
17
+ ), n = { id: s, name: t, parts: [...new Set(r)] };
18
+ return (e.col_span === null || typeof e.col_span == "number") && (n.col_span = e.col_span === null ? null : Math.min(12, Math.max(1, Math.round(e.col_span)))), o(e.overrides) && (n.overrides = e.overrides), (e.lock_conditions === null || typeof e.lock_conditions == "string") && (n.lock_conditions = e.lock_conditions), n;
19
+ }
20
+ function d(e) {
21
+ let t = e;
22
+ if (typeof t == "string")
23
+ try {
24
+ t = JSON.parse(t);
25
+ } catch {
26
+ return null;
27
+ }
28
+ if (!o(t)) return null;
29
+ const s = {};
30
+ if (t.focus_first === !0 && (s.focus_first = !0), t.enter_next === !0 && (s.enter_next = !0), t.adaptive === !0 && (s.adaptive = !0), t.glossary === !1 && (s.glossary = !1), typeof t.adaptive_threshold == "number" && Number.isFinite(t.adaptive_threshold)) {
31
+ const r = Math.min(50, Math.max(1, Math.round(t.adaptive_threshold)));
32
+ r !== 3 && (s.adaptive_threshold = r);
33
+ }
34
+ if (Array.isArray(t.tab_order)) {
35
+ const r = [
36
+ ...new Set(t.tab_order.filter((n) => typeof n == "string" && _.test(n)))
37
+ ].slice(0, 200);
38
+ r.length && (s.tab_order = r);
39
+ }
40
+ if (o(t.badge)) {
41
+ const r = typeof t.badge.tag == "string" ? t.badge.tag.replace(/\s+/g, " ").trim().slice(0, 16) : "", n = l.includes(t.badge.color) ? t.badge.color : "slate";
42
+ r && (s.badge = { tag: r, color: n });
43
+ }
44
+ if (Array.isArray(t.presets)) {
45
+ const r = /* @__PURE__ */ new Set(), n = [];
46
+ for (const c of t.presets) {
47
+ const i = f(c);
48
+ if (i && !r.has(i.id) && (r.add(i.id), n.push(i)), n.length >= 20) break;
49
+ }
50
+ n.length && (s.presets = n);
51
+ }
52
+ return Object.keys(s).length ? s : null;
53
+ }
54
+ function T(e) {
55
+ return d(e == null ? void 0 : e.entry_config) ?? {};
56
+ }
57
+ function h(e, t) {
58
+ return e < (t.adaptive_threshold ?? 3);
59
+ }
60
+ export {
61
+ l as BADGE_COLORS,
62
+ E as ENTRY_BADGE_TAG_MAX,
63
+ A as ENTRY_PRESETS_MAX,
64
+ g as ENTRY_TAB_ORDER_MAX,
65
+ p as ENTRY_THRESHOLD_DEFAULT,
66
+ u as ENTRY_THRESHOLD_MAX,
67
+ a as PRESET_PARTS,
68
+ T as entryConfigOf,
69
+ h as isBeginner,
70
+ d as sanitizeEntryConfig
71
+ };