@objectstack/console 17.3.0 → 17.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/dist/.objectui-sha +1 -1
  3. package/dist/assets/{ActionResultDialog-CQwenjVA.js → ActionResultDialog-Bsr2GS71.js} +1 -1
  4. package/dist/assets/{AiPendingActionsPage-7gZ8zlOy.js → AiPendingActionsPage-DB-UVcdM.js} +1 -1
  5. package/dist/assets/{ApiConsolePage-DUF0ysH7.js → ApiConsolePage-Bzqo2owc.js} +1 -1
  6. package/dist/assets/{AppDocsIndex-CP_AVG4X.js → AppDocsIndex-KhVqdZ-P.js} +1 -1
  7. package/dist/assets/{AppManagementPage-BJktnoa5.js → AppManagementPage-CsZ0LMQn.js} +1 -1
  8. package/dist/assets/{ApprovalsInboxPage-DlnxY-uy.js → ApprovalsInboxPage-D_LOnhJ7.js} +1 -1
  9. package/dist/assets/{AuditLogPage-DIJPRjji.js → AuditLogPage-B9eqwuzl.js} +1 -1
  10. package/dist/assets/{ComponentNavView-C84QByT7.js → ComponentNavView-DeokLfkW.js} +1 -1
  11. package/dist/assets/{CreateViewDialog-Zbd9Cagm.js → CreateViewDialog-BMdQ4ZYy.js} +1 -1
  12. package/dist/assets/{DashboardView-UyKHklBx.js → DashboardView-DHZboRi8.js} +1 -1
  13. package/dist/assets/{DeveloperHubPage-BRyNdrCJ.js → DeveloperHubPage-C_VYirN0.js} +1 -1
  14. package/dist/assets/{DocPage-Bx8ZXCYt.js → DocPage-_9x-3Dbi.js} +1 -1
  15. package/dist/assets/{DocShell-Ipy_IDvh.js → DocShell-D4dSPfBz.js} +1 -1
  16. package/dist/assets/{DocsIndex-CmY-7OQR.js → DocsIndex-CJVRa_hE.js} +1 -1
  17. package/dist/assets/{DocsLayout-BNsSvaz2.js → DocsLayout-C-tYgUZv.js} +1 -1
  18. package/dist/assets/{DocsSlug-Cb_NMM1k.js → DocsSlug-DmyGpfEy.js} +1 -1
  19. package/dist/assets/{ExpressionProvider-DqGWVuxV.js → ExpressionProvider-B6z09kM6.js} +1 -1
  20. package/dist/assets/{FlowRunsPage-B6ustUgi.js → FlowRunsPage-OjGJi-JU.js} +1 -1
  21. package/dist/assets/{IntegrationsPage-chOxmiyU.js → IntegrationsPage-CrDMDe62.js} +1 -1
  22. package/dist/assets/{InterfaceListPage-DVETnQm5.js → InterfaceListPage-P3y6hqTX.js} +1 -1
  23. package/dist/assets/{MarketplaceInstalledPage-DA5pjhAz.js → MarketplaceInstalledPage-CQek7WnV.js} +1 -1
  24. package/dist/assets/{MarketplacePackagePage-dCIVHBFi.js → MarketplacePackagePage-DL2ivKSc.js} +1 -1
  25. package/dist/assets/{MarketplacePage-wJb6g1p7.js → MarketplacePage-B-6EokyB.js} +1 -1
  26. package/dist/assets/{MetadataInspector-Cu-n1FYz.js → MetadataInspector-IQGUoLyp.js} +1 -1
  27. package/dist/assets/{ObjectDataPage-CP-YSZYQ.js → ObjectDataPage-Bmc3RQhM.js} +1 -1
  28. package/dist/assets/{PageView-B1_ibRuM.js → PageView-DzUZqB_h.js} +1 -1
  29. package/dist/assets/{ProfilePage-DEr5iZVB.js → ProfilePage-NklCqPxc.js} +1 -1
  30. package/dist/assets/{PublicFormsPage-CBcKQbNl.js → PublicFormsPage-CItIvcLQ.js} +1 -1
  31. package/dist/assets/RecordDetailView-XWxuegfV.js +3 -0
  32. package/dist/assets/{RecordFormPage-CGQlYWDk.js → RecordFormPage-B-yrhs7J.js} +1 -1
  33. package/dist/assets/{ReportDefaultInspector-R_p6YStL.js → ReportDefaultInspector-D5Kro5_t.js} +1 -1
  34. package/dist/assets/{ReportView-BTMrtcGH.js → ReportView-COpZ8PQT.js} +1 -1
  35. package/dist/assets/{RuntimeDraftBar-agGU39FL.js → RuntimeDraftBar-CSVtuByp.js} +1 -1
  36. package/dist/assets/{SchemaForm-DJbupOno.js → SchemaForm-DIsxxOZF.js} +1 -1
  37. package/dist/assets/{SearchResultsPage-CHhZUc6L.js → SearchResultsPage-B2r6kgni.js} +1 -1
  38. package/dist/assets/{SettingsHub-BGLR_gS7.js → SettingsHub-DQz2HDtZ.js} +1 -1
  39. package/dist/assets/{SettingsView-Bq-7Zkzs.js → SettingsView-BfOEalDW.js} +1 -1
  40. package/dist/assets/{SkeletonDetail-B4-UKxai.js → SkeletonDetail-DMOa5zcl.js} +1 -1
  41. package/dist/assets/{SystemHubPage-CVZVag1e.js → SystemHubPage-DM2VRSIP.js} +1 -1
  42. package/dist/assets/{abnfDiagram-VCTEODGH-DUS5D5dU.js → abnfDiagram-VCTEODGH-DaPlU6Hz.js} +1 -1
  43. package/dist/assets/{app-shell-eager-leaves-BB0oaPx6.js → app-shell-eager-leaves-wjbiJgVZ.js} +1 -1
  44. package/dist/assets/architectureDiagram-5GKGNRK7-Cq014PwG.js +36 -0
  45. package/dist/assets/{blockDiagram-OSKFZWR5-Bz2hnVmp.js → blockDiagram-OSKFZWR5-vtlcoeZc.js} +1 -1
  46. package/dist/assets/{c4Diagram-7LVT6UL2-DU3u1Y6c.js → c4Diagram-7LVT6UL2-BrdwRG2M.js} +1 -1
  47. package/dist/assets/channel-D2IgUFnY.js +1 -0
  48. package/dist/assets/{chunk-3NF5O7KM-B8Q7HUio.js → chunk-3NF5O7KM-CjWAf_Jo.js} +1 -1
  49. package/dist/assets/{chunk-4HAMMTFA-BPKwX4iB.js → chunk-4HAMMTFA-BtV_msXT.js} +1 -1
  50. package/dist/assets/chunk-75Z2AOVW-DdRL9yNr.js +2 -0
  51. package/dist/assets/chunk-CLGD4ZFX-De9kMAXh.js +1 -0
  52. package/dist/assets/{chunk-DU6HZSFF-BkY4hAzc.js → chunk-DU6HZSFF-DqjylQO-.js} +1 -1
  53. package/dist/assets/chunk-F27PBJKO-tEB_K-iD.js +1 -0
  54. package/dist/assets/{chunk-GMAD6QVW-DZo_NykZ.js → chunk-GMAD6QVW-BMzd_HHM.js} +1 -1
  55. package/dist/assets/{chunk-GVQU2GXP-9ELY9S6X.js → chunk-GVQU2GXP-B1p1nHC0.js} +1 -1
  56. package/dist/assets/{chunk-H2I77ZZE-vCr_buP7.js → chunk-H2I77ZZE-ioXC4dHO.js} +1 -1
  57. package/dist/assets/{chunk-HLEWEB6X-iPkY2ESt.js → chunk-HLEWEB6X-zZ3ZMup3.js} +1 -1
  58. package/dist/assets/chunk-L3NEJ4N5-DePXufTQ.js +1 -0
  59. package/dist/assets/{chunk-LQGUR6SS-iVI0GACK.js → chunk-LQGUR6SS-BUWUp_dz.js} +1 -1
  60. package/dist/assets/{chunk-OSK3NFVY-DcRwXCQD.js → chunk-OSK3NFVY-L7nTUJKT.js} +2 -2
  61. package/dist/assets/{chunk-P2QGCYS3-nx2-dM5t.js → chunk-P2QGCYS3-BG-i3rdI.js} +1 -1
  62. package/dist/assets/{chunk-POPQ4Y6H-BxLOacOG.js → chunk-POPQ4Y6H-DLEB8EqK.js} +1 -1
  63. package/dist/assets/{chunk-PWAF6VOD-2mst9kZu.js → chunk-PWAF6VOD-Be_prJjm.js} +1 -1
  64. package/dist/assets/{chunk-SVP7TREG-C3BMpr4x.js → chunk-SVP7TREG-BdJpxJji.js} +1 -1
  65. package/dist/assets/chunk-XXDRQBXY-CEXsCcSu.js +1 -0
  66. package/dist/assets/{chunk-ZLD2IHE6-ZFqtFJbj.js → chunk-ZLD2IHE6-BLIPZykR.js} +1 -1
  67. package/dist/assets/classDiagram-CYGNFDIV-BielDdJQ.js +1 -0
  68. package/dist/assets/classDiagram-v2-TLXNO2FR-BielDdJQ.js +1 -0
  69. package/dist/assets/cose-bilkent-JH36ORCC-CnLWv9XE.js +1 -0
  70. package/dist/assets/{createDerive-Best2JCj.js → createDerive-DtfnFzGm.js} +1 -1
  71. package/dist/assets/{cynefinDiagram-5FMLGOSQ-Lnly8IJd.js → cynefinDiagram-5FMLGOSQ-Do1SZz4I.js} +1 -1
  72. package/dist/assets/{dagre-OS7QT2EB-CdXLxmTK.js → dagre-OS7QT2EB-CqmZ9Y9O.js} +1 -1
  73. package/dist/assets/data-adapter-1YRpH3h_.js +5 -0
  74. package/dist/assets/{default-inspector-registry-DeEG98bO.js → default-inspector-registry-CmSpNwTr.js} +1 -1
  75. package/dist/assets/{diagram-S7CK7UJ4-DE8I3gxQ.js → diagram-S7CK7UJ4-CMpcDWop.js} +1 -1
  76. package/dist/assets/{diagram-UQ7AKVKN-D2xQpbEq.js → diagram-UQ7AKVKN-DLK_4yej.js} +1 -1
  77. package/dist/assets/{diagram-VSXAHHWV-DnttDSlO.js → diagram-VSXAHHWV-MAILxw0S.js} +1 -1
  78. package/dist/assets/diagram-VX7I27RA-DGiXGVX7.js +24 -0
  79. package/dist/assets/{diagram-Z3DM3KII-BgB9f0Nv.js → diagram-Z3DM3KII-BywboeGI.js} +1 -1
  80. package/dist/assets/dist-B88JFSFg.js +5 -0
  81. package/dist/assets/{ebnfDiagram-PWID7BFC-32WvKbS2.js → ebnfDiagram-PWID7BFC-DdMLbnuP.js} +1 -1
  82. package/dist/assets/{erDiagram-2YWLMYGG-Dwf8uAdl.js → erDiagram-2YWLMYGG-O6raGx2P.js} +1 -1
  83. package/dist/assets/flowDiagram-T62WH6J4-CkAxOnqU.js +1 -0
  84. package/dist/assets/framework-DFE_Mws9.js +36 -0
  85. package/dist/assets/{ganttDiagram-EL5Y4UJY-DqYIE0Cu.js → ganttDiagram-EL5Y4UJY-Dijdjc50.js} +2 -2
  86. package/dist/assets/{getIcon-CgyYxSEC.js → getIcon-B4Pp7Q-0.js} +1 -1
  87. package/dist/assets/gitGraphDiagram-WWUBYQGX-Cfl4OIGG.js +106 -0
  88. package/dist/assets/{highlighted-body-OFNGDK62-BxO9mjPI.js → highlighted-body-OFNGDK62-BlqGRgbU.js} +1 -1
  89. package/dist/assets/{i18n-Cfqor-xb.js → i18n-DGcOKnTh.js} +1 -1
  90. package/dist/assets/{i18n-locales-Bz4c8KXc.js → i18n-locales-BBA090ve.js} +10 -10
  91. package/dist/assets/index-C5Fu9Kda.css +2 -0
  92. package/dist/assets/index-ClPLLRzK.js +20 -0
  93. package/dist/assets/{infoDiagram-FKFFQAWI-Cr1-5_Am.js → infoDiagram-FKFFQAWI-oOVNWlVA.js} +1 -1
  94. package/dist/assets/{infrastructure-CIpDEFyQ.js → infrastructure-B4zG1jNa.js} +2 -2
  95. package/dist/assets/{ishikawaDiagram-5VMMS53U-Bsjx7BsE.js → ishikawaDiagram-5VMMS53U-BUfTfup1.js} +1 -1
  96. package/dist/assets/{journeyDiagram-EYS64GPL-1scn5Z5c.js → journeyDiagram-EYS64GPL-4fyU8Ui9.js} +2 -2
  97. package/dist/assets/{kanban-definition-UXKFOSKX-DjLQAv5U.js → kanban-definition-UXKFOSKX-qwquHo2y.js} +1 -1
  98. package/dist/assets/mermaid-GHXKKRXX-_UhQGe8N.js +1 -0
  99. package/dist/assets/{mermaid.core-pW40dd4u.js → mermaid.core-RfBGJVq5.js} +2 -2
  100. package/dist/assets/{metadata-admin-pawEBYI9.js → metadata-admin-Bo-vWW2Z.js} +3 -3
  101. package/dist/assets/{mindmap-definition-THT77NOG-CUcYMB9H.js → mindmap-definition-THT77NOG-cOVHgGB_.js} +1 -1
  102. package/dist/assets/{pegDiagram-XKGWAZYB-CT1r3sRa.js → pegDiagram-XKGWAZYB-DQikOuPL.js} +1 -1
  103. package/dist/assets/{pieDiagram-E7YTZNPT-CSi-V1LQ.js → pieDiagram-E7YTZNPT-Cu9wPXiv.js} +2 -2
  104. package/dist/assets/plugin-calendar-DqlnPeWE.js +1 -0
  105. package/dist/assets/plugin-charts-hJ5C1pY-.js +7 -0
  106. package/dist/assets/{plugin-chatbot-BGnkLzFS.js → plugin-chatbot-BeSLDg4N.js} +5 -5
  107. package/dist/assets/plugin-dashboard-d1o52lHr.js +6 -0
  108. package/dist/assets/{plugin-form-_fjHxKTV.js → plugin-form-D8x_rH5w.js} +1 -1
  109. package/dist/assets/plugin-gantt-B2GTMGPH.js +63 -0
  110. package/dist/assets/plugin-grid-DGXy_yQF.js +9 -0
  111. package/dist/assets/{plugin-kanban-DA0eW6yj.js → plugin-kanban-CVf6Nj3e.js} +1 -1
  112. package/dist/assets/plugin-map-hkbw1bGS.js +1 -0
  113. package/dist/assets/{plugin-markdown-B7zwZHmn.js → plugin-markdown-Bdb2UThR.js} +4 -4
  114. package/dist/assets/plugin-report-CelulaB7.js +59 -0
  115. package/dist/assets/{plugin-timeline-B6rsNNAK.js → plugin-timeline-DTcJ-hts.js} +1 -1
  116. package/dist/assets/plugin-tree-Bk5vG9la.js +1 -0
  117. package/dist/assets/{plugin-view-5qxxRyZZ.js → plugin-view-CKs41t7o.js} +1 -1
  118. package/dist/assets/plugins-views-DZmsFOak.js +4 -0
  119. package/dist/assets/{quadrantDiagram-AXDQQJYC-DUJ_94hm.js → quadrantDiagram-AXDQQJYC-DqTU6p89.js} +3 -3
  120. package/dist/assets/{railroadDiagram-O6MQD6OU-CEyfAhzM.js → railroadDiagram-O6MQD6OU-CHGgIBKb.js} +1 -1
  121. package/dist/assets/{requirementDiagram-IS5BZ75X-CAK7hvBg.js → requirementDiagram-IS5BZ75X-B20mHS5h.js} +1 -1
  122. package/dist/assets/{runtime-metadata-persistence-DYPxFzHI.js → runtime-metadata-persistence-DzS2YaNb.js} +1 -1
  123. package/dist/assets/{sankeyDiagram-P5KCCOFB-DgYJh7uz.js → sankeyDiagram-P5KCCOFB-oqGY91Cw.js} +3 -3
  124. package/dist/assets/{sequenceDiagram-WJ2MYXX4-DsQerPtC.js → sequenceDiagram-WJ2MYXX4-CVMm7Aid.js} +1 -1
  125. package/dist/assets/{src-CVJP2nIc.js → src-D7tZqf12.js} +1 -1
  126. package/dist/assets/{src-_DxAIBqo.js → src-DCXZnd2l.js} +1 -1
  127. package/dist/assets/{src-S6pzKItc.js → src-DEMdKbQy.js} +1 -1
  128. package/dist/assets/src-hcMLuWxG.js +17 -0
  129. package/dist/assets/stateDiagram-XQSTLZYL-3oM7IdVe.js +1 -0
  130. package/dist/assets/stateDiagram-v2-IH3M54BS-BznjPAgb.js +1 -0
  131. package/dist/assets/studioEntry-BUFsLXCL.js +1 -0
  132. package/dist/assets/{submitRedirect-UXd9NsjL.js → submitRedirect-7ExeC4kw.js} +1 -1
  133. package/dist/assets/{swimlanes-V6O3JKXN-BiKyiEJr.js → swimlanes-V6O3JKXN-Djgbrkmh.js} +1 -1
  134. package/dist/assets/swimlanesDiagram-JKAHXJPX-DHJJ3qZq.js +8 -0
  135. package/dist/assets/{timeline-definition-24CTP7MA-CW5rY3PX.js → timeline-definition-24CTP7MA-k2lbfDvL.js} +2 -2
  136. package/dist/assets/ui-components-CMHDBJEm.js +37 -0
  137. package/dist/assets/{ui-layout-UUTFXV6S.js → ui-layout-Jk_qY9Ni.js} +1 -1
  138. package/dist/assets/{use-book-data-qUZAxIs0.js → use-book-data-CM73PGvc.js} +1 -1
  139. package/dist/assets/{useActionModal-CkM-zGdy.js → useActionModal-D_iilsul.js} +1 -1
  140. package/dist/assets/{usePackageL10n-F9isJ9pn.js → usePackageL10n-BfPqgsRL.js} +1 -1
  141. package/dist/assets/{useSettingsLabel-CSZBfUiw.js → useSettingsLabel-CW2sBbmj.js} +1 -1
  142. package/dist/assets/vendor-charts-BBlPrtHS.js +67 -0
  143. package/dist/assets/{vendor-i18n-C1AQDWux.js → vendor-i18n-CzBLXLJU.js} +1 -1
  144. package/dist/assets/vendor-objectstack-BU0HrnMy.js +270 -0
  145. package/dist/assets/{vendor-zod-r9lyeyrU.js → vendor-zod-Bwe8XZZa.js} +3 -3
  146. package/dist/assets/{vennDiagram-4TSXK5OY-C79cMc25.js → vennDiagram-4TSXK5OY-zweM554s.js} +1 -1
  147. package/dist/assets/{wardleyDiagram-VM6X3IG4-BAO0_jUk.js → wardleyDiagram-VM6X3IG4-Dg9r6Ajz.js} +1 -1
  148. package/dist/assets/{xychartDiagram-S5SC5T6Z-BIRd7YRo.js → xychartDiagram-S5SC5T6Z-CraplxeN.js} +2 -2
  149. package/dist/eager-closure.json +87 -87
  150. package/dist/index.html +4 -4
  151. package/package.json +1 -1
  152. package/dist/assets/RecordDetailView-A8bbPnkK.js +0 -3
  153. package/dist/assets/architectureDiagram-5GKGNRK7-mGW8P1lC.js +0 -36
  154. package/dist/assets/channel-FD4s9EIH.js +0 -1
  155. package/dist/assets/chunk-75Z2AOVW-CkSdnmiC.js +0 -2
  156. package/dist/assets/chunk-CLGD4ZFX-BTkDISwp.js +0 -1
  157. package/dist/assets/chunk-F27PBJKO-DUKg0YWV.js +0 -1
  158. package/dist/assets/chunk-L3NEJ4N5-Bzz35TZJ.js +0 -1
  159. package/dist/assets/chunk-XXDRQBXY-iNC8aYmk.js +0 -1
  160. package/dist/assets/classDiagram-CYGNFDIV-D5Pd2TCl.js +0 -1
  161. package/dist/assets/classDiagram-v2-TLXNO2FR-D5Pd2TCl.js +0 -1
  162. package/dist/assets/cose-bilkent-JH36ORCC-CPQv9aQH.js +0 -1
  163. package/dist/assets/data-adapter-DL25qpAe.js +0 -5
  164. package/dist/assets/diagram-VX7I27RA-BSEwkn7K.js +0 -24
  165. package/dist/assets/dist-BpPy7hlB.js +0 -5
  166. package/dist/assets/flowDiagram-T62WH6J4-CqVSNJ8T.js +0 -1
  167. package/dist/assets/framework-BfSv4Kb0.js +0 -36
  168. package/dist/assets/gitGraphDiagram-WWUBYQGX-D1dYmoGu.js +0 -106
  169. package/dist/assets/index-BU-FzlQ6.js +0 -20
  170. package/dist/assets/index-_VyGO4ms.css +0 -2
  171. package/dist/assets/mermaid-GHXKKRXX-NzEcDxBh.js +0 -1
  172. package/dist/assets/plugin-calendar-BwiiCIjv.js +0 -1
  173. package/dist/assets/plugin-charts-CDGkx7z5.js +0 -7
  174. package/dist/assets/plugin-dashboard-Bj4ldCX6.js +0 -6
  175. package/dist/assets/plugin-gantt-zR8DkpEg.js +0 -63
  176. package/dist/assets/plugin-grid-kkbz4uec.js +0 -9
  177. package/dist/assets/plugin-map-DukneTNg.js +0 -1
  178. package/dist/assets/plugin-report-DaPtlsJr.js +0 -59
  179. package/dist/assets/plugin-tree-DauauLFc.js +0 -1
  180. package/dist/assets/plugins-views-iYcMmImr.js +0 -4
  181. package/dist/assets/src-JX1BkhmR.js +0 -17
  182. package/dist/assets/stateDiagram-XQSTLZYL-BJndPKik.js +0 -1
  183. package/dist/assets/stateDiagram-v2-IH3M54BS-Bi94bTLl.js +0 -1
  184. package/dist/assets/studioEntry-C6G8U-LG.js +0 -1
  185. package/dist/assets/swimlanesDiagram-JKAHXJPX-DKIR852g.js +0 -8
  186. package/dist/assets/ui-components-D2lrjG-t.js +0 -43
  187. package/dist/assets/vendor-charts-CY9WhhzX.js +0 -67
  188. package/dist/assets/vendor-objectstack-BeKUVjuj.js +0 -270
