@microvac/ui 0.1.0-rc.14 → 0.1.0-rc.15

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 (280) hide show
  1. package/dist/assets/{ActiveAgentsPanel-C9AP9hJu.js → ActiveAgentsPanel-BEx06tMt.js} +1 -1
  2. package/dist/assets/{AdapterManager-CmxTUKJH.js → AdapterManager-3kEEQWFJ.js} +1 -1
  3. package/dist/assets/{AdvancedToolsRoute-CXsQnTei.js → AdvancedToolsRoute-CgS6B-oh.js} +1 -1
  4. package/dist/assets/{AgentActionButtons-DWq2OuVK.js → AgentActionButtons-Cz3jCEd7.js} +1 -1
  5. package/dist/assets/{AgentAdvancedTab-dhBDxF-H.js → AgentAdvancedTab-BG6ZIAuN.js} +1 -1
  6. package/dist/assets/{AgentBulkSettingsSheet-DYT4ovDg.js → AgentBulkSettingsSheet-BrrbvspS.js} +1 -1
  7. package/dist/assets/{AgentChat-r0TPOfPK.js → AgentChat-Dw9iXD6H.js} +1 -1
  8. package/dist/assets/{AgentDetailPage-Bc_okBuS.js → AgentDetailPage-CuVIHv_q.js} +3 -3
  9. package/dist/assets/{AgentIdentityChip-CB2NBXkZ.js → AgentIdentityChip-BrVCcuHQ.js} +1 -1
  10. package/dist/assets/{AgentRosterFilters-b7qMLv8-.js → AgentRosterFilters-GQ2bdXfW.js} +2 -2
  11. package/dist/assets/{Agents-BsvXy3pZ.js → Agents-clrVQnvc.js} +2 -2
  12. package/dist/assets/{Agents.production-BeOZmzaF.js → Agents.production-DTopo7XB.js} +2 -2
  13. package/dist/assets/{AnimatedDialogContent-CWshmxP2.js → AnimatedDialogContent-CDLfw-dJ.js} +1 -1
  14. package/dist/assets/{AppDetail-DbqENTF_.js → AppDetail-BcWBg5yW.js} +1 -1
  15. package/dist/assets/{AppNotConnected-BhnCqL0F.js → AppNotConnected-NgfyHZ4L.js} +1 -1
  16. package/dist/assets/{ApprovalDetail-B2KiYLTj.js → ApprovalDetail-Dm_1V4tC.js} +1 -1
  17. package/dist/assets/{Approvals-j-wRmqKj.js → Approvals-i5AB3JPj.js} +1 -1
  18. package/dist/assets/{AppsConnect-CcPVEZ0C.js → AppsConnect-D660Tpuo.js} +1 -1
  19. package/dist/assets/{AppsReview-B8eWvKkS.js → AppsReview-DdTqOisY.js} +1 -1
  20. package/dist/assets/{ArtifactEmptyGraphic-5mdkS5jj.js → ArtifactEmptyGraphic-DzxCruYA.js} +1 -1
  21. package/dist/assets/{Artifacts-Bz7Oo6VX.js → Artifacts-CkXBz6nh.js} +1 -1
  22. package/dist/assets/{AssigneePickerInner-DdpF7hck.js → AssigneePickerInner-BNjyABBe.js} +1 -1
  23. package/dist/assets/{AssistantConnection-BpaaJDc_.js → AssistantConnection-CNF6mDmO.js} +1 -1
  24. package/dist/assets/{AttentionInlineVerbs-DlPQVCO-.js → AttentionInlineVerbs-BiyZ1ekZ.js} +1 -1
  25. package/dist/assets/{AttentionQueueRow-BC6ezctS.js → AttentionQueueRow-Bh0dKHpF.js} +1 -1
  26. package/dist/assets/{AuditHub-BVP7LKL9.js → AuditHub-BK848cb4.js} +1 -1
  27. package/dist/assets/{AuditRuns-DqizHgX1.js → AuditRuns-CUdlbP7S.js} +1 -1
  28. package/dist/assets/{Auth-DOF0snjp.js → Auth-DDqxm5gD.js} +1 -1
  29. package/dist/assets/{BoardChat-BYAbDtfd.js → BoardChat-fvKqk0R7.js} +1 -1
  30. package/dist/assets/{BoardClaim-7y41Pr8e.js → BoardClaim-BEC5BZfz.js} +1 -1
  31. package/dist/assets/{BootstrapSetupUxLab-BftH1vOv.js → BootstrapSetupUxLab-CXzErrin.js} +1 -1
  32. package/dist/assets/{Browse-Ck01W1Yl.js → Browse-DoovSMuF.js} +1 -1
  33. package/dist/assets/{BudgetPolicyCard-CKhrzfgy.js → BudgetPolicyCard-BYMlczCq.js} +1 -1
  34. package/dist/assets/{CaseDetail-qlXKJ66D.js → CaseDetail-UMAcSH_x.js} +1 -1
  35. package/dist/assets/{CaseStatus-B3RiZVDH.js → CaseStatus-BI0aMl9l.js} +1 -1
  36. package/dist/assets/{Cases-CFV3V-5X.js → Cases-CMTkGghU.js} +1 -1
  37. package/dist/assets/{ChatEndpointDetail-7Hi5TJNt.js → ChatEndpointDetail-CocNEInH.js} +1 -1
  38. package/dist/assets/{ChatEndpointSetup-CtwgH6sg.js → ChatEndpointSetup-Cyi2tI9K.js} +1 -1
  39. package/dist/assets/{ChatIdentityConfirm-CXjksBwX.js → ChatIdentityConfirm-Ba3JuTX1.js} +1 -1
  40. package/dist/assets/{CliAuth-KVjrGMfZ.js → CliAuth-D2jnueGH.js} +1 -1
  41. package/dist/assets/{Companies-oeJem3De.js → Companies-K75I9dJs.js} +1 -1
  42. package/dist/assets/{CompanyAccess-vWT6G-n_.js → CompanyAccess-Cw6nLUhE.js} +1 -1
  43. package/dist/assets/{CompanyActivity-zOzzeN1B.js → CompanyActivity-BsgmVpWS.js} +1 -1
  44. package/dist/assets/CompanyActivity.production-w-KGxvo6.js +1 -0
  45. package/dist/assets/{CompanyConnections-llSEaVa2.js → CompanyConnections-yRPYSdm7.js} +1 -1
  46. package/dist/assets/{CompanyEnvironments-DNyyGC_S.js → CompanyEnvironments-BA7kWdOJ.js} +1 -1
  47. package/dist/assets/{CompanyExport-CFa-F8Es.js → CompanyExport-DfsK4b9c.js} +1 -1
  48. package/dist/assets/{CompanyImport-DG6qwQ8F.js → CompanyImport-DJHAsmSF.js} +1 -1
  49. package/dist/assets/{CompanySettings-Dv5Z3ZQi.js → CompanySettings-DwzHGXec.js} +1 -1
  50. package/dist/assets/{CompanySettingsPluginPage-CZk1d_0d.js → CompanySettingsPluginPage-Bpa81PF3.js} +1 -1
  51. package/dist/assets/{CompanySkills-CdzWhJfQ.js → CompanySkills-eTqgbqQN.js} +1 -1
  52. package/dist/assets/{CompanySkills.production-IoCRW5FQ.js → CompanySkills.production-CQSWfH0r.js} +1 -1
  53. package/dist/assets/{ConfigureBuiltInAgentModal-BwW7XQ1O.js → ConfigureBuiltInAgentModal-DgeD7t_i.js} +1 -1
  54. package/dist/assets/{CopyableGatewayUrl-PTn061ft.js → CopyableGatewayUrl-B6K3rOal.js} +1 -1
  55. package/dist/assets/{CordisPluginSettings-C_BeeGEc.js → CordisPluginSettings-DD3AnD2G.js} +1 -1
  56. package/dist/assets/{Costs-DhuNxwSj.js → Costs-orBM8T-a.js} +1 -1
  57. package/dist/assets/{CrossIssueCollaborationUxLab-ZaAXq46r.js → CrossIssueCollaborationUxLab-Bv9y9-NE.js} +1 -1
  58. package/dist/assets/{Dashboard-BaDnqiKo.js → Dashboard-CrSBNKX1.js} +1 -1
  59. package/dist/assets/{DashboardLive-D-Ed7osd.js → DashboardLive-Cg8C9RiS.js} +1 -1
  60. package/dist/assets/{DecisionDateChips-D3pl_mLn.js → DecisionDateChips-BLZKZH71.js} +1 -1
  61. package/dist/assets/{DecisionHistoryPanel-D5MzyrOh.js → DecisionHistoryPanel-yK-CP7Qg.js} +1 -1
  62. package/dist/assets/{DecisionQueuePage-D3UZ9oRk.js → DecisionQueuePage-BKXbERai.js} +1 -1
  63. package/dist/assets/{DesignGuide-COTo7ICj.js → DesignGuide-2FswNsXz.js} +1 -1
  64. package/dist/assets/{DesignSandboxTaskThread-CMeCSQid.js → DesignSandboxTaskThread-CGU--FXR.js} +1 -1
  65. package/dist/assets/{EmailConnectionAccess-kCL7obSr.js → EmailConnectionAccess-CZ5QRKyg.js} +1 -1
  66. package/dist/assets/{EmailEndpointSetup-BGrksR_u.js → EmailEndpointSetup-BI2vsd8Y.js} +1 -1
  67. package/dist/assets/{EnforcementBanner-_Eb_nK3M.js → EnforcementBanner-B-iX466h.js} +1 -1
  68. package/dist/assets/{EntityRow-gpsOgEtu.js → EntityRow-BsICt6pd.js} +1 -1
  69. package/dist/assets/{ExecutionWorkspaceDetail-DwGkH6d3.js → ExecutionWorkspaceDetail-CMqR9puh.js} +1 -1
  70. package/dist/assets/{ExternalAgentInviteDialog-CGid6pM9.js → ExternalAgentInviteDialog-De30ZrLP.js} +1 -1
  71. package/dist/assets/{FilterBar-1D-VhrvG.js → FilterBar-rCmsTtG4.js} +1 -1
  72. package/dist/assets/{FolderControls-CQ6kef3c.js → FolderControls-CmnB7Ap-.js} +1 -1
  73. package/dist/assets/{GatewayDetail-CCqekM1J.js → GatewayDetail-Duw9pJ10.js} +1 -1
  74. package/dist/assets/{GatewaysList-nFsRcszh.js → GatewaysList-BBhVGhRq.js} +1 -1
  75. package/dist/assets/{GitHubConnectionRecovery-B9sFWJup.js → GitHubConnectionRecovery-6VshLoNV.js} +1 -1
  76. package/dist/assets/{GoalDetail-BQ8y55P-.js → GoalDetail-CahntjlI.js} +1 -1
  77. package/dist/assets/{GoalTree-laRjXp0P.js → GoalTree-CU4GBFCh.js} +1 -1
  78. package/dist/assets/{Goals-Cm14EaeP.js → Goals-CzM2NDFR.js} +1 -1
  79. package/dist/assets/{InstanceAccess-DxQ-Akt_.js → InstanceAccess-CZzkE65W.js} +1 -1
  80. package/dist/assets/{InstanceExperimentalSettings-BxwqbXNw.js → InstanceExperimentalSettings-DWumKtOK.js} +1 -1
  81. package/dist/assets/{InviteLanding-Cf0L_u6s.js → InviteLanding-BIy2z50u.js} +1 -1
  82. package/dist/assets/{IssueChatLongThreadPerf-BfsF6FdF.js → IssueChatLongThreadPerf-D4DJvdOG.js} +1 -1
  83. package/dist/assets/{JoinRequestQueue-BXCdTFG_.js → JoinRequestQueue-C5rauGYm.js} +1 -1
  84. package/dist/assets/{Layout.production-CqzU0qMi.js → Layout.production-BSDWnupa.js} +1 -1
  85. package/dist/assets/{McpConnect-COWnZ9Eb.js → McpConnect-BN8ST0RS.js} +1 -1
  86. package/dist/assets/{MembershipAction-C9i9Sdmi.js → MembershipAction-DTjhGn-L.js} +1 -1
  87. package/dist/assets/{MetricCard-Bwnt3_p3.js → MetricCard-CeL9Pdn5.js} +1 -1
  88. package/dist/assets/{MissingPluginTabPlaceholder-B0Zxv1Kx.js → MissingPluginTabPlaceholder-CbQiSVnZ.js} +1 -1
  89. package/dist/assets/{NewAgent-BIlJ5Dyt.js → NewAgent-BszrNpQk.js} +1 -1
  90. package/dist/assets/{NewAgentDialog-CJdMxxYL.js → NewAgentDialog-U9qAcTzc.js} +1 -1
  91. package/dist/assets/{NewGoalDialog-B8izfKLm.js → NewGoalDialog-DqKbk4-i.js} +1 -1
  92. package/dist/assets/{NewProjectDialog-DXqjTYFK.js → NewProjectDialog-DrlUAF-N.js} +1 -1
  93. package/dist/assets/{OnboardingPrimitives-DHYBqn_0.js → OnboardingPrimitives-BkgPF4Mu.js} +1 -1
  94. package/dist/assets/{OnboardingWizard-DqSfZ13V.js → OnboardingWizard-CMBMcuXv.js} +1 -1
  95. package/dist/assets/{OrgChart.production-DrSFUf7i.js → OrgChart.production-BLczTjRj.js} +1 -1
  96. package/dist/assets/{PaperclipCloudOAuthHandoff-jPUvjJ8q.js → PaperclipCloudOAuthHandoff-BTtF8UPD.js} +1 -1
  97. package/dist/assets/{PluginManager-h3LFPaUq.js → PluginManager-CCcqlfgK.js} +1 -1
  98. package/dist/assets/{PluginPage-E5Im4454.js → PluginPage-B1empV69.js} +1 -1
  99. package/dist/assets/{PluginSettings-BBO0jAgo.js → PluginSettings-DtopaRqR.js} +1 -1
  100. package/dist/assets/{ProfileDetailRoute-CQBD7fms.js → ProfileDetailRoute-BqvVpBZi.js} +1 -1
  101. package/dist/assets/{ProfileSettings-BwnVEHLp.js → ProfileSettings-5__tVfGi.js} +1 -1
  102. package/dist/assets/{ProfileWizardRoute-By_SC6Gn.js → ProfileWizardRoute-vt-MRLuD.js} +1 -1
  103. package/dist/assets/{ProjectDetail-CbiwFBAE.js → ProjectDetail-DJ4zjube.js} +1 -1
  104. package/dist/assets/{ProjectRepositoryInput-DZF9bX4E.js → ProjectRepositoryInput-BJcnj3At.js} +1 -1
  105. package/dist/assets/{ProjectWorkspaceDetail-DPsl_4bD.js → ProjectWorkspaceDetail-DEAO3q6v.js} +1 -1
  106. package/dist/assets/{ProjectWorkspacesContent-COH4dOWK.js → ProjectWorkspacesContent-CZvO7p0i.js} +1 -1
  107. package/dist/assets/{Projects-Ch9Qu7sn.js → Projects-Dm7-zXUH.js} +1 -1
  108. package/dist/assets/{QuotaBar-DIFOT9Uh.js → QuotaBar-Drp3CaxX.js} +1 -1
  109. package/dist/assets/{RepositoryEditor-DHB1bqId.js → RepositoryEditor-BT_VAkJu.js} +1 -1
  110. package/dist/assets/{Responsibilities-C5O0JXXG.js → Responsibilities-DbUEtGZu.js} +1 -1
  111. package/dist/assets/{ResponsibilityDetail-D6NpZpkm.js → ResponsibilityDetail--S8_GOkb.js} +1 -1
  112. package/dist/assets/{ResponsibleUserDenialUxLab-CFrIWYwe.js → ResponsibleUserDenialUxLab-1PB3JNG0.js} +1 -1
  113. package/dist/assets/{ReviewQueueCard-BPC4Lm67.js → ReviewQueueCard-B8w9aXKU.js} +1 -1
  114. package/dist/assets/{RoutineAuditActivity-sKyzMajz.js → RoutineAuditActivity-BCo7pYe5.js} +1 -1
  115. package/dist/assets/{RoutineDetail-CG8HF5fp.js → RoutineDetail-C9Dwn5G9.js} +1 -1
  116. package/dist/assets/{RoutineRunVariablesDialog-CKh3CmLD.js → RoutineRunVariablesDialog-Baomcbe3.js} +1 -1
  117. package/dist/assets/{Routines-tF2qfUKo.js → Routines-Dkv4gJno.js} +1 -1
  118. package/dist/assets/{Routines.production-BTyj1Ljr.js → Routines.production-Cs2Y-lpt.js} +1 -1
  119. package/dist/assets/{RoutinesToolbar-CvUFVCGN.js → RoutinesToolbar-BNKfCrTo.js} +1 -1
  120. package/dist/assets/{Search-Z9D0NuS1.js → Search-CVx4cl2o.js} +1 -1
  121. package/dist/assets/{Secrets-DgmbLOJK.js → Secrets-C2qv2HKZ.js} +1 -1
  122. package/dist/assets/{SkillBinaryFile-F3_9qcaM.js → SkillBinaryFile-DDkhLlfC.js} +1 -1
  123. package/dist/assets/{SkillCardIcon-CXHUCMej.js → SkillCardIcon-Cp_hws0N.js} +1 -1
  124. package/dist/assets/{SkillFolderTree-CB3lrTIE.js → SkillFolderTree-Cv0CmfYx.js} +1 -1
  125. package/dist/assets/{SkillSourceTree-BbuciCo6.js → SkillSourceTree-DmjlUswf.js} +1 -1
  126. package/dist/assets/{SkillSources-Dlo6Cew3.js → SkillSources-nmlYypUU.js} +1 -1
  127. package/dist/assets/{SkillStudio-ZO-Nf7eI.js → SkillStudio-BK3y_3zr.js} +1 -1
  128. package/dist/assets/{SkillsNavigationTabs-B9Iqnlqt.js → SkillsNavigationTabs-DRwMP1eu.js} +1 -1
  129. package/dist/assets/{SpekoPhoneCallback-C4VnMiZh.js → SpekoPhoneCallback-Cqi7AIyH.js} +1 -1
  130. package/dist/assets/{SpekoProviderSetup-I4evPZb3.js → SpekoProviderSetup-CJI4oXk5.js} +1 -1
  131. package/dist/assets/{StatusCards-D0MVzbsw.js → StatusCards-DKyyY81S.js} +1 -1
  132. package/dist/assets/{SummarySlotCard-DUXgZPxG.js → SummarySlotCard-f3RomdZS.js} +1 -1
  133. package/dist/assets/{TailscaleConnector-CMhT73gj.js → TailscaleConnector-yQWLR1Ra.js} +1 -1
  134. package/dist/assets/{TaskChatLab-D9-KAE-7.js → TaskChatLab-Dsr7eyj4.js} +1 -1
  135. package/dist/assets/{TaskSummaryList-CUxieFNe.js → TaskSummaryList-eFDfK_QH.js} +1 -1
  136. package/dist/assets/{Timeline-BNMoRbtK.js → Timeline-BWA9dyk6.js} +1 -1
  137. package/dist/assets/{ToolsAdminGate-CEr0zy2T.js → ToolsAdminGate-DpBg30hQ.js} +1 -1
  138. package/dist/assets/{TrustPresetSection-B9YXZtkh.js → TrustPresetSection-DtWjK9Kp.js} +1 -1
  139. package/dist/assets/{UserProfile-D-tnW96X.js → UserProfile-C66UI5xx.js} +1 -1
  140. package/dist/assets/{WebhookUrlWarning-Ba_DixKh.js → WebhookUrlWarning-CDygVnDH.js} +1 -1
  141. package/dist/assets/{WhatNeedsMe-B-Jzj8_M.js → WhatNeedsMe-BQ82RHus.js} +1 -1
  142. package/dist/assets/{Workspaces-BqhDI_Bl.js → Workspaces-DrjJes30.js} +1 -1
  143. package/dist/assets/{abnfDiagram-YUKMZFIV-Bn9P-nUW.js → abnfDiagram-YUKMZFIV-Crkksu2D.js} +1 -1
  144. package/dist/assets/{architecture-WOLXFQ4H-V1ldsZlt.js → architecture-WOLXFQ4H-bHU8FW0c.js} +1 -1
  145. package/dist/assets/{architectureDiagram-47P4ROYG-BkYxt-Gc.js → architectureDiagram-47P4ROYG-Bj5Styf9.js} +1 -1
  146. package/dist/assets/{arrow-down-left-o81ENfeW.js → arrow-down-left-Ck9VQyqQ.js} +1 -1
  147. package/dist/assets/{blockDiagram-E7TT5TSB-BO7pPYbp.js → blockDiagram-E7TT5TSB-OeHpNCQ-.js} +1 -1
  148. package/dist/assets/{budgets-0Dw6TH1A.js → budgets-CAWPqcn4.js} +1 -1
  149. package/dist/assets/{building-complex-DciZTnys.js → building-complex-Dxiyk_pH.js} +1 -1
  150. package/dist/assets/{c4Diagram-CRA5TL53-D4EpmmzV.js → c4Diagram-CRA5TL53-QbK5p76P.js} +1 -1
  151. package/dist/assets/channel-BSmZkKA8.js +1 -0
  152. package/dist/assets/{chat-channels-DWyry-9M.js → chat-channels-CzTZV2fr.js} +1 -1
  153. package/dist/assets/{chunk-2BW5OAIV-DFXIyCJy.js → chunk-2BW5OAIV-Ckr4HfBO.js} +1 -1
  154. package/dist/assets/{chunk-3YJQHVM4-Dj5wEKIw.js → chunk-3YJQHVM4-C_uoPpLR.js} +1 -1
  155. package/dist/assets/{chunk-4EA7E6EY-5XiUVgzK.js → chunk-4EA7E6EY-BeMEfIRS.js} +1 -1
  156. package/dist/assets/{chunk-7TKQ45FW-D0opKcsy.js → chunk-7TKQ45FW-DiwqWHvN.js} +1 -1
  157. package/dist/assets/{chunk-AW2ZBBNX-DnjsTe04.js → chunk-AW2ZBBNX-Cf57K3PO.js} +1 -1
  158. package/dist/assets/{chunk-DBDB3WZW-DNqSQPZ0.js → chunk-DBDB3WZW-B2qouVQO.js} +1 -1
  159. package/dist/assets/{chunk-E2ZNV5FY-cjSf_BTz.js → chunk-E2ZNV5FY-DG8wQ_NS.js} +1 -1
  160. package/dist/assets/{chunk-EU5HNXII-CZYBiaSw.js → chunk-EU5HNXII-cxRrXRGV.js} +1 -1
  161. package/dist/assets/{chunk-FVRAUYC3-DSc0-wJA.js → chunk-FVRAUYC3-Dizswk0V.js} +1 -1
  162. package/dist/assets/{chunk-HJ2JQQFS-MXK0gYSP.js → chunk-HJ2JQQFS-DL4lnpSv.js} +1 -1
  163. package/dist/assets/{chunk-HTAEGDNF-BjDZm_5k.js → chunk-HTAEGDNF-Zxjdb6kj.js} +1 -1
  164. package/dist/assets/{chunk-KQW6MTUR-Bfj0tDmO.js → chunk-KQW6MTUR-BsVaJdnu.js} +1 -1
  165. package/dist/assets/{chunk-NTY3LDVX-Bpz5TkVb.js → chunk-NTY3LDVX-DyT9N5sM.js} +1 -1
  166. package/dist/assets/{chunk-VPRB5NB3-CfeHjtbb.js → chunk-VPRB5NB3-BNz5CtBn.js} +1 -1
  167. package/dist/assets/{chunk-XC4XBNZT-FBCWmi6K.js → chunk-XC4XBNZT-CCgIhjYS.js} +1 -1
  168. package/dist/assets/{circle-slash-DqKFFqfb.js → circle-slash-uNv_ha0X.js} +1 -1
  169. package/dist/assets/{classDiagram-v2-K4WV4PDN-DbC_J0kK.js → classDiagram-v2-K4WV4PDN-Cdh3CEl4.js} +1 -1
  170. package/dist/assets/{coins-BztUbqyl.js → coins-BDAh8hDQ.js} +1 -1
  171. package/dist/assets/{collections-BxrcELwt.js → collections-B58p51lw.js} +1 -1
  172. package/dist/assets/{connection-owner-D-ikSHyR.js → connection-owner-D8fNrFqC.js} +1 -1
  173. package/dist/assets/{cynefin-EF2NZ3EQ-COwSJ4qP.js → cynefin-EF2NZ3EQ-BkwhfqJ0.js} +1 -1
  174. package/dist/assets/{cynefinDiagram-3GCD6N5R-diaEJq9Y.js → cynefinDiagram-3GCD6N5R-DuGb_wq2.js} +1 -1
  175. package/dist/assets/{dagre-W4DXFKR2-BPAMRuIj.js → dagre-W4DXFKR2-Bxq_Mhia.js} +1 -1
  176. package/dist/assets/{diagram-2UJZ2QOL-BvRnO1Id.js → diagram-2UJZ2QOL-B-P_hrXV.js} +1 -1
  177. package/dist/assets/{diagram-OVF4WLC6-CDgBeD0m.js → diagram-OVF4WLC6-Ds0BqQWH.js} +1 -1
  178. package/dist/assets/{diagram-PFPMY2P6-DAw9lREG.js → diagram-PFPMY2P6-Dpqb2-Cb.js} +1 -1
  179. package/dist/assets/{diagram-UMYRVEAY-ZQqQn22t.js → diagram-UMYRVEAY-BJSoxjiu.js} +1 -1
  180. package/dist/assets/{diagram-YEKJPTXX-CoJtGgWs.js → diagram-YEKJPTXX-BxaG_9tT.js} +1 -1
  181. package/dist/assets/{diagram-ZIFT7M5P-qW_Zn_bO.js → diagram-ZIFT7M5P-6acvVOtc.js} +1 -1
  182. package/dist/assets/{dist-B2E6oBK1.js → dist-0EWXio4m.js} +1 -1
  183. package/dist/assets/{dist-IcdxEhjC.js → dist-BGvZP_Cl.js} +1 -1
  184. package/dist/assets/{dist-DXjkgaZX.js → dist-BZ7AbEhN.js} +1 -1
  185. package/dist/assets/{dist-_EtfntKJ.js → dist-BlosHr86.js} +1 -1
  186. package/dist/assets/{dist-DylHAy-6.js → dist-Bmr4uhSk.js} +1 -1
  187. package/dist/assets/{dist-DML0cJH3.js → dist-C6yMfMNS.js} +1 -1
  188. package/dist/assets/{dist-Dl94YqeS.js → dist-CMZQedYl.js} +1 -1
  189. package/dist/assets/{dist-DKyBHaH2.js → dist-C_N_-eaT.js} +1 -1
  190. package/dist/assets/{dist-CvRpZH53.js → dist-CaUbG4Hl.js} +1 -1
  191. package/dist/assets/{dist-ptDa9fKh.js → dist-Cn7-nxjU.js} +1 -1
  192. package/dist/assets/{dist-CG-phytt.js → dist-Cnj95_pX.js} +1 -1
  193. package/dist/assets/{dist-DbXGl-wj.js → dist-D9DR7k9k.js} +1 -1
  194. package/dist/assets/{dist-CjRqeLFz.js → dist-DIwsVdS2.js} +1 -1
  195. package/dist/assets/{dist-BCJybC91.js → dist-DVE0lLId.js} +1 -1
  196. package/dist/assets/{dist-CPgRB-NQ.js → dist-DkAPL4CQ.js} +1 -1
  197. package/dist/assets/{dist-CeSzCyeG.js → dist-Dl6N3kpQ.js} +1 -1
  198. package/dist/assets/{dist-DZruZxAk.js → dist-DmBvXBzK.js} +1 -1
  199. package/dist/assets/{dist-CdmdXwCZ.js → dist-DpgXK0aZ.js} +1 -1
  200. package/dist/assets/{dist-CYRzGbSY.js → dist-gMRyU9GJ.js} +1 -1
  201. package/dist/assets/{dist-CG6fC1Db.js → dist-jQQX2kOU.js} +1 -1
  202. package/dist/assets/{dist-DZIxMHOT.js → dist-lUaUoFTq.js} +1 -1
  203. package/dist/assets/{dist-CuwPDbnL.js → dist-qw1ZF2vD.js} +1 -1
  204. package/dist/assets/{dist-B6Qde8KJ.js → dist-rH4qrNAn.js} +1 -1
  205. package/dist/assets/{ebnfDiagram-VR2GEFS7-DA4UvKXV.js → ebnfDiagram-VR2GEFS7-Ytj3Z5qC.js} +1 -1
  206. package/dist/assets/{elk-IJKZMXRS-CM74d3mJ.js → elk-IJKZMXRS-CJurNqqK.js} +1 -1
  207. package/dist/assets/{erDiagram-O2IAPWRE-d869V0qL.js → erDiagram-O2IAPWRE-hyXckW2d.js} +1 -1
  208. package/dist/assets/{eventmodeling-K75KTNOO-C-oz_eyI.js → eventmodeling-K75KTNOO-D3xQujrh.js} +1 -1
  209. package/dist/assets/flowDiagram-OXPTDLAJ-D4ojBTuY.js +1 -0
  210. package/dist/assets/{folder-plus-CxWXoYCi.js → folder-plus-BJZSMzuj.js} +1 -1
  211. package/dist/assets/{ganttDiagram-R7TSEDQI-BBul4Kpm.js → ganttDiagram-R7TSEDQI-C8U_ITl4.js} +1 -1
  212. package/dist/assets/{gitGraph-VSP46ZUC-BriEZgAq.js → gitGraph-VSP46ZUC-CDeq3yKT.js} +1 -1
  213. package/dist/assets/{gitGraphDiagram-XJZIOB7I-I12rg8s1.js → gitGraphDiagram-XJZIOB7I-CST3EWE9.js} +1 -1
  214. package/dist/assets/{goals-CvMWzjH4.js → goals-BNJZ4nzg.js} +1 -1
  215. package/dist/assets/{index-Bt31d8ga.js → index-BJtnP7H1.js} +8 -8
  216. package/dist/assets/{info-OHQRW6UA-CxrcGiem.js → info-OHQRW6UA-CPvTWk7J.js} +1 -1
  217. package/dist/assets/{infoDiagram-5W2HQ5XZ-4Sm0LiOu.js → infoDiagram-5W2HQ5XZ-BPUiNdxI.js} +1 -1
  218. package/dist/assets/{ishikawaDiagram-K3B6WC7H-CKXvKV-s.js → ishikawaDiagram-K3B6WC7H-D5Z3rmaA.js} +1 -1
  219. package/dist/assets/{issue-detail-4PCbYpdv.js → issue-detail-CZfjXs0M.js} +3 -3
  220. package/dist/assets/{journeyDiagram-COXZFDF6-BHsrZLvQ.js → journeyDiagram-COXZFDF6-CEkwEYdR.js} +1 -1
  221. package/dist/assets/{kanban-definition-P3RFRI5V-8HhnIs_l.js → kanban-definition-P3RFRI5V-8h_R6Qjq.js} +1 -1
  222. package/dist/assets/{line-rrKrpB-b.js → line-Ljt_vfsb.js} +1 -1
  223. package/dist/assets/{link-BecLzmfo.js → link-DvgFK0mz.js} +1 -1
  224. package/dist/assets/{list-filter-BC3D4IoX.js → list-filter-BR4_dvwm.js} +1 -1
  225. package/dist/assets/{log-in-BJCGwGGT.js → log-in-Dvx9-FMC.js} +1 -1
  226. package/dist/assets/{mcpSkills-DRs3pGKn.js → mcpSkills-76szK_k1.js} +1 -1
  227. package/dist/assets/{mermaid-parser.core-DmG0b4S0.js → mermaid-parser.core-BjFu937m.js} +3 -3
  228. package/dist/assets/{mermaid.core-D1vILTuF.js → mermaid.core-B0t95EIS.js} +4 -4
  229. package/dist/assets/{mindmap-definition-LZFPQGKD-DIMpL0de.js → mindmap-definition-LZFPQGKD-TVnHYUR4.js} +1 -1
  230. package/dist/assets/{packet-JDAUHWVQ-BnbYht3G.js → packet-JDAUHWVQ-aNGiRWLy.js} +1 -1
  231. package/dist/assets/{pegDiagram-BGZESJAR-BUjtJVjT.js → pegDiagram-BGZESJAR-DDadxqWQ.js} +1 -1
  232. package/dist/assets/{pie-XZMESJXO-CM4VXUb-.js → pie-XZMESJXO-CydFP1hd.js} +1 -1
  233. package/dist/assets/{pieDiagram-CAPJLFHJ-B3v8ryvG.js → pieDiagram-CAPJLFHJ-KhdUDwDS.js} +1 -1
  234. package/dist/assets/{power-0mw59G-l.js → power-sYV-WuqQ.js} +1 -1
  235. package/dist/assets/{profile-summary-B5rPf8v-.js → profile-summary-D4LPX-Dv.js} +1 -1
  236. package/dist/assets/{quadrantDiagram-GDMTTRAM-Cv-dS2Rn.js → quadrantDiagram-GDMTTRAM-B1X8K2Fs.js} +1 -1
  237. package/dist/assets/{radar-ABXABTNO-v6yZj4Fk.js → radar-ABXABTNO-BqodkLpx.js} +1 -1
  238. package/dist/assets/{railroad-I3PHUGI6-D-U8Cs0m.js → railroad-I3PHUGI6-HmRKXDJj.js} +1 -1
  239. package/dist/assets/{railroad-abnf-LNEFI6M7-Dw3fkrVy.js → railroad-abnf-LNEFI6M7-CkBttaHp.js} +1 -1
  240. package/dist/assets/{railroad-ebnf-DWYD2UWJ-_ln-e3Tx.js → railroad-ebnf-DWYD2UWJ-C6DBawFA.js} +1 -1
  241. package/dist/assets/{railroad-peg-JR7BVNR7-Bf8u1-RZ.js → railroad-peg-JR7BVNR7-Z9df3u5o.js} +1 -1
  242. package/dist/assets/{railroadDiagram-SM67HX2B-Drr5UhQI.js → railroadDiagram-SM67HX2B-2vDUUppL.js} +1 -1
  243. package/dist/assets/{requirementDiagram-X7JNWC4A-D5ef6_ac.js → requirementDiagram-X7JNWC4A-DAuP39Hc.js} +1 -1
  244. package/dist/assets/{sankeyDiagram-UM26HJRW-DncJWIz_.js → sankeyDiagram-UM26HJRW-ByS54QZK.js} +1 -1
  245. package/dist/assets/{saved-permissions-CizWg8-P.js → saved-permissions-CPiYtxkZ.js} +1 -1
  246. package/dist/assets/{scroll-text-Ck6HB7eM.js → scroll-text-CVSt6aO2.js} +1 -1
  247. package/dist/assets/{sdk-CWyUlmcn.js → sdk-vrG4HtB4.js} +1 -1
  248. package/dist/assets/{search-DkTqg7ab.js → search-CG-QtPVH.js} +1 -1
  249. package/dist/assets/{send-CYVi50sh.js → send-CH-0xdLm.js} +1 -1
  250. package/dist/assets/{sequenceDiagram-ZO4K6R2Y-Cs0nGCCg.js → sequenceDiagram-ZO4K6R2Y-DvWxKTLK.js} +1 -1
  251. package/dist/assets/{shared-CIwISWMj.js → shared-D37zfckm.js} +1 -1
  252. package/dist/assets/{smoke-lab-matrix-A7ubFpfk.js → smoke-lab-matrix-C5gR81E3.js} +1 -1
  253. package/dist/assets/{stateDiagram-v2-TBUQTH76-Dpp3m5Wq.js → stateDiagram-v2-TBUQTH76-DtiiZIXq.js} +1 -1
  254. package/dist/assets/{swimlanes-N4OXWK64-NXVbx1w8.js → swimlanes-N4OXWK64-BWSEtCbX.js} +1 -1
  255. package/dist/assets/swimlanesDiagram-K3J5GTZL-Bl_9DvHU.js +8 -0
  256. package/dist/assets/{timeline-definition-YOQAKGHF-DqI-Mv2e.js → timeline-definition-YOQAKGHF-U4QcniMh.js} +1 -1
  257. package/dist/assets/{treeView-D4JQ5SDB-CZBlE7ya.js → treeView-D4JQ5SDB-B2tdrtsj.js} +1 -1
  258. package/dist/assets/{treemap-SAJKECNS-BlueznID.js → treemap-SAJKECNS-DodN8j4n.js} +1 -1
  259. package/dist/assets/{useAgentlessOnboardingAutoOpen-CnFwEQ-H.js → useAgentlessOnboardingAutoOpen-DSWW7Juw.js} +1 -1
  260. package/dist/assets/{useAuthorizationWindow-DnFQsiFj.js → useAuthorizationWindow-tg3aKEU7.js} +1 -1
  261. package/dist/assets/{useDateRange-9EbqkWXy.js → useDateRange-CnZQr2KO.js} +1 -1
  262. package/dist/assets/{useFastResponsesEnabled-D8dunm4j.js → useFastResponsesEnabled-B8tHSJ1y.js} +1 -1
  263. package/dist/assets/{usePageView-BiX5i8ck.js → usePageView-CtFMs34g.js} +1 -1
  264. package/dist/assets/{useProfilesData-0VYQ4lAT.js → useProfilesData-CWHdMSuL.js} +1 -1
  265. package/dist/assets/{useReviewCount-WBWxwKI3.js → useReviewCount-W_bCZ2Hz.js} +1 -1
  266. package/dist/assets/{useRoutineFormOptions-DnX5DBn1.js → useRoutineFormOptions-CCLMmVSF.js} +1 -1
  267. package/dist/assets/{useSummaryDraftStream-DPQRvaXT.js → useSummaryDraftStream-NVNYNt72.js} +1 -1
  268. package/dist/assets/{useTailscaleConnections-BDff6dWx.js → useTailscaleConnections-Dy52nCY3.js} +1 -1
  269. package/dist/assets/{usecaseDiagram-VIAY4XPW-BSDn8OaJ.js → usecaseDiagram-VIAY4XPW-kEHhqgOj.js} +1 -1
  270. package/dist/assets/{vennDiagram-BLWOH2XV-BBSA9KNN.js → vennDiagram-BLWOH2XV-NPJU0aCU.js} +1 -1
  271. package/dist/assets/{wardley-7MLQ67FV-CsT-rTZ9.js → wardley-7MLQ67FV-bUGKvIPT.js} +1 -1
  272. package/dist/assets/{wardleyDiagram-YMQ3BMBF-BLClsIjw.js → wardleyDiagram-YMQ3BMBF-qtUDHfhb.js} +1 -1
  273. package/dist/assets/{xychartDiagram-TAQBALBS-2x4wB0gq.js → xychartDiagram-TAQBALBS-C-z57aZj.js} +1 -1
  274. package/dist/index.html +4 -4
  275. package/dist/sw.js +1 -1
  276. package/package.json +1 -1
  277. package/dist/assets/CompanyActivity.production-DbaFBsM0.js +0 -1
  278. package/dist/assets/channel-BQh2vFIU.js +0 -1
  279. package/dist/assets/flowDiagram-OXPTDLAJ-Be1xLbJu.js +0 -1
  280. package/dist/assets/swimlanesDiagram-K3J5GTZL-Ct3LnXZt.js +0 -8
@@ -1 +1 @@
1
- var nr=Object.defineProperty;var O=(t,e)=>nr(t,"name",{value:e,configurable:!0});import{n as l}from"./chunk-Y2CYZVJY-OvsAdhaO.js";import{m as pn}from"./src-DYjgETqR.js";import"./chunk-VPRB5NB3-CfeHjtbb.js";import"./chunk-3YJQHVM4-Dj5wEKIw.js";import"./chunk-HJ2JQQFS-MXK0gYSP.js";import"./chunk-E2ZNV5FY-cjSf_BTz.js";import"./chunk-4EA7E6EY-5XiUVgzK.js";import"./chunk-XC4XBNZT-FBCWmi6K.js";import"./chunk-DBDB3WZW-DNqSQPZ0.js";import"./chunk-2BW5OAIV-DFXIyCJy.js";import"./chunk-NTY3LDVX-Bpz5TkVb.js";import{r as or}from"./chunk-FVRAUYC3-DSc0-wJA.js";import{t as sr}from"./chunk-HTAEGDNF-BjDZm_5k.js";function Lo(t,{measure:e}){const n=t.config?.swimlane?.lineHops;if(n===!1)return;const o=n==="gap"?"gap":"arc",s=t.edges.filter(r=>Array.isArray(r.points)&&r.points.length>=2).map(r=>({id:r.id,points:r.points,curve:r.curve,arrowTypeStart:r.arrowTypeStart,arrowTypeEnd:r.arrowTypeEnd}));sr(e.groups.edgePaths,s,{enabled:!0,jumpRadius:6,jumpStyle:o})}O(Lo,"applySwimlaneLineJumps");l(Lo,"applySwimlaneLineJumps");var un="__swimlane_default__",rr=21,bo=20;function xn(t){return Math.max(t.padding??bo,bo)}O(xn,"topLaneHorizontalPadding");l(xn,"topLaneHorizontalPadding");function vo(t){const{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}const i=n-s/2,f=Math.min(r,n+s/2),d=i+Math.min(rr,Math.max(0,f-i));if(d<=i){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:i,bottom:d}}O(vo,"assignTopLaneTitleRect");l(vo,"assignTopLaneTitleRect");function wo(t){const e=t.direction,n=t.nodes??=[];for(const r of t.nodes??[])r.isGroup&&!r.parentId&&(r.shape="swimlane",e&&(r.direction=e));const o=n.filter(r=>!r.isGroup&&!r.parentId);if(o.length===0)return;let s=n.find(r=>r.id===un);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:un,label:"",isGroup:!0,shape:"swimlane",padding:20,look:t.config?.look,colorIndex:n.reduce((r,i)=>Math.max(r,i.colorIndex??-1),-1)+1,...e?{direction:e}:{}},n.push(s));for(const r of o)r.parentId=un}O(wo,"prepareLayoutForSwimlanes");l(wo,"prepareLayoutForSwimlanes");function Eo(t){const e=new Map;for(const i of t.nodes??[])e.set(i.id,i);const n=[];for(const i of t.edges??[]){const f=typeof i.start=="string"?i.start:void 0,d=typeof i.end=="string"?i.end:void 0;!f||!d||i.labelNodeId||n.push({id:i.id,src:f,dst:d,ref:i})}const o=t.nodes??[],s=o.filter(i=>i.isGroup),r=o.filter(i=>!i.isGroup);return{nodes:[...[...s].reverse(),...r].map(i=>i.id),edges:n,layout:t,nodeById:e}}O(Eo,"toGraphView");l(Eo,"toGraphView");function To(t,e,n,o){const{layout:s}=t,r=t.nodeById,i=o?.layerGap??100,f=o?.nodeGap??40;let d=0;for(const M of e.layers){let u=0;for(const m of M){const c=r.get(m);if(!c){u++;continue}c.layer=d,c.order=u;const b=n.x[m]??u*f,w=n.y[m]??d*i;c.x=b,c.y=w,u++}d++}const g=s.nodes??[],h=new Map,S=[];for(const M of g){if(!M?.isGroup)continue;M.parentId||S.push(M);const u=g.filter(I=>I.parentId===M.id);let m=1/0,c=-1/0,b=1/0,w=-1/0;for(const I of u){const T=I.x??n.x[I.id],v=I.y??n.y[I.id],p=I.width??0,y=I.height??0;T!=null&&v!=null&&(m=Math.min(m,T-p/2),c=Math.max(c,T+p/2),b=Math.min(b,v-y/2),w=Math.max(w,v+y/2))}if(m===1/0||b===1/0)M.x=M.x??0,M.y=M.y??0,M.width=M.width??0,M.height=M.height??0;else{const I=M.padding??20,T=M.parentId?I:2*xn(M),v=I,p=Math.max(0,c-m)+T,y=Math.max(0,w-b)+v,A=(m+c)/2,P=(b+w)/2;M.x=A,M.y=P,M.width=p,M.height=y,h.set(M.id,{minX:m,maxX:c,minY:b,maxY:w})}}if(S.length>0&&h.size>0){let M=1/0,u=-1/0,m=0;for(const c of S){const b=c.padding??20;b>m&&(m=b);const w=h.get(c.id);w&&(M=Math.min(M,w.minY),u=Math.max(u,w.maxY))}if(M!==1/0&&u!==-1/0){const c=Math.max(0,u-M)+2*Math.max(m,36),b=(M+u)/2;for(const y of S)y.y=b,y.height=c,y.swimlaneContentTop=M;const w=[...S].sort((y,A)=>(y.x??0)-(A.x??0)),I=[],T=[],v=[];for(const y of w){const A=h.get(y.id);if(!A)continue;const P=Math.max(0,A.maxX-A.minX)+2*xn(y),N=(A.minX+A.maxX)/2;I.push(y.id),T.push(N),v.push(P)}const p=I.length;if(p>0){const y=new Map;if(p===1)y.set(I[0],v[0]);else{const A=[];for(let F=0;F<p-1;F++)A.push(T[F+1]-T[F]);const P=new Array(p);P[0]=0;for(let F=0;F<p-1;F++)P[F+1]=2*A[F]-P[F];let N=0,R=Number.POSITIVE_INFINITY;for(let F=0;F<p;F++){const Y=v[F];F%2===0?N=Math.max(N,Y-P[F]):R=Math.min(R,P[F]-Y)}let _=N;N<=R?_=(N+R)/2:_=N;for(let F=0;F<p;F++){const Y=P[F]+(F%2===0?_:-_),Z=Math.max(v[F],Y);y.set(I[F],Z)}}for(const A of S){const P=y.get(A.id);P!=null&&(A.width=P),vo(A)}}}}}O(To,"writeBackToLayoutData");l(To,"writeBackToLayoutData");var ir="[EdgeLabelNodes]";function Ao(t){const e=[],n=[],o=new Map;for(const i of t.nodes)o.set(i.id,i);for(const i of t.edges){if(!i.label||i.label.length===0||i.isLayoutOnly||i.labelNodeId)continue;const f=i.start?o.get(i.start):void 0,d=i.end?o.get(i.end):void 0;if(!f||!d){pn.warn(ir,`Edge ${i.id} has missing source or target node`);continue}const g=`edge-label-${i.start}-${i.end}-${i.id}`,h=f.parentId!==d.parentId?d.parentId:f.parentId,S={id:g,label:i.label,edgeStart:i.start??"",edgeEnd:i.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:h,isGroup:!1,labelStyle:Array.isArray(i.labelStyle)?i.labelStyle[0]:i.labelStyle??"",...f.dir?{dir:f.dir}:{}};e.push(S),i.labelNodeId=g,i.label=void 0,i.text=void 0;const M={id:`${i.id}-to-label`,start:i.start,end:g,type:"normal",isLayoutOnly:!0},u={id:`${i.id}-from-label`,start:g,end:i.end,type:"normal",isLayoutOnly:!0};n.push(M,u)}const s=[...t.nodes,...e],r=[...t.edges,...n];return{...t,nodes:s,edges:r}}O(Ao,"createEdgeLabelNodes");l(Ao,"createEdgeLabelNodes");var _t=.001;function Wn(t){const e=t.x??0,n=t.y??0,o=t.width??0,s=t.height??0;return o>0&&s>0?{cx:e,cy:n,rect:we(e,n,o,s)}:void 0}O(Wn,"measuredNodeRect");l(Wn,"measuredNodeRect");function Kn(t){if(t.isGroup)return;const e=Wn(t);if(e)return{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}}O(Kn,"nodeBoundsInfoFor");l(Kn,"nodeBoundsInfoFor");function Qt(t,e,n=_t){return Math.abs(t.x-e.x)<n&&Math.abs(t.y-e.y)<n}O(Qt,"samePoint");l(Qt,"samePoint");function dt(t,e,n=_t){return Math.abs(t.x-e.x)<n}O(dt,"sameX");l(dt,"sameX");function ut(t,e,n=_t){return Math.abs(t.y-e.y)<n}O(ut,"sameY");l(ut,"sameY");function wt(t,e,n=_t){return ut(t,e,n)&&Math.abs(t.x-e.x)>n}O(wt,"isHorizontalSegment");l(wt,"isHorizontalSegment");function Et(t,e,n=_t){return dt(t,e,n)&&Math.abs(t.y-e.y)>n}O(Et,"isVerticalSegment");l(Et,"isVerticalSegment");function zt(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}O(zt,"overlapLength");l(zt,"overlapLength");function ne(t,e,n=_t){return t.horizontal&&e.horizontal&&ut(t.a,e.a,n)?zt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&dt(t.a,e.a,n)?zt(t.a.y,t.b.y,e.a.y,e.b.y):0}O(ne,"sameAxisSegmentOverlapLength");l(ne,"sameAxisSegmentOverlapLength");function Ee(t,e=_t){const n=[];for(let o=0;o<t.length-1;o++){const s=t[o],r=t[o+1],i=wt(s,r,e),f=Et(s,r,e);(i||f)&&n.push({index:o,a:s,b:r,horizontal:i,vertical:f})}return n}O(Ee,"orthogonalSegmentsForPoints");l(Ee,"orthogonalSegmentsForPoints");function qt(t,e=_t){const n=Ee(t,e);let o=0;for(let s=1;s<n.length;s++)n[s-1].horizontal!==n[s].horizontal&&o++;return o}O(qt,"countOrthogonalBends");l(qt,"countOrthogonalBends");function mt(t,e=_t){const n=[];for(const o of t){const s=n.length>0?n[n.length-1]:void 0;(!s||!Qt(s,o,e))&&n.push({x:o.x,y:o.y})}return n}O(mt,"dedupeConsecutivePoints");l(mt,"dedupeConsecutivePoints");function qn(t,e=_t){if(!t||t.length!==4)return;const[n,o,s,r]=t;return wt(n,o,e)&&Et(o,s,e)&&wt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:Et(n,o,e)&&wt(o,s,e)&&Et(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}O(qn,"classifyThreeSegmentRoute");l(qn,"classifyThreeSegmentRoute");function Je(t,e,n,o=0){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),f=Math.max(t.y,e.y);return r>n.left-o&&s<n.right+o&&f>n.top-o&&i<n.bottom+o}O(Je,"segmentBoundsOverlapRect");l(Je,"segmentBoundsOverlapRect");function Zn(t,e,n=0){return t.x>e.left+n&&t.x<e.right-n&&t.y>e.top+n&&t.y<e.bottom-n}O(Zn,"pointInsideRect");l(Zn,"pointInsideRect");function Ro(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom}O(Ro,"rectContainsRect");l(Ro,"rectContainsRect");function ze(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}O(ze,"rectsOverlap");l(ze,"rectsOverlap");function yn(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}O(yn,"inflateRect");l(yn,"inflateRect");function we(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}O(we,"rectFromCenterSize");l(we,"rectFromCenterSize");function jt(t){return Wn(t)?.rect}O(jt,"rectOfNodeBounds");l(jt,"rectOfNodeBounds");function Me(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}O(Me,"portForRectSide");l(Me,"portForRectSide");function Jn(t,e,n,o,s,r=_t){const i=e==="left"||e==="right",f=o==="left"||o==="right";if(i&&f){if(e==="right"&&o==="left"&&t.x<n.x||e==="left"&&o==="right"&&t.x>n.x){if(ut(t,n,r))return[t,n];const h=(t.x+n.x)/2;return[t,{x:h,y:t.y},{x:h,y:n.y},n]}if(e===o){if(ut(t,n,r))return;const h=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x:h,y:t.y},{x:h,y:n.y},n]}return}if(!i&&!f){if(e===o){if(dt(t,n,r))return;const S=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:S},{x:n.x,y:S},n]}if(!(e==="bottom"&&o==="top"&&t.y<n.y||e==="top"&&o==="bottom"&&t.y>n.y))return;if(dt(t,n,r))return[t,n];const h=(t.y+n.y)/2;return[t,{x:t.x,y:h},{x:n.x,y:h},n]}if(i&&!f){const h=e==="right"&&n.x>t.x||e==="left"&&n.x<t.x,S=o==="top"&&t.y<n.y||o==="bottom"&&t.y>n.y;return h&&S?[t,{x:n.x,y:t.y},n]:void 0}const d=e==="bottom"&&n.y>t.y||e==="top"&&n.y<t.y,g=o==="left"&&t.x<n.x||o==="right"&&t.x>n.x;return d&&g?[t,{x:t.x,y:n.y},n]:void 0}O(Jn,"buildOrthogonalPortPath");l(Jn,"buildOrthogonalPortPath");function Qn(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}O(Qn,"buildSameSideTrackPath");l(Qn,"buildSameSideTrackPath");function Qe(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const s=Kn(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}O(Qe,"collectRealNodeBounds");l(Qe,"collectRealNodeBounds");function me(t){const e=[],n=[];for(const o of t){const s=Kn(o);if(!s)continue;const r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}O(me,"collectNodeRectEntries");l(me,"collectNodeRectEntries");function No(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const s=o.x??0,r=o.y??0,i=o.width??0,f=o.height??0;n.push({nodeId:o.id,...we(s,r,i,f)})}return n}O(No,"collectLayoutNodeRects");l(No,"collectLayoutNodeRects");function to(t,e,n=_t){const o=t.start,s=t.end;if(!o||!s)return;const r=e.get(o),i=e.get(s);if(!(!r||!i))return{srcId:o,dstId:s,srcInfo:r,dstInfo:i,collinearX:Math.abs(r.cx-i.cx)<n,collinearY:Math.abs(r.cy-i.cy)<n}}O(to,"getNodePairGeometry");l(to,"getNodePairGeometry");function At(t,e,n,o=[],s=0){for(const r of n)if(!o.includes(r.id)&&Je(t,e,r.rect,-s))return!0;return!1}O(At,"segmentHitsAnyRect");l(At,"segmentHitsAnyRect");function eo(t,e,n,o,s=_t,r=1e-6){const i=ut(t,e,s),f=dt(t,e,s),d=ut(n,o,s),g=dt(n,o,s);if(i&&d||f&&g||!(i||f)||!(d||g))return!1;const h=i?{a:t,b:e}:{a:n,b:o},S=f?{a:t,b:e}:{a:n,b:o},M=h.a.y,u=Math.min(h.a.x,h.b.x),m=Math.max(h.a.x,h.b.x),c=S.a.x,b=Math.min(S.a.y,S.b.y),w=Math.max(S.a.y,S.b.y);if(c<u||c>m||M<b||M>w)return!1;const I=Math.abs(c-h.a.x)<r&&Math.abs(M-h.a.y)<r||Math.abs(c-h.b.x)<r&&Math.abs(M-h.b.y)<r,T=Math.abs(c-S.a.x)<r&&Math.abs(M-S.a.y)<r||Math.abs(c-S.b.x)<r&&Math.abs(M-S.b.y)<r;return!(I&&T)}O(eo,"orthogonalSegmentsCross");l(eo,"orthogonalSegmentsCross");function Oo(t,e,n,o,s=_t){const r=ut(t,e,s),i=dt(t,e,s),f=ut(n,o,s),d=dt(n,o,s);return i&&d&&dt(t,n,s)?zt(t.y,e.y,n.y,o.y)>s:r&&f&&ut(t,n,s)?zt(t.x,e.x,n.x,o.x)>s:!1}O(Oo,"sameAxisSegmentsOverlap");l(Oo,"sameAxisSegmentsOverlap");function $e(t,e,n,o,{epsilon:s=_t,skipDegenerateOther:r=!1}={}){for(const i of n){if(i===o||i.isLayoutOnly)continue;const f=i.points;if(!(!f||f.length<2))for(let d=0;d<f.length-1;d++){const g=f[d],h=f[d+1];if(!(r&&Qt(g,h,s))&&(eo(t,e,g,h,s)||Oo(t,e,g,h,s)))return!0}}return!1}O($e,"segmentConflictsWithAnyEdge");l($e,"segmentConflictsWithAnyEdge");function ce(t,e,n,o,s=_t){const r=ut(t,e,s),i=dt(t,e,s),f=ut(n,o,s),d=dt(n,o,s);if(!(r&&d||i&&f))return!1;const g=r?{a:t,b:e}:{a:n,b:o},h=r?{a:n,b:o}:{a:t,b:e},S=g.a.y,M=Math.min(g.a.x,g.b.x),u=Math.max(g.a.x,g.b.x),m=h.a.x,c=Math.min(h.a.y,h.b.y),b=Math.max(h.a.y,h.b.y);return m>M+s&&m<u-s&&S>c+s&&S<b-s}O(ce,"orthogonalSegmentsStrictlyCross");l(ce,"orthogonalSegmentsStrictlyCross");function bn(t,e,n){const o=Math.min(e,n),s=Math.max(e,n);return t>o+_t&&t<s-_t}O(bn,"strictlyBetween");l(bn,"strictlyBetween");function Po(t,e,n){return dt(t,e)&&dt(e,n)?bn(e.y,t.y,n.y):ut(t,e)&&ut(e,n)?bn(e.x,t.x,n.x):!1}O(Po,"isCollinearIntermediate");l(Po,"isCollinearIntermediate");function ko(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){const s=n[n.length-1],r=t[o],i=o+1<t.length?t[o+1]:void 0;if(s&&i){if(Qt(s,i)){o++,e=!0;continue}if(Po(s,r,i)){e=!0;continue}}n.push(r)}return{points:n,changed:e}}O(ko,"simplifyPolylineOnce");l(ko,"simplifyPolylineOnce");function Ve(t){const e=[t[0]];for(let o=1;o<t.length;o++){const s=e[e.length-1],r=t[o];if(!dt(s,r)&&!ut(s,r)){const i=e.length>=2?e[e.length-2]:void 0,f=i&&dt(i,s)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(f)}e.push(r)}const n=[];for(const o of e){const s=n[n.length-1];(!s||!Qt(s,o))&&n.push(o)}return n}O(Ve,"orthogonalizePolyline");l(Ve,"orthogonalizePolyline");function oe(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){const o=ko(e);if(e=o.points,!o.changed)break}return e}O(oe,"simplifyPolyline");l(oe,"simplifyPolyline");var tt=.001,cr=.5,Mo=4;function no(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length<n)return;const s=o.start?e.get(o.start):void 0,r=o.end?e.get(o.end):void 0;return{edge:o,points:o.points,srcRect:s?jt(s):void 0,dstRect:r?jt(r):void 0}}O(no,"endpointContextFor");l(no,"endpointContextFor");function Bo(t,e,n){if(ut(t,e,tt))return{x:t.x<n.left?n.left:n.right,y:t.y};if(dt(t,e,tt)){const o=t.y<n.top?n.top:n.bottom;return{x:t.x,y:o}}return{x:Math.min(n.right,Math.max(n.left,t.x)),y:Math.min(n.bottom,Math.max(n.top,t.y))}}O(Bo,"segmentEnterPoint");l(Bo,"segmentEnterPoint");function Mn(t,e,n){const o=n?1:-1;let s=n?0:t.length-1;for(;s>=0&&s<t.length&&Zn(t[s],e,cr);)s+=o;if(s<0||s>=t.length)return t;const r=s-o;if(r<0||r>=t.length)return t;const i=Bo(t[s],t[r],e);return n?[i,...t.slice(s)]:[...t.slice(0,s+1),i]}O(Mn,"clipEndpoint");l(Mn,"clipEndpoint");function Fo(t,e){for(const n of t){const o=no(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=Mn(s,o.srcRect,!0)),o.dstRect&&(s=Mn(s,o.dstRect,!1)),s=oe(Ve(s)),s=oo(s,o.srcRect,o.dstRect),o.edge.points=oe(Ve(s))}}O(Fo,"clipEdgeEndpointsToNodeBoundaries");l(Fo,"clipEdgeEndpointsToNodeBoundaries");function In(t,e,n,o=!1){if(ut(t,e,tt)){if(e.y<n.top-tt||e.y>n.bottom+tt)return e;if(o){if(t.x<n.left-tt)return{x:n.left,y:t.y};if(t.x>n.right+tt)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(dt(t,e,tt)){if(e.x<n.left-tt||e.x>n.right+tt)return e;if(o){if(t.y<n.top-tt)return{x:t.x,y:n.top};if(t.y>n.bottom+tt)return{x:t.x,y:n.bottom}}const s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}O(In,"snapEndpointToBoundary");l(In,"snapEndpointToBoundary");function je(t,e,n){const o=t[e];for(let s=e+n;s>=0&&s<t.length;s+=n){const r=t[s];if(!Qt(r,o,tt))return r}return t[e+n]}O(je,"firstDistinctAdjacent");l(je,"firstDistinctAdjacent");function Ue(t,e){const n=t+Mo,o=e-Mo;return n<=o?{lo:n,hi:o}:{lo:(t+e)/2,hi:(t+e)/2}}O(Ue,"cornerClearanceRange");l(Ue,"cornerClearanceRange");function Sn(t,e,n){const{lo:o,hi:s}=Ue(e,n);return Math.min(s,Math.max(o,t))}O(Sn,"clampToCornerClearance");l(Sn,"clampToCornerClearance");function _o(t){const e=Math.max(...t.map(o=>o.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}O(_o,"intersectRanges");l(_o,"intersectRanges");function Cn(t,e){return e==="left"||e==="right"?Ue(t.top,t.bottom):Ue(t.left,t.right)}O(Cn,"clearanceRangeForSide");l(Cn,"clearanceRangeForSide");function We(t,e,n){const o=t.y>=n.top-tt&&t.y<=n.bottom+tt,s=t.x>=n.left-tt&&t.x<=n.right+tt;if(ut(t,e,tt)&&o){if(Math.abs(t.x-n.left)<tt)return"left";if(Math.abs(t.x-n.right)<tt)return"right"}if(dt(t,e,tt)&&s){if(Math.abs(t.y-n.top)<tt)return"top";if(Math.abs(t.y-n.bottom)<tt)return"bottom"}}O(We,"terminalSideForSegment");l(We,"terminalSideForSegment");function Re(t){return t==="left"||t==="right"}O(Re,"isHorizontalSide");l(Re,"isHorizontalSide");function Do(t,e,n,o,s){const r=[],i=n?We(t,e,n):void 0,f=o?We(e,t,o):void 0;return n&&i&&Re(i)===s&&r.push(Cn(n,i)),o&&f&&Re(f)===s&&r.push(Cn(o,f)),r.length>0?_o(r):void 0}O(Do,"straightClearanceRange");l(Do,"straightClearanceRange");function Ln(t,e,n,o,s){const r=Do(t,e,n,o,s);if(!r)return;const i=s?t.y:t.x,f=Math.min(r.hi,Math.max(r.lo,i));if(!(Math.abs(f-i)<tt))return s?[{x:t.x,y:f},{x:e.x,y:f}]:[{x:f,y:t.y},{x:f,y:e.y}]}O(Ln,"clearStraightEndpointCornerAxis");l(Ln,"clearStraightEndpointCornerAxis");function oo(t,e,n){if(t.length!==2)return t;const[o,s]=t;return ut(o,s,tt)?Ln(o,s,e,n,!0)??t:dt(o,s,tt)?Ln(o,s,e,n,!1)??t:t}O(oo,"clearStraightEndpointCornerConnections");l(oo,"clearStraightEndpointCornerConnections");function Ho(t,e,n){return Re(n)?{x:t.x,y:Sn(t.y,e.top,e.bottom)}:{x:Sn(t.x,e.left,e.right),y:t.y}}O(Ho,"cornerClearedEndpoint");l(Ho,"cornerClearedEndpoint");function Xo(t,e,n,o,s,r){const i=t.map(f=>({...f}));for(let f=e;f>=0&&f<t.length;f+=n){const d=t[f];if(r&&!ut(d,o,tt)||!r&&!dt(d,o,tt))break;r?i[f].y=s.y:i[f].x=s.x}return i}O(Xo,"moveCollinearEndpointRun");l(Xo,"moveCollinearEndpointRun");function vn(t,e,n){if(t.length<2)return t;const o=n?0:t.length-1,s=n?1:-1,r=t[o],i=je(t,o,s);if(!i)return t;const f=We(r,i,e);if(!f)return t;const d=Re(f),g=Ho(r,e,f);return Qt(r,g,tt)?t:Xo(t,o,s,r,g,d)}O(vn,"clearEndpointCornerConnection");l(vn,"clearEndpointCornerConnection");function wn(t,e,n){const o=Math.min(t.x,e.x)>=n.left-tt&&Math.max(t.x,e.x)<=n.right+tt,s=Math.min(t.y,e.y)>=n.top-tt&&Math.max(t.y,e.y)<=n.bottom+tt;if(Math.abs(t.y-n.top)<tt&&Math.abs(e.y-n.top)<tt&&o)return"top";if(Math.abs(t.y-n.bottom)<tt&&Math.abs(e.y-n.bottom)<tt&&o)return"bottom";if(Math.abs(t.x-n.left)<tt&&Math.abs(e.x-n.left)<tt&&s)return"left";if(Math.abs(t.x-n.right)<tt&&Math.abs(e.x-n.right)<tt&&s)return"right"}O(wn,"borderSideForSegment");l(wn,"borderSideForSegment");function En(t,e,n,o){switch(t){case"top":return dt(e,n,tt)&&n.y<o.top-tt;case"bottom":return dt(e,n,tt)&&n.y>o.bottom+tt;case"left":return ut(e,n,tt)&&n.x<o.left-tt;case"right":return ut(e,n,tt)&&n.x>o.right+tt}}O(En,"leavesOutward");l(En,"leavesOutward");function Tn(t,e,n){if(t.length<3)return t;if(n){const r=wn(t[0],t[1],e);return r&&En(r,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,s=wn(t[o-1],t[o],e);return s&&En(s,t[o-1],t[o-2],e)?t.slice(0,o):t}O(Tn,"collapseOwnBorderStub");l(Tn,"collapseOwnBorderStub");function Yo(t,e,n){let o=t;if(e){const r=je(o,0,1);if(r){const i=In(r,o[0],e);i!==o[0]&&(o=[i,...o.slice(1)])}o=Tn(o,e,!0)}if(n){const r=o.length-1,i=je(o,r,-1);if(i){const f=In(i,o[r],n,!0);f!==o[r]&&(o=[...o.slice(0,r),f])}o=Tn(o,n,!1)}const s=oo(o,e,n);return s!==o||o.length===2?s:(e&&(o=vn(o,e,!0)),n&&(o=vn(o,n,!1)),o)}O(Yo,"snapAndCollapseEndpoints");l(Yo,"snapAndCollapseEndpoints");function An(t,e){for(const n of t){const o=no(n,e,2);if(!o)continue;const s=Yo(mt(o.points,tt),o.srcRect,o.dstRect);if(s.length<3){o.edge.points=s;continue}const r=[s[0],{...s[0]},...s.slice(1,-1),s[s.length-1],{...s[s.length-1]}];o.edge.points=r}}O(An,"prepareEdgeEndpointsForRenderer");l(An,"prepareEdgeEndpointsForRenderer");function so(t){return new Map(t.map(e=>[e.id,e]))}O(so,"buildNodeMap");l(so,"buildNodeMap");function Go(t,e){let n=t.parentId,o=null;for(;n;){const s=e.get(n);if(!s?.isGroup)break;o=s.id,n=s.parentId}return o}O(Go,"resolveTopLevelGroupId");l(Go,"resolveTopLevelGroupId");function Rn(t,e){let n=0,o=t.parentId;for(;o;){const s=e.get(o);if(!s?.isGroup)break;n++,o=s.parentId}return n}O(Rn,"groupDepth");l(Rn,"groupDepth");function ro(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(const r of t){const i=r.x,f=r.y;if(typeof i!="number"||typeof f!="number")continue;const d=r.width??0,g=r.height??0;e=Math.min(e,i-d/2),n=Math.max(n,i+d/2),o=Math.min(o,f-g/2),s=Math.max(s,f+g/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}O(ro,"boundsForChildren");l(ro,"boundsForChildren");function zo(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}O(zo,"applyGroupBounds");l(zo,"applyGroupBounds");function $o(t){const e=so(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>Rn(s,e)-Rn(o,e));for(const o of n){const s=ro(t.filter(r=>r.parentId===o.id));s&&zo(o,s)}}O($o,"recomputeNestedGroupBounds");l($o,"recomputeNestedGroupBounds");function Ke(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(d=>!d.isGroup);let r=1/0,i=-1/0;for(const d of s){const g=d[e];typeof g=="number"&&(r=Math.min(r,g),i=Math.max(i,g))}if(!Number.isFinite(r)||!Number.isFinite(i))return!1;const f=l(d=>r+i-d,"mirror");for(const d of n){const g=d[e];typeof g=="number"&&(d[e]=f(g));const h=d.groupTitleRect;h&&(d.groupTitleRect=e==="x"?{...h,left:f(h.right),right:f(h.left)}:{...h,top:f(h.bottom),bottom:f(h.top)})}for(const d of o)for(const g of d.points??[])g[e]=f(g[e]);return!0}O(Ke,"mirrorAxis");l(Ke,"mirrorAxis");function Vo(t){return(t.nodes??[]).some(e=>!e.isGroup)?Ke(t,"y"):!0}O(Vo,"applyBtDirectionTransform");l(Vo,"applyBtDirectionTransform");function jo(t,e="LR"){const n=t.nodes??[],o=t.edges??[],s=n.filter(N=>!N.isGroup);let r=1/0,i=1/0;for(const N of s){const R=N.x??0,_=N.y??0;R<r&&(r=R),_<i&&(i=_)}if(!Number.isFinite(r)||!Number.isFinite(i))return!1;const f=36;let d=0,g=0;for(const N of s)d+=N.width??0,g+=N.height??0;const h=d/s.length,S=g/s.length,M=S>0?Math.max(1,h/S):1;for(const N of s){const R=N.x??0,_=((N.y??0)-i)*M+f,F=R-r;N.x=_,N.y=F}for(const N of o)if(N.points)for(const R of N.points){const _=R.x,F=(R.y-i)*M+f,Y=_-r;R.x=F,R.y=Y}$o(n);const u=n.filter(N=>N.isGroup&&!N.parentId);if(u.length===0)return e==="RL"&&Ke(t,"x"),!0;const m=so(n),c=new Map;for(const N of n){if(N.isGroup)continue;const R=Go(N,m);if(!R)continue;const _=c.get(R)??[];_.push(N),c.set(R,_)}let b=0;for(const N of u){const R=N.padding??0;R>b&&(b=R)}const w=[];let I=1/0,T=-1/0;for(const N of u){const R=ro(c.get(N.id)??[]);R&&(I=Math.min(I,R.minX),T=Math.max(T,R.maxX),w.push({lane:N,contentTop:R.minY,contentBottom:R.maxY,centerY:(R.minY+R.maxY)/2}))}if(I===1/0||T===-1/0)return!0;const v=Math.max(0,T-I)+2*Math.max(b,10),p=f+v,y=(I+T)/2-v/2-f,A=y+p/2,P=Math.max(b,f);w.sort((N,R)=>N.centerY-R.centerY);for(let N=0;N<w.length;N++){const R=w[N];let _,F;if(N===0?_=R.contentTop-P:_=(w[N-1].contentBottom+R.contentTop)/2,N===w.length-1)F=R.contentBottom+P;else{const et=w[N+1];F=(R.contentBottom+et.contentTop)/2}const Y=Math.max(0,F-_),Z=(_+F)/2;R.lane.x=A,R.lane.y=Z,R.lane.width=p,R.lane.height=Y,R.lane.swimlaneContentTop=R.contentTop,R.lane.groupTitleRect={left:y,right:y+f,top:_,bottom:F}}return e==="RL"&&Ke(t,"x"),!0}O(jo,"applyLrDirectionTransform");l(jo,"applyLrDirectionTransform");var te=1e-6,De=8,ar=[0,De,-De,2*De,-2*De];function Uo(t,e){const{nodeInfoById:n,realNodeRects:o}=Qe(e);for(const s of t){if(s.isLayoutOnly)continue;const r=s.points;if(!r||r.length<4)continue;const i=qn(mt(r,te),te);if(!i)continue;const{p3:f}=i,d=i.kind==="HVH",g=to(s,n,te);if(!g)continue;const{srcId:h,dstId:S,srcInfo:M,dstInfo:u,collinearX:m,collinearY:c}=g;if(m||c)continue;let b;const w=M.rect;for(const I of ar){let T,v,p;if(d){const R=u.cy>M.cy?w.bottom:w.top,_=M.cx+I;if(_<=w.left+te||_>=w.right-te)continue;T={x:_,y:R},v={x:_,y:f.y},p={x:f.x,y:f.y}}else{const R=u.cx>M.cx?w.right:w.left,_=M.cy+I;if(_<=w.top+te||_>=w.bottom-te)continue;T={x:R,y:_},v={x:f.x,y:_},p={x:f.x,y:f.y}}const y=Qt(T,v,te),A=Qt(v,p,te);if(y&&A||!y&&At(T,v,o,[h],1)||!A&&At(v,p,o,[S],1))continue;const P=!y&&$e(T,v,t,s,{epsilon:te,skipDegenerateOther:!0}),N=!A&&$e(v,p,t,s,{epsilon:te,skipDegenerateOther:!0});if(!(P||N)){y?b=[v,p]:A?b=[T,v]:b=[T,v,p];break}}b&&(s.points=b)}}O(Uo,"portSwapToLShape");l(Uo,"portSwapToLShape");function Wo(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values());for(const f of t){if(f.isLayoutOnly)continue;const d=f.points;if(!d||d.length<4)continue;const g=mt(d,.001);if(g.length<4)continue;const h=g.length-1,S=g[h],M=g[h-1],u=g[h-2],m=S.x-M.x,c=S.y-M.y,b=Math.hypot(m,c);if(b>=10||b<.001)continue;const w=M.x-u.x,I=M.y-u.y;if(Math.hypot(w,I)<.001)continue;const T=wt(M,S,.001),v=Et(M,S,.001),p=wt(u,M,.001),y=Et(u,M,.001);if(!(T&&y||v&&p))continue;const A=f.end,P=f.start,N=A?e.get(A):void 0;if(!N)continue;const R=N.x??0,_=N.y??0,F=jt(N);if(!F)continue;let Y,Z;if(y){const rt=I<0;Y={x:R,y:u.y},Z={x:R,y:rt?F.bottom:F.top}}else{const rt=w>0;Y={x:u.x,y:_},Z={x:rt?F.right:F.left,y:_}}if(At(Y,Z,r,A?[A]:[],-2)||At(Y,Z,i,[],-2))continue;if(P){const rt=e.get(P),K=rt?jt(rt):void 0;if(K&&Zn(Y,K,2))continue}const et=l((rt,K)=>`${rt.x.toFixed(3)},${rt.y.toFixed(3)}|${K.x.toFixed(3)},${K.y.toFixed(3)}`,"ownSegmentKey"),nt=new Set;for(let rt=0;rt<g.length-1;rt++)nt.add(et(g[rt],g[rt+1]));const Mt=l((rt,K)=>{for(const Q of t){if(Q===f||Q.isLayoutOnly)continue;const st=Q.points;if(!(!st||st.length<2))for(let at=0;at<st.length-1;at++){const bt=st[at],It=st[at+1];if(!nt.has(et(bt,It))&&ce(rt,K,bt,It,.001))return!0}}return!1},"segmentCrossesOtherEdge");if(Mt(Y,Z))continue;if(h-3>=0){const rt=g[h-3],K=[P,A].filter(Q=>!!Q);if(At(rt,Y,r,K,-2)||Mt(rt,Y))continue}const yt=[...g.slice(0,h-2),Y,Z];f.points=yt;const Bt=f.labelNodeId;if(Bt){const rt=e.get(Bt);if(rt){const K=rt.width??0,Q=rt.height??0;if(K>0&&Q>0){let st,at,bt=-1;for(let It=0;It<yt.length-1;It++){const Lt=yt[It],Ut=yt[It+1],Zt=Math.hypot(Ut.x-Lt.x,Ut.y-Lt.y),se=ut(Lt,Ut,.001),re=dt(Lt,Ut,.001);(se&&Zt>=K+2||re&&Zt>=Q+2)&&Zt>bt&&(bt=Zt,st=(Lt.x+Ut.x)/2,at=(Lt.y+Ut.y)/2)}st!==void 0&&at!==void 0&&(rt.x=st,rt.y=at)}}}}}O(Wo,"collapseShortTerminalStub");l(Wo,"collapseShortTerminalStub");var J=.001,Ft=8,it=Ee,hn=l((t,e)=>dt(t,e,J)||ut(t,e,J),"orthogonallyAligned");function Ko(t,e){const s=l((u,m)=>{const c=u.x??0,b=u.y??0,w=m.x-c,I=m.y-b;let T=(u.width??0)/2,v=(u.height??0)/2;return Math.abs(I)*T>Math.abs(w)*v?(I<0&&(v=-v),{x:c+(I===0?0:v*w/I),y:b+v}):(w<0&&(T=-T),{x:c+T,y:b+(w===0?0:T*I/w)})},"rectIntersect"),r=l((u,m)=>{const c=mt(u.points??[]);if(c.length<2)return;const b=m?u.start:u.end,w=b?e.get(b):void 0,I=w?jt(w):void 0;if(!w||!b||!I)return;const T=m?c[0]:c[c.length-1],v=m?c[1]:c[c.length-2],p=s(w,T);let y=T;if(hn(v,p)&&(y=v),dt(p,y,J))return{edge:u,edgeId:String(u.id??""),nodeId:b,atStart:m,orientation:"V",coord:p.x,min:Math.min(p.y,y.y),max:Math.max(p.y,y.y),boundary:p,railEnd:y,rect:I};if(ut(p,y,J))return{edge:u,edgeId:String(u.id??""),nodeId:b,atStart:m,orientation:"H",coord:p.y,min:Math.min(p.x,y.x),max:Math.max(p.x,y.x),boundary:p,railEnd:y,rect:I}},"terminalLaneFor"),i=l((u,m)=>Math.max(0,Math.min(u.max,m.max)-Math.max(u.min,m.min)),"projectedOverlapLength"),f=l((u,m)=>u.nodeId!==m.nodeId||u.orientation!==m.orientation?!1:u.orientation==="H"?(Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1)&&dt(u.boundary,m.boundary,1):(Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1)&&ut(u.boundary,m.boundary,1),"sameTerminalFace"),d=l((u,m)=>u.nodeId!==m.nodeId||u.orientation!==m.orientation?!1:i(u,m)>=Ft&&Math.abs(u.coord-m.coord)<.5,"exactTerminalLaneConflict"),g=l((u,m)=>{if(u.nodeId!==m.nodeId||u.orientation!==m.orientation||u.orientation!=="H"||u.atStart===m.atStart)return!1;const c=i(u,m);if(c<Ft)return!1;const b=u.rect.bottom-u.rect.top;return c<b||c>2*b?!1:f(u,m)&&Math.abs(u.coord-m.coord)<16},"nearTerminalLaneConflict"),h=l((u,m)=>{const c=mt(u.edge.points??[]);if(c.length<2)return;const b=u.orientation==="V"?{x:u.boundary.x+m,y:u.boundary.y}:{x:u.boundary.x,y:u.boundary.y+m},w=u.orientation==="V"?{x:u.railEnd.x+m,y:u.railEnd.y}:{x:u.railEnd.x,y:u.railEnd.y+m};if(!l(()=>Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1?ut(b,u.boundary,J)&&b.x>=u.rect.left+1&&b.x<=u.rect.right-1:Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1?dt(b,u.boundary,J)&&b.y>=u.rect.top+1&&b.y<=u.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(u.atStart){const p=c.length>1&&Qt(c[1],u.railEnd,J),y=c.slice(p?2:1),A=y[0];return A&&!hn(A,w)?void 0:[b,w,...y]}const I=c.length>1&&Qt(c[c.length-2],u.railEnd,J),T=c.slice(0,I?-2:-1),v=T[T.length-1];if(!(v&&!hn(v,w)))return[...T,w,b]},"shiftedCandidate"),S=l(u=>{const m=u.edge,c=mt(m.points??[]);if(c.length!==2)return!1;const b=m.start,w=m.end,I=b?e.get(b):void 0,T=w?e.get(w):void 0;if(!I||!T)return!1;const v=I.x??0,p=I.y??0,y=T.x??0,A=T.y??0,[P,N]=c;return ut(P,N,J)&&Math.abs(p-A)<1&&Math.abs(v-y)>1||dt(P,N,J)&&Math.abs(v-y)<1&&Math.abs(p-A)>1},"laneIsStraightCollinearConnector"),M=[-7,7,-14,14,-21,21];for(let u=0;u<8;u++){const m=t.filter(b=>!b.isLayoutOnly).flatMap(b=>[r(b,!0),r(b,!1)]).filter(b=>!!b);let c=!1;for(let b=0;b<m.length&&!c;b++)for(let w=b+1;w<m.length&&!c;w++){const I=m[b],T=m[w];if(I.edge===T.edge||!(d(I,T)||g(I,T)))continue;const v=!d(I,T),p=[I,T].sort((y,A)=>{const P=S(y),N=S(A);return P!==N?Number(P)-Number(N):+!A.atStart-+!y.atStart});for(const y of p){for(const A of M){const P=h(y,A);if(!P)continue;const N=r({...y.edge,points:P},y.atStart);if(!(!N||m.some(R=>R.edge!==y.edge&&(d(N,R)||v&&g(N,R))))){y.edge.points=P,c=!0;break}}if(c)break}}if(!c)return}}O(Ko,"separateSharedRenderedTerminalLanes");l(Ko,"separateSharedRenderedTerminalLanes");function qo(t,e){const{realNodeRects:o,labelNodeRects:s}=me(e.values()),r=l((f,d)=>{const g=f.start,h=f.end,S=it(d);if(S.length!==d.length-1)return!1;const M=[g,h].filter(u=>!!u);for(const u of S)if(At(u.a,u.b,o,M,-2)||At(u.a,u.b,s,[],-2))return!1;for(const u of t){if(u===f||u.isLayoutOnly)continue;const m=u.points;if(!(!m||m.length<2)){for(const c of S)for(const b of it(mt(m)))if(ne(c,b,.5)>=Ft||ce(c.a,c.b,b.a,b.b,J))return!1}}return!0},"candidateIsSafe"),i=l((f,d)=>{if(d+4>=f.length)return;const g=f[d],h=f[d+1],S=f[d+2],M=f[d+3],u=f[d+4],m=wt(g,h)&&Et(h,S)&&wt(S,M)&&Et(M,u)&&dt(g,M,J)&&dt(g,u,J)&&dt(h,S,J)&&(h.x-g.x)*(M.x-S.x)<0,c=Et(g,h)&&wt(h,S)&&Et(S,M)&&wt(M,u)&&ut(g,M,J)&&ut(g,u,J)&&ut(h,S,J)&&(h.y-g.y)*(M.y-S.y)<0;if(m||c)return mt([...f.slice(0,d+1),u,...f.slice(d+5)]);if(d+5>=f.length)return;const b=f[d+5],w=Et(g,h)&&wt(h,S)&&Et(S,M)&&wt(M,u)&&Et(u,b)&&dt(g,u,J)&&dt(g,b,J)&&dt(S,M,J)&&(S.x-h.x)*(u.x-M.x)<0,I=wt(g,h)&&Et(h,S)&&wt(S,M)&&Et(M,u)&&wt(u,b)&&ut(g,u,J)&&ut(g,b,J)&&ut(S,M,J)&&(S.y-h.y)*(u.y-M.y)<0;if(!(!w&&!I))return mt([...f.slice(0,d+1),b,...f.slice(d+6)])},"withoutDogleg");for(let f=0;f<8;f++){let d=!1;for(const g of t){if(g.isLayoutOnly)continue;const h=mt(g.points??[]);for(let S=0;S<=h.length-5;S++){const M=i(h,S);if(!(!M||!r(g,M))){g.points=M,d=!0;break}}if(d)break}if(!d)return}}O(qo,"collapseRedundantRectangularDoglegs");l(qo,"collapseRedundantRectangularDoglegs");function Nn(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values()),f=t.filter(m=>!m.isLayoutOnly),d=l((m,c,b)=>mt(m===c?b??[]:m.points??[]),"pointsFor"),g=l((m,c)=>{let b=0;for(let w=0;w<f.length;w++){const I=it(d(f[w],m,c));for(let T=w+1;T<f.length;T++){const v=it(d(f[T],m,c));for(const p of I)for(const y of v)ce(p.a,p.b,y.a,y.b,J)&&b++}}return b},"strictCrossingCount"),h=l(m=>{const c=it(m);if(c.length!==3)return;const b=c[1];if(!(c[0].horizontal===b.horizontal||c[2].horizontal===b.horizontal))return{index:b.index,horizontal:b.horizontal,vertical:b.vertical,segment:b}},"middleRail"),S=l((m,c)=>{const b=[m.start,m.end].filter(w=>!!w);return r.filter(w=>{if(b.includes(w.id))return!1;const I=w.rect;return c.horizontal?zt(c.a.x,c.b.x,I.left,I.right)>=Ft&&c.a.y>=I.top-2&&c.a.y<=I.bottom+2:zt(c.a.y,c.b.y,I.top,I.bottom)>=Ft&&c.a.x>=I.left-2&&c.a.x<=I.right+2})},"blockingRectsFor"),M=l((m,c,b)=>{const w=m.map(T=>({...T}));if(c.horizontal)w[c.index].y=b,w[c.index+1].y=b;else if(c.vertical)w[c.index].x=b,w[c.index+1].x=b;else return;const I=oe(mt(w));return it(I).length===I.length-1?I:void 0},"candidateByMovingRail"),u=l((m,c,b)=>{const w=[m.start,m.end].filter(T=>!!T),I=it(c);if(I.length!==c.length-1)return!1;for(const T of I)if(At(T.a,T.b,r,w,-2)||At(T.a,T.b,i,[],-2))return!1;for(const T of f)if(T!==m){for(const v of I)for(const p of it(d(T)))if(ne(v,p,.5)>=Ft)return!1}return g(m,c)<=b},"candidateIsSafe");for(let m=0;m<8;m++){const c=g();let b=!1;for(const w of f){const I=d(w),T=h(I);if(!T)continue;const v=S(w,T.segment);if(v.length===0)continue;const p=T.horizontal?[Math.min(...v.map(y=>y.rect.top))-20,Math.max(...v.map(y=>y.rect.bottom))+20]:[Math.min(...v.map(y=>y.rect.left))-20,Math.max(...v.map(y=>y.rect.right))+20];for(const y of p){const A=M(I,T.segment,y);if(!(!A||!u(w,A,c))){w.points=A,b=!0;break}}if(b)break}if(!b)return}}O(Nn,"liftObstacleHuggingSameSideRails");l(Nn,"liftObstacleHuggingSameSideRails");function On(t,e){const o=l(d=>{const g=d.groupTitleRect;if(!(!g||typeof g.left!="number"||typeof g.right!="number"||typeof g.top!="number"||typeof g.bottom!="number"||!Number.isFinite(g.left)||!Number.isFinite(g.right)||!Number.isFinite(g.top)||!Number.isFinite(g.bottom)||g.right<=g.left||g.bottom<=g.top))return{left:g.left,right:g.right,top:g.top,bottom:g.bottom}},"validTitleRect"),s=l(d=>{if(!d.isGroup||d.parentId)return;const g=d.direction,h=typeof g=="string"?g.toUpperCase():"";if(h==="LR"||h==="RL"||h==="BT")return;const S=o(d),M=d.y,u=d.height;if(!S||typeof M!="number"||typeof u!="number"||!Number.isFinite(M)||!Number.isFinite(u)||u<=0)return;const m=S.right-S.left,c=S.bottom-S.top;if(!(c<=0||m<c))return{node:d,rect:S}},"topLaneTitleFor"),r=l((d,g)=>{if(!d.horizontal)return!1;const h=d.a.y;return h<=g.top+J||h>=g.bottom-J?!1:zt(d.a.x,d.b.x,g.left,g.right)>=Ft},"horizontalSegmentIntersectsTitle"),i=[...e.values()].map(s).filter(d=>!!d);if(i.length===0)return;let f=0;for(const d of t){if(d.isLayoutOnly)continue;const g=mt(d.points??[]);for(const h of it(g))for(const S of i)r(h,S.rect)&&(f=Math.max(f,S.rect.bottom-h.a.y+4))}if(!(f<=J))for(const d of i){const g=d.node.y,h=d.node.height;typeof g!="number"||typeof h!="number"||!Number.isFinite(g)||!Number.isFinite(h)||h<=0||(d.node.y=g-f/2,d.node.height=h+f,d.node.groupTitleRect={...d.rect,top:d.rect.top-f,bottom:d.rect.bottom-f})}}O(On,"liftTopLaneTitleBandsAboveRails");l(On,"liftTopLaneTitleBandsAboveRails");function Pn(t,e){const o=l(g=>{const h=g.groupTitleRect;if(!(!h||typeof h.left!="number"||typeof h.right!="number"||typeof h.top!="number"||typeof h.bottom!="number"||!Number.isFinite(h.left)||!Number.isFinite(h.right)||!Number.isFinite(h.top)||!Number.isFinite(h.bottom)||h.right<=h.left||h.bottom<=h.top))return{left:h.left,right:h.right,top:h.top,bottom:h.bottom}},"validTitleRect"),s=l(g=>{if(!g.isGroup||g.parentId||g.direction!=="LR")return;const h=o(g),S=g.x,M=g.width;if(!h||typeof S!="number"||typeof M!="number"||!Number.isFinite(S)||!Number.isFinite(M)||M<=0)return;const u=h.right-h.left,m=h.bottom-h.top;if(!(u<=0||m<u))return{node:g,rect:h}},"leftLaneTitleFor"),r=l((g,h)=>{if(!g.vertical)return!1;const S=g.a.x;return S<=h.left+J||S>=h.right-J?!1:zt(g.a.y,g.b.y,h.top,h.bottom)>=Ft},"verticalSegmentIntersectsTitle"),i=l((g,h)=>{if(!g.horizontal)return!1;const S=g.a.y;return S<=h.top+J||S>=h.bottom-J?!1:zt(g.a.x,g.b.x,h.left,h.right)>=Ft},"horizontalSegmentIntersectsTitle"),f=[...e.values()].map(s).filter(g=>!!g);if(f.length===0)return;let d=0;for(const g of t){if(g.isLayoutOnly)continue;const h=mt(g.points??[]);for(const S of it(h))for(const M of f)if(r(S,M.rect))d=Math.max(d,M.rect.right-S.a.x+4);else if(i(S,M.rect)){const u=Math.min(S.a.x,S.b.x);d=Math.max(d,M.rect.right-u+4)}}if(!(d<=J))for(const g of f){const h=g.node.x,S=g.node.width;typeof h!="number"||typeof S!="number"||!Number.isFinite(h)||!Number.isFinite(S)||S<=0||(g.node.x=h-d/2,g.node.width=S+d,g.node.groupTitleRect={...g.rect,left:g.rect.left-d,right:g.rect.right-d})}}O(Pn,"shiftLeftLaneTitleBandsLeftOfRails");l(Pn,"shiftLeftLaneTitleBandsLeftOfRails");function Zo(t,e){const{realNodeRects:o}=me(e.values()),s=t.filter(m=>!m.isLayoutOnly),r=l((m,c=new Map)=>mt(c.get(m)??m.points??[]),"replacementPointsFor"),i=l((m=new Map)=>{let c=0;for(let b=0;b<s.length;b++){const w=it(r(s[b],m));for(let I=b+1;I<s.length;I++){const T=it(r(s[I],m));for(const v of w)for(const p of T)ce(v.a,v.b,p.a,p.b,J)&&c++}}return c},"crossingCount"),f=l((m=new Map)=>s.reduce((c,b)=>c+qt(r(b,m)),0),"totalBends"),d=l(m=>{const c=r(m);if(c.length<4)return;const b=c[c.length-2],w=c[c.length-1];if(!(!wt(b,w,J)&&!Et(b,w,J)))return{tailStart:b,terminal:w}},"terminalTailFor"),g=l((m,c)=>{const b=r(m);if(b.length<3)return;const w=b[0],I=b[1];let T;if(wt(w,I,J))T={x:I.x,y:c.tailStart.y};else if(Et(w,I,J))T={x:c.tailStart.x,y:I.y};else return;const v=oe(mt([w,I,T,c.tailStart,c.terminal]));return it(v).length===v.length-1?v:void 0},"candidateWithDestinationTail"),h=l((m,c)=>{const b=[m.start,m.end].filter(w=>!!w);for(const w of it(c))if(At(w.a,w.b,o,b,-2))return!0;return!1},"pathHasNodeHit"),S=l((m,c,b)=>{for(const w of s)if(w!==m){for(const I of it(c))for(const T of it(r(w,b)))if(ne(I,T,.5)>=Ft)return!0}return!1},"pathHasSharedTrack"),M=l((m,c,b)=>!h(m,c)&&!S(m,c,b),"candidateIsSafe"),u=l(()=>{const m=new Map;for(const c of s){const b=c.end;if(!b||!e.has(b)||r(c).length<4)continue;const w=m.get(b)??[];w.push(c),m.set(b,w)}return m},"edgesByDestination");for(let m=0;m<4;m++){const c=i();if(c===0)return;const b=f();let w,I=c,T=b;for(const v of u().values())for(let p=0;p<v.length;p++)for(let y=p+1;y<v.length;y++){const A=v[p],P=v[y],N=d(A),R=d(P);if(!N||!R)continue;const _=g(A,R),F=g(P,N);if(!_||!F)continue;const Y=new Map([[A,_],[P,F]]);if(!M(A,_,Y)||!M(P,F,Y))continue;const Z=i(Y),et=f(Y);Z>=c||Z>I||Z===I&&et>=T||(w=Y,I=Z,T=et)}if(!w)return;for(const[v,p]of w)v.points=p}}O(Zo,"swapDestinationTerminalTailsToReduceCrossings");l(Zo,"swapDestinationTerminalTailsToReduceCrossings");function Jo(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values()),f=t.filter(v=>!v.isLayoutOnly),d=l((v,p=new Map)=>mt(p.get(v)??v.points??[]),"replacementPointsFor"),g=l((v=new Map)=>{let p=0;for(let y=0;y<f.length;y++){const A=it(d(f[y],v));for(let P=y+1;P<f.length;P++){const N=it(d(f[P],v));for(const R of A)for(const _ of N)ce(R.a,R.b,_.a,_.b,J)&&p++}}return p},"strictCrossingCount"),h=l((v=new Map)=>f.reduce((p,y)=>p+qt(d(y,v)),0),"totalBends"),S=l(v=>{const p=v.start,y=v.end,A=p?e.get(p):void 0,P=y?e.get(y):void 0,N=A?jt(A):void 0,R=P?jt(P):void 0;return N&&R?{src:N,dst:R}:void 0},"endpointRectsFor"),M=l((v,p,y)=>{if(y.index<=0||y.index+1>=p.length-1)return;const A=S(v);if(A){if(y.vertical){const P=y.a.x,N=Math.min(A.src.left,A.dst.left),R=Math.max(A.src.right,A.dst.right),_=P<N-J?"left":P>R+J?"right":void 0;return _?{edge:v,points:p,segmentIndex:y.index,axis:"vertical",side:_,coord:P,min:Math.min(y.a.y,y.b.y),max:Math.max(y.a.y,y.b.y)}:void 0}if(y.horizontal){const P=y.a.y,N=Math.min(A.src.top,A.dst.top),R=Math.max(A.src.bottom,A.dst.bottom),_=P<N-J?"top":P>R+J?"bottom":void 0;return _?{edge:v,points:p,segmentIndex:y.index,axis:"horizontal",side:_,coord:P,min:Math.min(y.a.x,y.b.x),max:Math.max(y.a.x,y.b.x)}:void 0}}},"externalRailForSegment"),u=l(()=>{const v=[];for(const p of f){const y=d(p);for(const A of it(y)){const P=M(p,y,A);P&&v.push(P)}}return v},"collectExternalRails"),m=l((v,p)=>v.edge!==p.edge&&v.axis===p.axis&&v.side===p.side&&zt(v.min,v.max,p.min,p.max)>=Ft,"railsInteract"),c=l(v=>{const p=[],y=new Set;for(const A of v){if(y.has(A))continue;const P=[A],N=[];for(y.add(A);P.length>0;){const R=P.pop();N.push(R);for(const _ of v)!y.has(_)&&m(R,_)&&(y.add(_),P.push(_))}N.length>1&&p.push(N)}return p},"connectedComponents"),b=l(v=>{const p=[];for(const y of v)p.some(A=>Math.abs(A-y.coord)<J)||p.push(y.coord);for(;p.length<v.length;){const y=Math.min(...p),A=Math.max(...p),P=v[0].side;p.push(P==="left"||P==="top"?y-12*(v.length-p.length):A+12*(v.length-p.length))}return p},"uniqueCoordsFor"),w=l(v=>{const p=v.map(P=>P.coord),y=b(v),A=[];if(v.length<=6){const P=new Array(y.length).fill(!1),N=[],R=l(()=>{if(N.length===v.length){N.some((_,F)=>Math.abs(_-p[F])>=J)&&A.push([...N]);return}for(const[_,F]of y.entries())P[_]||(P[_]=!0,N.push(F),R(),N.pop(),P[_]=!1)},"visit");return R(),A}for(let P=0;P<p.length;P++)for(let N=P+1;N<p.length;N++){const R=[...p];[R[P],R[N]]=[R[N],R[P]],A.push(R)}return A},"coordinateAssignmentsFor"),I=l((v,p)=>{const y=new Map;for(const[P,N]of v.entries()){const R=p[P],_=y.get(N.edge)??N.points.map(F=>({x:F.x,y:F.y}));N.axis==="vertical"?(_[N.segmentIndex].x=R,_[N.segmentIndex+1].x=R):(_[N.segmentIndex].y=R,_[N.segmentIndex+1].y=R),y.set(N.edge,_)}const A=new Map;for(const[P,N]of y){const R=oe(mt(N));if(it(R).length!==R.length-1)return;A.set(P,R)}return A},"replacementsForAssignment"),T=l(v=>{for(const[p,y]of v){const A=[p.start,p.end].filter(P=>!!P);for(const P of it(y))if(At(P.a,P.b,r,A,-2)||At(P.a,P.b,i,[],-2))return!1}for(let p=0;p<f.length;p++){const y=f[p],A=v.has(y),P=it(d(y,v));for(let N=p+1;N<f.length;N++){const R=f[N];if(!A&&!v.has(R))continue;const _=it(d(R,v));for(const F of P)for(const Y of _)if(ne(F,Y,.5)>=Ft)return!1}}return!0},"candidateIsSafe");for(let v=0;v<4;v++){const p=g();if(p===0)return;let y,A=p,P=h(),N=Number.POSITIVE_INFINITY;for(const R of c(u()))for(const _ of w(R)){const F=I(R,_);if(!F||!T(F))continue;const Y=g(F);if(Y>=p)continue;const Z=h(F),et=R.reduce((nt,Mt,yt)=>nt+Math.abs(_[yt]-Mt.coord),0);Y>A||Y===A&&(Z>P||Z===P&&et>=N)||(y=F,A=Y,P=Z,N=et)}if(!y)return;for(const[R,_]of y)R.points=_}}O(Jo,"reassignCrossingExternalRailChannels");l(Jo,"reassignCrossingExternalRailChannels");function Qo(t,e){const{realNodeRects:o,labelNodeRects:s}=me(e.values()),r=t.filter(u=>!u.isLayoutOnly),i=l((u,m,c)=>mt(u===m?c??[]:u.points??[]),"pointsFor"),f=l(u=>it(u).reduce((m,c)=>{const b=c.a.x-c.b.x,w=c.a.y-c.b.y;return m+Math.hypot(b,w)},0),"pathLength"),d=l((u,m)=>{let c=0;for(let b=0;b<r.length;b++){const w=it(i(r[b],u,m));for(let I=b+1;I<r.length;I++){const T=it(i(r[I],u,m));for(const v of w)for(const p of T)ce(v.a,v.b,p.a,p.b,J)&&c++}}return c},"strictCrossingCount"),g=l((u,m)=>{if(u.horizontal){const c=u.a.y;return(Math.abs(c-m.top)<1||Math.abs(c-m.bottom)<1)&&zt(u.a.x,u.b.x,m.left,m.right)>=Ft}if(u.vertical){const c=u.a.x;return(Math.abs(c-m.left)<1||Math.abs(c-m.right)<1)&&zt(u.a.y,u.b.y,m.top,m.bottom)>=Ft}return!1},"segmentRunsAlongRectBorder"),h=l(u=>{const m=[u.start,u.end].filter(b=>!!b),c=[];for(const b of m){const w=e.get(b),I=w?jt(w):void 0;I&&c.push(I)}return c},"endpointRectsFor"),S=l((u,m)=>{if(m+3>=u.length)return[];const c=u[m],b=u[m+1],w=u[m+2],I=u[m+3],T=wt(c,b,J)&&Et(b,w,J)&&wt(w,I,J),v=Et(c,b,J)&&wt(b,w,J)&&Et(w,I,J);if(!T&&!v)return[];if(!(T?Math.sign(b.x-c.x)!==Math.sign(I.x-w.x):Math.sign(b.y-c.y)!==Math.sign(I.y-w.y)))return[];const p=dt(c,I,J)||ut(c,I,J)?[]:[{x:c.x,y:I.y},{x:I.x,y:c.y}],y=p.length===0?[[...u.slice(0,m+1),...u.slice(m+3)]]:p.map(P=>[...u.slice(0,m+1),P,...u.slice(m+3)]),A=new Set;return y.map(P=>oe(mt(P))).filter(P=>{if(it(P).length!==P.length-1||!P.some(R=>Qt(R,I,J)))return!1;const N=P.map(R=>`${R.x.toFixed(3)},${R.y.toFixed(3)}`).join("|");return A.has(N)?!1:(A.add(N),!0)})},"shortcutCandidatesAt"),M=l((u,m,c)=>{const b=[u.start,u.end].filter(I=>!!I),w=h(u);for(const I of it(m))if(At(I.a,I.b,o,b,-2)||At(I.a,I.b,s,[],-2)||w.some(T=>g(I,T)))return!1;for(const I of r)if(I!==u){for(const T of it(m))for(const v of it(i(I)))if(ne(T,v,.5)>=Ft)return!1}return d(u,m)<=c},"candidateIsSafe");for(let u=0;u<8;u++){const m=d();let c,b,w=m,I=Number.POSITIVE_INFINITY,T=Number.POSITIVE_INFINITY;for(const v of r){const p=i(v),y=qt(p,J),A=f(p);for(let P=0;P<=p.length-4;P++)for(const N of S(p,P)){const R=qt(N,J),_=f(N);if(!(R<y||R===y&&_<A-J)||!M(v,N,m))continue;const F=d(v,N);F>w||F===w&&(R>I||R===I&&_>=T)||(c=v,b=N,w=F,I=R,T=_)}}if(!c||!b)return;c.points=b}}O(Qo,"shortcutRedundantOrthogonalJogs");l(Qo,"shortcutRedundantOrthogonalJogs");function ts(t,e){const i=[];for(const k of e.values()){if(k.isGroup||k.isEdgeLabel)continue;const D=k.x??0,H=k.y??0,j=jt(k);j&&i.push({id:String(k.id??""),cx:D,cy:H,rect:j})}if(i.length===0)return;const f=new Map(i.map(k=>[k.id,k])),d=i.map(k=>({id:k.id,rect:k.rect})),g=["top","bottom","left","right"],h={top:Math.min(...i.map(k=>k.rect.top))-20,bottom:Math.max(...i.map(k=>k.rect.bottom))+20,left:Math.min(...i.map(k=>k.rect.left))-20,right:Math.max(...i.map(k=>k.rect.right))+20},S=t.filter(k=>!k.isLayoutOnly),M=new Map(S.map((k,D)=>[k,D])),u=l(k=>{const D=k==="left"||k==="top"?-1:1,H=[];for(let j=0;j<=2;j++)H.push(h[k]+D*20*j);return H},"outwardTracksForSide"),m=l((k,D=new Map)=>mt(D.get(k)??k.points??[]),"replacementPointsFor"),c=l((k,D)=>{let H=0;for(const j of k)for(const a of D)ce(j.a,j.b,a.a,a.b,J)&&H++;return H},"crossingCountBetweenSegments"),b=l((k,D)=>c(it(k),it(D)),"crossingCountBetweenPaths"),w=l((k=new Map)=>{let D=0;const H=[],j=new Set,a=[],x=l(C=>{j.has(C)||(j.add(C),a.push(C))},"addEdge");for(let C=0;C<S.length;C++){const L=S[C],E=m(L,k);for(let B=C+1;B<S.length;B++){const $=S[B],q=b(E,m($,k));q>0&&(D+=q,H.push({first:L,second:$,count:q}),x(L),x($))}}return a.sort((C,L)=>(M.get(C)??0)-(M.get(L)??0)),{count:D,pairs:H,edgeSet:j,edges:a}},"crossingSnapshot"),I=l((k,D)=>{const H=new Set(D.keys());if(H.size===0)return k.count;let j=0;for(const x of k.pairs)(H.has(x.first)||H.has(x.second))&&(j+=x.count);let a=0;for(let x=0;x<S.length;x++){const C=S[x],L=H.has(C),E=m(C,D);for(let B=x+1;B<S.length;B++){const $=S[B];!L&&!H.has($)||(a+=b(E,m($,D)))}}return k.count-j+a},"crossingCountWithReplacements"),T=l(k=>{const D=new Map;for(const a of k.pairs){const x=D.get(a.first)??new Set;x.add(a.second),D.set(a.first,x);const C=D.get(a.second)??new Set;C.add(a.first),D.set(a.second,C)}const H=[],j=new Set;for(const a of k.edges){if(j.has(a))continue;const x=[a],C=[];for(j.add(a);x.length>0;){const L=x.pop();C.push(L);for(const E of D.get(L)??[])j.has(E)||(j.add(E),x.push(E))}C.sort((L,E)=>(M.get(L)??0)-(M.get(E)??0)),C.length>1&&H.push(C)}return H},"crossingComponents"),v=l(k=>[k.start,k.end].filter(D=>!!D),"endpointIdsFor"),p=l(k=>{const D=[];for(const H of T(k)){const j=new Set(H),a=new Set(H.flatMap(C=>v(C))),x=[...H];for(const C of S)j.has(C)||v(C).some(L=>a.has(L))&&x.push(C);x.sort((C,L)=>(M.get(C)??0)-(M.get(L)??0)),D.push(x)}return D},"pairSearchGroups"),y=l((k,D,H)=>I(k,new Map([[D,H]])),"crossingCountWithSingleReplacement"),A=l(k=>{const D=new Map;for(const H of k.pairs)D.set(H.first,(D.get(H.first)??0)+H.count),D.set(H.second,(D.get(H.second)??0)+H.count);return D},"currentCrossingsByEdge"),P=l(k=>k.slice(1).reduce((D,H,j)=>{const a=k[j];return D+Math.abs(H.x-a.x)+Math.abs(H.y-a.y)},0),"pathLength"),N=l((k=new Map)=>S.reduce((D,H)=>D+qt(m(H,k)),0),"totalBends"),R=l((k=new Map)=>S.reduce((D,H)=>D+P(m(H,k)),0),"totalLength"),_=l((k,D,H=new Map)=>{const j=it(D);for(const a of S)if(a!==k){for(const x of j)for(const C of it(m(a,H)))if(ne(x,C,.5)>=Ft)return!0}return!1},"pathHasSegmentConflict"),F=l((k,D)=>{const H=[k.start,k.end].filter(j=>!!j);for(const j of it(D))if(At(j.a,j.b,d,H,-2))return!0;return!1},"pathHitsNode"),Y=l((k,D)=>{const H=oe(mt(D));it(H).length===H.length-1&&k.push(H)},"pushOrthogonalCandidate"),Z=l(k=>k==="left"||k==="right","sideIsHorizontal"),et=l((k,D,H)=>{switch(D){case"left":return Math.min(k.x,H.x)-20;case"right":return Math.max(k.x,H.x)+20;case"top":return Math.min(k.y,H.y)-20;case"bottom":return Math.max(k.y,H.y)+20}},"localTrackForSameSide"),nt=l((k,D,H,j)=>{const a=H==="left"||H==="top"?-1:1,x=[et(D,H,j),h[H]];for(const C of x)for(let L=0;L<=2;L++)Y(k,Qn(D,H,j,C+a*20*L))},"addSameSideCandidates"),Mt=l((k,D,H,j,a)=>{for(const x of u(H))for(const C of u(a))Y(k,[D,{x,y:D.y},{x,y:C},{x:j.x,y:C},j])},"addHorizontalToVerticalCandidates"),yt=l((k,D,H,j,a)=>{for(const x of u(H))for(const C of u(a))Y(k,[D,{x:D.x,y:x},{x:C,y:x},{x:C,y:j.y},j])},"addVerticalToHorizontalCandidates"),Bt=l((k,D,H,j,a)=>{const x=[...u("top"),...u("bottom")];for(const C of u(H))for(const L of u(a))for(const E of x)Y(k,[D,{x:C,y:D.y},{x:C,y:E},{x:L,y:E},{x:L,y:j.y},j])},"addHorizontalPairCandidates"),rt=l((k,D,H,j,a)=>{const x=[...u("left"),...u("right")];for(const C of u(H))for(const L of u(a))for(const E of x)Y(k,[D,{x:D.x,y:C},{x:E,y:C},{x:E,y:L},{x:j.x,y:L},j])},"addVerticalPairCandidates"),K=l(k=>{const D=new Set;return k.map(H=>mt(H)).filter(H=>{const j=H.map(a=>`${a.x.toFixed(3)},${a.y.toFixed(3)}`).join("|");return D.has(j)||H.length<2?!1:(D.add(j),!0)})},"dedupeCandidatePaths"),Q=l((k,D,H,j)=>{const a=[],x=Jn(k,D,H,j,20,J);x&&Y(a,x),D===j&&nt(a,k,D,H);const C=Z(D),L=Z(j);return C&&!L?Mt(a,k,D,H,j):!C&&L?yt(a,k,D,H,j):C?Bt(a,k,D,H,j):rt(a,k,D,H,j),K(a)},"buildCandidatesForSides"),st=l((k,D,H,j)=>{const a=[...u("left"),...u("right")],x=[...u("top"),...u("bottom")];for(const C of g){const L=Me(j,C),E=C==="top"||C==="bottom"?u(C):x;for(const B of a){Y(k,[D,H,{x:B,y:H.y},{x:B,y:L.y},L]);for(const $ of E)Y(k,[D,H,{x:B,y:H.y},{x:B,y:$},{x:L.x,y:$},L])}}},"addVerticalDepartureOuterTrackCandidates"),at=l((k,D,H,j)=>{const a=[...u("left"),...u("right")],x=[...u("top"),...u("bottom")];for(const C of g){const L=Me(j,C),E=C==="left"||C==="right"?u(C):a;for(const B of x){Y(k,[D,H,{x:H.x,y:B},{x:L.x,y:B},L]);for(const $ of E)Y(k,[D,H,{x:H.x,y:B},{x:$,y:B},{x:$,y:L.y},L])}}},"addHorizontalDepartureOuterTrackCandidates"),bt=l(k=>{const D=k.start,H=k.end,j=H?f.get(H):void 0;if(!D||!j)return[];const a=mt(k.points??[]);if(a.length<4)return[];const x=a[0],C=a[1],L=[];return Et(x,C,J)?st(L,x,C,j):wt(x,C,J)&&at(L,x,C,j),L},"terminalPreservingOuterTrackCandidates"),It=l(k=>{const D=k.start,H=k.end,j=D?f.get(D):void 0,a=H?f.get(H):void 0;if(!j||!a)return[];const x=[];for(const C of g){const L=Me(j,C);for(const E of g)x.push(...Q(L,C,Me(a,E),E))}return x.push(...bt(k)),x},"candidatePathsFor"),Lt=l(()=>new Map(S.map(k=>[k,it(m(k))])),"currentSegmentsByEdge"),Ut=l((k,D,H)=>{const j=new Set;for(const a of S){if(a===k)continue;const x=H.get(a)??it(m(a));D.some(C=>x.some(L=>ne(C,L,.5)>=Ft))&&j.add(a)}return j},"sharedTrackConflictsFor"),Zt=l((k,D,H,j)=>{const a=new Set;return It(k).map(x=>oe(mt(x))).filter(x=>{if(F(k,x))return!1;const C=x.map(L=>`${L.x.toFixed(3)},${L.y.toFixed(3)}`).join("|");return a.has(C)||x.length<2?!1:(a.add(C),!0)}).map(x=>{const C=it(x);let L=0;for(const E of S)E!==k&&(L+=c(C,H.get(E)??it(m(E))));return{candidate:x,candidateSegments:C,crossings:D.count-(j.get(k)??0)+L,bends:qt(x,J),totalBends:qt(x),length:P(x)}}).filter(({crossings:x})=>x<=D.count).sort((x,C)=>x.crossings-C.crossings||x.bends-C.bends||x.length-C.length).slice(0,48).map(x=>({path:x.candidate,segments:x.candidateSegments,sharedTrackConflicts:Ut(k,x.candidateSegments,H),totalBends:x.totalBends,length:x.length}))},"pairCandidatesFor"),se=l((k,D,H,j,a,x)=>{let C=0;for(const E of k.pairs)(E.first===D||E.second===D||E.first===j||E.second===j)&&(C+=E.count);let L=c(H.segments,a.segments);for(const E of S){if(E===D||E===j)continue;const B=x.get(E)??it(m(E));L+=c(H.segments,B)+c(a.segments,B)}return k.count-C+L},"pairCrossingCount"),re=l((k,D)=>{for(const H of k.sharedTrackConflicts)if(H!==D)return!1;return!0},"conflictsOnlyWith"),Oe=l((k,D)=>k.segments.some(H=>D.segments.some(j=>ne(H,j,.5)>=Ft)),"candidatesShareTrack"),Ie=l((k,D,H,j)=>re(D,H.edge)&&re(j,k.edge)&&!Oe(D,j),"pairCandidatesAreCompatible"),Ae=l((k,D,H,j,a)=>{const x=se(k.current,D.edge,H,j.edge,a,k.baseSegments);if(!(x>=k.current.count))return{replacements:new Map([[D.edge,H.path],[j.edge,a.path]]),crossings:x,bends:k.currentBends-(k.baseBendsByEdge.get(D.edge)??0)-(k.baseBendsByEdge.get(j.edge)??0)+H.totalBends+a.totalBends,length:k.currentLength-(k.baseLengthByEdge.get(D.edge)??0)-(k.baseLengthByEdge.get(j.edge)??0)+H.length+a.length}},"scorePairReplacement"),on=l((k,D)=>k.crossings<D.crossings||k.crossings===D.crossings&&(k.bends<D.bends||k.bends===D.bends&&k.length<D.length),"pairScoreIsBetter"),sn=l((k,D,H,j)=>{let a=j;for(const x of D.candidates)for(const C of H.candidates){if(!Ie(D,x,H,C))continue;const L=Ae(k,D,x,H,C);L&&on(L,a)&&(a=L)}return a},"bestScoreForOptionPair"),rn=l(k=>{const D=N(),H=R(),j=Lt(),a=A(k),x=new Map(S.map(q=>[q,qt(m(q))])),C=new Map(S.map(q=>[q,P(m(q))])),L=new Map,E=p(k);for(const q of E)for(const G of q){if(L.has(G))continue;const X=Zt(G,k,j,a);X.length>0&&L.set(G,{edge:G,candidates:X})}let B={replacements:new Map,crossings:k.count,bends:D,length:H};const $={current:k,currentBends:D,currentLength:H,baseBendsByEdge:x,baseLengthByEdge:C,baseSegments:j};for(const q of E){const G=new Set(q.filter(W=>k.edgeSet.has(W))),X=q.map(W=>L.get(W)).filter(W=>!!W);for(let W=0;W<X.length;W++){const ft=X[W];for(let St=W+1;St<X.length;St++){const ot=X[St];!G.has(ft.edge)&&!G.has(ot.edge)||(B=sn($,ft,ot,B))}}}return B.replacements.size>0?B.replacements:void 0},"bestPairedReplacement");for(let k=0;k<4;k++){const D=w(),H=D.count;if(H===0)return;let j,a,x=H,C=Number.POSITIVE_INFINITY;for(const E of D.edges){const B=qt(m(E),J);for(const $ of It(E)){const q=F(E,$),G=!q&&_(E,$),X=y(D,E,$),W=qt($,J);q||G||(X<H||X===H&&W<B)&&(X>x||X===x&&W>=C||(j=E,a=$,x=X,C=W))}}if(j&&a){j.points=a;continue}const L=rn(D);if(!L)return;for(const[E,B]of L)E.points=B}}O(ts,"resolveRenderedOrthogonalCrossings");l(ts,"resolveRenderedOrthogonalCrossings");var ge=.001,fr=8;function es(t,e){const{nodeInfoById:n,realNodeRects:o}=Qe(e),s=["top","bottom","left","right"],r=20,i={top:Math.min(...o.map(c=>c.rect.top))-r,bottom:Math.max(...o.map(c=>c.rect.bottom))+r,left:Math.min(...o.map(c=>c.rect.left))-r,right:Math.max(...o.map(c=>c.rect.right))+r},f=l((c,b,w,I)=>{const T=[],v=Jn(c,b,w,I,r,ge);return v&&T.push(v),b===I&&T.push(Qn(c,b,w,i[b])),T},"buildOrthogonalPathCandidates"),d=l((c,b)=>{for(let w=0;w<c.length-1;w++){const I=c[w],T=c[w+1];if(At(I,T,o,b,1))return!0}return!1},"pathHitsNode"),g=l((c,b,w=!1)=>{let I=0;const T=Ee(c,ge),v=b.start,p=b.end;for(const y of t){if(y===b||y.isLayoutOnly)continue;const A=y.start,P=y.end;if(!w&&v&&p&&(A===v||A===p||P===v||P===p))continue;const N=y.points;if(!(!N||N.length<2))for(const R of T)for(const _ of Ee(N,ge)){if(eo(R.a,R.b,_.a,_.b,ge,ge)){I++;continue}ne(R,_,ge)>=fr&&I++}}return I},"pathConflictCount"),h=4,S=l((c,b)=>{const w=Math.abs(c.y-b.rect.top),I=Math.abs(c.y-b.rect.bottom),T=Math.abs(c.x-b.rect.left),v=Math.abs(c.x-b.rect.right);let p="top",y=w;return I<y&&(p="bottom",y=I),T<y&&(p="left",y=T),v<y&&(p="right",y=v),p},"nearestSideOfRect"),M=new Map,u=l((c,b,w)=>{const I=M.get(c)??[];I.push({side:b,edgeId:w}),M.set(c,I)},"addFaceClaim");for(const c of t){if(c.isLayoutOnly)continue;const b=c.points??[];if(b.length<1)continue;const w=c.id??"",I=c.start,T=c.end;if(I){const v=n.get(I);v&&u(I,S(b[0],v),w)}if(T){const v=n.get(T);v&&u(T,S(b[b.length-1],v),w)}}const m=l((c,b,w)=>M.get(c)?.some(I=>I.edgeId!==w&&I.side===b)??!1,"faceIsClaimed");for(const c of t){if(c.isLayoutOnly)continue;const b=c.points;if(!b||b.length<2)continue;const w=qt(b,ge);if(w<h)continue;const I=c.start,T=c.end;if(!I||!T)continue;const v=n.get(I),p=n.get(T);if(!v||!p)continue;const y=c.id??"",A=g(b,c,!0),P=g(b,c);let N,R=A,_=w;for(const F of s){if(m(I,F,y))continue;const Y=Me(v,F);for(const Z of s){if(m(T,Z,y))continue;const et=Me(p,Z);for(const nt of f(Y,F,et,Z)){if(d(nt,[I,T]))continue;const Mt=qt(nt,ge);if(A>0){const yt=g(nt,c,!0);if(yt>R||yt===R&&Mt>=_)continue;R=yt,_=Mt,N=nt;continue}g(nt,c)>P||Mt<_&&(_=Mt,N=nt)}}}if(N){c.points=N;const F=M.get(I);F&&M.set(I,F.filter(Z=>Z.edgeId!==y));const Y=M.get(T);Y&&M.set(T,Y.filter(Z=>Z.edgeId!==y)),u(I,S(N[0],v),y),u(T,S(N[N.length-1],p),y)}}}O(es,"simplifyDetouredEdges");l(es,"simplifyDetouredEdges");var Vt=.001,Io=10,He=7;function kn(t,e){const n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;const i=r.x-s.x,f=r.y-s.y;if(!(Math.abs(i)+Math.abs(f)<Vt)){if(Math.abs(f)<=Vt){const d=s.x+Math.sign(i)*Io;return{left:Math.min(s.x,d),right:Math.max(s.x,d),top:s.y-He,bottom:s.y+He}}if(Math.abs(i)<=Vt){const d=s.y+Math.sign(f)*Io;return{left:s.x-He,right:s.x+He,top:Math.min(s.y,d),bottom:Math.max(s.y,d)}}return{left:Math.min(s.x,r.x),right:Math.max(s.x,r.x),top:Math.min(s.y,r.y),bottom:Math.max(s.y,r.y)}}}O(kn,"markerClearanceRectFor");l(kn,"markerClearanceRectFor");function ns(t){return{left:Math.min(t.left,t.right),right:Math.max(t.left,t.right),top:Math.min(t.top,t.bottom),bottom:Math.max(t.top,t.bottom)}}O(ns,"normalizeRect");l(ns,"normalizeRect");function Bn(t,e){const n=mt(e);return[kn(n,!0),kn(n,!1)].some(o=>o&&ze(t,ns(o)))}O(Bn,"labelOverlapsOwnMarker");l(Bn,"labelOverlapsOwnMarker");function Ye(t,e){const n=[];for(const m of t){if(m.isLayoutOnly)continue;const c=m.points;if(!(!c||c.length<2))for(let b=0;b<c.length-1;b++)n.push({edgeId:m.id,p1:c[b],p2:c[b+1]})}const o=[],s=[];for(const m of e.values()){const c=m.isGroup,b=m.parentId;if(c&&!b){const I=jt(m);I&&s.push({id:m.id,rect:I});continue}if(c||m.isEdgeLabel)continue;const w=jt(m);w&&o.push({nodeId:m.id,rect:w})}const r=3,i=1,f=12,d=l((m,c)=>{const b=yn(c,r);for(const{nodeId:w,rect:I}of o)if(w!==m&&ze(b,I))return!0;return!1},"labelOverlapsForeignNode"),g=l((m,c)=>{const b=yn(c,r);for(const w of n)if(w.edgeId!==m&&Je(w.p1,w.p2,b))return!0;return!1},"labelOverlapsForeignEdge"),h=l((m,c,b)=>d(m,b)||g(c,b),"labelOverlapsAnything"),S=[],M=l(m=>{for(const{id:c,rect:b}of s)if(Ro(b,m))return c},"findContainingLane"),u=l((m,c)=>S.some(b=>b.labelId!==m&&ze(c,b.rect)),"overlapsPlacedLabel");for(const m of t){if(m.isLayoutOnly)continue;const c=m.labelNodeId;if(!c)continue;const b=e.get(c);if(!b)continue;const w=m.points;if(!w||w.length<2)continue;const I=b.width??0,T=b.height??0;if(I<=0||T<=0)continue;const v=[];for(let K=0;K<w.length-1;K++){const Q=w[K],st=w[K+1],at=Math.abs(Q.x-st.x),bt=Math.abs(Q.y-st.y);at<Vt&&bt<Vt||at>=Vt&&bt>=Vt||v.push({idx:K,length:at+bt,orientation:at>=Vt?"horizontal":"vertical",midX:(Q.x+st.x)/2,midY:(Q.y+st.y)/2})}if(v.length===0)continue;const p=v.length>=3?v.filter(K=>K.idx>0&&K.idx<v.length-1):v,y=p.length>0?p:v,A=I>=T?"horizontal":"vertical",P=l(K=>[...K].sort((Q,st)=>{const at=Q.orientation===A;if(at!==(st.orientation===A))return at?-1:1;const bt=Q.length>=(Q.orientation==="horizontal"?I:T)+2;return bt!==st.length>=(st.orientation==="horizontal"?I:T)+2?bt?-1:1:st.length-Q.length}),"rankSegments"),N=v[0],R=v[v.length-1],_=[.5,.25,.75,.05,.95,.15,.85,.1,.9],F=l((K,Q)=>{const st=w[K.idx],at=w[K.idx+1];return{midX:st.x+(at.x-st.x)*Q,midY:st.y+(at.y-st.y)*Q}},"anchorAtT"),Y=l((K,Q,st)=>Math.min(st,Math.max(Q,K)),"clamp"),Z=l((K,Q)=>K.midX>=Q.left-Vt&&K.midX<=Q.right+Vt&&K.midY>=Q.top-Vt&&K.midY<=Q.bottom+Vt,"pointInsideRectInclusive"),et=l(K=>{const Q=we(K.midX,K.midY,I,T),st=M(Q);if(st)return{laneId:st,anchor:K,rect:Q};const at=s.find(({rect:re})=>Z(K,re));if(!at)return;const bt=at.rect.left+I/2+i,It=at.rect.right-I/2-i,Lt=at.rect.top+T/2+i,Ut=at.rect.bottom-T/2-i;if(bt>It||Lt>Ut)return;const Zt={midX:Y(K.midX,bt,It),midY:Y(K.midY,Lt,Ut)},se=we(Zt.midX,Zt.midY,I,T);return Z(K,se)?{laneId:at.id,anchor:Zt,rect:se}:void 0},"placementForAnchor"),nt=l((K,Q,st)=>K.orientation==="horizontal"?Math.abs(Q.midX-st.x):Math.abs(Q.midY-st.y),"distanceAlongSegment"),Mt=l((K,Q)=>{const st=(K.orientation==="horizontal"?I/2:T/2)+f;if(K===N){const at=w[K.idx];if(nt(K,Q,at)+Vt<st)return!1}if(K===R){const at=w[K.idx+1];if(nt(K,Q,at)+Vt<st)return!1}return!0},"labelClearsTerminalEndpoints"),yt=l(K=>{const Q=P(K);for(const st of Q)for(const at of _){const bt=F(st,at);if(!Mt(st,bt))continue;const It=et(bt);if(It&&!Bn(It.rect,w)&&!u(c,It.rect)&&!h(c,m.id,It.rect))return{laneId:It.laneId,anchor:It.anchor}}},"tryPool"),Bt=l((K,Q,st=!1)=>{const at=P(K);for(const bt of at){const It={midX:bt.midX,midY:bt.midY};if(Q&&!Mt(bt,It))continue;const Lt=et(It);if(Lt&&!Bn(Lt.rect,w)&&!u(c,Lt.rect)&&!d(c,Lt.rect)&&(st||!g(m.id,Lt.rect)))return{laneId:Lt.laneId,anchor:Lt.anchor}}},"findLaneContainingFallback"),rt=yt(y)??(y.length<v.length?yt(v):void 0)??Bt(v,!0)??Bt(v,!1)??Bt(v,!1,!0);if(rt){b.x=rt.anchor.midX,b.y=rt.anchor.midY,b.parentId=rt.laneId;const K=we(rt.anchor.midX,rt.anchor.midY,I,T),Q=S.findIndex(st=>st.labelId===c);Q>=0?S[Q]={labelId:c,rect:K}:S.push({labelId:c,rect:K})}}}O(Ye,"anchorLabelsToPolyline");l(Ye,"anchorLabelsToPolyline");var gn=1e-6,So=4,lr=3;function Fn(t,e){return t<e?`${t}::${e}`:`${e}::${t}`}O(Fn,"pairKey");l(Fn,"pairKey");function os(t,e){const{nodeInfoById:n,realNodeRects:o}=Qe(e),s=new Map;for(const i of e){const f=i.id;if(!i.isGroup&&i.isEdgeLabel){s.set(f,{w:i.width??0,h:i.height??0});continue}}const r=l((i,f,d,g)=>{const h=Fn(f,d);let S=0;const M=l(u=>{if(!u)return;const m=s.get(u);if(!m)return;const c=g==="x"?m.w/2:m.h/2;c>S&&(S=c)},"consider");M(i.labelNodeId);for(const u of t){if(u===i||u.isLayoutOnly)continue;const m=u.start,c=u.end;!m||!c||Fn(m,c)===h&&M(u.labelNodeId)}return S>0?S+lr:0},"labelClearanceFor");for(const i of t){if(i.isLayoutOnly)continue;const f=i.points;if(!qn(f,gn))continue;const d=to(i,n,gn);if(!d)continue;const{srcId:g,dstId:h,srcInfo:S,dstInfo:M,collinearX:u,collinearY:m}=d;if(u===m)continue;let c,b;if(u){const v=M.cy>S.cy;c={x:S.cx,y:v?S.rect.bottom:S.rect.top},b={x:M.cx,y:v?M.rect.top:M.rect.bottom}}else{const v=M.cx>S.cx;c={x:v?S.rect.right:S.rect.left,y:S.cy},b={x:v?M.rect.left:M.rect.right,y:M.cy}}if(At(c,b,o,[g,h],1))continue;const w=r(i,g,h,u?"x":"y"),I=w>So?w:So,T=[0,I,-I];for(const v of T){const p={...c},y={...b};if(u){if(p.x+=v,y.x+=v,p.x<=S.rect.left||p.x>=S.rect.right||y.x<=M.rect.left||y.x>=M.rect.right)continue}else if(p.y+=v,y.y+=v,p.y<=S.rect.top||p.y>=S.rect.bottom||y.y<=M.rect.top||y.y>=M.rect.bottom)continue;if(!At(p,y,o,[g,h],1)&&!$e(p,y,t,i,{epsilon:gn})){i.points=[p,y];break}}}}O(os,"straightenCollinearSiblingDetours");l(os,"straightenCollinearSiblingDetours");function _n(t,e){const{realNodeRects:d,labelNodeRects:g}=me(e.values()),h=l((p,y)=>Ee(y,.001).map(A=>({...A,edge:p,interior:A.index>=1&&A.index<=y.length-3})),"segmentsFor"),S=l(()=>{const p=[];for(const y of t){if(y.isLayoutOnly)continue;const A=y.points;!A||A.length<2||p.push(...h(y,mt(A)))}return p},"allSegments"),M=l((p,y)=>p.horizontal&&y.horizontal?zt(p.a.x,p.b.x,y.a.x,y.b.x)>=8&&Math.abs(p.a.y-y.a.y)<7:p.vertical&&y.vertical?zt(p.a.y,p.b.y,y.a.y,y.b.y)>=8&&Math.abs(p.a.x-y.a.x)<7:!1,"hasCrowdedParallelTrack"),u=l((p,y)=>{const A=p.start,P=p.end,N=h(p,y);if(N.length!==y.length-1)return!1;const R=[A,P].filter(F=>!!F),_=p.labelNodeId?[p.labelNodeId]:[];for(const F of N)if(At(F.a,F.b,d,R,-2)||At(F.a,F.b,g,_,-2))return!1;for(const F of t){if(F===p||F.isLayoutOnly)continue;const Y=F.points;if(!(!Y||Y.length<2)){for(const Z of N)for(const et of h(F,mt(Y)))if(M(Z,et)||ce(Z.a,Z.b,et.a,et.b,.001))return!1}}return!0},"candidateIsSafe"),m=l((p,y)=>{const A=mt(p.edge.points??[]);if(A.length<4||p.index>=A.length-1)return;const P=A.map(N=>({...N}));if(p.horizontal)P[p.index].y+=y,P[p.index+1].y+=y;else if(p.vertical)P[p.index].x+=y,P[p.index+1].x+=y;else return;return h(p.edge,P).length===P.length-1?P:void 0},"shiftedCandidate"),c=l((p,y)=>({x:p.x??(y.left+y.right)/2,y:p.y??(y.top+y.bottom)/2}),"nodeCenter"),b=l(p=>{const y=p.edge,A=mt(y.points??[]);if(A.length!==4||p.index!==1)return;const P=y.start?e.get(y.start):void 0,N=y.end?e.get(y.end):void 0,R=P?jt(P):void 0,_=N?jt(N):void 0,F=A.slice(p.index+2);if(!(!P||!N||!R||!_||F.length===0))return{sourceCenter:c(P,R),targetCenter:c(N,_),sourceRect:R,tail:F}},"sourceDetourContextFor"),w=l((p,y,A,P,N,R)=>{const _=P.y>=A.y,F=_?N.bottom:N.top,Y=F+(_?20:-20);if(_&&p.b.y<=Y+.001||!_&&p.b.y>=Y-.001)return;const Z=p.a.x+y;return mt([{x:A.x,y:F},{x:A.x,y:Y},{x:Z,y:Y},{x:Z,y:p.b.y},...R],.001)},"verticalSourceDetour"),I=l((p,y,A,P,N,R)=>{const _=P.x>=A.x,F=_?N.right:N.left,Y=F+(_?20:-20);if(_&&p.b.x<=Y+.001||!_&&p.b.x>=Y-.001)return;const Z=p.a.y+y;return mt([{x:F,y:A.y},{x:Y,y:A.y},{x:Y,y:Z},{x:p.b.x,y:Z},...R],.001)},"horizontalSourceDetour"),T=l((p,y)=>{const A=b(p);if(A){if(p.vertical)return w(p,y,A.sourceCenter,A.targetCenter,A.sourceRect,A.tail);if(p.horizontal)return I(p,y,A.sourceCenter,A.targetCenter,A.sourceRect,A.tail)}},"sourceDetourCandidate"),v=[-7,7,-14,14,-21,21];for(let p=0;p<12;p++){const y=S();let A=!1;for(let P=0;P<y.length&&!A;P++)for(let N=P+1;N<y.length&&!A;N++){const R=y[P],_=y[N];if(R.edge===_.edge||!M(R,_))continue;const F=[R,_].filter(Y=>Y.interior);for(const Y of F){for(const Z of v){const et=m(Y,Z);if(et&&u(Y.edge,et)){Y.edge.points=et,A=!0;break}const nt=T(Y,Z);if(nt&&u(Y.edge,nt)){Y.edge.points=nt,A=!0;break}}if(A)break}}if(!A)return}}O(_n,"nudgeSharedInteriorSubpaths");l(_n,"nudgeSharedInteriorSubpaths");function ss(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,i=o.x-n.x,f=o.y-n.y,d=s*f-r*i;if(Math.abs(d)<1e-10)return!1;const g=n.x-t.x,h=n.y-t.y,S=(g*f-h*i)/d,M=(g*r-h*s)/d,u=.01;return S>u&&S<.99&&M>u&&M<.99}O(ss,"segmentsIntersect");l(ss,"segmentsIntersect");function rs(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const s=No(e),r=[];for(const f of n){if(f.isLayoutOnly)continue;const d=f.points;if(!d||d.length<2)continue;const g=f.start,h=f.end,S=f.labelNodeId,M=f.id??`${g}->${h}`;for(const u of s)if(!(u.nodeId===g||u.nodeId===h)&&!(S&&u.nodeId===S)){for(let m=0;m<d.length-1;m++)if(Je(d[m],d[m+1],u,-1)){o.push({type:"edge-node-overlap",edgeId:M,targetId:u.nodeId,detail:`segment ${m} passes through node "${u.nodeId}"`});break}}for(let u=0;u<d.length-1;u++)r.push({edgeId:M,start:g,end:h,p1:d[u],p2:d[u+1]})}const i=new Set;for(let f=0;f<r.length;f++)for(let d=f+1;d<r.length;d++){const g=r[f],h=r[d];if(g.edgeId!==h.edgeId&&!(g.start===h.start||g.start===h.end||g.end===h.start||g.end===h.end)&&ss(g.p1,g.p2,h.p1,h.p2)){const S=g.edgeId<h.edgeId?`${g.edgeId}|${h.edgeId}`:`${h.edgeId}|${g.edgeId}`;i.has(S)||(i.add(S),o.push({type:"edge-edge-crossing",edgeId:g.edgeId,targetId:h.edgeId,detail:`edges "${g.edgeId}" and "${h.edgeId}" cross`}))}}if(o.length>0){const f=o.filter(g=>g.type==="edge-node-overlap").length,d=o.filter(g=>g.type==="edge-edge-crossing").length;pn.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${f} edge-node overlap(s), ${d} edge crossing(s)`);for(const g of o)pn.warn(`[SWIMLANE_VALIDATE] ${g.type}: ${g.detail}`)}return o}O(rs,"validateSwimlanesLayout");l(rs,"validateSwimlanesLayout");function is(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(f=>!f.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!jo(t,e)||e==="BT"&&s.length>0&&!Vo(t))return;for(const f of o){if(f.isLayoutOnly)continue;const d=f.points;!d||d.length<2||(f.points=oe(Ve(d)))}es(o,n),os(o,n),Uo(o,n);const r=new Map;for(const f of n)r.set(String(f.id),f);Ye(o,r),Fo(o,r),Wo(o,r),_n(o,r),Ko(o,r),qo(o,r),Nn(o,r),Zo(o,r);const i=l(()=>{ts(o,r),Jo(o,r),Qo(o,r),Ye(o,r),An(o,r),Nn(o,r),Ye(o,r),An(o,r)},"finalizeRenderedEdges");i(),_n(o,r),i(),On(o,r),Pn(o,r),On(o,r),Pn(o,r)}O(is,"postProcessSwimlaneLayout");l(is,"postProcessSwimlaneLayout");function pe(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const s of t.edges){if(!e.has(s.src)||!e.has(s.dst))continue;const r=`${s.id}:${s.src}->${s.dst}`;n.has(r)||(n.add(r),o.push(s))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}O(pe,"normalizeGraph");l(pe,"normalizeGraph");function io(t,e){return t.edges.filter(n=>n.dst===e)}O(io,"incoming");l(io,"incoming");function cs(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}O(cs,"buildSuccessorMap");l(cs,"buildSuccessorMap");function co(t){const e=cs(t);for(const n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}O(co,"buildSortedSuccessorMap");l(co,"buildSortedSuccessorMap");function tn(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}O(tn,"buildInDegreeMap");l(tn,"buildInDegreeMap");function ao(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}O(ao,"sortedZeroInDegreeNodes");l(ao,"sortedZeroInDegreeNodes");function en(t,e=()=>!0){const n=new Map,o=new Map;for(const s of t.nodes)n.set(s,[]),o.set(s,[]);for(const s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}O(en,"buildPredecessorSuccessorMaps");l(en,"buildPredecessorSuccessorMaps");function fo(t,e,n,o){let s=0;for(const i of t.nodes)o?.skipGroups&&t.nodeById.get(i)?.isGroup||(s=Math.max(s,n[i]??0));const r=Array.from({length:s+1},()=>[]);for(const i of e)o?.skipGroups&&t.nodeById.get(i)?.isGroup||r[Math.max(0,n[i]??0)].push(i);return r}O(fo,"buildLayersFromRanks");l(fo,"buildLayersFromRanks");function Ne(t){const e=tn(t),n=ao(e),o=[],s=co(t);for(;n.length;){const r=n.shift();o.push(r);for(const i of s.get(r)??[])if(e.set(i,(e.get(i)??0)-1),(e.get(i)??0)===0){let f=0;for(;f<n.length&&n[f]<i;)f++;n.splice(f,0,i)}}return o.length===t.nodes.length?o:null}O(Ne,"topoSortIfAcyclic");l(Ne,"topoSortIfAcyclic");function Te(t){const e=new Map;let n=0;for(const o of t)e.set(o,n),n++;return e}O(Te,"buildLayerIndex");l(Te,"buildLayerIndex");function lo(t){const e=new Array(t.length),n=l((o,s)=>{if(s-o<=1)return 0;const r=o+s>>1;let i=n(o,r)+n(r,s),f=o,d=r,g=o;for(;f<r||d<s;)d>=s||f<r&&t[f]<=t[d]?e[g++]=t[f++]:(e[g++]=t[d++],i+=r-f);for(let h=o;h<s;h++)t[h]=e[h];return i},"count");return n(0,t.length)}O(lo,"countInversions");l(lo,"countInversions");function as(t){const e=pe(t),n=new Map;for(const h of e.nodes)n.set(h,[]);for(const h of e.edges)n.get(h.src).push(h);for(const h of n.values())h.sort((S,M)=>S.dst===M.dst?S.id.localeCompare(M.id):S.dst.localeCompare(M.dst));const o=Object.create(null);for(const h of e.nodes)o[h]=0;const s=[],r=l(h=>{o[h]=1;for(const S of n.get(h)??[]){const M=S.dst;o[M]===0?r(M):o[M]===1&&s.push(S)}o[h]=2},"dfs"),i=tn(e),f=[...e.nodes.filter(h=>(i.get(h)??0)===0),...e.nodes.filter(h=>(i.get(h)??0)!==0)];for(const h of f)o[h]===0&&r(h);const d=new Set(s.map(h=>`${h.id}:${h.src}->${h.dst}`)),g=e.edges.map(h=>d.has(`${h.id}:${h.src}->${h.dst}`)?{id:h.id,src:h.dst,dst:h.src,weight:h.weight,ref:h.ref}:h);return{acyclic:{nodes:[...e.nodes],edges:g,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}O(as,"removeCycles_DFS");l(as,"removeCycles_DFS");function fs(t){const e=new Map,n=l(o=>{if(e.has(o))return e.get(o);const s=t.nodeById.get(o);if(!s)return e.set(o,null),null;const r=s.parentId;if(!r)return e.set(o,null),null;const i=n(r)??r;return e.set(o,i),i},"resolve");for(const o of t.nodes)n(o);return e}O(fs,"buildTopLaneMap");l(fs,"buildTopLaneMap");function ae(t){const e=fs(t);return n=>e.get(n)??null}O(ae,"createTopLaneResolver");l(ae,"createTopLaneResolver");function nn(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}O(nn,"buildTopLaneOrder");l(nn,"buildTopLaneOrder");function uo(t,e){const n=nn(t);if(!e||e.length===0)return n;const o=new Set(n),s=new Set,r=[];for(const i of e)!o.has(i)||s.has(i)||(s.add(i),r.push(i));for(const i of n)s.has(i)||r.push(i);return r}O(uo,"resolveTopLaneOrder");l(uo,"resolveTopLaneOrder");var dr={EPSILON:1e-6},qe={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},Co={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function ls(t,e){const n=pe(t),o=e?.laneOf??(()=>null),s=e?.rankHint,{preds:r}=en(n);for(const p of r.values())p.sort((y,A)=>y.localeCompare(A));const i=Ne(n)??[...n.nodes].sort((p,y)=>p.localeCompare(y)),f=new Map;for(const[p,y]of i.entries())f.set(y,p);const d=new Map,g=new Map;for(const p of n.nodes)g.set(p,[]);for(const p of i){const y=(r.get(p)??[]).filter(A=>d.has(A));if(y.length>0){const A=ds(p,y,{laneOf:o,rankHint:s,topoIndex:f});d.set(p,A),g.get(A).push(p)}else d.has(p)||d.set(p,null)}for(const p of n.nodes)d.has(p)||d.set(p,null);const h=new Set;for(const p of n.nodes)(d.get(p)??null)===null&&h.add(p);const S=[...h].sort((p,y)=>{const A=f.get(p)??0,P=f.get(y)??0;return A===P?p.localeCompare(y):A-P}),M=us(n),u=new Map;for(const[p,y]of M.entries())u.set(p,[...y].sort((A,P)=>A.localeCompare(P)));const m=hs(u),c=gs(u),b=new Map;for(const p of n.nodes)b.set(p,[]);for(const p of c)for(const y of p.nodes){const A=b.get(y);A?A.push(p.id):b.set(y,[p.id])}const w=[],I=[],T=new Set,v=l(p=>{if(!T.has(p)){T.add(p),w.push(p);for(const y of g.get(p)??[])v(y);I.push(p)}},"walk");for(const p of S)v(p);for(const p of i)v(p);return{parent:d,children:g,roots:S,componentOf:m,blocks:c,nodeBlocks:b,adjacency:u,preorder:w,postorder:I,topologicalOrder:i}}O(ls,"buildDrivingTree");l(ls,"buildDrivingTree");function ds(t,e,n){const o=n.laneOf(t);return[...e].sort((s,r)=>{const i=n.laneOf(s),f=n.laneOf(r),d=i!=null&&i===o;if(d!==(f!=null&&f===o))return d?-1:1;const g=n.rankHint?.[s],h=n.rankHint?.[r];if(g!=null&&h!=null&&g!==h)return h-g;const S=n.topoIndex.get(s)??0,M=n.topoIndex.get(r)??0;return S!==M?S-M:s.localeCompare(r)})[0]}O(ds,"chooseParent");l(ds,"chooseParent");function us(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}O(us,"buildAdjacency");l(us,"buildAdjacency");function hs(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const s=[o];for(;s.length>0;){const r=s.pop();if(!e.has(r)){e.set(r,n);for(const i of t.get(r)??[])e.has(i)||s.push(i)}}n++}return e}O(hs,"assignComponents");l(hs,"assignComponents");function gs(t){const e=new Map,n=new Map,o=[],s=[];let r=0;const i=l((f,d)=>{e.set(f,++r),n.set(f,r);for(const g of t.get(f)??[])g!==d&&(e.has(g)?(e.get(g)??0)<(e.get(f)??0)&&(o.push([f,g]),n.set(f,Math.min(n.get(f)??r,e.get(g)??r))):(o.push([f,g]),i(g,f),n.set(f,Math.min(n.get(f)??r,n.get(g)??r)),(n.get(g)??0)>=(e.get(f)??0)&&s.push(ms(f,g,o,s.length))))},"visit");for(const f of t.keys())e.has(f)||i(f,null);return s}O(gs,"computeBlocks");l(gs,"computeBlocks");function ms(t,e,n,o){const s=[],r=new Set;for(;n.length>0;){const i=n.pop();if(s.push(i),r.add(i[0]),r.add(i[1]),i[0]===t&&i[1]===e||i[0]===e&&i[1]===t)break}return{id:o,edges:s,nodes:[...r]}}O(ms,"popBlock");l(ms,"popBlock");function ps(t,e,n){const o=[...t.nodes],s=new Map;for(const[I,T]of o.entries())s.set(T,I);const r=o.length,i=new Array(r).fill(-1),f=new Array(r).fill(0),d=[],g=new Set;for(const I of o){const T=n.parent.get(I)??null,v=s.get(I);v!=null&&T==null&&(i[v]=-1,f[v]=0,g.has(I)||(g.add(I),d.push(I)))}for(;d.length>0;){const I=d.shift(),T=s.get(I);if(T==null)continue;const v=n.children.get(I)??[];for(const p of v){if(g.has(p))continue;const y=s.get(p);y!=null&&(i[y]=T,f[y]=f[T]+1,g.add(p),d.push(p))}}for(const I of o){if(g.has(I))continue;const T=s.get(I);T!=null&&(i[T]=-1,f[T]=0,g.add(I))}const h=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),S=Array.from({length:h},()=>new Array(r).fill(-1));for(let I=0;I<r;I++)S[0][I]=i[I];for(let I=1;I<h;I++)for(let T=0;T<r;T++){const v=S[I-1][T];S[I][T]=v===-1?-1:S[I-1][v]}const M=l((I,T)=>{if(I===-1||T===-1)return-1;f[I]<f[T]&&([I,T]=[T,I]);const v=f[I]-f[T];for(let p=0;p<h;p++)if(v>>p&1&&(I=S[p][I],I===-1))return-1;if(I===T)return I;for(let p=h-1;p>=0;p--){const y=S[p][I],A=S[p][T];y===-1||A===-1||y!==A&&(I=y,T=A)}return S[0][I]},"lcaIndex"),u=Array.from({length:r},()=>new Map);for(const I of t.edges){let T=I.src,v=I.dst,p=e[T],y=e[v];if(p==null||y==null||(p>y&&([T,v]=[v,T],[p,y]=[y,p]),p==null||y==null||p===y))continue;const A=s.get(T),P=s.get(v);if(A==null||P==null)continue;const N=M(A,P);if(N===-1)continue;const R=u[N];for(let _=p;_<y;_++)R.set(_,(R.get(_)??0)+1)}const m=new Map,c=l((I,T)=>{if(T.size!==0)for(const[v,p]of T)I.set(v,(I.get(v)??0)+p)},"mergeInto"),b=new Set,w=l(I=>{const T=s.get(I);b.add(I);const v=T==null?void 0:u[T],p=v?new Map(v):new Map,y=n.children.get(I)??[];for(const A of y){const P=w(A),N=e[I];if(N!=null){let R=m.get(I);R||(R=new Map,m.set(I,R));let _=P.get(N)??0;const F=e[A];F!=null&&F>N&&(_+=1),R.set(A,_)}c(p,P)}return p},"dfs");for(const I of n.roots)b.has(I)||w(I);for(const I of o)b.has(I)||w(I);return m}O(ps,"computeSubtreeCrossCounts");l(ps,"computeSubtreeCrossCounts");function xs(t,e,n){const o=new Map,s=l(r=>{let i=n[r]??0;const f=[...e.get(r)??[]];f.sort(ho(n));for(const d of f){s(d);const g=o.get(d);g!=null&&(i=Math.min(i,g))}o.set(r,i)},"annotate");for(const r of t)s(r);return o}O(xs,"annotateMinimumLayers");l(xs,"annotateMinimumLayers");function ho(t){return(e,n)=>{const o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}O(ho,"compareByRankThenId");l(ho,"compareByRankThenId");function ys(t,e,n,o){let s=0;for(const d of e){const g=n[d]??0;g>s&&(s=g)}const r=Array.from({length:s+1},()=>[]),i=new Set,f=l(d=>{if(i.has(d))return;i.add(d);const g=n[d]??0;r[g]||(r[g]=[]),r[g].push(d);for(const h of o(d))f(h)},"emit");for(const d of t)f(d);for(const d of e)if(!i.has(d)){const g=n[d]??0;r[g]||(r[g]=[]),r[g].push(d),i.add(d)}return r}O(ys,"emitNodesInTreeOrder");l(ys,"emitNodesInTreeOrder");function bs(t){const e=[];for(const n of t){const o=new Set,s=[];for(const r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}O(bs,"deduplicateLayers");l(bs,"deduplicateLayers");function Ms(t,e,n,o){return s=>{const r=t.get(s)??[];if(r.length===0)return[];const i=e[s]??0,f=[],d=[],g=n.get(s);for(const h of r){const S=o.get(h)??i;S>i?f.push({child:h,min:S}):d.push(h)}return f.sort((h,S)=>h.min===S.min?h.child.localeCompare(S.child):h.min-S.min),d.sort((h,S)=>{const M=g?.get(h)??0,u=g?.get(S)??0;if(M!==u)return M-u;const m=o.get(h)??i,c=o.get(S)??i;return m!==c?m-c:h.localeCompare(S)}),[...f.map(h=>h.child),...d]}}O(Ms,"createChildOrderer");l(Ms,"createChildOrderer");function Ze(t,e,n){const o=ls(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(const h of t.nodes)s.has(h)||s.set(h,[]);const i=ps(t,e,o),f=[...r].sort(ho(e)),d=Ms(s,e,i,xs(f,s,e));let g=ys(f,t.nodes,e,d);return g=bs(g),g}O(Ze,"buildMultitreeLayerOrder");l(Ze,"buildMultitreeLayerOrder");function Is(t,e,n){const o=new Set(t),s=new Set(e),r=Te(e),i=[];for(const f of n)o.has(f.src)&&s.has(f.dst)&&i.push(r.get(f.dst));return lo(i)}O(Is,"countCrossingsBetweenAdjacent");l(Is,"countCrossingsBetweenAdjacent");function Dn(t,e,n){const o=[];for(const r of e){const i=n[r.src],f=n[r.dst];if(i==null||f==null||i===f)continue;let d=r.src,g=r.dst,h=i,S=f;i>f&&(d=r.dst,g=r.src,h=f,S=i);for(let M=h;M<S;M++)o.push({id:`${r.id}@${M}`,src:d,dst:g,ref:r.ref})}let s=0;for(let r=0;r+1<t.length;r++)s+=Is(t[r],t[r+1],o);return s}O(Dn,"totalCrossings");l(Dn,"totalCrossings");function Ss(t,e){const n={...e},{preds:o}=en(t),s=ae(t);let r=Dn(Ze(t,n,s),t.edges,n);const i=qe.MAX_CROSSING_OPTIMIZATION_PASSES;for(let f=0;f<i;f++){let d=!1;const g=[...t.nodes].sort((h,S)=>(n[S]??0)-(n[h]??0));for(const h of g){const S=n[h]??0;if(S===0)continue;let M=0;for(const c of o.get(h)??[])M=Math.max(M,(n[c]??0)+1);if(M>=S)continue;const u=S;n[h]=M;const m=Dn(Ze(t,n,s),t.edges,n);m<r?(r=m,d=!0):n[h]=u}if(!d)break}return n}O(Ss,"optimizeRanksByCrossings");l(Ss,"optimizeRanksByCrossings");function Cs(t,e){const n=ae(t),o=[...t.nodes].sort((s,r)=>(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(const s of o){const r=n(s);if(!r)continue;const i=t.edges.filter(c=>c.src===s);if(i.length===0)continue;let f=!1,d=0;for(const c of i){const b=n(c.dst);b==null||b===r?f=!0:d++}if(d===0||f)continue;let g=0,h=!1;for(const c of t.edges){if(c.dst!==s)continue;const b=n(c.src);b&&(b===r?h=!0:g++)}if(g>0||!h)continue;const S=e[s]??0,M=S+d;let u=0;for(const c of t.edges)c.dst===s&&(u=Math.max(u,(e[c.src]??0)+1));const m=Math.max(S,u,M);m!==S&&(e[s]=m)}}O(Cs,"adjustCrossLaneSources");l(Cs,"adjustCrossLaneSources");function Ls(t,e){const n=pe(t),o=Ne(n)??[...n.nodes].sort(),s=e?.compactSingleInput??!1,r=ae(n);let i=Object.create(null);for(const f of o){const d=io(n,f),g=e?.ignoreCrossLaneEdges?d.filter(h=>{const S=r(h.src),M=r(f);return!S||!M?!0:S===M}):d;if(g.length===0)i[f]=0;else if(s&&g.length===1){const h=g[0].src;r(h)!==r(f)?i[f]=i[h]??0:i[f]=(i[h]??0)+1}else{let h=-1/0;for(const S of g)h=Math.max(h,(i[S.src]??0)+1);i[f]=h===-1/0?0:h}}return(e?.optimizeRanksByCrossings??!1)&&(i=Ss(n,i)),e?.ignoreCrossLaneEdges&&Cs(n,i),{layers:Ze(n,i,r),rankOf:i,dummy:new Set}}O(Ls,"assignLayers_LongestPath");l(Ls,"assignLayers_LongestPath");function vs(t,e){const n=pe(t),o={...Ls(n,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}).rankOf},s=ae(n),{preds:r,succs:i}=en(n,M=>{if(e?.ignoreCrossLaneEdges){const u=s(M.src),m=s(M.dst);if(u&&m&&u!==m)return!1}return!0}),f=Ne(n)??[...n.nodes],d=[...f].reverse(),g=l((M,u)=>{let m=0;for(const w of r.get(M)??[])m=Math.max(m,(o[w]??0)+1);let c=Number.POSITIVE_INFINITY;const b=i.get(M)??[];return b.length>0&&(c=Math.min(...b.map(w=>(o[w]??0)-1))),Number.isFinite(c)||(c=Math.max(m,u)),Math.min(Math.max(u,m),c)},"clampFeasible"),h=qe.GRAVITY_ITERATIONS,S=l(M=>{let u=!1;for(const m of M){const c=r.get(m)??[],b=i.get(m)??[];if(c.length===0&&b.length===0)continue;const w=c.length>0?c.reduce((p,y)=>p+(o[y]??0)+1,0)/c.length:o[m]??0,I=b.length>0?b.reduce((p,y)=>p+(o[y]??0)-1,0)/b.length:o[m]??0,T=Math.round((w+I)/2),v=g(m,T);v!==o[m]&&(o[m]=v,u=!0)}return u},"relaxOrder");for(let M=0;M<h;M++){const u=S(f),m=S(d);if(!u&&!m)break}for(const M of f){let u=0;for(const m of r.get(M)??[])u=Math.max(u,(o[m]??0)+1);(o[M]??0)<u&&(o[M]=u)}for(const M of d){const u=i.get(M)??[];if(u.length>0){const m=Math.min(...u.map(c=>(o[c]??0)-1));(o[M]??0)>m&&(o[M]=m)}}return{layers:fo(n,f,o),rankOf:o,dummy:new Set}}O(vs,"assignLayers_Gravity");l(vs,"assignLayers_Gravity");function ws(t){const e=tn(t),n=co(t);let o=ao(e);const s=[];for(;o.length>0;){const r=[];for(const i of o){s.push(i);for(const f of n.get(i)??[])e.set(f,(e.get(f)??0)-1),(e.get(f)??0)===0&&r.push(f)}o=r.sort((i,f)=>i.localeCompare(f))}return s.length===t.nodes.length?s:null}O(ws,"topoSortByGenerationIfAcyclic");l(ws,"topoSortByGenerationIfAcyclic");function Es(t,e){const n=pe(t),o=e?.direction==="LR"?ws(n)??[...n.nodes].sort():Ne(n)??[...n.nodes].sort(),s=ae(n),r=l(g=>s(g)??g,"laneOf"),i=Object.create(null),f=new Map,d=l((g,h)=>e?.ignoreCrossLaneEdges??!0?r(g)===r(h)?1:0:1,"edgeWeight");for(const g of o){if(n.nodeById.get(g)?.isGroup)continue;const h=io(n,g);let S=0;if(h.length>0)for(const c of h){const b=c.src,w=i[b]??0;S=Math.max(S,w+d(b,g))}const M=r(g),u=f.get(M)??0,m=Math.max(S,u);i[g]=m,f.set(M,m+1)}return{layers:fo(n,o,i,{skipGroups:!0}),rankOf:i,dummy:new Set}}O(Es,"assignLayers_LaneAwareCompact");l(Es,"assignLayers_LaneAwareCompact");function Ts(t,e){const n=pe(e),{rankOf:o}=t,s=t.layers.map(M=>[...M]),r=new Set(t.dummy?[...t.dummy]:[]);let i=0;const f=new Map(n.nodeById),d=l(M=>{const u=`placeholder-${i++}`,m={id:u,isGroup:!1,isDummy:!0,width:0,height:0};for(f.set(u,m),r.add(u);s.length<=M;)s.push([]);return s[M].push(u),o[u]=M,u},"addDummyAt"),g=[...n.edges].sort((M,u)=>M.id===u.id?M.src===u.src?M.dst.localeCompare(u.dst):M.src.localeCompare(u.src):M.id.localeCompare(u.id)),h=[];for(const M of g){const u=o[M.src]??0,m=o[M.dst]??0;if(m-u<=1){h.push(M);continue}let c=M.src;for(let w=u+1,I=0;w<m;w++,I++){const T=d(w);h.push({id:`${M.id}#${I}`,src:c,dst:T,weight:M.weight,ref:M.ref}),c=T}const b=m-u-2;h.push({id:`${M.id}#${Math.max(b+1,0)}`,src:c,dst:M.dst,weight:M.weight,ref:M.ref})}const S={nodes:[...n.nodes,...[...r].filter(M=>!n.nodes.includes(M))],edges:h,layout:n.layout,nodeById:f};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:S}}O(Ts,"makeProperLayering");l(Ts,"makeProperLayering");function Hn(t){const e=t.length;if(e===0)return Number.POSITIVE_INFINITY;const n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}O(Hn,"median");l(Hn,"median");function Xn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((e,n)=>e+n,0)/t.length}O(Xn,"barycenter");l(Xn,"barycenter");function As(t,e,n,o){const s=new Map;for(const r of t)s.set(r,[]);for(const r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}O(As,"neighborPositionsFor");l(As,"neighborPositionsFor");function Rs(t,e,n){const o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}O(Rs,"currentOrderTieBreak");l(Rs,"currentOrderTieBreak");function Yn(t,e,n){const o=new Set(t),s=new Set(e),r=Te(t),i=Te(e),f=[];for(const d of n)o.has(d.src)&&s.has(d.dst)&&f.push({u:r.get(d.src),v:i.get(d.dst)});return f.sort((d,g)=>d.u===g.u?d.v-g.v:d.u-g.u),lo(f.map(d=>d.v))}O(Yn,"countCrossingsBetweenAdjacent2");l(Yn,"countCrossingsBetweenAdjacent");function Ge(t,e,n){return[...t].sort((o,s)=>{const r=Hn(e.get(o)??[]),i=Hn(e.get(s)??[]);return r===i?Rs(o,s,n):isFinite(r)?isFinite(i)?r-i:-1:1})}O(Ge,"sortByHeuristic");l(Ge,"sortByHeuristic");function Gn(t,e,n,o,s,r){const i=Te(t),f=Te(e),d=As(e,i,n,o);if(!s||!r||r.length===0)return Ge(e,d,f);const g=new Map;for(const M of e){const u=s(M),m=g.get(u)??[];m.push(M),g.set(u,m)}const h=[];for(const M of r){const u=g.get(M);if(!u||u.length===0)continue;const m=Ge(u,d,f);h.push(...m)}const S=g.get(null);if(S&&S.length>0){const M=Ge(S,d,f);for(const u of M){const m=Xn(d.get(u)??[]);let c=h.length;if(isFinite(m)){for(const[b,w]of h.entries())if(m<Xn(d.get(w)??[])){c=b;break}}h.splice(c,0,u)}}return h}O(Gn,"reorderLayer");l(Gn,"reorderLayer");function zn(t,e,n,o,s){const r=[...e],i=new Set(t),f=new Set(e),d=o?new Set(o):null,g=n.filter(c=>i.has(c.src)&&f.has(c.dst)),h=d?n.filter(c=>f.has(c.src)&&d.has(c.dst)):void 0,S=l(c=>{let b=Yn(t,c,g);return h&&o&&(b+=Yn(c,o,h)),b},"crossingScore"),M=s?new Map:null;if(s&&M)for(const c of e)M.set(c,s(c));let u=!0,m=S(r);for(;u;){u=!1;for(let c=0;c+1<r.length;c++){if(M&&M.get(r[c])!==M.get(r[c+1]))continue;const b=m;[r[c],r[c+1]]=[r[c+1],r[c]];const w=S(r);w<b?(m=w,u=!0):[r[c],r[c+1]]=[r[c+1],r[c]]}}return r}O(zn,"transposeImprove");l(zn,"transposeImprove");function Ns(t,e,n){const o=t.layers.map(f=>[...f]),s=e.edges,r=ae(e),i=uo(e,n?.laneOrder);for(let f=0;f<3;f++){for(let d=1;d<o.length;d++)o[d]=Gn(o[d-1],o[d],s,"down",r,i),o[d]=zn(o[d-1],o[d],s,o[d+1],r);for(let d=o.length-2;d>=0;d--)o[d]=Gn(o[d+1],o[d],s,"up",r,i),o[d]=zn(o[d+1],o[d],s,o[d-1],r)}return{layers:o}}O(Ns,"orderLayers");l(Ns,"orderLayers");function Os(t,e,n){const o=n?.layerGap??Co.DEFAULT_LAYER_GAP,s=n?.nodeGap??Co.DEFAULT_NODE_GAP,r=n?.laneGap??s*2,i=n?.direction??"TB",f=i==="LR"||i==="RL",d=t.layers,g=Object.create(null),h=Object.create(null),S=l(R=>e.nodeById.get(R),"getNode"),M=l(R=>S(R)?.width??0,"getWidth"),u=l(R=>S(R)?.height??0,"getHeight"),m=ae(e),c=uo(e,n?.laneOrder),b=d.map(R=>R.reduce((_,F)=>Math.max(_,u(F)),0)),w=[];if(f)for(let R=0;R+1<d.length;R++){const _=d[R].reduce((yt,Bt)=>Math.max(yt,M(Bt)),0),F=d[R+1].reduce((yt,Bt)=>Math.max(yt,M(Bt)),0),Y=b[R],Z=b[R+1],et=Y/2+Z/2,nt=(_+F)/2,Mt=Math.max(0,nt-et-o);w.push(Mt)}const I=new Set;for(const R of d)for(const _ of R)I.add(m(_));const T=I.has(null),v=c.filter(R=>I.has(R)),p=[...T?[null]:[],...v],y=Object.create(null);for(const R of v)y[R]=0;T&&(y.null=0);for(const R of d){const _=Object.create(null),F=[];for(const Y of R){const Z=m(Y);Z===null?F.push(Y):(_[Z]||=[]).push(Y)}for(const[Y,Z]of Object.entries(_)){const et=Z.reduce((nt,Mt)=>nt+M(Mt),0)+s*Math.max(0,Z.length-1);y[Y]=Math.max(y[Y]??0,et)}if(T&&F.length){const Y=F.reduce((Z,et)=>Z+M(et),0)+s*Math.max(0,F.length-1);y.null=Math.max(y.null??0,Y)}}const A=new Map;{const R=p.map(F=>(F===null?y.null:y[F])??0);let _=-(R.reduce((F,Y)=>F+Y,0)+r*Math.max(0,p.length-1))/2;for(let F=0;F<p.length;F++){const Y=p[F],Z=R[F]??0,et=_+Z/2;A.set(Y,et),_+=Z,F<p.length-1&&(_+=r)}}let P=0;for(const[R,_]of d.entries()){const F=b[R]??0,Y=new Map;for(const et of _){const nt=m(et),Mt=Y.get(nt)??[];Mt.push(et),Y.set(nt,Mt)}for(const et of p){const nt=Y.get(et)??[];if(nt.length===0)continue;const Mt=A.get(et);if(nt.length===1){const yt=nt[0];g[yt]=Mt,h[yt]=P+F/2}else{const yt=nt.map(rt=>M(rt));let Bt=Mt-(yt.reduce((rt,K)=>rt+K,0)+s*(nt.length-1))/2;for(const[rt,K]of nt.entries()){const Q=yt[rt];g[K]=Bt+Q/2,h[K]=P+F/2,Bt+=Q+s}}}const Z=w[R]??0;P+=F+o+Z}const N=new Map;for(const R of e.edges){const _=R.ref.id;N.has(_)||N.set(_,[]),N.get(_).push(R)}for(const[,R]of N){if(R.length===0)continue;const _=R[0].ref,F=_.start,Y=_.end;if(F==null||Y==null)continue;const Z=Math.round(((g[F]??0)+(g[Y]??0))/2),et=new Set;for(const nt of R)et.add(nt.src),et.add(nt.dst);for(const nt of et)nt===F||nt===Y||e.nodeById.get(nt)?.isDummy&&(g[nt]=Z)}return{x:g,y:h}}O(Os,"assignCoordinates");l(Os,"assignCoordinates");var Ps=8;function ks(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}O(ks,"hashString");l(ks,"hashString");function Bs(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}O(Bs,"mulberry32");l(Bs,"mulberry32");function Fs(t,e){const n=[...t],o=Bs(e);for(let s=n.length-1;s>0;s--){const r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}O(Fs,"deterministicShuffle");l(Fs,"deterministicShuffle");function _s(t,e){let n=0;for(const[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}O(_s,"sourceDistance");l(_s,"sourceDistance");function $n(t,e){const n=new Map;for(const[s,r]of t.entries())n.set(r,s);let o=0;for(const{a:s,b:r,weight:i}of e){const f=n.get(s),d=n.get(r);f==null||d==null||(o+=i*Math.abs(f-d))}return o}O($n,"laneArrangementCost");l($n,"laneArrangementCost");function Ds(t){const e=nn(t);if(e.length<2)return[];const n=new Map(e.map((r,i)=>[r,i])),o=ae(t),s=new Map;for(const r of t.layout.edges??[]){if(r.isLayoutOnly)continue;const i=typeof r.start=="string"?r.start:void 0,f=typeof r.end=="string"?r.end:void 0;if(!i||!f||!t.nodeById.has(i)||!t.nodeById.has(f))continue;const d=o(i),g=o(f);if(!d||!g||d===g)continue;const h=n.get(d),S=n.get(g);if(h==null||S==null)continue;const[M,u]=h<=S?[d,g]:[g,d],m=`${M}\0${u}`,c=s.get(m);c?c.weight++:s.set(m,{a:M,b:u,weight:1})}return[...s.values()]}O(Ds,"buildWeightedLaneEdges");l(Ds,"buildWeightedLaneEdges");function Vn(t,e,n){const o=[...t];let s=$n(o,e),r=!0,i=0;const f=Math.max(1,o.length);for(;r&&i<f;){r=!1,i++;for(let d=0;d+1<o.length;d++){[o[d],o[d+1]]=[o[d+1],o[d]];const g=$n(o,e);g<s?(s=g,r=!0):[o[d],o[d+1]]=[o[d+1],o[d]]}}return{order:o,cost:s,sourceDistance:_s(o,n)}}O(Vn,"greedySwitch");l(Vn,"greedySwitch");function Hs(t,e){return t.cost!==e.cost?t.cost<e.cost:t.sourceDistance<e.sourceDistance}O(Hs,"isBetterCandidate");l(Hs,"isBetterCandidate");function Xs(t,e,n){const o=[...e].sort((s,r)=>s.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:i})=>`${s}:${r}:${i}`).join("|");return ks(`${t.join("|")}#${o}#${n}`)}O(Xs,"seedForRestart");l(Xs,"seedForRestart");function Ys(t,e={}){const n=nn(t);if(n.length<2)return n;const o=Ds(t);if(o.length===0)return n;const s=new Map(n.map((f,d)=>[f,d]));let r=Vn(n,o,s);const i=Math.max(0,e.restarts??Ps);for(let f=0;f<i;f++){const d=Vn(Fs(n,Xs(n,o,f)),o,s);Hs(d,r)&&(r=d)}return r.order}O(Ys,"optimizeTopLaneOrder");l(Ys,"optimizeTopLaneOrder");function Gs(t,e){const n=e?.ignoreCrossLaneEdges??!0,o=e?.optimizeRanksByCrossings??!0,s=pe(t),r=e?.automaticLaneOrdering?Ys(s,{restarts:Ps}):void 0,i=as(s),f=i.acyclic,{layering:d,graphWithDummies:g}=Ts(n?Es(f,{compactSingleInput:e?.compactSingleInput??qe.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:e?.direction}):vs(f,{compactSingleInput:e?.compactSingleInput??qe.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:o}),f),h=Ns(d,g,{laneOrder:r}),S=Os(h,g,{layerGap:e?.layerGap,nodeGap:e?.nodeGap,direction:e?.direction,laneOrder:r});return{acyclic:f,reversed:i.reversed,layering:d,ordered:h,coordinates:S}}O(Gs,"sugiyamaLayout");l(Gs,"sugiyamaLayout");var ct=dr.EPSILON,ur=8,ye=15,ve=15,Xe=25,Jt=20,mn=10;function jn(t,e,n){const o=t.x??0,s=t.y??0,r=e.x-o,i=e.y-s,f=Math.abs(r),d=Math.abs(i);return f<ct&&d<ct?n:d>ct&&d*3>=f?i>0?"bottom":"top":f>ct?r>0?"right":"left":n}O(jn,"chooseOrthogonalSide");l(jn,"chooseOrthogonalSide");function Un(t,e){return Math.abs(t.to-e.from)<ct||Math.abs(t.to-e.to)<ct?t.to:t.from}O(Un,"sharedLineEndpointCoord");l(Un,"sharedLineEndpointCoord");function be(t,e){return t.orient==="vertical"?{x:t.coord,y:e}:{x:e,y:t.coord}}O(be,"pointOnLine");l(be,"pointOnLine");function zs(t,e){const n=t.nodes??[],o=t.edges??[],s=[];for(const a of o)a.isLayoutOnly||s.push({...a,__originalEdge:a});const r=new Map,i=new Map,f=[],d=e==="LR";for(const a of n)r.set(a.id,a);const g=n.filter(a=>a.isGroup&&!a.parentId);for(const a of g){const x={id:a.id},C=l(L=>{i.set(L.id,x),n.filter(E=>E.parentId===L.id).forEach(C)},"assignLane");C(a)}const h=n.filter(a=>!a.isGroup&&!a.isEdgeLabel).map(a=>{const x=a.width??10,C=a.height??10,L=a.x??0,E=a.y??0,B=ur;return{nodeId:a.id,minX:L-x/2-B,maxX:L+x/2+B,minY:E-C/2-B,maxY:E+C/2+B,visualXHalfExtent:d?C/2+B:x/2+B}}),S=l((a,x,C,L)=>{let E=f.find(B=>B.orientation===a&&Math.abs(B.coord-x)<1);return E||(E={id:`pipe-${a}-${x.toFixed(0)}`,orientation:a,coord:x,spanMin:C,spanMax:L,tracks:[]},f.push(E)),E.spanMin=Math.min(E.spanMin,C),E.spanMax=Math.max(E.spanMax,L),E},"getOrAddPipe"),M=l((a,x)=>{const C=a.width??10,L=a.height??10,E=a.x??0,B=a.y??0;switch(x){case"top":return{x:E,y:B-L/2};case"bottom":return{x:E,y:B+L/2};case"left":return{x:E-C/2,y:B};case"right":return{x:E+C/2,y:B}}},"portForSide"),u=l((a,x,C)=>M(a,jn(a,x,C?"bottom":"top")),"getOrthogonalPort"),m=[],c=[],b=new Set,w=1e3,I=l((a,x,C)=>{if(m.length===0)return 0;const L=Math.abs(x.y-C.y)<ct,E=Math.abs(x.x-C.x)<ct;if(!L&&!E)return 0;let B=0;if(L){const $=x.y,q=Math.min(x.x,C.x)-ct,G=Math.max(x.x,C.x)+ct;if(G<=q)return 0;for(const X of m)X.edgeIndex===a||X.orientation!=="vertical"||X.pipe.coord<q||X.pipe.coord>G||X.from-ct<=$&&X.to+ct>=$&&(B+=w)}else if(E){const $=x.x,q=Math.min(x.y,C.y)-ct,G=Math.max(x.y,C.y)+ct;if(G<=q)return 0;for(const X of m)X.edgeIndex===a||X.orientation!=="horizontal"||X.pipe.coord<q||X.pipe.coord>G||X.from-ct<=$&&X.to+ct>=$&&(B+=w)}return B},"crossingPenalty"),T=s.map((a,x)=>{if(!a.start||!a.end)return{idx:x,crossLane:0,dx:0,dy:0};const C=r.get(a.start),L=r.get(a.end),E=i.get(a.start),B=i.get(a.end);return{idx:x,crossLane:E&&B&&E.id!==B.id?1:0,dx:C&&L?Math.abs((L.x??0)-(C.x??0)):0,dy:C&&L?Math.abs((L.y??0)-(C.y??0)):0}}).sort((a,x)=>{if(a.crossLane!==x.crossLane)return x.crossLane-a.crossLane;const C=a.dx+a.dy,L=x.dx+x.dy;return Math.abs(C-L)>1?C-L:a.idx-x.idx}).map(a=>a.idx),v=l((a,x,C,L)=>{const E=Math.min(a.x,x.x),B=Math.max(a.x,x.x),$=Math.min(a.y,x.y),q=Math.max(a.y,x.y);return!!h.find(G=>C&&G.nodeId===C||L&&G.nodeId===L?!1:Math.abs(a.x-x.x)>ct?G.minY<a.y&&G.maxY>a.y&&G.maxX>E&&G.minX<B:G.minX<a.x&&G.maxX>a.x&&G.maxY>$&&G.minY<q)},"isSegmentBlocked"),p=new Map,y=new Map;for(const a of s)!a.start||!a.end||a.start===a.end||(y.set(a.start,(y.get(a.start)??0)+1),y.set(a.end,(y.get(a.end)??0)+1));const A=l((a,x)=>jn(a,x,"bottom"),"determineSide"),P=new Map;for(const[a,x]of s.entries()){if(!x.start||!x.end||x.start===x.end||x.points&&x.points.length>0)continue;const C=r.get(x.start),L=r.get(x.end);if(!C||!L)continue;const E=(L.x??0)-(C.x??0),B=(L.y??0)-(C.y??0);P.set(a,{edgeIdx:a,srcId:x.start,dstId:x.end,srcSide:A(C,{x:L.x??0,y:L.y??0}),dstSide:A(L,{x:C.x??0,y:C.y??0}),absDx:Math.abs(E),absDy:Math.abs(B),dxSign:Math.sign(E),dySign:Math.sign(B)})}const N=l(a=>a.srcSide==="top"||a.srcSide==="bottom"?a.absDx===0?1/0:a.absDy/a.absDx:a.absDy===0?1/0:a.absDx/a.absDy,"preferenceStrength"),R=l(a=>a.srcSide==="top"||a.srcSide==="bottom"?a.dxSign>=0?"right":"left":a.dySign>=0?"bottom":"top","secondarySide"),_=new Map;for(const a of P.values()){const x=`${a.srcId}:${a.srcSide}`;_.has(x)||_.set(x,[]),_.get(x).push(a)}const F=new Map,Y=l((a,x)=>`${a}:${x}`,"loadKey");for(const a of P.values())F.set(Y(a.srcId,a.srcSide),(F.get(Y(a.srcId,a.srcSide))??0)+1),F.set(Y(a.dstId,a.dstSide),(F.get(Y(a.dstId,a.dstSide))??0)+1);for(const a of _.values())if(!(a.length<2)){a.sort((x,C)=>{const L=N(x),E=N(C);return Math.abs(L-E)>1e-9?E-L:x.edgeIdx-C.edgeIdx});for(let x=1;x<a.length;x++){const C=a[x],L=R(C),E=F.get(Y(C.srcId,C.srcSide))??0,B=F.get(Y(C.srcId,L))??0;B>=E||(F.set(Y(C.srcId,C.srcSide),E-1),F.set(Y(C.srcId,L),B+1),C.srcSide=L)}}const Z=l(a=>{const x=a?.shape;return x==="question"||x==="diamond"},"isDiamondNode"),et=new Map;for(const a of P.values())et.has(a.dstId)||et.set(a.dstId,new Set),et.get(a.dstId).add(a.dstSide);for(const a of P.values()){if(!Z(r.get(a.srcId)))continue;const x=et.get(a.srcId);if(!x?.has(a.srcSide))continue;const C=R(a);if(x.has(C)||(F.get(Y(a.srcId,C))??0)>0)continue;const L=F.get(Y(a.srcId,a.srcSide))??0;F.set(Y(a.srcId,a.srcSide),Math.max(0,L-1)),F.set(Y(a.srcId,C),1),a.srcSide=C}for(const a of P.values()){const{edgeIdx:x,srcId:C,dstId:L,srcSide:E,dstSide:B}=a,$=r.get(C),q=r.get(L),G=`${C}:${E}:src`,X=E==="top"||E==="bottom"?q.x??0:q.y??0;p.has(G)||p.set(G,[]),p.get(G).push({edgeIdx:x,oppositeCoord:X});const W=`${L}:${B}:dst`,ft=B==="top"||B==="bottom"?$.x??0:$.y??0;p.has(W)||p.set(W,[]),p.get(W).push({edgeIdx:x,oppositeCoord:ft})}const nt=new Map,Mt=8;for(const[a,x]of p){if(x.length<2)continue;x.sort((St,ot)=>St.oppositeCoord-ot.oppositeCoord);const C=a.split(":"),L=C.slice(0,-2).join(":"),E=C[C.length-2],B=C[C.length-1],$=r.get(L);if(!$)continue;const q=E==="left"||E==="right"?$.height??10:$.width??10,G=$.shape,X=G==="question"||G==="diamond"?q*.3:q,W=Math.min(20,Math.max(Mt,X/(x.length+1))),ft=-(W*(x.length-1))/2;for(const[St,ot]of x.entries()){const ht=ft+St*W,Tt=`${ot.edgeIdx}:${B}`;nt.set(Tt,ht)}}const yt=l(a=>!!s[a]?.labelNodeId,"edgeHasLabelNode"),Bt=l((a,x)=>a?(p.get(`${a}:${x}:src`)??[]).some(({edgeIdx:C})=>yt(C))||(p.get(`${a}:${x}:dst`)??[]).some(({edgeIdx:C})=>yt(C)):!1,"faceHasLabelNode"),rt=l((a,x,C)=>x==="top"||x==="bottom"?{x:a.x+C,y:a.y}:{x:a.x,y:a.y+C},"applyPortOffset"),K=l((a,x,C)=>{const L=P.get(a),E={x:C.x??0,y:C.y??0},B={x:x.x??0,y:x.y??0},$=L?.srcSide??A(x,E),q=L?.dstSide??A(C,B);let G=L?M(x,L.srcSide):u(x,E,!0),X=L?M(C,L.dstSide):u(C,B,!1);const W=nt.get(`${a}:src`),ft=nt.get(`${a}:dst`);return W!==void 0&&(G=rt(G,$,W)),ft!==void 0&&(X=rt(X,q,ft)),{pSrcPort:G,pDstPort:X,srcSide:$,dstSide:q}},"portsForEdge");for(const a of T){const x=s[a];if(c[a]=[],!x.start||!x.end||x.points&&x.points.length>0||x.start===x.end)continue;const C=r.get(x.start),L=r.get(x.end);if(!C||!L)continue;const{pSrcPort:E,pDstPort:B,srcSide:$,dstSide:q}=K(a,C,L),G={...E},X={...B},W=$==="top"||$==="bottom",ft=q==="top"||q==="bottom";W?G.y=E.y>(C.y??0)?E.y+Jt:E.y-Jt:G.x=E.x>(C.x??0)?E.x+Jt:E.x-Jt,ft?X.y=B.y>(L.y??0)?B.y+Jt:B.y-Jt:X.x=B.x>(L.x??0)?B.x+Jt:B.x-Jt;const St=l((z,V)=>{for(const U of h)if(!V.includes(U.nodeId)&&z.x>U.minX&&z.x<U.maxX&&z.y>U.minY&&z.y<U.maxY)return{inside:!0,obstacle:U};return{inside:!1}},"isPointInObstacle"),ot=l((z,V,U,lt,Rt)=>{if(Rt){const Nt=z.y>(V.y??0);return{x:(U.x??0)>=z.x?lt.maxX+ye:lt.minX-ye,y:Nt?lt.maxY+ve:lt.minY-ve,leavesPositiveSide:Nt}}const Ct=z.x>(V.x??0),vt=(U.y??0)>=z.y;return{x:Ct?lt.maxX+ye:lt.minX-ye,y:vt?lt.maxY+ve:lt.minY-ve,leavesPositiveSide:Ct}},"obstacleDetour");let ht=[];const Tt=[x.start,x.end],Gt=St(G,Tt);if(Gt.inside&&Gt.obstacle){const z=Gt.obstacle;if(W){const V=ot(E,C,L,z,!0);G.x=V.x,G.y=V.y;const U=V.leavesPositiveSide?Math.min(z.minY-2,E.y+Jt):Math.max(z.maxY+2,E.y-Jt);ht=[{x:E.x,y:U},{x:V.x,y:U},{x:V.x,y:V.y}]}else{const V=ot(E,C,L,z,!1),U=V.leavesPositiveSide?Math.min(z.minX-2,E.x+Jt):Math.max(z.maxX+2,E.x-Jt);G.x=V.x,G.y=V.y,ht=[{x:U,y:E.y},{x:U,y:V.y},{x:V.x,y:V.y}]}}let ie=[];const Se=St(X,Tt);if(Se.inside&&Se.obstacle){const z=Se.obstacle;if(ft){const V=ot(B,L,C,z,!0);X.x=V.x,X.y=V.y,ie=[{x:V.x,y:V.y},{x:B.x,y:V.y}]}else{const V=ot(B,L,C,z,!1);X.x=V.x,X.y=V.y,ie=[{x:V.x,y:V.y},{x:V.x,y:B.y}]}}if(ht.length===0&&ie.length===0){const z=ye,V=Math.abs(G.x-X.x)<z,U=Math.abs(G.y-X.y)<z,lt=nt.get(`${a}:src`)!==void 0||nt.get(`${a}:dst`)!==void 0,Rt=(p.get(`${x.start??""}:${$}:src`)?.length??0)+(p.get(`${x.start??""}:${$}:dst`)?.length??0),Ct=(p.get(`${x.end??""}:${q}:src`)?.length??0)+(p.get(`${x.end??""}:${q}:dst`)?.length??0),vt=Rt>1||Ct>1,Nt=y.get(x.start??"")??0,gt=y.get(x.end??"")??0,Yt=Rt>1&&Bt(x.start,$)||Ct>1&&Bt(x.end,q);if((V||U)&&!lt&&(!vt||vt&&!Yt&&(Rt<=1||Nt<=2)&&(Ct<=1||gt<=2))&&!v(E,B,x.start,x.end)){x.points=[{...E},{...G},{...X},{...B}],b.add(a);const $t=U?"horizontal":"vertical",Ot=U?E.y:E.x,Dt=U?Math.min(E.x,B.x):Math.min(E.y,B.y),pt=U?Math.max(E.x,B.x):Math.max(E.y,B.y),Pt={id:`fast-path-${$t}-${Ot.toFixed(0)}-${a}`,orientation:$t,coord:Ot,spanMin:Dt,spanMax:pt,tracks:[]};m.push({edgeIndex:a,segmentIndex:0,orientation:$t,pipe:Pt,trackIndex:0,from:Dt,to:pt});continue}}G.x=S("vertical",G.x,G.y,G.y).coord,X.x=S("vertical",X.x,X.y,X.y).coord;let fe=Math.min(G.x,X.x)-50,le=Math.max(G.x,X.x)+50,Ce=Math.min(G.y,X.y)-50,Le=Math.max(G.y,X.y)+50;for(const z of h){const V=Math.min(G.x,X.x),U=Math.max(G.x,X.x),lt=Math.min(G.y,X.y),Rt=Math.max(G.y,X.y);z.minX<U&&z.maxX>V&&z.minY<Rt&&z.maxY>lt&&(fe=Math.min(fe,z.minX-Xe),le=Math.max(le,z.maxX+Xe),Ce=Math.min(Ce,z.minY-Xe),Le=Math.max(Le,z.maxY+Xe))}for(const z of h){if(z.maxX<fe||z.minX>le||z.maxY<Ce||z.minY>Le)continue;const V=ye;S("horizontal",z.minY-V,fe,le),S("horizontal",z.maxY+V,fe,le);const U=ve;S("vertical",z.minX-U,Ce,Le),S("vertical",z.maxX+U,Ce,Le)}S("horizontal",G.y,fe,le),S("horizontal",X.y,fe,le);const Us=f.filter(z=>z.orientation==="horizontal"&&z.coord>=Ce&&z.coord<=Le),Ws=f.filter(z=>z.orientation==="vertical"&&z.coord>=fe&&z.coord<=le),Pe=l((z,V)=>`${z.toFixed(1)},${V.toFixed(1)}`,"getKey"),ke=Pe(G.x,G.y),go=Pe(X.x,X.y),Be=new Map,cn=new Map,an=new Map,Fe=new Set,xe=[];Be.set(ke,0),an.set(ke,"n"),xe.push({key:ke,f:Math.hypot(X.x-G.x,X.y-G.y),pt:G}),Fe.add(ke);let Ht=[];const de=l((z,V)=>v(z,V,x.start,x.end),"checkSegmentBlocked"),fn={x:X.x,y:G.y},Ks=de(G,fn),qs=de(fn,X),Zs=Ks||qs,ln={x:G.x,y:X.y},Js=de(G,ln),Qs=de(ln,X);if(Zs?Js||Qs||(Math.abs(G.x-X.x)<ct?Ht=[G,X]:Ht=[G,ln,X]):Math.abs(G.y-X.y)<ct||Math.abs(G.x-X.x)<ct?Ht=[G,X]:Ht=[G,fn,X],Ht.length===0)for(;xe.length>0;){xe.sort((gt,Yt)=>gt.f-Yt.f);const z=xe.shift();if(Fe.delete(z.key),z.key===go){let gt=go,Yt=X;for(Ht=[Yt];cn.has(gt);){const $t=cn.get(gt);Ht.unshift($t),Yt=$t,gt=Pe($t.x,$t.y)}break}const V=z.pt.x,U=z.pt.y,lt=Ws.sort((gt,Yt)=>gt.coord-Yt.coord),Rt=lt.findIndex(gt=>Math.abs(gt.coord-V)<1),Ct=Us.sort((gt,Yt)=>gt.coord-Yt.coord),vt=Ct.findIndex(gt=>Math.abs(gt.coord-U)<1),Nt=[];Rt>0&&Nt.push({x:lt[Rt-1].coord,y:U}),Rt>=0&&Rt<lt.length-1&&Nt.push({x:lt[Rt+1].coord,y:U}),vt>0&&Nt.push({x:V,y:Ct[vt-1].coord}),vt>=0&&vt<Ct.length-1&&Nt.push({x:V,y:Ct[vt+1].coord});for(const gt of Nt){const Yt=Math.min(V,gt.x),$t=Math.max(V,gt.x),Ot=Math.min(U,gt.y),Dt=Math.max(U,gt.y);if(h.some(Kt=>Kt.nodeId===x.start||Kt.nodeId===x.end?!1:Yt!==$t?Kt.minY<U&&Kt.maxY>U&&Kt.maxX>Yt&&Kt.minX<$t:Kt.minX<V&&Kt.maxX>V&&Kt.maxY>Ot&&Kt.minY<Dt))continue;const pt=Pe(gt.x,gt.y),Pt=Math.abs(gt.x-V)+Math.abs(gt.y-U),Wt=I(a,z.pt,gt);let xt=0;const kt=X.x-G.x,ue=X.y-G.y,he=gt.x-V,dn=gt.y-U;(ue>10&&dn<-5||ue<-10&&dn>5)&&(xt=Math.abs(dn)*100),(kt>10&&he<-5||kt<-10&&he>5)&&(xt+=Math.abs(he)*50);let mo=0;const po=an.get(z.key)??"n",xo=Math.abs(he)>ct?"h":"v";po!=="n"&&po!==xo&&(mo=50);const tr=Pt+Wt+xt+mo,_e=(Be.get(z.key)??1/0)+tr,yo=Math.abs(X.x-gt.x)+Math.abs(X.y-gt.y);if(_e<(Be.get(pt)??1/0))if(cn.set(pt,z.pt),Be.set(pt,_e),an.set(pt,xo),!Fe.has(pt))xe.push({key:pt,f:_e+yo,pt:gt}),Fe.add(pt);else{const Kt=xe.findIndex(er=>er.key===pt);Kt!==-1&&(xe[Kt].f=_e+yo)}}}if(Ht.length===0&&(Ht=[G,{x:G.x,y:X.y},X]),Ht.length>4){const z=Ht[0],V=Ht[Ht.length-1];let U=Math.min(z.x,V.x),lt=Math.max(z.x,V.x),Rt=Math.min(z.y,V.y),Ct=Math.max(z.y,V.y);for(const Ot of Ht)U=Math.min(U,Ot.x),lt=Math.max(lt,Ot.x),Rt=Math.min(Rt,Ot.y),Ct=Math.max(Ct,Ot.y);const vt=lt>Math.max(z.x,V.x),Nt=U<Math.min(z.x,V.x);if(d){const Ot=ve;if(vt){const Dt=Math.max(z.x,V.x),pt=Math.min(z.y,V.y),Pt=Math.max(z.y,V.y),Wt=h.filter(xt=>xt.minX<Dt&&xt.maxX>Dt&&xt.minY<Pt&&xt.maxY>pt);if(Wt.length>0){let xt=Math.max(z.x,V.x);for(const kt of Wt){const ue=(kt.minX+kt.maxX)/2;if(kt.visualXHalfExtent===void 0||isNaN(kt.visualXHalfExtent))continue;const he=ue+kt.visualXHalfExtent+Ot;xt=Math.max(xt,he)}isNaN(xt)||(lt=xt)}}if(Nt){const Dt=h.filter(pt=>pt.minX<Math.min(z.x,V.x)+Ot&&pt.minY<Math.max(z.y,V.y)&&pt.maxY>Math.min(z.y,V.y));if(Dt.length>0){let pt=Math.min(z.x,V.x);for(const Pt of Dt){const Wt=(Pt.minX+Pt.maxX)/2-Pt.visualXHalfExtent-Ot;pt=Math.min(pt,Wt)}U=pt}}}const gt=l(Ot=>{const Dt=V.y>z.y,pt=h.filter(xt=>{const kt=Math.min(z.x,V.x)<xt.maxX&&Math.max(z.x,V.x)>xt.minX,ue=Math.min(z.y,V.y)<xt.maxY&&Math.max(z.y,V.y)>xt.minY;return kt&&ue});let Pt=pt;if(d&&pt.length>0){const xt=pt.filter(kt=>kt.minX<Ot&&kt.maxX>Ot);xt.length>0&&(Pt=xt)}if(Pt.length===0)return V.y;const Wt=ye;if(Dt){const xt=Math.max(...Pt.map(kt=>kt.maxY))+Wt;if(xt<V.y-ct)return xt}else{const xt=Math.min(...Pt.map(kt=>kt.minY))-Wt;if(xt>V.y+ct)return xt}return V.y},"findBestReturnY"),Yt=l(Ot=>{const Dt=gt(Ot),pt={x:Ot,y:z.y},Pt={x:Ot,y:Dt},Wt={x:V.x,y:Dt},xt=de(z,pt),kt=de(pt,Pt),ue=de(Pt,Wt),he=Dt!==V.y?de(Wt,V):!1;return!xt&&!kt&&!ue&&!he?Math.abs(Dt-V.y)<ct?[z,pt,Pt,V]:[z,pt,Pt,Wt,V]:null},"trySimplifyWithDetourX"),$t=vt&&!Nt?Yt(lt):Nt&&!vt?Yt(U):null;$t&&(Ht=$t)}const Xt=[E,...ht,...Ht,...ie.reverse(),B];if(Xt.length>=3){const z=Xt[Xt.length-1],V=Xt[Xt.length-2],U=Xt[Xt.length-3],lt=Math.abs(U.y-V.y)<ct&&Math.abs(V.y-z.y)<ct,Rt=Math.abs(U.x-V.x)<ct&&Math.abs(V.x-z.x)<ct;if(lt){const Ct=Math.sign(V.x-U.x),vt=Math.sign(z.x-U.x);Ct!==0&&Ct===vt&&Math.abs(V.x-U.x)>Math.abs(z.x-U.x)&&Xt.splice(-2,1)}else if(Rt){const Ct=Math.sign(V.y-U.y),vt=Math.sign(z.y-U.y);Ct!==0&&Ct===vt&&Math.abs(V.y-U.y)>Math.abs(z.y-U.y)&&Xt.splice(-2,1)}}const ee=[Xt[0]];for(let z=1;z<Xt.length-1;z++){if(z===1){ee.push(Xt[z]);continue}const V=ee[ee.length-1],U=Xt[z],lt=Xt[z+1];if(Math.abs(V.y-U.y)<ct&&Math.abs(U.y-lt.y)<ct){if(U.x>V.x!=lt.x>U.x){ee.push(U);continue}continue}if(Math.abs(V.x-U.x)<ct&&Math.abs(U.x-lt.x)<ct){if(U.y>V.y!=lt.y>U.y){ee.push(U);continue}continue}ee.push(U)}ee.push(Xt[Xt.length-1]);for(let z=0;z<ee.length-1;z++){const V=ee[z],U=ee[z+1],lt=Math.abs(V.x-U.x)<ct?"vertical":"horizontal",Rt=lt==="vertical"?V.x:V.y,Ct=lt==="vertical"?Math.min(V.y,U.y):Math.min(V.x,U.x),vt=lt==="vertical"?Math.max(V.y,U.y):Math.max(V.x,U.x),Nt=S(lt,Rt,Ct,vt),gt={edgeIndex:a,segmentIndex:z,orientation:lt,pipe:Nt,trackIndex:0,from:Ct,to:vt};m.push(gt),c[a].push(m.length-1),Nt.tracks[0]||(Nt.tracks[0]={index:0,coord:Nt.coord,segments:[]}),Nt.tracks[0].segments.push({edgeIndex:a,segmentIndex:z,from:Ct,to:vt})}}const Q=l((a,x)=>a.from<x.to&&x.from<a.to,"segmentsOverlap"),st=l((a,x,C,L)=>{const E=!L.segments.some($=>($.edgeIndex!==x.edgeIndex||$.segmentIndex!==x.segmentIndex)&&Q($,a)),B=!C.segments.some($=>($.edgeIndex!==a.edgeIndex||$.segmentIndex!==a.segmentIndex)&&Q($,x));return E&&B?(a.trackIndex=L.index,x.trackIndex=C.index,C.segments=[...C.segments.filter($=>$.edgeIndex!==a.edgeIndex||$.segmentIndex!==a.segmentIndex),{edgeIndex:x.edgeIndex,segmentIndex:x.segmentIndex,from:x.from,to:x.to}],L.segments=[...L.segments.filter($=>$.edgeIndex!==x.edgeIndex||$.segmentIndex!==x.segmentIndex),{edgeIndex:a.edgeIndex,segmentIndex:a.segmentIndex,from:a.from,to:a.to}],!0):!1},"trySwapSegmentsAcrossTracks"),at=l(a=>{const x=a.tracks.length;return a.tracks[x]={index:x,coord:a.coord,segments:[]},x},"createNewTrack"),bt=l((a,x)=>{const C=a.pipe.tracks[a.trackIndex];C.segments=C.segments.filter(L=>L.edgeIndex!==a.edgeIndex||L.segmentIndex!==a.segmentIndex),a.trackIndex=x,a.pipe.tracks[x].segments.push({edgeIndex:a.edgeIndex,segmentIndex:a.segmentIndex,from:a.from,to:a.to})},"moveSegmentToTrack"),It=l((a,x)=>{const C=c[a.edgeIndex];for(const L of C){const E=m[L];E.pipe===a.pipe&&bt(E,x)}},"moveSegmentChainToTrack"),Lt=l(a=>{const x=c[a.edgeIndex],C=x.indexOf(m.indexOf(a)),L=[];return C>0&&L.push(m[x[C-1]]),C<x.length-1&&L.push(m[x[C+1]]),L},"getAdjacentSegmentsAlongEdge"),Ut=l((a,x)=>{if(a.orientation===x.orientation)return!1;const C=a.orientation==="horizontal"?a:x,L=a.orientation==="horizontal"?x:a;return L.pipe.coord>C.from&&L.pipe.coord<C.to&&C.pipe.coord>L.from&&C.pipe.coord<L.to},"haveAnyCrossing"),Zt=l((a,x)=>{for(const C of a.tracks)if(!C.segments.some(L=>(L.edgeIndex!==x.edgeIndex||L.segmentIndex!==x.segmentIndex)&&Q(L,x)))return C.index;return-1},"findAvailableTrack"),se=l((a,x)=>{if(a.trackIndex===x.trackIndex)return Q(a,x);const C=Lt(a),L=Lt(x);return C.some(E=>L.some(B=>Ut(E,B)))},"segmentsConflict"),re=l((a,x,C)=>{if(st(a,x,a.pipe.tracks[a.trackIndex],x.pipe.tracks[x.trackIndex]))return;const L=Zt(a.pipe,x);C(x,L!==-1?L:at(a.pipe))},"resolveTrackConflict"),Oe=l(a=>{let x=0;for(let C=0;C<a.length;C++)for(let L=C+1;L<a.length;L++){const E=a[C],B=a[L];E.pipe===B.pipe&&se(E,B)&&(x++,re(E,B,It))}return x},"resolveHandleConflicts"),Ie=new Map,Ae=l(a=>{if(Ie.has(a))return Ie.get(a);const x=c[a];if(x.length===0){const $={dest:0,deviation:0,base:0,delta:0};return Ie.set(a,$),$}const C=m[x[0]].pipe.coord;let L=C;for(let $=1;$<x.length;$++){const q=m[x[$]];if(q.orientation==="horizontal"){const G=q.from,X=q.to;L=Math.abs(G-C)>Math.abs(X-C)?G:X;break}}const E=Math.abs(L-C),B={dest:L,deviation:E,base:C,delta:L-C};return Ie.set(a,B),B},"getDestInfo"),on=l(()=>{let a=0;const x=new Map;for(const[L,E]of s.entries())c[L].length!==0&&E.start&&(x.has(E.start)||x.set(E.start,[]),x.get(E.start).push(L));const C=l(L=>{const E=s[L];if(!E.start||!E.end)return 0;const B=r.get(E.start),$=r.get(E.end);if(!B||!$)return 0;const q=($.x??0)-(B.x??0),G=($.y??0)-(B.y??0);return Math.abs(q)+Math.abs(G)},"getEdgeDistance");for(const L of x.values()){L.sort((B,$)=>{const q=Ae(B),G=Ae($);if(Math.abs(q.deviation-G.deviation)>1)return q.deviation-G.deviation;if(Math.abs(q.dest-G.dest)>1)return q.dest-G.dest;const X=C(B),W=C($);if(Math.abs(X-W)>1)return W-X;const ft=c[B].length,St=c[$].length;if(ft!==St)return ft-St;if(ft===1){const ot=c[B][0],ht=c[$][0];if(m[ot]&&m[ht]){const Tt=m[ot],Gt=m[ht],ie=Math.abs(Tt.to-Tt.from),Se=Math.abs(Gt.to-Gt.from);if(Math.abs(ie-Se)>1)return ie-Se}}return 0});const E=L.map(B=>m[c[B][0]]);a+=Oe(E)}return a},"fixSourceHandleCrossings"),sn=l(()=>{let a=0;const x=new Map;for(const[C,L]of s.entries())c[C].length!==0&&L.end&&(x.has(L.end)||x.set(L.end,[]),x.get(L.end).push(C));for(const C of x.values()){C.sort((E,B)=>{const $=l(X=>{const W=c[X];if(W.length<2)return 0;const ft=m[W[W.length-2]];return Math.abs(ft.to-ft.from)},"getDist"),q=$(E),G=$(B);return Math.abs(q-G)>.1?q-G:E-B});const L=C.map(E=>m[c[E][c[E].length-1]]);a+=Oe(L)}return a},"fixTargetHandleCrossings"),rn=l(()=>{let a=0;for(const x of f){const C=[];for(const L of x.tracks)for(const E of L.segments){const B=c[E.edgeIndex].find($=>m[$].segmentIndex===E.segmentIndex);B!==void 0&&C.push(m[B])}C.sort((L,E)=>L.edgeIndex-E.edgeIndex||L.segmentIndex-E.segmentIndex);for(let L=0;L<C.length;L++)for(let E=L+1;E<C.length;E++){const B=C[L],$=C[E];se(B,$)&&(a++,re(B,$,bt))}}return a},"fixPipeCrossings");let k=0;const D=10;for(;k<D;){let a=0;if(a+=on(),a+=sn(),a+=rn(),a===0)break;k++}const H=new Map;for(const a of f){const x=[];a.tracks.forEach(L=>{L.segments.forEach(E=>{x.push({edgeIndex:E.edgeIndex,segmentIndex:E.segmentIndex,trackIndex:L.index,from:E.from,to:E.to})})}),x.sort((L,E)=>L.from-E.from);const C=[];if(x.length>0){let L=[x[0]],E=x[0].to;for(let B=1;B<x.length;B++){const $=x[B];$.from<E?(L.push($),E=Math.max(E,$.to)):(C.push(L),L=[$],E=$.to)}C.push(L)}for(const L of C){const E=new Set;L.forEach(ot=>E.add(ot.trackIndex));const B=new Map;L.forEach(ot=>{const ht=Ae(ot.edgeIndex);B.set(ot.trackIndex,(B.get(ot.trackIndex)??0)+ht.delta)});const $=[...E].filter(ot=>(B.get(ot)??0)<-1),q=[...E].filter(ot=>(B.get(ot)??0)>1),G=[...E].filter(ot=>Math.abs(B.get(ot)??0)<=1);$.sort((ot,ht)=>(B.get(ht)??0)-(B.get(ot)??0)),q.sort((ot,ht)=>(B.get(ot)??0)-(B.get(ht)??0));const X=l((ot,ht)=>{L.filter(Tt=>Tt.trackIndex===ot).forEach(Tt=>{const Gt=b.has(Tt.edgeIndex)?a.coord:ht;H.set(`${Tt.edgeIndex}-${Tt.segmentIndex}`,Gt)})},"assignCoord");let W=0;for(const ot of $)W++,X(ot,a.coord-W*mn);if(G.length===0&&E.size>0){const ot=[...E].sort((Gt,ie)=>Math.abs(B.get(Gt)??0)-Math.abs(B.get(ie)??0))[0],ht=$.indexOf(ot);ht!==-1&&$.splice(ht,1);const Tt=q.indexOf(ot);Tt!==-1&&q.splice(Tt,1),G.push(ot)}let ft=0;for(const ot of G){if(ft===0)X(ot,a.coord);else{const ht=ft%2===1?1:-1,Tt=Math.ceil(ft/2);X(ot,a.coord+ht*Tt*mn*.5)}ft++}let St=0;for(const ot of q)St++,X(ot,a.coord+St*mn)}}for(const[a,x]of s.entries()){const C=c[a]??[];if(C.length===0)continue;const L=[],{pSrcPort:E,pDstPort:B}=K(a,r.get(x.start),r.get(x.end)),$=C.map(X=>{const W=m[X],ft=H.get(`${W.edgeIndex}-${W.segmentIndex}`)??W.pipe.coord;return{orient:W.orientation,coord:ft,from:W.from,to:W.to}});L.push(E);for(let X=0;X<$.length;X++){const W=$[X],ft=L[L.length-1],St=W.orient==="vertical"?ft.y:ft.x,ot=W.orient==="vertical"?ft.x:ft.y,ht=$[X+1],Tt=X<$.length-1;if(Math.abs(ot-W.coord)>ct&&L.push(be(W,St)),Tt&&ht.orient===W.orient)if(Math.abs(W.coord-ht.coord)>ct){const Gt=W.orient==="vertical"?(St+ht.from)/2:Un(W,ht);L.push(be(W,Gt),be(ht,Gt))}else(X===0||X===$.length-2)&&L.push(be(W,Un(W,ht)));else if(Tt)L.push(be(W,ht.coord));else{const Gt=Math.abs(W.from-St)<Math.abs(W.to-St)?W.to:W.from;L.push(be(W,Gt))}}const q=L[L.length-1];(Math.abs(q.x-B.x)>ct||Math.abs(q.y-B.y)>ct)&&L.push(B);const G=[];L.length>0&&G.push(L[0]);for(let X=1;X<L.length;X++){const W=L[X],ft=G[G.length-1];(Math.abs(W.x-ft.x)>ct||Math.abs(W.y-ft.y)>ct)&&G.push(W)}x.points=G}for(const a of s){const x=a.__originalEdge;x&&a.points&&(x.points=a.points)}t.edges=(t.edges??[]).filter(a=>!a.isLayoutOnly);const j=l((a,x)=>{const C=x.x??0,L=x.y??0,E=x.width??0,B=x.height??0;if(E<=0||B<=0)return a;const $=C-E/2,q=C+E/2,G=L-B/2,X=L+B/2;if(a.x<$||a.x>q||a.y<G||a.y>X)return a;const W=a.x-$,ft=q-a.x,St=a.y-G,ot=X-a.y,ht=Math.min(W,ft,St,ot);return ht===W?{x:$,y:a.y}:ht===ft?{x:q,y:a.y}:ht===St?{x:a.x,y:G}:{x:a.x,y:X}},"nodeBoundaryClamp");for(const a of t.edges){const x=a.points;if(!x||x.length<2)continue;const C=a.start,L=a.end,E=C?r.get(C):void 0,B=L?r.get(L):void 0;E&&(x[0]=j(x[0],E)),B&&(x[x.length-1]=j(x[x.length-1],B))}return t}O(zs,"routeEdgesOrthogonal");l(zs,"routeEdgesOrthogonal");function $s(t){return t.direction??"TB"}O($s,"getSwimlaneDirection");l($s,"getSwimlaneDirection");function Vs(t){const e=Eo(t),n=t.config.flowchart?.nodeSpacing??40,o=t.config.flowchart?.rankSpacing??100,s=t.config.swimlane?.ignoreCrossLaneEdges??!0,r=t.config.swimlane?.optimizeRanksByCrossings??!0,i=t.config.swimlane?.automaticLaneOrdering??!1,f=$s(t),{ordered:d,coordinates:g}=Gs(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:i,direction:f});To(e,d,g,{nodeGap:n,layerGap:o});for(const h of t.edges??[])delete h.points;zs(t,f);for(const h of t.edges??[])(!h.curve||h.curve==="basis")&&(h.curve="rounded");return is(t,f),rs(t),f}O(Vs,"runSwimlaneLayoutCore");l(Vs,"runSwimlaneLayoutCore");function js(t){wo(t);const e=Ao(t);t.nodes=e.nodes,t.edges=e.edges}O(js,"prepareSwimlaneLayout");l(js,"prepareSwimlaneLayout");var Tr=or({prepareLayout:js,runLayoutCore:Vs,afterPaint:Lo});export{Tr as render};
1
+ var nr=Object.defineProperty;var O=(t,e)=>nr(t,"name",{value:e,configurable:!0});import{n as l}from"./chunk-Y2CYZVJY-OvsAdhaO.js";import{m as pn}from"./src-DYjgETqR.js";import"./chunk-VPRB5NB3-BNz5CtBn.js";import"./chunk-3YJQHVM4-C_uoPpLR.js";import"./chunk-HJ2JQQFS-DL4lnpSv.js";import"./chunk-E2ZNV5FY-DG8wQ_NS.js";import"./chunk-4EA7E6EY-BeMEfIRS.js";import"./chunk-XC4XBNZT-CCgIhjYS.js";import"./chunk-DBDB3WZW-B2qouVQO.js";import"./chunk-2BW5OAIV-Ckr4HfBO.js";import"./chunk-NTY3LDVX-DyT9N5sM.js";import{r as or}from"./chunk-FVRAUYC3-Dizswk0V.js";import{t as sr}from"./chunk-HTAEGDNF-Zxjdb6kj.js";function Lo(t,{measure:e}){const n=t.config?.swimlane?.lineHops;if(n===!1)return;const o=n==="gap"?"gap":"arc",s=t.edges.filter(r=>Array.isArray(r.points)&&r.points.length>=2).map(r=>({id:r.id,points:r.points,curve:r.curve,arrowTypeStart:r.arrowTypeStart,arrowTypeEnd:r.arrowTypeEnd}));sr(e.groups.edgePaths,s,{enabled:!0,jumpRadius:6,jumpStyle:o})}O(Lo,"applySwimlaneLineJumps");l(Lo,"applySwimlaneLineJumps");var un="__swimlane_default__",rr=21,bo=20;function xn(t){return Math.max(t.padding??bo,bo)}O(xn,"topLaneHorizontalPadding");l(xn,"topLaneHorizontalPadding");function vo(t){const{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}const i=n-s/2,f=Math.min(r,n+s/2),d=i+Math.min(rr,Math.max(0,f-i));if(d<=i){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:i,bottom:d}}O(vo,"assignTopLaneTitleRect");l(vo,"assignTopLaneTitleRect");function wo(t){const e=t.direction,n=t.nodes??=[];for(const r of t.nodes??[])r.isGroup&&!r.parentId&&(r.shape="swimlane",e&&(r.direction=e));const o=n.filter(r=>!r.isGroup&&!r.parentId);if(o.length===0)return;let s=n.find(r=>r.id===un);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:un,label:"",isGroup:!0,shape:"swimlane",padding:20,look:t.config?.look,colorIndex:n.reduce((r,i)=>Math.max(r,i.colorIndex??-1),-1)+1,...e?{direction:e}:{}},n.push(s));for(const r of o)r.parentId=un}O(wo,"prepareLayoutForSwimlanes");l(wo,"prepareLayoutForSwimlanes");function Eo(t){const e=new Map;for(const i of t.nodes??[])e.set(i.id,i);const n=[];for(const i of t.edges??[]){const f=typeof i.start=="string"?i.start:void 0,d=typeof i.end=="string"?i.end:void 0;!f||!d||i.labelNodeId||n.push({id:i.id,src:f,dst:d,ref:i})}const o=t.nodes??[],s=o.filter(i=>i.isGroup),r=o.filter(i=>!i.isGroup);return{nodes:[...[...s].reverse(),...r].map(i=>i.id),edges:n,layout:t,nodeById:e}}O(Eo,"toGraphView");l(Eo,"toGraphView");function To(t,e,n,o){const{layout:s}=t,r=t.nodeById,i=o?.layerGap??100,f=o?.nodeGap??40;let d=0;for(const M of e.layers){let u=0;for(const m of M){const c=r.get(m);if(!c){u++;continue}c.layer=d,c.order=u;const b=n.x[m]??u*f,w=n.y[m]??d*i;c.x=b,c.y=w,u++}d++}const g=s.nodes??[],h=new Map,S=[];for(const M of g){if(!M?.isGroup)continue;M.parentId||S.push(M);const u=g.filter(I=>I.parentId===M.id);let m=1/0,c=-1/0,b=1/0,w=-1/0;for(const I of u){const T=I.x??n.x[I.id],v=I.y??n.y[I.id],p=I.width??0,y=I.height??0;T!=null&&v!=null&&(m=Math.min(m,T-p/2),c=Math.max(c,T+p/2),b=Math.min(b,v-y/2),w=Math.max(w,v+y/2))}if(m===1/0||b===1/0)M.x=M.x??0,M.y=M.y??0,M.width=M.width??0,M.height=M.height??0;else{const I=M.padding??20,T=M.parentId?I:2*xn(M),v=I,p=Math.max(0,c-m)+T,y=Math.max(0,w-b)+v,A=(m+c)/2,P=(b+w)/2;M.x=A,M.y=P,M.width=p,M.height=y,h.set(M.id,{minX:m,maxX:c,minY:b,maxY:w})}}if(S.length>0&&h.size>0){let M=1/0,u=-1/0,m=0;for(const c of S){const b=c.padding??20;b>m&&(m=b);const w=h.get(c.id);w&&(M=Math.min(M,w.minY),u=Math.max(u,w.maxY))}if(M!==1/0&&u!==-1/0){const c=Math.max(0,u-M)+2*Math.max(m,36),b=(M+u)/2;for(const y of S)y.y=b,y.height=c,y.swimlaneContentTop=M;const w=[...S].sort((y,A)=>(y.x??0)-(A.x??0)),I=[],T=[],v=[];for(const y of w){const A=h.get(y.id);if(!A)continue;const P=Math.max(0,A.maxX-A.minX)+2*xn(y),N=(A.minX+A.maxX)/2;I.push(y.id),T.push(N),v.push(P)}const p=I.length;if(p>0){const y=new Map;if(p===1)y.set(I[0],v[0]);else{const A=[];for(let F=0;F<p-1;F++)A.push(T[F+1]-T[F]);const P=new Array(p);P[0]=0;for(let F=0;F<p-1;F++)P[F+1]=2*A[F]-P[F];let N=0,R=Number.POSITIVE_INFINITY;for(let F=0;F<p;F++){const Y=v[F];F%2===0?N=Math.max(N,Y-P[F]):R=Math.min(R,P[F]-Y)}let _=N;N<=R?_=(N+R)/2:_=N;for(let F=0;F<p;F++){const Y=P[F]+(F%2===0?_:-_),Z=Math.max(v[F],Y);y.set(I[F],Z)}}for(const A of S){const P=y.get(A.id);P!=null&&(A.width=P),vo(A)}}}}}O(To,"writeBackToLayoutData");l(To,"writeBackToLayoutData");var ir="[EdgeLabelNodes]";function Ao(t){const e=[],n=[],o=new Map;for(const i of t.nodes)o.set(i.id,i);for(const i of t.edges){if(!i.label||i.label.length===0||i.isLayoutOnly||i.labelNodeId)continue;const f=i.start?o.get(i.start):void 0,d=i.end?o.get(i.end):void 0;if(!f||!d){pn.warn(ir,`Edge ${i.id} has missing source or target node`);continue}const g=`edge-label-${i.start}-${i.end}-${i.id}`,h=f.parentId!==d.parentId?d.parentId:f.parentId,S={id:g,label:i.label,edgeStart:i.start??"",edgeEnd:i.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:h,isGroup:!1,labelStyle:Array.isArray(i.labelStyle)?i.labelStyle[0]:i.labelStyle??"",...f.dir?{dir:f.dir}:{}};e.push(S),i.labelNodeId=g,i.label=void 0,i.text=void 0;const M={id:`${i.id}-to-label`,start:i.start,end:g,type:"normal",isLayoutOnly:!0},u={id:`${i.id}-from-label`,start:g,end:i.end,type:"normal",isLayoutOnly:!0};n.push(M,u)}const s=[...t.nodes,...e],r=[...t.edges,...n];return{...t,nodes:s,edges:r}}O(Ao,"createEdgeLabelNodes");l(Ao,"createEdgeLabelNodes");var _t=.001;function Wn(t){const e=t.x??0,n=t.y??0,o=t.width??0,s=t.height??0;return o>0&&s>0?{cx:e,cy:n,rect:we(e,n,o,s)}:void 0}O(Wn,"measuredNodeRect");l(Wn,"measuredNodeRect");function Kn(t){if(t.isGroup)return;const e=Wn(t);if(e)return{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}}O(Kn,"nodeBoundsInfoFor");l(Kn,"nodeBoundsInfoFor");function Qt(t,e,n=_t){return Math.abs(t.x-e.x)<n&&Math.abs(t.y-e.y)<n}O(Qt,"samePoint");l(Qt,"samePoint");function dt(t,e,n=_t){return Math.abs(t.x-e.x)<n}O(dt,"sameX");l(dt,"sameX");function ut(t,e,n=_t){return Math.abs(t.y-e.y)<n}O(ut,"sameY");l(ut,"sameY");function wt(t,e,n=_t){return ut(t,e,n)&&Math.abs(t.x-e.x)>n}O(wt,"isHorizontalSegment");l(wt,"isHorizontalSegment");function Et(t,e,n=_t){return dt(t,e,n)&&Math.abs(t.y-e.y)>n}O(Et,"isVerticalSegment");l(Et,"isVerticalSegment");function zt(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}O(zt,"overlapLength");l(zt,"overlapLength");function ne(t,e,n=_t){return t.horizontal&&e.horizontal&&ut(t.a,e.a,n)?zt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&dt(t.a,e.a,n)?zt(t.a.y,t.b.y,e.a.y,e.b.y):0}O(ne,"sameAxisSegmentOverlapLength");l(ne,"sameAxisSegmentOverlapLength");function Ee(t,e=_t){const n=[];for(let o=0;o<t.length-1;o++){const s=t[o],r=t[o+1],i=wt(s,r,e),f=Et(s,r,e);(i||f)&&n.push({index:o,a:s,b:r,horizontal:i,vertical:f})}return n}O(Ee,"orthogonalSegmentsForPoints");l(Ee,"orthogonalSegmentsForPoints");function qt(t,e=_t){const n=Ee(t,e);let o=0;for(let s=1;s<n.length;s++)n[s-1].horizontal!==n[s].horizontal&&o++;return o}O(qt,"countOrthogonalBends");l(qt,"countOrthogonalBends");function mt(t,e=_t){const n=[];for(const o of t){const s=n.length>0?n[n.length-1]:void 0;(!s||!Qt(s,o,e))&&n.push({x:o.x,y:o.y})}return n}O(mt,"dedupeConsecutivePoints");l(mt,"dedupeConsecutivePoints");function qn(t,e=_t){if(!t||t.length!==4)return;const[n,o,s,r]=t;return wt(n,o,e)&&Et(o,s,e)&&wt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:Et(n,o,e)&&wt(o,s,e)&&Et(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}O(qn,"classifyThreeSegmentRoute");l(qn,"classifyThreeSegmentRoute");function Je(t,e,n,o=0){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),f=Math.max(t.y,e.y);return r>n.left-o&&s<n.right+o&&f>n.top-o&&i<n.bottom+o}O(Je,"segmentBoundsOverlapRect");l(Je,"segmentBoundsOverlapRect");function Zn(t,e,n=0){return t.x>e.left+n&&t.x<e.right-n&&t.y>e.top+n&&t.y<e.bottom-n}O(Zn,"pointInsideRect");l(Zn,"pointInsideRect");function Ro(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom}O(Ro,"rectContainsRect");l(Ro,"rectContainsRect");function ze(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}O(ze,"rectsOverlap");l(ze,"rectsOverlap");function yn(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}O(yn,"inflateRect");l(yn,"inflateRect");function we(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}O(we,"rectFromCenterSize");l(we,"rectFromCenterSize");function jt(t){return Wn(t)?.rect}O(jt,"rectOfNodeBounds");l(jt,"rectOfNodeBounds");function Me(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}O(Me,"portForRectSide");l(Me,"portForRectSide");function Jn(t,e,n,o,s,r=_t){const i=e==="left"||e==="right",f=o==="left"||o==="right";if(i&&f){if(e==="right"&&o==="left"&&t.x<n.x||e==="left"&&o==="right"&&t.x>n.x){if(ut(t,n,r))return[t,n];const h=(t.x+n.x)/2;return[t,{x:h,y:t.y},{x:h,y:n.y},n]}if(e===o){if(ut(t,n,r))return;const h=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x:h,y:t.y},{x:h,y:n.y},n]}return}if(!i&&!f){if(e===o){if(dt(t,n,r))return;const S=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:S},{x:n.x,y:S},n]}if(!(e==="bottom"&&o==="top"&&t.y<n.y||e==="top"&&o==="bottom"&&t.y>n.y))return;if(dt(t,n,r))return[t,n];const h=(t.y+n.y)/2;return[t,{x:t.x,y:h},{x:n.x,y:h},n]}if(i&&!f){const h=e==="right"&&n.x>t.x||e==="left"&&n.x<t.x,S=o==="top"&&t.y<n.y||o==="bottom"&&t.y>n.y;return h&&S?[t,{x:n.x,y:t.y},n]:void 0}const d=e==="bottom"&&n.y>t.y||e==="top"&&n.y<t.y,g=o==="left"&&t.x<n.x||o==="right"&&t.x>n.x;return d&&g?[t,{x:t.x,y:n.y},n]:void 0}O(Jn,"buildOrthogonalPortPath");l(Jn,"buildOrthogonalPortPath");function Qn(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}O(Qn,"buildSameSideTrackPath");l(Qn,"buildSameSideTrackPath");function Qe(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const s=Kn(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}O(Qe,"collectRealNodeBounds");l(Qe,"collectRealNodeBounds");function me(t){const e=[],n=[];for(const o of t){const s=Kn(o);if(!s)continue;const r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}O(me,"collectNodeRectEntries");l(me,"collectNodeRectEntries");function No(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const s=o.x??0,r=o.y??0,i=o.width??0,f=o.height??0;n.push({nodeId:o.id,...we(s,r,i,f)})}return n}O(No,"collectLayoutNodeRects");l(No,"collectLayoutNodeRects");function to(t,e,n=_t){const o=t.start,s=t.end;if(!o||!s)return;const r=e.get(o),i=e.get(s);if(!(!r||!i))return{srcId:o,dstId:s,srcInfo:r,dstInfo:i,collinearX:Math.abs(r.cx-i.cx)<n,collinearY:Math.abs(r.cy-i.cy)<n}}O(to,"getNodePairGeometry");l(to,"getNodePairGeometry");function At(t,e,n,o=[],s=0){for(const r of n)if(!o.includes(r.id)&&Je(t,e,r.rect,-s))return!0;return!1}O(At,"segmentHitsAnyRect");l(At,"segmentHitsAnyRect");function eo(t,e,n,o,s=_t,r=1e-6){const i=ut(t,e,s),f=dt(t,e,s),d=ut(n,o,s),g=dt(n,o,s);if(i&&d||f&&g||!(i||f)||!(d||g))return!1;const h=i?{a:t,b:e}:{a:n,b:o},S=f?{a:t,b:e}:{a:n,b:o},M=h.a.y,u=Math.min(h.a.x,h.b.x),m=Math.max(h.a.x,h.b.x),c=S.a.x,b=Math.min(S.a.y,S.b.y),w=Math.max(S.a.y,S.b.y);if(c<u||c>m||M<b||M>w)return!1;const I=Math.abs(c-h.a.x)<r&&Math.abs(M-h.a.y)<r||Math.abs(c-h.b.x)<r&&Math.abs(M-h.b.y)<r,T=Math.abs(c-S.a.x)<r&&Math.abs(M-S.a.y)<r||Math.abs(c-S.b.x)<r&&Math.abs(M-S.b.y)<r;return!(I&&T)}O(eo,"orthogonalSegmentsCross");l(eo,"orthogonalSegmentsCross");function Oo(t,e,n,o,s=_t){const r=ut(t,e,s),i=dt(t,e,s),f=ut(n,o,s),d=dt(n,o,s);return i&&d&&dt(t,n,s)?zt(t.y,e.y,n.y,o.y)>s:r&&f&&ut(t,n,s)?zt(t.x,e.x,n.x,o.x)>s:!1}O(Oo,"sameAxisSegmentsOverlap");l(Oo,"sameAxisSegmentsOverlap");function $e(t,e,n,o,{epsilon:s=_t,skipDegenerateOther:r=!1}={}){for(const i of n){if(i===o||i.isLayoutOnly)continue;const f=i.points;if(!(!f||f.length<2))for(let d=0;d<f.length-1;d++){const g=f[d],h=f[d+1];if(!(r&&Qt(g,h,s))&&(eo(t,e,g,h,s)||Oo(t,e,g,h,s)))return!0}}return!1}O($e,"segmentConflictsWithAnyEdge");l($e,"segmentConflictsWithAnyEdge");function ce(t,e,n,o,s=_t){const r=ut(t,e,s),i=dt(t,e,s),f=ut(n,o,s),d=dt(n,o,s);if(!(r&&d||i&&f))return!1;const g=r?{a:t,b:e}:{a:n,b:o},h=r?{a:n,b:o}:{a:t,b:e},S=g.a.y,M=Math.min(g.a.x,g.b.x),u=Math.max(g.a.x,g.b.x),m=h.a.x,c=Math.min(h.a.y,h.b.y),b=Math.max(h.a.y,h.b.y);return m>M+s&&m<u-s&&S>c+s&&S<b-s}O(ce,"orthogonalSegmentsStrictlyCross");l(ce,"orthogonalSegmentsStrictlyCross");function bn(t,e,n){const o=Math.min(e,n),s=Math.max(e,n);return t>o+_t&&t<s-_t}O(bn,"strictlyBetween");l(bn,"strictlyBetween");function Po(t,e,n){return dt(t,e)&&dt(e,n)?bn(e.y,t.y,n.y):ut(t,e)&&ut(e,n)?bn(e.x,t.x,n.x):!1}O(Po,"isCollinearIntermediate");l(Po,"isCollinearIntermediate");function ko(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){const s=n[n.length-1],r=t[o],i=o+1<t.length?t[o+1]:void 0;if(s&&i){if(Qt(s,i)){o++,e=!0;continue}if(Po(s,r,i)){e=!0;continue}}n.push(r)}return{points:n,changed:e}}O(ko,"simplifyPolylineOnce");l(ko,"simplifyPolylineOnce");function Ve(t){const e=[t[0]];for(let o=1;o<t.length;o++){const s=e[e.length-1],r=t[o];if(!dt(s,r)&&!ut(s,r)){const i=e.length>=2?e[e.length-2]:void 0,f=i&&dt(i,s)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(f)}e.push(r)}const n=[];for(const o of e){const s=n[n.length-1];(!s||!Qt(s,o))&&n.push(o)}return n}O(Ve,"orthogonalizePolyline");l(Ve,"orthogonalizePolyline");function oe(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){const o=ko(e);if(e=o.points,!o.changed)break}return e}O(oe,"simplifyPolyline");l(oe,"simplifyPolyline");var tt=.001,cr=.5,Mo=4;function no(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length<n)return;const s=o.start?e.get(o.start):void 0,r=o.end?e.get(o.end):void 0;return{edge:o,points:o.points,srcRect:s?jt(s):void 0,dstRect:r?jt(r):void 0}}O(no,"endpointContextFor");l(no,"endpointContextFor");function Bo(t,e,n){if(ut(t,e,tt))return{x:t.x<n.left?n.left:n.right,y:t.y};if(dt(t,e,tt)){const o=t.y<n.top?n.top:n.bottom;return{x:t.x,y:o}}return{x:Math.min(n.right,Math.max(n.left,t.x)),y:Math.min(n.bottom,Math.max(n.top,t.y))}}O(Bo,"segmentEnterPoint");l(Bo,"segmentEnterPoint");function Mn(t,e,n){const o=n?1:-1;let s=n?0:t.length-1;for(;s>=0&&s<t.length&&Zn(t[s],e,cr);)s+=o;if(s<0||s>=t.length)return t;const r=s-o;if(r<0||r>=t.length)return t;const i=Bo(t[s],t[r],e);return n?[i,...t.slice(s)]:[...t.slice(0,s+1),i]}O(Mn,"clipEndpoint");l(Mn,"clipEndpoint");function Fo(t,e){for(const n of t){const o=no(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=Mn(s,o.srcRect,!0)),o.dstRect&&(s=Mn(s,o.dstRect,!1)),s=oe(Ve(s)),s=oo(s,o.srcRect,o.dstRect),o.edge.points=oe(Ve(s))}}O(Fo,"clipEdgeEndpointsToNodeBoundaries");l(Fo,"clipEdgeEndpointsToNodeBoundaries");function In(t,e,n,o=!1){if(ut(t,e,tt)){if(e.y<n.top-tt||e.y>n.bottom+tt)return e;if(o){if(t.x<n.left-tt)return{x:n.left,y:t.y};if(t.x>n.right+tt)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(dt(t,e,tt)){if(e.x<n.left-tt||e.x>n.right+tt)return e;if(o){if(t.y<n.top-tt)return{x:t.x,y:n.top};if(t.y>n.bottom+tt)return{x:t.x,y:n.bottom}}const s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}O(In,"snapEndpointToBoundary");l(In,"snapEndpointToBoundary");function je(t,e,n){const o=t[e];for(let s=e+n;s>=0&&s<t.length;s+=n){const r=t[s];if(!Qt(r,o,tt))return r}return t[e+n]}O(je,"firstDistinctAdjacent");l(je,"firstDistinctAdjacent");function Ue(t,e){const n=t+Mo,o=e-Mo;return n<=o?{lo:n,hi:o}:{lo:(t+e)/2,hi:(t+e)/2}}O(Ue,"cornerClearanceRange");l(Ue,"cornerClearanceRange");function Sn(t,e,n){const{lo:o,hi:s}=Ue(e,n);return Math.min(s,Math.max(o,t))}O(Sn,"clampToCornerClearance");l(Sn,"clampToCornerClearance");function _o(t){const e=Math.max(...t.map(o=>o.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}O(_o,"intersectRanges");l(_o,"intersectRanges");function Cn(t,e){return e==="left"||e==="right"?Ue(t.top,t.bottom):Ue(t.left,t.right)}O(Cn,"clearanceRangeForSide");l(Cn,"clearanceRangeForSide");function We(t,e,n){const o=t.y>=n.top-tt&&t.y<=n.bottom+tt,s=t.x>=n.left-tt&&t.x<=n.right+tt;if(ut(t,e,tt)&&o){if(Math.abs(t.x-n.left)<tt)return"left";if(Math.abs(t.x-n.right)<tt)return"right"}if(dt(t,e,tt)&&s){if(Math.abs(t.y-n.top)<tt)return"top";if(Math.abs(t.y-n.bottom)<tt)return"bottom"}}O(We,"terminalSideForSegment");l(We,"terminalSideForSegment");function Re(t){return t==="left"||t==="right"}O(Re,"isHorizontalSide");l(Re,"isHorizontalSide");function Do(t,e,n,o,s){const r=[],i=n?We(t,e,n):void 0,f=o?We(e,t,o):void 0;return n&&i&&Re(i)===s&&r.push(Cn(n,i)),o&&f&&Re(f)===s&&r.push(Cn(o,f)),r.length>0?_o(r):void 0}O(Do,"straightClearanceRange");l(Do,"straightClearanceRange");function Ln(t,e,n,o,s){const r=Do(t,e,n,o,s);if(!r)return;const i=s?t.y:t.x,f=Math.min(r.hi,Math.max(r.lo,i));if(!(Math.abs(f-i)<tt))return s?[{x:t.x,y:f},{x:e.x,y:f}]:[{x:f,y:t.y},{x:f,y:e.y}]}O(Ln,"clearStraightEndpointCornerAxis");l(Ln,"clearStraightEndpointCornerAxis");function oo(t,e,n){if(t.length!==2)return t;const[o,s]=t;return ut(o,s,tt)?Ln(o,s,e,n,!0)??t:dt(o,s,tt)?Ln(o,s,e,n,!1)??t:t}O(oo,"clearStraightEndpointCornerConnections");l(oo,"clearStraightEndpointCornerConnections");function Ho(t,e,n){return Re(n)?{x:t.x,y:Sn(t.y,e.top,e.bottom)}:{x:Sn(t.x,e.left,e.right),y:t.y}}O(Ho,"cornerClearedEndpoint");l(Ho,"cornerClearedEndpoint");function Xo(t,e,n,o,s,r){const i=t.map(f=>({...f}));for(let f=e;f>=0&&f<t.length;f+=n){const d=t[f];if(r&&!ut(d,o,tt)||!r&&!dt(d,o,tt))break;r?i[f].y=s.y:i[f].x=s.x}return i}O(Xo,"moveCollinearEndpointRun");l(Xo,"moveCollinearEndpointRun");function vn(t,e,n){if(t.length<2)return t;const o=n?0:t.length-1,s=n?1:-1,r=t[o],i=je(t,o,s);if(!i)return t;const f=We(r,i,e);if(!f)return t;const d=Re(f),g=Ho(r,e,f);return Qt(r,g,tt)?t:Xo(t,o,s,r,g,d)}O(vn,"clearEndpointCornerConnection");l(vn,"clearEndpointCornerConnection");function wn(t,e,n){const o=Math.min(t.x,e.x)>=n.left-tt&&Math.max(t.x,e.x)<=n.right+tt,s=Math.min(t.y,e.y)>=n.top-tt&&Math.max(t.y,e.y)<=n.bottom+tt;if(Math.abs(t.y-n.top)<tt&&Math.abs(e.y-n.top)<tt&&o)return"top";if(Math.abs(t.y-n.bottom)<tt&&Math.abs(e.y-n.bottom)<tt&&o)return"bottom";if(Math.abs(t.x-n.left)<tt&&Math.abs(e.x-n.left)<tt&&s)return"left";if(Math.abs(t.x-n.right)<tt&&Math.abs(e.x-n.right)<tt&&s)return"right"}O(wn,"borderSideForSegment");l(wn,"borderSideForSegment");function En(t,e,n,o){switch(t){case"top":return dt(e,n,tt)&&n.y<o.top-tt;case"bottom":return dt(e,n,tt)&&n.y>o.bottom+tt;case"left":return ut(e,n,tt)&&n.x<o.left-tt;case"right":return ut(e,n,tt)&&n.x>o.right+tt}}O(En,"leavesOutward");l(En,"leavesOutward");function Tn(t,e,n){if(t.length<3)return t;if(n){const r=wn(t[0],t[1],e);return r&&En(r,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,s=wn(t[o-1],t[o],e);return s&&En(s,t[o-1],t[o-2],e)?t.slice(0,o):t}O(Tn,"collapseOwnBorderStub");l(Tn,"collapseOwnBorderStub");function Yo(t,e,n){let o=t;if(e){const r=je(o,0,1);if(r){const i=In(r,o[0],e);i!==o[0]&&(o=[i,...o.slice(1)])}o=Tn(o,e,!0)}if(n){const r=o.length-1,i=je(o,r,-1);if(i){const f=In(i,o[r],n,!0);f!==o[r]&&(o=[...o.slice(0,r),f])}o=Tn(o,n,!1)}const s=oo(o,e,n);return s!==o||o.length===2?s:(e&&(o=vn(o,e,!0)),n&&(o=vn(o,n,!1)),o)}O(Yo,"snapAndCollapseEndpoints");l(Yo,"snapAndCollapseEndpoints");function An(t,e){for(const n of t){const o=no(n,e,2);if(!o)continue;const s=Yo(mt(o.points,tt),o.srcRect,o.dstRect);if(s.length<3){o.edge.points=s;continue}const r=[s[0],{...s[0]},...s.slice(1,-1),s[s.length-1],{...s[s.length-1]}];o.edge.points=r}}O(An,"prepareEdgeEndpointsForRenderer");l(An,"prepareEdgeEndpointsForRenderer");function so(t){return new Map(t.map(e=>[e.id,e]))}O(so,"buildNodeMap");l(so,"buildNodeMap");function Go(t,e){let n=t.parentId,o=null;for(;n;){const s=e.get(n);if(!s?.isGroup)break;o=s.id,n=s.parentId}return o}O(Go,"resolveTopLevelGroupId");l(Go,"resolveTopLevelGroupId");function Rn(t,e){let n=0,o=t.parentId;for(;o;){const s=e.get(o);if(!s?.isGroup)break;n++,o=s.parentId}return n}O(Rn,"groupDepth");l(Rn,"groupDepth");function ro(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(const r of t){const i=r.x,f=r.y;if(typeof i!="number"||typeof f!="number")continue;const d=r.width??0,g=r.height??0;e=Math.min(e,i-d/2),n=Math.max(n,i+d/2),o=Math.min(o,f-g/2),s=Math.max(s,f+g/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}O(ro,"boundsForChildren");l(ro,"boundsForChildren");function zo(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}O(zo,"applyGroupBounds");l(zo,"applyGroupBounds");function $o(t){const e=so(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>Rn(s,e)-Rn(o,e));for(const o of n){const s=ro(t.filter(r=>r.parentId===o.id));s&&zo(o,s)}}O($o,"recomputeNestedGroupBounds");l($o,"recomputeNestedGroupBounds");function Ke(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(d=>!d.isGroup);let r=1/0,i=-1/0;for(const d of s){const g=d[e];typeof g=="number"&&(r=Math.min(r,g),i=Math.max(i,g))}if(!Number.isFinite(r)||!Number.isFinite(i))return!1;const f=l(d=>r+i-d,"mirror");for(const d of n){const g=d[e];typeof g=="number"&&(d[e]=f(g));const h=d.groupTitleRect;h&&(d.groupTitleRect=e==="x"?{...h,left:f(h.right),right:f(h.left)}:{...h,top:f(h.bottom),bottom:f(h.top)})}for(const d of o)for(const g of d.points??[])g[e]=f(g[e]);return!0}O(Ke,"mirrorAxis");l(Ke,"mirrorAxis");function Vo(t){return(t.nodes??[]).some(e=>!e.isGroup)?Ke(t,"y"):!0}O(Vo,"applyBtDirectionTransform");l(Vo,"applyBtDirectionTransform");function jo(t,e="LR"){const n=t.nodes??[],o=t.edges??[],s=n.filter(N=>!N.isGroup);let r=1/0,i=1/0;for(const N of s){const R=N.x??0,_=N.y??0;R<r&&(r=R),_<i&&(i=_)}if(!Number.isFinite(r)||!Number.isFinite(i))return!1;const f=36;let d=0,g=0;for(const N of s)d+=N.width??0,g+=N.height??0;const h=d/s.length,S=g/s.length,M=S>0?Math.max(1,h/S):1;for(const N of s){const R=N.x??0,_=((N.y??0)-i)*M+f,F=R-r;N.x=_,N.y=F}for(const N of o)if(N.points)for(const R of N.points){const _=R.x,F=(R.y-i)*M+f,Y=_-r;R.x=F,R.y=Y}$o(n);const u=n.filter(N=>N.isGroup&&!N.parentId);if(u.length===0)return e==="RL"&&Ke(t,"x"),!0;const m=so(n),c=new Map;for(const N of n){if(N.isGroup)continue;const R=Go(N,m);if(!R)continue;const _=c.get(R)??[];_.push(N),c.set(R,_)}let b=0;for(const N of u){const R=N.padding??0;R>b&&(b=R)}const w=[];let I=1/0,T=-1/0;for(const N of u){const R=ro(c.get(N.id)??[]);R&&(I=Math.min(I,R.minX),T=Math.max(T,R.maxX),w.push({lane:N,contentTop:R.minY,contentBottom:R.maxY,centerY:(R.minY+R.maxY)/2}))}if(I===1/0||T===-1/0)return!0;const v=Math.max(0,T-I)+2*Math.max(b,10),p=f+v,y=(I+T)/2-v/2-f,A=y+p/2,P=Math.max(b,f);w.sort((N,R)=>N.centerY-R.centerY);for(let N=0;N<w.length;N++){const R=w[N];let _,F;if(N===0?_=R.contentTop-P:_=(w[N-1].contentBottom+R.contentTop)/2,N===w.length-1)F=R.contentBottom+P;else{const et=w[N+1];F=(R.contentBottom+et.contentTop)/2}const Y=Math.max(0,F-_),Z=(_+F)/2;R.lane.x=A,R.lane.y=Z,R.lane.width=p,R.lane.height=Y,R.lane.swimlaneContentTop=R.contentTop,R.lane.groupTitleRect={left:y,right:y+f,top:_,bottom:F}}return e==="RL"&&Ke(t,"x"),!0}O(jo,"applyLrDirectionTransform");l(jo,"applyLrDirectionTransform");var te=1e-6,De=8,ar=[0,De,-De,2*De,-2*De];function Uo(t,e){const{nodeInfoById:n,realNodeRects:o}=Qe(e);for(const s of t){if(s.isLayoutOnly)continue;const r=s.points;if(!r||r.length<4)continue;const i=qn(mt(r,te),te);if(!i)continue;const{p3:f}=i,d=i.kind==="HVH",g=to(s,n,te);if(!g)continue;const{srcId:h,dstId:S,srcInfo:M,dstInfo:u,collinearX:m,collinearY:c}=g;if(m||c)continue;let b;const w=M.rect;for(const I of ar){let T,v,p;if(d){const R=u.cy>M.cy?w.bottom:w.top,_=M.cx+I;if(_<=w.left+te||_>=w.right-te)continue;T={x:_,y:R},v={x:_,y:f.y},p={x:f.x,y:f.y}}else{const R=u.cx>M.cx?w.right:w.left,_=M.cy+I;if(_<=w.top+te||_>=w.bottom-te)continue;T={x:R,y:_},v={x:f.x,y:_},p={x:f.x,y:f.y}}const y=Qt(T,v,te),A=Qt(v,p,te);if(y&&A||!y&&At(T,v,o,[h],1)||!A&&At(v,p,o,[S],1))continue;const P=!y&&$e(T,v,t,s,{epsilon:te,skipDegenerateOther:!0}),N=!A&&$e(v,p,t,s,{epsilon:te,skipDegenerateOther:!0});if(!(P||N)){y?b=[v,p]:A?b=[T,v]:b=[T,v,p];break}}b&&(s.points=b)}}O(Uo,"portSwapToLShape");l(Uo,"portSwapToLShape");function Wo(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values());for(const f of t){if(f.isLayoutOnly)continue;const d=f.points;if(!d||d.length<4)continue;const g=mt(d,.001);if(g.length<4)continue;const h=g.length-1,S=g[h],M=g[h-1],u=g[h-2],m=S.x-M.x,c=S.y-M.y,b=Math.hypot(m,c);if(b>=10||b<.001)continue;const w=M.x-u.x,I=M.y-u.y;if(Math.hypot(w,I)<.001)continue;const T=wt(M,S,.001),v=Et(M,S,.001),p=wt(u,M,.001),y=Et(u,M,.001);if(!(T&&y||v&&p))continue;const A=f.end,P=f.start,N=A?e.get(A):void 0;if(!N)continue;const R=N.x??0,_=N.y??0,F=jt(N);if(!F)continue;let Y,Z;if(y){const rt=I<0;Y={x:R,y:u.y},Z={x:R,y:rt?F.bottom:F.top}}else{const rt=w>0;Y={x:u.x,y:_},Z={x:rt?F.right:F.left,y:_}}if(At(Y,Z,r,A?[A]:[],-2)||At(Y,Z,i,[],-2))continue;if(P){const rt=e.get(P),K=rt?jt(rt):void 0;if(K&&Zn(Y,K,2))continue}const et=l((rt,K)=>`${rt.x.toFixed(3)},${rt.y.toFixed(3)}|${K.x.toFixed(3)},${K.y.toFixed(3)}`,"ownSegmentKey"),nt=new Set;for(let rt=0;rt<g.length-1;rt++)nt.add(et(g[rt],g[rt+1]));const Mt=l((rt,K)=>{for(const Q of t){if(Q===f||Q.isLayoutOnly)continue;const st=Q.points;if(!(!st||st.length<2))for(let at=0;at<st.length-1;at++){const bt=st[at],It=st[at+1];if(!nt.has(et(bt,It))&&ce(rt,K,bt,It,.001))return!0}}return!1},"segmentCrossesOtherEdge");if(Mt(Y,Z))continue;if(h-3>=0){const rt=g[h-3],K=[P,A].filter(Q=>!!Q);if(At(rt,Y,r,K,-2)||Mt(rt,Y))continue}const yt=[...g.slice(0,h-2),Y,Z];f.points=yt;const Bt=f.labelNodeId;if(Bt){const rt=e.get(Bt);if(rt){const K=rt.width??0,Q=rt.height??0;if(K>0&&Q>0){let st,at,bt=-1;for(let It=0;It<yt.length-1;It++){const Lt=yt[It],Ut=yt[It+1],Zt=Math.hypot(Ut.x-Lt.x,Ut.y-Lt.y),se=ut(Lt,Ut,.001),re=dt(Lt,Ut,.001);(se&&Zt>=K+2||re&&Zt>=Q+2)&&Zt>bt&&(bt=Zt,st=(Lt.x+Ut.x)/2,at=(Lt.y+Ut.y)/2)}st!==void 0&&at!==void 0&&(rt.x=st,rt.y=at)}}}}}O(Wo,"collapseShortTerminalStub");l(Wo,"collapseShortTerminalStub");var J=.001,Ft=8,it=Ee,hn=l((t,e)=>dt(t,e,J)||ut(t,e,J),"orthogonallyAligned");function Ko(t,e){const s=l((u,m)=>{const c=u.x??0,b=u.y??0,w=m.x-c,I=m.y-b;let T=(u.width??0)/2,v=(u.height??0)/2;return Math.abs(I)*T>Math.abs(w)*v?(I<0&&(v=-v),{x:c+(I===0?0:v*w/I),y:b+v}):(w<0&&(T=-T),{x:c+T,y:b+(w===0?0:T*I/w)})},"rectIntersect"),r=l((u,m)=>{const c=mt(u.points??[]);if(c.length<2)return;const b=m?u.start:u.end,w=b?e.get(b):void 0,I=w?jt(w):void 0;if(!w||!b||!I)return;const T=m?c[0]:c[c.length-1],v=m?c[1]:c[c.length-2],p=s(w,T);let y=T;if(hn(v,p)&&(y=v),dt(p,y,J))return{edge:u,edgeId:String(u.id??""),nodeId:b,atStart:m,orientation:"V",coord:p.x,min:Math.min(p.y,y.y),max:Math.max(p.y,y.y),boundary:p,railEnd:y,rect:I};if(ut(p,y,J))return{edge:u,edgeId:String(u.id??""),nodeId:b,atStart:m,orientation:"H",coord:p.y,min:Math.min(p.x,y.x),max:Math.max(p.x,y.x),boundary:p,railEnd:y,rect:I}},"terminalLaneFor"),i=l((u,m)=>Math.max(0,Math.min(u.max,m.max)-Math.max(u.min,m.min)),"projectedOverlapLength"),f=l((u,m)=>u.nodeId!==m.nodeId||u.orientation!==m.orientation?!1:u.orientation==="H"?(Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1)&&dt(u.boundary,m.boundary,1):(Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1)&&ut(u.boundary,m.boundary,1),"sameTerminalFace"),d=l((u,m)=>u.nodeId!==m.nodeId||u.orientation!==m.orientation?!1:i(u,m)>=Ft&&Math.abs(u.coord-m.coord)<.5,"exactTerminalLaneConflict"),g=l((u,m)=>{if(u.nodeId!==m.nodeId||u.orientation!==m.orientation||u.orientation!=="H"||u.atStart===m.atStart)return!1;const c=i(u,m);if(c<Ft)return!1;const b=u.rect.bottom-u.rect.top;return c<b||c>2*b?!1:f(u,m)&&Math.abs(u.coord-m.coord)<16},"nearTerminalLaneConflict"),h=l((u,m)=>{const c=mt(u.edge.points??[]);if(c.length<2)return;const b=u.orientation==="V"?{x:u.boundary.x+m,y:u.boundary.y}:{x:u.boundary.x,y:u.boundary.y+m},w=u.orientation==="V"?{x:u.railEnd.x+m,y:u.railEnd.y}:{x:u.railEnd.x,y:u.railEnd.y+m};if(!l(()=>Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1?ut(b,u.boundary,J)&&b.x>=u.rect.left+1&&b.x<=u.rect.right-1:Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1?dt(b,u.boundary,J)&&b.y>=u.rect.top+1&&b.y<=u.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(u.atStart){const p=c.length>1&&Qt(c[1],u.railEnd,J),y=c.slice(p?2:1),A=y[0];return A&&!hn(A,w)?void 0:[b,w,...y]}const I=c.length>1&&Qt(c[c.length-2],u.railEnd,J),T=c.slice(0,I?-2:-1),v=T[T.length-1];if(!(v&&!hn(v,w)))return[...T,w,b]},"shiftedCandidate"),S=l(u=>{const m=u.edge,c=mt(m.points??[]);if(c.length!==2)return!1;const b=m.start,w=m.end,I=b?e.get(b):void 0,T=w?e.get(w):void 0;if(!I||!T)return!1;const v=I.x??0,p=I.y??0,y=T.x??0,A=T.y??0,[P,N]=c;return ut(P,N,J)&&Math.abs(p-A)<1&&Math.abs(v-y)>1||dt(P,N,J)&&Math.abs(v-y)<1&&Math.abs(p-A)>1},"laneIsStraightCollinearConnector"),M=[-7,7,-14,14,-21,21];for(let u=0;u<8;u++){const m=t.filter(b=>!b.isLayoutOnly).flatMap(b=>[r(b,!0),r(b,!1)]).filter(b=>!!b);let c=!1;for(let b=0;b<m.length&&!c;b++)for(let w=b+1;w<m.length&&!c;w++){const I=m[b],T=m[w];if(I.edge===T.edge||!(d(I,T)||g(I,T)))continue;const v=!d(I,T),p=[I,T].sort((y,A)=>{const P=S(y),N=S(A);return P!==N?Number(P)-Number(N):+!A.atStart-+!y.atStart});for(const y of p){for(const A of M){const P=h(y,A);if(!P)continue;const N=r({...y.edge,points:P},y.atStart);if(!(!N||m.some(R=>R.edge!==y.edge&&(d(N,R)||v&&g(N,R))))){y.edge.points=P,c=!0;break}}if(c)break}}if(!c)return}}O(Ko,"separateSharedRenderedTerminalLanes");l(Ko,"separateSharedRenderedTerminalLanes");function qo(t,e){const{realNodeRects:o,labelNodeRects:s}=me(e.values()),r=l((f,d)=>{const g=f.start,h=f.end,S=it(d);if(S.length!==d.length-1)return!1;const M=[g,h].filter(u=>!!u);for(const u of S)if(At(u.a,u.b,o,M,-2)||At(u.a,u.b,s,[],-2))return!1;for(const u of t){if(u===f||u.isLayoutOnly)continue;const m=u.points;if(!(!m||m.length<2)){for(const c of S)for(const b of it(mt(m)))if(ne(c,b,.5)>=Ft||ce(c.a,c.b,b.a,b.b,J))return!1}}return!0},"candidateIsSafe"),i=l((f,d)=>{if(d+4>=f.length)return;const g=f[d],h=f[d+1],S=f[d+2],M=f[d+3],u=f[d+4],m=wt(g,h)&&Et(h,S)&&wt(S,M)&&Et(M,u)&&dt(g,M,J)&&dt(g,u,J)&&dt(h,S,J)&&(h.x-g.x)*(M.x-S.x)<0,c=Et(g,h)&&wt(h,S)&&Et(S,M)&&wt(M,u)&&ut(g,M,J)&&ut(g,u,J)&&ut(h,S,J)&&(h.y-g.y)*(M.y-S.y)<0;if(m||c)return mt([...f.slice(0,d+1),u,...f.slice(d+5)]);if(d+5>=f.length)return;const b=f[d+5],w=Et(g,h)&&wt(h,S)&&Et(S,M)&&wt(M,u)&&Et(u,b)&&dt(g,u,J)&&dt(g,b,J)&&dt(S,M,J)&&(S.x-h.x)*(u.x-M.x)<0,I=wt(g,h)&&Et(h,S)&&wt(S,M)&&Et(M,u)&&wt(u,b)&&ut(g,u,J)&&ut(g,b,J)&&ut(S,M,J)&&(S.y-h.y)*(u.y-M.y)<0;if(!(!w&&!I))return mt([...f.slice(0,d+1),b,...f.slice(d+6)])},"withoutDogleg");for(let f=0;f<8;f++){let d=!1;for(const g of t){if(g.isLayoutOnly)continue;const h=mt(g.points??[]);for(let S=0;S<=h.length-5;S++){const M=i(h,S);if(!(!M||!r(g,M))){g.points=M,d=!0;break}}if(d)break}if(!d)return}}O(qo,"collapseRedundantRectangularDoglegs");l(qo,"collapseRedundantRectangularDoglegs");function Nn(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values()),f=t.filter(m=>!m.isLayoutOnly),d=l((m,c,b)=>mt(m===c?b??[]:m.points??[]),"pointsFor"),g=l((m,c)=>{let b=0;for(let w=0;w<f.length;w++){const I=it(d(f[w],m,c));for(let T=w+1;T<f.length;T++){const v=it(d(f[T],m,c));for(const p of I)for(const y of v)ce(p.a,p.b,y.a,y.b,J)&&b++}}return b},"strictCrossingCount"),h=l(m=>{const c=it(m);if(c.length!==3)return;const b=c[1];if(!(c[0].horizontal===b.horizontal||c[2].horizontal===b.horizontal))return{index:b.index,horizontal:b.horizontal,vertical:b.vertical,segment:b}},"middleRail"),S=l((m,c)=>{const b=[m.start,m.end].filter(w=>!!w);return r.filter(w=>{if(b.includes(w.id))return!1;const I=w.rect;return c.horizontal?zt(c.a.x,c.b.x,I.left,I.right)>=Ft&&c.a.y>=I.top-2&&c.a.y<=I.bottom+2:zt(c.a.y,c.b.y,I.top,I.bottom)>=Ft&&c.a.x>=I.left-2&&c.a.x<=I.right+2})},"blockingRectsFor"),M=l((m,c,b)=>{const w=m.map(T=>({...T}));if(c.horizontal)w[c.index].y=b,w[c.index+1].y=b;else if(c.vertical)w[c.index].x=b,w[c.index+1].x=b;else return;const I=oe(mt(w));return it(I).length===I.length-1?I:void 0},"candidateByMovingRail"),u=l((m,c,b)=>{const w=[m.start,m.end].filter(T=>!!T),I=it(c);if(I.length!==c.length-1)return!1;for(const T of I)if(At(T.a,T.b,r,w,-2)||At(T.a,T.b,i,[],-2))return!1;for(const T of f)if(T!==m){for(const v of I)for(const p of it(d(T)))if(ne(v,p,.5)>=Ft)return!1}return g(m,c)<=b},"candidateIsSafe");for(let m=0;m<8;m++){const c=g();let b=!1;for(const w of f){const I=d(w),T=h(I);if(!T)continue;const v=S(w,T.segment);if(v.length===0)continue;const p=T.horizontal?[Math.min(...v.map(y=>y.rect.top))-20,Math.max(...v.map(y=>y.rect.bottom))+20]:[Math.min(...v.map(y=>y.rect.left))-20,Math.max(...v.map(y=>y.rect.right))+20];for(const y of p){const A=M(I,T.segment,y);if(!(!A||!u(w,A,c))){w.points=A,b=!0;break}}if(b)break}if(!b)return}}O(Nn,"liftObstacleHuggingSameSideRails");l(Nn,"liftObstacleHuggingSameSideRails");function On(t,e){const o=l(d=>{const g=d.groupTitleRect;if(!(!g||typeof g.left!="number"||typeof g.right!="number"||typeof g.top!="number"||typeof g.bottom!="number"||!Number.isFinite(g.left)||!Number.isFinite(g.right)||!Number.isFinite(g.top)||!Number.isFinite(g.bottom)||g.right<=g.left||g.bottom<=g.top))return{left:g.left,right:g.right,top:g.top,bottom:g.bottom}},"validTitleRect"),s=l(d=>{if(!d.isGroup||d.parentId)return;const g=d.direction,h=typeof g=="string"?g.toUpperCase():"";if(h==="LR"||h==="RL"||h==="BT")return;const S=o(d),M=d.y,u=d.height;if(!S||typeof M!="number"||typeof u!="number"||!Number.isFinite(M)||!Number.isFinite(u)||u<=0)return;const m=S.right-S.left,c=S.bottom-S.top;if(!(c<=0||m<c))return{node:d,rect:S}},"topLaneTitleFor"),r=l((d,g)=>{if(!d.horizontal)return!1;const h=d.a.y;return h<=g.top+J||h>=g.bottom-J?!1:zt(d.a.x,d.b.x,g.left,g.right)>=Ft},"horizontalSegmentIntersectsTitle"),i=[...e.values()].map(s).filter(d=>!!d);if(i.length===0)return;let f=0;for(const d of t){if(d.isLayoutOnly)continue;const g=mt(d.points??[]);for(const h of it(g))for(const S of i)r(h,S.rect)&&(f=Math.max(f,S.rect.bottom-h.a.y+4))}if(!(f<=J))for(const d of i){const g=d.node.y,h=d.node.height;typeof g!="number"||typeof h!="number"||!Number.isFinite(g)||!Number.isFinite(h)||h<=0||(d.node.y=g-f/2,d.node.height=h+f,d.node.groupTitleRect={...d.rect,top:d.rect.top-f,bottom:d.rect.bottom-f})}}O(On,"liftTopLaneTitleBandsAboveRails");l(On,"liftTopLaneTitleBandsAboveRails");function Pn(t,e){const o=l(g=>{const h=g.groupTitleRect;if(!(!h||typeof h.left!="number"||typeof h.right!="number"||typeof h.top!="number"||typeof h.bottom!="number"||!Number.isFinite(h.left)||!Number.isFinite(h.right)||!Number.isFinite(h.top)||!Number.isFinite(h.bottom)||h.right<=h.left||h.bottom<=h.top))return{left:h.left,right:h.right,top:h.top,bottom:h.bottom}},"validTitleRect"),s=l(g=>{if(!g.isGroup||g.parentId||g.direction!=="LR")return;const h=o(g),S=g.x,M=g.width;if(!h||typeof S!="number"||typeof M!="number"||!Number.isFinite(S)||!Number.isFinite(M)||M<=0)return;const u=h.right-h.left,m=h.bottom-h.top;if(!(u<=0||m<u))return{node:g,rect:h}},"leftLaneTitleFor"),r=l((g,h)=>{if(!g.vertical)return!1;const S=g.a.x;return S<=h.left+J||S>=h.right-J?!1:zt(g.a.y,g.b.y,h.top,h.bottom)>=Ft},"verticalSegmentIntersectsTitle"),i=l((g,h)=>{if(!g.horizontal)return!1;const S=g.a.y;return S<=h.top+J||S>=h.bottom-J?!1:zt(g.a.x,g.b.x,h.left,h.right)>=Ft},"horizontalSegmentIntersectsTitle"),f=[...e.values()].map(s).filter(g=>!!g);if(f.length===0)return;let d=0;for(const g of t){if(g.isLayoutOnly)continue;const h=mt(g.points??[]);for(const S of it(h))for(const M of f)if(r(S,M.rect))d=Math.max(d,M.rect.right-S.a.x+4);else if(i(S,M.rect)){const u=Math.min(S.a.x,S.b.x);d=Math.max(d,M.rect.right-u+4)}}if(!(d<=J))for(const g of f){const h=g.node.x,S=g.node.width;typeof h!="number"||typeof S!="number"||!Number.isFinite(h)||!Number.isFinite(S)||S<=0||(g.node.x=h-d/2,g.node.width=S+d,g.node.groupTitleRect={...g.rect,left:g.rect.left-d,right:g.rect.right-d})}}O(Pn,"shiftLeftLaneTitleBandsLeftOfRails");l(Pn,"shiftLeftLaneTitleBandsLeftOfRails");function Zo(t,e){const{realNodeRects:o}=me(e.values()),s=t.filter(m=>!m.isLayoutOnly),r=l((m,c=new Map)=>mt(c.get(m)??m.points??[]),"replacementPointsFor"),i=l((m=new Map)=>{let c=0;for(let b=0;b<s.length;b++){const w=it(r(s[b],m));for(let I=b+1;I<s.length;I++){const T=it(r(s[I],m));for(const v of w)for(const p of T)ce(v.a,v.b,p.a,p.b,J)&&c++}}return c},"crossingCount"),f=l((m=new Map)=>s.reduce((c,b)=>c+qt(r(b,m)),0),"totalBends"),d=l(m=>{const c=r(m);if(c.length<4)return;const b=c[c.length-2],w=c[c.length-1];if(!(!wt(b,w,J)&&!Et(b,w,J)))return{tailStart:b,terminal:w}},"terminalTailFor"),g=l((m,c)=>{const b=r(m);if(b.length<3)return;const w=b[0],I=b[1];let T;if(wt(w,I,J))T={x:I.x,y:c.tailStart.y};else if(Et(w,I,J))T={x:c.tailStart.x,y:I.y};else return;const v=oe(mt([w,I,T,c.tailStart,c.terminal]));return it(v).length===v.length-1?v:void 0},"candidateWithDestinationTail"),h=l((m,c)=>{const b=[m.start,m.end].filter(w=>!!w);for(const w of it(c))if(At(w.a,w.b,o,b,-2))return!0;return!1},"pathHasNodeHit"),S=l((m,c,b)=>{for(const w of s)if(w!==m){for(const I of it(c))for(const T of it(r(w,b)))if(ne(I,T,.5)>=Ft)return!0}return!1},"pathHasSharedTrack"),M=l((m,c,b)=>!h(m,c)&&!S(m,c,b),"candidateIsSafe"),u=l(()=>{const m=new Map;for(const c of s){const b=c.end;if(!b||!e.has(b)||r(c).length<4)continue;const w=m.get(b)??[];w.push(c),m.set(b,w)}return m},"edgesByDestination");for(let m=0;m<4;m++){const c=i();if(c===0)return;const b=f();let w,I=c,T=b;for(const v of u().values())for(let p=0;p<v.length;p++)for(let y=p+1;y<v.length;y++){const A=v[p],P=v[y],N=d(A),R=d(P);if(!N||!R)continue;const _=g(A,R),F=g(P,N);if(!_||!F)continue;const Y=new Map([[A,_],[P,F]]);if(!M(A,_,Y)||!M(P,F,Y))continue;const Z=i(Y),et=f(Y);Z>=c||Z>I||Z===I&&et>=T||(w=Y,I=Z,T=et)}if(!w)return;for(const[v,p]of w)v.points=p}}O(Zo,"swapDestinationTerminalTailsToReduceCrossings");l(Zo,"swapDestinationTerminalTailsToReduceCrossings");function Jo(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values()),f=t.filter(v=>!v.isLayoutOnly),d=l((v,p=new Map)=>mt(p.get(v)??v.points??[]),"replacementPointsFor"),g=l((v=new Map)=>{let p=0;for(let y=0;y<f.length;y++){const A=it(d(f[y],v));for(let P=y+1;P<f.length;P++){const N=it(d(f[P],v));for(const R of A)for(const _ of N)ce(R.a,R.b,_.a,_.b,J)&&p++}}return p},"strictCrossingCount"),h=l((v=new Map)=>f.reduce((p,y)=>p+qt(d(y,v)),0),"totalBends"),S=l(v=>{const p=v.start,y=v.end,A=p?e.get(p):void 0,P=y?e.get(y):void 0,N=A?jt(A):void 0,R=P?jt(P):void 0;return N&&R?{src:N,dst:R}:void 0},"endpointRectsFor"),M=l((v,p,y)=>{if(y.index<=0||y.index+1>=p.length-1)return;const A=S(v);if(A){if(y.vertical){const P=y.a.x,N=Math.min(A.src.left,A.dst.left),R=Math.max(A.src.right,A.dst.right),_=P<N-J?"left":P>R+J?"right":void 0;return _?{edge:v,points:p,segmentIndex:y.index,axis:"vertical",side:_,coord:P,min:Math.min(y.a.y,y.b.y),max:Math.max(y.a.y,y.b.y)}:void 0}if(y.horizontal){const P=y.a.y,N=Math.min(A.src.top,A.dst.top),R=Math.max(A.src.bottom,A.dst.bottom),_=P<N-J?"top":P>R+J?"bottom":void 0;return _?{edge:v,points:p,segmentIndex:y.index,axis:"horizontal",side:_,coord:P,min:Math.min(y.a.x,y.b.x),max:Math.max(y.a.x,y.b.x)}:void 0}}},"externalRailForSegment"),u=l(()=>{const v=[];for(const p of f){const y=d(p);for(const A of it(y)){const P=M(p,y,A);P&&v.push(P)}}return v},"collectExternalRails"),m=l((v,p)=>v.edge!==p.edge&&v.axis===p.axis&&v.side===p.side&&zt(v.min,v.max,p.min,p.max)>=Ft,"railsInteract"),c=l(v=>{const p=[],y=new Set;for(const A of v){if(y.has(A))continue;const P=[A],N=[];for(y.add(A);P.length>0;){const R=P.pop();N.push(R);for(const _ of v)!y.has(_)&&m(R,_)&&(y.add(_),P.push(_))}N.length>1&&p.push(N)}return p},"connectedComponents"),b=l(v=>{const p=[];for(const y of v)p.some(A=>Math.abs(A-y.coord)<J)||p.push(y.coord);for(;p.length<v.length;){const y=Math.min(...p),A=Math.max(...p),P=v[0].side;p.push(P==="left"||P==="top"?y-12*(v.length-p.length):A+12*(v.length-p.length))}return p},"uniqueCoordsFor"),w=l(v=>{const p=v.map(P=>P.coord),y=b(v),A=[];if(v.length<=6){const P=new Array(y.length).fill(!1),N=[],R=l(()=>{if(N.length===v.length){N.some((_,F)=>Math.abs(_-p[F])>=J)&&A.push([...N]);return}for(const[_,F]of y.entries())P[_]||(P[_]=!0,N.push(F),R(),N.pop(),P[_]=!1)},"visit");return R(),A}for(let P=0;P<p.length;P++)for(let N=P+1;N<p.length;N++){const R=[...p];[R[P],R[N]]=[R[N],R[P]],A.push(R)}return A},"coordinateAssignmentsFor"),I=l((v,p)=>{const y=new Map;for(const[P,N]of v.entries()){const R=p[P],_=y.get(N.edge)??N.points.map(F=>({x:F.x,y:F.y}));N.axis==="vertical"?(_[N.segmentIndex].x=R,_[N.segmentIndex+1].x=R):(_[N.segmentIndex].y=R,_[N.segmentIndex+1].y=R),y.set(N.edge,_)}const A=new Map;for(const[P,N]of y){const R=oe(mt(N));if(it(R).length!==R.length-1)return;A.set(P,R)}return A},"replacementsForAssignment"),T=l(v=>{for(const[p,y]of v){const A=[p.start,p.end].filter(P=>!!P);for(const P of it(y))if(At(P.a,P.b,r,A,-2)||At(P.a,P.b,i,[],-2))return!1}for(let p=0;p<f.length;p++){const y=f[p],A=v.has(y),P=it(d(y,v));for(let N=p+1;N<f.length;N++){const R=f[N];if(!A&&!v.has(R))continue;const _=it(d(R,v));for(const F of P)for(const Y of _)if(ne(F,Y,.5)>=Ft)return!1}}return!0},"candidateIsSafe");for(let v=0;v<4;v++){const p=g();if(p===0)return;let y,A=p,P=h(),N=Number.POSITIVE_INFINITY;for(const R of c(u()))for(const _ of w(R)){const F=I(R,_);if(!F||!T(F))continue;const Y=g(F);if(Y>=p)continue;const Z=h(F),et=R.reduce((nt,Mt,yt)=>nt+Math.abs(_[yt]-Mt.coord),0);Y>A||Y===A&&(Z>P||Z===P&&et>=N)||(y=F,A=Y,P=Z,N=et)}if(!y)return;for(const[R,_]of y)R.points=_}}O(Jo,"reassignCrossingExternalRailChannels");l(Jo,"reassignCrossingExternalRailChannels");function Qo(t,e){const{realNodeRects:o,labelNodeRects:s}=me(e.values()),r=t.filter(u=>!u.isLayoutOnly),i=l((u,m,c)=>mt(u===m?c??[]:u.points??[]),"pointsFor"),f=l(u=>it(u).reduce((m,c)=>{const b=c.a.x-c.b.x,w=c.a.y-c.b.y;return m+Math.hypot(b,w)},0),"pathLength"),d=l((u,m)=>{let c=0;for(let b=0;b<r.length;b++){const w=it(i(r[b],u,m));for(let I=b+1;I<r.length;I++){const T=it(i(r[I],u,m));for(const v of w)for(const p of T)ce(v.a,v.b,p.a,p.b,J)&&c++}}return c},"strictCrossingCount"),g=l((u,m)=>{if(u.horizontal){const c=u.a.y;return(Math.abs(c-m.top)<1||Math.abs(c-m.bottom)<1)&&zt(u.a.x,u.b.x,m.left,m.right)>=Ft}if(u.vertical){const c=u.a.x;return(Math.abs(c-m.left)<1||Math.abs(c-m.right)<1)&&zt(u.a.y,u.b.y,m.top,m.bottom)>=Ft}return!1},"segmentRunsAlongRectBorder"),h=l(u=>{const m=[u.start,u.end].filter(b=>!!b),c=[];for(const b of m){const w=e.get(b),I=w?jt(w):void 0;I&&c.push(I)}return c},"endpointRectsFor"),S=l((u,m)=>{if(m+3>=u.length)return[];const c=u[m],b=u[m+1],w=u[m+2],I=u[m+3],T=wt(c,b,J)&&Et(b,w,J)&&wt(w,I,J),v=Et(c,b,J)&&wt(b,w,J)&&Et(w,I,J);if(!T&&!v)return[];if(!(T?Math.sign(b.x-c.x)!==Math.sign(I.x-w.x):Math.sign(b.y-c.y)!==Math.sign(I.y-w.y)))return[];const p=dt(c,I,J)||ut(c,I,J)?[]:[{x:c.x,y:I.y},{x:I.x,y:c.y}],y=p.length===0?[[...u.slice(0,m+1),...u.slice(m+3)]]:p.map(P=>[...u.slice(0,m+1),P,...u.slice(m+3)]),A=new Set;return y.map(P=>oe(mt(P))).filter(P=>{if(it(P).length!==P.length-1||!P.some(R=>Qt(R,I,J)))return!1;const N=P.map(R=>`${R.x.toFixed(3)},${R.y.toFixed(3)}`).join("|");return A.has(N)?!1:(A.add(N),!0)})},"shortcutCandidatesAt"),M=l((u,m,c)=>{const b=[u.start,u.end].filter(I=>!!I),w=h(u);for(const I of it(m))if(At(I.a,I.b,o,b,-2)||At(I.a,I.b,s,[],-2)||w.some(T=>g(I,T)))return!1;for(const I of r)if(I!==u){for(const T of it(m))for(const v of it(i(I)))if(ne(T,v,.5)>=Ft)return!1}return d(u,m)<=c},"candidateIsSafe");for(let u=0;u<8;u++){const m=d();let c,b,w=m,I=Number.POSITIVE_INFINITY,T=Number.POSITIVE_INFINITY;for(const v of r){const p=i(v),y=qt(p,J),A=f(p);for(let P=0;P<=p.length-4;P++)for(const N of S(p,P)){const R=qt(N,J),_=f(N);if(!(R<y||R===y&&_<A-J)||!M(v,N,m))continue;const F=d(v,N);F>w||F===w&&(R>I||R===I&&_>=T)||(c=v,b=N,w=F,I=R,T=_)}}if(!c||!b)return;c.points=b}}O(Qo,"shortcutRedundantOrthogonalJogs");l(Qo,"shortcutRedundantOrthogonalJogs");function ts(t,e){const i=[];for(const k of e.values()){if(k.isGroup||k.isEdgeLabel)continue;const D=k.x??0,H=k.y??0,j=jt(k);j&&i.push({id:String(k.id??""),cx:D,cy:H,rect:j})}if(i.length===0)return;const f=new Map(i.map(k=>[k.id,k])),d=i.map(k=>({id:k.id,rect:k.rect})),g=["top","bottom","left","right"],h={top:Math.min(...i.map(k=>k.rect.top))-20,bottom:Math.max(...i.map(k=>k.rect.bottom))+20,left:Math.min(...i.map(k=>k.rect.left))-20,right:Math.max(...i.map(k=>k.rect.right))+20},S=t.filter(k=>!k.isLayoutOnly),M=new Map(S.map((k,D)=>[k,D])),u=l(k=>{const D=k==="left"||k==="top"?-1:1,H=[];for(let j=0;j<=2;j++)H.push(h[k]+D*20*j);return H},"outwardTracksForSide"),m=l((k,D=new Map)=>mt(D.get(k)??k.points??[]),"replacementPointsFor"),c=l((k,D)=>{let H=0;for(const j of k)for(const a of D)ce(j.a,j.b,a.a,a.b,J)&&H++;return H},"crossingCountBetweenSegments"),b=l((k,D)=>c(it(k),it(D)),"crossingCountBetweenPaths"),w=l((k=new Map)=>{let D=0;const H=[],j=new Set,a=[],x=l(C=>{j.has(C)||(j.add(C),a.push(C))},"addEdge");for(let C=0;C<S.length;C++){const L=S[C],E=m(L,k);for(let B=C+1;B<S.length;B++){const $=S[B],q=b(E,m($,k));q>0&&(D+=q,H.push({first:L,second:$,count:q}),x(L),x($))}}return a.sort((C,L)=>(M.get(C)??0)-(M.get(L)??0)),{count:D,pairs:H,edgeSet:j,edges:a}},"crossingSnapshot"),I=l((k,D)=>{const H=new Set(D.keys());if(H.size===0)return k.count;let j=0;for(const x of k.pairs)(H.has(x.first)||H.has(x.second))&&(j+=x.count);let a=0;for(let x=0;x<S.length;x++){const C=S[x],L=H.has(C),E=m(C,D);for(let B=x+1;B<S.length;B++){const $=S[B];!L&&!H.has($)||(a+=b(E,m($,D)))}}return k.count-j+a},"crossingCountWithReplacements"),T=l(k=>{const D=new Map;for(const a of k.pairs){const x=D.get(a.first)??new Set;x.add(a.second),D.set(a.first,x);const C=D.get(a.second)??new Set;C.add(a.first),D.set(a.second,C)}const H=[],j=new Set;for(const a of k.edges){if(j.has(a))continue;const x=[a],C=[];for(j.add(a);x.length>0;){const L=x.pop();C.push(L);for(const E of D.get(L)??[])j.has(E)||(j.add(E),x.push(E))}C.sort((L,E)=>(M.get(L)??0)-(M.get(E)??0)),C.length>1&&H.push(C)}return H},"crossingComponents"),v=l(k=>[k.start,k.end].filter(D=>!!D),"endpointIdsFor"),p=l(k=>{const D=[];for(const H of T(k)){const j=new Set(H),a=new Set(H.flatMap(C=>v(C))),x=[...H];for(const C of S)j.has(C)||v(C).some(L=>a.has(L))&&x.push(C);x.sort((C,L)=>(M.get(C)??0)-(M.get(L)??0)),D.push(x)}return D},"pairSearchGroups"),y=l((k,D,H)=>I(k,new Map([[D,H]])),"crossingCountWithSingleReplacement"),A=l(k=>{const D=new Map;for(const H of k.pairs)D.set(H.first,(D.get(H.first)??0)+H.count),D.set(H.second,(D.get(H.second)??0)+H.count);return D},"currentCrossingsByEdge"),P=l(k=>k.slice(1).reduce((D,H,j)=>{const a=k[j];return D+Math.abs(H.x-a.x)+Math.abs(H.y-a.y)},0),"pathLength"),N=l((k=new Map)=>S.reduce((D,H)=>D+qt(m(H,k)),0),"totalBends"),R=l((k=new Map)=>S.reduce((D,H)=>D+P(m(H,k)),0),"totalLength"),_=l((k,D,H=new Map)=>{const j=it(D);for(const a of S)if(a!==k){for(const x of j)for(const C of it(m(a,H)))if(ne(x,C,.5)>=Ft)return!0}return!1},"pathHasSegmentConflict"),F=l((k,D)=>{const H=[k.start,k.end].filter(j=>!!j);for(const j of it(D))if(At(j.a,j.b,d,H,-2))return!0;return!1},"pathHitsNode"),Y=l((k,D)=>{const H=oe(mt(D));it(H).length===H.length-1&&k.push(H)},"pushOrthogonalCandidate"),Z=l(k=>k==="left"||k==="right","sideIsHorizontal"),et=l((k,D,H)=>{switch(D){case"left":return Math.min(k.x,H.x)-20;case"right":return Math.max(k.x,H.x)+20;case"top":return Math.min(k.y,H.y)-20;case"bottom":return Math.max(k.y,H.y)+20}},"localTrackForSameSide"),nt=l((k,D,H,j)=>{const a=H==="left"||H==="top"?-1:1,x=[et(D,H,j),h[H]];for(const C of x)for(let L=0;L<=2;L++)Y(k,Qn(D,H,j,C+a*20*L))},"addSameSideCandidates"),Mt=l((k,D,H,j,a)=>{for(const x of u(H))for(const C of u(a))Y(k,[D,{x,y:D.y},{x,y:C},{x:j.x,y:C},j])},"addHorizontalToVerticalCandidates"),yt=l((k,D,H,j,a)=>{for(const x of u(H))for(const C of u(a))Y(k,[D,{x:D.x,y:x},{x:C,y:x},{x:C,y:j.y},j])},"addVerticalToHorizontalCandidates"),Bt=l((k,D,H,j,a)=>{const x=[...u("top"),...u("bottom")];for(const C of u(H))for(const L of u(a))for(const E of x)Y(k,[D,{x:C,y:D.y},{x:C,y:E},{x:L,y:E},{x:L,y:j.y},j])},"addHorizontalPairCandidates"),rt=l((k,D,H,j,a)=>{const x=[...u("left"),...u("right")];for(const C of u(H))for(const L of u(a))for(const E of x)Y(k,[D,{x:D.x,y:C},{x:E,y:C},{x:E,y:L},{x:j.x,y:L},j])},"addVerticalPairCandidates"),K=l(k=>{const D=new Set;return k.map(H=>mt(H)).filter(H=>{const j=H.map(a=>`${a.x.toFixed(3)},${a.y.toFixed(3)}`).join("|");return D.has(j)||H.length<2?!1:(D.add(j),!0)})},"dedupeCandidatePaths"),Q=l((k,D,H,j)=>{const a=[],x=Jn(k,D,H,j,20,J);x&&Y(a,x),D===j&&nt(a,k,D,H);const C=Z(D),L=Z(j);return C&&!L?Mt(a,k,D,H,j):!C&&L?yt(a,k,D,H,j):C?Bt(a,k,D,H,j):rt(a,k,D,H,j),K(a)},"buildCandidatesForSides"),st=l((k,D,H,j)=>{const a=[...u("left"),...u("right")],x=[...u("top"),...u("bottom")];for(const C of g){const L=Me(j,C),E=C==="top"||C==="bottom"?u(C):x;for(const B of a){Y(k,[D,H,{x:B,y:H.y},{x:B,y:L.y},L]);for(const $ of E)Y(k,[D,H,{x:B,y:H.y},{x:B,y:$},{x:L.x,y:$},L])}}},"addVerticalDepartureOuterTrackCandidates"),at=l((k,D,H,j)=>{const a=[...u("left"),...u("right")],x=[...u("top"),...u("bottom")];for(const C of g){const L=Me(j,C),E=C==="left"||C==="right"?u(C):a;for(const B of x){Y(k,[D,H,{x:H.x,y:B},{x:L.x,y:B},L]);for(const $ of E)Y(k,[D,H,{x:H.x,y:B},{x:$,y:B},{x:$,y:L.y},L])}}},"addHorizontalDepartureOuterTrackCandidates"),bt=l(k=>{const D=k.start,H=k.end,j=H?f.get(H):void 0;if(!D||!j)return[];const a=mt(k.points??[]);if(a.length<4)return[];const x=a[0],C=a[1],L=[];return Et(x,C,J)?st(L,x,C,j):wt(x,C,J)&&at(L,x,C,j),L},"terminalPreservingOuterTrackCandidates"),It=l(k=>{const D=k.start,H=k.end,j=D?f.get(D):void 0,a=H?f.get(H):void 0;if(!j||!a)return[];const x=[];for(const C of g){const L=Me(j,C);for(const E of g)x.push(...Q(L,C,Me(a,E),E))}return x.push(...bt(k)),x},"candidatePathsFor"),Lt=l(()=>new Map(S.map(k=>[k,it(m(k))])),"currentSegmentsByEdge"),Ut=l((k,D,H)=>{const j=new Set;for(const a of S){if(a===k)continue;const x=H.get(a)??it(m(a));D.some(C=>x.some(L=>ne(C,L,.5)>=Ft))&&j.add(a)}return j},"sharedTrackConflictsFor"),Zt=l((k,D,H,j)=>{const a=new Set;return It(k).map(x=>oe(mt(x))).filter(x=>{if(F(k,x))return!1;const C=x.map(L=>`${L.x.toFixed(3)},${L.y.toFixed(3)}`).join("|");return a.has(C)||x.length<2?!1:(a.add(C),!0)}).map(x=>{const C=it(x);let L=0;for(const E of S)E!==k&&(L+=c(C,H.get(E)??it(m(E))));return{candidate:x,candidateSegments:C,crossings:D.count-(j.get(k)??0)+L,bends:qt(x,J),totalBends:qt(x),length:P(x)}}).filter(({crossings:x})=>x<=D.count).sort((x,C)=>x.crossings-C.crossings||x.bends-C.bends||x.length-C.length).slice(0,48).map(x=>({path:x.candidate,segments:x.candidateSegments,sharedTrackConflicts:Ut(k,x.candidateSegments,H),totalBends:x.totalBends,length:x.length}))},"pairCandidatesFor"),se=l((k,D,H,j,a,x)=>{let C=0;for(const E of k.pairs)(E.first===D||E.second===D||E.first===j||E.second===j)&&(C+=E.count);let L=c(H.segments,a.segments);for(const E of S){if(E===D||E===j)continue;const B=x.get(E)??it(m(E));L+=c(H.segments,B)+c(a.segments,B)}return k.count-C+L},"pairCrossingCount"),re=l((k,D)=>{for(const H of k.sharedTrackConflicts)if(H!==D)return!1;return!0},"conflictsOnlyWith"),Oe=l((k,D)=>k.segments.some(H=>D.segments.some(j=>ne(H,j,.5)>=Ft)),"candidatesShareTrack"),Ie=l((k,D,H,j)=>re(D,H.edge)&&re(j,k.edge)&&!Oe(D,j),"pairCandidatesAreCompatible"),Ae=l((k,D,H,j,a)=>{const x=se(k.current,D.edge,H,j.edge,a,k.baseSegments);if(!(x>=k.current.count))return{replacements:new Map([[D.edge,H.path],[j.edge,a.path]]),crossings:x,bends:k.currentBends-(k.baseBendsByEdge.get(D.edge)??0)-(k.baseBendsByEdge.get(j.edge)??0)+H.totalBends+a.totalBends,length:k.currentLength-(k.baseLengthByEdge.get(D.edge)??0)-(k.baseLengthByEdge.get(j.edge)??0)+H.length+a.length}},"scorePairReplacement"),on=l((k,D)=>k.crossings<D.crossings||k.crossings===D.crossings&&(k.bends<D.bends||k.bends===D.bends&&k.length<D.length),"pairScoreIsBetter"),sn=l((k,D,H,j)=>{let a=j;for(const x of D.candidates)for(const C of H.candidates){if(!Ie(D,x,H,C))continue;const L=Ae(k,D,x,H,C);L&&on(L,a)&&(a=L)}return a},"bestScoreForOptionPair"),rn=l(k=>{const D=N(),H=R(),j=Lt(),a=A(k),x=new Map(S.map(q=>[q,qt(m(q))])),C=new Map(S.map(q=>[q,P(m(q))])),L=new Map,E=p(k);for(const q of E)for(const G of q){if(L.has(G))continue;const X=Zt(G,k,j,a);X.length>0&&L.set(G,{edge:G,candidates:X})}let B={replacements:new Map,crossings:k.count,bends:D,length:H};const $={current:k,currentBends:D,currentLength:H,baseBendsByEdge:x,baseLengthByEdge:C,baseSegments:j};for(const q of E){const G=new Set(q.filter(W=>k.edgeSet.has(W))),X=q.map(W=>L.get(W)).filter(W=>!!W);for(let W=0;W<X.length;W++){const ft=X[W];for(let St=W+1;St<X.length;St++){const ot=X[St];!G.has(ft.edge)&&!G.has(ot.edge)||(B=sn($,ft,ot,B))}}}return B.replacements.size>0?B.replacements:void 0},"bestPairedReplacement");for(let k=0;k<4;k++){const D=w(),H=D.count;if(H===0)return;let j,a,x=H,C=Number.POSITIVE_INFINITY;for(const E of D.edges){const B=qt(m(E),J);for(const $ of It(E)){const q=F(E,$),G=!q&&_(E,$),X=y(D,E,$),W=qt($,J);q||G||(X<H||X===H&&W<B)&&(X>x||X===x&&W>=C||(j=E,a=$,x=X,C=W))}}if(j&&a){j.points=a;continue}const L=rn(D);if(!L)return;for(const[E,B]of L)E.points=B}}O(ts,"resolveRenderedOrthogonalCrossings");l(ts,"resolveRenderedOrthogonalCrossings");var ge=.001,fr=8;function es(t,e){const{nodeInfoById:n,realNodeRects:o}=Qe(e),s=["top","bottom","left","right"],r=20,i={top:Math.min(...o.map(c=>c.rect.top))-r,bottom:Math.max(...o.map(c=>c.rect.bottom))+r,left:Math.min(...o.map(c=>c.rect.left))-r,right:Math.max(...o.map(c=>c.rect.right))+r},f=l((c,b,w,I)=>{const T=[],v=Jn(c,b,w,I,r,ge);return v&&T.push(v),b===I&&T.push(Qn(c,b,w,i[b])),T},"buildOrthogonalPathCandidates"),d=l((c,b)=>{for(let w=0;w<c.length-1;w++){const I=c[w],T=c[w+1];if(At(I,T,o,b,1))return!0}return!1},"pathHitsNode"),g=l((c,b,w=!1)=>{let I=0;const T=Ee(c,ge),v=b.start,p=b.end;for(const y of t){if(y===b||y.isLayoutOnly)continue;const A=y.start,P=y.end;if(!w&&v&&p&&(A===v||A===p||P===v||P===p))continue;const N=y.points;if(!(!N||N.length<2))for(const R of T)for(const _ of Ee(N,ge)){if(eo(R.a,R.b,_.a,_.b,ge,ge)){I++;continue}ne(R,_,ge)>=fr&&I++}}return I},"pathConflictCount"),h=4,S=l((c,b)=>{const w=Math.abs(c.y-b.rect.top),I=Math.abs(c.y-b.rect.bottom),T=Math.abs(c.x-b.rect.left),v=Math.abs(c.x-b.rect.right);let p="top",y=w;return I<y&&(p="bottom",y=I),T<y&&(p="left",y=T),v<y&&(p="right",y=v),p},"nearestSideOfRect"),M=new Map,u=l((c,b,w)=>{const I=M.get(c)??[];I.push({side:b,edgeId:w}),M.set(c,I)},"addFaceClaim");for(const c of t){if(c.isLayoutOnly)continue;const b=c.points??[];if(b.length<1)continue;const w=c.id??"",I=c.start,T=c.end;if(I){const v=n.get(I);v&&u(I,S(b[0],v),w)}if(T){const v=n.get(T);v&&u(T,S(b[b.length-1],v),w)}}const m=l((c,b,w)=>M.get(c)?.some(I=>I.edgeId!==w&&I.side===b)??!1,"faceIsClaimed");for(const c of t){if(c.isLayoutOnly)continue;const b=c.points;if(!b||b.length<2)continue;const w=qt(b,ge);if(w<h)continue;const I=c.start,T=c.end;if(!I||!T)continue;const v=n.get(I),p=n.get(T);if(!v||!p)continue;const y=c.id??"",A=g(b,c,!0),P=g(b,c);let N,R=A,_=w;for(const F of s){if(m(I,F,y))continue;const Y=Me(v,F);for(const Z of s){if(m(T,Z,y))continue;const et=Me(p,Z);for(const nt of f(Y,F,et,Z)){if(d(nt,[I,T]))continue;const Mt=qt(nt,ge);if(A>0){const yt=g(nt,c,!0);if(yt>R||yt===R&&Mt>=_)continue;R=yt,_=Mt,N=nt;continue}g(nt,c)>P||Mt<_&&(_=Mt,N=nt)}}}if(N){c.points=N;const F=M.get(I);F&&M.set(I,F.filter(Z=>Z.edgeId!==y));const Y=M.get(T);Y&&M.set(T,Y.filter(Z=>Z.edgeId!==y)),u(I,S(N[0],v),y),u(T,S(N[N.length-1],p),y)}}}O(es,"simplifyDetouredEdges");l(es,"simplifyDetouredEdges");var Vt=.001,Io=10,He=7;function kn(t,e){const n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;const i=r.x-s.x,f=r.y-s.y;if(!(Math.abs(i)+Math.abs(f)<Vt)){if(Math.abs(f)<=Vt){const d=s.x+Math.sign(i)*Io;return{left:Math.min(s.x,d),right:Math.max(s.x,d),top:s.y-He,bottom:s.y+He}}if(Math.abs(i)<=Vt){const d=s.y+Math.sign(f)*Io;return{left:s.x-He,right:s.x+He,top:Math.min(s.y,d),bottom:Math.max(s.y,d)}}return{left:Math.min(s.x,r.x),right:Math.max(s.x,r.x),top:Math.min(s.y,r.y),bottom:Math.max(s.y,r.y)}}}O(kn,"markerClearanceRectFor");l(kn,"markerClearanceRectFor");function ns(t){return{left:Math.min(t.left,t.right),right:Math.max(t.left,t.right),top:Math.min(t.top,t.bottom),bottom:Math.max(t.top,t.bottom)}}O(ns,"normalizeRect");l(ns,"normalizeRect");function Bn(t,e){const n=mt(e);return[kn(n,!0),kn(n,!1)].some(o=>o&&ze(t,ns(o)))}O(Bn,"labelOverlapsOwnMarker");l(Bn,"labelOverlapsOwnMarker");function Ye(t,e){const n=[];for(const m of t){if(m.isLayoutOnly)continue;const c=m.points;if(!(!c||c.length<2))for(let b=0;b<c.length-1;b++)n.push({edgeId:m.id,p1:c[b],p2:c[b+1]})}const o=[],s=[];for(const m of e.values()){const c=m.isGroup,b=m.parentId;if(c&&!b){const I=jt(m);I&&s.push({id:m.id,rect:I});continue}if(c||m.isEdgeLabel)continue;const w=jt(m);w&&o.push({nodeId:m.id,rect:w})}const r=3,i=1,f=12,d=l((m,c)=>{const b=yn(c,r);for(const{nodeId:w,rect:I}of o)if(w!==m&&ze(b,I))return!0;return!1},"labelOverlapsForeignNode"),g=l((m,c)=>{const b=yn(c,r);for(const w of n)if(w.edgeId!==m&&Je(w.p1,w.p2,b))return!0;return!1},"labelOverlapsForeignEdge"),h=l((m,c,b)=>d(m,b)||g(c,b),"labelOverlapsAnything"),S=[],M=l(m=>{for(const{id:c,rect:b}of s)if(Ro(b,m))return c},"findContainingLane"),u=l((m,c)=>S.some(b=>b.labelId!==m&&ze(c,b.rect)),"overlapsPlacedLabel");for(const m of t){if(m.isLayoutOnly)continue;const c=m.labelNodeId;if(!c)continue;const b=e.get(c);if(!b)continue;const w=m.points;if(!w||w.length<2)continue;const I=b.width??0,T=b.height??0;if(I<=0||T<=0)continue;const v=[];for(let K=0;K<w.length-1;K++){const Q=w[K],st=w[K+1],at=Math.abs(Q.x-st.x),bt=Math.abs(Q.y-st.y);at<Vt&&bt<Vt||at>=Vt&&bt>=Vt||v.push({idx:K,length:at+bt,orientation:at>=Vt?"horizontal":"vertical",midX:(Q.x+st.x)/2,midY:(Q.y+st.y)/2})}if(v.length===0)continue;const p=v.length>=3?v.filter(K=>K.idx>0&&K.idx<v.length-1):v,y=p.length>0?p:v,A=I>=T?"horizontal":"vertical",P=l(K=>[...K].sort((Q,st)=>{const at=Q.orientation===A;if(at!==(st.orientation===A))return at?-1:1;const bt=Q.length>=(Q.orientation==="horizontal"?I:T)+2;return bt!==st.length>=(st.orientation==="horizontal"?I:T)+2?bt?-1:1:st.length-Q.length}),"rankSegments"),N=v[0],R=v[v.length-1],_=[.5,.25,.75,.05,.95,.15,.85,.1,.9],F=l((K,Q)=>{const st=w[K.idx],at=w[K.idx+1];return{midX:st.x+(at.x-st.x)*Q,midY:st.y+(at.y-st.y)*Q}},"anchorAtT"),Y=l((K,Q,st)=>Math.min(st,Math.max(Q,K)),"clamp"),Z=l((K,Q)=>K.midX>=Q.left-Vt&&K.midX<=Q.right+Vt&&K.midY>=Q.top-Vt&&K.midY<=Q.bottom+Vt,"pointInsideRectInclusive"),et=l(K=>{const Q=we(K.midX,K.midY,I,T),st=M(Q);if(st)return{laneId:st,anchor:K,rect:Q};const at=s.find(({rect:re})=>Z(K,re));if(!at)return;const bt=at.rect.left+I/2+i,It=at.rect.right-I/2-i,Lt=at.rect.top+T/2+i,Ut=at.rect.bottom-T/2-i;if(bt>It||Lt>Ut)return;const Zt={midX:Y(K.midX,bt,It),midY:Y(K.midY,Lt,Ut)},se=we(Zt.midX,Zt.midY,I,T);return Z(K,se)?{laneId:at.id,anchor:Zt,rect:se}:void 0},"placementForAnchor"),nt=l((K,Q,st)=>K.orientation==="horizontal"?Math.abs(Q.midX-st.x):Math.abs(Q.midY-st.y),"distanceAlongSegment"),Mt=l((K,Q)=>{const st=(K.orientation==="horizontal"?I/2:T/2)+f;if(K===N){const at=w[K.idx];if(nt(K,Q,at)+Vt<st)return!1}if(K===R){const at=w[K.idx+1];if(nt(K,Q,at)+Vt<st)return!1}return!0},"labelClearsTerminalEndpoints"),yt=l(K=>{const Q=P(K);for(const st of Q)for(const at of _){const bt=F(st,at);if(!Mt(st,bt))continue;const It=et(bt);if(It&&!Bn(It.rect,w)&&!u(c,It.rect)&&!h(c,m.id,It.rect))return{laneId:It.laneId,anchor:It.anchor}}},"tryPool"),Bt=l((K,Q,st=!1)=>{const at=P(K);for(const bt of at){const It={midX:bt.midX,midY:bt.midY};if(Q&&!Mt(bt,It))continue;const Lt=et(It);if(Lt&&!Bn(Lt.rect,w)&&!u(c,Lt.rect)&&!d(c,Lt.rect)&&(st||!g(m.id,Lt.rect)))return{laneId:Lt.laneId,anchor:Lt.anchor}}},"findLaneContainingFallback"),rt=yt(y)??(y.length<v.length?yt(v):void 0)??Bt(v,!0)??Bt(v,!1)??Bt(v,!1,!0);if(rt){b.x=rt.anchor.midX,b.y=rt.anchor.midY,b.parentId=rt.laneId;const K=we(rt.anchor.midX,rt.anchor.midY,I,T),Q=S.findIndex(st=>st.labelId===c);Q>=0?S[Q]={labelId:c,rect:K}:S.push({labelId:c,rect:K})}}}O(Ye,"anchorLabelsToPolyline");l(Ye,"anchorLabelsToPolyline");var gn=1e-6,So=4,lr=3;function Fn(t,e){return t<e?`${t}::${e}`:`${e}::${t}`}O(Fn,"pairKey");l(Fn,"pairKey");function os(t,e){const{nodeInfoById:n,realNodeRects:o}=Qe(e),s=new Map;for(const i of e){const f=i.id;if(!i.isGroup&&i.isEdgeLabel){s.set(f,{w:i.width??0,h:i.height??0});continue}}const r=l((i,f,d,g)=>{const h=Fn(f,d);let S=0;const M=l(u=>{if(!u)return;const m=s.get(u);if(!m)return;const c=g==="x"?m.w/2:m.h/2;c>S&&(S=c)},"consider");M(i.labelNodeId);for(const u of t){if(u===i||u.isLayoutOnly)continue;const m=u.start,c=u.end;!m||!c||Fn(m,c)===h&&M(u.labelNodeId)}return S>0?S+lr:0},"labelClearanceFor");for(const i of t){if(i.isLayoutOnly)continue;const f=i.points;if(!qn(f,gn))continue;const d=to(i,n,gn);if(!d)continue;const{srcId:g,dstId:h,srcInfo:S,dstInfo:M,collinearX:u,collinearY:m}=d;if(u===m)continue;let c,b;if(u){const v=M.cy>S.cy;c={x:S.cx,y:v?S.rect.bottom:S.rect.top},b={x:M.cx,y:v?M.rect.top:M.rect.bottom}}else{const v=M.cx>S.cx;c={x:v?S.rect.right:S.rect.left,y:S.cy},b={x:v?M.rect.left:M.rect.right,y:M.cy}}if(At(c,b,o,[g,h],1))continue;const w=r(i,g,h,u?"x":"y"),I=w>So?w:So,T=[0,I,-I];for(const v of T){const p={...c},y={...b};if(u){if(p.x+=v,y.x+=v,p.x<=S.rect.left||p.x>=S.rect.right||y.x<=M.rect.left||y.x>=M.rect.right)continue}else if(p.y+=v,y.y+=v,p.y<=S.rect.top||p.y>=S.rect.bottom||y.y<=M.rect.top||y.y>=M.rect.bottom)continue;if(!At(p,y,o,[g,h],1)&&!$e(p,y,t,i,{epsilon:gn})){i.points=[p,y];break}}}}O(os,"straightenCollinearSiblingDetours");l(os,"straightenCollinearSiblingDetours");function _n(t,e){const{realNodeRects:d,labelNodeRects:g}=me(e.values()),h=l((p,y)=>Ee(y,.001).map(A=>({...A,edge:p,interior:A.index>=1&&A.index<=y.length-3})),"segmentsFor"),S=l(()=>{const p=[];for(const y of t){if(y.isLayoutOnly)continue;const A=y.points;!A||A.length<2||p.push(...h(y,mt(A)))}return p},"allSegments"),M=l((p,y)=>p.horizontal&&y.horizontal?zt(p.a.x,p.b.x,y.a.x,y.b.x)>=8&&Math.abs(p.a.y-y.a.y)<7:p.vertical&&y.vertical?zt(p.a.y,p.b.y,y.a.y,y.b.y)>=8&&Math.abs(p.a.x-y.a.x)<7:!1,"hasCrowdedParallelTrack"),u=l((p,y)=>{const A=p.start,P=p.end,N=h(p,y);if(N.length!==y.length-1)return!1;const R=[A,P].filter(F=>!!F),_=p.labelNodeId?[p.labelNodeId]:[];for(const F of N)if(At(F.a,F.b,d,R,-2)||At(F.a,F.b,g,_,-2))return!1;for(const F of t){if(F===p||F.isLayoutOnly)continue;const Y=F.points;if(!(!Y||Y.length<2)){for(const Z of N)for(const et of h(F,mt(Y)))if(M(Z,et)||ce(Z.a,Z.b,et.a,et.b,.001))return!1}}return!0},"candidateIsSafe"),m=l((p,y)=>{const A=mt(p.edge.points??[]);if(A.length<4||p.index>=A.length-1)return;const P=A.map(N=>({...N}));if(p.horizontal)P[p.index].y+=y,P[p.index+1].y+=y;else if(p.vertical)P[p.index].x+=y,P[p.index+1].x+=y;else return;return h(p.edge,P).length===P.length-1?P:void 0},"shiftedCandidate"),c=l((p,y)=>({x:p.x??(y.left+y.right)/2,y:p.y??(y.top+y.bottom)/2}),"nodeCenter"),b=l(p=>{const y=p.edge,A=mt(y.points??[]);if(A.length!==4||p.index!==1)return;const P=y.start?e.get(y.start):void 0,N=y.end?e.get(y.end):void 0,R=P?jt(P):void 0,_=N?jt(N):void 0,F=A.slice(p.index+2);if(!(!P||!N||!R||!_||F.length===0))return{sourceCenter:c(P,R),targetCenter:c(N,_),sourceRect:R,tail:F}},"sourceDetourContextFor"),w=l((p,y,A,P,N,R)=>{const _=P.y>=A.y,F=_?N.bottom:N.top,Y=F+(_?20:-20);if(_&&p.b.y<=Y+.001||!_&&p.b.y>=Y-.001)return;const Z=p.a.x+y;return mt([{x:A.x,y:F},{x:A.x,y:Y},{x:Z,y:Y},{x:Z,y:p.b.y},...R],.001)},"verticalSourceDetour"),I=l((p,y,A,P,N,R)=>{const _=P.x>=A.x,F=_?N.right:N.left,Y=F+(_?20:-20);if(_&&p.b.x<=Y+.001||!_&&p.b.x>=Y-.001)return;const Z=p.a.y+y;return mt([{x:F,y:A.y},{x:Y,y:A.y},{x:Y,y:Z},{x:p.b.x,y:Z},...R],.001)},"horizontalSourceDetour"),T=l((p,y)=>{const A=b(p);if(A){if(p.vertical)return w(p,y,A.sourceCenter,A.targetCenter,A.sourceRect,A.tail);if(p.horizontal)return I(p,y,A.sourceCenter,A.targetCenter,A.sourceRect,A.tail)}},"sourceDetourCandidate"),v=[-7,7,-14,14,-21,21];for(let p=0;p<12;p++){const y=S();let A=!1;for(let P=0;P<y.length&&!A;P++)for(let N=P+1;N<y.length&&!A;N++){const R=y[P],_=y[N];if(R.edge===_.edge||!M(R,_))continue;const F=[R,_].filter(Y=>Y.interior);for(const Y of F){for(const Z of v){const et=m(Y,Z);if(et&&u(Y.edge,et)){Y.edge.points=et,A=!0;break}const nt=T(Y,Z);if(nt&&u(Y.edge,nt)){Y.edge.points=nt,A=!0;break}}if(A)break}}if(!A)return}}O(_n,"nudgeSharedInteriorSubpaths");l(_n,"nudgeSharedInteriorSubpaths");function ss(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,i=o.x-n.x,f=o.y-n.y,d=s*f-r*i;if(Math.abs(d)<1e-10)return!1;const g=n.x-t.x,h=n.y-t.y,S=(g*f-h*i)/d,M=(g*r-h*s)/d,u=.01;return S>u&&S<.99&&M>u&&M<.99}O(ss,"segmentsIntersect");l(ss,"segmentsIntersect");function rs(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const s=No(e),r=[];for(const f of n){if(f.isLayoutOnly)continue;const d=f.points;if(!d||d.length<2)continue;const g=f.start,h=f.end,S=f.labelNodeId,M=f.id??`${g}->${h}`;for(const u of s)if(!(u.nodeId===g||u.nodeId===h)&&!(S&&u.nodeId===S)){for(let m=0;m<d.length-1;m++)if(Je(d[m],d[m+1],u,-1)){o.push({type:"edge-node-overlap",edgeId:M,targetId:u.nodeId,detail:`segment ${m} passes through node "${u.nodeId}"`});break}}for(let u=0;u<d.length-1;u++)r.push({edgeId:M,start:g,end:h,p1:d[u],p2:d[u+1]})}const i=new Set;for(let f=0;f<r.length;f++)for(let d=f+1;d<r.length;d++){const g=r[f],h=r[d];if(g.edgeId!==h.edgeId&&!(g.start===h.start||g.start===h.end||g.end===h.start||g.end===h.end)&&ss(g.p1,g.p2,h.p1,h.p2)){const S=g.edgeId<h.edgeId?`${g.edgeId}|${h.edgeId}`:`${h.edgeId}|${g.edgeId}`;i.has(S)||(i.add(S),o.push({type:"edge-edge-crossing",edgeId:g.edgeId,targetId:h.edgeId,detail:`edges "${g.edgeId}" and "${h.edgeId}" cross`}))}}if(o.length>0){const f=o.filter(g=>g.type==="edge-node-overlap").length,d=o.filter(g=>g.type==="edge-edge-crossing").length;pn.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${f} edge-node overlap(s), ${d} edge crossing(s)`);for(const g of o)pn.warn(`[SWIMLANE_VALIDATE] ${g.type}: ${g.detail}`)}return o}O(rs,"validateSwimlanesLayout");l(rs,"validateSwimlanesLayout");function is(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(f=>!f.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!jo(t,e)||e==="BT"&&s.length>0&&!Vo(t))return;for(const f of o){if(f.isLayoutOnly)continue;const d=f.points;!d||d.length<2||(f.points=oe(Ve(d)))}es(o,n),os(o,n),Uo(o,n);const r=new Map;for(const f of n)r.set(String(f.id),f);Ye(o,r),Fo(o,r),Wo(o,r),_n(o,r),Ko(o,r),qo(o,r),Nn(o,r),Zo(o,r);const i=l(()=>{ts(o,r),Jo(o,r),Qo(o,r),Ye(o,r),An(o,r),Nn(o,r),Ye(o,r),An(o,r)},"finalizeRenderedEdges");i(),_n(o,r),i(),On(o,r),Pn(o,r),On(o,r),Pn(o,r)}O(is,"postProcessSwimlaneLayout");l(is,"postProcessSwimlaneLayout");function pe(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const s of t.edges){if(!e.has(s.src)||!e.has(s.dst))continue;const r=`${s.id}:${s.src}->${s.dst}`;n.has(r)||(n.add(r),o.push(s))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}O(pe,"normalizeGraph");l(pe,"normalizeGraph");function io(t,e){return t.edges.filter(n=>n.dst===e)}O(io,"incoming");l(io,"incoming");function cs(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}O(cs,"buildSuccessorMap");l(cs,"buildSuccessorMap");function co(t){const e=cs(t);for(const n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}O(co,"buildSortedSuccessorMap");l(co,"buildSortedSuccessorMap");function tn(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}O(tn,"buildInDegreeMap");l(tn,"buildInDegreeMap");function ao(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}O(ao,"sortedZeroInDegreeNodes");l(ao,"sortedZeroInDegreeNodes");function en(t,e=()=>!0){const n=new Map,o=new Map;for(const s of t.nodes)n.set(s,[]),o.set(s,[]);for(const s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}O(en,"buildPredecessorSuccessorMaps");l(en,"buildPredecessorSuccessorMaps");function fo(t,e,n,o){let s=0;for(const i of t.nodes)o?.skipGroups&&t.nodeById.get(i)?.isGroup||(s=Math.max(s,n[i]??0));const r=Array.from({length:s+1},()=>[]);for(const i of e)o?.skipGroups&&t.nodeById.get(i)?.isGroup||r[Math.max(0,n[i]??0)].push(i);return r}O(fo,"buildLayersFromRanks");l(fo,"buildLayersFromRanks");function Ne(t){const e=tn(t),n=ao(e),o=[],s=co(t);for(;n.length;){const r=n.shift();o.push(r);for(const i of s.get(r)??[])if(e.set(i,(e.get(i)??0)-1),(e.get(i)??0)===0){let f=0;for(;f<n.length&&n[f]<i;)f++;n.splice(f,0,i)}}return o.length===t.nodes.length?o:null}O(Ne,"topoSortIfAcyclic");l(Ne,"topoSortIfAcyclic");function Te(t){const e=new Map;let n=0;for(const o of t)e.set(o,n),n++;return e}O(Te,"buildLayerIndex");l(Te,"buildLayerIndex");function lo(t){const e=new Array(t.length),n=l((o,s)=>{if(s-o<=1)return 0;const r=o+s>>1;let i=n(o,r)+n(r,s),f=o,d=r,g=o;for(;f<r||d<s;)d>=s||f<r&&t[f]<=t[d]?e[g++]=t[f++]:(e[g++]=t[d++],i+=r-f);for(let h=o;h<s;h++)t[h]=e[h];return i},"count");return n(0,t.length)}O(lo,"countInversions");l(lo,"countInversions");function as(t){const e=pe(t),n=new Map;for(const h of e.nodes)n.set(h,[]);for(const h of e.edges)n.get(h.src).push(h);for(const h of n.values())h.sort((S,M)=>S.dst===M.dst?S.id.localeCompare(M.id):S.dst.localeCompare(M.dst));const o=Object.create(null);for(const h of e.nodes)o[h]=0;const s=[],r=l(h=>{o[h]=1;for(const S of n.get(h)??[]){const M=S.dst;o[M]===0?r(M):o[M]===1&&s.push(S)}o[h]=2},"dfs"),i=tn(e),f=[...e.nodes.filter(h=>(i.get(h)??0)===0),...e.nodes.filter(h=>(i.get(h)??0)!==0)];for(const h of f)o[h]===0&&r(h);const d=new Set(s.map(h=>`${h.id}:${h.src}->${h.dst}`)),g=e.edges.map(h=>d.has(`${h.id}:${h.src}->${h.dst}`)?{id:h.id,src:h.dst,dst:h.src,weight:h.weight,ref:h.ref}:h);return{acyclic:{nodes:[...e.nodes],edges:g,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}O(as,"removeCycles_DFS");l(as,"removeCycles_DFS");function fs(t){const e=new Map,n=l(o=>{if(e.has(o))return e.get(o);const s=t.nodeById.get(o);if(!s)return e.set(o,null),null;const r=s.parentId;if(!r)return e.set(o,null),null;const i=n(r)??r;return e.set(o,i),i},"resolve");for(const o of t.nodes)n(o);return e}O(fs,"buildTopLaneMap");l(fs,"buildTopLaneMap");function ae(t){const e=fs(t);return n=>e.get(n)??null}O(ae,"createTopLaneResolver");l(ae,"createTopLaneResolver");function nn(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}O(nn,"buildTopLaneOrder");l(nn,"buildTopLaneOrder");function uo(t,e){const n=nn(t);if(!e||e.length===0)return n;const o=new Set(n),s=new Set,r=[];for(const i of e)!o.has(i)||s.has(i)||(s.add(i),r.push(i));for(const i of n)s.has(i)||r.push(i);return r}O(uo,"resolveTopLaneOrder");l(uo,"resolveTopLaneOrder");var dr={EPSILON:1e-6},qe={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},Co={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function ls(t,e){const n=pe(t),o=e?.laneOf??(()=>null),s=e?.rankHint,{preds:r}=en(n);for(const p of r.values())p.sort((y,A)=>y.localeCompare(A));const i=Ne(n)??[...n.nodes].sort((p,y)=>p.localeCompare(y)),f=new Map;for(const[p,y]of i.entries())f.set(y,p);const d=new Map,g=new Map;for(const p of n.nodes)g.set(p,[]);for(const p of i){const y=(r.get(p)??[]).filter(A=>d.has(A));if(y.length>0){const A=ds(p,y,{laneOf:o,rankHint:s,topoIndex:f});d.set(p,A),g.get(A).push(p)}else d.has(p)||d.set(p,null)}for(const p of n.nodes)d.has(p)||d.set(p,null);const h=new Set;for(const p of n.nodes)(d.get(p)??null)===null&&h.add(p);const S=[...h].sort((p,y)=>{const A=f.get(p)??0,P=f.get(y)??0;return A===P?p.localeCompare(y):A-P}),M=us(n),u=new Map;for(const[p,y]of M.entries())u.set(p,[...y].sort((A,P)=>A.localeCompare(P)));const m=hs(u),c=gs(u),b=new Map;for(const p of n.nodes)b.set(p,[]);for(const p of c)for(const y of p.nodes){const A=b.get(y);A?A.push(p.id):b.set(y,[p.id])}const w=[],I=[],T=new Set,v=l(p=>{if(!T.has(p)){T.add(p),w.push(p);for(const y of g.get(p)??[])v(y);I.push(p)}},"walk");for(const p of S)v(p);for(const p of i)v(p);return{parent:d,children:g,roots:S,componentOf:m,blocks:c,nodeBlocks:b,adjacency:u,preorder:w,postorder:I,topologicalOrder:i}}O(ls,"buildDrivingTree");l(ls,"buildDrivingTree");function ds(t,e,n){const o=n.laneOf(t);return[...e].sort((s,r)=>{const i=n.laneOf(s),f=n.laneOf(r),d=i!=null&&i===o;if(d!==(f!=null&&f===o))return d?-1:1;const g=n.rankHint?.[s],h=n.rankHint?.[r];if(g!=null&&h!=null&&g!==h)return h-g;const S=n.topoIndex.get(s)??0,M=n.topoIndex.get(r)??0;return S!==M?S-M:s.localeCompare(r)})[0]}O(ds,"chooseParent");l(ds,"chooseParent");function us(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}O(us,"buildAdjacency");l(us,"buildAdjacency");function hs(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const s=[o];for(;s.length>0;){const r=s.pop();if(!e.has(r)){e.set(r,n);for(const i of t.get(r)??[])e.has(i)||s.push(i)}}n++}return e}O(hs,"assignComponents");l(hs,"assignComponents");function gs(t){const e=new Map,n=new Map,o=[],s=[];let r=0;const i=l((f,d)=>{e.set(f,++r),n.set(f,r);for(const g of t.get(f)??[])g!==d&&(e.has(g)?(e.get(g)??0)<(e.get(f)??0)&&(o.push([f,g]),n.set(f,Math.min(n.get(f)??r,e.get(g)??r))):(o.push([f,g]),i(g,f),n.set(f,Math.min(n.get(f)??r,n.get(g)??r)),(n.get(g)??0)>=(e.get(f)??0)&&s.push(ms(f,g,o,s.length))))},"visit");for(const f of t.keys())e.has(f)||i(f,null);return s}O(gs,"computeBlocks");l(gs,"computeBlocks");function ms(t,e,n,o){const s=[],r=new Set;for(;n.length>0;){const i=n.pop();if(s.push(i),r.add(i[0]),r.add(i[1]),i[0]===t&&i[1]===e||i[0]===e&&i[1]===t)break}return{id:o,edges:s,nodes:[...r]}}O(ms,"popBlock");l(ms,"popBlock");function ps(t,e,n){const o=[...t.nodes],s=new Map;for(const[I,T]of o.entries())s.set(T,I);const r=o.length,i=new Array(r).fill(-1),f=new Array(r).fill(0),d=[],g=new Set;for(const I of o){const T=n.parent.get(I)??null,v=s.get(I);v!=null&&T==null&&(i[v]=-1,f[v]=0,g.has(I)||(g.add(I),d.push(I)))}for(;d.length>0;){const I=d.shift(),T=s.get(I);if(T==null)continue;const v=n.children.get(I)??[];for(const p of v){if(g.has(p))continue;const y=s.get(p);y!=null&&(i[y]=T,f[y]=f[T]+1,g.add(p),d.push(p))}}for(const I of o){if(g.has(I))continue;const T=s.get(I);T!=null&&(i[T]=-1,f[T]=0,g.add(I))}const h=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),S=Array.from({length:h},()=>new Array(r).fill(-1));for(let I=0;I<r;I++)S[0][I]=i[I];for(let I=1;I<h;I++)for(let T=0;T<r;T++){const v=S[I-1][T];S[I][T]=v===-1?-1:S[I-1][v]}const M=l((I,T)=>{if(I===-1||T===-1)return-1;f[I]<f[T]&&([I,T]=[T,I]);const v=f[I]-f[T];for(let p=0;p<h;p++)if(v>>p&1&&(I=S[p][I],I===-1))return-1;if(I===T)return I;for(let p=h-1;p>=0;p--){const y=S[p][I],A=S[p][T];y===-1||A===-1||y!==A&&(I=y,T=A)}return S[0][I]},"lcaIndex"),u=Array.from({length:r},()=>new Map);for(const I of t.edges){let T=I.src,v=I.dst,p=e[T],y=e[v];if(p==null||y==null||(p>y&&([T,v]=[v,T],[p,y]=[y,p]),p==null||y==null||p===y))continue;const A=s.get(T),P=s.get(v);if(A==null||P==null)continue;const N=M(A,P);if(N===-1)continue;const R=u[N];for(let _=p;_<y;_++)R.set(_,(R.get(_)??0)+1)}const m=new Map,c=l((I,T)=>{if(T.size!==0)for(const[v,p]of T)I.set(v,(I.get(v)??0)+p)},"mergeInto"),b=new Set,w=l(I=>{const T=s.get(I);b.add(I);const v=T==null?void 0:u[T],p=v?new Map(v):new Map,y=n.children.get(I)??[];for(const A of y){const P=w(A),N=e[I];if(N!=null){let R=m.get(I);R||(R=new Map,m.set(I,R));let _=P.get(N)??0;const F=e[A];F!=null&&F>N&&(_+=1),R.set(A,_)}c(p,P)}return p},"dfs");for(const I of n.roots)b.has(I)||w(I);for(const I of o)b.has(I)||w(I);return m}O(ps,"computeSubtreeCrossCounts");l(ps,"computeSubtreeCrossCounts");function xs(t,e,n){const o=new Map,s=l(r=>{let i=n[r]??0;const f=[...e.get(r)??[]];f.sort(ho(n));for(const d of f){s(d);const g=o.get(d);g!=null&&(i=Math.min(i,g))}o.set(r,i)},"annotate");for(const r of t)s(r);return o}O(xs,"annotateMinimumLayers");l(xs,"annotateMinimumLayers");function ho(t){return(e,n)=>{const o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}O(ho,"compareByRankThenId");l(ho,"compareByRankThenId");function ys(t,e,n,o){let s=0;for(const d of e){const g=n[d]??0;g>s&&(s=g)}const r=Array.from({length:s+1},()=>[]),i=new Set,f=l(d=>{if(i.has(d))return;i.add(d);const g=n[d]??0;r[g]||(r[g]=[]),r[g].push(d);for(const h of o(d))f(h)},"emit");for(const d of t)f(d);for(const d of e)if(!i.has(d)){const g=n[d]??0;r[g]||(r[g]=[]),r[g].push(d),i.add(d)}return r}O(ys,"emitNodesInTreeOrder");l(ys,"emitNodesInTreeOrder");function bs(t){const e=[];for(const n of t){const o=new Set,s=[];for(const r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}O(bs,"deduplicateLayers");l(bs,"deduplicateLayers");function Ms(t,e,n,o){return s=>{const r=t.get(s)??[];if(r.length===0)return[];const i=e[s]??0,f=[],d=[],g=n.get(s);for(const h of r){const S=o.get(h)??i;S>i?f.push({child:h,min:S}):d.push(h)}return f.sort((h,S)=>h.min===S.min?h.child.localeCompare(S.child):h.min-S.min),d.sort((h,S)=>{const M=g?.get(h)??0,u=g?.get(S)??0;if(M!==u)return M-u;const m=o.get(h)??i,c=o.get(S)??i;return m!==c?m-c:h.localeCompare(S)}),[...f.map(h=>h.child),...d]}}O(Ms,"createChildOrderer");l(Ms,"createChildOrderer");function Ze(t,e,n){const o=ls(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(const h of t.nodes)s.has(h)||s.set(h,[]);const i=ps(t,e,o),f=[...r].sort(ho(e)),d=Ms(s,e,i,xs(f,s,e));let g=ys(f,t.nodes,e,d);return g=bs(g),g}O(Ze,"buildMultitreeLayerOrder");l(Ze,"buildMultitreeLayerOrder");function Is(t,e,n){const o=new Set(t),s=new Set(e),r=Te(e),i=[];for(const f of n)o.has(f.src)&&s.has(f.dst)&&i.push(r.get(f.dst));return lo(i)}O(Is,"countCrossingsBetweenAdjacent");l(Is,"countCrossingsBetweenAdjacent");function Dn(t,e,n){const o=[];for(const r of e){const i=n[r.src],f=n[r.dst];if(i==null||f==null||i===f)continue;let d=r.src,g=r.dst,h=i,S=f;i>f&&(d=r.dst,g=r.src,h=f,S=i);for(let M=h;M<S;M++)o.push({id:`${r.id}@${M}`,src:d,dst:g,ref:r.ref})}let s=0;for(let r=0;r+1<t.length;r++)s+=Is(t[r],t[r+1],o);return s}O(Dn,"totalCrossings");l(Dn,"totalCrossings");function Ss(t,e){const n={...e},{preds:o}=en(t),s=ae(t);let r=Dn(Ze(t,n,s),t.edges,n);const i=qe.MAX_CROSSING_OPTIMIZATION_PASSES;for(let f=0;f<i;f++){let d=!1;const g=[...t.nodes].sort((h,S)=>(n[S]??0)-(n[h]??0));for(const h of g){const S=n[h]??0;if(S===0)continue;let M=0;for(const c of o.get(h)??[])M=Math.max(M,(n[c]??0)+1);if(M>=S)continue;const u=S;n[h]=M;const m=Dn(Ze(t,n,s),t.edges,n);m<r?(r=m,d=!0):n[h]=u}if(!d)break}return n}O(Ss,"optimizeRanksByCrossings");l(Ss,"optimizeRanksByCrossings");function Cs(t,e){const n=ae(t),o=[...t.nodes].sort((s,r)=>(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(const s of o){const r=n(s);if(!r)continue;const i=t.edges.filter(c=>c.src===s);if(i.length===0)continue;let f=!1,d=0;for(const c of i){const b=n(c.dst);b==null||b===r?f=!0:d++}if(d===0||f)continue;let g=0,h=!1;for(const c of t.edges){if(c.dst!==s)continue;const b=n(c.src);b&&(b===r?h=!0:g++)}if(g>0||!h)continue;const S=e[s]??0,M=S+d;let u=0;for(const c of t.edges)c.dst===s&&(u=Math.max(u,(e[c.src]??0)+1));const m=Math.max(S,u,M);m!==S&&(e[s]=m)}}O(Cs,"adjustCrossLaneSources");l(Cs,"adjustCrossLaneSources");function Ls(t,e){const n=pe(t),o=Ne(n)??[...n.nodes].sort(),s=e?.compactSingleInput??!1,r=ae(n);let i=Object.create(null);for(const f of o){const d=io(n,f),g=e?.ignoreCrossLaneEdges?d.filter(h=>{const S=r(h.src),M=r(f);return!S||!M?!0:S===M}):d;if(g.length===0)i[f]=0;else if(s&&g.length===1){const h=g[0].src;r(h)!==r(f)?i[f]=i[h]??0:i[f]=(i[h]??0)+1}else{let h=-1/0;for(const S of g)h=Math.max(h,(i[S.src]??0)+1);i[f]=h===-1/0?0:h}}return(e?.optimizeRanksByCrossings??!1)&&(i=Ss(n,i)),e?.ignoreCrossLaneEdges&&Cs(n,i),{layers:Ze(n,i,r),rankOf:i,dummy:new Set}}O(Ls,"assignLayers_LongestPath");l(Ls,"assignLayers_LongestPath");function vs(t,e){const n=pe(t),o={...Ls(n,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}).rankOf},s=ae(n),{preds:r,succs:i}=en(n,M=>{if(e?.ignoreCrossLaneEdges){const u=s(M.src),m=s(M.dst);if(u&&m&&u!==m)return!1}return!0}),f=Ne(n)??[...n.nodes],d=[...f].reverse(),g=l((M,u)=>{let m=0;for(const w of r.get(M)??[])m=Math.max(m,(o[w]??0)+1);let c=Number.POSITIVE_INFINITY;const b=i.get(M)??[];return b.length>0&&(c=Math.min(...b.map(w=>(o[w]??0)-1))),Number.isFinite(c)||(c=Math.max(m,u)),Math.min(Math.max(u,m),c)},"clampFeasible"),h=qe.GRAVITY_ITERATIONS,S=l(M=>{let u=!1;for(const m of M){const c=r.get(m)??[],b=i.get(m)??[];if(c.length===0&&b.length===0)continue;const w=c.length>0?c.reduce((p,y)=>p+(o[y]??0)+1,0)/c.length:o[m]??0,I=b.length>0?b.reduce((p,y)=>p+(o[y]??0)-1,0)/b.length:o[m]??0,T=Math.round((w+I)/2),v=g(m,T);v!==o[m]&&(o[m]=v,u=!0)}return u},"relaxOrder");for(let M=0;M<h;M++){const u=S(f),m=S(d);if(!u&&!m)break}for(const M of f){let u=0;for(const m of r.get(M)??[])u=Math.max(u,(o[m]??0)+1);(o[M]??0)<u&&(o[M]=u)}for(const M of d){const u=i.get(M)??[];if(u.length>0){const m=Math.min(...u.map(c=>(o[c]??0)-1));(o[M]??0)>m&&(o[M]=m)}}return{layers:fo(n,f,o),rankOf:o,dummy:new Set}}O(vs,"assignLayers_Gravity");l(vs,"assignLayers_Gravity");function ws(t){const e=tn(t),n=co(t);let o=ao(e);const s=[];for(;o.length>0;){const r=[];for(const i of o){s.push(i);for(const f of n.get(i)??[])e.set(f,(e.get(f)??0)-1),(e.get(f)??0)===0&&r.push(f)}o=r.sort((i,f)=>i.localeCompare(f))}return s.length===t.nodes.length?s:null}O(ws,"topoSortByGenerationIfAcyclic");l(ws,"topoSortByGenerationIfAcyclic");function Es(t,e){const n=pe(t),o=e?.direction==="LR"?ws(n)??[...n.nodes].sort():Ne(n)??[...n.nodes].sort(),s=ae(n),r=l(g=>s(g)??g,"laneOf"),i=Object.create(null),f=new Map,d=l((g,h)=>e?.ignoreCrossLaneEdges??!0?r(g)===r(h)?1:0:1,"edgeWeight");for(const g of o){if(n.nodeById.get(g)?.isGroup)continue;const h=io(n,g);let S=0;if(h.length>0)for(const c of h){const b=c.src,w=i[b]??0;S=Math.max(S,w+d(b,g))}const M=r(g),u=f.get(M)??0,m=Math.max(S,u);i[g]=m,f.set(M,m+1)}return{layers:fo(n,o,i,{skipGroups:!0}),rankOf:i,dummy:new Set}}O(Es,"assignLayers_LaneAwareCompact");l(Es,"assignLayers_LaneAwareCompact");function Ts(t,e){const n=pe(e),{rankOf:o}=t,s=t.layers.map(M=>[...M]),r=new Set(t.dummy?[...t.dummy]:[]);let i=0;const f=new Map(n.nodeById),d=l(M=>{const u=`placeholder-${i++}`,m={id:u,isGroup:!1,isDummy:!0,width:0,height:0};for(f.set(u,m),r.add(u);s.length<=M;)s.push([]);return s[M].push(u),o[u]=M,u},"addDummyAt"),g=[...n.edges].sort((M,u)=>M.id===u.id?M.src===u.src?M.dst.localeCompare(u.dst):M.src.localeCompare(u.src):M.id.localeCompare(u.id)),h=[];for(const M of g){const u=o[M.src]??0,m=o[M.dst]??0;if(m-u<=1){h.push(M);continue}let c=M.src;for(let w=u+1,I=0;w<m;w++,I++){const T=d(w);h.push({id:`${M.id}#${I}`,src:c,dst:T,weight:M.weight,ref:M.ref}),c=T}const b=m-u-2;h.push({id:`${M.id}#${Math.max(b+1,0)}`,src:c,dst:M.dst,weight:M.weight,ref:M.ref})}const S={nodes:[...n.nodes,...[...r].filter(M=>!n.nodes.includes(M))],edges:h,layout:n.layout,nodeById:f};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:S}}O(Ts,"makeProperLayering");l(Ts,"makeProperLayering");function Hn(t){const e=t.length;if(e===0)return Number.POSITIVE_INFINITY;const n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}O(Hn,"median");l(Hn,"median");function Xn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((e,n)=>e+n,0)/t.length}O(Xn,"barycenter");l(Xn,"barycenter");function As(t,e,n,o){const s=new Map;for(const r of t)s.set(r,[]);for(const r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}O(As,"neighborPositionsFor");l(As,"neighborPositionsFor");function Rs(t,e,n){const o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}O(Rs,"currentOrderTieBreak");l(Rs,"currentOrderTieBreak");function Yn(t,e,n){const o=new Set(t),s=new Set(e),r=Te(t),i=Te(e),f=[];for(const d of n)o.has(d.src)&&s.has(d.dst)&&f.push({u:r.get(d.src),v:i.get(d.dst)});return f.sort((d,g)=>d.u===g.u?d.v-g.v:d.u-g.u),lo(f.map(d=>d.v))}O(Yn,"countCrossingsBetweenAdjacent2");l(Yn,"countCrossingsBetweenAdjacent");function Ge(t,e,n){return[...t].sort((o,s)=>{const r=Hn(e.get(o)??[]),i=Hn(e.get(s)??[]);return r===i?Rs(o,s,n):isFinite(r)?isFinite(i)?r-i:-1:1})}O(Ge,"sortByHeuristic");l(Ge,"sortByHeuristic");function Gn(t,e,n,o,s,r){const i=Te(t),f=Te(e),d=As(e,i,n,o);if(!s||!r||r.length===0)return Ge(e,d,f);const g=new Map;for(const M of e){const u=s(M),m=g.get(u)??[];m.push(M),g.set(u,m)}const h=[];for(const M of r){const u=g.get(M);if(!u||u.length===0)continue;const m=Ge(u,d,f);h.push(...m)}const S=g.get(null);if(S&&S.length>0){const M=Ge(S,d,f);for(const u of M){const m=Xn(d.get(u)??[]);let c=h.length;if(isFinite(m)){for(const[b,w]of h.entries())if(m<Xn(d.get(w)??[])){c=b;break}}h.splice(c,0,u)}}return h}O(Gn,"reorderLayer");l(Gn,"reorderLayer");function zn(t,e,n,o,s){const r=[...e],i=new Set(t),f=new Set(e),d=o?new Set(o):null,g=n.filter(c=>i.has(c.src)&&f.has(c.dst)),h=d?n.filter(c=>f.has(c.src)&&d.has(c.dst)):void 0,S=l(c=>{let b=Yn(t,c,g);return h&&o&&(b+=Yn(c,o,h)),b},"crossingScore"),M=s?new Map:null;if(s&&M)for(const c of e)M.set(c,s(c));let u=!0,m=S(r);for(;u;){u=!1;for(let c=0;c+1<r.length;c++){if(M&&M.get(r[c])!==M.get(r[c+1]))continue;const b=m;[r[c],r[c+1]]=[r[c+1],r[c]];const w=S(r);w<b?(m=w,u=!0):[r[c],r[c+1]]=[r[c+1],r[c]]}}return r}O(zn,"transposeImprove");l(zn,"transposeImprove");function Ns(t,e,n){const o=t.layers.map(f=>[...f]),s=e.edges,r=ae(e),i=uo(e,n?.laneOrder);for(let f=0;f<3;f++){for(let d=1;d<o.length;d++)o[d]=Gn(o[d-1],o[d],s,"down",r,i),o[d]=zn(o[d-1],o[d],s,o[d+1],r);for(let d=o.length-2;d>=0;d--)o[d]=Gn(o[d+1],o[d],s,"up",r,i),o[d]=zn(o[d+1],o[d],s,o[d-1],r)}return{layers:o}}O(Ns,"orderLayers");l(Ns,"orderLayers");function Os(t,e,n){const o=n?.layerGap??Co.DEFAULT_LAYER_GAP,s=n?.nodeGap??Co.DEFAULT_NODE_GAP,r=n?.laneGap??s*2,i=n?.direction??"TB",f=i==="LR"||i==="RL",d=t.layers,g=Object.create(null),h=Object.create(null),S=l(R=>e.nodeById.get(R),"getNode"),M=l(R=>S(R)?.width??0,"getWidth"),u=l(R=>S(R)?.height??0,"getHeight"),m=ae(e),c=uo(e,n?.laneOrder),b=d.map(R=>R.reduce((_,F)=>Math.max(_,u(F)),0)),w=[];if(f)for(let R=0;R+1<d.length;R++){const _=d[R].reduce((yt,Bt)=>Math.max(yt,M(Bt)),0),F=d[R+1].reduce((yt,Bt)=>Math.max(yt,M(Bt)),0),Y=b[R],Z=b[R+1],et=Y/2+Z/2,nt=(_+F)/2,Mt=Math.max(0,nt-et-o);w.push(Mt)}const I=new Set;for(const R of d)for(const _ of R)I.add(m(_));const T=I.has(null),v=c.filter(R=>I.has(R)),p=[...T?[null]:[],...v],y=Object.create(null);for(const R of v)y[R]=0;T&&(y.null=0);for(const R of d){const _=Object.create(null),F=[];for(const Y of R){const Z=m(Y);Z===null?F.push(Y):(_[Z]||=[]).push(Y)}for(const[Y,Z]of Object.entries(_)){const et=Z.reduce((nt,Mt)=>nt+M(Mt),0)+s*Math.max(0,Z.length-1);y[Y]=Math.max(y[Y]??0,et)}if(T&&F.length){const Y=F.reduce((Z,et)=>Z+M(et),0)+s*Math.max(0,F.length-1);y.null=Math.max(y.null??0,Y)}}const A=new Map;{const R=p.map(F=>(F===null?y.null:y[F])??0);let _=-(R.reduce((F,Y)=>F+Y,0)+r*Math.max(0,p.length-1))/2;for(let F=0;F<p.length;F++){const Y=p[F],Z=R[F]??0,et=_+Z/2;A.set(Y,et),_+=Z,F<p.length-1&&(_+=r)}}let P=0;for(const[R,_]of d.entries()){const F=b[R]??0,Y=new Map;for(const et of _){const nt=m(et),Mt=Y.get(nt)??[];Mt.push(et),Y.set(nt,Mt)}for(const et of p){const nt=Y.get(et)??[];if(nt.length===0)continue;const Mt=A.get(et);if(nt.length===1){const yt=nt[0];g[yt]=Mt,h[yt]=P+F/2}else{const yt=nt.map(rt=>M(rt));let Bt=Mt-(yt.reduce((rt,K)=>rt+K,0)+s*(nt.length-1))/2;for(const[rt,K]of nt.entries()){const Q=yt[rt];g[K]=Bt+Q/2,h[K]=P+F/2,Bt+=Q+s}}}const Z=w[R]??0;P+=F+o+Z}const N=new Map;for(const R of e.edges){const _=R.ref.id;N.has(_)||N.set(_,[]),N.get(_).push(R)}for(const[,R]of N){if(R.length===0)continue;const _=R[0].ref,F=_.start,Y=_.end;if(F==null||Y==null)continue;const Z=Math.round(((g[F]??0)+(g[Y]??0))/2),et=new Set;for(const nt of R)et.add(nt.src),et.add(nt.dst);for(const nt of et)nt===F||nt===Y||e.nodeById.get(nt)?.isDummy&&(g[nt]=Z)}return{x:g,y:h}}O(Os,"assignCoordinates");l(Os,"assignCoordinates");var Ps=8;function ks(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}O(ks,"hashString");l(ks,"hashString");function Bs(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}O(Bs,"mulberry32");l(Bs,"mulberry32");function Fs(t,e){const n=[...t],o=Bs(e);for(let s=n.length-1;s>0;s--){const r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}O(Fs,"deterministicShuffle");l(Fs,"deterministicShuffle");function _s(t,e){let n=0;for(const[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}O(_s,"sourceDistance");l(_s,"sourceDistance");function $n(t,e){const n=new Map;for(const[s,r]of t.entries())n.set(r,s);let o=0;for(const{a:s,b:r,weight:i}of e){const f=n.get(s),d=n.get(r);f==null||d==null||(o+=i*Math.abs(f-d))}return o}O($n,"laneArrangementCost");l($n,"laneArrangementCost");function Ds(t){const e=nn(t);if(e.length<2)return[];const n=new Map(e.map((r,i)=>[r,i])),o=ae(t),s=new Map;for(const r of t.layout.edges??[]){if(r.isLayoutOnly)continue;const i=typeof r.start=="string"?r.start:void 0,f=typeof r.end=="string"?r.end:void 0;if(!i||!f||!t.nodeById.has(i)||!t.nodeById.has(f))continue;const d=o(i),g=o(f);if(!d||!g||d===g)continue;const h=n.get(d),S=n.get(g);if(h==null||S==null)continue;const[M,u]=h<=S?[d,g]:[g,d],m=`${M}\0${u}`,c=s.get(m);c?c.weight++:s.set(m,{a:M,b:u,weight:1})}return[...s.values()]}O(Ds,"buildWeightedLaneEdges");l(Ds,"buildWeightedLaneEdges");function Vn(t,e,n){const o=[...t];let s=$n(o,e),r=!0,i=0;const f=Math.max(1,o.length);for(;r&&i<f;){r=!1,i++;for(let d=0;d+1<o.length;d++){[o[d],o[d+1]]=[o[d+1],o[d]];const g=$n(o,e);g<s?(s=g,r=!0):[o[d],o[d+1]]=[o[d+1],o[d]]}}return{order:o,cost:s,sourceDistance:_s(o,n)}}O(Vn,"greedySwitch");l(Vn,"greedySwitch");function Hs(t,e){return t.cost!==e.cost?t.cost<e.cost:t.sourceDistance<e.sourceDistance}O(Hs,"isBetterCandidate");l(Hs,"isBetterCandidate");function Xs(t,e,n){const o=[...e].sort((s,r)=>s.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:i})=>`${s}:${r}:${i}`).join("|");return ks(`${t.join("|")}#${o}#${n}`)}O(Xs,"seedForRestart");l(Xs,"seedForRestart");function Ys(t,e={}){const n=nn(t);if(n.length<2)return n;const o=Ds(t);if(o.length===0)return n;const s=new Map(n.map((f,d)=>[f,d]));let r=Vn(n,o,s);const i=Math.max(0,e.restarts??Ps);for(let f=0;f<i;f++){const d=Vn(Fs(n,Xs(n,o,f)),o,s);Hs(d,r)&&(r=d)}return r.order}O(Ys,"optimizeTopLaneOrder");l(Ys,"optimizeTopLaneOrder");function Gs(t,e){const n=e?.ignoreCrossLaneEdges??!0,o=e?.optimizeRanksByCrossings??!0,s=pe(t),r=e?.automaticLaneOrdering?Ys(s,{restarts:Ps}):void 0,i=as(s),f=i.acyclic,{layering:d,graphWithDummies:g}=Ts(n?Es(f,{compactSingleInput:e?.compactSingleInput??qe.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:e?.direction}):vs(f,{compactSingleInput:e?.compactSingleInput??qe.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:o}),f),h=Ns(d,g,{laneOrder:r}),S=Os(h,g,{layerGap:e?.layerGap,nodeGap:e?.nodeGap,direction:e?.direction,laneOrder:r});return{acyclic:f,reversed:i.reversed,layering:d,ordered:h,coordinates:S}}O(Gs,"sugiyamaLayout");l(Gs,"sugiyamaLayout");var ct=dr.EPSILON,ur=8,ye=15,ve=15,Xe=25,Jt=20,mn=10;function jn(t,e,n){const o=t.x??0,s=t.y??0,r=e.x-o,i=e.y-s,f=Math.abs(r),d=Math.abs(i);return f<ct&&d<ct?n:d>ct&&d*3>=f?i>0?"bottom":"top":f>ct?r>0?"right":"left":n}O(jn,"chooseOrthogonalSide");l(jn,"chooseOrthogonalSide");function Un(t,e){return Math.abs(t.to-e.from)<ct||Math.abs(t.to-e.to)<ct?t.to:t.from}O(Un,"sharedLineEndpointCoord");l(Un,"sharedLineEndpointCoord");function be(t,e){return t.orient==="vertical"?{x:t.coord,y:e}:{x:e,y:t.coord}}O(be,"pointOnLine");l(be,"pointOnLine");function zs(t,e){const n=t.nodes??[],o=t.edges??[],s=[];for(const a of o)a.isLayoutOnly||s.push({...a,__originalEdge:a});const r=new Map,i=new Map,f=[],d=e==="LR";for(const a of n)r.set(a.id,a);const g=n.filter(a=>a.isGroup&&!a.parentId);for(const a of g){const x={id:a.id},C=l(L=>{i.set(L.id,x),n.filter(E=>E.parentId===L.id).forEach(C)},"assignLane");C(a)}const h=n.filter(a=>!a.isGroup&&!a.isEdgeLabel).map(a=>{const x=a.width??10,C=a.height??10,L=a.x??0,E=a.y??0,B=ur;return{nodeId:a.id,minX:L-x/2-B,maxX:L+x/2+B,minY:E-C/2-B,maxY:E+C/2+B,visualXHalfExtent:d?C/2+B:x/2+B}}),S=l((a,x,C,L)=>{let E=f.find(B=>B.orientation===a&&Math.abs(B.coord-x)<1);return E||(E={id:`pipe-${a}-${x.toFixed(0)}`,orientation:a,coord:x,spanMin:C,spanMax:L,tracks:[]},f.push(E)),E.spanMin=Math.min(E.spanMin,C),E.spanMax=Math.max(E.spanMax,L),E},"getOrAddPipe"),M=l((a,x)=>{const C=a.width??10,L=a.height??10,E=a.x??0,B=a.y??0;switch(x){case"top":return{x:E,y:B-L/2};case"bottom":return{x:E,y:B+L/2};case"left":return{x:E-C/2,y:B};case"right":return{x:E+C/2,y:B}}},"portForSide"),u=l((a,x,C)=>M(a,jn(a,x,C?"bottom":"top")),"getOrthogonalPort"),m=[],c=[],b=new Set,w=1e3,I=l((a,x,C)=>{if(m.length===0)return 0;const L=Math.abs(x.y-C.y)<ct,E=Math.abs(x.x-C.x)<ct;if(!L&&!E)return 0;let B=0;if(L){const $=x.y,q=Math.min(x.x,C.x)-ct,G=Math.max(x.x,C.x)+ct;if(G<=q)return 0;for(const X of m)X.edgeIndex===a||X.orientation!=="vertical"||X.pipe.coord<q||X.pipe.coord>G||X.from-ct<=$&&X.to+ct>=$&&(B+=w)}else if(E){const $=x.x,q=Math.min(x.y,C.y)-ct,G=Math.max(x.y,C.y)+ct;if(G<=q)return 0;for(const X of m)X.edgeIndex===a||X.orientation!=="horizontal"||X.pipe.coord<q||X.pipe.coord>G||X.from-ct<=$&&X.to+ct>=$&&(B+=w)}return B},"crossingPenalty"),T=s.map((a,x)=>{if(!a.start||!a.end)return{idx:x,crossLane:0,dx:0,dy:0};const C=r.get(a.start),L=r.get(a.end),E=i.get(a.start),B=i.get(a.end);return{idx:x,crossLane:E&&B&&E.id!==B.id?1:0,dx:C&&L?Math.abs((L.x??0)-(C.x??0)):0,dy:C&&L?Math.abs((L.y??0)-(C.y??0)):0}}).sort((a,x)=>{if(a.crossLane!==x.crossLane)return x.crossLane-a.crossLane;const C=a.dx+a.dy,L=x.dx+x.dy;return Math.abs(C-L)>1?C-L:a.idx-x.idx}).map(a=>a.idx),v=l((a,x,C,L)=>{const E=Math.min(a.x,x.x),B=Math.max(a.x,x.x),$=Math.min(a.y,x.y),q=Math.max(a.y,x.y);return!!h.find(G=>C&&G.nodeId===C||L&&G.nodeId===L?!1:Math.abs(a.x-x.x)>ct?G.minY<a.y&&G.maxY>a.y&&G.maxX>E&&G.minX<B:G.minX<a.x&&G.maxX>a.x&&G.maxY>$&&G.minY<q)},"isSegmentBlocked"),p=new Map,y=new Map;for(const a of s)!a.start||!a.end||a.start===a.end||(y.set(a.start,(y.get(a.start)??0)+1),y.set(a.end,(y.get(a.end)??0)+1));const A=l((a,x)=>jn(a,x,"bottom"),"determineSide"),P=new Map;for(const[a,x]of s.entries()){if(!x.start||!x.end||x.start===x.end||x.points&&x.points.length>0)continue;const C=r.get(x.start),L=r.get(x.end);if(!C||!L)continue;const E=(L.x??0)-(C.x??0),B=(L.y??0)-(C.y??0);P.set(a,{edgeIdx:a,srcId:x.start,dstId:x.end,srcSide:A(C,{x:L.x??0,y:L.y??0}),dstSide:A(L,{x:C.x??0,y:C.y??0}),absDx:Math.abs(E),absDy:Math.abs(B),dxSign:Math.sign(E),dySign:Math.sign(B)})}const N=l(a=>a.srcSide==="top"||a.srcSide==="bottom"?a.absDx===0?1/0:a.absDy/a.absDx:a.absDy===0?1/0:a.absDx/a.absDy,"preferenceStrength"),R=l(a=>a.srcSide==="top"||a.srcSide==="bottom"?a.dxSign>=0?"right":"left":a.dySign>=0?"bottom":"top","secondarySide"),_=new Map;for(const a of P.values()){const x=`${a.srcId}:${a.srcSide}`;_.has(x)||_.set(x,[]),_.get(x).push(a)}const F=new Map,Y=l((a,x)=>`${a}:${x}`,"loadKey");for(const a of P.values())F.set(Y(a.srcId,a.srcSide),(F.get(Y(a.srcId,a.srcSide))??0)+1),F.set(Y(a.dstId,a.dstSide),(F.get(Y(a.dstId,a.dstSide))??0)+1);for(const a of _.values())if(!(a.length<2)){a.sort((x,C)=>{const L=N(x),E=N(C);return Math.abs(L-E)>1e-9?E-L:x.edgeIdx-C.edgeIdx});for(let x=1;x<a.length;x++){const C=a[x],L=R(C),E=F.get(Y(C.srcId,C.srcSide))??0,B=F.get(Y(C.srcId,L))??0;B>=E||(F.set(Y(C.srcId,C.srcSide),E-1),F.set(Y(C.srcId,L),B+1),C.srcSide=L)}}const Z=l(a=>{const x=a?.shape;return x==="question"||x==="diamond"},"isDiamondNode"),et=new Map;for(const a of P.values())et.has(a.dstId)||et.set(a.dstId,new Set),et.get(a.dstId).add(a.dstSide);for(const a of P.values()){if(!Z(r.get(a.srcId)))continue;const x=et.get(a.srcId);if(!x?.has(a.srcSide))continue;const C=R(a);if(x.has(C)||(F.get(Y(a.srcId,C))??0)>0)continue;const L=F.get(Y(a.srcId,a.srcSide))??0;F.set(Y(a.srcId,a.srcSide),Math.max(0,L-1)),F.set(Y(a.srcId,C),1),a.srcSide=C}for(const a of P.values()){const{edgeIdx:x,srcId:C,dstId:L,srcSide:E,dstSide:B}=a,$=r.get(C),q=r.get(L),G=`${C}:${E}:src`,X=E==="top"||E==="bottom"?q.x??0:q.y??0;p.has(G)||p.set(G,[]),p.get(G).push({edgeIdx:x,oppositeCoord:X});const W=`${L}:${B}:dst`,ft=B==="top"||B==="bottom"?$.x??0:$.y??0;p.has(W)||p.set(W,[]),p.get(W).push({edgeIdx:x,oppositeCoord:ft})}const nt=new Map,Mt=8;for(const[a,x]of p){if(x.length<2)continue;x.sort((St,ot)=>St.oppositeCoord-ot.oppositeCoord);const C=a.split(":"),L=C.slice(0,-2).join(":"),E=C[C.length-2],B=C[C.length-1],$=r.get(L);if(!$)continue;const q=E==="left"||E==="right"?$.height??10:$.width??10,G=$.shape,X=G==="question"||G==="diamond"?q*.3:q,W=Math.min(20,Math.max(Mt,X/(x.length+1))),ft=-(W*(x.length-1))/2;for(const[St,ot]of x.entries()){const ht=ft+St*W,Tt=`${ot.edgeIdx}:${B}`;nt.set(Tt,ht)}}const yt=l(a=>!!s[a]?.labelNodeId,"edgeHasLabelNode"),Bt=l((a,x)=>a?(p.get(`${a}:${x}:src`)??[]).some(({edgeIdx:C})=>yt(C))||(p.get(`${a}:${x}:dst`)??[]).some(({edgeIdx:C})=>yt(C)):!1,"faceHasLabelNode"),rt=l((a,x,C)=>x==="top"||x==="bottom"?{x:a.x+C,y:a.y}:{x:a.x,y:a.y+C},"applyPortOffset"),K=l((a,x,C)=>{const L=P.get(a),E={x:C.x??0,y:C.y??0},B={x:x.x??0,y:x.y??0},$=L?.srcSide??A(x,E),q=L?.dstSide??A(C,B);let G=L?M(x,L.srcSide):u(x,E,!0),X=L?M(C,L.dstSide):u(C,B,!1);const W=nt.get(`${a}:src`),ft=nt.get(`${a}:dst`);return W!==void 0&&(G=rt(G,$,W)),ft!==void 0&&(X=rt(X,q,ft)),{pSrcPort:G,pDstPort:X,srcSide:$,dstSide:q}},"portsForEdge");for(const a of T){const x=s[a];if(c[a]=[],!x.start||!x.end||x.points&&x.points.length>0||x.start===x.end)continue;const C=r.get(x.start),L=r.get(x.end);if(!C||!L)continue;const{pSrcPort:E,pDstPort:B,srcSide:$,dstSide:q}=K(a,C,L),G={...E},X={...B},W=$==="top"||$==="bottom",ft=q==="top"||q==="bottom";W?G.y=E.y>(C.y??0)?E.y+Jt:E.y-Jt:G.x=E.x>(C.x??0)?E.x+Jt:E.x-Jt,ft?X.y=B.y>(L.y??0)?B.y+Jt:B.y-Jt:X.x=B.x>(L.x??0)?B.x+Jt:B.x-Jt;const St=l((z,V)=>{for(const U of h)if(!V.includes(U.nodeId)&&z.x>U.minX&&z.x<U.maxX&&z.y>U.minY&&z.y<U.maxY)return{inside:!0,obstacle:U};return{inside:!1}},"isPointInObstacle"),ot=l((z,V,U,lt,Rt)=>{if(Rt){const Nt=z.y>(V.y??0);return{x:(U.x??0)>=z.x?lt.maxX+ye:lt.minX-ye,y:Nt?lt.maxY+ve:lt.minY-ve,leavesPositiveSide:Nt}}const Ct=z.x>(V.x??0),vt=(U.y??0)>=z.y;return{x:Ct?lt.maxX+ye:lt.minX-ye,y:vt?lt.maxY+ve:lt.minY-ve,leavesPositiveSide:Ct}},"obstacleDetour");let ht=[];const Tt=[x.start,x.end],Gt=St(G,Tt);if(Gt.inside&&Gt.obstacle){const z=Gt.obstacle;if(W){const V=ot(E,C,L,z,!0);G.x=V.x,G.y=V.y;const U=V.leavesPositiveSide?Math.min(z.minY-2,E.y+Jt):Math.max(z.maxY+2,E.y-Jt);ht=[{x:E.x,y:U},{x:V.x,y:U},{x:V.x,y:V.y}]}else{const V=ot(E,C,L,z,!1),U=V.leavesPositiveSide?Math.min(z.minX-2,E.x+Jt):Math.max(z.maxX+2,E.x-Jt);G.x=V.x,G.y=V.y,ht=[{x:U,y:E.y},{x:U,y:V.y},{x:V.x,y:V.y}]}}let ie=[];const Se=St(X,Tt);if(Se.inside&&Se.obstacle){const z=Se.obstacle;if(ft){const V=ot(B,L,C,z,!0);X.x=V.x,X.y=V.y,ie=[{x:V.x,y:V.y},{x:B.x,y:V.y}]}else{const V=ot(B,L,C,z,!1);X.x=V.x,X.y=V.y,ie=[{x:V.x,y:V.y},{x:V.x,y:B.y}]}}if(ht.length===0&&ie.length===0){const z=ye,V=Math.abs(G.x-X.x)<z,U=Math.abs(G.y-X.y)<z,lt=nt.get(`${a}:src`)!==void 0||nt.get(`${a}:dst`)!==void 0,Rt=(p.get(`${x.start??""}:${$}:src`)?.length??0)+(p.get(`${x.start??""}:${$}:dst`)?.length??0),Ct=(p.get(`${x.end??""}:${q}:src`)?.length??0)+(p.get(`${x.end??""}:${q}:dst`)?.length??0),vt=Rt>1||Ct>1,Nt=y.get(x.start??"")??0,gt=y.get(x.end??"")??0,Yt=Rt>1&&Bt(x.start,$)||Ct>1&&Bt(x.end,q);if((V||U)&&!lt&&(!vt||vt&&!Yt&&(Rt<=1||Nt<=2)&&(Ct<=1||gt<=2))&&!v(E,B,x.start,x.end)){x.points=[{...E},{...G},{...X},{...B}],b.add(a);const $t=U?"horizontal":"vertical",Ot=U?E.y:E.x,Dt=U?Math.min(E.x,B.x):Math.min(E.y,B.y),pt=U?Math.max(E.x,B.x):Math.max(E.y,B.y),Pt={id:`fast-path-${$t}-${Ot.toFixed(0)}-${a}`,orientation:$t,coord:Ot,spanMin:Dt,spanMax:pt,tracks:[]};m.push({edgeIndex:a,segmentIndex:0,orientation:$t,pipe:Pt,trackIndex:0,from:Dt,to:pt});continue}}G.x=S("vertical",G.x,G.y,G.y).coord,X.x=S("vertical",X.x,X.y,X.y).coord;let fe=Math.min(G.x,X.x)-50,le=Math.max(G.x,X.x)+50,Ce=Math.min(G.y,X.y)-50,Le=Math.max(G.y,X.y)+50;for(const z of h){const V=Math.min(G.x,X.x),U=Math.max(G.x,X.x),lt=Math.min(G.y,X.y),Rt=Math.max(G.y,X.y);z.minX<U&&z.maxX>V&&z.minY<Rt&&z.maxY>lt&&(fe=Math.min(fe,z.minX-Xe),le=Math.max(le,z.maxX+Xe),Ce=Math.min(Ce,z.minY-Xe),Le=Math.max(Le,z.maxY+Xe))}for(const z of h){if(z.maxX<fe||z.minX>le||z.maxY<Ce||z.minY>Le)continue;const V=ye;S("horizontal",z.minY-V,fe,le),S("horizontal",z.maxY+V,fe,le);const U=ve;S("vertical",z.minX-U,Ce,Le),S("vertical",z.maxX+U,Ce,Le)}S("horizontal",G.y,fe,le),S("horizontal",X.y,fe,le);const Us=f.filter(z=>z.orientation==="horizontal"&&z.coord>=Ce&&z.coord<=Le),Ws=f.filter(z=>z.orientation==="vertical"&&z.coord>=fe&&z.coord<=le),Pe=l((z,V)=>`${z.toFixed(1)},${V.toFixed(1)}`,"getKey"),ke=Pe(G.x,G.y),go=Pe(X.x,X.y),Be=new Map,cn=new Map,an=new Map,Fe=new Set,xe=[];Be.set(ke,0),an.set(ke,"n"),xe.push({key:ke,f:Math.hypot(X.x-G.x,X.y-G.y),pt:G}),Fe.add(ke);let Ht=[];const de=l((z,V)=>v(z,V,x.start,x.end),"checkSegmentBlocked"),fn={x:X.x,y:G.y},Ks=de(G,fn),qs=de(fn,X),Zs=Ks||qs,ln={x:G.x,y:X.y},Js=de(G,ln),Qs=de(ln,X);if(Zs?Js||Qs||(Math.abs(G.x-X.x)<ct?Ht=[G,X]:Ht=[G,ln,X]):Math.abs(G.y-X.y)<ct||Math.abs(G.x-X.x)<ct?Ht=[G,X]:Ht=[G,fn,X],Ht.length===0)for(;xe.length>0;){xe.sort((gt,Yt)=>gt.f-Yt.f);const z=xe.shift();if(Fe.delete(z.key),z.key===go){let gt=go,Yt=X;for(Ht=[Yt];cn.has(gt);){const $t=cn.get(gt);Ht.unshift($t),Yt=$t,gt=Pe($t.x,$t.y)}break}const V=z.pt.x,U=z.pt.y,lt=Ws.sort((gt,Yt)=>gt.coord-Yt.coord),Rt=lt.findIndex(gt=>Math.abs(gt.coord-V)<1),Ct=Us.sort((gt,Yt)=>gt.coord-Yt.coord),vt=Ct.findIndex(gt=>Math.abs(gt.coord-U)<1),Nt=[];Rt>0&&Nt.push({x:lt[Rt-1].coord,y:U}),Rt>=0&&Rt<lt.length-1&&Nt.push({x:lt[Rt+1].coord,y:U}),vt>0&&Nt.push({x:V,y:Ct[vt-1].coord}),vt>=0&&vt<Ct.length-1&&Nt.push({x:V,y:Ct[vt+1].coord});for(const gt of Nt){const Yt=Math.min(V,gt.x),$t=Math.max(V,gt.x),Ot=Math.min(U,gt.y),Dt=Math.max(U,gt.y);if(h.some(Kt=>Kt.nodeId===x.start||Kt.nodeId===x.end?!1:Yt!==$t?Kt.minY<U&&Kt.maxY>U&&Kt.maxX>Yt&&Kt.minX<$t:Kt.minX<V&&Kt.maxX>V&&Kt.maxY>Ot&&Kt.minY<Dt))continue;const pt=Pe(gt.x,gt.y),Pt=Math.abs(gt.x-V)+Math.abs(gt.y-U),Wt=I(a,z.pt,gt);let xt=0;const kt=X.x-G.x,ue=X.y-G.y,he=gt.x-V,dn=gt.y-U;(ue>10&&dn<-5||ue<-10&&dn>5)&&(xt=Math.abs(dn)*100),(kt>10&&he<-5||kt<-10&&he>5)&&(xt+=Math.abs(he)*50);let mo=0;const po=an.get(z.key)??"n",xo=Math.abs(he)>ct?"h":"v";po!=="n"&&po!==xo&&(mo=50);const tr=Pt+Wt+xt+mo,_e=(Be.get(z.key)??1/0)+tr,yo=Math.abs(X.x-gt.x)+Math.abs(X.y-gt.y);if(_e<(Be.get(pt)??1/0))if(cn.set(pt,z.pt),Be.set(pt,_e),an.set(pt,xo),!Fe.has(pt))xe.push({key:pt,f:_e+yo,pt:gt}),Fe.add(pt);else{const Kt=xe.findIndex(er=>er.key===pt);Kt!==-1&&(xe[Kt].f=_e+yo)}}}if(Ht.length===0&&(Ht=[G,{x:G.x,y:X.y},X]),Ht.length>4){const z=Ht[0],V=Ht[Ht.length-1];let U=Math.min(z.x,V.x),lt=Math.max(z.x,V.x),Rt=Math.min(z.y,V.y),Ct=Math.max(z.y,V.y);for(const Ot of Ht)U=Math.min(U,Ot.x),lt=Math.max(lt,Ot.x),Rt=Math.min(Rt,Ot.y),Ct=Math.max(Ct,Ot.y);const vt=lt>Math.max(z.x,V.x),Nt=U<Math.min(z.x,V.x);if(d){const Ot=ve;if(vt){const Dt=Math.max(z.x,V.x),pt=Math.min(z.y,V.y),Pt=Math.max(z.y,V.y),Wt=h.filter(xt=>xt.minX<Dt&&xt.maxX>Dt&&xt.minY<Pt&&xt.maxY>pt);if(Wt.length>0){let xt=Math.max(z.x,V.x);for(const kt of Wt){const ue=(kt.minX+kt.maxX)/2;if(kt.visualXHalfExtent===void 0||isNaN(kt.visualXHalfExtent))continue;const he=ue+kt.visualXHalfExtent+Ot;xt=Math.max(xt,he)}isNaN(xt)||(lt=xt)}}if(Nt){const Dt=h.filter(pt=>pt.minX<Math.min(z.x,V.x)+Ot&&pt.minY<Math.max(z.y,V.y)&&pt.maxY>Math.min(z.y,V.y));if(Dt.length>0){let pt=Math.min(z.x,V.x);for(const Pt of Dt){const Wt=(Pt.minX+Pt.maxX)/2-Pt.visualXHalfExtent-Ot;pt=Math.min(pt,Wt)}U=pt}}}const gt=l(Ot=>{const Dt=V.y>z.y,pt=h.filter(xt=>{const kt=Math.min(z.x,V.x)<xt.maxX&&Math.max(z.x,V.x)>xt.minX,ue=Math.min(z.y,V.y)<xt.maxY&&Math.max(z.y,V.y)>xt.minY;return kt&&ue});let Pt=pt;if(d&&pt.length>0){const xt=pt.filter(kt=>kt.minX<Ot&&kt.maxX>Ot);xt.length>0&&(Pt=xt)}if(Pt.length===0)return V.y;const Wt=ye;if(Dt){const xt=Math.max(...Pt.map(kt=>kt.maxY))+Wt;if(xt<V.y-ct)return xt}else{const xt=Math.min(...Pt.map(kt=>kt.minY))-Wt;if(xt>V.y+ct)return xt}return V.y},"findBestReturnY"),Yt=l(Ot=>{const Dt=gt(Ot),pt={x:Ot,y:z.y},Pt={x:Ot,y:Dt},Wt={x:V.x,y:Dt},xt=de(z,pt),kt=de(pt,Pt),ue=de(Pt,Wt),he=Dt!==V.y?de(Wt,V):!1;return!xt&&!kt&&!ue&&!he?Math.abs(Dt-V.y)<ct?[z,pt,Pt,V]:[z,pt,Pt,Wt,V]:null},"trySimplifyWithDetourX"),$t=vt&&!Nt?Yt(lt):Nt&&!vt?Yt(U):null;$t&&(Ht=$t)}const Xt=[E,...ht,...Ht,...ie.reverse(),B];if(Xt.length>=3){const z=Xt[Xt.length-1],V=Xt[Xt.length-2],U=Xt[Xt.length-3],lt=Math.abs(U.y-V.y)<ct&&Math.abs(V.y-z.y)<ct,Rt=Math.abs(U.x-V.x)<ct&&Math.abs(V.x-z.x)<ct;if(lt){const Ct=Math.sign(V.x-U.x),vt=Math.sign(z.x-U.x);Ct!==0&&Ct===vt&&Math.abs(V.x-U.x)>Math.abs(z.x-U.x)&&Xt.splice(-2,1)}else if(Rt){const Ct=Math.sign(V.y-U.y),vt=Math.sign(z.y-U.y);Ct!==0&&Ct===vt&&Math.abs(V.y-U.y)>Math.abs(z.y-U.y)&&Xt.splice(-2,1)}}const ee=[Xt[0]];for(let z=1;z<Xt.length-1;z++){if(z===1){ee.push(Xt[z]);continue}const V=ee[ee.length-1],U=Xt[z],lt=Xt[z+1];if(Math.abs(V.y-U.y)<ct&&Math.abs(U.y-lt.y)<ct){if(U.x>V.x!=lt.x>U.x){ee.push(U);continue}continue}if(Math.abs(V.x-U.x)<ct&&Math.abs(U.x-lt.x)<ct){if(U.y>V.y!=lt.y>U.y){ee.push(U);continue}continue}ee.push(U)}ee.push(Xt[Xt.length-1]);for(let z=0;z<ee.length-1;z++){const V=ee[z],U=ee[z+1],lt=Math.abs(V.x-U.x)<ct?"vertical":"horizontal",Rt=lt==="vertical"?V.x:V.y,Ct=lt==="vertical"?Math.min(V.y,U.y):Math.min(V.x,U.x),vt=lt==="vertical"?Math.max(V.y,U.y):Math.max(V.x,U.x),Nt=S(lt,Rt,Ct,vt),gt={edgeIndex:a,segmentIndex:z,orientation:lt,pipe:Nt,trackIndex:0,from:Ct,to:vt};m.push(gt),c[a].push(m.length-1),Nt.tracks[0]||(Nt.tracks[0]={index:0,coord:Nt.coord,segments:[]}),Nt.tracks[0].segments.push({edgeIndex:a,segmentIndex:z,from:Ct,to:vt})}}const Q=l((a,x)=>a.from<x.to&&x.from<a.to,"segmentsOverlap"),st=l((a,x,C,L)=>{const E=!L.segments.some($=>($.edgeIndex!==x.edgeIndex||$.segmentIndex!==x.segmentIndex)&&Q($,a)),B=!C.segments.some($=>($.edgeIndex!==a.edgeIndex||$.segmentIndex!==a.segmentIndex)&&Q($,x));return E&&B?(a.trackIndex=L.index,x.trackIndex=C.index,C.segments=[...C.segments.filter($=>$.edgeIndex!==a.edgeIndex||$.segmentIndex!==a.segmentIndex),{edgeIndex:x.edgeIndex,segmentIndex:x.segmentIndex,from:x.from,to:x.to}],L.segments=[...L.segments.filter($=>$.edgeIndex!==x.edgeIndex||$.segmentIndex!==x.segmentIndex),{edgeIndex:a.edgeIndex,segmentIndex:a.segmentIndex,from:a.from,to:a.to}],!0):!1},"trySwapSegmentsAcrossTracks"),at=l(a=>{const x=a.tracks.length;return a.tracks[x]={index:x,coord:a.coord,segments:[]},x},"createNewTrack"),bt=l((a,x)=>{const C=a.pipe.tracks[a.trackIndex];C.segments=C.segments.filter(L=>L.edgeIndex!==a.edgeIndex||L.segmentIndex!==a.segmentIndex),a.trackIndex=x,a.pipe.tracks[x].segments.push({edgeIndex:a.edgeIndex,segmentIndex:a.segmentIndex,from:a.from,to:a.to})},"moveSegmentToTrack"),It=l((a,x)=>{const C=c[a.edgeIndex];for(const L of C){const E=m[L];E.pipe===a.pipe&&bt(E,x)}},"moveSegmentChainToTrack"),Lt=l(a=>{const x=c[a.edgeIndex],C=x.indexOf(m.indexOf(a)),L=[];return C>0&&L.push(m[x[C-1]]),C<x.length-1&&L.push(m[x[C+1]]),L},"getAdjacentSegmentsAlongEdge"),Ut=l((a,x)=>{if(a.orientation===x.orientation)return!1;const C=a.orientation==="horizontal"?a:x,L=a.orientation==="horizontal"?x:a;return L.pipe.coord>C.from&&L.pipe.coord<C.to&&C.pipe.coord>L.from&&C.pipe.coord<L.to},"haveAnyCrossing"),Zt=l((a,x)=>{for(const C of a.tracks)if(!C.segments.some(L=>(L.edgeIndex!==x.edgeIndex||L.segmentIndex!==x.segmentIndex)&&Q(L,x)))return C.index;return-1},"findAvailableTrack"),se=l((a,x)=>{if(a.trackIndex===x.trackIndex)return Q(a,x);const C=Lt(a),L=Lt(x);return C.some(E=>L.some(B=>Ut(E,B)))},"segmentsConflict"),re=l((a,x,C)=>{if(st(a,x,a.pipe.tracks[a.trackIndex],x.pipe.tracks[x.trackIndex]))return;const L=Zt(a.pipe,x);C(x,L!==-1?L:at(a.pipe))},"resolveTrackConflict"),Oe=l(a=>{let x=0;for(let C=0;C<a.length;C++)for(let L=C+1;L<a.length;L++){const E=a[C],B=a[L];E.pipe===B.pipe&&se(E,B)&&(x++,re(E,B,It))}return x},"resolveHandleConflicts"),Ie=new Map,Ae=l(a=>{if(Ie.has(a))return Ie.get(a);const x=c[a];if(x.length===0){const $={dest:0,deviation:0,base:0,delta:0};return Ie.set(a,$),$}const C=m[x[0]].pipe.coord;let L=C;for(let $=1;$<x.length;$++){const q=m[x[$]];if(q.orientation==="horizontal"){const G=q.from,X=q.to;L=Math.abs(G-C)>Math.abs(X-C)?G:X;break}}const E=Math.abs(L-C),B={dest:L,deviation:E,base:C,delta:L-C};return Ie.set(a,B),B},"getDestInfo"),on=l(()=>{let a=0;const x=new Map;for(const[L,E]of s.entries())c[L].length!==0&&E.start&&(x.has(E.start)||x.set(E.start,[]),x.get(E.start).push(L));const C=l(L=>{const E=s[L];if(!E.start||!E.end)return 0;const B=r.get(E.start),$=r.get(E.end);if(!B||!$)return 0;const q=($.x??0)-(B.x??0),G=($.y??0)-(B.y??0);return Math.abs(q)+Math.abs(G)},"getEdgeDistance");for(const L of x.values()){L.sort((B,$)=>{const q=Ae(B),G=Ae($);if(Math.abs(q.deviation-G.deviation)>1)return q.deviation-G.deviation;if(Math.abs(q.dest-G.dest)>1)return q.dest-G.dest;const X=C(B),W=C($);if(Math.abs(X-W)>1)return W-X;const ft=c[B].length,St=c[$].length;if(ft!==St)return ft-St;if(ft===1){const ot=c[B][0],ht=c[$][0];if(m[ot]&&m[ht]){const Tt=m[ot],Gt=m[ht],ie=Math.abs(Tt.to-Tt.from),Se=Math.abs(Gt.to-Gt.from);if(Math.abs(ie-Se)>1)return ie-Se}}return 0});const E=L.map(B=>m[c[B][0]]);a+=Oe(E)}return a},"fixSourceHandleCrossings"),sn=l(()=>{let a=0;const x=new Map;for(const[C,L]of s.entries())c[C].length!==0&&L.end&&(x.has(L.end)||x.set(L.end,[]),x.get(L.end).push(C));for(const C of x.values()){C.sort((E,B)=>{const $=l(X=>{const W=c[X];if(W.length<2)return 0;const ft=m[W[W.length-2]];return Math.abs(ft.to-ft.from)},"getDist"),q=$(E),G=$(B);return Math.abs(q-G)>.1?q-G:E-B});const L=C.map(E=>m[c[E][c[E].length-1]]);a+=Oe(L)}return a},"fixTargetHandleCrossings"),rn=l(()=>{let a=0;for(const x of f){const C=[];for(const L of x.tracks)for(const E of L.segments){const B=c[E.edgeIndex].find($=>m[$].segmentIndex===E.segmentIndex);B!==void 0&&C.push(m[B])}C.sort((L,E)=>L.edgeIndex-E.edgeIndex||L.segmentIndex-E.segmentIndex);for(let L=0;L<C.length;L++)for(let E=L+1;E<C.length;E++){const B=C[L],$=C[E];se(B,$)&&(a++,re(B,$,bt))}}return a},"fixPipeCrossings");let k=0;const D=10;for(;k<D;){let a=0;if(a+=on(),a+=sn(),a+=rn(),a===0)break;k++}const H=new Map;for(const a of f){const x=[];a.tracks.forEach(L=>{L.segments.forEach(E=>{x.push({edgeIndex:E.edgeIndex,segmentIndex:E.segmentIndex,trackIndex:L.index,from:E.from,to:E.to})})}),x.sort((L,E)=>L.from-E.from);const C=[];if(x.length>0){let L=[x[0]],E=x[0].to;for(let B=1;B<x.length;B++){const $=x[B];$.from<E?(L.push($),E=Math.max(E,$.to)):(C.push(L),L=[$],E=$.to)}C.push(L)}for(const L of C){const E=new Set;L.forEach(ot=>E.add(ot.trackIndex));const B=new Map;L.forEach(ot=>{const ht=Ae(ot.edgeIndex);B.set(ot.trackIndex,(B.get(ot.trackIndex)??0)+ht.delta)});const $=[...E].filter(ot=>(B.get(ot)??0)<-1),q=[...E].filter(ot=>(B.get(ot)??0)>1),G=[...E].filter(ot=>Math.abs(B.get(ot)??0)<=1);$.sort((ot,ht)=>(B.get(ht)??0)-(B.get(ot)??0)),q.sort((ot,ht)=>(B.get(ot)??0)-(B.get(ht)??0));const X=l((ot,ht)=>{L.filter(Tt=>Tt.trackIndex===ot).forEach(Tt=>{const Gt=b.has(Tt.edgeIndex)?a.coord:ht;H.set(`${Tt.edgeIndex}-${Tt.segmentIndex}`,Gt)})},"assignCoord");let W=0;for(const ot of $)W++,X(ot,a.coord-W*mn);if(G.length===0&&E.size>0){const ot=[...E].sort((Gt,ie)=>Math.abs(B.get(Gt)??0)-Math.abs(B.get(ie)??0))[0],ht=$.indexOf(ot);ht!==-1&&$.splice(ht,1);const Tt=q.indexOf(ot);Tt!==-1&&q.splice(Tt,1),G.push(ot)}let ft=0;for(const ot of G){if(ft===0)X(ot,a.coord);else{const ht=ft%2===1?1:-1,Tt=Math.ceil(ft/2);X(ot,a.coord+ht*Tt*mn*.5)}ft++}let St=0;for(const ot of q)St++,X(ot,a.coord+St*mn)}}for(const[a,x]of s.entries()){const C=c[a]??[];if(C.length===0)continue;const L=[],{pSrcPort:E,pDstPort:B}=K(a,r.get(x.start),r.get(x.end)),$=C.map(X=>{const W=m[X],ft=H.get(`${W.edgeIndex}-${W.segmentIndex}`)??W.pipe.coord;return{orient:W.orientation,coord:ft,from:W.from,to:W.to}});L.push(E);for(let X=0;X<$.length;X++){const W=$[X],ft=L[L.length-1],St=W.orient==="vertical"?ft.y:ft.x,ot=W.orient==="vertical"?ft.x:ft.y,ht=$[X+1],Tt=X<$.length-1;if(Math.abs(ot-W.coord)>ct&&L.push(be(W,St)),Tt&&ht.orient===W.orient)if(Math.abs(W.coord-ht.coord)>ct){const Gt=W.orient==="vertical"?(St+ht.from)/2:Un(W,ht);L.push(be(W,Gt),be(ht,Gt))}else(X===0||X===$.length-2)&&L.push(be(W,Un(W,ht)));else if(Tt)L.push(be(W,ht.coord));else{const Gt=Math.abs(W.from-St)<Math.abs(W.to-St)?W.to:W.from;L.push(be(W,Gt))}}const q=L[L.length-1];(Math.abs(q.x-B.x)>ct||Math.abs(q.y-B.y)>ct)&&L.push(B);const G=[];L.length>0&&G.push(L[0]);for(let X=1;X<L.length;X++){const W=L[X],ft=G[G.length-1];(Math.abs(W.x-ft.x)>ct||Math.abs(W.y-ft.y)>ct)&&G.push(W)}x.points=G}for(const a of s){const x=a.__originalEdge;x&&a.points&&(x.points=a.points)}t.edges=(t.edges??[]).filter(a=>!a.isLayoutOnly);const j=l((a,x)=>{const C=x.x??0,L=x.y??0,E=x.width??0,B=x.height??0;if(E<=0||B<=0)return a;const $=C-E/2,q=C+E/2,G=L-B/2,X=L+B/2;if(a.x<$||a.x>q||a.y<G||a.y>X)return a;const W=a.x-$,ft=q-a.x,St=a.y-G,ot=X-a.y,ht=Math.min(W,ft,St,ot);return ht===W?{x:$,y:a.y}:ht===ft?{x:q,y:a.y}:ht===St?{x:a.x,y:G}:{x:a.x,y:X}},"nodeBoundaryClamp");for(const a of t.edges){const x=a.points;if(!x||x.length<2)continue;const C=a.start,L=a.end,E=C?r.get(C):void 0,B=L?r.get(L):void 0;E&&(x[0]=j(x[0],E)),B&&(x[x.length-1]=j(x[x.length-1],B))}return t}O(zs,"routeEdgesOrthogonal");l(zs,"routeEdgesOrthogonal");function $s(t){return t.direction??"TB"}O($s,"getSwimlaneDirection");l($s,"getSwimlaneDirection");function Vs(t){const e=Eo(t),n=t.config.flowchart?.nodeSpacing??40,o=t.config.flowchart?.rankSpacing??100,s=t.config.swimlane?.ignoreCrossLaneEdges??!0,r=t.config.swimlane?.optimizeRanksByCrossings??!0,i=t.config.swimlane?.automaticLaneOrdering??!1,f=$s(t),{ordered:d,coordinates:g}=Gs(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:i,direction:f});To(e,d,g,{nodeGap:n,layerGap:o});for(const h of t.edges??[])delete h.points;zs(t,f);for(const h of t.edges??[])(!h.curve||h.curve==="basis")&&(h.curve="rounded");return is(t,f),rs(t),f}O(Vs,"runSwimlaneLayoutCore");l(Vs,"runSwimlaneLayoutCore");function js(t){wo(t);const e=Ao(t);t.nodes=e.nodes,t.edges=e.edges}O(js,"prepareSwimlaneLayout");l(js,"prepareSwimlaneLayout");var Tr=or({prepareLayout:js,runLayoutCore:Vs,afterPaint:Lo});export{Tr as render};