@objectstack/console 17.2.0 → 17.3.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 (300) hide show
  1. package/CHANGELOG.md +611 -0
  2. package/README.md +26 -10
  3. package/dist/.objectstack-injection.json +2 -2
  4. package/dist/.objectui-sha +1 -1
  5. package/dist/assets/ActionResultDialog-CQwenjVA.js +9 -0
  6. package/dist/assets/{AiPendingActionsPage-CyG11hX9.js → AiPendingActionsPage-7gZ8zlOy.js} +1 -1
  7. package/dist/assets/ApiConsolePage-DUF0ysH7.js +1 -0
  8. package/dist/assets/{AppDocsIndex-BXkNskk1.js → AppDocsIndex-CP_AVG4X.js} +1 -1
  9. package/dist/assets/AppManagementPage-BJktnoa5.js +1 -0
  10. package/dist/assets/ApprovalsInboxPage-DlnxY-uy.js +1 -0
  11. package/dist/assets/{AuditLogPage-BZZ6tzHu.js → AuditLogPage-DIJPRjji.js} +1 -1
  12. package/dist/assets/ComponentNavView-C84QByT7.js +1 -0
  13. package/dist/assets/CreateViewDialog-Zbd9Cagm.js +1 -0
  14. package/dist/assets/DashboardView-UyKHklBx.js +1 -0
  15. package/dist/assets/{DeveloperHubPage-KEpKc45V.js → DeveloperHubPage-BRyNdrCJ.js} +1 -1
  16. package/dist/assets/DocPage-Bx8ZXCYt.js +1 -0
  17. package/dist/assets/{DocShell-DMJHUgE5.js → DocShell-Ipy_IDvh.js} +1 -1
  18. package/dist/assets/{DocsIndex-Bb5OtPb3.js → DocsIndex-CmY-7OQR.js} +1 -1
  19. package/dist/assets/{DocsLayout-CoIVTMH_.js → DocsLayout-BNsSvaz2.js} +1 -1
  20. package/dist/assets/{DocsSlug-BARWHmXg.js → DocsSlug-Cb_NMM1k.js} +1 -1
  21. package/dist/assets/ExpressionProvider-DqGWVuxV.js +1 -0
  22. package/dist/assets/FlowRunsPage-B6ustUgi.js +1 -0
  23. package/dist/assets/{IntegrationsPage-DTXA-Nne.js → IntegrationsPage-chOxmiyU.js} +2 -2
  24. package/dist/assets/InterfaceListPage-DVETnQm5.js +1 -0
  25. package/dist/assets/MarketplaceInstalledPage-DA5pjhAz.js +1 -0
  26. package/dist/assets/MarketplacePackagePage-dCIVHBFi.js +4 -0
  27. package/dist/assets/MarketplacePage-wJb6g1p7.js +1 -0
  28. package/dist/assets/MetadataInspector-Cu-n1FYz.js +1 -0
  29. package/dist/assets/ObjectDataPage-CP-YSZYQ.js +1 -0
  30. package/dist/assets/PageView-B1_ibRuM.js +1 -0
  31. package/dist/assets/ProfilePage-DEr5iZVB.js +1 -0
  32. package/dist/assets/PublicFormsPage-CBcKQbNl.js +1 -0
  33. package/dist/assets/RecordDetailView-A8bbPnkK.js +3 -0
  34. package/dist/assets/RecordFormPage-CGQlYWDk.js +1 -0
  35. package/dist/assets/ReportDefaultInspector-R_p6YStL.js +1 -0
  36. package/dist/assets/ReportView-BTMrtcGH.js +2 -0
  37. package/dist/assets/RuntimeDraftBar-agGU39FL.js +1 -0
  38. package/dist/assets/SchemaForm-DJbupOno.js +3 -0
  39. package/dist/assets/SearchResultsPage-CHhZUc6L.js +1 -0
  40. package/dist/assets/SettingsHub-BGLR_gS7.js +1 -0
  41. package/dist/assets/SettingsView-Bq-7Zkzs.js +1 -0
  42. package/dist/assets/SkeletonDetail-B4-UKxai.js +1 -0
  43. package/dist/assets/SystemHubPage-CVZVag1e.js +1 -0
  44. package/dist/assets/{abnfDiagram-N423BO3Z-DfpQlDUF.js → abnfDiagram-VCTEODGH-DUS5D5dU.js} +1 -1
  45. package/dist/assets/app-shell-eager-leaves-BB0oaPx6.js +1 -0
  46. package/dist/assets/{utils-CJ4UwXMF.js → appRoute-DEVGXLLH.js} +1 -1
  47. package/dist/assets/architecture-7GRP2DOG-kzM7RUjO.js +1 -0
  48. package/dist/assets/{architectureDiagram-T3A2C74G-Ej_4n3NG.js → architectureDiagram-5GKGNRK7-mGW8P1lC.js} +1 -1
  49. package/dist/assets/blockDiagram-OSKFZWR5-Bz2hnVmp.js +129 -0
  50. package/dist/assets/c4Diagram-7LVT6UL2-DU3u1Y6c.js +38 -0
  51. package/dist/assets/channel-FD4s9EIH.js +1 -0
  52. package/dist/assets/{chunk-U6XO7XAA-D-dXvZaW.js → chunk-2ZTRR5NV-DXmA5XXf.js} +1 -1
  53. package/dist/assets/chunk-3NF5O7KM-B8Q7HUio.js +168 -0
  54. package/dist/assets/{chunk-YOTPTUD7-CDtXQZ13.js → chunk-3Z5EZCMW-D3OlaP15.js} +1 -1
  55. package/dist/assets/chunk-4HAMMTFA-BPKwX4iB.js +62 -0
  56. package/dist/assets/{chunk-BIQX33UG-DMScvo0C.js → chunk-5V3GS4D5-sE73jHoi.js} +1 -1
  57. package/dist/assets/{chunk-MOZMSUNE-DG70Besp.js → chunk-6AZGARVD-dsTIs5yl.js} +1 -1
  58. package/dist/assets/{chunk-5JV3BV7I-BrKM6vC-.js → chunk-6EIED4P4-BB4xaK3K.js} +1 -1
  59. package/dist/assets/{chunk-R7FJI6CG-DsJHM8am.js → chunk-6K3QC6MW-DaG1LefG.js} +1 -1
  60. package/dist/assets/{chunk-OSBZ3O6U-Dch_xyhf.js → chunk-6TQVIW2G-DL8WEcT0.js} +1 -1
  61. package/dist/assets/{chunk-JG7HCLWE-lCTbN-f1.js → chunk-747NJXEK-Bdie6H1T.js} +1 -1
  62. package/dist/assets/chunk-75Z2AOVW-CkSdnmiC.js +2 -0
  63. package/dist/assets/chunk-CLGD4ZFX-BTkDISwp.js +1 -0
  64. package/dist/assets/chunk-DU6HZSFF-BkY4hAzc.js +127 -0
  65. package/dist/assets/{chunk-2GRJ4B5K-D1if-ThW.js → chunk-F27PBJKO-DUKg0YWV.js} +1 -1
  66. package/dist/assets/{chunk-KEIR6QF5-ydf36Hye.js → chunk-FOHPRMQF-C65HoZVt.js} +2 -2
  67. package/dist/assets/chunk-GMAD6QVW-DZo_NykZ.js +72 -0
  68. package/dist/assets/chunk-GVQU2GXP-9ELY9S6X.js +1 -0
  69. package/dist/assets/chunk-H2I77ZZE-vCr_buP7.js +1 -0
  70. package/dist/assets/{chunk-GF5L2VYU-Dgjjn2FR.js → chunk-HLEWEB6X-iPkY2ESt.js} +1 -1
  71. package/dist/assets/{chunk-QBLGF6JB-CzQYydMJ.js → chunk-I5DQTOEV-Cz6Y6T9y.js} +1 -1
  72. package/dist/assets/{chunk-5FCAYU7R-BuOxxvKk.js → chunk-ICYGCRZG-DdtFYQ2l.js} +1 -1
  73. package/dist/assets/{chunk-CQNSW5MT-CCth14ZS.js → chunk-IH6LHLGP-DybuHD8B.js} +1 -1
  74. package/dist/assets/{chunk-CYSBUYHQ-DIigEFGo.js → chunk-KI3K4JFJ-CB_CI00L.js} +1 -1
  75. package/dist/assets/chunk-L3NEJ4N5-Bzz35TZJ.js +1 -0
  76. package/dist/assets/chunk-LNGE3PJU-DWpGwHrW.js +34 -0
  77. package/dist/assets/chunk-LQGUR6SS-iVI0GACK.js +1 -0
  78. package/dist/assets/chunk-OSK3NFVY-DcRwXCQD.js +10 -0
  79. package/dist/assets/{chunk-5TONJI2A-Bdh0MHqz.js → chunk-OUJLGHUK-TbeyE6CA.js} +1 -1
  80. package/dist/assets/chunk-P2QGCYS3-nx2-dM5t.js +1 -0
  81. package/dist/assets/{chunk-KBJHAD2P-DI4-lUt-.js → chunk-POPQ4Y6H-BxLOacOG.js} +1 -1
  82. package/dist/assets/{chunk-4I5QYGJK-DlrWrdEa.js → chunk-PWAF6VOD-2mst9kZu.js} +1 -1
  83. package/dist/assets/{chunk-6Q2QTUOP-C2vvuHlO.js → chunk-SVP7TREG-C3BMpr4x.js} +1 -1
  84. package/dist/assets/{chunk-EMLP6XTP-B4CrDa5p.js → chunk-UY3FDG6J-CDAtW6MI.js} +1 -1
  85. package/dist/assets/{chunk-5HE753X5-T_shrJhj.js → chunk-XHIXRSVI-CqmtoxrP.js} +1 -1
  86. package/dist/assets/chunk-XXDRQBXY-iNC8aYmk.js +1 -0
  87. package/dist/assets/{chunk-5RXB4S5H-JwFhdddt.js → chunk-ZLD2IHE6-ZFqtFJbj.js} +2 -2
  88. package/dist/assets/classDiagram-CYGNFDIV-D5Pd2TCl.js +1 -0
  89. package/dist/assets/classDiagram-v2-TLXNO2FR-D5Pd2TCl.js +1 -0
  90. package/dist/assets/componentRegistry-ByxoJqMW.js +1 -0
  91. package/dist/assets/{cose-bilkent-JH36ORCC-XP-DnSP5.js → cose-bilkent-JH36ORCC-CPQv9aQH.js} +1 -1
  92. package/dist/assets/createDerive-Best2JCj.js +2 -0
  93. package/dist/assets/cynefin-OW5HDTMX-Dtvf1C60.js +1 -0
  94. package/dist/assets/{cynefinDiagram-MW4NZA55-B8MvpqXe.js → cynefinDiagram-5FMLGOSQ-Lnly8IJd.js} +1 -1
  95. package/dist/assets/cytoscape.esm-CGd-uY3x.js +321 -0
  96. package/dist/assets/dagre-OS7QT2EB-CdXLxmTK.js +4 -0
  97. package/dist/assets/dagre-PrKaheQc.js +1 -0
  98. package/dist/assets/data-adapter-DL25qpAe.js +5 -0
  99. package/dist/assets/default-inspector-registry-DeEG98bO.js +1 -0
  100. package/dist/assets/{diagram-7IWD3JNH-Xj62y5BF.js → diagram-S7CK7UJ4-DE8I3gxQ.js} +4 -4
  101. package/dist/assets/{diagram-UB23O5K3-bseKIzhv.js → diagram-UQ7AKVKN-D2xQpbEq.js} +1 -1
  102. package/dist/assets/{diagram-B4RE2ZJO-mI-iOCGl.js → diagram-VSXAHHWV-DnttDSlO.js} +1 -1
  103. package/dist/assets/{diagram-Q27KOJAE-B98Knrnh.js → diagram-VX7I27RA-BSEwkn7K.js} +1 -1
  104. package/dist/assets/{diagram-LBJQPF4R-BMTSoZch.js → diagram-Z3DM3KII-BgB9f0Nv.js} +1 -1
  105. package/dist/assets/dist-BpPy7hlB.js +5 -0
  106. package/dist/assets/{ebnfDiagram-BXEA7PRR-Bgo10FP1.js → ebnfDiagram-PWID7BFC-32WvKbS2.js} +1 -1
  107. package/dist/assets/erDiagram-2YWLMYGG-Dwf8uAdl.js +99 -0
  108. package/dist/assets/eventmodeling-NTZA5JFV-CSwP2CpK.js +1 -0
  109. package/dist/assets/expressionUser-CASszt1z.js +1 -0
  110. package/dist/assets/flowDiagram-T62WH6J4-CqVSNJ8T.js +1 -0
  111. package/dist/assets/framework-BfSv4Kb0.js +36 -0
  112. package/dist/assets/{ganttDiagram-PKOTCBZU-CrmKcYGt.js → ganttDiagram-EL5Y4UJY-DqYIE0Cu.js} +2 -2
  113. package/dist/assets/{getIcon-1ZXs1v-a.js → getIcon-CgyYxSEC.js} +1 -1
  114. package/dist/assets/gitGraph-4MIJSDKK--Dc33TN5.js +1 -0
  115. package/dist/assets/{gitGraphDiagram-DS77QQ5N-COu0mOui.js → gitGraphDiagram-WWUBYQGX-D1dYmoGu.js} +1 -1
  116. package/dist/assets/{highlighted-body-OFNGDK62-CnGKNo0r.js → highlighted-body-OFNGDK62-BxO9mjPI.js} +1 -1
  117. package/dist/assets/i18n-Cfqor-xb.js +9 -0
  118. package/dist/assets/i18n-locales-Bz4c8KXc.js +31 -0
  119. package/dist/assets/index-BU-FzlQ6.js +20 -0
  120. package/dist/assets/index-_VyGO4ms.css +2 -0
  121. package/dist/assets/info-A6RAGUB7-DBa3mCQO.js +1 -0
  122. package/dist/assets/{infoDiagram-6WML65LV-BT0Q6MIs.js → infoDiagram-FKFFQAWI-Cr1-5_Am.js} +1 -1
  123. package/dist/assets/infrastructure-CIpDEFyQ.js +3 -0
  124. package/dist/assets/{ishikawaDiagram-WSZJBQD7-kvPjMvBP.js → ishikawaDiagram-5VMMS53U-Bsjx7BsE.js} +1 -1
  125. package/dist/assets/{journeyDiagram-NVQOT4AX-DhXy7wxt.js → journeyDiagram-EYS64GPL-1scn5Z5c.js} +2 -2
  126. package/dist/assets/{kanban-definition-27J2QSJJ-CFDavpZY.js → kanban-definition-UXKFOSKX-DjLQAv5U.js} +2 -2
  127. package/dist/assets/mermaid-GHXKKRXX-NzEcDxBh.js +1 -0
  128. package/dist/assets/{mermaid-parser.core-Dd2B8Ckv.js → mermaid-parser.core-DUt1FNlO.js} +1 -1
  129. package/dist/assets/mermaid.core-pW40dd4u.js +10 -0
  130. package/dist/assets/metadata-admin-pawEBYI9.js +9 -0
  131. package/dist/assets/{mindmap-definition-FAOFIHXS-ITGoV4nW.js → mindmap-definition-THT77NOG-CUcYMB9H.js} +1 -1
  132. package/dist/assets/nav-selection-Dzm_mA3C.js +1 -0
  133. package/dist/assets/packet-AYTQ26CC-CPP93DZD.js +1 -0
  134. package/dist/assets/{pegDiagram-VL7TDLO6-BoRu9yvl.js → pegDiagram-XKGWAZYB-CT1r3sRa.js} +1 -1
  135. package/dist/assets/pie-WAS4IAKB-B-zzBvuc.js +1 -0
  136. package/dist/assets/{pieDiagram-7S7Q4E2Y-DVsM9krU.js → pieDiagram-E7YTZNPT-CSi-V1LQ.js} +3 -3
  137. package/dist/assets/plugin-calendar-BwiiCIjv.js +1 -0
  138. package/dist/assets/plugin-charts-CDGkx7z5.js +7 -0
  139. package/dist/assets/plugin-chatbot-BGnkLzFS.js +122 -0
  140. package/dist/assets/plugin-dashboard-Bj4ldCX6.js +6 -0
  141. package/dist/assets/plugin-form-_fjHxKTV.js +1 -0
  142. package/dist/assets/plugin-gantt-zR8DkpEg.js +63 -0
  143. package/dist/assets/plugin-grid-kkbz4uec.js +9 -0
  144. package/dist/assets/plugin-kanban-DA0eW6yj.js +1 -0
  145. package/dist/assets/plugin-map-DukneTNg.js +1 -0
  146. package/dist/assets/{plugin-markdown-DNllWgPM.js → plugin-markdown-B7zwZHmn.js} +1 -1
  147. package/dist/assets/plugin-report-DaPtlsJr.js +59 -0
  148. package/dist/assets/plugin-timeline-B6rsNNAK.js +1 -0
  149. package/dist/assets/plugin-tree-DauauLFc.js +1 -0
  150. package/dist/assets/plugin-view-5qxxRyZZ.js +1 -0
  151. package/dist/assets/plugins-views-iYcMmImr.js +4 -0
  152. package/dist/assets/{quadrantDiagram-CIZ2JOQS-C4VzXHnp.js → quadrantDiagram-AXDQQJYC-DUJ_94hm.js} +1 -1
  153. package/dist/assets/radar-RG4KPBEZ-DWmbpYEk.js +1 -0
  154. package/dist/assets/railroad-74A4TZTK-xJ7dMu2F.js +1 -0
  155. package/dist/assets/railroad-abnf-HS5TGJTU-Cw4KG_nE.js +1 -0
  156. package/dist/assets/railroad-ebnf-LZEXJU2U-C0cgrfTl.js +1 -0
  157. package/dist/assets/railroad-peg-WCYAUIDC-DOEGG9oQ.js +1 -0
  158. package/dist/assets/{railroadDiagram-AXF67PYL-DqZ3yKWv.js → railroadDiagram-O6MQD6OU-CEyfAhzM.js} +1 -1
  159. package/dist/assets/{requirementDiagram-LRYGKXZP-BeH0P3vD.js → requirementDiagram-IS5BZ75X-CAK7hvBg.js} +2 -2
  160. package/dist/assets/{runtime-metadata-persistence-DTOJpVmd.js → runtime-metadata-persistence-DYPxFzHI.js} +1 -1
  161. package/dist/assets/{sankeyDiagram-W5VNT64P-Bu_tPh-A.js → sankeyDiagram-P5KCCOFB-DgYJh7uz.js} +2 -2
  162. package/dist/assets/{sequenceDiagram-SI44F4Z6-BWEuLn1a.js → sequenceDiagram-WJ2MYXX4-DsQerPtC.js} +1 -1
  163. package/dist/assets/{src-CY2xhbXR.js → src-CVJP2nIc.js} +1 -1
  164. package/dist/assets/src-JX1BkhmR.js +17 -0
  165. package/dist/assets/{src-DhAd4aY4.js → src-S6pzKItc.js} +1 -1
  166. package/dist/assets/src-_DxAIBqo.js +1 -0
  167. package/dist/assets/{stateDiagram-OKZ733FA-Cp7aDYsZ.js → stateDiagram-XQSTLZYL-BJndPKik.js} +1 -1
  168. package/dist/assets/stateDiagram-v2-IH3M54BS-Bi94bTLl.js +1 -0
  169. package/dist/assets/studioEntry-C6G8U-LG.js +1 -0
  170. package/dist/assets/submitRedirect-UXd9NsjL.js +1 -0
  171. package/dist/assets/swimlanes-V6O3JKXN-BiKyiEJr.js +1 -0
  172. package/dist/assets/swimlanesDiagram-JKAHXJPX-DKIR852g.js +8 -0
  173. package/dist/assets/{timeline-definition-Z64GVDOM-BcUiJfLU.js → timeline-definition-24CTP7MA-CW5rY3PX.js} +2 -2
  174. package/dist/assets/treeView-Q6P3EWNA-BcWCBGcU.js +1 -0
  175. package/dist/assets/treemap-WGGIJYW6-DMTEJzXV.js +1 -0
  176. package/dist/assets/ui-components-D2lrjG-t.js +43 -0
  177. package/dist/assets/ui-layout-UUTFXV6S.js +1 -0
  178. package/dist/assets/use-book-data-qUZAxIs0.js +1 -0
  179. package/dist/assets/useActionModal-CkM-zGdy.js +1 -0
  180. package/dist/assets/usePackageL10n-F9isJ9pn.js +1 -0
  181. package/dist/assets/useSettingsLabel-CSZBfUiw.js +1 -0
  182. package/dist/assets/utils-MjUhYVsx.js +1 -0
  183. package/dist/assets/{vendor-charts-BEGSmcjR.js → vendor-charts-CY9WhhzX.js} +1 -1
  184. package/dist/assets/vendor-i18n-C1AQDWux.js +1 -0
  185. package/dist/assets/{vendor-markdown-C_Ip9E_I.js → vendor-markdown-BW_XFZ_b.js} +25 -25
  186. package/dist/assets/vendor-objectstack-BeKUVjuj.js +270 -0
  187. package/dist/assets/{vennDiagram-T6HMQDX7-BKJsL5fS.js → vennDiagram-4TSXK5OY-C79cMc25.js} +1 -1
  188. package/dist/assets/wardley-WFR3VGLG-BRyRizpT.js +1 -0
  189. package/dist/assets/{wardleyDiagram-T6FBY63Y-CZ0aMbYX.js → wardleyDiagram-VM6X3IG4-BAO0_jUk.js} +1 -1
  190. package/dist/assets/{xychartDiagram-ELKLHX3M-BpK2RmQ_.js → xychartDiagram-S5SC5T6Z-BIRd7YRo.js} +3 -3
  191. package/dist/eager-closure.json +180 -139
  192. package/dist/index.html +222 -6
  193. package/package.json +2 -2
  194. package/dist/assets/AdapterProvider-gULVLpjV.js +0 -3
  195. package/dist/assets/ApiConsolePage-DYuOp_W4.js +0 -1
  196. package/dist/assets/AppManagementPage-BvSxDdA_.js +0 -1
  197. package/dist/assets/ApprovalsInboxPage-oep3a-Ek.js +0 -1
  198. package/dist/assets/ComponentNavView-Cq4wkNUa.js +0 -1
  199. package/dist/assets/DashboardView-C23ZCS2S.js +0 -1
  200. package/dist/assets/DocPage-Y4rWCZ3E.js +0 -1
  201. package/dist/assets/ExpressionProvider-vGLngw8h.js +0 -1
  202. package/dist/assets/FlowRunsPage-BeGa9_ge.js +0 -1
  203. package/dist/assets/InterfaceListPage-BMvedZyV.js +0 -1
  204. package/dist/assets/ManagedByBadge-mKmG0hP7.js +0 -1
  205. package/dist/assets/MarketplaceAccessDenied-BBMyNu2w.js +0 -1
  206. package/dist/assets/MarketplaceInstalledPage-B4qrvb7w.js +0 -1
  207. package/dist/assets/MarketplacePackagePage-BuVfVeBj.js +0 -4
  208. package/dist/assets/MarketplacePage-Cmltk5nG.js +0 -1
  209. package/dist/assets/MetadataInspector-kVAu8vlh.js +0 -1
  210. package/dist/assets/MetadataProvider-DyFZSNqq.js +0 -1
  211. package/dist/assets/ObjectDataPage-BKHEYwXA.js +0 -1
  212. package/dist/assets/PageView-CTqS-VD9.js +0 -1
  213. package/dist/assets/ProfilePage-CBUxXn5a.js +0 -1
  214. package/dist/assets/PublicFormsPage-B8Dk8fky.js +0 -1
  215. package/dist/assets/RecordDetailView-BBNqsNy9.js +0 -11
  216. package/dist/assets/RecordFormPage-CeUmmc_n.js +0 -1
  217. package/dist/assets/ReportDefaultInspector-CRjDi2Er.js +0 -3
  218. package/dist/assets/ReportView-Cwi_Po4H.js +0 -2
  219. package/dist/assets/SearchResultsPage-Cg0oq2by.js +0 -1
  220. package/dist/assets/SettingsHub-B5_S9YgI.js +0 -1
  221. package/dist/assets/SettingsView-Csi1awf-.js +0 -1
  222. package/dist/assets/SystemHubPage-CnDri9oU.js +0 -1
  223. package/dist/assets/architecture-TIHT7OUA-B8Ln-u1a.js +0 -1
  224. package/dist/assets/blockDiagram-VBNYF7ZC-l_P_W7_Y.js +0 -132
  225. package/dist/assets/c4Diagram-5PPSVZJV-CE82HAlO.js +0 -10
  226. package/dist/assets/channel-DowAYf9b.js +0 -1
  227. package/dist/assets/chunk-3NCLNEKW-Z5ckM4mG.js +0 -1
  228. package/dist/assets/chunk-7BUUIJ7U-Bb538aSH.js +0 -1
  229. package/dist/assets/chunk-7Z6QIM7H-m6s_oalL.js +0 -10
  230. package/dist/assets/chunk-I66GZJ75-BsY3mBMx.js +0 -127
  231. package/dist/assets/chunk-J7OUQ5F2-Cl4FNR_k.js +0 -1
  232. package/dist/assets/chunk-JQJVKLGR-BApWxqMA.js +0 -156
  233. package/dist/assets/chunk-NSK5VX7P-BBTxIP6Z.js +0 -2
  234. package/dist/assets/chunk-QR6OTTB3-DJcD7xr-.js +0 -62
  235. package/dist/assets/chunk-RYQCIY6F-CnMsR_qh.js +0 -1
  236. package/dist/assets/chunk-UBXNYLIW-B7z1tp3V.js +0 -1
  237. package/dist/assets/chunk-W5SLKNZC-BnMc5i0B.js +0 -1
  238. package/dist/assets/chunk-WRU74C26-MrzCPX2E.js +0 -70
  239. package/dist/assets/chunk-XXDRQBXY-NKBlW2Dm.js +0 -1
  240. package/dist/assets/chunk-ZIRB5QZD-O39ZBUk3.js +0 -32
  241. package/dist/assets/classDiagram-JCYQIIEL-C4ADaKBz.js +0 -1
  242. package/dist/assets/classDiagram-v2-OCEON4UE-C4ADaKBz.js +0 -1
  243. package/dist/assets/createDerive-B3AGnDaY.js +0 -1
  244. package/dist/assets/cynefin-VYW2F7L2-exAq6djZ.js +0 -1
  245. package/dist/assets/cytoscape.esm-B-NFISlW.js +0 -321
  246. package/dist/assets/dagre-Buvkdvvj.js +0 -1
  247. package/dist/assets/dagre-VZM6K2ZE-B5E8-xuM.js +0 -4
  248. package/dist/assets/dist-Ck19TqqJ.js +0 -5
  249. package/dist/assets/erDiagram-JOGREHBK-BU4b8mUv.js +0 -85
  250. package/dist/assets/eventmodeling-45OFAUF4-DVTVIsGT.js +0 -1
  251. package/dist/assets/flowDiagram-UKHOOZJN-BDHHPApJ.js +0 -1
  252. package/dist/assets/framework-BwfIhdyz.js +0 -55
  253. package/dist/assets/gitGraph-TEB2WS4Q-DizXBl0d.js +0 -1
  254. package/dist/assets/i18n-rra-09wp.js +0 -9
  255. package/dist/assets/index-BLepsDd_.js +0 -19
  256. package/dist/assets/index-D26gl3rg.css +0 -2
  257. package/dist/assets/info-DKCQHKI2-CfAGND28.js +0 -1
  258. package/dist/assets/infrastructure-BCTDJsqi.js +0 -3
  259. package/dist/assets/map-BaFkSB1l.js +0 -1
  260. package/dist/assets/mermaid-GHXKKRXX-CR9PcY0X.js +0 -1
  261. package/dist/assets/mermaid.core-BwiBFu_S.js +0 -10
  262. package/dist/assets/metadata-admin-BE9_-F_f.js +0 -25
  263. package/dist/assets/packet-7NZHBO7P-DeymwuCa.js +0 -1
  264. package/dist/assets/pie-RZYD4A2V-C2S5u8nr.js +0 -1
  265. package/dist/assets/plugin-calendar-BfY9ZunQ.js +0 -1
  266. package/dist/assets/plugin-charts-CmWL7Og-.js +0 -7
  267. package/dist/assets/plugin-chatbot-mxoQfkdx.js +0 -120
  268. package/dist/assets/plugin-dashboard-CzbAW1Rz.js +0 -6
  269. package/dist/assets/plugin-form-ItAwTFz-.js +0 -1
  270. package/dist/assets/plugin-gantt-DF5W5xkN.js +0 -64
  271. package/dist/assets/plugin-grid-B42Photo.js +0 -9
  272. package/dist/assets/plugin-kanban-Dh3HIJIm.js +0 -1
  273. package/dist/assets/plugin-map-C1wSLqlB.js +0 -1
  274. package/dist/assets/plugin-report-yfOfZPQg.js +0 -59
  275. package/dist/assets/plugin-timeline-BpuaaqBd.js +0 -1
  276. package/dist/assets/plugin-tree-BrXE50se.js +0 -1
  277. package/dist/assets/plugin-view-Jc0rkk7A.js +0 -1
  278. package/dist/assets/plugins-views-cOiN-mPq.js +0 -4
  279. package/dist/assets/radar-I7S5WNFK-DzcfTC8k.js +0 -1
  280. package/dist/assets/railroad-3IZDKUUU-DT2-gzup.js +0 -1
  281. package/dist/assets/railroad-abnf-AHOZXSZD-BvCkhVdg.js +0 -1
  282. package/dist/assets/railroad-ebnf-EBAXGLYW-rvjxEE4k.js +0 -1
  283. package/dist/assets/railroad-peg-LSFZ7HO6-BIzZt1tD.js +0 -1
  284. package/dist/assets/skeletons-BwA1TSR2.js +0 -1
  285. package/dist/assets/src-BLbFBP_B.js +0 -1
  286. package/dist/assets/stateDiagram-v2-UEYNNEHI-DaTg8C5m.js +0 -1
  287. package/dist/assets/swimlanes-SLNWSIFB-wrx1JN6o.js +0 -1
  288. package/dist/assets/swimlanesDiagram-ULZ7WXOC-Bqz9GVuM.js +0 -8
  289. package/dist/assets/treeView-QDETBFTQ-DKZwqlNb.js +0 -1
  290. package/dist/assets/treemap-6X3UGDF4-Bqsldamv.js +0 -1
  291. package/dist/assets/ui-components-Dwq5utCl.js +0 -42
  292. package/dist/assets/ui-layout-DPFlQaQp.js +0 -1
  293. package/dist/assets/use-book-data-CZc8MJsb.js +0 -1
  294. package/dist/assets/useActionModal-DYiSBx1G.js +0 -1
  295. package/dist/assets/usePackageL10n-D91-102Q.js +0 -1
  296. package/dist/assets/useSettingsLabel-CeZ36S4g.js +0 -1
  297. package/dist/assets/vendor-i18n-Cpia2wlg.js +0 -1
  298. package/dist/assets/vendor-objectstack-B1R3ym-9.js +0 -264
  299. package/dist/assets/wardley-OPB4EBWU-C_U_bbc2.js +0 -1
  300. /package/dist/assets/{sizeCapture-X5ZJPWSS-B0uUizjq.js → sizeCapture-INFHLROL-B0uUizjq.js} +0 -0