@@ -1 +0,0 @@
1
- import{o as e,t}from"./rolldown-runtime-C0FnF6B9.js";import{u as n}from"./vendor-charts-CY9WhhzX.js";import{n as r}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{t as i}from"./src-CVJP2nIc.js";import{t as a}from"./cytoscape.esm-CGd-uY3x.js";var o=t(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.layoutBase=r():n.layoutBase=r()})(e,function(){return(function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=``,n(n.s=26)})([(function(e,t,n){function r(){}r.QUALITY=1,r.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,r.DEFAULT_INCREMENTAL=!1,r.DEFAULT_ANIMATION_ON_LAYOUT=!0,r.DEFAULT_ANIMATION_DURING_LAYOUT=!1,r.DEFAULT_ANIMATION_PERIOD=50,r.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,r.DEFAULT_GRAPH_MARGIN=15,r.NODE_DIMENSIONS_INCLUDE_LABELS=!1,r.SIMPLE_NODE_SIZE=40,r.SIMPLE_NODE_HALF_SIZE=r.SIMPLE_NODE_SIZE/2,r.EMPTY_COMPOUND_NODE_SIZE=40,r.MIN_EDGE_LENGTH=1,r.WORLD_BOUNDARY=1e6,r.INITIAL_WORLD_BOUNDARY=r.WORLD_BOUNDARY/1e3,r.WORLD_CENTER_X=1200,r.WORLD_CENTER_Y=900,e.exports=r}),(function(e,t,n){var r=n(2),i=n(8),a=n(9);function o(e,t,n){r.call(this,n),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=n,this.bendpoints=[],this.source=e,this.target=t}for(var s in o.prototype=Object.create(r.prototype),r)o[s]=r[s];o.prototype.getSource=function(){return this.source},o.prototype.getTarget=function(){return this.target},o.prototype.isInterGraph=function(){return this.isInterGraph},o.prototype.getLength=function(){return this.length},o.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},o.prototype.getBendpoints=function(){return this.bendpoints},o.prototype.getLca=function(){return this.lca},o.prototype.getSourceInLca=function(){return this.sourceInLca},o.prototype.getTargetInLca=function(){return this.targetInLca},o.prototype.getOtherEnd=function(e){if(this.source===e)return this.target;if(this.target===e)return this.source;throw`Node is not incident with this edge`},o.prototype.getOtherEndInGraph=function(e,t){for(var n=this.getOtherEnd(e),r=t.getGraphManager().getRoot();;){if(n.getOwner()==t)return n;if(n.getOwner()==r)break;n=n.getOwner().getParent()}return null},o.prototype.updateLength=function(){var e=[,,,,];this.isOverlapingSourceAndTarget=i.getIntersection(this.target.getRect(),this.source.getRect(),e),this.isOverlapingSourceAndTarget||(this.lengthX=e[0]-e[2],this.lengthY=e[1]-e[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},o.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},e.exports=o}),(function(e,t,n){function r(e){this.vGraphObject=e}e.exports=r}),(function(e,t,n){var r=n(2),i=n(10),a=n(13),o=n(0),s=n(16),c=n(4);function l(e,t,n,o){n==null&&o==null&&(o=t),r.call(this,o),e.graphManager!=null&&(e=e.graphManager),this.estimatedSize=i.MIN_VALUE,this.inclusionTreeDepth=i.MAX_VALUE,this.vGraphObject=o,this.edges=[],this.graphManager=e,this.rect=n!=null&&t!=null?new a(t.x,t.y,n.width,n.height):new a}for(var u in l.prototype=Object.create(r.prototype),r)l[u]=r[u];l.prototype.getEdges=function(){return this.edges},l.prototype.getChild=function(){return this.child},l.prototype.getOwner=function(){return this.owner},l.prototype.getWidth=function(){return this.rect.width},l.prototype.setWidth=function(e){this.rect.width=e},l.prototype.getHeight=function(){return this.rect.height},l.prototype.setHeight=function(e){this.rect.height=e},l.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},l.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},l.prototype.getCenter=function(){return new c(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},l.prototype.getLocation=function(){return new c(this.rect.x,this.rect.y)},l.prototype.getRect=function(){return this.rect},l.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},l.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},l.prototype.setRect=function(e,t){this.rect.x=e.x,this.rect.y=e.y,this.rect.width=t.width,this.rect.height=t.height},l.prototype.setCenter=function(e,t){this.rect.x=e-this.rect.width/2,this.rect.y=t-this.rect.height/2},l.prototype.setLocation=function(e,t){this.rect.x=e,this.rect.y=t},l.prototype.moveBy=function(e,t){this.rect.x+=e,this.rect.y+=t},l.prototype.getEdgeListToNode=function(e){var t=[],n=this;return n.edges.forEach(function(r){if(r.target==e){if(r.source!=n)throw`Incorrect edge source!`;t.push(r)}}),t},l.prototype.getEdgesBetween=function(e){var t=[],n=this;return n.edges.forEach(function(r){if(r.source!=n&&r.target!=n)throw`Incorrect edge source and/or target`;(r.target==e||r.source==e)&&t.push(r)}),t},l.prototype.getNeighborsList=function(){var e=new Set,t=this;return t.edges.forEach(function(n){if(n.source==t)e.add(n.target);else{if(n.target!=t)throw`Incorrect incidency!`;e.add(n.source)}}),e},l.prototype.withChildren=function(){var e=new Set,t,n;if(e.add(this),this.child!=null)for(var r=this.child.getNodes(),i=0;i<r.length;i++)t=r[i],n=t.withChildren(),n.forEach(function(t){e.add(t)});return e},l.prototype.getNoOfChildren=function(){var e=0,t;if(this.child==null)e=1;else for(var n=this.child.getNodes(),r=0;r<n.length;r++)t=n[r],e+=t.getNoOfChildren();return e==0&&(e=1),e},l.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw`assert failed`;return this.estimatedSize},l.prototype.calcEstimatedSize=function(){return this.child==null?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},l.prototype.scatter=function(){var e,t,n=-o.INITIAL_WORLD_BOUNDARY,r=o.INITIAL_WORLD_BOUNDARY;e=o.WORLD_CENTER_X+s.nextDouble()*(r-n)+n;var i=-o.INITIAL_WORLD_BOUNDARY,a=o.INITIAL_WORLD_BOUNDARY;t=o.WORLD_CENTER_Y+s.nextDouble()*(a-i)+i,this.rect.x=e,this.rect.y=t},l.prototype.updateBounds=function(){if(this.getChild()==null)throw`assert failed`;if(this.getChild().getNodes().length!=0){var e=this.getChild();if(e.updateBounds(!0),this.rect.x=e.getLeft(),this.rect.y=e.getTop(),this.setWidth(e.getRight()-e.getLeft()),this.setHeight(e.getBottom()-e.getTop()),o.NODE_DIMENSIONS_INCLUDE_LABELS){var t=e.getRight()-e.getLeft(),n=e.getBottom()-e.getTop();this.labelWidth>t&&(this.rect.x-=(this.labelWidth-t)/2,this.setWidth(this.labelWidth)),this.labelHeight>n&&(this.labelPos==`center`?this.rect.y-=(this.labelHeight-n)/2:this.labelPos==`top`&&(this.rect.y-=this.labelHeight-n),this.setHeight(this.labelHeight))}}},l.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw`assert failed`;return this.inclusionTreeDepth},l.prototype.transform=function(e){var t=this.rect.x;t>o.WORLD_BOUNDARY?t=o.WORLD_BOUNDARY:t<-o.WORLD_BOUNDARY&&(t=-o.WORLD_BOUNDARY);var n=this.rect.y;n>o.WORLD_BOUNDARY?n=o.WORLD_BOUNDARY:n<-o.WORLD_BOUNDARY&&(n=-o.WORLD_BOUNDARY);var r=new c(t,n),i=e.inverseTransformPoint(r);this.setLocation(i.x,i.y)},l.prototype.getLeft=function(){return this.rect.x},l.prototype.getRight=function(){return this.rect.x+this.rect.width},l.prototype.getTop=function(){return this.rect.y},l.prototype.getBottom=function(){return this.rect.y+this.rect.height},l.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},e.exports=l}),(function(e,t,n){function r(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.setX=function(e){this.x=e},r.prototype.setY=function(e){this.y=e},r.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},r.prototype.getCopy=function(){return new r(this.x,this.y)},r.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},e.exports=r}),(function(e,t,n){var r=n(2),i=n(10),a=n(0),o=n(6),s=n(3),c=n(1),l=n(13),u=n(12),d=n(11);function f(e,t,n){r.call(this,n),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=e,t!=null&&t instanceof o?this.graphManager=t:t!=null&&t instanceof Layout&&(this.graphManager=t.graphManager)}for(var p in f.prototype=Object.create(r.prototype),r)f[p]=r[p];f.prototype.getNodes=function(){return this.nodes},f.prototype.getEdges=function(){return this.edges},f.prototype.getGraphManager=function(){return this.graphManager},f.prototype.getParent=function(){return this.parent},f.prototype.getLeft=function(){return this.left},f.prototype.getRight=function(){return this.right},f.prototype.getTop=function(){return this.top},f.prototype.getBottom=function(){return this.bottom},f.prototype.isConnected=function(){return this.isConnected},f.prototype.add=function(e,t,n){if(t==null&&n==null){var r=e;if(this.graphManager==null)throw`Graph has no graph mgr!`;if(this.getNodes().indexOf(r)>-1)throw`Node already in graph!`;return r.owner=this,this.getNodes().push(r),r}var i=e;if(!(this.getNodes().indexOf(t)>-1&&this.getNodes().indexOf(n)>-1))throw`Source or target not in graph!`;if(t.owner!=n.owner||t.owner!=this)throw`Both owners must be this graph!`;return t.owner==n.owner?(i.source=t,i.target=n,i.isInterGraph=!1,this.getEdges().push(i),t.edges.push(i),n!=t&&n.edges.push(i),i):null},f.prototype.remove=function(e){var t=e;if(e instanceof s){if(t==null)throw`Node is null!`;if(t.owner==null||t.owner!=this)throw`Owner graph is invalid!`;if(this.graphManager==null)throw`Owner graph manager is invalid!`;for(var n=t.edges.slice(),r,i=n.length,a=0;a<i;a++)r=n[a],r.isInterGraph?this.graphManager.remove(r):r.source.owner.remove(r);var o=this.nodes.indexOf(t);if(o==-1)throw`Node not in owner node list!`;this.nodes.splice(o,1)}else if(e instanceof c){var r=e;if(r==null)throw`Edge is null!`;if(r.source==null||r.target==null)throw`Source and/or target is null!`;if(r.source.owner==null||r.target.owner==null||r.source.owner!=this||r.target.owner!=this)throw`Source and/or target owner is invalid!`;var l=r.source.edges.indexOf(r),u=r.target.edges.indexOf(r);if(!(l>-1&&u>-1))throw`Source and/or target doesn't know this edge!`;r.source.edges.splice(l,1),r.target!=r.source&&r.target.edges.splice(u,1);var o=r.source.owner.getEdges().indexOf(r);if(o==-1)throw`Not in owner's edge list!`;r.source.owner.getEdges().splice(o,1)}},f.prototype.updateLeftTop=function(){for(var e=i.MAX_VALUE,t=i.MAX_VALUE,n,r,a,o=this.getNodes(),s=o.length,c=0;c<s;c++){var l=o[c];n=l.getTop(),r=l.getLeft(),e>n&&(e=n),t>r&&(t=r)}return e==i.MAX_VALUE?null:(a=o[0].getParent().paddingLeft==null?this.margin:o[0].getParent().paddingLeft,this.left=t-a,this.top=e-a,new u(this.left,this.top))},f.prototype.updateBounds=function(e){for(var t=i.MAX_VALUE,n=-i.MAX_VALUE,r=i.MAX_VALUE,a=-i.MAX_VALUE,o,s,c,u,d,f=this.nodes,p=f.length,m=0;m<p;m++){var h=f[m];e&&h.child!=null&&h.updateBounds(),o=h.getLeft(),s=h.getRight(),c=h.getTop(),u=h.getBottom(),t>o&&(t=o),n<s&&(n=s),r>c&&(r=c),a<u&&(a=u)}var g=new l(t,r,n-t,a-r);t==i.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),d=f[0].getParent().paddingLeft==null?this.margin:f[0].getParent().paddingLeft,this.left=g.x-d,this.right=g.x+g.width+d,this.top=g.y-d,this.bottom=g.y+g.height+d},f.calculateBounds=function(e){for(var t=i.MAX_VALUE,n=-i.MAX_VALUE,r=i.MAX_VALUE,a=-i.MAX_VALUE,o,s,c,u,d=e.length,f=0;f<d;f++){var p=e[f];o=p.getLeft(),s=p.getRight(),c=p.getTop(),u=p.getBottom(),t>o&&(t=o),n<s&&(n=s),r>c&&(r=c),a<u&&(a=u)}return new l(t,r,n-t,a-r)},f.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},f.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw`assert failed`;return this.estimatedSize},f.prototype.calcEstimatedSize=function(){for(var e=0,t=this.nodes,n=t.length,r=0;r<n;r++){var i=t[r];e+=i.calcEstimatedSize()}return this.estimatedSize=e==0?a.EMPTY_COMPOUND_NODE_SIZE:e/Math.sqrt(this.nodes.length),this.estimatedSize},f.prototype.updateConnected=function(){var e=this;if(this.nodes.length==0){this.isConnected=!0;return}var t=new d,n=new Set,r=this.nodes[0],i,a;for(r.withChildren().forEach(function(e){t.push(e),n.add(e)});t.length!==0;){r=t.shift(),i=r.getEdges();for(var o=i.length,s=0;s<o;s++)a=i[s].getOtherEndInGraph(r,this),a!=null&&!n.has(a)&&a.withChildren().forEach(function(e){t.push(e),n.add(e)})}if(this.isConnected=!1,n.size>=this.nodes.length){var c=0;n.forEach(function(t){t.owner==e&&c++}),c==this.nodes.length&&(this.isConnected=!0)}},e.exports=f}),(function(e,t,n){var r,i=n(1);function a(e){r=n(5),this.layout=e,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var e=this.layout.newGraph(),t=this.layout.newNode(null),n=this.add(e,t);return this.setRootGraph(n),this.rootGraph},a.prototype.add=function(e,t,n,r,i){if(n==null&&r==null&&i==null){if(e==null)throw`Graph is null!`;if(t==null)throw`Parent node is null!`;if(this.graphs.indexOf(e)>-1)throw`Graph already in this graph mgr!`;if(this.graphs.push(e),e.parent!=null)throw`Already has a parent!`;if(t.child!=null)throw`Already has a child!`;return e.parent=t,t.child=e,e}i=n,r=t,n=e;var a=r.getOwner(),o=i.getOwner();if(a==null||a.getGraphManager()!=this)throw`Source not in this graph mgr!`;if(o==null||o.getGraphManager()!=this)throw`Target not in this graph mgr!`;if(a==o)return n.isInterGraph=!1,a.add(n,r,i);if(n.isInterGraph=!0,n.source=r,n.target=i,this.edges.indexOf(n)>-1)throw`Edge already in inter-graph edge list!`;if(this.edges.push(n),n.source==null||n.target==null)throw`Edge source and/or target is null!`;if(n.source.edges.indexOf(n)!=-1||n.target.edges.indexOf(n)!=-1)throw`Edge already in source and/or target incidency list!`;return n.source.edges.push(n),n.target.edges.push(n),n},a.prototype.remove=function(e){if(e instanceof r){var t=e;if(t.getGraphManager()!=this)throw`Graph not in this graph mgr`;if(!(t==this.rootGraph||t.parent!=null&&t.parent.graphManager==this))throw`Invalid parent node!`;var n=[];n=n.concat(t.getEdges());for(var a,o=n.length,s=0;s<o;s++)a=n[s],t.remove(a);var c=[];c=c.concat(t.getNodes());var l;o=c.length;for(var s=0;s<o;s++)l=c[s],t.remove(l);t==this.rootGraph&&this.setRootGraph(null);var u=this.graphs.indexOf(t);this.graphs.splice(u,1),t.parent=null}else if(e instanceof i){if(a=e,a==null)throw`Edge is null!`;if(!a.isInterGraph)throw`Not an inter-graph edge!`;if(a.source==null||a.target==null)throw`Source and/or target is null!`;if(a.source.edges.indexOf(a)==-1||a.target.edges.indexOf(a)==-1)throw`Source and/or target doesn't know this edge!`;var u=a.source.edges.indexOf(a);if(a.source.edges.splice(u,1),u=a.target.edges.indexOf(a),a.target.edges.splice(u,1),a.source.owner==null||a.source.owner.getGraphManager()==null)throw`Edge owner graph or owner graph manager is null!`;if(a.source.owner.getGraphManager().edges.indexOf(a)==-1)throw`Not in owner graph manager's edge list!`;var u=a.source.owner.getGraphManager().edges.indexOf(a);a.source.owner.getGraphManager().edges.splice(u,1)}},a.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},a.prototype.getGraphs=function(){return this.graphs},a.prototype.getAllNodes=function(){if(this.allNodes==null){for(var e=[],t=this.getGraphs(),n=t.length,r=0;r<n;r++)e=e.concat(t[r].getNodes());this.allNodes=e}return this.allNodes},a.prototype.resetAllNodes=function(){this.allNodes=null},a.prototype.resetAllEdges=function(){this.allEdges=null},a.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},a.prototype.getAllEdges=function(){if(this.allEdges==null){var e=[],t=this.getGraphs();t.length;for(var n=0;n<t.length;n++)e=e.concat(t[n].getEdges());e=e.concat(this.edges),this.allEdges=e}return this.allEdges},a.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},a.prototype.setAllNodesToApplyGravitation=function(e){if(this.allNodesToApplyGravitation!=null)throw`assert failed`;this.allNodesToApplyGravitation=e},a.prototype.getRoot=function(){return this.rootGraph},a.prototype.setRootGraph=function(e){if(e.getGraphManager()!=this)throw`Root not in this graph mgr!`;this.rootGraph=e,e.parent??=this.layout.newNode(`Root node`)},a.prototype.getLayout=function(){return this.layout},a.prototype.isOneAncestorOfOther=function(e,t){if(e==null||t==null)throw`assert failed`;if(e==t)return!0;var n=e.getOwner(),r;do{if(r=n.getParent(),r==null)break;if(r==t)return!0;if(n=r.getOwner(),n==null)break}while(!0);n=t.getOwner();do{if(r=n.getParent(),r==null)break;if(r==e)return!0;if(n=r.getOwner(),n==null)break}while(!0);return!1},a.prototype.calcLowestCommonAncestors=function(){for(var e,t,n,r,i,a=this.getAllEdges(),o=a.length,s=0;s<o;s++){if(e=a[s],t=e.source,n=e.target,e.lca=null,e.sourceInLca=t,e.targetInLca=n,t==n){e.lca=t.getOwner();continue}for(r=t.getOwner();e.lca==null;){for(e.targetInLca=n,i=n.getOwner();e.lca==null;){if(i==r){e.lca=i;break}if(i==this.rootGraph)break;if(e.lca!=null)throw`assert failed`;e.targetInLca=i.getParent(),i=e.targetInLca.getOwner()}if(r==this.rootGraph)break;e.lca??(e.sourceInLca=r.getParent(),r=e.sourceInLca.getOwner())}if(e.lca==null)throw`assert failed`}},a.prototype.calcLowestCommonAncestor=function(e,t){if(e==t)return e.getOwner();var n=e.getOwner();do{if(n==null)break;var r=t.getOwner();do{if(r==null)break;if(r==n)return r;r=r.getParent().getOwner()}while(!0);n=n.getParent().getOwner()}while(!0);return n},a.prototype.calcInclusionTreeDepths=function(e,t){e==null&&t==null&&(e=this.rootGraph,t=1);for(var n,r=e.getNodes(),i=r.length,a=0;a<i;a++)n=r[a],n.inclusionTreeDepth=t,n.child!=null&&this.calcInclusionTreeDepths(n.child,t+1)},a.prototype.includesInvalidEdge=function(){for(var e,t=this.edges.length,n=0;n<t;n++)if(e=this.edges[n],this.isOneAncestorOfOther(e.source,e.target))return!0;return!1},e.exports=a}),(function(e,t,n){var r=n(0);function i(){}for(var a in r)i[a]=r[a];i.MAX_ITERATIONS=2500,i.DEFAULT_EDGE_LENGTH=50,i.DEFAULT_SPRING_STRENGTH=.45,i.DEFAULT_REPULSION_STRENGTH=4500,i.DEFAULT_GRAVITY_STRENGTH=.4,i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,i.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,i.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,i.COOLING_ADAPTATION_FACTOR=.33,i.ADAPTATION_LOWER_NODE_LIMIT=1e3,i.ADAPTATION_UPPER_NODE_LIMIT=5e3,i.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,i.MAX_NODE_DISPLACEMENT=i.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,i.MIN_REPULSION_DIST=i.DEFAULT_EDGE_LENGTH/10,i.CONVERGENCE_CHECK_PERIOD=100,i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,i.MIN_EDGE_LENGTH=1,i.GRID_CALCULATION_CHECK_PERIOD=10,e.exports=i}),(function(e,t,n){var r=n(12);function i(){}i.calcSeparationAmount=function(e,t,n,r){if(!e.intersects(t))throw`assert failed`;var i=[,,];this.decideDirectionsForOverlappingNodes(e,t,i),n[0]=Math.min(e.getRight(),t.getRight())-Math.max(e.x,t.x),n[1]=Math.min(e.getBottom(),t.getBottom())-Math.max(e.y,t.y),e.getX()<=t.getX()&&e.getRight()>=t.getRight()?n[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight()):t.getX()<=e.getX()&&t.getRight()>=e.getRight()&&(n[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight())),e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()?n[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom()):t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()&&(n[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom()));var a=Math.abs((t.getCenterY()-e.getCenterY())/(t.getCenterX()-e.getCenterX()));t.getCenterY()===e.getCenterY()&&t.getCenterX()===e.getCenterX()&&(a=1);var o=a*n[0],s=n[1]/a;n[0]<s?s=n[0]:o=n[1],n[0]=-1*i[0]*(s/2+r),n[1]=-1*i[1]*(o/2+r)},i.decideDirectionsForOverlappingNodes=function(e,t,n){n[0]=e.getCenterX()<t.getCenterX()?-1:1,n[1]=e.getCenterY()<t.getCenterY()?-1:1},i.getIntersection2=function(e,t,n){var r=e.getCenterX(),i=e.getCenterY(),a=t.getCenterX(),o=t.getCenterY();if(e.intersects(t))return n[0]=r,n[1]=i,n[2]=a,n[3]=o,!0;var s=e.getX(),c=e.getY(),l=e.getRight(),u=e.getX(),d=e.getBottom(),f=e.getRight(),p=e.getWidthHalf(),m=e.getHeightHalf(),h=t.getX(),g=t.getY(),_=t.getRight(),v=t.getX(),y=t.getBottom(),b=t.getRight(),x=t.getWidthHalf(),S=t.getHeightHalf(),C=!1,w=!1;if(r===a){if(i>o)return n[0]=r,n[1]=c,n[2]=a,n[3]=y,!1;if(i<o)return n[0]=r,n[1]=d,n[2]=a,n[3]=g,!1}else if(i===o){if(r>a)return n[0]=s,n[1]=i,n[2]=_,n[3]=o,!1;if(r<a)return n[0]=l,n[1]=i,n[2]=h,n[3]=o,!1}else{var T=e.height/e.width,E=t.height/t.width,D=(o-i)/(a-r),O=void 0,k=void 0,A=void 0,j=void 0,M=void 0,N=void 0;if(-T===D?r>a?(n[0]=u,n[1]=d,C=!0):(n[0]=l,n[1]=c,C=!0):T===D&&(r>a?(n[0]=s,n[1]=c,C=!0):(n[0]=f,n[1]=d,C=!0)),-E===D?a>r?(n[2]=v,n[3]=y,w=!0):(n[2]=_,n[3]=g,w=!0):E===D&&(a>r?(n[2]=h,n[3]=g,w=!0):(n[2]=b,n[3]=y,w=!0)),C&&w)return!1;if(r>a?i>o?(O=this.getCardinalDirection(T,D,4),k=this.getCardinalDirection(E,D,2)):(O=this.getCardinalDirection(-T,D,3),k=this.getCardinalDirection(-E,D,1)):i>o?(O=this.getCardinalDirection(-T,D,1),k=this.getCardinalDirection(-E,D,3)):(O=this.getCardinalDirection(T,D,2),k=this.getCardinalDirection(E,D,4)),!C)switch(O){case 1:j=c,A=r+-m/D,n[0]=A,n[1]=j;break;case 2:A=f,j=i+p*D,n[0]=A,n[1]=j;break;case 3:j=d,A=r+m/D,n[0]=A,n[1]=j;break;case 4:A=u,j=i+-p*D,n[0]=A,n[1]=j}if(!w)switch(k){case 1:N=g,M=a+-S/D,n[2]=M,n[3]=N;break;case 2:M=b,N=o+x*D,n[2]=M,n[3]=N;break;case 3:N=y,M=a+S/D,n[2]=M,n[3]=N;break;case 4:M=v,N=o+-x*D,n[2]=M,n[3]=N}}return!1},i.getCardinalDirection=function(e,t,n){return e>t?n:1+n%4},i.getIntersection=function(e,t,n,i){if(i==null)return this.getIntersection2(e,t,n);var a=e.x,o=e.y,s=t.x,c=t.y,l=n.x,u=n.y,d=i.x,f=i.y,p=void 0,m=void 0,h=void 0,g=void 0,_=void 0,v=void 0,y=void 0,b=void 0,x=void 0;return h=c-o,_=a-s,y=s*o-a*c,g=f-u,v=l-d,b=d*u-l*f,x=h*v-g*_,x===0?null:(p=(_*b-v*y)/x,m=(g*y-h*b)/x,new r(p,m))},i.angleOfVector=function(e,t,n,r){var i=void 0;return e===n?i=r<t?this.ONE_AND_HALF_PI:this.HALF_PI:(i=Math.atan((r-t)/(n-e)),n<e?i+=Math.PI:r<t&&(i+=this.TWO_PI)),i},i.doIntersect=function(e,t,n,r){var i=e.x,a=e.y,o=t.x,s=t.y,c=n.x,l=n.y,u=r.x,d=r.y,f=(o-i)*(d-l)-(u-c)*(s-a);if(f===0)return!1;var p=((d-l)*(u-i)+(c-u)*(d-a))/f,m=((a-s)*(u-i)+(o-i)*(d-a))/f;return 0<p&&p<1&&0<m&&m<1},i.HALF_PI=.5*Math.PI,i.ONE_AND_HALF_PI=1.5*Math.PI,i.TWO_PI=2*Math.PI,i.THREE_PI=3*Math.PI,e.exports=i}),(function(e,t,n){function r(){}r.sign=function(e){return e>0?1:e<0?-1:0},r.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},r.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},e.exports=r}),(function(e,t,n){function r(){}r.MAX_VALUE=2147483647,r.MIN_VALUE=-2147483648,e.exports=r}),(function(e,t,n){var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var a=function(e){return{value:e,next:null,prev:null}},o=function(e,t,n,r){return e===null?r.head=t:e.next=t,n===null?r.tail=t:n.prev=t,t.prev=e,t.next=n,r.length++,t},s=function(e,t){var n=e.prev,r=e.next;return n===null?t.head=r:n.next=r,r===null?t.tail=n:r.prev=n,e.prev=e.next=null,t.length--,e};e.exports=function(){function e(t){var n=this;i(this,e),this.length=0,this.head=null,this.tail=null,t?.forEach(function(e){return n.push(e)})}return r(e,[{key:`size`,value:function(){return this.length}},{key:`insertBefore`,value:function(e,t){return o(t.prev,a(e),t,this)}},{key:`insertAfter`,value:function(e,t){return o(t,a(e),t.next,this)}},{key:`insertNodeBefore`,value:function(e,t){return o(t.prev,e,t,this)}},{key:`insertNodeAfter`,value:function(e,t){return o(t,e,t.next,this)}},{key:`push`,value:function(e){return o(this.tail,a(e),null,this)}},{key:`unshift`,value:function(e){return o(null,a(e),this.head,this)}},{key:`remove`,value:function(e){return s(e,this)}},{key:`pop`,value:function(){return s(this.tail,this).value}},{key:`popNode`,value:function(){return s(this.tail,this)}},{key:`shift`,value:function(){return s(this.head,this).value}},{key:`shiftNode`,value:function(){return s(this.head,this)}},{key:`get_object_at`,value:function(e){if(e<=this.length()){for(var t=1,n=this.head;t<e;)n=n.next,t++;return n.value}}},{key:`set_object_at`,value:function(e,t){if(e<=this.length()){for(var n=1,r=this.head;n<e;)r=r.next,n++;r.value=t}}}]),e}()}),(function(e,t,n){function r(e,t,n){this.x=null,this.y=null,e==null&&t==null&&n==null?(this.x=0,this.y=0):typeof e==`number`&&typeof t==`number`&&n==null?(this.x=e,this.y=t):e.constructor.name==`Point`&&t==null&&n==null&&(n=e,this.x=n.x,this.y=n.y)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.getLocation=function(){return new r(this.x,this.y)},r.prototype.setLocation=function(e,t,n){e.constructor.name==`Point`&&t==null&&n==null?(n=e,this.setLocation(n.x,n.y)):typeof e==`number`&&typeof t==`number`&&n==null&&(parseInt(e)==e&&parseInt(t)==t?this.move(e,t):(this.x=Math.floor(e+.5),this.y=Math.floor(t+.5)))},r.prototype.move=function(e,t){this.x=e,this.y=t},r.prototype.translate=function(e,t){this.x+=e,this.y+=t},r.prototype.equals=function(e){if(e.constructor.name==`Point`){var t=e;return this.x==t.x&&this.y==t.y}return this==e},r.prototype.toString=function(){return new r().constructor.name+`[x=`+this.x+`,y=`+this.y+`]`},e.exports=r}),(function(e,t,n){function r(e,t,n,r){this.x=0,this.y=0,this.width=0,this.height=0,e!=null&&t!=null&&n!=null&&r!=null&&(this.x=e,this.y=t,this.width=n,this.height=r)}r.prototype.getX=function(){return this.x},r.prototype.setX=function(e){this.x=e},r.prototype.getY=function(){return this.y},r.prototype.setY=function(e){this.y=e},r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(e){this.width=e},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(e){this.height=e},r.prototype.getRight=function(){return this.x+this.width},r.prototype.getBottom=function(){return this.y+this.height},r.prototype.intersects=function(e){return!(this.getRight()<e.x||this.getBottom()<e.y||e.getRight()<this.x||e.getBottom()<this.y)},r.prototype.getCenterX=function(){return this.x+this.width/2},r.prototype.getMinX=function(){return this.getX()},r.prototype.getMaxX=function(){return this.getX()+this.width},r.prototype.getCenterY=function(){return this.y+this.height/2},r.prototype.getMinY=function(){return this.getY()},r.prototype.getMaxY=function(){return this.getY()+this.height},r.prototype.getWidthHalf=function(){return this.width/2},r.prototype.getHeightHalf=function(){return this.height/2},e.exports=r}),(function(e,t,n){var r=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e};function i(){}i.lastID=0,i.createID=function(e){return i.isPrimitive(e)?e:e.uniqueID==null?(e.uniqueID=i.getString(),i.lastID++,e.uniqueID):e.uniqueID},i.getString=function(e){return e??=i.lastID,`Object#`+e},i.isPrimitive=function(e){var t=e===void 0?`undefined`:r(e);return e==null||t!=`object`&&t!=`function`},e.exports=i}),(function(e,t,n){function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var i=n(0),a=n(6),o=n(3),s=n(1),c=n(5),l=n(4),u=n(17),d=n(27);function f(e){d.call(this),this.layoutQuality=i.QUALITY,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=i.DEFAULT_INCREMENTAL,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new a(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,e!=null&&(this.isRemoteUse=e)}f.RANDOM_SEED=1,f.prototype=Object.create(d.prototype),f.prototype.getGraphManager=function(){return this.graphManager},f.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},f.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},f.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},f.prototype.newGraphManager=function(){var e=new a(this);return this.graphManager=e,e},f.prototype.newGraph=function(e){return new c(null,this.graphManager,e)},f.prototype.newNode=function(e){return new o(this.graphManager,e)},f.prototype.newEdge=function(e){return new s(null,null,e)},f.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},f.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var e=!this.checkLayoutSuccess()&&this.layout();return i.ANIMATE!==`during`&&(e&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,e)},f.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},f.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var e=this.graphManager.getAllEdges(),t=0;t<e.length;t++)e[t];for(var n=this.graphManager.getRoot().getNodes(),t=0;t<n.length;t++)n[t];this.update(this.graphManager.getRoot())}},f.prototype.update=function(e){if(e==null)this.update2();else if(e instanceof o){var t=e;if(t.getChild()!=null)for(var n=t.getChild().getNodes(),r=0;r<n.length;r++)update(n[r]);t.vGraphObject!=null&&t.vGraphObject.update(t)}else if(e instanceof s){var i=e;i.vGraphObject!=null&&i.vGraphObject.update(i)}else if(e instanceof c){var a=e;a.vGraphObject!=null&&a.vGraphObject.update(a)}},f.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=i.QUALITY,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=i.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},f.prototype.transform=function(e){if(e==null)this.transform(new l(0,0));else{var t=new u,n=this.graphManager.getRoot().updateLeftTop();if(n!=null){t.setWorldOrgX(e.x),t.setWorldOrgY(e.y),t.setDeviceOrgX(n.x),t.setDeviceOrgY(n.y);for(var r=this.getAllNodes(),i,a=0;a<r.length;a++)i=r[a],i.transform(t)}}},f.prototype.positionNodesRandomly=function(e){if(e==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var t,n,r=e.getNodes(),i=0;i<r.length;i++)t=r[i],n=t.getChild(),n==null||n.getNodes().length==0?t.scatter():(this.positionNodesRandomly(n),t.updateBounds())},f.prototype.getFlatForest=function(){for(var e=[],t=!0,n=this.graphManager.getRoot().getNodes(),i=!0,a=0;a<n.length;a++)n[a].getChild()!=null&&(i=!1);if(!i)return e;var o=new Set,s=[],c=new Map,l=[];for(l=l.concat(n);l.length>0&&t;){for(s.push(l[0]);s.length>0&&t;){var u=s[0];s.splice(0,1),o.add(u);for(var d=u.getEdges(),a=0;a<d.length;a++){var f=d[a].getOtherEnd(u);if(c.get(u)!=f){if(!o.has(f))s.push(f),c.set(f,u);else{t=!1;break}}}}if(!t)e=[];else{var p=[].concat(r(o));e.push(p);for(var a=0;a<p.length;a++){var m=p[a],h=l.indexOf(m);h>-1&&l.splice(h,1)}o=new Set,c=new Map}}return e},f.prototype.createDummyNodesForBendpoints=function(e){for(var t=[],n=e.source,r=this.graphManager.calcLowestCommonAncestor(e.source,e.target),i=0;i<e.bendpoints.length;i++){var a=this.newNode(null);a.setRect(new Point(0,0),new Dimension(1,1)),r.add(a);var o=this.newEdge(null);this.graphManager.add(o,n,a),t.add(a),n=a}var o=this.newEdge(null);return this.graphManager.add(o,n,e.target),this.edgeToDummyNodes.set(e,t),e.isInterGraph()?this.graphManager.remove(e):r.remove(e),t},f.prototype.createBendpointsFromDummyNodes=function(){var e=[];e=e.concat(this.graphManager.getAllEdges()),e=[].concat(r(this.edgeToDummyNodes.keys()),e);for(var t=0;t<e.length;t++){var n=e[t];if(n.bendpoints.length>0){for(var i=this.edgeToDummyNodes.get(n),a=0;a<i.length;a++){var o=i[a],s=new l(o.getCenterX(),o.getCenterY()),c=n.bendpoints.get(a);c.x=s.x,c.y=s.y,o.getOwner().remove(o)}this.graphManager.add(n,n.source,n.target)}}},f.transform=function(e,t,n,r){if(n!=null&&r!=null){var i=t;if(e<=50){var a=t/n;i-=(t-a)/50*(50-e)}else{var o=t*r;i+=(o-t)/50*(e-50)}return i}var s,c;return e<=50?(s=9*t/500,c=t/10):(s=9*t/50,c=-8*t),s*e+c},f.findCenterOfTree=function(e){var t=[];t=t.concat(e);var n=[],r=new Map,i=!1,a=null;(t.length==1||t.length==2)&&(i=!0,a=t[0]);for(var o=0;o<t.length;o++){var s=t[o],c=s.getNeighborsList().size;r.set(s,s.getNeighborsList().size),c==1&&n.push(s)}var l=[];for(l=l.concat(n);!i;){var u=[];u=u.concat(l),l=[];for(var o=0;o<t.length;o++){var s=t[o],d=t.indexOf(s);d>=0&&t.splice(d,1),s.getNeighborsList().forEach(function(e){if(n.indexOf(e)<0){var t=r.get(e)-1;t==1&&l.push(e),r.set(e,t)}})}n=n.concat(l),(t.length==1||t.length==2)&&(i=!0,a=t[0])}return a},f.prototype.setGraphManager=function(e){this.graphManager=e},e.exports=f}),(function(e,t,n){function r(){}r.seed=1,r.x=0,r.nextDouble=function(){return r.x=Math.sin(r.seed++)*1e4,r.x-Math.floor(r.x)},e.exports=r}),(function(e,t,n){var r=n(4);function i(e,t){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(e){this.lworldOrgX=e},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(e){this.lworldOrgY=e},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(e){this.lworldExtX=e},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(e){this.lworldExtY=e},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(e){this.ldeviceOrgX=e},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(e){this.ldeviceOrgY=e},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(e){this.ldeviceExtX=e},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(e){this.ldeviceExtY=e},i.prototype.transformX=function(e){var t=0,n=this.lworldExtX;return n!=0&&(t=this.ldeviceOrgX+(e-this.lworldOrgX)*this.ldeviceExtX/n),t},i.prototype.transformY=function(e){var t=0,n=this.lworldExtY;return n!=0&&(t=this.ldeviceOrgY+(e-this.lworldOrgY)*this.ldeviceExtY/n),t},i.prototype.inverseTransformX=function(e){var t=0,n=this.ldeviceExtX;return n!=0&&(t=this.lworldOrgX+(e-this.ldeviceOrgX)*this.lworldExtX/n),t},i.prototype.inverseTransformY=function(e){var t=0,n=this.ldeviceExtY;return n!=0&&(t=this.lworldOrgY+(e-this.ldeviceOrgY)*this.lworldExtY/n),t},i.prototype.inverseTransformPoint=function(e){return new r(this.inverseTransformX(e.x),this.inverseTransformY(e.y))},e.exports=i}),(function(e,t,n){function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var i=n(15),a=n(7),o=n(0),s=n(8),c=n(9);function l(){i.call(this),this.useSmartIdealEdgeLengthCalculation=a.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=a.DEFAULT_EDGE_LENGTH,this.springConstant=a.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=a.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=a.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=a.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=a.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*a.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=a.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=a.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=a.MAX_ITERATIONS}for(var u in l.prototype=Object.create(i.prototype),i)l[u]=i[u];l.prototype.initParameters=function(){i.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=a.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},l.prototype.calcIdealEdgeLengths=function(){for(var e,t,n,r,i,s,c=this.getGraphManager().getAllEdges(),l=0;l<c.length;l++)e=c[l],e.idealLength=this.idealEdgeLength,e.isInterGraph&&(n=e.getSource(),r=e.getTarget(),i=e.getSourceInLca().getEstimatedSize(),s=e.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(e.idealLength+=i+s-2*o.SIMPLE_NODE_SIZE),t=e.getLca().getInclusionTreeDepth(),e.idealLength+=a.DEFAULT_EDGE_LENGTH*a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(n.getInclusionTreeDepth()+r.getInclusionTreeDepth()-2*t))},l.prototype.initSpringEmbedder=function(){var e=this.getAllNodes().length;this.incremental?(e>a.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(e-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(this.coolingFactor=e>a.ADAPTATION_LOWER_NODE_LIMIT?Math.max(a.COOLING_ADAPTATION_FACTOR,1-(e-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},l.prototype.calcSpringForces=function(){for(var e=this.getAllEdges(),t,n=0;n<e.length;n++)t=e[n],this.calcSpringForce(t,t.idealLength)},l.prototype.calcRepulsionForces=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0&&arguments[1],n,r,i,o,s=this.getAllNodes(),c;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&e&&this.updateGrid(),c=new Set,n=0;n<s.length;n++)i=s[n],this.calculateRepulsionForceOfANode(i,c,e,t),c.add(i);else for(n=0;n<s.length;n++)for(i=s[n],r=n+1;r<s.length;r++)o=s[r],i.getOwner()==o.getOwner()&&this.calcRepulsionForce(i,o)},l.prototype.calcGravitationalForces=function(){for(var e,t=this.getAllNodesToApplyGravitation(),n=0;n<t.length;n++)e=t[n],this.calcGravitationalForce(e)},l.prototype.moveNodes=function(){for(var e=this.getAllNodes(),t,n=0;n<e.length;n++)t=e[n],t.move()},l.prototype.calcSpringForce=function(e,t){var n=e.getSource(),r=e.getTarget(),i,a,o,s;if(this.uniformLeafNodeSizes&&n.getChild()==null&&r.getChild()==null)e.updateLengthSimple();else if(e.updateLength(),e.isOverlapingSourceAndTarget)return;i=e.getLength(),i!=0&&(a=this.springConstant*(i-t),o=a*(e.lengthX/i),s=a*(e.lengthY/i),n.springForceX+=o,n.springForceY+=s,r.springForceX-=o,r.springForceY-=s)},l.prototype.calcRepulsionForce=function(e,t){var n=e.getRect(),r=t.getRect(),i=[,,],o=[,,,,],l,u,d,f,p,m,h;if(n.intersects(r)){s.calcSeparationAmount(n,r,i,a.DEFAULT_EDGE_LENGTH/2),m=2*i[0],h=2*i[1];var g=e.noOfChildren*t.noOfChildren/(e.noOfChildren+t.noOfChildren);e.repulsionForceX-=g*m,e.repulsionForceY-=g*h,t.repulsionForceX+=g*m,t.repulsionForceY+=g*h}else this.uniformLeafNodeSizes&&e.getChild()==null&&t.getChild()==null?(l=r.getCenterX()-n.getCenterX(),u=r.getCenterY()-n.getCenterY()):(s.getIntersection(n,r,o),l=o[2]-o[0],u=o[3]-o[1]),Math.abs(l)<a.MIN_REPULSION_DIST&&(l=c.sign(l)*a.MIN_REPULSION_DIST),Math.abs(u)<a.MIN_REPULSION_DIST&&(u=c.sign(u)*a.MIN_REPULSION_DIST),d=l*l+u*u,f=Math.sqrt(d),p=this.repulsionConstant*e.noOfChildren*t.noOfChildren/d,m=p*l/f,h=p*u/f,e.repulsionForceX-=m,e.repulsionForceY-=h,t.repulsionForceX+=m,t.repulsionForceY+=h},l.prototype.calcGravitationalForce=function(e){var t=e.getOwner(),n=(t.getRight()+t.getLeft())/2,r=(t.getTop()+t.getBottom())/2,i=e.getCenterX()-n,a=e.getCenterY()-r,o=Math.abs(i)+e.getWidth()/2,s=Math.abs(a)+e.getHeight()/2,c;e.getOwner()==this.graphManager.getRoot()?(c=t.getEstimatedSize()*this.gravityRangeFactor,(o>c||s>c)&&(e.gravitationForceX=-this.gravityConstant*i,e.gravitationForceY=-this.gravityConstant*a)):(c=t.getEstimatedSize()*this.compoundGravityRangeFactor,(o>c||s>c)&&(e.gravitationForceX=-this.gravityConstant*i*this.compoundGravityConstant,e.gravitationForceY=-this.gravityConstant*a*this.compoundGravityConstant))},l.prototype.isConverged=function(){var e,t=!1;return this.totalIterations>this.maxIterations/3&&(t=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),e=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,e||t},l.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},l.prototype.calcNoOfChildrenForAllNodes=function(){for(var e,t=this.graphManager.getAllNodes(),n=0;n<t.length;n++)e=t[n],e.noOfChildren=e.getNoOfChildren()},l.prototype.calcGrid=function(e){var t=0,n=0;t=parseInt(Math.ceil((e.getRight()-e.getLeft())/this.repulsionRange)),n=parseInt(Math.ceil((e.getBottom()-e.getTop())/this.repulsionRange));for(var r=Array(t),i=0;i<t;i++)r[i]=Array(n);for(var i=0;i<t;i++)for(var a=0;a<n;a++)r[i][a]=[];return r},l.prototype.addNodeToGrid=function(e,t,n){var r=0,i=0,a=0,o=0;r=parseInt(Math.floor((e.getRect().x-t)/this.repulsionRange)),i=parseInt(Math.floor((e.getRect().width+e.getRect().x-t)/this.repulsionRange)),a=parseInt(Math.floor((e.getRect().y-n)/this.repulsionRange)),o=parseInt(Math.floor((e.getRect().height+e.getRect().y-n)/this.repulsionRange));for(var s=r;s<=i;s++)for(var c=a;c<=o;c++)this.grid[s][c].push(e),e.setGridCoordinates(r,i,a,o)},l.prototype.updateGrid=function(){var e,t,n=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),e=0;e<n.length;e++)t=n[e],this.addNodeToGrid(t,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},l.prototype.calculateRepulsionForceOfANode=function(e,t,n,i){if(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&n||i){var o=new Set;e.surrounding=[];for(var s,c=this.grid,l=e.startX-1;l<e.finishX+2;l++)for(var u=e.startY-1;u<e.finishY+2;u++)if(!(l<0||u<0||l>=c.length||u>=c[0].length)){for(var d=0;d<c[l][u].length;d++)if(s=c[l][u][d],e.getOwner()==s.getOwner()&&e!=s&&!t.has(s)&&!o.has(s)){var f=Math.abs(e.getCenterX()-s.getCenterX())-(e.getWidth()/2+s.getWidth()/2),p=Math.abs(e.getCenterY()-s.getCenterY())-(e.getHeight()/2+s.getHeight()/2);f<=this.repulsionRange&&p<=this.repulsionRange&&o.add(s)}}e.surrounding=[].concat(r(o))}for(l=0;l<e.surrounding.length;l++)this.calcRepulsionForce(e,e.surrounding[l])},l.prototype.calcRepulsionRange=function(){return 0},e.exports=l}),(function(e,t,n){var r=n(1),i=n(7);function a(e,t,n){r.call(this,e,t,n),this.idealLength=i.DEFAULT_EDGE_LENGTH}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];e.exports=a}),(function(e,t,n){var r=n(3);function i(e,t,n,i){r.call(this,e,t,n,i),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];i.prototype.setGridCoordinates=function(e,t,n,r){this.startX=e,this.finishX=t,this.startY=n,this.finishY=r},e.exports=i}),(function(e,t,n){function r(e,t){this.width=0,this.height=0,e!==null&&t!==null&&(this.height=t,this.width=e)}r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(e){this.width=e},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(e){this.height=e},e.exports=r}),(function(e,t,n){var r=n(14);function i(){this.map={},this.keys=[]}i.prototype.put=function(e,t){var n=r.createID(e);this.contains(n)||(this.map[n]=t,this.keys.push(e))},i.prototype.contains=function(e){return r.createID(e),this.map[e]!=null},i.prototype.get=function(e){var t=r.createID(e);return this.map[t]},i.prototype.keySet=function(){return this.keys},e.exports=i}),(function(e,t,n){var r=n(14);function i(){this.set={}}i.prototype.add=function(e){var t=r.createID(e);this.contains(t)||(this.set[t]=e)},i.prototype.remove=function(e){delete this.set[r.createID(e)]},i.prototype.clear=function(){this.set={}},i.prototype.contains=function(e){return this.set[r.createID(e)]==e},i.prototype.isEmpty=function(){return this.size()===0},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAllTo=function(e){for(var t=Object.keys(this.set),n=t.length,r=0;r<n;r++)e.push(this.set[t[r]])},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAll=function(e){for(var t=e.length,n=0;n<t;n++){var r=e[n];this.add(r)}},e.exports=i}),(function(e,t,n){var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var a=n(11);e.exports=function(){function e(t,n){i(this,e),(n!==null||n!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var r=void 0;r=t instanceof a?t.size():t.length,this._quicksort(t,0,r-1)}return r(e,[{key:`_quicksort`,value:function(e,t,n){if(t<n){var r=this._partition(e,t,n);this._quicksort(e,t,r),this._quicksort(e,r+1,n)}}},{key:`_partition`,value:function(e,t,n){for(var r=this._get(e,t),i=t,a=n;;){for(;this.compareFunction(r,this._get(e,a));)a--;for(;this.compareFunction(this._get(e,i),r);)i++;if(i<a)this._swap(e,i,a),i++,a--;else return a}}},{key:`_get`,value:function(e,t){return e instanceof a?e.get_object_at(t):e[t]}},{key:`_set`,value:function(e,t,n){e instanceof a?e.set_object_at(t,n):e[t]=n}},{key:`_swap`,value:function(e,t,n){var r=this._get(e,t);this._set(e,t,this._get(e,n)),this._set(e,n,r)}},{key:`_defaultCompareFunction`,value:function(e,t){return t>e}}]),e}()}),(function(e,t,n){var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.exports=function(){function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;i(this,e),this.sequence1=t,this.sequence2=n,this.match_score=r,this.mismatch_penalty=a,this.gap_penalty=o,this.iMax=t.length+1,this.jMax=n.length+1,this.grid=Array(this.iMax);for(var s=0;s<this.iMax;s++){this.grid[s]=Array(this.jMax);for(var c=0;c<this.jMax;c++)this.grid[s][c]=0}this.tracebackGrid=Array(this.iMax);for(var l=0;l<this.iMax;l++){this.tracebackGrid[l]=Array(this.jMax);for(var u=0;u<this.jMax;u++)this.tracebackGrid[l][u]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return r(e,[{key:`getScore`,value:function(){return this.score}},{key:`getAlignments`,value:function(){return this.alignments}},{key:`computeGrids`,value:function(){for(var e=1;e<this.jMax;e++)this.grid[0][e]=this.grid[0][e-1]+this.gap_penalty,this.tracebackGrid[0][e]=[!1,!1,!0];for(var t=1;t<this.iMax;t++)this.grid[t][0]=this.grid[t-1][0]+this.gap_penalty,this.tracebackGrid[t][0]=[!1,!0,!1];for(var n=1;n<this.iMax;n++)for(var r=1;r<this.jMax;r++){var i=void 0;i=this.sequence1[n-1]===this.sequence2[r-1]?this.grid[n-1][r-1]+this.match_score:this.grid[n-1][r-1]+this.mismatch_penalty;var a=this.grid[n-1][r]+this.gap_penalty,o=this.grid[n][r-1]+this.gap_penalty,s=[i,a,o],c=this.arrayAllMaxIndexes(s);this.grid[n][r]=s[c[0]],this.tracebackGrid[n][r]=[c.includes(0),c.includes(1),c.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:`alignmentTraceback`,value:function(){var e=[];for(e.push({pos:[this.sequence1.length,this.sequence2.length],seq1:``,seq2:``});e[0];){var t=e[0],n=this.tracebackGrid[t.pos[0]][t.pos[1]];n[0]&&e.push({pos:[t.pos[0]-1,t.pos[1]-1],seq1:this.sequence1[t.pos[0]-1]+t.seq1,seq2:this.sequence2[t.pos[1]-1]+t.seq2}),n[1]&&e.push({pos:[t.pos[0]-1,t.pos[1]],seq1:this.sequence1[t.pos[0]-1]+t.seq1,seq2:`-`+t.seq2}),n[2]&&e.push({pos:[t.pos[0],t.pos[1]-1],seq1:`-`+t.seq1,seq2:this.sequence2[t.pos[1]-1]+t.seq2}),t.pos[0]===0&&t.pos[1]===0&&this.alignments.push({sequence1:t.seq1,sequence2:t.seq2}),e.shift()}return this.alignments}},{key:`getAllIndexes`,value:function(e,t){for(var n=[],r=-1;(r=e.indexOf(t,r+1))!==-1;)n.push(r);return n}},{key:`arrayAllMaxIndexes`,value:function(e){return this.getAllIndexes(e,Math.max.apply(null,e))}}]),e}()}),(function(e,t,n){var r=function(){};r.FDLayout=n(18),r.FDLayoutConstants=n(7),r.FDLayoutEdge=n(19),r.FDLayoutNode=n(20),r.DimensionD=n(21),r.HashMap=n(22),r.HashSet=n(23),r.IGeometry=n(8),r.IMath=n(9),r.Integer=n(10),r.Point=n(12),r.PointD=n(4),r.RandomSeed=n(16),r.RectangleD=n(13),r.Transform=n(17),r.UniqueIDGeneretor=n(14),r.Quicksort=n(24),r.LinkedList=n(11),r.LGraphObject=n(2),r.LGraph=n(5),r.LEdge=n(1),r.LGraphManager=n(6),r.LNode=n(3),r.Layout=n(15),r.LayoutConstants=n(0),r.NeedlemanWunsch=n(25),e.exports=r}),(function(e,t,n){function r(){this.listeners=[]}var i=r.prototype;i.addListener=function(e,t){this.listeners.push({event:e,callback:t})},i.removeListener=function(e,t){for(var n=this.listeners.length;n>=0;n--){var r=this.listeners[n];r.event===e&&r.callback===t&&this.listeners.splice(n,1)}},i.emit=function(e,t){for(var n=0;n<this.listeners.length;n++){var r=this.listeners[n];e===r.event&&r.callback(t)}},e.exports=r})])})})),s=t(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r(o()):typeof define==`function`&&define.amd?define([`layout-base`],r):typeof e==`object`?e.coseBase=r(o()):n.coseBase=r(n.layoutBase)})(e,function(e){return(function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=``,n(n.s=7)})([(function(t,n){t.exports=e}),(function(e,t,n){var r=n(0).FDLayoutConstants;function i(){}for(var a in r)i[a]=r[a];i.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,i.DEFAULT_RADIAL_SEPARATION=r.DEFAULT_EDGE_LENGTH,i.DEFAULT_COMPONENT_SEPERATION=60,i.TILE=!0,i.TILING_PADDING_VERTICAL=10,i.TILING_PADDING_HORIZONTAL=10,i.TREE_REDUCTION_ON_INCREMENTAL=!1,e.exports=i}),(function(e,t,n){var r=n(0).FDLayoutEdge;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i}),(function(e,t,n){var r=n(0).LGraph;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i}),(function(e,t,n){var r=n(0).LGraphManager;function i(e){r.call(this,e)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i}),(function(e,t,n){var r=n(0).FDLayoutNode,i=n(0).IMath;function a(e,t,n,i){r.call(this,e,t,n,i)}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];a.prototype.move=function(){var e=this.graphManager.getLayout();this.displacementX=e.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=e.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementX=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementX)),Math.abs(this.displacementY)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementY=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementY)),this.child==null||this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),e.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},a.prototype.propogateDisplacementToChildren=function(e,t){for(var n=this.getChild().getNodes(),r,i=0;i<n.length;i++)r=n[i],r.getChild()==null?(r.moveBy(e,t),r.displacementX+=e,r.displacementY+=t):r.propogateDisplacementToChildren(e,t)},a.prototype.setPred1=function(e){this.pred1=e},a.prototype.getPred1=function(){return pred1},a.prototype.getPred2=function(){return pred2},a.prototype.setNext=function(e){this.next=e},a.prototype.getNext=function(){return next},a.prototype.setProcessed=function(e){this.processed=e},a.prototype.isProcessed=function(){return processed},e.exports=a}),(function(e,t,n){var r=n(0).FDLayout,i=n(4),a=n(3),o=n(5),s=n(2),c=n(1),l=n(0).FDLayoutConstants,u=n(0).LayoutConstants,d=n(0).Point,f=n(0).PointD,p=n(0).Layout,m=n(0).Integer,h=n(0).IGeometry,g=n(0).LGraph,_=n(0).Transform;function v(){r.call(this),this.toBeTiled={}}for(var y in v.prototype=Object.create(r.prototype),r)v[y]=r[y];v.prototype.newGraphManager=function(){var e=new i(this);return this.graphManager=e,e},v.prototype.newGraph=function(e){return new a(null,this.graphManager,e)},v.prototype.newNode=function(e){return new o(this.graphManager,e)},v.prototype.newEdge=function(e){return new s(null,null,e)},v.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.isSubLayout||(this.idealEdgeLength=c.DEFAULT_EDGE_LENGTH<10?10:c.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=c.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=l.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=l.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=l.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=l.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=l.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/l.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=l.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},v.prototype.layout=function(){return u.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},v.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),!this.incremental){var e=this.getFlatForest();if(e.length>0)this.positionNodesRadially(e);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),n=this.nodesWithGravity.filter(function(e){return t.has(e)});this.graphManager.setAllNodesToApplyGravitation(n),this.positionNodesRandomly()}}else if(c.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),n=this.nodesWithGravity.filter(function(e){return t.has(e)});this.graphManager.setAllNodesToApplyGravitation(n)}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},v.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0}if(this.totalIterations%l.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0}this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-this.coolingCycle**+(Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0){if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),t=this.nodesWithGravity.filter(function(t){return e.has(t)});this.graphManager.setAllNodesToApplyGravitation(t),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0}this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var n=!this.isTreeGrowing&&!this.isGrowthFinished,r=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(n,r),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},v.prototype.getPositionsData=function(){for(var e=this.graphManager.getAllNodes(),t={},n=0;n<e.length;n++){var r=e[n].rect,i=e[n].id;t[i]={id:i,x:r.getCenterX(),y:r.getCenterY(),w:r.width,h:r.height}}return t},v.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var e=!1;if(l.ANIMATE===`during`)this.emit(`layoutstarted`);else{for(;!e;)e=this.tick();this.graphManager.updateBounds()}},v.prototype.calculateNodesToApplyGravitationTo=function(){var e=[],t,n=this.graphManager.getGraphs(),r=n.length,i;for(i=0;i<r;i++)t=n[i],t.updateConnected(),t.isConnected||(e=e.concat(t.getNodes()));return e},v.prototype.createBendpoints=function(){var e=[];e=e.concat(this.graphManager.getAllEdges());var t=new Set,n;for(n=0;n<e.length;n++){var r=e[n];if(!t.has(r)){var i=r.getSource(),a=r.getTarget();if(i==a)r.getBendpoints().push(new f),r.getBendpoints().push(new f),this.createDummyNodesForBendpoints(r),t.add(r);else{var o=[];if(o=o.concat(i.getEdgeListToNode(a)),o=o.concat(a.getEdgeListToNode(i)),!t.has(o[0])){if(o.length>1){var s;for(s=0;s<o.length;s++){var c=o[s];c.getBendpoints().push(new f),this.createDummyNodesForBendpoints(c)}}o.forEach(function(e){t.add(e)})}}}if(t.size==e.length)break}},v.prototype.positionNodesRadially=function(e){for(var t=new d(0,0),n=Math.ceil(Math.sqrt(e.length)),r=0,i=0,a=0,o=new f(0,0),s=0;s<e.length;s++){s%n==0&&(a=0,i=r,s!=0&&(i+=c.DEFAULT_COMPONENT_SEPERATION),r=0);var l=e[s],m=p.findCenterOfTree(l);t.x=a,t.y=i,o=v.radialLayout(l,m,t),o.y>r&&(r=Math.floor(o.y)),a=Math.floor(o.x+c.DEFAULT_COMPONENT_SEPERATION)}this.transform(new f(u.WORLD_CENTER_X-o.x/2,u.WORLD_CENTER_Y-o.y/2))},v.radialLayout=function(e,t,n){var r=Math.max(this.maxDiagonalInTree(e),c.DEFAULT_RADIAL_SEPARATION);v.branchRadialLayout(t,null,0,359,0,r);var i=g.calculateBounds(e),a=new _;a.setDeviceOrgX(i.getMinX()),a.setDeviceOrgY(i.getMinY()),a.setWorldOrgX(n.x),a.setWorldOrgY(n.y);for(var o=0;o<e.length;o++)e[o].transform(a);var s=new f(i.getMaxX(),i.getMaxY());return a.inverseTransformPoint(s)},v.branchRadialLayout=function(e,t,n,r,i,a){var o=(r-n+1)/2;o<0&&(o+=180);var s=(o+n)%360*h.TWO_PI/360,c=i*Math.cos(s),l=i*Math.sin(s);e.setCenter(c,l);var u=[];u=u.concat(e.getEdges());var d=u.length;t!=null&&d--;for(var f=0,p=u.length,m,g=e.getEdgesBetween(t);g.length>1;){var _=g[0];g.splice(0,1);var y=u.indexOf(_);y>=0&&u.splice(y,1),p--,d--}m=t==null?0:(u.indexOf(g[0])+1)%p;for(var b=Math.abs(r-n)/d,x=m;f!=d;x=++x%p){var S=u[x].getOtherEnd(e);if(S!=t){var C=(n+f*b)%360,w=(C+b)%360;v.branchRadialLayout(S,e,C,w,i+a,a),f++}}},v.maxDiagonalInTree=function(e){for(var t=m.MIN_VALUE,n=0;n<e.length;n++){var r=e[n].getDiagonal();r>t&&(t=r)}return t},v.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},v.prototype.groupZeroDegreeMembers=function(){var e=this,t={};this.memberGroups={},this.idToDummyNode={};for(var n=[],r=this.graphManager.getAllNodes(),i=0;i<r.length;i++){var a=r[i],s=a.getParent();this.getNodeDegreeWithChildren(a)===0&&(s.id==null||!this.getToBeTiled(s))&&n.push(a)}for(var i=0;i<n.length;i++){var a=n[i],c=a.getParent().id;t[c]===void 0&&(t[c]=[]),t[c]=t[c].concat(a)}Object.keys(t).forEach(function(n){if(t[n].length>1){var r=`DummyCompound_`+n;e.memberGroups[r]=t[n];var i=t[n][0].getParent(),a=new o(e.graphManager);a.id=r,a.paddingLeft=i.paddingLeft||0,a.paddingRight=i.paddingRight||0,a.paddingBottom=i.paddingBottom||0,a.paddingTop=i.paddingTop||0,e.idToDummyNode[r]=a;var s=e.getGraphManager().add(e.newGraph(),a),c=i.getChild();c.add(a);for(var l=0;l<t[n].length;l++){var u=t[n][l];c.remove(u),s.add(u)}}})},v.prototype.clearCompounds=function(){var e={},t={};this.performDFSOnCompounds();for(var n=0;n<this.compoundOrder.length;n++)t[this.compoundOrder[n].id]=this.compoundOrder[n],e[this.compoundOrder[n].id]=[].concat(this.compoundOrder[n].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[n].getChild()),this.compoundOrder[n].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(e,t)},v.prototype.clearZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(n){var r=e.idToDummyNode[n];t[n]=e.tileNodes(e.memberGroups[n],r.paddingLeft+r.paddingRight),r.rect.width=t[n].width,r.rect.height=t[n].height})},v.prototype.repopulateCompounds=function(){for(var e=this.compoundOrder.length-1;e>=0;e--){var t=this.compoundOrder[e],n=t.id,r=t.paddingLeft,i=t.paddingTop;this.adjustLocations(this.tiledMemberPack[n],t.rect.x,t.rect.y,r,i)}},v.prototype.repopulateZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack;Object.keys(t).forEach(function(n){var r=e.idToDummyNode[n],i=r.paddingLeft,a=r.paddingTop;e.adjustLocations(t[n],r.rect.x,r.rect.y,i,a)})},v.prototype.getToBeTiled=function(e){var t=e.id;if(this.toBeTiled[t]!=null)return this.toBeTiled[t];var n=e.getChild();if(n==null)return this.toBeTiled[t]=!1,!1;for(var r=n.getNodes(),i=0;i<r.length;i++){var a=r[i];if(this.getNodeDegree(a)>0)return this.toBeTiled[t]=!1,!1;if(a.getChild()==null){this.toBeTiled[a.id]=!1;continue}if(!this.getToBeTiled(a))return this.toBeTiled[t]=!1,!1}return this.toBeTiled[t]=!0,!0},v.prototype.getNodeDegree=function(e){e.id;for(var t=e.getEdges(),n=0,r=0;r<t.length;r++){var i=t[r];i.getSource().id!==i.getTarget().id&&(n+=1)}return n},v.prototype.getNodeDegreeWithChildren=function(e){var t=this.getNodeDegree(e);if(e.getChild()==null)return t;for(var n=e.getChild().getNodes(),r=0;r<n.length;r++){var i=n[r];t+=this.getNodeDegreeWithChildren(i)}return t},v.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},v.prototype.fillCompexOrderByDFS=function(e){for(var t=0;t<e.length;t++){var n=e[t];n.getChild()!=null&&this.fillCompexOrderByDFS(n.getChild().getNodes()),this.getToBeTiled(n)&&this.compoundOrder.push(n)}},v.prototype.adjustLocations=function(e,t,n,r,i){t+=r,n+=i;for(var a=t,o=0;o<e.rows.length;o++){var s=e.rows[o];t=a;for(var c=0,l=0;l<s.length;l++){var u=s[l];u.rect.x=t,u.rect.y=n,t+=u.rect.width+e.horizontalPadding,u.rect.height>c&&(c=u.rect.height)}n+=c+e.verticalPadding}},v.prototype.tileCompoundMembers=function(e,t){var n=this;this.tiledMemberPack=[],Object.keys(e).forEach(function(r){var i=t[r];n.tiledMemberPack[r]=n.tileNodes(e[r],i.paddingLeft+i.paddingRight),i.rect.width=n.tiledMemberPack[r].width,i.rect.height=n.tiledMemberPack[r].height})},v.prototype.tileNodes=function(e,t){var n={rows:[],rowWidth:[],rowHeight:[],width:0,height:t,verticalPadding:c.TILING_PADDING_VERTICAL,horizontalPadding:c.TILING_PADDING_HORIZONTAL};e.sort(function(e,t){return e.rect.width*e.rect.height>t.rect.width*t.rect.height?-1:+(e.rect.width*e.rect.height<t.rect.width*t.rect.height)});for(var r=0;r<e.length;r++){var i=e[r];n.rows.length==0?this.insertNodeToRow(n,i,0,t):this.canAddHorizontal(n,i.rect.width,i.rect.height)?this.insertNodeToRow(n,i,this.getShortestRowIndex(n),t):this.insertNodeToRow(n,i,n.rows.length,t),this.shiftToLastRow(n)}return n},v.prototype.insertNodeToRow=function(e,t,n,r){var i=r;n==e.rows.length&&(e.rows.push([]),e.rowWidth.push(i),e.rowHeight.push(0));var a=e.rowWidth[n]+t.rect.width;e.rows[n].length>0&&(a+=e.horizontalPadding),e.rowWidth[n]=a,e.width<a&&(e.width=a);var o=t.rect.height;n>0&&(o+=e.verticalPadding);var s=0;o>e.rowHeight[n]&&(s=e.rowHeight[n],e.rowHeight[n]=o,s=e.rowHeight[n]-s),e.height+=s,e.rows[n].push(t)},v.prototype.getShortestRowIndex=function(e){for(var t=-1,n=Number.MAX_VALUE,r=0;r<e.rows.length;r++)e.rowWidth[r]<n&&(t=r,n=e.rowWidth[r]);return t},v.prototype.getLongestRowIndex=function(e){for(var t=-1,n=Number.MIN_VALUE,r=0;r<e.rows.length;r++)e.rowWidth[r]>n&&(t=r,n=e.rowWidth[r]);return t},v.prototype.canAddHorizontal=function(e,t,n){var r=this.getShortestRowIndex(e);if(r<0)return!0;var i=e.rowWidth[r];if(i+e.horizontalPadding+t<=e.width)return!0;var a=0;e.rowHeight[r]<n&&r>0&&(a=n+e.verticalPadding-e.rowHeight[r]);var o=e.width-i>=t+e.horizontalPadding?(e.height+a)/(i+t+e.horizontalPadding):(e.height+a)/e.width;a=n+e.verticalPadding;var s=e.width<t?(e.height+a)/t:(e.height+a)/e.width;return s<1&&(s=1/s),o<1&&(o=1/o),o<s},v.prototype.shiftToLastRow=function(e){var t=this.getLongestRowIndex(e),n=e.rowWidth.length-1,r=e.rows[t],i=r[r.length-1],a=i.width+e.horizontalPadding;if(e.width-e.rowWidth[n]>a&&t!=n){r.splice(-1,1),e.rows[n].push(i),e.rowWidth[t]=e.rowWidth[t]-a,e.rowWidth[n]=e.rowWidth[n]+a,e.width=e.rowWidth[instance.getLongestRowIndex(e)];for(var o=Number.MIN_VALUE,s=0;s<r.length;s++)r[s].height>o&&(o=r[s].height);t>0&&(o+=e.verticalPadding);var c=e.rowHeight[t]+e.rowHeight[n];e.rowHeight[t]=o,e.rowHeight[n]<i.height+e.verticalPadding&&(e.rowHeight[n]=i.height+e.verticalPadding);var l=e.rowHeight[t]+e.rowHeight[n];e.height+=l-c,this.shiftToLastRow(e)}},v.prototype.tilingPreLayout=function(){c.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},v.prototype.tilingPostLayout=function(){c.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},v.prototype.reduceTrees=function(){for(var e=[],t=!0,n;t;){var r=this.graphManager.getAllNodes(),i=[];t=!1;for(var a=0;a<r.length;a++)n=r[a],n.getEdges().length==1&&!n.getEdges()[0].isInterGraph&&n.getChild()==null&&(i.push([n,n.getEdges()[0],n.getOwner()]),t=!0);if(t==1){for(var o=[],s=0;s<i.length;s++)i[s][0].getEdges().length==1&&(o.push(i[s]),i[s][0].getOwner().remove(i[s][0]));e.push(o),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=e},v.prototype.growTree=function(e){for(var t=e[e.length-1],n,r=0;r<t.length;r++)n=t[r],this.findPlaceforPrunedNode(n),n[2].add(n[0]),n[2].add(n[1],n[1].source,n[1].target);e.splice(e.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},v.prototype.findPlaceforPrunedNode=function(e){var t,n,r=e[0];n=r==e[1].source?e[1].target:e[1].source;var i=n.startX,a=n.finishX,o=n.startY,s=n.finishY,c=[0,0,0,0];if(o>0)for(var u=i;u<=a;u++)c[0]+=this.grid[u][o-1].length+this.grid[u][o].length-1;if(a<this.grid.length-1)for(var u=o;u<=s;u++)c[1]+=this.grid[a+1][u].length+this.grid[a][u].length-1;if(s<this.grid[0].length-1)for(var u=i;u<=a;u++)c[2]+=this.grid[u][s+1].length+this.grid[u][s].length-1;if(i>0)for(var u=o;u<=s;u++)c[3]+=this.grid[i-1][u].length+this.grid[i][u].length-1;for(var d=m.MAX_VALUE,f,p,h=0;h<c.length;h++)c[h]<d?(d=c[h],f=1,p=h):c[h]==d&&f++;if(f==3&&d==0)c[0]==0&&c[1]==0&&c[2]==0?t=1:c[0]==0&&c[1]==0&&c[3]==0?t=0:c[0]==0&&c[2]==0&&c[3]==0?t=3:c[1]==0&&c[2]==0&&c[3]==0&&(t=2);else if(f==2&&d==0){var g=Math.floor(Math.random()*2);t=c[0]==0&&c[1]==0?g==0?0:1:c[0]==0&&c[2]==0?g==0?0:2:c[0]==0&&c[3]==0?g==0?0:3:c[1]==0&&c[2]==0?g==0?1:2:c[1]==0&&c[3]==0?g==0?1:3:g==0?2:3}else if(f==4&&d==0){var g=Math.floor(Math.random()*4);t=g}else t=p;t==0?r.setCenter(n.getCenterX(),n.getCenterY()-n.getHeight()/2-l.DEFAULT_EDGE_LENGTH-r.getHeight()/2):t==1?r.setCenter(n.getCenterX()+n.getWidth()/2+l.DEFAULT_EDGE_LENGTH+r.getWidth()/2,n.getCenterY()):t==2?r.setCenter(n.getCenterX(),n.getCenterY()+n.getHeight()/2+l.DEFAULT_EDGE_LENGTH+r.getHeight()/2):r.setCenter(n.getCenterX()-n.getWidth()/2-l.DEFAULT_EDGE_LENGTH-r.getWidth()/2,n.getCenterY())},e.exports=v}),(function(e,t,n){var r={};r.layoutBase=n(0),r.CoSEConstants=n(1),r.CoSEEdge=n(2),r.CoSEGraph=n(3),r.CoSEGraphManager=n(4),r.CoSELayout=n(6),r.CoSENode=n(5),e.exports=r})])})})),c=e(t(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r(s()):typeof define==`function`&&define.amd?define([`cose-base`],r):typeof e==`object`?e.cytoscapeCoseBilkent=r(s()):n.cytoscapeCoseBilkent=r(n.coseBase)})(e,function(e){return(function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=``,n(n.s=1)})([(function(t,n){t.exports=e}),(function(e,t,n){var r=n(0).layoutBase.LayoutConstants,i=n(0).layoutBase.FDLayoutConstants,a=n(0).CoSEConstants,o=n(0).CoSELayout,s=n(0).CoSENode,c=n(0).layoutBase.PointD,l=n(0).layoutBase.DimensionD,u={ready:function(){},stop:function(){},quality:`default`,nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:`end`,animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function d(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function f(e){this.options=d(u,e),p(this.options)}var p=function(e){e.nodeRepulsion!=null&&(a.DEFAULT_REPULSION_STRENGTH=i.DEFAULT_REPULSION_STRENGTH=e.nodeRepulsion),e.idealEdgeLength!=null&&(a.DEFAULT_EDGE_LENGTH=i.DEFAULT_EDGE_LENGTH=e.idealEdgeLength),e.edgeElasticity!=null&&(a.DEFAULT_SPRING_STRENGTH=i.DEFAULT_SPRING_STRENGTH=e.edgeElasticity),e.nestingFactor!=null&&(a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=e.nestingFactor),e.gravity!=null&&(a.DEFAULT_GRAVITY_STRENGTH=i.DEFAULT_GRAVITY_STRENGTH=e.gravity),e.numIter!=null&&(a.MAX_ITERATIONS=i.MAX_ITERATIONS=e.numIter),e.gravityRange!=null&&(a.DEFAULT_GRAVITY_RANGE_FACTOR=i.DEFAULT_GRAVITY_RANGE_FACTOR=e.gravityRange),e.gravityCompound!=null&&(a.DEFAULT_COMPOUND_GRAVITY_STRENGTH=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=e.gravityCompound),e.gravityRangeCompound!=null&&(a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=e.gravityRangeCompound),e.initialEnergyOnIncremental!=null&&(a.DEFAULT_COOLING_FACTOR_INCREMENTAL=i.DEFAULT_COOLING_FACTOR_INCREMENTAL=e.initialEnergyOnIncremental),r.QUALITY=e.quality==`draft`?0:e.quality==`proof`?2:1,a.NODE_DIMENSIONS_INCLUDE_LABELS=i.NODE_DIMENSIONS_INCLUDE_LABELS=r.NODE_DIMENSIONS_INCLUDE_LABELS=e.nodeDimensionsIncludeLabels,a.DEFAULT_INCREMENTAL=i.DEFAULT_INCREMENTAL=r.DEFAULT_INCREMENTAL=!e.randomize,a.ANIMATE=i.ANIMATE=r.ANIMATE=e.animate,a.TILE=e.tile,a.TILING_PADDING_VERTICAL=typeof e.tilingPaddingVertical==`function`?e.tilingPaddingVertical.call():e.tilingPaddingVertical,a.TILING_PADDING_HORIZONTAL=typeof e.tilingPaddingHorizontal==`function`?e.tilingPaddingHorizontal.call():e.tilingPaddingHorizontal};f.prototype.run=function(){var e,t,n=this.options;this.idToLNode={};var r=this.layout=new o,i=this;i.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:`layoutstart`,layout:this});var a=r.newGraphManager();this.gm=a;var s=this.options.eles.nodes(),c=this.options.eles.edges();this.root=a.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(s),r);for(var l=0;l<c.length;l++){var u=c[l],d=this.idToLNode[u.data(`source`)],f=this.idToLNode[u.data(`target`)];if(d!==f&&d.getEdgesBetween(f).length==0){var p=a.add(r.newEdge(),d,f);p.id=u.id()}}var m=function(e,t){typeof e==`number`&&(e=t);var n=e.data(`id`),r=i.idToLNode[n];return{x:r.getRect().getCenterX(),y:r.getRect().getCenterY()}},h=function a(){for(var o=function(){n.fit&&n.cy.fit(n.eles,n.padding),e||(e=!0,i.cy.one(`layoutready`,n.ready),i.cy.trigger({type:`layoutready`,layout:i}))},s=i.options.refresh,c,l=0;l<s&&!c;l++)c=i.stopped||i.layout.tick();if(c){r.checkLayoutSuccess()&&!r.isSubLayout&&r.doPostLayout(),r.tilingPostLayout&&r.tilingPostLayout(),r.isLayoutFinished=!0,i.options.eles.nodes().positions(m),o(),i.cy.one(`layoutstop`,i.options.stop),i.cy.trigger({type:`layoutstop`,layout:i}),t&&cancelAnimationFrame(t),e=!1;return}var u=i.layout.getPositionsData();n.eles.nodes().positions(function(e,t){if(typeof e==`number`&&(e=t),!e.isParent()){for(var n=e.id(),r=u[n],i=e;r==null&&(r=u[i.data(`parent`)]||u[`DummyCompound_`+i.data(`parent`)],u[n]=r,i=i.parent()[0],i!=null););return r==null?{x:e.position(`x`),y:e.position(`y`)}:{x:r.x,y:r.y}}}),o(),t=requestAnimationFrame(a)};return r.addListener(`layoutstarted`,function(){i.options.animate===`during`&&(t=requestAnimationFrame(h))}),r.runLayout(),this.options.animate!==`during`&&(i.options.eles.nodes().not(`:parent`).layoutPositions(i,i.options,m),e=!1),this},f.prototype.getTopMostNodes=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].id()]=!0;return e.filter(function(e,n){typeof e==`number`&&(e=n);for(var r=e.parent()[0];r!=null;){if(t[r.id()])return!1;r=r.parent()[0]}return!0})},f.prototype.processChildrenList=function(e,t,n){for(var r=t.length,i=0;i<r;i++){var a=t[i],o=a.children(),u,d=a.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(u=a.outerWidth()!=null&&a.outerHeight()!=null?e.add(new s(n.graphManager,new c(a.position(`x`)-d.w/2,a.position(`y`)-d.h/2),new l(parseFloat(d.w),parseFloat(d.h)))):e.add(new s(this.graphManager)),u.id=a.data(`id`),u.paddingLeft=parseInt(a.css(`padding`)),u.paddingTop=parseInt(a.css(`padding`)),u.paddingRight=parseInt(a.css(`padding`)),u.paddingBottom=parseInt(a.css(`padding`)),this.options.nodeDimensionsIncludeLabels&&a.isParent()){var f=a.boundingBox({includeLabels:!0,includeNodes:!1}).w,p=a.boundingBox({includeLabels:!0,includeNodes:!1}).h,m=a.css(`text-halign`);u.labelWidth=f,u.labelHeight=p,u.labelPos=m}if(this.idToLNode[a.data(`id`)]=u,isNaN(u.rect.x)&&(u.rect.x=0),isNaN(u.rect.y)&&(u.rect.y=0),o!=null&&o.length>0){var h=n.getGraphManager().add(n.newGraph(),u);this.processChildrenList(h,o,n)}}},f.prototype.stop=function(){return this.stopped=!0,this};var m=function(e){e(`layout`,`cose-bilkent`,f)};typeof cytoscape<`u`&&m(cytoscape),e.exports=m})])})}))(),1);a.use(c.default);function l(e,t){e.forEach(e=>{let n={id:e.id,labelText:e.label,height:e.height,width:e.width,padding:e.padding??0};Object.keys(e).forEach(t=>{[`id`,`label`,`height`,`width`,`padding`,`x`,`y`].includes(t)||(n[t]=e[t])}),t.add({group:`nodes`,data:n,position:{x:e.x??0,y:e.y??0}})})}r(l,`addNodes`);function u(e,t){e.forEach(e=>{let n={id:e.id,source:e.start,target:e.end};Object.keys(e).forEach(t=>{[`id`,`start`,`end`].includes(t)||(n[t]=e[t])}),t.add({group:`edges`,data:n})})}r(u,`addEdges`);function d(e){return new Promise(t=>{let r=n(`body`).append(`div`).attr(`id`,`cy`).attr(`style`,`display:none`),o=a({container:document.getElementById(`cy`),style:[{selector:`edge`,style:{"curve-style":`bezier`}}]});r.remove(),l(e.nodes,o),u(e.edges,o),o.nodes().forEach(function(e){e.layoutDimensions=()=>{let t=e.data();return{w:t.width,h:t.height}}}),o.layout({name:`cose-bilkent`,quality:`proof`,styleEnabled:!1,animate:!1}).run(),o.ready(e=>{i.info(`Cytoscape ready`,e),t(o)})})}r(d,`createCytoscapeInstance`);function f(e){return e.nodes().map(e=>{let t=e.data(),n=e.position(),r={id:t.id,x:n.x,y:n.y};return Object.keys(t).forEach(e=>{e!==`id`&&(r[e]=t[e])}),r})}r(f,`extractPositionedNodes`);function p(e){return e.edges().map(e=>{let t=e.data(),n=e._private.rscratch,r={id:t.id,source:t.source,target:t.target,startX:n.startX,startY:n.startY,midX:n.midX,midY:n.midY,endX:n.endX,endY:n.endY};return Object.keys(t).forEach(e=>{[`id`,`source`,`target`].includes(e)||(r[e]=t[e])}),r})}r(p,`extractPositionedEdges`);async function m(e,t){i.debug(`Starting cose-bilkent layout algorithm`);try{h(e);let t=await d(e),n=f(t),r=p(t);return i.debug(`Layout completed: ${n.length} nodes, ${r.length} edges`),{nodes:n,edges:r}}catch(e){throw i.error(`Error in cose-bilkent layout algorithm:`,e),e}}r(m,`executeCoseBilkentLayout`);function h(e){if(!e)throw Error(`Layout data is required`);if(!e.config)throw Error(`Configuration is required in layout data`);if(!e.rootNode)throw Error(`Root node is required`);if(!e.nodes||!Array.isArray(e.nodes))throw Error(`No nodes found in layout data`);if(!Array.isArray(e.edges))throw Error(`Edges array is required in layout data`);return!0}r(h,`validateLayoutData`);var g=r(async(e,t,{insertCluster:n,insertEdge:r,insertEdgeLabel:i,insertMarkers:a,insertNode:o,log:s,positionEdgeLabel:c},{algorithm:l})=>{let u={},d={},f=t.select(`g`);a(f,e.markers,e.type,e.diagramId);let p=f.insert(`g`).attr(`class`,`subgraphs`),h=f.insert(`g`).attr(`class`,`edgePaths`),g=f.insert(`g`).attr(`class`,`edgeLabels`),_=f.insert(`g`).attr(`class`,`nodes`);s.debug(`Inserting nodes into DOM for dimension calculation`),await Promise.all(e.nodes.map(async t=>{if(t.isGroup){let e={...t};d[t.id]=e,u[t.id]=e,await n(p,t)}else{let n={...t};u[t.id]=n;let r=await o(_,t,{config:e.config,dir:e.direction||`TB`}),i=r.node().getBBox();n.width=i.width,n.height=i.height,n.domId=r,s.debug(`Node ${t.id} dimensions: ${i.width}x${i.height}`)}})),s.debug(`Running cose-bilkent layout algorithm`);let v=await m({...e,nodes:e.nodes.map(e=>{let t=u[e.id];return{...e,width:t.width,height:t.height}})},e.config);s.debug(`Positioning nodes based on layout results`),v.nodes.forEach(e=>{let t=u[e.id];t?.domId&&(t.domId.attr(`transform`,`translate(${e.x}, ${e.y})`),t.x=e.x,t.y=e.y,s.debug(`Positioned node ${t.id} at center (${e.x}, ${e.y})`))}),v.edges.forEach(t=>{let n=e.edges.find(e=>e.id===t.id);n&&(n.points=[{x:t.startX,y:t.startY},{x:t.midX,y:t.midY},{x:t.endX,y:t.endY}])}),s.debug(`Inserting and positioning edges`),await Promise.all(e.edges.map(async t=>{await i(g,t);let n=u[t.start??``],a=u[t.end??``];if(n&&a){let i=v.edges.find(e=>e.id===t.id);if(i){s.debug(`APA01 positionedEdge`,i);let o={...t};c(o,r(h,o,d,e.type,n,a,e.diagramId))}else{let i={...t,points:[{x:n.x||0,y:n.y||0},{x:a.x||0,y:a.y||0}]};c(i,r(h,i,d,e.type,n,a,e.diagramId))}}})),s.debug(`Cose-bilkent rendering completed`)},`render`);export{g as render};
@@ -1,5 +0,0 @@
1
- import{i as e,t}from"./rolldown-runtime-C0FnF6B9.js";import{Ct as n,Mt as r,Ot as i,at as a,jn as o,nt as s,rt as c,tt as l}from"./vendor-objectstack-BeKUVjuj.js";var u=class extends Error{code=`INVALID_FILTER`;httpStatus=400;constructor(e){super(e),this.name=`FilterOperatorError`}};function d(e){return{$eq:`=`,$ne:`!=`,$gt:`>`,$gte:`>=`,$lt:`<`,$lte:`<=`,$in:`in`,$nin:`nin`,$notin:`nin`,$between:`between`,$contains:`contains`,$notContains:`notcontains`,$notcontains:`notcontains`,$startsWith:`startswith`,$startswith:`startswith`,$endsWith:`endswith`,$endswith:`endswith`}[e]||null}function f(e){let t=[];for(let[n,r]of Object.entries(e))if(r!=null){if(typeof r==`object`&&!Array.isArray(r))for(let[e,i]of Object.entries(r)){if(e===`$regex`)throw new u(`[ObjectUI] The '\$regex' filter operator is not supported. It used to be converted to 'contains', which matches a literal substring rather than a pattern — a different result, not a degraded one. Field: '${n}', Value: ${JSON.stringify(i)}. Use $contains, $startsWith or $endsWith.`);if(e===`$null`){t.push([n,i?`is_null`:`is_not_null`,!0]);continue}if(e===`$exists`){t.push([n,i?`is_not_null`:`is_null`,!0]);continue}let r=d(e);if(r)t.push([n,r,i]);else throw new u(`[ObjectUI] Unknown filter operator '${e}' for field '${n}'. Supported operators: $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $between, $contains, $notContains, $startsWith, $endsWith, $null, $exists. If you need exact object matching, use the value directly without an operator.`)}else t.push([n,`=`,r])}return t.length===0?e:t.length===1?t[0]:[`and`,...t]}function p(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e.field;return typeof t==`string`&&t!==``}function m(e){let t=o(e.operator);return e.value===void 0?[e.field,t]:[e.field,t,e.value]}function h(e){if(e==null)return;if(Array.isArray(e))return e.length===0?void 0:e.some(p)?e.map(e=>p(e)?m(e):e):e;if(typeof e!=`object`)return;let t=e;if(Object.keys(t).length!==0)return f(t)}function g(...e){let t=e.map(h).filter(e=>e!==void 0);if(t.length!==0)return t.length===1?t[0]:[`and`,...t]}var _=Symbol.for(`objectui.objectSortability`);function v(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e.sortable;if(typeof t!=`boolean`)return;let n=e.reason,r=e.caveat;return{sortable:t,...typeof n==`string`?{reason:n}:{},...typeof r==`string`?{caveat:r}:{}}}function y(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e.fields;if(!t||typeof t!=`object`||Array.isArray(t))return;let n={};for(let[e,r]of Object.entries(t)){let t=v(r);t&&(n[e]=t)}return{fields:n}}function b(e,t){let n=y(t);return!n||!e||typeof e!=`object`||Object.defineProperty(e,_,{value:n,enumerable:!1,configurable:!0,writable:!0}),e}function x(e){if(!e||typeof e!=`object`)return;let t=e[_];if(!t||typeof t!=`object`)return;let n=t.fields;if(!(!n||typeof n!=`object`||Array.isArray(n)))return t}function S(e,t){if(typeof t!=`string`||t.length===0)return!1;let n=e.fields?.[t];return v(n)?.sortable===!0}function C(e,t){return Array.isArray(e)?e.filter(e=>S(t,e?.field)):[]}function w(e,t){let n=e?.code;return typeof n!=`string`||n.length===0?!1:n.toUpperCase()===t.toUpperCase()}function T(e,t){return t.some(t=>w(e,t))}function E(e){if(e!=null)return e.id??e._id??e.recordId}function D(e,t){let n={};for(let[r,i]of Object.entries(e))if(i&&typeof i==`object`&&!Array.isArray(i)&&typeof i.$ref==`number`){let e=i.$ref,a=E(t[e]);if(a===void 0)throw Error(`batchTransaction: field "${r}" references operation ${e}, which has not produced an id (forward or invalid $ref)`);n[r]=a}else n[r]=i;return n}async function O(e,t){let n=[],r=[];try{for(let i of t){let t=i.action??`create`;if(t===`create`){let t=await e.create(i.object,D(i.data??{},n));n.push(t);let a=E(t);a&&r.push({object:i.object,id:a})}else if(t===`update`){if(i.id==null)throw Error(`batchTransaction: update on "${i.object}" requires an id`);n.push(await e.update(i.object,i.id,D(i.data??{},n)))}else{if(i.id==null)throw Error(`batchTransaction: delete on "${i.object}" requires an id`);n.push(await e.delete(i.object,i.id))}}return{results:n}}catch(t){throw r.length>0&&await Promise.allSettled([...r].reverse().map(t=>e.delete(t.object,t.id))),t}}function k(e,t){return typeof e.batchTransaction==`function`?e.batchTransaction(t):O(e,t)}var A=new Set,j=()=>!1,M=[`reference_to`,`referenceTo`];function N(e,t,n){if(!j()||e.reference!==void 0)return;let r=M.filter(t=>e[t]!==void 0&&e[t]!==``);if(r.length===0)return;let i=t??(typeof e.name==`string`?e.name:`(unnamed field)`),a=n??`(unknown object)`;for(let t of r){let n=`${a}:${i}:${t}:${String(e[t])}`;A.has(n)||(A.add(n),console.warn(`[ObjectUI] Object \`${a}\`, field \`${i}\` declares its relationship target as \`${t}: '${String(e[t])}'\` and does NOT carry \`reference\`. \`reference\` is the only spelling the protocol declares: \`@objectstack/spec\`'s \`FieldSchema\` refuses \`${t}\` by name with \`unrecognized_keys\` ("Did you mean \`${t}\` -> \`reference\`?"). ObjectUI stamps \`reference\` here so this def still renders, but the readers no longer carry a \`${t}\` fallback of their own — fix the PRODUCER to emit \`reference\`, or serve the def through a backend that normalizes it (objectstack#13847 does this on the serve path and in \`os migrate meta\`). Maintainer ruling 2026-08-31: protocol normalization belongs on the server, the front end just executes the protocol. (objectui#6837)`))}}function P(e,t,n){if(!e||typeof e!=`object`)return e;let r=e,i=r.reference_to??r.reference??r.referenceTo;return i==null||i===``?e:(N(r,t,n),r.reference_to===void 0&&(r.reference_to=i),r.reference===void 0&&(r.reference=i),e)}function ee(e){let t=e&&typeof e==`object`?e.fields:null;if(!t||typeof t!=`object`)return e;let n=typeof e.name==`string`?e.name:void 0;if(Array.isArray(t))for(let e of t)P(e,void 0,n);else for(let[e,r]of Object.entries(t))P(r,e,n);return e}var te=t(((t,n)=>{var r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},c=(e,t,n,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(r({},`__esModule`,{value:!0}),e),u={};s(u,{ObjectLogger:()=>S,createLogger:()=>C}),n.exports=l(u);var d={debug:0,info:1,warn:2,error:3,fatal:4,silent:5},f={debug:`\x1B[36m`,info:`\x1B[32m`,warn:`\x1B[33m`,error:`\x1B[31m`,fatal:`\x1B[35m`,silent:``},p=`\x1B[0m`;function m(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1 $2`).replace(/([a-zA-Z])([0-9])/g,`$1 $2`).split(/[^A-Za-z0-9]+/).filter(Boolean).map(e=>e.toLowerCase())}function h(e){return/(?:ss|us|is)$/.test(e)?e:/(?:ch|sh|s|x|z)es$/.test(e)?e.slice(0,-2):/[a-z0-9]s$/.test(e)?e.slice(0,-1):e}var g=new Set(`access.account.admin.api.app.auth.bearer.client.csrf.db.database.encryption.id.jwt.master.oauth.private.public.refresh.root.secret.service.session.shared.sign.signing.ssh.token.user.webhook.xsrf`.split(`.`));function _(e,t){for(let n of[e,h(e)])if(!(n.length<=t.length||!n.endsWith(t))&&g.has(n.slice(0,n.length-t.length)))return!0;return!1}function v(e,t){for(let n=0;n+t.length<=e.length;n++)if(t.every((t,r)=>e[n+r]===t))return!0;return!1}function y(e,t){if(t.length===0||e.length===0)return!1;if(t.length>1){let n=t.join(``);return v(e,t)||e.some(e=>e===n||h(e)===n)}let n=t[0],r=e.filter(e=>/[a-z]/.test(e)).length>1;return e.some(e=>e===n||r&&h(e)===n||_(e,n))}function b(e){if(typeof process<`u`){let e={}.NO_COLOR;if(e!==void 0&&e!==``)return!1}return!!e?.isTTY}function x(t){if(typeof process>`u`)return;let n=process.getBuiltinModule;if(typeof n==`function`)try{return n.call(process,`node:${t}`)}catch{return}try{return e(t)}catch{return}}var S=class e{constructor(e={},t={}){this.ownsFileStream=!1,this.fileLoggingDisabled=!1,this.config={name:e.name,level:e.level??`info`,format:e.format??`pretty`,redact:e.redact??[`password`,`token`,`secret`,`key`],sourceLocation:e.sourceLocation??!1,file:e.file,rotation:{maxSize:e.rotation?.maxSize??`10m`,maxFiles:e.rotation?.maxFiles??5}},this.bindings=t,this.redactPatterns=this.config.redact.map(m).filter(e=>e.length>0),this.config.file&&typeof process<`u`&&this.openFileStream(this.config.file)}openFileStream(e){let t=x(`fs`),n=x(`path`);if(!t||!n){this.disableFileLogging(e,`no filesystem access in this runtime`);return}try{t.mkdirSync(n.dirname(e),{recursive:!0});let r=t.createWriteStream(e,{flags:`a`});r.on(`error`,t=>this.disableFileLogging(e,t.message)),this.fileStream=r,this.ownsFileStream=!0}catch(t){this.disableFileLogging(e,t.message)}}disableFileLogging(e,t){if(this.fileStream=void 0,this.ownsFileStream=!1,this.fileLoggingDisabled)return;this.fileLoggingDisabled=!0;let n=`${this.config.name?`[${this.config.name}] `:``}logger: file logging disabled \u2014 cannot write to ${e}: ${t}`;typeof process<`u`&&process.stderr?process.stderr.write(n+`
2
- `):typeof console<`u`&&console.warn(n)}isEnabled(e){return d[e]>=d[this.config.level]}isRedactedFieldName(e){let t=m(e);return this.redactPatterns.some(e=>y(t,e))}redactSensitive(e){if(!e||typeof e!=`object`)return e;let t=Array.isArray(e)?[...e]:{...e};for(let e in t)this.isRedactedFieldName(e)?t[e]=`***REDACTED***`:typeof t[e]==`object`&&t[e]!==null&&(t[e]=this.redactSensitive(t[e]));return t}write(e,t,n,r){if(!this.isEnabled(e))return;let i=this.redactSensitive({...this.bindings,...n,...r?{error:{message:r.message,stack:r.stack}}:{}}),a=Object.keys(i).length>0,o=new Date().toISOString(),s=e===`error`||e===`fatal`,c=typeof process<`u`?process:void 0,l=c?s?c.stderr:c.stdout:void 0,u,d;if(this.config.format===`json`)u=d=JSON.stringify({time:o,level:e,...this.config.name?{name:this.config.name}:{},msg:t,...i});else if(this.config.format===`text`){let n=[o,e.toUpperCase(),t];a&&n.push(JSON.stringify(i)),u=d=n.join(` | `)}else{let n=this.config.name?`[${this.config.name}] `:``,r=`${o} ${e.toUpperCase()}`,s=` ${n}${t}`;a&&(s+=` ${JSON.stringify(i)}`),d=r+s;let c=f[e]||``;u=c&&b(l)?`${c}${r}${p}${s}`:d}l?l.write(u+`
3
- `):typeof console<`u`&&(e===`error`||e===`fatal`?console.error:e===`warn`?console.warn:e===`debug`?console.debug:console.log)(u),this.fileStream&&this.fileStream.write(d+`
4
- `)}debug(e,t){this.write(`debug`,e,t)}info(e,t){this.write(`info`,e,t)}warn(e,t){this.write(`warn`,e,t)}error(e,t,n){this.writeErrorLike(`error`,e,t,n)}fatal(e,t,n){this.writeErrorLike(`fatal`,e,t,n)}writeErrorLike(e,t,n,r){if(n instanceof Error){this.write(e,t,r,n);return}let i=n&&r?{...n,...r}:n??r;this.write(e,t,i)}log(e,...t){this.info(e,t.length>0?{args:t}:void 0)}child(t){let n=new e({...this.config,file:void 0},{...this.bindings,...t});return n.config.file=this.config.file,n.fileStream=this.fileStream,n}withTrace(e,t){return this.child({traceId:e,spanId:t})}async destroy(){let e=this.fileStream;this.fileStream=void 0,!(!e||!this.ownsFileStream)&&(this.ownsFileStream=!1,await new Promise(t=>e.end(t)))}};function C(e){return new S(e)}0&&(n.exports={ObjectLogger:S,createLogger:C})})),ne=t(((e,t)=>{var r=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,l=Object.prototype.hasOwnProperty,u=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,i)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!l.call(e,s)&&s!==n&&r(e,s,{get:()=>t[s],enumerable:!(i=a(t,s))||i.enumerable});return e},f=e=>d(r({},`__esModule`,{value:!0}),e),p={};u(p,{FilterBuilder:()=>y,ObjectStackClient:()=>N,QueryBuilder:()=>b,RealtimeAPI:()=>v,ScopedEnvironmentClient:()=>P,createFilter:()=>S,createQuery:()=>x}),t.exports=f(p);var m=(i(),f(n)),h=(c(),f(s)),g=te(),_=(c(),f(s)),v=class{constructor(e,t){this.subscriptions=new Map,this.eventBuffer=[],this._baseUrl=e,this._token=t}subscribeMetadata(e,t,n){let r=`metadata-${e}-${Date.now()}`,i=[`metadata.${e}.created`,`metadata.${e}.updated`,`metadata.${e}.deleted`];return this.subscriptions.set(r,{filter:{type:e,packageId:n?.packageId,eventTypes:i},handler:n=>{if(!n.type.startsWith(`metadata.`))return;let r=_.MetadataEventSchema.safeParse(n.payload);if(!r.success)throw Error(`subscribeMetadata('${e}'): event '${n.type}' payload does not satisfy MetadataEventSchema \u2014 rejecting off-contract event (fix the producer): ${r.error.message}`);t(r.data)}}),this.startPolling(),()=>{this.subscriptions.delete(r),this.subscriptions.size===0&&this.stopPolling()}}subscribeData(e,t,n){let r=`data-${e}-${Date.now()}`;return this.subscriptions.set(r,{filter:{type:e,recordId:n?.recordId,eventTypes:[`data.record.created`,`data.record.updated`,`data.record.deleted`]},handler:r=>{if(!r.type.startsWith(`data.`)||r.object!==e||r.type.startsWith(`data.records.`))return;let i=_.DataEventSchema.safeParse(r.payload);if(!i.success)throw Error(`subscribeData('${e}'): event '${r.type}' payload does not satisfy DataEventSchema \u2014 rejecting off-contract event (fix the producer): ${i.error.message}`);n?.recordId&&i.data.recordId!==n.recordId||t(i.data)}}),this.startPolling(),()=>{this.subscriptions.delete(r),this.subscriptions.size===0&&this.stopPolling()}}subscribeBulkData(e,t){let n=`bulk-data-${e}-${Date.now()}`;return this.subscriptions.set(n,{filter:{type:e,eventTypes:[`data.records.updated`,`data.records.deleted`]},handler:n=>{if(!n.type.startsWith(`data.records.`)||n.object!==e)return;let r=_.BulkDataEventSchema.safeParse(n.payload);if(!r.success)throw Error(`subscribeBulkData('${e}'): event '${n.type}' payload does not satisfy BulkDataEventSchema \u2014 rejecting off-contract event (fix the producer): ${r.error.message}`);t(r.data)}}),this.startPolling(),()=>{this.subscriptions.delete(n),this.subscriptions.size===0&&this.stopPolling()}}emitEvent(e){for(let t of this.subscriptions.values()){let n=!t.filter.type||e.type.includes(t.filter.type)||e.object===t.filter.type,r=!t.filter.eventTypes?.length||t.filter.eventTypes.includes(e.type),i=!t.filter.packageId||e.payload?.packageId===t.filter.packageId;if(n&&r&&i)try{t.handler(e)}catch(e){console.error(`Error in realtime event handler:`,e)}}}startPolling(){this.pollInterval||=setInterval(()=>{for(;this.eventBuffer.length>0;){let e=this.eventBuffer.shift();e&&this.emitEvent(e)}},2e3)}stopPolling(){this.pollInterval&&=(clearInterval(this.pollInterval),void 0)}_bufferEvent(e){this.eventBuffer.push(e)}disconnect(){this.stopPolling(),this.subscriptions.clear(),this.eventBuffer=[]}},y=class{constructor(){this.conditions=[]}equals(e,t){return this.conditions.push([e,`=`,t]),this}notEquals(e,t){return this.conditions.push([e,`!=`,t]),this}greaterThan(e,t){return this.conditions.push([e,`>`,t]),this}greaterThanOrEqual(e,t){return this.conditions.push([e,`>=`,t]),this}lessThan(e,t){return this.conditions.push([e,`<`,t]),this}lessThanOrEqual(e,t){return this.conditions.push([e,`<=`,t]),this}in(e,t){return this.conditions.push([e,`in`,t]),this}notIn(e,t){return this.conditions.push([e,`not_in`,t]),this}like(e,t){return this.conditions.push([e,`like`,t]),this}isNull(e){return this.conditions.push([e,`is_null`,null]),this}isNotNull(e){return this.conditions.push([e,`is_not_null`,null]),this}between(e,t,n){return this.conditions.push([`and`,[e,`>=`,t],[e,`<=`,n]]),this}contains(e,t){return this.conditions.push([e,`contains`,t]),this}ilike(e,t){return this.conditions.push([e,`ilike`,t]),this}startsWith(e,t){return this.conditions.push([e,`starts_with`,t]),this}endsWith(e,t){return this.conditions.push([e,`ends_with`,t]),this}exists(e){return this.conditions.push([e,`is_not_null`,null]),this}build(){if(this.conditions.length===0)throw Error(`Filter builder has no conditions`);return this.conditions.length===1?this.conditions[0]:[`and`,...this.conditions]}getConditions(){return this.conditions}},b=class{constructor(e){this.query={},this._object=e,this.query.object=e}select(...e){return this.query.fields=e,this}where(e){let t=new y;e(t);let n=t.getConditions();return n.length===1?this.query.where=n[0]:n.length>1&&(this.query.where=[`and`,...n]),this}filter(e){return this.query.where=e,this}orderBy(e,t=`asc`){return this.query.orderBy||(this.query.orderBy=[]),this.query.orderBy.push({field:e,order:t}),this}limit(e){return this.query.limit=e,this}skip(e){return this.query.offset=e,this}offset(e){return this.query.offset=e,this}paginate(e,t){return this.query.limit=t,this.query.offset=(e-1)*t,this}groupBy(...e){return this.query.groupBy=e,this}expand(e,t){return this.query.expand||(this.query.expand={}),this.query.expand[e]=t||{},this}search(e,t){return this.query.search={query:e,...t},this}build(){return{object:this._object,...this.query}}getQuery(){return{...this.query}}};function x(e){return new b(e)}function S(){return new y}var C={where:!0,fields:!0,orderBy:!0,limit:!0,offset:!0,expand:!0};function w(e){return Object.keys(C).some(t=>t in e)}function T(e){if(e==null)return;let t;if(Array.isArray(e))t=e.map(e=>String(e).trim()).filter(Boolean);else if(typeof e==`object`){for(let[t,n]of Object.entries(e)){let e=typeof n==`object`&&n&&!Array.isArray(n)?Object.keys(n):[];if(e.length>0)throw Error(`data.find(): expand['${t}'] carries a nested query (${e.slice().sort().join(`, `)}), but the list route accepts only \`expand=<comma-separated relation names>\` \u2014 a nested per-relation query has no transport spelling on a GET, so it would be dropped rather than applied. Pass relation names only, or use data.query() with a QueryAST \`expand\` for nested detail.`)}t=Object.keys(e).map(e=>e.trim()).filter(Boolean)}else return;return t.length>0?t.join(`,`):void 0}async function*E(e){let t=e.body;if(!t)throw Error("Streaming response carried no body — this runtime's fetch does not expose `Response.body`");let n=new TextDecoder,r=``,i=function*(e){r+=e;let t;for(;(t=r.indexOf(`
5
- `))!==-1;){let e=r.slice(0,t).trim();if(r=r.slice(t+1),!e.startsWith(`data:`))continue;let n=e.slice(5).trim();if(!(!n||n===`[DONE]`))try{yield JSON.parse(n)}catch{}}};if(typeof t.getReader==`function`){let e=t.getReader();try{for(;;){let{done:t,value:r}=await e.read();if(t)break;yield*i(n.decode(r,{stream:!0}))}}finally{e.releaseLock?.()}}else for await(let e of t)yield*i(n.decode(e,{stream:!0}));yield*i(n.decode())}function D(e){return typeof e==`string`&&e?e:typeof e?.message==`string`&&e.message?e.message:`Action failed`}function O(e){let t=new Set([`success`,`data`,`error`,`code`,`fields`]);return e&&typeof e==`object`&&!Array.isArray(e)&&typeof e.success==`boolean`&&Object.keys(e).every(e=>t.has(e))?e.success===!1?{success:!1,error:D(e.error)}:{success:!0,data:e.data}:{success:!0,data:e}}function k(e){if(!e)return``;let t=new URLSearchParams;e.force&&t.set(`force`,`true`),e.packageId&&t.set(`package`,e.packageId),e.mode===`draft`&&t.set(`mode`,`draft`);let n=t.toString();return n?`?${n}`:``}function A(e){if(e?.ifMatch)return{"If-Match":String(e.ifMatch)}}function j(e){if(!e)return``;let t=new URLSearchParams;e.state===`draft`&&t.set(`state`,`draft`);let n=t.toString();return n?`?${n}`:``}function M(e){if(e?.ifMatch)return{"If-Match":String(e.ifMatch)}}var N=class{constructor(e){this.meta={getTypes:async()=>{let e=this.getRoute(`metadata`),t=await this.fetch(`${this.baseUrl}${e}`);return this.unwrapResponse(t)},getItems:async(e,t)=>{let n=this.getRoute(`metadata`),r=new URLSearchParams;t?.packageId&&r.set(`package`,t.packageId);let i=r.toString(),a=`${this.baseUrl}${n}/${e}${i?`?${i}`:``}`,o=await this.fetch(a);return this.unwrapResponse(o)},getItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=new URLSearchParams;n?.packageId&&i.set(`package`,n.packageId);let a=i.toString(),o=`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}${a?`?${a}`:``}`,s=await this.fetch(o);return this.unwrapResponse(s)},saveItem:async(e,t,n,r)=>{let i=this.getRoute(`metadata`),a=k(r),o=A(r),s=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}${a}`,{method:`PUT`,body:JSON.stringify(n),...o?{headers:o}:{}});return this.unwrapResponse(s)},deleteItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=j(n),a=M(n),o=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}${i}`,{method:`DELETE`,...a?{headers:a}:{}});return this.unwrapResponse(o)},getHistory:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=new URLSearchParams;n?.sinceSeq!==void 0&&i.set(`sinceSeq`,String(n.sinceSeq)),n?.limit!==void 0&&i.set(`limit`,String(n.limit));let a=i.toString(),o=`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/history${a?`?${a}`:``}`,s=await this.fetch(o);return this.unwrapResponse(s)},getCached:async(e,t)=>{let n=this.getRoute(`metadata`),r={};t?.ifNoneMatch&&(r[`If-None-Match`]=t.ifNoneMatch),t?.ifModifiedSince&&(r[`If-Modified-Since`]=t.ifModifiedSince);let i=await this.fetch(`${this.baseUrl}${n}/object/${e}`,{headers:r});if(i.status===304)return{notModified:!0,etag:t?.ifNoneMatch?{value:t.ifNoneMatch.replace(/^W\/|"/g,``),weak:t.ifNoneMatch.startsWith(`W/`)}:void 0};let a=await i.json(),o=i.headers.get(`ETag`),s=i.headers.get(`Last-Modified`);return{data:a,etag:o?{value:o.replace(/^W\/|"/g,``),weak:o.startsWith(`W/`)}:void 0,lastModified:s||void 0,notModified:!1}},getView:async(e,t=`list`)=>{let n=this.getRoute(`ui`),r=await this.fetch(`${this.baseUrl}${n}/view/${encodeURIComponent(e)}/${t}`);return this.unwrapResponse(r)},getPublished:async(e,t)=>{let n=this.getRoute(`metadata`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/published`);return this.unwrapResponse(r)},listDrafts:async e=>{let t=this.getRoute(`metadata`),n=new URLSearchParams;e?.packageId&&n.set(`packageId`,e.packageId),e?.type&&n.set(`type`,e.type);let r=n.toString(),i=await this.fetch(`${this.baseUrl}${t}/_drafts${r?`?${r}`:``}`);return this.unwrapResponse(i)},migrateStored:async e=>{let t=this.getRoute(`metadata`),n=await this.fetch(`${this.baseUrl}${t}/_migrate-stored`,{method:`POST`,body:JSON.stringify({...e?.apply===!0?{apply:!0}:{},...e?.types&&e.types.length>0?{types:e.types}:{}})});return this.unwrapResponse(n)},getLegalNextStates:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=n===void 0?``:`?from=${encodeURIComponent(n)}`,a=await this.fetch(`${this.baseUrl}${r}/object/${encodeURIComponent(e)}/state/${encodeURIComponent(t)}${i}`);return this.unwrapResponse(a)},getDiagnostics:async e=>{let t=this.getRoute(`metadata`),n=new URLSearchParams;e?.type&&n.set(`type`,e.type),e?.severity&&n.set(`severity`,e.severity),e?.packageId&&n.set(`package`,e.packageId);let r=n.toString(),i=await this.fetch(`${this.baseUrl}${t}/diagnostics${r?`?${r}`:``}`);return this.unwrapResponse(i)},getReferences:async(e,t)=>{let n=this.getRoute(`metadata`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/references`);return this.unwrapResponse(r)},getBookTree:async(e,t)=>{let n=this.getRoute(`metadata`),r=t?.packageId?`?package=${encodeURIComponent(t.packageId)}`:``,i=await this.fetch(`${this.baseUrl}${n}/book/${encodeURIComponent(e)}/tree${r}`);return this.unwrapResponse(i)},getAudit:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=n?.limit===void 0?``:`?limit=${n.limit}`,a=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/audit${i}`);return this.unwrapResponse(a)},publishItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/publish`,{method:`POST`,body:JSON.stringify(n?.message?{message:n.message}:{})});return this.unwrapResponse(i)},rollbackItem:async(e,t,n,r)=>{let i=this.getRoute(`metadata`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/rollback`,{method:`POST`,body:JSON.stringify({toVersion:n,...r?.message?{message:r.message}:{}})});return this.unwrapResponse(a)},diffItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=new URLSearchParams;n?.from!==void 0&&i.set(`from`,String(n.from)),n?.to!==void 0&&i.set(`to`,String(n.to));let a=i.toString(),o=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/diff${a?`?${a}`:``}`);return this.unwrapResponse(o)}},this.analytics={query:async e=>{let t=this.getRoute(`analytics`),n=await this.fetch(`${this.baseUrl}${t}/query`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},meta:async e=>{let t=this.getRoute(`analytics`),n=e?`?cube=${encodeURIComponent(e)}`:``,r=await this.fetch(`${this.baseUrl}${t}/meta${n}`);return this.unwrapResponse(r)},explain:async e=>{let t=this.getRoute(`analytics`),n=await this.fetch(`${this.baseUrl}${t}/sql`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},queryDataset:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/dataset/query`,{method:`POST`,body:JSON.stringify(e)})).json()}},this.email={send:async e=>{let t=this.getRoute(`email`),n=await this.fetch(`${this.baseUrl}${t}/send`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)}},this.datasources={external:{listTables:async(e,t)=>{let n=t?.schema?`?schema=${encodeURIComponent(t.schema)}`:``,r=this.getRoute(`datasources`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/external/tables${n}`);return this.unwrapResponse(i)},draft:async(e,t,n)=>{let r=this.getRoute(`datasources`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/external/tables/${encodeURIComponent(t)}/draft`,{method:`POST`,body:JSON.stringify(n??{})});return this.unwrapResponse(i)},import:async(e,t,n)=>{let r=this.getRoute(`datasources`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/external/tables/${encodeURIComponent(t)}/import`,{method:`POST`,body:JSON.stringify(n??{})});return this.unwrapResponse(i)},refreshCatalog:async e=>{let t=this.getRoute(`datasources`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/external/refresh-catalog`,{method:`POST`,body:JSON.stringify({})});return this.unwrapResponse(n)},validate:async e=>{let t=this.getRoute(`datasources`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/external/validate`,{method:`POST`,body:JSON.stringify({})});return this.unwrapResponse(n)}}},this.packages={list:async e=>{let t=this.getRoute(`packages`),n=new URLSearchParams;e?.status&&n.set(`status`,e.status),e?.type&&n.set(`type`,e.type),e?.enabled!==void 0&&n.set(`enabled`,String(e.enabled));let r=n.toString(),i=`${this.baseUrl}${t}${r?`?`+r:``}`,a=await this.fetch(i);return this.unwrapResponse(a)},get:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},install:async(e,t)=>{let n=this.getRoute(`packages`),r=await this.fetch(`${this.baseUrl}${n}`,{method:`POST`,body:JSON.stringify({manifest:e,settings:t?.settings,enableOnInstall:t?.enableOnInstall,...t?.overwrite===void 0?{}:{overwrite:t.overwrite}})});return this.unwrapResponse(r)},uninstall:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`,{method:`DELETE`});return this.unwrapResponse(n)},enable:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/enable`,{method:`PATCH`});return this.unwrapResponse(n)},disable:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/disable`,{method:`PATCH`});return this.unwrapResponse(n)},update:async(e,t)=>{let n=this.getRoute(`packages`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)});return this.unwrapResponse(r)},publish:async(e,t)=>{let n=this.getRoute(`packages`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/publish`,{method:`POST`,body:JSON.stringify(t??{})});return this.unwrapResponse(r)},publishDrafts:async(e,t)=>{let n=this.getRoute(`packages`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/publish-drafts`,{method:`POST`,body:JSON.stringify(t??{})});return this.unwrapResponse(r)},discardDrafts:async(e,t)=>{let n=this.getRoute(`packages`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/discard-drafts`,{method:`POST`,body:JSON.stringify(t??{})});return this.unwrapResponse(r)},listCommits:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/commits`);return this.unwrapResponse(n)},revertCommit:async(e,t,n)=>{let r=this.getRoute(`packages`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/commits/${encodeURIComponent(t)}/revert`,{method:`POST`,body:JSON.stringify(n??{})});return this.unwrapResponse(i)},rollback:async(e,t,n)=>{let r=this.getRoute(`packages`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/rollback`,{method:`POST`,body:JSON.stringify({commitId:t,...n??{}})});return this.unwrapResponse(i)},revert:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/revert`,{method:`POST`});return this.unwrapResponse(n)},export:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/export`);return this.unwrapResponse(n)},adoptOrphans:async(e,t)=>{let n=this.getRoute(`packages`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/adopt-orphans`,{method:`POST`,body:JSON.stringify(t??{})});return this.unwrapResponse(r)},duplicate:async(e,t,n)=>{let r=this.getRoute(`packages`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/duplicate`,{method:`POST`,body:JSON.stringify({targetPackageId:t,...n??{}})});return this.unwrapResponse(i)}},this.environments={list:async e=>{let t=new URLSearchParams;e?.organization_id&&t.set(`organizationId`,e.organization_id),e?.env_type&&t.set(`envType`,e.env_type),e?.status&&t.set(`status`,e.status);let n=t.toString(),r=`${this.baseUrl}/api/v1/cloud/environments${n?`?`+n:``}`,i=await this.fetch(r);return this.unwrapResponse(i)},get:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`);return this.unwrapResponse(t)},create:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(t)},update:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)});return this.unwrapResponse(n)},delete:async(e,t)=>{let n=t?.force?`?force=1`:``,r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}${n}`,{method:`DELETE`});return this.unwrapResponse(r)},activate:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/activate`,{method:`POST`});return this.unwrapResponse(t)},rotateCredential:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/credentials/rotate`,{method:`POST`,body:JSON.stringify({plaintext:t})});return this.unwrapResponse(n)},updateHostname:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/hostname`,{method:`POST`,body:JSON.stringify({hostname:t})});return this.unwrapResponse(n)},updateVisibility:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({visibility:t})});return this.unwrapResponse(n)},listRevisions:async(e,t)=>{let n=new URLSearchParams;t?.limit&&n.set(`limit`,String(t.limit)),t?.cursor&&n.set(`cursor`,t.cursor),t?.branch&&n.set(`branch`,t.branch);let r=n.toString(),i=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/revisions${r?`?${r}`:``}`);return this.unwrapResponse(i)},listBranches:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches`);return this.unwrapResponse(t)},renameBranch:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches/${encodeURIComponent(t)}/rename`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({newName:n})});return this.unwrapResponse(r)},deleteBranch:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(n)},retryProvisioning:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/retry`,{method:`POST`});return this.unwrapResponse(t)},listDrivers:async()=>{let e=await this.fetch(`${this.baseUrl}/api/v1/cloud/drivers`);return this.unwrapResponse(e)},packages:{list:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages`);return this.unwrapResponse(t)},install:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(n)},get:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}`);return this.unwrapResponse(n)},enable:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/enable`,{method:`PATCH`});return this.unwrapResponse(n)},disable:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/disable`,{method:`PATCH`});return this.unwrapResponse(n)},uninstall:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(n)},upgrade:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/upgrade`,{method:`POST`,body:JSON.stringify({targetVersion:n})});return this.unwrapResponse(r)}}},this.organizations={list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/organization/list`)).json();return{organizations:Array.isArray(t)?t:t?.data??[]}},create:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/create`,{method:`POST`,body:JSON.stringify(e)})).json()},update:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/update`,{method:`POST`,body:JSON.stringify({organizationId:e,data:t})})).json()},setActive:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/set-active`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},get:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/get-full-organization?organizationId=${encodeURIComponent(e)}`)).json()},listMembers:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/list-members?organizationId=${encodeURIComponent(e)}`)).json()},invite:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/invite-member`,{method:`POST`,body:JSON.stringify(e)})).json()},leave:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/leave`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/delete`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},removeMember:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/remove-member`,{method:`POST`,body:JSON.stringify({memberIdOrEmail:t.memberIdOrEmail,organizationId:e})})).json()},updateMemberRole:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/update-member-role`,{method:`POST`,body:JSON.stringify({memberId:t.memberId,role:t.role,organizationId:e})})).json()},getActiveMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/get-active-member?organizationId=${encodeURIComponent(e)}`)).json()},invitations:{list:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-invitations?organizationId=${encodeURIComponent(e)}`)).json();return{invitations:Array.isArray(n)?n:n?.data??n?.invitations??[]}},listMine:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/organization/list-user-invitations`)).json();return{invitations:Array.isArray(t)?t:t?.data??t?.invitations??[]}},cancel:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/cancel-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},accept:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/accept-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},reject:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/reject-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},resend:async e=>{if(e.id)try{await this.organizations.invitations.cancel(e.id)}catch{}return this.organizations.invite({email:e.email,role:e.role??`member`,organizationId:e.organizationId})}},teams:{list:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-teams?organizationId=${encodeURIComponent(e)}`)).json();return{teams:Array.isArray(n)?n:n?.data??n?.teams??[]}},create:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/create-team`,{method:`POST`,body:JSON.stringify(e)})).json()},update:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/update-team`,{method:`POST`,body:JSON.stringify(e)})).json()},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/remove-team`,{method:`POST`,body:JSON.stringify(e)})).json()},listMembers:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-team-members?teamId=${encodeURIComponent(e)}`)).json();return{members:Array.isArray(n)?n:n?.data??n?.members??[]}},addMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/add-team-member`,{method:`POST`,body:JSON.stringify(e)})).json()},removeMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/remove-team-member`,{method:`POST`,body:JSON.stringify(e)})).json()}}},this.oauth={applications:{register:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/create-client`,{method:`POST`,body:JSON.stringify(e)})).json()},get:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/get-client?client_id=${encodeURIComponent(e)}`)).json()},getPublic:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/public-client?client_id=${encodeURIComponent(e)}`)).json()},list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/oauth2/get-clients`)).json();return{applications:Array.isArray(t)?t:t?.clients??t?.data??[]}},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/delete-client`,{method:`POST`,body:JSON.stringify({client_id:e})})).json()}},consent:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/consent`,{method:`POST`,body:JSON.stringify(e)})).json()}},this.auth={getConfig:async()=>{let e=this.getRoute(`auth`),t=await this.fetch(`${this.baseUrl}${e}/config`);return this.unwrapResponse(t)},login:async e=>{let t=this.getRoute(`auth`),n=await this.fetch(`${this.baseUrl}${t}/sign-in/email`,{method:`POST`,headers:{Origin:this.baseUrl},body:JSON.stringify(e)}),r=await n.json().catch(()=>({}));if(!n.ok){let e=r?.message||r?.error?.message||`Login failed (HTTP ${n.status})`,t=Error(e);throw r?.code&&(t.code=r.code),t.status=n.status,t}let i=r&&(r.data??(r.token||r.user?{token:r.token,user:r.user}:void 0)),a=i?{...r,data:i}:r;return a.data?.token&&(this.token=a.data.token),a},logout:async()=>{let e=this.getRoute(`auth`);await this.fetch(`${this.baseUrl}${e}/sign-out`,{method:`POST`,headers:{"Content-Type":`application/json`,Origin:this.baseUrl},body:`{}`}),this.token=void 0},me:async()=>{let e=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${e}/get-session`,{headers:{Origin:this.baseUrl}})).json()},register:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/sign-up/email`,{method:`POST`,headers:{Origin:this.baseUrl},body:JSON.stringify(e)})).json(),r=n&&(n.data??(n.token||n.user?{token:n.token,user:n.user}:void 0)),i=r?{...n,data:r}:n;return i.data?.token&&(this.token=i.data.token),i},signInWithProvider:async(e,t)=>{if(typeof window>`u`)throw Error(`signInWithProvider requires a browser environment`);let n=this.getRoute(`auth`),r=t?.callbackURL??window.location.href,i=t?.type===`oidc`,a=i?`/sign-in/oauth2`:`/sign-in/social`,o=i?{providerId:e,callbackURL:r}:{provider:e,callbackURL:r};t?.errorCallbackURL&&(o.errorCallbackURL=t.errorCallbackURL);let s=await(await this.fetch(`${this.baseUrl}${n}${a}`,{method:`POST`,body:JSON.stringify(o)})).json(),c=s?.url??s?.data?.url;if(c)window.location.assign(c);else throw Error(`signInWithProvider: no redirect URL returned for provider "${e}"`)},refreshToken:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/get-session`,{method:`GET`})).json();return n.data?.token&&(this.token=n.data.token),n},bootstrapStatus:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/bootstrap-status`)).json();return{hasOwner:!!(t?.data??t)?.hasOwner}},updateUser:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/update-user`,{method:`POST`,body:JSON.stringify(e)})).json()},changePassword:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/change-password`,{method:`POST`,body:JSON.stringify(e)})).json()},setInitialPassword:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/set-initial-password`,{method:`POST`,body:JSON.stringify(e)})).json()},changeEmail:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/change-email`,{method:`POST`,body:JSON.stringify(e)})).json()},sendVerificationEmail:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/send-verification-email`,{method:`POST`,body:JSON.stringify(e)})).json()},verifyEmail:async e=>{let t=this.getRoute(`auth`),n=new URL(`${this.baseUrl}${t}/verify-email`);return n.searchParams.set(`token`,e.token),e.callbackURL&&n.searchParams.set(`callbackURL`,e.callbackURL),(await this.fetch(n.toString())).json()},deleteUser:async e=>{let t=this.getRoute(`auth`),n=await this.fetch(`${this.baseUrl}${t}/delete-user`,{method:`POST`,body:JSON.stringify(e)});return this.token=void 0,n.json()},sessions:{list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/list-sessions`)).json();return{sessions:Array.isArray(t)?t:t?.data??t?.sessions??[]}},revoke:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/revoke-session`,{method:`POST`,body:JSON.stringify({token:e})})).json()},revokeOthers:async()=>{let e=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${e}/revoke-other-sessions`,{method:`POST`,body:`{}`})).json()},revokeAll:async()=>{let e=this.getRoute(`auth`),t=await this.fetch(`${this.baseUrl}${e}/revoke-sessions`,{method:`POST`,body:`{}`});return this.token=void 0,t.json()}},twoFactor:{enable:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/two-factor/enable`,{method:`POST`,body:JSON.stringify(e)})).json();return n?.data??n},verifyTotp:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/verify-totp`,{method:`POST`,body:JSON.stringify(e)})).json()},disable:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/disable`,{method:`POST`,body:JSON.stringify(e)})).json()},generateBackupCodes:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/two-factor/generate-backup-codes`,{method:`POST`,body:JSON.stringify(e)})).json();return n?.data??n},verifyBackupCode:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/verify-backup-code`,{method:`POST`,body:JSON.stringify(e)})).json()}},accounts:{list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/list-accounts`)).json();return{accounts:Array.isArray(t)?t:t?.data??t?.accounts??[]}},unlink:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/unlink-account`,{method:`POST`,body:JSON.stringify(e)})).json()},linkSocial:async e=>{let t=this.getRoute(`auth`),n=e.callbackURL??(typeof window<`u`?window.location.href:void 0),r=await(await this.fetch(`${this.baseUrl}${t}/link-social`,{method:`POST`,body:JSON.stringify({provider:e.provider,callbackURL:n})})).json();return r?.data??r}}},this.storage={upload:async(e,t=`user`)=>{let n={filename:e.name,mimeType:e.type,size:e.size,scope:t},r=this.getRoute(`storage`),{data:i}=await(await this.fetch(`${this.baseUrl}${r}/upload/presigned`,{method:`POST`,body:JSON.stringify(n)})).json(),a=await this.fetchImpl(i.uploadUrl,{method:i.method,headers:i.headers,body:e});if(!a.ok)throw Error(`Storage Upload Failed: ${a.statusText}`);let o={fileId:i.fileId},s=await(await this.fetch(`${this.baseUrl}${r}/upload/complete`,{method:`POST`,body:JSON.stringify(o)})).json();return s?.data&&s.data.fileId==null&&(s.data.fileId=i.fileId),s},getDownloadUrl:async e=>{let t=this.getRoute(`storage`),n=await this.fetch(`${this.baseUrl}${t}/files/${e}/url`),{url:r}=await this.unwrapResponse(n);return r},getPresignedUrl:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/presigned`,{method:`POST`,body:JSON.stringify(e)})).json()},initChunkedUpload:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/chunked`,{method:`POST`,body:JSON.stringify(e)})).json()},uploadPart:async(e,t,n,r)=>{let i=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${i}/upload/chunked/${e}/chunk/${t}`,{method:`PUT`,headers:{"x-resume-token":n},body:r})).json()},completeChunkedUpload:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/chunked/${e.uploadId}/complete`,{method:`POST`,body:JSON.stringify(e)})).json()},resumeUpload:async(e,t,n,r)=>{let i=this.getRoute(`storage`),{totalChunks:a,uploadedChunks:o,status:s,expiresAt:c}=(await(await this.fetch(`${this.baseUrl}${i}/upload/chunked/${e}/progress`)).json()).data;if(s===`expired`){let t=Error(`Upload session ${e} expired${c?` at ${c}`:``}; start a new chunked upload`);throw t.code=`UPLOAD_SESSION_EXPIRED`,t.httpStatus=410,t.details={uploadId:e,expiresAt:c},t}let l=[],u=t instanceof ArrayBuffer?t:await t.arrayBuffer();for(let t=o;t<a;t++){let i=t*n,a=Math.min(i+n,u.byteLength),o=new Blob([u.slice(i,a)]),s=await this.storage.uploadPart(e,t,r,o);l.push({chunkIndex:t,eTag:s.data.eTag})}return this.storage.completeChunkedUpload({uploadId:e,parts:l})}},this.automation={trigger:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/trigger/${e}`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},list:async()=>{let e=this.getRoute(`automation`),t=await this.fetch(`${this.baseUrl}${e}`);return this.unwrapResponse(t)},get:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${e}`);return this.unwrapResponse(n)},create:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}`,{method:`POST`,body:JSON.stringify({name:e,...t})});return this.unwrapResponse(r)},update:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}`,{method:`PUT`,body:JSON.stringify({definition:t})});return this.unwrapResponse(r)},delete:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${e}`,{method:`DELETE`});return this.unwrapResponse(n)},listActions:async e=>{let t=this.getRoute(`automation`),n=new URLSearchParams;e?.paradigm&&n.set(`paradigm`,e.paradigm),e?.source&&n.set(`source`,e.source),e?.category&&n.set(`category`,e.category);let r=n.toString(),i=await this.fetch(`${this.baseUrl}${t}/actions${r?`?${r}`:``}`);return this.unwrapResponse(i)},listConnectors:async e=>{let t=this.getRoute(`automation`),n=e?.type?`?type=${encodeURIComponent(e.type)}`:``,r=await this.fetch(`${this.baseUrl}${t}/connectors${n}`);return this.unwrapResponse(r)},getRuntimeStatus:async()=>{let e=this.getRoute(`automation`),t=await this.fetch(`${this.baseUrl}${e}/_status`);return this.unwrapResponse(t)},toggle:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}/toggle`,{method:`POST`,body:JSON.stringify({enabled:t})});return this.unwrapResponse(r)},runs:{list:async(e,t)=>{let n=this.getRoute(`automation`),r=new URLSearchParams;t?.limit&&r.set(`limit`,String(t.limit)),t?.cursor&&r.set(`cursor`,t.cursor);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${e}/runs${i?`?${i}`:``}`);return this.unwrapResponse(a)},get:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}/runs/${t}`);return this.unwrapResponse(r)}},getFlow:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},execute:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/trigger`,{method:`POST`,body:JSON.stringify(t??{})});return this.unwrapResponse(r)},listRuns:async(e,t)=>{let n=this.getRoute(`automation`),r=new URLSearchParams;t?.limit!=null&&r.set(`limit`,String(t.limit)),t?.cursor&&r.set(`cursor`,t.cursor),t?.status&&r.set(`status`,t.status);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/runs${i?`?${i}`:``}`);return this.unwrapResponse(a)},getRun:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}`);return this.unwrapResponse(r)},resume:async(e,t,n)=>{let r=this.getRoute(`automation`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}/resume`,{method:`POST`,body:JSON.stringify(n??{})});return this.unwrapResponse(i)},getScreen:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}/screen`);return this.unwrapResponse(r)}},this.actions={invoke:async(e,t,n)=>{try{let r=await this.fetch(`${this.baseUrl}/api/v1/actions/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`POST`,body:JSON.stringify({recordId:n?.recordId,params:n?.params??{}})});return O(await this.unwrapResponse(r))}catch(e){return{success:!1,error:D(e)}}},invokeGlobal:async(e,t)=>this.actions.invoke(`global`,e,t)},this.keys={create:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/keys`,{method:`POST`,body:JSON.stringify({...e?.name==null?{}:{name:e.name},...e?.expiresAt==null?{}:{expires_at:e.expiresAt}})});return this.unwrapResponse(t)}},this.shareLinks={create:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/share-links`,{method:`POST`,body:JSON.stringify({object:e,recordId:t,...n??{}})});return this.unwrapResponse(r)},list:async e=>{let t=new URLSearchParams;e?.object&&t.set(`object`,e.object),e?.recordId&&t.set(`recordId`,e.recordId),e?.includeRevoked&&t.set(`includeRevoked`,`true`);let n=t.toString(),r=await this.fetch(`${this.baseUrl}/api/v1/share-links${n?`?${n}`:``}`);return this.unwrapResponse(r)},revoke:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/share-links/${encodeURIComponent(e)}`,{method:`DELETE`});return this.unwrapResponse(t)}},this.security={explain:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/security/explain`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(t)},describeDelegableScope:async()=>{let e=await this.fetch(`${this.baseUrl}/api/v1/security/my-delegable-scope`);return this.unwrapResponse(e)},suggestedBindings:{list:async e=>{let t=new URLSearchParams;e?.status&&t.set(`status`,e.status),e?.packageId&&t.set(`packageId`,e.packageId);let n=t.toString(),r=await this.fetch(`${this.baseUrl}/api/v1/security/suggested-bindings${n?`?${n}`:``}`);return this.unwrapResponse(r)},confirm:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/security/suggested-bindings/${encodeURIComponent(e)}/confirm`,{method:`POST`});return this.unwrapResponse(t)},dismiss:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/security/suggested-bindings/${encodeURIComponent(e)}/dismiss`,{method:`POST`});return this.unwrapResponse(t)}}},this.approvals={listRequests:async e=>{let t=this.getRoute(`approvals`),n=new URLSearchParams;e?.object&&n.set(`object`,e.object),e?.recordId&&n.set(`recordId`,e.recordId),e?.status&&n.set(`status`,Array.isArray(e.status)?e.status.join(`,`):e.status),e?.approverId&&n.set(`approverId`,Array.isArray(e.approverId)?e.approverId.join(`,`):e.approverId),e?.submitterId&&n.set(`submitterId`,e.submitterId);let r=n.toString(),i=await this.fetch(`${this.baseUrl}${t}/requests${r?`?${r}`:``}`),a=await this.unwrapResponse(i);return Array.isArray(a)?a:a?.data??[]},getRequest:async e=>{let t=this.getRoute(`approvals`),n=await this.fetch(`${this.baseUrl}${t}/requests/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},approve:async(e,t)=>{let n=this.getRoute(`approvals`),r=await this.fetch(`${this.baseUrl}${n}/requests/${encodeURIComponent(e)}/approve`,{method:`POST`,body:JSON.stringify({actorId:t?.actorId,comment:t?.comment,attachments:t?.attachments})});return this.unwrapResponse(r)},reject:async(e,t)=>{let n=this.getRoute(`approvals`),r=await this.fetch(`${this.baseUrl}${n}/requests/${encodeURIComponent(e)}/reject`,{method:`POST`,body:JSON.stringify({actorId:t?.actorId,comment:t?.comment,attachments:t?.attachments})});return this.unwrapResponse(r)},reassign:async(e,t)=>{let n=this.getRoute(`approvals`),r=await this.fetch(`${this.baseUrl}${n}/requests/${encodeURIComponent(e)}/reassign`,{method:`POST`,body:JSON.stringify({to:t.to,from:t.from,actorId:t.actorId,comment:t.comment})});return this.unwrapResponse(r)},recall:async(e,t)=>{let n=this.getRoute(`approvals`),r=await this.fetch(`${this.baseUrl}${n}/requests/${encodeURIComponent(e)}/recall`,{method:`POST`,body:JSON.stringify({actorId:t?.actorId,comment:t?.comment})});return this.unwrapResponse(r)},revise:async(e,t)=>{let n=this.getRoute(`approvals`),r=await this.fetch(`${this.baseUrl}${n}/requests/${encodeURIComponent(e)}/revise`,{method:`POST`,body:JSON.stringify({actorId:t?.actorId,comment:t?.comment})});return this.unwrapResponse(r)},resubmit:async(e,t)=>{let n=this.getRoute(`approvals`),r=await this.fetch(`${this.baseUrl}${n}/requests/${encodeURIComponent(e)}/resubmit`,{method:`POST`,body:JSON.stringify({actorId:t?.actorId,comment:t?.comment})});return this.unwrapResponse(r)},remind:async(e,t)=>{let n=this.getRoute(`approvals`),r=await this.fetch(`${this.baseUrl}${n}/requests/${encodeURIComponent(e)}/remind`,{method:`POST`,body:JSON.stringify({actorId:t?.actorId,comment:t?.comment})});return this.unwrapResponse(r)},requestInfo:async(e,t)=>{let n=this.getRoute(`approvals`),r=await this.fetch(`${this.baseUrl}${n}/requests/${encodeURIComponent(e)}/request-info`,{method:`POST`,body:JSON.stringify({actorId:t?.actorId,comment:t?.comment})});return this.unwrapResponse(r)},comment:async(e,t)=>{let n=this.getRoute(`approvals`),r=await this.fetch(`${this.baseUrl}${n}/requests/${encodeURIComponent(e)}/comment`,{method:`POST`,body:JSON.stringify({actorId:t.actorId,comment:t.comment,attachments:t.attachments})});return this.unwrapResponse(r)},listActions:async e=>{let t=this.getRoute(`approvals`),n=await this.fetch(`${this.baseUrl}${t}/requests/${encodeURIComponent(e)}/actions`),r=await this.unwrapResponse(n);return Array.isArray(r)?r:r?.data??[]}},this.shares={list:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/shares`),i=await this.unwrapResponse(r);return Array.isArray(i)?i:i?.data??[]},grant:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/shares`,{method:`POST`,body:JSON.stringify(n)});return this.unwrapResponse(i)},revoke:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/shares/${encodeURIComponent(n)}`,{method:`DELETE`});return i.status===204?{deleted:!0}:this.unwrapResponse(i)},rules:{list:async e=>{let t=new URLSearchParams;e?.object&&t.set(`object`,e.object),e?.activeOnly!==void 0&&t.set(`activeOnly`,String(e.activeOnly));let n=t.toString(),r=await this.fetch(`${this.baseUrl}/api/v1/sharing/rules${n?`?${n}`:``}`),i=await this.unwrapResponse(r);return Array.isArray(i)?i:i?.data??[]},save:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/sharing/rules`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(t)},get:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/sharing/rules/${encodeURIComponent(e)}`);return this.unwrapResponse(t)},delete:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/sharing/rules/${encodeURIComponent(e)}`,{method:`DELETE`});return t.status===204?{deleted:!0}:this.unwrapResponse(t)},evaluate:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/sharing/rules/${encodeURIComponent(e)}/evaluate`,{method:`POST`,body:JSON.stringify({})});return this.unwrapResponse(t)}}},this.search=async(e,t)=>{let n=new URLSearchParams;n.set(`q`,e),t?.objects?.length&&n.set(`objects`,t.objects.join(`,`)),t?.limit!==void 0&&n.set(`limit`,String(t.limit)),t?.perObject!==void 0&&n.set(`perObject`,String(t.perObject));let r=await this.fetch(`${this.baseUrl}/api/v1/search?${n.toString()}`);return this.unwrapResponse(r)},this.reports={list:async e=>{let t=new URLSearchParams;e?.object&&t.set(`object`,e.object),e?.ownerId&&t.set(`ownerId`,e.ownerId);let n=t.toString(),r=await this.fetch(`${this.baseUrl}/api/v1/reports${n?`?${n}`:``}`),i=await this.unwrapResponse(r);return Array.isArray(i)?i:i?.data??[]},save:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/reports`,{method:`POST`,body:JSON.stringify(e??{})});return this.unwrapResponse(t)},get:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/reports/${encodeURIComponent(e)}`);return this.unwrapResponse(t)},delete:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/reports/${encodeURIComponent(e)}`,{method:`DELETE`});return t.status===204?{deleted:!0}:this.unwrapResponse(t)},run:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/reports/${encodeURIComponent(e)}/run`,{method:`POST`,body:JSON.stringify({})});return this.unwrapResponse(t)},schedule:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/reports/${encodeURIComponent(e)}/schedule`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(n)},listSchedules:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/reports/${encodeURIComponent(e)}/schedules`),n=await this.unwrapResponse(t);return Array.isArray(n)?n:n?.data??[]},unschedule:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/reports/schedules/${encodeURIComponent(e)}`,{method:`DELETE`});return t.status===204?{deleted:!0}:this.unwrapResponse(t)}},this.notifications={list:async e=>{let t=this.getRoute(`notifications`),n=new URLSearchParams;e?.read!==void 0&&n.set(`read`,String(e.read)),e?.type&&n.set(`type`,e.type),e?.limit&&n.set(`limit`,String(e.limit));let r=n.toString(),i=await this.fetch(`${this.baseUrl}${t}${r?`?${r}`:``}`);return this.unwrapResponse(i)},markRead:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/read`,{method:`POST`,body:JSON.stringify({ids:e})});return this.unwrapResponse(n)},markAllRead:async()=>{let e=this.getRoute(`notifications`),t=await this.fetch(`${this.baseUrl}${e}/read/all`,{method:`POST`});return this.unwrapResponse(t)}},this.ai={chat:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/chat`,{method:`POST`,body:JSON.stringify({...e,stream:!1})});return this.unwrapResponse(n)},chatStream:async e=>{let t=this.getRoute(`ai`);return E(await this.fetch(`${this.baseUrl}${t}/chat`,{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify({...e,stream:!0})}))},complete:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/complete`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},models:async()=>{let e=this.getRoute(`ai`),t=await this.fetch(`${this.baseUrl}${e}/models`);return this.unwrapResponse(t)},conversations:{create:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/conversations`,{method:`POST`,body:JSON.stringify(e??{})});return this.unwrapResponse(n)},list:async e=>{let t=this.getRoute(`ai`),n=new URLSearchParams;e?.agentId&&n.set(`agentId`,e.agentId),e?.limit!==void 0&&n.set(`limit`,String(e.limit)),e?.cursor&&n.set(`cursor`,e.cursor);let r=n.toString(),i=await this.fetch(`${this.baseUrl}${t}/conversations${r?`?${r}`:``}`);return(await this.unwrapResponse(i))?.conversations??[]},get:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/conversations/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},update:async(e,t)=>{let n=this.getRoute(`ai`),r=await this.fetch(`${this.baseUrl}${n}/conversations/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)});return this.unwrapResponse(r)},delete:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/conversations/${encodeURIComponent(e)}`,{method:`DELETE`});return n.status===204?{deleted:!0}:this.unwrapResponse(n)},addMessage:async(e,t)=>{let n=this.getRoute(`ai`),r=await this.fetch(`${this.baseUrl}${n}/conversations/${encodeURIComponent(e)}/messages`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)}},agents:{list:async()=>{let e=this.getRoute(`ai`),t=await this.fetch(`${this.baseUrl}${e}/agents`);return(await this.unwrapResponse(t))?.agents??[]},chat:async(e,t)=>{let n=this.getRoute(`ai`),r=await this.fetch(`${this.baseUrl}${n}/agents/${encodeURIComponent(e)}/chat`,{method:`POST`,body:JSON.stringify({...t,stream:!1})});return this.unwrapResponse(r)},chatStream:async(e,t)=>{let n=this.getRoute(`ai`);return E(await this.fetch(`${this.baseUrl}${n}/agents/${encodeURIComponent(e)}/chat`,{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify({...t,stream:!0})}))}},pendingActions:{list:async e=>{let t=this.getRoute(`ai`),n=new URLSearchParams;e?.status&&n.set(`status`,e.status),e?.conversationId&&n.set(`conversationId`,e.conversationId),e?.limit!==void 0&&n.set(`limit`,String(e.limit));let r=n.toString(),i=await this.fetch(`${this.baseUrl}${t}/pending-actions${r?`?${r}`:``}`);return(await this.unwrapResponse(i))?.items??[]},get:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/pending-actions/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},approve:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/pending-actions/${encodeURIComponent(e)}/approve`,{method:`POST`,body:JSON.stringify({})});return this.unwrapResponse(n)},reject:async(e,t)=>{let n=this.getRoute(`ai`),r=await this.fetch(`${this.baseUrl}${n}/pending-actions/${encodeURIComponent(e)}/reject`,{method:`POST`,body:JSON.stringify(t===void 0?{}:{reason:t})});return this.unwrapResponse(r)}}},this.i18n={getLocales:async()=>{let e=this.getRoute(`i18n`),t=await this.fetch(`${this.baseUrl}${e}/locales`);return this.unwrapResponse(t)},getTranslations:async e=>{let t=this.getRoute(`i18n`),n=await this.fetch(`${this.baseUrl}${t}/translations/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},getFieldLabels:async(e,t)=>{let n=this.getRoute(`i18n`),r=await this.fetch(`${this.baseUrl}${n}/labels/${encodeURIComponent(e)}/${encodeURIComponent(t)}`);return this.unwrapResponse(r)}},this.data={query:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/query`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},find:async(e,t={})=>{let n=this.getRoute(`data`),r=new URLSearchParams,i=t,a={},o;if(w(t)?(i.where&&(a.filter=i.where),i.fields&&(a.select=i.fields),i.orderBy&&(a.sort=i.orderBy),i.limit!=null&&(a.top=i.limit),i.offset!=null&&(a.skip=i.offset),o=T(i.expand),i.aggregations&&(a.aggregations=i.aggregations),i.groupBy&&(a.groupBy=i.groupBy)):Object.assign(a,t),a.top!=null&&r.set(`top`,a.top.toString()),a.skip!=null&&r.set(`skip`,a.skip.toString()),a.sort){if(Array.isArray(a.sort)&&typeof a.sort[0]==`object`)r.set(`sort`,JSON.stringify(a.sort));else{let e=Array.isArray(a.sort)?a.sort.join(`,`):a.sort;r.set(`sort`,e)}}a.select&&r.set(`select`,a.select.join(`,`));let s=a.filter??a.filters;s&&(this.isFilterAST(s)||Array.isArray(s)?r.set(`filter`,JSON.stringify(s)):typeof s==`object`&&s&&Object.entries(s).forEach(([e,t])=>{t!=null&&r.append(e,String(t))})),a.aggregations&&r.set(`aggregations`,JSON.stringify(a.aggregations)),a.groupBy&&r.set(`groupBy`,a.groupBy.join(`,`)),o&&r.set(`expand`,o);let c=await this.fetch(`${this.baseUrl}${n}/${e}?${r.toString()}`);return this.unwrapResponse(c)},get:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/${t}`);return this.unwrapResponse(r)},create:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},createMany:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/createMany`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},import:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/import`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},createImportJob:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/import/jobs`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},getImportJobProgress:async e=>{let t=this.getRoute(`data`),n=await this.fetch(`${this.baseUrl}${t}/import/jobs/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},getImportJobResults:async e=>{let t=this.getRoute(`data`),n=await this.fetch(`${this.baseUrl}${t}/import/jobs/${encodeURIComponent(e)}/results`);return this.unwrapResponse(n)},listImportJobs:async(e={})=>{let t=this.getRoute(`data`),n=new URLSearchParams;e.object&&n.set(`object`,e.object),e.status&&n.set(`status`,e.status),e.limit!=null&&n.set(`limit`,String(e.limit)),e.offset!=null&&n.set(`offset`,String(e.offset));let r=n.toString()?`?${n.toString()}`:``,i=await this.fetch(`${this.baseUrl}${t}/import/jobs${r}`);return(await this.unwrapResponse(i)).jobs},cancelImportJob:async e=>{let t=this.getRoute(`data`),n=await this.fetch(`${this.baseUrl}${t}/import/jobs/${encodeURIComponent(e)}/cancel`,{method:`POST`});return this.unwrapResponse(n)},undoImportJob:async e=>{let t=this.getRoute(`data`),n=await this.fetch(`${this.baseUrl}${t}/import/jobs/${encodeURIComponent(e)}/undo`,{method:`POST`});return this.unwrapResponse(n)},update:async(e,t,n,r)=>{let i=this.getRoute(`data`),a={};r?.ifMatch&&(a[`If-Match`]=String(r.ifMatch));let o=await this.fetch(`${this.baseUrl}${i}/${e}/${t}`,{method:`PATCH`,body:JSON.stringify(n),...Object.keys(a).length?{headers:a}:{}});return this.unwrapResponse(o)},batch:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/batch`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},batchTransaction:async e=>{let t=this.getRoute(`data`).replace(/\/[^/]+\/?$/,``)||`/api/v1`,n={operations:e,atomic:!0},r=await this.fetch(`${this.baseUrl}${t}/batch`,{method:`POST`,body:JSON.stringify(n)});return this.unwrapResponse(r)},updateMany:async(e,t,n)=>{let r=this.getRoute(`data`),i={records:t,options:n},a=await this.fetch(`${this.baseUrl}${r}/${e}/updateMany`,{method:`POST`,body:JSON.stringify(i)});return this.unwrapResponse(a)},delete:async(e,t,n)=>{let r=this.getRoute(`data`),i={};n?.ifMatch&&(i[`If-Match`]=String(n.ifMatch));let a=await this.fetch(`${this.baseUrl}${r}/${e}/${t}`,{method:`DELETE`,...Object.keys(i).length?{headers:i}:{}});return this.unwrapResponse(a)},deleteMany:async(e,t,n)=>{let r=this.getRoute(`data`),i={ids:t,options:n},a=await this.fetch(`${this.baseUrl}${r}/${e}/deleteMany`,{method:`POST`,body:JSON.stringify(i)});return this.unwrapResponse(a)},clone:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/clone`,{method:`POST`,body:JSON.stringify(n?{overrides:n}:{})});return this.unwrapResponse(i)},export:async(e,t)=>{let n=this.getRoute(`data`),r=new URLSearchParams;t?.format&&r.set(`format`,t.format),t?.limit!==void 0&&r.set(`limit`,String(t.limit)),t?.filter!==void 0&&r.set(`filter`,typeof t.filter==`string`?t.filter:JSON.stringify(t.filter)),t?.orderby!==void 0&&r.set(`orderby`,typeof t.orderby==`string`?t.orderby:JSON.stringify(t.orderby)),t?.header!==void 0&&r.set(`header`,String(t.header));let i=r.toString();return this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/export${i?`?${i}`:``}`)}},this.baseUrl=e.baseUrl.replace(/\/$/,``),this.token=e.token,this.environmentId=e.environmentId,this.locale=e.locale,this.fetchImpl=e.fetch||globalThis.fetch.bind(globalThis),this.logger=e.logger||(0,g.createLogger)({level:e.debug?`debug`:`info`,format:`pretty`}),this.realtimeAPI=new v(this.baseUrl,this.token),this.logger.debug(`ObjectStack client created`,{baseUrl:this.baseUrl})}async connect(){this.logger.debug(`Connecting to ObjectStack server`,{baseUrl:this.baseUrl});try{let e;try{let t=`${this.baseUrl}/api/v1/discovery`;this.logger.debug(`Probing protocol-standard discovery endpoint`,{url:t});let n=await this.fetchImpl(t);if(n.ok){let t=await n.json();e=t.data||t,this.logger.debug(`Discovered via /api/v1/discovery`)}}catch(e){this.logger.debug(`Protocol-standard discovery probe failed`,{error:e.message})}if(!e){let t;try{t=`${new URL(this.baseUrl).origin}/.well-known/objectstack`}catch{t=`/.well-known/objectstack`}this.logger.debug(`Falling back to .well-known discovery`,{url:t});let n=await this.fetchImpl(t);if(!n.ok)throw Error(`Failed to connect to ${t}: ${n.statusText}`);let r=await n.json();e=r.data||r}if(!e)throw Error(`Connection failed: No discovery data returned`);return this.discoveryInfo=e,this.logger.info(`Connected to ObjectStack server`,{version:e.version,apiName:e.apiName,services:e.services}),e}catch(e){throw this.logger.error(`Failed to connect to ObjectStack server`,e,{baseUrl:this.baseUrl}),e}}get capabilities(){let e=this.discoveryInfo?.capabilities;if(!e)return;let t=e,n={};for(let e of h.WELL_KNOWN_CAPABILITY_KEYS){let r=t[e];n[e]=typeof r==`object`&&r?r.enabled===!0:r===!0}return n}environment(e){if(!e)throw Error(`[ObjectStack] environment(id): environmentId is required`);return new P(this,e)}_baseUrl(){return this.baseUrl}_fetch(e,t){return this.fetch(e,t)}_unwrap(e){return this.unwrapResponse(e)}_isFilterAST(e){return this.isFilterAST(e)}_apiBase(){let e=this.discoveryInfo?.routes?.data;if(typeof e==`string`&&e.endsWith(`/data`)){let t=e.slice(0,-5),n=this.discoveryInfo?.scoping;if(n?.scoped){let e=typeof n.environmentId==`string`&&n.environmentId?`/environments/${n.environmentId}`:void 0;if(e&&t.endsWith(e))t=t.slice(0,-e.length);else{let e=t.replace(/\/environments\/[^/]+$/,``);if(e===t)return`/api/v1`;t=e}}if(t)return t}return`/api/v1`}setProjectId(e){this.environmentId=e,this.logger.debug(`Active project changed`,{environmentId:e})}getProjectId(){return this.environmentId}setLocale(e){this.locale=e,this.logger.debug(`Active locale changed`,{locale:e})}getLocale(){return this.locale}get events(){return this.realtimeAPI}isFilterAST(e){return(0,m.isFilterAST)(e)}async unwrapResponse(e){let t=await e.json();return t&&typeof t.success==`boolean`&&`data`in t?t.data:t}async fetch(e,t={}){this.logger.debug(`HTTP request`,{method:t.method||`GET`,url:e,hasBody:!!t.body});let n={"Content-Type":`application/json`,...t.headers||{}};this.token&&(n.Authorization=`Bearer ${this.token}`),this.environmentId&&(n[`X-Environment-Id`]=this.environmentId),this.locale&&!Object.keys(n).some(e=>e.toLowerCase()===`accept-language`)&&(n[`Accept-Language`]=this.locale);let r=await this.fetchImpl(e,{...t,headers:n});if(this.logger.debug(`HTTP response`,{method:t.method||`GET`,url:e,status:r.status,ok:r.ok}),!r.ok){let n;try{n=await r.json()}catch{n={message:r.statusText}}this.logger.error(`HTTP request failed`,void 0,{method:t.method||`GET`,url:e,status:r.status,error:n});let i=n?.message??n?.error?.message??(typeof n?.error==`string`?n.error:void 0)??r.statusText,a=e=>typeof e==`string`&&e?e:void 0,o=a(n?.code)??a(n?.error?.code),s=Array.isArray(n?.fields)?n.fields:Array.isArray(n?.error?.details?.fields)?n.error.details.fields:void 0,c=Error(i);c.code=o,c.category=n?.error?.category,c.httpStatus=r.status,c.retryable=n?.error?.retryable,c.details=n?.details??n?.error?.details??n,s&&(c.fields=s);let l=e=>typeof e==`string`&&e.trim()?e:void 0,u=l(n?.userMessage)??l(n?.error?.userMessage);throw u&&(c.userMessage=u),c}return r}getRoute(e){let t=this.discoveryInfo?.routes;if(t){let n=t[e];if(n)return n}return{data:`/api/v1/data`,metadata:`/api/v1/meta`,discovery:`/api/v1/discovery`,ui:`/api/v1/ui`,auth:`/api/v1/auth`,analytics:`/api/v1/analytics`,storage:`/api/v1/storage`,automation:`/api/v1/automation`,packages:`/api/v1/packages`,realtime:`/api/v1/realtime`,approvals:`/api/v1/approvals`,notifications:`/api/v1/notifications`,ai:`/api/v1/ai`,i18n:`/api/v1/i18n`,mcp:`/api/v1/mcp`,datasources:`/api/v1/datasources`,email:`/api/v1/email`}[e]||`/api/v1/${e}`}},P=class{constructor(e,t){this.meta={getTypes:async()=>{let e=await this.parent._fetch(this.url(`/meta`));return this.parent._unwrap(e)},getItems:async(e,t)=>{let n=new URLSearchParams;t?.packageId&&n.set(`package`,t.packageId);let r=n.toString(),i=await this.parent._fetch(this.url(`/meta/${e}${r?`?${r}`:``}`));return this.parent._unwrap(i)},getItem:async(e,t,n)=>{let r=new URLSearchParams;n?.packageId&&r.set(`package`,n.packageId);let i=r.toString(),a=await this.parent._fetch(this.url(`/meta/${encodeURIComponent(e)}/${encodeURIComponent(t)}${i?`?${i}`:``}`));return this.parent._unwrap(a)},saveItem:async(e,t,n,r)=>{let i=k(r),a=A(r),o=await this.parent._fetch(this.url(`/meta/${encodeURIComponent(e)}/${encodeURIComponent(t)}${i}`),{method:`PUT`,body:JSON.stringify(n),...a?{headers:a}:{}});return this.parent._unwrap(o)},deleteItem:async(e,t,n)=>{let r=j(n),i=M(n),a=await this.parent._fetch(this.url(`/meta/${encodeURIComponent(e)}/${encodeURIComponent(t)}${r}`),{method:`DELETE`,...i?{headers:i}:{}});return this.parent._unwrap(a)},getHistory:async(e,t,n)=>{let r=new URLSearchParams;n?.sinceSeq!==void 0&&r.set(`sinceSeq`,String(n.sinceSeq)),n?.limit!==void 0&&r.set(`limit`,String(n.limit));let i=r.toString(),a=await this.parent._fetch(this.url(`/meta/${encodeURIComponent(e)}/${encodeURIComponent(t)}/history${i?`?${i}`:``}`));return this.parent._unwrap(a)}},this.data={query:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/query`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},find:async(e,t={})=>{let n=new URLSearchParams,r=t,i={},a;if(w(t)?(r.where&&(i.filter=r.where),r.fields&&(i.select=r.fields),r.orderBy&&(i.sort=r.orderBy),r.limit!=null&&(i.top=r.limit),r.offset!=null&&(i.skip=r.offset),a=T(r.expand),r.aggregations&&(i.aggregations=r.aggregations),r.groupBy&&(i.groupBy=r.groupBy)):Object.assign(i,t),i.top!=null&&n.set(`top`,i.top.toString()),i.skip!=null&&n.set(`skip`,i.skip.toString()),i.sort){if(Array.isArray(i.sort)&&typeof i.sort[0]==`object`)n.set(`sort`,JSON.stringify(i.sort));else{let e=Array.isArray(i.sort)?i.sort.join(`,`):i.sort;n.set(`sort`,e)}}i.select&&n.set(`select`,i.select.join(`,`));let o=i.filter??i.filters;o&&(this.parent._isFilterAST(o)||Array.isArray(o)?n.set(`filter`,JSON.stringify(o)):typeof o==`object`&&o&&Object.entries(o).forEach(([e,t])=>{t!=null&&n.append(e,String(t))})),i.aggregations&&n.set(`aggregations`,JSON.stringify(i.aggregations)),i.groupBy&&n.set(`groupBy`,i.groupBy.join(`,`)),a&&n.set(`expand`,a);let s=n.toString(),c=await this.parent._fetch(this.url(`/data/${e}${s?`?${s}`:``}`));return this.parent._unwrap(c)},get:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/${t}`));return this.parent._unwrap(n)},create:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},createMany:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/createMany`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},import:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/import`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},createImportJob:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/import/jobs`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},getImportJobProgress:async e=>{let t=await this.parent._fetch(this.url(`/data/import/jobs/${encodeURIComponent(e)}`));return this.parent._unwrap(t)},getImportJobResults:async e=>{let t=await this.parent._fetch(this.url(`/data/import/jobs/${encodeURIComponent(e)}/results`));return this.parent._unwrap(t)},listImportJobs:async(e={})=>{let t=new URLSearchParams;e.object&&t.set(`object`,e.object),e.status&&t.set(`status`,e.status),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString()?`?${t.toString()}`:``,r=await this.parent._fetch(this.url(`/data/import/jobs${n}`));return(await this.parent._unwrap(r)).jobs},cancelImportJob:async e=>{let t=await this.parent._fetch(this.url(`/data/import/jobs/${encodeURIComponent(e)}/cancel`),{method:`POST`});return this.parent._unwrap(t)},undoImportJob:async e=>{let t=await this.parent._fetch(this.url(`/data/import/jobs/${encodeURIComponent(e)}/undo`),{method:`POST`});return this.parent._unwrap(t)},update:async(e,t,n)=>{let r=await this.parent._fetch(this.url(`/data/${e}/${t}`),{method:`PATCH`,body:JSON.stringify(n)});return this.parent._unwrap(r)},batch:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/batch`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},batchTransaction:async e=>{let t={operations:e,atomic:!0},n=await this.parent._fetch(this.url(`/batch`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},updateMany:async(e,t,n)=>{let r={records:t,options:n},i=await this.parent._fetch(this.url(`/data/${e}/updateMany`),{method:`POST`,body:JSON.stringify(r)});return this.parent._unwrap(i)},delete:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/${t}`),{method:`DELETE`});return this.parent._unwrap(n)},deleteMany:async(e,t,n)=>{let r={ids:t,options:n},i=await this.parent._fetch(this.url(`/data/${e}/deleteMany`),{method:`POST`,body:JSON.stringify(r)});return this.parent._unwrap(i)}},this.packages={list:async()=>{let e=await this.parent._fetch(this.url(`/packages`));return this.parent._unwrap(e)},get:async(e,t)=>{let n=t?`?version=${encodeURIComponent(t)}`:``,r=await this.parent._fetch(this.url(`/packages/${encodeURIComponent(e)}${n}`));return this.parent._unwrap(r)}},this.automation={getFlow:async e=>{let t=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}`));return this.parent._unwrap(t)},execute:async(e,t)=>{let n=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/trigger`),{method:`POST`,body:JSON.stringify(t??{})});return this.parent._unwrap(n)},listRuns:async(e,t)=>{let n=new URLSearchParams;t?.limit!=null&&n.set(`limit`,String(t.limit)),t?.cursor&&n.set(`cursor`,t.cursor),t?.status&&n.set(`status`,t.status);let r=n.toString(),i=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/runs${r?`?${r}`:``}`));return this.parent._unwrap(i)},getRun:async(e,t)=>{let n=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}`));return this.parent._unwrap(n)},resume:async(e,t,n)=>{let r=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}/resume`),{method:`POST`,body:JSON.stringify(n??{})});return this.parent._unwrap(r)},getScreen:async(e,t)=>{let n=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}/screen`));return this.parent._unwrap(n)}},this.parent=e,this.environmentId=t}getProjectId(){return this.environmentId}scope(){return`${this.parent._apiBase()}/environments/${encodeURIComponent(this.environmentId)}`}url(e){return`${this.parent._baseUrl()}${this.scope()}${e}`}};0&&(t.exports={FilterBuilder:y,ObjectStackClient:N,QueryBuilder:b,RealtimeAPI:v,ScopedEnvironmentClient:P,createFilter:S,createQuery:x})}));i();var re=ne();c();function ie(e){if(!e||typeof e!=`object`)return[];let t=e.advisories;return Array.isArray(t)?t.filter(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.rule==`string`&&typeof t.path==`string`&&typeof t.where==`string`&&typeof t.message==`string`&&typeof t.hint==`string`&&typeof t.severity==`string`}):[]}var ae=[`overlayScope`,`lock`,`lockReason`,`lockSource`,`lockDocsUrl`,`provenance`,`packageId`,`packageVersion`,`editable`,`deletable`,`resettable`];function oe(e){let t=l.shape;return ae.filter(n=>e[n]!==void 0&&!t[n].safeParse(e[n]).success)}var F=`/meta`,I=`/api/v1`;function se(e){let t=e.baseUrl.replace(/\/+$/,``),n=e.environmentId?`${I}/environments/${encodeURIComponent(e.environmentId)}${F}`:`${I}${F}`;return/\/api\/v\d+$/i.test(t)?`${t.replace(/\/api\/v\d+$/i,``)}${e.environmentId?`${I}/environments/${encodeURIComponent(e.environmentId)}${F}`:`${I}${F}`}`:`${t}${n}`}async function L(e){let t;try{t=await e.json()}catch{t=await e.text().catch(()=>void 0)}let n=t&&typeof t==`object`?t:void 0,r=n?.error,i=(r&&typeof r==`object`?r.message:r)??n?.message??`Metadata request failed: ${e.status} ${e.statusText}`,a=Error(String(i));a.status=e.status,a.body=t;let o=r&&typeof r==`object`?r.details:void 0,s=o?.issues??(r&&typeof r==`object`?r.issues:void 0)??n?.issues;Array.isArray(s)&&(a.issues=s);let c=o?.code??(r&&typeof r==`object`?r.code:void 0)??n?.code;return c!=null&&(a.code=String(c)),a}function ce(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.type==`string`&&typeof t.name==`string`&&`item`in t}var le=class e{base;fetchImpl;headers;previewDrafts;onSaveAdvisory;constructor(e){this.base=se(e),this.fetchImpl=e.fetch??globalThis.fetch.bind(globalThis),this.headers={Accept:`application/json`,...e.headers??{}},this.previewDrafts=e.previewDrafts===!0,this.onSaveAdvisory=e.onSaveAdvisory}withEnvironment(t){return new e({baseUrl:this.base.replace(/\/api\/v\d+(?:\/environments\/[^/]+)?\/meta$/,``).replace(/\/+$/,``),environmentId:t,fetch:this.fetchImpl,headers:this.headers,previewDrafts:this.previewDrafts,...this.onSaveAdvisory?{onSaveAdvisory:this.onSaveAdvisory}:{}})}withPreviewDrafts(t){if(t===this.previewDrafts)return this;let n=this.base.match(/\/api\/v\d+\/environments\/([^/]+)\/meta$/);return new e({baseUrl:this.base.replace(/\/api\/v\d+(?:\/environments\/[^/]+)?\/meta$/,``).replace(/\/+$/,``),...n?{environmentId:decodeURIComponent(n[1])}:{},fetch:this.fetchImpl,headers:this.headers,previewDrafts:t,...this.onSaveAdvisory?{onSaveAdvisory:this.onSaveAdvisory}:{}})}async listTypes(){let e=await this.fetchImpl(this.base,{method:`GET`,headers:this.headers,cache:`no-store`});if(!e.ok)throw await L(e);let t=await e.json();return Array.isArray(t)?t:t&&Array.isArray(t.entries)?t.entries:t&&Array.isArray(t.items)?t.items:t&&Array.isArray(t.types)?t.types.map(e=>({type:e})):[]}async list(e,t={}){let n=[];t.packageId&&n.push(`package=${encodeURIComponent(t.packageId)}`),this.previewDrafts&&n.push(`preview=draft`);let r=n.length?`?${n.join(`&`)}`:``,i=`${this.base}/${encodeURIComponent(e)}${r}`,a=await this.fetchImpl(i,{method:`GET`,headers:this.headers,cache:`no-store`});if(!a.ok)throw await L(a);let o=await a.json();return Array.isArray(o)?o:o&&Array.isArray(o.items)?o.items:[]}async listDrafts(e={}){let t=[];e.packageId&&t.push(`packageId=${encodeURIComponent(e.packageId)}`),e.type&&t.push(`type=${encodeURIComponent(e.type)}`);let n=t.length?`?${t.join(`&`)}`:``,r=`${this.base}/_drafts${n}`,i=await this.fetchImpl(r,{method:`GET`,headers:this.headers,cache:`no-store`});if(!i.ok)throw await L(i);let a=await i.json();return Array.isArray(a)?a:a?.drafts??a?.data?.drafts??[]}async readItemResponse(e,t,n={}){let r=[];n.state===`draft`?r.push(`state=draft`):this.previewDrafts&&r.push(`preview=draft`),n.packageId&&r.push(`package=${encodeURIComponent(n.packageId)}`);let i=r.length?`?${r.join(`&`)}`:``,a=`${this.base}/${encodeURIComponent(e)}/${encodeURIComponent(t)}${i}`,o=await this.fetchImpl(a,{method:`GET`,headers:this.headers,cache:`no-store`});if(o.status===404)return null;if(!o.ok)throw await L(o);return await o.json()}async get(e,t,n={}){let r=await this.readItemResponse(e,t,n);return ce(r)?r.item??null:r}async getDraft(e,t,n={}){return this.readItemResponse(e,t,{state:`draft`,...n.packageId?{packageId:n.packageId}:{}})}emitAdvisories(e,t){if(this.onSaveAdvisory)try{let n=ie(e);n.length>0&&this.onSaveAdvisory({...t,advisories:n})}catch{}}async save(e,t,n,r={}){if(!t||!String(t).trim())throw Error(`MetadataClient.save: name must be non-empty (type="${e}"). The PUT /meta/:type/:name route requires a name segment.`);let i=[];r.force&&i.push(`force=true`),r.mode===`draft`&&i.push(`mode=draft`),r.packageId&&i.push(`package=${encodeURIComponent(r.packageId)}`);let a=i.length?`?${i.join(`&`)}`:``,o=`${this.base}/${encodeURIComponent(e)}/${encodeURIComponent(t)}${a}`,s={...this.headers,"Content-Type":`application/json`};r.ifMatch&&(s[`If-Match`]=r.ifMatch);let c=await this.fetchImpl(o,{method:`PUT`,headers:s,body:JSON.stringify(n)});if(!c.ok)throw await L(c);let l=await c.json();return this.emitAdvisories(l,{type:e,name:t,door:`save`,mode:r.mode===`draft`?`draft`:`publish`}),l}async publishDraft(e,t){let n=`${this.base}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/publish`,r=await this.fetchImpl(n,{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`application/json`},body:`{}`});if(!r.ok)throw await L(r);let i=await r.json().catch(()=>({})),a=i?.data&&typeof i.data==`object`?i.data:i;return this.emitAdvisories(a,{type:e,name:t,door:`publish`,mode:`publish`}),a}async layered(e,t,n={}){let r=n.packageId?`?package=${encodeURIComponent(n.packageId)}`:``,i=`${this.base}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/layers${r}`,a=await this.fetchImpl(i,{method:`GET`,headers:this.headers,cache:`no-store`});if(a.status===404)return{code:null,overlay:null,overlayScope:null,effective:null};if(!a.ok)throw await L(a);let o=await a.json();if(!(typeof o==`object`&&o&&(`code`in o||`overlay`in o||`effective`in o)))return{code:null,overlay:null,overlayScope:null,effective:o};let s=l.safeParse(o);if(s.success){let e=s.data;return{code:e.code??null,overlay:e.overlay??null,overlayScope:e.overlayScope,effective:e.effective??null,...o._diagnostics?{_diagnostics:o._diagnostics}:{},lock:e.lock,...e.lockReason===void 0?{}:{lockReason:e.lockReason},...e.lockSource===void 0?{}:{lockSource:e.lockSource},...e.lockDocsUrl===void 0?{}:{lockDocsUrl:e.lockDocsUrl},...e.provenance===void 0?{}:{provenance:e.provenance},...e.packageId===void 0?{}:{packageId:e.packageId},...e.packageVersion===void 0?{}:{packageVersion:e.packageVersion},editable:e.editable,deletable:e.deletable,resettable:e.resettable}}let c=oe(o);return{code:o.code??null,overlay:o.overlay??null,overlayScope:o.overlayScope??null,effective:o.effective??null,...o._diagnostics?{_diagnostics:o._diagnostics}:{},...o.lock===void 0?{}:{lock:o.lock},...o.lockReason===void 0?{}:{lockReason:o.lockReason},...o.lockSource===void 0?{}:{lockSource:o.lockSource},...o.lockDocsUrl===void 0?{}:{lockDocsUrl:o.lockDocsUrl},...o.provenance===void 0?{}:{provenance:o.provenance},...o.packageId===void 0?{}:{packageId:o.packageId},...o.packageVersion===void 0?{}:{packageVersion:o.packageVersion},...o.editable===void 0?{}:{editable:o.editable},...o.deletable===void 0?{}:{deletable:o.deletable},...o.resettable===void 0?{}:{resettable:o.resettable},...c.length>0?{_unrecognized:c}:{}}}async diagnostics(e={}){let t=[];e.type&&t.push(`type=${encodeURIComponent(e.type)}`),e.severity&&t.push(`severity=${encodeURIComponent(e.severity)}`),e.packageId&&t.push(`package=${encodeURIComponent(e.packageId)}`);let n=t.length?`?${t.join(`&`)}`:``,r=`${this.base}/diagnostics${n}`,i=await this.fetchImpl(r,{method:`GET`,headers:this.headers,cache:`no-store`});if(i.status===404)return{entries:[],total:0,scannedTypes:0,scannedItems:0,stats:{}};if(!i.ok)throw await L(i);let a=await i.json();return{entries:Array.isArray(a.entries)?a.entries:[],total:typeof a.total==`number`?a.total:0,scannedTypes:typeof a.scannedTypes==`number`?a.scannedTypes:0,scannedItems:typeof a.scannedItems==`number`?a.scannedItems:0,stats:a.stats&&typeof a.stats==`object`?a.stats:{}}}async references(e,t){let n=`${this.base}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/references`,r=await this.fetchImpl(n,{method:`GET`,headers:this.headers,cache:`no-store`});if(r.status===404)return[];if(!r.ok)throw await L(r);let i=await r.json();return Array.isArray(i)?i:i?.items??[]}async reset(e,t,n={}){let r=n.state===`draft`?`?state=draft`:``,i=`${this.base}/${encodeURIComponent(e)}/${encodeURIComponent(t)}${r}`,a={...this.headers};n.ifMatch&&(a[`If-Match`]=n.ifMatch);let o=await this.fetchImpl(i,{method:`DELETE`,headers:a});if(!o.ok)throw await L(o);return await o.json()}async publish(e,t,n={}){let r=n.packageId?`?package=${encodeURIComponent(n.packageId)}`:``,i=`${this.base}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/publish${r}`,a={...this.headers,"Content-Type":`application/json`},o=await this.fetchImpl(i,{method:`POST`,headers:a,body:JSON.stringify(n.message?{message:n.message}:{})});if(!o.ok)throw await L(o);let s=await o.json();return this.emitAdvisories(s,{type:e,name:t,door:`publish`,mode:`publish`}),s}async rollback(e,t,n,r={}){let i=`${this.base}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/rollback`,a={...this.headers,"Content-Type":`application/json`},o=await this.fetchImpl(i,{method:`POST`,headers:a,body:JSON.stringify({toVersion:n,...r.message?{message:r.message}:{}})});if(!o.ok)throw await L(o);return await o.json()}async diff(e,t,n,r){let i=new URLSearchParams;n!==void 0&&i.set(`from`,String(n)),r!==void 0&&i.set(`to`,String(r));let a=i.toString(),o=`${this.base}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/diff${a?`?${a}`:``}`,s=await this.fetchImpl(o,{method:`GET`,headers:this.headers,cache:`no-store`});if(!s.ok)throw await L(s);return await s.json()}async history(e,t,n={}){let r=new URLSearchParams;n.sinceSeq!==void 0&&r.set(`sinceSeq`,String(n.sinceSeq)),n.limit!==void 0&&r.set(`limit`,String(n.limit));let i=r.toString(),a=`${this.base}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/history${i?`?${i}`:``}`,o=await this.fetchImpl(a,{method:`GET`,headers:this.headers,cache:`no-store`});if(!o.ok)throw await L(o);return await o.json()}async audit(e,t,n={}){let r=new URLSearchParams;n.limit!==void 0&&r.set(`limit`,String(n.limit));let i=r.toString(),a=`${this.base}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/audit${i?`?${i}`:``}`,o=await this.fetchImpl(a,{method:`GET`,headers:this.headers,cache:`no-store`});if(!o.ok)throw await L(o);return await o.json()}},ue=class{cache;inflight;maxSize;ttl;stats;constructor(e={}){this.cache=new Map,this.inflight=new Map,this.maxSize=e.maxSize||100,this.ttl=e.ttl||3e5,this.stats={hits:0,misses:0,evictions:0,coalesced:0}}async get(e,t){let n=Date.now(),r=this.cache.get(e);if(r){if(n-r.timestamp<this.ttl)return r.accessCount++,r.lastAccessed=n,this.stats.hits++,this.cache.delete(e),this.cache.set(e,r),r.data;this.cache.delete(e)}let i=this.inflight.get(e);if(i)return this.stats.coalesced++,i;this.stats.misses++;let a=(async()=>{try{let n=await t();return this.set(e,n),n}finally{this.inflight.delete(e)}})();return this.inflight.set(e,a),a}prime(e,t){this.set(e,t)}set(e,t){let n=Date.now();this.cache.size>=this.maxSize&&!this.cache.has(e)&&this.evictLRU(),this.cache.set(e,{data:t,timestamp:n,accessCount:1,lastAccessed:n})}evictLRU(){let e=this.cache.keys().next().value;e!==void 0&&(this.cache.delete(e),this.stats.evictions++)}invalidate(e){e?this.cache.delete(e):this.cache.clear()}clear(){this.cache.clear(),this.inflight.clear(),this.stats={hits:0,misses:0,evictions:0,coalesced:0}}getStats(){let e=this.stats.hits+this.stats.misses,t=e>0?this.stats.hits/e:0;return{size:this.cache.size,maxSize:this.maxSize,hits:this.stats.hits,misses:this.stats.misses,evictions:this.stats.evictions,coalesced:this.stats.coalesced,hitRate:t}}getCachedSync(e){let t=this.cache.get(e);if(t){if(this.ttl>0&&Date.now()-t.timestamp>this.ttl){this.cache.delete(e);return}return this.cache.delete(e),this.cache.set(e,t),this.stats.hits++,t.data}}has(e){let t=this.cache.get(e);return t?Date.now()-t.timestamp>=this.ttl?(this.cache.delete(e),!1):!0:!1}},R=class extends Error{code;statusCode;details;constructor(e,t,n,r){super(e),this.code=t,this.statusCode=n,this.details=r,this.name=`ObjectStackError`,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,message:this.message,code:this.code,statusCode:this.statusCode,details:this.details,stack:this.stack}}},de=class extends R{constructor(e,t){super(`Metadata not found for object: ${e}`,`METADATA_NOT_FOUND`,404,{objectName:e,...t}),this.name=`MetadataNotFoundError`}},z=class extends R{successCount;failureCount;errors;constructor(e,t,n,r,i){super(`Bulk ${e} operation failed: ${t} succeeded, ${n} failed`,`BULK_OPERATION_ERROR`,500,{operation:e,successCount:t,failureCount:n,errors:r,...i}),this.successCount=t,this.failureCount=n,this.errors=r,this.name=`BulkOperationError`}getSummary(){let e=this.successCount+this.failureCount,t=e>0?this.failureCount/e:0;return{operation:this.details?.operation,total:e,successful:this.successCount,failed:this.failureCount,failureRate:t,errors:this.errors}}},B=class extends R{url;constructor(e,t,n,r){super(`Connection error: ${e}`,`CONNECTION_ERROR`,r||503,{url:t,...n}),this.url=t,this.name=`ConnectionError`}},V=class extends R{constructor(e=`Authentication failed`,t,n){super(e,`AUTHENTICATION_ERROR`,n||401,t),this.name=`AuthenticationError`}},H=class extends R{field;validationErrors;constructor(e,t,n,r){super(e,`VALIDATION_ERROR`,400,{field:t,validationErrors:n,...r}),this.field=t,this.validationErrors=n,this.name=`ValidationError`}getValidationErrors(){return this.validationErrors||[]}};function fe(e,t){let n=e?.status||e?.statusCode||500,r=e?.message||e?.statusText||`Unknown error`,i={context:t,response:{status:n,data:e?.data,headers:e?.headers}};switch(n){case 401:return new V(r,i,401);case 403:return new V(r,i,403);case 404:return t?.includes(`metadata`)||t?.includes(`schema`)||t?.includes(`getObjectSchema`)?new de(pe(t),i):new R(r,`NOT_FOUND`,404,i);case 400:return new H(r,void 0,e?.data?.errors,i);case 503:return new B(r,e?.config?.url,i,503);case 504:return new B(r,e?.config?.url,i,504);default:return new R(r,`UNKNOWN_ERROR`,n,i)}}function pe(e){if(!e)return`unknown`;let t=e.match(/\(([^)]+)\)/);return t?t[1]:`unknown`}var me=`sys_user_preference`;function he(e){let{dataSource:t,userId:n,key:r,resource:i=me,onError:a=()=>{}}=e,o=null,s=Promise.resolve(),c=async()=>{let e={$filter:{user_id:n,key:r},$top:1};return((await t.find(i,e))?.data??[]).find(e=>{if(!e)return!1;let t=e.user_id!==void 0&&e.user_id!==n,i=e.key!==void 0&&e.key!==r;return!t&&!i})??null},l=e=>{if(Array.isArray(e))return e;if(typeof e==`string`)try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}return[]},u=async e=>{if(o!==null)try{await t.update(i,o,{value:e});return}catch(e){o=null,a(`save`,e)}let s=await c();if(s&&s.id!==void 0&&s.id!==null){o=s.id,await t.update(i,s.id,{value:e});return}try{let a=(await t.create(i,{user_id:n,key:r,value:e}))?.id;a!=null&&(o=a)}catch(n){let r=await c();if(r&&r.id!==void 0&&r.id!==null){o=r.id,await t.update(i,r.id,{value:e});return}throw n}};return{async load(){try{let e=await c();return e?(e.id!==void 0&&e.id!==null&&(o=e.id),l(e.value)):(o=null,[])}catch(e){return a(`load`,e),[]}},async save(e){let t=s.then(()=>u(e)).catch(e=>{a(`save`,e)});return s=t,t}}}var ge={equals:`=`,eq:`=`,"==":`=`,not_equals:`!=`,notequals:`!=`,ne:`!=`,greater_than:`>`,greaterthan:`>`,gt:`>`,greater_than_or_equal:`>=`,greater_than_or_equals:`>=`,greaterthanorequal:`>=`,gte:`>=`,less_than:`<`,lessthan:`<`,lt:`<`,less_than_or_equal:`<=`,less_than_or_equals:`<=`,lessthanorequal:`<=`,lte:`<=`,in:`in`,not_in:`nin`,notin:`nin`,nin:`nin`,contains:`contains`,icontains:`icontains`,not_contains:`notcontains`,notcontains:`notcontains`,starts_with:`startswith`,startswith:`startswith`,ends_with:`endswith`,endswith:`endswith`,between:`between`,is_null:`isnull`,isnull:`isnull`,is_not_null:`isnotnull`,isnotnull:`isnotnull`,before:`<`,after:`>`};function _e(e){return typeof e==`string`?ge[e.toLowerCase()]??ge[e]??e:null}var ve=class extends Error{code=`INVALID_FILTER`;httpStatus=400;entry;index;constructor(e,t){let n=JSON.stringify(e)??String(e);super(`Filter entry ${t} is not a usable filter rule (${n}). Expected { field, operator, value } with a non-empty field.`),this.name=`MalformedFilterError`,this.entry=e,this.index=t}},ye=class extends Error{code=`INVALID_FILTER`;httpStatus=400;where;resource;constructor(e,t){let n=JSON.stringify(e)??String(e);super(`aggregate('${t}'): the spec-shape branch received a \`where\` array that is not a filter — ${n}. This branch posts \`where\` to POST /data/:object/query verbatim, so it must ALREADY be lowered: either a FilterCondition object (\`QuerySchema.where\`, @objectstack/spec data/query.zod.ts), or a FilterArray the ingress can lower — a comparison tuple (['stage','=','won']), a logical node (['and',[..],[..]]), or an array of nodes (data/filter.zod.ts, gate \`isFilterAST\`). A ViewFilterRule[] ([{ field, operator, value }, ...]) is authoring sugar, not a filter: lower it in the producer that built these aggregate params, not here. Nothing was sent to the server, so no unfiltered numbers came back.`),this.name=`UnloweredAggregateWhereError`,this.where=e,this.resource=t}};function be(e,t){if(Array.isArray(e)&&e.length!==0&&!r(e))throw new ye(e,t)}function xe(e){if(!e||typeof e!=`object`)return null;let t=e.field,n=_e(e.operator??e.op??`=`);return!t||!n?null:[String(t),n,e.value]}function Se(e){let t=e[0];return e.length>0&&typeof t==`object`&&!!t&&!Array.isArray(t)&&t.field!==void 0}function Ce(e){let t=e.map((e,t)=>{if(Array.isArray(e))return W(e);let n=xe(e);if(!n)throw new ve(e,t);return n});return t.length===1?t[0]:[`and`,...t]}var we=new Set([`and`,`or`]);function U(e){if(Se(e))return Ce(e);let t=e[0];return typeof t==`string`&&we.has(t.toLowerCase())?[t,...e.slice(1).map(W)]:e.every(e=>Array.isArray(e))?e.map(W):e}function W(e){if(Array.isArray(e))return e.length>0?U(e):e;if(e&&typeof e==`object`&&e.field!==void 0){let t=xe(e);if(t)return t}return e}function Te(e){if(e!=null){if(Array.isArray(e))return e.length===0?void 0:U(e);if(typeof e==`object`)return Object.keys(e).length===0?void 0:f(e)}}function Ee(e){if(e==null)return;if(typeof e==`string`){let t=e.trim();return t.length>0?t:void 0}let t=(e,t)=>String(t).toLowerCase()===`desc`?`-${e}`:e;if(Array.isArray(e)){let n=e.map(e=>typeof e==`string`?e.trim():t(e.field,e.order)).filter(e=>e.length>0);return n.length>0?n.join(`,`):void 0}if(typeof e==`object`){let n=Object.entries(e).map(([e,n])=>t(e,n));return n.length>0?n.join(`,`):void 0}}var G=new Map;async function De(e,t){let n=e||`<default>`,r=G.get(n);if(r)return r;let i=t().catch(e=>{throw G.delete(n),e});return G.set(n,i),i}function Oe(e){let t=e?.capabilities;if(!t||typeof t!=`object`)return;let n=t.transactionalBatch;if(typeof n==`boolean`)return n;if(n&&typeof n==`object`&&typeof n.enabled==`boolean`)return n.enabled}function K(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.httpStatus===404||t.status===404||t.statusCode===404||T({code:typeof t.code==`string`?t.code:``},[`OBJECT_NOT_FOUND`,`RECORD_NOT_FOUND`])}var ke=[`OBJECT_API_DISABLED`,`OBJECT_API_METHOD_NOT_ALLOWED`];function Ae(e){return T(e,ke)}var je=`PERMISSION_DENIED`;function Me(e){return w(e,je)}var q=`manage_metadata`,Ne=class extends Error{code=`VIEW_CONFIG_PERMISSION_DENIED`;capability=q;objectName;viewId;constructor(e,t){super(`View configuration is shared: changing "${t}" changes it for everyone who uses this view. That requires the "${q}" capability, which this session does not hold.`),this.name=`ViewConfigPermissionDeniedError`,this.objectName=e,this.viewId=t}};function Pe(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.code===`VIEW_CONFIG_PERMISSION_DENIED`||t.name===`ViewConfigPermissionDeniedError`}var Fe=class extends Error{code=`ANALYTICS_NOT_INSTALLED`;surface;serverCode;constructor(e,t,n){super(`Analytics capability is not installed on this deployment — ${e} is unavailable. Install @objectstack/service-analytics and mount AnalyticsServicePlugin to enable it.`+(t?` (server said: ${t})`:``)),this.name=`AnalyticsNotInstalledError`,this.surface=e,this.serverCode=n}},Ie=class extends Error{code=`ANALYTICS_DATASET_NOT_FOUND`;datasetName;serverCode;serverMessage;constructor(e){let t=e.datasetName?`Dataset "${e.datasetName}"`:`The requested dataset`;super(`${t} is not defined in this environment — the app that defines it is missing or out of date. Analytics itself is installed and answering, so the fix is to upgrade the installed app, not to install a server plugin.`+(e.serverMessage?` (server said: ${e.serverMessage})`:``)),this.name=`AnalyticsDatasetNotFoundError`,this.datasetName=e.datasetName,this.serverCode=e.serverCode,this.serverMessage=e.serverMessage}},J=class extends Error{code=`ANALYTICS_UNAUTHENTICATED`;serverCode;serverMessage;constructor(e={}){super(`Analytics query refused: this session is not authenticated. Sign in again and retry — the request was refused before it ran, so it says nothing about whether the analytics capability is installed.`+(e.serverMessage?` (server said: ${e.serverMessage})`:``)),this.name=`AnalyticsUnauthenticatedError`,this.serverCode=e.serverCode,this.serverMessage=e.serverMessage}};function Le(e){if(!e||typeof e!=`object`)return{};let t=e,n=(t.error&&typeof t.error==`object`?t.error:void 0)??t;return{code:typeof n.code==`string`&&n.code.length>0?n.code:void 0,message:typeof n.message==`string`&&n.message.length>0?n.message:typeof t.error==`string`&&t.error.length>0?t.error:void 0}}var Re=[404,501],ze=class extends Error{code=`ANALYTICS_QUERY_REJECTED`;serverCode;constructor(e,t){super(`Analytics rejected the query: ${e??`the request body does not match the AnalyticsQuery contract`}`),this.name=`AnalyticsQueryRejectedError`,this.serverCode=t}};function Be(e){let t=e??{},n=typeof t.code==`string`&&t.code.length>0?t.code:void 0,r=typeof t.message==`string`?t.message:void 0,i=typeof t.httpStatus==`number`?t.httpStatus:typeof t.status==`number`?t.status:typeof t.statusCode==`number`?t.statusCode:void 0;if(T({code:n},[`NOT_IMPLEMENTED`,`ROUTE_NOT_FOUND`]))return{kind:`not-installed`,code:n,message:r};if(w({code:n},`VALIDATION_FAILED`))return{kind:`rejected`,code:n,message:r};if(w({code:n},`UNAUTHENTICATED`))return{kind:`unauthenticated`,code:n,message:r};if(w({code:n},`CUBE_NOT_FOUND`))return{kind:`cube-not-found`,code:n,message:r};if(n===void 0){if(i!==void 0&&Re.includes(i))return{kind:`not-installed`,code:n,message:r};if(i===400)return{kind:`rejected`,code:n,message:r};if(i===401)return{kind:`unauthenticated`,code:n,message:r}}return{kind:`unknown`,code:n,message:r}}var Ve=class extends Error{code=`CONCURRENT_UPDATE`;httpStatus=409;currentVersion;currentRecord;userMessage;constructor(e){super(e.message??`Record was modified by another user`),this.name=`ConcurrentUpdateError`,this.currentVersion=e.currentVersion,this.currentRecord=e.currentRecord,this.userMessage=e.userMessage??null}};function He(e,t){return typeof e.userMessage==`string`&&e.userMessage.trim()?e.userMessage:typeof t.userMessage==`string`&&t.userMessage.trim()?t.userMessage:null}function Y(e){if(!e||typeof e!=`object`)return e;let t=e,n=t.details??{},r=He(t,n);if(t.code===`VALIDATION_FAILED`||t.name===`ValidationError`){let e=Array.isArray(n.fields)?n.fields:Array.isArray(t.fields)?t.fields:[],i=e.map(e=>{let t=e??{},n=typeof t.field==`string`?t.field:void 0;return n?{field:n,message:typeof t.message==`string`&&t.message.trim()?t.message:typeof t.code==`string`?t.code:``}:null}).filter(e=>e!==null);return new H(typeof t.message==`string`?t.message:`Validation failed`,i[0]?.field,i,r===null?{fields:e}:{fields:e,userMessage:r})}return t.code===`CONCURRENT_UPDATE`?new Ve({currentVersion:typeof n.currentVersion==`string`?n.currentVersion:null,currentRecord:n.currentRecord??null,message:typeof t.message==`string`?t.message:void 0,userMessage:r}):e}function X(e,t){if(!t||typeof t!=`object`)return null;let n=typeof t.method==`string`&&t.method?t.method:void 0,r=typeof t.url==`string`&&t.url?t.url:void 0,i=typeof t.status==`number`?t.status:typeof t.statusCode==`number`?t.statusCode:void 0;if(!n&&!r&&i===void 0)return null;let a=t.error&&typeof t.error==`object`?t.error:void 0,o=typeof t.code==`string`&&t.code||(a&&typeof a.code==`string`?a.code:void 0),s=[n??`GET`,r??`<unknown url>`];return s.push(`-> ${i??`no status`}`),o&&s.push(`[${o}]`),`${e}: ${s.join(` `)}`}function Ue(){let e=e=>{if(!e||typeof e!=`object`)return!1;if(e.status===404||e.statusCode===404)return!0;let t=e.error;if(t&&typeof t==`object`){let e=t.code;if(T({code:e},[`OBJECT_NOT_FOUND`,`RECORD_NOT_FOUND`]))return!0}return!1},t={debug:(e,t)=>console.debug(e,t??``),info:(e,t)=>console.info(e,t??``),warn:(e,t)=>console.warn(e,t??``),error:(t,n,r)=>{if(e(r)){console.debug(`[ObjectStack] ${X(t,r)??t} (suppressed expected 404)`,r);return}console.error(X(t,r)??t,n??``,r??``)},fatal:(e,t,n)=>console.error(X(e,n)??e,t??``,n??``),log:(e,...t)=>console.log(e,...t),child:()=>t,withTrace:()=>t};return t}var We=new Set(a.shape.reason.options),Ge=`objectui:unrecognized-drop-reason`;function Ke(e){return We.has(e)}function Z(e){return!!e&&typeof e==`object`&&Array.isArray(e.fields)&&e.fields.some(e=>typeof e==`string`)}function qe(e,t){let n=e.fields.filter(e=>typeof e==`string`),r=typeof e.object==`string`?e.object:t;return Ke(e.reason)?{...e,object:r,fields:n,reason:e.reason}:{...e,object:r,fields:n,reason:Ge,unrecognizedReason:e.reason}}var Je=``;function Q(e){if(typeof e!=`object`||!e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(Q).join(`,`)}]`;let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${Q(t[e])}`).join(`,`)}}`}function Ye(e,t){if(e===t)return!0;let n=e==null,r=t==null;return n||r?n&&r:Q(e)===Q(t)}function Xe(e,t,n){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e;let r=[];for(let i of e){let e=i.fields.filter(e=>!Object.prototype.hasOwnProperty.call(t,e)||!Object.prototype.hasOwnProperty.call(n,e)||!Ye(t[e],n[e]));e.length>0&&r.push({...i,fields:e})}return r}function Ze(e){let t=e?.list??e;return t?.data?.object??t?.object??t?.objectName}var $=`_isOverride`;function Qe(e,t){return t&&t.config&&typeof t.config==`object`?!1:(e?.viewKind??t?.viewKind)===`list`}function $e(e,t){return e?.[$]===!0||t?.[$]===!0||Qe(e,t)}var et=Object.freeze([`rowHeight`,`sort`,`hiddenFields`,`columnState`,`inlineEdit`]),tt=Object.freeze([`name`,`object`,`viewKind`,$]);function nt(e){if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e;if(!$e(t,t.list??t))return e;let n={};for(let e of tt)t[e]!==void 0&&(n[e]=t[e]);for(let e of et)t[e]!==void 0&&(n[e]=t[e]);return n}function rt(e){if(!e||typeof e!=`object`)return null;let t=e,n=`item`in t?t.item:t;if(!n||typeof n!=`object`)return null;let r=n.list??n;return!r||typeof r!=`object`?null:Object.keys(r).length>0?r:null}function it(e){let t=e??void 0;return{removed:!!(t?.deleted??t?.reset??!0),...typeof t?.reset==`boolean`?{reset:t.reset}:{},...typeof t?.message==`string`?{message:t.message}:{}}}function at(e,t,n,r){return{...e,...t,name:n,object:e?.object||e?.data?.object||r}}var ot=class{client;connected=!1;connectPromise=null;metadataCache;connectionState=`disconnected`;connectionStateListeners=[];batchProgressListeners=[];autoReconnect;maxReconnectAttempts;reconnectDelay;reconnectAttempts=0;baseUrl;token;analyticsCapabilityWarned=!1;fetchImpl;inflightFinds=new Map;missingResources=new Set;batchUnsupported=!1;atomicBatchCapability;mutationListeners=new Set;writeWarningListeners=new Set;saveAdvisoryListeners=new Set;systemCapabilities;constructor(e){this.client=new re.ObjectStackClient({...e,logger:Ue()}),this.installSaveAdvisoryInterceptor(),this.metadataCache=new ue(e.cache),this.autoReconnect=e.autoReconnect??!0,this.maxReconnectAttempts=e.maxReconnectAttempts??3,this.reconnectDelay=e.reconnectDelay??1e3,this.baseUrl=e.baseUrl,this.token=e.token,this.systemCapabilities=e.systemCapabilities,this.fetchImpl=e.fetch||globalThis.fetch.bind(globalThis)}async connect(){if(!this.connected)return this.connectPromise?this.connectPromise:(this.setConnectionState(`connecting`),this.connectPromise=(async()=>{try{let e=this.baseUrl||``,t=e?`${e.replace(/\/$/,``)}/api/v1/discovery`:`/api/v1/discovery`,n=await De(e,async()=>{let e=await this.fetchImpl(t,{method:`GET`,headers:this.token?{Authorization:`Bearer ${this.token}`}:void 0});if(!e.ok)throw Error(`discovery ${e.status} ${e.statusText}`);let n=await e.json();return n&&typeof n.success==`boolean`&&`data`in n?n.data:n});this.client.discoveryInfo=n,this.atomicBatchCapability=Oe(n),this.connected=!0,this.reconnectAttempts=0,this.setConnectionState(`connected`)}catch(e){let t=new B(e instanceof Error?e.message:`Failed to connect to ObjectStack server`,void 0,{originalError:e});if(this.setConnectionState(`error`,t),this.autoReconnect&&this.reconnectAttempts<this.maxReconnectAttempts)await this.attemptReconnect();else throw t}finally{this.connectPromise=null}})(),this.connectPromise)}async attemptReconnect(){this.reconnectAttempts++,this.setConnectionState(`reconnecting`);let e=this.reconnectDelay*2**(this.reconnectAttempts-1);await new Promise(t=>setTimeout(t,e)),this.connected=!1,await this.connect()}getConnectionState(){return this.connectionState}isConnected(){return this.connected&&this.connectionState===`connected`}onConnectionStateChange(e){return this.connectionStateListeners.push(e),()=>{let t=this.connectionStateListeners.indexOf(e);t>-1&&this.connectionStateListeners.splice(t,1)}}onBatchProgress(e){return this.batchProgressListeners.push(e),()=>{let t=this.batchProgressListeners.indexOf(e);t>-1&&this.batchProgressListeners.splice(t,1)}}setConnectionState(e,t){this.connectionState=e;let n={state:e,timestamp:Date.now(),error:t};this.connectionStateListeners.forEach(e=>{try{e(n)}catch(e){console.error(`Error in connection state listener:`,e)}})}emitBatchProgress(e){this.batchProgressListeners.forEach(t=>{try{t(e)}catch(e){console.error(`Error in batch progress listener:`,e)}})}async find(e,t){if(this.missingResources.has(e))return{data:[],total:0};let n=`${e}::${Q(t)}`,r=this.inflightFinds.get(n);if(r)return r;let i=(async()=>{if(await this.connect(),t?.$expand&&t.$expand.length>0||t?.$search!=null&&String(t.$search).trim()!==``){let n=await this.rawFindWithPopulate(e,t);return this.normalizeQueryResult(n,t)}let n=this.convertQueryParams(t);try{let r=await this.client.data.find(e,n);return this.normalizeQueryResult(r,t)}catch(t){if(!Ae(t)&&K(t))return this.missingResources.add(e),{data:[],total:0};throw t}})();this.inflightFinds.set(n,i);let a=()=>{this.inflightFinds.get(n)===i&&this.inflightFinds.delete(n)};return i.then(a,a),i}async searchAll(e,t){let n=(e??``).trim();if(n===``)return{query:``,hits:[]};await this.connect();let r=new URLSearchParams;r.set(`q`,n),t?.limit!=null&&t.limit>0&&r.set(`limit`,String(t.limit)),t?.objects&&t.objects.length>0&&r.set(`objects`,t.objects.join(`,`));let i=(this.baseUrl||``).replace(/\/$/,``),a=`${i}${/\/api\/v\d+$/i.test(i)?`/search`:`/api/v1/search`}?${r.toString()}`,o={"Content-Type":`application/json`};this.token&&(o.Authorization=`Bearer ${this.token}`);let s=await this.fetchImpl(a,{method:`GET`,headers:o});if(!s.ok){if(s.status===404)return{query:n,hits:[]};let e=await s.json().catch(()=>({message:s.statusText})),t=Error(e?.error?.message||e?.message||s.statusText);throw t.status=s.status,t}let c=await s.json(),l=c&&typeof c==`object`&&typeof c.success==`boolean`&&`data`in c?c.data:c,u=Array.isArray(l?.hits)?l.hits:Array.isArray(l)?l:[],d=[];for(let e of u){if(!e||typeof e!=`object`)continue;let t=e,n=t.object??t.objectName??t.object_name,r=t.id??t.record?.id??t.record?._id;typeof n==`string`&&r!=null&&d.push({object:n,id:String(r),title:typeof t.title==`string`?t.title:void 0,snippet:typeof t.snippet==`string`?t.snippet:void 0,record:t.record&&typeof t.record==`object`?t.record:void 0})}return{query:typeof l?.query==`string`?l.query:n,hits:d}}async findOne(e,t,n){if(await this.connect(),n?.$expand&&n.$expand.length>0)try{let r={...n,$filter:{id:String(t)},$top:1},i=await this.rawFindWithPopulate(e,r);if(Array.isArray(i))return i[0]||null;let a=i;return(a.records||a.value||[])[0]||null}catch(e){if(K(e))return null}try{return(await this.client.data.get(e,String(t))).record}catch(e){if(K(e))return null;throw e}}emitMutation(e){for(let t of this.mutationListeners)try{t(e)}catch(e){console.warn(`ObjectStackAdapter: mutation listener error`,e)}}onMutation(e){return this.mutationListeners.add(e),()=>{this.mutationListeners.delete(e)}}emitWriteWarning(e){for(let t of this.writeWarningListeners)try{t(e)}catch(e){console.warn(`ObjectStackAdapter: write-warning listener error`,e)}}notifyDroppedFields(e,t,n,r,i){let a=n?.droppedFields;if(!Array.isArray(a)||a.length===0)return;let o=a.filter(Z).map(e=>qe(e,t)),s=n?.record,c=Xe(o,i,s);c.length!==0&&this.emitWriteWarning({operation:e,resource:t,...r===void 0?{}:{id:r},droppedFields:c})}notifyBatchDroppedFields(e,t){let n=t?.droppedFields;if(!Array.isArray(n)||n.length===0)return;let r=t?.results;for(let t of n){if(!Z(t))continue;let n=t,i=typeof n.index==`number`?e[n.index]:void 0,a=typeof n.object==`string`?n.object:typeof i?.object==`string`?i.object:Je,o=typeof n.index==`number`&&Array.isArray(r)?r[n.index]:void 0,[s]=Xe([qe({fields:n.fields,reason:n.reason},a)],i?.data,o);if(!s)continue;let c=(i?.action??`create`)===`create`?`create`:`update`;this.emitWriteWarning({operation:c,resource:a,...i?.id!==void 0&&i?.id!==null?{id:i.id}:{},droppedFields:[s]})}}onWriteWarning(e){return this.writeWarningListeners.add(e),()=>{this.writeWarningListeners.delete(e)}}onSaveAdvisory(e){return this.saveAdvisoryListeners.add(e),()=>{this.saveAdvisoryListeners.delete(e)}}emitSaveAdvisory(e){for(let t of this.saveAdvisoryListeners)try{t(e)}catch(e){console.warn(`ObjectStackAdapter: save-advisory listener error`,e)}}installSaveAdvisoryInterceptor(){let e=this.client.meta,t=e.saveItem.bind(e);e.saveItem=async(e,n,r)=>{let i=await t(e,n,r);try{let t=ie(i);t.length>0&&this.emitSaveAdvisory({type:e,name:n,door:`save`,mode:i?.state===`draft`?`draft`:`publish`,advisories:t})}catch(e){console.warn(`ObjectStackAdapter: save-advisory read error`,e)}return i}}async create(e,t){await this.connect();try{let n=await this.client.data.create(e,t);return this.emitMutation({type:`create`,resource:e,record:{...n.record}}),this.notifyDroppedFields(`create`,e,n,n.record?.id,t),n.record}catch(e){throw Y(e)}}async update(e,t,n,r){await this.connect();try{let i=await this.client.data.update(e,String(t),n,r?.ifMatch?{ifMatch:r.ifMatch}:void 0);return this.emitMutation({type:`update`,resource:e,id:t,record:{...i.record}}),this.notifyDroppedFields(`update`,e,i,t,n),i.record}catch(e){throw Y(e)}}async delete(e,t,n){await this.connect();try{let r=await this.client.data.delete(e,String(t),n?.ifMatch?{ifMatch:n.ifMatch}:void 0);return r.success&&this.emitMutation({type:`delete`,resource:e,id:t}),r.success}catch(e){throw Y(e)}}async bulkUpdate(e,t,n){if(await this.connect(),!t||t.length===0)return 0;let r=t.map(e=>({id:String(e),data:n})),i=t=>(t>0&&this.emitMutation({type:`update`,resource:e}),t),a=this.client.data.updateMany;if(typeof a==`function`)try{let n=await a(e,r,{continueOnError:!0});return n&&typeof n==`object`&&typeof n.succeeded==`number`?i(n.succeeded):i(Array.isArray(n)?n.length:t.length)}catch(e){throw Y(e)}let o=0;for(let r of t)try{await this.client.data.update(e,String(r),n),o++}catch{}return i(o)}async bulkDelete(e,t){if(await this.connect(),!t||t.length===0)return 0;let n=t.map(e=>String(e)),r=t=>(t>0&&this.emitMutation({type:`delete`,resource:e}),t),i=this.client.data.deleteMany;if(typeof i==`function`)try{let t=await i(e,n,{continueOnError:!0});return t&&typeof t==`object`&&typeof t.succeeded==`number`?r(t.succeeded):r(Array.isArray(t)?t.length:n.length)}catch(e){throw Y(e)}let a=0;for(let t of n)try{await this.client.data.delete(e,t),a++}catch{}return r(a)}async batchTransaction(e){await this.connect();let t=this.atomicBatchCapability===!0;if(!t&&this.batchUnsupported)return O(this,e);try{let t=await this.client.data.batchTransaction(e);return this.emitBatchMutations(e,t?.results),this.notifyBatchDroppedFields(e,t),t}catch(n){let r=this.errorStatusOf(n);if(!t&&this.batchStatusUnsupported(r))return this.fallbackToEmulation(e,r);throw n}}batchStatusUnsupported(e){return e===404||e===405||e===501}errorStatusOf(e){if(!e||typeof e!=`object`)return;let t=e,n=t.httpStatus??t.status??t.statusCode;return typeof n==`number`?n:void 0}fallbackToEmulation(e,t){return this.batchUnsupported||(this.batchUnsupported=!0,console.warn(`ObjectStackAdapter: POST /api/v1/batch unavailable (HTTP ${t??`?`}) — falling back to non-atomic client-side batch emulation. Cross-object saves on this backend are best-effort, not transactional.`)),O(this,e)}emitBatchMutations(e,t){let n=Array.isArray(t)?t:[];e.forEach((e,t)=>{let r=e.action??`create`,i=n[t];r===`create`?this.emitMutation({type:`create`,resource:e.object,record:i}):r===`update`?this.emitMutation({type:`update`,resource:e.object,id:e.id??i?.id??i?._id,record:i}):r===`delete`&&this.emitMutation({type:`delete`,resource:e.object,id:e.id})})}async bulk(e,t,n){if(await this.connect(),!n||n.length===0)return[];let r=n.length,i=0,a=0,o=()=>{this.emitBatchProgress({operation:t,total:r,completed:i,failed:a,percentage:r>0?(i+a)/r*100:0})};try{switch(t){case`create`:{o();let t=await this.client.data.createMany(e,n);return i=t.length,a=r-i,o(),i>0&&this.emitMutation({type:`create`,resource:e}),t}case`delete`:{let t=n.map(e=>e.id).filter(Boolean);if(t.length===0){let e=n.map((e,t)=>({index:t,error:`Missing ID for item at index ${t}`}));throw a=n.length,o(),new z(`delete`,0,n.length,e)}return o(),await this.client.data.deleteMany(e,t),i=t.length,a=r-i,o(),i>0&&this.emitMutation({type:`delete`,resource:e}),[]}case`update`:{if(typeof this.client.data.updateMany==`function`)try{o();let t=this.client.data.updateMany,s=await t(e,n);return i=s.length,a=r-i,o(),i>0&&this.emitMutation({type:`update`,resource:e}),s}catch{}let t=[],s=[];for(let r=0;r<n.length;r++){let c=n[r],l=c.id;if(!l){s.push({index:r,error:`Missing ID`}),a++,o();continue}try{let n=await this.client.data.update(e,String(l),c);t.push(n.record),i++,o()}catch(e){let t=e instanceof Error?e.message:String(e);s.push({index:r,error:t}),a++,o()}}if(i>0&&this.emitMutation({type:`update`,resource:e}),s.length>0)throw new z(`update`,t.length,s.length,s,{resource:e,totalRecords:n.length});return t}default:throw new R(`Unsupported bulk operation: ${t}`,`UNSUPPORTED_OPERATION`,400)}}catch(r){if(o(),r instanceof z||r instanceof R)throw r;let i=r instanceof Error?r.message:String(r),a=n.map((e,t)=>({index:t,error:i}));throw new z(t,0,n.length,a,{resource:e,originalError:r})}}async importRecords(e,t){await this.connect();let n=this.client.data.import;if(typeof n!=`function`)throw new R(`The connected @objectstack/client does not support data.import(). Upgrade the client, or import via a per-row create fallback.`,`UNSUPPORTED_OPERATION`,400);try{return await n.call(this.client.data,e,t)}catch(e){throw Y(e)}}importJobApi(){let e=this.client.data;if(typeof e.createImportJob==`function`)return e}async createImportJob(e,t){await this.connect();let n=this.importJobApi();if(!n)throw new R(`The connected @objectstack/client does not support async import jobs (data.createImportJob). Upgrade the client, or use the synchronous importRecords() path.`,`UNSUPPORTED_OPERATION`,400);try{return await n.createImportJob.call(this.client.data,e,t)}catch(e){throw Y(e)}}async getImportJobProgress(e){await this.connect();let t=this.importJobApi();if(!t)throw new R(`The connected @objectstack/client does not support async import jobs.`,`UNSUPPORTED_OPERATION`,400);try{return await t.getImportJobProgress.call(this.client.data,e)}catch(e){throw Y(e)}}async getImportJobResults(e){await this.connect();let t=this.importJobApi();if(!t)throw new R(`The connected @objectstack/client does not support async import jobs.`,`UNSUPPORTED_OPERATION`,400);try{return await t.getImportJobResults.call(this.client.data,e)}catch(e){throw Y(e)}}async listImportJobs(e={}){await this.connect();let t=this.importJobApi();if(!t)throw new R(`The connected @objectstack/client does not support async import jobs.`,`UNSUPPORTED_OPERATION`,400);try{return await t.listImportJobs.call(this.client.data,e)}catch(e){throw Y(e)}}async cancelImportJob(e){await this.connect();let t=this.importJobApi();if(!t)throw new R(`The connected @objectstack/client does not support async import jobs.`,`UNSUPPORTED_OPERATION`,400);try{await t.cancelImportJob.call(this.client.data,e)}catch(e){throw Y(e)}}async undoImportJob(e){await this.connect();let t=this.importJobApi();if(!t||typeof t.undoImportJob!=`function`)throw new R(`The connected @objectstack/client does not support undoing import jobs (data.undoImportJob).`,`UNSUPPORTED_OPERATION`,400);try{return await t.undoImportJob.call(this.client.data,e)}catch(e){throw Y(e)}}normalizeQueryResult(e,t){if(Array.isArray(e))return{data:e,total:e.length,page:1,pageSize:e.length,hasMore:!1};let n=e,r=n.records||n.value||[],i=n.total??n.count??r.length,a=typeof n.hasMore==`boolean`?n.hasMore:t?.$top?r.length===t.$top:!1;return{data:r,total:i,page:t?.$skip&&t.$top?Math.floor(t.$skip/t.$top)+1:1,pageSize:t?.$top,hasMore:a}}async rawFindWithPopulate(e,t){let n=new URLSearchParams;if(t.$expand&&t.$expand.length>0&&n.set(`populate`,t.$expand.join(`,`)),t.$top!==void 0&&n.set(`top`,String(t.$top)),t.$skip!==void 0&&n.set(`skip`,String(t.$skip)),t.$search!=null&&String(t.$search).trim()!==``&&n.set(`search`,String(t.$search).trim()),t.$searchFields&&t.$searchFields.length>0&&n.set(`searchFields`,t.$searchFields.join(`,`)),t.$select&&t.$select.length>0){let e=t.$select.includes(`id`)?t.$select:[`id`,...t.$select];n.set(`select`,e.join(`,`))}let r=Ee(t.$orderby);if(r&&n.set(`sort`,r),t.$filter!==void 0&&t.$filter!==null){let e=Te(t.$filter);e!==void 0&&n.set(`filter`,JSON.stringify(e))}let i=this.baseUrl.replace(/\/$/,``),a=n.toString(),o=`${i}${/\/api\/v\d+$/i.test(i)?`/data`:`/api/v1/data`}/${e}${a?`?${a}`:``}`,s={"Content-Type":`application/json`};this.token&&(s.Authorization=`Bearer ${this.token}`);let c=await this.fetchImpl(o,{method:`GET`,headers:s});if(!c.ok){let e=await c.json().catch(()=>({message:c.statusText})),t=Error(e?.error?.message||e?.message||c.statusText);throw t.status=c.status,t.code=e?.code??e?.error?.code,t.httpStatus=c.status,t}let l=await c.json();return l&&typeof l.success==`boolean`&&`data`in l?l.data:l}async exportDownload(e,t={}){let n=new URLSearchParams,r=t.format===`xlsx`?`xlsx`:t.format===`json`?`json`:`csv`;if(n.set(`format`,r),t.fields&&t.fields.length>0&&n.set(`fields`,t.fields.join(`,`)),t.limit&&t.limit>0&&n.set(`limit`,String(t.limit)),t.includeHeaders===!1&&n.set(`header`,`false`),t.sort&&t.sort.length>0){let e=t.sort.filter(e=>e&&e.field).map(e=>`${e.field}:${e.direction===`desc`?`desc`:`asc`}`).join(`,`);e&&n.set(`orderby`,e)}if(t.filter!==void 0&&t.filter!==null){let e=Te(t.filter);e!==void 0&&n.set(`filter`,JSON.stringify(e))}let i=typeof t.search==`string`?t.search.trim():``;i&&(n.set(`search`,i),t.searchFields&&t.searchFields.length>0&&n.set(`searchFields`,t.searchFields.join(`,`)));let a=this.baseUrl.replace(/\/$/,``),o=`${a}${/\/api\/v\d+$/i.test(a)?`/data`:`/api/v1/data`}/${encodeURIComponent(e)}/export?${n.toString()}`,s={...this.getAuthHeaders()},c=await this.fetchImpl(o,{method:`GET`,headers:s,credentials:`include`});if(!c.ok){let e=await c.json().catch(()=>({message:c.statusText})),t=Error(e?.error?.message||e?.message||c.statusText);throw t.status=c.status,t}return await c.blob()}convertQueryParams(e){if(!e)return{};let t={};e.$select&&(t.select=e.$select.includes(`id`)?e.$select:[`id`,...e.$select]),e.$filter!==void 0&&e.$filter!==null&&((Array.isArray(e.$filter)?e.$filter.length===0:typeof e.$filter==`object`&&Object.keys(e.$filter).length===0)||(t.filters=Array.isArray(e.$filter)?U(e.$filter):f(e.$filter)));let n=Ee(e.$orderby);return n&&(t.sort=n),e.$skip!==void 0&&(t.skip=e.$skip),e.$top!==void 0&&(t.top=e.$top),e.$search!=null&&String(e.$search).trim()!==``&&(t.search=String(e.$search).trim()),e.$searchFields&&e.$searchFields.length>0&&(t.searchFields=e.$searchFields),t}async getObjectSchema(e){await this.connect();try{let t=await this.metadataCache.get(e,()=>this.fetchObjectSchemaFresh(e));return ee(t),this.applyFieldWidgetOverrides(e,t),t}catch(t){let n=t;throw K(n)?new de(e,{originalError:t}):t instanceof R?t:fe(n,`getObjectSchema(${e})`)}}applyFieldWidgetOverrides(e,t){let n={sys_permission_set:{object_permissions:`permission-facet-link`,field_permissions:`permission-facet-link`,system_permissions:`permission-facet-link`,row_level_security:`permission-facet-link`,tab_permissions:`permission-facet-link`,admin_scope:`permission-facet-link`}}[e],r=t&&typeof t==`object`?t.fields:null;if(!(!n||!r))for(let[e,t]of Object.entries(n))if(Array.isArray(r)){let n=r.find(t=>t?.name===e);n&&!n.widget&&(n.widget=t)}else{let n=r[e];n&&!n.widget&&(n.widget=t)}}async fetchObjectSchemaFresh(e){let t=(this.baseUrl||``).replace(/\/$/,``),n=`${t}${/\/api\/v\d+$/i.test(t)?`/meta`:`/api/v1/meta`}/object/${encodeURIComponent(e)}`,r={"Content-Type":`application/json`};this.token&&(r.Authorization=`Bearer ${this.token}`);let i=await this.fetchImpl(n,{method:`GET`,headers:r,cache:`no-cache`});if(!i.ok){let e=await i.json().catch(()=>({message:i.statusText})),t=Error(e?.error?.message||e?.message||i.statusText);throw t.status=i.status,t}let a=await i.json(),o=a&&typeof a==`object`&&`success`in a&&`data`in a?a.data:a;return b(o&&typeof o==`object`&&`item`in o?o.item:o,o&&typeof o==`object`?o.sortability:void 0)}async getObjects(){try{await this.connect();let e=(this.baseUrl||``).replace(/\/$/,``),t=`${e}${/\/api\/v\d+$/i.test(e)?`/meta`:`/api/v1/meta`}/object`,n={"Content-Type":`application/json`};this.token&&(n.Authorization=`Bearer ${this.token}`);let r=await this.fetchImpl(t,{method:`GET`,headers:n});if(!r.ok)return[];let i=await r.json(),a=i&&typeof i==`object`&&`success`in i&&`data`in i?i.data:i;return(Array.isArray(a)?a:Array.isArray(a?.items)?a.items:[]).map(e=>({name:String(e?.name??``),label:e?.label==null?void 0:String(e.label)})).filter(e=>e.name)}catch{return[]}}getClient(){return this.client}async getDiscovery(){try{return await this.connect(),this.client.discoveryInfo||null}catch{return null}}invalidateViewKeys(e,t){this.metadataCache.invalidate?.(`view:${e}:${t}`),this.metadataCache.invalidate?.(`view-overrides:${e}`)}async listViewOverrides(e){await this.connect();let t=`view-overrides:${e}`;return await this.metadataCache.get(t,async()=>{let t=await this.client.meta.getItems(`view`),n=Array.isArray(t?.items)?t.items:Array.isArray(t)?t:[],r={};for(let t of n){if(!t||typeof t!=`object`||Ze(t)!==e)continue;let n=t.name;typeof n==`string`&&n&&(r[n]=t)}return r})}async getView(e,t){await this.connect();try{let n=`view:${e}:${t}`;return await this.metadataCache.get(n,async()=>{let e=await this.client.meta.getItem(`view`,t);return e&&e.item?e.item:e??null})}catch{return null}}setSystemCapabilities(e){this.systemCapabilities=e?[...e]:void 0}maySetViewConfig(){return this.systemCapabilities===void 0||this.systemCapabilities.includes(q)}async updateViewConfig(e,t,n,r){if(!this.maySetViewConfig())throw new Ne(e,t);await this.connect();let i={...n||{},object:n?.object||e,name:t,...r?.isSavedView?{}:{[$]:!0}},a=await this.client.meta.saveItem(`view`,t,i);return this.invalidateViewKeys(e,t),a&&a.item?a.item:a??void 0}async listViews(e,t){await this.connect();try{let n;if(t?.previewDrafts){let e=await this.metadataClient().withPreviewDrafts(!0).list(`view`);n=Array.isArray(e)?e:[]}else{let e=await this.client.meta.getItems(`view`);n=Array.isArray(e?.items)?e.items:Array.isArray(e)?e:[]}let r=new Set([`form`,`detail`]);return n.filter(t=>{if(!t)return!1;let n=t.list??t;if(Ze(t)!==e)return!1;let i=t.viewKind??n?.viewKind;return!(i&&r.has(i)||$e(t,n))}).map(e=>{let t=e.list??e,n=e._draft===!0||t?._draft===!0;return t&&t.config&&typeof t.config==`object`?{...t.config,name:t.name??t.config.name,label:t.label??t.config.label,isDefault:!!t.isDefault,...n?{_draft:!0}:{}}:n?{...t,_draft:!0}:t})}catch(e){return console.warn(`[OBJECTSTACKDataSource] listViews failed:`,e),[]}}metadataClient(){return new le({baseUrl:this.baseUrl,fetch:this.fetchImpl,...this.token?{headers:{Authorization:`Bearer ${this.token}`}}:{}})}async listImportMappings(e){await this.connect();try{let t=await this.client.meta.getItems(`mapping`);return(Array.isArray(t?.items)?t.items:Array.isArray(t)?t:[]).filter(t=>t&&t.targetObject===e)}catch(e){return console.warn(`[OBJECTSTACKDataSource] listImportMappings failed:`,e),[]}}async createView(e,t){await this.connect();let n=String(t?.name||``).trim();if(!n){let r=String(t?.label||e||`view`).toLowerCase().replace(/[^a-z0-9_]+/g,`_`).replace(/^_+|_+$/g,``).slice(0,40);(!r||/^[0-9]/.test(r))&&(r=r?`view_${r}`:`view`);let i=Date.now().toString(36);n=`${r}_${i}`}let r={...t,name:n,object:t?.object||e,data:t?.data||{provider:`object`,object:e}},i=await this.client.meta.saveItem(`view`,n,r);return this.invalidateViewKeys(e,n),i&&i.item?i.item:r}async updateView(e,t,n){await this.connect();let r=this.metadataClient(),i=rt(await r.get(`view`,t,{state:`draft`}));if(i){let a=at(i,n,t,e);return await r.save(`view`,t,a,{mode:`draft`}),this.invalidateViewKeys(e,t),a}let a;try{let e=await this.client.meta.getItem(`view`,t);a=e&&(e.item||e)||{},a?.list&&(a=a.list)}catch(n){throw K(n)?Object.assign(Error(`updateView: view "${t}" not found on object "${e}" — no pending draft and no published overlay. Use createView() to create one.`),{cause:n}):n}let o=at(a,n,t,e),s=await this.client.meta.saveItem(`view`,t,o);return this.invalidateViewKeys(e,t),s&&s.item?s.item:o}async deleteView(e,t){await this.connect();let n=this.metadataClient();try{let r=it(await n.reset(`view`,t,{state:`draft`})),i;try{i=it(await n.reset(`view`,t))}catch(n){let i={deleted:!1,draft:r,published:{removed:!1}};throw Object.assign(Error(`deleteView: view "${t}" on object "${e}" is NOT fully removed — the draft home was ${r.removed?`discarded`:`already absent`}, but deleting the published overlay failed. The published row is still serving the view; retry the delete.`),{cause:n,outcome:i})}return{deleted:r.removed||i.removed,draft:r,published:i}}finally{this.invalidateViewKeys(e,t)}}async getApp(e){await this.connect();try{let t=`app:${e}`;return await this.metadataCache.get(t,async()=>{let t=await this.client.meta.getItem(`app`,e);return t&&t.item?t.item:t??null})}catch{return null}}async probeAppAccess(e){if(!e)return`unknown`;try{return await this.client.meta.getItem(`app`,e),`granted`}catch(e){return Me(e)?`denied`:`unknown`}}async getPage(e){await this.connect();try{let t=`page:${e}`;return await this.metadataCache.get(t,async()=>{let t=await this.client.meta.getItem(`page`,e);return t&&t.item?t.item:t??null})}catch{return null}}async updateDashboard(e,t){await this.connect();let n=await this.client.meta.saveItem(`dashboard`,e,t);return this.metadataCache.invalidate?.(`dashboards`),this.metadataCache.invalidate?.(`dashboard:${e}`),n&&n.item?n.item:n??void 0}async aggregate(e,t){if(await this.connect(),t!=null&&(Array.isArray(t.groupBy)||Array.isArray(t.aggregations)||t.where!==void 0)){let n={};Array.isArray(t.groupBy)&&(n.groupBy=t.groupBy),Array.isArray(t.aggregations)&&(n.aggregations=t.aggregations),t.where!==void 0&&(be(t.where,e),n.where=t.where),typeof t.limit==`number`&&(n.limit=t.limit);let r=await this.client.data.query(e,n);return Array.isArray(r)?r:Array.isArray(r?.records)?r.records:Array.isArray(r?.data)?r.data:[]}try{let n=t.function===`count`?`count`:`${t.field}_${t.function}`,r=this.aggregateValueKey(t),i={cube:e,measures:[n],dimensions:t.groupBy&&t.groupBy!==`_all`?[t.groupBy]:[]};t.filter&&(i.where=Array.isArray(t.filter)?U(t.filter):t.filter);let a=await this.client.analytics.query(i),o=Array.isArray(a)?a:a?.rows&&Array.isArray(a.rows)?a.rows:a?.data&&Array.isArray(a.data)?a.data:a?.data?.rows&&Array.isArray(a.data.rows)?a.data.rows:a?.results&&Array.isArray(a.results)?a.results:[];return o.length>0&&o.every(e=>e==null||!(n in e&&e[n]!=null||r in e&&e[r]!=null))?await this.aggregateViaFind(e,t):o.map(e=>{let t={...e};return n!==r&&n in t&&(t[r]=t[n],delete t[n]),t})}catch(n){let r=Be(n);if(r.kind===`rejected`)throw new ze(r.message,r.code);if(r.kind===`unauthenticated`)throw new J({serverCode:r.code,serverMessage:r.message});if(r.kind===`cube-not-found`)throw n;return r.kind===`not-installed`&&this.warnAnalyticsCapabilityOnce(r.message),await this.aggregateViaFind(e,t)}}async aggregateViaFind(e,t){let n=(await this.find(e,t.filter?{$filter:t.filter}:void 0)).data||[];return n.length===0?[]:this.aggregateClientSide(n,t)}warnAnalyticsCapabilityOnce(e){this.analyticsCapabilityWarned||(this.analyticsCapabilityWarned=!0,console.warn(`[OBJECTSTACKDataSource] analytics capability unavailable — aggregating client-side from a scoped find(). Numbers stay correct but the semantic layer (cubes, joins, server-side rollups) is off. Install @objectstack/service-analytics to enable it.`+(e?` Server said: ${e}`:``)))}async queryDataset(e,t){await this.connect();let n=`${(this.baseUrl||``).replace(/\/$/,``)}/api/v1/analytics/dataset/query`,r=typeof window<`u`&&new URLSearchParams(window.location.search).get(`preview`)===`draft`,i=typeof e==`string`?{datasetName:e,selection:t,...r?{previewDrafts:!0}:{}}:{dataset:e,selection:t,...r?{previewDrafts:!0}:{}},a=await this.fetchImpl(n,{method:`POST`,headers:{"Content-Type":`application/json`,...this.token?{Authorization:`Bearer ${this.token}`}:{}},body:JSON.stringify(i)});if(!a.ok){let t;try{t=await a.json()}catch{}let{code:n,message:r}=Le(t),i=r||(t===void 0?``:JSON.stringify(t)),o=`POST /analytics/dataset/query`,s=typeof e==`string`?e:typeof e?.name==`string`?String(e.name):void 0;if(T({code:n},[`NOT_IMPLEMENTED`,`ROUTE_NOT_FOUND`]))throw new Fe(o,r,n);if(w({code:n},`NOT_FOUND`))throw new Ie({datasetName:s,serverCode:n,serverMessage:r});if(w({code:n},`UNAUTHENTICATED`))throw new J({serverCode:n,serverMessage:r});if(n===void 0){if(Re.includes(a.status))throw new Fe(o,i||void 0);if(a.status===401)throw new J({serverMessage:r})}throw Error(`Dataset query failed: ${a.status} ${a.statusText}${i?` — ${i}`:``}`)}let o=await a.json(),s=o&&typeof o==`object`&&`success`in o&&`data`in o?o.data:o;return{rows:Array.isArray(s?.rows)?s.rows:Array.isArray(s)?s:[],fields:Array.isArray(s?.fields)?s.fields:[],object:typeof s?.object==`string`?s.object:void 0,dimensionFields:s?.dimensionFields&&typeof s.dimensionFields==`object`?s.dimensionFields:void 0,drillRawRows:Array.isArray(s?.drillRawRows)?s.drillRawRows:void 0,drillRanges:Array.isArray(s?.drillRanges)?s.drillRanges:void 0,totals:Array.isArray(s?.totals)?s.totals:void 0}}aggregateValueKey(e){return e.field||e.function||`count`}aggregateClientSide(e,t){let{field:n,function:r,groupBy:i}=t,a=this.aggregateValueKey(t),o={};for(let t of e){let e=String(t[i]??`Unknown`);o[e]||(o[e]=[]),o[e].push(t)}return Object.entries(o).map(([e,t])=>{let o=n?t.map(e=>Number(e[n])||0):[],s;switch(r){case`count`:s=t.length;break;case`avg`:s=o.length>0?o.reduce((e,t)=>e+t,0)/o.length:0;break;case`min`:s=o.length>0?Math.min(...o):0;break;case`max`:s=o.length>0?Math.max(...o):0;break;default:s=o.reduce((e,t)=>e+t,0)}return{[i]:e,[a]:s}})}async getItems(e,t){return await this.connect(),await Promise.all(t.map(async t=>{let n=`${e}:${t}`;return this.metadataCache.get(n,async()=>{let n=await this.client.meta.getItem(e,t);return n&&n.item?n.item:n})}))}getCached(e){return this.metadataCache.getCachedSync(e)}getCacheStats(){return this.metadataCache.getStats()}invalidateCache(e){this.metadataCache.invalidate(e)}clearCache(){this.metadataCache.clear()}async uploadFile(e,t,n){await this.connect();let r=new FormData;r.append(`file`,t),n?.recordId&&r.append(`recordId`,n.recordId),n?.fieldName&&r.append(`fieldName`,n.fieldName),n?.metadata&&r.append(`metadata`,JSON.stringify(n.metadata));let i=`${this.baseUrl}/api/data/${encodeURIComponent(e)}/upload`,a=await fetch(i,{method:`POST`,body:r,headers:{...this.getAuthHeaders()}});if(!a.ok)throw new R((await a.json().catch(()=>({message:a.statusText}))).message||`Upload failed with status ${a.status}`,`UPLOAD_ERROR`,a.status);return a.json()}async uploadFiles(e,t,n){await this.connect();let r=new FormData;t.forEach((e,t)=>{r.append(`files`,e,e.name||`file-${t}`)}),n?.recordId&&r.append(`recordId`,n.recordId),n?.fieldName&&r.append(`fieldName`,n.fieldName),n?.metadata&&r.append(`metadata`,JSON.stringify(n.metadata));let i=`${this.baseUrl}/api/data/${encodeURIComponent(e)}/upload`,a=await fetch(i,{method:`POST`,body:r,headers:{...this.getAuthHeaders()}});if(!a.ok)throw new R((await a.json().catch(()=>({message:a.statusText}))).message||`Upload failed with status ${a.status}`,`UPLOAD_ERROR`,a.status);return a.json()}async cancelPendingApproval(e,t){await this.connect();let n=`${this.baseUrl}/api/v1/approvals/requests?recordId=${encodeURIComponent(t)}&object=${encodeURIComponent(e)}`,r=await this.fetchImpl(n,{method:`GET`,headers:{"Content-Type":`application/json`,...this.getAuthHeaders()}});if(!r.ok)throw new R(`Failed to look up approval requests (status ${r.status})`,`APPROVAL_LOOKUP_FAILED`,r.status);let i=await r.json().catch(()=>({})),a=(Array.isArray(i)?i:i?.data??[]).find(e=>e?.status===`pending`||e?.status===`in_approval`);if(!a?.id)throw new R(`No pending approval request found for this record`,`NO_PENDING_REQUEST`,404);let o=`${this.baseUrl}/api/v1/approvals/requests/${encodeURIComponent(a.id)}/recall`,s=await this.fetchImpl(o,{method:`POST`,headers:{"Content-Type":`application/json`,...this.getAuthHeaders()},body:JSON.stringify({})});if(!s.ok){let e=await s.json().catch(()=>({}));throw new R(e?.error||e?.message||`Recall failed with status ${s.status}`,e?.code||`APPROVAL_RECALL_FAILED`,s.status)}let c=await s.json().catch(()=>({}));return{requestId:a.id,status:c?.data?.request?.status??`recalled`}}getAuthHeaders(){let e={};return this.token&&(e.Authorization=`Bearer ${this.token}`),e}};export{he as a,O as c,T as d,C as f,h as g,g as h,nt as i,k as l,x as m,Ae as n,le as o,S as p,Pe as r,ee as s,ot as t,w as u};
@@ -1,24 +0,0 @@
1
- import{at as e,c as t,ct as n,l as r,u as i}from"./vendor-charts-CY9WhhzX.js";import{n as a}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{t as o}from"./src-CVJP2nIc.js";import{D as s,H as c,K as l,U as u,a as d,b as f,c as p,f as m,v as h,w as g,y as _}from"./chunk-DU6HZSFF-BkY4hAzc.js";import{t as v}from"./chunk-CLGD4ZFX-BTkDISwp.js";import{t as y}from"./chunk-JWPE2WC7-DVXcaiue.js";import{n as b}from"./mermaid-parser.core-DUt1FNlO.js";import{i as x}from"./chunk-75Z2AOVW-CkSdnmiC.js";import{i as S,n as C}from"./chunk-P2QGCYS3-nx2-dM5t.js";import{t as w}from"./chunk-POPQ4Y6H-BxLOacOG.js";var T=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=u,this.getAccTitle=_,this.setDiagramTitle=l,this.getDiagramTitle=g,this.getAccDescription=h,this.setAccDescription=c}static{a(this,`TreeMapDB`)}getNodes(){return this.nodes}getConfig(){let e=m,t=f();return x({...e.treemap,...t.treemap??{}})}addNode(e,t){this.nodes.push(e),this.levels.set(e,t),t===0&&(this.outerNodes.push(e),this.root??=e)}getRoot(){return{name:``,children:this.outerNodes}}addClass(e,t){let n=this.classes.get(e)??{id:e,styles:[],textStyles:[]},r=t.replace(/\\,/g,`§§§`).replace(/,/g,`;`).replace(/§§§/g,`,`).split(`;`);r&&r.forEach(e=>{C(e)&&(n?.textStyles?n.textStyles.push(e):n.textStyles=[e]),n?.styles?n.styles.push(e):n.styles=[e]}),this.classes.set(e,n)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){d(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function E(e){if(!e.length)return[];let t=[],n=[];return e.forEach(e=>{let r={name:e.name,children:e.type===`Leaf`?void 0:[]};for(r.classSelector=e?.classSelector,e?.cssCompiledStyles&&(r.cssCompiledStyles=e.cssCompiledStyles),e.type===`Leaf`&&e.value!==void 0&&(r.value=e.value);n.length>0&&n[n.length-1].level>=e.level;)n.pop();if(n.length===0)t.push(r);else{let e=n[n.length-1].node;e.children?e.children.push(r):e.children=[r]}e.type!==`Leaf`&&n.push({node:r,level:e.level})}),t}a(E,`buildHierarchy`);var D=a((e,t)=>{y(e,t);let n=[];for(let n of e.TreemapRows??[])n.$type===`ClassDefStatement`&&t.addClass(n.className??``,n.styleText??``);for(let r of e.TreemapRows??[]){let e=r.item;if(!e)continue;let i=r.indent?parseInt(r.indent):0,a=O(e),o=e.classSelector?t.getStylesForClass(e.classSelector):[],s=o.length>0?o:void 0,c={level:i,name:a,type:e.$type,value:e.value,classSelector:e.classSelector,cssCompiledStyles:s};n.push(c)}let r=E(n),i=a((e,n)=>{for(let r of e)t.addNode(r,n),r.children&&r.children.length>0&&i(r.children,n+1)},`addNodesRecursively`);i(r,0)},`populate`),O=a(e=>e.name?String(e.name):``,`getItemName`),k={parser:{yy:void 0},parse:a(async e=>{try{let t=await b(`treemap`,e);o.debug(`Treemap AST:`,t);let n=k.parser?.yy;if(!(n instanceof T))throw Error(`parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);D(t,n)}catch(e){throw o.error(`Error parsing treemap:`,e),e}},`parse`)},A=10,j=10,M=25,N={draw:a((s,c,l,u)=>{let d=u.db,m=d.getConfig(),h=m.padding??A,g=d.getDiagramTitle(),_=d.getRoot(),{themeVariables:y}=f();if(!_)return;let b=g?30:0,x=v(c),C=m.nodeWidth?m.nodeWidth*j:960,T=m.nodeHeight?m.nodeHeight*j:500,E=C,D=T+b;x.attr(`viewBox`,`0 0 ${E} ${D}`),p(x,D,E,m.useMaxWidth);let O;try{let t=m.valueFormat||`,`;if(t===`$0,0`)O=a(t=>`$`+e(`,`)(t),`valueFormat`);else if(t.startsWith(`$`)&&t.includes(`,`)){let n=/\.\d+/.exec(t),r=n?n[0]:``;O=a(t=>`$`+e(`,`+r)(t),`valueFormat`)}else if(t.startsWith(`$`)){let n=t.substring(1);O=a(t=>`$`+e(n||``)(t),`valueFormat`)}else O=e(t)}catch(t){o.error(`Error creating format function:`,t),O=e(`,`)}let k=n().range([`transparent`,y.cScale0,y.cScale1,y.cScale2,y.cScale3,y.cScale4,y.cScale5,y.cScale6,y.cScale7,y.cScale8,y.cScale9,y.cScale10,y.cScale11]),N=n().range([`transparent`,y.cScalePeer0,y.cScalePeer1,y.cScalePeer2,y.cScalePeer3,y.cScalePeer4,y.cScalePeer5,y.cScalePeer6,y.cScalePeer7,y.cScalePeer8,y.cScalePeer9,y.cScalePeer10,y.cScalePeer11]),P=n().range([y.cScaleLabel0,y.cScaleLabel1,y.cScaleLabel2,y.cScaleLabel3,y.cScaleLabel4,y.cScaleLabel5,y.cScaleLabel6,y.cScaleLabel7,y.cScaleLabel8,y.cScaleLabel9,y.cScaleLabel10,y.cScaleLabel11]);g&&x.append(`text`).attr(`x`,E/2).attr(`y`,b/2).attr(`class`,`treemapTitle`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).text(g);let F=x.append(`g`).attr(`transform`,`translate(0, ${b})`).attr(`class`,`treemapContainer`),I=r(_).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),L=t().size([C,T]).paddingTop(e=>e.children&&e.children.length>0?M+j:0).paddingInner(h).paddingLeft(e=>e.children&&e.children.length>0?j:0).paddingRight(e=>e.children&&e.children.length>0?j:0).paddingBottom(e=>e.children&&e.children.length>0?j:0).round(!0)(I),R=L.descendants().filter(e=>e.children&&e.children.length>0),z=F.selectAll(`.treemapSection`).data(R).enter().append(`g`).attr(`class`,`treemapSection`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);z.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,M).attr(`class`,`treemapSectionHeader`).attr(`fill`,`none`).attr(`fill-opacity`,.6).attr(`stroke-width`,.6).attr(`style`,e=>e.depth===0?`display: none;`:``),z.append(`clipPath`).attr(`id`,(e,t)=>`clip-section-${c}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-12)).attr(`height`,M),z.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,(e,t)=>`treemapSection section${t}`).attr(`fill`,e=>k(e.data.name)).attr(`fill-opacity`,.6).attr(`stroke`,e=>N(e.data.name)).attr(`stroke-width`,2).attr(`stroke-opacity`,.4).attr(`style`,e=>{if(e.depth===0)return`display: none;`;let t=S({cssCompiledStyles:e.data.cssCompiledStyles});return t.nodeStyles+`;`+t.borderStyles.join(`;`)}),z.append(`text`).attr(`class`,`treemapSectionLabel`).attr(`x`,6).attr(`y`,M/2).attr(`dominant-baseline`,`middle`).text(e=>e.depth===0?``:e.data.name).attr(`font-weight`,`bold`).attr(`clip-path`,(e,t)=>`url(#clip-section-${c}-${t})`).attr(`style`,e=>e.depth===0?`display: none;`:`dominant-baseline: middle; font-size: 12px; fill:`+P(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+S({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).each(function(e){if(e.depth===0)return;let t=i(this),n=e.data.name;t.text(n);let r=e.x1-e.x0,a;a=m.showValues!==!1&&e.value?r-10-30-10-6:r-6-6;let o=Math.max(15,a),s=t.node();if(s.getComputedTextLength()>o){let e=n;for(;e.length>0;){if(e=n.substring(0,e.length-1),e.length===0){t.text(`...`),s.getComputedTextLength()>o&&t.text(``);break}if(t.text(e+`...`),s.getComputedTextLength()<=o)break}}}),m.showValues!==!1&&z.append(`text`).attr(`class`,`treemapSectionValue`).attr(`x`,e=>e.x1-e.x0-10).attr(`y`,M/2).attr(`text-anchor`,`end`).attr(`dominant-baseline`,`middle`).text(e=>e.value?O(e.value):``).attr(`font-style`,`italic`).attr(`style`,e=>e.depth===0?`display: none;`:`text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:`+P(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+S({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`));let B=L.leaves(),V=B.length>20,H=V?16:38,U=V?14:28,W=V?4:8,G=V?4:6,K=V?2:4,q=V?8:10,J=V?1:2,Y=F.selectAll(`.treemapLeafGroup`).data(B).enter().append(`g`).attr(`class`,(e,t)=>`treemapNode treemapLeafGroup leaf${t}${e.data.classSelector?` ${e.data.classSelector}`:``}x`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);Y.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,`treemapLeaf`).attr(`fill`,e=>e.parent?k(e.parent.data.name):k(e.data.name)).attr(`style`,e=>S({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr(`fill-opacity`,.3).attr(`stroke`,e=>e.parent?k(e.parent.data.name):k(e.data.name)).attr(`stroke-width`,3),Y.append(`clipPath`).attr(`id`,(e,t)=>`clip-${c}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-4)).attr(`height`,e=>Math.max(0,e.y1-e.y0-4)),Y.append(`text`).attr(`class`,`treemapLabel`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,e=>(e.y1-e.y0)/2).attr(`style`,e=>`text-anchor: middle; dominant-baseline: middle; font-size: ${H}px;fill:`+P(e.data.name)+`;`+S({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${c}-${t})`).text(e=>e.data.name).each(function(e){let t=i(this),n=e.x1-e.x0,r=e.y1-e.y0,a=t.node(),o=n-2*K,s=r-2*K;if(o<q||s<q){t.style(`display`,`none`);return}let c=parseInt(t.style(`font-size`),10),l=.6;for(;a.getComputedTextLength()>o&&c>W;)c--,t.style(`font-size`,`${c}px`);let u=Math.max(G,Math.min(U,Math.round(c*l))),d=c+J+u;for(;d>s&&c>W&&(c--,u=Math.max(G,Math.min(U,Math.round(c*l))),!(u<G&&c===W));)t.style(`font-size`,`${c}px`),d=c+J+u;t.style(`font-size`,`${c}px`),V?(c<W||s<W)&&t.style(`display`,`none`):(a.getComputedTextLength()>o||c<W||s<c)&&t.style(`display`,`none`)}),m.showValues!==!1&&Y.append(`text`).attr(`class`,`treemapValue`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,function(e){return(e.y1-e.y0)/2}).attr(`style`,e=>`text-anchor: middle; dominant-baseline: hanging; font-size: ${U}px;fill:`+P(e.data.name)+`;`+S({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${c}-${t})`).text(e=>e.value?O(e.value):``).each(function(e){let t=i(this),n=this.parentNode;if(!n){t.style(`display`,`none`);return}let r=i(n).select(`.treemapLabel`);if(r.empty()||r.style(`display`)===`none`){t.style(`display`,`none`);return}let a=parseFloat(r.style(`font-size`)),o=Math.max(G,Math.min(U,Math.round(a*.6)));t.style(`font-size`,`${o}px`);let s=(e.y1-e.y0)/2+a/2+J;t.attr(`y`,s);let c=e.x1-e.x0,l=e.y1-e.y0-4,u=c-2*K;t.node().getComputedTextLength()>u||s+o>l||o<G?t.style(`display`,`none`):t.style(`display`,null)});let X=m.diagramPadding??8;w(x,X,`flowchart`,m?.useMaxWidth||!1)},`draw`),getClasses:a(function(e,t){return t.db.getClasses()},`getClasses`)},P={sectionStrokeColor:`black`,sectionStrokeWidth:`1`,sectionFillColor:`#efefef`,leafStrokeColor:`black`,leafStrokeWidth:`1`,leafFillColor:`#efefef`,labelFontSize:`12px`,valueFontSize:`10px`,titleFontSize:`14px`},F={parser:k,get db(){return new T},renderer:N,styles:a(({treemap:e}={})=>{let t=s(),n=f(),r=x(t,n.themeVariables),i=x(P,e),a=i.titleColor??r.titleColor,o=i.labelColor??r.textColor,c=i.valueColor??r.textColor;return`
2
- .treemapNode.section {
3
- stroke: ${i.sectionStrokeColor};
4
- stroke-width: ${i.sectionStrokeWidth};
5
- fill: ${i.sectionFillColor};
6
- }
7
- .treemapNode.leaf {
8
- stroke: ${i.leafStrokeColor};
9
- stroke-width: ${i.leafStrokeWidth};
10
- fill: ${i.leafFillColor};
11
- }
12
- .treemapLabel {
13
- fill: ${o};
14
- font-size: ${i.labelFontSize};
15
- }
16
- .treemapValue {
17
- fill: ${c};
18
- font-size: ${i.valueFontSize};
19
- }
20
- .treemapTitle {
21
- fill: ${a};
22
- font-size: ${i.titleFontSize};
23
- }
24
- `},`getStyles`)};export{F as diagram};