@declarion/react 0.65.0 → 0.66.0

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 (467) hide show
  1. package/dist-lib/api/access-expiry.js +32 -0
  2. package/dist-lib/api/agents.js +105 -0
  3. package/dist-lib/api/auth-redirect.js +30 -0
  4. package/dist-lib/api/auth.js +67 -0
  5. package/dist-lib/api/batch.js +34 -0
  6. package/dist-lib/api/client.js +241 -0
  7. package/dist-lib/api/data.js +122 -0
  8. package/dist-lib/api/entities.js +160 -0
  9. package/dist-lib/api/events.js +120 -0
  10. package/dist-lib/api/fileReferences.js +8 -0
  11. package/dist-lib/api/params.js +20 -0
  12. package/dist-lib/api/properties.js +25 -0
  13. package/dist-lib/api/request-bounds.js +28 -0
  14. package/dist-lib/api/schema.js +71 -0
  15. package/dist-lib/api/session-renewal.js +36 -0
  16. package/dist-lib/api/status.js +17 -0
  17. package/dist-lib/app.js +262 -0
  18. package/dist-lib/components/actions/ActionButton.js +116 -0
  19. package/dist-lib/{ActionDialog-C6EG-AmC.js → components/actions/ActionDialog.js} +63 -53
  20. package/dist-lib/{ActionResultDialog.impl-BATutW8J.js → components/actions/ActionResultDialog.impl.js} +53 -48
  21. package/dist-lib/components/actions/ActionResultDialog.js +12 -0
  22. package/dist-lib/components/actions/ActionRunner.js +274 -0
  23. package/dist-lib/components/actions/ObjectActionBar.js +127 -0
  24. package/dist-lib/components/actions/PropertyGridEditor.js +202 -0
  25. package/dist-lib/components/actions/ResponsiveActionBar.js +773 -0
  26. package/dist-lib/components/actions/RowActionsKebab.js +90 -0
  27. package/dist-lib/{AgentChatPanel.impl-D5y_qEex.js → components/agents/AgentChatPanel.impl.js} +314 -362
  28. package/dist-lib/components/agents/AgentChatPanel.js +12 -0
  29. package/dist-lib/components/agents/AgentConversationDrawer.js +59 -0
  30. package/dist-lib/components/agents/AgentElicitForm.js +152 -0
  31. package/dist-lib/components/agents/AgentOpenFollower.impl.js +7 -0
  32. package/dist-lib/components/agents/AgentOpenFollower.js +12 -0
  33. package/dist-lib/components/agents/AgentPicker.js +58 -0
  34. package/dist-lib/components/agents/transcript-runs.js +52 -0
  35. package/dist-lib/components/chrome/AssociationTabs.js +176 -0
  36. package/dist-lib/components/chrome/AuditMetaStrip.js +64 -0
  37. package/dist-lib/components/chrome/Breadcrumbs.js +67 -0
  38. package/dist-lib/components/chrome/HighlightsStrip.js +39 -0
  39. package/dist-lib/{PageHeader-DiwLe7CO.js → components/chrome/PageHeader.js} +19 -15
  40. package/dist-lib/{PageShell-BJz1MiTH.js → components/chrome/PageShell.js} +3 -3
  41. package/dist-lib/components/chrome/RecordHeader.js +119 -0
  42. package/dist-lib/{headerActionZone-bef-tZZ7.js → components/chrome/headerActionZone.js} +1 -1
  43. package/dist-lib/components/detail-layout/AssociatedBlock.js +1244 -0
  44. package/dist-lib/components/detail-layout/AssociatedToolbar.js +87 -0
  45. package/dist-lib/components/detail-layout/ChildrenBlock.js +80 -0
  46. package/dist-lib/components/detail-layout/ChildrenCards.js +156 -0
  47. package/dist-lib/components/detail-layout/ChildrenList.js +135 -0
  48. package/dist-lib/components/detail-layout/ChildrenTable.js +189 -0
  49. package/dist-lib/components/detail-layout/ChildrenTimeline.js +609 -0
  50. package/dist-lib/components/detail-layout/DetailAuditStrip.js +40 -0
  51. package/dist-lib/components/detail-layout/DetailHighlights.js +54 -0
  52. package/dist-lib/{DraggableChildrenTable-Dd5SeuF6.js → components/detail-layout/DraggableChildrenTable.js} +56 -53
  53. package/dist-lib/components/detail-layout/EditableChildrenTable.js +341 -0
  54. package/dist-lib/components/detail-layout/ErrorSummary.js +89 -0
  55. package/dist-lib/components/detail-layout/EvidenceBlock.js +66 -0
  56. package/dist-lib/{FieldRow-DedGIY9R.js → components/detail-layout/FieldRow.js} +8 -7
  57. package/dist-lib/components/detail-layout/FieldsBlock.js +74 -0
  58. package/dist-lib/components/detail-layout/LayoutColumn.js +16 -0
  59. package/dist-lib/components/detail-layout/LayoutRenderer.js +54 -0
  60. package/dist-lib/components/detail-layout/LayoutRow.js +83 -0
  61. package/dist-lib/components/detail-layout/LayoutTabs.js +195 -0
  62. package/dist-lib/components/detail-layout/PropertiesBlock.js +74 -0
  63. package/dist-lib/components/detail-layout/QuickAddForm.js +81 -0
  64. package/dist-lib/components/detail-layout/SectionBlock.js +48 -0
  65. package/dist-lib/components/detail-layout/StatusesBlock.js +18 -0
  66. package/dist-lib/components/detail-layout/TimelineComposer.js +205 -0
  67. package/dist-lib/components/detail-layout/blockMeta.js +27 -0
  68. package/dist-lib/components/detail-layout/useManualColumnResize.js +94 -0
  69. package/dist-lib/components/detail-layout/useQuickAdd.js +85 -0
  70. package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +295 -0
  71. package/dist-lib/components/detail-layout/widgets/JsonDiffWidget.js +107 -0
  72. package/dist-lib/components/detail-layout/widgets/MonacoJson.js +47 -0
  73. package/dist-lib/components/detail-layout/widgets/WidgetHost.js +36 -0
  74. package/dist-lib/components/detail-layout/widgets/builtins.js +10 -0
  75. package/dist-lib/components/detail-layout/widgets/canonicalizeJson.js +32 -0
  76. package/dist-lib/components/detail-layout/widgets/monacoBootstrap.js +16 -0
  77. package/dist-lib/components/detail-layout/widgets/registry.js +13 -0
  78. package/dist-lib/components/fields/BoolField.js +13 -0
  79. package/dist-lib/components/fields/EmailField.js +16 -0
  80. package/dist-lib/components/fields/EnumField.js +38 -0
  81. package/dist-lib/components/fields/FileReferenceField.js +60 -0
  82. package/dist-lib/components/fields/IntArrayField.js +83 -0
  83. package/dist-lib/components/fields/JsonField.js +51 -0
  84. package/dist-lib/components/fields/MultilangArrayField.js +56 -0
  85. package/dist-lib/components/fields/MultilangField.js +65 -0
  86. package/dist-lib/components/fields/MultilangTextField.js +65 -0
  87. package/dist-lib/components/fields/NumberField.js +64 -0
  88. package/dist-lib/components/fields/PasswordField.js +34 -0
  89. package/dist-lib/components/fields/PhoneField.js +84 -0
  90. package/dist-lib/components/fields/RefCombobox.js +112 -0
  91. package/dist-lib/components/fields/RefField.js +45 -0
  92. package/dist-lib/components/fields/RichTextField.js +225 -0
  93. package/dist-lib/components/fields/SecretField.js +34 -0
  94. package/dist-lib/components/fields/StringArrayField.js +165 -0
  95. package/dist-lib/components/fields/StringField.js +39 -0
  96. package/dist-lib/components/fields/StructureField.js +221 -0
  97. package/dist-lib/components/fields/TextField.js +76 -0
  98. package/dist-lib/components/fields/TimestampField.js +110 -0
  99. package/dist-lib/components/fields/UrlField.js +18 -0
  100. package/dist-lib/components/fields/cells/factories/badge.js +42 -0
  101. package/dist-lib/components/fields/cells/factories/boolPill.js +17 -0
  102. package/dist-lib/components/fields/cells/factories/code.js +11 -0
  103. package/dist-lib/components/fields/cells/factories/date.js +30 -0
  104. package/dist-lib/components/fields/cells/factories/email.js +26 -0
  105. package/dist-lib/components/fields/cells/factories/emptyCell.js +10 -0
  106. package/dist-lib/components/fields/cells/factories/fileReference.js +17 -0
  107. package/dist-lib/components/fields/cells/factories/host-icons.js +146 -0
  108. package/dist-lib/components/fields/cells/factories/json.js +61 -0
  109. package/dist-lib/components/fields/cells/factories/link.js +32 -0
  110. package/dist-lib/components/fields/cells/factories/markdown.js +31 -0
  111. package/dist-lib/components/fields/cells/factories/markdownPreview.js +81 -0
  112. package/dist-lib/components/fields/cells/factories/money.js +37 -0
  113. package/dist-lib/components/fields/cells/factories/multilangInline.js +35 -0
  114. package/dist-lib/components/fields/cells/factories/nextRun.js +46 -0
  115. package/dist-lib/components/fields/cells/factories/number.js +42 -0
  116. package/dist-lib/components/fields/cells/factories/passwordMask.js +23 -0
  117. package/dist-lib/components/fields/cells/factories/phone.js +35 -0
  118. package/dist-lib/components/fields/cells/factories/refLink.js +57 -0
  119. package/dist-lib/components/fields/cells/factories/richTextPreview.js +34 -0
  120. package/dist-lib/components/fields/cells/factories/statusPill.js +35 -0
  121. package/dist-lib/components/fields/cells/factories/tagList.js +44 -0
  122. package/dist-lib/components/fields/cells/factories/text.js +5 -0
  123. package/dist-lib/components/fields/cells/factories/timestamp.js +18 -0
  124. package/dist-lib/components/fields/cells/factories/url-helpers.js +49 -0
  125. package/dist-lib/components/fields/cells/factories/url.js +45 -0
  126. package/dist-lib/components/fields/cells/registry.js +58 -0
  127. package/dist-lib/components/fields/index.js +80 -0
  128. package/dist-lib/components/fields/langMap.js +6 -0
  129. package/dist-lib/components/fields/secretValue.js +7 -0
  130. package/dist-lib/components/file-widgets/CircleImage.js +11 -0
  131. package/dist-lib/components/file-widgets/DocumentCard.js +277 -0
  132. package/dist-lib/components/file-widgets/FileList.js +213 -0
  133. package/dist-lib/{Grid-XUHm5SDe.js → components/file-widgets/Grid.js} +45 -40
  134. package/dist-lib/components/file-widgets/GridLazy.js +15 -0
  135. package/dist-lib/components/file-widgets/ImageWidget.js +354 -0
  136. package/dist-lib/components/file-widgets/LabeledSlots.js +69 -0
  137. package/dist-lib/components/file-widgets/SquareImage.js +11 -0
  138. package/dist-lib/components/file-widgets/UnknownFileWidget.js +22 -0
  139. package/dist-lib/components/file-widgets/UploadFailureText.js +10 -0
  140. package/dist-lib/components/file-widgets/WideBanner.js +11 -0
  141. package/dist-lib/components/file-widgets/builtins.js +15 -0
  142. package/dist-lib/components/file-widgets/cropper.js +13 -0
  143. package/dist-lib/components/file-widgets/draft-scope.js +59 -0
  144. package/dist-lib/components/file-widgets/helpers.js +75 -0
  145. package/dist-lib/components/file-widgets/host.js +75 -0
  146. package/dist-lib/{payload-DioMoxMX.js → components/file-widgets/payload.js} +14 -14
  147. package/dist-lib/components/file-widgets/registry.js +13 -0
  148. package/dist-lib/components/file-widgets/upload.js +180 -0
  149. package/dist-lib/components/file-widgets/useEmbedFileSrc.js +45 -0
  150. package/dist-lib/components/file-widgets/value.js +12 -0
  151. package/dist-lib/components/filters/FilterChips.js +123 -0
  152. package/dist-lib/components/filters/FilterConditionValue.js +40 -0
  153. package/dist-lib/components/filters/FilterDrawer.js +670 -0
  154. package/dist-lib/components/filters/FilterOmittedNotice.js +14 -0
  155. package/dist-lib/components/filters/filter-op-label.js +8 -0
  156. package/dist-lib/{CommandPalette.impl-DRI5kxVY.js → components/layout/CommandPalette.impl.js} +62 -61
  157. package/dist-lib/components/layout/CommandPalette.js +12 -0
  158. package/dist-lib/{DirtyTabsCloseDialog.impl-FhAiOmEb.js → components/layout/DirtyTabsCloseDialog.impl.js} +16 -14
  159. package/dist-lib/components/layout/DirtyTabsCloseDialog.js +12 -0
  160. package/dist-lib/{ImpersonationBanner.impl--g0iYwcV.js → components/layout/ImpersonationBanner.impl.js} +4 -3
  161. package/dist-lib/components/layout/ImpersonationBanner.js +12 -0
  162. package/dist-lib/components/layout/ImpersonationFrame.js +29 -0
  163. package/dist-lib/{ImpersonationStartModal.impl-BFBN0YJe.js → components/layout/ImpersonationStartModal.impl.js} +9 -9
  164. package/dist-lib/components/layout/ImpersonationStartModal.js +12 -0
  165. package/dist-lib/components/layout/Layout.js +755 -0
  166. package/dist-lib/components/layout/Rail.js +149 -0
  167. package/dist-lib/components/layout/Sidebar.js +362 -0
  168. package/dist-lib/components/layout/TabStrip.js +321 -0
  169. package/dist-lib/components/layout/TenantChip.js +355 -0
  170. package/dist-lib/components/layout/TopBar.js +305 -0
  171. package/dist-lib/components/layout/tab-close.js +24 -0
  172. package/dist-lib/components/list/ColumnPicker.js +112 -0
  173. package/dist-lib/components/list/InlineEditCell.js +107 -0
  174. package/dist-lib/components/list/PeekFieldCell.js +143 -0
  175. package/dist-lib/components/list/QuickPeek.js +263 -0
  176. package/dist-lib/components/list/ViewSwitcher.js +156 -0
  177. package/dist-lib/components/list/peekDraftStore.js +14 -0
  178. package/dist-lib/{AdminCatalogPage.impl-B-7MLqa1.js → components/pages/AdminCatalogPage.impl.js} +53 -49
  179. package/dist-lib/components/pages/AdminCatalogPage.js +12 -0
  180. package/dist-lib/components/pages/DocumentsMenu.js +150 -0
  181. package/dist-lib/components/pages/ExportMenu.js +123 -0
  182. package/dist-lib/{NotFoundPage.impl-BoX11u-P.js → components/pages/NotFoundPage.impl.js} +6 -4
  183. package/dist-lib/components/pages/NotFoundPage.js +12 -0
  184. package/dist-lib/components/pages/RecordDocumentsPanel.js +230 -0
  185. package/dist-lib/components/pages/RecordNotesPanel.js +200 -0
  186. package/dist-lib/components/pages/RecordPanels.js +18 -0
  187. package/dist-lib/components/pages/SSOCallbackPage.impl.js +28 -0
  188. package/dist-lib/components/pages/SSOCallbackPage.js +12 -0
  189. package/dist-lib/components/pages/SmartDetailPage.impl.js +986 -0
  190. package/dist-lib/components/pages/SmartDetailPage.js +12 -0
  191. package/dist-lib/components/pages/SmartListPage.impl.js +708 -0
  192. package/dist-lib/components/pages/SmartListPage.js +12 -0
  193. package/dist-lib/components/pages/SmartRecordListPage.impl.js +818 -0
  194. package/dist-lib/components/pages/SmartRecordListPage.js +12 -0
  195. package/dist-lib/components/pages/auth/AuthShell.js +350 -0
  196. package/dist-lib/{Forgot.impl-6tL6SBlS.js → components/pages/auth/Forgot.impl.js} +13 -12
  197. package/dist-lib/components/pages/auth/Forgot.js +12 -0
  198. package/dist-lib/{Reset.impl-D0pjhS6d.js → components/pages/auth/Reset.impl.js} +17 -15
  199. package/dist-lib/components/pages/auth/Reset.js +12 -0
  200. package/dist-lib/components/pages/auth/SignIn.js +252 -0
  201. package/dist-lib/{SignUp.impl-CfEXrUeg.js → components/pages/auth/SignUp.impl.js} +31 -27
  202. package/dist-lib/components/pages/auth/SignUp.js +12 -0
  203. package/dist-lib/{TwoFA.impl-B2HtPduH.js → components/pages/auth/TwoFA.impl.js} +9 -8
  204. package/dist-lib/components/pages/auth/TwoFA.js +12 -0
  205. package/dist-lib/components/pages/auth/icons.js +56 -0
  206. package/dist-lib/components/pages/exportRequest.js +17 -0
  207. package/dist-lib/components/pages/list/DataCell.js +27 -0
  208. package/dist-lib/components/pages/list/DeleteViewDialog.js +22 -0
  209. package/dist-lib/{ListCardsBody-BEoYjSZ2.js → components/pages/list/ListCardRow.js} +47 -72
  210. package/dist-lib/components/pages/list/ListCardsBody.js +31 -0
  211. package/dist-lib/components/pages/list/ListFloatbar.js +130 -0
  212. package/dist-lib/components/pages/list/ListFooter.js +138 -0
  213. package/dist-lib/components/pages/list/ListHeader.js +120 -0
  214. package/dist-lib/components/pages/list/ListNoRows.js +72 -0
  215. package/dist-lib/components/pages/list/ListTable.js +191 -0
  216. package/dist-lib/components/pages/list/ListTableRow.js +37 -0
  217. package/dist-lib/components/pages/list/ListToolbar.js +261 -0
  218. package/dist-lib/components/pages/list/ListUrlBanner.js +45 -0
  219. package/dist-lib/components/pages/list/RowActionsCell.js +49 -0
  220. package/dist-lib/components/pages/list/RowContextMenu.js +55 -0
  221. package/dist-lib/components/pages/list/SaveViewDialog.js +111 -0
  222. package/dist-lib/{SortHeaderMenu-Co5PvhTA.js → components/pages/list/SortHeaderMenu.js} +18 -17
  223. package/dist-lib/{cardProjection-Cxlogzh8.js → components/pages/list/cardProjection.js} +3 -3
  224. package/dist-lib/components/pages/list/column-sizing.js +17 -0
  225. package/dist-lib/components/pages/list/columns.js +168 -0
  226. package/dist-lib/components/pages/list/filter-meta.js +84 -0
  227. package/dist-lib/components/pages/list/page-size.js +11 -0
  228. package/dist-lib/components/pages/list/sortable-header.js +18 -0
  229. package/dist-lib/components/pages/list/table-features.js +11 -0
  230. package/dist-lib/components/pages/list/use-filter-value-labels.js +115 -0
  231. package/dist-lib/components/pages/list/useActiveView.js +98 -0
  232. package/dist-lib/components/pages/list/useHeaderReorder.js +93 -0
  233. package/dist-lib/components/pages/list/useListColumnLayout.js +56 -0
  234. package/dist-lib/components/pages/list/useListFilterPresentation.js +34 -0
  235. package/dist-lib/components/pages/list/useListQuery.js +101 -0
  236. package/dist-lib/components/pages/list/useListRowInteraction.js +120 -0
  237. package/dist-lib/components/pages/list/useListSelection.js +53 -0
  238. package/dist-lib/components/pages/list/useListSort.js +44 -0
  239. package/dist-lib/components/pages/list/useListViews.js +148 -0
  240. package/dist-lib/components/pages/list/useRowMenu.js +106 -0
  241. package/dist-lib/components/pages/list/visible-filters.js +19 -0
  242. package/dist-lib/{Preferences.impl-Ct5xwZtT.js → components/pages/profile/Preferences.impl.js} +34 -31
  243. package/dist-lib/components/pages/profile/Preferences.js +12 -0
  244. package/dist-lib/components/pages/profile/Profile.impl.js +437 -0
  245. package/dist-lib/components/pages/profile/Profile.js +12 -0
  246. package/dist-lib/{TenantParamsPage.impl-BGpdmEZg.js → components/pages/tenant-params/TenantParamsPage.impl.js} +45 -40
  247. package/dist-lib/components/pages/tenant-params/TenantParamsPage.js +12 -0
  248. package/dist-lib/components/params/ParamsBlock.js +119 -0
  249. package/dist-lib/{param-editors-TYYU7HKK.js → components/params/param-editors.js} +32 -28
  250. package/dist-lib/components/primitives/Avatar.js +33 -0
  251. package/dist-lib/components/primitives/BoolToggle.js +35 -0
  252. package/dist-lib/components/primitives/BrandGlyph.js +38 -0
  253. package/dist-lib/components/primitives/BrandLogo.js +20 -0
  254. package/dist-lib/components/primitives/Btn.js +67 -0
  255. package/dist-lib/{Check-DAfMbQIw.js → components/primitives/Check.js} +2 -2
  256. package/dist-lib/components/primitives/Chip.js +44 -0
  257. package/dist-lib/components/primitives/ClassifiedFieldLocked.js +15 -0
  258. package/dist-lib/components/primitives/Dropdown.js +85 -0
  259. package/dist-lib/components/primitives/Fields.js +751 -0
  260. package/dist-lib/components/primitives/HoverCard.js +115 -0
  261. package/dist-lib/components/primitives/IconBtn.js +37 -0
  262. package/dist-lib/{Icons-lt-7lhYR.js → components/primitives/Icons.js} +1 -1
  263. package/dist-lib/{Kbd-CNttVu0z.js → components/primitives/Kbd.js} +2 -2
  264. package/dist-lib/components/primitives/MenuItem.js +57 -0
  265. package/dist-lib/{Pill-D-wsfRhx.js → components/primitives/Pill.js} +1 -1
  266. package/dist-lib/{RecordIdBadge-wbigZaFc.js → components/primitives/RecordIdBadge.js} +5 -5
  267. package/dist-lib/components/primitives/RowField.js +47 -0
  268. package/dist-lib/{SectionCard-BYHoHWJc.js → components/primitives/SectionCard.js} +10 -10
  269. package/dist-lib/components/primitives/Spinner.js +31 -0
  270. package/dist-lib/components/primitives/StatTile.js +108 -0
  271. package/dist-lib/components/primitives/Tooltip.js +115 -0
  272. package/dist-lib/{dataTableStyles-vwD1mVOP.js → components/primitives/dataTableStyles.js} +1 -1
  273. package/dist-lib/components/shared/BlankScreen.js +13 -0
  274. package/dist-lib/{ChangePasswordDialog.impl-5hDc0wpE.js → components/shared/ChangePasswordDialog.impl.js} +27 -22
  275. package/dist-lib/{ChangePasswordDialog-C_T_3pjl.js → components/shared/ChangePasswordDialog.js} +2 -2
  276. package/dist-lib/components/shared/ConfirmDialog.js +129 -0
  277. package/dist-lib/components/shared/ConnectionNotice.js +12 -0
  278. package/dist-lib/components/shared/CopyButton.js +25 -0
  279. package/dist-lib/components/shared/DynamicIcon.js +73 -0
  280. package/dist-lib/components/shared/EmptyState.js +56 -0
  281. package/dist-lib/components/shared/ErrorBoundary.js +96 -0
  282. package/dist-lib/components/shared/LoadingSkeleton.js +117 -0
  283. package/dist-lib/components/shared/LucideIcon.js +43 -0
  284. package/dist-lib/components/shared/Markdown.js +15 -0
  285. package/dist-lib/{MarkdownRenderer-sK2TRZS-.js → components/shared/MarkdownRenderer.js} +10 -9
  286. package/dist-lib/components/shared/RefreshControl.js +42 -0
  287. package/dist-lib/components/shared/StatusGroupsDisplay.js +123 -0
  288. package/dist-lib/components/shared/StatusStepper.js +70 -0
  289. package/dist-lib/components/shared/toast/DeclarionToast.js +308 -0
  290. package/dist-lib/components/shared/useOwnRefresh.js +19 -0
  291. package/dist-lib/declarion-react.css +1 -1
  292. package/dist-lib/embed/EmbedAuthBootstrap.js +71 -0
  293. package/dist-lib/embed/EmbedContext.js +38 -0
  294. package/dist-lib/embed/EmbedDirtyReporter.js +17 -0
  295. package/dist-lib/embed/EmbedHistoryTracker.js +17 -0
  296. package/dist-lib/embed/EmbedLocationReporter.js +26 -0
  297. package/dist-lib/embed/EmbedResizeReporter.js +25 -0
  298. package/dist-lib/embed/EmbedUnsavedGuard.js +23 -0
  299. package/dist-lib/embed/embed-dirty.js +21 -0
  300. package/dist-lib/embed/embed-history.js +17 -0
  301. package/dist-lib/embed/embed-nav-guard.js +13 -0
  302. package/dist-lib/embed/file-src.js +60 -0
  303. package/dist-lib/embed/handshake.js +37 -0
  304. package/dist-lib/embed/params.js +45 -0
  305. package/dist-lib/embed/protocol.js +26 -0
  306. package/dist-lib/embed/screen-location.js +44 -0
  307. package/dist-lib/embed/theme.js +11 -0
  308. package/dist-lib/embed/token.js +54 -0
  309. package/dist-lib/embed/useEmbedNavigate.js +65 -0
  310. package/dist-lib/embed/useGlobalLinkInterceptor.js +63 -0
  311. package/dist-lib/hooks/useActionData.js +58 -0
  312. package/dist-lib/hooks/useAgentConversation.js +311 -0
  313. package/dist-lib/hooks/useAggregate.js +18 -0
  314. package/dist-lib/hooks/useAllEntityData.js +53 -0
  315. package/dist-lib/hooks/useAssociatedData.js +37 -0
  316. package/dist-lib/hooks/useAuth.js +56 -0
  317. package/dist-lib/hooks/useBranding.js +18 -0
  318. package/dist-lib/hooks/useBrandingChrome.js +58 -0
  319. package/dist-lib/hooks/useChildrenData.js +33 -0
  320. package/dist-lib/hooks/useColumns.js +44 -0
  321. package/dist-lib/hooks/useConnectionNotice.js +35 -0
  322. package/dist-lib/{useCurrentLocation-Bq1T72AW.js → hooks/useCurrentLocation.js} +2 -2
  323. package/dist-lib/hooks/useCurrentScreen.js +20 -0
  324. package/dist-lib/hooks/useCursorEntityData.js +77 -0
  325. package/dist-lib/hooks/useDebounce.js +11 -0
  326. package/dist-lib/hooks/useEntity.js +8 -0
  327. package/dist-lib/hooks/useEntityData.js +64 -0
  328. package/dist-lib/hooks/useFileReferenceJSON.js +29 -0
  329. package/dist-lib/hooks/useFilters.js +28 -0
  330. package/dist-lib/hooks/useFollowAgentOpen.js +84 -0
  331. package/dist-lib/hooks/useImpersonation.js +40 -0
  332. package/dist-lib/hooks/useIntentPrefetch.js +43 -0
  333. package/dist-lib/hooks/useJsonSnapshot.js +8 -0
  334. package/dist-lib/hooks/useLanguage.js +21 -0
  335. package/dist-lib/hooks/useLiveObject.js +17 -0
  336. package/dist-lib/hooks/useLongPress.js +49 -0
  337. package/dist-lib/hooks/useMutations.js +70 -0
  338. package/dist-lib/{useObject-B45F96rC.js → hooks/useObject.js} +2 -2
  339. package/dist-lib/hooks/useObjectStatus.js +20 -0
  340. package/dist-lib/hooks/usePageState.js +18 -0
  341. package/dist-lib/hooks/usePageStateRuntime.js +46 -0
  342. package/dist-lib/hooks/usePageStateTtl.js +10 -0
  343. package/dist-lib/hooks/useParams.js +123 -0
  344. package/dist-lib/hooks/useProperties.js +32 -0
  345. package/dist-lib/hooks/useRealtimeThresholds.js +31 -0
  346. package/dist-lib/hooks/useRegisterScreenTab.js +28 -0
  347. package/dist-lib/hooks/useResponsiveMode.js +84 -0
  348. package/dist-lib/hooks/useSSE.js +307 -0
  349. package/dist-lib/hooks/useSchema.js +73 -0
  350. package/dist-lib/hooks/useScreen.js +8 -0
  351. package/dist-lib/hooks/useScreenBack.js +60 -0
  352. package/dist-lib/hooks/useScreenTab.js +11 -0
  353. package/dist-lib/hooks/useTabNavigate.js +82 -0
  354. package/dist-lib/hooks/useTabSearchMirror.js +19 -0
  355. package/dist-lib/{useTabTitle-KrzEo118.js → hooks/useTabTitle.js} +9 -7
  356. package/dist-lib/hooks/useText.js +15 -0
  357. package/dist-lib/hooks/useTimelineData.js +44 -0
  358. package/dist-lib/hooks/useUnsavedInput.js +18 -0
  359. package/dist-lib/hooks/useVersionWatcher.js +62 -0
  360. package/dist-lib/hooks/useViews.js +88 -0
  361. package/dist-lib/hooks/useWindowConversation.js +11 -0
  362. package/dist-lib/icons.js +5 -3
  363. package/dist-lib/index.d.ts +42 -20
  364. package/dist-lib/index.js +131 -3926
  365. package/dist-lib/lib/action-dispatch.js +7 -0
  366. package/dist-lib/lib/actions.js +279 -0
  367. package/dist-lib/lib/anchor.js +41 -0
  368. package/dist-lib/lib/brand-tokens.js +95 -0
  369. package/dist-lib/lib/branding.js +25 -0
  370. package/dist-lib/lib/canonical-url.js +17 -0
  371. package/dist-lib/lib/capabilityPrefetch.js +57 -0
  372. package/dist-lib/lib/child-config.js +111 -0
  373. package/dist-lib/lib/children-validation.js +52 -0
  374. package/dist-lib/lib/decimal-text.js +15 -0
  375. package/dist-lib/lib/display-value.js +19 -0
  376. package/dist-lib/lib/document-templates.js +6 -0
  377. package/dist-lib/lib/download.js +41 -0
  378. package/dist-lib/lib/evidence-verdict.js +23 -0
  379. package/dist-lib/lib/failure.js +9 -0
  380. package/dist-lib/lib/field-classification.js +58 -0
  381. package/dist-lib/lib/field-regions.js +13 -0
  382. package/dist-lib/lib/filter-evaluator.js +98 -0
  383. package/dist-lib/lib/filters.js +118 -0
  384. package/dist-lib/lib/format-count.js +24 -0
  385. package/dist-lib/lib/html-state.js +9 -0
  386. package/dist-lib/lib/language.js +52 -0
  387. package/dist-lib/lib/longPressGesture.js +34 -0
  388. package/dist-lib/lib/mass-edit.js +65 -0
  389. package/dist-lib/{page-inset-D_kkVwwN.js → lib/page-inset.js} +1 -1
  390. package/dist-lib/lib/phone.js +28 -0
  391. package/dist-lib/lib/query-retry.js +7 -0
  392. package/dist-lib/lib/quick-add.js +23 -0
  393. package/dist-lib/lib/realtime-query-keys.js +23 -0
  394. package/dist-lib/lib/realtime-reconcile.js +148 -0
  395. package/dist-lib/lib/realtime-resync.js +192 -0
  396. package/dist-lib/lib/record-documents-key.js +4 -0
  397. package/dist-lib/lib/ref-choices.js +6 -0
  398. package/dist-lib/lib/refetch-when-idle.js +25 -0
  399. package/dist-lib/lib/rich-text.js +46 -0
  400. package/dist-lib/lib/rowClickGesture.js +10 -0
  401. package/dist-lib/lib/safe-url.js +34 -0
  402. package/dist-lib/lib/schema-routing.js +51 -0
  403. package/dist-lib/{screen-back-BtbEp5sO.js → lib/screen-back.js} +2 -2
  404. package/dist-lib/lib/scroll-restoration.js +156 -0
  405. package/dist-lib/lib/size-value.js +22 -0
  406. package/dist-lib/lib/sort.js +59 -0
  407. package/dist-lib/lib/timestamp.js +97 -0
  408. package/dist-lib/lib/toast.js +78 -0
  409. package/dist-lib/lib/ui-actions.js +81 -0
  410. package/dist-lib/{utils-D_QDpB8_.js → lib/utils.js} +1 -1
  411. package/dist-lib/lib/variants.js +63 -0
  412. package/dist-lib/lib/versionTracker.js +102 -0
  413. package/dist-lib/lib/viewport-category.js +12 -0
  414. package/dist-lib/{window-election-CHIvIZwx.js → lib/window-election.js} +1 -1
  415. package/dist-lib/stores/auth.js +84 -0
  416. package/dist-lib/stores/icon-registry.js +24 -0
  417. package/dist-lib/stores/list-layout.js +178 -0
  418. package/dist-lib/{page-state-eA6J_KIR.js → stores/page-state.js} +1 -1
  419. package/dist-lib/stores/preferences.js +126 -0
  420. package/dist-lib/stores/realtime.js +115 -0
  421. package/dist-lib/stores/screen-registry.js +10 -0
  422. package/dist-lib/stores/tabs.js +220 -0
  423. package/dist-lib/test/seed-schema.js +8 -0
  424. package/dist-lib/testing.d.ts +1 -1
  425. package/dist-lib/testing.js +80 -76
  426. package/dist-lib/types/api.js +48 -0
  427. package/dist-lib/types/fieldType.js +4 -0
  428. package/dist-lib/types/ordmap.js +50 -0
  429. package/dist-lib/types/schema.js +173 -0
  430. package/dist-lib/{useResponsiveMode-DIR1bZfo.d.ts → useResponsiveMode-DmrpMbZX.d.ts} +44 -16
  431. package/package.json +13 -12
  432. package/dist-lib/ActionRunner-DdBFhqGe.js +0 -1440
  433. package/dist-lib/AgentOpenFollower.impl-BAs_wGEZ.js +0 -81
  434. package/dist-lib/AssociatedBlock-BOoPLOjw.js +0 -1515
  435. package/dist-lib/AuthShell-C8aVwHS7.js +0 -361
  436. package/dist-lib/BlankScreen-DVc7fh8C.js +0 -61
  437. package/dist-lib/CopyButton-DRIT_f0k.js +0 -119
  438. package/dist-lib/DynamicIcon-DuBSz6TZ.js +0 -133
  439. package/dist-lib/FilterChips-Cv1tlXyo.js +0 -1031
  440. package/dist-lib/LayoutRenderer-d-tXYPze.js +0 -3239
  441. package/dist-lib/MenuItem-CfkVXPvC.js +0 -140
  442. package/dist-lib/MonacoJson-BG3S3GHX.js +0 -60
  443. package/dist-lib/Profile.impl-Cypk27ah.js +0 -527
  444. package/dist-lib/PropertyGridEditor-XrP6TZ5s.js +0 -4378
  445. package/dist-lib/RecordHeader-BfQ0_4wq.js +0 -217
  446. package/dist-lib/RefreshControl-CRdWPoF5.js +0 -195
  447. package/dist-lib/SSOCallbackPage.impl-Cfi2pQ59.js +0 -31
  448. package/dist-lib/SmartDetailPage.impl-BiIX0n7K.js +0 -1609
  449. package/dist-lib/SmartListPage.impl-Cu83Gv_G.js +0 -2818
  450. package/dist-lib/SmartRecordListPage.impl-DR6lq7HA.js +0 -795
  451. package/dist-lib/format-count-lyB4CPen.js +0 -943
  452. package/dist-lib/peekDraftStore-CaimrOhW.js +0 -200
  453. package/dist-lib/registry-CGe5kCXN.js +0 -119
  454. package/dist-lib/use-filter-value-labels-D3YDgUzg.js +0 -413
  455. package/dist-lib/useAgentConversation-rru-7hnF.js +0 -612
  456. package/dist-lib/useBranding-zcxEic2k.js +0 -41
  457. package/dist-lib/useBrandingChrome-bxaR3G1R.js +0 -170
  458. package/dist-lib/useCurrentScreen-BZOHBGQZ.js +0 -2522
  459. package/dist-lib/useImpersonation-DBIRRR70.js +0 -35
  460. package/dist-lib/useOwnRefresh-DJjaje52.js +0 -435
  461. package/dist-lib/useParams-BFLJi4n3.js +0 -133
  462. package/dist-lib/useProperties-B7opZ-iy.js +0 -81
  463. package/dist-lib/useScreenBack-DENlz844.js +0 -71
  464. package/dist-lib/useTabNavigate-CUqOmcMj.js +0 -78
  465. package/dist-lib/value-BuQVYx52.js +0 -194
  466. package/dist-lib/variants-vUtfBbE6.js +0 -1961
  467. /package/dist-lib/{JsonEditor-Dz1PQHC8.js → components/fields/JsonEditor.js} +0 -0