package/README.md CHANGED
@@ -1,20 +1,24 @@
1
1
  # @objectstack/console
2
2
 
3
- **Prebuilt Console SPA, version-locked to `@objectstack/framework`.**
3
+ **Prebuilt Console SPA, version-locked to the framework release that ships it.**
4
4
 
5
5
  This package contains nothing but a prebuilt `dist/` directory: the static
6
6
  assets of the ObjectStack runtime Console, baked at the commit of
7
7
  [`objectstack-ai/objectui`](https://github.com/objectstack-ai/objectui)
8
8
  recorded in [`.objectui-sha`](../../.objectui-sha) of this framework release.
9
9
 
10
- It exists so that a single
10
+ You never install it directly. `@objectstack/cli` declares it as a
11
+ dependency, and both ship at the same version from the Changesets `fixed`
12
+ group (see [`.changeset/config.json`](../../.changeset/config.json)), so
13
+ scaffolding an app
11
14
 
12
15
  ```sh
13
- pnpm add @objectstack/framework
16
+ npx create-objectstack
14
17
  ```
15
18
 
16
- always pulls in a Console build matched to the framework version — no
17
- second npm dependency to keep in sync.
19
+ — or adding `@objectstack/cli` to an existing one — always pulls in a Console
20
+ build matched to the framework version, with no second npm dependency to keep
21
+ in sync.
18
22
 
19
23
  ## Relationship to `@object-ui/console`
20
24
 
@@ -22,13 +26,25 @@ second npm dependency to keep in sync.
22
26
  |---|---|---|
23
27
  | Repo | [`objectstack-ai/objectui`](https://github.com/objectstack-ai/objectui) | [`objectstack-ai/objectstack`](https://github.com/objectstack-ai/objectstack) |
24
28
  | Role | Standalone Console SPA on its own release cadence | Prebuilt SPA frozen at the SHA this framework release was tested against |
25
- | Use | Cloud overlays, advanced users, anyone consuming Console directly | Default install for `@objectstack/framework` consumers |
29
+ | Use | Cloud overlays, advanced users, anyone consuming Console directly | What every `@objectstack/cli` install gets by default |
26
30
 
27
31
  The framework CLI's `resolveConsolePath()` (in
28
- `packages/cli/src/utils/console.ts`) prefers `@objectstack/console` and
29
- falls back to `@object-ui/console` when present — so cloud's Docker
30
- overlay (which `cp -r`s its build over `node_modules/@object-ui/console`)
31
- keeps working.
32
+ `packages/cli/src/utils/console.ts`) resolves `@objectstack/console` and
33
+ nothing else — `require.resolve('@objectstack/console/package.json')` from
34
+ the app and from the CLI itself, then a direct
35
+ `<cwd>/node_modules/@objectstack/console` check. Both require the resolved
36
+ `package.json` to be *named* `@objectstack/console`, so there is **no**
37
+ `node_modules` fallback to the `@object-ui/console` npm package; it is
38
+ never consulted.
39
+
40
+ `@object-ui/console` survives in the CLI in exactly one place: the
41
+ sibling-repo dev fallback, which accepts a checked-out **source** tree at
42
+ `../objectui/apps/console` whose `package.json` `name` is either spelling
43
+ (objectui still names that workspace package `@object-ui/console`). That is
44
+ a source-checkout probe for developing the framework against in-tree
45
+ objectui edits — not a package resolution. Cloud and objectos Docker images
46
+ overlay their own Console build into `@objectstack/console`'s `dist/` — not
47
+ into any `@object-ui/console` directory.
32
48
 
33
49
  ## Updating
34
50
 
@@ -6,8 +6,8 @@
6
6
  "name": "@objectstack/spec",
7
7
  "injectedFrom": "/home/runner/work/objectstack/objectstack/packages/spec",
8
8
  "skew": true,
9
- "freshWitness": "Dotted config path inside the submitted seed set (`seeds.0.mode`), so an author can jump to the offending key. May be empty for a whole-request finding.",
10
- "staleDetector": "2X large border radius (e.g., 1rem)"
9
+ "freshWitness": "A { $field } reference to the numeric column holding the day offset",
10
+ "staleDetector": "A lowered `functions` declaration: what the function declared about itself, with its callable replaced by a handler ref (#4976)"
11
11
  }
12
12
  ]
13
13
  }
