@objectstack/console 14.5.0 → 14.7.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 (273) hide show
  1. package/dist/.objectui-sha +1 -1
  2. package/dist/assets/{AdapterProvider-VM9K3D39.js → AdapterProvider-CmeZULrO.js} +1 -1
  3. package/dist/assets/{AiPendingActionsPage-mX_Izb42.js → AiPendingActionsPage-C4Iq12It.js} +1 -1
  4. package/dist/assets/{ApiConsolePage-CW5efCG0.js → ApiConsolePage-CVxWz2Fc.js} +1 -1
  5. package/dist/assets/AppDocsIndex-_Nk6Vrm0.js +1 -0
  6. package/dist/assets/{AppManagementPage-DjerO44R.js → AppManagementPage-Ds4z81em.js} +1 -1
  7. package/dist/assets/ApprovalsInboxPage-BYmqtmb8.js +1 -0
  8. package/dist/assets/{AuditLogPage-REsiCTKG.js → AuditLogPage-BY42e7b1.js} +1 -1
  9. package/dist/assets/{ComponentNavView-B4EBSM-o.js → ComponentNavView-CPizP2rl.js} +1 -1
  10. package/dist/assets/ConsoleFloatingChatbot-vRAPnn56.js +1 -0
  11. package/dist/assets/{CreateViewDialog-FNntBig_.js → CreateViewDialog-C6DeiGi1.js} +1 -1
  12. package/dist/assets/DashboardView-CZ3rnuQw.js +1 -0
  13. package/dist/assets/{DeveloperHubPage-B6pD0HUk.js → DeveloperHubPage-cynqEJzi.js} +1 -1
  14. package/dist/assets/DocShell-DowMXJqg.js +1 -0
  15. package/dist/assets/{ExpressionProvider-D94jBDAc.js → ExpressionProvider-jYh8yBEi.js} +1 -1
  16. package/dist/assets/{FlowRunsPage-DUZnmBwd.js → FlowRunsPage-BsxDtVro.js} +1 -1
  17. package/dist/assets/{IntegrationsPage-EOVS24Ho.js → IntegrationsPage-Dt3JjnPR.js} +1 -1
  18. package/dist/assets/{InterfaceListPage-2m_Tj1YU.js → InterfaceListPage-8ZC2DL6l.js} +1 -1
  19. package/dist/assets/{ManagedByBadge-Dpgfl255.js → ManagedByBadge-DySgRsRf.js} +1 -1
  20. package/dist/assets/{MarketplaceAccessDenied-DuO_FDoh.js → MarketplaceAccessDenied-CQo3oKUv.js} +1 -1
  21. package/dist/assets/{MarketplaceInstalledPage-DVOm5x-8.js → MarketplaceInstalledPage-COPjvdZD.js} +1 -1
  22. package/dist/assets/{MarketplacePackagePage-CjH5GQ5Z.js → MarketplacePackagePage-BL5_Fzlm.js} +1 -1
  23. package/dist/assets/{MarketplacePage-gPtkwtQv.js → MarketplacePage-BnHkiwG_.js} +1 -1
  24. package/dist/assets/MetadataInspector-mHEFcIlV.js +1 -0
  25. package/dist/assets/MetadataProvider-DRMpRtkE.js +1 -0
  26. package/dist/assets/{MonacoImpl-nyLaER8_.js → MonacoImpl-_--K1JSa.js} +1 -1
  27. package/dist/assets/ObjectDataPage-D9wwntH8.js +1 -0
  28. package/dist/assets/PageView-Bvw39DGp.js +1 -0
  29. package/dist/assets/{ProfilePage-CQlOfGDf.js → ProfilePage-CkS1AQDC.js} +1 -1
  30. package/dist/assets/{PublicFormsPage-Mu0E7e5y.js → PublicFormsPage-onVYVDnz.js} +1 -1
  31. package/dist/assets/RecordDetailView-DsaGwX7Z.js +2 -0
  32. package/dist/assets/RecordFormPage-B8hs2UT_.js +1 -0
  33. package/dist/assets/ReportDefaultInspector-DacLe5p0.js +3 -0
  34. package/dist/assets/ReportView-C5EokVMt.js +2 -0
  35. package/dist/assets/{SearchResultsPage-CfxZkWx7.js → SearchResultsPage-zgmMi_LJ.js} +1 -1
  36. package/dist/assets/{SettingsHub-DgLunUQU.js → SettingsHub-D73rzMbT.js} +1 -1
  37. package/dist/assets/{SettingsView-DFfL8vn4.js → SettingsView-BHmgUtG_.js} +1 -1
  38. package/dist/assets/{SystemHubPage-_NMRZfpb.js → SystemHubPage-HiWUvHtN.js} +1 -1
  39. package/dist/assets/abnfDiagram-VRR7QNED-BM2gIA2H.js +1 -0
  40. package/dist/assets/appRoute-C7XNGt8B.js +1 -0
  41. package/dist/assets/architecture-TIHT7OUA-X9gN3Z_J.js +1 -0
  42. package/dist/assets/architectureDiagram-ZJ3FMSHR-wyeItulr.js +36 -0
  43. package/dist/assets/assistantBus-cGcVZa3R.js +1 -0
  44. package/dist/assets/{blockDiagram-677ZJIJ3-BmONypzo.js → blockDiagram-677ZJIJ3-BybRqe6u.js} +2 -2
  45. package/dist/assets/{c4Diagram-LMCZKHZV-DqIiaVjm.js → c4Diagram-LMCZKHZV-CZhtNS_4.js} +2 -2
  46. package/dist/assets/channel-BAx__6e1.js +1 -0
  47. package/dist/assets/{chunk-32BRIVSS-BbTX8O4m.js → chunk-32BRIVSS-CjQ2uFsO.js} +1 -1
  48. package/dist/assets/{chunk-52WLFC77-DkgICN4F.js → chunk-52WLFC77-BBx3j8yk.js} +1 -1
  49. package/dist/assets/chunk-5FCAYU7R-w3UK8d6o.js +1 -0
  50. package/dist/assets/chunk-5HE753X5-Cg3JdNF3.js +1 -0
  51. package/dist/assets/chunk-5JV3BV7I-Dm-WSvPI.js +1 -0
  52. package/dist/assets/chunk-5TONJI2A-CQhZ6bam.js +2 -0
  53. package/dist/assets/chunk-BIQX33UG-_A6SWMTr.js +1 -0
  54. package/dist/assets/{chunk-C7G6YPKG-UMP_bNDd.js → chunk-C7G6YPKG-CrZlt4pv.js} +1 -1
  55. package/dist/assets/chunk-CQNSW5MT-DaOzt4Yv.js +1 -0
  56. package/dist/assets/chunk-CYSBUYHQ-Dr63T7GU.js +1 -0
  57. package/dist/assets/chunk-EMLP6XTP-BYfeYg3o.js +1 -0
  58. package/dist/assets/{chunk-EX3LRPZG-B0dJ64Ff.js → chunk-EX3LRPZG-x9nXH4xc.js} +2 -2
  59. package/dist/assets/{chunk-FWX5IMBZ-B8cCL4T7.js → chunk-FWX5IMBZ-cqzp-iMz.js} +1 -1
  60. package/dist/assets/{chunk-HOUHSVGY-B5nScni0.js → chunk-HOUHSVGY-Bfkm0El3.js} +1 -1
  61. package/dist/assets/{chunk-ICXQ74PX-zJg8KmvA.js → chunk-ICXQ74PX-WsDRuBhL.js} +1 -1
  62. package/dist/assets/chunk-JG7HCLWE-Dj9pjBYh.js +2 -0
  63. package/dist/assets/{chunk-KEIR6QF5-CxDrFr0l.js → chunk-KEIR6QF5-DtEGfq38.js} +4 -4
  64. package/dist/assets/{chunk-MOJQB5TN-DBKCpvOi.js → chunk-MOJQB5TN-K_QM_tTs.js} +1 -1
  65. package/dist/assets/chunk-MOZMSUNE-DxgOd8pF.js +1 -0
  66. package/dist/assets/{chunk-OGEWGWER-bKk51Nxt.js → chunk-OGEWGWER-CSkoB3Mi.js} +1 -1
  67. package/dist/assets/chunk-OSBZ3O6U-BSRxNamX.js +1 -0
  68. package/dist/assets/{chunk-PUDLZKDR-CKn_9iXM.js → chunk-PUDLZKDR-BUt9iFAU.js} +3 -3
  69. package/dist/assets/{chunk-Q4XR5HBZ-BP9atbVx.js → chunk-Q4XR5HBZ-B99LraLe.js} +1 -1
  70. package/dist/assets/chunk-QBLGF6JB-Xeo4xx7q.js +1 -0
  71. package/dist/assets/chunk-R7FJI6CG-D2Ok5kyf.js +1 -0
  72. package/dist/assets/{chunk-RYQCIY6F-B5RR1tIz.js → chunk-RYQCIY6F-CdJb5y8u.js} +1 -1
  73. package/dist/assets/chunk-U6XO7XAA-Cwwl_Wmn.js +2 -0
  74. package/dist/assets/{chunk-V7JOEXUC-DTerDTcg.js → chunk-V7JOEXUC-CzVnJgzj.js} +2 -2
  75. package/dist/assets/chunk-VAUOI2AC-HYDQgaka.js +1 -0
  76. package/dist/assets/{chunk-VR4S4FIN-jB_W-MHs.js → chunk-VR4S4FIN-B2IyRlJ4.js} +1 -1
  77. package/dist/assets/{chunk-WYO6CB5R-Cndg0Yo5.js → chunk-WYO6CB5R-C0_XZtpj.js} +2 -2
  78. package/dist/assets/chunk-XXDRQBXY-CtU5D9C8.js +1 -0
  79. package/dist/assets/chunk-YOTPTUD7-7OTU2RwK.js +1 -0
  80. package/dist/assets/{chunk-ZGVPDNZ5-BUUSzPje.js → chunk-ZGVPDNZ5-Bq7O6ELQ.js} +1 -1
  81. package/dist/assets/classDiagram-OUVF2IWQ-DiVkGMIZ.js +1 -0
  82. package/dist/assets/classDiagram-v2-EOCWNBFH-DiVkGMIZ.js +1 -0
  83. package/dist/assets/cose-bilkent-JH36ORCC-DqKYLwMN.js +1 -0
  84. package/dist/assets/cynefin-VYW2F7L2-C94HS-Ni.js +1 -0
  85. package/dist/assets/cynefinDiagram-TSTJHNR4-CFApUIdk.js +62 -0
  86. package/dist/assets/cytoscape.esm-CQFVGiJu.js +321 -0
  87. package/dist/assets/{dagre-VKFMJZFB-Crs38V5P.js → dagre-VKFMJZFB-D4HlgjaA.js} +1 -1
  88. package/dist/assets/{dagre-CXRCoUWR.js → dagre-dpRSp0QF.js} +1 -1
  89. package/dist/assets/data-adapter-BaIWVzG-.js +7 -0
  90. package/dist/assets/diagram-FQU43EPY-BcnxfyH-.js +3 -0
  91. package/dist/assets/{diagram-G47NLZAW-CSNJrWDK.js → diagram-G47NLZAW-CJxJUVu9.js} +1 -1
  92. package/dist/assets/diagram-NH7WQ7WH-DmBVlyYR.js +24 -0
  93. package/dist/assets/{diagram-OA4YK3LP-C2A07yOA.js → diagram-OA4YK3LP-CkaF9SQg.js} +3 -3
  94. package/dist/assets/diagram-WEI45ONY-8cpfjoG3.js +41 -0
  95. package/dist/assets/{dist-YwlXXOlT.js → dist-B4b49_J4.js} +1 -1
  96. package/dist/assets/ebnfDiagram-CCIWWBDH-kX04JbNj.js +1 -0
  97. package/dist/assets/{erDiagram-Q63AITRT-DjK6P1sf.js → erDiagram-Q63AITRT-GjnOtXoL.js} +2 -2
  98. package/dist/assets/eventmodeling-45OFAUF4-BuchSCe8.js +1 -0
  99. package/dist/assets/{exceljs.min-Dpb6mnud.js → exceljs.min-BSnPgFSx.js} +1 -1
  100. package/dist/assets/flowDiagram-23GEKE2U-CpcHvuan.js +1 -0
  101. package/dist/assets/{framework-CWU64Lvg.js → framework-DNWcCoBP.js} +8 -8
  102. package/dist/assets/{ganttDiagram-NO4QXBWP-UPhpWlEd.js → ganttDiagram-NO4QXBWP-7HpPOGwX.js} +2 -2
  103. package/dist/assets/{getIcon-p-vXfFiY.js → getIcon-DGciRPQd.js} +1 -1
  104. package/dist/assets/gitGraph-TEB2WS4Q-B2hHXR-t.js +1 -0
  105. package/dist/assets/gitGraphDiagram-IHSO6WYX-BgBKFUwZ.js +106 -0
  106. package/dist/assets/{graphlib-B8gBHxth.js → graphlib-DS17s2tU.js} +1 -1
  107. package/dist/assets/{highlighted-body-OFNGDK62-CcYD5yKj.js → highlighted-body-OFNGDK62-obGa3VW9.js} +1 -1
  108. package/dist/assets/{i18n-DGsfMUMn.js → i18n-DzI3zFKr.js} +3 -3
  109. package/dist/assets/index-CETzvR9k.js +2 -0
  110. package/dist/assets/index-DZuzAri6.css +2 -0
  111. package/dist/assets/info-DKCQHKI2-B_PilpBz.js +1 -0
  112. package/dist/assets/infoDiagram-FWYZ7A6U-CTsG_9Mj.js +2 -0
  113. package/dist/assets/infrastructure-Bc4DRENl.js +3 -0
  114. package/dist/assets/{ishikawaDiagram-FXEZZL3T-DvmRhm8H.js → ishikawaDiagram-FXEZZL3T-DgMu6-jd.js} +2 -2
  115. package/dist/assets/{journeyDiagram-5HDEW3XC-DFf6bjOX.js → journeyDiagram-5HDEW3XC-CKI4PBJp.js} +2 -2
  116. package/dist/assets/{kanban-definition-HUTT4EX6-DLK5X8Ol.js → kanban-definition-HUTT4EX6-ChvGKWDx.js} +2 -2
  117. package/dist/assets/{katex-CddkPoXu.js → katex-B7rAX3Vi.js} +1 -1
  118. package/dist/assets/{map-DsCK-0Cs.js → map-BaFkSB1l.js} +1 -1
  119. package/dist/assets/marketplaceApi-BZG2zqqI.js +1 -0
  120. package/dist/assets/mermaid-GHXKKRXX-zDa01SPQ.js +1 -0
  121. package/dist/assets/mermaid-parser.core-B2-C9kB8.js +3 -0
  122. package/dist/assets/{mermaid.core-D3axazyv.js → mermaid.core-CskcjgHM.js} +2 -2
  123. package/dist/assets/{metadata-admin-BcCYhjRC.js → metadata-admin-B3pnFq3D.js} +10 -10
  124. package/dist/assets/{mindmap-definition-LN4V7U3C-DwbonLR_.js → mindmap-definition-LN4V7U3C-BSAiSefe.js} +2 -2
  125. package/dist/assets/packet-7NZHBO7P-qOo2g-vE.js +1 -0
  126. package/dist/assets/pegDiagram-2B236MQR-BUG9TR1Z.js +1 -0
  127. package/dist/assets/pie-RZYD4A2V-U1Vrb5_c.js +1 -0
  128. package/dist/assets/{pieDiagram-ENE6RG2P-D8jBhNXT.js → pieDiagram-ENE6RG2P-CqKv9PBi.js} +3 -3
  129. package/dist/assets/{plugin-calendar-CSE3oYMl.js → plugin-calendar-DI8_y72D.js} +1 -1
  130. package/dist/assets/plugin-charts-8kHRsJ26.js +7 -0
  131. package/dist/assets/plugin-chatbot-5rciOKdr.js +120 -0
  132. package/dist/assets/{plugin-dashboard-N2kUovsm.js → plugin-dashboard-g6z_zZXP.js} +3 -3
  133. package/dist/assets/plugin-form-DWcrPPUr.js +1 -0
  134. package/dist/assets/plugin-gantt-BmusZEIw.js +100 -0
  135. package/dist/assets/plugin-grid-DdzrFURM.js +8 -0
  136. package/dist/assets/plugin-kanban-DtXDjkdV.js +1 -0
  137. package/dist/assets/{plugin-map-CXsqUoPv.js → plugin-map-B7RVCjPN.js} +1 -1
  138. package/dist/assets/{plugin-markdown-CFO9Lenx.js → plugin-markdown-hWqBbKBQ.js} +1 -1
  139. package/dist/assets/plugin-report-Fk8OwuMv.js +59 -0
  140. package/dist/assets/{plugin-timeline-3MSv2v9S.js → plugin-timeline-BLradJ31.js} +1 -1
  141. package/dist/assets/{plugin-tree-_3HdWuAy.js → plugin-tree-Dd-qjC-G.js} +1 -1
  142. package/dist/assets/plugin-view-Beo3HWpE.js +1 -0
  143. package/dist/assets/plugins-views-D0GqJrx_.js +4 -0
  144. package/dist/assets/preferLocal-CKqyhTP9.js +1 -0
  145. package/dist/assets/{quadrantDiagram-ABIIQ3AL-Do3adYzz.js → quadrantDiagram-ABIIQ3AL-DyfgU6pe.js} +2 -2
  146. package/dist/assets/radar-I7S5WNFK-BXCATs_F.js +1 -0
  147. package/dist/assets/railroad-3IZDKUUU-M5RydKKn.js +1 -0
  148. package/dist/assets/railroad-abnf-AHOZXSZD-Cx_YZh-R.js +1 -0
  149. package/dist/assets/railroad-ebnf-EBAXGLYW-u_O-iXWA.js +1 -0
  150. package/dist/assets/railroad-peg-LSFZ7HO6-8zQc29Q0.js +1 -0
  151. package/dist/assets/railroadDiagram-RFXS5EU6-DOOVaoMM.js +1 -0
  152. package/dist/assets/{requirementDiagram-TGXJPOKE-CClkXauU.js → requirementDiagram-TGXJPOKE-B0370dfa.js} +2 -2
  153. package/dist/assets/{sankeyDiagram-HTMAVEWB-DlUFch6E.js → sankeyDiagram-HTMAVEWB-BAioZail.js} +2 -2
  154. package/dist/assets/{sequenceDiagram-DBY2YBRQ-BEDTwji4.js → sequenceDiagram-DBY2YBRQ-B20vuf87.js} +3 -3
  155. package/dist/assets/{skeletons-ySdMMgAT.js → skeletons-Dc-JqV4x.js} +1 -1
  156. package/dist/assets/{src-D0ZYDfff.js → src-CKPhOIOh.js} +1 -1
  157. package/dist/assets/{src-CSRoqdRD.js → src-Cglm_8jd.js} +4 -4
  158. package/dist/assets/src-DZVwE2OF.js +18 -0
  159. package/dist/assets/src-DxI3szM2.js +1 -0
  160. package/dist/assets/{src-X8yirhNO.js → src-Ep8btdv1.js} +1 -1
  161. package/dist/assets/{stateDiagram-2N3HPSRC-BN6M4MGy.js → stateDiagram-2N3HPSRC-BScu2B9X.js} +1 -1
  162. package/dist/assets/stateDiagram-v2-6OUMAXLB-9fyTUlZR.js +1 -0
  163. package/dist/assets/surfaceAgent-DPt23-K5.js +1 -0
  164. package/dist/assets/swimlanes-5IMT3BWC-VepjEXMA.js +1 -0
  165. package/dist/assets/swimlanesDiagram-G3AALYLV-i6IYZT2a.js +8 -0
  166. package/dist/assets/{timeline-definition-FHXFAJF6-B6Oiv_gP.js → timeline-definition-FHXFAJF6-CvpwpY5P.js} +2 -2
  167. package/dist/assets/treeView-QDETBFTQ-BiM0w_uS.js +1 -0
  168. package/dist/assets/treemap-6X3UGDF4-CuKHZODJ.js +1 -0
  169. package/dist/assets/{types-B99y2QyO.js → types-bxB_p8fZ.js} +1 -1
  170. package/dist/assets/ui-components-CmbUYw-E.js +42 -0
  171. package/dist/assets/ui-layout-elT9p0KY.js +1 -0
  172. package/dist/assets/use-book-data-BNn214nk.js +1 -0
  173. package/dist/assets/useMetadata-B84fbReE.js +1 -0
  174. package/dist/assets/{useOpenRecordList-B3tjtz1e.js → useOpenRecordList-C75NAaDm.js} +1 -1
  175. package/dist/assets/{usePackageL10n-CiFMHfKe.js → usePackageL10n-DfeTyD2w.js} +1 -1
  176. package/dist/assets/useRecordApprovals-CwD1sHs0.js +1 -0
  177. package/dist/assets/utils-Bxty7IIa.js +1 -0
  178. package/dist/assets/{vendor-charts-D_CNNxD5.js → vendor-charts-HLBqza5P.js} +6 -6
  179. package/dist/assets/vendor-dndkit-DoG7p74h.js +5 -0
  180. package/dist/assets/vendor-i18n-ByHglwq-.js +1 -0
  181. package/dist/assets/{vendor-icons-core-DvLgTVYc.js → vendor-icons-core-CO5pY7RP.js} +1 -1
  182. package/dist/assets/{vendor-markdown-BJvgKhXw.js → vendor-markdown-DlkSIxwM.js} +25 -25
  183. package/dist/assets/vendor-objectstack-BjCqbVaM.js +96 -0
  184. package/dist/assets/vendor-radix-CWCRv2pn.js +46 -0
  185. package/dist/assets/{vendor-react-BGDDiZfJ.js → vendor-react-BKSb6vFP.js} +3 -3
  186. package/dist/assets/vendor-sentry-C3ouQ5cr.js +501 -0
  187. package/dist/assets/{vendor-ui-utils-BzQBRdq3.js → vendor-ui-utils-D-WJ115h.js} +1 -1
  188. package/dist/assets/{vennDiagram-L72KCM5P-DqRcgOxS.js → vennDiagram-L72KCM5P-DlCQcm_6.js} +2 -2
  189. package/dist/assets/wardley-OPB4EBWU-zwaHU-Tl.js +1 -0
  190. package/dist/assets/{wardleyDiagram-EHGQE667-BDyIMWfB.js → wardleyDiagram-EHGQE667-mesER_Po.js} +3 -3
  191. package/dist/assets/{xychartDiagram-FW5EYKEG-BRNQk20I.js → xychartDiagram-FW5EYKEG-cODEcpNB.js} +2 -2
  192. package/dist/index.html +6 -6
  193. package/package.json +1 -1
  194. package/dist/assets/AppDocsIndex-xfVoWnj-.js +0 -1
  195. package/dist/assets/ApprovalsInboxPage-CaCSwwcc.js +0 -1
  196. package/dist/assets/ConsoleFloatingChatbot-DtJ5G3pF.js +0 -1
  197. package/dist/assets/DashboardView-Bi3eGvU3.js +0 -1
  198. package/dist/assets/MetadataInspector-YoFTAkMA.js +0 -1
  199. package/dist/assets/MetadataProvider-ByLpS5Ra.js +0 -1
  200. package/dist/assets/ObjectDataPage-Dj2xHQH3.js +0 -1
  201. package/dist/assets/PageView-l4f-5mgO.js +0 -1
  202. package/dist/assets/RecordDetailView-B_B-3fuJ.js +0 -9
  203. package/dist/assets/RecordFormPage-BtK8VUj9.js +0 -1
  204. package/dist/assets/ReportDefaultInspector-Borp5kRd.js +0 -3
  205. package/dist/assets/ReportView-BrjYjp74.js +0 -2
  206. package/dist/assets/abnfDiagram-VRR7QNED-o_fBNeYD.js +0 -1
  207. package/dist/assets/appRoute-1sYdkwBz.js +0 -1
  208. package/dist/assets/architecture-TIHT7OUA-BF_0SrOH.js +0 -1
  209. package/dist/assets/architectureDiagram-ZJ3FMSHR-Bk_LES5L.js +0 -36
  210. package/dist/assets/assistantBus-BFk4fCbM.js +0 -1
  211. package/dist/assets/channel-CvRTB8GE.js +0 -1
  212. package/dist/assets/chunk-VAUOI2AC-BrcFPe7Z.js +0 -1
  213. package/dist/assets/chunk-XXDRQBXY-DGANY6E3.js +0 -1
  214. package/dist/assets/classDiagram-OUVF2IWQ-BGL42sFI.js +0 -1
  215. package/dist/assets/classDiagram-v2-EOCWNBFH-BGL42sFI.js +0 -1
  216. package/dist/assets/conversationLanguage-C4kzQvae.js +0 -1
  217. package/dist/assets/cose-bilkent-JH36ORCC-DJ-X6wmF.js +0 -1
  218. package/dist/assets/cynefin-VYW2F7L2-CXt4AgYW.js +0 -1
  219. package/dist/assets/cynefinDiagram-TSTJHNR4-C5mKt5aU.js +0 -62
  220. package/dist/assets/cytoscape.esm-B3I8pqwA.js +0 -321
  221. package/dist/assets/data-adapter-Cz11MUug.js +0 -7
  222. package/dist/assets/diagram-FQU43EPY-Bkx8ccpS.js +0 -3
  223. package/dist/assets/diagram-NH7WQ7WH-PaRAbfdR.js +0 -24
  224. package/dist/assets/diagram-WEI45ONY-BEyyGNpU.js +0 -41
  225. package/dist/assets/ebnfDiagram-CCIWWBDH-CtfwkNuv.js +0 -1
  226. package/dist/assets/eventmodeling-45OFAUF4-Dmacb12o.js +0 -1
  227. package/dist/assets/flowDiagram-23GEKE2U-DfQvGNQk.js +0 -1
  228. package/dist/assets/gitGraph-TEB2WS4Q-ChM6j6Bd.js +0 -1
  229. package/dist/assets/gitGraphDiagram-IHSO6WYX-B6Qcltd9.js +0 -106
  230. package/dist/assets/index-052ojABv.js +0 -2
  231. package/dist/assets/index-Dt-GIgSI.css +0 -2
  232. package/dist/assets/info-DKCQHKI2-C0RTkygr.js +0 -1
  233. package/dist/assets/infoDiagram-FWYZ7A6U-CgEoZeWY.js +0 -2
  234. package/dist/assets/infrastructure-B9dLsgB4.js +0 -3
  235. package/dist/assets/marketplaceApi-BN-VhaRz.js +0 -1
  236. package/dist/assets/mermaid-GHXKKRXX-DWvjDOK-.js +0 -1
  237. package/dist/assets/mermaid-parser.core-DV_Ys_OF.js +0 -6
  238. package/dist/assets/packet-7NZHBO7P-DSHvkxBR.js +0 -1
  239. package/dist/assets/pegDiagram-2B236MQR-B4IMkAIV.js +0 -1
  240. package/dist/assets/pie-RZYD4A2V-DjNUdL88.js +0 -1
  241. package/dist/assets/plugin-charts-DPNohuuV.js +0 -7
  242. package/dist/assets/plugin-chatbot-BT49v2CR.js +0 -120
  243. package/dist/assets/plugin-form-mON2217z.js +0 -1
  244. package/dist/assets/plugin-gantt-BrBwlK5S.js +0 -93
  245. package/dist/assets/plugin-grid-qkHiovZ2.js +0 -8
  246. package/dist/assets/plugin-kanban-CAw-uo9I.js +0 -1
  247. package/dist/assets/plugin-report-CH4uZunJ.js +0 -59
  248. package/dist/assets/plugin-view-BYrkl7Kl.js +0 -1
  249. package/dist/assets/plugins-views-Bf2gkCfN.js +0 -4
  250. package/dist/assets/radar-I7S5WNFK-qO0bWLwF.js +0 -1
  251. package/dist/assets/railroad-3IZDKUUU-CAj9esX-.js +0 -1
  252. package/dist/assets/railroad-abnf-AHOZXSZD-Ci_Yg729.js +0 -1
  253. package/dist/assets/railroad-ebnf-EBAXGLYW-Tz7H2Jrw.js +0 -1
  254. package/dist/assets/railroad-peg-LSFZ7HO6-BJIalSaK.js +0 -1
  255. package/dist/assets/railroadDiagram-RFXS5EU6-DDA7XtKq.js +0 -1
  256. package/dist/assets/recordFormNavigation-8nEYNxNo.js +0 -1
  257. package/dist/assets/src-WC2Ki4jb.js +0 -18
  258. package/dist/assets/stateDiagram-v2-6OUMAXLB-DCaXJLPh.js +0 -1
  259. package/dist/assets/swimlanes-5IMT3BWC-Bycq06w3.js +0 -1
  260. package/dist/assets/swimlanesDiagram-G3AALYLV-DWFAvAh7.js +0 -8
  261. package/dist/assets/treeView-QDETBFTQ-Cc2FYETg.js +0 -1
  262. package/dist/assets/treemap-6X3UGDF4-a4EjGpO3.js +0 -1
  263. package/dist/assets/ui-components-DHIW7RSX.js +0 -42
  264. package/dist/assets/ui-layout-DeDkO2oG.js +0 -1
  265. package/dist/assets/useMetadata-DdvHABxD.js +0 -1
  266. package/dist/assets/useRecordApprovals-CL4YRGv_.js +0 -1
  267. package/dist/assets/utils-Bixzg6Bz.js +0 -1
  268. package/dist/assets/vendor-dndkit-CzBh0_98.js +0 -5
  269. package/dist/assets/vendor-i18n-B6GOGCem.js +0 -1
  270. package/dist/assets/vendor-objectstack-6Mgxtaa1.js +0 -96
  271. package/dist/assets/vendor-radix-DCTEpigg.js +0 -46
  272. package/dist/assets/vendor-sentry-CHRc7_3y.js +0 -501
  273. package/dist/assets/wardley-OPB4EBWU-CuNyH0xZ.js +0 -1