@@ -1,1440 +0,0 @@
1
- import { $ as e, An as t, Bn as n, D as r, Dn as i, En as a, Ft as o, In as s, It as c, Ln as l, Nt as u, Q as d, Qn as f, Rn as p, S as m, U as h, W as g, Xn as _, an as v, fn as y, g as b, it as x, jn as S, kn as C, lt as w, pt as T, qn as E, r as D, rt as O, s as k, ut as A, wt as j, y as ee } from "./useCurrentScreen-BZOHBGQZ.js";
2
- import { o as M } from "./useParams-BFLJi4n3.js";
3
- import { Suspense as N, createContext as te, lazy as P, useCallback as F, useContext as ne, useEffect as I, useMemo as L, useReducer as re, useRef as R, useState as z } from "react";
4
- import { hashKey as ie, useInfiniteQuery as ae, useQuery as oe, useQueryClient as B } from "@tanstack/react-query";
5
- import { jsx as V, jsxs as se } from "react/jsx-runtime";
6
- import { create as ce } from "zustand";
7
- //#region src/components/actions/ActionResultDialog.tsx
8
- var le = P(() => import("./ActionResultDialog.impl-BATutW8J.js").then((e) => ({ default: e.ActionResultDialog })));
9
- function ue(e) {
10
- return /* @__PURE__ */ V(N, {
11
- fallback: null,
12
- children: /* @__PURE__ */ V(le, { ...e })
13
- });
14
- }
15
- //#endregion
16
- //#region src/hooks/useChildrenData.ts
17
- var de = "entity-children";
18
- function fe(e, t, n, r, a, o) {
19
- let s = k(n), c = b(s, a), l = Array.isArray(r) ? r : [r], u = Array.isArray(r) ? y(t, l.length) : [t];
20
- return oe({
21
- queryKey: [
22
- de,
23
- e,
24
- t,
25
- n,
26
- c,
27
- o
28
- ],
29
- queryFn: () => {
30
- let e = new URLSearchParams();
31
- if (!u) throw Error("invalid composite parent id");
32
- let t = l.map((e, t) => ({
33
- field: e,
34
- op: "eq",
35
- value: u[t]
36
- }));
37
- return e.set("filters", JSON.stringify(t)), c && e.set("sort", c), o && e.set("limit", String(o)), i(`/api/data/${n}?${e.toString()}`);
38
- },
39
- enabled: !!e && !!t && !!n && !!r && u !== null
40
- });
41
- }
42
- //#endregion
43
- //#region src/hooks/useActionData.ts
44
- var pe = "action-data", me = "action-data-cursor";
45
- function he(e, t) {
46
- return [
47
- pe,
48
- e,
49
- t
50
- ];
51
- }
52
- function ge(e, t, n = !0) {
53
- return oe({
54
- queryKey: he(e, t),
55
- queryFn: async () => (await A(e, t)).result,
56
- enabled: !!e && n
57
- });
58
- }
59
- function _e(e, t) {
60
- return [
61
- me,
62
- e,
63
- t
64
- ];
65
- }
66
- function ve(e, t, n = !0) {
67
- let r = _e(e, t), i = ae({
68
- queryKey: r,
69
- queryFn: async ({ pageParam: n }) => {
70
- let r = n ? {
71
- ...t,
72
- cursor: n
73
- } : t;
74
- return (await A(e, r)).result;
75
- },
76
- getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
77
- initialPageParam: void 0,
78
- enabled: !!e && n
79
- });
80
- return {
81
- rows: L(() => i.data?.pages.flatMap((e) => e?.data ?? []) ?? [], [i.data]),
82
- hasMore: !!i.hasNextPage,
83
- fetchNextPage: () => {
84
- i.fetchNextPage();
85
- },
86
- isFetchingNextPage: i.isFetchingNextPage,
87
- isLoading: i.isLoading,
88
- isError: i.isError,
89
- error: i.error,
90
- refetch: () => {
91
- i.refetch();
92
- },
93
- queryKey: r
94
- };
95
- }
96
- //#endregion
97
- //#region src/stores/realtime.ts
98
- var H = ce((e, t) => {
99
- let n = 0, r = 0;
100
- return {
101
- degradedEntities: /* @__PURE__ */ new Map(),
102
- markDegraded: (r) => {
103
- if (!r) return;
104
- let i = new Map(t().degradedEntities);
105
- i.set(r, {
106
- mark: ++n,
107
- since: i.get(r)?.since ?? Date.now()
108
- }), e({ degradedEntities: i });
109
- },
110
- unmarkDegraded: (n) => {
111
- let r = new Map(t().degradedEntities);
112
- for (let [e, t] of n) r.get(e)?.mark === t && r.delete(e);
113
- r.size !== t().degradedEntities.size && e({ degradedEntities: r });
114
- },
115
- connectionInterruptedSince: null,
116
- holdConnectionInterruption: () => {
117
- t().connectionInterruptedSince === null && e({ connectionInterruptedSince: Date.now() });
118
- },
119
- clearConnectionInterruption: () => {
120
- t().connectionInterruptedSince !== null && e({ connectionInterruptedSince: null });
121
- },
122
- relayInterruptedSince: null,
123
- holdRelayInterruption: () => {
124
- t().relayInterruptedSince === null && e({ relayInterruptedSince: Date.now() });
125
- },
126
- clearRelayInterruption: () => {
127
- t().relayInterruptedSince !== null && e({ relayInterruptedSince: null });
128
- },
129
- replayStartedAt: null,
130
- startReplay: () => {
131
- t().replayStartedAt === null && e({ replayStartedAt: Date.now() });
132
- },
133
- endReplay: () => {
134
- t().replayStartedAt !== null && e({ replayStartedAt: null });
135
- },
136
- thresholds: null,
137
- setThresholds: (n) => {
138
- let r = t().thresholds;
139
- r === n || typeof r == "object" && r && typeof n == "object" && n && r.pauseGraceMs === n.pauseGraceMs && r.silenceMs === n.silenceMs || e({ thresholds: n });
140
- },
141
- resyncs: [],
142
- addResync: (n) => {
143
- let i = ++r;
144
- return e({ resyncs: [...t().resyncs, {
145
- ...n,
146
- id: i
147
- }] }), i;
148
- },
149
- updateResync: (n, r) => {
150
- e({ resyncs: t().resyncs.map((e) => e.id === n ? {
151
- ...e,
152
- ...r
153
- } : e) });
154
- },
155
- removeResync: (n) => {
156
- t().resyncs.some((e) => e.id === n) && e({ resyncs: t().resyncs.filter((e) => e.id !== n) });
157
- }
158
- };
159
- });
160
- function ye(e, t, n) {
161
- return e === !0 && !t.has(n);
162
- }
163
- function be(e, t, n, r) {
164
- let i = {
165
- live: !1,
166
- recheckAt: null
167
- };
168
- if (t !== !0 || e.degradedEntities.has(n) || e.thresholds === "unreadable") return i;
169
- let a = [];
170
- for (let t of [
171
- e.connectionInterruptedSince,
172
- e.relayInterruptedSince,
173
- e.replayStartedAt
174
- ]) t !== null && a.push(t);
175
- for (let t of e.resyncs) if (t.blocking.has(n)) {
176
- if (t.standing) return i;
177
- a.push(t.openedAt);
178
- }
179
- if (a.length === 0 || e.thresholds === null) return {
180
- live: !0,
181
- recheckAt: null
182
- };
183
- let o = e.thresholds.pauseGraceMs, s = null;
184
- for (let e of a) {
185
- if (r - e >= o) return i;
186
- s = s === null ? e + o : Math.min(s, e + o);
187
- }
188
- return {
189
- live: !0,
190
- recheckAt: s
191
- };
192
- }
193
- function xe(e, t) {
194
- let n = H((e) => e.degradedEntities), r = H((e) => e.connectionInterruptedSince), i = H((e) => e.relayInterruptedSince), a = H((e) => e.replayStartedAt), o = H((e) => e.thresholds), s = H((e) => e.resyncs), [, c] = re((e) => e + 1, 0), { live: l, recheckAt: u } = be({
195
- degradedEntities: n,
196
- connectionInterruptedSince: r,
197
- relayInterruptedSince: i,
198
- replayStartedAt: a,
199
- thresholds: o,
200
- resyncs: s
201
- }, e, t, Date.now());
202
- return I(() => {
203
- if (u === null) return;
204
- let e = setTimeout(c, Math.max(0, u - Date.now()));
205
- return () => clearTimeout(e);
206
- }, [u]), l;
207
- }
208
- //#endregion
209
- //#region src/hooks/useRealtimeThresholds.ts
210
- var Se = "realtime_pause_grace_seconds", Ce = "realtime_silence_seconds";
211
- function we(e, t) {
212
- if (t.error) return `${e} could not be read: ${t.error.message}`;
213
- if (!t.data?.found) return `${e} is not declared`;
214
- let n = t.data.value;
215
- return typeof n != "number" || !Number.isFinite(n) || n < 0 ? `${e} is not a non-negative number: ${JSON.stringify(n)}` : n * 1e3;
216
- }
217
- function Te() {
218
- let e = c((e) => e.isAuthenticated), t = M(Se, { enabled: e }), n = M(Ce, { enabled: e }), r = !t.isPending && !n.isPending, i = r ? we(Se, t) : null, a = r ? we(Ce, n) : null;
219
- I(() => {
220
- if (i === null || a === null) return;
221
- let e = H.getState();
222
- if (typeof i == "number" && typeof a == "number") {
223
- let t = {
224
- pauseGraceMs: i,
225
- silenceMs: a
226
- };
227
- e.setThresholds(t);
228
- return;
229
- }
230
- let t = [i, a].filter((e) => typeof e == "string");
231
- console.error(`realtime: showing "Updates paused" - ${t.join("; ")}`), e.setThresholds("unreadable");
232
- }, [i, a]);
233
- }
234
- //#endregion
235
- //#region src/lib/record-documents-key.ts
236
- var Ee = "record-documents", De = {
237
- nulls_first: "first",
238
- nulls_last: "last"
239
- };
240
- function Oe(e) {
241
- if (!e) return [];
242
- let t = [];
243
- for (let n of e.split(",")) {
244
- let e = n.trim();
245
- if (!e) continue;
246
- let r = e.split(":"), i = r[0]?.trim();
247
- if (!i || i.startsWith("$property.")) continue;
248
- let a = {
249
- field: i,
250
- dir: r[1]?.trim().toLowerCase() === "desc" ? "desc" : "asc"
251
- }, o = r[2]?.trim().toLowerCase();
252
- if (o) {
253
- let e = De[o];
254
- e && (a.nulls = e);
255
- }
256
- t.push(a);
257
- }
258
- return t;
259
- }
260
- function ke(e) {
261
- if (!e) return;
262
- let t = [];
263
- for (let n of e.split(",")) {
264
- let e = n.trim();
265
- if (!e) continue;
266
- let r = e.split(":")[0]?.trim();
267
- r && r.startsWith("$property.") || t.push(e);
268
- }
269
- return t.length > 0 ? t.join(",") : void 0;
270
- }
271
- function Ae(e) {
272
- return e.map((e) => {
273
- let t = `${e.field}:${e.dir}`;
274
- return e.nulls === "first" ? `${t}:nulls_first` : e.nulls === "last" ? `${t}:nulls_last` : t;
275
- }).join(",");
276
- }
277
- function je(e, t) {
278
- let n = e.findIndex((e) => e.field === t);
279
- return n >= 0 ? [...e.slice(0, n), ...e.slice(n + 1)] : e.length >= 5 ? e : [...e, {
280
- field: t,
281
- dir: "asc"
282
- }];
283
- }
284
- function Me(e, t) {
285
- let n = e.filter((e) => e.field !== t.field);
286
- return n.length >= 5 ? e : [...n, t];
287
- }
288
- function Ne(e, t) {
289
- let n = e.findIndex((e) => e.field === t);
290
- return n < 0 ? e : [...e.slice(0, n), ...e.slice(n + 1)];
291
- }
292
- //#endregion
293
- //#region src/api/entities.ts
294
- function Pe(e, t) {
295
- return e.$statuses?.find((e) => e.group_code === t);
296
- }
297
- function Fe(e, t) {
298
- return e.$properties?.find((e) => e.property_code === t);
299
- }
300
- function U(e) {
301
- let t = { ...e };
302
- return t.$status = (e) => Pe(t, e), t.$property = (e) => Fe(t, e), t;
303
- }
304
- var Ie = class {
305
- cache = {};
306
- merge(e) {
307
- if (e) for (let t of Object.keys(e)) {
308
- this.cache[t] || (this.cache[t] = {});
309
- let n = e[t];
310
- for (let e of Object.keys(n)) this.cache[t][e] = {
311
- ...this.cache[t][e],
312
- ...n[e]
313
- };
314
- }
315
- }
316
- all() {
317
- return this.cache;
318
- }
319
- get(e, t) {
320
- return this.cache[e]?.[t];
321
- }
322
- clear() {
323
- this.cache = {};
324
- }
325
- };
326
- function Le(e, t) {
327
- let n = new URL(`/api/data/${e}`, window.location.origin);
328
- return t.select && t.select.length > 0 && n.searchParams.set("select", t.select.join(",")), t.expand && t.expand.length > 0 && n.searchParams.set("expand", t.expand.join(",")), t.sort && n.searchParams.set("sort", t.sort), t.search && n.searchParams.set("search", t.search), t.limit && n.searchParams.set("limit", String(t.limit)), t.after && n.searchParams.set("after", t.after), t.count && n.searchParams.set("count", "with"), t.screen && n.searchParams.set("screen", t.screen), t.preview && n.searchParams.set("preview", "true"), t.include_deleted && n.searchParams.set("include_deleted", "true"), t.filters && t.filters.length > 0 && n.searchParams.set("filters", JSON.stringify(t.filters)), n.pathname + n.search;
329
- }
330
- var W = class {
331
- entity;
332
- refs;
333
- constructor(e, t) {
334
- this.entity = e, this.refs = t ?? new Ie();
335
- }
336
- async get(e) {
337
- let t = new URLSearchParams(typeof e == "string" ? { id: e } : e);
338
- return U((await i(`/api/data/${this.entity}?${t.toString()}`)).data);
339
- }
340
- async list(e = {}) {
341
- let t, n = !1;
342
- try {
343
- t = await i(Le(this.entity, e));
344
- } catch (r) {
345
- if (e.after && f(r)) {
346
- let { after: r, ...a } = e;
347
- t = await i(Le(this.entity, a)), n = !0;
348
- } else throw r;
349
- }
350
- return this.refs.merge(t.$refs), {
351
- data: t.data.map((e) => U(e)),
352
- meta: t.meta,
353
- $refs: this.refs.all(),
354
- reset: n
355
- };
356
- }
357
- async create(e) {
358
- return (await this.createMany([e]))[0];
359
- }
360
- async createMany(e) {
361
- if (e.length === 0) return [];
362
- let t = e.map((e) => ({
363
- action: `${this.entity}.__create`,
364
- params: {
365
- entity: this.entity,
366
- fields: e
367
- }
368
- })), n = await C("system.batch", {
369
- actions: t,
370
- atomic: !0
371
- });
372
- return G(n, `${this.entity}.__create`), n.results.map((e) => U(Re(e)));
373
- }
374
- async update(e, t) {
375
- return (await this.updateMany([{
376
- id: e,
377
- ...t
378
- }]))[0];
379
- }
380
- async updateMany(e) {
381
- if (e.length === 0) return [];
382
- let t = e.map(({ id: e, ...t }) => ({
383
- action: `${this.entity}.__update`,
384
- params: {
385
- object_ids: [e],
386
- entity: this.entity,
387
- fields: t
388
- }
389
- })), n = await C("system.batch", {
390
- actions: t,
391
- atomic: !0
392
- });
393
- return G(n, `${this.entity}.__update`), n.results.map((e) => U(Re(e)));
394
- }
395
- async delete(e) {
396
- await this.deleteMany([e]);
397
- }
398
- async deleteMany(e) {
399
- return e.length === 0 ? { count: 0 } : { count: (await A(`${this.entity}.__delete`, {
400
- object_ids: e,
401
- entity: this.entity
402
- })).object_count ?? e.length };
403
- }
404
- async restore(e) {
405
- await this.restoreMany([e]);
406
- }
407
- async restoreMany(e) {
408
- return e.length === 0 ? { count: 0 } : { count: (await A(`${this.entity}.__restore`, {
409
- object_ids: e,
410
- entity: this.entity
411
- })).object_count ?? e.length };
412
- }
413
- async upsert(e, t) {
414
- return (await this.upsertMany([e], t))[0];
415
- }
416
- async upsertMany(e, t) {
417
- if (e.length === 0) return [];
418
- let n = e.map((e) => ({
419
- action: `${this.entity}.__upsert`,
420
- params: {
421
- entity: this.entity,
422
- fields: e,
423
- unique_by: t
424
- }
425
- })), r = await C("system.batch", {
426
- actions: n,
427
- atomic: !0
428
- });
429
- return G(r, `${this.entity}.__upsert`), r.results.map((e) => U(ze(e)));
430
- }
431
- };
432
- function G(e, t) {
433
- if (e.committed) return;
434
- let n = e.results.find((e) => !e.ok), r = n?.error ? `${_(n.error.type)}: ${n.error.title}` : "batch did not commit";
435
- throw Error(`${t} batch failed: ${r}`);
436
- }
437
- function Re(e) {
438
- let t = e.result ?? {};
439
- return (Array.isArray(t.rows) ? t.rows[0] : void 0) ?? {};
440
- }
441
- function ze(e) {
442
- let t = e.result ?? {};
443
- return (Array.isArray(t.rows) ? t.rows[0] : void 0)?.row ?? {};
444
- }
445
- function Be(e, t) {
446
- return new W(e, t);
447
- }
448
- //#endregion
449
- //#region src/hooks/useCursorEntityData.ts
450
- var K = "entity-data-cursor";
451
- function Ve(e) {
452
- return JSON.stringify({
453
- sort: e.sort,
454
- filters: e.filters,
455
- search: e.search,
456
- select: e.select,
457
- expand: e.expand,
458
- includeDeleted: e.includeDeleted,
459
- screen: e.screen,
460
- preview: e.preview,
461
- limit: e.limit
462
- });
463
- }
464
- function He(e, t) {
465
- return [
466
- K,
467
- e,
468
- Ve(t)
469
- ];
470
- }
471
- function Ue(e, t, n) {
472
- let r = B(), i = L(() => new W(e ?? ""), [e]), a = L(() => Ve(t), [t]), o = L(() => [
473
- K,
474
- e,
475
- a
476
- ], [e, a]), s = ae({
477
- queryKey: o,
478
- queryFn: ({ pageParam: e }) => i.list({
479
- sort: t.sort,
480
- filters: t.filters,
481
- search: t.search,
482
- select: t.select,
483
- expand: t.expand,
484
- include_deleted: t.includeDeleted || void 0,
485
- screen: t.screen,
486
- preview: t.preview,
487
- limit: t.limit,
488
- after: e ?? void 0,
489
- count: !e || void 0
490
- }),
491
- getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
492
- initialPageParam: void 0,
493
- enabled: !!e && n,
494
- placeholderData: (t, n) => n?.queryKey?.[1] === e ? t : void 0
495
- }), c = s.data?.pages, l = c && c.length > 1 ? c[c.length - 1]?.reset : !1;
496
- I(() => {
497
- l && r.resetQueries({ queryKey: o });
498
- }, [
499
- l,
500
- r,
501
- o
502
- ]);
503
- let u = L(() => (s.data?.pages ?? []).flatMap((e) => e.data), [s.data?.pages]), d = s.data?.pages?.[0]?.meta;
504
- return {
505
- rows: u,
506
- refs: s.data?.pages?.[s.data.pages.length - 1]?.$refs,
507
- total: d && !d.count_unknown ? d.total : void 0,
508
- countMode: d?.count_mode,
509
- countUnknown: d?.count_unknown ?? !1,
510
- hasMore: s.hasNextPage,
511
- fetchNextPage: s.fetchNextPage,
512
- isFetchingNextPage: s.isFetchingNextPage,
513
- isLoading: s.isLoading,
514
- isFetching: s.isFetching,
515
- isPlaceholderData: s.isPlaceholderData,
516
- isError: s.isError,
517
- error: s.error,
518
- refetch: s.refetch
519
- };
520
- }
521
- //#endregion
522
- //#region src/lib/realtime-query-keys.ts
523
- var We = ["entity-data", "entity-data-all"], Ge = [K], Ke = [...We, ...Ge], qe = "generated_document";
524
- function Je(e) {
525
- return typeof e[0] == "string" && Ke.includes(e[0]);
526
- }
527
- function Ye(e) {
528
- return Ge.includes(e[0]);
529
- }
530
- function Xe(e) {
531
- return Je(e) || e[0] === "entity-count" || e[0] === "entity-item";
532
- }
533
- function q(e) {
534
- let t = null;
535
- return Xe(e) ? t = e[1] : e[0] === "entity-children" ? t = e[3] : e[0] === "record-documents" && (t = qe), typeof t == "string" ? t : null;
536
- }
537
- function Ze(e) {
538
- return q(e) !== null;
539
- }
540
- //#endregion
541
- //#region src/lib/realtime-resync.ts
542
- var Qe = 3e3, $e = /* @__PURE__ */ new WeakMap();
543
- function et(e) {
544
- let t = $e.get(e);
545
- return t || (t = {
546
- counter: 0,
547
- inFlight: /* @__PURE__ */ new WeakMap(),
548
- lastSettled: /* @__PURE__ */ new WeakMap(),
549
- lastSuccess: /* @__PURE__ */ new WeakMap()
550
- }, $e.set(e, t)), t;
551
- }
552
- function tt(e, t) {
553
- if (t.type !== "updated") return;
554
- let { query: n, action: r } = t;
555
- switch (r.type) {
556
- case "fetch":
557
- e.inFlight.set(n, ++e.counter);
558
- return;
559
- case "success": {
560
- if (r.manual) return;
561
- let t = e.inFlight.get(n);
562
- e.inFlight.delete(n), e.lastSettled.set(n, t), t !== void 0 && e.lastSuccess.set(n, t);
563
- return;
564
- }
565
- case "error":
566
- e.lastSettled.set(n, e.inFlight.get(n)), e.inFlight.delete(n);
567
- return;
568
- case "setState":
569
- n.state.fetchStatus === "idle" && e.inFlight.delete(n);
570
- return;
571
- }
572
- }
573
- function J(e) {
574
- return e.getObserversCount() > 0 && !e.isDisabled() && !e.isStatic();
575
- }
576
- function nt(e, t) {
577
- if (e.kind === "keys") return !1;
578
- let n = q(t);
579
- return n === null ? !1 : e.kind === "all" || e.entities.has(n);
580
- }
581
- function Y(e, t) {
582
- let n = H.getState(), r = et(e).counter, i = t.carriedMarks ?? /* @__PURE__ */ new Map();
583
- if (t.scope.kind === "all" && !t.standing) {
584
- let e = n.resyncs.find((e) => e.scope.kind === "all" && !e.issued && !e.standing);
585
- if (e) {
586
- n.updateResync(e.id, {
587
- generation: r,
588
- jitter: e.jitter || t.jitter === !0,
589
- carriedMarks: new Map([...e.carriedMarks, ...i])
590
- });
591
- return;
592
- }
593
- }
594
- let a = /* @__PURE__ */ new Map();
595
- if (t.scope.kind === "keys") for (let e of t.keys ?? []) a.set(ie(e), e);
596
- else for (let n of e.getQueryCache().getAll()) nt(t.scope, n.queryKey) && a.set(n.queryHash, n.queryKey);
597
- n.addResync({
598
- generation: r,
599
- openedAt: Date.now(),
600
- standing: t.standing === !0,
601
- issued: !1,
602
- jitter: t.jitter === !0,
603
- scope: t.scope,
604
- keys: a,
605
- observed: /* @__PURE__ */ new Map(),
606
- carriedMarks: i,
607
- blocking: /* @__PURE__ */ new Set()
608
- });
609
- }
610
- var rt = class {
611
- queryClient;
612
- record;
613
- timers = /* @__PURE__ */ new Map();
614
- unsubscribers = [];
615
- relayHeld;
616
- running = !1;
617
- dirty = !1;
618
- constructor(e) {
619
- this.queryClient = e, this.record = et(e), this.relayHeld = H.getState().relayInterruptedSince !== null;
620
- }
621
- start() {
622
- this.unsubscribers.push(this.queryClient.getQueryCache().subscribe((e) => this.onCacheEvent(e)), H.subscribe((e, t) => {
623
- (e.resyncs !== t.resyncs || e.relayInterruptedSince !== t.relayInterruptedSince) && this.reconcile();
624
- })), this.reconcile();
625
- }
626
- stop() {
627
- for (let e of this.unsubscribers.splice(0)) e();
628
- for (let e of this.timers.values()) clearTimeout(e);
629
- this.timers.clear();
630
- }
631
- onCacheEvent(e) {
632
- tt(this.record, e);
633
- let t = H.getState().resyncs;
634
- t.length !== 0 && ((e.type === "added" || e.type === "observerAdded") && this.takeInKey(t, e.query), e.type === "updated" && (e.action.type === "error" || e.action.type === "success" && !e.action.manual) && this.fetchAgainIfJoinedEarlier(t, e.query), this.reconcile());
635
- }
636
- takeInKey(e, t) {
637
- let n = H.getState(), r = t.queryKey;
638
- for (let i of e) !i.keys.has(t.queryHash) && nt(i.scope, r) && n.updateResync(i.id, { keys: new Map([...i.keys, [t.queryHash, r]]) });
639
- }
640
- fetchAgainIfJoinedEarlier(e, t) {
641
- let n = this.record.lastSettled.get(t);
642
- e.some((e) => e.issued && !e.standing && e.keys.has(t.queryHash) && (n === void 0 || n <= e.generation)) && J(t) && this.queryClient.invalidateQueries({
643
- queryKey: t.queryKey,
644
- exact: !0
645
- }, { cancelRefetch: !1 });
646
- }
647
- reconcile() {
648
- if (this.running) this.dirty = !0;
649
- else {
650
- this.running = !0;
651
- try {
652
- do
653
- this.dirty = !1, this.pass();
654
- while (this.dirty);
655
- } finally {
656
- this.running = !1;
657
- }
658
- }
659
- }
660
- pass() {
661
- let e = H.getState(), t = e.relayInterruptedSince !== null;
662
- if (this.relayHeld && !t) for (let t of e.resyncs) !t.issued && !t.standing && e.updateResync(t.id, { generation: this.record.counter });
663
- this.relayHeld = t;
664
- for (let e of H.getState().resyncs) this.schedule(e, t);
665
- for (let e of H.getState().resyncs) this.evaluate(e);
666
- for (let e of this.timers.keys()) H.getState().resyncs.some((t) => t.id === e) || this.clearTimer(e);
667
- }
668
- schedule(e, t) {
669
- e.standing || e.issued || t ? this.clearTimer(e.id) : this.timers.has(e.id) || (e.jitter ? this.timers.set(e.id, setTimeout(() => {
670
- this.timers.delete(e.id), H.getState().relayInterruptedSince === null && (this.issue(e.id), this.reconcile());
671
- }, Math.random() * Qe)) : this.issue(e.id));
672
- }
673
- clearTimer(e) {
674
- let t = this.timers.get(e);
675
- t !== void 0 && (clearTimeout(t), this.timers.delete(e));
676
- }
677
- issue(e) {
678
- let t = H.getState(), n = t.resyncs.find((t) => t.id === e);
679
- if (!n || n.issued) return;
680
- t.updateResync(e, { issued: !0 });
681
- let r = this.queryClient.getQueryCache(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
682
- for (let e of n.keys.keys()) {
683
- let t = r.get(e);
684
- t && ((this.record.lastSuccess.get(t) ?? 0) > n.generation || (this.record.inFlight.get(t) ?? 0) > n.generation || (J(t) ? i.add(t) : a.add(t)));
685
- }
686
- a.size > 0 && this.queryClient.invalidateQueries({
687
- predicate: (e) => a.has(e),
688
- refetchType: "none"
689
- }), i.size > 0 && this.queryClient.invalidateQueries({ predicate: (e) => i.has(e) }, { cancelRefetch: !1 });
690
- }
691
- evaluate(e) {
692
- let t = this.queryClient.getQueryCache(), n = /* @__PURE__ */ new Set(), r = new Map(e.observed);
693
- for (let [i, a] of e.keys) {
694
- let o = q(a);
695
- if (o === null) continue;
696
- let s = t.get(i);
697
- if (s && J(s)) {
698
- r.set(i, s), (this.record.lastSuccess.get(s) ?? 0) <= e.generation && n.add(o);
699
- continue;
700
- }
701
- let c = r.get(i);
702
- c && c !== s && J(c) ? n.add(o) : r.delete(i);
703
- }
704
- let i = H.getState();
705
- n.size === 0 && (e.issued || e.standing) ? (i.removeResync(e.id), i.unmarkDegraded(e.carriedMarks)) : (!it(n, e.blocking) || !at(r, e.observed)) && i.updateResync(e.id, {
706
- blocking: n,
707
- observed: r
708
- });
709
- }
710
- };
711
- function it(e, t) {
712
- if (e.size !== t.size) return !1;
713
- for (let n of e) if (!t.has(n)) return !1;
714
- return !0;
715
- }
716
- function at(e, t) {
717
- if (e.size !== t.size) return !1;
718
- for (let [n, r] of e) if (t.get(n) !== r) return !1;
719
- return !0;
720
- }
721
- function ot(e) {
722
- I(() => {
723
- let t = new rt(e);
724
- return t.start(), () => t.stop();
725
- }, [e]);
726
- }
727
- //#endregion
728
- //#region src/lib/refetch-when-idle.ts
729
- var st = /* @__PURE__ */ new WeakMap();
730
- function X(e, t) {
731
- if (t.state.fetchStatus !== "fetching") {
732
- e.invalidateQueries({
733
- queryKey: t.queryKey,
734
- exact: !0
735
- });
736
- return;
737
- }
738
- let n = st.get(e);
739
- if (!n) {
740
- let t = /* @__PURE__ */ new Set();
741
- n = t, st.set(e, t), e.getQueryCache().subscribe((n) => {
742
- let r = n.query;
743
- n.type === "updated" && r.state.fetchStatus !== "fetching" && t.delete(r.queryHash) && e.invalidateQueries({
744
- queryKey: r.queryKey,
745
- exact: !0
746
- });
747
- });
748
- }
749
- n.add(t.queryHash);
750
- }
751
- //#endregion
752
- //#region src/lib/realtime-reconcile.ts
753
- async function ct(e, t, n, r) {
754
- let i = e.getQueryCache().findAll({ predicate: (e) => Je(e.queryKey) && e.queryKey[1] === t }), a = !1, o = [];
755
- for (let s of i) s.state.data !== void 0 && (s.getObserversCount() === 0 ? e.invalidateQueries({
756
- queryKey: s.queryKey,
757
- refetchType: "none"
758
- }) : Ye(s.queryKey) ? X(e, s) : o.push(lt(e, s, t, n, r).then((e) => {
759
- e.refetchCount && (a = !0);
760
- })));
761
- return await Promise.all(o), a;
762
- }
763
- async function lt(e, t, n, r, i) {
764
- let a = t.state.data;
765
- if (!a || !Array.isArray(a.data)) return X(e, t), {
766
- refetchWindow: !0,
767
- refetchCount: !0
768
- };
769
- let o = vt(t), s = o.per_page ?? a.data.length;
770
- if (r.length > s) return pt(e, t);
771
- let c, l = xt(t), u = t.state.dataUpdateCount;
772
- try {
773
- c = await T(n, mt(o, r), { signal: i });
774
- } catch (r) {
775
- return yt(r) ? (Y(e, {
776
- scope: { kind: "keys" },
777
- keys: [t.queryKey, D(n, o)],
778
- standing: !0
779
- }), e.invalidateQueries({
780
- queryKey: t.queryKey,
781
- refetchType: "none"
782
- }), {
783
- refetchWindow: !1,
784
- refetchCount: !1
785
- }) : pt(e, t);
786
- }
787
- return c.meta?.has_more || t.state.dataUpdateCount !== u ? pt(e, t) : ut(e, t, a, o, r, c, l);
788
- }
789
- function ut(e, t, n, r, i, a, o) {
790
- let s = Oe(r.sort).map((e) => e.field), c = _t(t, r), l = {
791
- refetchWindow: !1,
792
- refetchCount: !1
793
- }, u = [], d = [];
794
- for (let e of i) {
795
- let t = a.data.find((t) => Z(t, e.pk)), r = n.data.findIndex((t) => Z(t, e.pk));
796
- t && r >= 0 ? gt(s, n.data[r], t) ? l.refetchWindow = !0 : u.push({
797
- pk: e.pk,
798
- row: t
799
- }) : t ? (l.refetchWindow = !0, l.refetchCount = !0) : r >= 0 ? (d.push(e.pk), l.refetchWindow = !0, l.refetchCount = !0) : e.createdOnly || (l.refetchCount = !0, c || (l.refetchWindow = !0));
800
- }
801
- return (d.length > 0 || u.length > 0 && !l.refetchWindow) && dt(e, t, u, d, a, o), l.refetchWindow && X(e, t), l;
802
- }
803
- function dt(e, t, n, r, i, a) {
804
- St(t, a) && e.setQueryData(t.queryKey, (e) => {
805
- if (!e || !Array.isArray(e.data)) return e;
806
- let t = e.data.map((e) => {
807
- let t = n.find((t) => Z(e, t.pk));
808
- return t ? t.row : e;
809
- });
810
- return r.length > 0 && (t = t.filter((e) => !r.some((t) => Z(e, t)))), {
811
- ...e,
812
- data: t,
813
- $refs: ft(e.$refs, i.$refs)
814
- };
815
- });
816
- }
817
- function ft(e, t) {
818
- if (!t) return e;
819
- if (!e) return t;
820
- let n = { ...e };
821
- for (let [e, r] of Object.entries(t)) n[e] = {
822
- ...n[e] ?? {},
823
- ...r
824
- };
825
- return n;
826
- }
827
- function pt(e, t) {
828
- return X(e, t), {
829
- refetchWindow: !0,
830
- refetchCount: !0
831
- };
832
- }
833
- function mt(e, t) {
834
- let n = [...e.filters ?? [], ht(t)];
835
- return {
836
- ...e,
837
- filters: n,
838
- page: 1,
839
- per_page: t.length,
840
- count: "window"
841
- };
842
- }
843
- function ht(e) {
844
- let t = Object.keys(e[0]?.pk ?? {}).sort();
845
- if (t.length === 1) {
846
- let n = t[0];
847
- return {
848
- field: n,
849
- op: "in",
850
- value: e.map((e) => e.pk[n])
851
- };
852
- }
853
- return { or: e.map((e) => ({ and: t.map((t) => ({
854
- field: t,
855
- op: "eq",
856
- value: e.pk[t]
857
- })) })) };
858
- }
859
- function gt(e, t, n) {
860
- for (let r of e) {
861
- let e = t[r], i = n[r];
862
- if (e === void 0 || i === void 0 || !Object.is(e, i) && JSON.stringify(e) !== JSON.stringify(i)) return !0;
863
- }
864
- return !1;
865
- }
866
- function Z(e, t) {
867
- for (let [n, r] of Object.entries(t)) {
868
- let t = e[n];
869
- if (typeof t != "string" && typeof t != "number" || String(t) !== r) return !1;
870
- }
871
- return !0;
872
- }
873
- function _t(e, t) {
874
- return e.queryKey[0] === "entity-data-all" || (t.page ?? 1) === 1;
875
- }
876
- function vt(e) {
877
- let t = e.queryKey[2];
878
- return t && typeof t == "object" ? { ...t } : {};
879
- }
880
- function yt(e) {
881
- return e instanceof E && e.status === 429;
882
- }
883
- var bt = /* @__PURE__ */ new WeakMap();
884
- function xt(e) {
885
- let t = (bt.get(e) ?? 0) + 1;
886
- return bt.set(e, t), t;
887
- }
888
- function St(e, t) {
889
- return (bt.get(e) ?? 0) === t;
890
- }
891
- //#endregion
892
- //#region src/hooks/useSSE.ts
893
- var Ct = 3e4, wt = 1e3, Tt = 50, Et = "replay_gap";
894
- function Dt() {
895
- return typeof document > "u" || document.visibilityState !== "hidden";
896
- }
897
- function Ot() {
898
- let [e, t] = z(Dt);
899
- return I(() => {
900
- if (typeof document > "u") return;
901
- let e = () => t(Dt());
902
- return document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e);
903
- }, []), e;
904
- }
905
- async function Q(e, t, n) {
906
- if (t.length === 0) return;
907
- let r = /* @__PURE__ */ new Map();
908
- for (let e of t) {
909
- let t = r.get(e.entity) ?? {
910
- keylessReason: null,
911
- keyless: !1,
912
- rows: /* @__PURE__ */ new Map()
913
- }, n = Ft(e);
914
- if (n === null) t.keyless = !0, t.keylessReason = Mt(t.keylessReason, e.reason ?? "");
915
- else for (let r of n) {
916
- let n = Pt(r), i = t.rows.get(n);
917
- t.rows.set(n, {
918
- pk: r,
919
- createdOnly: (i?.createdOnly ?? !0) && e.action === "created"
920
- });
921
- }
922
- r.set(e.entity, t);
923
- }
924
- let i = [];
925
- for (let [t, a] of r) e.invalidateQueries({ predicate: (e) => {
926
- let n = e.queryKey;
927
- return n[0] === "entity-children" && n[3] === t;
928
- } }), t === "generated_document" && e.invalidateQueries({ predicate: (e) => e.queryKey[0] === Ee }), a.keyless ? At(e, t, a.keylessReason) : (Lt(e, t, [...a.rows.values()].map((e) => e.pk)), i.push(ct(e, t, [...a.rows.values()], n).then((n) => {
929
- if (n) for (let n of e.getQueryCache().findAll({ queryKey: ["entity-count", t] })) X(e, n);
930
- })));
931
- await Promise.all(i);
932
- }
933
- function kt(e, t, n, r, i) {
934
- let a = r.filter((e) => Object.keys(e).length > 0);
935
- if (a.length === 0 || a.length !== r.length) {
936
- i();
937
- return;
938
- }
939
- let o = a.map((e) => ({ pk: e })), s = Bt(e, t, [{
940
- entity: n,
941
- action: "updated",
942
- ids: a.map(Pt),
943
- objects: o
944
- }]);
945
- s.length === 0 ? i() : Q(e, s);
946
- }
947
- function At(e, t, n) {
948
- let r = (e) => Nt(e, t);
949
- n === $ ? jt(e, r) : e.invalidateQueries({ predicate: (e) => r(e.queryKey) });
950
- }
951
- function jt(e, t) {
952
- e.removeQueries({ predicate: (e) => t(e.queryKey) && e.getObserversCount() > 0 }), e.invalidateQueries({
953
- predicate: (e) => t(e.queryKey),
954
- refetchType: "none"
955
- });
956
- }
957
- var $ = "access_not_projectable";
958
- function Mt(e, t) {
959
- return e === $ || t === $ ? $ : e ?? t;
960
- }
961
- function Nt(e, t) {
962
- return e[1] === t && Xe(e);
963
- }
964
- function Pt(e) {
965
- return JSON.stringify(Object.keys(e).sort().map((t) => [t, e[t]]));
966
- }
967
- function Ft(e) {
968
- if (e.ids.length === 0 || !e.objects || e.objects.length === 0) return null;
969
- let t = [];
970
- for (let n of e.objects) {
971
- if (!n.pk || Object.keys(n.pk).length === 0) return null;
972
- t.push(n.pk);
973
- }
974
- return t;
975
- }
976
- function It(e) {
977
- let t = Object.keys(e).sort(), n = [JSON.stringify(t.map((t) => [t, e[t]]))];
978
- return t.length === 1 && n.push(JSON.stringify(e[t[0]])), n;
979
- }
980
- function Lt(e, t, n) {
981
- if (n.length === 0) return;
982
- let r = /* @__PURE__ */ new Set();
983
- for (let e of n) for (let t of It(e)) r.add(t);
984
- e.invalidateQueries({ predicate: (e) => {
985
- let n = e.queryKey;
986
- return n[0] === "entity-item" && n[1] === t && r.has(JSON.stringify(n[2] ?? null));
987
- } });
988
- }
989
- function Rt(e) {
990
- return Ze(e) || e[0] === "action-data" || e[0] === "action-data-cursor";
991
- }
992
- function zt(e) {
993
- jt(e, Rt);
994
- }
995
- function Bt(e, t, n) {
996
- let r = e.getQueryData(["schema", t]), i = H.getState().degradedEntities;
997
- return n.filter((e) => ye(r?.entities?.[e.entity]?.realtime, i, e.entity));
998
- }
999
- function Vt(e, t) {
1000
- let n = e.getQueryData(["schema", t]), r = H.getState().degradedEntities;
1001
- e.invalidateQueries({
1002
- predicate: (e) => {
1003
- let t = q(e.queryKey);
1004
- return t !== null && !ye(n?.entities?.[t]?.realtime, r, t);
1005
- },
1006
- refetchType: "active"
1007
- });
1008
- }
1009
- function Ht(e, t) {
1010
- return e.snapshotPoint !== null && t !== void 0 && Number(t) > e.snapshotPoint;
1011
- }
1012
- function Ut() {
1013
- let e = c((e) => e.isAuthenticated), r = c((e) => e.activeTenant?.id ?? ""), i = B(), o = R(null), u = R(""), d = R(""), f = R(Promise.resolve()), h = R(0), g = Ot(), _ = R(!g);
1014
- ot(i), Te(), I(() => {
1015
- let v = H.getState();
1016
- if (!e) {
1017
- u.current = "", d.current = "", _.current = !g, v.clearConnectionInterruption();
1018
- return;
1019
- }
1020
- if (!g) {
1021
- _.current = !0, o.current?.abort(), o.current = null, v.clearConnectionInterruption();
1022
- return;
1023
- }
1024
- v.holdConnectionInterruption(), _.current && (_.current = !1, u.current && Vt(i, e)), d.current !== r && (u.current = "", d.current = r);
1025
- let y = !0, b = 0, x = null, C = [], w = null, T = null, E = (e) => {
1026
- f.current = f.current.then(e).catch((e) => {
1027
- console.error("realtime: applying a change batch failed", e);
1028
- });
1029
- }, D = (e, t) => {
1030
- d.current === t && (u.current = e);
1031
- }, O = (e) => {
1032
- if (!e) return;
1033
- k();
1034
- let t = d.current;
1035
- E(() => D(e, t));
1036
- }, k = () => {
1037
- if (w !== null && (clearTimeout(w), w = null), C.length === 0) return;
1038
- let t = C.splice(0, C.length), n = o.current?.signal, r = d.current;
1039
- E(() => Q(i, Bt(i, e, t), n).finally(() => {
1040
- for (let e of t) e.eventID && D(e.eventID, r);
1041
- }));
1042
- }, A = () => {
1043
- w === null && (w = setTimeout(k, Tt));
1044
- }, j = () => {
1045
- T !== null && (clearTimeout(T), T = null);
1046
- }, M = (e) => {
1047
- j();
1048
- let t = H.getState().thresholds;
1049
- t !== null && t !== "unreadable" && (T = setTimeout(() => {
1050
- T = null, y && x === e && (e.silent = !0, H.getState().holdConnectionInterruption());
1051
- }, t.silenceMs));
1052
- }, N = (e) => {
1053
- y && x === e && e.stated && (e.silent && (e.silent = !1, H.getState().clearConnectionInterruption()), M(e));
1054
- }, te = H.subscribe((e, t) => {
1055
- e.thresholds !== t.thresholds && x?.stated && !x.silent && M(x);
1056
- }), P = (e) => {
1057
- let t = H.getState(), n = new Set(e), r = /* @__PURE__ */ new Map();
1058
- for (let [e, { mark: i }] of t.degradedEntities) n.has(e) || r.set(e, i);
1059
- let a = [...n].filter((e) => !t.degradedEntities.has(e));
1060
- for (let e of n) t.markDegraded(e);
1061
- r.size > 0 && Y(i, {
1062
- scope: {
1063
- kind: "entities",
1064
- entities: new Set(r.keys())
1065
- },
1066
- jitter: !0,
1067
- carriedMarks: r
1068
- }), a.length > 0 && Q(i, a.map((e) => ({
1069
- entity: e,
1070
- action: "updated",
1071
- ids: []
1072
- })));
1073
- };
1074
- async function F() {
1075
- for (; y;) {
1076
- let e = new AbortController();
1077
- o.current = e;
1078
- let r = n(), d = r ? p() : null, f = {
1079
- seq: ++h.current,
1080
- presented: u.current !== "",
1081
- stated: !1,
1082
- silent: !1,
1083
- snapshotPoint: null
1084
- };
1085
- x = f;
1086
- let g = H.getState();
1087
- g.holdConnectionInterruption(), f.presented ? g.startReplay() : g.endReplay();
1088
- let _ = /* @__PURE__ */ new Set();
1089
- try {
1090
- for await (let n of m({
1091
- signal: e.signal,
1092
- lastEventID: u.current,
1093
- bearerToken: d ?? void 0,
1094
- credentials: r ? "omit" : void 0,
1095
- onActivity: () => N(f)
1096
- })) {
1097
- if (!y) break;
1098
- let e = H.getState();
1099
- if (n.type === "session_refresh") {
1100
- zt(i);
1101
- try {
1102
- r ? (l(), await s()) : await t(), i.invalidateQueries({ queryKey: ["schema"] }), c.getState().refreshMe();
1103
- } catch {}
1104
- break;
1105
- }
1106
- if (n.type === "snapshot_complete") {
1107
- b = 0, f.stated = !0, f.snapshotPoint = n.asOf ?? null, e.clearConnectionInterruption(), M(f);
1108
- let t = n.known && n.asOf !== void 0;
1109
- t ? e.clearRelayInterruption() : e.holdRelayInterruption(), f.presented || (n.asOf && O(String(n.asOf)), Y(i, { scope: { kind: "all" } })), t && P(_ ?? []), _ = null;
1110
- } else if (n.type === "replay_complete") {
1111
- k();
1112
- let e = f.seq;
1113
- E(() => {
1114
- h.current === e && H.getState().endReplay();
1115
- });
1116
- } else if (n.type === "checkpoint") O(n.eventID);
1117
- else if (n.type === "cache_reset") O(n.eventID), n.reason !== Et && Ht(f, n.eventID) && e.holdRelayInterruption(), Y(i, {
1118
- scope: { kind: "all" },
1119
- jitter: !0
1120
- });
1121
- else if (n.type === "realtime_streaming") {
1122
- if (O(n.eventID), !Ht(f, n.eventID)) continue;
1123
- e.clearRelayInterruption(), P(n.degraded);
1124
- } else if (n.type === "realtime_degraded") {
1125
- if (_ !== null) {
1126
- _.add(n.entity);
1127
- continue;
1128
- }
1129
- if (O(n.eventID), !Ht(f, n.eventID)) continue;
1130
- e.markDegraded(n.entity), Q(i, [{
1131
- entity: n.entity,
1132
- action: "updated",
1133
- ids: []
1134
- }]);
1135
- } else n.type === "entity_changed" && (C.push({
1136
- entity: n.entity,
1137
- action: n.action,
1138
- eventID: n.eventID,
1139
- ids: n.ids,
1140
- objects: n.objects,
1141
- reason: n.reason
1142
- }), A());
1143
- }
1144
- } catch (e) {
1145
- if (!y || e instanceof DOMException && e.name === "AbortError") break;
1146
- if (e instanceof ee) {
1147
- if (H.getState().holdConnectionInterruption(), j(), r) try {
1148
- l(), await s(), b = 0;
1149
- continue;
1150
- } catch {
1151
- S()();
1152
- return;
1153
- }
1154
- try {
1155
- await t(), b = 0;
1156
- continue;
1157
- } catch (e) {
1158
- if (e instanceof a) {
1159
- S()();
1160
- return;
1161
- }
1162
- }
1163
- }
1164
- }
1165
- if (j(), !y) break;
1166
- H.getState().holdConnectionInterruption();
1167
- let v = Math.min(wt * 2 ** b, Ct), w = v * .5 * Math.random();
1168
- await new Promise((e) => setTimeout(e, v + w)), b++;
1169
- }
1170
- }
1171
- return F(), () => {
1172
- y = !1, x = null, o.current?.abort(), o.current = null, j(), te(), k();
1173
- };
1174
- }, [
1175
- e,
1176
- r,
1177
- i,
1178
- g
1179
- ]);
1180
- }
1181
- //#endregion
1182
- //#region src/components/actions/ActionRunner.tsx
1183
- var Wt = P(() => import("./ActionDialog-C6EG-AmC.js").then((e) => ({ default: e.ActionDialog })));
1184
- function Gt(e, t) {
1185
- if (!t || typeof t != "object") return { kind: "success" };
1186
- let n = t, r = n.status, i = n.success?.length ?? 0, a = n.errors?.length ?? 0, o = n.skipped?.length ?? 0, s = n.errors?.[0]?.error?.title;
1187
- if (r === "partial") {
1188
- let t = e("action.outcome.succeeded_of", "{count} of {total} succeeded", {
1189
- count: i,
1190
- total: i + a + o
1191
- });
1192
- return {
1193
- kind: "partial",
1194
- detail: s ? `${t} · ${s}` : t
1195
- };
1196
- }
1197
- if (r === "skipped") return {
1198
- kind: "skipped",
1199
- detail: e("action.outcome.none_matched", "No items matched")
1200
- };
1201
- if (r === "accepted") return { kind: "accepted" };
1202
- if (w(n.events)) {
1203
- let t = n.events?.failed_count ?? 0, r = n.events?.timed_out_count ?? 0, i = n.events?.failures_omitted ?? 0, a = [t ? u(e, "action.outcome.follow_up_steps_count", t, {
1204
- one: "{count} follow-up step failed",
1205
- other: "{count} follow-up steps failed"
1206
- }) : "", r ? e("action.outcome.timed_out_count", "{count} did not finish in time", { count: r }) : ""].filter(Boolean), o = n.events?.failures?.[0], s = o ? `${a.join(" · ")} · ${o.handler}` : a.join(" · ");
1207
- return {
1208
- kind: "partial",
1209
- detail: i ? e("action.outcome.with_more", "{summary} (+{count} more)", {
1210
- summary: s,
1211
- count: i
1212
- }) : s
1213
- };
1214
- }
1215
- return { kind: "success" };
1216
- }
1217
- function Kt(e) {
1218
- if (!e || typeof e != "object") return null;
1219
- let t = e.result;
1220
- if (!t || typeof t != "object") return null;
1221
- let n = t.$display;
1222
- return !n || typeof n != "object" ? null : n;
1223
- }
1224
- function qt(e) {
1225
- let t = Kt(e)?.fields;
1226
- if (!Array.isArray(t)) return null;
1227
- for (let e of t) {
1228
- if (e?.type !== "download") continue;
1229
- let t = e.href ?? e.download_url ?? e.value;
1230
- if (typeof t == "string" && t !== "" && O(t)) return {
1231
- url: t,
1232
- filename: typeof e.filename == "string" ? e.filename : void 0
1233
- };
1234
- }
1235
- return null;
1236
- }
1237
- function Jt(e) {
1238
- if (!e || typeof e != "object") return;
1239
- let t = e.result;
1240
- t && typeof t == "object" && "impersonation_session_id" in t && window.location.assign("/");
1241
- }
1242
- function Yt(e, t, n) {
1243
- if (n instanceof x) {
1244
- let r = n.response.errors ?? [], i = r[0]?.error?.title;
1245
- if (r.length === 1) return {
1246
- kind: "error",
1247
- detail: d(t, n),
1248
- retryable: r[0]?.error?.retryable
1249
- };
1250
- let a = e("action.outcome.failed_count", "{count} failed", { count: r.length });
1251
- return {
1252
- kind: "error",
1253
- detail: i ? `${a} · ${i}` : a,
1254
- retryable: r.every((e) => e.error?.retryable)
1255
- };
1256
- }
1257
- return {
1258
- kind: "error",
1259
- detail: d(t, n),
1260
- retryable: n instanceof E ? n.retryable : void 0
1261
- };
1262
- }
1263
- var Xt = te(null);
1264
- function Zt() {
1265
- let e = ne(Xt);
1266
- if (!e) throw Error("useActionRunner must be used within <ActionRunnerProvider>");
1267
- return e;
1268
- }
1269
- function Qt(e) {
1270
- let t = {}, n = e.action?.resolved_hidden_defaults;
1271
- if (n) for (let [e, r] of Object.entries(n)) r !== void 0 && (t[e] = r);
1272
- return t;
1273
- }
1274
- function $t({ children: t }) {
1275
- let n = j(), i = j("errors"), a = g(), { data: s } = o(), [l, u] = z(null), [f, p] = z(0), [m, _] = z(null), y = F((e) => {
1276
- if (e?.progress_screen) return s?.screens[e.progress_screen]?.route;
1277
- }, [s?.screens]), b = F((t, r, o, s, c, l) => {
1278
- let u = () => {
1279
- let e = en(c), r = y(o), i = e ? n("action.toast.job_queued", "Job {id} queued", { id: e }) : n("action.toast.running_in_background", "Running in background");
1280
- h.success(n("action.toast.started", "{title} started", { title: t }), i, r ? { action: {
1281
- label: n("action.toast.view", "View"),
1282
- onClick: () => a(r)
1283
- } } : void 0);
1284
- };
1285
- switch (s.kind) {
1286
- case "success": {
1287
- let a = qt(c), o = a ? { action: {
1288
- label: n("action.result.download", "Download"),
1289
- onClick: () => {
1290
- e(i, a.url, a.filename).catch((e) => {
1291
- h.error(i("file.download_failed", "The file could not be downloaded."), d(i, e));
1292
- });
1293
- }
1294
- } } : void 0;
1295
- r ? u() : h.success(n("action.toast.complete", "{title} complete", { title: t }), void 0, o);
1296
- return;
1297
- }
1298
- case "accepted":
1299
- u();
1300
- return;
1301
- case "skipped":
1302
- h.info(t, s.detail);
1303
- return;
1304
- case "partial":
1305
- h.warning(n("action.toast.partially_completed", "{title} partially completed", { title: t }), s.detail);
1306
- return;
1307
- case "error":
1308
- h.error(t, s.detail || i("action.failed", "This action did not complete."), s.retryable && l ? { action: {
1309
- label: n("action.toast.retry", "Retry"),
1310
- onClick: l
1311
- } } : void 0);
1312
- return;
1313
- }
1314
- }, [
1315
- n,
1316
- i,
1317
- a,
1318
- y
1319
- ]), x = B(), S = c((e) => e.isAuthenticated), C = F((e, t, n) => {
1320
- let r = () => {
1321
- for (let e of [
1322
- "entity-data",
1323
- "entity-count",
1324
- "entity-item"
1325
- ]) x.invalidateQueries({ queryKey: [e, t] });
1326
- };
1327
- if (n === "partial") return r();
1328
- let i = s?.entities?.[t], a = e.row ? [e.row] : e.bulkSelection ?? [];
1329
- if (!i || a.length === 0) return r();
1330
- kt(x, S, t, a.map((e) => v(i, e)), r);
1331
- }, [
1332
- x,
1333
- s,
1334
- S
1335
- ]), w = F((e, t, n) => {
1336
- if (t.kind === "success" || t.kind === "accepted" || t.kind === "partial") {
1337
- let n = e.entity ?? e.action?.entity;
1338
- n && C(e, n, t.kind);
1339
- }
1340
- if (t.kind !== "success" && t.kind !== "accepted") return;
1341
- e.onSuccess?.(n);
1342
- let r = Kt(n);
1343
- r && _(r), Jt(n);
1344
- }, [C]), T = F((e) => {
1345
- let t = e.action, a = e.longRunning ?? t?.long_running ?? !1, o = e.title || n(t?.display?.name) || n("action.default_title", "Action"), s = async (r) => {
1346
- p((e) => e + 1);
1347
- try {
1348
- let i = await e.execute(r), s = Gt(n, i);
1349
- b(o, a, t, s, i), w(e, s, i);
1350
- } catch (e) {
1351
- b(o, a, t, Yt(n, i, e), void 0, () => {
1352
- s(r);
1353
- });
1354
- } finally {
1355
- p((e) => Math.max(0, e - 1));
1356
- }
1357
- }, c = t ?? (e.destructive ? {
1358
- display: {
1359
- name: { en: o },
1360
- icon: ""
1361
- },
1362
- destructive: !0
1363
- } : void 0), l = !!(t?.resolved_params && t.resolved_params.length > 0), d = r(c);
1364
- return c && (l || d) ? (u({
1365
- id: Symbol(),
1366
- opts: e,
1367
- title: o,
1368
- action: c,
1369
- pending: !1
1370
- }), Promise.resolve()) : s(Qt(e));
1371
- }, [
1372
- n,
1373
- i,
1374
- b,
1375
- w
1376
- ]), E = f > 0 || !!l?.pending, D = L(() => ({
1377
- run: T,
1378
- isRunning: E
1379
- }), [T, E]), O = l?.action, k = F(async (e) => {
1380
- if (!l) return;
1381
- let t = l.id, r = l, a = r.opts.action, o = r.opts.longRunning ?? a?.long_running ?? !1;
1382
- u((e) => e?.id === t ? {
1383
- ...e,
1384
- pending: !0
1385
- } : e), p((e) => e + 1);
1386
- try {
1387
- let i = await r.opts.execute(e), s = Gt(n, i);
1388
- b(r.title, o, a, s, i), w(r.opts, s, i), s.kind !== "partial" && u((e) => e?.id === t ? null : e);
1389
- } catch (e) {
1390
- b(r.title, o, a, Yt(n, i, e));
1391
- } finally {
1392
- p((e) => Math.max(0, e - 1)), u((e) => e?.id === t ? {
1393
- ...e,
1394
- pending: !1
1395
- } : e);
1396
- }
1397
- }, [
1398
- n,
1399
- i,
1400
- l,
1401
- b,
1402
- w
1403
- ]);
1404
- return /* @__PURE__ */ se(Xt.Provider, {
1405
- value: D,
1406
- children: [
1407
- t,
1408
- m && /* @__PURE__ */ V(ue, {
1409
- open: !0,
1410
- onClose: () => _(null),
1411
- display: m
1412
- }),
1413
- l && O && /* @__PURE__ */ V(N, {
1414
- fallback: null,
1415
- children: /* @__PURE__ */ V(Wt, {
1416
- open: !0,
1417
- onOpenChange: (e) => {
1418
- e || u(null);
1419
- },
1420
- action: O,
1421
- actionName: l.title,
1422
- onSubmit: k,
1423
- isPending: l.pending,
1424
- bulkSelection: l.opts.bulkSelection,
1425
- row: l.opts.row
1426
- })
1427
- })
1428
- ]
1429
- });
1430
- }
1431
- function en(e) {
1432
- return tn(e) ?? tn(e?.result);
1433
- }
1434
- function tn(e) {
1435
- if (!e || typeof e != "object") return;
1436
- let t = e, n = t.job_id ?? t.id;
1437
- return typeof n == "string" ? n : void 0;
1438
- }
1439
- //#endregion
1440
- export { ge as C, fe as E, _e as S, de as T, Ee as _, He as a, pe as b, W as c, Me as d, je as f, ke as g, Ae as h, Ut as i, Ie as l, Ne as m, Zt as n, Ve as o, Oe as p, kt as r, Ue as s, $t as t, Be as u, xe as v, ve as w, he as x, me as y };