@@ -1 +1 @@
1
- 190fbd01d0615e2e168faf9e08b8ad7844bc039d
1
+ 00d3f09c500c4a45b5f27aca8af80349412faaf1
@@ -0,0 +1,9 @@
1
+ import{o as e,t}from"./rolldown-runtime-C0FnF6B9.js";import{b as n,r}from"./vendor-react-CsWFRkED.js";import{g as i}from"./infrastructure-CIpDEFyQ.js";import{Fr as a,Tt as o,Wn as s,qn as c,qr as l}from"./framework-BfSv4Kb0.js";import{a as u,y as d}from"./i18n-locales-Bz4c8KXc.js";import{Bn as f,Cr as p,Cs as m,Fs as h,G as g,Sr as _,Ss as v,Xr as y,_ as b,br as x,gc as S,p as C,vr as w,xr as T,yr as E}from"./ui-components-D2lrjG-t.js";var D=e(n(),1),O=r(),k=(0,D.createContext)({favorites:null,recent:null,flowPaletteRecents:null}),A=(0,D.createContext)(null);function j({children:e}){let[t,n]=(0,D.useState)({favorites:null,recent:null,flowPaletteRecents:null}),r=(0,D.useRef)({attach:(e,t)=>{n(n=>n[e]===t?n:{...n,[e]:t})}});return(0,O.jsx)(A.Provider,{value:r.current,children:(0,O.jsx)(k.Provider,{value:t,children:e})})}function M(e){return(0,D.useContext)(k)[e]}function ee(){let e=(0,D.useContext)(A);return(0,D.useCallback)((t,n)=>{e?.attach(t,n)},[e])}function N(e,t){return t?`${e}:u:${t}`:e}function P(e,t){let n=(0,D.useRef)(t);n.current=t,(0,D.useEffect)(()=>{if(typeof window>`u`)return;let t=t=>{if(t.key===e&&t.storageArea===localStorage){if(t.newValue==null){n.current(null);return}try{n.current(JSON.parse(t.newValue))}catch{n.current(null)}}};return window.addEventListener(`storage`,t),()=>window.removeEventListener(`storage`,t)},[e])}function F(e,t=500){let n=null,r=null,i=!1,a=async()=>{if(n&&=(clearTimeout(n),null),!i)return;let t=r;i=!1,r=null;try{await e(t)}catch{}};return{schedule:e=>{r=e,i=!0,n&&clearTimeout(n),n=setTimeout(()=>{n=null,a()},t)},flush:a,cancel:()=>{n&&clearTimeout(n),n=null,i=!1,r=null}}}var I=`objectui-recent-items`,L=8;function R(e){try{let t=localStorage.getItem(N(I,e));return t?JSON.parse(t):[]}catch{return[]}}function z(e,t){try{localStorage.setItem(N(I,t),JSON.stringify(e))}catch{}}var B=(0,D.createContext)(null);function te({children:e}){let{user:t}=i(),n=t?.id??null,r=M(`recent`),[a,o]=(0,D.useState)(()=>R(n));(0,D.useEffect)(()=>{o(R(n))},[n]),P(N(I,n),e=>{o(Array.isArray(e)?e.filter(e=>e&&typeof e.id==`string`).slice(0,L):[])});let s=(0,D.useRef)(0);(0,D.useEffect)(()=>{if(!r)return;let e=++s.current,t=!1;return(async()=>{try{let i=await r.load();if(t||e!==s.current)return;let a=(Array.isArray(i)?i:[]).filter(e=>e&&typeof e.id==`string`).slice(0,L);o(a),z(a,n)}catch{}})(),()=>{t=!0}},[r,n]);let c=(0,D.useMemo)(()=>F(async e=>{r&&await r.save(e)},500),[r]);(0,D.useEffect)(()=>()=>{c.flush()},[c]);let l=(0,D.useCallback)(e=>{z(e,n),r&&c.schedule(e)},[n,r,c]),u=(0,D.useCallback)(e=>{o(t=>{let n=t.filter(t=>t.id!==e.id),r=[{...e,visitedAt:new Date().toISOString()},...n].slice(0,L);return l(r),r})},[l]),d=(0,D.useCallback)(()=>{o([]),l([])},[l]),f=(0,D.useMemo)(()=>({recentItems:a,addRecentItem:u,clearRecentItems:d}),[a,u,d]);return(0,O.jsx)(B.Provider,{value:f,children:e})}function ne(){return(0,D.useContext)(B)||{recentItems:[],addRecentItem:()=>{},clearRecentItems:()=>{}}}var re={checkbox:`boolean`,reference:`lookup`,"datetime-local":`datetime`};function V(e){return b(re[e]??e)}var ie=new Set([`lookup`,`master_detail`]);function H(e){return ie.has(V(e.type))&&!e.referenceTo}function U(e){let t=V(e.type);H(e)&&(t=`text`);let n={name:e.name,label:e.label,type:t,required:e.required,placeholder:e.placeholder,options:e.options,multiple:e.multiple,accept:e.accept,maxSize:e.maxSize};return t===`boolean`&&(n.widget=`checkbox`),a.has(t)&&Object.assign(n,{reference_to:e.referenceTo,display_field:e.displayField,id_field:e.idField,description_field:e.descriptionField,title_format:e.titleFormat,lookup_columns:e.lookupColumns,lookup_filters:e.lookupFilters,lookup_page_size:e.lookupPageSize,depends_on:e.dependsOn}),n}function ae(e,t,n){return e.filter(e=>{let r=e.visible;return l(r)?typeof r==`boolean`?r:c(r,null,{fallback:!0,scope:t,rowless:!0,warnOnError:!0,label:n?`param "${e.name}" of action "${n}"`:`param "${e.name}"`}):!0})}function oe(e,t){let n=new Set;for(let t of e){let e=U(t).type;(e===`file`||e===`image`)&&n.add(t.name)}if(n.size===0)return t;let r=e=>g(e)??e,i={...t};for(let e of n){let t=i[e];t!=null&&(i[e]=Array.isArray(t)?t.map(r):r(t))}return i}function se(){return(0,O.jsx)(`div`,{className:`h-9 w-full animate-pulse rounded-md bg-muted`,"aria-hidden":`true`})}function ce({state:e,onOpenChange:t}){let{t:n,language:r}=d(),[i,a]=(0,D.useState)({}),[c,l]=(0,D.useState)({}),[m,h]=(0,D.useState)({}),g=Object.values(m).some(Boolean),v=o(),b=(0,D.useMemo)(()=>ae(e.params,v,e.title),[e.params,v,e.title]);(0,D.useEffect)(()=>{if(e.open){let e={};for(let t of b)t.defaultValue!==void 0&&(e[t.name]=t.defaultValue);a(e),l({}),h({})}},[e.open,b]);let S=e=>e==null?!0:typeof e==`string`?e.trim()===``:Array.isArray(e)?e.length===0:!1,k=()=>{if(g)return;let n={};for(let e of b)e.required&&S(i[e.name])&&(n[e.name]=!0);if(Object.keys(n).length>0){l(n);return}e.resolve?.(oe(b,i)),t(!1)},A=()=>{e.resolve?.(null),t(!1)},j=(e,t)=>{a(n=>({...n,[e]:t})),l(t=>({...t,[e]:!1}))};return(0,O.jsx)(w,{open:e.open,onOpenChange:e=>{e||A()},children:(0,O.jsxs)(E,{children:[(0,O.jsxs)(_,{children:[(0,O.jsx)(p,{children:e.title||n(`actionDialog.title`)}),(0,O.jsx)(x,{className:`whitespace-pre-line`,children:e.description||n(`actionDialog.description`)})]}),(0,O.jsx)(`div`,{className:`grid gap-4 py-4`,children:b.map(e=>{let t={...e,label:u(e.label,r),helpText:e.helpText==null?e.helpText:u(e.helpText,r),options:e.options?.map(e=>({...e,label:u(e.label,r)}))},a=U(t),o=C(a.type),l=a.type===`file`||a.type===`image`?{onUploadingChange:e=>h(n=>({...n,[t.name]:e}))}:{},d=s.has(a.type)?{dependentValues:i}:{},p=H(t);return a.type===`select`&&!a.placeholder&&(a.placeholder=n(`actionDialog.selectPlaceholder`,{label:t.label})),p&&!a.placeholder&&(a.placeholder=n(`actionDialog.lookupPlaceholder`,{label:t.label})),a.type===`boolean`?(0,O.jsxs)(`div`,{className:`grid gap-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(`div`,{className:`size-4 mt-0.5 animate-pulse rounded-sm bg-muted`,"aria-hidden":`true`}),children:(0,O.jsx)(o,{id:t.name,value:i[t.name]===!0,onChange:e=>j(t.name,e===!0),field:a,className:`mt-0.5`,"aria-required":t.required||void 0})}),(0,O.jsxs)(f,{htmlFor:t.name,className:`font-normal cursor-pointer`,children:[t.label,t.required&&(0,O.jsx)(`span`,{className:`text-destructive ml-1`,"aria-hidden":`true`,children:`*`})]})]}),c[t.name]&&(0,O.jsx)(`p`,{className:`text-xs text-destructive ml-6`,children:n(`actionDialog.requiredError`,{label:t.label})}),t.helpText&&(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground ml-6`,children:t.helpText})]},t.name):(0,O.jsxs)(`div`,{className:`grid gap-2`,children:[(0,O.jsxs)(f,{htmlFor:t.name,children:[t.label,t.required&&(0,O.jsx)(`span`,{className:`text-destructive ml-1`,"aria-hidden":`true`,children:`*`})]}),(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(se,{}),children:(0,O.jsx)(o,{id:t.name,value:i[t.name]??null,onChange:e=>j(t.name,e),field:a,className:c[t.name]?`border-destructive`:``,"aria-required":t.required||void 0,...l,...d})}),c[t.name]&&(0,O.jsx)(`p`,{className:`text-xs text-destructive`,children:n(`actionDialog.requiredError`,{label:t.label})}),t.helpText&&(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.helpText}),p&&!t.helpText&&(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`actionDialog.lookupHelpText`)})]},t.name)})}),(0,O.jsxs)(T,{children:[(0,O.jsx)(y,{variant:`outline`,onClick:A,children:n(`actionDialog.cancel`)}),(0,O.jsx)(y,{onClick:k,disabled:g,children:n(g?`actionDialog.uploading`:`actionDialog.confirm`)})]})]})})}var le=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),W=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),G=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),ue=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),de=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),fe=t((e=>{var t=W().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),pe=t((e=>{var t=W().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),me=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),K=t((e=>{var t=G(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),he=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),ge=t((e=>{var t=he();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),_e=t(((e,t)=>{var n=ge();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),q=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),J=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
2
+ ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),Y=t((e=>{var t=q(),n=J();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),ve=t((e=>{var t=W(),n=K(),r=G(),i=Y(),a=q(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),ye=t((e=>{var t=W(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),be=t(((e,t)=>{var n=Y();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),xe=t(((e,t)=>{var n=Y(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),Se=t(((e,t)=>{var n=Y();function r(e){this.mode=n.BYTE,this.data=typeof e==`string`?new TextEncoder().encode(e):new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),Ce=t(((e,t)=>{var n=Y(),r=W();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
3
+ Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),we=t(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),Te=t((e=>{var t=Y(),n=be(),r=xe(),i=Se(),a=Ce(),o=J(),s=W(),c=we();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
4
+ Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),Ee=t((e=>{var t=W(),n=G(),r=ue(),i=de(),a=fe(),o=pe(),s=me(),c=K(),l=_e(),u=ve(),d=ye(),f=Y(),p=Te();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
5
+ The chosen QR Code version cannot contain this amount of data.
6
+ Minimum version required to store current data is: `+c+`.
7
+ `);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),X=t((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||(e.color={});let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),De=t((e=>{var t=X();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),Oe=t((e=>{var t=X();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
8
+ `;return typeof a==`function`&&a(null,p),p}})),Z=t((e=>{var t=le(),n=Ee(),r=De(),i=Oe();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})})),ke=Z();function Ae(e,t){if(e!=null)return t.split(`.`).reduce((e,t)=>{if(e!=null)return e[t]},e)}function je({state:e,onAcknowledge:t}){let{t:n}=d(),{spec:r,data:i}=e,a=(0,D.useMemo)(()=>(r?.fields&&r.fields.length>0?r.fields:[{path:``,label:void 0,format:r?.format??`json`}]).map(e=>({field:e,value:e.path===``?i:Ae(i,e.path)})).filter(({field:e,value:t})=>e.path===``||t!==void 0),[r,i]);return(0,O.jsx)(w,{open:e.open,onOpenChange:e=>{},children:(0,O.jsxs)(E,{onPointerDownOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),className:`max-w-lg`,children:[(0,O.jsxs)(_,{children:[(0,O.jsx)(p,{children:r?.title||n(`actions.resultDialog.defaultTitle`)||`Save this value now`}),r?.description?(0,O.jsx)(x,{children:r.description}):null]}),(0,O.jsx)(`div`,{className:`space-y-4 py-2`,children:a.map(({field:e,value:t},n)=>(0,O.jsx)(Q,{field:e,value:t,defaultFormat:r?.format},`${e.path}-${n}`))}),(0,O.jsx)(T,{children:(0,O.jsx)(y,{onClick:t,children:r?.acknowledge||n(`actions.resultDialog.acknowledge`)||`I have saved this`})})]})})}function Q({field:e,value:t,defaultFormat:n}){let r=e.format??n??`json`,i=e.label,a=r===`qrcode`&&typeof t!=`string`||r===`code-list`&&!Array.isArray(t)||(r===`secret`||r===`text`)&&typeof t!=`string`?`json`:r;return(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[i?(0,O.jsx)(`div`,{className:`text-sm font-medium text-foreground/80`,children:i}):null,a===`qrcode`?(0,O.jsx)(Ne,{value:t}):null,a===`code-list`?(0,O.jsx)(Pe,{value:t}):null,a===`secret`?(0,O.jsx)(Fe,{value:t}):null,a===`text`?(0,O.jsx)(Ie,{value:t}):null,a===`json`?(0,O.jsx)(Le,{value:t}):null]})}function Me(e){let[t,n]=(0,D.useState)(!1);return(0,D.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>n(!1),1500);return()=>clearTimeout(e)},[t]),{copy:async()=>{if(e!=null)try{await navigator.clipboard.writeText(e),n(!0)}catch{}},copied:t}}function $({value:e,label:t}){let{copy:n,copied:r}=Me(e);return(0,O.jsxs)(y,{type:`button`,variant:`outline`,size:`sm`,onClick:n,children:[r?(0,O.jsx)(S,{className:`w-4 h-4`}):(0,O.jsx)(h,{className:`w-4 h-4`}),t?(0,O.jsx)(`span`,{className:`ml-2`,children:t}):null]})}function Ne({value:e}){let[t,n]=(0,D.useState)(null);return(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{className:`flex justify-center rounded-md border bg-white p-3`,children:t?(0,O.jsx)(`span`,{className:`text-sm text-destructive`,children:t}):(0,O.jsx)(`canvas`,{ref:t=>{!t||!e||(0,ke.toCanvas)(t,e,{width:200,margin:1},e=>{e&&n(e.message)})}})}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`code`,{className:`flex-1 truncate rounded bg-muted px-2 py-1 text-xs font-mono`,children:e}),(0,O.jsx)($,{value:e})]})]})}function Pe({value:e}){let{t}=d(),n=e.join(`
9
+ `);return(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{className:`rounded-md border bg-muted/40 p-2`,children:(0,O.jsx)(`ul`,{className:`space-y-1`,children:e.map((e,t)=>(0,O.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`code`,{className:`flex-1 rounded bg-background px-2 py-1 text-sm font-mono`,children:e}),(0,O.jsx)($,{value:e})]},`${t}-${e}`))})}),(0,O.jsx)(`div`,{className:`flex justify-end`,children:(0,O.jsx)($,{value:n,label:t(`actions.resultDialog.copyAll`)})})]})}function Fe({value:e}){let[t,n]=(0,D.useState)(!1);return(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`code`,{className:`flex-1 rounded bg-muted px-2 py-1 text-sm font-mono break-all`,children:t?e:e.replace(/./g,`•`)}),(0,O.jsx)(y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>n(e=>!e),children:t?(0,O.jsx)(m,{className:`w-4 h-4`}):(0,O.jsx)(v,{className:`w-4 h-4`})}),(0,O.jsx)($,{value:e})]})}function Ie({value:e}){return(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`code`,{className:`flex-1 rounded bg-muted px-2 py-1 text-sm font-mono break-all`,children:e}),(0,O.jsx)($,{value:e})]})}function Le({value:e}){let t=(0,D.useMemo)(()=>{try{return JSON.stringify(e,null,2)}catch{return String(e)}},[e]);return(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`pre`,{className:`max-h-80 overflow-auto rounded-md border bg-muted/40 p-3 text-xs font-mono`,children:t}),(0,O.jsx)(`div`,{className:`flex justify-end`,children:(0,O.jsx)($,{value:t})})]})}export{V as a,j as c,ee as d,P as f,H as i,F as l,Z as n,te as o,M as p,ce as r,ne as s,je as t,N as u};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,r as n}from"./vendor-react-CsWFRkED.js";import{n as r}from"./plugin-chatbot-mxoQfkdx.js";var i=e(t(),1),a=n();function o(){let e={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_SERVER_URL:``,VITE_USE_MOCK_SERVER:`false`},t=e.VITE_AI_BASE_URL;return t?t.replace(/\/$/,``):`${(e.VITE_SERVER_URL??``).replace(/\/$/,``)}/api/v1/ai`}function s(){let e=(0,i.useMemo)(()=>o(),[]);return(0,a.jsxs)(`div`,{className:`p-6 max-w-6xl mx-auto`,children:[(0,a.jsxs)(`div`,{className:`mb-4`,children:[(0,a.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`AI Approvals`}),(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Review actions an AI agent proposed. Approve to execute them server-side; reject to send a reason back to the model so it can revise the next turn.`})]}),(0,a.jsx)(r,{apiBase:e,variant:`card`,title:`Queue`,description:`Polled every 5 seconds. Decisions are recorded under your identity.`})]})}export{s as AiPendingActionsPage,s as default};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,r as n}from"./vendor-react-CsWFRkED.js";import{n as r}from"./plugin-chatbot-BGnkLzFS.js";var i=e(t(),1),a=n();function o(){let e={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_SERVER_URL:``,VITE_USE_MOCK_SERVER:`false`},t=e.VITE_AI_BASE_URL;return t?t.replace(/\/$/,``):`${(e.VITE_SERVER_URL??``).replace(/\/$/,``)}/api/v1/ai`}function s(){let e=(0,i.useMemo)(()=>o(),[]);return(0,a.jsxs)(`div`,{className:`p-6 max-w-6xl mx-auto`,children:[(0,a.jsxs)(`div`,{className:`mb-4`,children:[(0,a.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`AI Approvals`}),(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Review actions an AI agent proposed. Approve to execute them server-side; reject to send a reason back to the model so it can revise the next turn.`})]}),(0,a.jsx)(r,{apiBase:e,variant:`card`,title:`Queue`,description:`Polled every 5 seconds. Decisions are recorded under your identity.`})]})}export{s as AiPendingActionsPage,s as default};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,r as n}from"./vendor-react-CsWFRkED.js";import{M as r,q as i}from"./framework-BfSv4Kb0.js";import{Da as a,Er as o,Fs as s,Jo as c,Pr as l,Si as u,Tr as d,Us as f,aa as p,gc as m,hc as h,ka as g,ni as _,pc as v,va as y,vo as b,wr as ee}from"./ui-components-D2lrjG-t.js";import"./src-JX1BkhmR.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 (JSON)`,bodyTemplate:{messages:[{role:`user`,content:``}],stream:!1}},{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:`GET`,path:`/status`,desc:`Active LLM adapter provenance`},{method:`GET`,path:`/effective-model`,desc:`Effective model ids and where they came from`},{method:`POST`,path:`/conversations`,desc:`Create conversation`,bodyTemplate:{}},{method:`GET`,path:`/conversations`,desc:`List conversations`},{method:`GET`,path:`/conversations/:id`,desc:`Get conversation with message history`},{method:`PATCH`,path:`/conversations/:id`,desc:`Update conversation (title, metadata)`,bodyTemplate:{title:``}},{method:`DELETE`,path:`/conversations/:id`,desc:`Delete conversation`},{method:`POST`,path:`/conversations/:id/messages`,desc:`Add message to conversation`,bodyTemplate:{role:`user`,content:``}},{method:`GET`,path:`/conversations/:id/debug`,desc:`Reconcile a build conversation: agent-claimed vs live metadata`},{method:`GET`,path:`/agents`,desc:`List active agents`},{method:`POST`,path:`/agents/:agentName/chat`,desc:`Chat with a named agent (JSON)`,bodyTemplate:{messages:[{role:`user`,content:``}],stream:!1}},{method:`GET`,path:`/assistant`,desc:`Resolve the default assistant and its active skills`},{method:`GET`,path:`/assistant/skills`,desc:`List active skills for a context`},{method:`POST`,path:`/assistant/chat`,desc:`Ambient chat — auto-resolves agent and skills (JSON)`,bodyTemplate:{messages:[{role:`user`,content:``}],stream:!1}},{method:`GET`,path:`/tools`,desc:`List registered AI tools`},{method:`POST`,path:`/tools/:toolName/execute`,desc:`Execute one tool directly (playground)`,bodyTemplate:{parameters:{}}},{method:`GET`,path:`/pending-actions`,desc:`List pending actions awaiting approval`},{method:`GET`,path:`/pending-actions/:id`,desc:`Get one pending action`},{method:`POST`,path:`/pending-actions/:id/approve`,desc:`Approve a pending action and execute it`,bodyTemplate:{}},{method:`POST`,path:`/pending-actions/:id/reject`,desc:`Reject a pending action`,bodyTemplate:{reason:``}},{method:`POST`,path:`/evals/runs`,desc:`Run an eval case — ai:admin, makes paid LLM calls`,bodyTemplate:{caseId:``}},{method:`GET`,path:`/usage`,desc:`AI quota headroom per meter (console usage indicator)`}]},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`}]},"file-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`}]}},T={"file-storage":`storage`};function E(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 te(){let e=i(),[t,n]=(0,x.useState)([]),[a,o]=(0,x.useState)([]),[s,c]=(0,x.useState)(!0),[l,u]=(0,x.useState)(null),d=(0,x.useCallback)(async()=>{c(!0),u(null);let t=`/api/v1`,i=`${t}/discovery`,a=[{method:`GET`,path:i,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 s=`/api/v1/auth`,c={},l={};try{let e=await fetch(i);if(e.ok){let t=await e.json(),n=t?.data??t;l=n?.routes??{},c=n?.services??{},l.auth&&(s=l.auth)}}catch{}let u=[];for(let[e,t]of Object.entries(w)){let n=T[e],i=(n?c[n]:void 0)??c[e],a=i?r(i):!1,o=i?.route??l[e]??t.defaultRoute;a&&u.push(...E(e,o))}let d=e?.getClient?.(),f=[];try{let e=await d?.meta?.getTypes?.();e&&Array.isArray(e.types)?f=e.types:Array.isArray(e)&&(f=e)}catch{}let p=[];try{let e=f.includes(`object`)?`object`:null;if(e&&d?.meta?.getItems){let t=await d.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),p=n.map(e=>e.name||e.id).filter(Boolean)}}catch{}let m=p.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}]}),h=f.filter(e=>!S.includes(e)).map(e=>({method:`GET`,path:`${t}/meta/${e}`,desc:`List ${e} metadata`,group:`Metadata`})),g=p.map(e=>({method:`GET`,path:`${t}/meta/object/${e}`,desc:`${e} schema`,group:`Metadata`})),_=[...a,...C(s),...u,...h,...g,...m],v=new Map;for(let e of _){let t=v.get(e.group)||[];t.push(e),v.set(e.group,t)}let y=[`System`,`Auth`,`AI`,`Workflow`,`Realtime`,`Notifications`,`Analytics`,`Automation`,`i18n`,`UI`,`Feed`,`Storage`,`Metadata`],b=Array.from(v.entries()).sort(([e],[t])=>{let n=y.indexOf(e),r=y.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}));n(b),o(_)}catch(e){u(e.message||`Failed to discover APIs`)}finally{c(!1)}},[e]);return(0,x.useEffect)(()=>{d()},[d]),{groups:t,allEndpoints:a,loading:s,error:l,refresh:d}}var D=n(),O={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`},ne={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`},re=[{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`}],k=1;function A(){let e=i()?.getClient?.(),{groups:t,loading:n,refresh:r}=te(),[S,C]=(0,x.useState)(``),[w,T]=(0,x.useState)(new Set),[E,A]=(0,x.useState)(null),[ie,j]=(0,x.useState)(``),[ae,M]=(0,x.useState)(``),[N,P]=(0,x.useState)(``),[F,I]=(0,x.useState)([]),[L,R]=(0,x.useState)(!1),[z,B]=(0,x.useState)(null),[V,H]=(0,x.useState)([]),[U,oe]=(0,x.useState)(null),[W,G]=(0,x.useState)(!1),K=(0,x.useMemo)(()=>{if(!S)return t;let e=S.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,S]),se=(0,x.useCallback)(e=>{T(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),ce=(0,x.useCallback)(e=>{A(e),j(e.method),M(e.path),P(e.bodyTemplate?JSON.stringify(e.bodyTemplate,null,2):``),I([]),B(null)},[]),q=ie||E?.method||`GET`,J=ae||E?.path||``,Y=(0,x.useMemo)(()=>{let e=F.filter(e=>e.enabled&&e.key.trim());if(e.length===0)return J;let t=e.map(e=>`${encodeURIComponent(e.key)}=${encodeURIComponent(e.value)}`).join(`&`);return`${J}?${t}`},[J,F]),X=(0,x.useCallback)((e=``,t=``)=>{I(n=>[...n,{id:k++,key:e,value:t,enabled:!0}])},[]),le=(0,x.useCallback)(e=>{I(t=>t.filter(t=>t.id!==e))},[]),Z=(0,x.useCallback)((e,t,n)=>{I(r=>r.map(r=>r.id===e?{...r,[t]:n}:r))},[]),ue=(0,x.useCallback)(e=>{I(t=>t.map(t=>t.id===e?{...t,enabled:!t.enabled}:t))},[]),Q=(0,x.useCallback)(async()=>{if(L||!Y)return;let t=`${e?.baseUrl??``}${Y}`;R(!0);let n=performance.now();try{let e={method:q,headers:{"Content-Type":`application/json`}};[`POST`,`PATCH`,`PUT`].includes(q)&&N.trim()&&(e.body=N);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();let o={status:r.status,body:a,duration:i};B(o),H(e=>[{id:Date.now(),method:q,url:Y,body:N||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);B({status:0,body:`Network Error: ${e.message}`,duration:t})}finally{R(!1)}},[e,Y,q,N,L]),de=(0,x.useCallback)(e=>{j(e.method);let[t,n]=e.url.split(`?`);if(M(t),P(e.body||``),n){let e=new URLSearchParams(n),t=[];e.forEach((e,n)=>{t.push({id:k++,key:n,value:e,enabled:!0})}),I(t)}else I([]);B(null),A(null)},[]),fe=(0,x.useCallback)(()=>{z?.body&&(navigator.clipboard.writeText(z.body),G(!0),setTimeout(()=>G(!1),1500))},[z]),$=e=>ne[String(e)[0]]??`text-muted-foreground`;return(0,D.jsxs)(`div`,{className:`flex flex-1 min-h-0 overflow-hidden`,children:[(0,D.jsxs)(`div`,{className:`w-72 shrink-0 border-r flex flex-col overflow-hidden`,children:[(0,D.jsxs)(`div`,{className:`p-3 border-b space-y-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`h3`,{className:`text-sm font-semibold text-foreground flex-1`,children:`API Endpoints`}),(0,D.jsx)(`button`,{type:`button`,onClick:r,disabled:n,className:`p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground`,title:`Refresh endpoints`,children:(0,D.jsx)(y,{className:`h-3.5 w-3.5 ${n?`animate-spin`:``}`})})]}),(0,D.jsxs)(`div`,{className:`relative`,children:[(0,D.jsx)(p,{className:`absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,D.jsx)(`input`,{type:`text`,value:S,onChange:e=>C(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,D.jsx)(`div`,{className:`flex-1 overflow-auto p-2 space-y-1`,children:n?(0,D.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,D.jsx)(b,{className:`h-4 w-4 animate-spin mr-2`}),`Discovering APIs...`]}):K.length===0?(0,D.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,D.jsx)(c,{className:`h-6 w-6 opacity-30 mb-2`}),(0,D.jsx)(`span`,{children:S?`No matching endpoints`:`No endpoints found`})]}):K.map(e=>{let t=w.has(e.key)||!!S;return(0,D.jsxs)(ee,{open:t,onOpenChange:()=>se(e.key),children:[(0,D.jsx)(o,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`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,D.jsx)(v,{className:`h-3 w-3 shrink-0 transition-transform duration-200 ${t?`rotate-90`:``}`}),(0,D.jsx)(`span`,{className:`flex-1 text-left truncate`,children:e.label}),(0,D.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums opacity-60`,children:e.endpoints.length})]})}),(0,D.jsx)(d,{children:(0,D.jsx)(`div`,{className:`ml-3 space-y-0.5 mt-0.5`,children:e.endpoints.map((e,t)=>(0,D.jsxs)(`button`,{type:`button`,onClick:()=>ce(e),className:`w-full text-left flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors ${E===e?`bg-accent text-accent-foreground`:`hover:bg-muted/50 text-muted-foreground hover:text-foreground`}`,children:[(0,D.jsx)(l,{variant:`outline`,className:`font-mono text-[9px] shrink-0 px-1 py-0 ${O[e.method]||``}`,children:e.method}),(0,D.jsx)(`span`,{className:`truncate`,children:e.desc})]},`${e.method}-${e.path}-${t}`))})})]},e.key)})}),(0,D.jsxs)(`div`,{className:`p-3 border-t space-y-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsx)(`h4`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:`Query Parameters`}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>X(),className:`inline-flex items-center gap-0.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,D.jsx)(a,{className:`h-3 w-3`}),`Add`]})]}),(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:re.map(e=>(0,D.jsx)(`button`,{type:`button`,onClick:()=>X(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))}),F.length>0&&(0,D.jsx)(`div`,{className:`space-y-1`,children:F.map(e=>(0,D.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:()=>ue(e.id),className:`h-3 w-3 shrink-0 rounded border accent-primary`}),(0,D.jsx)(`input`,{type:`text`,value:e.key,onChange:t=>Z(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,D.jsx)(`input`,{type:`text`,value:e.value,onChange:t=>Z(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,D.jsx)(`button`,{type:`button`,onClick:()=>le(e.id),className:`shrink-0 p-0.5 rounded text-muted-foreground hover:text-destructive transition-colors`,children:(0,D.jsx)(_,{className:`h-3 w-3`})})]},e.id))})]})]}),(0,D.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:[(0,D.jsxs)(`div`,{className:`p-3 border-b space-y-1`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`select`,{value:q,onChange:e=>j(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 ${O[q]||``}`,children:[`GET`,`POST`,`PATCH`,`PUT`,`DELETE`].map(e=>(0,D.jsx)(`option`,{value:e,children:e},e))}),(0,D.jsx)(`input`,{type:`text`,value:J,onChange:e=>M(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`&&Q()}}),(0,D.jsxs)(`button`,{type:`button`,onClick:Q,disabled:L||!Y,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:[L?(0,D.jsx)(b,{className:`h-3.5 w-3.5 animate-spin`}):(0,D.jsx)(g,{className:`h-3.5 w-3.5`}),`Send`]})]}),F.some(e=>e.enabled&&e.key.trim())&&(0,D.jsxs)(`div`,{className:`text-[10px] font-mono text-muted-foreground truncate pl-1`,children:[`→ `,Y]})]}),(0,D.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 overflow-auto`,children:[[`POST`,`PATCH`,`PUT`].includes(q)&&(0,D.jsxs)(`div`,{className:`p-3 border-b space-y-1`,children:[(0,D.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Request Body (JSON)`}),(0,D.jsx)(`textarea`,{value:N,onChange:e=>P(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" }`})]}),L&&(0,D.jsxs)(`div`,{className:`flex items-center justify-center py-8 text-muted-foreground text-sm`,children:[(0,D.jsx)(b,{className:`h-4 w-4 animate-spin mr-2`}),`Sending request...`]}),z&&!L&&(0,D.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col overflow-hidden`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 bg-muted/30 border-b`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,D.jsx)(`span`,{className:`font-mono font-semibold ${$(z.status)}`,children:z.status||`ERR`}),(0,D.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1`,children:[(0,D.jsx)(f,{className:`h-3 w-3`}),z.duration,`ms`]})]}),(0,D.jsxs)(`button`,{type:`button`,onClick:fe,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[W?(0,D.jsx)(m,{className:`h-3 w-3`}):(0,D.jsx)(s,{className:`h-3 w-3`}),W?`Copied`:`Copy`]})]}),(0,D.jsx)(`pre`,{className:`flex-1 overflow-auto p-3 text-xs font-mono bg-muted/10 whitespace-pre-wrap break-all`,children:z.body})]}),!z&&!L&&(0,D.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground text-sm`,children:(0,D.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,D.jsx)(c,{className:`h-10 w-10 mx-auto opacity-20`}),(0,D.jsxs)(`p`,{children:[`Select an endpoint or type a URL and click `,(0,D.jsx)(`strong`,{children:`Send`})]}),(0,D.jsx)(`p`,{className:`text-xs opacity-60`,children:`All registered APIs are auto-discovered from the platform`})]})}),V.length>0&&(0,D.jsxs)(`div`,{className:`border-t`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2`,children:[(0,D.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:[`History (`,V.length,`)`]}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>H([]),className:`inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:[(0,D.jsx)(u,{className:`h-3 w-3`}),`Clear`]})]}),(0,D.jsx)(`div`,{className:`space-y-0.5 px-2 pb-2 max-h-60 overflow-auto`,children:V.map(e=>(0,D.jsxs)(`div`,{className:`rounded border`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>oe(U===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:[U===e.id?(0,D.jsx)(h,{className:`h-3 w-3 shrink-0`}):(0,D.jsx)(v,{className:`h-3 w-3 shrink-0`}),(0,D.jsx)(l,{variant:`outline`,className:`font-mono text-[9px] shrink-0 ${O[e.method]||``}`,children:e.method}),(0,D.jsx)(`span`,{className:`font-mono truncate text-left flex-1`,children:e.url}),(0,D.jsx)(`span`,{className:`ml-auto shrink-0 font-mono ${$(e.status)}`,children:e.status}),(0,D.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[e.duration,`ms`]}),(0,D.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),de(e)},className:`shrink-0 p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,title:`Replay request`,children:(0,D.jsx)(g,{className:`h-2.5 w-2.5`})})]}),U===e.id&&(0,D.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{A as ApiConsolePage};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t,b as n,h as r,r as i,s as a}from"./vendor-react-CsWFRkED.js";import{yo as o,zc as s}from"./ui-components-Dwq5utCl.js";import{t as c}from"./DocShell-DMJHUgE5.js";import{a as l,c as u,n as d}from"./use-book-data-CZc8MJsb.js";var f=e(n(),1),p=i();function m(){let{appName:e}=r(),{books:n,docs:i,state:m}=d(),h=(0,f.useMemo)(()=>n.filter(t=>u(t)===e),[n,e]),g=(0,f.useMemo)(()=>l(h,i),[h,i]);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)(a,{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)(t,{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(n=>(0,p.jsx)(`li`,{children:(0,p.jsxs)(t,{to:`/apps/${e}/docs/${n.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:n.label}),n.description?(0,p.jsx)(`div`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:n.description}):n.subtitle?(0,p.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-muted-foreground/70`,children:n.subtitle}):null,(0,p.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground/80`,children:[n.docCount,` `,n.docCount===1?`article`:`articles`]})]})]})},n.name))})})})}export{m as default};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t,b as n,h as r,r as i,s as a}from"./vendor-react-CsWFRkED.js";import{Rc as o,vo as s}from"./ui-components-D2lrjG-t.js";import{t as c}from"./DocShell-Ipy_IDvh.js";import{a as l,c as u,n as d}from"./use-book-data-qUZAxIs0.js";var f=e(n(),1),p=i();function m(){let{appName:e}=r(),{books:n,docs:i,state:m}=d(),h=(0,f.useMemo)(()=>n.filter(t=>u(t)===e),[n,e]),g=(0,f.useMemo)(()=>l(h,i),[h,i]);return m===`loading`?(0,p.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,p.jsx)(s,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})}):g.length===1?(0,p.jsx)(a,{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)(o,{className:`h-10 w-10`}),(0,p.jsx)(`p`,{className:`text-sm`,children:`This app does not ship any documentation yet.`}),(0,p.jsx)(t,{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(n=>(0,p.jsx)(`li`,{children:(0,p.jsxs)(t,{to:`/apps/${e}/docs/${n.slug}`,className:`flex h-full items-start gap-3 rounded-md border border-border p-3 hover:bg-muted/50`,children:[(0,p.jsx)(o,{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:n.label}),n.description?(0,p.jsx)(`div`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:n.description}):n.subtitle?(0,p.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-muted-foreground/70`,children:n.subtitle}):null,(0,p.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground/80`,children:[n.docCount,` `,n.docCount===1?`article`:`articles`]})]})]})},n.name))})})})}export{m as default};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,h as n,p as r,r as i}from"./vendor-react-CsWFRkED.js";import{J as a,q as o}from"./framework-BfSv4Kb0.js";import{y as s}from"./i18n-locales-Bz4c8KXc.js";import{Ci as c,Da as l,Do as u,Dr as d,In as f,Ki as p,Or as m,Pa as h,Pr as g,Ri as _,Si as v,Xr as y,aa as b,kr as x,wi as S,ws as C}from"./ui-components-D2lrjG-t.js";import{r as w}from"./vendor-ui-utils-BFw4cGI6.js";import"./src-JX1BkhmR.js";var T=e(t(),1);function E(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 D=i();function O(e,t){return(e instanceof Error?e.message:String(e??``))||t}function k(){let{t:e}=s(),t=r(),{appName:i}=n(),k=i?`/apps/${i}`:``,{apps:A,refresh:j}=a(),M=o(),N=(0,T.useCallback)(()=>M?.getClient?.()?.meta??null,[M]),P=e(`appManagement.toast.unknownError`,{defaultValue:`unknown error`}),F=(0,T.useCallback)(t=>E(t?.label,e)||t?.name||``,[e]),[I,L]=(0,T.useState)(``),[R,z]=(0,T.useState)(new Set),[B,V]=(0,T.useState)(null),[H,U]=(0,T.useState)(!1),W=(A||[]).filter(t=>{if(!I)return!0;let n=I.toLowerCase();return(t.name||``).toLowerCase().includes(n)||F(t).toLowerCase().includes(n)||(E(t.description,e)||``).toLowerCase().includes(n)}),G=(0,T.useCallback)(e=>{z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),K=(0,T.useCallback)(()=>{R.size===W.length?z(new Set):z(new Set(W.map(e=>e.name)))},[R.size,W]),q=(0,T.useCallback)(async t=>{let n=N();if(!n){w.error(e(`appManagement.toast.noClient`,{defaultValue:`Cannot reach the metadata service`}));return}U(!0);try{let r=t.active===!1;await n.saveItem(`app`,t.name,{...t,active:r}),w.success(r?e(`appManagement.toast.appEnabled`,{defaultValue:`{{name}} enabled`,name:F(t)}):e(`appManagement.toast.appDisabled`,{defaultValue:`{{name}} disabled`,name:F(t)})),await j()}catch(t){w.error(e(`appManagement.toast.toggleFailed`,{defaultValue:`Failed to toggle app status: {{reason}}`,reason:O(t,P)}))}finally{U(!1)}},[j,N,e,F,P]),J=(0,T.useCallback)(async t=>{let n=N();if(!n){w.error(e(`appManagement.toast.noClient`,{defaultValue:`Cannot reach the metadata service`}));return}U(!0);try{let r=(A||[]).filter(e=>e?.isDefault===!0&&e.name!==t.name);for(let e of r)await n.saveItem(`app`,e.name,{...e,isDefault:!1});await n.saveItem(`app`,t.name,{...t,isDefault:!0}),w.success(e(`appManagement.toast.setDefaultDone`,{defaultValue:`{{name}} set as default`,name:F(t)})),await j()}catch(t){w.error(e(`appManagement.toast.setDefaultFailed`,{defaultValue:`Failed to set default app: {{reason}}`,reason:O(t,P)}))}finally{U(!1)}},[A,j,N,e,F,P]),Y=(0,T.useCallback)(async t=>{if(B!==t.name){V(t.name);return}let n=N();if(!n){w.error(e(`appManagement.toast.noClient`,{defaultValue:`Cannot reach the metadata service`}));return}U(!0);try{await n.deleteItem(`app`,t.name),w.success(e(`appManagement.toast.appDeleted`,{defaultValue:`{{name}} deleted`,name:F(t)})),V(null),await j()}catch(t){w.error(e(`appManagement.toast.deleteFailed`,{defaultValue:`Failed to delete app: {{reason}}`,reason:O(t,P)}))}finally{U(!1)}},[B,j,N,e,F,P]),X=(0,T.useCallback)(async t=>{let n=N();if(!n){w.error(e(`appManagement.toast.noClient`,{defaultValue:`Cannot reach the metadata service`}));return}U(!0);let r=0,i=[];try{let a=new Map((A||[]).map(e=>[e?.name,e]));for(let o of R){let s=a.get(o);if(s)try{await n.saveItem(`app`,o,{...s,active:t}),r+=1}catch(t){i.push(e(`appManagement.toast.bulkFailureEntry`,{defaultValue:`{{name}} ({{reason}})`,name:F(s),reason:O(t,P)}))}}if(r>0&&(w.success(t?e(`appManagement.toast.bulkEnabled`,{defaultValue:`{{n}} apps enabled`,n:r}):e(`appManagement.toast.bulkDisabled`,{defaultValue:`{{n}} apps disabled`,n:r})),z(new Set)),i.length>0){let t=e(`appManagement.toast.bulkFailureJoiner`,{defaultValue:`; `});w.error(e(`appManagement.toast.bulkFailed`,{defaultValue:`Failed for {{n}}: {{details}}`,n:i.length,details:i.join(t)}))}await j()}catch(t){w.error(e(`appManagement.toast.bulkOperationFailed`,{defaultValue:`Bulk operation failed: {{reason}}`,reason:O(t,P)}))}finally{U(!1)}},[A,R,j,N,e,F,P]);return(0,D.jsxs)(`div`,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:e(`appManagement.title`,{defaultValue:`Applications`})}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e(`appManagement.subtitle`,{defaultValue:`Manage all configured applications`})})]}),(0,D.jsxs)(y,{onClick:()=>t(`${k}/create-app`),"data-testid":`create-app-btn`,children:[(0,D.jsx)(l,{className:`h-4 w-4 mr-2`}),e(`appManagement.newApp`,{defaultValue:`New App`})]})]}),(0,D.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[(0,D.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,D.jsx)(`label`,{htmlFor:`app-search`,className:`sr-only`,children:e(`appManagement.searchLabel`,{defaultValue:`Search apps`})}),(0,D.jsx)(b,{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,D.jsx)(f,{id:`app-search`,placeholder:e(`appManagement.searchPlaceholder`,{defaultValue:`Search apps…`}),value:I,onChange:e=>L(e.target.value),className:`pl-8`,"data-testid":`app-search-input`})]}),R.size>0&&(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(g,{variant:`secondary`,children:e(`appManagement.selectedCount`,{defaultValue:`{{n}} selected`,n:R.size})}),(0,D.jsx)(y,{variant:`outline`,size:`sm`,onClick:()=>X(!0),disabled:H,children:e(`appManagement.bulkEnable`,{defaultValue:`Enable`})}),(0,D.jsx)(y,{variant:`outline`,size:`sm`,onClick:()=>X(!1),disabled:H,children:e(`appManagement.bulkDisable`,{defaultValue:`Disable`})})]})]}),W.length>0&&(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,D.jsx)(d,{id:`select-all-apps`,checked:R.size===W.length&&W.length>0,onCheckedChange:()=>K()}),(0,D.jsx)(`label`,{htmlFor:`select-all-apps`,className:`cursor-pointer`,children:e(`appManagement.selectAll`,{defaultValue:`Select all ({{n}})`,n:W.length})})]}),W.length===0?(0,D.jsxs)(`div`,{className:`text-center py-12 text-muted-foreground`,"data-testid":`no-apps-message`,children:[(0,D.jsx)(u,{className:`h-12 w-12 mx-auto mb-3 opacity-30`}),(0,D.jsx)(`p`,{children:e(`appManagement.empty`,{defaultValue:`No apps found.`})})]}):(0,D.jsx)(`div`,{className:`grid gap-3`,children:W.map(n=>{let r=n.active!==!1,i=n.isDefault===!0,a=B===n.name,o=F(n);return(0,D.jsx)(m,{className:r?``:`opacity-60`,"data-testid":`app-card-${n.name}`,children:(0,D.jsxs)(x,{className:`flex items-center gap-3 py-3 px-4`,children:[(0,D.jsx)(d,{id:`select-app-${n.name}`,checked:R.has(n.name),onCheckedChange:()=>G(n.name),"aria-label":e(`appManagement.selectApp`,{defaultValue:`Select {{name}}`,name:o}),className:`shrink-0`}),(0,D.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,D.jsx)(u,{className:`h-4 w-4`})}),(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`font-medium truncate`,children:o}),i&&(0,D.jsx)(g,{variant:`default`,className:`text-xs`,children:e(`appManagement.defaultBadge`,{defaultValue:`Default`})}),(0,D.jsx)(g,{variant:r?`secondary`:`outline`,className:`text-xs`,children:r?e(`appManagement.active`,{defaultValue:`Active`}):e(`appManagement.inactive`,{defaultValue:`Inactive`})})]}),n.description&&(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:E(n.description,e)})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,D.jsx)(y,{variant:`ghost`,size:`icon`,title:e(`appManagement.openApp`,{defaultValue:`Open app`}),"aria-label":e(`appManagement.openAppNamed`,{defaultValue:`Open {{name}}`,name:o}),onClick:()=>t(`/apps/${n._packageId??n.name}`),children:(0,D.jsx)(C,{className:`h-4 w-4`})}),(0,D.jsx)(y,{variant:`ghost`,size:`icon`,title:e(`appManagement.editApp`,{defaultValue:`Edit app`}),"aria-label":e(`appManagement.editAppNamed`,{defaultValue:`Edit {{name}}`,name:o}),onClick:()=>t(`${k}/edit-app/${n.name}`),children:(0,D.jsx)(h,{className:`h-4 w-4`})}),n._packageId?(0,D.jsx)(y,{variant:`ghost`,size:`icon`,title:e(`appManagement.editWithAi`,{defaultValue:`Edit with AI`}),"aria-label":e(`appManagement.editWithAiNamed`,{defaultValue:`Edit {{name}} with AI`,name:o}),onClick:()=>t(`/ai/build?package=${encodeURIComponent(n._packageId)}&new=1`),children:(0,D.jsx)(p,{className:`h-4 w-4`})}):null,(0,D.jsx)(y,{variant:`ghost`,size:`icon`,title:r?e(`appManagement.disableApp`,{defaultValue:`Disable app`}):e(`appManagement.enableApp`,{defaultValue:`Enable app`}),"aria-label":r?e(`appManagement.disableAppNamed`,{defaultValue:`Disable {{name}}`,name:o}):e(`appManagement.enableAppNamed`,{defaultValue:`Enable {{name}}`,name:o}),onClick:()=>q(n),disabled:H,children:r?(0,D.jsx)(c,{className:`h-4 w-4`}):(0,D.jsx)(S,{className:`h-4 w-4`})}),(0,D.jsx)(y,{variant:`ghost`,size:`icon`,title:e(`appManagement.setDefault`,{defaultValue:`Set as default`}),"aria-label":e(`appManagement.setDefaultNamed`,{defaultValue:`Set {{name}} as default`,name:o}),onClick:()=>J(n),disabled:H||i,children:(0,D.jsx)(_,{className:`h-4 w-4 ${i?`fill-current text-yellow-500`:``}`})}),(0,D.jsx)(y,{variant:`ghost`,size:`icon`,title:a?e(`appManagement.confirmDelete`,{defaultValue:`Click again to confirm delete`}):e(`appManagement.deleteApp`,{defaultValue:`Delete app`}),"aria-label":a?e(`appManagement.confirmDeleteNamed`,{defaultValue:`Confirm delete {{name}}`,name:o}):e(`appManagement.deleteAppNamed`,{defaultValue:`Delete {{name}}`,name:o}),onClick:()=>Y(n),disabled:H,className:a?`text-destructive`:``,children:(0,D.jsx)(v,{className:`h-4 w-4`})})]})]})},n.name)})})]})}export{k as AppManagementPage};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t,b as n,g as r,h as i,r as a}from"./vendor-react-CsWFRkED.js";import{c as o,g as s,n as c,y as ee}from"./infrastructure-CIpDEFyQ.js";import{q as te}from"./framework-BfSv4Kb0.js";import{y as ne}from"./i18n-locales-Bz4c8KXc.js";import{Bt as re,Cn as ie,Dn as ae,Dr as oe,En as l,Fs as se,Gr as ce,Gt as u,Hr as le,Ht as ue,Ia as de,In as fe,Jr as pe,Js as me,Jt as he,Kr as ge,Kt as d,On as _e,Or as ve,Pr as f,Rr as ye,Sn as be,Tn as xe,Ur as Se,Us as Ce,Ut as we,Vr as Te,Vt as Ee,Wi as De,Wr as Oe,Wt as ke,Xr as p,Yc as Ae,Yr as je,Ys as Me,aa as Ne,bn as Pe,di as Fe,ea as Ie,gc as Le,gn as m,ht as Re,ia as ze,ic as Be,ii as Ve,il as h,kr as He,mc as Ue,mt as We,ni as Ge,pc as Ke,qr as qe,qt as Je,sc as Ye,va as Xe,vn as Ze,vt as Qe,wn as $e,ws as et,xn as tt,yn as nt,zr as rt,zt as it}from"./ui-components-D2lrjG-t.js";import{r as g}from"./vendor-ui-utils-BFw4cGI6.js";import{r as at,y as ot}from"./RecordDetailView-A8bbPnkK.js";import"./src-JX1BkhmR.js";import{t as st}from"./studioEntry-C6G8U-LG.js";var _=e(n(),1),ct=`${``.replace(/\/$/,``)}/api/v1`;async function v(e,t){let n=ee.get(),r=await fetch(`${ct}${e}`,{credentials:`include`,headers:{"Content-Type":`application/json`,...n?{Authorization:`Bearer ${n}`}:{},...t?.headers||{}},...t}),i=null;try{i=await r.json()}catch{}if(!r.ok){let e=i?.code??`HTTP_${r.status}`,t=i?.message??i?.error??r.statusText,n=Error(`${e}: ${t}`);throw n.code=e,n.status=r.status,n.details=i,n}return i}var y={listProcesses(e={}){let t=new URLSearchParams;e.object&&t.set(`object`,e.object),e.activeOnly&&t.set(`activeOnly`,`true`);let n=t.toString();return v(`/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 v(`/approvals/requests${r?`?${r}`:``}`)},async getRequest(e){return{data:await v(`/approvals/requests/${encodeURIComponent(e)}`)}},listActions(e){return v(`/approvals/requests/${encodeURIComponent(e)}/actions`)},async approve(e,t){let n=await v(`/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 v(`/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 v(`/approvals/requests/${encodeURIComponent(e)}/recall`,{method:`POST`,body:JSON.stringify(t)})).request,finalized:!0}},async reassign(e,t){return{data:(await v(`/approvals/requests/${encodeURIComponent(e)}/reassign`,{method:`POST`,body:JSON.stringify(t)})).request}},async remind(e,t={}){let n=await v(`/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 v(`/approvals/requests/${encodeURIComponent(e)}/request-info`,{method:`POST`,body:JSON.stringify(t)})).request}},async sendBack(e,t){let n=await v(`/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 v(`/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 v(`/approvals/requests/${encodeURIComponent(e)}/comment`,{method:`POST`,body:JSON.stringify(t)})).request}},async submit(e){return v(`/approvals/requests`,{method:`POST`,body:JSON.stringify(e)})}};function lt(e){if(!e)return[];let t=new Set;e.id&&t.add(e.id),e.email&&t.add(e.email);let n=[...e.positions||[],...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)}function b(e,t){return`${e}::${t}`}function x(e){return typeof e.object_name==`string`&&e.object_name!==``&&typeof e.record_id==`string`&&e.record_id!==``}function S(e){let t=new Map,n=new Set;for(let r of e){if(!x(r))continue;let e=b(r.object_name,r.record_id);if(n.has(e))continue;n.add(e);let i=t.get(r.object_name);i?i.push(r.record_id):t.set(r.object_name,[r.record_id])}let r=[];for(let[e,n]of t)for(let t=0;t<n.length;t+=100)r.push({objectName:e,ids:n.slice(t,t+100)});return r}function C(e){if(Array.isArray(e))return e;let t=e?.data;return Array.isArray(t)?t:[]}async function ut(e,t){let n=new Map,r=S(t);return await Promise.all(r.map(async({objectName:t,ids:r})=>{let i;try{let n=await e.find(t,{$filter:{id:{$in:r}},$select:[`id`],$top:r.length});i=new Set(C(n).map(e=>e?.id).filter(e=>typeof e==`string`&&e!==``))}catch{return}for(let e of r)n.set(b(t,e),i.has(e))})),n}function dt(e){let t=te(),[n,r]=(0,_.useState)(()=>new Map),i=(0,_.useRef)(new Set),a=(0,_.useRef)(e);a.current=e;let o=(0,_.useMemo)(()=>e.filter(x).map(e=>b(e.object_name,e.record_id)).join(`|`),[e]);return(0,_.useEffect)(()=>{if(!t)return;let e=a.current.filter(e=>x(e)&&!i.current.has(b(e.object_name,e.record_id)));if(e.length===0)return;for(let t of e)x(t)&&i.current.add(b(t.object_name,t.record_id));let n=!1;return ut(t,e).then(e=>{n||e.size===0||r(t=>{let n=new Map(t);for(let[t,r]of e)n.set(t,r);return n})}),()=>{n=!0}},[t,o]),(0,_.useMemo)(()=>({isUnreadable:e=>x(e)&&n.get(b(e.object_name,e.record_id))===!1}),[n])}var w=new Set;function T(e){let t=e?.fields;if(!t||typeof t!=`object`)return w;let n=new Set;if(Array.isArray(t))for(let e of t){if(!e||typeof e!=`object`)continue;let t=e,r=t.name;typeof r==`string`&&r!==``&&t.hidden===!0&&n.add(r)}else for(let[e,r]of Object.entries(t))!r||typeof r!=`object`||r.hidden===!0&&n.add(e);return n.size>0?n:w}async function E(e,t){if(typeof e?.getObjectSchema!=`function`)return w;try{return T(await e.getObjectSchema(t))}catch{return w}}function ft(e){let t=[],n=new Set;for(let r of e)typeof r!=`string`||r===``||n.has(r)||(n.add(r),t.push(r));return t}function pt(e){let t=te(),[n,r]=(0,_.useState)(()=>new Map),i=(0,_.useRef)(new Set),a=(0,_.useRef)(e);a.current=e;let o=(0,_.useMemo)(()=>ft(e).join(`|`),[e]);return(0,_.useEffect)(()=>{if(!t)return;let e=ft(a.current).filter(e=>!i.current.has(e));if(e.length===0)return;for(let t of e)i.current.add(t);let n=!1;return Promise.all(e.map(async e=>[e,await E(t,e)])).then(e=>{n||r(t=>{let n=new Map(t);for(let[t,r]of e)n.set(t,r);return n})}),()=>{n=!0}},[t,o]),(0,_.useMemo)(()=>({forObject:e=>typeof e==`string`&&e!==``?n.get(e)??w:w}),[n])}var D=a(),mt=50,ht={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 gt({status:e,label:t}){return(0,D.jsx)(f,{variant:`outline`,className:h(`font-medium`,ht[e]??``),children:t})}function _t(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function O(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 k(e){return e&&String(e).replace(/^flow:/,``).trim().split(/[_\-\s]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)||`—`}function A(e){return e.process_label||k(e.process_name)}function vt(e){return e.step_label?e.step_label:e.current_step?k(e.current_step):null}function yt(e){return e.submitter_name||O(e.submitter_id)}function bt(e,t){return t.pending_approver_names?.[e]||O(e)}function xt(e,t){let n=t.pending_approver_groups?.[e];return n&&n.length?n.join(` / `):void 0}function St(e){let t=[],n=new Map;for(let r of e.pending_approvers||[]){let i=bt(r,e),a=xt(r,e),o=a?`${i} ${a}`:i,s=n.get(o);s?(s.count+=1,r&&!s.title.split(`, `).includes(r)&&(s.title+=`, ${r}`)):(n.set(o,{label:i,group:a,count:1,title:r||i}),t.push(o))}return t.map(e=>n.get(e))}function Ct(e){if(e.submitter_name)return!1;let t=(e.submitter_id||``).trim();return!t||t.startsWith(`flow:`)||t.startsWith(`system:`)}function wt(e){return e.object_label||e.object_name}function j(e){return e.submitted_at||e.created_at||void 0}function M(e,t){let n=j(e);if(!n)return null;let r=Date.parse(n);return Number.isNaN(r)?null:(t-r)/36e5}function Tt(e,t){if(e.status!==`pending`)return`text-muted-foreground`;let n=M(e,t);return n==null?`text-muted-foreground`:n>72?`text-red-600 dark:text-red-400 font-medium`:n>24?`text-amber-600 dark:text-amber-400`:`text-muted-foreground`}function Et(e){let t=Math.max(1,Math.round(Math.abs(e)/36e5));return t<48?`${t}h`:`${Math.round(t/24)}d`}function Dt(e,t){if(!e)return null;let n=Date.parse(e);return Number.isNaN(n)?null:{overdue:n<t,ms:Math.abs(t-n)}}var N=new Set([`id`,`created_at`,`updated_at`,`created_by`,`updated_by`,`organization_id`]);function P(e){let t=e.split(`_`).filter(Boolean);return t.length>1&&t[t.length-1].toLowerCase()===`id`&&t.pop(),t.map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function Ot(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 F=/^[A-Za-z0-9_-]{15,}$/;function kt(e,t,n,r=6,i,a){if(!e||typeof e!=`object`||Array.isArray(e))return[];let o=[];for(let[s,c]of Object.entries(e)){if(N.has(s)||a?.has(s)||i&&s===i||c==null||typeof c==`object`||String(c).trim()===``)continue;let e=t?.[s];if(!(!e&&typeof c==`string`&&F.test(c.trim())&&!/^\d+$/.test(c.trim()))&&(o.push([n?.[s]??P(s),e??Ot(s,c)]),o.length>=r))break}return o}var At=/(amount|total|price|value|cost|sum|budget|salary|fee|revenue|balance|金额|总额|价格|费用|预算|金额)/i;function I(e,t){let n=e.payload;if(!n||typeof n!=`object`||Array.isArray(n))return null;for(let[r,i]of Object.entries(n)){if(N.has(r)||t.has(r)||!At.test(r))continue;let n=typeof i==`number`?i:typeof i==`string`&&i.trim()!==``&&Number.isFinite(Number(i))?Number(i):null;if(!(n==null||!Number.isFinite(n)))return{key:r,label:e.payload_labels?.[r]??P(r),value:n,display:e.payload_display?.[r]??n.toLocaleString()}}return null}function jt({r:e,tr:t}){return(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`div`,{className:`font-medium truncate`,children:A(e)}),(0,D.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[vt(e)||`—`,(e.round??1)>1&&(0,D.jsx)(`span`,{className:`ml-1.5 text-violet-600 dark:text-violet-400`,children:t(`roundChip`,`Round {{n}}`,{n:e.round})})]})]})}function Mt({r:e,href:n,hiddenKeys:r}){let i=I(e,r),a=e.record_title||O(e.record_id);return(0,D.jsxs)(`div`,{className:`min-w-0`,children:[n===null?(0,D.jsx)(`div`,{className:`text-sm truncate max-w-full`,title:e.record_id,children:a}):(0,D.jsxs)(t,{to:n,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,D.jsx)(`span`,{className:`truncate`,children:a}),(0,D.jsx)(et,{className:`h-3 w-3 shrink-0 text-muted-foreground`})]}),(0,D.jsxs)(`div`,{className:`text-xs text-muted-foreground truncate`,children:[wt(e),i&&(0,D.jsxs)(`span`,{className:`ml-1.5 font-medium text-foreground`,title:`${i.label}: ${i.display}`,children:[`· `,i.display]})]})]})}function Nt({r:e,actionable:t,busy:n,needsInputs:r,tr:i,onApprove:a,onReject:o}){if(!t)return null;let s=i(`needsDecisionInputs`,`This approval collects decision outputs — open it to decide.`);return(0,D.jsxs)(`div`,{className:`flex items-center gap-1 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity`,onClick:e=>e.stopPropagation(),title:r?s:void 0,children:[(0,D.jsx)(p,{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:n||r,onClick:()=>a(e),"aria-label":r?s:i(`approve`,`Approve`),children:(0,D.jsx)(Be,{className:`h-4 w-4`})}),(0,D.jsx)(p,{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:n||r,onClick:()=>o(e),"aria-label":r?s:i(`reject`,`Reject`),children:(0,D.jsx)(Me,{className:`h-4 w-4`})})]})}function Pt(){let{t:e,language:n}=ne(),{user:a}=s(),{appName:ee}=i(),[te,ct]=r(),v=(0,_.useMemo)(()=>lt(a),[a]),{systemPermissions:b}=c(),x=st(b),S=(0,_.useCallback)((t,n,r)=>String(e(`approvalsInbox.${t}`,{defaultValue:n,...r})),[e]),[C,ut]=(0,_.useState)(()=>Date.now());(0,_.useEffect)(()=>{let e=setInterval(()=>ut(Date.now()),6e4);return()=>clearInterval(e)},[]);let w=(0,_.useCallback)(e=>{if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return e;let r=Math.round((C-t)/1e3);if(r<45)return S(`justNow`,`just now`);let i=Math.round(r/60);if(i<60)return S(`minutesAgo`,`{{count}}m ago`,{count:i});let a=Math.round(i/60);if(a<24)return S(`hoursAgo`,`{{count}}h ago`,{count:a});let o=Math.round(a/24);if(o<30)return S(`daysAgo`,`{{count}}d ago`,{count:o});try{return new Date(e).toLocaleDateString(n)}catch{return e}},[S,n,C]),T=(0,_.useCallback)(e=>{switch(e){case`pending`:return S(`statusPending`,`Pending`);case`approved`:return S(`statusApproved`,`Approved`);case`rejected`:return S(`statusRejected`,`Rejected`);case`recalled`:return S(`statusRecalled`,`Recalled`);case`returned`:return S(`statusReturned`,`Returned for revision`);default:return e}},[S]),E=(0,_.useCallback)((e,t)=>{let n=e?.code??``,r=e?.status??0;return n===`NOT_IMPLEMENTED`||r===501?S(`recallUnavailable`,`Recall is not available on this deployment.`):n===`THROTTLED`||r===429?S(`remindThrottled`,`A reminder was sent recently — try again later.`):r===404?S(`requestGone`,`This request no longer exists. Refresh the list.`):n===`FORBIDDEN`||r===403?S(`notAllowed`,`You are not allowed to perform this action.`):n===`INVALID_STATE`||r===409?S(`alreadyDecided`,`This request was already decided. Refresh the list.`):e?.message||t},[S]),ft=(0,_.useCallback)(e=>e.overdue?S(`slaOverdue`,`SLA overdue {{dur}}`,{dur:Et(e.ms)}):S(`slaRemaining`,`SLA {{dur}} left`,{dur:Et(e.ms)}),[S]),ht=(0,_.useCallback)(e=>`/apps/${ee||`setup`}/${encodeURIComponent(e.object_name)}/record/${encodeURIComponent(e.record_id)}`,[ee]),[k,xt]=(0,_.useState)(`pending`),[M,N]=(0,_.useState)([]),[P,Ot]=(0,_.useState)(!1),[F,At]=(0,_.useState)(!1),[Pt,Ft]=(0,_.useState)(null),[It,Lt]=(0,_.useState)(null),[Rt,zt]=(0,_.useState)(0),[L,Bt]=(0,_.useState)(null),[R,Vt]=(0,_.useState)(null),[Ht,Ut]=(0,_.useState)([]),[Wt,Gt]=(0,_.useState)(!1),Kt=(0,_.useMemo)(()=>R?[...M,R]:M,[M,R]),qt=dt(Kt),z=pt((0,_.useMemo)(()=>Kt.map(e=>e.object_name),[Kt])),Jt=z.forObject(R?.object_name),Yt=(0,_.useMemo)(()=>o(),[]),Xt=(0,_.useCallback)(async e=>{let t=window.open(``,`_blank`,`noopener`);try{let n=``.replace(/\/$/,``),r=await Yt(`${n}/api/v1/storage/files/${encodeURIComponent(e.id)}/url`);if(!r.ok)throw Error(`HTTP_${r.status}`);let i=await r.json().catch(()=>null),a=i?.data?.url??i?.url;if(!a)throw Error(`NO_URL`);let o=/^https?:\/\//i.test(a)?a:`${n}${a}`;t?t.location.href=o:window.open(o,`_blank`,`noopener`)}catch{t?.close(),g.error(S(`attachmentOpenFailed`,`Could not open the attachment — please try again`))}},[Yt,S]),[B,Zt]=(0,_.useState)(``),[Qt,$t]=(0,_.useState)(``),[en,tn]=(0,_.useState)(`all`),[nn,rn]=(0,_.useState)(`all`),[V,an]=(0,_.useState)(`all`),[on,sn]=(0,_.useState)(`recent`),[H,cn]=(0,_.useState)(new Set),[ln,un]=(0,_.useState)(!1),[U,dn]=(0,_.useState)(null),[W,fn]=(0,_.useState)(null),[pn,mn]=(0,_.useState)(null),[G,hn]=(0,_.useState)(``),[gn,_n]=(0,_.useState)(!1),[vn,yn]=(0,_.useState)(-1);(0,_.useEffect)(()=>{if(k===`pending`)return;let e=window.setTimeout(()=>$t(B),350);return()=>window.clearTimeout(e)},[B,k]);let K=(0,_.useCallback)(async()=>{Ot(!0),Lt(null);try{let e=[];if(k===`pending`)e=v.length?(await y.listRequests({status:`pending`,approverId:v})).data:[],zt(e.length),Ft(null);else{let t={q:Qt||void 0,status:V===`all`?void 0:V,limit:mt,offset:0};if(k===`submitted`){let n=a?.id;if(n){let r=await y.listRequests({submitterId:n,...t});e=r.data,Ft(r.total??r.data.length)}else e=[],Ft(0)}else{let n=await y.listRequests(t);e=n.data,Ft(n.total??n.data.length)}v.length&&y.listRequests({status:`pending`,approverId:v}).then(e=>zt(e.data.length)).catch(()=>{})}e.sort((e,t)=>(j(t)||``).localeCompare(j(e)||``)),N(e)}catch(e){Lt(e?.message||String(e)),N([])}finally{Ot(!1)}},[k,v,a?.id,Qt,V]);(0,_.useEffect)(()=>{K()},[K]);let bn=(0,_.useCallback)(async()=>{if(!(k===`pending`||F)){At(!0);try{let e=await y.listRequests({submitterId:k===`submitted`?a?.id??void 0:void 0,q:Qt||void 0,status:V===`all`?void 0:V,limit:mt,offset:M.length});N(t=>{let n=new Set(t.map(e=>e.id));return[...t,...e.data.filter(e=>!n.has(e.id))]}),e.total!=null&&Ft(e.total)}catch(e){g.error(E(e,S(`loadFailed`,`Failed to load request`)))}finally{At(!1)}}},[k,F,a?.id,Qt,V,M.length,E,S]),q=(0,_.useCallback)(async e=>{Bt(e),Gt(!0);try{let[t,n]=await Promise.all([y.getRequest(e),y.listActions(e)]);Vt(t.data),Ut(n.data)}catch(e){g.error(E(e,S(`loadFailed`,`Failed to load request`))),Vt(null),Ut([])}finally{Gt(!1)}},[E,S]),xn=()=>{Bt(null),Vt(null),Ut([])};(0,_.useEffect)(()=>{let e=te.get(`request`);e&&(ct(e=>{let t=new URLSearchParams(e);return t.delete(`request`),t},{replace:!0}),q(e))},[te]);let J=(0,_.useCallback)(()=>{v.length&&y.listRequests({status:`pending`,approverId:v}).then(e=>zt(e.data.length)).catch(()=>{})},[v]),Sn=(0,_.useCallback)(async e=>{let[t,n]=await Promise.all([y.getRequest(e),y.listActions(e)]);Vt(t.data),Ut(n.data),K()},[K]),Cn=(0,_.useCallback)(async()=>{if(!R)return;let e=R.id;try{let[t,n]=await Promise.all([y.getRequest(e),y.listActions(e)]);Vt(t.data),Ut(n.data),K();let r=new Set(t.data.pending_approvers||[]),i=t.data.status===`pending`&&v.some(e=>r.has(e));if(k===`pending`&&!i){let t=Rn.current,n=t.findIndex(t=>t.id===e),r=t[n+1]??t[n-1];if(r&&r.id!==e){q(r.id);return}xn()}}catch{Sn(e)}},[R,v,k,K,q,xn,Sn]),wn=(0,_.useCallback)(async()=>{if(!(!R||!G.trim())){_n(!0);try{await y.comment(R.id,{actor_id:a?.id,comment:G.trim()}),hn(``),await Sn(R.id)}catch(e){g.error(E(e,S(`actionFailed`,`Action failed`)))}finally{_n(!1)}}},[R,G,a?.id,Sn,E,S]),Tn=(0,_.useMemo)(()=>{if(!R||R.status!==`pending`)return!1;if(R.viewer)return R.viewer.can_act||!!R.viewer.can_override;let e=new Set(R.pending_approvers||[]);return v.some(t=>e.has(t))},[R,v]),En=(0,_.useMemo)(()=>!R||R.status!==`pending`?!1:R.viewer?R.viewer.is_submitter:R.submitter_id===a?.id,[R,a?.id]),Dn=(0,_.useMemo)(()=>!R||R.status!==`returned`?!1:R.viewer?R.viewer.is_submitter:R.submitter_id===a?.id,[R,a?.id]),On=(0,_.useMemo)(()=>{let e=new Set;for(let t of M)e.add(A(t));return Array.from(e).sort()},[M]),kn=(0,_.useMemo)(()=>{let e=new Set;for(let t of M)t.object_name&&e.add(t.object_name);return Array.from(e).sort()},[M]),Y=(0,_.useMemo)(()=>{let e=B.trim().toLowerCase(),t=M.filter(t=>en!==`all`&&A(t)!==en||nn!==`all`&&t.object_name!==nn||V!==`all`&&t.status!==V?!1:k!==`pending`||!e||[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));if(on===`recent`)return t;let n=[...t];return on===`amount`?n.sort((e,t)=>{let n=I(e,z.forObject(e.object_name))?.value,r=I(t,z.forObject(t.object_name))?.value;return n==null&&r==null?0:n==null?1:r==null?-1:r-n}):n.sort((e,t)=>(j(e)||``).localeCompare(j(t)||``)),n},[M,B,en,nn,V,k,on,z]),X=(0,_.useMemo)(()=>L?Y.findIndex(e=>e.id===L):-1,[Y,L]);(0,_.useEffect)(()=>{if(H.size===0)return;let e=new Set(Y.map(e=>e.id)),t=!1,n=new Set;for(let r of H)e.has(r)?n.add(r):t=!0;t&&cn(n)},[Y,H]),(0,_.useEffect)(()=>{vn>=Y.length&&yn(Y.length-1)},[Y.length,vn]);let An=(0,_.useCallback)(e=>{if(e.status!==`pending`)return!1;let t=new Set(v);return(e.pending_approvers||[]).some(e=>t.has(e))},[v]),Z=(0,_.useCallback)(e=>Array.isArray(e.decision_outputs)&&e.decision_outputs.length>0,[]),jn=(0,_.useCallback)(e=>An(e)&&!Z(e),[An,Z]),Q=(0,_.useMemo)(()=>Y.filter(e=>H.has(e.id)&&jn(e)),[Y,H,jn]),$=Y.filter(e=>e.status===`pending`),Mn=$.length>0&&$.every(e=>H.has(e.id)),Nn=(0,_.useCallback)(()=>{cn(e=>{if(Mn)return new Set;let t=new Set(e);for(let e of $)t.add(e.id);return t})},[Mn,$]),Pn=(0,_.useCallback)(e=>{cn(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Fn=(0,_.useCallback)(async e=>{let t=Q;if(t.length===0)return;un(!0);let n=0,r=[];for(let i of t){let t=new Set(i.pending_approvers||[]),o=v.find(e=>t.has(e))||a?.id||``;try{await(e===`approve`?y.approve:y.reject)(i.id,{actor_id:o}),n++}catch{r.push(i.record_title||O(i.record_id))}}if(un(!1),cn(new Set),r.length===0)g.success(e===`approve`?S(`bulkApproved`,`Approved {{count}} requests`,{count:n}):S(`bulkRejected`,`Rejected {{count}} requests`,{count:n}));else{let e=r.slice(0,3).join(`, `);g.error(S(`bulkPartial`,`{{ok}} succeeded, {{fail}} failed: {{which}}`,{ok:n,fail:r.length,which:e+(r.length>3?`…`:``)}))}K(),J()},[Q,v,a?.id,K,J,S]),In=(0,_.useCallback)(async()=>{let e=U;if(!e)return;let t=new Set(e.pending_approvers||[]),n=v.find(e=>t.has(e))||a?.id||``;mn(e.id),dn(null);try{let t=await y.approve(e.id,{actor_id:n});g.success(t.finalized?S(`inlineApproved`,`Approved "{{title}}"`,{title:e.record_title||O(e.record_id)}):S(`approvedWaiting`,`Approved — waiting on the remaining approvers`)),K(),J()}catch(e){g.error(E(e,S(`actionFailed`,`Action failed`)))}finally{mn(null)}},[U,v,a?.id,K,J,E,S]),Ln=(0,_.useCallback)(async()=>{let e=W;if(!e)return;let t=new Set(e.pending_approvers||[]),n=v.find(e=>t.has(e))||a?.id||``;mn(e.id),fn(null);try{await y.reject(e.id,{actor_id:n}),g.success(S(`inlineRejected`,`Rejected "{{title}}"`,{title:e.record_title||O(e.record_id)})),K(),J()}catch(e){g.error(E(e,S(`actionFailed`,`Action failed`)))}finally{mn(null)}},[W,v,a?.id,K,J,E,S]),Rn=(0,_.useRef)(Y);Rn.current=Y;let zn=(0,_.useRef)(vn);zn.current=vn,(0,_.useEffect)(()=>{let e=e=>{if(L||U||W)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(),yn(Math.min(i+1,r.length-1))):e.key===`k`||e.key===`ArrowUp`?(e.preventDefault(),yn(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]&&k===`pending`?(e.preventDefault(),Pn(r[i].id)):e.key===`a`&&i>=0&&r[i]&&jn(r[i])?(e.preventDefault(),dn(r[i])):e.key===`r`&&i>=0&&r[i]&&jn(r[i])&&(e.preventDefault(),fn(r[i]))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[L,U,W,k,q,Pn,jn]),(0,_.useEffect)(()=>{if(!L)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===L);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)},[L,q]);let Bn=!!B||en!==`all`||nn!==`all`||V!==`all`,Vn=e=>{xt(e),an(`all`),tn(`all`),rn(`all`),Zt(``),sn(`recent`),yn(-1)};return(0,D.jsxs)(`div`,{className:`flex flex-col gap-4 sm:gap-6 p-4 sm:p-6 max-w-6xl`,children:[(0,D.jsxs)(`header`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`h1`,{className:`text-2xl font-semibold flex items-center gap-2`,children:[(0,D.jsx)(De,{className:`h-6 w-6`}),S(`title`,`Approvals Inbox`)]}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:S(`subtitle`,`Review and act on approval requests.`)})]}),(0,D.jsxs)(p,{variant:`outline`,size:`sm`,onClick:K,disabled:P,className:`self-start sm:self-auto`,children:[(0,D.jsx)(Xe,{className:`h-4 w-4 mr-2 ${P?`animate-spin`:``}`}),S(`refresh`,`Refresh`)]})]}),It&&(0,D.jsxs)(ye,{variant:`destructive`,children:[(0,D.jsx)(Ye,{className:`h-4 w-4`}),(0,D.jsx)(rt,{children:It})]}),(0,D.jsxs)(it,{value:k,onValueChange:Vn,children:[(0,D.jsxs)(Ee,{children:[(0,D.jsxs)(ue,{value:`pending`,children:[S(`tabMyPending`,`My Pending`),Rt>0&&(0,D.jsx)(f,{variant:`secondary`,className:`ml-2`,children:Rt})]}),(0,D.jsx)(ue,{value:`submitted`,children:S(`tabSubmitted`,`Submitted by me`)}),(0,D.jsx)(ue,{value:`all`,children:S(`tabAll`,`All`)})]}),(0,D.jsxs)(re,{value:k,className:`mt-4 space-y-3`,children:[!P&&(M.length>0||k!==`pending`&&(Qt||V!==`all`))&&(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsxs)(`div`,{className:`relative flex-1 min-w-[200px] max-w-sm`,children:[(0,D.jsx)(Ne,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,D.jsx)(fe,{value:B,onChange:e=>Zt(e.target.value),placeholder:S(`searchPlaceholder`,`Search record, process, requester…`),className:`pl-8 h-8 text-sm`}),B&&(0,D.jsx)(`button`,{type:`button`,onClick:()=>Zt(``),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,"aria-label":S(`clearSearch`,`Clear search`),children:(0,D.jsx)(Ge,{className:`h-3.5 w-3.5`})})]}),k!==`pending`&&(0,D.jsxs)($e,{value:V,onValueChange:an,children:[(0,D.jsx)(ae,{className:`h-8 w-auto min-w-[130px] text-sm`,children:(0,D.jsx)(_e,{placeholder:S(`statusFilter`,`Status`)})}),(0,D.jsxs)(xe,{children:[(0,D.jsx)(l,{value:`all`,children:S(`allStatuses`,`All statuses`)}),(0,D.jsx)(l,{value:`pending`,children:T(`pending`)}),(0,D.jsx)(l,{value:`approved`,children:T(`approved`)}),(0,D.jsx)(l,{value:`rejected`,children:T(`rejected`)}),(0,D.jsx)(l,{value:`recalled`,children:T(`recalled`)}),(0,D.jsx)(l,{value:`returned`,children:T(`returned`)})]})]}),On.length>1&&(0,D.jsxs)($e,{value:en,onValueChange:tn,children:[(0,D.jsx)(ae,{className:`h-8 w-auto min-w-[140px] text-sm`,children:(0,D.jsx)(_e,{placeholder:S(`processFilter`,`Process`)})}),(0,D.jsxs)(xe,{children:[(0,D.jsx)(l,{value:`all`,children:S(`allProcesses`,`All processes`)}),On.map(e=>(0,D.jsx)(l,{value:e,children:e},e))]})]}),kn.length>1&&(0,D.jsxs)($e,{value:nn,onValueChange:rn,children:[(0,D.jsx)(ae,{className:`h-8 w-auto min-w-[140px] text-sm`,children:(0,D.jsx)(_e,{placeholder:S(`objectFilter`,`Object`)})}),(0,D.jsxs)(xe,{children:[(0,D.jsx)(l,{value:`all`,children:S(`allObjects`,`All objects`)}),kn.map(e=>(0,D.jsx)(l,{value:e,children:e},e))]})]}),(0,D.jsxs)($e,{value:on,onValueChange:e=>sn(e),children:[(0,D.jsxs)(ae,{className:`h-8 w-auto min-w-[120px] text-sm`,children:[(0,D.jsx)(Ae,{className:`h-3.5 w-3.5 mr-1 text-muted-foreground`}),(0,D.jsx)(_e,{placeholder:S(`sortBy`,`Sort`)})]}),(0,D.jsxs)(xe,{children:[(0,D.jsx)(l,{value:`recent`,children:S(`sortRecent`,`Newest first`)}),(0,D.jsx)(l,{value:`oldest`,children:S(`sortOldest`,`Oldest first`)}),(0,D.jsx)(l,{value:`amount`,children:S(`sortAmount`,`Amount (high→low)`)})]})]}),Bn&&(0,D.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:S(`filterCount`,`{{shown}} of {{total}}`,{shown:Y.length,total:M.length})})]}),k===`pending`&&H.size>0&&(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 rounded-md border bg-accent/30 text-sm`,children:[(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`strong`,{children:H.size}),` `,S(`selected`,`selected`),Q.length!==H.size&&(0,D.jsx)(`span`,{className:`text-muted-foreground ml-1`,children:S(`actionableCount`,`({{count}} actionable)`,{count:Q.length})})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsxs)(Te,{children:[(0,D.jsx)(je,{asChild:!0,children:(0,D.jsxs)(p,{size:`sm`,disabled:ln||Q.length===0,children:[(0,D.jsx)(Be,{className:`h-3.5 w-3.5 mr-1`}),S(`approveN`,`Approve {{count}}`,{count:Q.length||``})]})}),(0,D.jsxs)(Oe,{children:[(0,D.jsxs)(qe,{children:[(0,D.jsx)(pe,{children:S(`bulkApproveTitle`,`Approve {{count}} requests?`,{count:Q.length})}),(0,D.jsx)(ce,{children:S(`bulkApproveBody`,`Each request is approved with your identity and its flow continues down the approve branch.`)})]}),(0,D.jsxs)(ge,{children:[(0,D.jsx)(Se,{children:S(`cancel`,`Cancel`)}),(0,D.jsx)(le,{onClick:()=>Fn(`approve`),children:S(`approveN`,`Approve {{count}}`,{count:Q.length})})]})]})]}),(0,D.jsxs)(Te,{children:[(0,D.jsx)(je,{asChild:!0,children:(0,D.jsxs)(p,{size:`sm`,variant:`outline`,disabled:ln||Q.length===0,className:`border-destructive text-destructive hover:bg-destructive hover:text-destructive-foreground`,children:[(0,D.jsx)(Me,{className:`h-3.5 w-3.5 mr-1`}),S(`rejectN`,`Reject {{count}}`,{count:Q.length||``})]})}),(0,D.jsxs)(Oe,{children:[(0,D.jsxs)(qe,{children:[(0,D.jsx)(pe,{children:S(`bulkRejectTitle`,`Reject {{count}} requests?`,{count:Q.length})}),(0,D.jsx)(ce,{children:S(`bulkRejectBody`,`This rejects the selected requests and notifies their submitters.`)})]}),(0,D.jsxs)(ge,{children:[(0,D.jsx)(Se,{children:S(`cancel`,`Cancel`)}),(0,D.jsx)(le,{onClick:()=>Fn(`reject`),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:S(`rejectN`,`Reject {{count}}`,{count:Q.length})})]})]})]}),(0,D.jsx)(p,{size:`sm`,variant:`ghost`,onClick:()=>cn(new Set),disabled:ln,children:S(`clear`,`Clear`)})]})]}),P?(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(m,{className:`h-10 w-full`}),(0,D.jsx)(m,{className:`h-10 w-full`}),(0,D.jsx)(m,{className:`h-10 w-full`})]}):M.length===0?(0,D.jsx)(`div`,{className:`flex items-center justify-center min-h-[240px] rounded-md border border-dashed`,children:(0,D.jsxs)(We,{children:[(0,D.jsx)(Qe,{children:S(`emptyTitle`,`No requests`)}),(0,D.jsx)(Re,{children:k===`pending`?S(`emptyPending`,`You're all caught up — nothing is waiting on you.`):S(`emptyOther`,`Nothing here yet.`)}),k===`pending`&&(0,D.jsx)(p,{variant:`link`,size:`sm`,className:`mt-1`,onClick:()=>Vn(`all`),children:S(`emptyViewAll`,`Browse all requests`)})]})}):Y.length===0?(0,D.jsx)(`div`,{className:`flex items-center justify-center min-h-[160px] rounded-md border border-dashed text-sm text-muted-foreground`,children:S(`noMatches`,`No matches for current filters.`)}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(ve,{className:`hidden md:block`,children:(0,D.jsx)(He,{className:`p-0`,children:(0,D.jsxs)(we,{children:[(0,D.jsx)(Je,{children:(0,D.jsxs)(he,{children:[k===`pending`&&(0,D.jsx)(d,{className:`w-10`,children:(0,D.jsx)(oe,{checked:Mn,onCheckedChange:Nn,"aria-label":S(`selectAll`,`Select all`),disabled:$.length===0})}),(0,D.jsx)(d,{className:`w-[22%]`,children:S(`colRequest`,`Request`)}),(0,D.jsx)(d,{className:`w-[30%]`,children:S(`colRecord`,`Record`)}),(0,D.jsx)(d,{className:`w-[16%]`,children:S(`colRequester`,`Requester`)}),(0,D.jsx)(d,{className:`w-[110px] min-w-[96px] whitespace-nowrap`,children:S(`colStatus`,`Status`)}),(0,D.jsx)(d,{className:`w-[132px]`,children:S(`colWaiting`,`Submitted`)}),(0,D.jsx)(d,{className:`w-20`,"aria-label":S(`colActions`,`Actions`)})]})}),(0,D.jsx)(ke,{children:Y.map((e,t)=>(0,D.jsxs)(he,{className:h(`group cursor-pointer hover:bg-accent/50`,vn===t&&`ring-2 ring-inset ring-ring bg-accent/30`),onClick:()=>{yn(t),q(e.id)},children:[k===`pending`&&(0,D.jsx)(u,{className:`w-10`,onClick:e=>e.stopPropagation(),children:(0,D.jsx)(oe,{checked:H.has(e.id),onCheckedChange:()=>Pn(e.id),disabled:e.status!==`pending`,"aria-label":S(`selectRow`,`Select request`)})}),(0,D.jsx)(u,{children:(0,D.jsx)(jt,{r:e,tr:S})}),(0,D.jsx)(u,{children:(0,D.jsx)(Mt,{r:e,href:qt.isUnreadable(e)?null:ht(e),hiddenKeys:z.forObject(e.object_name)})}),(0,D.jsx)(u,{children:Ct(e)?(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm text-muted-foreground`,children:[(0,D.jsx)(Ve,{className:`h-3.5 w-3.5 shrink-0`}),(0,D.jsx)(`span`,{className:`truncate italic`,children:S(`flowOrigin`,`Flow-initiated`)})]}):(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,D.jsx)(Fe,{className:`h-3.5 w-3.5 text-muted-foreground shrink-0`}),(0,D.jsx)(`span`,{className:`truncate`,title:e.submitter_id||``,children:yt(e)})]})}),(0,D.jsx)(u,{children:(0,D.jsx)(gt,{status:e.status,label:T(e.status)})}),(0,D.jsxs)(u,{className:h(`text-xs whitespace-nowrap`,Tt(e,C)),title:_t(j(e)),children:[(0,D.jsx)(Ce,{className:`h-3 w-3 inline mr-1`}),w(j(e)),e.status===`pending`&&(()=>{let t=Dt(e.sla_due_at,C);return t?(0,D.jsx)(`div`,{className:h(`mt-0.5 text-[10px] font-medium`,t.overdue?`text-red-600 dark:text-red-400`:`text-muted-foreground`),children:ft(t)}):null})()]}),(0,D.jsx)(u,{className:`w-20`,children:(0,D.jsx)(Nt,{r:e,actionable:An(e),busy:pn===e.id,needsInputs:Z(e),tr:S,onApprove:dn,onReject:fn})})]},e.id))})]})})}),(0,D.jsx)(`div`,{className:`md:hidden space-y-2`,children:Y.map(e=>(0,D.jsx)(ve,{className:`cursor-pointer active:bg-accent/50`,onClick:()=>void q(e.id),children:(0,D.jsxs)(He,{className:`p-3 space-y-1.5`,children:[(0,D.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,D.jsx)(`div`,{className:`font-medium text-sm truncate`,children:A(e)}),(0,D.jsx)(gt,{status:e.status,label:T(e.status)})]}),(0,D.jsxs)(`div`,{className:`text-sm truncate`,children:[e.record_title||O(e.record_id),(0,D.jsx)(`span`,{className:`text-muted-foreground text-xs ml-1.5`,children:wt(e)}),(()=>{let t=I(e,z.forObject(e.object_name));return t?(0,D.jsxs)(`span`,{className:`text-xs ml-1.5 font-medium`,title:t.label,children:[`· `,t.display]}):null})()]}),(0,D.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[Ct(e)?(0,D.jsxs)(`span`,{className:`inline-flex items-center gap-1 truncate italic`,children:[(0,D.jsx)(Ve,{className:`h-3 w-3`}),S(`flowOrigin`,`Flow-initiated`)]}):(0,D.jsxs)(`span`,{className:`inline-flex items-center gap-1 truncate`,children:[(0,D.jsx)(Fe,{className:`h-3 w-3`}),yt(e)]}),(0,D.jsxs)(`span`,{className:h(`inline-flex items-center gap-1 whitespace-nowrap`,Tt(e,C)),children:[(0,D.jsx)(Ce,{className:`h-3 w-3`}),w(j(e))]})]}),An(e)&&(0,D.jsxs)(`div`,{className:`flex gap-2 pt-1`,onClick:e=>e.stopPropagation(),title:Z(e)?S(`needsDecisionInputs`,`This approval collects decision outputs — open it to decide.`):void 0,children:[(0,D.jsxs)(p,{size:`sm`,className:`h-7 flex-1`,disabled:pn===e.id||Z(e),onClick:()=>dn(e),children:[(0,D.jsx)(Be,{className:`h-3.5 w-3.5 mr-1`}),S(`approve`,`Approve`)]}),(0,D.jsxs)(p,{size:`sm`,variant:`outline`,className:`h-7 flex-1 border-destructive text-destructive`,disabled:pn===e.id||Z(e),onClick:()=>fn(e),children:[(0,D.jsx)(Me,{className:`h-3.5 w-3.5 mr-1`}),S(`reject`,`Reject`)]})]})]})},e.id))}),k!==`pending`&&Pt!=null&&(0,D.jsxs)(`div`,{className:`flex items-center justify-center gap-3 py-1`,children:[(0,D.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:S(`loadedOf`,`Loaded {{loaded}} of {{total}}`,{loaded:M.length,total:Pt})}),M.length<Pt&&(0,D.jsx)(p,{size:`sm`,variant:`outline`,disabled:F,onClick:()=>void bn(),children:F?S(`loadingMore`,`Loading…`):S(`loadMore`,`Load more`)})]}),(0,D.jsx)(`div`,{className:`hidden md:block text-[11px] text-muted-foreground`,children:S(`keyboardHint`,`Keyboard: j/k move · Enter open · x select · a approve · r reject`)})]})]})]}),(0,D.jsx)(Te,{open:!!U,onOpenChange:e=>!e&&dn(null),children:(0,D.jsxs)(Oe,{children:[(0,D.jsxs)(qe,{children:[(0,D.jsx)(pe,{children:S(`approveOneTitle`,`Approve "{{title}}"?`,{title:U?U.record_title||O(U.record_id):``})}),(0,D.jsx)(ce,{children:S(`approveOneBody`,`This approves the request with your identity. To add a comment or attachment, open the request instead.`)})]}),(0,D.jsxs)(ge,{children:[(0,D.jsx)(Se,{children:S(`cancel`,`Cancel`)}),(0,D.jsx)(le,{onClick:()=>void In(),children:S(`approve`,`Approve`)})]})]})}),(0,D.jsx)(Te,{open:!!W,onOpenChange:e=>!e&&fn(null),children:(0,D.jsxs)(Oe,{children:[(0,D.jsxs)(qe,{children:[(0,D.jsx)(pe,{children:S(`rejectOneTitle`,`Reject "{{title}}"?`,{title:W?W.record_title||O(W.record_id):``})}),(0,D.jsx)(ce,{children:S(`rejectOneBody`,`This rejects the request and notifies the submitter.`)})]}),(0,D.jsxs)(ge,{children:[(0,D.jsx)(Se,{children:S(`cancel`,`Cancel`)}),(0,D.jsx)(le,{onClick:()=>void Ln(),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:S(`reject`,`Reject`)})]})]})}),(0,D.jsx)(Ze,{open:!!L,onOpenChange:e=>!e&&xn(),children:(0,D.jsxs)(nt,{className:`w-full sm:max-w-xl overflow-y-auto`,children:[(0,D.jsxs)(tt,{children:[(0,D.jsx)(be,{children:R?A(R):S(`drawerTitle`,`Approval Request`)}),(0,D.jsx)(Pe,{children:R?vt(R)||wt(R):``})]}),R&&X>=0&&Y.length>1&&(0,D.jsxs)(`div`,{className:`flex items-center justify-between mt-2 text-xs text-muted-foreground`,children:[(0,D.jsxs)(p,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,disabled:X<=0,onClick:()=>{let e=Y[X-1];e&&q(e.id)},children:[(0,D.jsx)(Ue,{className:`h-4 w-4 mr-0.5`}),S(`prevRequest`,`Previous`)]}),(0,D.jsx)(`span`,{children:S(`positionOf`,`Request {{index}} of {{total}}`,{index:X+1,total:Y.length})}),(0,D.jsxs)(p,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,disabled:X>=Y.length-1,onClick:()=>{let e=Y[X+1];e&&q(e.id)},children:[S(`nextRequest`,`Next`),(0,D.jsx)(Ke,{className:`h-4 w-4 ml-0.5`})]})]}),Wt?(0,D.jsxs)(`div`,{className:`space-y-2 mt-6`,children:[(0,D.jsx)(m,{className:`h-6 w-3/4`}),(0,D.jsx)(m,{className:`h-6 w-1/2`}),(0,D.jsx)(m,{className:`h-20 w-full`})]}):R?(0,D.jsxs)(`div`,{className:`space-y-4 mt-6`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,D.jsx)(gt,{status:R.status,label:T(R.status)}),(R.round??1)>1&&(0,D.jsx)(f,{variant:`outline`,className:`text-[10px] border-violet-200 text-violet-700 dark:border-violet-500/30 dark:text-violet-400`,children:S(`roundChip`,`Round {{n}}`,{n:R.round})}),(0,D.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:_t(j(R)),children:[(0,D.jsx)(Ce,{className:`h-3 w-3`}),S(`submittedAgo`,`Submitted {{when}}`,{when:w(j(R))})]}),R.completed_at&&(0,D.jsxs)(`span`,{children:[`· `,S(`completedAt`,`Completed {{when}}`,{when:w(R.completed_at)})]}),R.status===`pending`&&(()=>{let e=Dt(R.sla_due_at,C);return e?(0,D.jsx)(f,{variant:`outline`,className:h(`text-[10px]`,e.overdue?`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:ft(e)}):null})()]}),(()=>{let e=I(R,Jt),n=kt(R.payload,R.payload_display,R.payload_labels,6,e?.key,Jt);return(0,D.jsx)(ve,{children:(0,D.jsxs)(He,{className:`p-4 space-y-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[qt.isUnreadable(R)?(0,D.jsx)(`div`,{className:`text-base font-semibold truncate`,children:R.record_title||O(R.record_id)}):(0,D.jsxs)(t,{to:ht(R),className:`text-base font-semibold hover:underline inline-flex items-center gap-1.5`,children:[(0,D.jsx)(`span`,{className:`truncate`,children:R.record_title||O(R.record_id)}),(0,D.jsx)(et,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}),(0,D.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:wt(R)})]}),(0,D.jsx)(`div`,{className:`text-right text-xs text-muted-foreground shrink-0`,children:(0,D.jsx)(`div`,{className:`inline-flex items-center gap-1`,children:Ct(R)?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(Ve,{className:`h-3 w-3`}),(0,D.jsx)(`span`,{className:`italic`,children:S(`flowOrigin`,`Flow-initiated`)})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(Fe,{className:`h-3 w-3`}),(0,D.jsx)(`span`,{title:R.submitter_id||``,children:yt(R)})]})})})]}),e&&(0,D.jsxs)(`div`,{className:`border-t pt-3`,children:[(0,D.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e.label}),(0,D.jsx)(`div`,{className:`text-xl font-semibold tabular-nums`,title:e.display,children:e.display})]}),n.length>0&&(0,D.jsx)(`div`,{className:h(`grid grid-cols-2 gap-x-4 gap-y-2 text-sm`,!e&&`border-t pt-3`),children:n.map(([e,t])=>(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e}),(0,D.jsx)(`div`,{className:`truncate`,title:t,children:t})]},e))}),R.decision_progress&&(()=>{let e=R.decision_progress,t=(R.pending_approvers||[]).length;return(0,D.jsxs)(`div`,{className:`border-t pt-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-1.5`,children:[(0,D.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.behavior===`per_group`?S(`progressGroups`,`Sign-off progress — {{got}} of {{need}} groups`,{got:e.got,need:e.need}):S(`progressApprovals`,`Approvals — {{got}} of {{need}}`,{got:e.got,need:e.need})}),e.behavior!==`per_group`&&R.status===`pending`&&t>0&&(0,D.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:S(`progressEligible`,`{{count}} eligible approver(s)`,{count:t})})]}),(0,D.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":e.need,"aria-valuenow":Math.min(e.got,e.need),"aria-label":S(`progressBar`,`Decision progress`),className:`flex gap-1`,children:e.need>0&&e.need<=12?Array.from({length:e.need}).map((t,n)=>(0,D.jsx)(`div`,{className:h(`h-1.5 flex-1 rounded-full`,n<e.got?`bg-emerald-500`:`bg-muted`)},n)):(0,D.jsx)(`div`,{className:`h-1.5 flex-1 rounded-full bg-muted overflow-hidden`,children:(0,D.jsx)(`div`,{className:`h-full rounded-full bg-emerald-500`,style:{width:`${e.need>0?Math.min(100,e.got/e.need*100):0}%`}})})}),e.groups&&(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:e.groups.map(e=>(0,D.jsxs)(f,{variant:`outline`,className:h(`text-[11px] gap-1`,e.satisfied?`border-emerald-300 text-emerald-700 dark:border-emerald-700 dark:text-emerald-400`:`text-muted-foreground`),title:`${e.got}/${e.need}`,children:[e.satisfied?(0,D.jsx)(Le,{className:`h-3 w-3`}):(0,D.jsx)(me,{className:`h-2.5 w-2.5`}),e.group,` `,e.got,`/`,e.need]},e.group))})]})})(),R.status===`pending`&&(R.pending_approvers||[]).length>0&&(0,D.jsxs)(`div`,{className:`border-t pt-3`,children:[(0,D.jsx)(`div`,{className:`text-[11px] text-muted-foreground mb-1`,children:S(`waitingOn`,`Waiting on`)}),(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:St(R).map((e,t)=>(0,D.jsxs)(f,{variant:`outline`,className:`text-[11px]`,title:e.title,children:[e.label,e.group&&(0,D.jsxs)(`span`,{className:`ml-1 text-muted-foreground`,children:[`· `,e.group]}),e.count>1&&(0,D.jsxs)(`span`,{className:`ml-1 text-muted-foreground`,children:[`×`,e.count]})]},`${e.label}-${e.group??``}-${t}`))})]})]})})})(),(R.flow_steps?.length??0)>1&&(0,D.jsx)(`ol`,{className:`flex flex-col px-1`,"aria-label":S(`stepProgress`,`Approval steps`),children:R.flow_steps.map((e,t,n)=>{let r=n[t+1];return(0,D.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,D.jsxs)(`div`,{className:`flex flex-col items-center self-stretch`,children:[(0,D.jsx)(`span`,{className:h(`flex items-center justify-center h-5 w-5 shrink-0 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,D.jsx)(Le,{className:`h-3 w-3`}):t+1}),r&&(0,D.jsx)(`div`,{className:h(`w-px flex-1 min-h-3 my-1`,r.state===`done`||r.state===`current`?`bg-emerald-300 dark:bg-emerald-700`:`bg-border`)})]}),(0,D.jsx)(`span`,{className:h(`min-w-0 flex-1 pt-0.5 text-xs break-words`,e.state===`current`?`font-medium`:`text-muted-foreground`),children:e.label})]},e.id)})}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h3`,{className:`text-sm font-semibold mb-3`,children:S(`history`,`Activity`)}),Ht.length===0?(0,D.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:S(`noActions`,`No actions yet.`)}):(0,D.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:Ht.map(e=>{let t=ot(e),n=t?`bg-amber-500`: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`,r=e.actor_id===`system:sla`?S(`systemSlaActor`,`System (SLA)`):e.actor_name??(e.actor_id&&e.actor_id===R.submitter_id?yt(R):O(e.actor_id)),i=e.action===`submit`?S(`actSubmit`,`Submitted`):e.action===`approve`?S(`actApprove`,`Approved`):e.action===`reject`?S(`actReject`,`Rejected`):e.action===`recall`?S(`actRecall`,`Recalled`):e.action===`reassign`?S(`actReassign`,`Reassigned`):e.action===`remind`?S(`actRemind`,`Reminder sent`):e.action===`request_info`?S(`actRequestInfo`,`Requested more info`):e.action===`comment`?S(`actComment`,`Commented`):e.action===`escalate`?S(`actEscalate`,`SLA escalated`):e.action===`revise`?S(`actRevise`,`Sent back for revision`):e.action===`resubmit`?S(`actResubmit`,`Resubmitted`):e.action;return(0,D.jsxs)(`li`,{className:`relative text-xs`,children:[(0,D.jsx)(`span`,{className:`absolute -left-[18px] top-1 h-3 w-3 rounded-full ring-2 ring-background ${n}`,"aria-hidden":!0}),(0,D.jsxs)(`div`,{className:`flex items-baseline gap-1.5 flex-wrap`,children:[(0,D.jsx)(`span`,{className:`font-medium`,children:i}),(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,D.jsx)(`span`,{title:e.actor_id||``,children:r}),t&&(0,D.jsxs)(f,{variant:`outline`,className:`gap-1 border-amber-500/60 px-1.5 py-0 text-[10px] font-medium text-amber-700 dark:text-amber-400`,title:S(`viaOverrideHint`,`The actor held no approver slot on this step — admitted by the admin-override path.`),"data-testid":`via-override-chip`,children:[(0,D.jsx)(Ie,{className:`h-3 w-3`,"aria-hidden":!0}),S(`viaOverrideChip`,`Admin override`)]}),(0,D.jsx)(`span`,{className:`ml-auto text-muted-foreground text-[10px]`,title:_t(e.created_at),children:w(e.created_at)})]}),(()=>{let t=e;return e.action!==`reassign`||!t.reassign_from&&!t.reassign_to?null:(0,D.jsx)(`div`,{className:`text-muted-foreground mt-0.5`,children:S(`reassignFromTo`,`from {{from}} to {{to}}`,{from:t.reassign_from_name??O(t.reassign_from),to:t.reassign_to_name??O(t.reassign_to)})})})(),e.comment&&(0,D.jsxs)(`div`,{className:`text-muted-foreground italic mt-0.5`,children:[`"`,e.comment,`"`]}),Array.isArray(e.attachments)&&e.attachments.length>0&&(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1`,children:e.attachments.map((t,n)=>(0,D.jsxs)(`button`,{type:`button`,onClick:()=>void Xt(t),className:`inline-flex items-center gap-1 text-[11px] px-2 py-0.5 rounded-full border text-muted-foreground hover:text-foreground hover:bg-accent transition-colors`,title:t.name||t.id,children:[(0,D.jsx)(de,{className:`h-3 w-3`}),t.name||`${S(`attachmentChip`,`Attachment`)}${e.attachments.length>1?` ${n+1}`:``}`]},t.id||n))})]},e.id)})}),R.status===`pending`&&(Tn||En)&&(0,D.jsxs)(`div`,{className:`flex items-center gap-2 mt-3`,children:[(0,D.jsx)(fe,{value:G,onChange:e=>hn(e.target.value),onKeyDown:e=>{e.key===`Enter`&&G.trim()&&(e.preventDefault(),wn())},placeholder:S(`replyPlaceholder`,`Reply on this request…`),className:`h-8 text-sm`}),(0,D.jsx)(p,{size:`sm`,variant:`outline`,className:`h-8 px-2 shrink-0`,disabled:!G.trim()||gn,onClick:()=>void wn(),children:(0,D.jsx)(ze,{className:`h-3.5 w-3.5`})})]})]}),x&&R.payload!=null&&(0,D.jsxs)(`details`,{className:`group`,children:[(0,D.jsx)(`summary`,{className:`cursor-pointer text-xs text-muted-foreground hover:text-foreground select-none`,children:S(`rawData`,`Raw data (JSON)`)}),(0,D.jsxs)(`div`,{className:`mt-2`,children:[(0,D.jsx)(`div`,{className:`flex justify-end`,children:(0,D.jsxs)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(JSON.stringify(R.payload,null,2)),g.success(S(`copied`,`Copied`))}catch{g.error(S(`copyFailed`,`Copy failed`))}},className:`text-[10px] text-muted-foreground hover:text-foreground inline-flex items-center gap-1`,children:[(0,D.jsx)(se,{className:`h-3 w-3`}),S(`copy`,`Copy`)]})}),(0,D.jsx)(`pre`,{className:`text-[11px] bg-muted/50 rounded p-2 overflow-auto max-h-48 mt-1`,children:JSON.stringify(R.payload,null,2)})]})]}),R.status===`pending`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(ie,{}),(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsx)(at,{objectName:`sys_approval_request`,record:R,location:`record_section`,label:S(`declaredActions`,`Actions`),onDone:()=>{Cn()}}),!Tn&&(0,D.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:En?S(`whyDisabledSubmitter`,`You submitted this request, so you can recall it — but only the assigned approvers can approve or reject.`):S(`whyDisabled`,`Only the assigned approvers can act on this request. It is waiting on: {{who}}.`,{who:(R.pending_approvers||[]).map(e=>bt(e,R)).join(`, `)||`—`})})]})]}),Dn&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(ie,{}),(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:S(`returnedHint`,`An approver sent this back to you. The record is unlocked — fix the data, then resubmit to start a new approval round.`)}),(0,D.jsxs)(`div`,{className:`flex gap-2 flex-wrap items-center`,children:[(0,D.jsx)(p,{asChild:!0,size:`sm`,variant:`outline`,children:(0,D.jsxs)(t,{to:ht(R),children:[(0,D.jsx)(et,{className:`h-4 w-4 mr-1`}),S(`editRecordBtn`,`Edit record`)]})}),(0,D.jsx)(at,{objectName:`sys_approval_request`,record:R,location:`record_section`,onDone:()=>{Sn(R.id),K()}})]})]})]})]}):null]})})]})}export{Pt as ApprovalsInboxPage};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,r as n}from"./vendor-react-CsWFRkED.js";import{Bn as r,Cn as i,Dn as a,En as o,Gt as s,In as c,Jt as l,Kt as u,On as d,Or as f,Pr as p,Rr as m,Sn as h,Tn as g,Ut as _,Wt as ee,Xr as v,bn as te,cc as ne,gn as re,gt as ie,ht as ae,kr as y,oa as b,qt as x,ri as oe,sa as se,vn as ce,wn as le,xn as ue,ya as S,yn as C,yt as w,zr as T}from"./ui-components-Dwq5utCl.js";var E=e(t(),1),de=[`create`,`update`,`delete`,`login`,`logout`,`config_change`,`import`],D={create:`default`,update:`secondary`,delete:`destructive`,login:`outline`,logout:`outline`,config_change:`secondary`,import:`outline`},O=n(),fe=`${``.replace(/\/$/,``)}/api/v1`,k=50;function A(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function j(e,t=24){return e?e.length>t?`${e.slice(0,t-1)}…`:e:`—`}function M(e){if(!e)return``;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function N(){let[e,t]=(0,E.useState)([]),[n,N]=(0,E.useState)(!1),[P,F]=(0,E.useState)(null),[I,L]=(0,E.useState)(`all`),[R,z]=(0,E.useState)(``),[B,V]=(0,E.useState)(``),[H,U]=(0,E.useState)(``),[W,G]=(0,E.useState)(``),[K,q]=(0,E.useState)(0),[J,Y]=(0,E.useState)(!1),[X,Z]=(0,E.useState)(null),Q=(0,E.useCallback)(async()=>{N(!0),F(null);try{let e={};I&&I!==`all`&&(e.action=I),R.trim()&&(e.object_name=R.trim()),B.trim()&&(e.user_id=B.trim()),H&&(e.created_at={...e.created_at||{},$gte:H}),W&&(e.created_at={...e.created_at||{},$lte:`${W}T23:59:59`});let n=new URLSearchParams;Object.keys(e).length>0&&n.set(`$filter`,JSON.stringify(e)),n.set(`$orderby`,`created_at desc`),n.set(`$top`,`51`),n.set(`$skip`,String(K*k));let r=await fetch(`${fe}/data/sys_audit_log?${n.toString()}`,{credentials:`include`});if(!r.ok){let e=await r.text().catch(()=>``);throw Error(`HTTP ${r.status}: ${e.slice(0,200)||r.statusText}`)}let i=await r.json(),a=Array.isArray(i)?i:Array.isArray(i?.records)?i.records:Array.isArray(i?.data)?i.data:[];Y(a.length>k),t(a.slice(0,k))}catch(e){console.warn(`[AuditLogPage] load failed:`,e),F(e?.message||`Failed to load audit log`),t([]),Y(!1)}finally{N(!1)}},[I,R,B,H,W,K]);(0,E.useEffect)(()=>{Q()},[Q]);let pe=(0,E.useCallback)(()=>{L(`all`),z(``),V(``),U(``),G(``),q(0)},[]),$=(0,E.useMemo)(()=>{let e=0;return I!==`all`&&(e+=1),R.trim()&&(e+=1),B.trim()&&(e+=1),H&&(e+=1),W&&(e+=1),e},[I,R,B,H,W]);return(0,O.jsxs)(`div`,{className:`p-6 space-y-4 max-w-screen-2xl mx-auto`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(se,{className:`h-6 w-6 text-muted-foreground`}),(0,O.jsxs)(`div`,{className:`flex-1`,children:[(0,O.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Audit Log`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Read-only system activity and record changes. Newest first.`})]}),(0,O.jsxs)(v,{variant:`outline`,size:`sm`,onClick:Q,disabled:n,children:[(0,O.jsx)(S,{className:`h-4 w-4 mr-1 ${n?`animate-spin`:``}`}),`Refresh`]})]}),(0,O.jsx)(f,{children:(0,O.jsxs)(y,{className:`p-4 grid grid-cols-1 md:grid-cols-5 gap-3`,children:[(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(r,{className:`text-xs`,children:`Action`}),(0,O.jsxs)(le,{value:I,onValueChange:e=>{L(e),q(0)},children:[(0,O.jsx)(a,{className:`h-9`,children:(0,O.jsx)(d,{})}),(0,O.jsxs)(g,{children:[(0,O.jsx)(o,{value:`all`,children:`All actions`}),de.map(e=>(0,O.jsx)(o,{value:e,children:e},e))]})]})]}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(r,{className:`text-xs`,children:`Object`}),(0,O.jsx)(c,{placeholder:`e.g. account`,value:R,onChange:e=>{z(e.target.value),q(0)},className:`h-9`})]}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(r,{className:`text-xs`,children:`Actor (user id)`}),(0,O.jsx)(c,{placeholder:`user id`,value:B,onChange:e=>{V(e.target.value),q(0)},className:`h-9`})]}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(r,{className:`text-xs`,children:`From`}),(0,O.jsx)(c,{type:`date`,value:H,onChange:e=>{U(e.target.value),q(0)},className:`h-9`})]}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(r,{className:`text-xs`,children:`To`}),(0,O.jsx)(c,{type:`date`,value:W,onChange:e=>{G(e.target.value),q(0)},className:`h-9`})]}),$>0&&(0,O.jsx)(`div`,{className:`md:col-span-5 flex justify-end`,children:(0,O.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:pe,children:[(0,O.jsx)(oe,{className:`h-4 w-4 mr-1`}),`Clear filters (`,$,`)`]})})]})}),P&&(0,O.jsxs)(m,{variant:`destructive`,children:[(0,O.jsx)(ne,{className:`h-4 w-4`}),(0,O.jsx)(T,{children:P})]}),(0,O.jsx)(f,{children:(0,O.jsx)(y,{className:`p-0`,children:n&&e.length===0?(0,O.jsx)(`div`,{className:`p-6 space-y-2`,children:Array.from({length:6}).map((e,t)=>(0,O.jsx)(re,{className:`h-9 w-full`},t))}):e.length===0?(0,O.jsx)(`div`,{className:`p-12`,children:(0,O.jsxs)(ae,{children:[(0,O.jsx)(b,{className:`h-8 w-8 text-muted-foreground mb-3`}),(0,O.jsx)(w,{children:`No audit entries`}),(0,O.jsx)(ie,{children:$>0?`Try clearing filters or widening the date range.`:`Events will appear here once tracked objects are modified.`})]})}):(0,O.jsxs)(_,{children:[(0,O.jsx)(x,{children:(0,O.jsxs)(l,{children:[(0,O.jsx)(u,{className:`w-[180px]`,children:`Timestamp`}),(0,O.jsx)(u,{className:`w-[130px]`,children:`Action`}),(0,O.jsx)(u,{children:`Object`}),(0,O.jsx)(u,{children:`Record`}),(0,O.jsx)(u,{children:`Actor`}),(0,O.jsx)(u,{className:`w-[130px]`,children:`IP`})]})}),(0,O.jsx)(ee,{children:e.map(e=>{let t=D[e.action||``]||`outline`;return(0,O.jsxs)(l,{className:`cursor-pointer`,onClick:()=>Z(e),children:[(0,O.jsx)(s,{className:`font-mono text-xs`,children:A(e.created_at)}),(0,O.jsx)(s,{children:(0,O.jsx)(p,{variant:t,children:e.action||`—`})}),(0,O.jsx)(s,{children:e.object_name||`—`}),(0,O.jsx)(s,{className:`font-mono text-xs`,children:j(e.record_id,18)}),(0,O.jsx)(s,{className:`font-mono text-xs`,children:j(e.user_id,18)}),(0,O.jsx)(s,{className:`font-mono text-xs`,children:e.ip_address||`—`})]},e.id)})})]})})}),(e.length>0||K>0)&&(0,O.jsxs)(`div`,{className:`flex items-center justify-between text-sm text-muted-foreground`,children:[(0,O.jsxs)(`span`,{children:[`Page `,K+1,J?``:` · end`]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(v,{variant:`outline`,size:`sm`,disabled:K===0||n,onClick:()=>q(e=>Math.max(0,e-1)),children:`Previous`}),(0,O.jsx)(v,{variant:`outline`,size:`sm`,disabled:!J||n,onClick:()=>q(e=>e+1),children:`Next`})]})]}),(0,O.jsx)(ce,{open:!!X,onOpenChange:e=>!e&&Z(null),children:(0,O.jsxs)(C,{side:`right`,className:`sm:max-w-2xl w-full overflow-y-auto`,children:[(0,O.jsxs)(ue,{children:[(0,O.jsxs)(h,{className:`flex items-center gap-2`,children:[(0,O.jsx)(p,{variant:X&&D[X.action||``]||`outline`,children:X?.action||`—`}),X?.object_name||`Audit Event`]}),(0,O.jsx)(te,{children:X?.id?(0,O.jsx)(`span`,{className:`font-mono text-xs`,children:X.id}):null})]}),X&&(0,O.jsxs)(`div`,{className:`mt-6 space-y-5`,children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-sm`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Timestamp`}),(0,O.jsx)(`div`,{className:`font-mono`,children:A(X.created_at)})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`IP Address`}),(0,O.jsx)(`div`,{className:`font-mono`,children:X.ip_address||`—`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Actor (user_id)`}),(0,O.jsx)(`div`,{className:`font-mono break-all`,children:X.user_id||`—`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Tenant`}),(0,O.jsx)(`div`,{className:`font-mono break-all`,children:X.tenant_id||`—`})]}),(0,O.jsxs)(`div`,{className:`col-span-2`,children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Target record`}),(0,O.jsxs)(`div`,{className:`font-mono text-sm break-all`,children:[X.object_name||`—`,` / `,X.record_id||`—`]})]}),X.user_agent&&(0,O.jsxs)(`div`,{className:`col-span-2`,children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`User Agent`}),(0,O.jsx)(`div`,{className:`font-mono text-xs break-all`,children:X.user_agent})]})]}),(X.old_value||X.new_value)&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i,{}),(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsx)(`div`,{className:`text-sm font-medium`,children:`Change payload`}),X.old_value&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Before`}),(0,O.jsx)(`pre`,{className:`rounded-md bg-muted p-3 text-xs font-mono whitespace-pre-wrap max-h-64 overflow-auto`,children:M(X.old_value)})]}),X.new_value&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`After`}),(0,O.jsx)(`pre`,{className:`rounded-md bg-muted p-3 text-xs font-mono whitespace-pre-wrap max-h-64 overflow-auto`,children:M(X.new_value)})]})]})]}),X.metadata&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i,{}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-sm font-medium mb-2`,children:`Metadata`}),(0,O.jsx)(`pre`,{className:`rounded-md bg-muted p-3 text-xs font-mono whitespace-pre-wrap max-h-48 overflow-auto`,children:M(X.metadata)})]})]})]})]})})]})}export{N as AuditLogPage};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,r as n}from"./vendor-react-CsWFRkED.js";import{Bn as r,Cn as i,Dn as a,En as o,Gt as s,In as c,Jt as l,Kt as u,On as d,Or as f,Pr as p,Rr as m,Sn as h,Tn as g,Ut as _,Wt as ee,Xr as v,aa as te,bn as ne,gn as re,ht as ie,kr as y,mt as ae,ni as b,oa as x,qt as oe,sc as se,va as ce,vn as le,vt as ue,wn as S,xn as C,yn as w,zr as T}from"./ui-components-D2lrjG-t.js";var E=e(t(),1),de=[`create`,`update`,`delete`,`login`,`logout`,`config_change`,`import`],D={create:`default`,update:`secondary`,delete:`destructive`,login:`outline`,logout:`outline`,config_change:`secondary`,import:`outline`},O=n(),fe=`${``.replace(/\/$/,``)}/api/v1`,k=50;function A(e){if(!e)return`—`;try{return new Date(e).toLocaleString()}catch{return e}}function j(e,t=24){return e?e.length>t?`${e.slice(0,t-1)}…`:e:`—`}function M(e){if(!e)return``;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function N(){let[e,t]=(0,E.useState)([]),[n,N]=(0,E.useState)(!1),[P,F]=(0,E.useState)(null),[I,L]=(0,E.useState)(`all`),[R,z]=(0,E.useState)(``),[B,V]=(0,E.useState)(``),[H,U]=(0,E.useState)(``),[W,G]=(0,E.useState)(``),[K,q]=(0,E.useState)(0),[J,Y]=(0,E.useState)(!1),[X,Z]=(0,E.useState)(null),Q=(0,E.useCallback)(async()=>{N(!0),F(null);try{let e={};I&&I!==`all`&&(e.action=I),R.trim()&&(e.object_name=R.trim()),B.trim()&&(e.user_id=B.trim()),H&&(e.created_at={...e.created_at||{},$gte:H}),W&&(e.created_at={...e.created_at||{},$lte:`${W}T23:59:59`});let n=new URLSearchParams;Object.keys(e).length>0&&n.set(`$filter`,JSON.stringify(e)),n.set(`$orderby`,`created_at desc`),n.set(`$top`,`51`),n.set(`$skip`,String(K*k));let r=await fetch(`${fe}/data/sys_audit_log?${n.toString()}`,{credentials:`include`});if(!r.ok){let e=await r.text().catch(()=>``);throw Error(`HTTP ${r.status}: ${e.slice(0,200)||r.statusText}`)}let i=await r.json(),a=Array.isArray(i)?i:Array.isArray(i?.records)?i.records:Array.isArray(i?.data)?i.data:[];Y(a.length>k),t(a.slice(0,k))}catch(e){console.warn(`[AuditLogPage] load failed:`,e),F(e?.message||`Failed to load audit log`),t([]),Y(!1)}finally{N(!1)}},[I,R,B,H,W,K]);(0,E.useEffect)(()=>{Q()},[Q]);let pe=(0,E.useCallback)(()=>{L(`all`),z(``),V(``),U(``),G(``),q(0)},[]),$=(0,E.useMemo)(()=>{let e=0;return I!==`all`&&(e+=1),R.trim()&&(e+=1),B.trim()&&(e+=1),H&&(e+=1),W&&(e+=1),e},[I,R,B,H,W]);return(0,O.jsxs)(`div`,{className:`p-6 space-y-4 max-w-screen-2xl mx-auto`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(x,{className:`h-6 w-6 text-muted-foreground`}),(0,O.jsxs)(`div`,{className:`flex-1`,children:[(0,O.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Audit Log`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Read-only system activity and record changes. Newest first.`})]}),(0,O.jsxs)(v,{variant:`outline`,size:`sm`,onClick:Q,disabled:n,children:[(0,O.jsx)(ce,{className:`h-4 w-4 mr-1 ${n?`animate-spin`:``}`}),`Refresh`]})]}),(0,O.jsx)(f,{children:(0,O.jsxs)(y,{className:`p-4 grid grid-cols-1 md:grid-cols-5 gap-3`,children:[(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(r,{className:`text-xs`,children:`Action`}),(0,O.jsxs)(S,{value:I,onValueChange:e=>{L(e),q(0)},children:[(0,O.jsx)(a,{className:`h-9`,children:(0,O.jsx)(d,{})}),(0,O.jsxs)(g,{children:[(0,O.jsx)(o,{value:`all`,children:`All actions`}),de.map(e=>(0,O.jsx)(o,{value:e,children:e},e))]})]})]}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(r,{className:`text-xs`,children:`Object`}),(0,O.jsx)(c,{placeholder:`e.g. account`,value:R,onChange:e=>{z(e.target.value),q(0)},className:`h-9`})]}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(r,{className:`text-xs`,children:`Actor (user id)`}),(0,O.jsx)(c,{placeholder:`user id`,value:B,onChange:e=>{V(e.target.value),q(0)},className:`h-9`})]}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(r,{className:`text-xs`,children:`From`}),(0,O.jsx)(c,{type:`date`,value:H,onChange:e=>{U(e.target.value),q(0)},className:`h-9`})]}),(0,O.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,O.jsx)(r,{className:`text-xs`,children:`To`}),(0,O.jsx)(c,{type:`date`,value:W,onChange:e=>{G(e.target.value),q(0)},className:`h-9`})]}),$>0&&(0,O.jsx)(`div`,{className:`md:col-span-5 flex justify-end`,children:(0,O.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:pe,children:[(0,O.jsx)(b,{className:`h-4 w-4 mr-1`}),`Clear filters (`,$,`)`]})})]})}),P&&(0,O.jsxs)(m,{variant:`destructive`,children:[(0,O.jsx)(se,{className:`h-4 w-4`}),(0,O.jsx)(T,{children:P})]}),(0,O.jsx)(f,{children:(0,O.jsx)(y,{className:`p-0`,children:n&&e.length===0?(0,O.jsx)(`div`,{className:`p-6 space-y-2`,children:Array.from({length:6}).map((e,t)=>(0,O.jsx)(re,{className:`h-9 w-full`},t))}):e.length===0?(0,O.jsx)(`div`,{className:`p-12`,children:(0,O.jsxs)(ae,{children:[(0,O.jsx)(te,{className:`h-8 w-8 text-muted-foreground mb-3`}),(0,O.jsx)(ue,{children:`No audit entries`}),(0,O.jsx)(ie,{children:$>0?`Try clearing filters or widening the date range.`:`Events will appear here once tracked objects are modified.`})]})}):(0,O.jsxs)(_,{children:[(0,O.jsx)(oe,{children:(0,O.jsxs)(l,{children:[(0,O.jsx)(u,{className:`w-[180px]`,children:`Timestamp`}),(0,O.jsx)(u,{className:`w-[130px]`,children:`Action`}),(0,O.jsx)(u,{children:`Object`}),(0,O.jsx)(u,{children:`Record`}),(0,O.jsx)(u,{children:`Actor`}),(0,O.jsx)(u,{className:`w-[130px]`,children:`IP`})]})}),(0,O.jsx)(ee,{children:e.map(e=>{let t=D[e.action||``]||`outline`;return(0,O.jsxs)(l,{className:`cursor-pointer`,onClick:()=>Z(e),children:[(0,O.jsx)(s,{className:`font-mono text-xs`,children:A(e.created_at)}),(0,O.jsx)(s,{children:(0,O.jsx)(p,{variant:t,children:e.action||`—`})}),(0,O.jsx)(s,{children:e.object_name||`—`}),(0,O.jsx)(s,{className:`font-mono text-xs`,children:j(e.record_id,18)}),(0,O.jsx)(s,{className:`font-mono text-xs`,children:j(e.user_id,18)}),(0,O.jsx)(s,{className:`font-mono text-xs`,children:e.ip_address||`—`})]},e.id)})})]})})}),(e.length>0||K>0)&&(0,O.jsxs)(`div`,{className:`flex items-center justify-between text-sm text-muted-foreground`,children:[(0,O.jsxs)(`span`,{children:[`Page `,K+1,J?``:` · end`]}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(v,{variant:`outline`,size:`sm`,disabled:K===0||n,onClick:()=>q(e=>Math.max(0,e-1)),children:`Previous`}),(0,O.jsx)(v,{variant:`outline`,size:`sm`,disabled:!J||n,onClick:()=>q(e=>e+1),children:`Next`})]})]}),(0,O.jsx)(le,{open:!!X,onOpenChange:e=>!e&&Z(null),children:(0,O.jsxs)(w,{side:`right`,className:`sm:max-w-2xl w-full overflow-y-auto`,children:[(0,O.jsxs)(C,{children:[(0,O.jsxs)(h,{className:`flex items-center gap-2`,children:[(0,O.jsx)(p,{variant:X&&D[X.action||``]||`outline`,children:X?.action||`—`}),X?.object_name||`Audit Event`]}),(0,O.jsx)(ne,{children:X?.id?(0,O.jsx)(`span`,{className:`font-mono text-xs`,children:X.id}):null})]}),X&&(0,O.jsxs)(`div`,{className:`mt-6 space-y-5`,children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-sm`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Timestamp`}),(0,O.jsx)(`div`,{className:`font-mono`,children:A(X.created_at)})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`IP Address`}),(0,O.jsx)(`div`,{className:`font-mono`,children:X.ip_address||`—`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Actor (user_id)`}),(0,O.jsx)(`div`,{className:`font-mono break-all`,children:X.user_id||`—`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Tenant`}),(0,O.jsx)(`div`,{className:`font-mono break-all`,children:X.tenant_id||`—`})]}),(0,O.jsxs)(`div`,{className:`col-span-2`,children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Target record`}),(0,O.jsxs)(`div`,{className:`font-mono text-sm break-all`,children:[X.object_name||`—`,` / `,X.record_id||`—`]})]}),X.user_agent&&(0,O.jsxs)(`div`,{className:`col-span-2`,children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`User Agent`}),(0,O.jsx)(`div`,{className:`font-mono text-xs break-all`,children:X.user_agent})]})]}),(X.old_value||X.new_value)&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i,{}),(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsx)(`div`,{className:`text-sm font-medium`,children:`Change payload`}),X.old_value&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`Before`}),(0,O.jsx)(`pre`,{className:`rounded-md bg-muted p-3 text-xs font-mono whitespace-pre-wrap max-h-64 overflow-auto`,children:M(X.old_value)})]}),X.new_value&&(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,children:`After`}),(0,O.jsx)(`pre`,{className:`rounded-md bg-muted p-3 text-xs font-mono whitespace-pre-wrap max-h-64 overflow-auto`,children:M(X.new_value)})]})]})]}),X.metadata&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i,{}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-sm font-medium mb-2`,children:`Metadata`}),(0,O.jsx)(`pre`,{className:`rounded-md bg-muted p-3 text-xs font-mono whitespace-pre-wrap max-h-48 overflow-auto`,children:M(X.metadata)})]})]})]})]})})]})}export{N as AuditLogPage};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-C0FnF6B9.js";import{b as e,g as t,h as n,r}from"./vendor-react-CsWFRkED.js";import{ht as i,mt as a,vt as o}from"./ui-components-D2lrjG-t.js";import{t as s}from"./componentRegistry-ByxoJqMW.js";e();var c=r();function l({extraProps:e}={}){let r=n(),[l]=t(),u=r.ns,d=r.name,f=u&&d?`${u}:${d}`:u??``,p=s(f);if(!p)return(0,c.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,c.jsxs)(a,{children:[(0,c.jsx)(o,{children:`Component not registered`}),(0,c.jsxs)(i,{children:[`No component is registered for `,(0,c.jsx)(`code`,{className:`font-mono`,children:f||`(empty)`}),`. Ensure the plugin that provides this surface is installed and has called`,(0,c.jsx)(`code`,{className:`font-mono`,children:` registerAppComponent()`}),`.`]})]})});let m={};for(let[e,t]of l.entries())m[e]=t;let h=p.component;return(0,c.jsx)(h,{...m,...e??{}})}export{l as ComponentNavView,l as default};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,r as n}from"./vendor-react-CsWFRkED.js";import{y as r}from"./i18n-locales-Bz4c8KXc.js";import{Cr as i,Dc as a,Do as o,Gi as s,In as c,Sr as ee,Tc as l,Ui as u,Us as d,Xr as f,bo as p,br as m,fo as h,il as g,sc as _,vr as v,xr as y,yr as te,zo as b}from"./ui-components-D2lrjG-t.js";import{n as x}from"./createDerive-Best2JCj.js";import{a as S,i as C,n as w,o as T,r as E,s as ne,t as D}from"./plugin-view-5qxxRyZZ.js";var O=e(t(),1),k=n();function A({title:e,subtitle:t,icon:n,actions:r,accentColor:i,sticky:a=!1,className:o,"data-testid":s}){return(0,k.jsxs)(`div`,{style:{"--page-header-accent":i||`hsl(var(--primary))`},className:g(`relative shrink-0 border-b bg-background z-10`,a&&`sticky top-0 bg-background/85 backdrop-blur supports-[backdrop-filter]:bg-background/75`,o),"data-testid":s??`page-header`,children:[(0,k.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,k.jsxs)(`div`,{className:`flex justify-between items-center gap-3 py-2.5 sm:py-3 px-4 sm:px-6`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[n&&(0,k.jsx)(`div`,{className:g(`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,k.jsxs)(`div`,{className:`min-w-0`,children:[(0,k.jsx)(`h1`,{className:`text-base sm:text-lg lg:text-xl font-semibold tracking-tight text-foreground truncate leading-tight`,children:e}),t&&(0,k.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,k.jsx)(`div`,{className:`flex items-center gap-1.5 sm:gap-2 shrink-0`,children:r})]})]})}function j(e){return[{type:`grid`,icon:o,label:e(`console.objectView.viewTypeGrid`),description:e(`console.objectView.viewTypeGridDesc`)},{type:`kanban`,icon:u,label:e(`console.objectView.viewTypeKanban`),description:e(`console.objectView.viewTypeKanbanDesc`)},{type:`calendar`,icon:a,label:e(`console.objectView.viewTypeCalendar`),description:e(`console.objectView.viewTypeCalendarDesc`)},{type:`gallery`,icon:b,label:e(`console.objectView.viewTypeGallery`),description:e(`console.objectView.viewTypeGalleryDesc`)},{type:`timeline`,icon:d,label:e(`console.objectView.viewTypeTimeline`),description:e(`console.objectView.viewTypeTimelineDesc`)},{type:`gantt`,icon:s,label:e(`console.objectView.viewTypeGantt`),description:e(`console.objectView.viewTypeGanttDesc`)},{type:`map`,icon:h,label:e(`console.objectView.viewTypeMap`),description:e(`console.objectView.viewTypeMapDesc`)},{type:`chart`,icon:l,label:e(`console.objectView.viewTypeChart`),description:e(`console.objectView.viewTypeChartDesc`)},{type:`tree`,icon:p,label:e(`console.objectView.viewTypeTree`),description:e(`console.objectView.viewTypeTreeDesc`)}]}function M(e,t){for(let n=1;n<1e3;n++){let r=`${e} ${n}`;if(!t.has(r))return r}return e}var N={kanban:[{key:`groupByField`,i18nKey:`console.objectView.groupByField`,helpI18nKey:`console.objectView.groupByFieldHelp`,filter:e=>e.type===`select`||e.type===`boolean`,preferred:w}],calendar:[{key:`startDateField`,i18nKey:`console.objectView.startDateField`,helpI18nKey:`console.objectView.startDateFieldHelp`,filter:e=>e.type===`date`,preferred:E},{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:E},{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:E},{key:`endDateField`,i18nKey:`console.objectView.endDateField`,helpI18nKey:`console.objectView.ganttEndDateFieldHelp`,filter:e=>e.type===`date`,preferred:D},{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=>T(e)}],map:[{key:`latitudeField`,i18nKey:`console.objectView.latitudeField`,helpI18nKey:`console.objectView.latitudeFieldHelp`,filter:e=>e.type===`number`&&S(e,`latitude`)},{key:`longitudeField`,i18nKey:`console.objectView.longitudeField`,helpI18nKey:`console.objectView.longitudeFieldHelp`,filter:e=>e.type===`number`&&S(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:w},{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 P({open:e,onOpenChange:t,onCreate:n,existingLabels:a,availableTypes:o,objectDef:s}){let{t:l}=r(),u=(0,O.useMemo)(()=>j(l),[l]),d=(0,O.useMemo)(()=>o&&o.length>0?u.filter(e=>o.includes(e.type)):u,[u,o]),p=(a??[]).join(`\0`),h=(0,O.useMemo)(()=>new Set(a??[]),[p]),b=(0,O.useMemo)(()=>s?C(s):[],[s]),[S,w]=(0,O.useState)(d[0]?.type??`grid`),[T,E]=(0,O.useState)(``),[D,A]=(0,O.useState)(!1),[P,F]=(0,O.useState)(``),[I,L]=(0,O.useState)(!1),[R,z]=(0,O.useState)({});(0,O.useEffect)(()=>{e&&(w(d[0]?.type??`grid`),A(!1),L(!1),z({}))},[e,d]),(0,O.useEffect)(()=>{if(!D){let e=d.find(e=>e.type===S);E(M(e?.label??`View`,h))}},[S,D,d,h]),(0,O.useEffect)(()=>{I||F(x(T))},[T,I]);let B=N[S]??[],V=e=>e.kind===`enum`?(e.enumOptions?.length??0)>0:!s||(e.filter?b.filter(e.filter):b).length>0,H=(0,O.useMemo)(()=>{let e={};return d.forEach(t=>{let n=(N[t.type]??[]).find(e=>!V(e));e[t.type]=n??null}),e},[d,b,s]),U=e=>R[`${S}.${e}`]??``,W=(e,t)=>z(n=>({...n,[`${S}.${e}`]:t})),G=T.trim(),K=G.length>0&&h.has(G),q=B.every(e=>U(e.key).length>0),J=/^[a-z_][a-z0-9_]*$/,Y=P.trim(),X=Y.length===0,Z=Y.length>0&&!J.test(Y),Q=G.length>0&&!K&&q&&!X&&!Z;(0,O.useEffect)(()=>{B.length!==0&&B.forEach(e=>{if(U(e.key).length>0)return;if(e.kind===`enum`){e.defaultValue&&W(e.key,e.defaultValue);return}let t=e.filter?b.filter(e.filter):b;if(t.length===0)return;if(t.length===1){W(e.key,t[0].value);return}let n=ne(t,e.preferred??[]);n&&W(e.key,n)})},[S,b]);let $=()=>{if(!Q)return;let e={};B.forEach(t=>{let n=U(t.key);n&&(e[t.key]=t.key===`yAxisFields`?[n]:n)});let r={type:S,label:G,name:Y};Object.keys(e).length>0&&(r[S]=e),n(r),t(!1)};return(0,k.jsx)(v,{open:e,onOpenChange:t,children:(0,k.jsxs)(te,{className:`sm:max-w-[560px]`,"data-testid":`create-view-dialog`,children:[(0,k.jsxs)(ee,{children:[(0,k.jsx)(i,{children:l(`console.objectView.createView`)}),(0,k.jsx)(m,{children:l(`console.objectView.createViewDesc`)})]}),(0,k.jsx)(`div`,{className:`grid grid-cols-4 gap-2 py-2`,"data-testid":`create-view-type-grid`,children:d.map(({type:e,label:t,description:n,icon:r})=>{let i=e===S,a=H[e],o=!!a,s=o?l(`console.objectView.viewTypeUnavailable`,{field:l(a.i18nKey)}):void 0;return(0,k.jsxs)(`button`,{type:`button`,"data-testid":`create-view-type-${e}`,"aria-pressed":i,"aria-disabled":o,disabled:o,title:s,onClick:()=>{o||w(e)},className:g(`group flex flex-col items-start gap-1 rounded-lg border bg-background p-3 text-left transition-colors`,!o&&`hover:border-primary/60 hover:bg-accent/40`,i&&!o?`border-primary ring-2 ring-primary/30 bg-accent/40`:`border-border`,o&&`opacity-50 cursor-not-allowed`),children:[(0,k.jsx)(r,{className:g(`h-5 w-5`,i&&!o?`text-primary`:`text-muted-foreground group-hover:text-foreground`)}),(0,k.jsx)(`div`,{className:`text-xs font-medium leading-tight`,children:t}),(0,k.jsx)(`div`,{className:`text-[10px] leading-tight text-muted-foreground line-clamp-2`,children:o?l(`console.objectView.viewTypeUnavailableShort`):n})]},e)})}),B.length>0&&(0,k.jsx)(`div`,{className:`space-y-3 rounded-md border border-dashed bg-muted/30 p-3`,"data-testid":`create-view-required-fields`,children:B.map(e=>{let t=U(e.key),n=e.kind===`enum`,r=n?[]:e.filter?b.filter(e.filter):b,i=!n&&b.length>0&&r.length===0;return(0,k.jsxs)(`div`,{className:`space-y-1`,children:[(0,k.jsxs)(`label`,{htmlFor:`create-view-required-${e.key}`,className:`text-xs font-medium`,children:[l(e.i18nKey),(0,k.jsx)(`span`,{className:`ml-1 text-destructive`,"aria-hidden":`true`,children:`*`})]}),(0,k.jsxs)(`select`,{id:`create-view-required-${e.key}`,"aria-required":`true`,"data-testid":`create-view-required-${e.key}`,value:t,onChange:t=>W(e.key,t.target.value),disabled:i,className:g(`h-9 w-full rounded-md border bg-background px-2 text-xs`,`border-input`),children:[(0,k.jsx)(`option`,{value:``,children:l(n?`console.objectView.selectOption`:`console.objectView.selectField`)}),n?e.enumOptions.map(e=>(0,k.jsx)(`option`,{value:e.value,children:l(e.i18nKey)},e.value)):r.map(e=>(0,k.jsx)(`option`,{value:e.value,children:e.label},e.value))]}),e.helpI18nKey&&!i&&(0,k.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:l(e.helpI18nKey)}),i&&(0,k.jsxs)(`p`,{className:`flex items-center gap-1 text-[11px] text-destructive`,"data-testid":`create-view-error-no-field-${e.key}`,children:[(0,k.jsx)(_,{className:`h-3 w-3`}),l(`console.objectView.noEligibleFieldForType`)]})]},e.key)})}),(0,k.jsxs)(`div`,{className:`space-y-1`,children:[(0,k.jsxs)(`label`,{htmlFor:`create-view-name-input`,className:`text-xs font-medium`,children:[l(`console.objectView.title`),(0,k.jsx)(`span`,{className:`ml-1 text-destructive`,"aria-hidden":`true`,children:`*`})]}),(0,k.jsx)(c,{id:`create-view-name-input`,"aria-required":`true`,"data-testid":`create-view-name-input`,autoFocus:!0,value:T,onChange:e=>{E(e.target.value),A(!0)},onKeyDown:e=>{e.key===`Enter`&&Q&&$()},placeholder:l(`console.objectView.newView`),className:`h-9`}),K&&(0,k.jsx)(`p`,{className:`text-[11px] text-destructive`,"data-testid":`create-view-error-duplicate`,children:l(`console.objectView.duplicateViewName`)})]}),(0,k.jsxs)(`div`,{className:`space-y-1`,children:[(0,k.jsxs)(`label`,{htmlFor:`create-view-machine-name-input`,className:`text-xs font-medium`,children:[l(`console.objectView.viewName`),(0,k.jsx)(`span`,{className:`ml-1 text-destructive`,"aria-hidden":`true`,children:`*`})]}),(0,k.jsx)(c,{id:`create-view-machine-name-input`,"aria-required":`true`,"data-testid":`create-view-machine-name-input`,value:P,onChange:e=>{F(e.target.value),L(!0)},onKeyDown:e=>{e.key===`Enter`&&Q&&$()},placeholder:`grid_1`,className:`h-9 font-mono`}),X?(0,k.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,"data-testid":`create-view-machine-name-help`,children:l(`console.objectView.viewNameRequired`)}):Z?(0,k.jsx)(`p`,{className:`text-[11px] text-destructive`,"data-testid":`create-view-error-machine-name`,children:l(`console.objectView.viewNameInvalid`)}):(0,k.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,"data-testid":`create-view-machine-name-help`,children:l(`console.objectView.viewNameHelp`)})]}),(0,k.jsxs)(y,{className:`mt-2`,children:[(0,k.jsx)(f,{type:`button`,variant:`outline`,onClick:()=>t(!1),"data-testid":`create-view-cancel`,children:l(`console.objectView.cancel`)}),(0,k.jsx)(f,{type:`button`,disabled:!Q,onClick:$,"data-testid":`create-view-submit`,children:l(`console.objectView.create`)})]})]})})}export{A as n,P as t};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,h as n,r}from"./vendor-react-CsWFRkED.js";import{J as i,q as a,z as o}from"./framework-BfSv4Kb0.js";import{u as s,y as c}from"./i18n-locales-Bz4c8KXc.js";import{Oo as l,gn as u,ht as d,mt as f,vt as p}from"./ui-components-D2lrjG-t.js";import{r as m}from"./vendor-ui-utils-BFw4cGI6.js";import{a as h}from"./ExpressionProvider-DqGWVuxV.js";import{t as g}from"./useActionModal-CkM-zGdy.js";import{t as _}from"./preferLocal-CKqyhTP9.js";import{n as v}from"./utils-MjUhYVsx.js";import{n as y,t as b}from"./MetadataInspector-Cu-n1FYz.js";import{n as x}from"./plugin-dashboard-Bj4ldCX6.js";import{t as S}from"./useOpenRecordList-DOZu_JZX.js";var C=r();function w({cards:e=6}){return(0,C.jsxs)(`div`,{className:`w-full space-y-6 p-4 sm:p-6`,children:[(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(u,{className:`h-7 w-56`}),(0,C.jsx)(u,{className:`h-4 w-80`})]}),(0,C.jsx)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:Array.from({length:4}).map((e,t)=>(0,C.jsxs)(`div`,{className:`rounded-lg border p-4 space-y-2`,children:[(0,C.jsx)(u,{className:`h-4 w-20`}),(0,C.jsx)(u,{className:`h-8 w-24`}),(0,C.jsx)(u,{className:`h-3 w-16`})]},`stat-${t}`))}),(0,C.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:Array.from({length:e}).map((e,t)=>(0,C.jsxs)(`div`,{className:`rounded-lg border p-4 space-y-3`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,C.jsx)(u,{className:`h-5 w-32`}),(0,C.jsx)(u,{className:`h-5 w-5 rounded-full`})]}),(0,C.jsx)(u,{className:`h-40 w-full`}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(u,{className:`h-3 w-16`}),(0,C.jsx)(u,{className:`h-3 w-12`})]})]},`widget-${t}`))})]})}var T=e(t(),1);function E({dataSource:e}){let t=S(),{dashboardName:r}=n(),{showDebug:u}=y(),E=a(),{t:D}=c(),{dashboardLabel:O,dashboardDescription:k}=s(),[A,j]=(0,T.useState)(!0),{modalHandler:M,modalElement:N}=g(E),P=(0,T.useMemo)(()=>({export_dashboard_pdf:async()=>{m.info(D(`dashboardActions.printDialogOpening`));try{return window.print(),{success:!0}}catch(e){return m.error(D(`dashboardActions.exportFailed`,{message:e?.message||String(e)})),{success:!1,error:e?.message||String(e)}}},forecast_dashboard:async()=>(m.info(D(`dashboardActions.forecastSoon`)),{success:!0})}),[D]);(0,T.useEffect)(()=>{j(!0),queueMicrotask(()=>j(!1))},[r]);let{dashboards:F,objects:I}=i(),{app:L}=h(),R=_(F,r,L?._packageId),z=(0,T.useMemo)(()=>new Set((I||[]).map(e=>e?.name).filter(Boolean)),[I]),B=(0,T.useMemo)(()=>{if(!R||z.size===0)return R;let e=R.widgets;if(!Array.isArray(e)||e.length===0)return R;let t=e.filter(e=>{let t=e?.requiresObject??e?.object;return!t||z.has(t)});return t.length===e.length?R:{...R,widgets:t}},[R,z]);return A?(0,C.jsx)(w,{}):R?(0,C.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,children:[(0,C.jsx)(`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,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(()=>{let e=v((B||R).title,D),t=v(R.label,D),n=O({name:R.name,label:t}),r=e||n||R.name;return(0,C.jsx)(`h1`,{className:`text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate`,children:r})})(),(()=>{let e=(B||R).description??R.description,t=k({name:R.name,description:v(e,D)});return t?(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:t}):null})()]})}),(0,C.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-col sm:flex-row relative`,children:[(0,C.jsx)(`div`,{className:`flex-1 min-w-0 overflow-auto p-2 sm:p-4 md:p-6`,children:(0,C.jsx)(o,{value:{openRecordList:t},children:(0,C.jsx)(x,{schema:B,dataSource:e,modalHandler:M,scriptHandlers:P,hideHeaderText:!0})})}),(0,C.jsx)(b,{open:u,sections:[{title:`Dashboard Configuration`,data:B}]})]}),N]}):(0,C.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,C.jsxs)(f,{children:[(0,C.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,C.jsx)(l,{className:`h-6 w-6 text-muted-foreground`})}),(0,C.jsx)(p,{children:D(`empty.dashboardNotFound`)}),(0,C.jsx)(d,{children:D(`empty.dashboardNotFoundDescription`,{name:r})})]})})}export{E as DashboardView};
@@ -1 +1 @@
1
- import{h as e,p as t,r as n}from"./vendor-react-CsWFRkED.js";import{Ai as r,Ar as i,Mr as a,Or as o,ai as s,ds as c,jr as l,ka as u,kr as d}from"./ui-components-Dwq5utCl.js";var f=n();function p(){let n=t(),{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:u,href:`${m}/developer/integrations`},{title:`API Console`,description:`Inspect and exercise REST endpoints with auto-discovered services`,icon:r,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:c,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 t=e.icon;return(0,f.jsxs)(o,{className:`cursor-pointer transition-colors hover:bg-accent/50`,onClick:()=>n(e.href),"data-testid":`hub-card-${e.title.toLowerCase().replace(/\s+/g,`-`)}`,role:`link`,tabIndex:0,"aria-label":`${e.title}: ${e.description}`,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(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)(t,{className:`h-5 w-5`})}),(0,f.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,f.jsx)(a,{className:`text-base`,children:e.title}),(0,f.jsx)(i,{className:`text-xs`,children:e.description})]})]}),(0,f.jsx)(d,{className:`pt-0`})]},e.title)})})]})}export{p as DeveloperHubPage};
1
+ import{h as e,p as t,r as n}from"./vendor-react-CsWFRkED.js";import{Ar as r,Mr as i,Oa as a,Or as o,ii as s,jr as c,ki as l,kr as u,us as d}from"./ui-components-D2lrjG-t.js";var f=n();function p(){let n=t(),{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:a,href:`${m}/developer/integrations`},{title:`API Console`,description:`Inspect and exercise REST endpoints with auto-discovered services`,icon:l,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:d,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 t=e.icon;return(0,f.jsxs)(o,{className:`cursor-pointer transition-colors hover:bg-accent/50`,onClick:()=>n(e.href),"data-testid":`hub-card-${e.title.toLowerCase().replace(/\s+/g,`-`)}`,role:`link`,tabIndex:0,"aria-label":`${e.title}: ${e.description}`,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e.href))},children:[(0,f.jsxs)(c,{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)(t,{className:`h-5 w-5`})}),(0,f.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,f.jsx)(i,{className:`text-base`,children:e.title}),(0,f.jsx)(r,{className:`text-xs`,children:e.description})]})]}),(0,f.jsx)(u,{className:`pt-0`})]},e.title)})})]})}export{p as DeveloperHubPage};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t,b as n,h as r,p as i,r as a}from"./vendor-react-CsWFRkED.js";import{q as o}from"./framework-BfSv4Kb0.js";import{y as s}from"./i18n-locales-Bz4c8KXc.js";import{hc as c,ps as l,sc as u,uo as d,vo as f,ws as p}from"./ui-components-D2lrjG-t.js";import"./src-JX1BkhmR.js";import{t as m}from"./DocShell-Ipy_IDvh.js";import{i as h,l as g,n as _,u as v}from"./use-book-data-qUZAxIs0.js";import{r as y,t as b}from"./plugin-markdown-B7zwZHmn.js";var x=e(n(),1),S=/(^```[^\n]*\n[\s\S]*?\n```[ \t]*$|^~~~[^\n]*\n[\s\S]*?\n~~~[ \t]*$)/m,C=/(`[^`\n]+`)/,w=/\]\((?:\.\/)?([a-z][a-z0-9_]*)\.md(#[^)\s]*)?\)/g;function T(e){return e.split(C).map((e,t)=>t%2==1?e:e.replace(w,`](/docs/$1$2)`)).join(``)}function E(e){let t=[],n=e;for(;;){let e=S.exec(n);if(!e||e.index===void 0)return t.push(T(n)),t.join(``);t.push(T(n.slice(0,e.index)),e[0]),n=n.slice(e.index+e[0].length)}}var D=a();function O({book:e,activeDoc:n,docHref:r}){return(0,D.jsxs)(`nav`,{"aria-label":e.label??e.name,className:`text-sm`,children:[e.label?(0,D.jsx)(`div`,{className:`mb-3 px-2 text-sm font-semibold text-foreground`,children:e.label}):null,(0,D.jsx)(`div`,{className:`space-y-5`,children:e.groups.map(e=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`mb-1 px-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e.label}),(0,D.jsx)(`ul`,{className:`space-y-0.5`,children:e.entries.map((e,i)=>{if(e.separator)return(0,D.jsx)(`li`,{className:`my-1.5 border-t border-border/60`,"aria-hidden":!0},`sep-${i}`);if(e.href)return(0,D.jsx)(`li`,{children:(0,D.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,className:`flex items-center gap-1.5 rounded px-2 py-1 text-muted-foreground hover:bg-muted/50 hover:text-foreground`,children:[(0,D.jsx)(`span`,{className:`truncate`,children:e.label??e.href}),(0,D.jsx)(p,{className:`h-3 w-3 shrink-0 opacity-60`})]})},`ext-${i}`);if(!e.doc)return null;let a=e.doc===n;return(0,D.jsx)(`li`,{children:(0,D.jsx)(t,{to:r(e.doc),"aria-current":a?`page`:void 0,className:`block truncate rounded px-2 py-1 transition ${a?`bg-primary/10 font-medium text-foreground`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`,children:e.label??e.doc})},e.doc)})})]},e.key))})]})}function k(){let{slug:e,name:t,appName:n}=r(),a=i(),p=o(),{t:S}=s(),[C,w]=(0,x.useState)(null),[T,k]=(0,x.useState)(`loading`),[A,j]=(0,x.useState)(``);(0,x.useEffect)(()=>{let e=!1;async function r(){if(!(!t||!p)){k(`loading`);try{let r=await p.getClient().meta.getItem(`doc`,t,n?{packageId:n}:void 0),i=r?.item??r?.data??r;if(e)return;i&&typeof i.content==`string`?(w({name:t,label:i.label,content:i.content}),k(`ready`)):k(`missing`)}catch(t){if(e)return;(t?.status??t?.response?.status)===404||/not found/i.test(t?.message??``)?k(`missing`):(j(t?.message??`Failed to load documentation`),k(`error`))}}}return r(),()=>{e=!0}},[t,n,p]);let M=(0,x.useCallback)(e=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`}),window.history.replaceState(null,``,`${window.location.pathname}${window.location.search}#${e}`)},[]),N=(0,x.useCallback)(e=>{if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0)return;let t=e.target.closest(`a`)?.getAttribute(`href`);t&&(t.startsWith(`/docs/`)?(e.preventDefault(),a(t)):t.startsWith(`#`)&&(e.preventDefault(),M(decodeURIComponent(t.slice(1)))))},[a,M]),P=(0,x.useCallback)((e,t)=>{e.defaultPrevented||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||(e.preventDefault(),M(t))},[M]),F=(0,x.useMemo)(()=>y(C?.content??``),[C?.content]),I=S(`help.onThisPage`,{defaultValue:`On this page`}),{books:L,docs:R}=_(),z=n?`/apps/${n}/docs`:`/docs`,B=(0,x.useMemo)(()=>{let t=L.find(t=>h(t)===e);return t?g(t,v(t,R)):null},[L,R,e]),V=(0,x.useCallback)(t=>`${z}/${e}/${t}`,[z,e]);return T===`loading`?(0,D.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,D.jsx)(f,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})}):T===`missing`?(0,D.jsx)(m,{breadcrumb:t,children:(0,D.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,D.jsx)(l,{className:`h-10 w-10 text-muted-foreground`}),(0,D.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Documentation not found`}),(0,D.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No document named `,(0,D.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:t}),` is installed. It may belong to a package that is not installed, or it was removed in a newer version.`]})]})}):T===`error`?(0,D.jsx)(m,{breadcrumb:t,children:(0,D.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,D.jsx)(u,{className:`h-10 w-10 text-destructive`}),(0,D.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Failed to load documentation`}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:A})]})}):(0,D.jsxs)(m,{breadcrumb:C?.label??t,children:[B?(0,D.jsxs)(`details`,{className:`group mx-auto max-w-6xl px-4 pt-4 sm:px-6 lg:hidden`,children:[(0,D.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-md border bg-muted/30 px-3 py-2 text-sm font-medium [&::-webkit-details-marker]:hidden`,children:[(0,D.jsx)(d,{className:`h-4 w-4 text-muted-foreground`}),(0,D.jsx)(`span`,{className:`truncate`,children:B.label??`Contents`}),(0,D.jsx)(c,{className:`ml-auto h-4 w-4 text-muted-foreground transition-transform group-open:rotate-180`})]}),(0,D.jsx)(`div`,{className:`mt-2 rounded-md border p-3`,children:(0,D.jsx)(O,{book:B,activeDoc:t,docHref:V})})]}):null,(0,D.jsxs)(`div`,{className:`mx-auto flex gap-8 p-4 sm:p-6 ${B?`max-w-6xl`:`max-w-5xl`}`,children:[B?(0,D.jsx)(`aside`,{className:`hidden w-56 shrink-0 lg:block`,children:(0,D.jsx)(`nav`,{className:`sticky top-20 max-h-[calc(100vh-6rem)] overflow-auto pr-1`,children:(0,D.jsx)(O,{book:B,activeDoc:t,docHref:V})})}):null,(0,D.jsx)(`article`,{className:`min-w-0 max-w-3xl flex-1 [&_h1]:scroll-mt-24 [&_h2]:scroll-mt-24 [&_h3]:scroll-mt-24`,onClick:N,children:(0,D.jsx)(b,{schema:{type:`markdown`,content:E(C?.content??``)}})}),F.length>=3?(0,D.jsx)(`aside`,{className:`hidden xl:block w-56 shrink-0`,children:(0,D.jsxs)(`nav`,{"aria-label":I,className:`sticky top-20 max-h-[calc(100vh-6rem)] overflow-auto`,children:[(0,D.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:I}),(0,D.jsx)(`ul`,{className:`border-l border-border text-sm`,children:F.map(e=>(0,D.jsx)(`li`,{style:{paddingLeft:(e.depth-2)*12},children:(0,D.jsx)(`a`,{href:`#${e.id}`,onClick:t=>P(t,e.id),className:`-ml-px block border-l border-transparent py-0.5 pl-3 text-muted-foreground hover:border-primary hover:text-foreground`,children:e.text})},e.id))})]})}):null]})]})}export{k as default};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./vendor-react-CsWFRkED.js";import{zc as n}from"./ui-components-Dwq5utCl.js";var r=t();function i({breadcrumb:t,children:i}){return(0,r.jsxs)(`div`,{className:`min-h-full`,children:[(0,r.jsx)(`header`,{className:`sticky top-0 z-10 border-b border-border bg-background/80 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:(0,r.jsxs)(`div`,{className:`mx-auto flex max-w-3xl items-center gap-2 px-4 py-3 sm:px-6`,children:[(0,r.jsxs)(e,{to:`/docs`,className:`flex items-center gap-2 text-sm font-semibold hover:opacity-80`,children:[(0,r.jsx)(n,{className:`h-4 w-4 text-muted-foreground`}),(0,r.jsx)(`span`,{children:`Documentation`})]}),t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`span`,{className:`text-muted-foreground/60`,"aria-hidden":!0,children:`/`}),(0,r.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:t})]}):null]})}),i]})}export{i as t};
1
+ import{a as e,r as t}from"./vendor-react-CsWFRkED.js";import{Rc as n}from"./ui-components-D2lrjG-t.js";var r=t();function i({breadcrumb:t,children:i}){return(0,r.jsxs)(`div`,{className:`min-h-full`,children:[(0,r.jsx)(`header`,{className:`sticky top-0 z-10 border-b border-border bg-background/80 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:(0,r.jsxs)(`div`,{className:`mx-auto flex max-w-3xl items-center gap-2 px-4 py-3 sm:px-6`,children:[(0,r.jsxs)(e,{to:`/docs`,className:`flex items-center gap-2 text-sm font-semibold hover:opacity-80`,children:[(0,r.jsx)(n,{className:`h-4 w-4 text-muted-foreground`}),(0,r.jsx)(`span`,{children:`Documentation`})]}),t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`span`,{className:`text-muted-foreground/60`,"aria-hidden":!0,children:`/`}),(0,r.jsx)(`span`,{className:`truncate text-sm text-muted-foreground`,children:t})]}):null]})}),i]})}export{i as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t,b as n,r}from"./vendor-react-CsWFRkED.js";import{cc as i,yo as a,zc as o}from"./ui-components-Dwq5utCl.js";import{t as s}from"./DocShell-DMJHUgE5.js";import{a as c,n as l}from"./use-book-data-CZc8MJsb.js";var u=e(n(),1),d=r();function f(){let{books:e,docs:n,state:r,error:f}=l(),p=(0,u.useMemo)(()=>c(e,n),[e,n]);return r===`loading`?(0,d.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,d.jsx)(a,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})}):r===`error`?(0,d.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,d.jsx)(i,{className:`h-10 w-10 text-destructive`}),(0,d.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Failed to load documentation`}),(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f})]}):(0,d.jsx)(s,{children:(0,d.jsxs)(`div`,{className:`mx-auto max-w-4xl p-4 sm:p-6`,children:[(0,d.jsxs)(`header`,{className:`mb-6`,children:[(0,d.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:`Documentation`}),(0,d.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Books and guides from your installed packages.`})]}),p.length===0?(0,d.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-16 text-center text-muted-foreground`,children:[(0,d.jsx)(o,{className:`h-10 w-10`}),(0,d.jsxs)(`p`,{className:`text-sm`,children:[`No documentation is installed. Packages ship docs as flat`,(0,d.jsx)(`code`,{className:`mx-1 rounded bg-muted px-1 py-0.5`,children:`src/docs/*.md`}),`files, organised by a `,(0,d.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:`book`}),` (ADR-0046).`]})]}):(0,d.jsx)(`ul`,{className:`grid items-stretch gap-3 sm:grid-cols-2`,children:p.map(e=>(0,d.jsx)(`li`,{className:`h-full`,children:(0,d.jsxs)(t,{to:`/docs/${e.slug}`,className:`flex h-full items-start gap-3 rounded-md border border-border p-3 hover:bg-muted/50`,children:[(0,d.jsx)(o,{className:`mt-0.5 h-5 w-5 shrink-0 text-muted-foreground`}),(0,d.jsxs)(`div`,{className:`min-w-0`,children:[(0,d.jsx)(`div`,{className:`text-sm font-semibold`,children:e.label}),e.description?(0,d.jsx)(`div`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:e.description}):e.subtitle?(0,d.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-muted-foreground/70`,children:e.subtitle}):null,(0,d.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground/80`,children:[e.docCount,` `,e.docCount===1?`article`:`articles`]})]})]})},e.name))})]})})}export{f as default};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{a as t,b as n,r}from"./vendor-react-CsWFRkED.js";import{Rc as i,sc as a,vo as o}from"./ui-components-D2lrjG-t.js";import{t as s}from"./DocShell-Ipy_IDvh.js";import{a as c,n as l}from"./use-book-data-qUZAxIs0.js";var u=e(n(),1),d=r();function f(){let{books:e,docs:n,state:r,error:f}=l(),p=(0,u.useMemo)(()=>c(e,n),[e,n]);return r===`loading`?(0,d.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,d.jsx)(o,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})}):r===`error`?(0,d.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,d.jsx)(a,{className:`h-10 w-10 text-destructive`}),(0,d.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Failed to load documentation`}),(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f})]}):(0,d.jsx)(s,{children:(0,d.jsxs)(`div`,{className:`mx-auto max-w-4xl p-4 sm:p-6`,children:[(0,d.jsxs)(`header`,{className:`mb-6`,children:[(0,d.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:`Documentation`}),(0,d.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Books and guides from your installed packages.`})]}),p.length===0?(0,d.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-16 text-center text-muted-foreground`,children:[(0,d.jsx)(i,{className:`h-10 w-10`}),(0,d.jsxs)(`p`,{className:`text-sm`,children:[`No documentation is installed. Packages ship docs as flat`,(0,d.jsx)(`code`,{className:`mx-1 rounded bg-muted px-1 py-0.5`,children:`src/docs/*.md`}),`files, organised by a `,(0,d.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:`book`}),` (ADR-0046).`]})]}):(0,d.jsx)(`ul`,{className:`grid items-stretch gap-3 sm:grid-cols-2`,children:p.map(e=>(0,d.jsx)(`li`,{className:`h-full`,children:(0,d.jsxs)(t,{to:`/docs/${e.slug}`,className:`flex h-full items-start gap-3 rounded-md border border-border p-3 hover:bg-muted/50`,children:[(0,d.jsx)(i,{className:`mt-0.5 h-5 w-5 shrink-0 text-muted-foreground`}),(0,d.jsxs)(`div`,{className:`min-w-0`,children:[(0,d.jsx)(`div`,{className:`text-sm font-semibold`,children:e.label}),e.description?(0,d.jsx)(`div`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:e.description}):e.subtitle?(0,d.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-muted-foreground/70`,children:e.subtitle}):null,(0,d.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground/80`,children:[e.docCount,` `,e.docCount===1?`article`:`articles`]})]})]})},e.name))})]})})}export{f as default};
@@ -1 +1 @@
1
- import{c as e,r as t}from"./vendor-react-CsWFRkED.js";import{r as n,t as r}from"./use-book-data-CZc8MJsb.js";var i=t();function a(){let t=n();return(0,i.jsx)(r.Provider,{value:t,children:(0,i.jsx)(e,{})})}export{a as default};
1
+ import{c as e,r as t}from"./vendor-react-CsWFRkED.js";import{r as n,t as r}from"./use-book-data-qUZAxIs0.js";var i=t();function a(){let t=n();return(0,i.jsx)(r.Provider,{value:t,children:(0,i.jsx)(e,{})})}export{a as default};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,h as n,r,s as i}from"./vendor-react-CsWFRkED.js";import{ms as a,yo as o,zc as s}from"./ui-components-Dwq5utCl.js";import{t as c}from"./DocShell-DMJHUgE5.js";import{i as l,l as u,n as d,o as f,s as p,u as m}from"./use-book-data-CZc8MJsb.js";var h=e(t(),1),g=r();function _(){let{slug:e,appName:t}=n(),{books:r,docs:p,state:_}=d(),v=(0,h.useMemo)(()=>r.find(t=>l(t)===e),[r,e]),y=(0,h.useMemo)(()=>v?f(u(v,m(v,p))):void 0,[v,p]);if(_===`loading`)return(0,g.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,g.jsx)(o,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})});if(v&&y){let n=t?`/apps/${t}/docs`:`/docs`;return(0,g.jsx)(i,{to:`${n}/${e}/${y}`,replace:!0})}return(0,g.jsx)(c,{breadcrumb:v?v.label??e:e,children:(0,g.jsx)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:v?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(s,{className:`h-10 w-10 text-muted-foreground`}),(0,g.jsx)(`h1`,{className:`text-lg font-semibold`,children:v.label??e}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This book has no documents yet.`})]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(a,{className:`h-10 w-10 text-muted-foreground`}),(0,g.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Book not found`}),(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No book named `,(0,g.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:e}),` is installed.`]})]})})})}function v(){let{slug:e,appName:t}=n(),{books:r,docs:s,state:u}=d();if(u===`loading`)return(0,g.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,g.jsx)(o,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})});if(e&&r.some(t=>l(t)===e))return(0,g.jsx)(_,{});let f=t?`/apps/${t}/docs`:`/docs`,m=e?p(e,r,s):null;return m&&e?(0,g.jsx)(i,{to:`${f}/${l(m)}/${e}`,replace:!0}):(0,g.jsx)(c,{breadcrumb:e,children:(0,g.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,g.jsx)(a,{className:`h-10 w-10 text-muted-foreground`}),(0,g.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Documentation not found`}),(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No book or document named `,(0,g.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:e}),` is installed.`]})]})})}export{v as default};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{b as t,h as n,r,s as i}from"./vendor-react-CsWFRkED.js";import{Rc as a,ps as o,vo as s}from"./ui-components-D2lrjG-t.js";import{t as c}from"./DocShell-Ipy_IDvh.js";import{i as l,l as u,n as d,o as f,s as p,u as m}from"./use-book-data-qUZAxIs0.js";var h=e(t(),1),g=r();function _(){let{slug:e,appName:t}=n(),{books:r,docs:p,state:_}=d(),v=(0,h.useMemo)(()=>r.find(t=>l(t)===e),[r,e]),y=(0,h.useMemo)(()=>v?f(u(v,m(v,p))):void 0,[v,p]);if(_===`loading`)return(0,g.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,g.jsx)(s,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})});if(v&&y){let n=t?`/apps/${t}/docs`:`/docs`;return(0,g.jsx)(i,{to:`${n}/${e}/${y}`,replace:!0})}return(0,g.jsx)(c,{breadcrumb:v?v.label??e:e,children:(0,g.jsx)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:v?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(a,{className:`h-10 w-10 text-muted-foreground`}),(0,g.jsx)(`h1`,{className:`text-lg font-semibold`,children:v.label??e}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This book has no documents yet.`})]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(o,{className:`h-10 w-10 text-muted-foreground`}),(0,g.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Book not found`}),(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No book named `,(0,g.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:e}),` is installed.`]})]})})})}function v(){let{slug:e,appName:t}=n(),{books:r,docs:a,state:u}=d();if(u===`loading`)return(0,g.jsx)(`div`,{className:`flex h-full items-center justify-center p-10 text-muted-foreground`,children:(0,g.jsx)(s,{className:`h-5 w-5 animate-spin`,"aria-label":`Loading documentation`})});if(e&&r.some(t=>l(t)===e))return(0,g.jsx)(_,{});let f=t?`/apps/${t}/docs`:`/docs`,m=e?p(e,r,a):null;return m&&e?(0,g.jsx)(i,{to:`${f}/${l(m)}/${e}`,replace:!0}):(0,g.jsx)(c,{breadcrumb:e,children:(0,g.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col items-center gap-3 p-10 text-center`,children:[(0,g.jsx)(o,{className:`h-10 w-10 text-muted-foreground`}),(0,g.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Documentation not found`}),(0,g.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No book or document named `,(0,g.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:e}),` is installed.`]})]})})}export{v as default};