@@ -0,0 +1 @@
1
+ import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{n,r,t as i,y as a}from"./vendor-react-BKSb6vFP.js";import{Ft as o,L as s,Pt as c,R as l,X as u,kt as d,l as f,qt as p}from"./framework-DNWcCoBP.js";import{$a as m,$o as h,$s as g,Ao as _,Ar as v,Bs as y,Ca as b,Cc as x,Co as S,Dr as C,Er as w,Fa as T,Ga as E,Gr as D,Hr as O,Hs as k,Ia as A,Io as j,Ja as M,Jo as N,Ki as ee,Kr as P,Ks as F,La as I,Oa as te,Qa as ne,Qi as L,Rr as re,Ta as R,Us as z,Va as ie,Vs as B,Wr as ae,Xa as oe,Xs as se,Ya as ce,Yr as V,Zr as le,Zs as ue,_a as de,aa as fe,bo as H,ca as pe,cs as me,da as he,ds as ge,ea as U,eo as _e,fa as ve,fi as ye,gc as be,ha as xe,ji as Se,mo as Ce,ns as we,oi as Te,pa as Ee,qo as De,qr as Oe,ra as ke,rs as Ae,si as je,ui as Me,uo as Ne,us as Pe,vo as Fe,vs as Ie,yi as Le,yo as Re,zi as ze,zs as Be}from"./ui-components-CmbUYw-E.js";import{a as W,o as G,r as K}from"./vendor-ui-utils-D-WJ115h.js";import"./data-adapter-BaIWVzG-.js";import{n as Ve,r as He}from"./plugin-form-DWcrPPUr.js";import{i as Ue}from"./plugin-grid-DdzrFURM.js";var q=e(a(),1);function We(e){return e||(typeof window<`u`&&window.sessionStorage?window.sessionStorage:null)}function Ge(e,t={}){let{maxHistory:n=50,persistKey:r,storage:i}=t,a=We(i),o=(()=>{if(!r||!a)return null;try{let e=a.getItem(r);if(!e)return null;let t=JSON.parse(e);if(t&&t.v===1&&Array.isArray(t.past)&&Array.isArray(t.future))return t}catch{}return null})(),[s,c]=(0,q.useState)(o?.current??e),l=(0,q.useRef)(o?.past??[]),u=(0,q.useRef)(o?.future??[]),[,d]=(0,q.useState)(0),f=(0,q.useCallback)(()=>d(e=>e+1),[]);(0,q.useEffect)(()=>{if(!(!r||!a))try{let e={v:1,past:l.current,current:s,future:u.current};a.setItem(r,JSON.stringify(e))}catch{}},[s,r,a]);let p=(0,q.useCallback)(e=>{c(t=>(l.current=[...l.current.slice(-(n-1)),t],u.current=[],e)),f()},[n,f]),m=(0,q.useCallback)(()=>{l.current.length!==0&&(c(e=>{let t=[...l.current],n=t.pop();return l.current=t,u.current=[e,...u.current],n}),f())},[f]),h=(0,q.useCallback)(()=>{u.current.length!==0&&(c(e=>{let t=[...u.current],n=t.shift();return u.current=t,l.current=[...l.current,e],n}),f())},[f]),g=(0,q.useCallback)(e=>{l.current=[],u.current=[],c(e),f()},[f]),_=(0,q.useCallback)(()=>{if(!(!r||!a))try{a.removeItem(r)}catch{}},[r,a]),v=(0,q.useCallback)(e=>{let t=l.current.length+1+u.current.length;e<0||e>=t||e!==l.current.length&&(c(t=>{let n=[...l.current,t,...u.current],r=n[e];return l.current=n.slice(0,e),u.current=n.slice(e+1),r}),f())},[f]);return{current:s,canUndo:l.current.length>0,canRedo:u.current.length>0,undoCount:l.current.length,redoCount:u.current.length,timeline:[...l.current,s,...u.current],currentIndex:l.current.length,push:p,undo:m,redo:h,reset:g,jumpTo:v,clearPersisted:_}}function Ke(){let[e,t]=(0,q.useState)(!1),[n,r]=(0,q.useState)(``),[i,a]=(0,q.useState)(``),o=(0,q.useRef)(null);return{isOpen:e,title:n,message:i,confirm:(0,q.useCallback)((e,n)=>(r(e),a(n),t(!0),new Promise(e=>{o.current=e})),[]),onConfirm:(0,q.useCallback)(()=>{t(!1),o.current?.(!0),o.current=null},[]),onCancel:(0,q.useCallback)(()=>{t(!1),o.current?.(!1),o.current=null},[])}}function qe(){let[e,t]=(0,q.useState)(new Set);return{selectedIds:e,toggle:(0,q.useCallback)((e,n=!1)=>{t(t=>{let r=new Set(n?t:[]);return t.has(e)&&n?r.delete(e):r.add(e),r})},[]),selectOne:(0,q.useCallback)(e=>{t(new Set([e]))},[]),selectMany:(0,q.useCallback)(e=>{t(new Set(e))},[]),clearSelection:(0,q.useCallback)(()=>{t(new Set)},[]),isSelected:(0,q.useCallback)(t=>e.has(t),[e]),count:e.size}}function Je(){let[e,t]=(0,q.useState)(null);return{clipboard:e,copy:(0,q.useCallback)(e=>{t(structuredClone(e))},[]),paste:(0,q.useCallback)(()=>e?structuredClone(e):null,[e]),hasContent:e!==null}}function Ye(e={}){let{minZoom:t=.25,maxZoom:n=3,zoomStep:r=.1,initialZoom:i=1}=e,[a,o]=(0,q.useState)(i),[s,c]=(0,q.useState)({x:0,y:0}),l=(0,q.useRef)(!1),u=(0,q.useRef)({x:0,y:0}),d=(0,q.useCallback)(e=>Math.min(n,Math.max(t,+e.toFixed(2))),[t,n]);return{zoom:a,panOffset:s,zoomIn:(0,q.useCallback)(()=>o(e=>d(e+r)),[d,r]),zoomOut:(0,q.useCallback)(()=>o(e=>d(e-r)),[d,r]),resetZoom:(0,q.useCallback)(()=>{o(1),c({x:0,y:0})},[]),setZoom:(0,q.useCallback)(e=>o(d(e)),[d]),handleWheel:(0,q.useCallback)(e=>{if(e.ctrlKey||e.metaKey){e.preventDefault();let t=e.deltaY>0?-r:r;o(e=>d(e+t))}},[d,r]),startPan:(0,q.useCallback)(e=>{if(e.button===1||e.button===0&&e.altKey){e.preventDefault(),l.current=!0,u.current={x:e.clientX,y:e.clientY};let t=e=>{if(!l.current)return;let t=e.clientX-u.current.x,n=e.clientY-u.current.y;u.current={x:e.clientX,y:e.clientY},c(e=>({x:e.x+t,y:e.y+n}))},n=()=>{l.current=!1,document.removeEventListener(`mousemove`,t),document.removeEventListener(`mouseup`,n)};document.addEventListener(`mousemove`,t),document.addEventListener(`mouseup`,n)}},[]),transformStyle:{transform:`translate(${s.x}px, ${s.y}px) scale(${a})`,transformOrigin:`0 0`}}}var J=r();function Xe(...e){return W(G(e))}function Ze({isOpen:e,title:t,message:n,confirmLabel:r=`Delete`,cancelLabel:i=`Cancel`,destructive:a=!0,onConfirm:o,onCancel:s}){let c=(0,q.useRef)(null);return(0,q.useEffect)(()=>{let t=c.current;t&&(e&&!t.open?t.showModal():!e&&t.open&&t.close())},[e]),e?(0,J.jsx)(`dialog`,{ref:c,className:`fixed inset-0 z-50 m-auto rounded-lg border bg-background p-0 shadow-lg backdrop:bg-black/50`,onClose:s,"aria-labelledby":`confirm-title`,"aria-describedby":`confirm-message`,children:(0,J.jsxs)(`div`,{className:`w-80 p-6`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[a&&(0,J.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-full bg-destructive/10`,children:(0,J.jsx)(P,{className:`h-5 w-5 text-destructive`})}),(0,J.jsx)(`h2`,{id:`confirm-title`,className:`text-lg font-semibold`,children:t})]}),(0,J.jsx)(`p`,{id:`confirm-message`,className:`text-sm text-muted-foreground mb-6`,children:n}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,J.jsx)(`button`,{onClick:s,className:`px-4 py-2 text-sm rounded-md border hover:bg-accent`,children:i}),(0,J.jsx)(`button`,{onClick:o,className:Xe(`px-4 py-2 text-sm rounded-md font-medium`,a?`bg-destructive text-destructive-foreground hover:bg-destructive/90`:`bg-primary text-primary-foreground hover:bg-primary/90`),autoFocus:!0,children:r})]})]})}):null}function Qe(...e){return W(G(e))}function $e({title:e=`Properties`,fields:t,onChange:n,className:r}){let[i,a]=(0,q.useState)(new Set),o=(0,q.useCallback)(e=>{a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),s=t.reduce((e,t)=>{let n=t.group??`General`;return e[n]||(e[n]=[]),e[n].push(t),e},{});return(0,J.jsxs)(`div`,{className:Qe(`flex flex-col`,r),role:`region`,"aria-label":e,children:[(0,J.jsx)(`div`,{className:`p-3 border-b font-medium text-sm`,children:e}),(0,J.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[Object.entries(s).map(([e,t])=>(0,J.jsxs)(`div`,{className:`border-b last:border-b-0`,children:[(0,J.jsxs)(`button`,{onClick:()=>o(e),className:`w-full flex items-center gap-1 px-3 py-2 text-xs font-medium text-muted-foreground hover:bg-accent/50`,children:[i.has(e)?(0,J.jsx)(y,{className:`h-3 w-3`}):(0,J.jsx)(B,{className:`h-3 w-3`}),e]}),!i.has(e)&&(0,J.jsx)(`div`,{className:`px-3 pb-2 space-y-2`,children:t.map(e=>(0,J.jsx)(et,{field:e,onChange:n},e.name))})]},e)),t.length===0&&(0,J.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground text-center`,children:`Select an element to edit its properties`})]})]})}function et({field:e,onChange:t}){let n=n=>{t(e.name,n)};return(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:e.label}),e.type===`text`&&(0,J.jsx)(`input`,{type:`text`,value:String(e.value??``),onChange:e=>n(e.target.value),className:`w-full px-2 py-1 text-xs border rounded bg-background`}),e.type===`number`&&(0,J.jsx)(`input`,{type:`number`,value:Number(e.value??0),onChange:e=>n(Number(e.target.value)),className:`w-full px-2 py-1 text-xs border rounded bg-background`}),e.type===`boolean`&&(0,J.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:!!e.value,onChange:e=>n(e.target.checked),className:`rounded`}),(0,J.jsx)(`span`,{className:`text-xs`,children:e.value?`Yes`:`No`})]}),e.type===`select`&&(0,J.jsx)(`select`,{value:String(e.value??``),onChange:e=>n(e.target.value),className:`w-full px-2 py-1 text-xs border rounded bg-background`,children:e.options?.map(e=>(0,J.jsx)(`option`,{value:e.value,children:e.label},e.value))}),e.type===`color`&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`input`,{type:`color`,value:String(e.value??`#000000`),onChange:e=>n(e.target.value),className:`h-6 w-6 rounded border cursor-pointer`}),(0,J.jsx)(`span`,{className:`text-xs font-mono`,children:String(e.value??`#000000`)})]}),e.type===`textarea`&&(0,J.jsx)(`textarea`,{value:String(e.value??``),onChange:e=>n(e.target.value),className:`w-full px-2 py-1 text-xs border rounded bg-background resize-y`,rows:3}),e.description&&(0,J.jsx)(`p`,{className:`text-[0.65rem] text-muted-foreground/70`,children:e.description})]})}function tt(...e){return W(G(e))}function nt({items:e,canvasWidth:t,canvasHeight:n,position:r=`bottom-right`,size:i=150,className:a}){let o=Math.min(i/t,i/n),s=t*o,c=n*o;return(0,J.jsx)(`div`,{className:tt(`absolute border rounded bg-background/90 shadow-sm overflow-hidden`,{"top-left":`top-2 left-2`,"top-right":`top-2 right-2`,"bottom-left":`bottom-2 left-2`,"bottom-right":`bottom-2 right-2`}[r],a),role:`img`,"aria-label":`Canvas minimap`,children:(0,J.jsxs)(`svg`,{width:s,height:c,viewBox:`0 0 ${t} ${n}`,children:[(0,J.jsx)(`rect`,{width:t,height:n,fill:`hsl(var(--muted))`,opacity:`0.3`}),e.map(e=>(0,J.jsx)(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,fill:e.selected?`hsl(var(--primary))`:e.color??`hsl(var(--foreground) / 0.3)`,rx:`2`},e.id))]})})}var rt=(0,q.createContext)(null);rt.displayName=`CollaborationContext`;function it(){return(0,q.useContext)(rt)}function Y(...e){return W(G(e))}function at({canvas:e={width:1200,height:800,gridSize:8,showGrid:!0,snapToGrid:!0},components:t=[],palette:n=ot,showComponentTree:r=!0,undoRedo:i=!0,propertyEditor:a=!0,readOnly:o=!1,showMinimap:s=!1,onChange:c,className:l}){let u=Ge(t),d=u.current,f=(0,q.useCallback)(e=>{u.push(e),c?.(e)},[u,c]),p=Ye({initialZoom:e.zoom??1}),{zoom:m}=p,h=qe(),g=(0,q.useMemo)(()=>{let e=Array.from(h.selectedIds);return e.length>0?e[0]:null},[h.selectedIds]),_=(0,q.useMemo)(()=>d.find(e=>e.id===g),[d,g]),v=Je(),y=Ke(),b=it(),x=(0,q.useCallback)(e=>{b&&b.sendOperation({...e,userId:b.currentUserId??``})},[b]),[S,C]=(0,q.useState)(!0),[w,E]=(0,q.useState)(!0),[D,O]=(0,q.useState)(s),k=(0,q.useRef)(null),j=(0,q.useRef)(null),M=(0,q.useCallback)(t=>!e.snapToGrid||!e.gridSize?t:Math.round(t/e.gridSize)*e.gridSize,[e.snapToGrid,e.gridSize]),N=(0,q.useCallback)((e,t)=>{if(o)return;let r=n.flatMap(e=>e.items).find(t=>t.type===e),i=r?.defaultSize,a={id:`comp-${Date.now()}`,type:e,label:t,position:{x:100,y:100,width:i?.width??200,height:i?.height??100},props:r?.defaultProps??{}},s=[...d,a];f(s),h.selectOne(a.id),x({type:`insert`,elementId:a.id,data:{component:a}})},[d,o,n,f,h,x]),P=(0,q.useCallback)(e=>{if(o)return;let t=d.filter(t=>t.id!==e);f(t),h.isSelected(e)&&h.clearSelection(),x({type:`delete`,elementId:e,data:{}})},[d,o,f,h,x]),F=(0,q.useCallback)(async()=>{if(o||h.count===0||!await y.confirm(`Delete components`,`Are you sure you want to delete ${h.count} component${h.count>1?`s`:``}?`))return;let e=h.selectedIds,t=d.filter(t=>!e.has(t.id));f(t),h.clearSelection(),e.forEach(e=>{x({type:`delete`,elementId:e,data:{}})})},[o,h,y,d,f,x]),I=(0,q.useCallback)((e,t)=>{if(o||!g)return;let n=d.map(n=>n.id===g?e===`label`?{...n,label:String(t)}:e===`x`?{...n,position:{...n.position,x:Number(t)}}:e===`y`?{...n,position:{...n.position,y:Number(t)}}:e===`width`?{...n,position:{...n.position,width:Number(t)}}:e===`height`?{...n,position:{...n.position,height:Number(t)}}:{...n,props:{...n.props,[e]:t}}:n);f(n),x({type:`update`,elementId:g,data:{[e]:t}})},[o,g,d,f,x]),ne=(0,q.useCallback)(()=>{let e=h.selectedIds;if(e.size===0)return;let t=d.filter(t=>e.has(t.id));v.copy(t)},[h,d,v]),re=(0,q.useCallback)(()=>{if(o)return;let e=v.paste();if(!e||e.length===0)return;let t=0,n=e.map(e=>({...e,id:`comp-${Date.now()}-${++t}-${Math.random().toString(36).slice(2,7)}`,position:{...e.position,x:e.position.x+20,y:e.position.y+20}})),r=[...d,...n];f(r),h.selectMany(n.map(e=>e.id)),n.forEach(e=>{x({type:`insert`,elementId:e.id,data:{component:e}})})},[o,v,d,f,h,x]),R=(0,q.useCallback)((e,t)=>{o||(k.current={id:t.id,startX:e.clientX,startY:e.clientY},e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t.id))},[o]),z=(0,q.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},[]),ie=(0,q.useCallback)(e=>{e.preventDefault();let t=k.current;if(!t||o)return;let n=(e.clientX-t.startX)/m,r=(e.clientY-t.startY)/m,i=d.map(e=>e.id===t.id?{...e,position:{...e.position,x:M(e.position.x+n),y:M(e.position.y+r)}}:e);f(i),x({type:`move`,elementId:t.id,data:{}}),k.current=null},[o,m,d,f,M,x]),B=(0,q.useMemo)(()=>_?[{name:`label`,label:`Label`,type:`text`,value:_.label??``,group:`General`},{name:`x`,label:`X`,type:`number`,value:_.position.x,group:`Position`},{name:`y`,label:`Y`,type:`number`,value:_.position.y,group:`Position`},{name:`width`,label:`Width`,type:`number`,value:_.position.width,group:`Size`},{name:`height`,label:`Height`,type:`number`,value:_.position.height,group:`Size`}]:[],[_]),oe=(0,q.useMemo)(()=>d.map(e=>({id:e.id,x:e.position.x,y:e.position.y,width:typeof e.position.width==`number`?e.position.width:100,height:typeof e.position.height==`number`?e.position.height:50,selected:h.isSelected(e.id)})),[d,h]);return(0,q.useEffect)(()=>{let e=j.current;if(!e)return;let t=e=>{let t=[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.target.tagName),n=e.ctrlKey||e.metaKey;if((e.key===`Delete`||e.key===`Backspace`)&&h.count>0&&!t){e.preventDefault(),F();return}if(e.key===`Escape`){h.clearSelection();return}if(!t){if(n&&e.key===`z`&&!e.shiftKey&&i&&!o){e.preventDefault(),u.undo();return}if(n&&(e.key===`z`&&e.shiftKey||e.key===`y`)&&i&&!o){e.preventDefault(),u.redo();return}if(n&&e.key===`c`){e.preventDefault(),ne();return}if(n&&e.key===`v`&&!o){e.preventDefault(),re();return}if(n&&e.key===`a`){e.preventDefault(),h.selectMany(d.map(e=>e.id));return}}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[h,F,i,o,u,ne,re,d]),(0,J.jsxs)(`div`,{ref:j,tabIndex:0,className:Y(`flex h-full w-full border rounded-lg overflow-hidden bg-background`,l),children:[!o&&(0,J.jsx)(`div`,{className:Y(`border-r bg-muted/30 flex flex-col transition-[width] duration-200`,S?`w-60`:`w-0 overflow-hidden`),role:`region`,"aria-label":`Component palette`,children:S&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`p-3 border-b font-medium text-sm`,children:`Components`}),(0,J.jsx)(`div`,{className:`flex-1 overflow-y-auto p-2`,children:n.map(e=>(0,J.jsxs)(`div`,{className:`mb-3`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground px-2 py-1 uppercase`,children:e.label}),e.items.map(e=>(0,J.jsxs)(`button`,{onClick:()=>N(e.type,e.label),className:`w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded hover:bg-accent text-left`,children:[(0,J.jsx)(L,{className:`h-3 w-3`}),e.label]},e.type))]},e.name))})]})}),(0,J.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 p-2 border-b bg-muted/20`,role:`toolbar`,"aria-label":`Designer toolbar`,children:[!o&&(0,J.jsx)(`button`,{className:`p-1.5 rounded hover:bg-accent`,title:S?`Collapse palette`:`Expand palette`,"aria-label":S?`Collapse palette`:`Expand palette`,onClick:()=>C(e=>!e),children:(0,J.jsx)(xe,{className:Y(`h-4 w-4`,!S&&`rotate-180`)})}),i&&!o&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`w-px h-5 bg-border mx-1`}),(0,J.jsx)(`button`,{className:Y(`p-1.5 rounded hover:bg-accent`,!u.canUndo&&`opacity-40 pointer-events-none`),title:`Undo (Ctrl+Z)`,"aria-label":`Undo`,disabled:!u.canUndo,onClick:()=>u.undo(),children:(0,J.jsx)(ae,{className:`h-4 w-4`})}),(0,J.jsx)(`button`,{className:Y(`p-1.5 rounded hover:bg-accent`,!u.canRedo&&`opacity-40 pointer-events-none`),title:`Redo (Ctrl+Shift+Z)`,"aria-label":`Redo`,disabled:!u.canRedo,onClick:()=>u.redo(),children:(0,J.jsx)(ee,{className:`h-4 w-4`})}),(0,J.jsx)(`div`,{className:`w-px h-5 bg-border mx-1`})]}),!o&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{className:Y(`p-1.5 rounded hover:bg-accent`,h.count===0&&`opacity-40 pointer-events-none`),title:`Copy (Ctrl+C)`,"aria-label":`Copy`,disabled:h.count===0,onClick:ne,children:(0,J.jsx)(me,{className:`h-4 w-4`})}),(0,J.jsx)(`button`,{className:Y(`p-1.5 rounded hover:bg-accent`,!v.hasContent&&`opacity-40 pointer-events-none`),title:`Paste (Ctrl+V)`,"aria-label":`Paste`,disabled:!v.hasContent,onClick:re,children:(0,J.jsx)(Ie,{className:`h-4 w-4`})}),(0,J.jsx)(`div`,{className:`w-px h-5 bg-border mx-1`})]}),!o&&(0,J.jsx)(`button`,{className:Y(`p-1.5 rounded hover:bg-accent`,h.count===0&&`opacity-40 pointer-events-none`),title:`Delete selected`,"aria-label":`Delete selected`,disabled:h.count===0,onClick:F,children:(0,J.jsx)(V,{className:`h-4 w-4`})}),(0,J.jsx)(`button`,{className:`p-1.5 rounded hover:bg-accent`,title:`Preview`,"aria-label":`Preview`,children:(0,J.jsx)(De,{className:`h-4 w-4`})}),(0,J.jsx)(`button`,{className:Y(`p-1.5 rounded hover:bg-accent`,D&&`bg-accent`),title:`Toggle minimap`,"aria-label":`Toggle minimap`,onClick:()=>O(e=>!e),children:(0,J.jsx)(A,{className:`h-4 w-4`})}),(0,J.jsx)(`div`,{className:`flex-1`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(`button`,{className:`p-1 rounded hover:bg-accent text-xs`,"aria-label":`Zoom out`,onClick:p.zoomOut,children:(0,J.jsx)(te,{className:`h-3 w-3`})}),(0,J.jsxs)(`span`,{className:`text-xs text-muted-foreground w-10 text-center`,children:[Math.round(m*100),`%`]}),(0,J.jsx)(`button`,{className:`p-1 rounded hover:bg-accent text-xs`,"aria-label":`Zoom in`,onClick:p.zoomIn,children:(0,J.jsx)(L,{className:`h-3 w-3`})}),(0,J.jsx)(`button`,{className:`p-1 rounded hover:bg-accent text-xs`,"aria-label":`Reset zoom`,onClick:p.resetZoom,children:(0,J.jsx)(T,{className:`h-3 w-3`})})]}),r&&(0,J.jsx)(`button`,{className:`p-1.5 rounded hover:bg-accent`,title:w?`Collapse panel`:`Expand panel`,"aria-label":w?`Collapse panel`:`Expand panel`,onClick:()=>E(e=>!e),children:(0,J.jsx)(ve,{className:Y(`h-4 w-4`,!w&&`rotate-180`)})})]}),(0,J.jsx)(`div`,{className:`flex-1 overflow-auto bg-muted/10 p-4 relative`,role:`region`,"aria-label":`Design canvas`,onWheel:p.handleWheel,onMouseDown:p.startPan,onDragOver:z,onDrop:ie,children:(0,J.jsxs)(`div`,{className:`relative bg-background border rounded shadow-sm mx-auto`,style:{width:e.width*m,height:e.height*m,transform:`translate(${p.panOffset.x}px, ${p.panOffset.y}px)`,backgroundImage:e.showGrid?`radial-gradient(circle, hsl(var(--border)) 1px, transparent 1px)`:void 0,backgroundSize:e.showGrid&&e.gridSize?`${e.gridSize*m}px ${e.gridSize*m}px`:void 0},children:[d.map(e=>{let t=h.isSelected(e.id);return(0,J.jsxs)(`div`,{draggable:!o,onDragStart:t=>R(t,e),className:Y(`absolute border rounded cursor-move select-none transition-shadow`,t?`border-primary ring-2 ring-primary/20 shadow-md`:`border-border hover:border-primary/50`),style:{left:e.position.x*m,top:e.position.y*m,width:typeof e.position.width==`number`?e.position.width*m:e.position.width,height:typeof e.position.height==`number`?e.position.height*m:e.position.height},onClick:t=>h.toggle(e.id,t.shiftKey),children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1 bg-muted/50 text-xs border-b`,children:[(0,J.jsx)(Fe,{className:`h-3 w-3 text-muted-foreground`}),(0,J.jsx)(`span`,{className:`truncate`,children:e.label??e.type}),!o&&(0,J.jsx)(`button`,{onClick:t=>{t.stopPropagation(),P(e.id)},className:`ml-auto p-0.5 rounded hover:bg-destructive/10`,"aria-label":`Delete ${e.label??e.type}`,children:(0,J.jsx)(V,{className:`h-3 w-3 text-destructive`})})]}),(0,J.jsx)(`div`,{className:`p-2 text-xs text-muted-foreground`,children:e.type})]},e.id)}),D&&(0,J.jsx)(nt,{items:oe,canvasWidth:e.width,canvasHeight:e.height})]})})]}),r&&(0,J.jsx)(`div`,{className:Y(`border-l bg-muted/30 flex flex-col transition-[width] duration-200`,w?`w-60`:`w-0 overflow-hidden`),role:`region`,"aria-label":`Component tree`,children:w&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`p-3 border-b font-medium text-sm flex items-center gap-2`,children:[(0,J.jsx)(_e,{className:`h-4 w-4`}),`Component Tree`]}),(0,J.jsx)(`div`,{className:`flex-1 overflow-y-auto p-2`,children:d.length===0?(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground text-center py-4`,children:`No components added yet. Click a component in the palette to add it to the canvas.`}):d.map(e=>(0,J.jsx)(`button`,{onClick:t=>h.toggle(e.id,t.shiftKey),className:Y(`w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded text-left`,h.isSelected(e.id)?`bg-accent`:`hover:bg-accent/50`),children:(0,J.jsx)(`span`,{className:`truncate`,children:e.label??e.type})},e.id))}),a&&_?(0,J.jsx)(`div`,{className:`border-t`,children:(0,J.jsx)($e,{title:`Properties – ${_.label??_.type}`,fields:B,onChange:I})}):_&&(0,J.jsxs)(`div`,{className:`border-t p-3`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium mb-2`,children:`Properties`}),(0,J.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-1`,children:[(0,J.jsxs)(`div`,{children:[`Type: `,_.type]}),(0,J.jsxs)(`div`,{children:[`ID: `,_.id]}),(0,J.jsxs)(`div`,{children:[`Position: `,_.position.x,`,`,` `,_.position.y]}),(0,J.jsxs)(`div`,{children:[`Size: `,_.position.width,` ×`,` `,_.position.height]})]})]})]})}),(0,J.jsx)(Ze,{isOpen:y.isOpen,title:y.title,message:y.message,onConfirm:y.onConfirm,onCancel:y.onCancel})]})}var ot=[{name:`layout`,label:`Layout`,items:[{type:`container`,label:`Container`,defaultSize:{width:400,height:300}},{type:`flex`,label:`Flex`,defaultSize:{width:400,height:200}},{type:`grid`,label:`Grid`,defaultSize:{width:400,height:300}},{type:`card`,label:`Card`,defaultSize:{width:300,height:200}},{type:`tabs`,label:`Tabs`,defaultSize:{width:400,height:300}}]},{name:`form`,label:`Form`,items:[{type:`input`,label:`Input`,defaultSize:{width:300,height:60}},{type:`textarea`,label:`Textarea`,defaultSize:{width:300,height:120}},{type:`select`,label:`Select`,defaultSize:{width:300,height:60}},{type:`checkbox`,label:`Checkbox`,defaultSize:{width:200,height:40}},{type:`button`,label:`Button`,defaultSize:{width:120,height:40}}]},{name:`data`,label:`Data`,items:[{type:`table`,label:`Table`,defaultSize:{width:600,height:400}},{type:`chart`,label:`Chart`,defaultSize:{width:400,height:300}},{type:`list`,label:`List`,defaultSize:{width:300,height:400}},{type:`statistic`,label:`Statistic`,defaultSize:{width:200,height:100}}]}];function st(e,t={}){return Ge(e,t)}function ct(...e){return W(G(e))}var lt=[`text`,`number`,`boolean`,`date`,`datetime`,`uuid`,`email`,`url`,`phone`,`json`,`integer`,`float`,`decimal`,`currency`,`percent`,`textarea`,`select`,`multiselect`,`lookup`,`attachment`,`formula`,`autonumber`];function ut(e,t=4,n=280,r=250,i=50,a=50){return e.map((e,o)=>({...e,position:{x:i+o%t*n,y:a+Math.floor(o/t)*r}}))}function dt({entities:e=[],relationships:t=[],canvas:n={width:1200,height:800,showGrid:!0},showRelationshipLabels:r=!0,readOnly:i=!1,onEntitiesChange:a,onRelationshipsChange:o,className:s}){let c=(0,q.useRef)(null),l=st({entities:e,relationships:t},{maxHistory:50}),{entities:u,relationships:d}=l.current,f=(0,q.useCallback)(e=>{l.push(e),a?.(e.entities),o?.(e.relationships)},[l,a,o]),p=Ke(),m=qe(),h=m.count>0?Array.from(m.selectedIds)[0]:null,g=Je(),_=Ye({minZoom:.25,maxZoom:3,zoomStep:.1}),v=it(),[b,x]=(0,q.useState)(!0),[S,T]=(0,q.useState)(!0),[E,D]=(0,q.useState)(null),[O,k]=(0,q.useState)(``),[A,j]=(0,q.useState)(null),[M,N]=(0,q.useState)(``),P=(0,q.useRef)(null),F=(0,q.useCallback)(()=>{if(i)return;let e=l.current,t={id:`entity-${Date.now()}`,name:`new_entity_${e.entities.length+1}`,label:`New Entity ${e.entities.length+1}`,fields:[{name:`id`,type:`uuid`,primaryKey:!0,required:!0},{name:`created_at`,type:`datetime`,required:!0},{name:`updated_at`,type:`datetime`,required:!0}],position:{x:50+e.entities.length%4*280,y:50+Math.floor(e.entities.length/4)*250}},n={entities:[...e.entities,t],relationships:e.relationships};f(n),m.selectOne(t.id),v?.sendOperation({type:`insert`,userId:v?.currentUserId??``,elementId:t.id,data:{name:t.name,label:t.label}})},[i,l,f,m,v]),I=(0,q.useCallback)(async e=>{if(i)return;let t=u.find(t=>t.id===e);if(!await p.confirm(`Delete Entity`,`Are you sure you want to delete "${t?.label??e}"? This action cannot be undone.`))return;let n=l.current,r={entities:n.entities.filter(t=>t.id!==e),relationships:n.relationships.filter(t=>t.sourceEntity!==e&&t.targetEntity!==e)};f(r),m.isSelected(e)&&m.clearSelection(),v?.sendOperation({type:`delete`,userId:v?.currentUserId??``,elementId:e,data:{}})},[i,u,p,l,f,m,v]),te=(0,q.useCallback)(async()=>{if(i||m.count===0)return;let e=Array.from(m.selectedIds);if(!await p.confirm(`Delete Entities`,`Are you sure you want to delete ${e.length} selected entity(s)? This action cannot be undone.`))return;let t=l.current,n=new Set(e),r={entities:t.entities.filter(e=>!n.has(e.id)),relationships:t.relationships.filter(e=>!n.has(e.sourceEntity)&&!n.has(e.targetEntity))};f(r),m.clearSelection()},[i,m,p,l,f]),ne=(0,q.useCallback)(()=>{if(i)return;let e=l.current,t={entities:ut(e.entities),relationships:e.relationships};f(t)},[i,l,f]),R=(0,q.useCallback)(()=>{let e=u.filter(e=>m.isSelected(e.id));e.length>0&&g.copy(e)},[u,m,g]),z=(0,q.useCallback)(()=>{if(i)return;let e=g.paste();if(!e||e.length===0)return;let t=l.current,n=e.map((e,t)=>({...e,id:`entity-${Date.now()}-${t}`,name:`${e.name}_copy`,label:`${e.label} (Copy)`,position:{x:e.position.x+30,y:e.position.y+30}})),r={entities:[...t.entities,...n],relationships:t.relationships};f(r),m.selectMany(n.map(e=>e.id))},[i,g,l,f,m]),ie=(0,q.useCallback)(e=>{if(i)return;let t=l.current,n={entities:t.entities.map(t=>{if(t.id!==e)return t;let n={name:`field_${t.fields.length+1}`,type:`text`,required:!1};return{...t,fields:[...t.fields,n]}}),relationships:t.relationships};f(n)},[i,l,f]),oe=(0,q.useCallback)((e,t,n)=>{i||(D({entityId:e,fieldIndex:t}),k(n))},[i]),se=(0,q.useCallback)(()=>{if(!E)return;let e=O.trim();if(e===``){D(null);return}let t=l.current,n={entities:t.entities.map(t=>{if(t.id!==E.entityId)return t;let n=t.fields.map((t,n)=>n===E.fieldIndex?{...t,name:e}:t);return{...t,fields:n}}),relationships:t.relationships};f(n),D(null)},[E,O,l,f]),le=(0,q.useCallback)(()=>{D(null)},[]),ue=(0,q.useCallback)((e,t)=>{i||(j(e),N(t))},[i]),de=(0,q.useCallback)(()=>{if(!A)return;let e=M.trim();if(e===``){j(null);return}let t=l.current,n={entities:t.entities.map(t=>t.id===A?{...t,label:e}:t),relationships:t.relationships};f(n),j(null)},[A,M,l,f]),fe=(0,q.useCallback)(()=>{j(null)},[]),H=(0,q.useCallback)((e,t,n)=>{if(i)return;let r=l.current,a={entities:r.entities.map(r=>{if(r.id!==e)return r;let i=r.fields.map((e,r)=>r===t?{...e,type:n}:e);return{...r,fields:i}}),relationships:r.relationships};f(a)},[i,l,f]),pe=(0,q.useCallback)((e,t)=>{if(i||!u.find(e=>e.id===t))return;let n=e.target.getBoundingClientRect();P.current={entityId:t,offsetX:e.clientX-n.left,offsetY:e.clientY-n.top},e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t)},[i,u]),he=(0,q.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},[]),ge=(0,q.useCallback)(e=>{if(e.preventDefault(),!P.current)return;let t=e.currentTarget.getBoundingClientRect(),n=_.zoom,r=(e.clientX-t.left-_.panOffset.x)/n-P.current.offsetX,i=(e.clientY-t.top-_.panOffset.y)/n-P.current.offsetY,a=l.current,o={entities:a.entities.map(e=>e.id===P.current.entityId?{...e,position:{x:Math.max(0,Math.round(r)),y:Math.max(0,Math.round(i))}}:e),relationships:a.relationships};f(o),P.current=null},[_.zoom,_.panOffset,l,f]),U=h?u.find(e=>e.id===h):null,_e=U?[{name:`name`,label:`Name`,type:`text`,value:U.name,group:`General`},{name:`label`,label:`Label`,type:`text`,value:U.label,group:`General`},{name:`description`,label:`Description`,type:`textarea`,value:U.description??``,group:`General`},{name:`color`,label:`Color`,type:`color`,value:U.color??`#3b82f6`,group:`Appearance`},{name:`position.x`,label:`X Position`,type:`number`,value:U.position.x,group:`Position`},{name:`position.y`,label:`Y Position`,type:`number`,value:U.position.y,group:`Position`}]:[],ve=(0,q.useCallback)((e,t)=>{if(!h)return;let n=l.current,r={entities:n.entities.map(n=>n.id===h?e===`position.x`?{...n,position:{...n.position,x:Number(t)}}:e===`position.y`?{...n,position:{...n.position,y:Number(t)}}:{...n,[e]:t}:n),relationships:n.relationships};f(r)},[h,l,f]);(0,q.useEffect)(()=>{let e=c.current;if(!e)return;let t=e=>{let t=e.target.tagName;if(t===`INPUT`||t===`TEXTAREA`||t===`SELECT`)return;let n=e.ctrlKey||e.metaKey;n&&e.key===`z`?(e.preventDefault(),l.undo()):n&&(e.key===`y`||e.shiftKey&&e.key===`Z`)?(e.preventDefault(),l.redo()):n&&e.key===`c`?(e.preventDefault(),R()):n&&e.key===`v`?(e.preventDefault(),z()):(e.key===`Delete`||e.key===`Backspace`)&&m.count>0?(e.preventDefault(),te()):e.key===`Escape`&&(m.clearSelection(),D(null),j(null))};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[l,R,z,te,m]);let ye=u.map(e=>({id:e.id,x:e.position.x,y:e.position.y,width:240,height:40+e.fields.length*24,color:e.color,selected:m.isSelected(e.id)}));return(0,J.jsxs)(`div`,{ref:c,tabIndex:0,className:ct(`flex h-full w-full border rounded-lg overflow-hidden bg-background`,s),children:[(0,J.jsxs)(`div`,{className:`flex flex-col flex-1 min-w-0`,children:[(0,J.jsxs)(`div`,{role:`toolbar`,"aria-label":`Designer toolbar`,className:`flex items-center gap-2 p-2 border-b bg-muted/20 flex-wrap`,children:[(0,J.jsx)(Ae,{className:`h-4 w-4`}),(0,J.jsx)(`span`,{className:`font-medium text-sm`,children:`Data Model Designer`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1 ml-2 border-l pl-2`,children:[(0,J.jsx)(`button`,{onClick:()=>l.undo(),disabled:!l.canUndo,"aria-label":`Undo`,title:`Undo (Ctrl+Z)`,className:`p-1 rounded hover:bg-accent disabled:opacity-40`,children:(0,J.jsx)(ae,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(`button`,{onClick:()=>l.redo(),disabled:!l.canRedo,"aria-label":`Redo`,title:`Redo (Ctrl+Y)`,className:`p-1 rounded hover:bg-accent disabled:opacity-40`,children:(0,J.jsx)(ee,{className:`h-3.5 w-3.5`})})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1 border-l pl-2`,children:[(0,J.jsx)(`button`,{onClick:_.zoomOut,"aria-label":`Zoom Out`,title:`Zoom Out`,className:`p-1 rounded hover:bg-accent`,children:(0,J.jsx)(w,{className:`h-3.5 w-3.5`})}),(0,J.jsxs)(`span`,{className:`text-xs tabular-nums w-10 text-center`,children:[Math.round(_.zoom*100),`%`]}),(0,J.jsx)(`button`,{onClick:_.zoomIn,"aria-label":`Zoom In`,title:`Zoom In`,className:`p-1 rounded hover:bg-accent`,children:(0,J.jsx)(C,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(`button`,{onClick:_.resetZoom,"aria-label":`Reset Zoom`,title:`Reset Zoom`,className:`p-1 rounded hover:bg-accent`,children:(0,J.jsx)(ze,{className:`h-3 w-3`})})]}),!i&&(0,J.jsxs)(`div`,{className:`flex items-center gap-1 border-l pl-2`,children:[(0,J.jsx)(`button`,{onClick:R,disabled:m.count===0,"aria-label":`Copy`,title:`Copy (Ctrl+C)`,className:`p-1 rounded hover:bg-accent disabled:opacity-40`,children:(0,J.jsx)(me,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(`button`,{onClick:z,disabled:!g.hasContent,"aria-label":`Paste`,title:`Paste (Ctrl+V)`,className:`p-1 rounded hover:bg-accent disabled:opacity-40`,children:(0,J.jsx)(Ie,{className:`h-3.5 w-3.5`})})]}),!i&&(0,J.jsxs)(`button`,{onClick:ne,"aria-label":`Auto Layout`,title:`Auto Layout`,className:`flex items-center gap-1 px-2 py-1 text-xs rounded border hover:bg-accent`,children:[(0,J.jsx)(Re,{className:`h-3 w-3`}),` Auto Layout`]}),(0,J.jsx)(`div`,{className:`flex-1`}),v?.isConnected&&(0,J.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,role:`status`,"aria-label":`Collaboration active`,children:[(0,J.jsx)(re,{className:`h-3 w-3`}),(0,J.jsxs)(`span`,{children:[v.users.length,` user`,v.users.length===1?``:`s`]})]}),m.count>1&&(0,J.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[m.count,` selected`]}),!i&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{onClick:F,"aria-label":`Add Entity`,className:`flex items-center gap-1 px-2 py-1 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90`,children:[(0,J.jsx)(L,{className:`h-3 w-3`}),` Add Entity`]}),(0,J.jsxs)(`button`,{"aria-label":`Add Relationship`,title:`Add Relationship (coming soon)`,className:`flex items-center gap-1 px-2 py-1 text-xs rounded bg-secondary text-secondary-foreground hover:bg-secondary/80`,children:[(0,J.jsx)(ce,{className:`h-3 w-3`}),` Add Relationship`]})]})]}),(0,J.jsxs)(`div`,{role:`region`,"aria-label":`Canvas`,className:`flex-1 overflow-auto bg-muted/10 p-4 relative`,onWheel:_.handleWheel,onMouseDown:_.startPan,onDragOver:he,onDrop:ge,children:[(0,J.jsxs)(`div`,{className:`relative`,style:{width:n.width,minHeight:n.height,..._.transformStyle,backgroundImage:n.showGrid?`radial-gradient(circle, hsl(var(--border)) 1px, transparent 1px)`:void 0,backgroundSize:n.showGrid?`20px 20px`:void 0},children:[(0,J.jsx)(`svg`,{className:`absolute inset-0 pointer-events-none`,width:n.width,height:n.height,children:d.map(e=>{let t=u.find(t=>t.id===e.sourceEntity),n=u.find(t=>t.id===e.targetEntity);return!t||!n?null:(0,J.jsxs)(`g`,{children:[(0,J.jsx)(`line`,{x1:t.position.x+120,y1:t.position.y+50,x2:n.position.x+120,y2:n.position.y+50,stroke:`hsl(var(--primary))`,strokeWidth:`2`,strokeDasharray:e.type===`many-to-many`?`5,5`:void 0}),r&&e.label&&(0,J.jsx)(`text`,{x:(t.position.x+n.position.x)/2+120,y:(t.position.y+n.position.y)/2+50-8,textAnchor:`middle`,className:`text-xs fill-muted-foreground`,children:e.label})]},e.id)})}),u.length===0&&(0,J.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-muted-foreground text-sm`,children:`No entities in the model. Click 'Add Entity' to create your first entity.`}),u.map(e=>(0,J.jsxs)(`div`,{role:`group`,"aria-label":e.label,draggable:!i,onDragStart:t=>pe(t,e.id),className:ct(`absolute rounded-lg border-2 bg-background shadow-sm w-60 select-none cursor-grab active:cursor-grabbing`,m.isSelected(e.id)?`border-primary ring-2 ring-primary/20`:`border-border hover:border-primary/50`),style:{left:e.position.x,top:e.position.y},onClick:t=>m.toggle(e.id,t.shiftKey),children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-t-lg font-medium text-sm`,style:{backgroundColor:e.color??`hsl(var(--primary) / 0.1)`},children:[(0,J.jsx)(Ae,{className:`h-3.5 w-3.5`}),A===e.id?(0,J.jsx)(`input`,{type:`text`,value:M,onChange:e=>N(e.target.value),onBlur:de,onKeyDown:e=>{e.key===`Enter`&&de(),e.key===`Escape`&&fe()},className:`text-sm font-medium px-1 py-0 border rounded bg-background w-32 focus:outline-none focus:ring-1 focus:ring-primary`,autoFocus:!0,onClick:e=>e.stopPropagation(),"data-testid":`entity-label-input-${e.id}`}):(0,J.jsx)(`span`,{className:`truncate cursor-text`,onDoubleClick:t=>{t.stopPropagation(),ue(e.id,e.label)},title:`Double-click to edit label`,"data-testid":`entity-label-${e.id}`,children:e.label}),!i&&(0,J.jsx)(`button`,{onClick:t=>{t.stopPropagation(),I(e.id)},"aria-label":`Delete ${e.label}`,className:`ml-auto p-0.5 rounded hover:bg-destructive/20`,children:(0,J.jsx)(V,{className:`h-3 w-3 text-destructive`})})]}),(0,J.jsx)(`div`,{className:`px-3 py-1 divide-y`,children:e.fields.map((t,n)=>(0,J.jsxs)(`div`,{className:`flex items-center gap-2 py-1 text-xs`,children:[E&&E.entityId===e.id&&E.fieldIndex===n?(0,J.jsx)(`input`,{type:`text`,value:O,onChange:e=>k(e.target.value),onBlur:se,onKeyDown:e=>{e.key===`Enter`&&se(),e.key===`Escape`&&le()},className:`font-mono text-xs px-1 py-0 border rounded bg-background w-24 focus:outline-none focus:ring-1 focus:ring-primary`,autoFocus:!0,onClick:e=>e.stopPropagation()}):(0,J.jsxs)(`span`,{className:ct(`font-mono cursor-text`,t.primaryKey&&`font-bold text-primary`),onClick:r=>{r.stopPropagation(),oe(e.id,n,t.name)},title:`Click to edit field name`,children:[t.primaryKey&&(0,J.jsx)(`span`,{className:`text-[0.65rem] font-semibold text-primary mr-0.5`,children:`PK`}),t.name]}),i?(0,J.jsx)(`span`,{className:`text-muted-foreground ml-auto`,children:t.type}):(0,J.jsx)(`select`,{value:t.type,onChange:t=>{t.stopPropagation(),H(e.id,n,t.target.value)},onClick:e=>e.stopPropagation(),className:`text-xs text-muted-foreground ml-auto bg-transparent border-none focus:ring-1 focus:ring-primary rounded cursor-pointer p-0`,"data-testid":`field-type-${e.id}-${n}`,children:lt.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))}),t.required&&(0,J.jsx)(`span`,{className:`text-destructive`,children:`*`})]},`${t.name}-${n}`))}),!i&&(0,J.jsx)(`div`,{className:`px-3 py-1 border-t`,children:(0,J.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),ie(e.id)},"aria-label":`Add field to ${e.label}`,className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground w-full py-0.5`,children:[(0,J.jsx)(L,{className:`h-3 w-3`}),` Add Field`]})})]},e.id))]}),S&&u.length>0&&(0,J.jsx)(nt,{items:ye,canvasWidth:n.width,canvasHeight:n.height,position:`bottom-right`,size:150})]})]}),(0,J.jsxs)(`div`,{className:`w-64 border-l flex flex-col bg-background shrink-0`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0`,children:[(0,J.jsxs)(`button`,{onClick:()=>x(e=>!e),className:`flex items-center gap-1 px-3 py-2 text-xs font-medium text-muted-foreground hover:bg-accent/50 border-b`,"aria-expanded":b,"aria-controls":`property-editor-panel`,children:[b?(0,J.jsx)(B,{className:`h-3 w-3`}):(0,J.jsx)(y,{className:`h-3 w-3`}),`Properties`]}),b&&(0,J.jsx)(`div`,{id:`property-editor-panel`,className:`flex-1 overflow-y-auto`,children:(0,J.jsx)($e,{title:U?U.label:`Properties`,fields:_e,onChange:ve})})]}),(0,J.jsx)(`div`,{className:`border-t`,children:(0,J.jsxs)(`button`,{onClick:()=>T(e=>!e),className:`flex items-center gap-1 px-3 py-2 text-xs font-medium text-muted-foreground hover:bg-accent/50 w-full`,"aria-expanded":S,children:[S?(0,J.jsx)(B,{className:`h-3 w-3`}):(0,J.jsx)(y,{className:`h-3 w-3`}),`Minimap`]})})]}),(0,J.jsx)(Ze,{isOpen:p.isOpen,title:p.title,message:p.message,onConfirm:p.onConfirm,onCancel:p.onCancel,destructive:!0})]})}function ft(...e){return W(G(e))}var pt=120,mt=50;function ht(e,t){if(e.length===0)return e;let n=new Map,r=new Map;for(let t of e)n.set(t.id,0),r.set(t.id,[]);for(let e of t)n.set(e.target,(n.get(e.target)??0)+1),r.get(e.source)?.push(e.target);let i=[],a=new Set,o=e.filter(e=>(n.get(e.id)??0)===0).map(e=>e.id);for(o.length===0&&(o=[e[0].id]);o.length>0;){i.push(o);for(let e of o)a.add(e);let e=new Set;for(let t of o)for(let n of r.get(t)??[])a.has(n)||e.add(n);o=Array.from(e)}let s=e.filter(e=>!a.has(e.id)).map(e=>e.id);s.length>0&&i.push(s);let c=new Map;for(let e=0;e<i.length;e++){let t=i[e];for(let n=0;n<t.length;n++)c.set(t[n],{x:80+e*200,y:80+n*100})}return e.map(e=>({...e,position:c.get(e.id)??e.position}))}function gt({processName:e=`New Process`,nodes:t=[],edges:n=[],lanes:r,canvas:i={width:1400,height:800,showGrid:!0},showMinimap:a=!0,showToolbar:o=!0,readOnly:s=!1,onNodesChange:c,onEdgesChange:l,className:u}){let d=Ge({nodes:t,edges:n},{maxHistory:50}),f=d.current.nodes,p=d.current.edges,m=(0,q.useCallback)((e,t)=>{d.push({nodes:e,edges:t}),c?.(e),l?.(t)},[d,c,l]),h=Ke(),g=qe(),_=Je(),v=Ye({initialZoom:1}),y=it(),[b,x]=(0,q.useState)(null),[T,E]=(0,q.useState)(!1),[D,O]=(0,q.useState)(null),[k,A]=(0,q.useState)(null),[j,N]=(0,q.useState)(!0),[P,F]=(0,q.useState)(null),[I,te]=(0,q.useState)({x:0,y:0}),ne=(0,q.useRef)(null),L=(0,q.useRef)(c),re=(0,q.useRef)(l);L.current=c,re.current=l,(0,q.useEffect)(()=>{L.current?.(f),re.current?.(p)},[d.current]);let R=(0,q.useCallback)((e,t)=>{if(s)return;let n={id:`node-${Date.now()}`,type:e,label:t,position:{x:200+f.length*160,y:200}},r=[...f,n];m(r,p),x(n.id),g.selectOne(n.id),y?.sendOperation({type:`insert`,elementId:n.id,data:{label:t},userId:y.currentUserId??``})},[f,p,s,m,g,y]),z=(0,q.useCallback)(async e=>{if(s)return;let t=f.find(t=>t.id===e);if(!await h.confirm(`Delete Node`,`Are you sure you want to delete "${t?.label??e}"? This will also remove all connected edges.`))return;let n=f.filter(t=>t.id!==e),r=p.filter(t=>t.source!==e&&t.target!==e);m(n,r),b===e&&x(null),g.clearSelection(),y?.sendOperation({type:`delete`,elementId:e,data:{},userId:y.currentUserId??``})},[f,p,b,s,m,h,g,y]),ie=(0,q.useCallback)(async()=>{if(s||g.count===0||!await h.confirm(`Delete Selected Nodes`,`Are you sure you want to delete ${g.count} selected node(s) and their connected edges?`))return;let e=g.selectedIds,t=f.filter(t=>!e.has(t.id)),n=p.filter(t=>!e.has(t.source)&&!e.has(t.target));m(t,n),x(null),g.clearSelection()},[f,p,s,m,h,g]),B=(0,q.useCallback)(()=>{let e=g.count>0?g.selectedIds:b?new Set([b]):new Set;if(e.size===0)return;let t=f.filter(t=>e.has(t.id));_.copy(t)},[f,b,g,_]),oe=(0,q.useCallback)(()=>{if(s)return;let e=_.paste();if(!e||e.length===0)return;let t=e.map(e=>({...e,id:`node-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,position:{x:e.position.x+40,y:e.position.y+40}})),n=[...f,...t];m(n,p),g.selectMany(t.map(e=>e.id)),x(t[0].id)},[s,f,p,_,m,g]),se=(0,q.useCallback)(()=>{E(e=>e?(O(null),!1):!0)},[]),ce=(0,q.useCallback)(e=>{if(!T)return!1;if(!D)return O(e),!0;if(D===e)return!0;let t={id:`edge-${Date.now()}`,source:D,target:e},n=[...p,t];return m(f,n),O(null),E(!1),y?.sendOperation({type:`insert`,elementId:t.id,data:{source:D,target:e},userId:y.currentUserId??``}),!0},[T,D,f,p,m,y]),le=(0,q.useCallback)(()=>{if(s||f.length===0)return;let e=ht(f,p);m(e,p)},[f,p,s,m]),ue=(0,q.useCallback)((e,t)=>{if(s||!f.find(e=>e.id===t))return;F(t);let n=e.target.getBoundingClientRect();te({x:e.clientX-n.left,y:e.clientY-n.top}),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t)},[s,f]),de=(0,q.useCallback)(e=>{if(e.preventDefault(),s||!P)return;let t=e.currentTarget.getBoundingClientRect(),n=v.zoom,r=(e.clientX-t.left-v.panOffset.x)/n-I.x,i=(e.clientY-t.top-v.panOffset.y)/n-I.y,a=Math.max(0,Math.round(r/20)*20),o=Math.max(0,Math.round(i/20)*20),c=f.map(e=>e.id===P?{...e,position:{x:a,y:o}}:e);m(c,p),F(null)},[s,P,I,f,p,v.zoom,v.panOffset,m]),fe=(0,q.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},[]),H=(0,q.useMemo)(()=>f.find(e=>e.id===b)??null,[f,b]),ge=(0,q.useMemo)(()=>H?[{name:`label`,label:`Name`,type:`text`,value:H.label,group:`General`},{name:`type`,label:`Type`,type:`select`,value:H.type,options:[{label:`Start Event`,value:`start-event`},{label:`End Event`,value:`end-event`},{label:`User Task`,value:`user-task`},{label:`Service Task`,value:`service-task`},{label:`Script Task`,value:`script-task`},{label:`Exclusive Gateway`,value:`exclusive-gateway`},{label:`Parallel Gateway`,value:`parallel-gateway`},{label:`Inclusive Gateway`,value:`inclusive-gateway`}],group:`General`},{name:`description`,label:`Description`,type:`textarea`,value:H.description??``,group:`General`}]:[],[H]),_e=(0,q.useCallback)((e,t)=>{if(s||!b)return;let n=f.map(n=>n.id===b?{...n,[e]:t}:n);m(n,p)},[s,b,f,p,m]),be=e=>{switch(e){case`start-event`:return`rounded-full bg-green-100 border-green-500 text-green-700`;case`end-event`:return`rounded-full bg-red-100 border-red-500 text-red-700`;case`exclusive-gateway`:case`parallel-gateway`:case`inclusive-gateway`:case`event-based-gateway`:return`rotate-45 bg-yellow-100 border-yellow-500 text-yellow-700`;case`user-task`:return`rounded bg-blue-100 border-blue-500 text-blue-700`;case`service-task`:case`script-task`:return`rounded bg-purple-100 border-purple-500 text-purple-700`;default:return`rounded bg-gray-100 border-gray-500 text-gray-700`}},xe=(0,q.useMemo)(()=>f.map(e=>({id:e.id,x:e.position.x,y:e.position.y,width:pt,height:mt,selected:g.isSelected(e.id)||e.id===b})),[f,g,b]);(0,q.useEffect)(()=>{let e=ne.current;if(!e)return;let t=e=>{let t=e.target?.tagName;if(t===`INPUT`||t===`TEXTAREA`||t===`SELECT`)return;let n=e.ctrlKey||e.metaKey;if(n&&e.key===`z`&&!e.shiftKey){e.preventDefault(),d.undo();return}if(n&&e.key===`y`||n&&e.key===`z`&&e.shiftKey){e.preventDefault(),d.redo();return}if(n&&e.key===`c`){e.preventDefault(),B();return}if(n&&e.key===`v`){e.preventDefault(),oe();return}if(e.key===`Delete`||e.key===`Backspace`){g.count>0?(e.preventDefault(),ie()):b&&(e.preventDefault(),z(b));return}if(e.key===`Escape`){T?(E(!1),O(null)):(x(null),g.clearSelection());return}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[b,T,g,d,B,oe,z,ie]);let Se=(0,q.useCallback)(e=>{e.target===e.currentTarget&&(x(null),g.clearSelection(),T&&(E(!1),O(null)))},[T,g]);return(0,J.jsxs)(`div`,{ref:ne,tabIndex:0,className:ft(`flex flex-col h-full w-full border rounded-lg overflow-hidden bg-background`,u),children:[(0,J.jsx)(Ze,{isOpen:h.isOpen,title:h.title,message:h.message,onConfirm:h.onConfirm,onCancel:h.onCancel,destructive:!0}),o&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2 p-2 border-b bg-muted/20`,role:`toolbar`,"aria-label":`Process toolbar`,children:[(0,J.jsx)(S,{className:`h-4 w-4`}),(0,J.jsx)(`span`,{className:`font-medium text-sm`,"aria-label":`Process name`,children:e}),y?.isConnected&&(0,J.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,role:`status`,"aria-label":`Collaboration active`,children:[(0,J.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-green-500`}),y.users.length,` user`,y.users.length===1?``:`s`]}),(0,J.jsx)(`div`,{className:`flex-1`}),!s&&(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(`button`,{onClick:()=>d.undo(),disabled:!d.canUndo,className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent disabled:opacity-40`,title:`Undo (Ctrl+Z)`,"aria-label":`Undo`,children:(0,J.jsx)(ae,{className:`h-3 w-3`})}),(0,J.jsx)(`button`,{onClick:()=>d.redo(),disabled:!d.canRedo,className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent disabled:opacity-40`,title:`Redo (Ctrl+Y)`,"aria-label":`Redo`,children:(0,J.jsx)(ee,{className:`h-3 w-3`})}),(0,J.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`}),(0,J.jsx)(`button`,{onClick:B,disabled:g.count===0&&!b,className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent disabled:opacity-40`,title:`Copy (Ctrl+C)`,"aria-label":`Copy`,children:(0,J.jsx)(me,{className:`h-3 w-3`})}),(0,J.jsx)(`button`,{onClick:oe,disabled:!_.hasContent,className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent disabled:opacity-40`,title:`Paste (Ctrl+V)`,"aria-label":`Paste`,children:(0,J.jsx)(Ie,{className:`h-3 w-3`})}),(0,J.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`}),(0,J.jsxs)(`button`,{onClick:se,className:ft(`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,T&&`bg-primary text-primary-foreground`),title:`Connect nodes`,"aria-label":`Connect nodes`,"aria-pressed":T,children:[(0,J.jsx)(M,{className:`h-3 w-3`}),` Connect`]}),(0,J.jsxs)(`button`,{onClick:le,className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:`Auto layout`,"aria-label":`Auto layout`,children:[(0,J.jsx)(pe,{className:`h-3 w-3`}),` Layout`]}),(0,J.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`}),(0,J.jsx)(`button`,{onClick:v.zoomIn,className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:`Zoom in`,"aria-label":`Zoom in`,children:(0,J.jsx)(C,{className:`h-3 w-3`})}),(0,J.jsxs)(`span`,{className:`text-xs tabular-nums min-w-[3ch] text-center`,"aria-label":`Zoom level`,children:[Math.round(v.zoom*100),`%`]}),(0,J.jsx)(`button`,{onClick:v.zoomOut,className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:`Zoom out`,"aria-label":`Zoom out`,children:(0,J.jsx)(w,{className:`h-3 w-3`})}),(0,J.jsx)(`button`,{onClick:v.resetZoom,className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:`Reset zoom`,"aria-label":`Reset zoom`,children:(0,J.jsx)(ze,{className:`h-3 w-3`})}),(0,J.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`}),(0,J.jsxs)(`button`,{onClick:()=>R(`start-event`,`Start`),className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:`Add Start Event`,"aria-label":`Add Start Event`,children:[(0,J.jsx)(U,{className:`h-3 w-3 text-green-600`}),` Start`]}),(0,J.jsxs)(`button`,{onClick:()=>R(`user-task`,`User Task`),className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:`Add User Task`,"aria-label":`Add User Task`,children:[(0,J.jsx)(ye,{className:`h-3 w-3 text-blue-600`}),` Task`]}),(0,J.jsxs)(`button`,{onClick:()=>R(`exclusive-gateway`,`Decision`),className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:`Add Gateway`,"aria-label":`Add Gateway`,children:[(0,J.jsx)(we,{className:`h-3 w-3 text-yellow-600`}),` Gateway`]}),(0,J.jsxs)(`button`,{onClick:()=>R(`end-event`,`End`),className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:`Add End Event`,"aria-label":`Add End Event`,children:[(0,J.jsx)(ye,{className:`h-3 w-3 text-red-600`}),` End`]}),(0,J.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`}),(0,J.jsx)(`button`,{onClick:()=>N(e=>!e),className:`flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent`,title:j?`Hide properties`:`Show properties`,"aria-label":j?`Hide property panel`:`Show property panel`,"aria-expanded":j,children:j?(0,J.jsx)(ve,{className:`h-3 w-3`}):(0,J.jsx)(he,{className:`h-3 w-3`})})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[(0,J.jsx)(`div`,{className:`flex-1 overflow-auto bg-muted/10 p-4`,role:`region`,"aria-label":`Process canvas`,onWheel:v.handleWheel,onMouseDown:v.startPan,children:(0,J.jsxs)(`div`,{className:`relative`,style:{...v.transformStyle,width:i.width,minHeight:i.height,backgroundImage:i.showGrid?`radial-gradient(circle, hsl(var(--border)) 1px, transparent 1px)`:void 0,backgroundSize:i.showGrid?`20px 20px`:void 0},onClick:Se,onDrop:de,onDragOver:fe,children:[(0,J.jsxs)(`svg`,{className:`absolute inset-0 pointer-events-none`,width:i.width,height:i.height,children:[(0,J.jsx)(`defs`,{children:(0,J.jsx)(`marker`,{id:`arrowhead`,markerWidth:`10`,markerHeight:`7`,refX:`10`,refY:`3.5`,orient:`auto`,children:(0,J.jsx)(`polygon`,{points:`0 0, 10 3.5, 0 7`,fill:`hsl(var(--foreground))`})})}),p.map(e=>{let t=f.find(t=>t.id===e.source),n=f.find(t=>t.id===e.target);if(!t||!n)return null;t.position.x+pt/2;let r=t.position.y+mt/2;n.position.x+pt/2;let i=n.position.y+mt/2,a=t.position.x+pt,o=r,s=n.position.x,c=i;return(0,J.jsxs)(`g`,{children:[(0,J.jsx)(`path`,{d:`M ${a} ${o} Q ${(a+s)/2} ${o}, ${(a+s)/2} ${(o+c)/2} T ${s} ${c}`,fill:`none`,stroke:`hsl(var(--foreground) / 0.5)`,strokeWidth:`2`,markerEnd:`url(#arrowhead)`}),e.label&&(0,J.jsx)(`text`,{x:(a+s)/2,y:(o+c)/2-8,textAnchor:`middle`,className:`text-[10px] fill-muted-foreground`,children:e.label})]},e.id)})]}),f.length===0&&(0,J.jsx)(`div`,{className:`flex items-center justify-center h-full min-h-[200px] text-muted-foreground text-sm`,children:`No nodes in the process. Use the toolbar buttons to add start events, tasks, gateways, and end events.`}),f.map(e=>{let t=g.isSelected(e.id)||b===e.id,n=D===e.id,r=k===e.id,i=T||r;return(0,J.jsxs)(`div`,{className:`absolute select-none`,style:{left:e.position.x,top:e.position.y},role:`group`,"aria-label":e.label,draggable:!s&&!T,onDragStart:t=>ue(t,e.id),onMouseEnter:()=>A(e.id),onMouseLeave:()=>A(null),onClick:t=>{ce(e.id)||(t.shiftKey?g.toggle(e.id,!0):(x(e.id),g.selectOne(e.id)))},children:[(0,J.jsx)(`div`,{className:ft(`flex items-center justify-center border-2 min-w-[120px] min-h-[50px] px-3 py-2 transition-shadow`,be(e.type),t&&`ring-2 ring-primary shadow-md`,n&&`ring-2 ring-blue-400 shadow-lg`,T&&!n&&`cursor-crosshair`),children:(0,J.jsx)(`span`,{className:ft(`text-xs font-medium`,(e.type===`exclusive-gateway`||e.type===`parallel-gateway`||e.type===`inclusive-gateway`||e.type===`event-based-gateway`)&&`-rotate-45`),children:e.label})}),i&&!s&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`absolute w-3 h-3 rounded-full bg-blue-500 border-2 border-white shadow cursor-crosshair`,style:{left:-6,top:mt/2-6},title:`Input port`,onClick:t=>{t.stopPropagation(),ce(e.id)}}),(0,J.jsx)(`div`,{className:`absolute w-3 h-3 rounded-full bg-blue-500 border-2 border-white shadow cursor-crosshair`,style:{right:-6,top:mt/2-6},title:`Output port`,onClick:t=>{t.stopPropagation(),T?ce(e.id):(E(!0),O(e.id))}}),(0,J.jsx)(`div`,{className:`absolute w-3 h-3 rounded-full bg-blue-400 border-2 border-white shadow cursor-crosshair`,style:{left:pt/2-6,top:-6},title:`Port`,onClick:t=>{t.stopPropagation(),ce(e.id)}}),(0,J.jsx)(`div`,{className:`absolute w-3 h-3 rounded-full bg-blue-400 border-2 border-white shadow cursor-crosshair`,style:{left:pt/2-6,bottom:-6},title:`Port`,onClick:t=>{t.stopPropagation(),ce(e.id)}})]}),!s&&t&&!T&&(0,J.jsx)(`button`,{onClick:t=>{t.stopPropagation(),z(e.id)},className:`absolute -top-2 -right-2 p-0.5 rounded-full bg-destructive text-destructive-foreground shadow`,"aria-label":`Delete node`,children:(0,J.jsx)(V,{className:`h-3 w-3`})})]},e.id)}),a&&f.length>0&&(0,J.jsx)(nt,{items:xe,canvasWidth:i.width??1400,canvasHeight:i.height??800,position:`bottom-right`})]})}),j&&!s&&(0,J.jsx)(`div`,{className:`w-64 border-l bg-background overflow-y-auto shrink-0`,role:`complementary`,"aria-label":`Property panel`,children:(0,J.jsx)($e,{title:H?`Properties: ${H.label}`:`Properties`,fields:ge,onChange:_e})})]})]})}function X(...e){return W(G(e))}var Z={untitledReport:`Untitled Report`,reportCanvas:`Report canvas`,properties:`Properties`,propertiesPanel:`Properties panel`,designerToolbar:`Report designer toolbar`,selectElementPrompt:`Select an element to edit its properties`,addElementsPrompt:`Add elements using the buttons above`,addText:`Add Text`,addField:`Add Field`,addImage:`Add Image`,addChart:`Add Chart`,addTable:`Add Table`,undo:`Undo`,undoShortcut:`Undo (Ctrl+Z)`,redo:`Redo`,redoShortcut:`Redo (Ctrl+Shift+Z)`,copy:`Copy`,copyShortcut:`Copy (Ctrl+C)`,paste:`Paste`,pasteShortcut:`Paste (Ctrl+V)`,deleteSelected:`Delete selected`,deleteElement:`Delete element`,deleteElementsTitle:`Delete elements`,deleteElementMessage:e=>`Are you sure you want to delete ${e} element${e>1?`s`:``}?`,collapsePanel:`Collapse panel`,expandPanel:`Expand panel`,collaborationConnected:`Connected`,sectionHeader:`Report Header`,sectionPageHeader:`Page Header`,sectionGroupHeader:`Group Header`,sectionDetail:`Detail`,sectionGroupFooter:`Group Footer`,sectionPageFooter:`Page Footer`,sectionFooter:`Report Footer`,elementText:`Text`,elementImage:`🖼 Image`,elementChart:`📊 Chart`,elementTable:`📋 Table`,propLabel:`Label`,propX:`X`,propY:`Y`,propWidth:`Width`,propHeight:`Height`,propText:`Text`,propField:`Field`,groupPosition:`Position`,groupSize:`Size`,groupContent:`Content`,groupGeneral:`General`},_t={A4:{width:595,height:842},A3:{width:842,height:1191},Letter:{width:612,height:792},Legal:{width:612,height:1008},Tabloid:{width:792,height:1224}},vt=[{type:`header`,height:80,elements:[]},{type:`detail`,height:400,elements:[],repeat:!0},{type:`footer`,height:60,elements:[]}];function yt({reportName:e=Z.untitledReport,objectName:t,pageSize:n=`A4`,orientation:r=`portrait`,margins:i={top:40,right:40,bottom:40,left:40},sections:a=[],showToolbar:o=!0,showPropertyPanel:s=!0,readOnly:c=!1,onSectionsChange:l,className:u}){let d=Ge(a.length>0?a:vt),f=d.current,p=(0,q.useCallback)(e=>{d.push(e),l?.(e)},[d,l]),m=qe(),h=(0,q.useMemo)(()=>{let e=Array.from(m.selectedIds);return e.length>0?e[0]:null},[m.selectedIds]),g=Je(),_=Ke(),v=it(),y=(0,q.useCallback)(e=>{v&&v.sendOperation({...e,userId:v.currentUserId??``})},[v]),[b,x]=(0,q.useState)(!0),S=(0,q.useRef)(null),C=(0,q.useRef)(null),w=_t[n],T=r===`landscape`?w.height:w.width,E=r===`landscape`?w.width:w.height,O=e=>{switch(e){case`header`:return Z.sectionHeader;case`page-header`:return Z.sectionPageHeader;case`group-header`:return Z.sectionGroupHeader;case`detail`:return Z.sectionDetail;case`group-footer`:return Z.sectionGroupFooter;case`page-footer`:return Z.sectionPageFooter;case`footer`:return Z.sectionFooter;default:return e}},k=(0,q.useMemo)(()=>h?f.flatMap(e=>e.elements).find(e=>e.id===h):null,[h,f]),A=(0,q.useCallback)((e,t)=>{if(c)return;let n={id:`elem-${Date.now()}`,type:t,position:{x:i.left,y:10,width:200,height:30},properties:{text:t===`text`?`New Text`:void 0,field:t===`field`?`field_name`:void 0}},r=f.map((t,r)=>r===e?{...t,elements:[...t.elements,n]}:t);p(r),m.selectOne(n.id),y({type:`insert`,elementId:n.id,data:{element:n}})},[f,i.left,c,p,m,y]),M=(0,q.useCallback)(e=>{if(c)return;let t=f.map(t=>({...t,elements:t.elements.filter(t=>t.id!==e)}));p(t),m.isSelected(e)&&m.clearSelection(),y({type:`delete`,elementId:e,data:{}})},[f,c,p,m,y]),N=(0,q.useCallback)(async()=>{if(c||m.count===0||!await _.confirm(Z.deleteElementsTitle,Z.deleteElementMessage(m.count)))return;let e=m.selectedIds,t=f.map(t=>({...t,elements:t.elements.filter(t=>!e.has(t.id))}));p(t),m.clearSelection(),e.forEach(e=>{y({type:`delete`,elementId:e,data:{}})})},[c,m,_,f,p,y]),P=(0,q.useCallback)((e,t)=>{if(c||!h)return;let n=f.map(n=>({...n,elements:n.elements.map(n=>n.id===h?e===`x`?{...n,position:{...n.position,x:Number(t)}}:e===`y`?{...n,position:{...n.position,y:Number(t)}}:e===`width`?{...n,position:{...n.position,width:Number(t)}}:e===`height`?{...n,position:{...n.position,height:Number(t)}}:{...n,properties:{...n.properties,[e]:t}}:n)}));p(n),y({type:`update`,elementId:h,data:{[e]:t}})},[c,h,f,p,y]),F=(0,q.useCallback)(()=>{let e=m.selectedIds;if(e.size===0)return;let t=f.flatMap(e=>e.elements).filter(t=>e.has(t.id));g.copy(t)},[m,f,g]),I=(0,q.useCallback)(()=>{if(c)return;let e=g.paste();if(!e||e.length===0)return;let t=0,n=e.map(e=>({...e,id:`elem-${Date.now()}-${++t}-${Math.random().toString(36).slice(2,7)}`,position:{...e.position,x:e.position.x+20,y:e.position.y+20}})),r=f.findIndex(e=>e.type===`detail`),i=r>=0?r:0,a=f.map((e,t)=>t===i?{...e,elements:[...e.elements,...n]}:e);p(a),m.selectMany(n.map(e=>e.id)),n.forEach(e=>{y({type:`insert`,elementId:e.id,data:{element:e}})})},[c,g,f,p,m,y]),te=(0,q.useCallback)((e,t,n)=>{c||(S.current={id:t.id,sectionIndex:n,startX:e.clientX,startY:e.clientY},e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t.id))},[c]),ne=(0,q.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`},[]),re=(0,q.useCallback)((e,t)=>{e.preventDefault();let n=S.current;if(!n||c)return;let r=e.clientX-n.startX,i=e.clientY-n.startY;if(n.sectionIndex===t){let e=f.map((e,a)=>a===t?{...e,elements:e.elements.map(e=>e.id===n.id?{...e,position:{...e.position,x:Math.max(0,e.position.x+r),y:Math.max(0,(typeof e.position.y==`number`?e.position.y:0)+i)}}:e)}:e);p(e)}else{let e=null,i=f.map((t,i)=>{if(i!==n.sectionIndex)return t;let a=t.elements.find(e=>e.id===n.id);return a&&(e={...a,position:{...a.position,x:Math.max(0,a.position.x+r),y:10}}),{...t,elements:t.elements.filter(e=>e.id!==n.id)}});if(e){let n=i.map((n,r)=>r===t?{...n,elements:[...n.elements,e]}:n);p(n)}}y({type:`move`,elementId:n.id,data:{}}),S.current=null},[c,f,p,y]),R=(0,q.useMemo)(()=>{if(!k)return[];let e=[{name:`x`,label:Z.propX,type:`number`,value:k.position.x,group:Z.groupPosition},{name:`y`,label:Z.propY,type:`number`,value:k.position.y,group:Z.groupPosition},{name:`width`,label:Z.propWidth,type:`number`,value:k.position.width,group:Z.groupSize},{name:`height`,label:Z.propHeight,type:`number`,value:k.position.height,group:Z.groupSize}];return k.type===`text`&&e.push({name:`text`,label:Z.propText,type:`text`,value:k.properties.text??``,group:Z.groupContent}),k.type===`field`&&e.push({name:`field`,label:Z.propField,type:`text`,value:k.properties.field??``,group:Z.groupContent}),e},[k]);return(0,q.useEffect)(()=>{let e=C.current;if(!e)return;let t=e=>{let t=[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.target.tagName),n=e.ctrlKey||e.metaKey;if((e.key===`Delete`||e.key===`Backspace`)&&m.count>0&&!t){e.preventDefault(),N();return}if(e.key===`Escape`){m.clearSelection();return}if(!t){if(n&&e.key===`z`&&!e.shiftKey&&!c){e.preventDefault(),d.undo();return}if(n&&(e.key===`z`&&e.shiftKey||e.key===`y`)&&!c){e.preventDefault(),d.redo();return}if(n&&e.key===`c`){e.preventDefault(),F();return}if(n&&e.key===`v`&&!c){e.preventDefault(),I();return}if(n&&e.key===`a`){e.preventDefault();let t=f.flatMap(e=>e.elements).map(e=>e.id);m.selectMany(t);return}}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[m,N,c,d,F,I,f]),(0,J.jsxs)(`div`,{ref:C,tabIndex:0,className:X(`flex h-full w-full border rounded-lg overflow-hidden bg-background`,u),children:[(0,J.jsxs)(`div`,{className:`flex-1 flex flex-col min-w-0`,children:[o&&(0,J.jsxs)(`div`,{role:`toolbar`,"aria-label":Z.designerToolbar,className:`flex items-center gap-2 p-2 border-b bg-muted/20`,children:[(0,J.jsx)(j,{className:`h-4 w-4`}),(0,J.jsx)(`span`,{className:`font-medium text-sm`,children:e}),t&&(0,J.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t,`)`]}),!c&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`w-px h-5 bg-border mx-1`}),(0,J.jsx)(`button`,{className:X(`p-1.5 rounded hover:bg-accent`,!d.canUndo&&`opacity-40 pointer-events-none`),title:Z.undoShortcut,"aria-label":Z.undo,disabled:!d.canUndo,onClick:()=>d.undo(),children:(0,J.jsx)(ae,{className:`h-4 w-4`})}),(0,J.jsx)(`button`,{className:X(`p-1.5 rounded hover:bg-accent`,!d.canRedo&&`opacity-40 pointer-events-none`),title:Z.redoShortcut,"aria-label":Z.redo,disabled:!d.canRedo,onClick:()=>d.redo(),children:(0,J.jsx)(ee,{className:`h-4 w-4`})}),(0,J.jsx)(`div`,{className:`w-px h-5 bg-border mx-1`})]}),!c&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{className:X(`p-1.5 rounded hover:bg-accent`,m.count===0&&`opacity-40 pointer-events-none`),title:Z.copyShortcut,"aria-label":Z.copy,disabled:m.count===0,onClick:F,children:(0,J.jsx)(me,{className:`h-4 w-4`})}),(0,J.jsx)(`button`,{className:X(`p-1.5 rounded hover:bg-accent`,!g.hasContent&&`opacity-40 pointer-events-none`),title:Z.pasteShortcut,"aria-label":Z.paste,disabled:!g.hasContent,onClick:I,children:(0,J.jsx)(Ie,{className:`h-4 w-4`})}),(0,J.jsx)(`div`,{className:`w-px h-5 bg-border mx-1`})]}),!c&&(0,J.jsx)(`button`,{className:X(`p-1.5 rounded hover:bg-accent`,m.count===0&&`opacity-40 pointer-events-none`),title:Z.deleteSelected,"aria-label":Z.deleteSelected,disabled:m.count===0,onClick:N,children:(0,J.jsx)(V,{className:`h-4 w-4`})}),(0,J.jsx)(`div`,{className:`flex-1`}),v?.isConnected&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-green-500`}),Z.collaborationConnected,v.users.length>1&&` (${v.users.length})`]}),(0,J.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[n,` `,r]}),s&&(0,J.jsx)(`button`,{className:`p-1.5 rounded hover:bg-accent`,title:b?Z.collapsePanel:Z.expandPanel,"aria-label":b?Z.collapsePanel:Z.expandPanel,onClick:()=>x(e=>!e),children:(0,J.jsx)(ve,{className:X(`h-4 w-4`,!b&&`rotate-180`)})})]}),(0,J.jsx)(`div`,{role:`region`,"aria-label":Z.reportCanvas,className:`flex-1 overflow-auto bg-muted/10 p-4 flex justify-center`,children:(0,J.jsx)(`div`,{className:`bg-white shadow-lg border`,style:{width:T,minHeight:E},children:f.map((e,t)=>(0,J.jsxs)(`div`,{className:`relative border-b border-dashed border-gray-300`,style:{minHeight:e.height},onDragOver:ne,onDrop:e=>re(e,t),children:[(0,J.jsxs)(`div`,{className:`absolute left-0 top-0 px-2 py-0.5 bg-muted text-xs text-muted-foreground border-r border-b rounded-br`,children:[O(e.type),e.repeat&&` ↻`]}),!c&&(0,J.jsxs)(`div`,{className:`absolute right-1 top-0 flex items-center gap-0.5`,children:[(0,J.jsx)(`button`,{onClick:()=>A(t,`text`),className:`p-0.5 rounded hover:bg-accent`,title:Z.addText,"aria-label":Z.addText,children:(0,J.jsx)(D,{className:`h-3 w-3`})}),(0,J.jsx)(`button`,{onClick:()=>A(t,`field`),className:`p-0.5 rounded hover:bg-accent`,title:Z.addField,"aria-label":Z.addField,children:(0,J.jsx)(L,{className:`h-3 w-3`})}),(0,J.jsx)(`button`,{onClick:()=>A(t,`image`),className:`p-0.5 rounded hover:bg-accent`,title:Z.addImage,"aria-label":Z.addImage,children:(0,J.jsx)(Ne,{className:`h-3 w-3`})}),(0,J.jsx)(`button`,{onClick:()=>A(t,`chart`),className:`p-0.5 rounded hover:bg-accent`,title:Z.addChart,"aria-label":Z.addChart,children:(0,J.jsx)(ue,{className:`h-3 w-3`})}),(0,J.jsx)(`button`,{onClick:()=>A(t,`table`),className:`p-0.5 rounded hover:bg-accent`,title:Z.addTable,"aria-label":Z.addTable,children:(0,J.jsx)(Te,{className:`h-3 w-3`})})]}),(0,J.jsxs)(`div`,{className:`relative`,style:{minHeight:e.height,paddingTop:24},children:[e.elements.length===0&&(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground text-center pt-4`,children:Z.addElementsPrompt}),e.elements.map(e=>{let n=m.isSelected(e.id);return(0,J.jsxs)(`div`,{draggable:!c,onDragStart:n=>te(n,e,t),className:X(`absolute border rounded px-2 py-1 text-xs cursor-pointer`,n?`border-primary ring-1 ring-primary/30 bg-primary/5`:`border-dashed border-gray-400 hover:border-primary/50`),style:{left:e.position.x,top:(typeof e.position.y==`number`?e.position.y:0)+24,width:e.position.width,height:e.position.height},onClick:t=>m.toggle(e.id,t.shiftKey),children:[(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.type===`text`&&(e.properties.text??Z.elementText),e.type===`field`&&`{${e.properties.field??`field`}}`,e.type===`image`&&Z.elementImage,e.type===`chart`&&Z.elementChart,e.type===`table`&&Z.elementTable]}),!c&&n&&(0,J.jsx)(`button`,{onClick:t=>{t.stopPropagation(),M(e.id)},className:`absolute -top-2 -right-2 p-0.5 rounded-full bg-destructive text-destructive-foreground shadow`,"aria-label":Z.deleteElement,children:(0,J.jsx)(V,{className:`h-2.5 w-2.5`})})]},e.id)})]})]},`${e.type}-${t}`))})})]}),s&&(0,J.jsx)(`div`,{role:`region`,"aria-label":Z.propertiesPanel,className:X(`border-l bg-muted/30 flex flex-col transition-[width] duration-200`,b?`w-56`:`w-0 overflow-hidden`),children:b&&(h&&k?(0,J.jsx)($e,{title:`${Z.properties} – ${k.type}`,fields:R,onChange:P}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`p-3 border-b font-medium text-sm`,children:Z.properties}),(0,J.jsx)(`div`,{className:`flex-1 overflow-y-auto p-3`,children:(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground text-center py-4`,children:Z.selectElementPrompt})})]}))}),(0,J.jsx)(Ze,{isOpen:_.isOpen,title:_.title,message:_.message,onConfirm:_.onConfirm,onCancel:_.onCancel})]})}var bt={"appDesigner.basicInfo":`Basic Info`,"appDesigner.objects":`Objects`,"appDesigner.navigation":`Navigation`,"appDesigner.branding":`Branding`,"appDesigner.stepBasicDesc":`Name, title, and layout`,"appDesigner.stepObjectsDesc":`Select business objects`,"appDesigner.stepNavigationDesc":`Build navigation tree`,"appDesigner.stepBrandingDesc":`Logo, colors, and favicon`,"appDesigner.appName":`App Name`,"appDesigner.appTitle":`Title`,"appDesigner.appDescription":`Description`,"appDesigner.appIcon":`Icon`,"appDesigner.template":`Template`,"appDesigner.layout":`Layout`,"appDesigner.layoutSidebar":`Sidebar`,"appDesigner.layoutHeader":`Header`,"appDesigner.layoutEmpty":`Empty`,"appDesigner.snakeCaseHint":`Must be snake_case (e.g. my_app)`,"appDesigner.searchObjects":`Search objects…`,"appDesigner.selectAll":`Select All`,"appDesigner.deselectAll":`Deselect All`,"appDesigner.noObjectsFound":`No objects found.`,"appDesigner.addGroup":`Add Group`,"appDesigner.addUrl":`Add URL`,"appDesigner.addSeparator":`Add Separator`,"appDesigner.noNavItemsHint":`No navigation items yet. Select objects in the previous step or add items manually.`,"appDesigner.separatorLabel":`— Separator —`,"appDesigner.newGroup":`New Group`,"appDesigner.newLink":`New Link`,"appDesigner.logoUrl":`Logo URL`,"appDesigner.primaryColor":`Primary Color`,"appDesigner.faviconUrl":`Favicon URL`,"appDesigner.preview":`Preview`,"common.cancel":`Cancel`,"common.back":`Back`,"common.next":`Next`,"common.close":`Close`,"appDesigner.complete":`Complete`,"appDesigner.saveDraft":`Save Draft`,"appDesigner.cancelConfirmTitle":`Discard changes?`,"appDesigner.cancelConfirmMessage":`You have unsaved changes. Are you sure you want to cancel?`,"appDesigner.confirmDiscard":`Discard`,"appDesigner.keepEditing":`Keep Editing`,"appDesigner.navNoItems":`No navigation items. Click buttons above to add items.`,"appDesigner.navNoPreviewItems":`No items`,"appDesigner.navLivePreview":`Live Preview`,"appDesigner.navCollapseGroup":`Collapse group`,"appDesigner.navExpandGroup":`Expand group`,"appDesigner.navAddChild":`Add child`,"appDesigner.navMoveUp":`Move up`,"appDesigner.navMoveDown":`Move down`,"appDesigner.navRemove":`Remove`,"appDesigner.navObjectPage":`Object Page`,"appDesigner.navDashboard":`Dashboard`,"appDesigner.navPage":`Page`,"appDesigner.navReport":`Report`,"appDesigner.navGroup":`Group`,"appDesigner.navUrl":`URL`,"appDesigner.navSeparator":`Separator`,"appDesigner.navTypeObject":`Object`,"appDesigner.navTypeDashboard":`Dashboard`,"appDesigner.navTypePage":`Page`,"appDesigner.navTypeReport":`Report`,"appDesigner.navTypeUrl":`URL`,"appDesigner.navTypeGroup":`Group`,"appDesigner.navTypeSeparator":`Separator`,"appDesigner.navTypeAction":`Action`,"appDesigner.navEditIcon":`Edit icon`,"appDesigner.navToggleVisible":`Toggle visibility`,"appDesigner.navHidden":`Hidden`,"appDesigner.navExportSchema":`Export JSON`,"appDesigner.navImportSchema":`Import JSON`,"appDesigner.navExportSuccess":`Navigation schema exported`,"appDesigner.navImportSuccess":`Navigation schema imported`,"appDesigner.navImportError":`Invalid navigation JSON`,"appDesigner.navIconPlaceholder":`Icon name (e.g. Users)`,"appDesigner.dashboardEditor":`Dashboard Editor`,"appDesigner.noWidgets":`No widgets. Click a button above to add one.`,"appDesigner.widgetLayoutSize":`Layout Size`,"appDesigner.widgetWidth":`Width`,"appDesigner.widgetHeight":`Height`,"appDesigner.dashboardPreview":`Dashboard Preview`,"appDesigner.noWidgetsPreview":`No widgets to preview`,"appDesigner.pageCanvasEditor":`Page Canvas Editor`,"appDesigner.emptyPage":`Empty page. Click a button above to add a component.`,"appDesigner.pagePreview":`Page Preview`,"appDesigner.noComponentsPreview":`No components to preview`,"appDesigner.modePage":`Page`,"appDesigner.modeDashboard":`Dashboard`,"appDesigner.undo":`Undo`,"appDesigner.redo":`Redo`,"appDesigner.brandingEditor":`Branding Editor`,"appDesigner.brandingExport":`Export JSON`,"appDesigner.brandingImport":`Import JSON`,"appDesigner.brandingPreview":`Preview`,"appDesigner.brandingSampleButton":`Sample Button`,"appDesigner.brandingSampleText":`This is how your brand theme will look.`,"appDesigner.colorPalette":`Color Palette`,"appDesigner.fontFamily":`Font Family`,"appDesigner.fontDefault":`Default (System)`,"appDesigner.modeLight":`Light`,"appDesigner.modeDark":`Dark`,"appDesigner.mobilePreview":`Mobile Preview`,"appDesigner.objectManager.title":`Object Manager`,"appDesigner.objectManager.addObject":`New Object`,"appDesigner.objectManager.searchPlaceholder":`Search objects…`,"appDesigner.objectManager.noObjects":`No objects found.`,"appDesigner.objectManager.objectName":`API Name`,"appDesigner.objectManager.objectLabel":`Label`,"appDesigner.objectManager.pluralLabel":`Plural Label`,"appDesigner.objectManager.icon":`Icon`,"appDesigner.objectManager.selectIcon":`Select icon…`,"appDesigner.objectManager.group":`Group`,"appDesigner.objectManager.noGroup":`No Group`,"appDesigner.objectManager.sortOrder":`Sort Order`,"appDesigner.objectManager.enabled":`Enabled`,"appDesigner.objectManager.relationships":`Relationships`,"appDesigner.objectManager.systemBadge":`System`,"appDesigner.objectManager.fieldCount":`{{count}} fields`,"appDesigner.objectManager.ungrouped":`Ungrouped`,"appDesigner.objectManager.deleteConfirmTitle":`Delete Object?`,"appDesigner.objectManager.deleteConfirmMessage":`This will permanently delete the object and all its fields. This action cannot be undone.`,"appDesigner.fieldDesigner.title":`Field Designer`,"appDesigner.fieldDesigner.addField":`New Field`,"appDesigner.fieldDesigner.searchPlaceholder":`Search fields…`,"appDesigner.fieldDesigner.allTypes":`All Types`,"appDesigner.fieldDesigner.noFields":`No fields found.`,"appDesigner.fieldDesigner.fieldName":`API Name`,"appDesigner.fieldDesigner.fieldLabel":`Label`,"appDesigner.fieldDesigner.fieldType":`Type`,"appDesigner.fieldDesigner.fieldGroup":`Group`,"appDesigner.fieldDesigner.description":`Description`,"appDesigner.fieldDesigner.required":`Required`,"appDesigner.fieldDesigner.unique":`Unique`,"appDesigner.fieldDesigner.readOnly":`Read Only`,"appDesigner.fieldDesigner.hidden":`Hidden`,"appDesigner.fieldDesigner.indexed":`Indexed`,"appDesigner.fieldDesigner.externalId":`External ID`,"appDesigner.fieldDesigner.trackHistory":`Track History`,"appDesigner.fieldDesigner.defaultValue":`Default Value`,"appDesigner.fieldDesigner.placeholder":`Placeholder`,"appDesigner.fieldDesigner.referenceTo":`Reference To`,"appDesigner.fieldDesigner.formula":`Formula`,"appDesigner.fieldDesigner.options":`Options`,"appDesigner.fieldDesigner.addOption":`Add Option`,"appDesigner.fieldDesigner.validationRules":`Validation Rules`,"appDesigner.fieldDesigner.addRule":`Add Rule`,"appDesigner.fieldDesigner.systemBadge":`System`,"appDesigner.fieldDesigner.ungrouped":`General`,"appDesigner.fieldDesigner.deleteConfirmTitle":`Delete Field?`,"appDesigner.fieldDesigner.deleteConfirmMessage":`This will permanently delete the field. Existing data in this field will be lost.`,"appDesigner.fieldDesigner.basicSection":`Basic`,"appDesigner.fieldDesigner.typeSpecificSection":`Type Settings`,"appDesigner.fieldDesigner.advancedSection":`Advanced`,"appDesigner.fieldDesigner.typeCategory.text":`Text`,"appDesigner.fieldDesigner.typeCategory.number":`Number`,"appDesigner.fieldDesigner.typeCategory.date":`Date & Time`,"appDesigner.fieldDesigner.typeCategory.choice":`Choice`,"appDesigner.fieldDesigner.typeCategory.relation":`Relation`,"appDesigner.fieldDesigner.typeCategory.advanced":`Advanced`,"common.edit":`Edit`};function xt(e){return(t,n)=>{let r=e[t]||t;if(n)for(let[e,t]of Object.entries(n))r=r.replace(`{{${e}}}`,String(t));return r}}function St(){try{let e=f();return e.t(`appDesigner.basicInfo`)===`appDesigner.basicInfo`?{t:xt(bt)}:{t:e.t}}catch{return{t:xt(bt)}}}function Q(...e){return W(G(e))}var Ct={name:``,title:``,description:``,icon:``,template:``,layout:`sidebar`,objects:[],navigation:[],branding:{logo:``,primaryColor:`#3b82f6`,favicon:``}};function wt(e){return e.filter(e=>e.selected).map(e=>({id:e.name,type:`object`,label:e.pluralLabel||e.label,icon:e.icon,objectName:e.name}))}var Tt=0;function Et(e){return Tt+=1,`${e}_${Date.now()}_${Tt}`}function Dt({steps:e,currentIndex:t,onStepClick:n}){return(0,J.jsx)(`nav`,{className:`flex items-center justify-center gap-0 px-4 py-6`,children:e.map((e,r)=>{let i=r<t,a=r===t;return(0,J.jsxs)(q.Fragment,{children:[r>0&&(0,J.jsx)(`div`,{className:Q(`h-0.5 w-12 sm:w-20`,i?`bg-blue-500`:`bg-gray-200`)}),(0,J.jsxs)(`button`,{type:`button`,"data-testid":`wizard-step-${e.id}`,onClick:()=>n(r),className:Q(`flex flex-col items-center gap-1 outline-none focus-visible:ring-2 focus-visible:ring-blue-400 rounded-lg px-2 py-1`,a&&`cursor-default`,!a&&`cursor-pointer`),children:[(0,J.jsx)(`div`,{className:Q(`flex h-8 w-8 items-center justify-center rounded-full text-sm font-semibold transition-colors`,i&&`bg-blue-500 text-white`,a&&`bg-blue-600 text-white ring-2 ring-blue-300`,!i&&!a&&`bg-gray-200 text-gray-500`),children:i?(0,J.jsx)(z,{className:`h-4 w-4`}):r+1}),(0,J.jsx)(`span`,{className:Q(`text-xs font-medium`,a?`text-blue-600`:`text-gray-500`),children:e.label})]})]},e.id)})})}function Ot({draft:e,templates:t,readOnly:n,onChange:r,t:i}){let a=e.name.length>0&&!c(e.name);return(0,J.jsxs)(`div`,{"data-testid":`wizard-step-basic-content`,className:`mx-auto max-w-lg space-y-5`,children:[(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsxs)(`label`,{htmlFor:`app-name`,className:`block text-sm font-medium text-gray-700`,children:[i(`appDesigner.appName`),` `,(0,J.jsx)(`span`,{className:`text-red-500`,children:`*`})]}),(0,J.jsx)(`input`,{id:`app-name`,"data-testid":`app-name-input`,type:`text`,value:e.name,onChange:e=>r({name:e.target.value}),placeholder:`my_app`,disabled:n,className:Q(`block w-full rounded-md border px-3 py-2 text-sm shadow-sm outline-none transition-colors`,`focus:border-blue-500 focus:ring-1 focus:ring-blue-500`,`disabled:cursor-not-allowed disabled:bg-gray-50`,a?`border-red-400`:`border-gray-300`)}),a&&(0,J.jsx)(`p`,{className:`text-xs text-red-500`,children:i(`appDesigner.snakeCaseHint`)})]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsxs)(`label`,{htmlFor:`app-title`,className:`block text-sm font-medium text-gray-700`,children:[i(`appDesigner.appTitle`),` `,(0,J.jsx)(`span`,{className:`text-red-500`,children:`*`})]}),(0,J.jsx)(`input`,{id:`app-title`,"data-testid":`app-title-input`,type:`text`,value:e.title,onChange:e=>r({title:e.target.value}),placeholder:`My Application`,disabled:n,className:`block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`})]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`app-description`,className:`block text-sm font-medium text-gray-700`,children:i(`appDesigner.appDescription`)}),(0,J.jsx)(`textarea`,{id:`app-description`,"data-testid":`app-description-input`,value:e.description??``,onChange:e=>r({description:e.target.value}),rows:3,disabled:n,className:`block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50 resize-none`})]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`app-icon`,className:`block text-sm font-medium text-gray-700`,children:i(`appDesigner.appIcon`)}),(0,J.jsx)(`input`,{id:`app-icon`,type:`text`,value:e.icon??``,onChange:e=>r({icon:e.target.value}),placeholder:`LayoutDashboard`,disabled:n,className:`block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`})]}),t.length>0&&(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`app-template`,className:`block text-sm font-medium text-gray-700`,children:i(`appDesigner.template`)}),(0,J.jsxs)(`select`,{id:`app-template`,value:e.template??``,onChange:e=>r({template:e.target.value}),disabled:n,className:`block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`,children:[(0,J.jsx)(`option`,{value:``,children:`None`}),t.map(e=>(0,J.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]}),(0,J.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,J.jsx)(`legend`,{className:`text-sm font-medium text-gray-700`,children:i(`appDesigner.layout`)}),(0,J.jsx)(`div`,{className:`flex gap-3`,children:[{value:`sidebar`,labelKey:`appDesigner.layoutSidebar`,Icon:Ee},{value:`header`,labelKey:`appDesigner.layoutHeader`,Icon:pe},{value:`empty`,labelKey:`appDesigner.layoutEmpty`,Icon:oe}].map(({value:t,labelKey:a,Icon:o})=>(0,J.jsxs)(`label`,{"data-testid":`app-layout-${t}`,className:Q(`flex flex-1 cursor-pointer flex-col items-center gap-1.5 rounded-lg border-2 p-3 transition-colors`,e.layout===t?`border-blue-500 bg-blue-50`:`border-gray-200 hover:border-gray-300`,n&&`pointer-events-none opacity-60`),children:[(0,J.jsx)(o,{className:`h-5 w-5 text-gray-600`}),(0,J.jsx)(`span`,{className:`text-xs font-medium text-gray-700`,children:i(a)}),(0,J.jsx)(`input`,{type:`radio`,name:`layout`,value:t,checked:e.layout===t,onChange:()=>r({layout:t}),disabled:n,className:`sr-only`})]},t))})]})]})}function kt({objects:e,readOnly:t,onToggle:n,onToggleAll:r,search:i,onSearchChange:a,t:o}){let s=(0,q.useMemo)(()=>{if(!i)return e;let t=i.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(t)||e.label.toLowerCase().includes(t))},[e,i]),c=e.length>0&&e.every(e=>e.selected);return e.every(e=>!e.selected),(0,J.jsxs)(`div`,{"data-testid":`wizard-step-objects-content`,className:`mx-auto max-w-2xl space-y-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsxs)(`div`,{className:`relative flex-1`,children:[(0,J.jsx)(Se,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-gray-400`}),(0,J.jsx)(`input`,{"data-testid":`object-search`,type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:o(`appDesigner.searchObjects`),className:`block w-full rounded-md border border-gray-300 py-2 pl-9 pr-3 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500`})]}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>r(!c),disabled:t,className:`rounded-md border border-gray-300 px-3 py-2 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,children:o(c?`appDesigner.deselectAll`:`appDesigner.selectAll`)})]}),s.length===0?(0,J.jsx)(`p`,{className:`py-8 text-center text-sm text-gray-400`,children:o(`appDesigner.noObjectsFound`)}):(0,J.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3`,children:s.map(e=>(0,J.jsxs)(`button`,{type:`button`,"data-testid":`object-card-${e.name}`,disabled:t,onClick:()=>n(e.name),className:Q(`flex flex-col items-start gap-1 rounded-lg border-2 p-3 text-left transition-colors`,e.selected?`border-blue-500 bg-blue-50`:`border-gray-200 hover:border-gray-300`,t&&`pointer-events-none opacity-60`),children:[(0,J.jsxs)(`div`,{className:`flex w-full items-center justify-between`,children:[(0,J.jsx)(`span`,{className:`text-sm font-medium text-gray-800`,children:e.label}),(0,J.jsx)(`div`,{className:Q(`flex h-5 w-5 items-center justify-center rounded border transition-colors`,e.selected?`border-blue-500 bg-blue-500 text-white`:`border-gray-300`),children:e.selected&&(0,J.jsx)(z,{className:`h-3 w-3`})})]}),(0,J.jsx)(`span`,{className:`text-xs text-gray-500`,children:e.name}),e.icon&&(0,J.jsx)(`span`,{className:`text-xs text-gray-400`,children:e.icon})]},e.name))})]})}var At={object:`bg-green-100 text-green-700`,group:`bg-purple-100 text-purple-700`,url:`bg-sky-100 text-sky-700`,separator:`bg-gray-100 text-gray-600`,dashboard:`bg-amber-100 text-amber-700`,page:`bg-teal-100 text-teal-700`,report:`bg-rose-100 text-rose-700`,action:`bg-orange-100 text-orange-700`};function jt({items:e,readOnly:t,onAdd:n,onRemove:r,onReorder:i,t:a}){return(0,J.jsxs)(`div`,{"data-testid":`wizard-step-navigation-content`,className:`mx-auto max-w-lg space-y-4`,children:[(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsxs)(`button`,{type:`button`,"data-testid":`add-group-btn`,onClick:()=>n(`group`),disabled:t,className:`inline-flex items-center gap-1.5 rounded-md border border-gray-300 px-3 py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,J.jsx)(_,{className:`h-3.5 w-3.5`}),a(`appDesigner.addGroup`)]}),(0,J.jsxs)(`button`,{type:`button`,"data-testid":`add-url-btn`,onClick:()=>n(`url`),disabled:t,className:`inline-flex items-center gap-1.5 rounded-md border border-gray-300 px-3 py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,J.jsx)(M,{className:`h-3.5 w-3.5`}),a(`appDesigner.addUrl`)]}),(0,J.jsxs)(`button`,{type:`button`,"data-testid":`add-separator-btn`,onClick:()=>n(`separator`),disabled:t,className:`inline-flex items-center gap-1.5 rounded-md border border-gray-300 px-3 py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,J.jsx)(te,{className:`h-3.5 w-3.5`}),a(`appDesigner.addSeparator`)]})]}),e.length===0?(0,J.jsx)(`p`,{className:`py-8 text-center text-sm text-gray-400`,children:a(`appDesigner.noNavItemsHint`)}):(0,J.jsx)(`ul`,{className:`space-y-1.5`,children:e.map((n,o)=>(0,J.jsxs)(`li`,{"data-testid":`nav-item-${n.id}`,className:`flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2`,children:[n.icon&&(0,J.jsx)(`span`,{className:`text-xs text-gray-400`,children:n.icon}),(0,J.jsx)(`span`,{className:`flex-1 truncate text-sm text-gray-800`,children:n.type===`separator`?a(`appDesigner.separatorLabel`):u(n.label)}),(0,J.jsx)(`span`,{className:Q(`rounded-full px-2 py-0.5 text-[10px] font-medium`,At[n.type]??`bg-gray-100 text-gray-600`),children:n.type}),(0,J.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>i(n.id,`up`),disabled:t||o===0,className:`rounded p-0.5 text-gray-400 transition-colors hover:text-gray-700 disabled:opacity-30`,"aria-label":`Move up`,children:(0,J.jsx)(Be,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>i(n.id,`down`),disabled:t||o===e.length-1,className:`rounded p-0.5 text-gray-400 transition-colors hover:text-gray-700 disabled:opacity-30`,"aria-label":`Move down`,children:(0,J.jsx)(B,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>r(n.id),disabled:t,className:`rounded p-0.5 text-gray-400 transition-colors hover:text-red-500 disabled:opacity-30`,"aria-label":`Remove`,children:(0,J.jsx)(V,{className:`h-3.5 w-3.5`})})]})]},n.id))})]})}function Mt({branding:e,title:t,readOnly:n,onChange:r,t:i}){return(0,J.jsxs)(`div`,{"data-testid":`wizard-step-branding-content`,className:`mx-auto max-w-lg space-y-5`,children:[(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`branding-logo`,className:`block text-sm font-medium text-gray-700`,children:i(`appDesigner.logoUrl`)}),(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(Ne,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-gray-400`}),(0,J.jsx)(`input`,{id:`branding-logo`,"data-testid":`branding-logo-input`,type:`text`,value:e.logo??``,onChange:e=>r({logo:e.target.value}),placeholder:`https://example.com/logo.svg`,disabled:n,className:`block w-full rounded-md border border-gray-300 py-2 pl-9 pr-3 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`})]})]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`branding-color`,className:`block text-sm font-medium text-gray-700`,children:i(`appDesigner.primaryColor`)}),(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(de,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-gray-400`}),(0,J.jsx)(`input`,{id:`branding-color`,"data-testid":`branding-color-input`,type:`text`,value:e.primaryColor??`#3b82f6`,onChange:e=>r({primaryColor:e.target.value}),placeholder:`#3b82f6`,disabled:n,className:`block w-full rounded-md border border-gray-300 py-2 pl-9 pr-3 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`})]})]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`branding-favicon`,className:`block text-sm font-medium text-gray-700`,children:i(`appDesigner.faviconUrl`)}),(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(H,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-gray-400`}),(0,J.jsx)(`input`,{id:`branding-favicon`,"data-testid":`branding-favicon-input`,type:`text`,value:e.favicon??``,onChange:e=>r({favicon:e.target.value}),placeholder:`https://example.com/favicon.ico`,disabled:n,className:`block w-full rounded-md border border-gray-300 py-2 pl-9 pr-3 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`})]})]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`span`,{className:`block text-sm font-medium text-gray-700`,children:i(`appDesigner.preview`)}),(0,J.jsxs)(`div`,{className:`rounded-lg border border-gray-200 bg-white p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.logo?(0,J.jsx)(`img`,{src:e.logo,alt:`App logo`,className:`h-8 w-8 rounded object-contain`}):(0,J.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded bg-gray-100 text-xs text-gray-400`,children:`Logo`}),(0,J.jsx)(`span`,{className:`text-sm font-semibold text-gray-800`,children:t||i(`appDesigner.appTitle`)})]}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,J.jsx)(`div`,{className:`h-4 w-4 rounded-full border border-gray-200`,style:{backgroundColor:e.primaryColor||`#3b82f6`}}),(0,J.jsx)(`span`,{className:`text-xs text-gray-500`,children:e.primaryColor||`#3b82f6`})]}),e.favicon&&(0,J.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,J.jsx)(`img`,{src:e.favicon,alt:`Favicon`,className:`h-4 w-4 rounded object-contain`}),(0,J.jsx)(`span`,{className:`text-xs text-gray-500`,children:`Favicon`})]})]})]})]})}function Nt({availableObjects:e=[],templates:t=[],initialDraft:n,onComplete:r,onCancel:i,onSaveDraft:a,readOnly:o=!1,className:s}){let{t:l}=St(),u=Ke(),[d,f]=(0,q.useState)(0),[p,m]=(0,q.useState)(``),[h,g]=(0,q.useState)(()=>({...Ct,objects:e.map(e=>({...e})),...n})),_=(0,q.useMemo)(()=>[{id:`basic`,label:l(`appDesigner.basicInfo`),description:l(`appDesigner.stepBasicDesc`),icon:`Settings`},{id:`objects`,label:l(`appDesigner.objects`),description:l(`appDesigner.stepObjectsDesc`),icon:`Database`},{id:`navigation`,label:l(`appDesigner.navigation`),description:l(`appDesigner.stepNavigationDesc`),icon:`Menu`},{id:`branding`,label:l(`appDesigner.branding`),description:l(`appDesigner.stepBrandingDesc`),icon:`Palette`}],[l]),b=d===0,x=d===_.length-1,S=(0,q.useMemo)(()=>h.name.length>0&&c(h.name)&&h.title.trim().length>0,[h.name,h.title]),C=(0,q.useMemo)(()=>d!==0||S,[d,S]),w=(0,q.useCallback)(e=>{g(t=>({...t,...e}))},[]),T=(0,q.useCallback)(e=>{g(t=>({...t,branding:{...t.branding,...e}}))},[]),E=(0,q.useCallback)(e=>{g(t=>({...t,objects:t.objects.map(t=>t.name===e?{...t,selected:!t.selected}:t)}))},[]),D=(0,q.useCallback)(e=>{g(t=>({...t,objects:t.objects.map(t=>({...t,selected:e}))}))},[]),O=(0,q.useCallback)(e=>{let t={id:Et(e),type:e,label:e===`separator`?``:e===`group`?`New Group`:`New Link`,...e===`group`?{children:[]}:{},...e===`url`?{url:``}:{}};g(e=>({...e,navigation:[...e.navigation,t]}))},[]),A=(0,q.useCallback)(e=>{g(t=>({...t,navigation:t.navigation.filter(t=>t.id!==e)}))},[]),j=(0,q.useCallback)((e,t)=>{g(n=>{let r=[...n.navigation],i=r.findIndex(t=>t.id===e);if(i<0)return n;let a=t===`up`?i-1:i+1;return a<0||a>=r.length?n:([r[i],r[a]]=[r[a],r[i]],{...n,navigation:r})})},[]),M=(0,q.useCallback)(()=>{x||(d===1&&g(e=>({...e,navigation:wt(e.objects)})),f(e=>e+1))},[d,x]),N=(0,q.useCallback)(()=>{b||f(e=>e-1)},[b]),ee=(0,q.useCallback)(()=>{r?.(h)},[h,r]),P=(0,q.useCallback)(async()=>{(h.name.length>0||h.title.length>0)&&i?await u.confirm(l(`appDesigner.cancelConfirmTitle`),l(`appDesigner.cancelConfirmMessage`))&&i():i?.()},[h.name,h.title,i,u,l]),F=(0,q.useCallback)(()=>{a?.(h)},[h,a]),I=(0,q.useCallback)(e=>{e<=d?f(e):e===d+1&&C&&(d===1&&e===2&&g(e=>({...e,navigation:wt(e.objects)})),f(e))},[d,C]);return(0,J.jsxs)(`div`,{className:Q(`flex h-full flex-col rounded-xl border border-gray-200 bg-white shadow-sm`,s),children:[u.isOpen&&(0,J.jsx)(`div`,{"data-testid":`cancel-confirm-dialog`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40`,role:`dialog`,"aria-modal":`true`,children:(0,J.jsxs)(`div`,{className:`mx-4 w-full max-w-sm rounded-lg bg-white p-6 shadow-xl`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,J.jsx)(`h3`,{className:`text-base font-semibold text-gray-900`,children:u.title}),(0,J.jsx)(`button`,{type:`button`,onClick:u.onCancel,className:`rounded p-1 text-gray-400 hover:text-gray-600`,"aria-label":l(`common.close`),children:(0,J.jsx)(v,{className:`h-4 w-4`})})]}),(0,J.jsx)(`p`,{className:`mt-2 text-sm text-gray-600`,children:u.message}),(0,J.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,J.jsx)(`button`,{type:`button`,"data-testid":`cancel-confirm-keep`,onClick:u.onCancel,className:`rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50`,children:l(`appDesigner.keepEditing`)}),(0,J.jsx)(`button`,{type:`button`,"data-testid":`cancel-confirm-discard`,onClick:u.onConfirm,className:`rounded-md bg-red-600 px-3 py-1.5 text-sm font-medium text-white transition-colors hover:bg-red-700`,children:l(`appDesigner.confirmDiscard`)})]})]})}),(0,J.jsx)(`div`,{className:`border-b border-gray-100`,children:(0,J.jsx)(Dt,{steps:_,currentIndex:d,onStepClick:I})}),(0,J.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6`,children:[d===0&&(0,J.jsx)(Ot,{draft:h,templates:t,readOnly:o,onChange:w,t:l}),d===1&&(0,J.jsx)(kt,{objects:h.objects,readOnly:o,onToggle:E,onToggleAll:D,search:p,onSearchChange:m,t:l}),d===2&&(0,J.jsx)(jt,{items:h.navigation,readOnly:o,onAdd:O,onRemove:A,onReorder:j,t:l}),d===3&&(0,J.jsx)(Mt,{branding:h.branding,title:h.title,readOnly:o,onChange:T,t:l})]}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between border-t border-gray-100 px-6 py-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`button`,{type:`button`,"data-testid":`wizard-cancel`,onClick:P,disabled:o,className:`rounded-md px-4 py-2 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50`,children:l(`common.cancel`)}),a&&(0,J.jsx)(`button`,{type:`button`,"data-testid":`wizard-save-draft`,onClick:F,disabled:o,className:`rounded-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,children:l(`appDesigner.saveDraft`)})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!b&&(0,J.jsxs)(`button`,{type:`button`,"data-testid":`wizard-back`,onClick:N,disabled:o,className:`inline-flex items-center gap-1 rounded-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,J.jsx)(k,{className:`h-4 w-4`}),l(`common.back`)]}),x?(0,J.jsxs)(`button`,{type:`button`,"data-testid":`wizard-complete`,onClick:ee,disabled:o||!C,className:`inline-flex items-center gap-1 rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,J.jsx)(z,{className:`h-4 w-4`}),l(`appDesigner.complete`)]}):(0,J.jsxs)(`button`,{type:`button`,"data-testid":`wizard-next`,onClick:M,disabled:o||!C,className:`inline-flex items-center gap-1 rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50`,children:[l(`common.next`),(0,J.jsx)(y,{className:`h-4 w-4`})]})]})]})]})}function Pt(...e){return W(G(e))}var Ft=0;function It(e){return Ft+=1,`${e}_${Date.now()}_${Ft}`}var Lt={object:{labelKey:`appDesigner.navTypeObject`,color:`bg-green-100 text-green-700`,Icon:Ae},dashboard:{labelKey:`appDesigner.navTypeDashboard`,color:`bg-amber-100 text-amber-700`,Icon:m},page:{labelKey:`appDesigner.navTypePage`,color:`bg-teal-100 text-teal-700`,Icon:j},report:{labelKey:`appDesigner.navTypeReport`,color:`bg-rose-100 text-rose-700`,Icon:ue},url:{labelKey:`appDesigner.navTypeUrl`,color:`bg-sky-100 text-sky-700`,Icon:M},group:{labelKey:`appDesigner.navTypeGroup`,color:`bg-purple-100 text-purple-700`,Icon:_},separator:{labelKey:`appDesigner.navTypeSeparator`,color:`bg-gray-100 text-gray-600`,Icon:te},action:{labelKey:`appDesigner.navTypeAction`,color:`bg-orange-100 text-orange-700`,Icon:b}},Rt=[{type:`object`,labelKey:`appDesigner.navObjectPage`},{type:`dashboard`,labelKey:`appDesigner.navDashboard`},{type:`page`,labelKey:`appDesigner.navPage`},{type:`report`,labelKey:`appDesigner.navReport`},{type:`group`,labelKey:`appDesigner.navGroup`},{type:`url`,labelKey:`appDesigner.navUrl`},{type:`separator`,labelKey:`appDesigner.navSeparator`}];function zt({item:e,depth:t,index:n,total:r,readOnly:i,onRemove:a,onMoveUp:o,onMoveDown:s,onToggleExpand:c,onUpdateLabel:l,onUpdateIcon:d,onToggleVisible:f,onAddChild:p,expandedIds:m,t:h}){let[g,_]=(0,q.useState)(!1),[v,b]=(0,q.useState)(u(e.label)??``),[x,S]=(0,q.useState)(!1),[C,w]=(0,q.useState)(e.icon||``),T=Lt[e.type];e.type===`group`&&e.children&&e.children.length;let E=m.has(e.id),D=e.visible===!1,O=()=>{v.trim()?l(e.id,v.trim()):b(u(e.label)??``),_(!1)},k=()=>{d(e.id,C.trim()),S(!1)};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`li`,{"data-testid":`nav-designer-item-${e.id}`,className:Pt(`flex items-center gap-2 rounded-md border border-gray-200 bg-white px-2 py-1.5 transition-colors hover:bg-gray-50`,D&&`opacity-50`),style:{marginLeft:t*20},children:[(0,J.jsx)(Fe,{className:`h-3.5 w-3.5 shrink-0 cursor-grab text-gray-300`}),e.type===`group`?(0,J.jsx)(`button`,{type:`button`,onClick:()=>c(e.id),className:`rounded p-0.5 text-gray-400 hover:text-gray-600`,"aria-label":h(E?`appDesigner.navCollapseGroup`:`appDesigner.navExpandGroup`),children:E?(0,J.jsx)(B,{className:`h-3.5 w-3.5`}):(0,J.jsx)(y,{className:`h-3.5 w-3.5`})}):(0,J.jsx)(`span`,{className:`w-5`}),x&&!i?(0,J.jsx)(`input`,{type:`text`,value:C,onChange:e=>w(e.target.value),onBlur:k,onKeyDown:t=>{t.key===`Enter`&&k(),t.key===`Escape`&&(w(e.icon||``),S(!1))},autoFocus:!0,placeholder:h(`appDesigner.navIconPlaceholder`),"data-testid":`nav-designer-icon-input-${e.id}`,className:`w-24 rounded border border-blue-300 px-1 py-0.5 text-xs outline-none focus:ring-1 focus:ring-blue-400`}):(0,J.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[(0,J.jsx)(T.Icon,{className:`h-3.5 w-3.5 shrink-0 text-gray-500`}),!i&&e.type!==`separator`&&(0,J.jsx)(`button`,{type:`button`,onClick:()=>{w(e.icon||``),S(!0)},className:`rounded p-0.5 text-gray-300 hover:text-blue-500`,"aria-label":h(`appDesigner.navEditIcon`),"data-testid":`nav-designer-edit-icon-${e.id}`,children:(0,J.jsx)(fe,{className:`h-2.5 w-2.5`})})]}),e.type===`separator`?(0,J.jsx)(`span`,{className:`flex-1 text-xs italic text-gray-400`,children:h(`appDesigner.separatorLabel`)}):g&&!i?(0,J.jsx)(`input`,{type:`text`,value:v,onChange:e=>b(e.target.value),onBlur:O,onKeyDown:t=>{t.key===`Enter`&&O(),t.key===`Escape`&&(b(u(e.label)??``),_(!1))},autoFocus:!0,className:`flex-1 rounded border border-blue-300 px-1.5 py-0.5 text-sm outline-none focus:ring-1 focus:ring-blue-400`}):(0,J.jsx)(`span`,{className:Pt(`flex-1 truncate text-sm text-gray-800`,!i&&`cursor-text`),onDoubleClick:()=>{!i&&e.type!==`separator`&&(b(u(e.label)??``),_(!0))},children:u(e.label)}),(0,J.jsx)(`span`,{className:Pt(`rounded-full px-2 py-0.5 text-[10px] font-medium`,T.color),children:h(T.labelKey)}),D&&(0,J.jsx)(`span`,{className:`rounded-full bg-gray-200 px-1.5 py-0.5 text-[10px] font-medium text-gray-500`,"data-testid":`nav-designer-hidden-badge-${e.id}`,children:h(`appDesigner.navHidden`)}),!i&&e.type!==`separator`&&(0,J.jsx)(`button`,{type:`button`,onClick:()=>f(e.id),className:`rounded p-0.5 text-gray-400 hover:text-gray-700`,"aria-label":h(`appDesigner.navToggleVisible`),"data-testid":`nav-designer-toggle-visible-${e.id}`,children:D?(0,J.jsx)(N,{className:`h-3.5 w-3.5`}):(0,J.jsx)(De,{className:`h-3.5 w-3.5`})}),e.type===`group`&&!i&&(0,J.jsx)(`button`,{type:`button`,onClick:()=>p(e.id,`page`),className:`rounded p-0.5 text-gray-400 hover:text-blue-500`,"aria-label":h(`appDesigner.navAddChild`),"data-testid":`nav-designer-add-child-${e.id}`,children:(0,J.jsx)(L,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>o(e.id),disabled:i||n===0,className:`rounded p-0.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":h(`appDesigner.navMoveUp`),children:(0,J.jsx)(Be,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>s(e.id),disabled:i||n===r-1,className:`rounded p-0.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":h(`appDesigner.navMoveDown`),children:(0,J.jsx)(B,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>a(e.id),disabled:i,className:`rounded p-0.5 text-gray-400 hover:text-red-500 disabled:opacity-30`,"aria-label":h(`appDesigner.navRemove`),"data-testid":`nav-designer-remove-${e.id}`,children:(0,J.jsx)(V,{className:`h-3.5 w-3.5`})})]}),e.type===`group`&&E&&e.children&&(0,J.jsx)(J.Fragment,{children:e.children.map((n,r)=>(0,J.jsx)(zt,{item:n,depth:t+1,index:r,total:e.children.length,readOnly:i,onRemove:a,onMoveUp:o,onMoveDown:s,onToggleExpand:c,onUpdateLabel:l,onUpdateIcon:d,onToggleVisible:f,onAddChild:p,expandedIds:m,t:h},n.id))})]})}function Bt({items:e,t}){return(0,J.jsxs)(`div`,{"data-testid":`nav-designer-preview`,className:`w-56 shrink-0 rounded-lg border border-gray-200 bg-gray-50 p-3`,children:[(0,J.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase text-gray-500`,children:t(`appDesigner.navLivePreview`)}),e.length===0?(0,J.jsx)(`p`,{className:`text-xs text-gray-400`,children:t(`appDesigner.navNoPreviewItems`)}):(0,J.jsx)(`ul`,{className:`space-y-0.5`,children:e.map(e=>(0,J.jsx)(Vt,{item:e,depth:0},e.id))})]})}function Vt({item:e,depth:t}){let n=Lt[e.type];return e.type===`separator`?(0,J.jsx)(`li`,{className:`my-1 border-t border-gray-200`,style:{marginLeft:t*12}}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`li`,{className:`flex items-center gap-1.5 rounded px-2 py-1 text-xs text-gray-700 hover:bg-gray-100`,style:{marginLeft:t*12},children:[(0,J.jsx)(n.Icon,{className:`h-3 w-3 text-gray-400`}),(0,J.jsx)(`span`,{className:`truncate`,children:u(e.label)})]}),e.type===`group`&&e.children?.map(e=>(0,J.jsx)(Vt,{item:e,depth:t+1},e.id))]})}function Ht({items:e,onChange:t,readOnly:n=!1,showPreview:r=!0,className:i,onExport:a,onImport:o}){let{t:s}=St(),c=(0,q.useRef)(null),[l,u]=(0,q.useState)(()=>new Set(e.filter(e=>e.type===`group`).map(e=>e.id))),d=(0,q.useCallback)(n=>{function r(e){return e.filter(e=>e.id!==n).map(e=>e.children?{...e,children:r(e.children)}:e)}t(r(e))},[e,t]),f=(0,q.useCallback)((n,r)=>{function i(e){let t=e.findIndex(e=>e.id===n);if(t>=0){let n=r===`up`?t-1:t+1;if(n>=0&&n<e.length){let r=[...e];return[r[t],r[n]]=[r[n],r[t]],r}return e}return e.map(e=>e.children?{...e,children:i(e.children)}:e)}t(i(e))},[e,t]),p=(0,q.useCallback)((n,r)=>{function i(e){return e.map(e=>e.id===n?{...e,label:r}:e.children?{...e,children:i(e.children)}:e)}t(i(e))},[e,t]),m=(0,q.useCallback)((n,r)=>{function i(e){return e.map(e=>e.id===n?{...e,icon:r||void 0}:e.children?{...e,children:i(e.children)}:e)}t(i(e))},[e,t]),g=(0,q.useCallback)(n=>{function r(e){return e.map(e=>e.id===n?{...e,visible:e.visible===!1}:e.children?{...e,children:r(e.children)}:e)}t(r(e))},[e,t]),_=(0,q.useCallback)((n,r)=>{let i={id:It(r),type:r,label:r===`separator`?``:`New ${s(Lt[r].labelKey)}`,...r===`group`?{children:[]}:{},...r===`url`?{url:``}:{}};function a(e){return e.map(e=>e.id===n&&e.type===`group`?{...e,children:[...e.children||[],i]}:e.children?{...e,children:a(e.children)}:e)}t(a(e)),u(e=>new Set(e).add(n))},[e,t]),v=(0,q.useCallback)(n=>{let r={id:It(n),type:n,label:n===`separator`?``:`New ${s(Lt[n].labelKey)}`,...n===`group`?{children:[]}:{},...n===`url`?{url:``}:{}};t([...e,r])},[e,t,s]),y=(0,q.useCallback)(e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),b=(0,q.useCallback)(()=>{if(a)a(e);else{let t=JSON.stringify(e,null,2),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`navigation-schema.json`,i.click(),URL.revokeObjectURL(r)}},[e,a]),x=(0,q.useCallback)(e=>{let n=e.target.files?.[0];if(!n)return;let r=new FileReader;r.onload=e=>{try{let n=JSON.parse(e.target?.result);Array.isArray(n)&&(o?o(n):t(n))}catch{}},r.readAsText(n),c.current&&(c.current.value=``)},[t,o]);return(0,J.jsxs)(`div`,{"data-testid":`navigation-designer`,className:Pt(`flex flex-col gap-4 sm:flex-row`,i),children:[(0,J.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[Rt.map(({type:e,labelKey:t})=>{let{Icon:r,color:i}=Lt[e];return(0,J.jsxs)(`button`,{type:`button`,"data-testid":`nav-designer-add-${e}`,onClick:()=>v(e),disabled:n,className:Pt(`inline-flex items-center gap-1 rounded-md border border-gray-200 px-2.5 py-1 text-xs font-medium transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,J.jsx)(L,{className:`h-3 w-3`}),s(t)]},e)}),(0,J.jsx)(`span`,{className:`mx-1 hidden h-4 w-px bg-gray-200 sm:block`}),(0,J.jsxs)(`button`,{type:`button`,"data-testid":`nav-designer-export`,onClick:b,className:`inline-flex items-center gap-1 rounded-md border border-gray-200 px-2.5 py-1 text-xs font-medium transition-colors hover:bg-gray-50`,children:[(0,J.jsx)(h,{className:`h-3 w-3`}),s(`appDesigner.navExportSchema`)]}),(0,J.jsxs)(`label`,{"data-testid":`nav-designer-import`,className:Pt(`inline-flex cursor-pointer items-center gap-1 rounded-md border border-gray-200 px-2.5 py-1 text-xs font-medium transition-colors hover:bg-gray-50`,n&&`cursor-not-allowed opacity-50`),children:[(0,J.jsx)(O,{className:`h-3 w-3`}),s(`appDesigner.navImportSchema`),(0,J.jsx)(`input`,{ref:c,type:`file`,accept:`.json`,className:`hidden`,onChange:x,disabled:n,"data-testid":`nav-designer-import-input`})]})]}),e.length===0?(0,J.jsx)(`div`,{className:`py-8 text-center text-sm text-gray-400`,children:s(`appDesigner.navNoItems`)}):(0,J.jsx)(`ul`,{className:`space-y-1`,"data-testid":`nav-designer-tree`,children:e.map((t,r)=>(0,J.jsx)(zt,{item:t,depth:0,index:r,total:e.length,readOnly:n,onRemove:d,onMoveUp:e=>f(e,`up`),onMoveDown:e=>f(e,`down`),onToggleExpand:y,onUpdateLabel:p,onUpdateIcon:m,onToggleVisible:g,onAddChild:_,expandedIds:l,t:s},t.id))})]}),r&&(0,J.jsx)(Bt,{items:e,t:s})]})}function Ut(...e){return W(G(e))}var Wt=[{type:`metric`,label:`KPI Metric`,Icon:Oe},{type:`bar`,label:`Bar Chart`,Icon:ue},{type:`line`,label:`Line Chart`,Icon:se},{type:`pie`,label:`Pie Chart`,Icon:F},{type:`table`,label:`Table`,Icon:Te},{type:`grid`,label:`Grid`,Icon:ne}],Gt=0;function Kt(){return Gt+=1,`widget_${Date.now()}_${Gt}`}function qt({widget:e,index:t,total:n,selected:r,readOnly:i,onSelect:a,onRemove:o,onMoveUp:s,onMoveDown:c}){let l=e.type||`metric`,u=Wt.find(e=>e.type===l)||Wt[0];return(0,J.jsxs)(`div`,{"data-testid":`dashboard-widget-${e.id}`,onClick:a,className:Ut(`group cursor-pointer rounded-lg border-2 p-3 transition-colors`,r?`border-blue-500 bg-blue-50`:`border-gray-200 hover:border-gray-300`),children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(Fe,{className:`h-4 w-4 text-gray-300`}),(0,J.jsx)(u.Icon,{className:`h-4 w-4 text-gray-500`}),(0,J.jsx)(`span`,{className:`text-sm font-medium text-gray-800`,children:e.title||`Widget ${t+1}`})]}),!i&&(0,J.jsxs)(`div`,{className:`flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s()},disabled:t===0,className:`rounded p-0.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":`Move up`,children:(0,J.jsx)(Be,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:t===n-1,className:`rounded p-0.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":`Move down`,children:(0,J.jsx)(B,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o()},className:`rounded p-0.5 text-gray-400 hover:text-red-500`,"aria-label":`Remove widget`,"data-testid":`dashboard-widget-remove-${e.id}`,children:(0,J.jsx)(V,{className:`h-3.5 w-3.5`})})]})]}),(0,J.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-medium text-gray-600`,children:u.label}),e.object&&(0,J.jsx)(`span`,{className:`text-[10px] text-gray-400`,children:e.object})]})]})}function Jt({widget:e,readOnly:t,onChange:n,onClose:r}){let{t:i}=St();return(0,J.jsxs)(`div`,{"data-testid":`widget-property-panel`,className:`shrink-0 space-y-4 rounded-lg border border-gray-200 bg-white p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsx)(`h4`,{className:`text-sm font-semibold text-gray-800`,children:i(`appDesigner.widgetProperties`)}),(0,J.jsx)(`button`,{type:`button`,onClick:r,className:`rounded p-0.5 text-gray-400 hover:text-gray-600`,"aria-label":`Close`,children:(0,J.jsx)(v,{className:`h-4 w-4`})})]}),(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(`label`,{htmlFor:`widget-title`,className:`text-xs font-medium text-gray-600`,children:`Title`}),(0,J.jsx)(`input`,{id:`widget-title`,"data-testid":`widget-prop-title`,type:`text`,value:e.title??``,onChange:e=>n({title:e.target.value}),disabled:t,className:`block w-full rounded-md border border-gray-300 px-2.5 py-1.5 text-sm outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50`})]}),(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(`label`,{htmlFor:`widget-type`,className:`text-xs font-medium text-gray-600`,children:`Type`}),(0,J.jsx)(`select`,{id:`widget-type`,"data-testid":`widget-prop-type`,value:e.type??`metric`,onChange:e=>n({type:e.target.value}),disabled:t,className:`block w-full rounded-md border border-gray-300 px-2.5 py-1.5 text-sm outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50`,children:Wt.map(e=>(0,J.jsx)(`option`,{value:e.type,children:e.label},e.type))})]}),(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(`label`,{htmlFor:`widget-object`,className:`text-xs font-medium text-gray-600`,children:`Data Source (Object)`}),(0,J.jsx)(`input`,{id:`widget-object`,"data-testid":`widget-prop-object`,type:`text`,value:e.object??``,onChange:e=>n({object:e.target.value}),disabled:t,placeholder:`e.g. orders`,className:`block w-full rounded-md border border-gray-300 px-2.5 py-1.5 text-sm outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50`})]}),(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(`label`,{htmlFor:`widget-value-field`,className:`text-xs font-medium text-gray-600`,children:`Value Field`}),(0,J.jsx)(`input`,{id:`widget-value-field`,"data-testid":`widget-prop-value-field`,type:`text`,value:e.valueField??``,onChange:e=>n({valueField:e.target.value}),disabled:t,placeholder:`e.g. amount`,className:`block w-full rounded-md border border-gray-300 px-2.5 py-1.5 text-sm outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50`})]}),(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(`label`,{htmlFor:`widget-aggregate`,className:`text-xs font-medium text-gray-600`,children:`Aggregate`}),(0,J.jsxs)(`select`,{id:`widget-aggregate`,"data-testid":`widget-prop-aggregate`,value:e.aggregate??`count`,onChange:e=>n({aggregate:e.target.value}),disabled:t,className:`block w-full rounded-md border border-gray-300 px-2.5 py-1.5 text-sm outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50`,children:[(0,J.jsx)(`option`,{value:`count`,children:`Count`}),(0,J.jsx)(`option`,{value:`sum`,children:`Sum`}),(0,J.jsx)(`option`,{value:`avg`,children:`Average`}),(0,J.jsx)(`option`,{value:`min`,children:`Min`}),(0,J.jsx)(`option`,{value:`max`,children:`Max`})]})]}),(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(`label`,{htmlFor:`widget-color`,className:`text-xs font-medium text-gray-600`,children:`Color Variant`}),(0,J.jsxs)(`select`,{id:`widget-color`,"data-testid":`widget-prop-color`,value:e.colorVariant??`default`,onChange:e=>n({colorVariant:e.target.value}),disabled:t,className:`block w-full rounded-md border border-gray-300 px-2.5 py-1.5 text-sm outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50`,children:[(0,J.jsx)(`option`,{value:`default`,children:`Default`}),(0,J.jsx)(`option`,{value:`blue`,children:`Blue`}),(0,J.jsx)(`option`,{value:`teal`,children:`Teal`}),(0,J.jsx)(`option`,{value:`orange`,children:`Orange`}),(0,J.jsx)(`option`,{value:`purple`,children:`Purple`}),(0,J.jsx)(`option`,{value:`success`,children:`Success`}),(0,J.jsx)(`option`,{value:`warning`,children:`Warning`}),(0,J.jsx)(`option`,{value:`danger`,children:`Danger`})]})]}),(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(`label`,{className:`text-xs font-medium text-gray-600`,children:i(`appDesigner.widgetLayoutSize`)}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex-1`,children:[(0,J.jsx)(`label`,{htmlFor:`widget-width`,className:`text-[10px] text-gray-400`,children:i(`appDesigner.widgetWidth`)}),(0,J.jsx)(`input`,{id:`widget-width`,"data-testid":`widget-prop-width`,type:`number`,min:1,value:e.layout?.w??1,onChange:t=>n({layout:{...e.layout,w:Number(t.target.value)||1}}),disabled:t,className:`block w-full rounded-md border border-gray-300 px-2 py-1 text-sm outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50`})]}),(0,J.jsxs)(`div`,{className:`flex-1`,children:[(0,J.jsx)(`label`,{htmlFor:`widget-height`,className:`text-[10px] text-gray-400`,children:i(`appDesigner.widgetHeight`)}),(0,J.jsx)(`input`,{id:`widget-height`,"data-testid":`widget-prop-height`,type:`number`,min:1,value:e.layout?.h??1,onChange:t=>n({layout:{...e.layout,h:Number(t.target.value)||1}}),disabled:t,className:`block w-full rounded-md border border-gray-300 px-2 py-1 text-sm outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50`})]})]})]})]})}function Yt({schema:e}){let{t}=St(),n=e.widgets||[];return(0,J.jsxs)(`div`,{"data-testid":`dashboard-preview`,className:`rounded-lg border border-gray-200 bg-gray-50 p-4`,children:[(0,J.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-gray-700`,children:e.title||t(`appDesigner.dashboardPreview`)}),n.length===0?(0,J.jsx)(`div`,{className:`text-xs text-gray-400`,children:t(`appDesigner.noWidgetsPreview`)}):(0,J.jsx)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(${e.columns??2}, 1fr)`},children:n.map(e=>{let t=Wt.find(t=>t.type===(e.type||`metric`))||Wt[0];return(0,J.jsxs)(`div`,{className:`rounded-md border border-gray-200 bg-white p-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(t.Icon,{className:`h-3 w-3 text-gray-400`}),(0,J.jsx)(`span`,{className:`text-xs font-medium text-gray-600`,children:e.title||`Untitled`})]}),(0,J.jsx)(`div`,{className:`mt-1 text-[10px] text-gray-400`,children:t.label})]},e.id)})})]})}function Xt({schema:e,onChange:t,readOnly:n=!1,className:r,onExport:i,onImport:a,selectedWidgetId:o,onWidgetSelect:s}){let{t:c}=St(),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(!1),p=(0,q.useRef)(null),m=(0,q.useRef)(null),g=o!==void 0,_=g?o:l,v=(0,q.useCallback)(e=>{s&&s(e),g||u(e)},[g,s,u]),{current:y,canUndo:b,canRedo:x,push:S,undo:C,redo:w}=Ge(e),T=(0,q.useCallback)(e=>{S(e),t(e)},[S,t]),E=y.widgets||[],D=E.find(e=>e.id===_),k=(0,q.useCallback)(e=>{let t=Kt(),n={id:t,title:``,type:e,layout:{x:0,y:E.length,w:y.columns??2,h:1}};T({...y,widgets:[...E,n]}),v(t)},[y,E,T,v]),A=(0,q.useCallback)(e=>{T({...y,widgets:E.filter(t=>t.id!==e)}),_===e&&v(null)},[y,E,_,T,v]),j=(0,q.useCallback)((e,t)=>{let n=E.findIndex(t=>t.id===e);if(n<0)return;let r=t===`up`?n-1:n+1;if(r<0||r>=E.length)return;let i=[...E];[i[n],i[r]]=[i[r],i[n]],T({...y,widgets:i})},[y,E,T]),M=(0,q.useCallback)(e=>{_&&T({...y,widgets:E.map(t=>t.id===_?{...t,...e}:t)})},[y,E,_,T]);(0,q.useEffect)(()=>{let e=p.current;if(!e)return;let t=e=>{if(!n){if((e.ctrlKey||e.metaKey)&&e.key===`z`&&!e.shiftKey){e.preventDefault(),C();return}if((e.ctrlKey||e.metaKey)&&(e.key===`y`||e.key===`z`&&e.shiftKey)){e.preventDefault(),w();return}if((e.key===`Delete`||e.key===`Backspace`)&&_){let t=e.target;if(t.tagName===`INPUT`||t.tagName===`SELECT`||t.tagName===`TEXTAREA`)return;e.preventDefault(),A(_)}}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[n,C,w,_,A]);let P=(0,q.useCallback)(()=>{i&&i(y)},[y,i]),F=(0,q.useCallback)(()=>{m.current?.click()},[]),I=(0,q.useCallback)(e=>{let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=()=>{try{let e=JSON.parse(n.result);e&&e.type===`dashboard`&&(T(e),a?.(e))}catch{}},n.readAsText(t),e.target.value=``},[T,a]);return(0,J.jsxs)(`div`,{ref:p,tabIndex:0,"data-testid":`dashboard-editor`,className:Ut(`flex flex-col gap-4 outline-none`,r),children:[(0,J.jsx)(`input`,{ref:m,type:`file`,accept:`.json`,className:`hidden`,"data-testid":`dashboard-import-input`,onChange:I}),D&&!d&&(0,J.jsx)(Jt,{widget:D,readOnly:n,onChange:M,onClose:()=>v(null)}),(0,J.jsxs)(`div`,{className:`flex-1 space-y-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`text-sm font-medium text-gray-700`,children:[c(`appDesigner.addWidget`),`:`]}),Wt.map(({type:e,label:t,Icon:r})=>(0,J.jsxs)(`button`,{type:`button`,"data-testid":`dashboard-add-${e}`,onClick:()=>k(e),disabled:n||d,className:`inline-flex items-center gap-1.5 rounded-md border border-gray-200 px-2.5 py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,J.jsx)(r,{className:`h-3.5 w-3.5`}),t]},e))]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[!n&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{type:`button`,"data-testid":`dashboard-undo`,onClick:C,disabled:!b,className:`rounded p-1.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":c(`appDesigner.undo`),children:(0,J.jsx)(ae,{className:`h-4 w-4`})}),(0,J.jsx)(`button`,{type:`button`,"data-testid":`dashboard-redo`,onClick:w,disabled:!x,className:`rounded p-1.5 text-gray-400 hover:text-gray-700 disabled:opacity-30`,"aria-label":c(`appDesigner.redo`),children:(0,J.jsx)(ee,{className:`h-4 w-4`})})]}),(0,J.jsx)(`button`,{type:`button`,"data-testid":`dashboard-export`,onClick:P,className:`rounded p-1.5 text-gray-400 hover:text-gray-700`,"aria-label":c(`appDesigner.navExportSchema`),children:(0,J.jsx)(h,{className:`h-4 w-4`})}),!n&&(0,J.jsx)(`button`,{type:`button`,"data-testid":`dashboard-import`,onClick:F,className:`rounded p-1.5 text-gray-400 hover:text-gray-700`,"aria-label":c(`appDesigner.navImportSchema`),children:(0,J.jsx)(O,{className:`h-4 w-4`})}),(0,J.jsx)(`button`,{type:`button`,"data-testid":`dashboard-preview-toggle`,onClick:()=>f(e=>!e),className:Ut(`rounded p-1.5 transition-colors`,d?`bg-blue-100 text-blue-600`:`text-gray-400 hover:text-gray-700`),"aria-label":c(d?`appDesigner.modeEdit`:`appDesigner.preview`),children:d?(0,J.jsx)(N,{className:`h-4 w-4`}):(0,J.jsx)(De,{className:`h-4 w-4`})})]})]}),d?(0,J.jsx)(Yt,{schema:y}):E.length===0?(0,J.jsx)(`div`,{className:`flex h-48 items-center justify-center rounded-lg border-2 border-dashed border-gray-200 text-sm text-gray-400`,children:c(`appDesigner.noWidgets`)}):(0,J.jsx)(`div`,{className:`grid gap-3`,style:{gridTemplateColumns:`repeat(${y.columns??2}, 1fr)`},children:E.map((e,t)=>(0,J.jsx)(qt,{widget:e,index:t,total:E.length,selected:e.id===_,readOnly:n,onSelect:()=>v(e.id??null),onRemove:()=>A(e.id),onMoveUp:()=>j(e.id,`up`),onMoveDown:()=>j(e.id,`down`)},e.id))})]})]})}function $(...e){return W(G(e))}var Zt=[{hex:`#3b82f6`,name:`Blue`},{hex:`#6366f1`,name:`Indigo`},{hex:`#8b5cf6`,name:`Violet`},{hex:`#a855f7`,name:`Purple`},{hex:`#ec4899`,name:`Pink`},{hex:`#ef4444`,name:`Red`},{hex:`#f97316`,name:`Orange`},{hex:`#f59e0b`,name:`Amber`},{hex:`#eab308`,name:`Yellow`},{hex:`#22c55e`,name:`Green`},{hex:`#14b8a6`,name:`Teal`},{hex:`#06b6d4`,name:`Cyan`},{hex:`#0ea5e9`,name:`Sky`},{hex:`#64748b`,name:`Slate`},{hex:`#1e293b`,name:`Dark`},{hex:`#0f172a`,name:`Navy`}],Qt=[`Inter`,`Roboto`,`Open Sans`,`Lato`,`Montserrat`,`Poppins`,`Source Sans Pro`,`Noto Sans`,`system-ui`];function $t({branding:e,onChange:t,appTitle:n=`My App`,readOnly:r=!1,className:i,onExport:a,onImport:o}){let{t:s}=St(),[c,l]=(0,q.useState)(`light`),{current:u,push:d,canUndo:f,canRedo:p,undo:m,redo:g}=Ge(e),_=(0,q.useRef)(!0);(0,q.useEffect)(()=>{if(_.current){_.current=!1;return}t(u)},[u]);let v=(0,q.useCallback)(e=>{let n={...u,...e};_.current=!0,d(n),t(n)},[u,d,t]),y=(0,q.useCallback)(()=>{if(a){a(u);return}let e=new Blob([JSON.stringify(u,null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`branding.json`,n.click(),URL.revokeObjectURL(t)},[u,a]),b=(0,q.useCallback)(()=>{if(o){o(u);return}let e=document.createElement(`input`);e.type=`file`,e.accept=`.json`,e.onchange=e=>{let n=e.target.files?.[0];if(!n)return;let r=new FileReader;r.onload=e=>{try{let n=JSON.parse(e.target?.result);if(typeof n==`object`&&n){let e={...u,...n};d(e),t(e)}}catch{}},r.readAsText(n)},e.click()},[u,d,t,o]),x=(0,q.useCallback)(e=>{r||((e.ctrlKey||e.metaKey)&&e.key===`z`&&(e.preventDefault(),e.shiftKey?g():m()),(e.ctrlKey||e.metaKey)&&e.key===`y`&&(e.preventDefault(),g()))},[r,m,g]),S=u.primaryColor||`#3b82f6`,C=c===`dark`;return(0,J.jsxs)(`div`,{"data-testid":`branding-editor`,className:$(`flex flex-col gap-4 sm:gap-6`,i),onKeyDown:x,tabIndex:0,children:[(0,J.jsxs)(`div`,{"data-testid":`branding-editor-toolbar`,className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-semibold text-gray-800 mr-auto`,children:s(`appDesigner.brandingEditor`)}),(0,J.jsxs)(`button`,{"data-testid":`branding-undo`,type:`button`,onClick:m,disabled:!f||r,className:$(`inline-flex items-center gap-1 rounded-md border px-2.5 py-1.5 text-xs font-medium shadow-sm transition-colors`,f&&!r?`border-gray-300 bg-white text-gray-700 hover:bg-gray-50`:`border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed`),title:s(`appDesigner.undo`),children:[(0,J.jsx)(ae,{className:`h-3.5 w-3.5`}),s(`appDesigner.undo`)]}),(0,J.jsxs)(`button`,{"data-testid":`branding-redo`,type:`button`,onClick:g,disabled:!p||r,className:$(`inline-flex items-center gap-1 rounded-md border px-2.5 py-1.5 text-xs font-medium shadow-sm transition-colors`,p&&!r?`border-gray-300 bg-white text-gray-700 hover:bg-gray-50`:`border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed`),title:s(`appDesigner.redo`),children:[(0,J.jsx)(ee,{className:`h-3.5 w-3.5`}),s(`appDesigner.redo`)]}),(0,J.jsxs)(`button`,{"data-testid":`branding-export`,type:`button`,onClick:y,className:`inline-flex items-center gap-1 rounded-md border border-gray-300 bg-white px-2.5 py-1.5 text-xs font-medium text-gray-700 shadow-sm transition-colors hover:bg-gray-50`,title:s(`appDesigner.brandingExport`),children:[(0,J.jsx)(h,{className:`h-3.5 w-3.5`}),s(`appDesigner.brandingExport`)]}),(0,J.jsxs)(`button`,{"data-testid":`branding-import`,type:`button`,onClick:b,disabled:r,className:$(`inline-flex items-center gap-1 rounded-md border px-2.5 py-1.5 text-xs font-medium shadow-sm transition-colors`,r?`border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed`:`border-gray-300 bg-white text-gray-700 hover:bg-gray-50`),title:s(`appDesigner.brandingImport`),children:[(0,J.jsx)(O,{className:`h-3.5 w-3.5`}),s(`appDesigner.brandingImport`)]})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:gap-6`,children:[(0,J.jsxs)(`div`,{className:`flex-1 space-y-5`,children:[(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`be-logo`,className:`block text-sm font-medium text-gray-700`,children:s(`appDesigner.logoUrl`)}),(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(Ne,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-gray-400`}),(0,J.jsx)(`input`,{id:`be-logo`,"data-testid":`branding-logo-input`,type:`text`,value:u.logo??``,onChange:e=>v({logo:e.target.value}),placeholder:`https://example.com/logo.svg`,disabled:r,className:`block w-full rounded-md border border-gray-300 py-2 pl-9 pr-3 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`})]})]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`be-color`,className:`block text-sm font-medium text-gray-700`,children:s(`appDesigner.primaryColor`)}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(`div`,{className:`relative flex-1`,children:[(0,J.jsx)(de,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-gray-400`}),(0,J.jsx)(`input`,{id:`be-color`,"data-testid":`branding-color-input`,type:`text`,value:u.primaryColor??`#3b82f6`,onChange:e=>v({primaryColor:e.target.value}),placeholder:`#3b82f6`,disabled:r,className:`block w-full rounded-md border border-gray-300 py-2 pl-9 pr-3 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`})]}),(0,J.jsx)(`input`,{"data-testid":`branding-color-picker`,type:`color`,value:S,onChange:e=>v({primaryColor:e.target.value}),disabled:r,className:`h-9 w-9 cursor-pointer rounded-md border border-gray-300 p-0.5 disabled:cursor-not-allowed`})]}),(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(`span`,{className:`text-xs text-gray-500`,children:s(`appDesigner.colorPalette`)}),(0,J.jsx)(`div`,{"data-testid":`branding-color-palette`,className:`flex flex-wrap gap-1.5`,children:Zt.map(e=>(0,J.jsx)(`button`,{"data-testid":`branding-swatch-${e.hex.slice(1)}`,type:`button`,onClick:()=>!r&&v({primaryColor:e.hex}),disabled:r,className:$(`h-6 w-6 rounded-full border-2 transition-transform hover:scale-110 disabled:cursor-not-allowed`,S===e.hex?`border-gray-800 ring-2 ring-offset-1 ring-gray-400`:`border-transparent`),style:{backgroundColor:e.hex},title:e.name},e.hex))})]})]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`be-favicon`,className:`block text-sm font-medium text-gray-700`,children:s(`appDesigner.faviconUrl`)}),(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(H,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-gray-400`}),(0,J.jsx)(`input`,{id:`be-favicon`,"data-testid":`branding-favicon-input`,type:`text`,value:u.favicon??``,onChange:e=>v({favicon:e.target.value}),placeholder:`https://example.com/favicon.ico`,disabled:r,className:`block w-full rounded-md border border-gray-300 py-2 pl-9 pr-3 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50`})]})]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`be-font`,className:`block text-sm font-medium text-gray-700`,children:s(`appDesigner.fontFamily`)}),(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(D,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-gray-400`}),(0,J.jsxs)(`select`,{id:`be-font`,"data-testid":`branding-font-select`,value:u.fontFamily??``,onChange:e=>v({fontFamily:e.target.value||void 0}),disabled:r,className:`block w-full rounded-md border border-gray-300 py-2 pl-9 pr-3 text-sm shadow-sm outline-none transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-50 appearance-none`,children:[(0,J.jsx)(`option`,{value:``,children:s(`appDesigner.fontDefault`)}),Qt.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))]})]})]})]}),(0,J.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsx)(`span`,{className:`text-sm font-medium text-gray-700`,children:s(`appDesigner.brandingPreview`)}),(0,J.jsxs)(`div`,{"data-testid":`branding-mode-toggle`,className:`flex rounded-md border border-gray-300 overflow-hidden`,children:[(0,J.jsxs)(`button`,{"data-testid":`branding-mode-light`,type:`button`,onClick:()=>l(`light`),className:$(`inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium transition-colors`,c===`light`?`bg-blue-50 text-blue-700`:`bg-white text-gray-600 hover:bg-gray-50`),children:[(0,J.jsx)(je,{className:`h-3.5 w-3.5`}),s(`appDesigner.modeLight`)]}),(0,J.jsxs)(`button`,{"data-testid":`branding-mode-dark`,type:`button`,onClick:()=>l(`dark`),className:$(`inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium transition-colors`,c===`dark`?`bg-gray-800 text-gray-100`:`bg-white text-gray-600 hover:bg-gray-50`),children:[(0,J.jsx)(R,{className:`h-3.5 w-3.5`}),s(`appDesigner.modeDark`)]})]})]}),(0,J.jsxs)(`div`,{"data-testid":`branding-preview`,className:$(`rounded-lg border p-4 transition-colors`,C?`border-gray-700 bg-gray-900 text-gray-100`:`border-gray-200 bg-white text-gray-800`),style:{fontFamily:u.fontFamily||`inherit`},children:[(0,J.jsx)(`div`,{className:`rounded-md p-3 mb-3`,style:{backgroundColor:S},children:(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[u.logo?(0,J.jsx)(`img`,{src:u.logo,alt:`Logo`,className:`h-8 w-8 rounded object-contain bg-white/20`}):(0,J.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded bg-white/20 text-xs text-white`,children:`Logo`}),(0,J.jsx)(`span`,{className:`text-sm font-semibold text-white`,children:n})]})}),(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`div`,{className:`h-4 w-4 rounded-full border border-gray-200`,style:{backgroundColor:S}}),(0,J.jsx)(`span`,{className:$(`text-xs`,C?`text-gray-400`:`text-gray-500`),children:S})]}),(0,J.jsx)(`button`,{type:`button`,className:`rounded-md px-3 py-1.5 text-xs font-medium text-white transition-colors`,style:{backgroundColor:S},tabIndex:-1,children:s(`appDesigner.brandingSampleButton`)}),(0,J.jsx)(`p`,{className:$(`text-xs`,C?`text-gray-400`:`text-gray-500`),children:s(`appDesigner.brandingSampleText`)}),u.favicon&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`img`,{src:u.favicon,alt:`Favicon`,className:`h-4 w-4 rounded object-contain`}),(0,J.jsx)(`span`,{className:$(`text-xs`,C?`text-gray-400`:`text-gray-500`),children:`Favicon`})]}),u.fontFamily&&(0,J.jsxs)(`div`,{className:$(`text-xs`,C?`text-gray-400`:`text-gray-500`),children:[s(`appDesigner.fontFamily`),`: `,u.fontFamily]})]})]}),(0,J.jsxs)(`div`,{"data-testid":`branding-preview-mobile`,className:$(`mx-auto w-48 rounded-xl border-2 p-2 transition-colors`,C?`border-gray-700 bg-gray-900`:`border-gray-300 bg-white`),style:{fontFamily:u.fontFamily||`inherit`},children:[(0,J.jsx)(`div`,{className:`text-center text-[10px] font-medium text-gray-400 mb-1`,children:s(`appDesigner.mobilePreview`)}),(0,J.jsx)(`div`,{className:`rounded-md p-2 mb-1`,style:{backgroundColor:S},children:(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[u.logo?(0,J.jsx)(`img`,{src:u.logo,alt:`Logo`,className:`h-4 w-4 rounded object-contain bg-white/20`}):(0,J.jsx)(`div`,{className:`flex h-4 w-4 items-center justify-center rounded bg-white/20 text-[6px] text-white`,children:`L`}),(0,J.jsx)(`span`,{className:`text-[9px] font-semibold text-white truncate`,children:n})]})}),(0,J.jsxs)(`div`,{className:`space-y-1 px-1`,children:[(0,J.jsx)(`div`,{className:$(`h-2 w-3/4 rounded`,C?`bg-gray-700`:`bg-gray-200`)}),(0,J.jsx)(`div`,{className:$(`h-2 w-1/2 rounded`,C?`bg-gray-700`:`bg-gray-200`)}),(0,J.jsx)(`div`,{className:$(`h-2 w-2/3 rounded`,C?`bg-gray-700`:`bg-gray-200`)})]})]})]})]})]})}function en(...e){return W(G(e))}var tn=[`Custom Objects`,`System Objects`,`Integration`,`Analytics`],nn=[`Box`,`Database`,`Users`,`FileText`,`Settings`,`ShoppingCart`,`Calendar`,`Mail`,`Briefcase`,`Building`,`Globe`,`Heart`,`Star`,`Tag`,`Bookmark`,`Folder`,`Archive`,`Package`,`Truck`,`CreditCard`];function rn({objects:e,onObjectsChange:t,onSelectObject:n,showSystemObjects:r=!0,readOnly:i=!1,className:a}){let{t:o}=St(),s=Ke(),[c,l]=(0,q.useState)(!1),[u,f]=(0,q.useState)(null),p=(0,q.useMemo)(()=>r?e:e.filter(e=>!e.isSystem),[e,r]),m=(0,q.useMemo)(()=>new d({items:p}),[p]),h=(0,q.useMemo)(()=>[{field:`name`,label:o(`appDesigner.objectManager.objectName`),width:160},{field:`label`,label:o(`appDesigner.objectManager.objectLabel`),width:160},{field:`group`,label:o(`appDesigner.objectManager.group`),width:130},{field:`fieldCount`,label:`Fields`,width:80},{field:`enabled`,label:o(`appDesigner.objectManager.enabled`),width:80}],[o]),g=(0,q.useMemo)(()=>({type:`object-grid`,objectName:`object_definition`,columns:h,searchableFields:[`name`,`label`,`description`],showSearch:!0,operations:i?void 0:{create:!0,update:!0,delete:!0}}),[h,i]),_=(0,q.useCallback)(t=>{let r=e.find(e=>e.name===t.name);r&&n?.(r)},[e,n]),v=(0,q.useCallback)(t=>{let n=e.find(e=>e.name===t.name);n&&(f(n),l(!0))},[e]),y=(0,q.useCallback)(async n=>{let r=e.find(e=>e.name===n.name);!r||r.isSystem||await s.confirm(o(`appDesigner.objectManager.deleteConfirmTitle`),o(`appDesigner.objectManager.deleteConfirmMessage`))&&t?.(e.filter(e=>e.id!==r.id))},[e,t,s,o]),b=(0,q.useCallback)(()=>{f(null),l(!0)},[]),x=(0,q.useCallback)(n=>{if(u){let r={...u,name:String(n.name||u.name),label:String(n.label||u.label),pluralLabel:n.pluralLabel?String(n.pluralLabel):void 0,description:n.description?String(n.description):void 0,icon:n.icon?String(n.icon):void 0,group:n.group?String(n.group):void 0,sortOrder:typeof n.sortOrder==`number`?n.sortOrder:void 0,enabled:n.enabled!==!1};t?.(e.map(e=>e.id===u.id?r:e))}else{let r={id:`obj_${Date.now()}`,name:String(n.name||`new_object_${e.length+1}`),label:String(n.label||`New Object ${e.length+1}`),pluralLabel:n.pluralLabel?String(n.pluralLabel):void 0,description:n.description?String(n.description):void 0,icon:n.icon?String(n.icon):void 0,group:n.group?String(n.group):void 0,sortOrder:typeof n.sortOrder==`number`?n.sortOrder:void 0,isSystem:!1,enabled:n.enabled!==!1,fieldCount:0};t?.([...e,r])}l(!1),f(null)},[u,e,t]),S=(0,q.useCallback)(e=>{e||(l(!1),f(null))},[]),C=(0,q.useMemo)(()=>({type:`object-form`,formType:`modal`,objectName:`object_definition`,mode:u?`edit`:`create`,title:u?`${o(`common.edit`)} — ${u.label}`:o(`appDesigner.objectManager.addObject`),open:c,onOpenChange:S,modalSize:`lg`,customFields:[{name:`name`,label:o(`appDesigner.objectManager.objectName`),type:`text`,required:!0,placeholder:`api_name`,disabled:i||(u?.isSystem??!1)},{name:`label`,label:o(`appDesigner.objectManager.objectLabel`),type:`text`,required:!0,placeholder:`Display Name`,disabled:i},{name:`pluralLabel`,label:o(`appDesigner.objectManager.pluralLabel`),type:`text`,placeholder:`Display Names`,disabled:i},{name:`description`,label:o(`appDesigner.appDescription`),type:`textarea`,disabled:i},{name:`icon`,label:o(`appDesigner.objectManager.icon`),type:`select`,options:nn.map(e=>({label:e,value:e})),disabled:i},{name:`group`,label:o(`appDesigner.objectManager.group`),type:`select`,options:tn.map(e=>({label:e,value:e})),disabled:i},{name:`sortOrder`,label:o(`appDesigner.objectManager.sortOrder`),type:`number`,disabled:i},{name:`enabled`,label:o(`appDesigner.objectManager.enabled`),type:`boolean`,disabled:i}],initialValues:u?{name:u.name,label:u.label,pluralLabel:u.pluralLabel||``,description:u.description||``,icon:u.icon||``,group:u.group||``,sortOrder:u.sortOrder??0,enabled:u.enabled!==!1}:{enabled:!0},onSuccess:x,onCancel:()=>S(!1),readOnly:i}),[u,c,S,x,i,o]);return(0,J.jsxs)(`div`,{"data-testid":`object-manager`,className:en(`w-full space-y-3`,a),children:[(0,J.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(Ae,{className:`h-4 w-4 text-primary`}),(0,J.jsx)(`h2`,{className:`text-sm font-semibold`,children:o(`appDesigner.objectManager.title`)}),(0,J.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:p.length})]})}),(0,J.jsx)(Ue,{schema:g,dataSource:m,onRowClick:_,onEdit:i?void 0:v,onDelete:i?void 0:y,onAddRecord:i?void 0:b}),c&&(0,J.jsx)(Ve,{schema:C}),(0,J.jsx)(Ze,{isOpen:s.isOpen,title:s.title,message:s.message,confirmLabel:o(`common.delete`),cancelLabel:o(`common.cancel`),onConfirm:s.onConfirm,onCancel:s.onCancel,destructive:!0})]})}function an(...e){return W(G(e))}var on={text:{label:`Text`,Icon:D},textarea:{label:`Text Area`,Icon:j},number:{label:`Number`,Icon:Ce},boolean:{label:`Checkbox`,Icon:le},date:{label:`Date`,Icon:g},datetime:{label:`Date/Time`,Icon:g},time:{label:`Time`,Icon:g},select:{label:`Picklist`,Icon:E},email:{label:`Email`,Icon:be},phone:{label:`Phone`,Icon:ke},url:{label:`URL`,Icon:H},password:{label:`Password`,Icon:ie},currency:{label:`Currency`,Icon:Ce},percent:{label:`Percent`,Icon:Ce},lookup:{label:`Lookup`,Icon:ce},formula:{label:`Formula`,Icon:ge},autonumber:{label:`Auto Number`,Icon:Ce},file:{label:`File`,Icon:j},image:{label:`Image`,Icon:Ne},markdown:{label:`Markdown`,Icon:j},html:{label:`Rich Text`,Icon:j},color:{label:`Color`,Icon:de},code:{label:`Code`,Icon:ge},location:{label:`Location`,Icon:I},address:{label:`Address`,Icon:I},rating:{label:`Rating`,Icon:Me},slider:{label:`Slider`,Icon:Le}};Object.keys(on);var sn={text:[`text`,`textarea`,`email`,`phone`,`url`,`password`,`markdown`,`html`],number:[`number`,`currency`,`percent`,`autonumber`,`rating`,`slider`],date:[`date`,`datetime`,`time`],choice:[`boolean`,`select`],relation:[`lookup`],advanced:[`formula`,`file`,`image`,`color`,`code`,`location`,`address`]},cn=[`text`,`number`,`date`,`choice`,`relation`,`advanced`];function ln({objectName:e,fields:t,onFieldsChange:n,readOnly:r=!1,className:i}){let{t:a}=St(),o=Ke(),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(null),[f,p]=(0,q.useState)(``),m=(0,q.useMemo)(()=>f?t.filter(e=>e.type===f):t,[t,f]),h=(0,q.useMemo)(()=>new d({items:m}),[m]),g=(0,q.useMemo)(()=>[{field:`name`,label:a(`appDesigner.fieldDesigner.fieldName`),width:140},{field:`label`,label:a(`appDesigner.fieldDesigner.fieldLabel`),width:160},{field:`type`,label:a(`appDesigner.fieldDesigner.fieldType`),width:100},{field:`required`,label:a(`appDesigner.fieldDesigner.required`),width:80},{field:`unique`,label:a(`appDesigner.fieldDesigner.unique`),width:80},{field:`group`,label:a(`appDesigner.fieldDesigner.fieldGroup`),width:120}],[a]),_=(0,q.useMemo)(()=>({type:`object-grid`,objectName:`field_definition`,columns:g,searchableFields:[`name`,`label`,`description`],showSearch:!0,operations:r?void 0:{create:!0,update:!0,delete:!0}}),[g,r]),v=(0,q.useCallback)(e=>{let n=t.find(t=>t.name===e.name);n&&(u(n),c(!0))},[t]),y=(0,q.useCallback)(async e=>{let r=t.find(t=>t.name===e.name);!r||r.isSystem||await o.confirm(a(`appDesigner.fieldDesigner.deleteConfirmTitle`),a(`appDesigner.fieldDesigner.deleteConfirmMessage`))&&n?.(t.filter(e=>e.id!==r.id))},[t,n,o,a]),b=(0,q.useCallback)(()=>{u(null),c(!0)},[]),x=(0,q.useCallback)(e=>{if(l){let r={...l,name:String(e.name||l.name),label:String(e.label||l.label),type:e.type||l.type,group:e.group?String(e.group):void 0,description:e.description?String(e.description):void 0,required:e.required===!0,unique:e.unique===!0,readonly:e.readonly===!0,hidden:e.hidden===!0,indexed:e.indexed===!0,externalId:e.externalId===!0,trackHistory:e.trackHistory===!0,defaultValue:e.defaultValue?String(e.defaultValue):void 0,placeholder:e.placeholder?String(e.placeholder):void 0,referenceTo:e.referenceTo?String(e.referenceTo):void 0,formula:e.formula?String(e.formula):void 0};n?.(t.map(e=>e.id===l.id?r:e))}else{let r={id:`fld_${Date.now()}`,name:String(e.name||`new_field_${t.length+1}`),label:String(e.label||`New Field ${t.length+1}`),type:e.type||`text`,group:e.group?String(e.group):void 0,description:e.description?String(e.description):void 0,required:e.required===!0,unique:e.unique===!0,readonly:e.readonly===!0,hidden:e.hidden===!0,indexed:e.indexed===!0,externalId:e.externalId===!0,trackHistory:e.trackHistory===!0,defaultValue:e.defaultValue?String(e.defaultValue):void 0,placeholder:e.placeholder?String(e.placeholder):void 0,referenceTo:e.referenceTo?String(e.referenceTo):void 0,formula:e.formula?String(e.formula):void 0,isSystem:!1};n?.([...t,r])}c(!1),u(null)},[l,t,n]),S=(0,q.useCallback)(e=>{e||(c(!1),u(null))},[]),C=(0,q.useMemo)(()=>cn.map(e=>({category:e,label:a(`appDesigner.fieldDesigner.typeCategory.${e}`),options:sn[e].map(e=>({label:on[e].label,value:e}))})),[a]),w=(0,q.useMemo)(()=>C.flatMap(e=>e.options),[C]),T=(0,q.useMemo)(()=>({type:`object-form`,formType:`drawer`,objectName:`field_definition`,mode:l?`edit`:`create`,title:l?`${a(`common.edit`)} — ${l.label}`:a(`appDesigner.fieldDesigner.addField`),open:s,onOpenChange:S,drawerSide:`right`,drawerWidth:`480px`,sections:[{name:`basic`,label:a(`appDesigner.fieldDesigner.basicSection`),fields:[{name:`name`,label:a(`appDesigner.fieldDesigner.fieldName`),type:`text`,required:!0,placeholder:`api_name`,disabled:r||(l?.isSystem??!1)},{name:`label`,label:a(`appDesigner.fieldDesigner.fieldLabel`),type:`text`,required:!0,placeholder:`Display Label`,disabled:r},{name:`type`,label:a(`appDesigner.fieldDesigner.fieldType`),type:`select`,required:!0,options:w,disabled:r||(l?.isSystem??!1)},{name:`required`,label:a(`appDesigner.fieldDesigner.required`),type:`boolean`,disabled:r},{name:`unique`,label:a(`appDesigner.fieldDesigner.unique`),type:`boolean`,disabled:r},{name:`description`,label:a(`appDesigner.fieldDesigner.description`),type:`textarea`,disabled:r}]},{name:`typeSpecific`,label:a(`appDesigner.fieldDesigner.typeSpecificSection`),fields:[{name:`referenceTo`,label:a(`appDesigner.fieldDesigner.referenceTo`),type:`text`,placeholder:`Referenced object`,disabled:r,condition:{field:`type`,equals:`lookup`}},{name:`formula`,label:a(`appDesigner.fieldDesigner.formula`),type:`textarea`,placeholder:`e.g. price * quantity`,disabled:r,condition:{field:`type`,equals:`formula`}},{name:`defaultValue`,label:a(`appDesigner.fieldDesigner.defaultValue`),type:`text`,placeholder:`Default value`,disabled:r},{name:`placeholder`,label:a(`appDesigner.fieldDesigner.placeholder`),type:`text`,placeholder:`Placeholder text`,disabled:r},{name:`group`,label:a(`appDesigner.fieldDesigner.fieldGroup`),type:`text`,placeholder:`Field Group`,disabled:r}]},{name:`advanced`,label:a(`appDesigner.fieldDesigner.advancedSection`),collapsible:!0,collapsed:!0,fields:[{name:`indexed`,label:a(`appDesigner.fieldDesigner.indexed`),type:`boolean`,disabled:r},{name:`externalId`,label:a(`appDesigner.fieldDesigner.externalId`),type:`boolean`,disabled:r},{name:`trackHistory`,label:a(`appDesigner.fieldDesigner.trackHistory`),type:`boolean`,disabled:r},{name:`readonly`,label:a(`appDesigner.fieldDesigner.readOnly`),type:`boolean`,disabled:r},{name:`hidden`,label:a(`appDesigner.fieldDesigner.hidden`),type:`boolean`,disabled:r}]}],initialValues:l?{name:l.name,label:l.label,type:l.type,group:l.group||``,description:l.description||``,required:l.required||!1,unique:l.unique||!1,readonly:l.readonly||!1,hidden:l.hidden||!1,indexed:l.indexed||!1,externalId:l.externalId||!1,trackHistory:l.trackHistory||!1,defaultValue:l.defaultValue==null?``:String(l.defaultValue),placeholder:l.placeholder||``,referenceTo:l.referenceTo||``,formula:l.formula||``}:{type:`text`,required:!1,unique:!1},onSuccess:x,onCancel:()=>S(!1),readOnly:r}),[l,s,S,x,w,r,a]);return(0,J.jsxs)(`div`,{"data-testid":`field-designer`,className:an(`w-full space-y-3`,i),children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(Pe,{className:`h-4 w-4 text-primary`}),(0,J.jsx)(`h2`,{className:`text-sm font-semibold`,children:a(`appDesigner.fieldDesigner.title`)}),e&&(0,J.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`— `,e]}),(0,J.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:m.length})]}),(0,J.jsxs)(`select`,{value:f,onChange:e=>p(e.target.value),"data-testid":`field-designer-type-filter`,className:`rounded-md border border-input bg-background px-2 py-1 text-xs outline-none transition-colors focus:border-primary focus:ring-1 focus:ring-primary`,children:[(0,J.jsx)(`option`,{value:``,children:a(`appDesigner.fieldDesigner.allTypes`)}),C.map(e=>(0,J.jsx)(`optgroup`,{label:e.label,children:e.options.map(e=>(0,J.jsx)(`option`,{value:e.value,children:e.label},e.value))},e.category))]})]}),(0,J.jsx)(Ue,{schema:_,dataSource:h,onEdit:r?void 0:v,onDelete:r?void 0:y,onAddRecord:r?void 0:b}),s&&(0,J.jsx)(He,{schema:T}),(0,J.jsx)(Ze,{isOpen:o.isOpen,title:o.title,message:o.message,confirmLabel:a(`common.delete`),cancelLabel:a(`common.cancel`),onConfirm:o.onConfirm,onCancel:o.onCancel,destructive:!0})]})}var un=`objectui-app-wizard-draft`;function dn(){let e=i(),{appName:t}=n(),{objects:r,refresh:a}=l(),c=s(),u=(r||[]).map(e=>({name:e.name,label:e.label||e.name,pluralLabel:e.pluralLabel,icon:e.icon,selected:!1})),d=(0,q.useCallback)(()=>{try{let e=localStorage.getItem(un);if(e)return JSON.parse(e)}catch{}},[]),f=(0,q.useCallback)(async t=>{try{let n=o(t),r=c?.getClient();r&&await r.meta.saveItem(`app`,t.name,n),localStorage.removeItem(un),K.success(`Application "${t.title}" created successfully`),await a?.(),e(`/apps/${t.name}`)}catch(e){K.error(e?.message||`Failed to create application`)}},[e,a,c]),p=(0,q.useCallback)(()=>{e(t?`/apps/${t}`:`/`)},[e,t]),m=(0,q.useCallback)(e=>{try{localStorage.setItem(un,JSON.stringify(e)),K.info(`Draft saved`)}catch{}},[]);return(0,J.jsx)(`div`,{className:`mx-auto max-w-4xl py-8 px-4`,"data-testid":`create-app-page`,children:(0,J.jsx)(Nt,{availableObjects:u,initialDraft:d(),onComplete:f,onCancel:p,onSaveDraft:m})})}function fn(){let e=i(),{appName:t,editAppName:r}=n(),{apps:a,objects:c,refresh:u}=l(),d=s(),f=r||t,p=a.find(e=>e.name===f),m=(c||[]).map(e=>({name:e.name,label:e.label||e.name,pluralLabel:e.pluralLabel,icon:e.icon,selected:p?.navigation?.some(t=>t.type===`object`&&t.objectName===e.name)??!1})),h=(0,q.useMemo)(()=>{if(p)return{name:p.name,title:p.title||p.label||``,description:p.description||``,icon:p.icon||``,layout:p.layout||`sidebar`,navigation:p.navigation||[],branding:{logo:p.branding?.logo||p.logo||``,primaryColor:p.branding?.primaryColor||`#3b82f6`,favicon:p.branding?.favicon||p.favicon||``}}},[p]),g=(0,q.useCallback)(async t=>{try{let n=o(t),r={...p,...n},i=d?.getClient();i&&await i.meta.saveItem(`app`,t.name,r),K.success(`Application "${t.title}" updated successfully`),await u?.(),e(`/apps/${t.name}`)}catch(e){K.error(e?.message||`Failed to update application`)}},[e,u,d,p]),_=(0,q.useCallback)(()=>{e(t?`/apps/${t}`:`/`)},[e,t]),v=(0,q.useCallback)(e=>{try{localStorage.setItem(`objectui-edit-draft-${f}`,JSON.stringify(e)),K.info(`Draft saved`)}catch{}},[f]);return p?(0,J.jsx)(`div`,{className:`mx-auto max-w-4xl py-8 px-4`,"data-testid":`edit-app-page`,children:(0,J.jsx)(Nt,{availableObjects:m,initialDraft:h,onComplete:g,onCancel:_,onSaveDraft:v})}):(0,J.jsx)(`div`,{className:`mx-auto max-w-4xl py-8 px-4 text-center`,"data-testid":`edit-app-not-found`,children:(0,J.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Application "`,f,`" not found.`]})})}function pn(){let e=i(),{dashboardName:t}=n(),r=s(),{dashboards:a,refresh:o}=l(),c=a?.find(e=>e.name===t),[u,d]=(0,q.useState)(()=>c||{type:`dashboard`,name:t??``,title:t??``,columns:2,widgets:[]}),f=(0,q.useRef)(u);f.current=u;let p=(0,q.useCallback)(async e=>{try{if(r)return await r.update(`sys_dashboard`,t,e),o().catch(()=>{}),!0}catch{}return!1},[r,t,o]),m=(0,q.useCallback)(async e=>{d(e),await p(e)},[p]);(0,q.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),p(f.current).then(e=>{e&&K.success(`Dashboard saved`)}))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p]);let h=(0,q.useCallback)(e=>{let n=new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${t||`dashboard`}.json`,i.click(),URL.revokeObjectURL(r),K.success(`Dashboard schema exported`)},[t]),g=(0,q.useCallback)(e=>{K.success(`Dashboard schema imported`),m(e)},[m]);return c?(0,J.jsxs)(`div`,{className:`h-full flex flex-col`,"data-testid":`dashboard-design-page`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 sm:px-6`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>e(-1),className:`rounded p-1.5 text-muted-foreground hover:text-foreground`,"aria-label":`Go back`,"data-testid":`dashboard-design-back`,children:(0,J.jsx)(x,{className:`h-4 w-4`})}),(0,J.jsxs)(`h1`,{className:`text-lg font-semibold tracking-tight truncate`,children:[`Edit Dashboard: `,c.label||c.title||t]})]}),(0,J.jsx)(`div`,{className:`flex-1 overflow-auto p-4 sm:p-6`,children:(0,J.jsx)(Xt,{schema:u,onChange:m,onExport:h,onImport:g})})]}):(0,J.jsxs)(`div`,{className:`h-full flex items-center justify-center text-muted-foreground`,children:[`Dashboard "`,t,`" not found`]})}var mn=t({AppCreationWizard:()=>Nt,BrandingEditor:()=>$t,CreateAppPage:()=>dn,DashboardDesignPage:()=>pn,DashboardEditor:()=>Xt,DataModelDesigner:()=>dt,EditAppPage:()=>fn,FieldDesigner:()=>ln,NavigationDesigner:()=>Ht,ObjectManager:()=>rn,PageDesigner:()=>at,ProcessDesigner:()=>gt,ReportDesigner:()=>yt});p.register(`page-designer`,at,{namespace:`plugin-designer`,label:`Page Designer`,category:`Designer`,inputs:[{name:`canvas`,type:`code`,label:`Canvas Configuration`},{name:`components`,type:`code`,label:`Components`},{name:`showComponentTree`,type:`boolean`,label:`Show Component Tree`,defaultValue:!0},{name:`undoRedo`,type:`boolean`,label:`Undo/Redo`,defaultValue:!0},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),p.register(`data-model-designer`,dt,{namespace:`plugin-designer`,label:`Data Model Designer`,category:`Designer`,inputs:[{name:`entities`,type:`code`,label:`Entities`},{name:`relationships`,type:`code`,label:`Relationships`},{name:`autoLayout`,type:`boolean`,label:`Auto Layout`,defaultValue:!1},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),p.register(`process-designer`,gt,{namespace:`plugin-designer`,label:`Process Designer (BPMN)`,category:`Designer`,inputs:[{name:`processName`,type:`string`,label:`Process Name`},{name:`nodes`,type:`code`,label:`Nodes`},{name:`edges`,type:`code`,label:`Edges`},{name:`showMinimap`,type:`boolean`,label:`Show Minimap`,defaultValue:!1},{name:`showToolbar`,type:`boolean`,label:`Show Toolbar`,defaultValue:!0},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),p.register(`report-designer`,yt,{namespace:`plugin-designer`,label:`Report Designer`,category:`Designer`,inputs:[{name:`reportName`,type:`string`,label:`Report Name`},{name:`objectName`,type:`string`,label:`Data Source Object`},{name:`sections`,type:`code`,label:`Sections`},{name:`showToolbar`,type:`boolean`,label:`Show Toolbar`,defaultValue:!0},{name:`showPropertyPanel`,type:`boolean`,label:`Show Property Panel`,defaultValue:!0},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),p.register(`app-creation-wizard`,Nt,{namespace:`plugin-designer`,label:`App Creation Wizard`,category:`Designer`,inputs:[{name:`availableObjects`,type:`code`,label:`Available Objects`},{name:`templates`,type:`code`,label:`Templates`},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),p.register(`navigation-designer`,Ht,{namespace:`plugin-designer`,label:`Navigation Designer`,category:`Designer`,inputs:[{name:`items`,type:`code`,label:`Navigation Items`},{name:`showPreview`,type:`boolean`,label:`Show Preview`,defaultValue:!0},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),p.register(`dashboard-editor`,Xt,{namespace:`plugin-designer`,label:`Dashboard Editor`,category:`Designer`,inputs:[{name:`schema`,type:`code`,label:`Dashboard Schema`},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),p.register(`branding-editor`,$t,{namespace:`plugin-designer`,label:`Branding Editor`,category:`Designer`,inputs:[{name:`branding`,type:`code`,label:`Branding Config`},{name:`appTitle`,type:`string`,label:`App Title`},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),p.register(`object-manager`,rn,{namespace:`plugin-designer`,label:`Object Manager`,category:`Designer`,inputs:[{name:`objects`,type:`code`,label:`Object Definitions`},{name:`showSystemObjects`,type:`boolean`,label:`Show System Objects`,defaultValue:!0},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]}),p.register(`field-designer`,ln,{namespace:`plugin-designer`,label:`Field Designer`,category:`Designer`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`},{name:`fields`,type:`code`,label:`Field Definitions`},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}]});export{ln as n,mn as t};
@@ -1,2 +1,2 @@
1
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{g as t,r as n,y as r}from"./vendor-react-BGDDiZfJ.js";import{Kt as i}from"./framework-CWU64Lvg.js";import{Bt as a}from"./ui-components-DHIW7RSX.js";var o=e(r(),1),s=n(),c=o.lazy(()=>t(()=>import(`./MonacoImpl-nyLaER8_.js`),[],import.meta.url)),l=({schema:e,value:t,onChange:n})=>(0,s.jsx)(o.Suspense,{fallback:(0,s.jsx)(a,{className:`w-full h-[400px]`}),children:(0,s.jsx)(c,{value:t??e.value,language:e.language,theme:e.theme,height:e.height,onChange:n??e.onChange,readOnly:e.readOnly,className:e.className})});i.register(`code-editor`,l,{namespace:`plugin-editor`,label:`Code Editor`,category:`plugin`,inputs:[{name:`value`,type:`string`,label:`Code`,defaultValue:``},{name:`language`,type:`enum`,label:`Language`,enum:[`javascript`,`typescript`,`python`,`json`,`html`,`css`],defaultValue:`javascript`},{name:`theme`,type:`enum`,label:`Theme`,enum:[`vs-dark`,`light`],defaultValue:`vs-dark`},{name:`height`,type:`string`,label:`Height`,defaultValue:`400px`},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}],defaultProps:{value:`// Write your code here
1
+ import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{g as t,r as n,y as r}from"./vendor-react-BKSb6vFP.js";import{qt as i}from"./framework-DNWcCoBP.js";import{Bt as a}from"./ui-components-CmbUYw-E.js";var o=e(r(),1),s=n(),c=o.lazy(()=>t(()=>import(`./MonacoImpl-_--K1JSa.js`),[],import.meta.url)),l=({schema:e,value:t,onChange:n})=>(0,s.jsx)(o.Suspense,{fallback:(0,s.jsx)(a,{className:`w-full h-[400px]`}),children:(0,s.jsx)(c,{value:t??e.value,language:e.language,theme:e.theme,height:e.height,onChange:n??e.onChange,readOnly:e.readOnly,className:e.className})});i.register(`code-editor`,l,{namespace:`plugin-editor`,label:`Code Editor`,category:`plugin`,inputs:[{name:`value`,type:`string`,label:`Code`,defaultValue:``},{name:`language`,type:`enum`,label:`Language`,enum:[`javascript`,`typescript`,`python`,`json`,`html`,`css`],defaultValue:`javascript`},{name:`theme`,type:`enum`,label:`Theme`,enum:[`vs-dark`,`light`],defaultValue:`vs-dark`},{name:`height`,type:`string`,label:`Height`,defaultValue:`400px`},{name:`readOnly`,type:`boolean`,label:`Read Only`,defaultValue:!1}],defaultProps:{value:`// Write your code here
2
2
  console.log("Hello, World!");`,language:`javascript`,theme:`vs-dark`,height:`400px`,readOnly:!1}});export{l as CodeEditorRenderer};
@@ -1 +1 @@
1
- import{dn as e,sn as t,u as n}from"./vendor-charts-D_CNNxD5.js";import{n as r}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{t as i}from"./src-D0ZYDfff.js";import{O as a,c as o,s,x as c}from"./chunk-WYO6CB5R-Cndg0Yo5.js";import"./chunk-HOUHSVGY-B5nScni0.js";import{g as l}from"./chunk-ICXQ74PX-zJg8KmvA.js";import"./chunk-Q4XR5HBZ-BP9atbVx.js";import"./chunk-7BUUIJ7U-Bb538aSH.js";import"./chunk-OGEWGWER-bKk51Nxt.js";import{t as u}from"./graphlib-B8gBHxth.js";import{t as d}from"./dagre-CXRCoUWR.js";import"./chunk-32BRIVSS-BbTX8O4m.js";import"./chunk-XXDRQBXY-DGANY6E3.js";import"./chunk-VR4S4FIN-jB_W-MHs.js";import"./chunk-C7G6YPKG-UMP_bNDd.js";import"./chunk-ZGVPDNZ5-BUUSzPje.js";import"./chunk-52WLFC77-DkgICN4F.js";import"./chunk-FWX5IMBZ-B8cCL4T7.js";import{i as f,n as p,t as m}from"./chunk-EX3LRPZG-B0dJ64Ff.js";var h=r(e=>e.append(`circle`).attr(`class`,`start-state`).attr(`r`,c().state.sizeUnit).attr(`cx`,c().state.padding+c().state.sizeUnit).attr(`cy`,c().state.padding+c().state.sizeUnit),`drawStartState`),g=r(e=>e.append(`line`).style(`stroke`,`grey`).style(`stroke-dasharray`,`3`).attr(`x1`,c().state.textHeight).attr(`class`,`divider`).attr(`x2`,c().state.textHeight*2).attr(`y1`,0).attr(`y2`,0),`drawDivider`),_=r((e,t)=>{let n=e.append(`text`).attr(`x`,2*c().state.padding).attr(`y`,c().state.textHeight+2*c().state.padding).attr(`font-size`,c().state.fontSize).attr(`class`,`state-title`).text(t.id),r=n.node().getBBox();return e.insert(`rect`,`:first-child`).attr(`x`,c().state.padding).attr(`y`,c().state.padding).attr(`width`,r.width+2*c().state.padding).attr(`height`,r.height+2*c().state.padding).attr(`rx`,c().state.radius),n},`drawSimpleState`),v=r((e,t)=>{let n=r(function(e,t,n){let r=e.append(`tspan`).attr(`x`,2*c().state.padding).text(t);n||r.attr(`dy`,c().state.textHeight)},`addTspan`),i=e.append(`text`).attr(`x`,2*c().state.padding).attr(`y`,c().state.textHeight+1.3*c().state.padding).attr(`font-size`,c().state.fontSize).attr(`class`,`state-title`).text(t.descriptions[0]).node().getBBox(),a=i.height,o=e.append(`text`).attr(`x`,c().state.padding).attr(`y`,a+c().state.padding*.4+c().state.dividerMargin+c().state.textHeight).attr(`class`,`state-description`),s=!0,l=!0;t.descriptions.forEach(function(e){s||(n(o,e,l),l=!1),s=!1});let u=e.append(`line`).attr(`x1`,c().state.padding).attr(`y1`,c().state.padding+a+c().state.dividerMargin/2).attr(`y2`,c().state.padding+a+c().state.dividerMargin/2).attr(`class`,`descr-divider`),d=o.node().getBBox(),f=Math.max(d.width,i.width);return u.attr(`x2`,f+3*c().state.padding),e.insert(`rect`,`:first-child`).attr(`x`,c().state.padding).attr(`y`,c().state.padding).attr(`width`,f+2*c().state.padding).attr(`height`,d.height+a+2*c().state.padding).attr(`rx`,c().state.radius),e},`drawDescrState`),y=r((e,t,n)=>{let r=c().state.padding,i=2*c().state.padding,a=e.node().getBBox(),o=a.width,s=a.x,l=e.append(`text`).attr(`x`,0).attr(`y`,c().state.titleShift).attr(`font-size`,c().state.fontSize).attr(`class`,`state-title`).text(t.id),u=l.node().getBBox().width+i,d=Math.max(u,o);d===o&&(d+=i);let f,p=e.node().getBBox();t.doc,f=s-r,u>o&&(f=(o-d)/2+r),Math.abs(s-p.x)<r&&u>o&&(f=s-(u-o)/2);let m=1-c().state.textHeight;return e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,m).attr(`class`,n?`alt-composit`:`composit`).attr(`width`,d).attr(`height`,p.height+c().state.textHeight+c().state.titleShift+1).attr(`rx`,`0`),l.attr(`x`,f+r),u<=o&&l.attr(`x`,s+(d-i)/2-u/2+r),e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,c().state.titleShift-c().state.textHeight-c().state.padding).attr(`width`,d).attr(`height`,c().state.textHeight*3).attr(`rx`,c().state.radius),e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,c().state.titleShift-c().state.textHeight-c().state.padding).attr(`width`,d).attr(`height`,p.height+3+2*c().state.textHeight).attr(`rx`,c().state.radius),e},`addTitleAndBox`),b=r(e=>(e.append(`circle`).attr(`class`,`end-state-outer`).attr(`r`,c().state.sizeUnit+c().state.miniPadding).attr(`cx`,c().state.padding+c().state.sizeUnit+c().state.miniPadding).attr(`cy`,c().state.padding+c().state.sizeUnit+c().state.miniPadding),e.append(`circle`).attr(`class`,`end-state-inner`).attr(`r`,c().state.sizeUnit).attr(`cx`,c().state.padding+c().state.sizeUnit+2).attr(`cy`,c().state.padding+c().state.sizeUnit+2)),`drawEndState`),x=r((e,t)=>{let n=c().state.forkWidth,r=c().state.forkHeight;if(t.parentId){let e=n;n=r,r=e}return e.append(`rect`).style(`stroke`,`black`).style(`fill`,`black`).attr(`width`,n).attr(`height`,r).attr(`x`,c().state.padding).attr(`y`,c().state.padding)},`drawForkJoinState`),S=r((e,t,n,r)=>{let i=0,a=r.append(`text`);a.style(`text-anchor`,`start`),a.attr(`class`,`noteText`);let o=e.replace(/\r\n/g,`<br/>`);o=o.replace(/\n/g,`<br/>`);let l=o.split(s.lineBreakRegex),u=1.25*c().state.noteMargin;for(let e of l){let r=e.trim();if(r.length>0){let e=a.append(`tspan`);if(e.text(r),u===0){let t=e.node().getBBox();u+=t.height}i+=u,e.attr(`x`,t+c().state.noteMargin),e.attr(`y`,n+i+1.25*c().state.noteMargin)}}return{textWidth:a.node().getBBox().width,textHeight:i}},`_drawLongText`),C=r((e,t)=>{t.attr(`class`,`state-note`);let n=t.append(`rect`).attr(`x`,0).attr(`y`,c().state.padding),{textWidth:r,textHeight:i}=S(e,0,0,t.append(`g`));return n.attr(`height`,i+2*c().state.noteMargin),n.attr(`width`,r+c().state.noteMargin*2),n},`drawNote`),w=r(function(e,t){let n=t.id,r={id:n,label:t.id,width:0,height:0},i=e.append(`g`).attr(`id`,n).attr(`class`,`stateGroup`);t.type===`start`&&h(i),t.type===`end`&&b(i),(t.type===`fork`||t.type===`join`)&&x(i,t),t.type===`note`&&C(t.note.text,i),t.type===`divider`&&g(i),t.type==="default"&&t.descriptions.length===0&&_(i,t),t.type==="default"&&t.descriptions.length>0&&v(i,t);let a=i.node().getBBox();return r.width=a.width+2*c().state.padding,r.height=a.height+2*c().state.padding,r},`drawState`),T=0,E=r(function(n,o,u){let d=r(function(e){switch(e){case m.relationType.AGGREGATION:return`aggregation`;case m.relationType.EXTENSION:return`extension`;case m.relationType.COMPOSITION:return`composition`;case m.relationType.DEPENDENCY:return`dependency`}},`getRelationType`);o.points=o.points.filter(e=>!Number.isNaN(e.y));let f=o.points,p=e().x(function(e){return e.x}).y(function(e){return e.y}).curve(t),h=n.append(`path`).attr(`d`,p(f)).attr(`id`,`edge`+T).attr(`class`,`transition`),g=``;if(c().state.arrowMarkerAbsolute&&(g=a(!0)),h.attr(`marker-end`,`url(`+g+`#`+d(m.relationType.DEPENDENCY)+`End)`),u.title!==void 0){let e=n.append(`g`).attr(`class`,`stateLabel`),{x:t,y:r}=l.calcLabelPosition(o.points),a=s.getRows(u.title),d=0,f=[],p=0,m=0;for(let n=0;n<=a.length;n++){let o=e.append(`text`).attr(`text-anchor`,`middle`).text(a[n]).attr(`x`,t).attr(`y`,r+d),s=o.node().getBBox();p=Math.max(p,s.width),m=Math.min(m,s.x),i.info(s.x,t,r+d),d===0&&(d=o.node().getBBox().height,i.info(`Title height`,d,r)),f.push(o)}let h=d*a.length;if(a.length>1){let e=(a.length-1)*d*.5;f.forEach((t,n)=>t.attr(`y`,r+n*d-e)),h=d*a.length}let g=e.node().getBBox();e.insert(`rect`,`:first-child`).attr(`class`,`box`).attr(`x`,t-p/2-c().state.padding/2).attr(`y`,r-h/2-c().state.padding/2-3.5).attr(`width`,p+c().state.padding).attr(`height`,h+c().state.padding),i.info(g)}T++},`drawEdge`),D,O={},k=r(function(){},`setConf`),A=r(function(e){e.append(`defs`).append(`marker`).attr(`id`,`dependencyEnd`).attr(`refX`,19).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 19,7 L9,13 L14,7 L9,1 Z`)},`insertMarkers`),j=r(function(e,t,r,a){D=c().state;let s=c().securityLevel,l;s===`sandbox`&&(l=n(`#i`+t));let u=n(s===`sandbox`?l.nodes()[0].contentDocument.body:`body`),d=s===`sandbox`?l.nodes()[0].contentDocument:document;i.debug(`Rendering diagram `+e);let f=u.select(`[id='${t}']`);A(f),N(a.db.getRootDoc(),f.append(`g`).attr(`id`,t+`-root`),void 0,!1,u,d,a);let p=D.padding,m=f.node().getBBox(),h=m.width+p*2,g=m.height+p*2;o(f,g,h*1.75,D.useMaxWidth),f.attr(`viewBox`,`${m.x-D.padding} ${m.y-D.padding} `+h+` `+g)},`draw`),M=r(e=>e?e.length*D.fontSizeFactor:1,`getLabelWidth`),N=r((e,t,n,r,a,o,c)=>{let l=new u({compound:!0,multigraph:!0}),f,p=!0;for(f=0;f<e.length;f++)if(e[f].stmt===`relation`){p=!1;break}n?l.setGraph({rankdir:`LR`,multigraph:!0,compound:!0,ranker:`tight-tree`,ranksep:p?1:D.edgeLengthFactor,nodeSep:p?1:50,isMultiGraph:!0}):l.setGraph({rankdir:`TB`,multigraph:!0,compound:!0,ranksep:p?1:D.edgeLengthFactor,nodeSep:p?1:50,ranker:`tight-tree`,isMultiGraph:!0}),l.setDefaultEdgeLabel(function(){return{}});let m=c.db.getStates(),h=c.db.getRelations(),g=Object.keys(m);for(let e of g){let i=m[e];n&&(i.parentId=n);let s;if(i.doc){let e=t.append(`g`).attr(`id`,i.id).attr(`class`,`stateGroup`);s=N(i.doc,e,i.id,!r,a,o,c);{e=y(e,i,r);let t=e.node().getBBox();s.width=t.width,s.height=t.height+D.padding/2,O[i.id]={y:D.compositTitleSize}}}else s=w(t,i,l);if(i.note){let e=w(t,{descriptions:[],id:i.id+`-note`,note:i.note,type:`note`},l);i.note.position===`left of`?(l.setNode(s.id+`-note`,e),l.setNode(s.id,s)):(l.setNode(s.id,s),l.setNode(s.id+`-note`,e)),l.setParent(s.id,s.id+`-group`),l.setParent(s.id+`-note`,s.id+`-group`)}else l.setNode(s.id,s)}i.debug(`Count=`,l.nodeCount(),l);let _=0;h.forEach(function(e){_++,i.debug(`Setting edge`,e),l.setEdge(e.id1,e.id2,{relation:e,width:M(e.title),height:D.labelHeight*s.getRows(e.title).length,labelpos:`c`},`id`+_)}),d(l),i.debug(`Graph after layout`,l.nodes());let v=t.node();l.nodes().forEach(function(e){e!==void 0&&l.node(e)!==void 0?(i.warn(`Node `+e+`: `+JSON.stringify(l.node(e))),a.select(`#`+v.id+` #`+e).attr(`transform`,`translate(`+(l.node(e).x-l.node(e).width/2)+`,`+(l.node(e).y+(O[e]?O[e].y:0)-l.node(e).height/2)+` )`),a.select(`#`+v.id+` #`+e).attr(`data-x-shift`,l.node(e).x-l.node(e).width/2),o.querySelectorAll(`#`+v.id+` #`+e+` .divider`).forEach(e=>{let t=e.parentElement,n=0,r=0;t&&(t.parentElement&&(n=t.parentElement.getBBox().width),r=parseInt(t.getAttribute(`data-x-shift`),10),Number.isNaN(r)&&(r=0)),e.setAttribute(`x1`,0-r+8),e.setAttribute(`x2`,n-r-8)})):i.debug(`No Node `+e+`: `+JSON.stringify(l.node(e)))});let b=v.getBBox();l.edges().forEach(function(e){e!==void 0&&l.edge(e)!==void 0&&(i.debug(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(l.edge(e))),E(t,l.edge(e),l.edge(e).relation))}),b=v.getBBox();let x={id:n||`root`,label:n||`root`,width:0,height:0};return x.width=b.width+2*D.padding,x.height=b.height+2*D.padding,i.debug(`Doc rendered`,x,l),x},`renderDoc`),P={parser:p,get db(){return new m(1)},renderer:{setConf:k,draw:j},styles:f,init:r(e=>{e.state||={},e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{P as diagram};
1
+ import{dn as e,sn as t,u as n}from"./vendor-charts-HLBqza5P.js";import{n as r}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{t as i}from"./src-CKPhOIOh.js";import{O as a,c as o,s,x as c}from"./chunk-WYO6CB5R-C0_XZtpj.js";import"./chunk-HOUHSVGY-Bfkm0El3.js";import{g as l}from"./chunk-ICXQ74PX-WsDRuBhL.js";import"./chunk-Q4XR5HBZ-B99LraLe.js";import"./chunk-7BUUIJ7U-Bb538aSH.js";import"./chunk-OGEWGWER-CSkoB3Mi.js";import{t as u}from"./graphlib-DS17s2tU.js";import{t as d}from"./dagre-dpRSp0QF.js";import"./chunk-32BRIVSS-CjQ2uFsO.js";import"./chunk-XXDRQBXY-CtU5D9C8.js";import"./chunk-VR4S4FIN-B2IyRlJ4.js";import"./chunk-C7G6YPKG-CrZlt4pv.js";import"./chunk-ZGVPDNZ5-Bq7O6ELQ.js";import"./chunk-52WLFC77-BBx3j8yk.js";import"./chunk-FWX5IMBZ-cqzp-iMz.js";import{i as f,n as p,t as m}from"./chunk-EX3LRPZG-x9nXH4xc.js";var h=r(e=>e.append(`circle`).attr(`class`,`start-state`).attr(`r`,c().state.sizeUnit).attr(`cx`,c().state.padding+c().state.sizeUnit).attr(`cy`,c().state.padding+c().state.sizeUnit),`drawStartState`),g=r(e=>e.append(`line`).style(`stroke`,`grey`).style(`stroke-dasharray`,`3`).attr(`x1`,c().state.textHeight).attr(`class`,`divider`).attr(`x2`,c().state.textHeight*2).attr(`y1`,0).attr(`y2`,0),`drawDivider`),_=r((e,t)=>{let n=e.append(`text`).attr(`x`,2*c().state.padding).attr(`y`,c().state.textHeight+2*c().state.padding).attr(`font-size`,c().state.fontSize).attr(`class`,`state-title`).text(t.id),r=n.node().getBBox();return e.insert(`rect`,`:first-child`).attr(`x`,c().state.padding).attr(`y`,c().state.padding).attr(`width`,r.width+2*c().state.padding).attr(`height`,r.height+2*c().state.padding).attr(`rx`,c().state.radius),n},`drawSimpleState`),v=r((e,t)=>{let n=r(function(e,t,n){let r=e.append(`tspan`).attr(`x`,2*c().state.padding).text(t);n||r.attr(`dy`,c().state.textHeight)},`addTspan`),i=e.append(`text`).attr(`x`,2*c().state.padding).attr(`y`,c().state.textHeight+1.3*c().state.padding).attr(`font-size`,c().state.fontSize).attr(`class`,`state-title`).text(t.descriptions[0]).node().getBBox(),a=i.height,o=e.append(`text`).attr(`x`,c().state.padding).attr(`y`,a+c().state.padding*.4+c().state.dividerMargin+c().state.textHeight).attr(`class`,`state-description`),s=!0,l=!0;t.descriptions.forEach(function(e){s||(n(o,e,l),l=!1),s=!1});let u=e.append(`line`).attr(`x1`,c().state.padding).attr(`y1`,c().state.padding+a+c().state.dividerMargin/2).attr(`y2`,c().state.padding+a+c().state.dividerMargin/2).attr(`class`,`descr-divider`),d=o.node().getBBox(),f=Math.max(d.width,i.width);return u.attr(`x2`,f+3*c().state.padding),e.insert(`rect`,`:first-child`).attr(`x`,c().state.padding).attr(`y`,c().state.padding).attr(`width`,f+2*c().state.padding).attr(`height`,d.height+a+2*c().state.padding).attr(`rx`,c().state.radius),e},`drawDescrState`),y=r((e,t,n)=>{let r=c().state.padding,i=2*c().state.padding,a=e.node().getBBox(),o=a.width,s=a.x,l=e.append(`text`).attr(`x`,0).attr(`y`,c().state.titleShift).attr(`font-size`,c().state.fontSize).attr(`class`,`state-title`).text(t.id),u=l.node().getBBox().width+i,d=Math.max(u,o);d===o&&(d+=i);let f,p=e.node().getBBox();t.doc,f=s-r,u>o&&(f=(o-d)/2+r),Math.abs(s-p.x)<r&&u>o&&(f=s-(u-o)/2);let m=1-c().state.textHeight;return e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,m).attr(`class`,n?`alt-composit`:`composit`).attr(`width`,d).attr(`height`,p.height+c().state.textHeight+c().state.titleShift+1).attr(`rx`,`0`),l.attr(`x`,f+r),u<=o&&l.attr(`x`,s+(d-i)/2-u/2+r),e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,c().state.titleShift-c().state.textHeight-c().state.padding).attr(`width`,d).attr(`height`,c().state.textHeight*3).attr(`rx`,c().state.radius),e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,c().state.titleShift-c().state.textHeight-c().state.padding).attr(`width`,d).attr(`height`,p.height+3+2*c().state.textHeight).attr(`rx`,c().state.radius),e},`addTitleAndBox`),b=r(e=>(e.append(`circle`).attr(`class`,`end-state-outer`).attr(`r`,c().state.sizeUnit+c().state.miniPadding).attr(`cx`,c().state.padding+c().state.sizeUnit+c().state.miniPadding).attr(`cy`,c().state.padding+c().state.sizeUnit+c().state.miniPadding),e.append(`circle`).attr(`class`,`end-state-inner`).attr(`r`,c().state.sizeUnit).attr(`cx`,c().state.padding+c().state.sizeUnit+2).attr(`cy`,c().state.padding+c().state.sizeUnit+2)),`drawEndState`),x=r((e,t)=>{let n=c().state.forkWidth,r=c().state.forkHeight;if(t.parentId){let e=n;n=r,r=e}return e.append(`rect`).style(`stroke`,`black`).style(`fill`,`black`).attr(`width`,n).attr(`height`,r).attr(`x`,c().state.padding).attr(`y`,c().state.padding)},`drawForkJoinState`),S=r((e,t,n,r)=>{let i=0,a=r.append(`text`);a.style(`text-anchor`,`start`),a.attr(`class`,`noteText`);let o=e.replace(/\r\n/g,`<br/>`);o=o.replace(/\n/g,`<br/>`);let l=o.split(s.lineBreakRegex),u=1.25*c().state.noteMargin;for(let e of l){let r=e.trim();if(r.length>0){let e=a.append(`tspan`);if(e.text(r),u===0){let t=e.node().getBBox();u+=t.height}i+=u,e.attr(`x`,t+c().state.noteMargin),e.attr(`y`,n+i+1.25*c().state.noteMargin)}}return{textWidth:a.node().getBBox().width,textHeight:i}},`_drawLongText`),C=r((e,t)=>{t.attr(`class`,`state-note`);let n=t.append(`rect`).attr(`x`,0).attr(`y`,c().state.padding),{textWidth:r,textHeight:i}=S(e,0,0,t.append(`g`));return n.attr(`height`,i+2*c().state.noteMargin),n.attr(`width`,r+c().state.noteMargin*2),n},`drawNote`),w=r(function(e,t){let n=t.id,r={id:n,label:t.id,width:0,height:0},i=e.append(`g`).attr(`id`,n).attr(`class`,`stateGroup`);t.type===`start`&&h(i),t.type===`end`&&b(i),(t.type===`fork`||t.type===`join`)&&x(i,t),t.type===`note`&&C(t.note.text,i),t.type===`divider`&&g(i),t.type==="default"&&t.descriptions.length===0&&_(i,t),t.type==="default"&&t.descriptions.length>0&&v(i,t);let a=i.node().getBBox();return r.width=a.width+2*c().state.padding,r.height=a.height+2*c().state.padding,r},`drawState`),T=0,E=r(function(n,o,u){let d=r(function(e){switch(e){case m.relationType.AGGREGATION:return`aggregation`;case m.relationType.EXTENSION:return`extension`;case m.relationType.COMPOSITION:return`composition`;case m.relationType.DEPENDENCY:return`dependency`}},`getRelationType`);o.points=o.points.filter(e=>!Number.isNaN(e.y));let f=o.points,p=e().x(function(e){return e.x}).y(function(e){return e.y}).curve(t),h=n.append(`path`).attr(`d`,p(f)).attr(`id`,`edge`+T).attr(`class`,`transition`),g=``;if(c().state.arrowMarkerAbsolute&&(g=a(!0)),h.attr(`marker-end`,`url(`+g+`#`+d(m.relationType.DEPENDENCY)+`End)`),u.title!==void 0){let e=n.append(`g`).attr(`class`,`stateLabel`),{x:t,y:r}=l.calcLabelPosition(o.points),a=s.getRows(u.title),d=0,f=[],p=0,m=0;for(let n=0;n<=a.length;n++){let o=e.append(`text`).attr(`text-anchor`,`middle`).text(a[n]).attr(`x`,t).attr(`y`,r+d),s=o.node().getBBox();p=Math.max(p,s.width),m=Math.min(m,s.x),i.info(s.x,t,r+d),d===0&&(d=o.node().getBBox().height,i.info(`Title height`,d,r)),f.push(o)}let h=d*a.length;if(a.length>1){let e=(a.length-1)*d*.5;f.forEach((t,n)=>t.attr(`y`,r+n*d-e)),h=d*a.length}let g=e.node().getBBox();e.insert(`rect`,`:first-child`).attr(`class`,`box`).attr(`x`,t-p/2-c().state.padding/2).attr(`y`,r-h/2-c().state.padding/2-3.5).attr(`width`,p+c().state.padding).attr(`height`,h+c().state.padding),i.info(g)}T++},`drawEdge`),D,O={},k=r(function(){},`setConf`),A=r(function(e){e.append(`defs`).append(`marker`).attr(`id`,`dependencyEnd`).attr(`refX`,19).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 19,7 L9,13 L14,7 L9,1 Z`)},`insertMarkers`),j=r(function(e,t,r,a){D=c().state;let s=c().securityLevel,l;s===`sandbox`&&(l=n(`#i`+t));let u=n(s===`sandbox`?l.nodes()[0].contentDocument.body:`body`),d=s===`sandbox`?l.nodes()[0].contentDocument:document;i.debug(`Rendering diagram `+e);let f=u.select(`[id='${t}']`);A(f),N(a.db.getRootDoc(),f.append(`g`).attr(`id`,t+`-root`),void 0,!1,u,d,a);let p=D.padding,m=f.node().getBBox(),h=m.width+p*2,g=m.height+p*2;o(f,g,h*1.75,D.useMaxWidth),f.attr(`viewBox`,`${m.x-D.padding} ${m.y-D.padding} `+h+` `+g)},`draw`),M=r(e=>e?e.length*D.fontSizeFactor:1,`getLabelWidth`),N=r((e,t,n,r,a,o,c)=>{let l=new u({compound:!0,multigraph:!0}),f,p=!0;for(f=0;f<e.length;f++)if(e[f].stmt===`relation`){p=!1;break}n?l.setGraph({rankdir:`LR`,multigraph:!0,compound:!0,ranker:`tight-tree`,ranksep:p?1:D.edgeLengthFactor,nodeSep:p?1:50,isMultiGraph:!0}):l.setGraph({rankdir:`TB`,multigraph:!0,compound:!0,ranksep:p?1:D.edgeLengthFactor,nodeSep:p?1:50,ranker:`tight-tree`,isMultiGraph:!0}),l.setDefaultEdgeLabel(function(){return{}});let m=c.db.getStates(),h=c.db.getRelations(),g=Object.keys(m);for(let e of g){let i=m[e];n&&(i.parentId=n);let s;if(i.doc){let e=t.append(`g`).attr(`id`,i.id).attr(`class`,`stateGroup`);s=N(i.doc,e,i.id,!r,a,o,c);{e=y(e,i,r);let t=e.node().getBBox();s.width=t.width,s.height=t.height+D.padding/2,O[i.id]={y:D.compositTitleSize}}}else s=w(t,i,l);if(i.note){let e=w(t,{descriptions:[],id:i.id+`-note`,note:i.note,type:`note`},l);i.note.position===`left of`?(l.setNode(s.id+`-note`,e),l.setNode(s.id,s)):(l.setNode(s.id,s),l.setNode(s.id+`-note`,e)),l.setParent(s.id,s.id+`-group`),l.setParent(s.id+`-note`,s.id+`-group`)}else l.setNode(s.id,s)}i.debug(`Count=`,l.nodeCount(),l);let _=0;h.forEach(function(e){_++,i.debug(`Setting edge`,e),l.setEdge(e.id1,e.id2,{relation:e,width:M(e.title),height:D.labelHeight*s.getRows(e.title).length,labelpos:`c`},`id`+_)}),d(l),i.debug(`Graph after layout`,l.nodes());let v=t.node();l.nodes().forEach(function(e){e!==void 0&&l.node(e)!==void 0?(i.warn(`Node `+e+`: `+JSON.stringify(l.node(e))),a.select(`#`+v.id+` #`+e).attr(`transform`,`translate(`+(l.node(e).x-l.node(e).width/2)+`,`+(l.node(e).y+(O[e]?O[e].y:0)-l.node(e).height/2)+` )`),a.select(`#`+v.id+` #`+e).attr(`data-x-shift`,l.node(e).x-l.node(e).width/2),o.querySelectorAll(`#`+v.id+` #`+e+` .divider`).forEach(e=>{let t=e.parentElement,n=0,r=0;t&&(t.parentElement&&(n=t.parentElement.getBBox().width),r=parseInt(t.getAttribute(`data-x-shift`),10),Number.isNaN(r)&&(r=0)),e.setAttribute(`x1`,0-r+8),e.setAttribute(`x2`,n-r-8)})):i.debug(`No Node `+e+`: `+JSON.stringify(l.node(e)))});let b=v.getBBox();l.edges().forEach(function(e){e!==void 0&&l.edge(e)!==void 0&&(i.debug(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(l.edge(e))),E(t,l.edge(e),l.edge(e).relation))}),b=v.getBBox();let x={id:n||`root`,label:n||`root`,width:0,height:0};return x.width=b.width+2*D.padding,x.height=b.height+2*D.padding,i.debug(`Doc rendered`,x,l),x},`renderDoc`),P={parser:p,get db(){return new m(1)},renderer:{setConf:k,draw:j},styles:f,init:r(e=>{e.state||={},e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{P as diagram};
@@ -0,0 +1 @@
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import"./src-CKPhOIOh.js";import"./chunk-WYO6CB5R-C0_XZtpj.js";import"./chunk-HOUHSVGY-Bfkm0El3.js";import"./chunk-ICXQ74PX-WsDRuBhL.js";import"./chunk-Q4XR5HBZ-B99LraLe.js";import"./chunk-7BUUIJ7U-Bb538aSH.js";import"./chunk-OGEWGWER-CSkoB3Mi.js";import"./chunk-32BRIVSS-CjQ2uFsO.js";import"./chunk-XXDRQBXY-CtU5D9C8.js";import"./chunk-VR4S4FIN-B2IyRlJ4.js";import"./chunk-C7G6YPKG-CrZlt4pv.js";import"./chunk-ZGVPDNZ5-Bq7O6ELQ.js";import"./chunk-52WLFC77-BBx3j8yk.js";import"./chunk-FWX5IMBZ-cqzp-iMz.js";import{i as t,n,r,t as i}from"./chunk-EX3LRPZG-x9nXH4xc.js";var a={parser:n,get db(){return new i(2)},renderer:r,styles:t,init:e(e=>{e.state||={},e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{f as t,h as n,m as r,y as i}from"./vendor-react-BKSb6vFP.js";import{J as a,L as o,R as s,l as c}from"./framework-DNWcCoBP.js";import{Ft as l}from"./ui-components-CmbUYw-E.js";import{r as u}from"./vendor-ui-utils-D-WJ115h.js";import"./AdapterProvider-CmeZULrO.js";import{o as d}from"./MetadataProvider-DRMpRtkE.js";import{d as f,r as p}from"./useRecordApprovals-CwD1sHs0.js";import{_ as m,f as h,v as g,y as _}from"./plugin-chatbot-5rciOKdr.js";import{n as v}from"./ui-layout-elT9p0KY.js";import{r as y}from"./appRoute-C7XNGt8B.js";var b=e(i(),1);function x({objectName:e,objectLabel:n,dataSource:i,onEdit:o,onRefresh:s,onConfirm:l,onToast:d}){let f=t(),{appName:p}=r(),{t:m}=c(),h=`/apps/${p}`,{execute:g,loading:_,error:v,runner:y}=a({context:{objectName:e,objectLabel:n||e,baseUrl:h},onConfirm:l,onToast:d});return(0,b.useEffect)(()=>{y.registerHandler(`create`,async()=>(o?.(null),{success:!0})),y.registerHandler(`delete`,async t=>{let r=Array.isArray(t.params?.records)?t.params.records.filter(e=>e?.id!=null):null;if(r&&r.length>1){let t=await Promise.allSettled(r.map(t=>i.delete(e,t.id))),a=t.filter(e=>e.status===`rejected`).length,o=t.length-a;return s?.(),a===0?(u.success(m(`objectActions.bulkDeleteSuccess`,{count:o,label:n||e,defaultValue:`Deleted ${o} ${n||e} records`})),{success:!0,reload:!0,silent:!0}):(u.error(m(`objectActions.bulkDeletePartial`,{succeeded:o,failed:a,defaultValue:`${o} deleted, ${a} failed`})),{success:!1})}let a=t.params?.recordId??t.params?.record?.id??r?.[0]?.id??t.recordId;if(!a)return{success:!1,error:m(`objectActions.noRecordId`)};try{return await i.delete(e,a),s?.(),u.success(m(`objectActions.deleteSuccess`,{label:n||e})),{success:!0,reload:!0,silent:!0}}catch(t){return u.error(m(`objectActions.deleteFailed`,{label:n||e}),{description:t.message}),{success:!1}}}),y.registerHandler(`navigate`,async e=>{let t=e.params?.url||e.url;return t&&f(t.startsWith(`/`)?t:`${h}/${t}`),{success:!0}}),y.registerHandler(`refresh`,async()=>(s?.(),{success:!0,reload:!0}))},[y,e,i,o,s,f,h,m,n]),{execute:g,create:(0,b.useCallback)(()=>{o?.(null)},[o]),deleteRecord:(0,b.useCallback)(async e=>g({type:`delete`,confirmText:m(`objectActions.deleteConfirm`),params:{recordId:e}}),[g,m]),navigateToView:(0,b.useCallback)(t=>{f(`${h}/${e}/view/${t}`)},[f,h,e]),navigateToRecord:(0,b.useCallback)(t=>{f(`${h}/${e}/record/${encodeURIComponent(t)}`)},[f,h,e]),loading:_,error:v}}function S(e){return e==null?[]:Array.isArray(e)?e:[e]}function C(e,t){let{alias:r,value:i=`1`,replace:a=!0}=t??{},[o,s]=n(),c=(0,b.useMemo)(()=>S(r),[r]),l=(0,b.useCallback)(t=>t.get(e)===i||c.some(e=>t.get(e)===i),[e,i,c]),u=l(o),d=(0,b.useCallback)(t=>{if(t===l(o))return;let n=new URLSearchParams(o);if(t){n.set(e,i);for(let e of c)n.delete(e)}else{n.delete(e);for(let e of c)n.delete(e)}s(n,{replace:a})},[l,o,s,e,i,c,a]);return{open:u,setOpen:d,openOverlay:(0,b.useCallback)(()=>d(!0),[d]),closeOverlay:(0,b.useCallback)(()=>d(!1),[d]),toggleOverlay:(0,b.useCallback)(()=>{s(t=>{let n=new URLSearchParams(t);if(l(n)){n.delete(e);for(let e of c)n.delete(e)}else{n.set(e,i);for(let e of c)n.delete(e)}return n},{replace:a})},[s,l,e,i,c,a])}}async function w(e){let t=await fetch(`/api/v1/meta/_drafts?packageId=${encodeURIComponent(e)}`,{credentials:`include`,headers:{Accept:`application/json`},cache:`no-store`});if(!t.ok)throw Error(`_drafts HTTP ${t.status}`);let n=await t.json(),r=Array.isArray(n)?n:n?.drafts??n?.data?.drafts??[];return Array.isArray(r)?r.length:0}function T(e){return{status:`drafted`,drafted:e.items,...e.summary?{summary:e.summary}:{},...e.packageId?{packageId:e.packageId}:{},...e.autoPublishable?{autoPublishable:!0}:{},...e.failedCount?{failed:Array.from({length:e.failedCount},()=>null)}:{},...e.materialized?{materialized:!0}:{},...e.verification?{verification:e.verification}:{},...e.issues&&e.issues.length?{issues:e.issues}:{},...e.nextSteps&&e.nextSteps.length?{nextSteps:e.nextSteps}:{}}}function ee(e){return{status:`blueprint_proposed`,...e.summary?{summary:e.summary}:{},counts:e.counts,questions:e.questions,...e.targetApp?{targetApp:e.targetApp}:{},blueprint:{objects:e.objects.map(e=>({name:e.name,...e.label?{label:e.label}:{},fields:Array.from({length:e.fieldCount},()=>null)})),assumptions:e.assumptions}}}var E=`objectstack:ai-chat-conversation-id`,te=`objectstack:ai-chat-messages`;function D(e,t){return t?`${E}:${e}:${t}`:`${E}:${e}`}function O(e){try{return localStorage.getItem(e)??void 0}catch{return}}function k(e,t){try{t?localStorage.setItem(e,t):localStorage.removeItem(e)}catch{}}function A(e){return`${te}:${e}`}function j(e){try{let t=localStorage.getItem(A(e));if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>!!e&&typeof e==`object`&&typeof e.id==`string`&&(e.role===`user`||e.role===`assistant`||e.role===`system`)&&Array.isArray(e.parts)):[]}catch{return[]}}function M(e,t){if(e)try{if(t.length===0){localStorage.removeItem(A(e));return}localStorage.setItem(A(e),JSON.stringify(t))}catch{}}function ne(e){return e.map(e=>{let t=[];if(e.content&&t.push({type:`text`,text:e.content}),e.role===`assistant`)for(let n of e.toolInvocations??[]){let e=n.draftReview?T(n.draftReview):n.proposedPlan?ee(n.proposedPlan):void 0;t.push({type:`tool-${n.toolName}`,toolCallId:n.toolCallId,toolName:n.toolName,state:n.state??(n.errorText?`output-error`:`output-available`),...n.errorText?{errorText:n.errorText}:{},...e===void 0?{}:{output:e}})}if(t.length!==0)return{id:e.id,role:e.role,parts:t}}).filter(e=>!!e)}function N(e){return typeof e==`string`?e?[{type:`text`,text:e}]:[]:Array.isArray(e)?e.map(e=>{if(typeof e==`string`)return e?{type:`text`,text:e}:void 0;if(e&&typeof e==`object`&&`type`in e&&typeof e.type==`string`)return e;if(e&&typeof e==`object`&&`text`in e&&typeof e.text==`string`)return{type:`text`,text:e.text}}).filter(e=>!!e):e&&typeof e==`object`&&`parts`in e&&Array.isArray(e.parts)?N(e.parts):[]}function re(e,t){for(let n of N(e)){let e=typeof n.toolCallId==`string`?n.toolCallId:void 0;if(!e)continue;let r=t.get(e);if(!r)continue;let i=n.output??n.result;if(i===void 0)continue;r.output=i;let a=n.errorText;r.state=n.isError||typeof a==`string`?`output-error`:`output-available`,typeof a==`string`&&(r.errorText=a)}}function P(e){if(!e)return[];let t=[],n=new Map;return e.forEach((e,r)=>{let i=e.role;if(i===`tool`){re(e.content,n);return}if(i!==`user`&&i!==`assistant`&&i!==`system`)return;let a=N(e.content);if(a.length!==0){if(i===`assistant`)for(let e of a){e.type===`tool-call`&&typeof e.toolName==`string`&&e.toolName&&(e.type=`tool-${e.toolName}`);let t=typeof e.toolCallId==`string`?e.toolCallId:void 0;t&&(e.type===`tool-call`||e.type.startsWith(`tool-`))&&n.set(t,e)}t.push({id:e.id??`msg-${r}`,role:i,parts:a})}}),t}function F(e){if(!(typeof e!=`string`||!e))try{let t=JSON.parse(e);return Array.isArray(t)?t:void 0}catch{return}}function ie(e){return e?e.map(e=>{let t=e.id,n=typeof e.content==`string`?e.content:``;if(e.role===`assistant`){let r=F(e.tool_calls);if(r&&r.length>0){let e=[];return n&&e.push({type:`text`,text:n}),e.push(...r),{id:t,role:`assistant`,content:e}}return{id:t,role:`assistant`,content:n}}if(e.role===`tool`){let r=F(e.content);return r&&r.length>0&&r[0]?.type===`tool-result`?{id:t,role:`tool`,content:r}:{id:t,role:`tool`,content:[{type:`tool-result`,toolCallId:e.tool_call_id??``,toolName:`unknown`,output:{type:`text`,value:n}}]}}return{id:t,role:e.role,content:n}}):[]}async function I(e,t){let n=await fetch(`${e}/conversations/${encodeURIComponent(t)}`,{credentials:`include`});if(n.status===404||n.status===403)return null;if(!n.ok)throw Error(`GET conversation failed: ${n.status}`);return await n.json()}async function L(e){let t=await fetch(`${e}/conversations`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:`{}`});if(!t.ok)throw Error(`POST conversation failed: ${t.status}`);return await t.json()}async function ae(e,t){await fetch(`${e}/conversations/${encodeURIComponent(t)}`,{method:`DELETE`,credentials:`include`}).catch(()=>{})}function oe(e){let{userId:t,scope:n,apiBase:r,activeId:i,forceNew:a,resumeMode:o=`resume`,legacyScope:s,adoptLegacy:c}=e,l=(0,b.useRef)(c);l.current=c;let[u,d]=(0,b.useState)(void 0),[f,p]=(0,b.useState)([]),[m,h]=(0,b.useState)(!!t),g=(0,b.useRef)(!0),_=(0,b.useRef)(void 0),v=(0,b.useRef)(void 0);(0,b.useEffect)(()=>(g.current=!0,()=>{g.current=!1}),[]),(0,b.useEffect)(()=>{if(!t){d(void 0),p([]),h(!1),_.current=void 0,v.current=void 0;return}let e=v.current!==n;if(!i&&!a&&!e&&_.current===t&&u)return;let c=!1,f=D(t,n);return!i&&(a||e&&_.current===t)&&(d(void 0),p([])),h(!0),(async()=>{try{if(i){let e=await I(r,i);if(c)return;if(e){k(f,e.id),d(e.id);let r=P(e.messages),i=r.length>0?r:j(e.id);(i.length>0||e.id!==u)&&p(i),_.current=t,v.current=n;return}k(f,void 0),M(i,[])}else if(!a){let e=O(f);if(!e&&s&&l.current){let e=O(D(t,s));if(e){try{let i=await I(r,e);if(c)return;if(i){let e=P(i.messages),r=e.length>0?e:j(i.id);if(l.current?.(r)){k(f,i.id),d(i.id),p(r),_.current=t,v.current=n;return}}}catch{}if(c)return}}if(e){let i=await I(r,e);if(c)return;if(i){let e=P(i.messages);if(o!==`fresh`||e.length===0){d(i.id),p(o===`fresh`?[]:e.length>0?e:j(i.id)),_.current=t,v.current=n;return}}else k(f,void 0),M(e,[])}}let e=await L(r);if(c)return;k(f,e.id),d(e.id),p(P(e.messages)),_.current=t,v.current=n}catch{c||(d(void 0),p([]))}finally{c||h(!1)}})(),()=>{c=!0}},[t,n,r,i,a,o,s]);let y=(0,b.useCallback)(async()=>{if(!t)return;let e=D(t,n);h(!0);try{u&&await ae(r,u),M(u,[]),k(e,void 0);let t=await L(r);if(k(e,t.id),M(t.id,[]),!g.current)return;d(t.id),p([])}catch{g.current&&(d(void 0),p([]))}finally{g.current&&h(!1)}},[u,t,n,r]),x=(0,b.useCallback)(async()=>{if(!t)return;let e=D(t,n);h(!0);try{let i=await L(r);if(k(e,i.id),M(i.id,[]),!g.current)return;d(i.id),p([]),_.current=t,v.current=n}catch{}finally{g.current&&h(!1)}},[t,n,r]),S=(0,b.useCallback)(e=>{!t||!u||(k(D(t,e),u),_.current=t,v.current=e)},[t,u]);return{conversationId:u,conversationScope:v.current,initialMessages:f,isLoading:m,reset:y,startNew:x,rekeyScope:S}}function se(e){if(!e||e.length===0)return!1;let t=e[e.length-1];return!t||t.role!==`assistant`?!1:t.parts.some(e=>e.type===`text`&&String(e.text??``).trim().length>0)}function ce(e){let{chatApi:t,conversationId:n}=e,[r,i]=(0,b.useState)(!1),a=(0,b.useRef)(void 0);return{errorSuppressed:r,handleChatError:(0,b.useCallback)(async e=>{if(e?.notSent){i(!1);return}let r=t?.replace(/\/agents\/[^/]+\/chat$/,``);if(!n||!r){i(!1);return}try{let e=P((await I(r,n))?.messages);if(se(e)&&a.current){a.current(e),i(!0);return}}catch{}i(!1)},[n,t]),setMessagesRef:a,resetSuppression:(0,b.useCallback)(()=>i(!1),[])}}var le=new Set([`new chat`,`new conversation`,`untitled`,`新对话`]);function ue(e){let t=e?.trim().toLowerCase();return!t||le.has(t)}function de(e){let t=e.messages;if(!t||t.length===0)return;for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.role===`user`){let e=R(n.content);if(e)return e}}let n=t[t.length-1];return R(n?.content)}function R(e){if(typeof e==`string`)return e.slice(0,140);if(e&&typeof e==`object`&&`text`in e&&typeof e.text==`string`)return e.text.slice(0,140);if(e&&typeof e==`object`&&`parts`in e&&Array.isArray(e.parts))return R(e.parts);if(Array.isArray(e)){let t=e.map(e=>typeof e==`string`?e:e&&typeof e==`object`&&`text`in e&&typeof e.text==`string`?e.text:``).join(``);return t?t.slice(0,140):void 0}}function z(e){let t=e.title?.trim(),n=de(e)??R(e.preview);return{id:e.id,title:ue(t)?void 0:t,agentId:e.agentId,createdAt:e.createdAt,updatedAt:e.updatedAt,preview:n}}async function B(e,t){let n=await fetch(`${e}/conversations/${encodeURIComponent(t)}`,{credentials:`include`});if(!n.ok)return;let r=await n.json();return z(`conversation`in r&&r.conversation?r.conversation:r)}function V(e){let{userId:t,apiBase:n,limit:r=50,refreshKey:i}=e,[a,o]=(0,b.useState)([]),[s,c]=(0,b.useState)(!!t),[l,u]=(0,b.useState)(void 0),[d,f]=(0,b.useState)(0),p=(0,b.useCallback)(async()=>{f(e=>e+1)},[]),m=(0,b.useCallback)(async e=>{try{await fetch(`${n}/conversations/${encodeURIComponent(e)}`,{method:`DELETE`,credentials:`include`})}finally{o(t=>t.filter(t=>t.id!==e))}},[n]),h=(0,b.useCallback)(async(e,t)=>{let r=t.trim();o(t=>t.map(t=>t.id===e?{...t,title:r||void 0}:t));let i=await fetch(`${n}/conversations/${encodeURIComponent(e)}`,{method:`PATCH`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:r})});if(!i.ok)throw f(e=>e+1),Error(`PATCH conversation failed: ${i.status}`)},[n]);return(0,b.useEffect)(()=>{if(!t){o([]),c(!1),u(void 0);return}let e=!1;return c(!0),u(void 0),(async()=>{try{let t=await fetch(`${n}/conversations?limit=${encodeURIComponent(String(r))}`,{credentials:`include`});if(!t.ok)throw Error(`GET conversations failed: ${t.status}`);let i=await t.json(),a=Array.isArray(i)?i:i.conversations??i.items??[];if(e)return;let s=a.map(z).sort((e,t)=>(t.updatedAt??``).localeCompare(e.updatedAt??``));o(s);let c=s.filter(e=>!e.title&&!e.preview).slice(0,20);if(c.length>0){let t=await Promise.all(c.map(e=>B(n,e.id).catch(()=>void 0)));if(e)return;let r=new Map(t.filter(e=>!!(e?.preview||e?.title)).map(e=>[e.id,e]));r.size>0&&o(e=>e.map(e=>{let t=r.get(e.id);return t?{...e,title:e.title??t.title,preview:e.preview??t.preview}:e}))}}catch(t){if(e)return;u(t instanceof Error?t:Error(String(t))),o([])}finally{e||c(!1)}})(),()=>{e=!0}},[t,n,r,d,i]),{conversations:a,isLoading:s,error:l,refetch:p,remove:m,rename:h}}function H(e){if(typeof e.content==`string`)return e.content;let t=e.parts;return Array.isArray(t)?t.map(e=>e&&typeof e==`object`&&e.type===`text`?String(e.text??``):``).join(` `):``}function U(e){if(Array.isArray(e))for(let t=e.length-1;t>=0;t--){let n=e[t];if(!n||n.role!==`user`)continue;let r=H(n);if(r.trim())return/[一-鿿]/.test(r)?`zh-CN`:void 0}}function fe(e){return(U(e)??``).toLowerCase().startsWith(`zh`)}function pe(e,t){return{name:e.name,label:e.label,pluralLabel:e.pluralLabel,description:e.description,icon:e.icon,group:e.group,sortOrder:e.sortOrder,enabled:e.enabled,fields:t,relationships:e.relationships}}function me(e){return{name:e.name,label:e.label,type:e.type,group:e.group,description:e.description,required:e.required,unique:e.unique,readonly:e.readonly,hidden:e.hidden,defaultValue:e.defaultValue,placeholder:e.placeholder,options:e.options,externalId:e.externalId,trackHistory:e.trackHistory,indexed:e.indexed,referenceTo:e.referenceTo,formula:e.formula,sortOrder:e.sortOrder}}var he=class{adapter;constructor(e){this.adapter=e}async getItems(e){let t=await this.adapter.getClient().meta.getItems(e);return t&&typeof t==`object`&&`items`in t&&Array.isArray(t.items)?t.items:[]}async saveMetadataItem(e,t,n){await this.adapter.getClient().meta.saveItem(e,t,n),this.adapter.invalidateCache(`${e}:${t}`)}async deleteMetadataItem(e,t){await this.adapter.getClient().meta.saveItem(e,t,{name:t,enabled:!1,_deleted:!0}),this.adapter.invalidateCache(`${e}:${t}`)}async saveObject(e,t){let n=this.adapter.getClient(),r=pe(e,t);await n.meta.saveItem(`object`,e.name,r),this.adapter.invalidateCache(`object:${e.name}`)}async deleteObject(e){await this.adapter.getClient().meta.saveItem(`object`,e,{name:e,enabled:!1,_deleted:!0}),this.adapter.invalidateCache(`object:${e}`)}async saveFields(e,t){let n=this.adapter.getClient(),r={};try{let t=await n.meta.getItem(`object`,e);r=t?.item??t??{}}catch{}let i={...r,name:e,fields:t.map(me)};await n.meta.saveItem(`object`,e,i),this.adapter.invalidateCache(`object:${e}`)}static diffObjects(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map(t.map(e=>[e.id,e]));for(let[e,t]of r)if(!n.has(e))return{type:`create`,object:t};for(let[e,t]of n)if(!r.has(e))return{type:`delete`,object:t};for(let[e,t]of r){let r=n.get(e);if(r&&JSON.stringify(r)!==JSON.stringify(t))return{type:`update`,object:t}}return null}static diffFields(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map(t.map(e=>[e.id,e]));for(let[e,t]of r)if(!n.has(e))return{type:`create`,field:t};for(let[e,t]of n)if(!r.has(e))return{type:`delete`,field:t};for(let[e,t]of r){let r=n.get(e);if(r&&JSON.stringify(r)!==JSON.stringify(t))return{type:`update`,field:t}}return null}};function ge(){let e=o();return(0,b.useMemo)(()=>e?new he(e):null,[e])}var _e=20;function ve(e,t=``){let{href:n,external:r}=v(e,t);return r?n:!n||n===`#`?``:n}function ye(e){return`nav:${e}`}function be(){let{favorites:e,addFavorite:t,removeFavorite:n,setPinned:r,pinnedNavIds:i}=p(),a=(0,b.useCallback)((e,i,a,o)=>{let s=ye(e);i?(a&&t({id:s,label:a.label,href:ve(a,o??``),type:`nav`,navId:e,pinned:!0}),r(s,!0)):n(s)},[t,n,r]),o=(0,b.useCallback)(e=>i.has(e),[i]),s=(0,b.useCallback)(e=>{if(i.size===0){let t=!1;for(let n of e)if(n.pinned){t=!0;break}if(!t)return e}let t=0,n=e=>e.map(e=>{let r=i.has(e.id)&&t<_e;r&&t++;let a=e.children?.length?n(e.children):e.children;return r!==(e.pinned??!1)||a!==e.children?{...e,pinned:r,children:a}:e});return n(e)},[i]),c=(0,b.useCallback)(()=>{for(let t of e)t.type===`nav`&&n(t.id)},[e,n]);return{pinnedIds:(0,b.useMemo)(()=>Array.from(i),[i]),togglePin:a,isPinned:o,applyPins:s,clearPins:c}}var xe=0;function W(e=`nav`){return`${e}_${Date.now()}_${++xe}`}function G(e,t){return[...e,t]}function K(e,t,n){return e.filter(e=>!(e.type===t&&(t===`page`&&e.pageName===n||t===`dashboard`&&e.dashboardName===n))).map(e=>e.children&&e.children.length>0?{...e,children:K(e.children,t,n)}:e)}function q(e,t,n,r){return e.map(e=>{let i=e;return t===`page`&&e.type===`page`&&e.pageName===n?i={...e,pageName:r}:t===`dashboard`&&e.type===`dashboard`&&e.dashboardName===n&&(i={...e,dashboardName:r}),i.children&&i.children.length>0?{...i,children:q(i.children,t,n,r)}:i})}function J(e,t){return e.length===t.length?e===t||JSON.stringify(e)===JSON.stringify(t):!1}function Se(e){return typeof e==`string`&&e.startsWith(`sys_`)}function Ce(e){if(!e||typeof e!=`object`)return!1;let t=e;return t._packageId!=null||t._provenance===`package`||Se(t.name)}function Y(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t._lock??t.protection?.lock;return n!==`full`&&n!==`no-overlay`}function we(){let e=o(),{apps:t,refresh:n}=s(),{t:r}=c(),i=(0,b.useRef)(e);i.current=e;let a=(0,b.useRef)(n);a.current=n;let l=(0,b.useCallback)(async(e,t)=>{let n=i.current?.getClient();n&&await n.meta.saveItem(`app`,e,t),await a.current?.()},[]),d=(0,b.useCallback)(e=>y(t,e),[t]),f=(0,b.useCallback)(async(e,t,n)=>{let i=d(e);if(!i)return;let a=i.navigation??[],o=G(a,{id:W(`nav_page`),type:`page`,label:n||t,pageName:t,icon:`FileText`}),s={...i,navigation:o};try{await l(e,s),u.success(r(`navigationSync.addedPage`,{name:n||t}),{action:{label:r(`navigationSync.undoLabel`),onClick:async()=>{try{await l(e,{...i,navigation:a}),u.info(r(`navigationSync.undone`))}catch{u.error(r(`navigationSync.undoFailed`))}}}})}catch{u.error(r(`navigationSync.updateFailed`))}},[d,l,r]),p=(0,b.useCallback)(async(e,t,n)=>{let i=d(e);if(!i)return;let a=i.navigation??[],o=G(a,{id:W(`nav_dash`),type:`dashboard`,label:n||t,dashboardName:t,icon:`LayoutDashboard`}),s={...i,navigation:o};try{await l(e,s),u.success(r(`navigationSync.addedDashboard`,{name:n||t}),{action:{label:r(`navigationSync.undoLabel`),onClick:async()=>{try{await l(e,{...i,navigation:a}),u.info(r(`navigationSync.undone`))}catch{u.error(r(`navigationSync.undoFailed`))}}}})}catch{u.error(r(`navigationSync.updateFailed`))}},[d,l,r]),m=(0,b.useCallback)(async(e,t)=>{let n=d(e);if(!n)return;let i=n.navigation??[],a=K(i,`page`,t);if(J(a,i))return;let o={...n,navigation:a};try{await l(e,o),u.success(r(`navigationSync.removedPage`,{name:t}),{action:{label:r(`navigationSync.undoLabel`),onClick:async()=>{try{await l(e,{...n,navigation:i}),u.info(r(`navigationSync.undone`))}catch{u.error(r(`navigationSync.undoFailed`))}}}})}catch{u.error(r(`navigationSync.updateFailed`))}},[d,l,r]),h=(0,b.useCallback)(async(e,t)=>{let n=d(e);if(!n)return;let i=n.navigation??[],a=K(i,`dashboard`,t);if(J(a,i))return;let o={...n,navigation:a};try{await l(e,o),u.success(r(`navigationSync.removedDashboard`,{name:t}),{action:{label:r(`navigationSync.undoLabel`),onClick:async()=>{try{await l(e,{...n,navigation:i}),u.info(r(`navigationSync.undone`))}catch{u.error(r(`navigationSync.undoFailed`))}}}})}catch{u.error(r(`navigationSync.updateFailed`))}},[d,l,r]),g=(0,b.useCallback)(async(e,t,n)=>{let i=d(e);if(!i)return;let a=i.navigation??[],o=q(a,`page`,t,n);if(J(o,a))return;let s={...i,navigation:o};try{await l(e,s),u.success(r(`navigationSync.renamedPage`,{oldName:t,newName:n}),{action:{label:r(`navigationSync.undoLabel`),onClick:async()=>{try{await l(e,{...i,navigation:a}),u.info(r(`navigationSync.undone`))}catch{u.error(r(`navigationSync.undoFailed`))}}}})}catch{u.error(r(`navigationSync.updateFailed`))}},[d,l,r]),_=(0,b.useCallback)(async(e,t,n)=>{let i=d(e);if(!i)return;let a=i.navigation??[],o=q(a,`dashboard`,t,n);if(J(o,a))return;let s={...i,navigation:o};try{await l(e,s),u.success(r(`navigationSync.renamedDashboard`,{oldName:t,newName:n}),{action:{label:r(`navigationSync.undoLabel`),onClick:async()=>{try{await l(e,{...i,navigation:a}),u.info(r(`navigationSync.undone`))}catch{u.error(r(`navigationSync.undoFailed`))}}}})}catch{u.error(r(`navigationSync.updateFailed`))}},[d,l,r]),v=e=>e&&typeof e==`object`&&`name`in e?e.name:void 0;return{syncPageCreated:f,syncDashboardCreated:p,syncPageDeleted:m,syncDashboardDeleted:h,syncPageRenamed:g,syncDashboardRenamed:_,syncPageCreatedAllApps:(0,b.useCallback)(async(e,n)=>{for(let r of t){let t=v(r);!t||!Y(r)||await f(t,e,n)}},[t,f]),syncDashboardCreatedAllApps:(0,b.useCallback)(async(e,n)=>{for(let r of t){let t=v(r);!t||!Y(r)||await p(t,e,n)}},[t,p]),syncPageDeletedAllApps:(0,b.useCallback)(async e=>{for(let n of t){let t=v(n);!t||!Y(n)||await m(t,e)}},[t,m]),syncDashboardDeletedAllApps:(0,b.useCallback)(async e=>{for(let n of t){let t=v(n);!t||!Y(n)||await h(t,e)}},[t,h]),syncPageRenamedAllApps:(0,b.useCallback)(async(e,n)=>{for(let r of t){let t=v(r);!t||!Y(r)||await g(t,e,n)}},[t,g]),syncDashboardRenamedAllApps:(0,b.useCallback)(async(e,n)=>{for(let r of t){let t=v(r);!t||!Y(r)||await _(t,e,n)}},[t,_])}}function Te(){let{pages:e,dashboards:t,apps:n,getTypeStatus:r}=s(),i=o(),a=(0,b.useRef)(i);a.current=i;let c=d(),{syncPageCreated:l,syncDashboardCreated:u,syncPageDeleted:f,syncDashboardDeleted:p}=we(),m=(0,b.useRef)(null),h=(0,b.useRef)(null),g=(0,b.useRef)(0),_=(0,b.useRef)(!1),v=e=>e&&typeof e==`object`&&`name`in e?e.name:void 0;return(0,b.useEffect)(()=>{if(_.current)return;if(c){m.current=null,h.current=null;return}if(r&&(r(`page`)!==`ready`||r(`dashboard`)!==`ready`))return;let i=e=>new Set(e.filter(e=>!Ce(e)).map(e=>e?.name).filter(e=>typeof e==`string`&&e.length>0)),a=i(e??[]),o=i(t??[]),s=m.current,d=h.current;if(s===null||d===null){m.current=a,h.current=o;return}let y=[...a].filter(e=>!s.has(e)),b=[...s].filter(e=>!a.has(e)),x=[...o].filter(e=>!d.has(e)),S=[...d].filter(e=>!o.has(e));if(y.length===0&&b.length===0&&x.length===0&&S.length===0){m.current=a,h.current=o;return}let C=++g.current;_.current=!0;let w=!1;return(async()=>{try{for(let e of n){if(w||g.current!==C)break;let t=v(e);if(!(!t||!Y(e))){for(let e of y){if(w)break;await l(t,e)}for(let e of b){if(w)break;await f(t,e)}for(let e of x){if(w)break;await u(t,e)}for(let e of S){if(w)break;await p(t,e)}}}}finally{g.current===C&&(m.current=a,h.current=o,_.current=!1)}})(),()=>{w=!0}},[e,t,n,c,r,l,u,f,p]),null}var Ee=768,X=1024;function De(){let{setOpen:e,isMobile:t}=l(),n=(0,b.useRef)(e);(0,b.useEffect)(()=>{n.current=e},[e]),(0,b.useEffect)(()=>{if(t)return;let e=!1;function r(){let t=window.innerWidth,r=t>=Ee&&t<X;r&&!e&&n.current(!1),e=r}return r(),window.addEventListener(`resize`,r),()=>window.removeEventListener(`resize`,r)},[t])}var Oe=new Set([`view`,`record`,`page`,`dashboard`,`design`,`report`]);function Z(e){return e.replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Q(e){try{return decodeURIComponent(e)}catch{return e}}function ke({pathname:e,appName:t,objects:n=[],basePathSegment:r=`apps`,disabled:i=!1}){let{addRecentItem:a}=f(),o=(0,b.useRef)(n);o.current=n,(0,b.useEffect)(()=>{if(i||!t)return;let n=e.split(`/`).filter(Boolean);if(n[0]!==r||n[1]!==t)return;let s=n[2],c=n[3],l=`/${r}/${t}`;if(s===`metadata`){let e=n[3],t=n[4];e&&t&&t!==`new`&&a({id:`metadata:${e}:${Q(t)}`,label:Q(t),href:`${l}/metadata/${e}/${t}`,type:`metadata`});return}if(s&&!Oe.has(s)){let e=o.current.find(e=>e.name===s);e&&a({id:`object:${e.name}`,label:e.label||e.name,href:`${l}/${e.name}`,type:`object`});return}if(c)switch(s){case`dashboard`:a({id:`dashboard:${c}`,label:Z(c),href:`${l}/dashboard/${c}`,type:`dashboard`});break;case`page`:a({id:`page:${c}`,label:Z(c),href:`${l}/page/${c}`,type:`page`});break;case`report`:a({id:`report:${c}`,label:Z(c),href:`${l}/report/${c}`,type:`report`});break;default:break}},[e,t,r,i])}var $={"studio-build":`build`,default:`ask`};function Ae(e,{agents:t,appDefaultAgent:n,aiStudioEnabled:r=!0}){let i=t.map(e=>e.name),a=(g(n)?n:void 0)??$[e]??$.default;return _(!r&&m(a)?`ask`:a,i)??h(t)}export{w as _,be as a,fe as c,ie as d,I as f,M as g,oe as h,Te as i,V as l,P as m,ke as n,ge as o,ne as p,De as r,U as s,Ae as t,ce as u,C as v,x as y};