@objectstack/console 12.3.0 → 12.4.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 (248) hide show
  1. package/dist/.objectui-sha +1 -1
  2. package/dist/assets/{AdapterProvider-_4c7hk3d.js → AdapterProvider-DYYVhErE.js} +1 -1
  3. package/dist/assets/{AiPendingActionsPage-Gc2Wh8Kh.js → AiPendingActionsPage-BRZ9smBE.js} +1 -1
  4. package/dist/assets/ApiConsolePage-DqCLFtg6.js +1 -0
  5. package/dist/assets/AppDocsIndex-ChTjYsgs.js +1 -0
  6. package/dist/assets/AppManagementPage-CpBtMYk7.js +1 -0
  7. package/dist/assets/ApprovalsInboxPage-Cm6RlF50.js +1 -0
  8. package/dist/assets/{AuditLogPage-C-rDSpPt.js → AuditLogPage-BUapxa-t.js} +1 -1
  9. package/dist/assets/{ComponentNavView-DX23dzZd.js → ComponentNavView-CV-L0t8o.js} +1 -1
  10. package/dist/assets/ConsoleFloatingChatbot-BtSnKZ5C.js +1 -0
  11. package/dist/assets/CreateViewDialog-CMNLzv6j.js +1 -0
  12. package/dist/assets/DashboardView-DTeb8b6a.js +1 -0
  13. package/dist/assets/DashboardWidgetInspector-CUJFDeER.js +1 -0
  14. package/dist/assets/DeveloperHubPage-CigDAiDQ.js +1 -0
  15. package/dist/assets/{ExpressionProvider-w-HoWEV1.js → ExpressionProvider-ODpzkcN3.js} +1 -1
  16. package/dist/assets/FlowRunsPage-BCTyVNQV.js +1 -0
  17. package/dist/assets/{IntegrationsPage-COvUlRq2.js → IntegrationsPage-D8453O8m.js} +2 -2
  18. package/dist/assets/InterfaceListPage-CaG6oJ3-.js +1 -0
  19. package/dist/assets/{ManagedByBadge-BZofhfqM.js → ManagedByBadge-BGSB7vGi.js} +1 -1
  20. package/dist/assets/MarketplaceAccessDenied-CAuxNcMw.js +1 -0
  21. package/dist/assets/MarketplaceInstalledPage-DIKAvmEt.js +1 -0
  22. package/dist/assets/MarketplacePackagePage-CxoOdisY.js +4 -0
  23. package/dist/assets/MarketplacePage-SkUEdd3B.js +1 -0
  24. package/dist/assets/{MetadataInspector-CpceGXDL.js → MetadataInspector-RvnQ-QOT.js} +1 -1
  25. package/dist/assets/MetadataProvider-BpQl3Bw2.js +1 -0
  26. package/dist/assets/{MonacoImpl-DoDns4Vj.js → MonacoImpl-nyLaER8_.js} +1 -1
  27. package/dist/assets/ObjectDataPage-CnMdpBNe.js +1 -0
  28. package/dist/assets/PageView-Ckvi7QO6.js +1 -0
  29. package/dist/assets/ProfilePage-7etuxYZk.js +1 -0
  30. package/dist/assets/PublicFormsPage-xWq9jZzJ.js +1 -0
  31. package/dist/assets/RecordDetailView-CzR6BAUv.js +9 -0
  32. package/dist/assets/{RecordFormPage-CbvOD5UT.js → RecordFormPage-DTyNzewM.js} +1 -1
  33. package/dist/assets/ReportDefaultInspector-BA-D9th_.js +11 -0
  34. package/dist/assets/ReportView-CHBbT7mP.js +2 -0
  35. package/dist/assets/{SearchResultsPage-D0nbmFox.js → SearchResultsPage-BIuFjDoa.js} +1 -1
  36. package/dist/assets/{SettingsHub-BsZee-2C.js → SettingsHub-ZMQjBQwP.js} +1 -1
  37. package/dist/assets/SettingsView-eCnpX1vu.js +1 -0
  38. package/dist/assets/SystemHubPage-f4hYqDoI.js +1 -0
  39. package/dist/assets/{abnfDiagram-VRR7QNED-DWrainSQ.js → abnfDiagram-VRR7QNED-o_fBNeYD.js} +1 -1
  40. package/dist/assets/architecture-TIHT7OUA-BF_0SrOH.js +1 -0
  41. package/dist/assets/{architectureDiagram-ZJ3FMSHR-BqIfH_cZ.js → architectureDiagram-ZJ3FMSHR-Bk_LES5L.js} +1 -1
  42. package/dist/assets/{assistantBus-DosfPCbN.js → assistantBus-BFk4fCbM.js} +1 -1
  43. package/dist/assets/{blockDiagram-677ZJIJ3-BDhRO3KX.js → blockDiagram-677ZJIJ3-BmONypzo.js} +1 -1
  44. package/dist/assets/{c4Diagram-LMCZKHZV-DBmvkEa3.js → c4Diagram-LMCZKHZV-DqIiaVjm.js} +1 -1
  45. package/dist/assets/channel-CvRTB8GE.js +1 -0
  46. package/dist/assets/{chunk-32BRIVSS-1_aHOdgh.js → chunk-32BRIVSS-BbTX8O4m.js} +1 -1
  47. package/dist/assets/{chunk-52WLFC77-C-mFgIG6.js → chunk-52WLFC77-DkgICN4F.js} +1 -1
  48. package/dist/assets/{chunk-C7G6YPKG-DvvI9WqY.js → chunk-C7G6YPKG-UMP_bNDd.js} +1 -1
  49. package/dist/assets/{chunk-EX3LRPZG-BaKE258M.js → chunk-EX3LRPZG-B0dJ64Ff.js} +1 -1
  50. package/dist/assets/{chunk-FWX5IMBZ-BZ1KYToN.js → chunk-FWX5IMBZ-B8cCL4T7.js} +1 -1
  51. package/dist/assets/{chunk-HOUHSVGY-BjQmUg1D.js → chunk-HOUHSVGY-B5nScni0.js} +1 -1
  52. package/dist/assets/{chunk-ICXQ74PX-DGFLQjwm.js → chunk-ICXQ74PX-zJg8KmvA.js} +1 -1
  53. package/dist/assets/{chunk-KEIR6QF5-MVybfwhZ.js → chunk-KEIR6QF5-CxDrFr0l.js} +3 -3
  54. package/dist/assets/{chunk-MOJQB5TN-aPZk6pC8.js → chunk-MOJQB5TN-DBKCpvOi.js} +1 -1
  55. package/dist/assets/{chunk-OGEWGWER-C_9e4OS0.js → chunk-OGEWGWER-bKk51Nxt.js} +1 -1
  56. package/dist/assets/{chunk-PUDLZKDR-c0kZKR-G.js → chunk-PUDLZKDR-CKn_9iXM.js} +1 -1
  57. package/dist/assets/{chunk-Q4XR5HBZ-o24M5lkF.js → chunk-Q4XR5HBZ-BP9atbVx.js} +1 -1
  58. package/dist/assets/{chunk-RYQCIY6F-DUMnfbFk.js → chunk-RYQCIY6F-B5RR1tIz.js} +1 -1
  59. package/dist/assets/{chunk-V7JOEXUC-BP0RE3_V.js → chunk-V7JOEXUC-DTerDTcg.js} +1 -1
  60. package/dist/assets/chunk-VAUOI2AC-BrcFPe7Z.js +1 -0
  61. package/dist/assets/{chunk-VR4S4FIN-DykLEeqy.js → chunk-VR4S4FIN-jB_W-MHs.js} +1 -1
  62. package/dist/assets/chunk-WYO6CB5R-Cndg0Yo5.js +127 -0
  63. package/dist/assets/chunk-XXDRQBXY-DGANY6E3.js +1 -0
  64. package/dist/assets/{chunk-ZGVPDNZ5-DQH9cJwj.js → chunk-ZGVPDNZ5-BUUSzPje.js} +1 -1
  65. package/dist/assets/classDiagram-OUVF2IWQ-BGL42sFI.js +1 -0
  66. package/dist/assets/classDiagram-v2-EOCWNBFH-BGL42sFI.js +1 -0
  67. package/dist/assets/{cose-bilkent-JH36ORCC-CDWwyRUu.js → cose-bilkent-JH36ORCC-DJ-X6wmF.js} +1 -1
  68. package/dist/assets/cynefin-VYW2F7L2-CXt4AgYW.js +1 -0
  69. package/dist/assets/{cynefinDiagram-TSTJHNR4-Dn83Cn2D.js → cynefinDiagram-TSTJHNR4-C5mKt5aU.js} +1 -1
  70. package/dist/assets/{cytoscape.esm-Djp6vQyU.js → cytoscape.esm-B3I8pqwA.js} +1 -1
  71. package/dist/assets/{dagre-VKFMJZFB-DYKhgtL2.js → dagre-VKFMJZFB-Crs38V5P.js} +2 -2
  72. package/dist/assets/{data-adapter-W6WwA2ln.js → data-adapter-DLOPVTZ2.js} +1 -1
  73. package/dist/assets/{diagram-FQU43EPY-84kGXmcJ.js → diagram-FQU43EPY-Bkx8ccpS.js} +1 -1
  74. package/dist/assets/{diagram-G47NLZAW-FzYRzXJF.js → diagram-G47NLZAW-CSNJrWDK.js} +1 -1
  75. package/dist/assets/{diagram-NH7WQ7WH-D2_7Upma.js → diagram-NH7WQ7WH-PaRAbfdR.js} +1 -1
  76. package/dist/assets/{diagram-OA4YK3LP-uqOHgtNB.js → diagram-OA4YK3LP-C2A07yOA.js} +1 -1
  77. package/dist/assets/{diagram-WEI45ONY-BoLpoJXF.js → diagram-WEI45ONY-BEyyGNpU.js} +1 -1
  78. package/dist/assets/{dist-CfcbLQde.js → dist-YwlXXOlT.js} +1 -1
  79. package/dist/assets/{ebnfDiagram-CCIWWBDH-DLYgN3Ab.js → ebnfDiagram-CCIWWBDH-CtfwkNuv.js} +1 -1
  80. package/dist/assets/{erDiagram-Q63AITRT-BmagGyFR.js → erDiagram-Q63AITRT-DjK6P1sf.js} +1 -1
  81. package/dist/assets/eventmodeling-45OFAUF4-Dmacb12o.js +1 -0
  82. package/dist/assets/{exceljs.min-DIyttv_G.js → exceljs.min-Dpb6mnud.js} +2 -2
  83. package/dist/assets/flowDiagram-23GEKE2U-DfQvGNQk.js +1 -0
  84. package/dist/assets/framework-B3O15Lsq.js +36 -0
  85. package/dist/assets/{ganttDiagram-NO4QXBWP-DdGzwLRB.js → ganttDiagram-NO4QXBWP-UPhpWlEd.js} +1 -1
  86. package/dist/assets/getIcon-B5xaQx5N.js +1 -0
  87. package/dist/assets/gitGraph-TEB2WS4Q-ChM6j6Bd.js +1 -0
  88. package/dist/assets/{gitGraphDiagram-IHSO6WYX-Dv8qb0qh.js → gitGraphDiagram-IHSO6WYX-B6Qcltd9.js} +2 -2
  89. package/dist/assets/{highlighted-body-OFNGDK62-CLUabCIi.js → highlighted-body-OFNGDK62-B_roNkgm.js} +1 -1
  90. package/dist/assets/index-B-sF8xtC.css +2 -0
  91. package/dist/assets/index-TdJi7kFM.js +2 -0
  92. package/dist/assets/info-DKCQHKI2-C0RTkygr.js +1 -0
  93. package/dist/assets/{infoDiagram-FWYZ7A6U-BnI8Gbdt.js → infoDiagram-FWYZ7A6U-CgEoZeWY.js} +1 -1
  94. package/dist/assets/infrastructure-Bcx6-8du.js +3 -0
  95. package/dist/assets/{ishikawaDiagram-FXEZZL3T-BfpmvVA0.js → ishikawaDiagram-FXEZZL3T-DvmRhm8H.js} +1 -1
  96. package/dist/assets/{journeyDiagram-5HDEW3XC-8UQvh7pY.js → journeyDiagram-5HDEW3XC-DFf6bjOX.js} +2 -2
  97. package/dist/assets/{kanban-definition-HUTT4EX6-CFX7QbbK.js → kanban-definition-HUTT4EX6-DLK5X8Ol.js} +1 -1
  98. package/dist/assets/maplibre-gl-R0DO2NBr.js +748 -0
  99. package/dist/assets/{marketplaceApi-BLyDDfGk.js → marketplaceApi-zYQofLEk.js} +1 -1
  100. package/dist/assets/mermaid-GHXKKRXX-B7uCX_yo.js +1 -0
  101. package/dist/assets/{mermaid-parser.core-qFqgm_H6.js → mermaid-parser.core-DV_Ys_OF.js} +2 -2
  102. package/dist/assets/{mermaid.core-T8rJXbMH.js → mermaid.core-D3axazyv.js} +2 -2
  103. package/dist/assets/metadata-admin-DJAg5WLs.js +22 -0
  104. package/dist/assets/{mindmap-definition-LN4V7U3C-BmcygCh7.js → mindmap-definition-LN4V7U3C-DwbonLR_.js} +1 -1
  105. package/dist/assets/packet-7NZHBO7P-DSHvkxBR.js +1 -0
  106. package/dist/assets/{pegDiagram-2B236MQR-D3IbyQE9.js → pegDiagram-2B236MQR-B4IMkAIV.js} +1 -1
  107. package/dist/assets/pie-RZYD4A2V-DjNUdL88.js +1 -0
  108. package/dist/assets/{pieDiagram-ENE6RG2P-BZteOl-k.js → pieDiagram-ENE6RG2P-D8jBhNXT.js} +1 -1
  109. package/dist/assets/plugin-calendar-BKbWgkod.js +1 -0
  110. package/dist/assets/plugin-charts-BZo5ApEF.js +7 -0
  111. package/dist/assets/plugin-chatbot-D2Uv-hn9.js +120 -0
  112. package/dist/assets/plugin-dashboard-CRFZp7gC.js +6 -0
  113. package/dist/assets/plugin-form-FeZEoC2R.js +1 -0
  114. package/dist/assets/plugin-gantt-D9YRdBGD.js +93 -0
  115. package/dist/assets/plugin-grid-eiIl2HN_.js +8 -0
  116. package/dist/assets/plugin-kanban-3rFMGC21.js +1 -0
  117. package/dist/assets/plugin-map-BHQrQ_Wu.js +1 -0
  118. package/dist/assets/{plugin-markdown-CWbusz5W.js → plugin-markdown-DesFSRDB.js} +1 -1
  119. package/dist/assets/{plugin-report-Cy6FwNfk.js → plugin-report-BKD6SOp5.js} +4 -4
  120. package/dist/assets/plugin-timeline-BrkABjqu.js +1 -0
  121. package/dist/assets/{plugin-tree-CtakCCIf.js → plugin-tree-CKck3lEJ.js} +1 -1
  122. package/dist/assets/plugin-view-BJ9uLrnO.js +1 -0
  123. package/dist/assets/plugins-views-CibWNUsP.js +4 -0
  124. package/dist/assets/{quadrantDiagram-ABIIQ3AL-DPVvulM5.js → quadrantDiagram-ABIIQ3AL-Do3adYzz.js} +1 -1
  125. package/dist/assets/radar-I7S5WNFK-qO0bWLwF.js +1 -0
  126. package/dist/assets/railroad-3IZDKUUU-CAj9esX-.js +1 -0
  127. package/dist/assets/railroad-abnf-AHOZXSZD-Ci_Yg729.js +1 -0
  128. package/dist/assets/railroad-ebnf-EBAXGLYW-Tz7H2Jrw.js +1 -0
  129. package/dist/assets/railroad-peg-LSFZ7HO6-BJIalSaK.js +1 -0
  130. package/dist/assets/{railroadDiagram-RFXS5EU6-CgLSy8wn.js → railroadDiagram-RFXS5EU6-DDA7XtKq.js} +1 -1
  131. package/dist/assets/{requirementDiagram-TGXJPOKE-DYX2pMfn.js → requirementDiagram-TGXJPOKE-CClkXauU.js} +1 -1
  132. package/dist/assets/{sankeyDiagram-HTMAVEWB-amvhkMhz.js → sankeyDiagram-HTMAVEWB-DlUFch6E.js} +1 -1
  133. package/dist/assets/{sequenceDiagram-DBY2YBRQ-CPxWMCbb.js → sequenceDiagram-DBY2YBRQ-BEDTwji4.js} +1 -1
  134. package/dist/assets/{skeletons-BK6x7CYd.js → skeletons-CzC0fiXD.js} +1 -1
  135. package/dist/assets/src-6xqJEeiC.js +15 -0
  136. package/dist/assets/{src-BPEDMjfw.js → src-BeTFx9-N.js} +1 -1
  137. package/dist/assets/{src-BvIm_4jD.js → src-CSRoqdRD.js} +1 -1
  138. package/dist/assets/{src-6rOMKMLU.js → src-D0ZYDfff.js} +1 -1
  139. package/dist/assets/{stateDiagram-2N3HPSRC-DkFPpTq2.js → stateDiagram-2N3HPSRC-BN6M4MGy.js} +1 -1
  140. package/dist/assets/stateDiagram-v2-6OUMAXLB-DCaXJLPh.js +1 -0
  141. package/dist/assets/{swimlanes-5IMT3BWC-DMPnpahc.js → swimlanes-5IMT3BWC-Bycq06w3.js} +1 -1
  142. package/dist/assets/swimlanesDiagram-G3AALYLV-DWFAvAh7.js +8 -0
  143. package/dist/assets/{timeline-definition-FHXFAJF6-DMhg5ZmV.js → timeline-definition-FHXFAJF6-B6Oiv_gP.js} +1 -1
  144. package/dist/assets/treeView-QDETBFTQ-Cc2FYETg.js +1 -0
  145. package/dist/assets/treemap-6X3UGDF4-a4EjGpO3.js +1 -0
  146. package/dist/assets/{types-X8W-qTHJ.js → types-UYoEctl-.js} +1 -1
  147. package/dist/assets/ui-components-rkvkkTxO.js +42 -0
  148. package/dist/assets/{ui-layout-BdFgfR9C.js → ui-layout-CAjjF5_S.js} +1 -1
  149. package/dist/assets/{useMetadata-DAEfn7ks.js → useMetadata-Eb5o6ihl.js} +1 -1
  150. package/dist/assets/useOpenRecordList-DIo7M1au.js +1 -0
  151. package/dist/assets/{usePackageL10n-CasuagU5.js → usePackageL10n-CiFMHfKe.js} +1 -1
  152. package/dist/assets/{useReconcileOnError-CtvIPgmD.js → useReconcileOnError-4is_Tic6.js} +1 -1
  153. package/dist/assets/{useRecordApprovals-BHkgfYJW.js → useRecordApprovals-obyIj2_8.js} +1 -1
  154. package/dist/assets/vendor-charts-D_CNNxD5.js +67 -0
  155. package/dist/assets/vendor-dndkit-CzBh0_98.js +5 -0
  156. package/dist/assets/vendor-i18n-B6GOGCem.js +1 -0
  157. package/dist/assets/{vendor-icons-core-CPQTXONm.js → vendor-icons-core-DvLgTVYc.js} +1 -1
  158. package/dist/assets/{vendor-markdown-Cbritblm.js → vendor-markdown-BJvgKhXw.js} +18 -18
  159. package/dist/assets/vendor-objectstack-Bw0HRuFa.js +95 -0
  160. package/dist/assets/vendor-radix-DCTEpigg.js +46 -0
  161. package/dist/assets/vendor-react-BGDDiZfJ.js +13 -0
  162. package/dist/assets/vendor-sentry-CHRc7_3y.js +501 -0
  163. package/dist/assets/{vendor-ui-utils-C1OpMExs.js → vendor-ui-utils-BzQBRdq3.js} +1 -1
  164. package/dist/assets/{vennDiagram-L72KCM5P-BCn9MNWT.js → vennDiagram-L72KCM5P-DqRcgOxS.js} +1 -1
  165. package/dist/assets/wardley-OPB4EBWU-CuNyH0xZ.js +1 -0
  166. package/dist/assets/{wardleyDiagram-EHGQE667-ShqmBgOZ.js → wardleyDiagram-EHGQE667-BDyIMWfB.js} +1 -1
  167. package/dist/assets/{xychartDiagram-FW5EYKEG-D1hShMP_.js → xychartDiagram-FW5EYKEG-BRNQk20I.js} +1 -1
  168. package/dist/index.html +6 -6
  169. package/package.json +1 -1
  170. package/dist/assets/ApiConsolePage-CmiLmtuU.js +0 -1
  171. package/dist/assets/AppDocsIndex-CG7e4V2y.js +0 -1
  172. package/dist/assets/AppManagementPage-C7T-9Exg.js +0 -1
  173. package/dist/assets/ApprovalsInboxPage-D9PFFxKD.js +0 -1
  174. package/dist/assets/ConsoleFloatingChatbot-CmLazUxX.js +0 -1
  175. package/dist/assets/CreateViewDialog-6JmiAMxS.js +0 -1
  176. package/dist/assets/DashboardView-Al7ce4gm.js +0 -1
  177. package/dist/assets/DashboardWidgetInspector-BmIMgSGO.js +0 -1
  178. package/dist/assets/DeveloperHubPage-D8eYekI9.js +0 -1
  179. package/dist/assets/FlowRunsPage-Hs5i7s3C.js +0 -1
  180. package/dist/assets/InterfaceListPage-JNxR3qlQ.js +0 -1
  181. package/dist/assets/MarketplaceAccessDenied-Cur1UQ0U.js +0 -1
  182. package/dist/assets/MarketplaceInstalledPage-D9ow2tlx.js +0 -1
  183. package/dist/assets/MarketplacePackagePage-0AKyKbMD.js +0 -4
  184. package/dist/assets/MarketplacePage-DUzZZa8D.js +0 -1
  185. package/dist/assets/MetadataProvider-MNkZn-bR.js +0 -1
  186. package/dist/assets/ObjectDataPage-CUJksP8e.js +0 -1
  187. package/dist/assets/PageView-AS6xg5z-.js +0 -1
  188. package/dist/assets/ProfilePage-iJeMD7FK.js +0 -1
  189. package/dist/assets/PublicFormsPage-C-wbtEXG.js +0 -1
  190. package/dist/assets/RecordDetailView-Ba0xool8.js +0 -9
  191. package/dist/assets/ReportDefaultInspector-OSqdhKEL.js +0 -11
  192. package/dist/assets/ReportView-Df7cdlQo.js +0 -2
  193. package/dist/assets/SettingsView-CSBwd4YP.js +0 -1
  194. package/dist/assets/SystemHubPage-n41ly_cC.js +0 -1
  195. package/dist/assets/architecture-TIHT7OUA-D3WxD8aQ.js +0 -1
  196. package/dist/assets/channel-MM6d7ooS.js +0 -1
  197. package/dist/assets/chunk-VAUOI2AC-Bgyec1On.js +0 -1
  198. package/dist/assets/chunk-WYO6CB5R-BBbafnWJ.js +0 -127
  199. package/dist/assets/chunk-XXDRQBXY-V26l8fww.js +0 -1
  200. package/dist/assets/classDiagram-OUVF2IWQ-BOtUpfWB.js +0 -1
  201. package/dist/assets/classDiagram-v2-EOCWNBFH-BOtUpfWB.js +0 -1
  202. package/dist/assets/cynefin-VYW2F7L2-v0nc1IZv.js +0 -1
  203. package/dist/assets/eventmodeling-45OFAUF4-CHsG6T7D.js +0 -1
  204. package/dist/assets/flowDiagram-23GEKE2U-BZtO2Jjx.js +0 -1
  205. package/dist/assets/framework-B9PMswdm.js +0 -36
  206. package/dist/assets/getIcon-DkcFniPV.js +0 -1
  207. package/dist/assets/gitGraph-TEB2WS4Q-DEB3Nljf.js +0 -1
  208. package/dist/assets/index-Oki50z-M.js +0 -2
  209. package/dist/assets/index-rbBh03NP.css +0 -2
  210. package/dist/assets/info-DKCQHKI2-BMNzABlv.js +0 -1
  211. package/dist/assets/infrastructure-BnbfcrX8.js +0 -3
  212. package/dist/assets/maplibre-gl-DGbvC0OV.js +0 -748
  213. package/dist/assets/mermaid-GHXKKRXX-Df_DEhBm.js +0 -1
  214. package/dist/assets/metadata-admin-DiOg8Tx8.js +0 -22
  215. package/dist/assets/packet-7NZHBO7P-CVEX3X_K.js +0 -1
  216. package/dist/assets/pie-RZYD4A2V-VzBvughO.js +0 -1
  217. package/dist/assets/plugin-calendar-CVeG5Hhb.js +0 -1
  218. package/dist/assets/plugin-charts-BTfOaZVx.js +0 -7
  219. package/dist/assets/plugin-chatbot-COpsZSy4.js +0 -120
  220. package/dist/assets/plugin-dashboard-Bi5WrqPG.js +0 -6
  221. package/dist/assets/plugin-form-CzotVFc-.js +0 -1
  222. package/dist/assets/plugin-gantt-BUcqVYxX.js +0 -93
  223. package/dist/assets/plugin-grid-BXfwTczT.js +0 -8
  224. package/dist/assets/plugin-kanban-Dw_QTU-e.js +0 -1
  225. package/dist/assets/plugin-map-D89OX2_H.js +0 -1
  226. package/dist/assets/plugin-timeline-BAImk_4t.js +0 -1
  227. package/dist/assets/plugin-view-DZC_ZJtv.js +0 -1
  228. package/dist/assets/plugins-views-CxFTNQJ7.js +0 -4
  229. package/dist/assets/radar-I7S5WNFK-BvMfKOT_.js +0 -1
  230. package/dist/assets/railroad-3IZDKUUU-DfKQD3PJ.js +0 -1
  231. package/dist/assets/railroad-abnf-AHOZXSZD-DVyrJPzV.js +0 -1
  232. package/dist/assets/railroad-ebnf-EBAXGLYW-Cri8VQ5d.js +0 -1
  233. package/dist/assets/railroad-peg-LSFZ7HO6-Bmvxxxt6.js +0 -1
  234. package/dist/assets/src-CCztNT-4.js +0 -15
  235. package/dist/assets/stateDiagram-v2-6OUMAXLB-C_tQckF_.js +0 -1
  236. package/dist/assets/swimlanesDiagram-G3AALYLV-BLVdl7Q4.js +0 -8
  237. package/dist/assets/treeView-QDETBFTQ-Cz0fwXom.js +0 -1
  238. package/dist/assets/treemap-6X3UGDF4-BlqJD81v.js +0 -1
  239. package/dist/assets/ui-components-DsYvPIox.js +0 -42
  240. package/dist/assets/useOpenRecordList-DL3H_OJi.js +0 -1
  241. package/dist/assets/vendor-charts-DVOdzzh2.js +0 -67
  242. package/dist/assets/vendor-dndkit-0M_nRjzm.js +0 -5
  243. package/dist/assets/vendor-i18n-sU23bKX1.js +0 -1
  244. package/dist/assets/vendor-objectstack-sPlD8LgO.js +0 -95
  245. package/dist/assets/vendor-radix-DniuRzL-.js +0 -46
  246. package/dist/assets/vendor-react-slxo-5GC.js +0 -11
  247. package/dist/assets/vendor-sentry-BnfuR4xu.js +0 -501
  248. package/dist/assets/wardley-OPB4EBWU-DdYQ8RHK.js +0 -1
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{_ as t,t as n}from"./vendor-react-slxo-5GC.js";import{L as r}from"./framework-B9PMswdm.js";import{Ba as i,Hi as a,Jr as o,Qi as s,Qn as c,Us as l,Vs as u,Ws as d,Xi as f,Xn as p,Zn as m,_s as h,ki as g,kr as _,ls as v,or as y,yo as b}from"./ui-components-DsYvPIox.js";import"./src-CCztNT-4.js";var x=e(t(),1),S=[`plugin`,`plugins`,`kind`,`package`];function C(e){return[{method:`POST`,path:`${e}/sign-in/email`,desc:`Sign in (email)`,group:`Auth`,bodyTemplate:{email:`user@example.com`,password:``}},{method:`POST`,path:`${e}/sign-up/email`,desc:`Sign up (email)`,group:`Auth`,bodyTemplate:{email:``,password:``,name:``}},{method:`POST`,path:`${e}/sign-out`,desc:`Sign out`,group:`Auth`},{method:`GET`,path:`${e}/get-session`,desc:`Get session`,group:`Auth`}]}var w={ai:{group:`AI`,defaultRoute:`/api/v1/ai`,endpoints:[{method:`POST`,path:`/chat`,desc:`Chat completion`,bodyTemplate:{messages:[{role:`user`,content:``}]}},{method:`POST`,path:`/chat/stream`,desc:`Streaming chat (SSE)`,bodyTemplate:{messages:[{role:`user`,content:``}]}},{method:`POST`,path:`/complete`,desc:`Text completion`,bodyTemplate:{prompt:``}},{method:`GET`,path:`/models`,desc:`List available models`},{method:`POST`,path:`/nlq`,desc:`Natural language query`,bodyTemplate:{query:``}},{method:`POST`,path:`/suggest`,desc:`AI-powered suggestions`,bodyTemplate:{object:``,field:``,context:{}}},{method:`POST`,path:`/insights`,desc:`AI-generated insights`,bodyTemplate:{object:``,recordIds:[]}},{method:`POST`,path:`/conversations`,desc:`Create conversation`,bodyTemplate:{}},{method:`GET`,path:`/conversations`,desc:`List conversations`},{method:`POST`,path:`/conversations/:id/messages`,desc:`Add message to conversation`,bodyTemplate:{role:`user`,content:``}},{method:`DELETE`,path:`/conversations/:id`,desc:`Delete conversation`}]},workflow:{group:`Workflow`,defaultRoute:`/api/v1/workflow`,endpoints:[{method:`GET`,path:`/:object/config`,desc:`Get workflow configuration`},{method:`GET`,path:`/:object/:recordId/state`,desc:`Get workflow state`},{method:`POST`,path:`/:object/:recordId/transition`,desc:`Execute workflow transition`,bodyTemplate:{targetState:``}},{method:`POST`,path:`/:object/:recordId/approve`,desc:`Approve workflow step`,bodyTemplate:{comment:``}},{method:`POST`,path:`/:object/:recordId/reject`,desc:`Reject workflow step`,bodyTemplate:{comment:``}}]},realtime:{group:`Realtime`,defaultRoute:`/api/v1/realtime`,endpoints:[{method:`POST`,path:`/connect`,desc:`Establish realtime connection`,bodyTemplate:{transport:`websocket`}},{method:`POST`,path:`/disconnect`,desc:`Close realtime connection`,bodyTemplate:{connectionId:``}},{method:`POST`,path:`/subscribe`,desc:`Subscribe to channel`,bodyTemplate:{channel:``}},{method:`POST`,path:`/unsubscribe`,desc:`Unsubscribe from channel`,bodyTemplate:{channel:``}},{method:`PUT`,path:`/presence/:channel`,desc:`Set presence state`,bodyTemplate:{status:`online`}},{method:`GET`,path:`/presence/:channel`,desc:`Get channel presence`}]},notification:{group:`Notifications`,defaultRoute:`/api/v1/notifications`,endpoints:[{method:`GET`,path:``,desc:`List notifications`},{method:`POST`,path:`/devices`,desc:`Register device for push`,bodyTemplate:{token:``,platform:`web`}},{method:`DELETE`,path:`/devices/:deviceId`,desc:`Unregister device`},{method:`GET`,path:`/preferences`,desc:`Get notification preferences`},{method:`PATCH`,path:`/preferences`,desc:`Update notification preferences`,bodyTemplate:{email:!0,push:!0}},{method:`POST`,path:`/read`,desc:`Mark notifications as read`,bodyTemplate:{ids:[]}},{method:`POST`,path:`/read/all`,desc:`Mark all as read`}]},analytics:{group:`Analytics`,defaultRoute:`/api/v1/analytics`,endpoints:[{method:`POST`,path:`/query`,desc:`Execute analytics query`,bodyTemplate:{measures:[],dimensions:[]}},{method:`GET`,path:`/meta`,desc:`Get analytics metadata`}]},automation:{group:`Automation`,defaultRoute:`/api/v1/automation`,endpoints:[{method:`POST`,path:`/trigger`,desc:`Trigger automation`,bodyTemplate:{name:``,params:{}}}]},i18n:{group:`i18n`,defaultRoute:`/api/v1/i18n`,endpoints:[{method:`GET`,path:`/locales`,desc:`Get available locales`},{method:`GET`,path:`/translations/:locale`,desc:`Get translations for locale`},{method:`GET`,path:`/labels/:object/:locale`,desc:`Get translated field labels`}]},ui:{group:`UI`,defaultRoute:`/api/v1/ui`,endpoints:[{method:`GET`,path:`/views`,desc:`List views`},{method:`GET`,path:`/views/:id`,desc:`Get view by ID`},{method:`POST`,path:`/views`,desc:`Create view`,bodyTemplate:{name:``,object:``,type:`list`}},{method:`PATCH`,path:`/views/:id`,desc:`Update view`,bodyTemplate:{name:``}},{method:`DELETE`,path:`/views/:id`,desc:`Delete view`}]},feed:{group:`Feed`,defaultRoute:`/api/v1/feed`,endpoints:[{method:`GET`,path:`/:object/:recordId`,desc:`Get feed items`},{method:`POST`,path:`/:object/:recordId`,desc:`Post feed item`,bodyTemplate:{body:``}}]},storage:{group:`Storage`,defaultRoute:`/api/v1/storage`,endpoints:[{method:`POST`,path:`/upload`,desc:`Upload file (multipart/form-data)`},{method:`GET`,path:`/:fileId`,desc:`Download file`},{method:`DELETE`,path:`/:fileId`,desc:`Delete file`}]}};function T(e,t){let n=w[e];return n?n.endpoints.map(e=>({method:e.method,path:`${t}${e.path}`,desc:e.desc,group:n.group,...e.bodyTemplate?{bodyTemplate:e.bodyTemplate}:{}})):[]}function ee(){let e=r(),[t,n]=(0,x.useState)([]),[i,a]=(0,x.useState)([]),[o,s]=(0,x.useState)(!0),[c,l]=(0,x.useState)(null),u=(0,x.useCallback)(async()=>{s(!0),l(null);let t=`/api/v1`,r=`${t}/discovery`,i=[{method:`GET`,path:r,desc:`API Discovery`,group:`System`},{method:`GET`,path:`${t}/meta/types`,desc:`List metadata types`,group:`Metadata`},{method:`GET`,path:`${t}/packages`,desc:`List packages`,group:`System`},{method:`GET`,path:`/api/v1/health`,desc:`Health check`,group:`System`}];try{let o=`/api/v1/auth`,s={},c={};try{let e=await fetch(r);if(e.ok){let t=await e.json(),n=t?.data??t;c=n?.routes??{},s=n?.services??{},c.auth&&(o=c.auth)}}catch{}let l=[];for(let[e,t]of Object.entries(w)){let n=s[e],r=n?.enabled??!1,i=n?.handlerReady??(n?.status===`available`||n?.status===`degraded`),a=n?.route??c[e]??t.defaultRoute;r&&i&&l.push(...T(e,a))}let u=e?.getClient?.(),d=[];try{let e=await u?.meta?.getTypes?.();e&&Array.isArray(e.types)?d=e.types:Array.isArray(e)&&(d=e)}catch{}let f=[];try{let e=d.includes(`object`)?`object`:null;if(e&&u?.meta?.getItems){let t=await u.meta.getItems(e),n=[];Array.isArray(t)?n=t:t&&Array.isArray(t.items)?n=t.items:t&&Array.isArray(t.value)&&(n=t.value),f=n.map(e=>e.name||e.id).filter(Boolean)}}catch{}let p=f.flatMap(e=>{let n=e.startsWith(`sys_`)?`Data: system tables`:`Data: ${e}`;return[{method:`GET`,path:`${t}/data/${e}`,desc:`List ${e}`,group:n},{method:`POST`,path:`${t}/data/${e}`,desc:`Create ${e}`,group:n,bodyTemplate:{name:`example`}},{method:`GET`,path:`${t}/data/${e}/:id`,desc:`Get ${e} by ID`,group:n},{method:`PATCH`,path:`${t}/data/${e}/:id`,desc:`Update ${e}`,group:n,bodyTemplate:{name:`updated`}},{method:`DELETE`,path:`${t}/data/${e}/:id`,desc:`Delete ${e}`,group:n}]}),m=d.filter(e=>!S.includes(e)).map(e=>({method:`GET`,path:`${t}/meta/${e}`,desc:`List ${e} metadata`,group:`Metadata`})),h=f.map(e=>({method:`GET`,path:`${t}/meta/object/${e}`,desc:`${e} schema`,group:`Metadata`})),g=[...i,...C(o),...l,...m,...h,...p],_=new Map;for(let e of g){let t=_.get(e.group)||[];t.push(e),_.set(e.group,t)}let v=[`System`,`Auth`,`AI`,`Workflow`,`Realtime`,`Notifications`,`Analytics`,`Automation`,`i18n`,`UI`,`Feed`,`Storage`,`Metadata`];n(Array.from(_.entries()).sort(([e],[t])=>{let n=v.indexOf(e),r=v.indexOf(t);return n!==-1&&r!==-1?n-r:n===-1?r===-1?e.localeCompare(t):1:-1}).map(([e,t])=>({key:e,label:e,endpoints:t}))),a(g)}catch(e){l(e.message||`Failed to discover APIs`)}finally{s(!1)}},[e]);return(0,x.useEffect)(()=>{u()},[u]),{groups:t,allEndpoints:i,loading:o,error:c,refresh:u}}var E=n(),D={GET:`text-emerald-600 bg-emerald-50 border-emerald-200 dark:text-emerald-400 dark:bg-emerald-950/50`,POST:`text-blue-600 bg-blue-50 border-blue-200 dark:text-blue-400 dark:bg-blue-950/50`,PATCH:`text-amber-600 bg-amber-50 border-amber-200 dark:text-amber-400 dark:bg-amber-950/50`,PUT:`text-amber-600 bg-amber-50 border-amber-200 dark:text-amber-400 dark:bg-amber-950/50`,DELETE:`text-red-600 bg-red-50 border-red-200 dark:text-red-400 dark:bg-red-950/50`},te={2:`text-emerald-600 dark:text-emerald-400`,3:`text-blue-600 dark:text-blue-400`,4:`text-amber-600 dark:text-amber-400`,5:`text-red-600 dark:text-red-400`},ne=[{key:`$top`,placeholder:`10`,hint:`limit`},{key:`$skip`,placeholder:`0`,hint:`offset`},{key:`$sort`,placeholder:`name`,hint:`sort field`},{key:`$select`,placeholder:`name,email`,hint:`fields`},{key:`$count`,placeholder:`true`,hint:`total count`},{key:`$filter`,placeholder:`status eq 'active'`,hint:`OData filter`}],O=1;function k(){let e=r()?.getClient?.(),{groups:t,loading:n,refresh:S}=ee(),[C,w]=(0,x.useState)(``),[T,k]=(0,x.useState)(new Set),[A,j]=(0,x.useState)(null),[re,M]=(0,x.useState)(``),[ie,N]=(0,x.useState)(``),[P,F]=(0,x.useState)(``),[I,L]=(0,x.useState)([]),[R,z]=(0,x.useState)(!1),[B,V]=(0,x.useState)(null),[H,U]=(0,x.useState)([]),[W,ae]=(0,x.useState)(null),[G,K]=(0,x.useState)(!1),q=(0,x.useMemo)(()=>{if(!C)return t;let e=C.toLowerCase();return t.map(t=>({...t,endpoints:t.endpoints.filter(t=>t.desc.toLowerCase().includes(e)||t.path.toLowerCase().includes(e)||t.method.toLowerCase().includes(e))})).filter(e=>e.endpoints.length>0)},[t,C]),oe=(0,x.useCallback)(e=>{k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),se=(0,x.useCallback)(e=>{j(e),M(e.method),N(e.path),F(e.bodyTemplate?JSON.stringify(e.bodyTemplate,null,2):``),L([]),V(null)},[]),J=re||A?.method||`GET`,Y=ie||A?.path||``,X=(0,x.useMemo)(()=>{let e=I.filter(e=>e.enabled&&e.key.trim());return e.length===0?Y:`${Y}?${e.map(e=>`${encodeURIComponent(e.key)}=${encodeURIComponent(e.value)}`).join(`&`)}`},[Y,I]),Z=(0,x.useCallback)((e=``,t=``)=>{L(n=>[...n,{id:O++,key:e,value:t,enabled:!0}])},[]),ce=(0,x.useCallback)(e=>{L(t=>t.filter(t=>t.id!==e))},[]),Q=(0,x.useCallback)((e,t,n)=>{L(r=>r.map(r=>r.id===e?{...r,[t]:n}:r))},[]),le=(0,x.useCallback)(e=>{L(t=>t.map(t=>t.id===e?{...t,enabled:!t.enabled}:t))},[]),$=(0,x.useCallback)(async()=>{if(R||!X)return;let t=`${e?.baseUrl??``}${X}`;z(!0);let n=performance.now();try{let e={method:J,headers:{"Content-Type":`application/json`}};[`POST`,`PATCH`,`PUT`].includes(J)&&P.trim()&&(e.body=P);let r=await fetch(t,e),i=Math.round(performance.now()-n),a;if((r.headers.get(`content-type`)??``).includes(`json`)){let e=await r.json();a=JSON.stringify(e,null,2)}else a=await r.text();V({status:r.status,body:a,duration:i}),U(e=>[{id:Date.now(),method:J,url:X,body:P||void 0,status:r.status,duration:i,response:a,timestamp:new Date},...e].slice(0,50))}catch(e){let t=Math.round(performance.now()-n);V({status:0,body:`Network Error: ${e.message}`,duration:t})}finally{z(!1)}},[e,X,J,P,R]),ue=(0,x.useCallback)(e=>{M(e.method);let[t,n]=e.url.split(`?`);if(N(t),F(e.body||``),n){let e=new URLSearchParams(n),t=[];e.forEach((e,n)=>{t.push({id:O++,key:n,value:e,enabled:!0})}),L(t)}else L([]);V(null),j(null)},[]),de=(0,x.useCallback)(()=>{B?.body&&(navigator.clipboard.writeText(B.body),K(!0),setTimeout(()=>K(!1),1500))},[B]),fe=e=>te[String(e)[0]]??`text-muted-foreground`;return(0,E.jsxs)(`div`,{className:`flex flex-1 min-h-0 overflow-hidden`,children:[(0,E.jsxs)(`div`,{className:`w-72 shrink-0 border-r flex flex-col overflow-hidden`,children:[(0,E.jsxs)(`div`,{className:`p-3 border-b space-y-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`h3`,{className:`text-sm font-semibold text-foreground flex-1`,children:`API Endpoints`}),(0,E.jsx)(`button`,{onClick:S,disabled:n,className:`p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground`,title:`Refresh endpoints`,children:(0,E.jsx)(a,{className:`h-3.5 w-3.5 ${n?`animate-spin`:``}`})})]}),(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(g,{className:`absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,E.jsx)(`input`,{type:`text`,value:C,onChange:e=>w(e.target.value),placeholder:`Search endpoints...`,className:`w-full rounded-md border bg-background pl-8 pr-3 py-1.5 text-sm focus:outline-none focus:ring-1 focus:ring-ring`})]})]}),(0,E.jsx)(`div`,{className:`flex-1 overflow-auto p-2 space-y-1`,children:n?(0,E.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,E.jsx)(i,{className:`h-4 w-4 animate-spin mr-2`}),`Discovering APIs...`]}):q.length===0?(0,E.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,E.jsx)(b,{className:`h-6 w-6 opacity-30 mb-2`}),(0,E.jsx)(`span`,{children:C?`No matching endpoints`:`No endpoints found`})]}):q.map(e=>{let t=T.has(e.key)||!!C;return(0,E.jsxs)(p,{open:t,onOpenChange:()=>oe(e.key),children:[(0,E.jsx)(c,{asChild:!0,children:(0,E.jsxs)(`button`,{className:`w-full flex items-center gap-1.5 px-2 py-1.5 rounded-md text-xs font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground transition-colors`,children:[(0,E.jsx)(u,{className:`h-3 w-3 shrink-0 transition-transform duration-200 ${t?`rotate-90`:``}`}),(0,E.jsx)(`span`,{className:`flex-1 text-left truncate`,children:e.label}),(0,E.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums opacity-60`,children:e.endpoints.length})]})}),(0,E.jsx)(m,{children:(0,E.jsx)(`div`,{className:`ml-3 space-y-0.5 mt-0.5`,children:e.endpoints.map((e,t)=>(0,E.jsxs)(`button`,{onClick:()=>se(e),className:`w-full text-left flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors ${A===e?`bg-accent text-accent-foreground`:`hover:bg-muted/50 text-muted-foreground hover:text-foreground`}`,children:[(0,E.jsx)(y,{variant:`outline`,className:`font-mono text-[9px] shrink-0 px-1 py-0 ${D[e.method]||``}`,children:e.method}),(0,E.jsx)(`span`,{className:`truncate`,children:e.desc})]},`${e.method}-${e.path}-${t}`))})})]},e.key)})}),(0,E.jsxs)(`div`,{className:`p-3 border-t space-y-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,E.jsx)(`h4`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:`Query Parameters`}),(0,E.jsxs)(`button`,{onClick:()=>Z(),className:`inline-flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,E.jsx)(f,{className:`h-3 w-3`}),`Add`]})]}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:ne.map(e=>(0,E.jsx)(`button`,{onClick:()=>Z(e.key,``),className:`text-[10px] px-1.5 py-0.5 rounded border bg-muted/30 text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors font-mono`,title:e.hint,children:e.key},e.key))}),I.length>0&&(0,E.jsx)(`div`,{className:`space-y-1`,children:I.map(e=>(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,E.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:()=>le(e.id),className:`h-3 w-3 shrink-0 rounded border accent-primary`}),(0,E.jsx)(`input`,{type:`text`,value:e.key,onChange:t=>Q(e.id,`key`,t.target.value),placeholder:`key`,className:`flex-1 min-w-0 rounded border bg-background px-1.5 py-0.5 text-[10px] font-mono focus:outline-none focus:ring-1 focus:ring-ring`}),(0,E.jsx)(`input`,{type:`text`,value:e.value,onChange:t=>Q(e.id,`value`,t.target.value),placeholder:`value`,className:`flex-1 min-w-0 rounded border bg-background px-1.5 py-0.5 text-[10px] font-mono focus:outline-none focus:ring-1 focus:ring-ring`}),(0,E.jsx)(`button`,{onClick:()=>ce(e.id),className:`shrink-0 p-0.5 rounded text-muted-foreground hover:text-destructive transition-colors`,children:(0,E.jsx)(_,{className:`h-3 w-3`})})]},e.id))})]})]}),(0,E.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:[(0,E.jsxs)(`div`,{className:`p-3 border-b space-y-1`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`select`,{value:J,onChange:e=>M(e.target.value),className:`rounded-md border bg-background px-2 py-1.5 font-mono text-xs font-semibold focus:outline-none focus:ring-1 focus:ring-ring ${D[J]||``}`,children:[`GET`,`POST`,`PATCH`,`PUT`,`DELETE`].map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))}),(0,E.jsx)(`input`,{type:`text`,value:Y,onChange:e=>N(e.target.value),className:`flex-1 rounded-md border bg-background px-3 py-1.5 font-mono text-sm focus:outline-none focus:ring-1 focus:ring-ring`,placeholder:`/api/v1/...`,onKeyDown:e=>{e.key===`Enter`&&$()}}),(0,E.jsxs)(`button`,{onClick:$,disabled:R||!X,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-1.5 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors`,children:[R?(0,E.jsx)(i,{className:`h-3.5 w-3.5 animate-spin`}):(0,E.jsx)(s,{className:`h-3.5 w-3.5`}),`Send`]})]}),I.some(e=>e.enabled&&e.key.trim())&&(0,E.jsxs)(`div`,{className:`text-[10px] font-mono text-muted-foreground truncate pl-1`,children:[`→ `,X]})]}),(0,E.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 overflow-auto`,children:[[`POST`,`PATCH`,`PUT`].includes(J)&&(0,E.jsxs)(`div`,{className:`p-3 border-b space-y-1`,children:[(0,E.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Request Body (JSON)`}),(0,E.jsx)(`textarea`,{value:P,onChange:e=>F(e.target.value),rows:5,className:`w-full rounded-md border bg-background px-3 py-2 font-mono text-xs focus:outline-none focus:ring-1 focus:ring-ring resize-y`,placeholder:`{ "key": "value" }`})]}),R&&(0,E.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,E.jsx)(i,{className:`h-4 w-4 animate-spin mr-2`}),`Sending request...`]}),B&&!R&&(0,E.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col overflow-hidden`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 bg-muted/30 border-b`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,E.jsx)(`span`,{className:`font-mono font-semibold ${fe(B.status)}`,children:B.status||`ERR`}),(0,E.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,E.jsx)(h,{className:`h-3 w-3`}),B.duration,`ms`]})]}),(0,E.jsxs)(`button`,{onClick:de,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[G?(0,E.jsx)(d,{className:`h-3 w-3`}):(0,E.jsx)(v,{className:`h-3 w-3`}),G?`Copied`:`Copy`]})]}),(0,E.jsx)(`pre`,{className:`flex-1 overflow-auto p-3 text-xs font-mono bg-muted/10 whitespace-pre-wrap break-all`,children:B.body})]}),!B&&!R&&(0,E.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground text-sm`,children:(0,E.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,E.jsx)(b,{className:`h-10 w-10 mx-auto opacity-20`}),(0,E.jsxs)(`p`,{children:[`Select an endpoint or type a URL and click `,(0,E.jsx)(`strong`,{children:`Send`})]}),(0,E.jsx)(`p`,{className:`text-xs opacity-60`,children:`All registered APIs are auto-discovered from the platform`})]})}),H.length>0&&(0,E.jsxs)(`div`,{className:`border-t`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2`,children:[(0,E.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:[`History (`,H.length,`)`]}),(0,E.jsxs)(`button`,{onClick:()=>U([]),className:`inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,E.jsx)(o,{className:`h-3 w-3`}),`Clear`]})]}),(0,E.jsx)(`div`,{className:`space-y-0.5 px-2 pb-2 max-h-60 overflow-auto`,children:H.map(e=>(0,E.jsxs)(`div`,{className:`rounded border`,children:[(0,E.jsxs)(`button`,{onClick:()=>ae(W===e.id?null:e.id),className:`w-full flex items-center gap-2 px-2 py-1.5 text-xs hover:bg-muted/30 transition-colors`,children:[W===e.id?(0,E.jsx)(l,{className:`h-3 w-3 shrink-0`}):(0,E.jsx)(u,{className:`h-3 w-3 shrink-0`}),(0,E.jsx)(y,{variant:`outline`,className:`font-mono text-[9px] shrink-0 ${D[e.method]||``}`,children:e.method}),(0,E.jsx)(`span`,{className:`font-mono truncate text-left flex-1`,children:e.url}),(0,E.jsx)(`span`,{className:`ml-auto shrink-0 font-mono ${fe(e.status)}`,children:e.status}),(0,E.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[e.duration,`ms`]}),(0,E.jsx)(`button`,{onClick:t=>{t.stopPropagation(),ue(e)},className:`shrink-0 p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,title:`Replay request`,children:(0,E.jsx)(s,{className:`h-2.5 w-2.5`})})]}),W===e.id&&(0,E.jsx)(`pre`,{className:`px-3 py-2 text-xs font-mono bg-muted/10 border-t overflow-auto max-h-40 whitespace-pre-wrap break-all`,children:e.response})]},e.id))})]})]})]})]})}export{k as ApiConsolePage};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{_ as t,a as n,f as r,r as i,t as a}from"./vendor-react-slxo-5GC.js";import{Ba as o,dc as s}from"./ui-components-DsYvPIox.js";import{a as c,i as l,n as u,r as d}from"./index-Oki50z-M.js";var f=e(t(),1),p=a();function m(){let{appName:e}=r(),{books:t,docs:a,state:m}=u(),h=(0,f.useMemo)(()=>t.filter(t=>l(t)===e),[t,e]),g=(0,f.useMemo)(()=>d(h,a),[h,a]);return m===`loading`?(0,p.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,p.jsx)(o,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})}):g.length===1?(0,p.jsx)(n,{to:`/apps/${e}/docs/${g[0].slug}`,replace:!0}):(0,p.jsx)(c,{children:(0,p.jsx)(`div`,{className:`mx-auto max-w-3xl p-4 sm:p-6`,children:g.length===0?(0,p.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-16 text-center text-muted-foreground`,children:[(0,p.jsx)(s,{className:`h-10 w-10`}),(0,p.jsx)(`p`,{className:`text-sm`,children:`This app does not ship any documentation yet.`}),(0,p.jsx)(i,{to:`/docs`,className:`text-sm font-medium text-primary hover:underline`,children:`Browse all documentation`})]}):(0,p.jsx)(`ul`,{className:`grid gap-3 sm:grid-cols-2`,children:g.map(t=>(0,p.jsx)(`li`,{children:(0,p.jsxs)(i,{to:`/apps/${e}/docs/${t.slug}`,className:`flex h-full items-start gap-3 rounded-md border border-border p-3 hover:bg-muted/50`,children:[(0,p.jsx)(s,{className:`mt-0.5 h-5 w-5 shrink-0 text-muted-foreground`}),(0,p.jsxs)(`div`,{className:`min-w-0`,children:[(0,p.jsx)(`div`,{className:`text-sm font-semibold`,children:t.label}),t.description?(0,p.jsx)(`div`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:t.description}):t.subtitle?(0,p.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-muted-foreground/70`,children:t.subtitle}):null,(0,p.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground/80`,children:[t.docCount,` `,t.docCount===1?`article`:`articles`]})]})]})},t.name))})})})}export{m as default};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{_ as t,f as n,t as r,u as i}from"./vendor-react-slxo-5GC.js";import{R as a}from"./framework-B9PMswdm.js";import{$n as o,Jr as s,Sr as c,Xa as l,Xi as u,Xr as d,Yo as f,Yr as p,cn as m,er as h,gi as g,ki as _,li as v,or as y,ra as b,tr as x}from"./ui-components-DsYvPIox.js";import{r as S}from"./vendor-ui-utils-C1OpMExs.js";import"./src-CCztNT-4.js";var C=e(t(),1);function w(e,t){if(e!=null){if(typeof e==`string`)return e;if(t){let n=t(e.key,{defaultValue:e.defaultValue,...e.params});if(n&&n!==e.key)return n}return e.defaultValue||e.key}}var T=r();function E(){let e=i(),{appName:t}=n(),r=t?`/apps/${t}`:``,{apps:E,refresh:D}=a(),[O,k]=(0,C.useState)(``),[A,j]=(0,C.useState)(new Set),[M,N]=(0,C.useState)(null),[P,F]=(0,C.useState)(!1),I=(E||[]).filter(e=>{if(!O)return!0;let t=O.toLowerCase();return(e.name||``).toLowerCase().includes(t)||(e.label||``).toLowerCase().includes(t)||(e.description||``).toLowerCase().includes(t)}),L=(0,C.useCallback)(e=>{j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),R=(0,C.useCallback)(()=>{A.size===I.length?j(new Set):j(new Set(I.map(e=>e.name)))},[A.size,I]),z=(0,C.useCallback)(async e=>{F(!0);try{let t=e.active===!1;S.success(`${e.label||e.name} ${t?`enabled`:`disabled`}`),await D()}catch{S.error(`Failed to toggle app status`)}finally{F(!1)}},[D]),B=(0,C.useCallback)(async e=>{F(!0);try{S.success(`${e.label||e.name} set as default`),await D()}catch{S.error(`Failed to set default app`)}finally{F(!1)}},[D]),V=(0,C.useCallback)(async e=>{if(M!==e.name){N(e.name);return}F(!0);try{S.success(`${e.label||e.name} deleted`),N(null),await D()}catch{S.error(`Failed to delete app`)}finally{F(!1)}},[M,D]),H=(0,C.useCallback)(async e=>{F(!0);try{S.success(`${A.size} apps ${e?`enabled`:`disabled`}`),j(new Set),await D()}catch{S.error(`Bulk operation failed`)}finally{F(!1)}},[A,D]);return(0,T.jsxs)(`div`,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,T.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`Applications`}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Manage all configured applications`})]}),(0,T.jsxs)(c,{onClick:()=>e(`${r}/create-app`),"data-testid":`create-app-btn`,children:[(0,T.jsx)(u,{className:`h-4 w-4 mr-2`}),`New App`]})]}),(0,T.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[(0,T.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,T.jsx)(`label`,{htmlFor:`app-search`,className:`sr-only`,children:`Search apps`}),(0,T.jsx)(_,{className:`pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`,"aria-hidden":`true`}),(0,T.jsx)(m,{id:`app-search`,placeholder:`Search apps...`,value:O,onChange:e=>k(e.target.value),className:`pl-8`,"data-testid":`app-search-input`})]}),A.size>0&&(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(y,{variant:`secondary`,children:[A.size,` selected`]}),(0,T.jsx)(c,{variant:`outline`,size:`sm`,onClick:()=>H(!0),disabled:P,children:`Enable`}),(0,T.jsx)(c,{variant:`outline`,size:`sm`,onClick:()=>H(!1),disabled:P,children:`Disable`})]})]}),I.length>0&&(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,T.jsx)(o,{id:`select-all-apps`,checked:A.size===I.length&&I.length>0,onCheckedChange:()=>R()}),(0,T.jsxs)(`label`,{htmlFor:`select-all-apps`,className:`cursor-pointer`,children:[`Select all (`,I.length,`)`]})]}),I.length===0?(0,T.jsxs)(`div`,{className:`text-center py-12 text-muted-foreground`,"data-testid":`no-apps-message`,children:[(0,T.jsx)(l,{className:`h-12 w-12 mx-auto mb-3 opacity-30`}),(0,T.jsx)(`p`,{children:`No apps found.`})]}):(0,T.jsx)(`div`,{className:`grid gap-3`,children:I.map(t=>{let n=t.active!==!1,i=t.isDefault===!0,a=M===t.name;return(0,T.jsx)(h,{className:n?``:`opacity-60`,"data-testid":`app-card-${t.name}`,children:(0,T.jsxs)(x,{className:`flex items-center gap-3 py-3 px-4`,children:[(0,T.jsx)(o,{id:`select-app-${t.name}`,checked:A.has(t.name),onCheckedChange:()=>L(t.name),"aria-label":`Select ${t.label||t.name}`,className:`shrink-0`}),(0,T.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,T.jsx)(l,{className:`h-4 w-4`})}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`font-medium truncate`,children:w(t.label)||t.name}),i&&(0,T.jsx)(y,{variant:`default`,className:`text-xs`,children:`Default`}),(0,T.jsx)(y,{variant:n?`secondary`:`outline`,className:`text-xs`,children:n?`Active`:`Inactive`})]}),t.description&&(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:w(t.description)})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,T.jsx)(c,{variant:`ghost`,size:`icon`,title:`Open app`,"aria-label":`Open ${t.label||t.name}`,onClick:()=>e(`/apps/${t._packageId??t.name}`),children:(0,T.jsx)(f,{className:`h-4 w-4`})}),(0,T.jsx)(c,{variant:`ghost`,size:`icon`,title:`Edit app`,"aria-label":`Edit ${t.label||t.name}`,onClick:()=>e(`${r}/edit-app/${t.name}`),children:(0,T.jsx)(b,{className:`h-4 w-4`})}),t._packageId?(0,T.jsx)(c,{variant:`ghost`,size:`icon`,title:`Edit with AI`,"aria-label":`Edit ${t.label||t.name} with AI`,onClick:()=>e(`/ai/build?package=${encodeURIComponent(t._packageId)}&new=1`),children:(0,T.jsx)(g,{className:`h-4 w-4`})}):null,(0,T.jsx)(c,{variant:`ghost`,size:`icon`,title:n?`Disable app`:`Enable app`,"aria-label":n?`Disable ${t.label||t.name}`:`Enable ${t.label||t.name}`,onClick:()=>z(t),disabled:P,children:n?(0,T.jsx)(p,{className:`h-4 w-4`}):(0,T.jsx)(d,{className:`h-4 w-4`})}),(0,T.jsx)(c,{variant:`ghost`,size:`icon`,title:`Set as default`,"aria-label":`Set ${t.label||t.name} as default`,onClick:()=>B(t),disabled:P||i,children:(0,T.jsx)(v,{className:`h-4 w-4 ${i?`fill-current text-yellow-500`:``}`})}),(0,T.jsx)(c,{variant:`ghost`,size:`icon`,title:a?`Click again to confirm delete`:`Delete app`,"aria-label":a?`Confirm delete ${t.label||t.name}`:`Delete ${t.label||t.name}`,onClick:()=>V(t),disabled:P,className:a?`text-destructive`:``,children:(0,T.jsx)(s,{className:`h-4 w-4`})})]})]})},t.name)})})]})}export{E as AppManagementPage};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{_ as t,f as n,r,t as i}from"./vendor-react-slxo-5GC.js";import{d as a,f as ee}from"./infrastructure-BnbfcrX8.js";import{l as te}from"./framework-B9PMswdm.js";import{$n as ne,Ac as o,Bt as re,Cc as ie,Cs as ae,Ds as oe,Fs as se,G as ce,Gt as le,Hi as ue,Hs as de,Ht as fe,J as pe,Jt as s,Kt as me,Ms as he,Oi as ge,Rr as _e,Rt as c,Sr as l,Ur as ve,Ut as ye,Vs as be,Vt as xe,W as Se,Ws as Ce,Wt as we,Xt as Te,Yo as Ee,Yt as De,_r as u,_s as Oe,_t as ke,br as d,cn as Ae,ct as je,dr as Me,dt as Ne,er as Pe,fn as Fe,ft as Ie,gr as f,gt as Le,hr as p,ht as m,ki as Re,kr as ze,ls as Be,lt as Ve,mc as He,mi as Ue,mr as h,mt as g,or as We,os as Ge,pr as _,pt as Ke,qt as qe,st as Je,tr as Ye,ur as Xe,ut as Ze,vr as v,xr as Qe,yr as y}from"./ui-components-DsYvPIox.js";import{r as b}from"./vendor-ui-utils-C1OpMExs.js";var x=e(t(),1),$e=`${``.replace(/\/$/,``)}/api/v1`;async function S(e,t){let n=await fetch(`${$e}${e}`,{credentials:`include`,headers:{"Content-Type":`application/json`,...t?.headers||{}},...t}),r=null;try{r=await n.json()}catch{}if(!n.ok){let e=r?.code??`HTTP_${n.status}`,t=r?.message??r?.error??n.statusText,i=Error(`${e}: ${t}`);throw i.code=e,i.status=n.status,i.details=r,i}return r}var C={listProcesses(e={}){let t=new URLSearchParams;e.object&&t.set(`object`,e.object),e.activeOnly&&t.set(`activeOnly`,`true`);let n=t.toString();return S(`/approvals/processes${n?`?${n}`:``}`)},listRequests(e={}){let t=new URLSearchParams;e.status&&t.set(`status`,e.status),e.object&&t.set(`object`,e.object),e.recordId&&t.set(`recordId`,e.recordId);let n=Array.isArray(e.approverId)?e.approverId.filter(Boolean).join(`,`):e.approverId;n&&t.set(`approverId`,n),e.submitterId&&t.set(`submitterId`,e.submitterId),e.q?.trim()&&t.set(`q`,e.q.trim()),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let r=t.toString();return S(`/approvals/requests${r?`?${r}`:``}`)},async getRequest(e){return{data:await S(`/approvals/requests/${encodeURIComponent(e)}`)}},listActions(e){return S(`/approvals/requests/${encodeURIComponent(e)}/actions`)},async approve(e,t){let n=await S(`/approvals/requests/${encodeURIComponent(e)}/approve`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,finalized:n.finalized}},async reject(e,t){let n=await S(`/approvals/requests/${encodeURIComponent(e)}/reject`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,finalized:n.finalized}},async recall(e,t){return{data:(await S(`/approvals/requests/${encodeURIComponent(e)}/recall`,{method:`POST`,body:JSON.stringify(t)})).request,finalized:!0}},async reassign(e,t){return{data:(await S(`/approvals/requests/${encodeURIComponent(e)}/reassign`,{method:`POST`,body:JSON.stringify(t)})).request}},async remind(e,t={}){let n=await S(`/approvals/requests/${encodeURIComponent(e)}/remind`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,notified:n.notified}},async requestInfo(e,t){return{data:(await S(`/approvals/requests/${encodeURIComponent(e)}/request-info`,{method:`POST`,body:JSON.stringify(t)})).request}},async sendBack(e,t){let n=await S(`/approvals/requests/${encodeURIComponent(e)}/revise`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,autoRejected:n.autoRejected===!0}},async resubmit(e,t={}){let n=await S(`/approvals/requests/${encodeURIComponent(e)}/resubmit`,{method:`POST`,body:JSON.stringify(t)});return{data:n.request,resumed:n.resumed===!0}},async comment(e,t){return{data:(await S(`/approvals/requests/${encodeURIComponent(e)}/comment`,{method:`POST`,body:JSON.stringify(t)})).request}},async submit(e){return S(`/approvals/requests`,{method:`POST`,body:JSON.stringify(e)})}};function et(e){if(!e)return[];let t=new Set;e.id&&t.add(e.id),e.email&&t.add(e.email);let n=[...e.roles||[],...typeof e.role==`string`?e.role.split(`,`):[]];for(let e of n){let n=String(e).trim();n&&t.add(`role:${n}`)}return Array.from(t)}var w=i(),tt=50,nt={pending:`border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-400`,approved:`border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-400`,rejected:`border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-400`,recalled:`border-border bg-muted text-muted-foreground`,returned:`border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-400`};function rt(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function T(e){return e?e.includes(`@`)?e:e.startsWith(`role:`)?`Role: ${e.slice(5)}`:e.length>14?`${e.slice(0,6)}…${e.slice(-4)}`:e:`—`}function E(e){return e&&String(e).replace(/^flow:/,``).trim().split(/[_\-\s]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)||`—`}function it(e){return e.process_label||E(e.process_name)}function at(e){return e.step_label?e.step_label:e.current_step?E(e.current_step):null}function ot(e){return e.submitter_name||T(e.submitter_id)}function st(e,t){return t.pending_approver_names?.[e]||T(e)}function ct(e){return e.object_label||e.object_name}function D(e){return e.submitted_at||e.created_at||void 0}function O(e){let t=D(e);if(!t)return null;let n=Date.parse(t);return Number.isNaN(n)?null:(Date.now()-n)/36e5}function lt(e){if(e.status!==`pending`)return`text-muted-foreground`;let t=O(e);return t==null?`text-muted-foreground`:t>72?`text-red-600 dark:text-red-400 font-medium`:t>24?`text-amber-600 dark:text-amber-400`:`text-muted-foreground`}function ut(e){let t=Math.max(1,Math.round(Math.abs(e)/36e5));return t<48?`${t}h`:`${Math.round(t/24)}d`}var k=new Set([`id`,`created_at`,`updated_at`,`created_by`,`updated_by`,`organization_id`]);function A(e){return e.split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function j(e,t){if(typeof t==`boolean`)return t?`✓`:`—`;if(typeof t==`number`){if(t>0xe8d4a51000&&/(_at$|_date$|^date_|_time$)/.test(e))try{return new Date(t).toLocaleDateString()}catch{}return t.toLocaleString()}let n=String(t);if(/^\d{4}-\d{2}-\d{2}T\d{2}/.test(n))try{return new Date(n).toLocaleString()}catch{}return n}var dt=/^[A-Za-z0-9_-]{15,}$/;function ft(e,t,n=6){if(!e||typeof e!=`object`||Array.isArray(e))return[];let r=[];for(let[i,a]of Object.entries(e)){if(k.has(i)||a==null||typeof a==`object`||String(a).trim()===``)continue;let e=t?.[i];if(!(!e&&typeof a==`string`&&dt.test(a.trim())&&!/^\d+$/.test(a.trim()))&&(r.push([A(i),e??j(i,a)]),r.length>=n))break}return r}function pt(){let{t:e,language:t}=te(),{user:i}=ee(),$e=a(),{appName:S}=n(),E=(0,x.useMemo)(()=>et(i),[i]),O=(0,x.useCallback)((t,n,r)=>String(e(`approvalsInbox.${t}`,{defaultValue:n,...r})),[e]),k=(0,x.useCallback)(e=>{if(!e)return`—`;let n=Date.parse(e);if(Number.isNaN(n))return e;let r=Math.round((Date.now()-n)/1e3);if(r<45)return O(`justNow`,`just now`);let i=Math.round(r/60);if(i<60)return O(`minutesAgo`,`{{count}}m ago`,{count:i});let a=Math.round(i/60);if(a<24)return O(`hoursAgo`,`{{count}}h ago`,{count:a});let ee=Math.round(a/24);if(ee<30)return O(`daysAgo`,`{{count}}d ago`,{count:ee});try{return new Date(e).toLocaleDateString(t)}catch{return e}},[O,t]),A=(0,x.useCallback)(e=>{switch(e){case`pending`:return O(`statusPending`,`Pending`);case`approved`:return O(`statusApproved`,`Approved`);case`rejected`:return O(`statusRejected`,`Rejected`);case`recalled`:return O(`statusRecalled`,`Recalled`);case`returned`:return O(`statusReturned`,`Returned for revision`);default:return e}},[O]),j=(0,x.useCallback)((e,t)=>{let n=e?.code??``,r=e?.status??0;return n===`NOT_IMPLEMENTED`||r===501?O(`recallUnavailable`,`Recall is not available on this deployment.`):n===`THROTTLED`||r===429?O(`remindThrottled`,`A reminder was sent recently — try again later.`):r===404?O(`requestGone`,`This request no longer exists. Refresh the list.`):n===`FORBIDDEN`||r===403?O(`notAllowed`,`You are not allowed to perform this action.`):n===`INVALID_STATE`||r===409?O(`alreadyDecided`,`This request was already decided. Refresh the list.`):e?.message||t},[O]);function dt({status:e}){return(0,w.jsx)(We,{variant:`outline`,className:o(`font-medium`,nt[e]??``),children:A(e)})}let pt=(0,x.useCallback)(e=>`/apps/${S||`setup`}/${encodeURIComponent(e.object_name)}/record/${encodeURIComponent(e.record_id)}`,[S]),[M,mt]=(0,x.useState)(`pending`),[N,ht]=(0,x.useState)([]),[gt,_t]=(0,x.useState)(!1),[vt,yt]=(0,x.useState)(!1),[bt,xt]=(0,x.useState)(null),[St,Ct]=(0,x.useState)(null),[wt,Tt]=(0,x.useState)(0),[P,Et]=(0,x.useState)(null),[F,Dt]=(0,x.useState)(null),[Ot,kt]=(0,x.useState)([]),[At,jt]=(0,x.useState)(!1),[I,L]=(0,x.useState)(``),[R,Mt]=(0,x.useState)(``),[z,Nt]=(0,x.useState)(null),[B,Pt]=(0,x.useState)(``),[Ft,It]=(0,x.useState)(``),[Lt,Rt]=(0,x.useState)(`all`),[zt,Bt]=(0,x.useState)(`all`),[V,Vt]=(0,x.useState)(`all`),[H,Ht]=(0,x.useState)(new Set),[Ut,Wt]=(0,x.useState)(!1),[U,Gt]=(0,x.useState)(null),[Kt,qt]=(0,x.useState)(null),[Jt,Yt]=(0,x.useState)(!1),[Xt,Zt]=(0,x.useState)(``),[Qt,$t]=(0,x.useState)(!1),[en,tn]=(0,x.useState)(``),[nn,rn]=(0,x.useState)(!1),[an,on]=(0,x.useState)(``),[sn,cn]=(0,x.useState)(!1),[ln,un]=(0,x.useState)(``),[W,G]=(0,x.useState)(!1),[dn,fn]=(0,x.useState)([]),[pn,mn]=(0,x.useState)(-1);(0,x.useEffect)(()=>{if(M===`pending`)return;let e=window.setTimeout(()=>It(B),350);return()=>window.clearTimeout(e)},[B,M]);let K=(0,x.useCallback)(async()=>{_t(!0),Ct(null);try{let e=[];if(M===`pending`)e=E.length?(await C.listRequests({status:`pending`,approverId:E})).data:[],Tt(e.length),xt(null);else{let t={q:Ft||void 0,status:V===`all`?void 0:V,limit:tt,offset:0};if(M===`submitted`){let n=i?.id;if(n){let r=await C.listRequests({submitterId:n,...t});e=r.data,xt(r.total??r.data.length)}else e=[],xt(0)}else{let n=await C.listRequests(t);e=n.data,xt(n.total??n.data.length)}E.length&&C.listRequests({status:`pending`,approverId:E}).then(e=>Tt(e.data.length)).catch(()=>{})}e.sort((e,t)=>(D(t)||``).localeCompare(D(e)||``)),ht(e)}catch(e){Ct(e?.message||String(e)),ht([])}finally{_t(!1)}},[M,E,i?.id,Ft,V]);(0,x.useEffect)(()=>{K()},[K]);let hn=(0,x.useCallback)(async()=>{if(!(M===`pending`||vt)){yt(!0);try{let e=await C.listRequests({submitterId:M===`submitted`?i?.id??void 0:void 0,q:Ft||void 0,status:V===`all`?void 0:V,limit:tt,offset:N.length});ht(t=>{let n=new Set(t.map(e=>e.id));return[...t,...e.data.filter(e=>!n.has(e.id))]}),e.total!=null&&xt(e.total)}catch(e){b.error(j(e,O(`loadFailed`,`Failed to load request`)))}finally{yt(!1)}}},[M,vt,i?.id,Ft,V,N.length,j,O]),q=(0,x.useCallback)(async e=>{Et(e),jt(!0),L(``),Mt(``);try{let[t,n]=await Promise.all([C.getRequest(e),C.listActions(e)]);Dt(t.data),kt(n.data)}catch(e){b.error(j(e,O(`loadFailed`,`Failed to load request`))),Dt(null),kt([])}finally{jt(!1)}},[j,O]),gn=()=>{Et(null),Dt(null),kt([]),L(``),Mt(``)},J=(0,x.useCallback)(e=>{if(R.trim())return R.trim();if(!e)return i?.id||``;let t=new Set(e.pending_approvers||[]);for(let e of E)if(t.has(e))return e;return i?.id||``},[R,E,i?.id]),Y=(0,x.useCallback)(()=>{E.length&&C.listRequests({status:`pending`,approverId:E}).then(e=>Tt(e.data.length)).catch(()=>{})},[E]),_n=(0,x.useCallback)(async e=>{if(!F)return;let t=e===`recall`&&i?.id||J(F);if(!t){b.error(O(`noActor`,`Cannot determine the acting identity`));return}Nt(e);try{let n={actor_id:t,comment:I.trim()||void 0},r=await(e===`approve`?C.approve:e===`reject`?C.reject:C.recall)(F.id,n);if(b.success(e===`approve`?r.finalized?O(`approvedFinal`,`Approved`):O(`approvedWaiting`,`Approved — waiting on the remaining approvers`):e===`reject`?O(`rejectedToast`,`Rejected`):O(`recalledToast`,`Request recalled`)),L(``),e!==`recall`&&M===`pending`){let e=Rn.current,t=e.findIndex(e=>e.id===F.id),n=e[t+1]??e[t-1];K(),n&&n.id!==F.id?q(n.id):gn();return}let[i,a]=await Promise.all([C.getRequest(F.id),C.listActions(F.id)]);Dt(i.data),kt(a.data),K()}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{Nt(null)}},[F,J,I,K,i?.id,j,O,M,q]),X=(0,x.useCallback)(async e=>{let[t,n]=await Promise.all([C.getRequest(e),C.listActions(e)]);Dt(t.data),kt(n.data),K()},[K]),vn=(0,x.useCallback)(async()=>{if(!(!F||!Xt.trim())){G(!0);try{await C.reassign(F.id,{actor_id:J(F),to:Xt.trim(),comment:I.trim()||void 0}),b.success(O(`reassignSuccess`,`Handed to {{to}}`,{to:Xt.trim()})),Yt(!1),Zt(``),L(``),await X(F.id),Y()}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{G(!1)}}},[F,Xt,I,J,X,Y,j,O]),yn=(0,x.useCallback)(async()=>{if(F){G(!0);try{let e=await C.remind(F.id,{actor_id:i?.id});b.success(O(`remindSuccess`,`Reminder sent to {{count}} approver(s)`,{count:e.notified})),await X(F.id)}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{G(!1)}}},[F,i?.id,X,j,O]),bn=(0,x.useCallback)(async()=>{if(!(!F||!en.trim())){G(!0);try{await C.requestInfo(F.id,{actor_id:J(F),comment:en.trim()}),b.success(O(`requestInfoSent`,`Sent back to the requester for more information`)),$t(!1),tn(``),await X(F.id)}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{G(!1)}}},[F,en,J,X,j,O]),xn=(0,x.useCallback)(async()=>{if(F){G(!0);try{let e=await C.sendBack(F.id,{actor_id:J(F),comment:an.trim()||void 0});b.success(e.autoRejected?O(`sendBackAutoRejected`,`Revision limit reached — the request was auto-rejected`):O(`sendBackSuccess`,`Sent back for revision — the requester can now edit and resubmit`)),rn(!1),on(``),await X(F.id),Y()}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{G(!1)}}},[F,an,J,X,Y,j,O]),Sn=(0,x.useCallback)(async()=>{if(F){cn(!0);try{await C.resubmit(F.id,{actor_id:i?.id,comment:I.trim()||void 0}),b.success(O(`resubmitSuccess`,`Resubmitted — a new approval round has opened`)),L(``),await X(F.id),Y()}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{cn(!1)}}},[F,I,i?.id,X,Y,j,O]),Cn=(0,x.useCallback)(async()=>{if(!(!F||!ln.trim())){G(!0);try{await C.comment(F.id,{actor_id:i?.id,comment:ln.trim()}),un(``),await X(F.id)}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{G(!1)}}},[F,ln,i?.id,X,j,O]),wn=(0,x.useCallback)(async()=>{if(!dn.length)try{let e=``.replace(/\/$/,``);fn(((await(await fetch(`${e}/api/v1/data/sys_user?limit=100`,{credentials:`include`})).json()).records||[]).filter(e=>e.email&&e.name&&e.id!==i?.id).map(e=>({name:String(e.name),email:String(e.email)})))}catch{}},[dn.length,i?.id]),Tn=(0,x.useMemo)(()=>{if(!F||F.status!==`pending`)return!1;let e=new Set(F.pending_approvers||[]);return E.some(t=>e.has(t))||R.trim().length>0},[F,E,R]),En=(0,x.useMemo)(()=>!F||F.status!==`pending`?!1:F.submitter_id===i?.id||R.trim().length>0,[F,i?.id,R]),Dn=(0,x.useMemo)(()=>!F||F.status!==`returned`?!1:F.submitter_id===i?.id||R.trim().length>0,[F,i?.id,R]),On=(0,x.useMemo)(()=>{let e=new Set;for(let t of N)e.add(it(t));return Array.from(e).sort()},[N]),kn=(0,x.useMemo)(()=>{let e=new Set;for(let t of N)t.object_name&&e.add(t.object_name);return Array.from(e).sort()},[N]),Z=(0,x.useMemo)(()=>{let e=B.trim().toLowerCase();return N.filter(t=>Lt!==`all`&&it(t)!==Lt||zt!==`all`&&t.object_name!==zt||V!==`all`&&t.status!==V?!1:M!==`pending`||!e?!0:[t.process_name,t.process_label,t.step_label,t.object_name,t.record_id,t.record_title,t.submitter_id,t.submitter_name,...t.pending_approvers||[]].filter(Boolean).join(` `).toLowerCase().includes(e))},[N,B,Lt,zt,V,M]),An=(0,x.useMemo)(()=>P?Z.findIndex(e=>e.id===P):-1,[Z,P]);(0,x.useEffect)(()=>{if(H.size===0)return;let e=new Set(Z.map(e=>e.id)),t=!1,n=new Set;for(let r of H)e.has(r)?n.add(r):t=!0;t&&Ht(n)},[Z,H]),(0,x.useEffect)(()=>{pn>=Z.length&&mn(Z.length-1)},[Z.length,pn]);let Q=(0,x.useCallback)(e=>{if(e.status!==`pending`)return!1;let t=new Set(E);return(e.pending_approvers||[]).some(e=>t.has(e))},[E]),$=(0,x.useMemo)(()=>Z.filter(e=>H.has(e.id)&&Q(e)),[Z,H,Q]),jn=Z.filter(e=>e.status===`pending`),Mn=jn.length>0&&jn.every(e=>H.has(e.id)),Nn=(0,x.useCallback)(()=>{Ht(e=>{if(Mn)return new Set;let t=new Set(e);for(let e of jn)t.add(e.id);return t})},[Mn,jn]),Pn=(0,x.useCallback)(e=>{Ht(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Fn=(0,x.useCallback)(async e=>{let t=$;if(t.length===0)return;Wt(!0);let n=0,r=[];for(let a of t){let t=new Set(a.pending_approvers||[]),ee=E.find(e=>t.has(e))||i?.id||``;try{await(e===`approve`?C.approve:C.reject)(a.id,{actor_id:ee}),n++}catch{r.push(a.record_title||T(a.record_id))}}if(Wt(!1),Ht(new Set),r.length===0)b.success(e===`approve`?O(`bulkApproved`,`Approved {{count}} requests`,{count:n}):O(`bulkRejected`,`Rejected {{count}} requests`,{count:n}));else{let e=r.slice(0,3).join(`, `);b.error(O(`bulkPartial`,`{{ok}} succeeded, {{fail}} failed: {{which}}`,{ok:n,fail:r.length,which:e+(r.length>3?`…`:``)}))}K(),Y()},[$,E,i?.id,K,Y,O]),In=(0,x.useCallback)(async e=>{if(!Q(e)||Kt)return;let t=new Set(e.pending_approvers||[]),n=E.find(e=>t.has(e))||i?.id||``;qt(e.id);try{let t=await C.approve(e.id,{actor_id:n});b.success(t.finalized?O(`inlineApproved`,`Approved "{{title}}"`,{title:e.record_title||T(e.record_id)}):O(`approvedWaiting`,`Approved — waiting on the remaining approvers`)),K(),Y()}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{qt(null)}},[Q,Kt,E,i?.id,K,Y,j,O]),Ln=(0,x.useCallback)(async()=>{let e=U;if(!e)return;let t=new Set(e.pending_approvers||[]),n=E.find(e=>t.has(e))||i?.id||``;qt(e.id),Gt(null);try{await C.reject(e.id,{actor_id:n}),b.success(O(`inlineRejected`,`Rejected "{{title}}"`,{title:e.record_title||T(e.record_id)})),K(),Y()}catch(e){b.error(j(e,O(`actionFailed`,`Action failed`)))}finally{qt(null)}},[U,E,i?.id,K,Y,j,O]),Rn=(0,x.useRef)(Z);Rn.current=Z;let zn=(0,x.useRef)(pn);zn.current=pn,(0,x.useEffect)(()=>{let e=e=>{if(P||U)return;let t=e.target,n=t?.tagName;if(n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t?.isContentEditable||document.querySelector(`[role="alertdialog"]`))return;let r=Rn.current;if(!r.length)return;let i=zn.current;e.key===`j`||e.key===`ArrowDown`?(e.preventDefault(),mn(Math.min(i+1,r.length-1))):e.key===`k`||e.key===`ArrowUp`?(e.preventDefault(),mn(Math.max(i-1,0))):e.key===`Enter`&&i>=0&&r[i]?(e.preventDefault(),q(r[i].id)):(e.key===`x`||e.key===` `)&&i>=0&&r[i]&&M===`pending`?(e.preventDefault(),Pn(r[i].id)):e.key===`a`&&i>=0&&r[i]?(e.preventDefault(),In(r[i])):e.key===`r`&&i>=0&&r[i]&&Q(r[i])&&(e.preventDefault(),Gt(r[i]))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[P,U,M,q,Pn,In,Q]),(0,x.useEffect)(()=>{if(!P)return;let e=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;let t=e.target,n=t?.tagName;if(n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t?.isContentEditable||document.querySelector(`[role="alertdialog"]`))return;let r=Rn.current,i=r.findIndex(e=>e.id===P);if(i<0)return;let a=e.key===`ArrowLeft`?r[i-1]:r[i+1];a&&(e.preventDefault(),q(a.id))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[P,q]);let Bn=!!B||Lt!==`all`||zt!==`all`||V!==`all`,Vn=e=>{mt(e),Vt(`all`),Rt(`all`),Bt(`all`),Pt(``),mn(-1)};function Hn({r:e}){return(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`div`,{className:`font-medium truncate`,children:it(e)}),(0,w.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[at(e)||`—`,(e.round??1)>1&&(0,w.jsx)(`span`,{className:`ml-1.5 text-violet-600 dark:text-violet-400`,children:O(`roundChip`,`Round {{n}}`,{n:e.round})})]})]})}function Un({r:e}){return(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsxs)(r,{to:pt(e),onClick:e=>e.stopPropagation(),className:`inline-flex items-center gap-1 text-sm hover:underline truncate max-w-full`,title:e.record_id,children:[(0,w.jsx)(`span`,{className:`truncate`,children:e.record_title||T(e.record_id)}),(0,w.jsx)(Ee,{className:`h-3 w-3 shrink-0 text-muted-foreground`})]}),(0,w.jsx)(`div`,{className:`text-xs text-muted-foreground truncate`,children:ct(e)})]})}function Wn({r:e}){if(!Q(e))return null;let t=Kt===e.id;return(0,w.jsxs)(`div`,{className:`flex items-center gap-1 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity`,onClick:e=>e.stopPropagation(),children:[(0,w.jsx)(l,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-emerald-700 hover:text-emerald-800 hover:bg-emerald-50 dark:text-emerald-400`,disabled:t,onClick:()=>void In(e),"aria-label":O(`approve`,`Approve`),children:(0,w.jsx)(he,{className:`h-4 w-4`})}),(0,w.jsx)(l,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-red-600 hover:text-red-700 hover:bg-red-50 dark:text-red-400`,disabled:t,onClick:()=>Gt(e),"aria-label":O(`reject`,`Reject`),children:(0,w.jsx)(ae,{className:`h-4 w-4`})})]})}return(0,w.jsxs)(`div`,{className:`flex flex-col gap-4 sm:gap-6 p-4 sm:p-6 max-w-6xl`,children:[(0,w.jsxs)(`header`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`h1`,{className:`text-2xl font-semibold flex items-center gap-2`,children:[(0,w.jsx)(Ue,{className:`h-6 w-6`}),O(`title`,`Approvals Inbox`)]}),(0,w.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:O(`subtitle`,`Review and act on approval requests.`)})]}),(0,w.jsxs)(l,{variant:`outline`,size:`sm`,onClick:K,disabled:gt,className:`self-start sm:self-auto`,children:[(0,w.jsx)(ue,{className:`h-4 w-4 mr-2 ${gt?`animate-spin`:``}`}),O(`refresh`,`Refresh`)]})]}),St&&(0,w.jsxs)(Xe,{variant:`destructive`,children:[(0,w.jsx)(se,{className:`h-4 w-4`}),(0,w.jsx)(Me,{children:St})]}),(0,w.jsxs)(je,{value:M,onValueChange:Vn,children:[(0,w.jsxs)(Ze,{children:[(0,w.jsxs)(Ne,{value:`pending`,children:[O(`tabMyPending`,`My Pending`),wt>0&&(0,w.jsx)(We,{variant:`secondary`,className:`ml-2`,children:wt})]}),(0,w.jsx)(Ne,{value:`submitted`,children:O(`tabSubmitted`,`Submitted by me`)}),(0,w.jsx)(Ne,{value:`all`,children:O(`tabAll`,`All`)})]}),(0,w.jsxs)(Ve,{value:M,className:`mt-4 space-y-3`,children:[!gt&&(N.length>0||M!==`pending`&&(Ft||V!==`all`))&&(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsxs)(`div`,{className:`relative flex-1 min-w-[200px] max-w-sm`,children:[(0,w.jsx)(Re,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,w.jsx)(Ae,{value:B,onChange:e=>Pt(e.target.value),placeholder:O(`searchPlaceholder`,`Search record, process, requester…`),className:`pl-8 h-8 text-sm`}),B&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>Pt(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,"aria-label":O(`clearSearch`,`Clear search`),children:(0,w.jsx)(ze,{className:`h-3.5 w-3.5`})})]}),M!==`pending`&&(0,w.jsxs)(me,{value:V,onValueChange:Vt,children:[(0,w.jsx)(De,{className:`h-8 w-auto min-w-[130px] text-sm`,children:(0,w.jsx)(Te,{placeholder:O(`statusFilter`,`Status`)})}),(0,w.jsxs)(qe,{children:[(0,w.jsx)(s,{value:`all`,children:O(`allStatuses`,`All statuses`)}),(0,w.jsx)(s,{value:`pending`,children:A(`pending`)}),(0,w.jsx)(s,{value:`approved`,children:A(`approved`)}),(0,w.jsx)(s,{value:`rejected`,children:A(`rejected`)}),(0,w.jsx)(s,{value:`recalled`,children:A(`recalled`)}),(0,w.jsx)(s,{value:`returned`,children:A(`returned`)})]})]}),On.length>1&&(0,w.jsxs)(me,{value:Lt,onValueChange:Rt,children:[(0,w.jsx)(De,{className:`h-8 w-auto min-w-[140px] text-sm`,children:(0,w.jsx)(Te,{placeholder:O(`processFilter`,`Process`)})}),(0,w.jsxs)(qe,{children:[(0,w.jsx)(s,{value:`all`,children:O(`allProcesses`,`All processes`)}),On.map(e=>(0,w.jsx)(s,{value:e,children:e},e))]})]}),kn.length>1&&(0,w.jsxs)(me,{value:zt,onValueChange:Bt,children:[(0,w.jsx)(De,{className:`h-8 w-auto min-w-[140px] text-sm`,children:(0,w.jsx)(Te,{placeholder:O(`objectFilter`,`Object`)})}),(0,w.jsxs)(qe,{children:[(0,w.jsx)(s,{value:`all`,children:O(`allObjects`,`All objects`)}),kn.map(e=>(0,w.jsx)(s,{value:e,children:e},e))]})]}),Bn&&(0,w.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:O(`filterCount`,`{{shown}} of {{total}}`,{shown:Z.length,total:N.length})})]}),M===`pending`&&H.size>0&&(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 rounded-md border bg-accent/30 text-sm`,children:[(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`strong`,{children:H.size}),` `,O(`selected`,`selected`),$.length!==H.size&&(0,w.jsx)(`span`,{className:`text-muted-foreground ml-1`,children:O(`actionableCount`,`({{count}} actionable)`,{count:$.length})})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsxs)(_,{children:[(0,w.jsx)(Qe,{asChild:!0,children:(0,w.jsxs)(l,{size:`sm`,disabled:Ut||$.length===0,children:[(0,w.jsx)(he,{className:`h-3.5 w-3.5 mr-1`}),O(`approveN`,`Approve {{count}}`,{count:$.length||``})]})}),(0,w.jsxs)(f,{children:[(0,w.jsxs)(y,{children:[(0,w.jsx)(d,{children:O(`bulkApproveTitle`,`Approve {{count}} requests?`,{count:$.length})}),(0,w.jsx)(u,{children:O(`bulkApproveBody`,`Each request is approved with your identity and its flow continues down the approve branch.`)})]}),(0,w.jsxs)(v,{children:[(0,w.jsx)(p,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(h,{onClick:()=>Fn(`approve`),children:O(`approveN`,`Approve {{count}}`,{count:$.length})})]})]})]}),(0,w.jsxs)(_,{children:[(0,w.jsx)(Qe,{asChild:!0,children:(0,w.jsxs)(l,{size:`sm`,variant:`outline`,disabled:Ut||$.length===0,className:`border-destructive text-destructive hover:bg-destructive hover:text-destructive-foreground`,children:[(0,w.jsx)(ae,{className:`h-3.5 w-3.5 mr-1`}),O(`rejectN`,`Reject {{count}}`,{count:$.length||``})]})}),(0,w.jsxs)(f,{children:[(0,w.jsxs)(y,{children:[(0,w.jsx)(d,{children:O(`bulkRejectTitle`,`Reject {{count}} requests?`,{count:$.length})}),(0,w.jsx)(u,{children:O(`bulkRejectBody`,`This rejects the selected requests and notifies their submitters.`)})]}),(0,w.jsxs)(v,{children:[(0,w.jsx)(p,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(h,{onClick:()=>Fn(`reject`),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:O(`rejectN`,`Reject {{count}}`,{count:$.length})})]})]})]}),(0,w.jsx)(l,{size:`sm`,variant:`ghost`,onClick:()=>Ht(new Set),disabled:Ut,children:O(`clear`,`Clear`)})]})]}),gt?(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(c,{className:`h-10 w-full`}),(0,w.jsx)(c,{className:`h-10 w-full`}),(0,w.jsx)(c,{className:`h-10 w-full`})]}):N.length===0?(0,w.jsx)(`div`,{className:`flex items-center justify-center min-h-[240px] rounded-md border border-dashed`,children:(0,w.jsxs)(Se,{children:[(0,w.jsx)(pe,{children:O(`emptyTitle`,`No requests`)}),(0,w.jsx)(ce,{children:M===`pending`?O(`emptyPending`,`You're all caught up — nothing is waiting on you.`):O(`emptyOther`,`Nothing here yet.`)}),M===`pending`&&(0,w.jsx)(l,{variant:`link`,size:`sm`,className:`mt-1`,onClick:()=>Vn(`all`),children:O(`emptyViewAll`,`Browse all requests`)})]})}):Z.length===0?(0,w.jsx)(`div`,{className:`flex items-center justify-center min-h-[160px] rounded-md border border-dashed text-sm text-muted-foreground`,children:O(`noMatches`,`No matches for current filters.`)}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Pe,{className:`hidden md:block`,children:(0,w.jsx)(Ye,{className:`p-0`,children:(0,w.jsxs)(Ie,{children:[(0,w.jsx)(Le,{children:(0,w.jsxs)(ke,{children:[M===`pending`&&(0,w.jsx)(m,{className:`w-10`,children:(0,w.jsx)(ne,{checked:Mn,onCheckedChange:Nn,"aria-label":O(`selectAll`,`Select all`),disabled:jn.length===0})}),(0,w.jsx)(m,{children:O(`colRequest`,`Request`)}),(0,w.jsx)(m,{children:O(`colRecord`,`Record`)}),(0,w.jsx)(m,{children:O(`colRequester`,`Requester`)}),(0,w.jsx)(m,{children:O(`colStatus`,`Status`)}),(0,w.jsx)(m,{children:O(`colWaiting`,`Submitted`)}),(0,w.jsx)(m,{className:`w-20`,"aria-label":O(`colActions`,`Actions`)})]})}),(0,w.jsx)(Ke,{children:Z.map((e,t)=>(0,w.jsxs)(ke,{className:o(`group cursor-pointer hover:bg-accent/50`,pn===t&&`ring-2 ring-inset ring-ring bg-accent/30`),onClick:()=>{mn(t),q(e.id)},children:[M===`pending`&&(0,w.jsx)(g,{className:`w-10`,onClick:e=>e.stopPropagation(),children:(0,w.jsx)(ne,{checked:H.has(e.id),onCheckedChange:()=>Pn(e.id),disabled:e.status!==`pending`,"aria-label":O(`selectRow`,`Select request`)})}),(0,w.jsx)(g,{children:(0,w.jsx)(Hn,{r:e})}),(0,w.jsx)(g,{children:(0,w.jsx)(Un,{r:e})}),(0,w.jsx)(g,{children:(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,w.jsx)(_e,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,w.jsx)(`span`,{className:`truncate`,title:e.submitter_id||``,children:ot(e)})]})}),(0,w.jsx)(g,{children:(0,w.jsx)(dt,{status:e.status})}),(0,w.jsxs)(g,{className:o(`text-xs whitespace-nowrap`,lt(e)),title:rt(D(e)),children:[(0,w.jsx)(Oe,{className:`h-3 w-3 inline mr-1`}),k(D(e)),e.status===`pending`&&e.sla_due_at&&(0,w.jsx)(`div`,{className:o(`mt-0.5 text-[10px] font-medium`,Date.parse(e.sla_due_at)<Date.now()?`text-red-600 dark:text-red-400`:`text-muted-foreground`),children:Date.parse(e.sla_due_at)<Date.now()?O(`slaOverdue`,`SLA overdue {{dur}}`,{dur:ut(Date.now()-Date.parse(e.sla_due_at))}):O(`slaRemaining`,`SLA {{dur}} left`,{dur:ut(Date.parse(e.sla_due_at)-Date.now())})})]}),(0,w.jsx)(g,{className:`w-20`,children:(0,w.jsx)(Wn,{r:e})})]},e.id))})]})})}),(0,w.jsx)(`div`,{className:`md:hidden space-y-2`,children:Z.map(e=>(0,w.jsx)(Pe,{className:`cursor-pointer active:bg-accent/50`,onClick:()=>void q(e.id),children:(0,w.jsxs)(Ye,{className:`p-3 space-y-1.5`,children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,w.jsx)(`div`,{className:`font-medium text-sm truncate`,children:it(e)}),(0,w.jsx)(dt,{status:e.status})]}),(0,w.jsxs)(`div`,{className:`text-sm truncate`,children:[e.record_title||T(e.record_id),(0,w.jsx)(`span`,{className:`text-muted-foreground text-xs ml-1.5`,children:ct(e)})]}),(0,w.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 truncate`,children:[(0,w.jsx)(_e,{className:`h-3 w-3`}),ot(e)]}),(0,w.jsxs)(`span`,{className:o(`inline-flex items-center gap-1 whitespace-nowrap`,lt(e)),children:[(0,w.jsx)(Oe,{className:`h-3 w-3`}),k(D(e))]})]}),Q(e)&&(0,w.jsxs)(`div`,{className:`flex gap-2 pt-1`,onClick:e=>e.stopPropagation(),children:[(0,w.jsxs)(l,{size:`sm`,className:`h-7 flex-1`,disabled:Kt===e.id,onClick:()=>void In(e),children:[(0,w.jsx)(he,{className:`h-3.5 w-3.5 mr-1`}),O(`approve`,`Approve`)]}),(0,w.jsxs)(l,{size:`sm`,variant:`outline`,className:`h-7 flex-1 border-destructive text-destructive`,disabled:Kt===e.id,onClick:()=>Gt(e),children:[(0,w.jsx)(ae,{className:`h-3.5 w-3.5 mr-1`}),O(`reject`,`Reject`)]})]})]})},e.id))}),M!==`pending`&&bt!=null&&(0,w.jsxs)(`div`,{className:`flex items-center justify-center gap-3 py-1`,children:[(0,w.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:O(`loadedOf`,`Loaded {{loaded}} of {{total}}`,{loaded:N.length,total:bt})}),N.length<bt&&(0,w.jsx)(l,{size:`sm`,variant:`outline`,disabled:vt,onClick:()=>void hn(),children:vt?O(`loadingMore`,`Loading…`):O(`loadMore`,`Load more`)})]}),(0,w.jsx)(`div`,{className:`hidden md:block text-[11px] text-muted-foreground`,children:O(`keyboardHint`,`Keyboard: j/k move · Enter open · x select · a approve · r reject`)})]})]})]}),(0,w.jsx)(_,{open:Jt,onOpenChange:e=>{e||(Yt(!1),Zt(``))},children:(0,w.jsxs)(f,{children:[(0,w.jsxs)(y,{children:[(0,w.jsx)(d,{children:O(`reassignTitle`,`Hand this approval to someone else?`)}),(0,w.jsx)(u,{children:O(`reassignBody`,`Your approver slot moves to the person you pick — they are notified and can act immediately.`)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(Fe,{htmlFor:`reassign-to`,className:`text-xs`,children:O(`reassignTo`,`New approver`)}),(0,w.jsx)(Ae,{id:`reassign-to`,list:`reassign-user-options`,value:Xt,onChange:e=>Zt(e.target.value),placeholder:O(`reassignToPlaceholder`,`Pick a user or type an email / role:<name>`),className:`mt-1`}),(0,w.jsx)(`datalist`,{id:`reassign-user-options`,children:dn.map(e=>(0,w.jsx)(`option`,{value:e.email,children:e.name},e.email))})]}),(0,w.jsxs)(v,{children:[(0,w.jsx)(p,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(h,{disabled:!Xt.trim()||W,onClick:()=>void vn(),children:O(`reassignBtn`,`Reassign`)})]})]})}),(0,w.jsx)(_,{open:Qt,onOpenChange:e=>{e||($t(!1),tn(``))},children:(0,w.jsxs)(f,{children:[(0,w.jsxs)(y,{children:[(0,w.jsx)(d,{children:O(`requestInfoTitle`,`Ask the requester for more information?`)}),(0,w.jsx)(u,{children:O(`requestInfoBody`,`The request stays pending; the requester is notified and can reply on the thread.`)})]}),(0,w.jsx)(Je,{value:en,onChange:e=>tn(e.target.value),rows:3,placeholder:O(`requestInfoPlaceholder`,`What do you need from the requester?`)}),(0,w.jsxs)(v,{children:[(0,w.jsx)(p,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(h,{disabled:!en.trim()||W,onClick:()=>void bn(),children:O(`requestInfoBtn`,`Request info`)})]})]})}),(0,w.jsx)(_,{open:nn,onOpenChange:e=>{e||(rn(!1),on(``))},children:(0,w.jsxs)(f,{children:[(0,w.jsxs)(y,{children:[(0,w.jsx)(d,{children:O(`sendBackTitle`,`Send this request back for revision?`)}),(0,w.jsx)(u,{children:O(`sendBackBody`,`This round ends and the record unlocks so the requester can fix the data. When they resubmit, a fresh approval round opens for all approvers.`)})]}),(0,w.jsx)(Je,{value:an,onChange:e=>on(e.target.value),rows:3,placeholder:O(`sendBackPlaceholder`,`What needs to be fixed before this can be approved?`)}),(0,w.jsxs)(v,{children:[(0,w.jsx)(p,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(h,{disabled:W,onClick:()=>void xn(),children:O(`sendBackBtn`,`Send back`)})]})]})}),(0,w.jsx)(_,{open:!!U,onOpenChange:e=>!e&&Gt(null),children:(0,w.jsxs)(f,{children:[(0,w.jsxs)(y,{children:[(0,w.jsx)(d,{children:O(`rejectOneTitle`,`Reject "{{title}}"?`,{title:U?U.record_title||T(U.record_id):``})}),(0,w.jsx)(u,{children:O(`rejectOneBody`,`This rejects the request and notifies the submitter.`)})]}),(0,w.jsxs)(v,{children:[(0,w.jsx)(p,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(h,{onClick:()=>void Ln(),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:O(`reject`,`Reject`)})]})]})}),(0,w.jsx)(re,{open:!!P,onOpenChange:e=>!e&&gn(),children:(0,w.jsxs)(xe,{className:`w-full sm:max-w-xl overflow-y-auto`,children:[(0,w.jsxs)(ye,{children:[(0,w.jsx)(we,{children:F?it(F):O(`drawerTitle`,`Approval Request`)}),(0,w.jsx)(fe,{children:F?at(F)||ct(F):``})]}),F&&An>=0&&Z.length>1&&(0,w.jsxs)(`div`,{className:`flex items-center justify-between mt-2 text-xs text-muted-foreground`,children:[(0,w.jsxs)(l,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,disabled:An<=0,onClick:()=>{let e=Z[An-1];e&&q(e.id)},children:[(0,w.jsx)(de,{className:`h-4 w-4 mr-0.5`}),O(`prevRequest`,`Previous`)]}),(0,w.jsx)(`span`,{children:O(`positionOf`,`{{index}} of {{total}}`,{index:An+1,total:Z.length})}),(0,w.jsxs)(l,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,disabled:An>=Z.length-1,onClick:()=>{let e=Z[An+1];e&&q(e.id)},children:[O(`nextRequest`,`Next`),(0,w.jsx)(be,{className:`h-4 w-4 ml-0.5`})]})]}),At?(0,w.jsxs)(`div`,{className:`space-y-2 mt-6`,children:[(0,w.jsx)(c,{className:`h-6 w-3/4`}),(0,w.jsx)(c,{className:`h-6 w-1/2`}),(0,w.jsx)(c,{className:`h-20 w-full`})]}):F?(0,w.jsxs)(`div`,{className:`space-y-4 mt-6`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,w.jsx)(dt,{status:F.status}),(F.round??1)>1&&(0,w.jsx)(We,{variant:`outline`,className:`text-[10px] border-violet-200 text-violet-700 dark:border-violet-500/30 dark:text-violet-400`,children:O(`roundChip`,`Round {{n}}`,{n:F.round})}),(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:rt(D(F)),children:[(0,w.jsx)(Oe,{className:`h-3 w-3`}),O(`submittedAgo`,`Submitted {{when}}`,{when:k(D(F))})]}),F.completed_at&&(0,w.jsxs)(`span`,{children:[`· `,O(`completedAt`,`Completed {{when}}`,{when:k(F.completed_at)})]}),F.status===`pending`&&F.sla_due_at&&(0,w.jsx)(We,{variant:`outline`,className:o(`text-[10px]`,Date.parse(F.sla_due_at)<Date.now()?`border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-400`:`border-border text-muted-foreground`),children:Date.parse(F.sla_due_at)<Date.now()?O(`slaOverdue`,`SLA overdue {{dur}}`,{dur:ut(Date.now()-Date.parse(F.sla_due_at))}):O(`slaRemaining`,`SLA {{dur}} left`,{dur:ut(Date.parse(F.sla_due_at)-Date.now())})})]}),(0,w.jsx)(Pe,{children:(0,w.jsxs)(Ye,{className:`p-4 space-y-3`,children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsxs)(r,{to:pt(F),className:`text-base font-semibold hover:underline inline-flex items-center gap-1.5`,children:[(0,w.jsx)(`span`,{className:`truncate`,children:F.record_title||T(F.record_id)}),(0,w.jsx)(Ee,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}),(0,w.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:ct(F)})]}),(0,w.jsx)(`div`,{className:`text-right text-xs text-muted-foreground shrink-0`,children:(0,w.jsxs)(`div`,{className:`inline-flex items-center gap-1`,children:[(0,w.jsx)(_e,{className:`h-3 w-3`}),(0,w.jsx)(`span`,{title:F.submitter_id||``,children:ot(F)})]})})]}),ft(F.payload,F.payload_display).length>0&&(0,w.jsx)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-2 text-sm border-t pt-3`,children:ft(F.payload,F.payload_display).map(([e,t])=>(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e}),(0,w.jsx)(`div`,{className:`truncate`,title:t,children:t})]},e))}),F.status===`pending`&&(F.pending_approvers||[]).length>0&&(0,w.jsxs)(`div`,{className:`border-t pt-3`,children:[(0,w.jsx)(`div`,{className:`text-[11px] text-muted-foreground mb-1`,children:O(`waitingOn`,`Waiting on`)}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:(F.pending_approvers||[]).map((e,t)=>(0,w.jsx)(We,{variant:`outline`,className:`text-[11px]`,title:e,children:st(e,F)},t))})]})]})}),(F.flow_steps?.length??0)>1&&(0,w.jsx)(`div`,{className:`flex items-center px-1`,"aria-label":O(`stepProgress`,`Approval steps`),children:F.flow_steps.map((e,t)=>(0,w.jsxs)(x.Fragment,{children:[t>0&&(0,w.jsx)(`div`,{className:o(`h-px flex-1 mx-2`,e.state===`done`||e.state===`current`?`bg-emerald-300 dark:bg-emerald-700`:`bg-border`)}),(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,w.jsx)(`span`,{className:o(`flex items-center justify-center h-5 w-5 rounded-full text-[10px] font-semibold`,e.state===`done`&&`bg-emerald-500 text-white`,e.state===`current`&&`bg-amber-500 text-white ring-2 ring-amber-200 dark:ring-amber-500/30`,e.state===`upcoming`&&`bg-muted text-muted-foreground border`),children:e.state===`done`?(0,w.jsx)(Ce,{className:`h-3 w-3`}):t+1}),(0,w.jsx)(`span`,{className:o(`text-xs`,e.state===`current`?`font-medium`:`text-muted-foreground`),children:e.label})]})]},e.id))}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`text-sm font-semibold mb-3`,children:O(`history`,`Activity`)}),Ot.length===0?(0,w.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:O(`noActions`,`No actions yet.`)}):(0,w.jsx)(`ol`,{className:`relative space-y-3 pl-5 before:absolute before:left-[7px] before:top-1 before:bottom-1 before:w-px before:bg-border`,children:Ot.map(e=>{let t=e.action===`approve`?`bg-emerald-500`:e.action===`reject`?`bg-destructive`:e.action===`submit`?`bg-blue-500`:e.action===`reassign`?`bg-indigo-500`:e.action===`remind`||e.action===`request_info`?`bg-amber-500`:e.action===`comment`?`bg-slate-400`:e.action===`escalate`?`bg-red-500`:e.action===`revise`?`bg-violet-500`:e.action===`resubmit`?`bg-blue-500`:`bg-muted-foreground`,n=e.actor_id===`system:sla`?O(`systemSlaActor`,`System (SLA)`):e.actor_name??(e.actor_id&&e.actor_id===F.submitter_id?ot(F):T(e.actor_id)),r=e.action===`submit`?O(`actSubmit`,`Submitted`):e.action===`approve`?O(`actApprove`,`Approved`):e.action===`reject`?O(`actReject`,`Rejected`):e.action===`recall`?O(`actRecall`,`Recalled`):e.action===`reassign`?O(`actReassign`,`Reassigned`):e.action===`remind`?O(`actRemind`,`Reminder sent`):e.action===`request_info`?O(`actRequestInfo`,`Requested more info`):e.action===`comment`?O(`actComment`,`Commented`):e.action===`escalate`?O(`actEscalate`,`SLA escalated`):e.action===`revise`?O(`actRevise`,`Sent back for revision`):e.action===`resubmit`?O(`actResubmit`,`Resubmitted`):e.action;return(0,w.jsxs)(`li`,{className:`relative text-xs`,children:[(0,w.jsx)(`span`,{className:`absolute -left-[18px] top-1 h-3 w-3 rounded-full ring-2 ring-background ${t}`,"aria-hidden":!0}),(0,w.jsxs)(`div`,{className:`flex items-baseline gap-1.5 flex-wrap`,children:[(0,w.jsx)(`span`,{className:`font-medium`,children:r}),(0,w.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,w.jsx)(`span`,{title:e.actor_id||``,children:n}),(0,w.jsx)(`span`,{className:`ml-auto text-muted-foreground text-[10px]`,title:rt(e.created_at),children:k(e.created_at)})]}),e.comment&&(0,w.jsxs)(`div`,{className:`text-muted-foreground italic mt-0.5`,children:[`"`,e.comment,`"`]})]},e.id)})}),F.status===`pending`&&(Tn||En)&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2 mt-3`,children:[(0,w.jsx)(Ae,{value:ln,onChange:e=>un(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ln.trim()&&(e.preventDefault(),Cn())},placeholder:O(`replyPlaceholder`,`Reply on this request…`),className:`h-8 text-sm`}),(0,w.jsx)(l,{size:`sm`,variant:`outline`,className:`h-8 px-2 shrink-0`,disabled:!ln.trim()||W,onClick:()=>void Cn(),children:(0,w.jsx)(ge,{className:`h-3.5 w-3.5`})})]})]}),F.payload!=null&&(0,w.jsxs)(`details`,{className:`group`,children:[(0,w.jsx)(`summary`,{className:`cursor-pointer text-xs text-muted-foreground hover:text-foreground select-none`,children:O(`rawData`,`Raw data (JSON)`)}),(0,w.jsxs)(`div`,{className:`mt-2`,children:[(0,w.jsx)(`div`,{className:`flex justify-end`,children:(0,w.jsxs)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(JSON.stringify(F.payload,null,2)),b.success(O(`copied`,`Copied`))}catch{b.error(O(`copyFailed`,`Copy failed`))}},className:`text-[10px] text-muted-foreground hover:text-foreground inline-flex items-center gap-1`,children:[(0,w.jsx)(Be,{className:`h-3 w-3`}),O(`copy`,`Copy`)]})}),(0,w.jsx)(`pre`,{className:`text-[11px] bg-muted/50 rounded p-2 overflow-auto max-h-48 mt-1`,children:JSON.stringify(F.payload,null,2)})]})]}),F.status===`pending`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(le,{}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[$e&&(0,w.jsxs)(`details`,{className:`group`,children:[(0,w.jsx)(`summary`,{className:`cursor-pointer text-xs text-muted-foreground hover:text-foreground select-none`,children:O(`overrideActor`,`Act as another identity (admin)`)}),(0,w.jsxs)(`div`,{className:`mt-2`,children:[(0,w.jsx)(Fe,{htmlFor:`actor-override`,className:`text-xs`,children:O(`actor`,`Actor`)}),(0,w.jsx)(`input`,{id:`actor-override`,type:`text`,value:R,onChange:e=>Mt(e.target.value),placeholder:`${O(`auto`,`Auto`)}: ${J(F)||`—`}`,className:`w-full mt-1 px-3 py-2 text-sm border rounded-md bg-background`}),(0,w.jsx)(`div`,{className:`text-[10px] text-muted-foreground mt-1`,children:O(`overrideHint`,`e.g. role:sales_manager. Leave blank to use the auto-detected identity.`)})]})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(Fe,{htmlFor:`comment`,className:`text-xs`,children:O(`comment`,`Comment (optional)`)}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1.5`,children:[O(`quickPhrase1`,`Approved — meets requirements.`),O(`quickPhrase2`,`Approved with conditions — please monitor execution.`),O(`quickPhrase3`,`Please add supporting material and resubmit.`)].map(e=>(0,w.jsx)(`button`,{type:`button`,onClick:()=>L(e),className:`text-[11px] px-2 py-0.5 rounded-full border text-muted-foreground hover:text-foreground hover:bg-accent transition-colors`,children:e},e))}),(0,w.jsx)(Je,{id:`comment`,value:I,onChange:e=>L(e.target.value),rows:2,className:`mt-1`})]}),(0,w.jsxs)(`div`,{className:`flex gap-2 flex-wrap`,children:[(0,w.jsxs)(l,{size:`sm`,onClick:()=>_n(`approve`),disabled:!Tn||z!==null,children:[(0,w.jsx)(he,{className:`h-4 w-4 mr-1`}),z===`approve`?O(`approving`,`Approving…`):O(`approve`,`Approve`)]}),(0,w.jsxs)(_,{children:[(0,w.jsx)(Qe,{asChild:!0,children:(0,w.jsxs)(l,{size:`sm`,variant:`outline`,disabled:!Tn||z!==null,className:`border-destructive text-destructive hover:bg-destructive hover:text-destructive-foreground`,children:[(0,w.jsx)(ae,{className:`h-4 w-4 mr-1`}),z===`reject`?O(`rejecting`,`Rejecting…`):O(`reject`,`Reject`)]})}),(0,w.jsxs)(f,{children:[(0,w.jsxs)(y,{children:[(0,w.jsx)(d,{children:O(`rejectTitle`,`Reject this request?`)}),(0,w.jsx)(u,{children:O(`rejectBody`,`This marks the request as rejected and notifies the submitter.`)})]}),(0,w.jsxs)(v,{children:[(0,w.jsx)(p,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(h,{onClick:()=>_n(`reject`),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:O(`reject`,`Reject`)})]})]})]}),Tn&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(l,{size:`sm`,variant:`outline`,disabled:z!==null||W,className:`border-violet-300 text-violet-700 hover:bg-violet-50 dark:text-violet-400`,onClick:()=>rn(!0),children:[(0,w.jsx)(Ge,{className:`h-4 w-4 mr-1`}),O(`sendBackBtn`,`Send back`)]}),(0,w.jsxs)(l,{size:`sm`,variant:`outline`,disabled:z!==null||W,className:`border-amber-300 text-amber-700 hover:bg-amber-50 dark:text-amber-400`,onClick:()=>$t(!0),children:[(0,w.jsx)(oe,{className:`h-4 w-4 mr-1`}),O(`requestInfoBtn`,`Request info`)]}),(0,w.jsxs)(l,{size:`sm`,variant:`outline`,disabled:z!==null||W,onClick:()=>{wn(),Yt(!0)},children:[(0,w.jsx)(ie,{className:`h-4 w-4 mr-1`}),O(`reassignBtn`,`Reassign`)]})]}),En&&(0,w.jsxs)(l,{size:`sm`,variant:`outline`,disabled:W,onClick:()=>void yn(),children:[(0,w.jsx)(He,{className:`h-4 w-4 mr-1`}),O(`remindBtn`,`Send reminder`)]}),En&&(0,w.jsxs)(_,{children:[(0,w.jsx)(Qe,{asChild:!0,children:(0,w.jsxs)(l,{size:`sm`,variant:`outline`,disabled:z!==null,children:[(0,w.jsx)(ve,{className:`h-4 w-4 mr-1`}),z===`recall`?O(`recalling`,`Recalling…`):O(`recall`,`Recall`)]})}),(0,w.jsxs)(f,{children:[(0,w.jsxs)(y,{children:[(0,w.jsx)(d,{children:O(`recallTitle`,`Recall this request?`)}),(0,w.jsx)(u,{children:O(`recallBody`,`This withdraws your request. Approvers can no longer act on it, and the record is unlocked.`)})]}),(0,w.jsxs)(v,{children:[(0,w.jsx)(p,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(h,{onClick:()=>_n(`recall`),children:O(`recall`,`Recall`)})]})]})]})]}),!Tn&&(0,w.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:En?O(`whyDisabledSubmitter`,`You submitted this request, so you can recall it — but only the assigned approvers can approve or reject.`):O(`whyDisabled`,`Only the assigned approvers can act on this request. It is waiting on: {{who}}.`,{who:(F.pending_approvers||[]).map(e=>st(e,F)).join(`, `)||`—`})})]})]}),Dn&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(le,{}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:O(`returnedHint`,`An approver sent this back to you. The record is unlocked — fix the data, then resubmit to start a new approval round.`)}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(Fe,{htmlFor:`resubmit-comment`,className:`text-xs`,children:O(`comment`,`Comment (optional)`)}),(0,w.jsx)(Je,{id:`resubmit-comment`,value:I,onChange:e=>L(e.target.value),rows:2,className:`mt-1`,placeholder:O(`resubmitPlaceholder`,`What did you change?`)})]}),(0,w.jsxs)(`div`,{className:`flex gap-2 flex-wrap`,children:[(0,w.jsx)(l,{asChild:!0,size:`sm`,variant:`outline`,children:(0,w.jsxs)(r,{to:pt(F),children:[(0,w.jsx)(Ee,{className:`h-4 w-4 mr-1`}),O(`editRecordBtn`,`Edit record`)]})}),(0,w.jsxs)(l,{size:`sm`,disabled:sn,onClick:()=>void Sn(),children:[(0,w.jsx)(ue,{className:o(`h-4 w-4 mr-1`,sn&&`animate-spin`)}),sn?O(`resubmitting`,`Resubmitting…`):O(`resubmitBtn`,`Resubmit`)]}),(0,w.jsxs)(_,{children:[(0,w.jsx)(Qe,{asChild:!0,children:(0,w.jsxs)(l,{size:`sm`,variant:`outline`,disabled:sn,children:[(0,w.jsx)(ve,{className:`h-4 w-4 mr-1`}),O(`recall`,`Recall`)]})}),(0,w.jsxs)(f,{children:[(0,w.jsxs)(y,{children:[(0,w.jsx)(d,{children:O(`abandonTitle`,`Abandon this revision?`)}),(0,w.jsx)(u,{children:O(`abandonBody`,`This withdraws the request instead of resubmitting it. The approval ends here.`)})]}),(0,w.jsxs)(v,{children:[(0,w.jsx)(p,{children:O(`cancel`,`Cancel`)}),(0,w.jsx)(h,{onClick:()=>_n(`recall`),children:O(`recall`,`Recall`)})]})]})]})]})]})]})]}):null]})})]})}export{pt as ApprovalsInboxPage};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{_ as t,l as n,t as r,u as i}from"./vendor-react-slxo-5GC.js";import{l as a}from"./framework-B9PMswdm.js";import{Jt as o,Kt as s,Sr as c,Ti as l,Xt as u,Yt as d,ct as f,dt as p,fi as m,k as h,qt as g,ut as _}from"./ui-components-DsYvPIox.js";import{r as v}from"./vendor-ui-utils-C1OpMExs.js";import{i as y,s as b,t as x}from"./assistantBus-DosfPCbN.js";import{c as S,l as ee,n as te,o as ne,t as re}from"./useReconcileOnError-CtvIPgmD.js";import{C as ie,a as ae,d as C,f as w,g as T,h as E,m as D,r as oe,t as se,u as ce,y as O}from"./plugin-chatbot-COpsZSy4.js";import{n as le,x as k}from"./marketplaceApi-BLyDDfGk.js";var A=e(t(),1);function j(e){return e.some(e=>E(e.name))&&e.some(e=>T(e.name))}function M({agents:e,showAgentPickerProp:t,envOptIn:n=!1,aiStudioEnabled:r=!0}){return t===void 0?n?!0:r&&j(e):t}var N=r(),P={ask:{zh:`智能助手`,en:`Assistant`},build:{zh:`构建助手`,en:`Build assistant`}};function F(e,t,n){let r=t?P[D(t)]:void 0;return r?e?r.zh:r.en:n}function ue(e,t,n,r,i){let a=(e??``).toLowerCase().startsWith(`zh`),o=F(a,n,r),s=i.slice(0,2).map(e=>e.label||e.name);if(a){let e=[s[0]?`查询最近创建的${s[0]}`:`帮我查询最近的数据`,s[0]?`统计${s[0]}的总数量`:`统计各对象的记录数量`,s[1]?`${s[1]}有哪些字段?`:`当前应用里有哪些数据对象?`].filter(Boolean);return{agentLabel:o,labels:{emptyTitle:`你好,我是${o}`,emptyDescription:`随时帮你查询和分析「${t}」中的数据。试试下面的问题,或直接输入你的需求。`,clear:`清空对话`,sendHint:`发送`,agentActivity:`执行过程`,toolCompleted:`已完成`,toolRunning:`运行中`,toolAwaitingApproval:`等待确认`,toolFailed:`失败`,connectionWaiting:`正在等待服务器响应…`,connectionStalledLabel:`仍在处理中…`,connectionOfflineLabel:`网络已断开,正在重连…`,designingPlanLabel:`正在为你设计方案…`,designingPlanHints:[`梳理需要记录的数据…`,`设计对象与字段…`,`关联相关记录…`,`配置关系与查找字段…`,`规划页面与视图…`,`布置表单与列表…`,`补充默认值与校验…`,`规划一个看板来跟踪…`,`复核整体结构是否自洽…`,`汇总成完整方案…`],toolDetailsHidden:`已隐藏工具参数和原始结果,仅保留过程摘要。`,copy:`复制`,copied:`已复制`,regenerate:`重新生成`,model:`模型`,submit:`发送`,uploadFiles:`上传文件`,stopResponse:`停止生成`,sendFailedRateLimited:`发送过于频繁,请稍候再试。你的消息已保留在输入框中。`,sendFailedGeneric:`消息发送失败,请重试。你的消息已保留在输入框中。`,trace:`调试 trace`,viewTrace:`查看调试 trace`},placeholder:`向${o}提问…`,loadingPlaceholder:`正在加载助手…`,title:`${t} 智能助手`,newChat:`开启新对话`,share:`分享对话`,reviewDraft:e=>`查看 ${e} 项变更`,publishDrafts:`发布`,published:`已发布`,nextSteps:`下一步`,planTitle:`方案预览`,planQuestions:`搭建前请确认`,planAssumptions:`假设`,planDeferred:`待补 / 暂未搭建`,planApproveHint:`回复以确认或调整该方案。`,planApprove:`开始搭建`,planAdjust:`调整方案`,planBuilt:`已搭建`,planReady:`方案已就绪。点击开始搭建,或告诉我需要调整什么。`,planApproveMessage:`确认,开始搭建。`,planApproveDefaultsMessage:`确认搭建,未决问题按你的合理假设和默认处理。`,planAnswer:(e,t)=>`关于「${e}」,我选择「${t}」。`,publishOk:`已发布,对象已生效。`,publishFailed:`发布失败`,seedWarn:`已发布,但部分示例数据未能载入。`,openBuiltApp:`打开应用`,suggestions:e}}let c=[s[0]?`Show the latest ${s[0]}`:`Show my most recent records`,s[0]?`How many ${s[0]} are there?`:`Count records by status`,s[1]?`What fields does ${s[1]} have?`:`What data can I work with here?`].filter(Boolean);return{agentLabel:o,labels:{emptyTitle:`Hi, I'm ${o}`,emptyDescription:`I can help you query and analyze your ${t} data. Try a prompt below, or just type your question.`,clear:`Clear`,sendHint:`to send`,agentActivity:`Agent activity`,toolCompleted:`Completed`,toolRunning:`Running`,toolAwaitingApproval:`Awaiting approval`,toolFailed:`Failed`,connectionWaiting:`Waiting for server…`,connectionStalledLabel:`Still working…`,connectionOfflineLabel:`Connection lost — reconnecting…`,designingPlanLabel:`Designing your app…`,designingPlanHints:[`Mapping out the data you’ll track…`,`Shaping objects and their fields…`,`Connecting related records…`,`Setting up relationships and lookups…`,`Planning the screens and views…`,`Laying out forms and lists…`,`Adding sensible defaults and validations…`,`Sketching a dashboard to track it…`,`Double-checking the structure hangs together…`,`Pulling the plan together…`],toolDetailsHidden:`Tool inputs and raw results are hidden in this view.`,copy:`Copy`,copied:`Copied`,regenerate:`Regenerate`,model:`Model`,submit:`Submit`,uploadFiles:`Upload files`,stopResponse:`Stop response`,sendFailedRateLimited:`You're sending messages too quickly. Your message is kept below — wait a moment and try again.`,sendFailedGeneric:`Couldn't send your message. It's kept below — please try again.`,trace:`trace`,viewTrace:`View trace`},placeholder:`Ask ${o}...`,loadingPlaceholder:`Loading assistant...`,title:`${t} Assistant`,newChat:`New chat`,share:`Share conversation`,reviewDraft:e=>`Review ${e} change${e===1?``:`s`}`,publishDrafts:`Publish`,published:`Published`,nextSteps:`What's next`,planTitle:`Proposed plan`,planQuestions:`Confirm before building`,planAssumptions:`Assumptions`,planDeferred:`Not yet built`,planApproveHint:`Reply to approve or adjust this plan.`,planApprove:`Build it`,planAdjust:`Adjust`,planBuilt:`Built`,planReady:`The plan is ready. Build it now, or tell me what to adjust.`,planApproveMessage:`Looks good — build it as proposed.`,planApproveDefaultsMessage:`Build it with your best assumptions; use sensible defaults for the open questions.`,planAnswer:(e,t)=>`For "${e}", go with: ${t}.`,publishOk:`Published — objects are now live.`,publishFailed:`Publish failed`,seedWarn:`Published, but some sample data failed to load.`,openBuiltApp:`Open app`,suggestions:c}}var I=`/api/v1/ai`;function L(e){if(e)return e.replace(/\/$/,``);let t={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_SENTRY_DSN:`https://1373a588ceb9da150b11e64bf85f583d@o4510356161757184.ingest.us.sentry.io/4511439670673408`,VITE_SENTRY_ENVIRONMENT:`production`,VITE_SENTRY_SEND_DEFAULT_PII:`true`,VITE_SERVER_URL:``,VITE_USE_MOCK_SERVER:`false`},n=t.VITE_AI_BASE_URL;return n?n.replace(/\/$/,``):`${(t.VITE_SERVER_URL??``).replace(/\/$/,``)}${I}`}function de(e,t){if(!e||e.type!==`object`)return null;let n=e.label||e.name||`this object`;return(t??``).toLowerCase().startsWith(`zh`)?[`为「${n}」补充字段`,`为「${n}」建议校验规则`,`添加一个状态选项字段`]:[`Add fields to ${n}`,`Suggest validations for ${n}`,`Add a status picklist field`]}var R=new Set([`view`,`record`,`page`,`dashboard`,`design`,`report`,`metadata`]);function z(e){try{return decodeURIComponent(e)}catch{return e}}function fe(e,t){let n=e.split(`/`).filter(Boolean),r=n.indexOf(`apps`);if(r===-1||n.length<r+3)return{};let i=z(n[r+2]);if(R.has(i)||!t.some(e=>e.name===i))return{};let a=n[r+3]?z(n[r+3]):void 0,o=a&&a!==`new`?a:void 0;return{objectName:i,...o?{recordId:o}:{}}}function B({appLabel:e,appName:t,objects:r,agents:S,agentsLoading:C,activeAgent:w,onAgentChange:T,showAgentPicker:E,chatApi:D,apiBase:j,defaultOpen:M=!1,conversationId:P,initialMessages:I,onNewChat:L}){let{language:R}=a(),z=i(),B=n(),V=A.useMemo(()=>fe(B.pathname,r),[B.pathname,r]),{editor:H}=b(),{models:pe,defaultModelId:me}=ce({apiBase:j}),[he,ge]=A.useState(void 0),U=he??me,_e=A.useMemo(()=>!I||I.length===0?[]:ie(I),[I]),W=A.useMemo(()=>S.find(e=>e.name===w)?.label??w??e,[S,w,e]),G=A.useMemo(()=>ue(R,e,w,W,r),[R,e,w,W,r]),ve=A.useMemo(()=>de(H,R),[H,R]),{errorSuppressed:ye,handleChatError:be,setMessagesRef:xe,resetSuppression:K}=re({chatApi:D,conversationId:P}),{messages:q,isLoading:J,error:Se,sendMessage:Y,stop:Ce,reload:we,clear:Te,setMessages:X}=O({api:D,conversationId:P,model:U,onError:be,body:{context:{activeApp:e,appName:t,objects:r.map(e=>({name:e.name,label:e.label})),agentName:w,autoPublishAiBuilds:k().features.autoPublishAiBuilds,...V.objectName?{objectName:V.objectName}:{},...V.recordId?{recordId:V.recordId}:{},...H?{editing:H}:{}}},initialMessages:_e,autoResponse:!D,autoResponseText:r.length>0?`I can help you work with ${r.map(e=>e.label||e.name).join(`, `)}. What would you like to do?`:`Thanks for your message! I'm here to help you navigate and manage your data.`,autoResponseDelay:600});A.useEffect(()=>{xe.current=X},[X]),A.useEffect(()=>{ee(P,ne(q))},[P,q]);let Z=se({messages:q,apiBase:j,continueConversation:e=>{K(),Y(e)}}),Q=(R??``).toLowerCase().startsWith(`zh`),Ee=E&&S.length>1?S.length<=3?(0,N.jsx)(f,{value:w,onValueChange:T,children:(0,N.jsx)(_,{className:`h-7 gap-0.5 p-0.5`,"data-testid":`floating-chatbot-agent-picker`,children:S.map(e=>(0,N.jsx)(p,{value:e.name,disabled:C,title:e.description||void 0,className:`h-6 px-2.5 text-xs`,children:F(Q,e.name,e.label)},e.name))})}):(0,N.jsxs)(s,{value:w,onValueChange:T,disabled:C,children:[(0,N.jsx)(d,{className:`h-7 w-[180px] text-xs`,"data-testid":`floating-chatbot-agent-picker`,children:(0,N.jsx)(u,{placeholder:`Choose agent...`})}),(0,N.jsx)(g,{align:`end`,children:S.map(e=>(0,N.jsxs)(o,{value:e.name,className:`text-xs`,children:[(0,N.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,N.jsx)(`span`,{className:`block text-muted-foreground text-[10px] truncate max-w-[220px]`,children:e.description}):null]},e.name))})]}):null,[De,$]=A.useState(!1),Oe=A.useMemo(()=>j.replace(/\/v1\/ai$/,``).replace(/\/ai$/,``)||`/api`,[j]),ke=(0,N.jsxs)(N.Fragment,{children:[q.length>0?(0,N.jsx)(c,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,"aria-label":G.newChat,title:G.newChat,"data-testid":`floating-chatbot-new`,onClick:L,children:(0,N.jsx)(m,{className:`h-4 w-4`})}):null,P?(0,N.jsx)(c,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,"aria-label":G.share,title:G.share,"data-testid":`floating-chatbot-share`,onClick:()=>$(!0),children:(0,N.jsx)(l,{className:`h-4 w-4`})}):null]});return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(oe,{onUpgrade:()=>window.open(le(),`_blank`,`noopener,noreferrer`),floatingConfig:{position:`bottom-right`,defaultOpen:M,panelWidth:420,panelHeight:560,title:G.title,triggerSize:56},headerExtra:Ee,headerActions:ke,messages:q,labels:G.labels,models:pe,selectedModelId:U,onModelChange:ge,showAvatars:!0,hideClearBar:!0,assistantAvatarFallback:G.agentLabel,suggestions:q.length===0?ve??G.suggestions:void 0,placeholder:w?G.placeholder:C?G.loadingPlaceholder:G.placeholder,onSendMessage:e=>{K(),Y(e)},onClear:Te,onStop:J?Ce:void 0,onReload:we,isLoading:J,error:ye?void 0:Se,enableMarkdown:!0,onToolApprove:Z.decide,toolDecisions:Z.decisions,toolApproveLabel:`Approve & run`,toolDenyLabel:`Reject`,toolDenyReason:`Operator rejected from chat`,onReviewDraft:e=>{e[0]&&y(e[0])},toolReviewLabel:G.reviewDraft,onOpenBuiltApp:e=>z(`/apps/${encodeURIComponent(e)}`),openBuiltAppLabel:G.openBuiltApp,onPreviewDraftApp:(e,t)=>z(t?.materialized?`/apps/${encodeURIComponent(e)}`:`/apps/${encodeURIComponent(e)}?preview=draft`),onDraftArtifacts:e=>{for(let t of e)x(t)},fetchPendingDraftCount:te,onPublishDrafts:async e=>{try{let t=await fetch(`/api/v1/packages/${encodeURIComponent(e)}/publish-drafts`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:`{}`}),n=await t.json().catch(()=>null);if(!t.ok||n?.success===!1)throw Error(n?.error?.message||`HTTP ${t.status}`);let r=n?.data?.failedCount??n?.failedCount??0;if(r)throw Error(String(r));let i=n?.data?.seedApplied??n?.seedApplied;i&&i.success===!1?v.warning(G.seedWarn,{description:i.error??(Array.isArray(i.errors)&&i.errors.length?String(i.errors[0]):void 0)}):v.success(G.publishOk);let a=(n?.data?.published??n?.published??[]).find(e=>e?.type===`app`&&e?.name);return a?.name&&z(`/apps/${encodeURIComponent(a.name)}`),{ok:!0,health:ae(n)}}catch(e){return v.error(G.publishFailed,{description:e instanceof Error?e.message:void 0}),!1}},publishDraftsLabel:G.publishDrafts,nextStepsLabel:G.nextSteps,planTitleLabel:G.planTitle,planQuestionsLabel:G.planQuestions,planAssumptionsLabel:G.planAssumptions,planDeferredLabel:G.planDeferred,planApproveHintLabel:G.planApproveHint,planApproveLabel:G.planApprove,planAdjustLabel:G.planAdjust,planBuiltLabel:G.planBuilt,planReadyLabel:G.planReady,planApproveMessage:G.planApproveMessage,planApproveDefaultsMessage:G.planApproveDefaultsMessage,planAnswerMessage:G.planAnswer,publishedLabel:G.published,autoPublishDrafts:k().features.autoPublishAiBuilds}),P&&(0,N.jsx)(h,{open:De,onOpenChange:$,objectName:`ai_conversations`,recordId:P,recordLabel:`this conversation`,apiBase:Oe})]})}function V({appLabel:e,appName:t,objects:n,apiBase:r,defaultAgent:i,showAgentPicker:a,defaultOpen:o=!1,userId:s}){let c=A.useMemo(()=>L(r),[r]),l={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_SENTRY_DSN:`https://1373a588ceb9da150b11e64bf85f583d@o4510356161757184.ingest.us.sentry.io/4511439670673408`,VITE_SENTRY_ENVIRONMENT:`production`,VITE_SENTRY_SEND_DEFAULT_PII:`true`,VITE_SERVER_URL:``,VITE_USE_MOCK_SERVER:`false`},u=l.VITE_AI_DEFAULT_AGENT,{agents:d,isLoading:f,error:p}=w({apiBase:c}),m=M({agents:d,showAgentPickerProp:a,envOptIn:l.VITE_AI_SHOW_AGENT_PICKER===`true`,aiStudioEnabled:k().features.aiStudio!==!1}),[h,g]=A.useState(void 0);A.useEffect(()=>{if(!h&&d.length>0){let e=C(d,i??u);e&&g(e)}},[d,h,i,u]);let _=h?`${c}/agents/${encodeURIComponent(h)}/chat`:void 0,v=h?D(h)===`build`:!1,{conversationId:y,initialMessages:b,startNew:x}=S({userId:h?s:void 0,scope:h,apiBase:c,resumeMode:v?`resume`:`fresh`});return(0,N.jsx)(B,{appLabel:e,appName:t,objects:n,agents:d,agentsLoading:f,agentsError:p,activeAgent:h,onAgentChange:g,showAgentPicker:m,chatApi:_,apiBase:c,defaultOpen:o,conversationId:y,initialMessages:b,onNewChat:x},`${_??`local`}:${y??`pending`}`)}export{V as default};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{_ as t,t as n}from"./vendor-react-slxo-5GC.js";import{l as r}from"./framework-B9PMswdm.js";import{Ac as i,Fs as a,Gn as o,Ha as s,Jn as c,Kn as l,Pa as u,Qs as d,Sr as f,Wn as p,Xa as m,Yn as h,_s as g,cn as _,co as v,ec as y,hi as b,pi as x,qn as S}from"./ui-components-DsYvPIox.js";import{a as C,i as w,n as T,o as E,r as D,s as O,t as k}from"./plugin-view-DZC_ZJtv.js";var A=e(t(),1),j=n();function M({title:e,description:t,icon:n,actions:r,accentColor:a,sticky:o=!1,className:s,"data-testid":c}){return(0,j.jsxs)(`div`,{style:{"--page-header-accent":a||`hsl(var(--primary))`},className:i(`relative shrink-0 border-b bg-background z-10`,o&&`sticky top-0 bg-background/85 backdrop-blur supports-[backdrop-filter]:bg-background/75`,s),"data-testid":c??`page-header`,children:[(0,j.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 top-0 h-[2px] opacity-80`,style:{background:`linear-gradient(90deg, transparent, var(--page-header-accent), transparent)`}}),(0,j.jsxs)(`div`,{className:`flex justify-between items-center gap-3 py-2.5 sm:py-3 px-4 sm:px-6`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[n&&(0,j.jsx)(`div`,{className:i(`shrink-0 inline-flex items-center justify-center rounded-lg`,`h-9 w-9 sm:h-10 sm:w-10`,`[&_svg]:h-[18px] [&_svg]:w-[18px] sm:[&_svg]:h-5 sm:[&_svg]:w-5`),style:{color:`var(--page-header-accent)`,background:`linear-gradient(135deg, color-mix(in srgb, var(--page-header-accent) 18%, transparent), color-mix(in srgb, var(--page-header-accent) 6%, transparent))`,boxShadow:`inset 0 0 0 1px color-mix(in srgb, var(--page-header-accent) 22%, transparent)`},children:n}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`h1`,{className:`text-base sm:text-lg lg:text-xl font-semibold tracking-tight text-foreground truncate leading-tight`,children:e}),t&&(0,j.jsx)(`p`,{className:`text-xs sm:text-sm text-muted-foreground truncate hidden sm:block max-w-xl mt-0.5`,children:t})]})]}),r&&(0,j.jsx)(`div`,{className:`flex items-center gap-1.5 sm:gap-2 shrink-0`,children:r})]})]})}function N(e){return[{type:`grid`,icon:m,label:e(`console.objectView.viewTypeGrid`),description:e(`console.objectView.viewTypeGridDesc`)},{type:`kanban`,icon:x,label:e(`console.objectView.viewTypeKanban`),description:e(`console.objectView.viewTypeKanbanDesc`)},{type:`calendar`,icon:y,label:e(`console.objectView.viewTypeCalendar`),description:e(`console.objectView.viewTypeCalendarDesc`)},{type:`gallery`,icon:v,label:e(`console.objectView.viewTypeGallery`),description:e(`console.objectView.viewTypeGalleryDesc`)},{type:`timeline`,icon:g,label:e(`console.objectView.viewTypeTimeline`),description:e(`console.objectView.viewTypeTimelineDesc`)},{type:`gantt`,icon:b,label:e(`console.objectView.viewTypeGantt`),description:e(`console.objectView.viewTypeGanttDesc`)},{type:`map`,icon:u,label:e(`console.objectView.viewTypeMap`),description:e(`console.objectView.viewTypeMapDesc`)},{type:`chart`,icon:d,label:e(`console.objectView.viewTypeChart`),description:e(`console.objectView.viewTypeChartDesc`)},{type:`tree`,icon:s,label:e(`console.objectView.viewTypeTree`),description:e(`console.objectView.viewTypeTreeDesc`)}]}function P(e,t){for(let n=1;n<1e3;n++){let r=`${e} ${n}`;if(!t.has(r))return r}return e}var F={kanban:[{key:`groupByField`,i18nKey:`console.objectView.groupByField`,helpI18nKey:`console.objectView.groupByFieldHelp`,filter:e=>e.type===`select`||e.type===`boolean`,preferred:T}],calendar:[{key:`startDateField`,i18nKey:`console.objectView.startDateField`,helpI18nKey:`console.objectView.startDateFieldHelp`,filter:e=>e.type===`date`,preferred:D},{key:`titleField`,i18nKey:`console.objectView.titleField`,helpI18nKey:`console.objectView.titleFieldHelp`,filter:e=>e.type===`text`}],timeline:[{key:`startDateField`,i18nKey:`console.objectView.startDateField`,helpI18nKey:`console.objectView.timelineDateFieldHelp`,filter:e=>e.type===`date`,preferred:D},{key:`titleField`,i18nKey:`console.objectView.titleField`,helpI18nKey:`console.objectView.titleFieldHelp`,filter:e=>e.type===`text`}],gantt:[{key:`startDateField`,i18nKey:`console.objectView.startDateField`,helpI18nKey:`console.objectView.ganttStartDateFieldHelp`,filter:e=>e.type===`date`,preferred:D},{key:`endDateField`,i18nKey:`console.objectView.endDateField`,helpI18nKey:`console.objectView.ganttEndDateFieldHelp`,filter:e=>e.type===`date`,preferred:k},{key:`titleField`,i18nKey:`console.objectView.titleField`,helpI18nKey:`console.objectView.titleFieldHelp`,filter:e=>e.type===`text`}],gallery:[{key:`coverField`,i18nKey:`console.objectView.imageField`,helpI18nKey:`console.objectView.imageFieldHelp`,filter:e=>E(e)}],map:[{key:`latitudeField`,i18nKey:`console.objectView.latitudeField`,helpI18nKey:`console.objectView.latitudeFieldHelp`,filter:e=>e.type===`number`&&C(e,`latitude`)},{key:`longitudeField`,i18nKey:`console.objectView.longitudeField`,helpI18nKey:`console.objectView.longitudeFieldHelp`,filter:e=>e.type===`number`&&C(e,`longitude`)}],chart:[{key:`chartType`,i18nKey:`console.objectView.chartType`,helpI18nKey:`console.objectView.chartTypeHelp`,kind:`enum`,enumOptions:[{value:`bar`,i18nKey:`console.objectView.chartTypeBar`},{value:`line`,i18nKey:`console.objectView.chartTypeLine`},{value:`pie`,i18nKey:`console.objectView.chartTypePie`},{value:`area`,i18nKey:`console.objectView.chartTypeArea`},{value:`scatter`,i18nKey:`console.objectView.chartTypeScatter`}],defaultValue:`bar`},{key:`xAxisField`,i18nKey:`console.objectView.xAxisField`,helpI18nKey:`console.objectView.xAxisFieldHelp`,filter:e=>e.type===`select`||e.type===`boolean`||e.type===`date`||e.type===`text`,preferred:T},{key:`yAxisFields`,i18nKey:`console.objectView.yAxisField`,helpI18nKey:`console.objectView.yAxisFieldHelp`,filter:e=>e.type===`number`}],tree:[{key:`parentField`,i18nKey:`console.objectView.parentField`,helpI18nKey:`console.objectView.parentFieldHelp`,filter:e=>e.rawType===`tree`||e.rawType===`lookup`||e.rawType===`master_detail`}]};function I({open:e,onOpenChange:t,onCreate:n,existingLabels:s,availableTypes:u,objectDef:d}){let{t:m}=r(),g=(0,A.useMemo)(()=>N(m),[m]),v=(0,A.useMemo)(()=>u&&u.length>0?g.filter(e=>u.includes(e.type)):g,[g,u]),y=(0,A.useMemo)(()=>new Set(s??[]),[(s??[]).join(`\0`)]),b=(0,A.useMemo)(()=>d?w(d):[],[d]),[x,C]=(0,A.useState)(v[0]?.type??`grid`),[T,E]=(0,A.useState)(``),[D,k]=(0,A.useState)(!1),[M,I]=(0,A.useState)({});(0,A.useEffect)(()=>{e&&(C(v[0]?.type??`grid`),k(!1),I({}))},[e,v]),(0,A.useEffect)(()=>{D||E(P(v.find(e=>e.type===x)?.label??`View`,y))},[x,D,v,y]);let L=F[x]??[],R=e=>e.kind===`enum`?(e.enumOptions?.length??0)>0:d?(e.filter?b.filter(e.filter):b).length>0:!0,z=(0,A.useMemo)(()=>{let e={};return v.forEach(t=>{let n=(F[t.type]??[]).find(e=>!R(e));e[t.type]=n??null}),e},[v,b,d]),B=e=>M[`${x}.${e}`]??``,V=(e,t)=>I(n=>({...n,[`${x}.${e}`]:t})),H=T.trim(),U=H.length>0&&y.has(H),W=L.every(e=>B(e.key).length>0),G=H.length>0&&!U&&W;(0,A.useEffect)(()=>{L.length!==0&&L.forEach(e=>{if(B(e.key).length>0)return;if(e.kind===`enum`){e.defaultValue&&V(e.key,e.defaultValue);return}let t=e.filter?b.filter(e.filter):b;if(t.length===0)return;if(t.length===1){V(e.key,t[0].value);return}let n=O(t,e.preferred??[]);n&&V(e.key,n)})},[x,b]);let K=()=>{if(!G)return;let e={};L.forEach(t=>{let n=B(t.key);n&&(e[t.key]=t.key===`yAxisFields`?[n]:n)});let r={type:x,label:H};Object.keys(e).length>0&&(r[x]=e),n(r),t(!1)};return(0,j.jsx)(p,{open:e,onOpenChange:t,children:(0,j.jsxs)(o,{className:`sm:max-w-[560px]`,"data-testid":`create-view-dialog`,children:[(0,j.jsxs)(c,{children:[(0,j.jsx)(h,{children:m(`console.objectView.createView`)}),(0,j.jsx)(l,{children:m(`console.objectView.createViewDesc`)})]}),(0,j.jsx)(`div`,{className:`grid grid-cols-4 gap-2 py-2`,"data-testid":`create-view-type-grid`,children:v.map(({type:e,label:t,description:n,icon:r})=>{let a=e===x,o=z[e],s=!!o,c=s?m(`console.objectView.viewTypeUnavailable`,{field:m(o.i18nKey)}):void 0;return(0,j.jsxs)(`button`,{type:`button`,"data-testid":`create-view-type-${e}`,"aria-pressed":a,"aria-disabled":s,disabled:s,title:c,onClick:()=>{s||C(e)},className:i(`group flex flex-col items-start gap-1 rounded-lg border bg-background p-3 text-left transition-colors`,!s&&`hover:border-primary/60 hover:bg-accent/40`,a&&!s?`border-primary ring-2 ring-primary/30 bg-accent/40`:`border-border`,s&&`opacity-50 cursor-not-allowed`),children:[(0,j.jsx)(r,{className:i(`h-5 w-5`,a&&!s?`text-primary`:`text-muted-foreground group-hover:text-foreground`)}),(0,j.jsx)(`div`,{className:`text-xs font-medium leading-tight`,children:t}),(0,j.jsx)(`div`,{className:`text-[10px] leading-tight text-muted-foreground line-clamp-2`,children:s?m(`console.objectView.viewTypeUnavailableShort`):n})]},e)})}),L.length>0&&(0,j.jsx)(`div`,{className:`space-y-3 rounded-md border border-dashed bg-muted/30 p-3`,"data-testid":`create-view-required-fields`,children:L.map(e=>{let t=B(e.key),n=e.kind===`enum`,r=n?[]:e.filter?b.filter(e.filter):b,o=!n&&b.length>0&&r.length===0;return(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`label`,{htmlFor:`create-view-required-${e.key}`,className:`text-xs font-medium`,children:[m(e.i18nKey),(0,j.jsx)(`span`,{className:`ml-1 text-destructive`,children:`*`})]}),(0,j.jsxs)(`select`,{id:`create-view-required-${e.key}`,"data-testid":`create-view-required-${e.key}`,value:t,onChange:t=>V(e.key,t.target.value),disabled:o,className:i(`h-9 w-full rounded-md border bg-background px-2 text-xs`,`border-input`),children:[(0,j.jsx)(`option`,{value:``,children:m(n?`console.objectView.selectOption`:`console.objectView.selectField`)}),n?e.enumOptions.map(e=>(0,j.jsx)(`option`,{value:e.value,children:m(e.i18nKey)},e.value)):r.map(e=>(0,j.jsx)(`option`,{value:e.value,children:e.label},e.value))]}),e.helpI18nKey&&!o&&(0,j.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:m(e.helpI18nKey)}),o&&(0,j.jsxs)(`p`,{className:`flex items-center gap-1 text-[11px] text-destructive`,"data-testid":`create-view-error-no-field-${e.key}`,children:[(0,j.jsx)(a,{className:`h-3 w-3`}),m(`console.objectView.noEligibleFieldForType`)]})]},e.key)})}),(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`label`,{htmlFor:`create-view-name-input`,className:`text-xs font-medium`,children:[m(`console.objectView.title`),(0,j.jsx)(`span`,{className:`ml-1 text-destructive`,children:`*`})]}),(0,j.jsx)(_,{id:`create-view-name-input`,"data-testid":`create-view-name-input`,autoFocus:!0,value:T,onChange:e=>{E(e.target.value),k(!0)},onKeyDown:e=>{e.key===`Enter`&&G&&K()},placeholder:m(`console.objectView.newView`),className:`h-9`}),U&&(0,j.jsx)(`p`,{className:`text-[11px] text-destructive`,"data-testid":`create-view-error-duplicate`,children:m(`console.objectView.duplicateViewName`)})]}),(0,j.jsxs)(S,{className:`mt-2`,children:[(0,j.jsx)(f,{type:`button`,variant:`outline`,onClick:()=>t(!1),"data-testid":`create-view-cancel`,children:m(`console.objectView.cancel`)}),(0,j.jsx)(f,{type:`button`,disabled:!G,onClick:K,"data-testid":`create-view-submit`,children:m(`console.objectView.create`)})]})]})})}export{M as n,I as t};
@@ -1 +0,0 @@
1
- import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{_ as n,f as r,t as i}from"./vendor-react-slxo-5GC.js";import{d as a}from"./infrastructure-BnbfcrX8.js";import{E as o,L as s,R as c,l}from"./framework-B9PMswdm.js";import{G as u,Gn as d,Ic as f,J as p,Jn as m,Jr as h,Kn as g,Kr as _,Qs as v,Sr as y,W as b,Wn as x,Xa as S,Xi as C,Yn as w,Za as T,Zs as E,ai as D,kr as O,qn as ee,qs as k,ra as te,wc as A}from"./ui-components-DsYvPIox.js";import{r as j}from"./vendor-ui-utils-C1OpMExs.js";import"./AdapterProvider-_4c7hk3d.js";import{n as ne}from"./plugin-form-CzotVFc-.js";import"./MetadataProvider-MNkZn-bR.js";import{r as re}from"./ExpressionProvider-w-HoWEV1.js";import{r as ie}from"./useMetadata-DAEfn7ks.js";import{v as M}from"./ReportDefaultInspector-OSqdhKEL.js";import{t as N}from"./utils-Bixzg6Bz.js";import{n as ae,r as oe,t as se}from"./MetadataInspector-CpceGXDL.js";import{n as P,t as F}from"./DashboardWidgetInspector-BmIMgSGO.js";import{r as ce}from"./runtime-metadata-persistence-D1KKivGr.js";import{n as I,t as le}from"./useOpenRecordList-DL3H_OJi.js";import{n as ue}from"./skeletons-BK6x7CYd.js";import{n as de}from"./plugin-dashboard-Bi5WrqPG.js";var L=e(n(),1),R=i();function fe({open:e,onClose:t,schema:n,selectedWidgetId:r,onSelectWidget:i,onSave:a,onChange:o,onRemoveWidget:s,name:c,metadataClient:u,onAfterChange:d}){let{t:f}=l(),p=(0,L.useMemo)(()=>M(),[]),[m,g]=(0,L.useState)(!1),[_,v]=(0,L.useState)(0),b=(0,L.useCallback)(e=>{g(!0),o({...n??{},...e})},[n,o]),x=(0,L.useCallback)(e=>{o(e),g(!1)},[o]),S=(0,L.useCallback)(e=>{i(e&&e.kind===`widget`?e.id:null)},[i]),C=Array.isArray(n?.widgets)?n.widgets:[],w=r?C.find(e=>e?.id===r):null;if(!e)return null;let T=typeof n?.name==`string`?n.name:``,E=w?f(`widget.editor.title`,{defaultValue:`Edit widget`}):f(`dashboard.editor.title`,{defaultValue:`Edit dashboard`});return(0,R.jsxs)(`aside`,{className:`hidden sm:flex w-[440px] shrink-0 flex-col border-l bg-background h-full`,"data-testid":`dashboard-config-panel`,role:`complementary`,"aria-label":E,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-4 py-2.5 shrink-0`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[w&&(0,R.jsx)(y,{variant:`ghost`,size:`sm`,onClick:()=>i(null),className:`h-7 w-7 p-0`,"aria-label":f(`dashboard.editor.backToDashboard`,{defaultValue:`Back to dashboard`}),title:f(`dashboard.editor.backToDashboard`,{defaultValue:`Back to dashboard`}),"data-testid":`dashboard-config-back`,children:(0,R.jsx)(A,{className:`h-4 w-4`})}),(0,R.jsx)(`div`,{className:`text-sm font-medium truncate`,children:E})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[w&&s&&(0,R.jsx)(y,{variant:`ghost`,size:`sm`,onClick:()=>s(r),className:`h-7 w-7 p-0 text-destructive hover:text-destructive`,"aria-label":f(`widget.editor.delete`,{defaultValue:`Delete widget`}),title:f(`widget.editor.delete`,{defaultValue:`Delete widget`}),"data-testid":`widget-delete-button`,children:(0,R.jsx)(h,{className:`h-3.5 w-3.5`})}),(0,R.jsx)(y,{variant:`ghost`,size:`sm`,onClick:t,className:`h-7 w-7 p-0`,"aria-label":f(`common.close`,{defaultValue:`Close`}),"data-testid":`dashboard-config-close`,children:(0,R.jsx)(O,{className:`h-4 w-4`})})]})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:w?(0,R.jsx)(F,{type:`dashboard`,name:T,draft:n??{},selection:{kind:`widget`,id:r},onPatch:b,onClearSelection:()=>i(null),onSelectionChange:S,readOnly:!1,locale:p}):(0,R.jsx)(P,{type:`dashboard`,name:T,draft:n??{},onPatch:b,onSelectionChange:S,readOnly:!1,locale:p})}),(0,R.jsxs)(`div`,{"data-testid":`dashboard-config-footer`,className:`flex items-center justify-end gap-2 border-t px-4 py-2.5 shrink-0`,children:[(0,R.jsx)(I,{type:`dashboard`,name:c||T||void 0,metadataClient:u,dirty:m,onResume:x,savedSignal:_,onAfterChange:d}),(0,R.jsx)(y,{size:`sm`,onClick:()=>{a(n??{}),g(!1),v(e=>e+1)},"data-testid":`dashboard-config-save`,children:f(`common.save`,{defaultValue:`Save`})})]})]})}var z=t({DashboardView:()=>U}),B=[{type:`metric`,label:`KPI Metric`,Icon:_},{type:`bar`,label:`Bar Chart`,Icon:v},{type:`line`,label:`Line Chart`,Icon:E},{type:`pie`,label:`Pie Chart`,Icon:k},{type:`table`,label:`Table`,Icon:D},{type:`pivot`,label:`Pivot`,Icon:S}],V=0;function H(){return V+=1,`widget_${Date.now()}_${V}`}function pe(e){return!e.widgets?.length||!e.widgets.some(e=>!e.id)?e:{...e,widgets:e.widgets.map(e=>e.id?e:{...e,id:H()})}}function me(e){let t=B.find(t=>t.type===e);return t?`New ${t.label}`:`New Widget`}function U({dataSource:e}){let t=le(),{dashboardName:n}=r(),{showDebug:i}=ae(),h=s(),_=ie(),{t:v}=l(),{dashboardLabel:S,dashboardDescription:E}=f(),D=a(),[O,k]=(0,L.useState)(!0),[A,M]=(0,L.useState)(!1),[P,F]=(0,L.useState)(null),[I,z]=(0,L.useState)(null),V=(0,L.useCallback)(e=>{z(t=>(t&&t.resolve(e),null))},[]),U=(0,L.useCallback)(e=>new Promise(t=>{let n;if(typeof e==`string`){let t=e.match(/^(create|new|add|edit|update)_(.+)$/);if(t){let e=t[1];n={objectName:t[2],mode:e===`edit`||e===`update`?`edit`:`create`}}else n={objectName:e,mode:`create`}}else n=e;z({schema:n,resolve:t})}),[]),he=(0,L.useMemo)(()=>({export_dashboard_pdf:async()=>{j.info(v(`dashboardActions.pdfPreparing`));try{return window.print(),{success:!0}}catch(e){return j.error(v(`dashboardActions.exportFailed`,{message:e?.message||String(e)})),{success:!1,error:e?.message||String(e)}}},forecast_dashboard:async()=>(j.info(v(`dashboardActions.forecastSoon`)),{success:!0})}),[v]);(0,L.useEffect)(()=>{k(!0),J(null),M(!1),F(null),queueMicrotask(()=>k(!1))},[n]);let{dashboards:ge,objects:W,refresh:G}=c(),{app:_e}=re(),K=oe(ge,n,_e?._packageId),[q,J]=(0,L.useState)(null);(0,L.useEffect)(()=>{A||J(null)},[K]);let Y=(0,L.useCallback)(async e=>{try{_&&await ce(`dashboard`,n,e,{metadataClient:_}),G().catch(()=>{})}catch(e){let t=e instanceof Error?e.message:String(e);console.warn(`[DashboardView] Auto-save failed:`,e),j.error(`Failed to save dashboard: ${t}`)}},[_,n,G]),ve=(0,L.useCallback)(()=>{J(pe(K)),M(!0)},[K]),ye=(0,L.useCallback)(()=>{M(!1),F(null)},[]),X=(0,L.useCallback)(e=>{if(!q)return;let t=H(),n={id:t,title:me(e),type:e,layout:{x:0,y:q.widgets?.length??0,w:q.columns??2,h:1}},r={...q,widgets:[...q.widgets||[],n]};J(r),Y(r),F(t)},[q,Y]),be=(0,L.useCallback)(e=>{if(!q)return;let t={...q,widgets:q.widgets.filter(t=>t.id!==e)};J(t),Y(t),P===e&&F(null)},[q,P,Y]),xe=(0,L.useCallback)(e=>{let t=q||K;if(!t)return;let n={...t,widgets:e};J(n),Y(n)},[q,K,Y]),Se=(q||K)??null,Z=(0,L.useMemo)(()=>new Set((W||[]).map(e=>e?.name).filter(Boolean)),[W]),Q=q||K,$=(0,L.useMemo)(()=>{if(!Q||Z.size===0)return Q;let e=Q.widgets;if(!Array.isArray(e)||e.length===0)return Q;let t=e.filter(e=>{let t=e?.requiresObject??e?.object;return t?Z.has(t):!0});return t.length===e.length?Q:{...Q,widgets:t}},[Q,Z]);return O?(0,R.jsx)(ue,{}):K?(0,R.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col sm:flex-row justify-between sm:items-center gap-3 sm:gap-4 p-4 sm:p-6 border-b shrink-0`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(()=>{let e=N(($||K).title,v),t=N(K.label,v),n=S({name:K.name,label:t});return(0,R.jsx)(`h1`,{className:`text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate`,children:e||n||K.name})})(),(()=>{let e=($||K).description??K.description,t=E({name:K.name,description:N(e,v)});return t?(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:t}):null})()]}),(0,R.jsxs)(`div`,{className:`shrink-0 flex items-center gap-1.5`,children:[A&&(0,R.jsx)(`div`,{className:`flex items-center gap-1 mr-2`,role:`toolbar`,"aria-label":`Add widgets`,"data-testid":`dashboard-widget-toolbar`,children:B.map(({type:e,label:t,Icon:n})=>(0,R.jsxs)(`button`,{type:`button`,"data-testid":`dashboard-add-${e}`,onClick:()=>X(e),className:`inline-flex items-center gap-1 rounded-md border border-input bg-background px-2 py-1.5 text-[11px] font-medium text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,title:`Add ${t}`,"aria-label":`Add ${t} widget`,children:[(0,R.jsx)(C,{className:`h-3 w-3`}),(0,R.jsx)(n,{className:`h-3 w-3`})]},e))}),D&&(0,R.jsxs)(`button`,{type:`button`,onClick:ve,className:`inline-flex items-center gap-1.5 rounded-md border border-input bg-background px-2.5 py-1.5 text-xs font-medium text-muted-foreground shadow-sm hover:bg-accent hover:text-accent-foreground`,"data-testid":`dashboard-edit-button`,children:[(0,R.jsx)(te,{className:`h-3.5 w-3.5`}),v(`common.edit`,{defaultValue:`Edit`})]})]})]}),(0,R.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-col sm:flex-row relative`,children:[(0,R.jsx)(`div`,{className:`flex-1 min-w-0 overflow-auto p-2 sm:p-4 md:p-6`,children:(0,R.jsx)(o,{value:{openRecordList:t},children:(0,R.jsx)(de,{schema:$,dataSource:e,designMode:A,selectedWidgetId:P,onWidgetClick:F,onWidgetsReorder:xe,modalHandler:U,scriptHandlers:he,hideHeaderText:!0})})}),(0,R.jsx)(fe,{open:A&&D,onClose:ye,schema:Se,selectedWidgetId:P,onSelectWidget:F,onSave:Y,onChange:J,onRemoveWidget:be,name:n,metadataClient:_,onAfterChange:()=>G().catch(()=>{})}),(0,R.jsx)(se,{open:i,sections:[{title:`Dashboard Configuration`,data:$}]})]}),I&&I.schema?.objectName?(0,R.jsx)(ne,{schema:{type:`object-form`,formType:`modal`,objectName:I.schema.objectName,mode:I.schema.mode||`create`,recordId:I.schema.recordId,title:I.schema.title,description:I.schema.description,fields:I.schema.fields,open:!0,onOpenChange:e=>{e||V({success:!1})},onSuccess:e=>{V({success:!0,reload:!0,data:e})},onCancel:()=>{V({success:!1})},showSubmit:!0,showCancel:!0},dataSource:h}):I?(0,R.jsx)(x,{open:!0,onOpenChange:e=>{e||V({success:!1})},children:(0,R.jsxs)(d,{children:[(0,R.jsxs)(m,{children:[(0,R.jsx)(w,{children:I.schema?.title||v(`actionDialog.defaultActionTitle`)}),I.schema?.description&&(0,R.jsx)(g,{children:I.schema.description})]}),(0,R.jsxs)(ee,{children:[(0,R.jsx)(y,{variant:`outline`,onClick:()=>V({success:!1}),children:v(`actionDialog.cancel`)}),(0,R.jsx)(y,{onClick:()=>V({success:!0}),children:v(`actionDialog.ok`)})]})]})}):null]}):(0,R.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,R.jsxs)(b,{children:[(0,R.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,R.jsx)(T,{className:`h-6 w-6 text-muted-foreground`})}),(0,R.jsx)(p,{children:v(`empty.dashboardNotFound`)}),(0,R.jsx)(u,{children:v(`empty.dashboardNotFoundDescription`,{name:n})})]})})}export{z as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{_ as t,t as n}from"./vendor-react-slxo-5GC.js";import{V as r,_ as i,f as a}from"./vendor-objectstack-sPlD8LgO.js";import{$s as o,Ac as s,Bn as c,Hn as l,In as u,Jt as d,Ks as f,Kt as p,Ls as m,Rn as h,Sr as g,Va as _,Vn as v,Ws as y,Xi as b,Xs as x,Xt as S,Ys as C,Yt as w,Zs as T,_o as E,ai as D,an as O,cn as k,es as A,fn as j,fs as M,kc as N,ki as P,kr as F,on as ee,or as te,po as ne,qr as re,qs as ie,qt as I,rs as ae,sn as oe,zn as L}from"./ui-components-DsYvPIox.js";import{r as R}from"./useMetadata-DAEfn7ks.js";import{F as se,I as ce,M as z,N as le,P as B,W as ue,_ as de,a as fe,g as pe,i as me,j as he,k as ge,p as _e,r as ve,t as V,y as H}from"./ReportDefaultInspector-OSqdhKEL.js";var U=e(t(),1),W=n();function ye(e,t){if(!t)return!0;let n=t.toLowerCase();return e.value.toLowerCase().includes(n)||e.label.toLowerCase().includes(n)||(e.group?.toLowerCase().includes(n)??!1)}function G({label:e,value:t,onCommit:n,options:r,placeholder:i=`Select…`,searchPlaceholder:a=`Search or type…`,emptyText:o=`No match — keep typing to use a custom value.`,disabled:d,loading:f,allowCustom:p=!0,mono:_,className:b}){let[x,S]=U.useState(!1),[C,w]=U.useState(``),T=r.find(e=>e.value===t),E=T?T.label:t||(f?`Loading…`:i),D=U.useMemo(()=>r.filter(e=>ye(e,C)),[r,C]),k=U.useMemo(()=>{let e=[],t=new Map;for(let n of D){let r=n.group??``;t.has(r)||(t.set(r,[]),e.push(r)),t.get(r).push(n)}return e.map(e=>({heading:e,items:t.get(e)}))},[D]),A=C.trim(),M=p&&!!A&&!r.some(e=>e.value===A),N=e=>{n(e),S(!1),w(``)},P=(0,W.jsxs)(O,{open:x,onOpenChange:e=>{S(e),e||w(``)},children:[(0,W.jsx)(oe,{asChild:!0,children:(0,W.jsxs)(g,{type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":x,disabled:d,className:s(`h-8 w-full justify-between px-2 text-sm font-normal`,b),children:[(0,W.jsx)(`span`,{className:s(`truncate`,_&&`font-mono`,!T&&!t&&`text-muted-foreground`),children:E}),(0,W.jsx)(m,{className:`ml-2 h-3.5 w-3.5 shrink-0 opacity-50`})]})}),(0,W.jsx)(ee,{align:`start`,className:`w-[var(--radix-popover-trigger-width)] min-w-[14rem] p-0`,children:(0,W.jsxs)(u,{shouldFilter:!1,children:[(0,W.jsx)(c,{value:C,onValueChange:w,placeholder:a}),(0,W.jsxs)(l,{children:[!M&&D.length===0&&(0,W.jsx)(h,{children:o}),M&&(0,W.jsx)(L,{children:(0,W.jsx)(v,{value:`__custom__${A}`,onSelect:()=>N(A),children:(0,W.jsxs)(`span`,{className:`truncate`,children:[`Use `,(0,W.jsxs)(`span`,{className:`font-mono`,children:[`“`,A,`”`]})]})})}),k.map((e,n)=>(0,W.jsx)(L,{heading:e.heading||void 0,children:e.items.map(e=>(0,W.jsxs)(v,{value:e.value,onSelect:()=>N(e.value),children:[(0,W.jsx)(y,{className:s(`h-3.5 w-3.5`,e.value===t?`opacity-100`:`opacity-0`)}),(0,W.jsx)(`span`,{className:`truncate font-mono`,children:e.value}),e.label&&e.label!==e.value&&(0,W.jsx)(`span`,{className:`ml-1 truncate text-muted-foreground`,children:e.label}),e.hint&&(0,W.jsx)(`span`,{className:`ml-auto pl-2 text-[10px] text-muted-foreground`,children:e.hint})]},e.value))},e.heading||`g${n}`))]})]})})]});return e?(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsx)(j,{className:`text-xs text-muted-foreground`,children:e}),P]}):P}var be=new Set([`lookup`,`master_detail`,`masterdetail`,`master-detail`]);function K(e,t){if(typeof e==`string`&&e)return e;if(e&&typeof e==`object`){let t=e.default;if(typeof t==`string`&&t)return t}return t}function xe(e){let t=e.reference??e.reference_to??e.referenceTo??e.reference_to_object;if(typeof t==`string`&&t)return t;if(Array.isArray(t)&&typeof t[0]==`string`)return t[0];if(t&&typeof t==`object`){let e=t.object;if(typeof e==`string`&&e)return e}}function Se(e){switch(e){case`lookup`:case`master_detail`:case`masterDetail`:case`master-detail`:return`lookup`;case`date`:case`datetime`:case`time`:return`date`;case`number`:case`currency`:case`percent`:case`int`:case`integer`:case`float`:case`double`:case`autonumber`:return`number`;case`boolean`:case`toggle`:return`boolean`;default:return`string`}}function q(e,t){if(!e)return{label:t,fields:[],relationships:[]};let n=K(e.label,t),r=ue(e.fields).entries.map(e=>({name:e.name,label:K(e.def.label,e.name),type:typeof e.def.type==`string`?e.def.type:void 0,def:e.def}));return{label:n,fields:r,relationships:r.filter(e=>e.type&&be.has(e.type.toLowerCase())).map(e=>({name:e.name,label:e.label,referenceTo:xe(e.def)}))}}function J(e,t,n){let r=e,i=[];for(let e of t.split(`.`)){let t=r.relationships.find(t=>t.name===e);if(!t?.referenceTo)return;let a=n[t.referenceTo];if(!a)return;i.push(t.label),r=a}return{target:r,labels:i}}function Ce(e,t,n){let r=e.fields.map(t=>({value:t.name,label:t.label,type:t.type,group:e.label}));for(let i of t){let t=J(e,i,n);if(!t)continue;let a=[...t.labels,t.target.label].join(` → `);for(let e of t.target.fields)r.push({value:`${i}.${e.name}`,label:e.label,type:e.type,group:a})}return r}function Y(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e))return e.some(e=>Y(e,t));let n=e;return typeof n.dataset==`string`&&n.dataset===t?!0:Object.values(n).some(e=>e&&typeof e==`object`&&Y(e,t))}function we(){let e=R(),[t,n]=U.useState({options:[],loading:!0});return U.useEffect(()=>{let t=!1;return n(e=>({...e,loading:!0})),e.list(`object`).then(e=>{t||n({options:(Array.isArray(e)?e:[]).map(e=>({name:typeof e.name==`string`?e.name:``,label:K(e.label,typeof e.name==`string`?e.name:``)})).filter(e=>!!e.name).sort((e,t)=>e.label.localeCompare(t.label)),loading:!1})}).catch(()=>{t||n({options:[],loading:!1})}),()=>{t=!0}},[e]),t}function Te(e,t){let n=R(),r=t.join(`\0`),[i,a]=U.useState({relationships:[],fieldOptions:[],loading:!!e});return U.useEffect(()=>{if(!e){a({relationships:[],fieldOptions:[],loading:!1});return}let t=!1;return a(e=>({...e,loading:!0})),(async()=>{try{let i=await n.get(`object`,e);if(t)return;let o=q(i,e),s=r?r.split(`\0`):[],c={[e]:o},l=async e=>{if(c[e])return c[e];let t;try{t=q(await n.get(`object`,e),e)}catch{t=q(null,e)}return c[e]=t,t};for(let e of s){let t=o;for(let n of e.split(`.`)){let e=t.relationships.find(e=>e.name===n);if(!e?.referenceTo)break;t=await l(e.referenceTo)}}if(t)return;let u=[...o.relationships];for(let e of s){if(e.split(`.`).length>=3)continue;let t=J(o,e,c);if(t)for(let n of t.target.relationships)u.push({name:`${e}.${n.name}`,label:`${e}.${n.name}`,referenceTo:n.referenceTo})}a({relationships:u,fieldOptions:Ce(o,s,c),loading:!1})}catch{t||a({relationships:[],fieldOptions:[],loading:!1})}})(),()=>{t=!0}},[n,e,r]),i}function Ee(e){let t=R(),[n,r]=U.useState({reports:0,dashboards:0,loading:!!e});return U.useEffect(()=>{if(!e){r({reports:0,dashboards:0,loading:!1});return}let n=!1;return r(e=>({...e,loading:!0})),(async()=>{let[i,a]=await Promise.all([t.list(`report`).catch(()=>[]),t.list(`dashboard`).catch(()=>[])]);n||r({reports:(Array.isArray(i)?i:[]).filter(t=>Y(t,e)).length,dashboards:(Array.isArray(a)?a:[]).filter(t=>Y(t,e)).length,loading:!1})})(),()=>{n=!0}},[t,e]),n}var X={metric:{id:`metric`,label:`Metric (KPI)`,category:`kpi`,icon:ne},bar:{id:`bar`,label:`Bar chart`,category:`chart`,icon:x},"horizontal-bar":{id:`horizontal-bar`,label:`Horizontal bar`,category:`chart`,icon:C},line:{id:`line`,label:`Line chart`,category:`chart`,icon:T},area:{id:`area`,label:`Area chart`,category:`chart`,icon:o},pie:{id:`pie`,label:`Pie chart`,category:`chart`,icon:ie},donut:{id:`donut`,label:`Donut chart`,category:`chart`,icon:A},scatter:{id:`scatter`,label:`Scatter plot`,category:`chart`,icon:f},funnel:{id:`funnel`,label:`Funnel`,category:`chart`,icon:re},table:{id:`table`,label:`Data table`,category:`data`,icon:D},pivot:{id:`pivot`,label:`Pivot table`,category:`data`,icon:ae},list:{id:`list`,label:`Record list`,category:`data`,icon:_},custom:{id:`custom`,label:`Custom widget`,category:`custom`,icon:M}},De={kpi:`Single value`,chart:`Charts`,data:`Tabular`,custom:`Custom`},Oe=[`kpi`,`chart`,`data`,`custom`].map(e=>({category:e,types:Object.values(X).filter(t=>t.category===e)})),ke=N;function Ae({onAdd:e,label:t=`Add widget`}){let[n,r]=U.useState(!1),[i,a]=U.useState(``),o=U.useRef(null),s=U.useRef(null);U.useEffect(()=>{if(!n){a(``);return}let e=e=>{o.current?.contains(e.target)||r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),queueMicrotask(()=>s.current?.focus()),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]);let c=U.useMemo(()=>{let e=i.trim().toLowerCase();return e?Oe.map(t=>({category:t.category,types:t.types.filter(t=>t.id.toLowerCase().includes(e)||t.label.toLowerCase().includes(e))})).filter(e=>e.types.length):Oe},[i]);return(0,W.jsxs)(`div`,{ref:o,className:`relative`,children:[(0,W.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded border border-dashed px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted/30 hover:text-foreground`,onClick:()=>r(e=>!e),children:[(0,W.jsx)(b,{className:`h-3 w-3`}),t]}),n&&(0,W.jsxs)(`div`,{className:`absolute right-0 top-full z-40 mt-1 w-72 rounded-md border bg-popover shadow-md`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 border-b px-2 py-1.5`,children:[(0,W.jsx)(P,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,W.jsx)(`input`,{ref:s,type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`Search widgets…`,className:`w-full bg-transparent text-xs outline-none placeholder:text-muted-foreground`})]}),(0,W.jsx)(`div`,{className:`max-h-72 overflow-auto py-1`,children:c.length===0?(0,W.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:`No matches.`}):c.map(t=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`px-3 pt-2 pb-1 text-[10px] uppercase tracking-wider text-muted-foreground`,children:De[t.category]}),t.types.map(t=>(0,W.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs hover:bg-accent`,onClick:()=>{e(t.id),r(!1)},children:[(0,W.jsx)(X[t.id]?.icon??ke,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,W.jsx)(`span`,{className:`font-medium truncate`,children:t.label}),(0,W.jsx)(`code`,{className:`ml-auto text-[10px] text-muted-foreground`,children:t.id})]},t.id))]},t.category))})]})]})}var je={io:`input`,unrepresentable:`any`},Me=new Set([`widgets`,`label`,`description`,`name`]),Z,Ne=!1;function Pe(){if(Z||Ne)return Z;try{Z=r(a,je)}catch(e){Ne=!0,typeof console<`u`&&console.warn(`[dashboard-schema] failed to derive Dashboard JSONSchema from spec`,e)}return Z}var Q;function Fe(){if(Q)return Q;if(!(!i||typeof i!=`object`)){try{let e=JSON.parse(JSON.stringify(i));for(let t of e.sections??[])t.fields=(t.fields??[]).filter(e=>{let t=typeof e==`string`?e:e?.field;return!Me.has(t)});e.sections=(e.sections??[]).filter(e=>(e.fields??[]).length>0),Q=e}catch(e){typeof console<`u`&&console.warn(`[dashboard-schema] failed to prepare dashboardForm from spec`,e);return}return Q}}var Ie=new Set([`name`,`label`,`description`,`widgets`]);function Le({draft:e,onPatch:t,readOnly:n,locale:r,onSelectionChange:i,serverSchema:a}){let o=U.useCallback(e=>H(e,r),[r]),s=typeof e.label==`string`?e.label:``,c=typeof e.description==`string`?e.description:``,l=U.useMemo(()=>Array.isArray(e.widgets)?e.widgets:[],[e.widgets]),u=e=>{let n=ce(`widget`,l.map(e=>e?.id).filter(Boolean)),r=X[e],a=r?`New ${r.label.toLowerCase()}`:`New widget`;t({widgets:le(l,{id:n,type:e,title:a,...r?.defaults??{}})}),i?.({kind:`widget`,id:n,label:a})},d=e=>{t({widgets:se(l,e,null)})},f=(e,n)=>{e!==n&&t({widgets:B(l,e,n)})},p=(e,t)=>{e?.id&&i?.({kind:`widget`,id:e.id,label:e.title||e.id||`Widget ${t+1}`})},[m,h]=U.useState(null),[_,v]=U.useState(null),{schema:y,form:b}=U.useMemo(()=>fe({bundledSchema:Pe(),bundledForm:Fe(),serverSchema:a,excludeFields:Ie,sectionTitle:H(`engine.inspector.moreFields`,r)}),[a,r]);return(0,W.jsxs)(he,{kindLabel:o(`engine.inspector.dashboard.kind`),title:String(s||e.name||o(`engine.inspector.dashboard.kind`)),onClose:()=>{},closeLabel:o(`engine.inspector.dashboard.close`),hideClose:!0,children:[(0,W.jsx)(z,{label:o(`engine.inspector.dashboard.label`),value:s,onCommit:e=>t({label:e}),placeholder:o(`engine.inspector.dashboard.labelPlaceholder`),disabled:n}),(0,W.jsx)(z,{label:o(`engine.inspector.dashboard.description`),value:c,onCommit:e=>t({description:e}),placeholder:o(`engine.inspector.dashboard.descriptionPlaceholder`),disabled:n}),(0,W.jsxs)(`div`,{className:`border-t pt-3 space-y-1.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(j,{className:`text-xs text-muted-foreground`,children:o(`engine.inspector.dashboard.widgets`)}),(0,W.jsx)(te,{variant:`outline`,className:`text-[10px]`,children:l.length})]}),l.length===0?(0,W.jsx)(`p`,{className:`rounded-md border border-dashed bg-muted/30 px-3 py-3 text-center text-[11px] text-muted-foreground`,children:o(`engine.inspector.dashboard.widgetsEmpty`)}):(0,W.jsx)(`div`,{className:`space-y-1`,children:l.map((e,t)=>{let r=X[e?.type]?.icon??ke;return(0,W.jsxs)(`div`,{draggable:!n,onDragStart:()=>h(t),onDragEnd:()=>{h(null),v(null)},onDragOver:e=>{e.preventDefault(),v(t)},onDrop:()=>{m!=null&&m!==t&&f(m,t),h(null),v(null)},className:`group flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs hover:bg-accent`+(_===t&&m!==null&&m!==t?` border-primary`:``),children:[!n&&(0,W.jsx)(E,{className:`h-3.5 w-3.5 shrink-0 cursor-grab text-muted-foreground`}),(0,W.jsx)(r,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,W.jsx)(`button`,{type:`button`,className:`min-w-0 flex-1 truncate text-left font-medium`,onClick:()=>p(e,t),title:e?.title||e?.id,children:e?.title||e?.id||`Widget ${t+1}`}),(0,W.jsx)(`code`,{className:`text-[10px] text-muted-foreground`,children:e?.type}),!n&&(0,W.jsx)(g,{type:`button`,variant:`ghost`,size:`sm`,className:`h-6 w-6 shrink-0 p-0 opacity-0 group-hover:opacity-100`,onClick:()=>d(t),title:o(`engine.inspector.dashboard.removeWidget`),"aria-label":o(`engine.inspector.dashboard.removeWidget`),children:(0,W.jsx)(F,{className:`h-3.5 w-3.5`})})]},e?.id??t)})}),!n&&(0,W.jsx)(Ae,{onAdd:u,label:o(`engine.inspector.add.widget`)})]}),(0,W.jsx)(`div`,{className:`border-t pt-3`,children:y?(0,W.jsx)(_e,{schema:y,form:b,value:e,hiddenFields:[`name`,`label`,`description`,`widgets`],readOnly:n,onChange:e=>t(e)}):(0,W.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:o(`engine.inspector.dashboard.noSchema`)})})]})}var Re=[{value:`metric`,label:`KPI Metric`},{value:`bar`,label:`Bar Chart`},{value:`line`,label:`Line Chart`},{value:`pie`,label:`Pie Chart`},{value:`table`,label:`Table`},{value:`grid`,label:`Grid`}],ze=[`count`,`sum`,`avg`,`min`,`max`],Be=[`default`,`blue`,`teal`,`orange`,`purple`,`success`,`warning`,`danger`];function Ve(e,t){let n=Array.isArray(e.widgets)?e.widgets:[],r=n.findIndex(e=>e?.id===t);return r<0?null:{widget:n[r],index:r}}function He({draft:e,selection:t,onPatch:n,onClearSelection:r,onSelectionChange:i,readOnly:a,locale:o}){let s=Array.isArray(e.widgets)?e.widgets:[],c=t.kind===`widget`?t.id:void 0,l=c?Ve(e,c):null,u=l?.widget??{},f=typeof u.dataset==`string`?u.dataset:``,m=typeof u.object==`string`?u.object:``,h=Array.isArray(u.dimensions)?u.dimensions.filter(e=>typeof e==`string`):[],_=Array.isArray(u.values)?u.values.filter(e=>typeof e==`string`):[],v=ve(),y=me(f||void 0,v),{options:b,loading:x}=we(),{fields:C}=pe(m||void 0),T=U.useMemo(()=>{let e=v.datasets.map(e=>({value:e.name,label:e.label&&e.label!==e.name?`${e.label} (${e.name})`:e.name}));return f&&!e.some(e=>e.value===f)&&e.push({value:f,label:f}),e},[v.datasets,f]),E=U.useMemo(()=>b.map(e=>({value:e.name,label:e.label})),[b]),D=U.useMemo(()=>C.map(e=>({value:e.name,label:e.label,hint:e.type})),[C]),O=U.useMemo(()=>y.measures.map(e=>({name:e.name,label:e.aggregate?`${e.name} · ${e.aggregate}`:e.name,type:`number`,hidden:!1})),[y.measures]),A=U.useMemo(()=>y.dimensions.map(e=>({name:e.name,label:e.name,type:e.type??`text`,hidden:!1})),[y.dimensions]);if(t.kind!==`widget`)return(0,W.jsx)(Ue,{message:`Unsupported selection kind: ${t.kind}`,onClose:r,locale:o});if(!l)return(0,W.jsx)(Ue,{message:`The selected widget was removed from the draft.`,onClose:r,locale:o});let{widget:j,index:M}=l;function N(e){let t=[...s];t[M]={...t[M],...e},n({widgets:t})}function P(e){n({widgets:B(s,M,e)}),j.id&&i?.({kind:`widget`,id:j.id,label:j.title??void 0})}return(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:H(`engine.inspector.widget.kind`,o)}),(0,W.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:j.title||t.label||`Widget ${M+1}`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,W.jsx)(ge,{index:M,total:s.length,onMove:P,upLabel:H(`engine.inspector.reorder.up`,o),downLabel:H(`engine.inspector.reorder.down`,o),disabled:a}),(0,W.jsx)(g,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:r,title:H(`engine.inspector.widget.close`,o),"aria-label":H(`engine.inspector.widget.close`,o),children:(0,W.jsx)(F,{className:`h-3.5 w-3.5`})})]})]}),(0,W.jsx)($,{id:`widget-title`,label:H(`engine.inspector.widget.title`,o),children:(0,W.jsx)(k,{id:`widget-title`,value:j.title??``,onChange:e=>N({title:e.target.value}),disabled:a})}),(0,W.jsx)($,{id:`widget-type`,label:H(`engine.inspector.widget.type`,o),children:(0,W.jsxs)(p,{value:j.type??`metric`,onValueChange:e=>N({type:e}),disabled:a,children:[(0,W.jsx)(w,{id:`widget-type`,children:(0,W.jsx)(S,{})}),(0,W.jsx)(I,{children:Re.map(e=>(0,W.jsx)(d,{value:e.value,children:e.label},e.value))})]})}),(0,W.jsxs)(`div`,{className:`space-y-3 rounded-md border border-dashed border-primary/40 bg-primary/5 p-3`,children:[(0,W.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-primary/80`,children:H(`engine.inspector.widget.datasetSection`,o)}),(0,W.jsxs)($,{id:`widget-dataset`,label:H(`engine.inspector.widget.dataset`,o),children:[(0,W.jsx)(G,{value:f,onCommit:e=>N({dataset:e||void 0}),options:T,loading:v.loading,placeholder:H(`engine.inspector.widget.datasetPlaceholder`,o),searchPlaceholder:H(`engine.inspector.widget.datasetPlaceholder`,o),disabled:a,mono:!0}),(0,W.jsx)(`p`,{className:`text-[10px] leading-snug text-muted-foreground`,children:H(`engine.inspector.widget.datasetHint`,o)})]}),f&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(V,{label:H(`engine.inspector.widget.dimensions`,o),emptyText:H(`engine.inspector.widget.dimensionsHint`,o),names:h,options:A,loading:y.loading,error:y.error,readOnly:a,onCommit:e=>N({dimensions:e})}),(0,W.jsx)(V,{label:H(`engine.inspector.widget.values`,o),emptyText:H(`engine.inspector.widget.valuesHint`,o),names:_,options:O,loading:y.loading,error:y.error,readOnly:a,onCommit:e=>N({values:e})})]})]}),(0,W.jsx)($,{id:`widget-object`,label:H(`engine.inspector.widget.object`,o),children:(0,W.jsx)(G,{value:j.object??``,onCommit:e=>N({object:e||void 0}),options:E,loading:x,placeholder:`Select an object…`,searchPlaceholder:`Search objects…`,disabled:a,mono:!0})}),(0,W.jsx)($,{id:`widget-value-field`,label:H(`engine.inspector.widget.valueField`,o),children:(0,W.jsx)(G,{value:j.valueField??``,onCommit:e=>N({valueField:e||void 0}),options:D,placeholder:j.object?`Select a field…`:`e.g. amount`,searchPlaceholder:`Search fields…`,disabled:a,mono:!0})}),(0,W.jsx)($,{id:`widget-category-field`,label:H(`engine.inspector.widget.categoryField`,o),children:(0,W.jsx)(G,{value:j.categoryField??``,onCommit:e=>N({categoryField:e||void 0}),options:D,placeholder:j.object?`Select a field…`:`e.g. status`,searchPlaceholder:`Search fields…`,disabled:a,mono:!0})}),(0,W.jsx)($,{id:`widget-aggregate`,label:H(`engine.inspector.widget.aggregate`,o),children:(0,W.jsxs)(p,{value:j.aggregate??`count`,onValueChange:e=>N({aggregate:e}),disabled:a,children:[(0,W.jsx)(w,{id:`widget-aggregate`,children:(0,W.jsx)(S,{})}),(0,W.jsx)(I,{children:ze.map(e=>(0,W.jsx)(d,{value:e,children:e},e))})]})}),(0,W.jsx)($,{id:`widget-color`,label:H(`engine.inspector.widget.color`,o),children:(0,W.jsx)(de,{value:j.colorVariant??`default`,onChange:e=>N({colorVariant:e}),disabled:a,options:Be.map(e=>({value:e}))})}),(0,W.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,W.jsx)($,{id:`widget-w`,label:H(`engine.inspector.widget.width`,o),children:(0,W.jsx)(k,{id:`widget-w`,type:`number`,min:1,value:j.layout?.w??1,onChange:e=>N({layout:{...j.layout??{},w:Number(e.target.value)||1}}),disabled:a})}),(0,W.jsx)($,{id:`widget-h`,label:H(`engine.inspector.widget.height`,o),children:(0,W.jsx)(k,{id:`widget-h`,type:`number`,min:1,value:j.layout?.h??1,onChange:e=>N({layout:{...j.layout??{},h:Number(e.target.value)||1}}),disabled:a})})]}),!a&&(0,W.jsx)(`div`,{className:`pt-2 border-t`,children:(0,W.jsx)(g,{type:`button`,variant:`outline`,size:`sm`,className:`w-full text-destructive hover:text-destructive`,onClick:()=>{let t=Array.isArray(e.widgets)?[...e.widgets]:[];t.splice(M,1),n({widgets:t}),r()},children:H(`engine.inspector.widget.remove`,o)})})]})}function $({id:e,label:t,children:n}){return(0,W.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,W.jsx)(j,{htmlFor:e,className:`text-xs font-medium text-muted-foreground`,children:t}),n]})}function Ue({message:e,onClose:t,locale:n}){return(0,W.jsxs)(`div`,{className:`space-y-3 rounded-md border border-dashed p-4 text-sm text-muted-foreground`,children:[(0,W.jsx)(`p`,{children:e}),(0,W.jsx)(g,{type:`button`,variant:`outline`,size:`sm`,onClick:t,children:H(`engine.inspector.widget.close`,n)})]})}export{Se as a,we as c,X as i,G as l,Le as n,Te as o,Ae as r,Ee as s,He as t};
@@ -1 +0,0 @@
1
- import{f as e,t,u as n}from"./vendor-react-slxo-5GC.js";import{Io as r,Zi as i,er as a,ir as o,jr as s,nr as c,rr as l,ti as u,tr as d}from"./ui-components-DsYvPIox.js";var f=t();function p(){let t=n(),{appName:p}=e(),m=p?`/apps/${p}`:``,h=[{title:`Integrations & APIs`,description:`Your app as a REST API — base URL, endpoints, and connect samples`,icon:i,href:`${m}/developer/integrations`},{title:`API Console`,description:`Inspect and exercise REST endpoints with auto-discovered services`,icon:u,href:`${m}/developer/api-console`},{title:`Flow Runs`,description:`Trigger flows with sample inputs and inspect recent run history`,icon:s,href:`${m}/developer/flow-runs`},{title:`Public Forms`,description:`Publish, share, and embed FormViews available to anonymous users`,icon:r,href:`${m}/developer/public-forms`}];return(0,f.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6`,children:[(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`Developer`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Tools for building, debugging, and sharing ObjectStack apps`})]}),(0,f.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:h.map(e=>{let n=e.icon;return(0,f.jsxs)(a,{className:`cursor-pointer transition-colors hover:bg-accent/50`,onClick:()=>t(e.href),"data-testid":`hub-card-${e.title.toLowerCase().replace(/\s+/g,`-`)}`,role:`link`,tabIndex:0,"aria-label":`${e.title}: ${e.description}`,onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),t(e.href))},children:[(0,f.jsxs)(l,{className:`flex flex-row items-center gap-3 pb-2`,children:[(0,f.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,f.jsx)(n,{className:`h-5 w-5`})}),(0,f.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,f.jsx)(o,{className:`text-base`,children:e.title}),(0,f.jsx)(c,{className:`text-xs`,children:e.description})]})]}),(0,f.jsx)(d,{className:`pt-0`})]},e.title)})})]})}export{p as DeveloperHubPage};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{_ as t,t as n}from"./vendor-react-slxo-5GC.js";import{L as r}from"./framework-B9PMswdm.js";import{Ba as i,Bt as a,Cs as o,Fs as s,Hi as c,Ht as l,Ms as u,Qi as d,Rt as f,Sr as p,Ut as m,Vt as h,Wt as g,Zt as _,_s as v,_t as y,cn as b,er as x,fn as S,ft as C,gt as w,ht as T,ir as E,jr as D,mt as O,nr as k,or as A,pt as j,rr as M,st as N,tr as P,vt as F}from"./ui-components-DsYvPIox.js";import"./src-CCztNT-4.js";var I=e(t(),1),L=n();function R({status:e}){let t={success:{icon:u,cls:`text-emerald-600 border-emerald-300`},completed:{icon:u,cls:`text-emerald-600 border-emerald-300`},failed:{icon:o,cls:`text-red-600 border-red-300`},error:{icon:o,cls:`text-red-600 border-red-300`},running:{icon:i,cls:`text-blue-600 border-blue-300 animate-pulse`},pending:{icon:v,cls:`text-amber-600 border-amber-300`},skipped:{icon:s,cls:`text-muted-foreground`}}[e]??{icon:s,cls:`text-muted-foreground`},n=t.icon;return(0,L.jsxs)(A,{variant:`outline`,className:`text-[10px] font-mono inline-flex items-center gap-1 ${t.cls}`,children:[(0,L.jsx)(n,{className:`h-3 w-3`}),e]})}function z(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function B(e,t){switch(t){case`number`:{if(e===``)return;let t=Number(e);return Number.isNaN(t)?e:t}case`boolean`:return e===`true`;case`object`:case`list`:case`array`:if(e.trim()===``)return;try{return JSON.parse(e)}catch{return e}default:return e}}function V({data:e}){return(0,L.jsx)(`pre`,{className:`rounded border bg-muted/30 p-2 text-xs font-mono overflow-auto whitespace-pre-wrap break-all max-h-96`,children:JSON.stringify(e,null,2)})}function H(){let e=r()?.getClient?.(),[t,n]=(0,I.useState)([]),[i,a]=(0,I.useState)(!0),[o,s]=(0,I.useState)(null),[l,u]=(0,I.useState)(``),[d,m]=(0,I.useState)(0),h=(0,I.useCallback)(async()=>{if(!e?.meta?.getItems){s(`meta.getItems is not available on this client`),a(!1);return}a(!0),s(null);try{let t=await e.meta.getItems(`flow`),r=(Array.isArray(t)?t:Array.isArray(t?.items)?t.items:Array.isArray(t?.value)?t.value:[]).map(e=>({name:e?.spec?.name??e?.name,label:e?.spec?.label,spec:e?.spec??e,updatedAt:e?.updatedAt??e?.updated_at})).filter(e=>e.name);n(r),!l&&r.length>0&&u(r[0].name)}catch(e){s(e?.message??String(e))}finally{a(!1)}},[e,l]);(0,I.useEffect)(()=>{h()},[h]);let g=(0,I.useMemo)(()=>t.find(e=>e.name===l)??null,[t,l]);return(0,L.jsxs)(`div`,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight flex items-center gap-2`,children:[(0,L.jsx)(D,{className:`h-5 w-5`}),`Flow Runs`]}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Pick a flow, trigger a test run with sample inputs, and inspect recent run history`})]}),(0,L.jsxs)(x,{children:[(0,L.jsx)(M,{className:`pb-3`,children:(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(E,{className:`text-base`,children:`Flow`}),(0,L.jsx)(k,{children:`Select a flow definition to test`})]}),(0,L.jsxs)(p,{variant:`outline`,size:`sm`,onClick:h,disabled:i,children:[(0,L.jsx)(c,{className:`h-3.5 w-3.5 mr-2 ${i?`animate-spin`:``}`}),`Refresh`]})]})}),(0,L.jsxs)(P,{children:[i&&(0,L.jsx)(f,{className:`h-9 w-72`}),o&&(0,L.jsx)(`p`,{className:`text-sm text-red-500 font-mono break-all`,children:o}),!i&&!o&&t.length===0&&(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No flow definitions found.`}),!i&&!o&&t.length>0&&(0,L.jsx)(`select`,{value:l,onChange:e=>u(e.target.value),className:`flex h-9 w-full max-w-md rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm focus:outline-none focus:ring-1 focus:ring-ring`,children:t.map(e=>(0,L.jsx)(`option`,{value:e.name,children:e.label?`${e.label} (${e.name})`:e.name},e.name))})]})]}),g&&(0,L.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,L.jsx)(U,{client:e,flow:g.spec,onExecuted:()=>m(e=>e+1)}),(0,L.jsx)(W,{client:e,flowName:g.name,refreshKey:d})]})]})}function U({client:e,flow:t,onExecuted:n}){let r=(0,I.useMemo)(()=>(t?.variables??[]).filter(e=>e?.isInput),[t]),[a,s]=(0,I.useState)({}),[c,l]=(0,I.useState)(!1),[f,m]=(0,I.useState)(null),[h,g]=(0,I.useState)(null);(0,I.useEffect)(()=>{s({}),m(null),g(null)},[t?.name]);let _=(e,t)=>s(n=>({...n,[e]:t}));return(0,L.jsxs)(x,{children:[(0,L.jsxs)(M,{className:`pb-3`,children:[(0,L.jsx)(E,{className:`text-base`,children:`Test Run`}),(0,L.jsx)(k,{children:`Provide input values and invoke the flow`})]}),(0,L.jsxs)(P,{className:`space-y-3`,children:[r.length===0&&(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This flow declares no input variables. Click Run to invoke with no parameters.`}),r.map(e=>(0,L.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,L.jsxs)(S,{htmlFor:`var-${e.name}`,className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`font-mono text-xs`,children:e.name}),(0,L.jsx)(A,{variant:`outline`,className:`text-[10px] font-mono`,children:e.type})]}),e.type===`boolean`?(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(F,{id:`var-${e.name}`,checked:a[e.name]===`true`,onCheckedChange:t=>_(e.name,t?`true`:`false`)}),(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a[e.name]===`true`?`true`:`false`})]}):e.type===`object`||e.type===`list`||e.type===`array`?(0,L.jsx)(N,{id:`var-${e.name}`,placeholder:`JSON ${e.type}`,value:a[e.name]??``,onChange:t=>_(e.name,t.target.value),className:`font-mono text-xs min-h-[80px]`}):(0,L.jsx)(b,{id:`var-${e.name}`,type:e.type===`number`?`number`:`text`,value:a[e.name]??``,onChange:t=>_(e.name,t.target.value)})]},e.name)),(0,L.jsx)(`div`,{className:`pt-1`,children:(0,L.jsxs)(p,{onClick:async()=>{if(!e?.automation?.execute){g(`automation.execute is not available on this client`);return}l(!0),g(null),m(null);try{let i={};for(let e of r){let t=a[e.name];t!==void 0&&(i[e.name]=B(t,e.type))}m(await e.automation.execute(t.name,{params:i})),n?.()}catch(e){g(e?.message??String(e))}finally{l(!1)}},disabled:c,size:`sm`,children:[c?(0,L.jsx)(i,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,L.jsx)(d,{className:`h-3.5 w-3.5 mr-2`}),c?`Running…`:`Run Flow`]})}),(f||h)&&(0,L.jsxs)(`div`,{className:`pt-2 border-t mt-2 space-y-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[h||f?.success===!1?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(o,{className:`h-4 w-4 text-red-500`}),` Failed`]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(u,{className:`h-4 w-4 text-emerald-500`}),` Result`]}),typeof f?.durationMs==`number`&&(0,L.jsxs)(A,{variant:`secondary`,className:`text-[10px] font-mono`,children:[f.durationMs,` ms`]})]}),h&&(0,L.jsx)(`p`,{className:`text-sm text-red-500 font-mono break-all`,children:h}),f&&(0,L.jsx)(V,{data:f})]})]})]})}function W({client:e,flowName:t,refreshKey:n}){let[r,o]=(0,I.useState)([]),[s,u]=(0,I.useState)(!0),[d,v]=(0,I.useState)(null),[b,S]=(0,I.useState)(null),[D,N]=(0,I.useState)(null),[F,B]=(0,I.useState)(!1),[H,U]=(0,I.useState)(null),W=(0,I.useCallback)(async()=>{if(!e?.automation?.listRuns){v(`automation.listRuns is not available on this client`),u(!1);return}u(!0),v(null);try{let n=await e.automation.listRuns(t,{limit:20});o(Array.isArray(n)?n:n?.items??n?.runs??[])}catch(e){v(e?.message??String(e))}finally{u(!1)}},[e,t]);(0,I.useEffect)(()=>{W()},[W,n]);let G=async n=>{S(n),N(null),U(null),B(!0);try{let r=await e.automation.getRun(t,n);N(r?.run??r)}catch(e){U(e?.message??String(e))}finally{B(!1)}};return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(x,{children:[(0,L.jsx)(M,{className:`pb-3`,children:(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(E,{className:`text-base`,children:`Recent Runs`}),(0,L.jsx)(k,{className:`font-mono text-xs`,children:t})]}),(0,L.jsxs)(p,{variant:`outline`,size:`sm`,onClick:W,disabled:s,children:[s?(0,L.jsx)(i,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,L.jsx)(c,{className:`h-3.5 w-3.5 mr-2`}),`Refresh`]})]})}),(0,L.jsxs)(P,{children:[s&&(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(f,{className:`h-8 w-full`}),(0,L.jsx)(f,{className:`h-8 w-full`}),(0,L.jsx)(f,{className:`h-8 w-full`})]}),!s&&d&&(0,L.jsx)(`p`,{className:`text-sm text-red-500 font-mono break-all`,children:d}),!s&&!d&&r.length===0&&(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground py-6 text-center`,children:`No runs yet. Use the Test Run panel to invoke this flow.`}),!s&&!d&&r.length>0&&(0,L.jsxs)(C,{children:[(0,L.jsx)(w,{children:(0,L.jsxs)(y,{children:[(0,L.jsx)(T,{children:`Run`}),(0,L.jsx)(T,{children:`Status`}),(0,L.jsx)(T,{children:`Started`}),(0,L.jsx)(T,{className:`text-right`,children:`Duration`})]})}),(0,L.jsx)(j,{children:r.map(e=>(0,L.jsxs)(y,{className:`cursor-pointer`,onClick:()=>G(e.id),children:[(0,L.jsxs)(O,{className:`font-mono text-xs`,children:[e.id.slice(0,12),`…`]}),(0,L.jsx)(O,{children:(0,L.jsx)(R,{status:e.status})}),(0,L.jsx)(O,{className:`text-xs text-muted-foreground`,children:z(e.startedAt)}),(0,L.jsx)(O,{className:`text-right font-mono text-xs`,children:typeof e.durationMs==`number`?`${e.durationMs} ms`:`—`})]},e.id))})]})]})]}),(0,L.jsx)(a,{open:!!b,onOpenChange:e=>{e||(S(null),N(null))},children:(0,L.jsxs)(h,{side:`right`,className:`w-full sm:max-w-2xl p-0 flex flex-col`,children:[(0,L.jsxs)(m,{className:`p-4 border-b`,children:[(0,L.jsxs)(g,{className:`font-mono text-sm break-all`,children:[`Run `,b]}),(0,L.jsx)(l,{children:D&&(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,L.jsx)(R,{status:D.status}),typeof D.durationMs==`number`&&(0,L.jsxs)(A,{variant:`secondary`,className:`text-[10px] font-mono`,children:[D.durationMs,` ms`]}),(0,L.jsx)(`span`,{className:`text-xs`,children:z(D.startedAt)})]})})]}),(0,L.jsxs)(_,{className:`flex-1 p-4`,children:[F&&(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(f,{className:`h-16 w-full`}),(0,L.jsx)(f,{className:`h-16 w-full`}),(0,L.jsx)(f,{className:`h-16 w-full`})]}),H&&(0,L.jsx)(`p`,{className:`text-sm text-red-500 font-mono break-all`,children:H}),!F&&D&&(0,L.jsx)(`div`,{className:`space-y-3`,children:Array.isArray(D.steps)&&D.steps.length>0?D.steps.map((e,t)=>(0,L.jsxs)(`div`,{className:`rounded-md border p-3 space-y-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,L.jsxs)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:[`#`,t+1]}),(0,L.jsx)(`span`,{className:`font-mono text-sm font-medium`,children:e.nodeLabel||e.nodeId}),e.nodeType&&(0,L.jsx)(A,{variant:`outline`,className:`text-[10px] font-mono`,children:e.nodeType}),(0,L.jsx)(R,{status:e.status}),typeof e.durationMs==`number`&&(0,L.jsxs)(A,{variant:`secondary`,className:`text-[10px] font-mono ml-auto`,children:[e.durationMs,` ms`]})]}),e.input!==void 0&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground mb-1`,children:`Input`}),(0,L.jsx)(V,{data:e.input})]}),e.output!==void 0&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground mb-1`,children:`Output`}),(0,L.jsx)(V,{data:e.output})]}),e.error&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`text-[10px] uppercase text-red-500 mb-1`,children:`Error`}),(0,L.jsx)(V,{data:e.error})]})]},`${e.nodeId}-${t}`)):(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground mb-1`,children:`Run`}),(0,L.jsx)(V,{data:D})]})})]})]})})]})}export{H as FlowRunsPage};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{_ as t,p as n,t as r,u as i}from"./vendor-react-slxo-5GC.js";import{L as a,R as o,Y as s,l as c,q as l}from"./framework-B9PMswdm.js";import{G as u,J as d,V as f,W as p,rs as m}from"./ui-components-DsYvPIox.js";import"./MetadataProvider-MNkZn-bR.js";import{t as h}from"./RecordDetailView-Ba0xool8.js";import{l as g}from"./plugins-views-CxFTNQJ7.js";var _=e(t(),1),v=`uf_`;function y(e){let t={};return e.forEach((e,n)=>{if(n.startsWith(v)&&e!==``){let r=n.slice(3);t[r]=e.split(`,`).map(e=>{try{return decodeURIComponent(e)}catch{return e}})}}),Object.keys(t).length>0?t:void 0}function b(e,t){let n=new URLSearchParams(e);for(let[e,r]of Object.entries(t)){let t=v+e;r&&r.length>0?n.set(t,r.map(e=>encodeURIComponent(String(e))).join(`,`)):n.delete(t)}return n}var x=r();function S(e){return Array.isArray(e?.columns)&&e.columns.length>0}function C(e,t){let n=e?.listViews||e?.list_views||{},r=(t?[n[`${e?.name}.${t}`],n[t],...t==="default"||t===`list`?[e?.list]:[]]:[e?.list,...Object.values(n)]).filter(Boolean);return r.find(S)??r[0]}var w=new Set([`id`,`created_at`,`createdAt`,`updated_at`,`updatedAt`,`deleted_at`,`deletedAt`,`created_by`,`createdBy`,`updated_by`,`updatedBy`,`_version`,`_rev`]);function T(e){let t=e?.highlightFields;if(Array.isArray(t)&&t.length>0)return t.filter(t=>e.fields?.[t]);let n=e?.fields;return n&&typeof n==`object`?Object.entries(n).filter(([e,t])=>t&&!t.hidden&&!w.has(e)).map(([e])=>e).slice(0,6):[]}function E(e,t){let n=e?.fields;if(!(!n||typeof n!=`object`))return Object.entries(n).find(([e,n])=>n&&!n.hidden&&!w.has(e)&&t(e,n))?.[0]}var D=new Set([`select`,`multiselect`,`radio`,`enum`,`boolean`]),O=new Set([`date`,`datetime`,`time`]),k=new Set([`image`,`file`,`attachment`,`avatar`,`photo`]);function A(e){let t=E(e,(e,t)=>D.has(t.type))??E(e,e=>/status|stage|state|priority|category|kind/i.test(e));return t?{groupField:t,groupByField:t}:void 0}function j(e){return E(e,(e,t)=>O.has(t.type))??E(e,e=>/date|due|start|end|deadline|schedule/i.test(e))}function M(e){let t=j(e);return t?{startDateField:t}:void 0}function N(e){let t=E(e,(e,t)=>k.has(t.type));return t?{coverField:t}:void 0}var P=new Set([`location`,`geo`,`geolocation`,`geopoint`,`point`]);function F(e){let t=E(e,(e,t)=>O.has(t.type)&&/start|begin|kickoff/i.test(e))??E(e,(e,t)=>O.has(t.type));if(!t)return;let n=E(e,(e,n)=>O.has(n.type)&&e!==t&&/end|due|finish|deadline|close/i.test(e))??E(e,(e,n)=>O.has(n.type)&&e!==t);if(!n)return;let r=E(e,(e,t)=>(t.type===`number`||t.type===`percent`)&&/progress|percent|complete/i.test(e));return{startDateField:t,endDateField:n,...r?{progressField:r}:{}}}function I(e){let t=E(e,(e,t)=>P.has(t.type))??E(e,e=>/location|address|geo|coords?|place|venue/i.test(e));return t?{locationField:t}:void 0}function L({page:e,className:t,onConfigChange:r,reserveEditAffordance:v}){let{t:w}=c(),{objects:E}=o(),D=a(),O=i(),[k,j]=n(),[P]=_.useState(()=>y(new URLSearchParams(window.location.search))),L=_.useCallback(e=>{j(t=>b(t,e),{replace:!0})},[j]),R=e?.interfaceConfig||{},z=_.useMemo(()=>(E||[]).find(e=>e.name===R.source),[E,R.source]),B=_.useMemo(()=>C(z,R.sourceView),[z,R.sourceView]),V=R.recordAction===`page`||R.recordAction===`modal`||R.recordAction===`none`?R.recordAction:`drawer`,H=_.useCallback(e=>`/apps/${window.location.pathname.split(`/`)[2]||``}/${R.source}/record/${encodeURIComponent(String(e))}`,[R.source]),U=l({navigation:{mode:V===`none`?`none`:V},objectName:R.source,onNavigate:e=>O(H(e))}),W=k.get(`recordId`),G=_.useCallback((e,t)=>{if(V===`none`)return;let n=e?.id??e?._id;if(t&&(t.metaKey||t.ctrlKey||t.button===1)&&n!=null){window.open(H(n),`_blank`);return}if((V===`drawer`||V===`modal`)&&n!=null){j(e=>{let t=new URLSearchParams(e);return t.set(`recordId`,String(n)),t});return}U.handleClick(e,t)},[V,H,U,j]),ee=_.useCallback(()=>{j(e=>{let t=new URLSearchParams(e);return t.delete(`recordId`),t})},[j]);_.useEffect(()=>{W&&!U.isOpen?U.open({id:W}):!W&&U.isOpen&&U.close()},[W]);let K=z?.name,q=!!B&&!S(B),J=B?.name??(R.sourceView?`${R.source}.${R.sourceView}`:void 0),[Y,X]=_.useState(null);_.useEffect(()=>{let e=!1;if(X(null),!(!K||!R.source||!q||!J))return(async()=>{try{let t=D,n=null;typeof t?.listViewOverrides==`function`&&(n=(await t.listViewOverrides(R.source))?.[J]??null),!S(n)&&typeof t?.getView==`function`&&(n=await t.getView(R.source,J)),!e&&n&&typeof n==`object`&&X(n)}catch{}})(),()=>{e=!0}},[K,R.source,R.sourceView,q,J,D]);let Z=_.useMemo(()=>Y?{...B,...Y}:B,[B,Y]),te=JSON.stringify(Z??null),Q=_.useMemo(()=>{if(!z)return;let e=Z||{},t=R.appearance??e.appearance,n=t?.allowedVisualizations||[],r=new Set(n),i=R.userActions||{},a=e.kanban??(r.has(`kanban`)?A(z):void 0),o=e.calendar??(r.has(`calendar`)?M(z):void 0),s=e.timeline??(r.has(`timeline`)?M(z):void 0),c=e.gallery??(r.has(`gallery`)?N(z):void 0),l=e.gantt??(r.has(`gantt`)?F(z):void 0),u=e.options?.map??(r.has(`map`)?I(z):void 0),d=[...Array.isArray(e.filter)?e.filter:[],...Array.isArray(R.filterBy)?R.filterBy:[]],f=S(R)?R.columns:S(e)?e.columns:T(z),p=Array.isArray(R.sort)&&R.sort.length?R.sort:e.sort;return{type:`list-view`,objectName:z.name,viewType:n[0]??e.type??`grid`,fields:f,...d.length?{filters:d}:{},...p?.length?{sort:p}:{},grouping:e.grouping,rowColor:e.rowColor,pagination:e.pagination,searchableFields:e.searchableFields,emptyState:e.emptyState,kanban:a,calendar:o,gallery:c,timeline:s,gantt:l,...u||e.options?{options:{...e.options??{},...u?{map:u}:{}}}:{},userFilters:R.userFilters??e.userFilters,appearance:t,showViewSwitcher:n.length>1,showRecordCount:R.showRecordCount,addRecord:R.addRecord,showSearch:i.search!==!1,showSort:i.sort!==!1,showFilters:i.filter===!0,showDensity:i.rowHeight===!0,showHideFields:!1,showGroup:!1,showColor:!1,allowExport:!1,inlineEdit:i.editInline===!0}},[K,te,R]);if(!z||!Q)return(0,x.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,x.jsxs)(p,{children:[(0,x.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,x.jsx)(m,{className:`h-6 w-6 text-muted-foreground`})}),(0,x.jsx)(d,{children:w(`empty.objectNotFound`,{defaultValue:`Source object not found`})}),(0,x.jsx)(u,{children:w(`empty.interfacePageSourceMissing`,{defaultValue:`This interface page references "{{name}}", which is not available.`,name:R.source||`?`})})]})});let $=Array.isArray(R.buttons)&&R.buttons.length?R.buttons.map(e=>(z.actions||[]).find(t=>t?.name===e)).filter(Boolean).map(e=>({...e,locations:[`list_toolbar`]})):[];return(0,x.jsxs)(`div`,{className:t??`h-full flex flex-col`,"data-testid":`interface-list-page`,children:[(0,x.jsxs)(`div`,{className:`pl-4 pt-4 pb-2 shrink-0 flex items-start justify-between gap-3 ${v?`pr-12`:`pr-4`}`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`h1`,{className:`text-lg font-semibold leading-tight`,children:typeof e.label==`string`?e.label:e.name}),typeof e.description==`string`&&e.description&&(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:e.description})]}),$.length>0&&(0,x.jsx)(`div`,{className:`shrink-0`,"data-testid":`interface-page-buttons`,children:(0,x.jsx)(s,{schema:{type:`action:bar`,location:`list_toolbar`,actions:$,size:`sm`,variant:`outline`}})})]}),(0,x.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto`,children:(0,x.jsx)(g,{schema:Q,dataSource:D,userFilterSelections:P,onUserFilterSelectionsChange:L,onSortChange:r?e=>r({sort:e}):void 0,onColumnStateChange:r?e=>{e?.order?.length&&r({columns:e.order})}:void 0,onRowClick:V===`none`?void 0:G})}),U.isOverlay&&(0,x.jsx)(f,{...U,setIsOpen:e=>{e||ee()},title:typeof e.label==`string`?e.label:R.source||`Record`,children:e=>(0,x.jsx)(h,{objectNameOverride:R.source,recordIdOverride:String(e?.id??e?._id??W??``),embedded:!0,dataSource:D,objects:E,onEdit:()=>{}})})]})}export{A as a,N as i,M as n,b as o,T as r,y as s,L as t};
@@ -1 +0,0 @@
1
- import{f as e,t,u as n}from"./vendor-react-slxo-5GC.js";import{l as r}from"./framework-B9PMswdm.js";import{Sr as i,er as a,tr as o,za as s}from"./ui-components-DsYvPIox.js";var c=t();function l(){let t=n(),{appName:l}=e(),{t:u}=r(),d=l?`/apps/${l}`:`/`;return(0,c.jsx)(`div`,{className:`container mx-auto max-w-2xl px-6 py-16`,children:(0,c.jsx)(a,{children:(0,c.jsxs)(o,{className:`flex flex-col items-center gap-4 py-12 text-center`,children:[(0,c.jsx)(`div`,{className:`rounded-full bg-muted p-3`,children:(0,c.jsx)(s,{className:`h-6 w-6 text-muted-foreground`})}),(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h2`,{className:`text-lg font-semibold`,children:u(`marketplace.accessDenied.title`)}),(0,c.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:u(`marketplace.accessDenied.description`)})]}),(0,c.jsx)(i,{variant:`outline`,onClick:()=>t(d),children:u(`marketplace.action.backHome`)})]})})})}export{l as t};
@@ -1 +0,0 @@
1
- import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{_ as n,f as r,t as i,u as a}from"./vendor-react-slxo-5GC.js";import{d as o}from"./infrastructure-BnbfcrX8.js";import{Kt as s,l as c}from"./framework-B9PMswdm.js";import{Fs as l,Jr as u,Rt as d,Sr as f,Ui as p,Yo as m,er as h,ir as g,or as _,rr as v,si as y,tr as b,wc as x}from"./ui-components-DsYvPIox.js";import{_ as S,l as C,u as w}from"./marketplaceApi-BLyDDfGk.js";import{t as T}from"./MarketplaceAccessDenied-Cur1UQ0U.js";var E=e(n(),1),D=i();function O(){let e=a(),{appName:t}=r(),n=o(),{t:i,language:s}=c(),y=t?`/apps/${t}`:``,[x,O]=(0,E.useState)([]),[k,A]=(0,E.useState)(`local`),[j,M]=(0,E.useState)(!0),[N,P]=(0,E.useState)(null),[F,I]=(0,E.useState)(null),L=async()=>{M(!0);try{let e=await C();e.connected?(A(`cloud`),O(e.items)):(A(`local`),O(await w()))}finally{M(!1)}};(0,E.useEffect)(()=>{L()},[]);let R=async e=>{if(confirm(i(`marketplace.uninstall.confirm`,{manifestId:e.manifestId,version:e.version}))){P(e.manifestId),I(null);try{await S(e.manifestId),I({ok:!0,message:i(`marketplace.uninstall.successInList`,{manifestId:e.manifestId})}),await L()}catch(e){I({ok:!1,message:e?.message??String(e)})}finally{P(null)}}};return n?(0,D.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,D.jsx)(`div`,{className:`flex justify-end`,children:(0,D.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>void L(),disabled:j,children:[(0,D.jsx)(p,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),i(`marketplace.refresh`)]})}),F&&(0,D.jsx)(`div`,{className:`rounded-md border p-3 text-sm ${F.ok?`border-green-500/30 bg-green-500/5 text-green-700 dark:text-green-400`:`border-destructive/30 bg-destructive/5 text-destructive`}`,children:(0,D.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,D.jsx)(l,{className:`h-4 w-4 mt-0.5 shrink-0`,"aria-hidden":`true`}),(0,D.jsx)(`div`,{children:F.message})]})}),j&&x.length===0?(0,D.jsx)(`div`,{className:`grid gap-3`,children:Array.from({length:3}).map((e,t)=>(0,D.jsx)(d,{className:`h-20 w-full`},t))}):x.length===0?(0,D.jsxs)(`div`,{className:`text-center py-12 text-sm text-muted-foreground border rounded-md`,children:[(0,D.jsx)(`p`,{children:i(`marketplace.installedEmpty`)}),(0,D.jsx)(f,{variant:`link`,className:`mt-2`,onClick:()=>e(`${y}/system/marketplace`),children:i(`marketplace.browseLink`)})]}):(0,D.jsx)(`div`,{className:`grid gap-3`,children:x.map(t=>(0,D.jsxs)(h,{children:[(0,D.jsxs)(v,{className:`flex flex-row items-start justify-between gap-3 pb-2`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsxs)(g,{className:`text-base truncate flex items-center gap-2`,children:[t.manifestId,(0,D.jsx)(_,{variant:`outline`,children:i(`marketplace.versionBadge`,{version:t.version})})]}),(0,D.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1 flex flex-wrap gap-x-3 gap-y-1`,children:[(0,D.jsx)(`span`,{children:i(`marketplace.installedAt`,{when:new Date(t.installedAt).toLocaleString(s||void 0)})}),t.installedBy&&(0,D.jsx)(`span`,{children:i(`marketplace.installedBy`,{user:t.installedBy})}),(0,D.jsxs)(`span`,{children:[i(`marketplace.installedPackageId`),` `,(0,D.jsx)(`code`,{className:`font-mono`,children:t.packageId})]})]})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,D.jsxs)(f,{variant:`ghost`,size:`sm`,onClick:()=>e(`${y}/system/marketplace/${t.packageId}`),children:[(0,D.jsx)(m,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),i(`marketplace.action.details`)]}),k===`local`&&(0,D.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>void R(t),disabled:N===t.manifestId,children:[(0,D.jsx)(u,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),N===t.manifestId?i(`marketplace.action.uninstalling`):i(`marketplace.action.uninstall`)]})]})]}),k===`local`&&(0,D.jsx)(b,{className:`pt-0 text-xs text-muted-foreground`,dangerouslySetInnerHTML:{__html:i(`marketplace.cachedAs`,{path:`.objectstack/installed-packages/${t.manifestId.replace(/[^a-zA-Z0-9._-]/g,`_`)}.json`})}})]},t.manifestId))}),(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground border-t pt-4`,dangerouslySetInnerHTML:{__html:i(`marketplace.installedAdditiveNote`)}})]}):(0,D.jsx)(T,{})}s.register(`marketplace:installed-list`,()=>(0,D.jsx)(O,{}),{namespace:`app-shell`,label:`Installed Marketplace Packages`,category:`plugin`,inputs:[]});var k=t({MarketplaceInstalledPage:()=>A});function A(){let e=a(),{appName:t}=r(),{t:n}=c(),i=t?`/apps/${t}`:``;return(0,D.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6 max-w-5xl`,children:[(0,D.jsxs)(f,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>e(`${i}/system/marketplace`),children:[(0,D.jsx)(x,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),n(`marketplace.back`)]}),(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(y,{className:`h-6 w-6 text-primary`,"aria-hidden":`true`}),(0,D.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:n(`marketplace.installedTitle`)})]}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,dangerouslySetInnerHTML:{__html:n(`marketplace.installedSubtitle`)}})]}),(0,D.jsx)(O,{})]})}export{k as t};
@@ -1,4 +0,0 @@
1
- import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{_ as n,f as r,t as i,u as a}from"./vendor-react-slxo-5GC.js";import{d as ee}from"./infrastructure-BnbfcrX8.js";import{R as te,l as ne}from"./framework-B9PMswdm.js";import{$n as o,$o as re,Ba as s,Ci as c,Fs as l,Gn as ie,Jn as ae,Jr as u,Jt as oe,Kn as se,Kt as ce,Ms as d,Nr as f,Oo as le,Ps as ue,Rt as p,Sn as de,Sr as m,Wn as fe,Xo as pe,Xt as me,Yn as he,Yo as ge,Yt as _e,_a as ve,er as ye,fn as h,fs as g,gn as _,ir as be,mn as xe,or as v,pn as Se,qn as Ce,qt as we,rr as Te,rs as Ee,sc as y,tr as De,wc as Oe,wi as ke,ya as Ae}from"./ui-components-DsYvPIox.js";import"./MetadataProvider-MNkZn-bR.js";import{n as je}from"./assistantBus-DosfPCbN.js";import{_ as Me,a as Ne,c as Pe,g as Fe,h as Ie,i as Le,m as Re,o as ze,p as Be,r as b,s as Ve,t as He,u as Ue,x}from"./marketplaceApi-BLyDDfGk.js";import{n as We,t as Ge}from"./usePackageL10n-CasuagU5.js";import{t as Ke}from"./MarketplaceAccessDenied-Cur1UQ0U.js";var S=e(n(),1),C=i();function qe(e){let t=e.replace(/\r\n/g,`
2
- `).split(`
3
- `),n=[],r=0;for(;r<t.length;){let e=t[r];if(e.startsWith("```")){let i=e.slice(3).trim();r++;let a=[];for(;r<t.length&&!t[r].startsWith("```");)a.push(t[r]),r++;r++,n.push({type:`code`,text:a.join(`
4
- `),lang:i});continue}let i=/^(#{1,3})\s+(.*)$/.exec(e);if(i){let e=i[1].length;n.push({type:`h${e}`,text:i[2].trim()}),r++;continue}if(/^[-*]\s+/.test(e)){let e=[];for(;r<t.length&&/^[-*]\s+/.test(t[r]);)e.push(t[r].replace(/^[-*]\s+/,``)),r++;n.push({type:`ul`,items:e});continue}if(/^\d+\.\s+/.test(e)){let e=[];for(;r<t.length&&/^\d+\.\s+/.test(t[r]);)e.push(t[r].replace(/^\d+\.\s+/,``)),r++;n.push({type:`ol`,items:e});continue}if(!e.trim()){r++;continue}let a=[];for(;r<t.length&&t[r].trim()&&!/^#{1,3}\s+/.test(t[r])&&!/^[-*]\s+/.test(t[r])&&!/^\d+\.\s+/.test(t[r])&&!t[r].startsWith("```");)a.push(t[r]),r++;n.push({type:`p`,text:a.join(` `)})}return n}function w(e){let t=[],n=e,r=0,i=[{re:/`([^`]+)`/,render:e=>(0,C.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[0.85em]`,children:e[1]},`k${r++}`)},{re:/\*\*([^*]+)\*\*/,render:e=>(0,C.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e[1]},`k${r++}`)},{re:/\*([^*]+)\*/,render:e=>(0,C.jsx)(`em`,{children:e[1]},`k${r++}`)},{re:/\[([^\]]+)\]\(([^)]+)\)/,render:e=>(0,C.jsx)(`a`,{href:e[2],target:`_blank`,rel:`noopener noreferrer`,className:`text-violet-600 underline-offset-2 hover:underline dark:text-violet-400`,children:e[1]},`k${r++}`)}];for(;n;){let e=-1,r=null,a=null;for(let t of i){let i=t.re.exec(n);i&&(e===-1||i.index<e)&&(e=i.index,r=i,a=t)}if(!r||!a){t.push(n);break}e>0&&t.push(n.slice(0,e)),t.push(a.render(r)),n=n.slice(e+r[0].length)}return(0,C.jsx)(C.Fragment,{children:t.map((e,t)=>(0,C.jsx)(S.Fragment,{children:e},t))})}function Je({source:e,className:t}){let n=qe(e);return(0,C.jsx)(`div`,{className:`flex flex-col gap-4 text-sm leading-relaxed text-foreground/90 ${t??``}`,children:n.map((e,t)=>{switch(e.type){case`h1`:return(0,C.jsx)(`h2`,{className:`mt-2 text-xl font-bold tracking-tight`,children:w(e.text??``)},t);case`h2`:return(0,C.jsx)(`h3`,{className:`mt-3 text-base font-semibold tracking-tight`,children:w(e.text??``)},t);case`h3`:return(0,C.jsx)(`h4`,{className:`mt-2 text-sm font-semibold tracking-tight text-foreground/80`,children:w(e.text??``)},t);case`p`:return(0,C.jsx)(`p`,{children:w(e.text??``)},t);case`ul`:return(0,C.jsx)(`ul`,{className:`ml-1 flex list-none flex-col gap-1.5`,children:(e.items??[]).map((e,t)=>(0,C.jsxs)(`li`,{className:`flex gap-2`,children:[(0,C.jsx)(`span`,{"aria-hidden":`true`,className:`mt-1.5 inline-block h-1.5 w-1.5 shrink-0 rounded-full bg-violet-500/70`}),(0,C.jsx)(`span`,{children:w(e)})]},t))},t);case`ol`:return(0,C.jsx)(`ol`,{className:`ml-5 flex list-decimal flex-col gap-1.5 marker:text-muted-foreground`,children:(e.items??[]).map((e,t)=>(0,C.jsx)(`li`,{className:`pl-1`,children:w(e)},t))},t);case`code`:return(0,C.jsx)(`pre`,{className:`overflow-x-auto rounded-lg border bg-muted/40 p-3 text-xs leading-relaxed`,children:(0,C.jsx)(`code`,{className:`font-mono`,children:e.text})},t)}return null})})}var T={node:`In-process · full trust`,sandbox:`Sandboxed`,worker:`Out-of-process`};function E({icon:e,label:t,items:n}){return!n||n.length===0?null:(0,C.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,C.jsx)(e,{className:`h-3.5 w-3.5 mt-0.5 text-muted-foreground shrink-0`,"aria-hidden":`true`}),(0,C.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,C.jsx)(`div`,{className:`text-xs font-medium`,children:t}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-0.5`,children:n.map(e=>(0,C.jsx)(`code`,{className:`font-mono text-[11px] px-1 py-0.5 rounded bg-muted break-all`,children:e},e))})]})]})}function Ye({version:e}){let{t}=ne();if(!e?.contains_code)return null;let n=e.permissions??{},r=(n.services?.length??0)+(n.hooks?.length??0)+(n.network?.length??0)+(n.fs?.length??0)>0;return(0,C.jsxs)(`div`,{className:`rounded-md border border-amber-500/30 bg-amber-500/5 p-3 space-y-3 text-sm`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,C.jsx)(g,{className:`h-4 w-4 text-amber-600 shrink-0`,"aria-hidden":`true`}),t(`marketplace.disclosure.containsCode`,{defaultValue:`This package contains code`})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[e.runtime&&(0,C.jsx)(v,{variant:`outline`,children:t(`marketplace.disclosure.runtime.${e.runtime}`,{defaultValue:T[e.runtime]??e.runtime})}),e.platform_verified?(0,C.jsxs)(v,{variant:`outline`,className:`gap-1 border-green-500/40 text-green-700 dark:text-green-400`,children:[(0,C.jsx)(c,{className:`h-3 w-3`,"aria-hidden":`true`}),t(`marketplace.disclosure.reviewed`,{defaultValue:`Reviewed & approved`})]}):(0,C.jsxs)(v,{variant:`outline`,className:`gap-1 border-amber-500/40 text-amber-700 dark:text-amber-400`,children:[(0,C.jsx)(ke,{className:`h-3 w-3`,"aria-hidden":`true`}),t(`marketplace.disclosure.unreviewed`,{defaultValue:`Not yet reviewed`})]}),e.signed&&(0,C.jsxs)(v,{variant:`outline`,className:`gap-1`,children:[(0,C.jsx)(d,{className:`h-3 w-3`,"aria-hidden":`true`}),t(`marketplace.disclosure.signed`,{defaultValue:`Signed`})]})]}),r?(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t(`marketplace.disclosure.grantsIntro`,{defaultValue:`On install, this package will be granted:`})}),(0,C.jsx)(E,{icon:y,label:t(`marketplace.disclosure.services`,{defaultValue:`Platform services`}),items:n.services??void 0}),(0,C.jsx)(E,{icon:f,label:t(`marketplace.disclosure.hooks`,{defaultValue:`Lifecycle hooks`}),items:n.hooks??void 0}),(0,C.jsx)(E,{icon:Ae,label:t(`marketplace.disclosure.network`,{defaultValue:`Network access`}),items:n.network??void 0}),(0,C.jsx)(E,{icon:le,label:t(`marketplace.disclosure.fs`,{defaultValue:`Filesystem access`}),items:n.fs??void 0})]}):(0,C.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t(`marketplace.disclosure.noPermissions`,{defaultValue:`Requests no special permissions.`})})]})}var D=t({MarketplacePackagePage:()=>O});function O(){let e=a(),{packageId:t,appName:n}=r(),i=ee(),{t:c,language:f}=ne(),le=n?`/apps/${n}`:``,{refresh:g}=te(),[y,ke]=(0,S.useState)(null),[Ae,qe]=(0,S.useState)(!0),[w,T]=(0,S.useState)(null),[E,D]=(0,S.useState)(!1),[O,Xe]=(0,S.useState)([]),[Ze,k]=(0,S.useState)(!1),[A,j]=(0,S.useState)(null),[M,N]=(0,S.useState)(``),[Qe,$e]=(0,S.useState)({}),[P,et]=(0,S.useState)(!1),[tt,nt]=(0,S.useState)(!1),[F,rt]=(0,S.useState)(!1),[I,L]=(0,S.useState)(null),[R,it]=(0,S.useState)(null),[z,B]=(0,S.useState)(null),[V,H]=(0,S.useState)(null),[U,W]=(0,S.useState)(null),[at,G]=(0,S.useState)([]),[K,q]=(0,S.useState)(!1),[J,Y]=(0,S.useState)(null);(0,S.useEffect)(()=>{if(!x().features.installLocal)return;let e=!1;return(async()=>{let t=await Ue();e||G(t)})(),()=>{e=!0}},[t,J]),(0,S.useEffect)(()=>{if(!t)return;let e=x().defaultEnvironmentId??``,n=!1;return(async()=>{let r=await b(t,e);n||!r||(B(r),it(r.version))})(),()=>{n=!0}},[t]),(0,S.useEffect)(()=>{let e=!1;return(async()=>{if(t){qe(!0),T(null);try{let n=await Le(t);e||ke(n)}catch(t){e||T(t?.message??String(t))}finally{e||qe(!1)}}})(),()=>{e=!0}},[t]);let ot=async()=>{D(!0),L(null),j(null);let e=x().defaultEnvironmentId;if(e){k(!1),N(e),Xe([]);return}k(!0);try{let[e,n]=await Promise.all([Ve(),Pe()]),r=e.filter(e=>{let t=e.organization_id;return t?n.has(String(t)):!1});Xe(r),$e({});let i=t;i&&Promise.all(r.map(async e=>{try{let t=await b(i,e.id);return t?[e.id,t.version]:null}catch{return null}})).then(e=>{let t={};for(let n of e)n&&(t[n[0]]=n[1]);$e(t)}),e.length>0&&r.length===0?j(c(`marketplace.install.noPermission`)):r.length===1&&N(r[0].id)}catch(e){let t=e?.status;j(t===401||t===403?c(`marketplace.install.signInFirst`):e?.message??String(e))}finally{k(!1)}},st=async()=>{if(!(!t||!M)){rt(!0),L(null);try{it(((await ze({packageId:t,environmentId:M,seedSampleData:P}))?.installation?.version??y?.package?.latest_version?.version??y?.versions?.[0]?.version??``)||`installed`);try{let e=x().defaultEnvironmentId||M;if(e){let n=await b(t,e);n&&B(n)}}catch{}let e=x().defaultEnvironmentId;if(!e||e===M)try{if(typeof sessionStorage<`u`)for(let e of Object.keys(sessionStorage))e.startsWith(`objectui:metadata:`)&&sessionStorage.removeItem(e);await g()}catch{}L({ok:!0,message:c(`marketplace.install.success`)}),je()}catch(e){L({ok:!1,message:e?.message??String(e)})}finally{rt(!1)}}},ct=async()=>{if(t){q(!0),Y(null);try{let e=await Ne({packageId:t});try{await g(`app`)}catch{}Y({ok:!0,message:c(`marketplace.install.localSuccess`,{version:e.version,name:y?.package?Ge(y.package,f).displayName:e.manifestId})}),je()}catch(e){let t=e?.code,n=e?.message??String(e);t===`manifest_conflict`?n=c(`marketplace.install.localManifestConflict`,{message:n}):t===`unauthorized`?n=c(`marketplace.install.localUnauthorized`):t===`marketplace_unavailable`&&(n=c(`marketplace.install.localMarketplaceUnavailable`)),Y({ok:!1,message:n})}finally{q(!1)}}},lt=async()=>{if($&&confirm(c(`marketplace.uninstall.confirm`,{manifestId:$.manifestId,version:$.version}))){q(!0),Y(null);try{await Me($.manifestId);try{await g(`app`)}catch{}Y({ok:!0,message:c(`marketplace.uninstall.successInDetail`,{manifestId:$.manifestId})})}catch(e){Y({ok:!1,message:e?.message??String(e)})}finally{q(!1)}}},ut=async()=>{if(z){H(`reseed`),W(null);try{let e=await Fe(z.installationId);e.ok?(B({...z,withSampleData:!0}),W({ok:!0,text:c(`marketplace.detail.reseedQueued`)||`Sample data will be re-seeded on next environment access.`})):W({ok:!1,text:e.error||`Re-seed failed`})}finally{H(null)}}},dt=async()=>{if(z&&confirm(c(`marketplace.detail.purgeConfirm`)||`Delete all sample records seeded by this package? User-added records will NOT be touched.`)){H(`purge`),W(null);try{let e=await Re(z.installationId);if(e.ok){B({...z,withSampleData:!1});let t=e.deleted??0;W({ok:!0,text:t>0?c(`marketplace.detail.purgeSuccess`,{count:t})||`Removed ${t} sample record(s).`:c(`marketplace.detail.purgeNoData`)||`No sample records found to purge.`})}else W({ok:!1,text:e.error||`Purge failed`})}finally{H(null)}}},ft=async()=>{if($){H(`reseed`),W(null);try{let e=await Ie($.manifestId);G(e=>e.map(e=>e.manifestId===$.manifestId?{...e,withSampleData:!0}:e));let t=e.inserted??0,n=e.updated??0,r=e.errors??0,i=c(`marketplace.detail.reseedLocalSuccess`,{inserted:t,updated:n})||`Sample data re-seeded (inserted=${t}, updated=${n}).`;W(r>0?{ok:!1,text:`${i} ${c(`marketplace.detail.reseedPartialErrors`,{count:r})||`(${r} record(s) failed to write)`}`}:{ok:!0,text:i})}catch(e){W({ok:!1,text:e?.message||`Re-seed failed`})}finally{H(null)}}},pt=async()=>{if($&&confirm(c(`marketplace.detail.purgeConfirm`)||`Delete all sample records seeded by this package? User-added records will NOT be touched.`)){H(`purge`),W(null);try{let e=await Be($.manifestId);G(e=>e.map(e=>e.manifestId===$.manifestId?{...e,withSampleData:!1}:e));let t=e.deleted??0;W({ok:!0,text:t>0?c(`marketplace.detail.purgeSuccess`,{count:t})||`Removed ${t} sample record(s).`:c(`marketplace.detail.purgeNoData`)||`No sample records found to purge.`})}catch(e){W({ok:!1,text:e?.message||`Purge failed`})}finally{H(null)}}};if(Ae)return(0,C.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl flex flex-col gap-6 p-4 sm:p-6`,children:[(0,C.jsx)(p,{className:`h-8 w-32`}),(0,C.jsx)(p,{className:`h-16 w-full`}),(0,C.jsx)(p,{className:`h-64 w-full`})]});if(w||!y)return(0,C.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl flex flex-col gap-6 p-4 sm:p-6`,children:[(0,C.jsxs)(m,{variant:`ghost`,size:`sm`,onClick:()=>e(`${le}/system/marketplace`),children:[(0,C.jsx)(Oe,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),c(`marketplace.back`)]}),(0,C.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-destructive/30 bg-destructive/5 p-4 text-sm`,children:[(0,C.jsx)(l,{className:`h-4 w-4 mt-0.5 text-destructive`,"aria-hidden":`true`}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`font-medium text-destructive`,children:c(`marketplace.load.packageFailed`)}),(0,C.jsx)(`div`,{className:`text-muted-foreground mt-1`,children:w??c(`marketplace.load.notFound`)})]})]})]});let X=y.package,Z=Ge(X,f),Q=X.latest_version?.version??y.versions[0]?.version??null,$=at.find(e=>e.manifestId===X.manifest_id)??null,mt=!!X.latest_version?.contains_code,ht=!!R&&R!==`installed`&&!!Q&&R!==Q,gt=x().features.installLocal,_t=!Q||K||F||!gt&&!!R&&!ht,vt=gt?{label:c(K?`marketplace.action.working`:$?`marketplace.action.reinstall`:`marketplace.action.install`),onClick:ct}:{label:F?c(`marketplace.action.installing`):R?ht?c(`marketplace.action.updateTo`,{defaultValue:`Update`,version:Q}):c(`marketplace.action.installed`,{defaultValue:`Installed`}):c(`marketplace.action.installToCloud`),onClick:ot},yt=X.category?c(`marketplace.category.${X.category}`,{defaultValue:X.category}):null;return i?(0,C.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl flex flex-col gap-6 p-4 sm:p-6`,children:[(0,C.jsxs)(m,{variant:`ghost`,size:`sm`,className:`self-start -ml-2 text-muted-foreground hover:text-foreground`,onClick:()=>e(`${le}/system/marketplace`),children:[(0,C.jsx)(Oe,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),c(`marketplace.back`)]}),(0,C.jsxs)(`div`,{className:`flex items-start gap-5 flex-wrap sm:flex-nowrap rounded-2xl border bg-gradient-to-br from-primary/5 via-background to-background p-6 sm:p-8`,children:[(0,C.jsx)(We,{iconUrl:X.icon_url,displayName:Z.displayName,manifestId:X.manifest_id,className:`h-20 w-20 rounded-2xl shadow-sm ring-1 ring-border shrink-0`,initialClassName:`text-3xl font-bold`}),(0,C.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,C.jsx)(`h1`,{className:`text-2xl sm:text-3xl font-bold tracking-tight truncate`,children:Z.displayName||X.manifest_id}),X.homepage_url&&(0,C.jsxs)(`a`,{href:X.homepage_url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,title:c(`marketplace.detail.homepage`),children:[(0,C.jsx)(ge,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,C.jsx)(`span`,{className:`hidden sm:inline`,children:c(`marketplace.detail.homepage`)})]})]}),(0,C.jsxs)(`div`,{className:`text-sm text-muted-foreground mt-2 flex flex-wrap items-center gap-1.5`,children:[(0,C.jsx)(`code`,{className:`font-mono text-xs px-1.5 py-0.5 rounded bg-muted`,children:X.manifest_id}),Q&&(0,C.jsx)(v,{variant:`outline`,children:c(`marketplace.versionBadge`,{version:Q})}),X.publisher&&X.publisher!==`private`&&(0,C.jsx)(v,{variant:X.publisher===`objectstack`?`default`:`secondary`,children:X.publisher}),yt&&(0,C.jsx)(v,{variant:`outline`,children:yt}),X.license&&(0,C.jsx)(v,{variant:`outline`,className:`font-normal`,children:X.license}),$&&(0,C.jsxs)(v,{variant:`default`,className:`bg-green-600 hover:bg-green-600 gap-1`,children:[(0,C.jsx)(d,{className:`h-3 w-3`,"aria-hidden":`true`}),c(`marketplace.detail.installedV`,{version:$.version})]}),!$&&R&&(0,C.jsxs)(v,{variant:`default`,className:`bg-green-600 hover:bg-green-600 gap-1`,children:[(0,C.jsx)(d,{className:`h-3 w-3`,"aria-hidden":`true`}),c(`marketplace.detail.installedV`,{version:R})]}),ht&&(0,C.jsxs)(v,{variant:`default`,className:`bg-amber-500 hover:bg-amber-500 gap-1`,children:[(0,C.jsx)(ue,{className:`h-3 w-3`,"aria-hidden":`true`}),c(`marketplace.detail.updateAvailable`,{defaultValue:`Update available`}),` → v`,Q]})]}),Z.description&&(0,C.jsx)(`p`,{className:`text-sm sm:text-base text-foreground/80 mt-3 max-w-2xl leading-relaxed`,children:Z.description})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0 self-start`,children:[(0,C.jsxs)(m,{onClick:vt.onClick,disabled:_t,size:`lg`,className:`min-w-[8rem]`,children:[(0,C.jsx)(re,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),vt.label]}),$&&(0,C.jsxs)(Se,{children:[(0,C.jsx)(de,{asChild:!0,children:(0,C.jsx)(m,{variant:`outline`,size:`lg`,className:`px-2.5`,"aria-label":c(`marketplace.detail.moreOptions`),children:(0,C.jsx)(pe,{className:`h-4 w-4`,"aria-hidden":`true`})})}),(0,C.jsxs)(xe,{align:`end`,className:`w-56`,children:[(0,C.jsxs)(_,{onSelect:ft,disabled:V!==null,children:[V===`reseed`?(0,C.jsx)(s,{className:`h-4 w-4 mr-2 animate-spin`,"aria-hidden":`true`}):(0,C.jsx)(Ee,{className:`h-4 w-4 mr-2`,"aria-hidden":`true`}),$.withSampleData?c(`marketplace.detail.reseedAgain`)||`Re-seed sample data`:c(`marketplace.detail.addSampleData`)||`Add sample data`]}),(0,C.jsxs)(_,{onSelect:pt,disabled:V!==null||!$.withSampleData,className:`text-destructive focus:text-destructive`,children:[V===`purge`?(0,C.jsx)(s,{className:`h-4 w-4 mr-2 animate-spin`,"aria-hidden":`true`}):(0,C.jsx)(u,{className:`h-4 w-4 mr-2`,"aria-hidden":`true`}),c(`marketplace.detail.purgeSampleData`)||`Purge sample data`]}),(0,C.jsxs)(_,{onSelect:lt,disabled:K,className:`text-destructive focus:text-destructive`,children:[(0,C.jsx)(u,{className:`h-4 w-4 mr-2`,"aria-hidden":`true`}),c(`marketplace.detail.uninstallFromRuntime`)]})]})]}),!$&&z&&!x().cloudUrl&&(0,C.jsxs)(Se,{children:[(0,C.jsx)(de,{asChild:!0,children:(0,C.jsx)(m,{variant:`outline`,size:`lg`,className:`px-2.5`,"aria-label":c(`marketplace.detail.moreOptions`)||`More options`,children:(0,C.jsx)(pe,{className:`h-4 w-4`,"aria-hidden":`true`})})}),(0,C.jsxs)(xe,{align:`end`,className:`w-56`,children:[(0,C.jsxs)(_,{onSelect:ut,disabled:V!==null,children:[V===`reseed`?(0,C.jsx)(s,{className:`h-4 w-4 mr-2 animate-spin`,"aria-hidden":`true`}):(0,C.jsx)(Ee,{className:`h-4 w-4 mr-2`,"aria-hidden":`true`}),z.withSampleData?c(`marketplace.detail.reseedAgain`)||`Re-seed sample data`:c(`marketplace.detail.addSampleData`)||`Add sample data`]}),(0,C.jsxs)(_,{onSelect:dt,disabled:V!==null||!z.withSampleData,className:`text-destructive focus:text-destructive`,children:[V===`purge`?(0,C.jsx)(s,{className:`h-4 w-4 mr-2 animate-spin`,"aria-hidden":`true`}):(0,C.jsx)(u,{className:`h-4 w-4 mr-2`,"aria-hidden":`true`}),c(`marketplace.detail.purgeSampleData`)||`Purge sample data`]})]})]})]})]}),U&&(0,C.jsxs)(`div`,{role:`status`,className:`flex items-start gap-2 rounded-md border p-3 text-sm ${U.ok?`border-green-500/30 bg-green-500/5 text-green-700 dark:text-green-400`:`border-destructive/30 bg-destructive/5 text-destructive`}`,children:[U.ok?(0,C.jsx)(d,{className:`h-4 w-4 mt-0.5 shrink-0`,"aria-hidden":`true`}):(0,C.jsx)(l,{className:`h-4 w-4 mt-0.5 shrink-0`,"aria-hidden":`true`}),(0,C.jsx)(`div`,{className:`flex-1`,children:U.text}),(0,C.jsx)(`button`,{type:`button`,className:`text-xs underline opacity-60 hover:opacity-100`,onClick:()=>W(null),children:c(`marketplace.action.dismiss`)})]}),J&&(0,C.jsxs)(`div`,{role:`status`,className:`flex items-start gap-2 rounded-md border p-3 text-sm whitespace-pre-wrap ${J.ok?`border-green-500/30 bg-green-500/5 text-green-700 dark:text-green-400`:`border-destructive/30 bg-destructive/5 text-destructive`}`,children:[J.ok?(0,C.jsx)(d,{className:`h-4 w-4 mt-0.5 shrink-0`,"aria-hidden":`true`}):(0,C.jsx)(l,{className:`h-4 w-4 mt-0.5 shrink-0`,"aria-hidden":`true`}),(0,C.jsx)(`div`,{className:`flex-1`,children:J.message}),(0,C.jsx)(`button`,{type:`button`,className:`text-xs underline opacity-60 hover:opacity-100`,onClick:()=>Y(null),children:c(`marketplace.action.dismiss`)})]}),(0,C.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-3`,children:[(0,C.jsx)(`div`,{className:`lg:col-span-2 space-y-4`,children:(0,C.jsxs)(ye,{children:[(0,C.jsx)(Te,{children:(0,C.jsx)(be,{className:`text-base`,children:c(`marketplace.detail.about`)})}),(0,C.jsx)(De,{children:Z.readme?(0,C.jsx)(Je,{source:Z.readme}):(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c(`marketplace.detail.noReadme`)})})]})}),(0,C.jsx)(`div`,{className:`space-y-4`,children:(0,C.jsxs)(ye,{children:[(0,C.jsx)(Te,{children:(0,C.jsx)(be,{className:`text-base`,children:c(`marketplace.detail.versions`)})}),(0,C.jsx)(De,{children:y.versions.length===0?(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c(`marketplace.detail.noApprovedVersions`)}):(0,C.jsx)(`ul`,{className:`space-y-3`,children:y.versions.map(e=>(0,C.jsxs)(`li`,{className:`space-y-1 text-sm`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,C.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,C.jsx)(ve,{className:`h-3.5 w-3.5 text-muted-foreground`,"aria-hidden":`true`}),(0,C.jsxs)(`code`,{className:`font-mono`,children:[`v`,e.version]}),e.is_prerelease&&(0,C.jsx)(v,{variant:`outline`,className:`text-xs`,children:c(`marketplace.detail.prerelease`)})]}),(0,C.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.published_at?new Date(e.published_at).toLocaleDateString():`—`})]}),e.release_notes&&e.release_notes.trim()&&(0,C.jsx)(`p`,{className:`whitespace-pre-line pl-5 text-xs text-muted-foreground`,children:e.release_notes.trim()})]},e.id))})})]})})]}),(0,C.jsx)(fe,{open:E,onOpenChange:e=>{D(e),e||(L(null),nt(!1))},children:(0,C.jsxs)(ie,{children:[(0,C.jsxs)(ae,{children:[(0,C.jsx)(he,{children:c(`marketplace.install.dialogTitle`,{name:Z.displayName||X.manifest_id})}),(0,C.jsx)(se,{children:x().defaultEnvironmentId?c(`marketplace.install.dialogDescCurrent`,{host:typeof window<`u`?window.location.host:``}):c(`marketplace.install.dialogDescPicker`)})]}),Ze?(0,C.jsx)(p,{className:`h-10 w-full`}):A?(0,C.jsxs)(`div`,{className:`rounded-md border border-amber-500/30 bg-amber-500/5 p-3 text-sm space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,C.jsx)(l,{className:`h-4 w-4 mt-0.5 text-amber-600`,"aria-hidden":`true`}),(0,C.jsx)(`div`,{className:`flex-1`,children:A})]}),(0,C.jsx)(`a`,{href:He(X.id),target:`_blank`,rel:`noopener noreferrer`,children:(0,C.jsxs)(m,{variant:`outline`,size:`sm`,className:`w-full`,children:[(0,C.jsx)(ge,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),c(`marketplace.action.openOnCloud`)]})})]}):x().defaultEnvironmentId?(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(o,{id:`seed`,checked:P,onCheckedChange:e=>et(e===!0)}),(0,C.jsx)(h,{htmlFor:`seed`,className:`text-sm font-normal cursor-pointer`,children:c(`marketplace.install.includeSampleData`)})]}):O.length===0?(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c(`marketplace.install.noEnvs`)}):(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(h,{htmlFor:`env-select`,children:c(`marketplace.install.environment`)}),(0,C.jsxs)(ce,{value:M,onValueChange:N,children:[(0,C.jsx)(_e,{id:`env-select`,children:(0,C.jsx)(me,{placeholder:c(`marketplace.install.environmentPlaceholder`)})}),(0,C.jsx)(we,{children:O.map(e=>{let t=Qe[e.id],n=!!t&&!!Q&&t!==`installed`&&t!==Q;return(0,C.jsxs)(oe,{value:e.id,children:[e.display_name||e.hostname||e.id,e.plan&&(0,C.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,e.plan]}),t&&(n?(0,C.jsxs)(`span`,{className:`text-amber-600`,children:[` · `,c(`marketplace.install.updateTo`,{defaultValue:`Update → v{{version}}`,version:Q})]}):(0,C.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,c(`marketplace.install.installedVersion`,{defaultValue:`Installed v{{version}}`,version:t})]}))]},e.id)})})]})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(o,{id:`seed`,checked:P,onCheckedChange:e=>et(e===!0)}),(0,C.jsx)(h,{htmlFor:`seed`,className:`text-sm font-normal cursor-pointer`,children:c(`marketplace.install.includeSampleData`)})]})]}),mt&&!A&&(0,C.jsxs)(`div`,{className:`space-y-3`,children:[(0,C.jsx)(Ye,{version:X.latest_version}),(0,C.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,C.jsx)(o,{id:`ack-perms`,checked:tt,onCheckedChange:e=>nt(e===!0)}),(0,C.jsx)(h,{htmlFor:`ack-perms`,className:`text-sm font-normal cursor-pointer leading-snug`,children:c(`marketplace.disclosure.acknowledge`,{defaultValue:`I understand this package runs code and grants the permissions above.`})})]})]}),I&&(0,C.jsx)(`div`,{className:`rounded-md border p-3 text-sm ${I.ok?`border-green-500/30 bg-green-500/5 text-green-700`:`border-destructive/30 bg-destructive/5 text-destructive`}`,children:I.message}),(0,C.jsxs)(Ce,{children:[(0,C.jsx)(m,{variant:`outline`,onClick:()=>D(!1),children:c(`marketplace.action.close`)}),!A&&(0,C.jsx)(m,{onClick:st,disabled:!M||F||I?.ok===!0||mt&&!tt,children:c(F?`marketplace.action.installing`:`marketplace.action.install`)})]})]})})]}):(0,C.jsx)(Ke,{})}export{D as t};
@@ -1 +0,0 @@
1
- import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{_ as n,f as r,t as i,u as a}from"./vendor-react-slxo-5GC.js";import{d as o}from"./infrastructure-BnbfcrX8.js";import{l as s}from"./framework-B9PMswdm.js";import{Ei as c,Fs as ee,Ms as l,Rt as u,Sr as d,Ui as f,_a as p,cn as te,er as m,ir as h,ki as g,nr as _,or as v,rr as y,si as b,tr as x}from"./ui-components-DsYvPIox.js";import{n as ne}from"./assistantBus-DosfPCbN.js";import{a as S,d as re,f as C,l as ie,o as ae,u as oe,x as se}from"./marketplaceApi-BLyDDfGk.js";import{n as w,t as T}from"./usePackageL10n-CasuagU5.js";import{t as E}from"./MarketplaceAccessDenied-Cur1UQ0U.js";var D=t({MarketplacePage:()=>A}),O=e(n(),1),k=i();function ce(){let{language:e,t}=s();return n=>{if(!n)return``;let r=new Date(n);if(Number.isNaN(r.getTime()))return``;let i=Math.floor((Date.now()-r.getTime())/864e5);if(i<1)return t(`marketplace.relativeTime.today`);try{let t=new Intl.RelativeTimeFormat(e||`en`,{numeric:`auto`});return i<30?t.format(-i,`day`):i<365?t.format(-Math.floor(i/30),`month`):t.format(-Math.floor(i/365),`year`)}catch{return i<30?t(`marketplace.relativeTime.daysAgo`,{count:i}):i<365?t(`marketplace.relativeTime.monthsAgo`,{count:Math.floor(i/30)}):t(`marketplace.relativeTime.yearsAgo`,{count:Math.floor(i/365)})}}}function A(){let e=a(),{appName:t}=r(),n=o(),{t:i,language:D}=s(),A=ce(),j=t?`/apps/${t}`:``,[M,N]=(0,O.useState)([]),[P,F]=(0,O.useState)(!0),[I,L]=(0,O.useState)(null),[R,z]=(0,O.useState)(``),[B,V]=(0,O.useState)(``),[H,U]=(0,O.useState)([]),[W,le]=(0,O.useState)([]),[G,K]=(0,O.useState)(null),[q,J]=(0,O.useState)(null),[Y,ue]=(0,O.useState)(new Set),de=(0,O.useMemo)(()=>{let e=new Map;for(let t of H)e.set(t.manifestId,t);return e},[H]),X=async()=>{F(!0),L(null);try{let[e,t,n,r]=await Promise.all([re({limit:100}),oe(),C(),ie()]);N(e.items??[]),U(t),le(n.items??[]);let i=new Set;for(let e of t)i.add(e.manifestId);for(let e of r.items)i.add(e.manifestId);ue(i)}catch(e){L(e?.message??String(e)),N([])}finally{F(!1)}};(0,O.useEffect)(()=>{X()},[]);let fe=async e=>{K(e.id),J(null);try{se().features.installLocal?await S({packageId:e.manifest_id||e.id,versionId:`latest`}):await ae({packageId:e.id,environmentId:``,seedSampleData:!0}),J({ok:!0,text:i(`marketplace.org.installed`,{defaultValue:`Installed ${e.display_name}`,name:e.display_name})}),await X(),ne()}catch(e){J({ok:!1,text:e?.message??String(e)})}finally{K(null)}},Z=(0,O.useMemo)(()=>{let e=new Set;for(let t of M)t.category&&e.add(t.category);return Array.from(e).sort()},[M]),Q=e=>{let t=`marketplace.category.${e}`,n=i(t,{defaultValue:e});return n===t?e:n},$=(0,O.useMemo)(()=>{let e=R.trim().toLowerCase();return M.filter(t=>{if(B&&t.category!==B)return!1;if(!e)return!0;let n=T(t,D);return`${n.displayName} ${t.manifest_id} ${n.description??``}`.toLowerCase().includes(e)})},[M,R,B,D]);return n?(0,k.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6`,children:[(0,k.jsxs)(`div`,{className:`flex items-start justify-between gap-4 flex-wrap`,children:[(0,k.jsxs)(`div`,{className:`min-w-0`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(b,{className:`h-6 w-6 text-primary`,"aria-hidden":`true`}),(0,k.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:i(`marketplace.title`)})]}),(0,k.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:i(`marketplace.subtitle`)})]}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsxs)(d,{variant:`outline`,size:`sm`,onClick:()=>e(`${j}/system/marketplace/installed`),children:[(0,k.jsx)(c,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),H.length>0?i(`marketplace.installedCount`,{count:H.length}):i(`marketplace.installed`)]}),(0,k.jsxs)(d,{variant:`outline`,size:`sm`,onClick:()=>void X(),disabled:P,children:[(0,k.jsx)(f,{className:`h-4 w-4 mr-1.5`,"aria-hidden":`true`}),i(`marketplace.refresh`)]})]})]}),(0,k.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3`,children:[(0,k.jsxs)(`div`,{className:`relative flex-1`,children:[(0,k.jsx)(g,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`,"aria-hidden":`true`}),(0,k.jsx)(te,{value:R,onChange:e=>z(e.target.value),placeholder:i(`marketplace.searchPlaceholder`),className:`pl-9`,"aria-label":i(`marketplace.searchAria`)})]}),Z.length>0&&(0,k.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,k.jsx)(d,{size:`sm`,variant:B===``?`default`:`outline`,onClick:()=>V(``),children:i(`marketplace.all`)}),Z.map(e=>(0,k.jsx)(d,{size:`sm`,variant:B===e?`default`:`outline`,onClick:()=>V(e),children:Q(e)},e))]})]}),I&&(0,k.jsxs)(`div`,{className:`flex items-start gap-3 rounded-md border border-destructive/30 bg-destructive/5 p-4 text-sm`,children:[(0,k.jsx)(ee,{className:`h-4 w-4 mt-0.5 text-destructive`,"aria-hidden":`true`}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`font-medium text-destructive`,children:i(`marketplace.load.failed`)}),(0,k.jsx)(`div`,{className:`text-muted-foreground mt-1`,children:I}),(0,k.jsx)(`div`,{className:`text-xs text-muted-foreground mt-2`,dangerouslySetInnerHTML:{__html:i(`marketplace.load.failedHint`)}})]})]}),W.length>0&&(0,k.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(b,{className:`h-5 w-5 text-primary`,"aria-hidden":`true`}),(0,k.jsx)(`h2`,{className:`text-sm font-semibold`,children:i(`marketplace.org.heading`,{defaultValue:`Your organization`})}),(0,k.jsx)(v,{variant:`secondary`,className:`text-xs`,children:W.length})]}),q&&(0,k.jsx)(`div`,{className:`rounded-md border p-3 text-sm ${q.ok?`border-green-500/30 bg-green-500/5 text-green-700 dark:text-green-400`:`border-destructive/30 bg-destructive/5 text-destructive`}`,children:q.text}),(0,k.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:W.map(e=>{let t=Y.has(e.manifest_id);return(0,k.jsxs)(m,{className:`flex flex-col`,"data-testid":`org-card-${e.manifest_id}`,children:[(0,k.jsxs)(y,{className:`flex flex-row items-start gap-3 pb-2`,children:[(0,k.jsx)(w,{iconUrl:e.icon_url,displayName:e.display_name,manifestId:e.manifest_id}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsx)(h,{className:`text-base truncate`,children:e.display_name}),(0,k.jsx)(_,{className:`text-xs truncate`,children:(0,k.jsx)(`code`,{className:`font-mono`,children:e.manifest_id})})]}),e.visibility&&(0,k.jsx)(v,{variant:`outline`,className:`shrink-0 text-xs`,children:e.visibility})]}),(0,k.jsxs)(x,{className:`flex-1 flex flex-col gap-2`,children:[(0,k.jsx)(`p`,{className:`text-sm text-muted-foreground line-clamp-2`,children:e.description||i(`marketplace.noDescription`)}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2 mt-auto pt-2 flex-wrap`,children:[e.latest_version&&(0,k.jsxs)(v,{variant:`outline`,className:`text-xs`,children:[(0,k.jsx)(p,{className:`h-3 w-3 mr-1`,"aria-hidden":`true`}),i(`marketplace.versionBadge`,{version:e.latest_version})]}),(0,k.jsx)(`div`,{className:`ml-auto`,children:t?(0,k.jsxs)(v,{variant:`default`,className:`text-xs bg-green-600 hover:bg-green-600`,children:[(0,k.jsx)(l,{className:`h-3 w-3 mr-1`,"aria-hidden":`true`}),i(`marketplace.org.installedBadge`,{defaultValue:`Installed`})]}):(0,k.jsx)(d,{size:`sm`,onClick:()=>void fe(e),disabled:G===e.id,children:G===e.id?i(`marketplace.org.installing`,{defaultValue:`Installing…`}):i(`marketplace.org.install`,{defaultValue:`Install`})})})]})]})]},e.id)})}),(0,k.jsx)(`div`,{className:`border-b pt-2`})]}),P&&M.length===0?(0,k.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,k.jsxs)(m,{children:[(0,k.jsxs)(y,{className:`pb-2`,children:[(0,k.jsx)(u,{className:`h-10 w-10 rounded-lg mb-2`}),(0,k.jsx)(u,{className:`h-5 w-3/4`}),(0,k.jsx)(u,{className:`h-4 w-1/2 mt-1`})]}),(0,k.jsx)(x,{children:(0,k.jsx)(u,{className:`h-12 w-full`})})]},t))}):$.length===0?(0,k.jsx)(`div`,{className:`text-center py-12 text-sm text-muted-foreground`,children:M.length===0?i(`marketplace.noApprovedYet`):i(`marketplace.noMatchFilters`)}):(0,k.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:$.map(t=>{let n=de.get(t.manifest_id),r=T(t,D);return(0,k.jsxs)(m,{className:`cursor-pointer transition-colors hover:bg-accent/50 flex flex-col`,onClick:()=>e(`${j}/system/marketplace/${t.id}`),role:`link`,tabIndex:0,onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),e(`${j}/system/marketplace/${t.id}`))},"data-testid":`marketplace-card-${t.manifest_id}`,children:[(0,k.jsxs)(y,{className:`flex flex-row items-start gap-3 pb-2`,children:[(0,k.jsx)(w,{iconUrl:t.icon_url,displayName:r.displayName,manifestId:t.manifest_id}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsx)(h,{className:`text-base truncate`,children:r.displayName}),(0,k.jsx)(_,{className:`text-xs truncate`,children:(0,k.jsx)(`code`,{className:`font-mono`,children:t.manifest_id})})]}),t.publisher&&t.publisher!==`private`&&(0,k.jsx)(v,{variant:t.publisher===`objectstack`?`default`:`secondary`,className:`shrink-0`,children:t.publisher})]}),(0,k.jsxs)(x,{className:`flex-1 flex flex-col gap-2`,children:[(0,k.jsx)(`p`,{className:`text-sm text-muted-foreground line-clamp-2`,children:r.description||i(`marketplace.noDescription`)}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2 mt-auto pt-2 flex-wrap`,children:[n&&(0,k.jsxs)(v,{variant:`default`,className:`text-xs bg-green-600 hover:bg-green-600`,children:[(0,k.jsx)(l,{className:`h-3 w-3 mr-1`,"aria-hidden":`true`}),i(`marketplace.installedBadge`,{version:n.version})]}),t.latest_version?.version&&(0,k.jsxs)(v,{variant:`outline`,className:`text-xs`,children:[(0,k.jsx)(p,{className:`h-3 w-3 mr-1`,"aria-hidden":`true`}),i(`marketplace.versionBadge`,{version:t.latest_version.version})]}),t.category&&(0,k.jsx)(v,{variant:`outline`,className:`text-xs`,children:Q(t.category)}),t.latest_version?.published_at&&(0,k.jsx)(`span`,{className:`text-xs text-muted-foreground ml-auto`,children:A(t.latest_version.published_at)})]})]})]},t.id)})})]}):(0,k.jsx)(E,{})}export{D as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{_ as t,l as n,t as r,u as i}from"./vendor-react-slxo-5GC.js";import{I as a}from"./framework-B9PMswdm.js";import{n as o}from"./data-adapter-W6WwA2ln.js";import{i as s}from"./plugin-form-CzotVFc-.js";import{a as c,o as l}from"./assistantBus-DosfPCbN.js";var u=e(t(),1),d=r(),f=(0,u.createContext)(!1),p=`preview`,m=`draft`;function h(e){return new URLSearchParams(e).get(p)===m}var g=!1;function _(){g=!0}function v({force:e,children:t}){let r=n(),a=i(),o=(0,u.useMemo)(()=>h(r.search),[r.search]),[s,c]=(0,u.useState)(o);return(0,u.useEffect)(()=>{if(o){c(!0),g=!1;return}if(!s)return;if(g){g=!1,c(!1);return}let e=new URLSearchParams(r.search);e.set(p,m),a(`${r.pathname}?${e.toString()}${r.hash}`,{replace:!0})},[o,s,r.pathname,r.search,r.hash,a]),(0,d.jsx)(f.Provider,{value:e??(o||s),children:t})}function y(){return(0,u.useContext)(f)}var b=300*1e3,x=[`app`,`view`],S={apps:`app`,objects:`object`,dashboards:`dashboard`,reports:`report`,pages:`page`},C=`objectui:metadata:`;function w(){try{let e=import.meta;if(e&&e.env&&typeof e.env.MODE==`string`)return e.env.MODE!==`production`}catch{}return!1}var T=w();function E(...e){T&&console.debug(`[MetadataProvider]`,...e)}function D(e){return Array.isArray(e)?e:e&&typeof e==`object`&&`items`in e&&Array.isArray(e.items)?e.items:[]}function O(e){return e==null?null:typeof e==`object`&&`item`in e?e.item??null:e}function k(e){return!!e&&typeof e==`object`&&`name`in e&&typeof e.name==`string`}function A(e){return!!e&&typeof e==`object`&&!!e.viewKind&&!!e.object}function j(e,t){if(!e.length||!t.length)return e;let n={},r=new Set;for(let e of t)A(e)&&r.add(e.object);for(let e of t){if(A(e)){let t=n[e.object]||={listViews:{},formViews:{}},r=e.name||`${e.object}.${e.viewKind}`,i=e.config&&typeof e.config==`object`?e.config:{},a={...i,name:r,label:e.label??i.label,isDefault:!!e.isDefault};e.viewKind===`form`?(t.formViews[r]=a,(e.isDefault||!t.form)&&(t.form=a)):(t.listViews[r]=a,e.isDefault&&(t.primary=a));continue}let t=e?.name||e?.list?.data?.object||e?.form?.data?.object;if(!t||r.has(t))continue;let i=n[t]||={listViews:{},formViews:{}};if(e.list){i.primary=e.list;let t=e.list.name||`list`;i.listViews[t]=e.list}if(e.form&&(i.form=e.form),e.listViews&&typeof e.listViews==`object`)for(let[t,n]of Object.entries(e.listViews))i.listViews[t]=n;if(e.formViews&&typeof e.formViews==`object`)for(let[t,n]of Object.entries(e.formViews))i.formViews[t]=n}return e.map(e=>{let t=n[e.name];if(!t)return e;let r=e.listViews||e.list_views||{},i=e.formViews||e.form_views||{},a={...e,listViews:{...t.listViews,...r}};return(Object.keys(t.formViews).length||Object.keys(i).length)&&(a.formViews={...t.formViews,...i}),t.primary&&!e.list&&(a.list=t.primary),t.form&&!e.form&&(a.form=t.form),a})}function M(e){if(!e?.length)return e;let t={};for(let n of e){let e=n?.fields;if(!e)continue;let r=Array.isArray(e)?e.map(e=>[e?.name,e]):Object.entries(e);for(let[e,i]of r){let r=i;if(!e||!r?.inlineEdit||r.type!==`master_detail`&&r.type!==`lookup`)continue;let a=r.reference;a&&(t[a]||=[]).push({childObject:n.name,relationshipField:e,inlineMode:s(n,r.inlineEdit,{relationshipField:e}),...r.inlineTitle?{title:r.inlineTitle}:{},...Array.isArray(r.inlineColumns)?{columns:r.inlineColumns}:{},...typeof r.inlineAmountField==`string`?{amountField:r.inlineAmountField}:{}})}}return Object.keys(t).length?e.map(e=>{let n=t[e.name];if(!n?.length)return e;let r={...e.form||{type:`simple`}},i=Array.isArray(r.subforms)?r.subforms:[],a=new Set(i.map(e=>e.childObject));r.subforms=[...n.filter(e=>!a.has(e.childObject)),...i];let o={...e,form:r};return e.formViews?.default&&(o.formViews={...e.formViews,default:{...e.formViews.default,subforms:r.subforms}}),o}):e}function N(){return{status:`idle`,items:[],byName:new Map,error:null,fetchedAt:0,promise:null}}function P(e){if(typeof sessionStorage>`u`)return null;try{let t=sessionStorage.getItem(C+e);if(!t)return null;let n=JSON.parse(t);return Array.isArray(n)?n:null}catch{return null}}function F(e,t){if(!(typeof sessionStorage>`u`))try{sessionStorage.setItem(C+e,JSON.stringify(t))}catch{}}function I({children:e,adapter:t,ttlMs:n=b}){let r=(0,u.useRef)(new Map),i=(0,u.useRef)(new Map),s=(0,u.useRef)(t);s.current=t;let f=y(),p=(0,u.useMemo)(()=>f?new o({baseUrl:``,previewDrafts:!0}):null,[f]),m=(0,u.useRef)(p);m.current=p;let[h,g]=(0,u.useState)(0),_=(0,u.useCallback)(()=>{typeof queueMicrotask==`function`?queueMicrotask(()=>g(e=>e+1)):Promise.resolve().then(()=>g(e=>e+1))},[]);(0,u.useEffect)(()=>{r.current.clear(),i.current.clear(),_()},[f,_]);let v=(0,u.useCallback)(e=>{let t=r.current.get(e);return t||(t=N(),r.current.set(e,t)),t},[]),C=(0,u.useCallback)(e=>{let t=v(e);if(t.promise)return t.promise;if(t.status===`ready`&&Date.now()-t.fetchedAt<n)return E(`cache hit (fresh) type=${e} items=${t.items.length}`),Promise.resolve(t.items);let r=Date.now();t.status=`loading`,t.error=null;let i=m.current,a=(i?i.list(e):s.current.getClient().meta.getItems(e)).then(n=>{let a=D(n);t.items=a,t.status=`ready`,t.error=null,t.fetchedAt=Date.now(),t.promise=null,t.byName.clear();for(let e of a)k(e)&&t.byName.set(e.name,e);return e===`app`&&!i&&F(e,a),E(`fetched type=${e} items=${a.length} in ${Date.now()-r}ms`),_(),a}).catch(n=>{let r=n instanceof Error?n:Error(String(n));return t.status=`error`,t.error=r,t.promise=null,E(`fetch failed type=${e}`,r),_(),[]});return t.promise=a,a},[_,v,n]),w=(0,u.useCallback)((e,t)=>{let n=v(e);if(n.byName.has(t))return E(`item cache hit type=${e} name=${t}`),Promise.resolve(n.byName.get(t)??null);let r=i.current.get(e);r||(r=new Map,i.current.set(e,r));let a=r.get(t);if(a)return a;let o=Date.now(),c=m.current,l=(c?c.get(e,t):s.current.getClient().meta.getItem(e,t)).then(i=>{let a=O(i);return a&&n.byName.set(t,a),E(`fetched item type=${e} name=${t} in ${Date.now()-o}ms`),r.delete(t),a}).catch(n=>(r.delete(t),E(`fetch item failed type=${e} name=${t}`,n),null));return r.set(t,l),l},[v]),T=(0,u.useCallback)(async e=>{if(e){let t=v(e);t.fetchedAt=0,t.byName.clear(),await C(e);return}let t=Array.from(r.current.keys()).filter(e=>r.current.get(e).status!==`idle`);await Promise.all(t.map(e=>{let t=r.current.get(e);return t.fetchedAt=0,t.byName.clear(),C(e)}))},[C,v]),A=(0,u.useCallback)((e,t)=>{let n=r.current.get(e);n&&(t?(n.byName.delete(t),n.items=n.items.filter(e=>e?.name!==t),E(`invalidated type=${e} name=${t}`)):(n.status=`idle`,n.items=[],n.byName.clear(),n.error=null,n.fetchedAt=0,E(`invalidated type=${e}`)),_())},[_]);(0,u.useEffect)(()=>{if(f)return c(({type:e})=>{A(e)})},[f,A]),(0,u.useEffect)(()=>l(()=>{try{s.current?.clearCache?.()}catch{}T()}),[T]);let[I,L]=(0,u.useState)(!0),[R,z]=(0,u.useState)(null);(0,u.useEffect)(()=>{let e=!1,t=f?null:P(`app`);if(t){let e=v(`app`);e.items=t,e.status=`ready`,e.fetchedAt=0;for(let n of t)k(n)&&e.byName.set(n.name,n);_(),L(!1)}return(async()=>{for(let t of x)try{await C(t),e||z(null)}catch(t){e||z(t instanceof Error?t:Error(String(t)))}e||L(!1)})(),()=>{e=!0}},[t,C,v,_,f]);let B=(0,u.useMemo)(()=>{let e=e=>{let t=v(e);return t.status===`idle`&&C(e),t.items};return{apps:v(`app`).items,get objects(){let t=e(S.objects),n=e(`view`);return M(n.length?j(t,n):t)},get dashboards(){return e(S.dashboards)},get reports(){return e(S.reports)},get pages(){return e(S.pages)},loading:I,error:R??v(`app`).error,refresh:T,invalidate:A,ensureType:C,getItem:w,getItemsByType:t=>e(t),getTypeStatus:e=>v(e).status}},[h,I,R,C,w,v,T,A]);return(0,d.jsx)(a.Provider,{value:B,children:e})}export{y as a,_ as i,p as n,v as r,I as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{_ as t,f as n,p as r,t as i,u as ee}from"./vendor-react-slxo-5GC.js";import{d as te,f as a,n as o,t as s}from"./infrastructure-BnbfcrX8.js";import{l as c,q as l}from"./framework-B9PMswdm.js";import{G as u,Ic as ne,J as d,Mi as re,Sr as f,V as ie,W as p,Xi as ae,kr as m,rs as h,za as g}from"./ui-components-DsYvPIox.js";import{t as _}from"./RecordDetailView-Ba0xool8.js";import{r as v}from"./useMetadata-DAEfn7ks.js";import{t as y}from"./getIcon-DkcFniPV.js";import{n as b,t as x}from"./CreateViewDialog-6JmiAMxS.js";import{a as S,i as oe,n as se,o as ce,r as le,s as ue}from"./InterfaceListPage-JNxR3qlQ.js";import{l as de}from"./plugins-views-CxFTNQJ7.js";import{t as fe}from"./runtime-metadata-persistence-D1KKivGr.js";var C=e(t(),1),w=i();function T(e){let t=[];return e.forEach((e,n)=>{let r=/^filter\[(.+)\]$/.exec(n);r&&r[1]&&e!==``&&t.push([r[1],`=`,e])}),t}var E=new Set([`select`,`multiselect`,`radio`,`enum`,`boolean`]),D=4;function O({dataSource:e,objects:t}){let{appName:i,objectName:O}=n(),{t:k}=c(),{objectLabel:A,fieldLabel:j}=ne(),M=ee(),[N,P]=r(),{can:F}=o(),{canRead:I}=s(O??``),{user:L}=a(),R=te(),z=v(),[pe,B]=C.useState(!1),V=C.useMemo(()=>(t||[]).find(e=>e.name===O),[t,O]),[me]=C.useState(()=>ue(new URLSearchParams(window.location.search))),he=C.useCallback(e=>{P(t=>ce(t,e),{replace:!0})},[P]),H=Array.from(N.entries()).filter(([e])=>e.startsWith(`filter[`)).map(([e,t])=>`${e}=${t}`).join(`&`),U=C.useMemo(()=>{let e=T(new URLSearchParams(H)),t=e.filter(([e])=>I(e));if(t.length<e.length){let t=e.filter(([e])=>!I(e)).map(([e])=>e);console.warn(`[ObjectDataPage] Dropped URL filter(s) on unreadable field(s): ${t.join(`, `)}`)}return t.map(([e,t,n])=>n===`{current_user_id}`?[e,t,L?.id??n]:[e,t,n])},[H,I,L?.id]),ge=C.useCallback(e=>{P(t=>{let n=new URLSearchParams(t);return n.delete(`filter[${e}]`),n})},[P]),W=C.useMemo(()=>le(V).filter(e=>I(e)),[V,I]),G=C.useMemo(()=>{let e=V?.fields;if(!e||typeof e!=`object`)return;let t=Object.entries(e).filter(([e,t])=>t&&!t.hidden&&E.has(t.type)&&I(e)).slice(0,D).map(([e])=>({field:e}));return t.length>0?{element:`dropdown`,fields:t}:void 0},[V,I]),K=C.useCallback(e=>`/apps/${i}/${O}/record/${encodeURIComponent(String(e))}`,[i,O]),q=l({navigation:{mode:`drawer`},objectName:O??``,onNavigate:e=>M(K(e))}),J=N.get(`recordId`),_e=C.useCallback((e,t)=>{let n=e?.id??e?._id;if(t&&(t.metaKey||t.ctrlKey||t.button===1)&&n!=null){window.open(K(n),`_blank`);return}n!=null&&P(e=>{let t=new URLSearchParams(e);return t.set(`recordId`,String(n)),t})},[K,P]),ve=C.useCallback(()=>{P(e=>{let t=new URLSearchParams(e);return t.delete(`recordId`),t})},[P]);C.useEffect(()=>{J&&!q.isOpen?q.open({id:J}):!J&&q.isOpen&&q.close()},[J]);let Y=C.useMemo(()=>S(V),[V]),X=C.useMemo(()=>se(V),[V]),Z=C.useMemo(()=>oe(V),[V]),Q=C.useMemo(()=>{let e=[`grid`];return Y&&e.push(`kanban`),X&&e.push(`calendar`),Z&&e.push(`gallery`),e},[Y,X,Z]),$=C.useMemo(()=>{if(V)return{type:`list-view`,objectName:V.name,viewType:`grid`,fields:W,...U.length?{filters:U}:{},kanban:Y,calendar:X,gallery:Z,userFilters:G,appearance:{allowedVisualizations:Q},showViewSwitcher:Q.length>1,showSearch:!0,showSort:!0,showFilters:!0,showGroup:!0,showHideFields:!0,showDensity:!0,showRecordCount:!0}},[V,W,U,Y,X,Z,G,Q]),ye=C.useCallback(async e=>{try{let t={...e,columns:Array.isArray(e.columns)&&e.columns.length>0?e.columns:W,...U.length?{filter:U}:{}},n=await fe(`view`,String(e?.name??e?.id??``),t,{metadataClient:z});n&&M(`../view/${n}`,{relative:`path`})}catch(e){console.error(`[ObjectDataPage] Failed to save view:`,e)}},[W,U,z,M]);return V?F(V.name,`read`)?(0,w.jsxs)(`div`,{className:`h-full flex flex-col bg-background min-w-0 overflow-hidden`,"data-testid":`object-data-page`,children:[(0,w.jsx)(`div`,{className:`hidden sm:block`,children:(0,w.jsx)(b,{title:(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`truncate`,children:A(V)}),(0,w.jsx)(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:k(`console.objectData.badge`,{defaultValue:`Data`})})]}),description:k(`console.objectData.description`,{defaultValue:`URL-defined data slice — not bound to any saved view.`}),icon:C.createElement(y(V?.icon),{className:`h-4 w-4`}),actions:(0,w.jsxs)(w.Fragment,{children:[F(V.name,`create`)&&(0,w.jsxs)(f,{size:`sm`,onClick:()=>M(`../new`,{relative:`path`}),className:`shadow-none gap-1.5 h-8 sm:h-9`,"data-testid":`object-data-new-button`,children:[(0,w.jsx)(ae,{className:`h-4 w-4`}),(0,w.jsx)(`span`,{className:`hidden sm:inline`,children:k(`console.objectView.new`)})]}),R&&(0,w.jsxs)(f,{size:`sm`,variant:`outline`,onClick:()=>B(!0),className:`shadow-none gap-1.5 h-8 sm:h-9`,"data-testid":`object-data-save-as-view`,children:[(0,w.jsx)(re,{className:`h-4 w-4`}),(0,w.jsx)(`span`,{className:`hidden sm:inline`,children:k(`console.objectData.saveAsView`,{defaultValue:`Save as view`})})]})]})})}),U.length>0&&(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 border-b px-3 sm:px-4 py-2 shrink-0`,"data-testid":`object-data-filter-chips`,children:[(0,w.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:k(`console.objectData.filteredBy`,{defaultValue:`Filtered by`})}),U.map(([e,,t])=>(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border bg-muted/40 px-2 py-0.5 text-xs`,children:[(0,w.jsx)(`span`,{className:`font-medium`,children:j(V.name,e,e)}),(0,w.jsxs)(`span`,{className:`text-muted-foreground`,children:[`= `,String(t)]}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>ge(e),className:`ml-0.5 rounded-full hover:bg-muted p-0.5`,"aria-label":k(`console.objectData.removeFilter`,{defaultValue:`Remove filter {{field}}`,field:e}),"data-testid":`object-data-remove-filter-${e}`,children:(0,w.jsx)(m,{className:`h-3 w-3`})})]},e))]}),(0,w.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto`,children:$&&(0,w.jsx)(de,{schema:$,dataSource:e,userFilterSelections:me,onUserFilterSelectionsChange:he,onRowClick:_e})}),q.isOverlay&&(0,w.jsx)(ie,{...q,setIsOpen:e=>{e||ve()},title:A(V),children:n=>(0,w.jsx)(_,{objectNameOverride:V.name,recordIdOverride:String(n?.id??n?._id??J??``),embedded:!0,dataSource:e,objects:t,onEdit:()=>{}})}),R&&(0,w.jsx)(x,{open:pe,onOpenChange:B,onCreate:ye,objectDef:V})]}):(0,w.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,"data-testid":`object-data-403`,children:(0,w.jsxs)(p,{children:[(0,w.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,w.jsx)(g,{className:`h-6 w-6 text-muted-foreground`})}),(0,w.jsx)(d,{children:k(`console.objectData.noAccessTitle`,{defaultValue:`Access denied`})}),(0,w.jsx)(u,{children:k(`console.objectData.noAccess`,{defaultValue:`You do not have permission to view this data.`})})]})}):(0,w.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,w.jsxs)(p,{children:[(0,w.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,w.jsx)(h,{className:`h-6 w-6 text-muted-foreground`})}),(0,w.jsx)(d,{children:k(`console.objectView.objectNotFound`)}),(0,w.jsx)(u,{children:k(`console.objectView.objectNotFoundDescription`,{objectName:O})})]})})}export{O as ObjectDataPage};