@juki-team/base-ui 1.5.13 → 1.5.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 (258) hide show
  1. package/dist/esm/ArrowForwardIcon-Bd0B_Kwe.js +1 -0
  2. package/dist/esm/BarChart-B6teyAwl.js +1 -0
  3. package/dist/esm/{CartesianChart-DYpkf6Ou.js → CartesianChart-BZZYJ31q.js} +1 -1
  4. package/dist/esm/ChangePasswordModal-wjB2d2a0.js +1 -0
  5. package/dist/esm/CodeEditor--mRrq7Xc.js +1 -0
  6. package/dist/esm/CodeViewer-C2keyN4-.js +1 -0
  7. package/dist/esm/Collapse-C_rZY9aE.js +1 -0
  8. package/dist/esm/{DataGrid-BdFgb8IP.js → DataGrid-DbFP5mTw.js} +1 -1
  9. package/dist/esm/DataViewer-lFoDNwIZ.js +1 -0
  10. package/dist/esm/DrawerView-BLwtJxwY.js +1 -0
  11. package/dist/esm/ExcalidrawButton-CrNTOZTX.js +1 -0
  12. package/dist/esm/GraphvizViewer-beaBRsJd.js +1 -0
  13. package/dist/esm/ImageLoaderCropper-_ZIo2zEm.js +1 -0
  14. package/dist/esm/InputCellPhoneNumber-CusvoWas.js +1 -0
  15. package/dist/esm/{InputColor-CHgGjI3f.js → InputColor-ADhkNitB.js} +1 -1
  16. package/dist/esm/LineChart-DUg6yaTg.js +1 -0
  17. package/dist/esm/{LoaderLayer-ECtsj85k.js → LoaderLayer-Csc8unUJ.js} +1 -1
  18. package/dist/esm/MdMath-Dstso3EJ.js +1 -0
  19. package/dist/esm/{MdMathEditor-Dvq5oODw.js → MdMathEditor-BMYIOhto.js} +1 -1
  20. package/dist/esm/{Popover-CX8YffOd.js → Popover-DRm9Iqcj.js} +1 -1
  21. package/dist/esm/ReplyIcon-BAIEk00m.js +1 -0
  22. package/dist/esm/{SettingsIcon-B9nmP4lD.js → SettingsIcon-Cd0qgB0A.js} +1 -1
  23. package/dist/esm/SlideDeck-C0Py_6HO.js +1 -0
  24. package/dist/esm/{TableEyeIcon-Mb5aFvN0.js → TableEyeIcon-CYXh-eSU.js} +1 -1
  25. package/dist/esm/{TableOfContents-BBAEZx6Z.js → TableOfContents-GPaHLa0x.js} +1 -1
  26. package/dist/esm/Tooltip-DZbA_43G.js +1 -0
  27. package/dist/esm/UserCodeEditor-D_rQzIU2.js +61 -0
  28. package/dist/esm/VirtualizedRowsFixed-BgL_awYQ.js +1 -0
  29. package/dist/esm/WorksheetAsSlides-B8zp1Rak.js +1 -0
  30. package/dist/esm/{WorksheetBodies-CO67-rEz.js → WorksheetBodies-Cr9jJtnr.js} +1 -1
  31. package/dist/esm/WorksheetContents-Y4b_IwYP.js +1 -0
  32. package/dist/esm/WorksheetEditor-BoecibGe.js +1 -0
  33. package/dist/esm/{WorksheetNode-BgNNzY8I.js → WorksheetNode-DTyHDssN.js} +1 -1
  34. package/dist/esm/WorksheetViewer-BkyLzOi4.js +1 -0
  35. package/dist/esm/abnfDiagram-WEYOIA3C-C_CVppQA.js +1 -0
  36. package/dist/esm/{arc-COK0VEkT.js → arc-vEmnBEcc.js} +1 -1
  37. package/dist/esm/architectureDiagram-ZHVYKT53-CCcP7rrg.js +1 -0
  38. package/dist/esm/blockDiagram-RJAE7QA3-DU8sn8Km.js +1 -0
  39. package/dist/esm/c4Diagram-XDPPPE54-DQFPX695.js +1 -0
  40. package/dist/esm/channel-5x2nMoMO.js +1 -0
  41. package/dist/esm/{chunk-2E7WHVMD-CVBqw5fR.js → chunk-2E7WHVMD-p2GM0eBD.js} +1 -1
  42. package/dist/esm/{chunk-2Q5K7J3B-CyZYeWxE.js → chunk-2Q5K7J3B-Cy8SGmP2.js} +1 -1
  43. package/dist/esm/{chunk-4EMNKR2T-D1yHHif8.js → chunk-4EMNKR2T-CyLGLodZ.js} +1 -1
  44. package/dist/esm/{chunk-55XCU76K-CvYWAV_o.js → chunk-55XCU76K-BN8xVJCh.js} +1 -1
  45. package/dist/esm/{chunk-5VM5RSS4-CS0kZLYA.js → chunk-5VM5RSS4-D3PGx3gp.js} +1 -1
  46. package/dist/esm/{chunk-JWPE2WC7-Ct5OBLCL.js → chunk-JWPE2WC7-BJAR6xMq.js} +1 -1
  47. package/dist/esm/{chunk-NQOKRVIF-D0-2mmH4.js → chunk-NQOKRVIF-fUehRCXZ.js} +1 -1
  48. package/dist/esm/{chunk-VQ5W62QI-CsGo0PTx.js → chunk-VQ5W62QI-mHHsR0s0.js} +1 -1
  49. package/dist/esm/{chunk-XXDRQBXY-DPPGTM3w.js → chunk-XXDRQBXY-DLLBlZjr.js} +1 -1
  50. package/dist/esm/{chunk-ZCHMQSOR-Bvjutmxm.js → chunk-ZCHMQSOR-t517tTkb.js} +1 -1
  51. package/dist/esm/classDiagram-v2-4MYWR3UA-CrNA_w1s.js +1 -0
  52. package/dist/esm/{commons-iref2pEJ.js → commons-BLDufAOm.js} +1 -1
  53. package/dist/esm/constants.js +1 -1
  54. package/dist/esm/cose-bilkent-JH36ORCC-DTawllqu.js +1 -0
  55. package/dist/esm/cynefinDiagram-WF24UDRP-DWwhOkSi.js +1 -0
  56. package/dist/esm/dagre-NK4GIZVX-Jm0gIaFX.js +1 -0
  57. package/dist/esm/diagram-CBK3MWTC-CcOs3Ceh.js +1 -0
  58. package/dist/esm/diagram-I5XIIV2D-BBh0FWXm.js +1 -0
  59. package/dist/esm/diagram-ODIL2UCW-BlztNr6r.js +1 -0
  60. package/dist/esm/diagram-PFBEJUXE-DtRoe0ng.js +1 -0
  61. package/dist/esm/diagram-RJA3I4VV-LdjGFjBw.js +1 -0
  62. package/dist/esm/diagram-TYUNFSNR-D8WXXh7g.js +1 -0
  63. package/dist/esm/ebnfDiagram-V4P3TTPT-DESDKr7D.js +1 -0
  64. package/dist/esm/elk-QONTBCTQ-DDBz4veG.js +1 -0
  65. package/dist/esm/enums.js +1 -1
  66. package/dist/esm/erDiagram-KYQIGQAA-CBg-NMBs.js +1 -0
  67. package/dist/esm/flowDiagram-IUGLLWBU-BytjhPBX.js +1 -0
  68. package/dist/esm/ganttDiagram-R7GPNTJY-BKQtPa2l.js +1 -0
  69. package/dist/esm/gitGraphDiagram-PDYL7XHY-SgW1IIil.js +1 -0
  70. package/dist/esm/helpers.js +1 -1
  71. package/dist/esm/index-38k9tHSo.js +1 -0
  72. package/dist/esm/index-3QSNRp1k.js +1 -0
  73. package/dist/esm/{index-B5Soolr4.js → index-CEgC-P3H.js} +1 -1
  74. package/dist/esm/{index-70SVfF-m.js → index-D954khxt.js} +1 -1
  75. package/dist/esm/{index-DkZReaeM.js → index-yFCV1i1-.js} +1 -1
  76. package/dist/esm/infoDiagram-MVDRKAX5-DfklDIw_.js +1 -0
  77. package/dist/esm/ishikawaDiagram-HPEHV2GE-BgFDqFFr.js +1 -0
  78. package/dist/esm/journeyDiagram-BOSHW7O7-DMgZlI3B.js +1 -0
  79. package/dist/esm/kanban-definition-FNSA4HC5-6nGtZdla.js +1 -0
  80. package/dist/esm/main.js +1 -1
  81. package/dist/esm/{mermaid.core-DRk6tt5W.js → mermaid.core-VF3HuzPL.js} +2 -2
  82. package/dist/esm/mindmap-definition-6OY57UG3-CldUD6qU.js +1 -0
  83. package/dist/esm/pegDiagram-ECIUJNBX-CxOzmAR6.js +1 -0
  84. package/dist/esm/pieDiagram-GNMPY74T-CVzFNxbL.js +1 -0
  85. package/dist/esm/quadrantDiagram-D57K4MC3-zu8PK3sn.js +1 -0
  86. package/dist/esm/railroadDiagram-Y72NRBL7-32O5vSNO.js +1 -0
  87. package/dist/esm/requirementDiagram-EQYSW5RA-y8y1LAQQ.js +1 -0
  88. package/dist/esm/sankeyDiagram-SY24JHO5-B6RN54HY.js +1 -0
  89. package/dist/esm/sequenceDiagram-BLEHNHQU-x0406cvr.js +1 -0
  90. package/dist/esm/server.js +1 -1
  91. package/dist/esm/settings-6x4qNkNZ.js +1 -0
  92. package/dist/esm/settings.js +1 -1
  93. package/dist/esm/sizeCapture-INFHLROL--wG_Awhp.js +1 -0
  94. package/dist/esm/stateDiagram-v2-A6IESKWZ-BO6rHKAj.js +1 -0
  95. package/dist/esm/swimlanes-B3ENRKFQ-Bn5D5Wx7.js +1 -0
  96. package/dist/esm/swimlanesDiagram-AYQRV4AK-Ba9zNATm.js +1 -0
  97. package/dist/esm/timeline-definition-JXYKGLGB-BEJjWLZB.js +1 -0
  98. package/dist/esm/{types-DsZvEANP.js → types-B-kh3Oeb.js} +1 -1
  99. package/dist/esm/usecaseDiagram-WPOLBNNX-RyH7DcwX.js +1 -0
  100. package/dist/esm/vennDiagram-Q3Y3IDCW-CxTrhG-i.js +1 -0
  101. package/dist/esm/wardleyDiagram-IVAIDKWA-pBsrgWov.js +1 -0
  102. package/dist/esm/websocket-D79arGLt.js +1 -0
  103. package/dist/esm/xychartDiagram-4URNHDU4-CA9STbh6.js +1 -0
  104. package/dist/module-types/src/components/helpers/problem.d.ts +1 -1
  105. package/dist/module-types/src/components/helpers/websocket.d.ts +3 -11
  106. package/dist/module-types/src/components/hooks/useInjectOrganizationStyles.d.ts +1 -0
  107. package/dist/module-types/src/components/hooks/useJudge.d.ts +2 -2
  108. package/dist/module-types/src/components/hooks/useJukiUser.d.ts +17 -17
  109. package/dist/module-types/src/components/hooks/useOrganizationPresence.d.ts +18 -0
  110. package/dist/module-types/src/components/hooks/useOwnPresence.d.ts +5 -0
  111. package/dist/module-types/src/components/hooks/useSubscribe.d.ts +2 -2
  112. package/dist/module-types/src/components/molecules/LinkLastPath/types.d.ts +1 -1
  113. package/dist/module-types/src/components/organisms/HorizontalMenu/MenuParts.d.ts +19 -0
  114. package/dist/module-types/src/components/organisms/LoginUser/LoginUser.d.ts +3 -1
  115. package/dist/module-types/src/components/organisms/ProblemSelector/ProblemSelector.d.ts +1 -1
  116. package/dist/module-types/src/components/organisms/ProblemSelector/types.d.ts +4 -4
  117. package/dist/module-types/src/components/organisms/SubmitView/commons/SubmissionListenerVerdict.d.ts +2 -2
  118. package/dist/module-types/src/components/organisms/SubmitView/commons/SubmissionVerdict.d.ts +3 -3
  119. package/dist/module-types/src/components/organisms/SubmitView/commons/SubmitViewContent.d.ts +2 -2
  120. package/dist/module-types/src/components/organisms/UserChip/types.d.ts +2 -2
  121. package/dist/module-types/src/components/organisms/UserNicknameLink/UserNicknameLink.d.ts +1 -1
  122. package/dist/module-types/src/components/organisms/UsersSelector/types.d.ts +3 -3
  123. package/dist/module-types/src/components/organisms/_layz_/DataViewer/JkContestTableTest/MockJkContestTable.d.ts +2 -2
  124. package/dist/module-types/src/components/organisms/_layz_/DataViewer/JkProblemTableTest/MockJkProblemTable.d.ts +2 -2
  125. package/dist/module-types/src/components/organisms/_layz_/DataViewer/JkSubmissionsTableTest/MockJkSubmissionTable.d.ts +2 -2
  126. package/dist/module-types/src/components/organisms/_layz_/WorksheetAsSlides/types.d.ts +2 -2
  127. package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/ResultHeader.d.ts +2 -2
  128. package/dist/module-types/src/components/organisms/_layz_/WorksheetViewer/types.d.ts +2 -2
  129. package/dist/module-types/src/components/organisms/modals/ImageUploaderModal/PublicImagesTab/PublicImages.d.ts +2 -2
  130. package/dist/module-types/src/components/organisms/modals/LoginModal/LoginModal.d.ts +1 -1
  131. package/dist/module-types/src/components/organisms/modals/LoginModal/LoginModalTemplate/types.d.ts +2 -2
  132. package/dist/module-types/src/components/organisms/modals/LoginModal/types.d.ts +1 -1
  133. package/dist/module-types/src/components/organisms/modals/UserPreviewModal/UserPreviewContentModal.d.ts +4 -4
  134. package/dist/module-types/src/components/providers/JukiAblyInitializer/JukiAblyInitializer.d.ts +1 -1
  135. package/dist/module-types/src/components/providers/JukiUIProvider/JukiUIProvider.d.ts +1 -1
  136. package/dist/module-types/src/components/providers/JukiUIProvider/types.d.ts +2 -2
  137. package/dist/module-types/src/components/providers/JukiUserProvider/types.d.ts +4 -4
  138. package/dist/module-types/src/components/templates/ContestNameLinkField/types.d.ts +3 -3
  139. package/dist/module-types/src/components/templates/EditProfileModal/ImageProfileModal.d.ts +1 -1
  140. package/dist/module-types/src/components/templates/EditProfileModal/types.d.ts +5 -5
  141. package/dist/module-types/src/components/templates/MainMenu/SettingsSection/index.d.ts +1 -1
  142. package/dist/module-types/src/components/templates/MainMenu/types.d.ts +1 -1
  143. package/dist/module-types/src/components/templates/ProblemView/commons/ProblemCodeEditor.d.ts +2 -2
  144. package/dist/module-types/src/components/templates/ProblemView/types.d.ts +3 -3
  145. package/dist/module-types/src/components/templates/ResetPasswordModal/ResetPasswordModal.d.ts +1 -1
  146. package/dist/module-types/src/components/templates/ResetPasswordModal/types.d.ts +1 -1
  147. package/dist/module-types/src/components/templates/UserProfile/types.d.ts +3 -3
  148. package/dist/module-types/src/components/templates/UserProfileSettings/types.d.ts +2 -2
  149. package/dist/module-types/src/components/templates/UserViewLayout/types.d.ts +2 -2
  150. package/dist/module-types/src/components/templates/columns/contest-columns/getContestContestantsHeader.d.ts +2 -2
  151. package/dist/module-types/src/components/templates/columns/contest-columns/getContestDateHeader.d.ts +2 -2
  152. package/dist/module-types/src/components/templates/columns/contest-columns/getContestNameHeader.d.ts +2 -2
  153. package/dist/module-types/src/components/templates/columns/contest-columns/getContestStatusHeader.d.ts +2 -2
  154. package/dist/module-types/src/components/templates/columns/contest-columns/getContestTagsHeader.d.ts +2 -2
  155. package/dist/module-types/src/components/templates/columns/problem-columns/getProblemAdminActionsHeader.d.ts +2 -2
  156. package/dist/module-types/src/components/templates/columns/problem-columns/getProblemKeyHeader.d.ts +2 -2
  157. package/dist/module-types/src/components/templates/columns/problem-columns/getProblemModeHeader.d.ts +2 -2
  158. package/dist/module-types/src/components/templates/columns/problem-columns/getProblemNameHeader.d.ts +2 -2
  159. package/dist/module-types/src/components/templates/columns/problem-columns/getProblemOwnerHeader.d.ts +2 -2
  160. package/dist/module-types/src/components/templates/columns/problem-columns/getProblemTagsHeader.d.ts +2 -2
  161. package/dist/module-types/src/components/templates/columns/problem-columns/getProblemTypeHeader.d.ts +2 -2
  162. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionContestHeader.d.ts +2 -2
  163. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionContestProblemHeader.d.ts +3 -3
  164. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionDateHeader.d.ts +2 -2
  165. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionLanguageHeader.d.ts +2 -2
  166. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionMemoryHeader.d.ts +2 -2
  167. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionNicknameHeader.d.ts +2 -2
  168. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionProblemHeader.d.ts +3 -3
  169. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionRejudgeHeader.d.ts +2 -2
  170. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionTimeHeader.d.ts +2 -2
  171. package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionVerdictHeader.d.ts +2 -2
  172. package/dist/module-types/src/components/templates/members/DocumentMembersModal/DocumentMembersModal.d.ts +2 -2
  173. package/dist/module-types/src/components/templates/members/types.d.ts +6 -6
  174. package/dist/module-types/src/components/templates/problem/ProblemCrawlerField.d.ts +1 -1
  175. package/dist/module-types/src/components/templates/problem/ProblemOwnerField.d.ts +1 -1
  176. package/dist/module-types/src/components/templates/problem/types.d.ts +10 -10
  177. package/dist/module-types/src/components/templates/submission/SubmissionNicknameField.d.ts +1 -1
  178. package/dist/module-types/src/components/templates/submission/types.d.ts +9 -9
  179. package/dist/module-types/src/components/types/index.d.ts +6 -6
  180. package/dist/module-types/src/constants/index.d.ts +2 -2
  181. package/dist/module-types/src/enums/index.d.ts +1 -1
  182. package/dist/module-types/src/hooks/index.d.ts +2 -1
  183. package/dist/module-types/src/settings/ApiManager.d.ts +77 -101
  184. package/dist/module-types/src/settings/AppRoutes.d.ts +2 -2
  185. package/dist/module-types/src/stores/websocket/topicChannels.d.ts +17 -5
  186. package/dist/module-types/src/stores/websocket/types.d.ts +4 -8
  187. package/package.json +5 -5
  188. package/dist/esm/ArrowForwardIcon-DelUFdaJ.js +0 -1
  189. package/dist/esm/BarChart-D2X8Qu4u.js +0 -1
  190. package/dist/esm/ChangePasswordModal-yc4D7RMs.js +0 -1
  191. package/dist/esm/CodeEditor-Dxp5QnTB.js +0 -1
  192. package/dist/esm/CodeViewer-BSZXIngC.js +0 -1
  193. package/dist/esm/Collapse-D-w5SKss.js +0 -1
  194. package/dist/esm/DataViewer-DVVGkDSK.js +0 -1
  195. package/dist/esm/DrawerView-DCRvckZd.js +0 -1
  196. package/dist/esm/ExcalidrawButton-_a-eNbyb.js +0 -1
  197. package/dist/esm/GraphvizViewer-B2-JVx0t.js +0 -1
  198. package/dist/esm/ImageLoaderCropper-wV-hPOjq.js +0 -1
  199. package/dist/esm/InputCellPhoneNumber-Bcl22QsC.js +0 -1
  200. package/dist/esm/LineChart-ByKPkVhP.js +0 -1
  201. package/dist/esm/MdMath-DljkRDxR.js +0 -1
  202. package/dist/esm/ReplyIcon-BNYBKbgb.js +0 -1
  203. package/dist/esm/SlideDeck-C0n93gz0.js +0 -1
  204. package/dist/esm/Tooltip-DB0S1ErV.js +0 -1
  205. package/dist/esm/UserCodeEditor-B1d5gyVE.js +0 -61
  206. package/dist/esm/VirtualizedRowsFixed-ChX4ON0l.js +0 -1
  207. package/dist/esm/WorksheetAsSlides-CpiXbUML.js +0 -1
  208. package/dist/esm/WorksheetContents-ClZpiXB-.js +0 -1
  209. package/dist/esm/WorksheetEditor-CjAvgOx6.js +0 -1
  210. package/dist/esm/WorksheetViewer-DVQitUzi.js +0 -1
  211. package/dist/esm/abnfDiagram-WEYOIA3C-CwJ1V2U1.js +0 -1
  212. package/dist/esm/architectureDiagram-ZHVYKT53-CM6AQFKG.js +0 -1
  213. package/dist/esm/blockDiagram-RJAE7QA3-CdSNo9Pe.js +0 -1
  214. package/dist/esm/c4Diagram-XDPPPE54-BhfYKASq.js +0 -1
  215. package/dist/esm/channel-DWjyymG_.js +0 -1
  216. package/dist/esm/classDiagram-v2-4MYWR3UA-J_cOAAHS.js +0 -1
  217. package/dist/esm/cose-bilkent-JH36ORCC-BHzp2aV0.js +0 -1
  218. package/dist/esm/cynefinDiagram-WF24UDRP-B3Y9mCh3.js +0 -1
  219. package/dist/esm/dagre-NK4GIZVX-BSfh-C_i.js +0 -1
  220. package/dist/esm/diagram-CBK3MWTC-w-BT1S7I.js +0 -1
  221. package/dist/esm/diagram-I5XIIV2D-wMqo87b_.js +0 -1
  222. package/dist/esm/diagram-ODIL2UCW-DQhUXqDu.js +0 -1
  223. package/dist/esm/diagram-PFBEJUXE-BlCntZMJ.js +0 -1
  224. package/dist/esm/diagram-RJA3I4VV-Cev21A9i.js +0 -1
  225. package/dist/esm/diagram-TYUNFSNR-BiiLNoPs.js +0 -1
  226. package/dist/esm/ebnfDiagram-V4P3TTPT-BWNnHl88.js +0 -1
  227. package/dist/esm/elk-QONTBCTQ-DhvgoeNg.js +0 -1
  228. package/dist/esm/erDiagram-KYQIGQAA-DkFGw08p.js +0 -1
  229. package/dist/esm/flowDiagram-IUGLLWBU-B-Bxdnen.js +0 -1
  230. package/dist/esm/ganttDiagram-R7GPNTJY-Bvr90Acy.js +0 -1
  231. package/dist/esm/gitGraphDiagram-PDYL7XHY-DHszoB7b.js +0 -1
  232. package/dist/esm/index-2PTQqTnK.js +0 -1
  233. package/dist/esm/index-BpcqEzEG.js +0 -1
  234. package/dist/esm/infoDiagram-MVDRKAX5-D05SjyVf.js +0 -1
  235. package/dist/esm/ishikawaDiagram-HPEHV2GE-50RQ8Owd.js +0 -1
  236. package/dist/esm/journeyDiagram-BOSHW7O7-DnHu8DYt.js +0 -1
  237. package/dist/esm/kanban-definition-FNSA4HC5-BF3y0Q5O.js +0 -1
  238. package/dist/esm/mindmap-definition-6OY57UG3-D2VvQCn5.js +0 -1
  239. package/dist/esm/pegDiagram-ECIUJNBX-LCa_e2vp.js +0 -1
  240. package/dist/esm/pieDiagram-GNMPY74T-BFxRc695.js +0 -1
  241. package/dist/esm/quadrantDiagram-D57K4MC3-m-v5Oved.js +0 -1
  242. package/dist/esm/railroadDiagram-Y72NRBL7-CGhQNkt2.js +0 -1
  243. package/dist/esm/requirementDiagram-EQYSW5RA-D4TUJX2j.js +0 -1
  244. package/dist/esm/sankeyDiagram-SY24JHO5-qeunG13D.js +0 -1
  245. package/dist/esm/sequenceDiagram-BLEHNHQU-Bf8dSGiP.js +0 -1
  246. package/dist/esm/settings-CBGV-lz3.js +0 -1
  247. package/dist/esm/sizeCapture-INFHLROL-B0tQoQkY.js +0 -1
  248. package/dist/esm/stateDiagram-v2-A6IESKWZ-D-bM5qVN.js +0 -1
  249. package/dist/esm/swimlanes-B3ENRKFQ-DR9euVhL.js +0 -1
  250. package/dist/esm/swimlanesDiagram-AYQRV4AK-D0-BBYnj.js +0 -1
  251. package/dist/esm/timeline-definition-JXYKGLGB-ChsOD2es.js +0 -1
  252. package/dist/esm/usecaseDiagram-WPOLBNNX-DZFg1Zof.js +0 -1
  253. package/dist/esm/vennDiagram-Q3Y3IDCW-DAW-dDy7.js +0 -1
  254. package/dist/esm/wardleyDiagram-IVAIDKWA-B-gsebc8.js +0 -1
  255. package/dist/esm/websocket-CdeP8N_S.js +0 -1
  256. package/dist/esm/xychartDiagram-4URNHDU4-DS3Qm0VA.js +0 -1
  257. package/dist/module-types/src/components/hooks/useClientTrackLocation.d.ts +0 -1
  258. package/dist/module-types/src/components/hooks/useInjectCompanyStyles.d.ts +0 -1
@@ -0,0 +1 @@
1
+ const e=[];for(let t=0;t<256;++t)e.push((t+256).toString(16).slice(1));const t=new Uint8Array(16);function a(a,s,o){return crypto.randomUUID?crypto.randomUUID():function(a){a=a||{};const s=a.random??a.rng?.()??crypto.getRandomValues(t);if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=15&s[6]|64,s[8]=63&s[8]|128,function(t,a=0){return(e[t[a+0]]+e[t[a+1]]+e[t[a+2]]+e[t[a+3]]+"-"+e[t[a+4]]+e[t[a+5]]+"-"+e[t[a+6]]+e[t[a+7]]+"-"+e[t[a+8]]+e[t[a+9]]+"-"+e[t[a+10]]+e[t[a+11]]+e[t[a+12]]+e[t[a+13]]+e[t[a+14]]+e[t[a+15]]).toLowerCase()}(s)}(a)}var s,o,n,l,r,R,i,E,u,c,m,d,_,S,T,A,p,I,N,C,O,g,h,D,f,P,b;!function(e){e.NEWSLETTER_SUBSCRIPTION="newsletterSubscription",e.LANGUAGE="preferredLanguage",e.THEME="preferredTheme",e.DATA_VIEW_MODE="preferredDataViewMode",e.MENU_VIEW_MODE="preferredMenuViewMode",e.TIME_ZONE="preferredTimeZone",e.FONT_SIZE="preferredFontSize"}(s||(s={})),function(e){e.NONE="NONE",e.COURSE="COURSE",e.WORKSHEET="WORKSHEET",e.CONTEST="CONTEST"}(o||(o={})),function(e){e.C_11="c11",e.CPP_11="cpp11",e.CPP_20="cpp20",e.JAVA_21="java21",e.PYTHON_3="python3",e.PYTHON_PYPY_3="pypy3",e.JAVASCRIPT_NODE_JS_22="nodejs22",e.PYTHON_2="python2",e.PYTHON_PYPY_2="pypy2",e.ICPC_C="ICPC_C",e.C="C",e.CPP="CPP",e.ICPC_CPP="ICPC_CPP",e.CPP11="CPP11",e.CPP14="CPP14",e.CPP17="CPP17",e.JAVA="JAVA",e.ICPC_PYTHON="ICPC_PYTHON",e.PYTHON="PYTHON",e.PYTHON2="PYTHON2",e.PYTHON3="PYTHON3",e.JAVASCRIPT="JAVASCRIPT",e.TYPESCRIPT="TYPESCRIPT",e.JSX="JSX",e.TSX="TSX",e.MDX="MDX",e.PSEUDOCODE_PSEINT="PSEUDOCODE_PSEINT",e.LATEX="LATEX",e.JSON="JSON",e.HTML="HTML",e.TEXT="TEXT",e.DIFF="DIFF",e.MARKDOWN="MARKDOWN",e.ARDUINO="ARDUINO",e.DOT="DOT",e.MERMAID="MERMAID",e.BASH="BASH"}(n||(n={})),function(e){e.USER="USER",e.PROBLEM="PROBLEM",e.CONTEST="CONTEST",e.ATTEMPT="ATTEMPT"}(l||(l={})),function(e){e.SUCCESS="SUCCESS",e.ERROR="ERROR",e.LOADING="LOADING",e.NONE="NONE"}(r||(r={})),function(e){e.PUBLIC="PUBLIC",e.RESERVED="RESERVED",e.PRIVATE="PRIVATE",e.ARCHIVED="ARCHIVED"}(R||(R={})),function(e){e.PRIVATE="PRIVATE",e.RESTRICTED="RESTRICTED",e.PUBLIC="PUBLIC",e.EXPOSED="EXPOSED"}(i||(i={})),function(e){e.FREE="FREE",e.STANDARD="STANDARD",e.PREMIUM="PREMIUM",e.CUSTOM="CUSTOM"}(E||(E={})),function(e){e.HORIZONTAL_WHITE="horizontal-white",e.HORIZONTAL_COLOR="horizontal-color",e.VERTICAL_WHITE="vertical-white",e.VERTICAL_COLOR="vertical-color"}(u||(u={})),function(e){e.PUBLIC="PUBLIC",e.RESERVED="RESERVED",e.ARCHIVED="ARCHIVED"}(c||(c={})),function(e){e.UPCOMING="upcoming",e.LIVE="live",e.PAST="past"}(m||(m={})),function(e){e.INDIVIDUALLY="INDIVIDUALLY",e.CONTEST="CONTEST"}(d||(d={})),function(e){e.DATA_UPDATE="DATA_UPDATE",e.SCOREBOARD_RECALCULATE="SCOREBOARD_RECALCULATE",e.SCOREBOARD_UNLOCK="SCOREBOARD_UNLOCK",e.SCOREBOARD_LOCK="SCOREBOARD_LOCK",e.ENABLE_UPSOLVING="ENABLE_UPSOLVING",e.DISABLE_UPSOLVING="DISABLE_UPSOLVING",e.PARTICIPANT_JOIN="PARTICIPANT_JOIN"}(_||(_={})),function(e){e.NONE="NONE",e.CLOSE="CLOSE",e.OPEN="OPEN"}(S||(S={})),function(e){e.RELEASED="RELEASED",e.ARCHIVED="ARCHIVED"}(T||(T={})),function(e){e.ORGANIZATION="ORGANIZATION",e.PROBLEM="PROBLEM",e.CONTEST="CONTEST",e.JUDGE="JUDGE",e.USER="USER",e.SUBMISSION="SUBMISSION"}(A||(A={})),function(e){e.ORGANIZATION="C",e.USER="U",e.PROBLEM="P",e.CLASS="K",e.CLASS_ASSIGNMENT="KA",e.CONTEST="T",e.SCOREBOARD="B",e.SCOREBOARD_EVENTS="BE",e.COURSE="R",e.FILE="F",e.GROUP="G",e.JUDGE="J",e.WORKSHEET="W",e.WORKSHEET_SUBMISSIONS="WS",e.SUBMIT="S",e.LOCALE="L",e.COMMENT="M",e.EXCALIDRAW="E",e.MARKDOWN="MD",e.DOCUMENT_TEMPLATE="DT",e.MERMAID="MM"}(p||(p={})),function(e){e.REMOVE="REMOVE",e.ADD="ADD",e.UPDATE="UPDATE"}(I||(I={})),function(e){e.VIEWER="VIEWER",e.EDITOR="EDITOR"}(N||(N={})),function(e){e.FOLDER="FOLDER",e.FILE="FILE"}(C||(C={})),function(e){e.SHARED="shared",e.SHARED_EXCALIDRAW="shared/E",e.TEMP="temp",e.PROBLEMS="problems",e.CONTESTS="contests"}(O||(O={})),function(e){e.CLASS="CLASS",e.TEAM="TEAM"}(g||(g={})),function(e){e.JUKI_JUDGE="JUKI_JUDGE",e.CODEFORCES="CODEFORCES",e.CODEFORCES_GYM="CODEFORCES_GYM",e.JV_UMSA="JV_UMSA",e.UVA_ONLINE_JUDGE="UVA_ONLINE_JUDGE",e.AT_CODER="AT_CODER",e.CODECHEF="CODECHEF",e.TOPCODER="TOPCODER",e.LEETCODE="LEETCODE"}(h||(h={})),function(e){e.NONE="NONE",e.PENDING="PENDING",e.HIDDEN="HIDDEN",e.CE="CE",e.RE="RE",e.TLE="TLE",e.MLE="MLE",e.WA="WA",e.PE="PE",e.PA="PA",e.AC="AC"}(D||(D={})),function(e){e.NONE="NONE",e.RECEIVED="RECEIVED",e.COMPILING="COMPILING",e.COMPILED="COMPILED",e.COMPILATION_ERROR="COMPILATION_ERROR",e.FETCHING_TEST_CASES="FETCHING_TEST_CASES",e.RUNNING_TEST_CASE="RUNNING_TEST_CASE",e.RUNNING_TEST_CASES="RUNNING_TEST_CASES",e.RUNNING_SAMPLE_TEST_CASES="RUNNING_SAMPLE_TEST_CASES",e.EXECUTED_TEST_CASE="EXECUTED_TEST_CASE",e.FAILED_TEST_CASE="FAILED_TEST_CASE",e.JUDGING_TEST_CASE="JUDGING_TEST_CASE",e.GRADING="GRADING",e.FAILED="FAILED",e.COMPLETED="COMPLETED"}(f||(f={})),function(e){e.HIGH_PERFORMANCE="HIGH_PERFORMANCE",e.LOW_PERFORMANCE="LOW_PERFORMANCE"}(P||(P={})),function(e){e.SUCCESS="success",e.INFO="info",e.WARNING="warning",e.ERROR="error",e.QUIET="quiet"}(b||(b={}));const v={ES:"ES",EN:"EN"},U={LIGHT:"LIGHT",DARK:"DARK"};var M,L,y,F,B,x,G,w,V,H,K,j,J,k,W,Y,X,z;!function(e){e.INPUT="INPUT",e.OUTPUT="OUTPUT"}(M||(M={})),function(e){e.STANDARD="STANDARD",e.INTERACTIVE="INTERACTIVE"}(L||(L={})),function(e){e.STANDARD="STANDARD",e.DYNAMIC="DYNAMIC",e.INTERACTIVE="INTERACTIVE"}(y||(y={})),function(e){e.STANDARD="STANDARD",e.DYNAMIC="DYNAMIC",e.INTERACTIVE="INTERACTIVE"}(F||(F={})),function(e){e.SUBTASK="SUBTASK",e.TOTAL="TOTAL",e.PARTIAL="PARTIAL"}(B||(B={})),function(e){e.ERR400="ERR400",e.ERR401="ERR401",e.ERR403="ERR403",e.ERR404="ERR404",e.ERR405="ERR405",e.ERR500="ERR500",e.ERR9997="ERR9997",e.ERR9998="ERR9998",e.ERR9999="ERR9999",e.ERR0000="ERR0000",e.ERR0010="ERR0010",e.ERR0011="ERR0011",e.ERR0012="ERR0012",e.ERR0013="ERR0013",e.ERR0014="ERR0014",e.ERR0015="ERR0015",e.ERR0016="ERR0016",e.ERR0017="ERR0017",e.ERR0018="ERR0018",e.ERR0019="ERR0019",e.ERR0020="ERR0020",e.ERR0021="ERR0021",e.ERR0022="ERR0022",e.ERR0023="ERR0023",e.ERR0024="ERR0024",e.ERR0050="ERR0050",e.ERR0051="ERR0051",e.ERR0052="ERR0052",e.ERR0053="ERR0053",e.ERR0100="ERR0100",e.ERR0110="ERR0110",e.ERR0111="ERR0111",e.ERR0112=" ERR0112",e.ERR0113="ERR0113",e.ERR0114="ERR0114",e.ERR0115="ERR0115",e.ERR0116="ERR0116",e.ERR0117="ERR0117",e.ERR0118="ERR0118",e.ERR0119="ERR0119",e.ERR0120="ERR0120",e.ERR0121="ERR0121",e.ERR0122="ERR0122",e.ERR0200="ERR0200",e.ERR0210="ERR0210",e.ERR0211="ERR0211",e.ERR0212="ERR0212",e.ERR0213="ERR0213",e.ERR0214="ERR0214",e.ERR0215="ERR0215",e.ERR0216="ERR0216",e.ERR0217="ERR0217",e.ERR0218="ERR0218",e.ERR0219="ERR0219",e.ERR0220="ERR0220",e.ERR0230="ERR0230",e.ERR0231="ERR0231",e.ERR0232="ERR0232",e.ERR0233="ERR0233",e.ERR0234="ERR0234",e.ERR0235="ERR0235",e.ERR0236="ERR0236",e.ERR0237="ERR0237",e.ERR0240="ERR0240",e.ERR0241="ERR0241",e.ERR0242="ERR0242",e.ERR0243="ERR0243",e.ERR0244="ERR0244",e.ERR0245="ERR0245",e.ERR0246="ERR0246",e.ERR0247="ERR0247",e.ERR0300="ERR0300",e.ERR0301="ERR0301",e.ERR0302="ERR0302",e.ERR0303="ERR0303",e.ERR0310="ERR0310",e.ERR0311="ERR0311",e.ERR0321="ERR0321",e.ERR0331="ERR0331",e.ERR0400="ERR0400",e.ERR0410="ERR0410",e.ERR0420="ERR0420",e.ERR0421="ERR0421",e.ERR0430="ERR0430",e.ERR0440="ERR0440",e.ERR0600="ERR0600",e.ERR0610="ERR0610",e.ERR0611="ERR0611",e.ERR0612="ERR0612",e.ERR0613="ERR0613",e.ERR0614="ERR0614",e.ERR0615="ERR0615",e.ERR0616="ERR0665",e.ERR0617="ERR0617",e.ERR0618="ERR0618",e.ERR0619="ERR0619",e.ERR0800="ERR0800",e.ERR0810="ERR0810",e.ERR0811="ERR0811",e.ERR0812="ERR0812",e.ERR0813="ERR0813",e.ERR0814="ERR0814",e.ERR0815="ERR0815",e.ERR0816="ERR0865",e.ERR0817="ERR0817",e.ERR0818="ERR0818",e.ERR0819="ERR0819",e.ERR0820="ERR0820",e.ERR9900="ERR9900",e.ERR9910="ERR9910",e.ERR9911="ERR9911",e.ERR9912="ERR9912",e.ERR9913="ERR9913",e.ERR9914="ERR9914",e.ERR9915="ERR9915",e.ERR9916="ERR9916",e.ERR9917="ERR9917"}(x||(x={})),function(e){e.FATAL="FATAL",e.ERROR="ERROR",e.WARN="WARN",e.INFO="INFO",e.DEBUG="DEBUG",e.TRACE="TRACE"}(G||(G={})),function(e){e.POST="POST",e.GET="GET",e.PUT="PUT",e.PATCH="PATCH",e.DELETE="DELETE"}(w||(w={})),function(e){e.JK_MD="JK_MD",e.CODE_EDITOR="CODE_EDITOR",e.LIST="LIST",e.GRAPH="GRAPH",e.QUIZ_PROBLEM="QUIZ_PROBLEM",e.QUIZ_TEXT="QUIZ_TEXT",e.QUIZ_OPTIONS="QUIZ_OPTIONS",e.NEW_PAGE="NEW_PAGE"}(V||(V={})),function(e){e.TOTAL="TOTAL",e.PARTIAL="PARTIAL"}(H||(H={})),function(e){e.SUBSCRIBE_CODE_RUN_STATUS="SUBSCRIBE_CODE_RUN_STATUS",e.UNSUBSCRIBE_CODE_RUN_STATUS="UNSUBSCRIBE_CODE_RUN_STATUS",e.SUBSCRIBE_SUBMISSION_RUN_STATUS="SUBSCRIBE_SUBMISSION_RUN_STATUS",e.UNSUBSCRIBE_SUBMISSION_RUN_STATUS="UNSUBSCRIBE_SUBMISSION_RUN_STATUS",e.SUBSCRIBE_GET_DATA="SUBSCRIBE_GET_DATA",e.UNSUBSCRIBE_GET_DATA="SUBSCRIBE_GET_DATA",e.SUBSCRIBE_PROBLEM_CRAWLED="SUBSCRIBE_PROBLEM_CRAWLED",e.UNSUBSCRIBE_PROBLEM_CRAWLED="UNSUBSCRIBE_PROBLEM_CRAWLED",e.SUBSCRIBE_SUBMISSIONS_CRAWL="SUBSCRIBE_SUBMISSIONS_CRAWL",e.UNSUBSCRIBE_SUBMISSIONS_CRAWL="UNSUBSCRIBE_SUBMISSIONS_CRAWL",e.SUBSCRIBE_CONTEST_CHANGES="SUBSCRIBE_CONTEST_CHANGES",e.UNSUBSCRIBE_CONTEST_CHANGES="UNSUBSCRIBE_CONTEST_CHANGES",e.SUBSCRIBE_USER_NOTIFICATION="SUBSCRIBE_USER_NOTIFICATION",e.UNSUBSCRIBE_USER_NOTIFICATION="UNSUBSCRIBE_USER_NOTIFICATION"}(K||(K={})),function(e){e.CODE_RUN_STATUS="CODE_RUN_STATUS",e.SUBMISSION_RUN_STATUS="SUBMISSION_RUN_STATUS",e.USER_MESSAGE="USER_MESSAGE",e.SEND_DATA_="SEND_DATA_",e.SEND_DATA_ECS_TASK_DEFINITIONS_LIST="SEND_DATA_ECS_TASK_DEFINITIONS_LIST",e.SEND_DATA_ECS_TASKS_LIST="SEND_DATA_ECS_TASKS_LIST",e.SEND_DATA_EC2_INSTANCES_LIST="SEND_DATA_EC2_INSTANCES_LIST",e.SEND_DATA_SSM_SESSIONS_LIST="SEND_DATA_SSM_SESSIONS_LIST",e.SEND_DATA_RUN_COMMAND="SEND_DATA_RUN_COMMAND",e.PROBLEM_CRAWLED="PROBLEM_CRAWLED",e.SUBMISSIONS_CRAWL="SUBMISSIONS_CRAWL",e.CONTEST_CHANGES="CONTEST_CHANGES",e.USER_NOTIFICATION_="USER_NOTIFICATION_",e.USER_NOTIFICATION_SUBMISSION="USER_NOTIFICATION_SUBMISSION",e.USER_NOTIFICATION_CONTEST_CLARIFICATION="USER_NOTIFICATION_CONTEST_CLARIFICATION"}(j||(j={})),function(e){e.ADMINISTRATORS="administrators",e.MANAGERS="managers",e.PARTICIPANTS="participants",e.GUESTS="guests",e.SPECTATORS="spectators"}(J||(J={})),function(e){e.CARDS="CARDS",e.ROWS="ROWS"}(k||(k={})),function(e){e.HORIZONTAL="HORIZONTAL",e.VERTICAL="VERTICAL"}(W||(W={})),function(e){e.SUPER_ADMIN="SUPER_ADMIN",e.ADMIN="ADMIN",e.MASTER="MASTER",e.MANAGER="MANAGER",e.CREATOR="CREATOR",e.REGULAR="REGULAR",e.LIMITED="LIMITED",e.GUEST="GUEST",e.RESTRICTED="RESTRICTED"}(Y||(Y={})),function(e){e.NOTHING="NOTHING",e.SEND_SUBMISSION="SEND_SUBMISSION",e.TRACKING_SUBMISSION="TRACKING_SUBMISSION",e.CRAWLING_LANGUAGES="CRAWLING_LANGUAGES",e.CRAWLING_PROBLEM_DATA="CRAWLING_PROBLEM_DATA"}(X||(X={})),function(e){e.RATIO_21_9="21:9",e.RATIO_20_9="20:9",e.RATIO_16_9="16:9",e.RATIO_16_10="16:10",e.RATIO_3_2="3:2",e.RATIO_4_3="4:3",e.RATIO_5_4="5:4",e.RATIO_1_1="1:1"}(z||(z={}));const Z="javac 17.0.15",q="v20.19.2",Q="Python 3.11.2",$="Python 3.9.16 (7.3.11+dfsg-2+deb12u3, Dec 30 2024, 22:36:23)\n[PyPy 7.3.11 with GCC 12.2.0]",ee={mime:"text/x-csrc",mainFilename:"main.c",fileExtension:["c"],hasBuildFile:!0,executable:"gcc",executableVersion:"gcc (Debian 12.2.0-14+deb12u1) 12.2.0\nCopyright (C) 2022 Free Software Foundation, Inc.\nThis is free software; see the source for copying conditions. There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.",templateSourceCode:'#include <stdio.h>\n \nint main(void) {\n \n printf("Hello World\\n");\n \n return 0;\n}',monacoKey:"c",codeMirrorKey:"c",highlightJsKey:"c"},te={mime:"text/x-c++src",mainFilename:"main.cpp",fileExtension:["cpp","c++","cxx","cc"],hasBuildFile:!0,executable:"g++",executableVersion:"g++ (Debian 12.2.0-14+deb12u1) 12.2.0\nCopyright (C) 2022 Free Software Foundation, Inc.\nThis is free software; see the source for copying conditions. There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.",templateSourceCode:'#include <iostream>\n\nusing namespace std;\n\nint main() {\n \n cout << "Hello World" << endl;\n \n return 0;\n}',monacoKey:"cpp",codeMirrorKey:"cpp",highlightJsKey:"cpp"},ae={mime:"text/x-python",mainFilename:"main.py",fileExtension:["py"],hasBuildFile:!1,templateSourceCode:'print("Hello World\\n")',monacoKey:"python",codeMirrorKey:"python",highlightJsKey:"python"},se={[n.C_11]:{value:n.C_11,label:"C 11",compilePattern:"/usr/bin/jk-c11 -static -fno-optimize-sibling-calls -fno-strict-aliasing -DONLINE_JUDGE -fno-asm -lm -s -O2 -std=gnu11 -o {{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}",runPattern:"{{folder_path}}/{{compiled_file_name}}",...ee},[n.CPP_11]:{value:n.CPP_11,label:"C++ 11",compilePattern:"/usr/bin/jk-cpp11 -x c++ -static -DONLINE_JUDGE -lm -s -O2 -std=gnu++11 -o {{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}",runPattern:"{{folder_path}}/{{compiled_file_name}}",...te},[n.CPP_20]:{value:n.CPP_20,label:"C++ 20",compilePattern:"/usr/bin/jk-cpp20 -x c++ -static -DONLINE_JUDGE -lm -s -O2 -std=gnu++20 -o {{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}",runPattern:"{{folder_path}}/{{compiled_file_name}}",...te},[n.JAVA_21]:{value:n.JAVA_21,label:"Java 21",mime:"text/x-java",mainFilename:"Main.java",fileExtension:["java"],compilePattern:"/usr/bin/jk-javac -cp '.;*' {{folder_path}}/{{source_full_file_name}}",runPattern:"/usr/bin/jk-java -Xmx512M -Xss64M -DONLINE_JUDGE=true -Duser.language=en -Duser.region=US -Duser.variant=US -cp {{folder_path}} {{class_name}}",templateSourceCode:'class Main {\n public static void main (String[] args) {\n \n System.out.println("Hello World");\n \n }\n}',hasBuildFile:!0,executable:"java",executableVersion:Z,monacoKey:"java",codeMirrorKey:"java",highlightJsKey:"java"},[n.PYTHON_2]:{value:n.PYTHON_2,label:"Python 2 *",compilePattern:"/usr/bin/jk-python2 -m py_compile {{folder_path}}/{{source_full_file_name}}",runPattern:"/usr/bin/jk-python2 {{folder_path}}/{{source_full_file_name}}",executable:"python2",executableVersion:$,...ae},[n.PYTHON_3]:{value:n.PYTHON_3,label:"Python 3",compilePattern:"/usr/bin/jk-python3 -m py_compile {{folder_path}}/{{source_full_file_name}}",runPattern:"/usr/bin/jk-python3 {{folder_path}}/{{source_full_file_name}}",executable:"python3",executableVersion:$,...ae},[n.PYTHON_PYPY_2]:{value:n.PYTHON_PYPY_2,label:"PyPy 2 *",compilePattern:"/usr/bin/jk-pypy2 -m py_compile {{folder_path}}/{{source_full_file_name}}",runPattern:"/usr/bin/jk-pypy2 {{folder_path}}/{{source_full_file_name}}",executable:"pypy2",executableVersion:$,...ae},[n.PYTHON_PYPY_3]:{value:n.PYTHON_PYPY_3,label:"PyPy 3",compilePattern:"/usr/bin/jk-pypy3 -m py_compile {{folder_path}}/{{source_full_file_name}}",runPattern:"/usr/bin/jk-pypy3 {{folder_path}}/{{source_full_file_name}}",executable:"pypy3",executableVersion:$,...ae},[n.JAVASCRIPT_NODE_JS_22]:{value:n.JAVASCRIPT_NODE_JS_22,label:"Javascript Node.js 22",mime:"application/x-javascript",mainFilename:"main.js",fileExtension:["js"],compilePattern:"",runPattern:"/usr/bin/jk-node22 {{folder_path}}/{{source_full_file_name}}",templateSourceCode:'console.log("Hello World\\n")',hasBuildFile:!1,executable:"node",executableVersion:q,monacoKey:"javascript",codeMirrorKey:"javascript",highlightJsKey:"javascript"},[n.ICPC_C]:{value:n.ICPC_C,label:"ICPC C *",compilePattern:"gcc -x c -g -O2 -std=gnu11 -static -lm -o {{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}",runPattern:"{{folder_path}}/{{compiled_file_name}}",...ee},[n.C]:{value:n.C,label:"C *",compilePattern:"gcc -static -fno-optimize-sibling-calls -fno-strict-aliasing -DONLINE_JUDGE -fno-asm -lm -s -O2 -o {{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}",runPattern:"{{folder_path}}/{{compiled_file_name}}",...ee},[n.ICPC_CPP]:{value:n.ICPC_CPP,label:"ICPC C++ *",compilePattern:"g++ -x c++ -static -g -O2 -std=gnu++20 -o {{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}",runPattern:"{{folder_path}}/{{compiled_file_name}}",...te},[n.CPP]:{value:n.CPP,label:"C++ *",compilePattern:"g++ -x c++ -static -DONLINE_JUDGE -lm -s -O2 -o {{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}",runPattern:"{{folder_path}}/{{compiled_file_name}}",...te},[n.CPP11]:{value:n.CPP11,label:"C++ 11 *",compilePattern:"g++ -x c++ -static -DONLINE_JUDGE -lm -s -O2 -std=c++11 -o {{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}",runPattern:"{{folder_path}}/{{compiled_file_name}}",...te},[n.CPP14]:{value:n.CPP14,label:"C++ 14 *",compilePattern:"g++ -x c++ -static -DONLINE_JUDGE -lm -s -O2 -std=c++14 -o {{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}",runPattern:"{{folder_path}}/{{compiled_file_name}}",...te},[n.CPP17]:{value:n.CPP17,label:"C++ 17 *",compilePattern:"g++ -x c++ -static -DONLINE_JUDGE -lm -s -O2 -std=c++17 -o {{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}",runPattern:"{{folder_path}}/{{compiled_file_name}}",...te},[n.JAVA]:{value:n.JAVA,label:"Java *",mime:"text/x-java",mainFilename:"Main.java",fileExtension:["java"],compilePattern:"javac -cp '.;*' {{folder_path}}/{{source_full_file_name}}",runPattern:"/usr/lib/jvm/java-17-openjdk-amd64/bin/java -Xmx512M -Xss64M -DONLINE_JUDGE=true -Duser.language=en -Duser.region=US -Duser.variant=US -cp {{folder_path}} {{class_name}}",templateSourceCode:'class Main {\n public static void main (String[] args) {\n \n System.out.println("Hello World");\n \n }\n}',hasBuildFile:!0,executable:"javac",executableVersion:Z,monacoKey:"java",codeMirrorKey:"java",highlightJsKey:"java"},[n.ICPC_PYTHON]:{value:n.ICPC_PYTHON,label:"ICPC Python *",compilePattern:"pypy3 -m py_compile {{folder_path}}/{{source_full_file_name}}",runPattern:"/usr/bin/pypy3 {{folder_path}}/{{source_full_file_name}}",executable:"pypy3",executableVersion:$,...ae},[n.PYTHON]:{value:n.PYTHON,label:"Python *",compilePattern:"python3 -m py_compile {{folder_path}}/{{source_full_file_name}}",runPattern:"/usr/bin/python3 {{folder_path}}/{{source_full_file_name}}",executable:"python3",executableVersion:Q,...ae},[n.PYTHON2]:{value:n.PYTHON2,label:"Python 2 *",compilePattern:"python2 -m py_compile {{folder_path}}/{{source_full_file_name}}",runPattern:"/usr/bin/python2 {{folder_path}}/{{source_full_file_name}}",executable:"python",executableVersion:"Python 2.7.18",...ae},[n.PYTHON3]:{value:n.PYTHON3,label:"Python 3 *",compilePattern:"python3 -m py_compile {{folder_path}}/{{source_full_file_name}}",runPattern:"/usr/bin/python3 {{folder_path}}/{{source_full_file_name}}",executable:"python3",executableVersion:Q,...ae},[n.JAVASCRIPT]:{value:n.JAVASCRIPT,label:"Javascript *",mime:"application/x-javascript",mainFilename:"main.js",fileExtension:["js"],compilePattern:"",runPattern:"/usr/bin/node {{folder_path}}/{{source_full_file_name}}",templateSourceCode:'console.log("Hello World\\n")',hasBuildFile:!1,executable:"node",executableVersion:q,monacoKey:"javascript",codeMirrorKey:"javascript",highlightJsKey:"javascript"},[n.TYPESCRIPT]:{value:n.TYPESCRIPT,label:"Typescript *",mime:"application/x-typescript",mainFilename:"main.ts",fileExtension:["ts"],compilePattern:"",runPattern:"/usr/bin/node {{folder_path}}/{{source_full_file_name}}",templateSourceCode:'console.log("Hello World\\n")',hasBuildFile:!1,executable:"node",executableVersion:q,monacoKey:"typescript",codeMirrorKey:"typescript",highlightJsKey:"typescript"},[n.TSX]:{value:n.TSX,label:"TSX *",mime:"application/x-typescript",mainFilename:"main.tsx",fileExtension:["tsx"],compilePattern:"",runPattern:"/usr/bin/node {{folder_path}}/{{source_full_file_name}}",templateSourceCode:'console.log("Hello World\\n")',hasBuildFile:!1,executable:"node",executableVersion:q,monacoKey:"typescript",codeMirrorKey:"typescript",highlightJsKey:"typescript"},[n.JSX]:{value:n.JSX,label:"JSX *",mime:"application/x-javascript",mainFilename:"main.jsx",fileExtension:["jsx"],compilePattern:"",runPattern:"/usr/bin/node {{folder_path}}/{{source_full_file_name}}",templateSourceCode:'console.log("Hello World\\n")',hasBuildFile:!1,executable:"node",executableVersion:q,monacoKey:"javascript",codeMirrorKey:"javascript",highlightJsKey:"javascript"},[n.PSEUDOCODE_PSEINT]:{value:n.PSEUDOCODE_PSEINT,label:"Pseudo-código (PSeInt)",mime:"text/plain",mainFilename:"main.psc",fileExtension:["psc"],compilePattern:"jk-pseint {{folder_path}}/{{source_full_file_name}} --norun --nouser && jk-pseint {{folder_path}}/{{source_full_file_name}} --draw {{folder_path}}/{{source_full_file_name}}.psd && jk-psexport {{folder_path}}/{{source_full_file_name}}.psd {{folder_path}}/{{source_full_file_name}}.cpp --lang=cpp && g++ -x c++ -g -O2 -std=gnu++20 -static -o {{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}.cpp",runPattern:"{{folder_path}}/{{compiled_file_name}}",templateSourceCode:'Algoritmo HOLA_MUNDO\n\tImprimir "Hello World"\nFinAlgoritmo\n',hasBuildFile:!1,executable:"",executableVersion:"PSeInt 20230904-l64-wx3\nhttp://pseint.sourceforge.net\nby Pablo Novara (zaskar_84@yahoo.com.ar)\npsExport 20230904-l64-wx3\nhttp://pseint.sourceforge.net\nby Pablo Novara (zaskar_84@yahoo.com.ar)",monacoKey:"text",codeMirrorKey:"pseudocode-pseint",highlightJsKey:"plaintext"},[n.DOT]:{value:n.DOT,label:"DOT",mime:"text/vnd.graphviz",mainFilename:"diagram.dot",fileExtension:["dot"],compilePattern:"",runPattern:"",templateSourceCode:"digraph G {\n A -> B;\n B -> C;\n}",hasBuildFile:!1,executable:"",executableVersion:"",monacoKey:"dot",codeMirrorKey:"dot",highlightJsKey:"plaintext"},[n.MERMAID]:{value:n.MERMAID,label:"Mermaid",mime:"text/mermaid",mainFilename:"diagram.mmd",fileExtension:["mmd","mermaid"],compilePattern:"",runPattern:"",templateSourceCode:"graph TD\n A[Start] --\x3e B{Is it working?}\n B -- Yes --\x3e C[Great!]\n B -- No --\x3e D[Fix it]\n D --\x3e B\n",hasBuildFile:!1,executable:"",executableVersion:"",monacoKey:"mermaid",codeMirrorKey:"mermaid",highlightJsKey:"plaintext"},[n.JSON]:{value:n.JSON,label:"JSON",mime:"application/json",mainFilename:"main.json",fileExtension:["json"],compilePattern:"",runPattern:"",templateSourceCode:"{\n \n}",hasBuildFile:!1,executable:"",executableVersion:"",monacoKey:"json",codeMirrorKey:"javascript",highlightJsKey:"json"},[n.TEXT]:{value:n.TEXT,label:"plain text",mime:"text/plain",mainFilename:"main.txt",fileExtension:["txt","text","in","out"],compilePattern:"",runPattern:"",templateSourceCode:"",hasBuildFile:!1,executable:"",executableVersion:"",monacoKey:"text",codeMirrorKey:"text",highlightJsKey:"plaintext"},[n.DIFF]:{value:n.DIFF,label:"diff",mime:"text/plain",mainFilename:"main.patch",fileExtension:["diff","patch"],compilePattern:"",runPattern:"",templateSourceCode:"",hasBuildFile:!1,executable:"",executableVersion:"",monacoKey:"diff",codeMirrorKey:"diff",highlightJsKey:"diff"},[n.LATEX]:{value:n.LATEX,label:"LaTeX",mime:"application/x-latex",mainFilename:"main.tex",fileExtension:["tex"],compilePattern:"",runPattern:"",templateSourceCode:"",hasBuildFile:!1,executable:"",executableVersion:"",monacoKey:"latex",codeMirrorKey:"stex",highlightJsKey:"latex"},[n.MARKDOWN]:{value:n.MARKDOWN,label:"Markdown",mime:"text/plain",mainFilename:"main.md",fileExtension:["md"],compilePattern:"",runPattern:"",templateSourceCode:"# Hello World\n",hasBuildFile:!1,executable:"",executableVersion:"",monacoKey:"markdown",codeMirrorKey:"markdown",highlightJsKey:"markdown"},[n.MDX]:{value:n.MDX,label:"MDX",mime:"text/plain",mainFilename:"main.mdx",fileExtension:["mdx"],compilePattern:"",runPattern:"",templateSourceCode:"# Hello World\n",hasBuildFile:!1,executable:"",executableVersion:"",monacoKey:"markdown",codeMirrorKey:"markdown",highlightJsKey:"markdown"},[n.ARDUINO]:{value:n.ARDUINO,label:"Arduino",mime:"text/plain",mainFilename:"main.c",fileExtension:["c","cpp","pde","h","ino"],compilePattern:"",runPattern:"",templateSourceCode:"",hasBuildFile:!1,executable:"",executableVersion:"",monacoKey:"c",codeMirrorKey:"c",highlightJsKey:"c"},[n.HTML]:{value:n.HTML,label:"HTML",mime:"text/HTML",mainFilename:"index.html",fileExtension:["html"],compilePattern:"",runPattern:"",templateSourceCode:"",hasBuildFile:!1,executable:"",executableVersion:"",monacoKey:"html",codeMirrorKey:"html",highlightJsKey:"xml"},[n.BASH]:{value:n.BASH,label:"Bash",mime:"text/plain",mainFilename:"main.sh",fileExtension:["sh","bash"],compilePattern:"",runPattern:"",templateSourceCode:'#!/bin/bash\necho "Hello World"\n',hasBuildFile:!1,executable:"bash",executableVersion:"",monacoKey:"shell",codeMirrorKey:"shell",highlightJsKey:"bash"}},oe={VIVOS:[{color:"#FF0000",title:"Rojo"},{color:"#FF5900",title:"Rojo - Naranja"},{color:"#FF8600",title:"Naranja"},{color:"#FFBF00",title:"Ámbar"},{color:"#FFFF00",title:"Amarillo"},{color:"#A6FF00",title:"Lima o Verde limon"},{color:"#00FF8C",title:"Verde puro"},{color:"#00FF8C",title:"Verde cian"},{color:"#00FFFF",title:"Cian"},{color:"#0099FF",title:"Cerúleo o Azur"},{color:"#0000FF",title:"Azul"},{color:"#9F00FF",title:"Violeta"},{color:"#FF00FF",title:"Magenta"},{color:"#FF0099",title:"Fucsia"}],OSCUROS:[{color:"#880000",title:"Granate"},{color:"#882F00",title:"Caoba o Rojo indio"},{color:"#884700",title:"Marrón o Pardo"},{color:"#886600",title:"Marrón dorado"},{color:"#888800",title:"Oliva"},{color:"#588800",title:"Verde palta"},{color:"#008800",title:"Verde estándar"},{color:"#008858",title:"Esmeralda"},{color:"#008888",title:"Cerceta o Azul verde"},{color:"#005288",title:"Añil"},{color:"#000080",title:"Azul marino"},{color:"#880088",title:"Azul púrpura"},{color:"#880088",title:"Púrpura o Morado"},{color:"#880047",title:"Vino"}],AGRISADOS:[{color:"#BF4040",title:"Lacre"},{color:"#BF6340",title:"Cobre"},{color:"#BF8340",title:"Cnalea o Ocre"},{color:"#BF9F40",title:"Dorado"},{color:"#BFBF40",title:"Chartreuse"},{color:"#93BF40",title:"Verde manzana"},{color:"#93BF40",title:"Verde bosque"},{color:"#40BF40",title:"Verde mar"},{color:"#40BFBF",title:"Turquesa"},{color:"#408CBF",title:"Azul acero"},{color:"#4040BF",title:"Zafiro"},{color:"#9340BF",title:"Amastista"},{color:"#B140BF",title:"Púrpureo"},{color:"#B140BF",title:"Fandango"}],CLAROS:[{color:"#FF7777",title:"Coral"},{color:"#FF9977",title:"Salmón"},{color:"#FFB977",title:"Melón o Durazno"},{color:"#FFDA80",title:"Crema"},{color:"#FFFF88",title:"Maíz"},{color:"#CFFF77",title:"Té verde"},{color:"#77FF77",title:"Verde claro"},{color:"#77FFAA",title:"Menta"},{color:"#80FFFF",title:"Aguamarina"},{color:"#73C7FF",title:"Celeste"},{color:"#8082FF",title:"Bígaro o aciano"},{color:"#C977FF",title:"Lavanda o lila"},{color:"#FF77FF",title:"Malva"},{color:"#FF77C1",title:"Rosado"}]},ne="",le="x-juki-forwarded-host",re="x-juki-visitor-session-id",Re="x-juki-metadata",ie="juki-app";function Ee(e){try{if("string"==typeof e)return JSON.parse(e),!0}catch(e){return!1}return!1}function ue(e){try{return"string"==typeof JSON.stringify(e)}catch(e){return!1}}function ce(e){let t=0;for(;-1!==e.indexOf(t);)t++;return t}function me(e,t){const a=[];for(let s=e;s<t;s++)a.push(s);return a}function de(...e){console.warn((new Date).toLocaleString(),...e)}function _e(...e){console.info((new Date).toLocaleString(),...e)}function Se(...e){console.error((new Date).toLocaleString(),...e)}function Te(e){const t=new ArrayBuffer(e.length),a=new Uint8Array(t);for(let t=0;t<e.length;t++)a[t]=255&e.charCodeAt(t);return t}function Ae(e){return e.join("")}function pe(e){return e.split("")}E.FREE,E.FREE,E.STANDARD,E.STANDARD,E.PREMIUM,E.PREMIUM,E.CUSTOM,E.CUSTOM,c.PUBLIC,c.PUBLIC,c.RESERVED,c.RESERVED,c.ARCHIVED,c.ARCHIVED,Y.RESTRICTED,Y.RESTRICTED,Y.GUEST,Y.GUEST,Y.REGULAR,Y.REGULAR,Y.CREATOR,Y.CREATOR,Y.MANAGER,Y.MANAGER,Y.MASTER,Y.MASTER,Y.ADMIN,Y.ADMIN,Y.SUPER_ADMIN,Y.SUPER_ADMIN;const Ie=(e,t)=>{if(e===t)return!1;if(e.length!==t.length)return!0;for(let a=0;a<t.length;a+=1)if(t[a]!==e[a])return!0;return!1},Ne=me(1970,2100),Ce=["January","February","March","April","May","June","July","August","September","October","November","December"],Oe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ge=me(0,24),he=me(0,60),De=me(0,60),fe=me(0,1e3),Pe={[h.JUKI_JUDGE]:{value:h.JUKI_JUDGE,label:"Juki Judge",logo:"https://images.juki.pub/c/juki-judge-logo-horizontal-color.svg",logoSize:[883.991,435],url:"https://judge.juki.app"},[h.CODEFORCES]:{value:h.CODEFORCES,label:"Codeforces",logo:"https://images.juki.pub/c/codeforces-logo-horizontal-color.svg",logoSize:[1232.75,145.12],url:"https://codeforces.com"},[h.CODEFORCES_GYM]:{value:h.CODEFORCES_GYM,label:"Codeforces Gym",logo:"https://images.juki.pub/c/codeforces-logo-horizontal-color.svg",logoSize:[1232.75,145.12],url:"https://codeforces.com"},[h.JV_UMSA]:{value:h.JV_UMSA,label:"Juez Virtual UMSA",logo:"https://images.juki.pub/c/codeforces-logo-horizontal-color.svg",logoSize:[1232.75,145.12],url:"https://jv.umsa.bo"},[h.UVA_ONLINE_JUDGE]:{value:h.UVA_ONLINE_JUDGE,label:"Uva Online Judge",logo:"https://images.juki.pub/c/uva-online-judge-logo-color.png",logoSize:[150,135.994],url:"https://onlinejudge.org"},[h.AT_CODER]:{value:h.AT_CODER,label:"AtCoder",logo:"https://images.juki.pub/c/at-coder-logo-color.png",logoSize:[762.997,675],url:"https://atcoder.jp"},[h.CODECHEF]:{value:h.CODECHEF,label:"Codechef",logo:"https://images.juki.pub/c/codechef-logo-color.svg",logoSize:[1207.7,453.17],url:"https://www.codechef.com"},[h.TOPCODER]:{value:h.TOPCODER,label:"Topcoder",logo:"https://images.juki.pub/c/topcoder-logo-color.png",logoSize:[971.99,415.99],url:"https://www.topcoder.com"},[h.LEETCODE]:{value:h.LEETCODE,label:"LeetCode",logo:"https://images.juki.pub/assets/leetcode-logo-color.svg",logoSize:[95,111],url:"https://leetcode.com"}};B.TOTAL,B.SUBTASK,B.PARTIAL,F.STANDARD,F.DYNAMIC;const be=[n.C_11,n.CPP_11,n.CPP_20,n.JAVA_21,n.PYTHON_3,n.PYTHON_PYPY_3,n.JAVASCRIPT_NODE_JS_22,n.PSEUDOCODE_PSEINT],ve=[...be],Ue={[D.NONE]:{value:D.NONE,label:"none",color:"#555555"},[D.PENDING]:{value:D.PENDING,label:"pending",color:"#79B6FD"},[D.HIDDEN]:{value:D.HIDDEN,label:"hidden",color:"#555555"},[D.AC]:{value:D.AC,label:"accepted",color:"#43D787"},[D.PE]:{value:D.PE,label:"presentation error",color:"#55db93"},[D.PA]:{value:D.PA,label:"partial accepted",color:"#55db93"},[D.CE]:{value:D.CE,label:"compilation error",color:"#FE9F9F"},[D.RE]:{value:D.RE,label:"runtime error",color:"#FE9F9F"},[D.TLE]:{value:D.TLE,label:"time limit exceed",color:"#FE9F9F"},[D.MLE]:{value:D.MLE,label:"memory limit exceed",color:"#FE9F9F"},[D.WA]:{value:D.WA,label:"wrong answer",color:"#FE9F9F"}};D.NONE,D.PENDING,D.AC,D.PE,D.PA,D.CE,D.RE,D.TLE,D.MLE,D.WA;const Me={[f.NONE]:{value:f.NONE,label:"none"},[f.RECEIVED]:{value:f.RECEIVED,label:"received"},[f.COMPILING]:{value:f.COMPILING,label:"compiling"},[f.COMPILED]:{value:f.COMPILED,label:"compiled"},[f.COMPILATION_ERROR]:{value:f.COMPILATION_ERROR,label:"compilation error"},[f.FETCHING_TEST_CASES]:{value:f.FETCHING_TEST_CASES,label:"fetching test cases"},[f.RUNNING_TEST_CASE]:{value:f.RUNNING_TEST_CASE,label:"running test case"},[f.RUNNING_TEST_CASES]:{value:f.RUNNING_TEST_CASES,label:"running test cases"},[f.RUNNING_SAMPLE_TEST_CASES]:{value:f.RUNNING_SAMPLE_TEST_CASES,label:"running sample cases"},[f.EXECUTED_TEST_CASE]:{value:f.EXECUTED_TEST_CASE,label:"executed test case"},[f.FAILED_TEST_CASE]:{value:f.FAILED_TEST_CASE,label:"failed test case"},[f.JUDGING_TEST_CASE]:{value:f.JUDGING_TEST_CASE,label:"judging test case"},[f.GRADING]:{value:f.GRADING,label:"grading"},[f.FAILED]:{value:f.FAILED,label:"failed"},[f.COMPLETED]:{value:f.COMPLETED,label:"completed"}};P.HIGH_PERFORMANCE,P.HIGH_PERFORMANCE,P.LOW_PERFORMANCE,P.LOW_PERFORMANCE,L.STANDARD,L.STANDARD,L.INTERACTIVE,L.INTERACTIVE,y.STANDARD,y.STANDARD,y.DYNAMIC,y.DYNAMIC,y.INTERACTIVE,y.INTERACTIVE;const Le=[B.TOTAL,B.SUBTASK,B.PARTIAL],ye={[B.TOTAL]:{value:B.TOTAL,label:"total",description:"if all test cases are Accepted the result is Accepted otherwise it will be Runtime Error, Time Limited Exceeded, Memory Limited Exceeded, Wrong Answer or Presentation Error in that order."},[B.SUBTASK]:{value:B.SUBTASK,label:"subtask",description:"the test cases are grouped and each group of test cases is assigned a score, if all test cases in a group are Accepted then the score assigned to that group of test cases is added to total score, if total score is equal to the sum of the assigned scores of all groups of test cases then the result is Accepted, otherwise if the total score is greater than zero the result is Partial Accepted with the total accumulated score, otherwise it will be Runtime Error, Time Limited Exceeded, Memory Limited Exceeded, Wrong Answer or Presentation Error in that order."},[B.PARTIAL]:{value:B.PARTIAL,label:"partial",description:"the test cases are grouped and each group is associated with X points, and each test case in a group scores X points "}};F.STANDARD,F.DYNAMIC,F.INTERACTIVE;const Fe={[F.STANDARD]:{value:F.STANDARD,label:"standard",description:"The contestant submit a single source code in one of the allowed programming languages. The source code is either standalone or to be compiled. The resulting user's executable does I/O standard input and output. The output produced by the contestant's program is then compared to the correct output using a simple diff algorithm."},[F.INTERACTIVE]:{value:F.INTERACTIVE,label:"interactive",description:"developing.."},[F.DYNAMIC]:{value:F.DYNAMIC,label:"dynamic",description:"The contestant submit a single source code in one of the allowed programming languages. The user's source code is either standalone or to be compiled. The resulting user's executable does I/O standard input and output. The output produced by the contestant's program is saved. The problem editor save a single source code in C++ 17. The editor's source code can read judge input filepath argv[1], judge output filepath argv[2], user's output filepath argv[3], user's error filepath argv[4], user's log filepath argv[5], user's source filepath argv[6] and submission information filepath argv[7] (companyId, submitId, runId, userId, contestId, problemId, language, userNickname, timestamp). The resulting editor's executable should be \"AC\" or a number between 1 and 100 for partial accepted"}};Y.RESTRICTED,Y.RESTRICTED,Y.GUEST,Y.GUEST,Y.REGULAR,Y.REGULAR,Y.CREATOR,Y.CREATOR,Y.MANAGER,Y.MANAGER,Y.MASTER,Y.MASTER,Y.ADMIN,Y.ADMIN,Y.SUPER_ADMIN,Y.SUPER_ADMIN;const Be={[x.ERR500]:{value:x.ERR500,message:"internal server error",status:500},[x.ERR400]:{value:x.ERR400,message:"bad request",status:400},[x.ERR401]:{value:x.ERR401,message:"unauthorized",status:401},[x.ERR403]:{value:x.ERR403,message:"forbidden",status:403},[x.ERR404]:{value:x.ERR404,message:"not found",status:404},[x.ERR405]:{value:x.ERR405,message:"method not allowed",status:405},[x.ERR9997]:{value:x.ERR9997,message:"aborted request",status:400},[x.ERR9998]:{value:x.ERR9998,message:"error on response",status:400},[x.ERR9999]:{value:x.ERR9999,message:"service no found",status:400},[x.ERR9900]:{value:x.ERR9900,message:"internal server error on organization service",status:500},[x.ERR9910]:{value:x.ERR9910,message:"organization not created",status:500},[x.ERR9911]:{value:x.ERR9911,message:"organization not found",status:500},[x.ERR9912]:{value:x.ERR9912,message:"organization not updated",status:500},[x.ERR9913]:{value:x.ERR9913,message:"organization not deleted",status:500},[x.ERR9914]:{value:x.ERR9914,message:"not allowed to create the organization",status:400},[x.ERR9915]:{value:x.ERR9915,message:"not allowed to view the organization",status:400},[x.ERR9916]:{value:x.ERR9916,message:"not allowed to updated the organization",status:400},[x.ERR9917]:{value:x.ERR9917,message:"not allowed to deleted the organization",status:400},[x.ERR0000]:{value:x.ERR0000,message:"internal server error on users service",status:500},[x.ERR0010]:{value:x.ERR0010,message:"user not created",status:500},[x.ERR0011]:{value:x.ERR0011,message:"user not found",status:500},[x.ERR0012]:{value:x.ERR0012,message:"user not updated",status:500},[x.ERR0013]:{value:x.ERR0013,message:"user not deleted",status:500},[x.ERR0014]:{value:x.ERR0014,message:"not allowed to create the user",status:400},[x.ERR0015]:{value:x.ERR0015,message:"not allowed to view the user",status:400},[x.ERR0016]:{value:x.ERR0016,message:"not allowed to updated the user",status:400},[x.ERR0017]:{value:x.ERR0017,message:"not allowed to deleted the user",status:400},[x.ERR0018]:{value:x.ERR0018,message:"user is reported",status:400},[x.ERR0019]:{value:x.ERR0019,message:"user is archived",status:400},[x.ERR0020]:{value:x.ERR0020,message:"user with email requested not found",status:400},[x.ERR0021]:{value:x.ERR0021,message:"user with nickname requested not found",status:400},[x.ERR0022]:{value:x.ERR0022,message:"the email is already registered",status:400},[x.ERR0023]:{value:x.ERR0023,message:"the nickname is already taken",status:400},[x.ERR0024]:{value:x.ERR0024,message:"incorrect password",status:400},[x.ERR0050]:{value:x.ERR0050,message:"user session not created",status:500},[x.ERR0051]:{value:x.ERR0051,message:"user session not found",status:500},[x.ERR0052]:{value:x.ERR0052,message:"user session not updated",status:500},[x.ERR0053]:{value:x.ERR0053,message:"user session not deleted",status:500},[x.ERR0100]:{value:x.ERR0100,message:"internal server error on problems service",status:500},[x.ERR0110]:{value:x.ERR0110,message:"problem not created",status:500},[x.ERR0111]:{value:x.ERR0111,message:"problem not found",status:500},[x.ERR0112]:{value:x.ERR0112,message:"problem not updated",status:500},[x.ERR0113]:{value:x.ERR0113,message:"problem not deleted",status:500},[x.ERR0114]:{value:x.ERR0114,message:"not allowed to create the problem",status:400},[x.ERR0115]:{value:x.ERR0115,message:"not allowed to view the problem",status:400},[x.ERR0116]:{value:x.ERR0116,message:"not allowed to updated the problem",status:400},[x.ERR0117]:{value:x.ERR0117,message:"not allowed to deleted the problem",status:400},[x.ERR0118]:{value:x.ERR0118,message:"problem mode not supported",status:500},[x.ERR0119]:{value:x.ERR0119,message:"problem type not supported",status:500},[x.ERR0120]:{value:x.ERR0120,message:"problem time limit must be a number",status:500},[x.ERR0121]:{value:x.ERR0121,message:"problem memory limit must be number",status:500},[x.ERR0122]:{value:x.ERR0122,message:"test case file empty",status:400},[x.ERR0200]:{value:x.ERR0200,message:"internal server error on contests service",status:500},[x.ERR0210]:{value:x.ERR0210,message:"contest not created",status:500},[x.ERR0211]:{value:x.ERR0211,message:"contest not found",status:500},[x.ERR0212]:{value:x.ERR0212,message:"contest not updated",status:500},[x.ERR0213]:{value:x.ERR0213,message:"contest not deleted",status:500},[x.ERR0214]:{value:x.ERR0214,message:"not allowed to create the contest",status:400},[x.ERR0215]:{value:x.ERR0215,message:"not allowed to view the contest",status:400},[x.ERR0216]:{value:x.ERR0216,message:"not allowed to updated the contest",status:400},[x.ERR0217]:{value:x.ERR0217,message:"not allowed to deleted the contest",status:400},[x.ERR0218]:{value:x.ERR0218,message:"not allowed to register to the contest",status:400},[x.ERR0219]:{value:x.ERR0219,message:"is already registered",status:400},[x.ERR0220]:{value:x.ERR0220,message:"not allowed to view contests",status:400},[x.ERR0230]:{value:x.ERR0230,message:"scoreboard not created",status:500},[x.ERR0231]:{value:x.ERR0231,message:"scoreboard not found",status:500},[x.ERR0232]:{value:x.ERR0232,message:"scoreboard not updated",status:500},[x.ERR0233]:{value:x.ERR0233,message:"scoreboard not deleted",status:500},[x.ERR0234]:{value:x.ERR0234,message:"not allowed to create the scoreboard",status:400},[x.ERR0235]:{value:x.ERR0235,message:"not allowed to view the scoreboard",status:400},[x.ERR0236]:{value:x.ERR0236,message:"not allowed to update the scoreboard",status:400},[x.ERR0237]:{value:x.ERR0237,message:"not allowed to delete the scoreboard",status:400},[x.ERR0240]:{value:x.ERR0240,message:"clarification not created",status:500},[x.ERR0241]:{value:x.ERR0241,message:"clarification not found",status:500},[x.ERR0242]:{value:x.ERR0242,message:"clarification not updated",status:500},[x.ERR0243]:{value:x.ERR0243,message:"clarification not deleted",status:500},[x.ERR0244]:{value:x.ERR0244,message:"not allowed to submit clarification",status:400},[x.ERR0245]:{value:x.ERR0245,message:"not allowed to view clarification",status:400},[x.ERR0246]:{value:x.ERR0246,message:"not allowed to update clarification",status:400},[x.ERR0247]:{value:x.ERR0247,message:"not allowed to delete clarification",status:400},[x.ERR0300]:{value:x.ERR0300,message:"internal server error on submissions service",status:500},[x.ERR0301]:{value:x.ERR0301,message:"submission not found",status:500},[x.ERR0302]:{value:x.ERR0302,message:"submission not created",status:500},[x.ERR0303]:{value:x.ERR0303,message:"submission not updated",status:500},[x.ERR0310]:{value:x.ERR0310,message:"source empty",status:400},[x.ERR0311]:{value:x.ERR0311,message:"programming language not supported",status:400},[x.ERR0321]:{value:x.ERR0321,message:"not allowed submit the problem in the contest",status:400},[x.ERR0331]:{value:x.ERR0331,message:"judgement unavailable",status:400},[x.ERR0400]:{value:x.ERR0400,message:"internal server error on utils services",status:500},[x.ERR0410]:{value:x.ERR0410,message:"empty image",status:400},[x.ERR0420]:{value:x.ERR0420,message:"",status:400},[x.ERR0421]:{value:x.ERR0421,message:"compilation failed",status:400},[x.ERR0430]:{value:x.ERR0430,message:"",status:400},[x.ERR0440]:{value:x.ERR0440,message:"the email could not be sent",status:400},[x.ERR0600]:{value:x.ERR0600,message:"internal server error on teams service",status:500},[x.ERR0610]:{value:x.ERR0610,message:"team not created",status:400},[x.ERR0611]:{value:x.ERR0611,message:"team not found",status:400},[x.ERR0612]:{value:x.ERR0612,message:"team not updated",status:400},[x.ERR0613]:{value:x.ERR0613,message:"team not deleted",status:400},[x.ERR0614]:{value:x.ERR0614,message:"not allowed to create the team",status:400},[x.ERR0615]:{value:x.ERR0615,message:"not allowed to view the team",status:400},[x.ERR0616]:{value:x.ERR0616,message:"not allowed to updated the team",status:400},[x.ERR0617]:{value:x.ERR0617,message:"not allowed to deleted the team",status:400},[x.ERR0618]:{value:x.ERR0618,message:"team is reported",status:400},[x.ERR0619]:{value:x.ERR0619,message:"team is archived",status:400},[x.ERR0800]:{value:x.ERR0800,message:"internal server error on files service",status:500},[x.ERR0810]:{value:x.ERR0810,message:"file not created",status:400},[x.ERR0811]:{value:x.ERR0811,message:"file not found",status:400},[x.ERR0812]:{value:x.ERR0812,message:"file not updated",status:400},[x.ERR0813]:{value:x.ERR0813,message:"file not deleted",status:400},[x.ERR0814]:{value:x.ERR0814,message:"not allowed to create the file",status:400},[x.ERR0815]:{value:x.ERR0815,message:"not allowed to view the file",status:400},[x.ERR0816]:{value:x.ERR0816,message:"not allowed to updated the file",status:400},[x.ERR0817]:{value:x.ERR0817,message:"not allowed to deleted the file",status:400},[x.ERR0818]:{value:x.ERR0818,message:"file is reserved",status:400},[x.ERR0819]:{value:x.ERR0819,message:"file is private",status:400},[x.ERR0820]:{value:x.ERR0820,message:"file is archived",status:400}};C.FILE,C.FILE,C.FOLDER,C.FOLDER,Y.RESTRICTED,Y.RESTRICTED,Y.GUEST,Y.GUEST,Y.REGULAR,Y.REGULAR,Y.MASTER,Y.MASTER,Y.ADMIN,Y.ADMIN,Y.SUPER_ADMIN,Y.SUPER_ADMIN,T.RELEASED,T.RELEASED,T.ARCHIVED,T.ARCHIVED;const xe={[i.PRIVATE]:{value:i.PRIVATE,label:"private",description:"the record will be visible and editable only to the owner"},[i.RESTRICTED]:{value:i.RESTRICTED,label:"restricted",description:"the record will be visible to viewers and the owner and editable to editors and the owner"},[i.PUBLIC]:{value:i.PUBLIC,label:"public",description:"the record will be visible to anyone and editable to editors and the owner"},[i.EXPOSED]:{value:i.EXPOSED,label:"exposed",description:"the record will be visible and editable to anyone"}},Ge=1e3,we=6e4,Ve={users:{create:!1,manage:!1,administrate:!1},problems:{create:!1,manage:!1},submissions:{manage:!1},contests:{create:!1,manage:!1},organization:{manage:!1,administrate:!1},services:{administrate:!1}},He=e=>encodeURIComponent(e),Ke=e=>`presence:organization:${He(e)}`,je=e=>{const[t,a,s,...o]=e.split(":");return"contest"===t&&a&&!o.length&&Object.values(J).includes(s)?{contestKey:decodeURIComponent(a),role:s}:null},Je=()=>({id:a(),type:V.NEW_PAGE,title:"",points:0}),ke={[z.RATIO_21_9]:{aspectRatio:z.RATIO_21_9,width:2520,height:1080,decimal:21/9,label:"ultrawide"},[z.RATIO_20_9]:{aspectRatio:z.RATIO_20_9,width:2400,height:1080,decimal:20/9,label:"mobile wide"},[z.RATIO_16_9]:{aspectRatio:z.RATIO_16_9,width:1920,height:1080,decimal:16/9,label:"widescreen"},[z.RATIO_16_10]:{aspectRatio:z.RATIO_16_10,width:1920,height:1200,decimal:1.6,label:"widescreen tall"},[z.RATIO_3_2]:{aspectRatio:z.RATIO_3_2,width:1440,height:960,decimal:1.5,label:"balanced"},[z.RATIO_4_3]:{aspectRatio:z.RATIO_4_3,width:1024,height:768,decimal:4/3,label:"standard"},[z.RATIO_5_4]:{aspectRatio:z.RATIO_5_4,width:1280,height:1024,decimal:5/4,label:"square old"},[z.RATIO_1_1]:{aspectRatio:z.RATIO_1_1,width:1e3,height:1e3,decimal:1,label:"square"}};var We,Ye;!function(e){e.UNMET_PREREQUISITES="UNMET_PREREQUISITES",e.MAX_ACCEPTED_SUBMISSIONS_ACHIEVED="MAX_ACCEPTED_SUBMISSIONS_ACHIEVED",e.START_TIME_IN_THE_FUTURE="START_TIME_IN_THE_FUTURE",e.END_TIME_IN_THE_PAST="END_TIME_IN_THE_PAST"}(We||(We={})),function(e){e.USER="USER",e.TEAM="TEAM"}(Ye||(Ye={}));const Xe=(e,t)=>{const a=new Date(e);return a.setFullYear(t),a},ze=(e,t)=>{const a=new Date(e);return a.setMonth(t),a},Ze=(e,t)=>{const a=new Date(e);return a.setDate(t),a},qe=(e,t)=>{const a=new Date(e);return a.setHours(t),a},Qe=(e,t)=>{const a=new Date(e);return a.setMinutes(t),a},$e=(e,t)=>{const a=new Date(e);return a.setSeconds(t),a},et=(e,t)=>{const a=new Date(e);return a.setMilliseconds(t),a},tt=(e,t=1)=>Xe(e,e.getFullYear()-t),at=(e,t=1)=>Xe(e,e.getFullYear()+t),st=e=>{const t=new Date(e);return t.setMonth(t.getMonth()-1),t},ot=e=>{const t=new Date(e);return t.setMonth(t.getMonth()+1),t},nt=e=>{const t=new Date(e);return t.setDate(t.getDate()+1),t},lt=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},rt=e=>{const t=new Date(e);return t.setHours(23,59,59,999),t},Rt=e=>{const t=new Date(e);return t.setDate(1),lt(t)},it=e=>{const t=Rt(ot(e));return new Date(t.getTime()-1)},Et=e=>{const t=new Date(e);return t.setMonth(0),Rt(t)},ut=e=>{const t=new Date(e);for(;t.getDay();)t.setDate(t.getDate()-1);return lt(t)},ct=e=>{const t=new Date(e);return t.setMinutes(0,0,0),t},mt=e=>{const t=new Date(e);return t.setMinutes(59,59,999),t},dt=e=>{const t=new Date(e);return t.setSeconds(0,0),t},_t=e=>{const t=new Date(e);return t.setSeconds(59,999),t},St=e=>{const t=new Date(e);return t.setMilliseconds(0),t},Tt=e=>{const t=new Date(e);return t.setMilliseconds(999),t},At=(e,t)=>e.getTime()===t.getTime(),pt=(e,t)=>e.getFullYear()===t.getFullYear(),It=(e,t)=>pt(e,t)&&e.getMonth()===t.getMonth(),Nt=(e,t)=>It(e,t)&&e.getDate()===t.getDate(),Ct=(e,t)=>Nt(e,t)&&e.getHours()===t.getHours(),Ot=(e,t)=>Ct(e,t)&&e.getMinutes()===t.getMinutes(),gt=(e,t)=>Ot(e,t)&&e.getSeconds()===t.getSeconds(),ht=(e,t)=>At(e,t),Dt=e=>e instanceof Date&&!Number.isNaN(e.getTime()),ft=(e,t)=>e.getTime()>t.getTime(),Pt=(e,t)=>e.getTime()<t.getTime(),bt=(e,t)=>e.getFullYear()>t.getFullYear(),vt=(e,t)=>bt(e,t)||pt(e,t)&&e.getMonth()>t.getMonth(),Ut=(e,t)=>vt(e,t)||It(e,t)&&e.getDate()>t.getDate(),Mt=(e,t)=>Ut(e,t)||Nt(e,t)&&e.getHours()>t.getHours(),Lt=(e,t)=>Mt(e,t)||Ct(e,t)&&e.getMinutes()>t.getMinutes(),yt=(e,t)=>Lt(e,t)||Ot(e,t)&&e.getSeconds()>t.getSeconds(),Ft=(e,t)=>yt(e,t)||gt(e,t)&&e.getMilliseconds()>t.getMilliseconds(),Bt=(e,t)=>e.getFullYear()<t.getFullYear(),xt=(e,t)=>Bt(e,t)||pt(e,t)&&e.getMonth()<t.getMonth(),Gt=(e,t)=>xt(e,t)||It(e,t)&&e.getDate()<t.getDate(),wt=(e,t)=>Gt(e,t)||Nt(e,t)&&e.getHours()<t.getHours(),Vt=(e,t)=>wt(e,t)||Ct(e,t)&&e.getMinutes()<t.getMinutes(),Ht=(e,t)=>Vt(e,t)||Ot(e,t)&&e.getSeconds()<t.getSeconds(),Kt=(e,t)=>Ht(e,t)||gt(e,t)&&e.getMilliseconds()<t.getMilliseconds(),jt=(e,{start:t,end:a},s="[]")=>("["===s.charAt(0)&&At(e,t)||ft(e,t))&&("]"===s.charAt(1)&&At(e,a)||Pt(e,a)),Jt=e=>{switch(!0){case!(e?.members?.rankAdministrators!==S.NONE&&e?.members?.rankAdministrators!==S.CLOSE||e?.members?.rankManagers!==S.OPEN||e?.members?.rankGuests!==S.NONE&&e?.members?.rankGuests!==S.CLOSE&&e?.members?.rankGuests!==S.OPEN||e?.members?.rankSpectators!==S.OPEN||e?.members?.rankParticipants!==S.NONE&&e?.members?.rankParticipants!==S.CLOSE&&e?.members?.rankParticipants!==S.OPEN):return i.EXPOSED;case!(e?.members?.rankAdministrators!==S.NONE&&e?.members?.rankAdministrators!==S.CLOSE||e?.members?.rankManagers!==S.CLOSE||e?.members?.rankGuests!==S.NONE&&e?.members?.rankGuests!==S.CLOSE&&e?.members?.rankGuests!==S.OPEN||e?.members?.rankSpectators!==S.OPEN||e?.members?.rankParticipants!==S.NONE&&e?.members?.rankParticipants!==S.CLOSE&&e?.members?.rankParticipants!==S.OPEN):return i.PUBLIC;case!(e?.members?.rankAdministrators!==S.NONE&&e?.members?.rankAdministrators!==S.CLOSE||e?.members?.rankManagers!==S.CLOSE||e?.members?.rankGuests!==S.NONE&&e?.members?.rankGuests!==S.CLOSE&&e?.members?.rankGuests!==S.OPEN||e?.members?.rankSpectators!==S.CLOSE||e?.members?.rankParticipants!==S.NONE&&e?.members?.rankParticipants!==S.CLOSE&&e?.members?.rankParticipants!==S.OPEN):return i.RESTRICTED;case e?.members?.rankAdministrators===S.NONE&&e?.members?.rankManagers===S.NONE&&e?.members?.rankGuests===S.NONE&&e?.members?.rankSpectators===S.NONE&&e?.members?.rankParticipants===S.NONE:default:return i.PRIVATE}};class kt extends Error{constructor(e,t){const a=t?.message||Be[e].message;super(a),this.message=a,this.code=e,t?.stack&&(this.stack=t.stack),t?.data&&(this.data=t.data)}}function Wt(e){const t=e.lastIndexOf(".");return-1!==t?e.substring(0,t):e}const Yt=(e,t,a)=>{const{timeUsed:s,memoryUsed:o,exitCode:n}=zt(e?.log),l=s>t,r=o>a,R=0!==n;return{compilationError:e?.status===f.COMPILATION_ERROR,timeUsed:s,timeLimitExceeded:l,memoryUsed:o,memoryLimitExceeded:r,exitCode:n,runtimeError:R,failed:!!e?.log&&(l||r||R)}},Xt=(e,t,a)=>{const{compilationError:s,timeLimitExceeded:o,memoryLimitExceeded:n,runtimeError:l,timeUsed:r,memoryUsed:R,exitCode:i}=Yt(e,t,a);return{verdict:s?D.CE:o?D.TLE:n?D.MLE:l?D.RE:e.out===e.testOut?D.AC:e.withPE&&e.out.split(" ").join("").split("\n").join("")===e.testOut.split(" ").join("").split("\n").join("")?D.PE:e.withPE||e.out.split(" ").join("").split("\n").join("")!==e.testOut.split(" ").join("").split("\n").join("")?D.WA:D.AC,timeUsed:r,memoryUsed:R,exitCode:i}},zt=e=>{const t=e?.split?.("\n")||[];let a=0,s=0,o=-1;if(t.length>4)for(const e of t)e.startsWith("time:")?(a=+e.split(":")[1],Number.isNaN(a)&&(a=0),a*=1e3):e.startsWith("max-rss:")?s=parseInt(e.split(":")[1],10):e.startsWith("exitcode:")&&(o=parseInt(e.split(":")[1],10));else t.length>=3&&(a=+t[0],s=+t[1],o=+t[2]);return{timeUsed:Number.isNaN(a)?0:a,memoryUsed:Number.isNaN(s)?0:s,exitCode:Number.isNaN(o)?-1:o}},Zt=(e,t,a="0")=>`${e}`.padStart(t,a),qt=e=>{if(!Ee(e)){const t={success:!1,message:Be[x.ERR9999].message,errors:[{code:x.ERR9999,detail:"",message:Be[x.ERR9999].message}]};return Se({message:"response is not string json, success false on cleaning request",responseText:e,response:t}),t}const t=JSON.parse(e);if("boolean"==typeof t.success){if(!0===t.success&&"string"==typeof t.message&&t.content)return{success:!0,message:t.message,content:t.content};if(!0===t.success&&"string"==typeof t.message&&Array.isArray(t.contents)&&t.meta)return{success:!0,message:t.message,contents:t.contents,meta:t.meta};if(!1===t.success&&"string"==typeof t.message&&Array.isArray(t.errors)){const a={success:!1,message:t.message,errors:t.errors};return Se({message:"success false on cleaning request",responseText:e,response:a}),a}}const a={success:!1,message:Be[x.ERR9998].message,errors:[{code:x.ERR9998,detail:"",message:Be[x.ERR9998].message}]};return Se({message:"success false on cleaning request",responseText:e,response:a}),a},Qt=e=>Object.values(K).includes(e?.event)&&"string"==typeof e?.clientId&&!!e.clientId,$t=e=>Qt(e)&&e?.event===K.SUBSCRIBE_CODE_RUN_STATUS&&"string"==typeof e?.runId&&!!e.runId,ea=e=>Qt(e)&&e?.event===K.UNSUBSCRIBE_CODE_RUN_STATUS&&"string"==typeof e?.runId&&!!e.runId,ta=e=>Qt(e)&&e?.event===K.SUBSCRIBE_SUBMISSION_RUN_STATUS&&"string"==typeof e?.submitId&&!!e.submitId,aa=e=>Qt(e)&&e?.event===K.UNSUBSCRIBE_SUBMISSION_RUN_STATUS&&"string"==typeof e?.submitId&&!!e.submitId,sa=e=>Qt(e)&&e?.event===K.SUBSCRIBE_GET_DATA,oa=e=>Qt(e)&&e?.event===K.UNSUBSCRIBE_GET_DATA,na=e=>Qt(e)&&e?.event===K.SUBSCRIBE_PROBLEM_CRAWLED,la=e=>Qt(e)&&e?.event===K.UNSUBSCRIBE_PROBLEM_CRAWLED,ra=e=>Qt(e)&&e?.event===K.SUBSCRIBE_SUBMISSIONS_CRAWL,Ra=e=>Qt(e)&&e?.event===K.UNSUBSCRIBE_SUBMISSIONS_CRAWL,ia=e=>Qt(e)&&e?.event===K.SUBSCRIBE_CONTEST_CHANGES,Ea=e=>Qt(e)&&e?.event===K.UNSUBSCRIBE_CONTEST_CHANGES,ua=e=>Qt(e)&&e?.event===K.SUBSCRIBE_USER_NOTIFICATION,ca=e=>Qt(e)&&e?.event===K.UNSUBSCRIBE_USER_NOTIFICATION,ma=e=>Object.values(j).includes(e?.event)&&"string"==typeof e?.key&&"string"==typeof e?.connectionId&&"number"==typeof e?.createdAt&&!!e.createdAt,da=e=>ma(e)&&e?.event===j.CODE_RUN_STATUS&&"string"==typeof e?.runId&&!!e.runId&&e?.status in f,_a=e=>ma(e)&&e?.event===j.SUBMISSION_RUN_STATUS&&"string"==typeof e?.submitId&&!!e.submitId&&e?.status in f&&e?.verdict in D&&"number"==typeof e?.points,Sa=(e,t,a)=>`${e}-${t}-${a}`,Ta=(e,t)=>{return da(e)?Sa(j.CODE_RUN_STATUS,t,e.runId):_a(e)?Sa(j.SUBMISSION_RUN_STATUS,t,e.submitId):(a=e,[j.SEND_DATA_ECS_TASK_DEFINITIONS_LIST,j.SEND_DATA_EC2_INSTANCES_LIST,j.SEND_DATA_ECS_TASKS_LIST,j.SEND_DATA_SSM_SESSIONS_LIST,j.SEND_DATA_RUN_COMMAND].includes(a?.event)&&"string"==typeof a?.dataId&&a.dataId&&a?.content?Sa(j.SEND_DATA_,t,e.dataId):(e=>ma(e)&&e?.event===j.CONTEST_CHANGES&&!!e?.content)(e)?Sa(j.CONTEST_CHANGES,t,e.content.contestKey):(e=>ma(e)&&e?.event===j.PROBLEM_CRAWLED&&!!e?.content)(e)?Sa(j.PROBLEM_CRAWLED,t,e.content.problemKey):(e=>ma(e)&&e?.event===j.SUBMISSIONS_CRAWL&&!!e?.content)(e)?Sa(j.SUBMISSIONS_CRAWL,t,Ae([e.content.contestKey,e.content.problemKeys])):(e=>[j.USER_NOTIFICATION_SUBMISSION,j.USER_NOTIFICATION_CONTEST_CLARIFICATION].includes(e?.event)&&!!e?.content)(e)?Sa(j.USER_NOTIFICATION_,t,"*"):null);var a},Aa=e=>{return ta(e)?(t=e.submitId,`submission:${He(t)}`):na(e)?(a=e.problemKey,`problem:${He(a)}`):ia(e)||ra(e)?(s=e.contestKey,o=J.SPECTATORS,`contest:${He(s)}:${o}`):null;var t,a,s,o},pa=e=>ia(e)||ra(e)?e.contestKey:null;function Ia(e){const t=[],a=1e3,s=6e4,o=36e5,n=864e5,l=6048e5,r=Math.floor(e/l);t.push({remaining:r,label:1===r?"week":"weeks",abbreviatedLabel:"w",milliseconds:l,digits:2});const R=Math.floor(e%l/n);t.push({remaining:R,label:1===R?"day":"days",abbreviatedLabel:"d",milliseconds:n,digits:2});const i=Math.floor(e%n/o);t.push({remaining:i,label:1===i?"hour":"hours",abbreviatedLabel:"h",milliseconds:o,digits:2});const E=Math.floor(e%o/s);t.push({remaining:E,label:1===E?"minute":"minutes",abbreviatedLabel:"m",milliseconds:s,digits:2});const u=Math.floor(e%s/a);t.push({remaining:u,label:1===u?"second":"seconds",abbreviatedLabel:"s",milliseconds:a,digits:2});const c=Math.floor(e%a);return t.push({remaining:c,label:1===c?"millisecond":"milliseconds",abbreviatedLabel:"ms",milliseconds:1,digits:3}),t}const Na=(e,t)=>e+"|"+t,Ca=(e,t)=>`${e}|${t}`,Oa=e=>{const[t,a]=e.split("|");return{sessionId:t,uiId:a}},ga=e=>{const t=[...e];t[0]?.type!==V.NEW_PAGE&&t.unshift(Je());let a=t[0],s=[];const o=[];for(let e=1;e<t.length;e++){const n=t[e];n.type===V.NEW_PAGE?(o.push({header:a,content:[...s]}),a=n,s=[]):s.push(n)}return o.push({header:a,content:[...s]}),o},ha=e=>"string"==typeof e?.id&&e.id&&Object.values(V).includes(e?.type)&&"string"==typeof e?.title&&"number"==typeof e?.points,Da=e=>ha(e)&&e?.type===V.JK_MD&&"string"==typeof e?.content,fa=e=>ha(e)&&e?.type===V.CODE_EDITOR&&"object"==typeof e?.sourceCode&&null!==e?.sourceCode&&"object"===e?.testCases&&null!==e?.testCases&&Array.isArray(e?.languages)&&"number"==typeof e?.height,Pa=e=>ha(e)&&e?.type===V.QUIZ_PROBLEM&&Object.values(h).includes(e?.problemJudge)||"string"==typeof e?.problemJudge&&"string"==typeof e?.problemKey&&Array.isArray(e?.languages)&&"number"==typeof e?.height,ba=e=>ha(e)&&e?.type===V.QUIZ_OPTIONS&&"string"==typeof e?.description&&Array.isArray(e?.options)&&e?.options.every(e=>"string"==typeof e?.label&&"boolean"==typeof e?.correct&&"string"==typeof e?.id)&&"boolean"==typeof e?.multiple&&("TOTAL"===e?.scoringMode||"PARTIAL"===e?.scoringMode),va=import.meta.env,Ua=("undefined"!=typeof process?process.env.NEXT_PUBLIC_JUKI_SERVICE_V2_URL:void 0)||va?.VITE_JUKI_SERVICE_V2_URL||"",Ma=("undefined"!=typeof process?process.env.NEXT_PUBLIC_JUKI_TOKEN_NAME:void 0)||va?.VITE_JUKI_TOKEN_NAME||"",La=("undefined"!=typeof process?process.env.NODE_ENV:void 0)||"development",ya=+(("undefined"!=typeof process?process.env.NEXT_PUBLIC_ABLY_LOG_LEVEL:void 0)||va?.VITE_ABLY_LOG_LEVEL||0)||void 0,Fa={revalidateOnFocus:!1,revalidateOnReconnect:!0,revalidateIfStale:!0,focusThrottleInterval:5e3,dedupingInterval:5e3};export{ta as $,ya as A,Re as B,n as C,Oe as D,Ve as E,Fe as F,ye as G,w as H,se as I,Ua as J,B as K,v as L,W as M,La as N,ie as O,s as P,H as Q,be as R,r as S,U as T,ne as U,Ia as V,V as W,$t as X,ea as Y,Sa as Z,j as _,ga as a,st as a$,aa as a0,sa as a1,oa as a2,ua as a3,ca as a4,na as a5,la as a6,ra as a7,Ra as a8,Ae as a9,Bt as aA,it as aB,Rt as aC,rt as aD,lt as aE,mt as aF,ct as aG,_t as aH,dt as aI,Tt as aJ,St as aK,ve as aL,f as aM,b as aN,da as aO,Yt as aP,Ge as aQ,Me as aR,Xt as aS,D as aT,ce as aU,Wt as aV,oe as aW,ut as aX,nt as aY,Xe as aZ,Ne as a_,ia as aa,Ea as ab,K as ac,pe as ad,Dt as ae,ht as af,gt as ag,Ot as ah,Ct as ai,Nt as aj,It as ak,pt as al,jt as am,Ft as an,yt as ao,Lt as ap,Mt as aq,Ut as ar,vt as as,bt as at,Kt as au,Ht as av,Vt as aw,wt as ax,Gt as ay,xt as az,k as b,ze as b0,ot as b1,Ze as b2,Et as b3,tt as b4,at as b5,qe as b6,ge as b7,Qe as b8,he as b9,$e as ba,De as bb,et as bc,fe as bd,Ca as be,we as bf,h as bg,Ue as bh,Aa as bi,pa as bj,Ke as bk,je as bl,Ta as bm,_a as bn,Pe as bo,Le as bp,F as bq,Jt as br,S as bs,Ye as bt,i as bu,xe as bv,Oa as bw,Ie as bx,de as c,Ma as d,Fa as e,_e as f,Na as g,Je as h,Ee as i,fa as j,Da as k,ba as l,Pa as m,ke as n,Ce as o,Zt as p,le as q,re as r,Te as s,x as t,Be as u,a as v,qt as w,Se as x,ue as y,kt as z};
@@ -1 +1 @@
1
- export{j as jukiApiManager,a as jukiAppRoutes}from"./index-2PTQqTnK.js";import"./settings-CBGV-lz3.js";import"./commons-iref2pEJ.js";import"react";import"./enums.js";
1
+ export{j as jukiApiManager,a as jukiAppRoutes}from"./index-3QSNRp1k.js";import"./settings-6x4qNkNZ.js";import"./commons-BLDufAOm.js";import"react";import"./enums.js";
@@ -0,0 +1 @@
1
+ import{_ as t}from"./mermaid.core-VF3HuzPL.js";import"./index-38k9tHSo.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-BLDufAOm.js";import"./settings-6x4qNkNZ.js";import"./constants.js";import"./LoaderLayer-Csc8unUJ.js";import"./websocket-D79arGLt.js";import"./index-3QSNRp1k.js";import"motion/react";import"react-dom";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"@ably/spaces/dist/mjs/react";import"./string-DPJhNSkw.js";function e(){if("undefined"!=typeof globalThis)return globalThis}function o(){return Boolean(e()?.mermaidCaptureSizes)}function r(){return"undefined"==typeof location?"browser-dev":`${location.pathname}${location.search}`}function i(t,o){const r=e();if(!r)return;const i=o.node(),s=(i&&"ownerSVGElement"in i?i.ownerSVGElement:null)??i,n=s?.id??"(unknown)";r.mermaidCapturedSizes??=[];const a={svgId:n,sizes:t};r.mermaidCapturedSizes.push(a),r.mermaidLastCapturedSizes=a}function s(t,e){const o=[];for(const t of e.nodes)t.isGroup||o.push({id:t.id,width:t.width??0,height:t.height??0});0!==o.length&&i({metadata:{captureVersion:1,capturedAt:(new Date).toISOString(),capturedFrom:r()},nodes:o},t)}t(e,"getCaptureGlobal"),t(o,"shouldCaptureSizes"),t(r,"capturedFromLocation"),t(i,"emitCapturedSizes"),t(s,"captureNodeSizes");export{s as captureNodeSizes,o as shouldCaptureSizes};
@@ -0,0 +1 @@
1
+ import{g as t}from"./chunk-XXDRQBXY-DLLBlZjr.js";import{s as e}from"./chunk-VQ5W62QI-mHHsR0s0.js";import{_ as s,l as i,c as n,r,t as o,u as a,a as l,b as c,g as h,s as d,v as u,x as p,ag as y,m as g,C as m,k as f,B as S,E as k,F as b,G as T,M as _}from"./mermaid.core-VF3HuzPL.js";import{c as E}from"./chunk-55XCU76K-BN8xVJCh.js";import"./index-38k9tHSo.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-BLDufAOm.js";import"./settings-6x4qNkNZ.js";import"./constants.js";import"./LoaderLayer-Csc8unUJ.js";import"./websocket-D79arGLt.js";import"./index-3QSNRp1k.js";import"motion/react";import"react-dom";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"@ably/spaces/dist/mjs/react";import"./string-DPJhNSkw.js";var $=function(){var t=s(function(t,e,s,i){for(s=s||{},i=t.length;i--;s[t[i]]=e);return s},"o"),e=[1,2],i=[1,3],n=[1,4],r=[2,4],o=[1,9],a=[1,11],l=[1,16],c=[1,17],h=[1,18],d=[1,19],u=[1,33],p=[1,20],y=[1,21],g=[1,22],m=[1,23],f=[1,24],S=[1,26],k=[1,27],b=[1,28],T=[1,29],_=[1,30],E=[1,31],$=[1,32],x=[1,35],C=[1,36],v=[1,37],D=[1,38],w=[1,34],I=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],A=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],L=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],N={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"--\x3e":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"--\x3e",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:s(function(t,e,s,i,n,r,o){var a=r.length-1;switch(n){case 3:return i.setRootDoc(r[a]),r[a];case 4:this.$=[];break;case 5:"nl"!=r[a]&&(r[a-1].push(r[a]),this.$=r[a-1]);break;case 6:case 7:case 12:this.$=r[a];break;case 8:this.$="nl";break;case 13:const t=r[a-1];t.description=i.trimColon(r[a]),this.$=t;break;case 14:this.$={stmt:"relation",state1:r[a-2],state2:r[a]};break;case 15:const e=i.trimColon(r[a]);this.$={stmt:"relation",state1:r[a-3],state2:r[a-1],description:e};break;case 19:this.$={stmt:"state",id:r[a-3],type:"default",description:"",doc:r[a-1]};break;case 20:var l=r[a],c=r[a-2].trim();if(r[a].match(":")){var h=r[a].split(":");l=h[0],c=[c,h[1]]}this.$={stmt:"state",id:l,type:"default",description:c};break;case 21:this.$={stmt:"state",id:r[a-3],type:"default",description:r[a-5],doc:r[a-1]};break;case 22:this.$={stmt:"state",id:r[a],type:"fork"};break;case 23:this.$={stmt:"state",id:r[a],type:"join"};break;case 24:this.$={stmt:"state",id:r[a],type:"choice"};break;case 25:this.$={stmt:"state",id:i.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:r[a-1].trim(),note:{position:r[a-2].trim(),text:r[a].trim()}};break;case 29:this.$=r[a].trim(),i.setAccTitle(this.$);break;case 30:case 31:this.$=r[a].trim(),i.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:r[a-3],url:r[a-2],tooltip:r[a-1]};break;case 33:this.$={stmt:"click",id:r[a-3],url:r[a-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:r[a-1].trim(),classes:r[a].trim()};break;case 36:this.$={stmt:"style",id:r[a-1].trim(),styleClass:r[a].trim()};break;case 37:this.$={stmt:"applyClass",id:r[a-1].trim(),styleClass:r[a].trim()};break;case 38:i.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:i.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:i.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:i.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:r[a].trim(),type:"default",description:""};break;case 46:case 47:this.$={stmt:"state",id:r[a-2].trim(),classes:[r[a].trim()],type:"default",description:""}}},"anonymous"),table:[{3:1,4:e,5:i,6:n},{1:[3]},{3:5,4:e,5:i,6:n},{3:6,4:e,5:i,6:n},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],r,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:a,8:8,9:10,10:12,11:13,12:14,13:15,16:l,17:c,19:h,22:d,24:u,25:p,26:y,27:g,28:m,29:f,32:25,33:S,35:k,37:b,38:T,41:_,45:E,48:$,51:x,52:C,53:v,54:D,57:w},t(I,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:l,17:c,19:h,22:d,24:u,25:p,26:y,27:g,28:m,29:f,32:25,33:S,35:k,37:b,38:T,41:_,45:E,48:$,51:x,52:C,53:v,54:D,57:w},t(I,[2,7]),t(I,[2,8]),t(I,[2,9]),t(I,[2,10]),t(I,[2,11]),t(I,[2,12],{14:[1,40],15:[1,41]}),t(I,[2,16]),{18:[1,42]},t(I,[2,18],{20:[1,43]}),{23:[1,44]},t(I,[2,22]),t(I,[2,23]),t(I,[2,24]),t(I,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(I,[2,28]),{34:[1,49]},{36:[1,50]},t(I,[2,31]),{13:51,24:u,57:w},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(A,[2,44],{58:[1,56]}),t(A,[2,45],{58:[1,57]}),t(I,[2,38]),t(I,[2,39]),t(I,[2,40]),t(I,[2,41]),t(I,[2,6]),t(I,[2,13]),{13:58,24:u,57:w},t(I,[2,17]),t(L,r,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(I,[2,29]),t(I,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(I,[2,14],{14:[1,71]}),{4:o,5:a,8:8,9:10,10:12,11:13,12:14,13:15,16:l,17:c,19:h,21:[1,72],22:d,24:u,25:p,26:y,27:g,28:m,29:f,32:25,33:S,35:k,37:b,38:T,41:_,45:E,48:$,51:x,52:C,53:v,54:D,57:w},t(I,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(I,[2,34]),t(I,[2,35]),t(I,[2,36]),t(I,[2,37]),t(A,[2,46]),t(A,[2,47]),t(I,[2,15]),t(I,[2,19]),t(L,r,{7:78}),t(I,[2,26]),t(I,[2,27]),{5:[1,79]},{5:[1,80]},{4:o,5:a,8:8,9:10,10:12,11:13,12:14,13:15,16:l,17:c,19:h,21:[1,81],22:d,24:u,25:p,26:y,27:g,28:m,29:f,32:25,33:S,35:k,37:b,38:T,41:_,45:E,48:$,51:x,52:C,53:v,54:D,57:w},t(I,[2,32]),t(I,[2,33]),t(I,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:s(function(t,e){if(!e.recoverable){var s=new Error(t);throw s.hash=e,s}this.trace(t)},"parseError"),parse:s(function(t){var e=this,i=[0],n=[],r=[null],o=[],a=this.table,l="",c=0,h=0,d=o.slice.call(arguments,1),u=Object.create(this.lexer),p={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(p.yy[y]=this.yy[y]);u.setInput(t,p.yy),p.yy.lexer=u,p.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var g=u.yylloc;o.push(g);var m=u.options&&u.options.ranges;function f(){var t;return"number"!=typeof(t=n.pop()||u.lex()||1)&&(t instanceof Array&&(t=(n=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof p.yy.parseError?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,s(function(t){i.length=i.length-2*t,r.length=r.length-t,o.length=o.length-t},"popStack"),s(f,"lex");for(var S,k,b,T,_,E,$,x,C={};;){if(k=i[i.length-1],this.defaultActions[k]?b=this.defaultActions[k]:(null==S&&(S=f()),b=a[k]&&a[k][S]),void 0===b||!b.length||!b[0]){var v="";for(_ in x=[],a[k])this.terminals_[_]&&_>2&&x.push("'"+this.terminals_[_]+"'");v=u.showPosition?"Parse error on line "+(c+1)+":\n"+u.showPosition()+"\nExpecting "+x.join(", ")+", got '"+(this.terminals_[S]||S)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==S?"end of input":"'"+(this.terminals_[S]||S)+"'"),this.parseError(v,{text:u.match,token:this.terminals_[S]||S,line:u.yylineno,loc:g,expected:x})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+S);switch(b[0]){case 1:i.push(S),r.push(u.yytext),o.push(u.yylloc),i.push(b[1]),S=null,h=u.yyleng,l=u.yytext,c=u.yylineno,g=u.yylloc;break;case 2:if(E=this.productions_[b[1]][1],C.$=r[r.length-E],C._$={first_line:o[o.length-(E||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(E||1)].first_column,last_column:o[o.length-1].last_column},m&&(C._$.range=[o[o.length-(E||1)].range[0],o[o.length-1].range[1]]),void 0!==(T=this.performAction.apply(C,[l,h,c,p.yy,b[1],r,o].concat(d))))return T;E&&(i=i.slice(0,-1*E*2),r=r.slice(0,-1*E),o=o.slice(0,-1*E)),i.push(this.productions_[b[1]][0]),r.push(C.$),o.push(C._$),$=a[i[i.length-2]][i[i.length-1]],i.push($);break;case 3:return!0}}return!0},"parse")},O=function(){return{EOF:1,parseError:s(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:s(function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:s(function(t){var e=t.length,s=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),s.length-1&&(this.yylineno-=s.length-1);var n=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:s?(s.length===i.length?this.yylloc.first_column:0)+i[i.length-s.length].length-s[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[n[0],n[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:s(function(t){this.unput(this.match.slice(t))},"less"),pastInput:s(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:s(function(t,e){var s,i,n;if(this.options.backtrack_lexer&&(n={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(n.yylloc.range=this.yylloc.range.slice(0))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],s=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),s)return s;if(this._backtrack){for(var r in n)this[r]=n[r];return!1}return!1},"test_match"),next:s(function(){if(this.done)return this.EOF;var t,e,s,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),r=0;r<n.length;r++)if((s=this._input.match(this.rules[n[r]]))&&(!e||s[0].length>e[0].length)){if(e=s,i=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(s,n[r])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,n[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:s(function(){var t=this.next();return t||this.lex()},"lex"),begin:s(function(t){this.conditionStack.push(t)},"begin"),popState:s(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:s(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:s(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:s(function(t){this.begin(t)},"pushState"),stateStackSize:s(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:s(function(t,e,i,n){function r(){const s=e.yytext.indexOf("%%");if(0===s)return!1;if(s>0){const i=e.yytext.slice(0,s),n=e.yytext.slice(s);n&&t.lexer.unput(n),e.yytext=i}return!0}switch(s(r,"processId"),i){case 0:return 38;case 1:return 40;case 2:return 39;case 3:return 44;case 4:case 43:return 51;case 5:case 44:return 52;case 6:case 45:return 53;case 7:case 46:return 54;case 8:case 78:return 5;case 9:case 10:case 11:case 12:case 57:case 63:break;case 13:case 33:return this.pushState("SCALE"),17;case 14:case 34:return 18;case 15:case 21:case 35:case 50:case 54:this.popState();break;case 16:return this.begin("acc_title"),33;case 17:return this.popState(),"acc_title_value";case 18:return this.begin("acc_descr"),35;case 19:return this.popState(),"acc_descr_value";case 20:this.begin("acc_descr_multiline");break;case 22:return"acc_descr_multiline_value";case 23:return this.pushState("CLASSDEF"),41;case 24:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 25:return this.popState(),this.pushState("CLASSDEFID"),42;case 26:return this.popState(),43;case 27:return this.pushState("CLASS"),48;case 28:return this.popState(),this.pushState("CLASS_STYLE"),49;case 29:return this.popState(),50;case 30:return this.pushState("STYLE"),45;case 31:return this.popState(),this.pushState("STYLEDEF_STYLES"),46;case 32:return this.popState(),47;case 36:this.pushState("STATE");break;case 37:case 40:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),25;case 38:case 41:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),26;case 39:case 42:return this.popState(),e.yytext=e.yytext.slice(0,-10).trim(),27;case 47:this.pushState("STATE_STRING");break;case 48:return this.pushState("STATE_ID"),"AS";case 49:case 65:if(!r())return;return this.popState(),"ID";case 51:return"STATE_DESCR";case 52:throw new Error('Error: State name must be a single word. Found: "'+e.yytext.trim()+'"');case 53:return 19;case 55:return this.popState(),this.pushState("struct"),20;case 56:return this.popState(),21;case 58:return this.begin("NOTE"),29;case 59:return this.popState(),this.pushState("NOTE_ID"),59;case 60:return this.popState(),this.pushState("NOTE_ID"),60;case 61:this.popState(),this.pushState("FLOATING_NOTE");break;case 62:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";case 64:return"NOTE_TEXT";case 66:if(!r())return;return this.popState(),this.pushState("NOTE_TEXT"),24;case 67:return this.popState(),e.yytext=e.yytext.substr(2).trim(),31;case 68:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),31;case 69:case 70:return 6;case 71:return 16;case 72:return 57;case 73:if(!r())return;return 24;case 74:return e.yytext=e.yytext.trim(),14;case 75:return 15;case 76:return 28;case 77:return 58;case 79:return"INVALID"}},"anonymous"),rules:[/^(?:click\b)/i,/^(?:href\b)/i,/^(?:"[^"]*")/i,/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<<fork>>)/i,/^(?:.*<<join>>)/i,/^(?:.*<<choice>>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\w+\s+\w+.*?\{)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?\n\s*end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[10,11,12],inclusive:!1},struct:{rules:[10,11,12,23,27,30,36,43,44,45,46,56,57,58,72,73,74,75,76,77],inclusive:!1},FLOATING_NOTE_ID:{rules:[65],inclusive:!1},FLOATING_NOTE:{rules:[62,63,64],inclusive:!1},NOTE_TEXT:{rules:[67,68],inclusive:!1},NOTE_ID:{rules:[66],inclusive:!1},NOTE:{rules:[59,60,61],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[32],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[31],inclusive:!1},CLASS_STYLE:{rules:[29],inclusive:!1},CLASS:{rules:[28],inclusive:!1},CLASSDEFID:{rules:[26],inclusive:!1},CLASSDEF:{rules:[24,25],inclusive:!1},acc_descr_multiline:{rules:[21,22],inclusive:!1},acc_descr:{rules:[19],inclusive:!1},acc_title:{rules:[17],inclusive:!1},SCALE:{rules:[14,15,34,35],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[49],inclusive:!1},STATE_STRING:{rules:[50,51],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[10,11,12,37,38,39,40,41,42,47,48,52,53,54,55],inclusive:!1},ID:{rules:[10,11,12],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,12,13,16,18,20,23,27,30,33,36,55,58,69,70,71,72,73,74,75,77,78,79],inclusive:!0}}}}();function R(){this.yy={}}return N.lexer=O,s(R,"Parser"),R.prototype=N,N.Parser=R,new R}();$.parser=$;var x=$,C="state",v="root",D="relation",w="default",I="divider",A="fill:none",L="fill: #333",N="markdown",O="normal",R="rect",B="rectWithTitle",F="divider",j="roundedWithTitle",P="statediagram",Y=`${P}-state`,G="transition",W=`${G} note-edge`,M=`${P}-note`,z=`${P}-cluster`,U=`${P}-cluster-alt`,X="parent",H="note",V="----",K=`${V}${H}`,J=`${V}${X}`,Q=new Map,q=0,Z=0,tt=new Map,et=s((t,e,s,i)=>{if(t===F&&void 0!==s?.id&&tt.has(s.id)){const t=tt.get(s.id);return tt.set(e,t),t}const n=Z++,r=i?void 0:n;return tt.set(e,r),r},"colorSlotFor");function st(t="",e=0,s="",i=V){return`state-${t}${null!==s&&s.length>0?`${i}${s}`:""}-${e}`}s(st,"stateDomId");var it=s((t,e,s,r,o,a,l,c)=>{i.trace("items",e),e.forEach(e=>{switch(e.stmt){case C:case w:lt(t,e,s,r,o,a,l,c);break;case D:{lt(t,e.state1,s,r,o,a,l,c),lt(t,e.state2,s,r,o,a,l,c);const i="neo"===l,h={id:"edge"+q,start:e.state1.id,end:e.state2.id,arrowhead:"normal",arrowTypeEnd:i?"arrow_barb_neo":"arrow_barb",style:A,labelStyle:"",label:g.sanitizeText(e.description??"",n()),arrowheadStyle:L,labelpos:"c",labelType:N,thickness:O,classes:G,look:l};o.push(h),q++}}})},"setupDoc"),nt=s((t,e="TB")=>{let s=e;if(t.doc)for(const e of t.doc)"dir"===e.stmt&&(s=e.value);return s},"getDir");function rt(t,e,s){if(!e.id||"</join></fork>"===e.id||"</choice>"===e.id)return;e.cssClasses&&(Array.isArray(e.cssCompiledStyles)||(e.cssCompiledStyles=[]),e.cssClasses.split(" ").forEach(t=>{const i=s.get(t);i&&(e.cssCompiledStyles=[...e.cssCompiledStyles??[],...i.styles])}));const i=t.find(t=>t.id===e.id);i?Object.assign(i,e):t.push(e)}function ot(t){return t?.classes?.join(" ")??""}function at(t){return t?.styles??[]}s(rt,"insertOrUpdateNode"),s(ot,"getClassesFromDbInfo"),s(at,"getStylesFromDbInfo");var lt=s((t,e,s,r,o,a,l,c)=>{const h=e.id,d=s.get(h),u=ot(d),p=at(d),y=n(),m=""!==u.trim()||p.length>0;if(i.info("dataFetcher parsedItem",e,d,p),"root"!==h){let s=R;!0===e.start?s="stateStart":!1===e.start&&(s="stateEnd"),e.type!==w&&(s=e.type),Q.get(h)||Q.set(h,{id:h,shape:s,description:g.sanitizeText(h,y),cssClasses:`${u} ${Y}`,cssStyles:p});const n=Q.get(h);e.description&&(Array.isArray(n.description)?(n.shape=B,n.description.push(e.description)):n.description?.length&&n.description.length>0?(n.shape=B,n.description===h?n.description=[e.description]:n.description=[n.description,e.description]):(n.shape=R,n.description=e.description),n.description=g.sanitizeTextOrArray(n.description,y)),1===n.description?.length&&n.shape===B&&("group"===n.type?n.shape=j:n.shape=R),!n.type&&e.doc&&(i.info("Setting cluster for XCX",h,nt(e)),n.type="group",n.isGroup=!0,n.dir=nt(e),n.shape=e.type===I?F:j,n.colorIndex=et(n.shape,h,t,m),n.cssClasses=`${n.cssClasses} ${z} ${a?U:""}`);const d={labelStyle:"",shape:n.shape,label:n.description,cssClasses:n.cssClasses,cssCompiledStyles:[],cssStyles:n.cssStyles,id:h,dir:n.dir,domId:st(h,q),type:n.type,isGroup:"group"===n.type,colorIndex:n.colorIndex,padding:8,rx:10,ry:10,look:l,labelType:"markdown"};if(d.shape===F&&(d.label=""),t&&"root"!==t.id&&(i.trace("Setting node ",h," to be child of its parent ",t.id),d.parentId=t.id),d.centerLabel=!0,e.note){const t={labelStyle:"",shape:"note",label:e.note.text,labelType:"markdown",cssClasses:M,cssStyles:[],cssCompiledStyles:[],id:h+K+"-"+q,domId:st(h,q,H),type:"node",isGroup:!1,padding:y.flowchart?.padding,look:l,position:e.note.position},s=h+J,i={labelStyle:"",shape:"noteGroup",label:e.note.text,cssClasses:n.cssClasses,cssStyles:[],id:h+J,domId:st(h,q,X),type:"group",isGroup:!0,padding:16,look:l,position:e.note.position};q++,i.id=s,t.parentId=s,rt(r,i,c),rt(r,t,c),rt(r,d,c);let a=h,u=t.id;"left of"===e.note.position&&(a=t.id,u=h),o.push({id:a+"-"+u,start:a,end:u,arrowhead:"none",arrowTypeEnd:"",style:A,labelStyle:"",classes:W,pattern:"dashed",arrowheadStyle:L,labelpos:"c",labelType:N,thickness:O,look:l})}else rt(r,d,c)}e.doc&&(i.trace("Adding nodes children "),it(e,e.doc,s,r,o,!a,l,c))},"dataFetcher"),ct=s(()=>{Q.clear(),q=0,Z=0,tt.clear()},"reset"),ht=s((t,e="TB")=>{if(!t.doc)return e;let s=e;for(const e of t.doc)"dir"===e.stmt&&(s=e.value);return s},"getDir"),dt={getClasses:s(function(t,e){return e.db.getClasses()},"getClasses"),draw:s(async function(s,l,c,h){i.info("REF0:"),i.info("Drawing state diagram (v2)",l);const{securityLevel:d,state:u,layout:p}=n();h.db.extract(h.db.getRootDocV2());const y=h.db.getData(),g=t(l,d);y.type=h.type,y.layoutAlgorithm=r(p),y.nodeSpacing=u?.nodeSpacing||50,y.rankSpacing=u?.rankSpacing||50;"neo"===n().look?y.markers=["barbNeo"]:y.markers=["barb"],y.diagramId=l,await o(y,g);try{("function"==typeof h.db.getLinks?h.db.getLinks():new Map).forEach((t,e)=>{const s="string"==typeof e?e:"string"==typeof e?.id?e.id:"",n=y.nodes.find(t=>t.id===s);if(!s)return void i.warn("⚠️ Invalid or missing stateId from key:",JSON.stringify(e));const r=g.node()?.querySelectorAll("g.node, g.rough-node");let o;if(r?.forEach(t=>{const e=t.textContent?.trim();t.id!==n?.domId&&e!==s||(o=t)}),!o)return void i.warn("⚠️ Could not find node matching text:",s);const a=o.parentNode;if(!a)return void i.warn("⚠️ Node has no parent, cannot wrap:",s);const l=document.createElementNS("http://www.w3.org/2000/svg","a"),c=t.url.replace(/^"+|"+$/g,"");if(l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c),l.setAttribute("target","_blank"),t.tooltip){const e=t.tooltip.replace(/^"+|"+$/g,"");l.setAttribute("title",e),o.setAttribute("title",e)}a.replaceChild(l,o),l.appendChild(o),i.info("🔗 Wrapped node in <a> tag for:",s,t.url)})}catch(t){i.error("❌ Error injecting clickable links:",t)}a.insertTitle(g,"statediagramTitleText",u?.titleTopMargin??25,h.db.getDiagramTitle()),e(g,8,P,u?.useMaxWidth??!0)},"draw"),getDir:ht},ut="[*]",pt="start",yt="[*]",gt="end",mt="color",ft="fill",St="bgFill",kt=",",bt=s(()=>new Map,"newClassesList"),Tt=s(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),_t=s(t=>JSON.parse(JSON.stringify(t)),"clone"),Et=class{constructor(t){this.version=t,this.nodes=[],this.edges=[],this.rootDoc=[],this.classes=bt(),this.documents={root:Tt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.dividerCnt=0,this.links=new Map,this.funs=[],this.getAccTitle=l,this.setAccTitle=c,this.getAccDescription=h,this.setAccDescription=d,this.setDiagramTitle=u,this.getDiagramTitle=p,this.clear(),this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this),this.bindFunctions=this.bindFunctions.bind(this)}static{s(this,"StateDB")}static{this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}}extract(t){this.clear(!0);for(const e of Array.isArray(t)?t:t.doc)switch(e.stmt){case C:this.addState(e.id.trim(),e.type,e.doc,e.description,e.note);break;case D:this.addRelation(e.state1,e.state2,e.description);break;case"classDef":this.addStyleClass(e.id.trim(),e.classes);break;case"style":this.handleStyleDef(e);break;case"applyClass":this.setCssClass(e.id.trim(),e.styleClass);break;case"click":this.addLink(e.id,e.url,e.tooltip)}const e=this.getStates(),s=n();ct(),lt(void 0,this.getRootDocV2(),e,this.nodes,this.edges,!0,s.look,this.classes);for(const t of this.nodes)if(Array.isArray(t.label)){if(t.description=t.label.slice(1),t.isGroup&&t.description.length>0)throw new Error(`Group nodes can only have label. Remove the additional description for node [${t.id}]`);t.label=t.label[0]}}handleStyleDef(t){const e=t.id.trim().split(","),s=t.styleClass.split(",");for(const t of e){let e=this.getState(t);if(!e){const s=t.trim();this.addState(s),e=this.getState(s)}e&&(e.styles=s.map(t=>t.replace(/;/g,"")?.trim()))}}setRootDoc(t){i.info("Setting root doc",t),this.rootDoc=t,1===this.version?this.extract(t):this.extract(this.getRootDocV2())}docTranslator(t,e,s){if(e.stmt===D)return this.docTranslator(t,e.state1,!0),void this.docTranslator(t,e.state2,!1);if(e.stmt===C&&(e.id===ut?(e.id=t.id+(s?"_start":"_end"),e.start=s):e.id=e.id.trim()),e.stmt!==v&&e.stmt!==C||!e.doc)return;const i=[];let n=[];for(const t of e.doc)if(t.type===I){const e=_t(t);e.doc=_t(n),i.push(e),n=[]}else n.push(t);if(i.length>0&&n.length>0){const t={stmt:C,id:y(),type:"divider",doc:_t(n)};i.push(_t(t)),e.doc=i}e.doc.forEach(t=>this.docTranslator(e,t,!0))}getRootDocV2(){return this.docTranslator({id:v,stmt:v},{id:v,stmt:v,doc:this.rootDoc},!0),{id:v,doc:this.rootDoc}}addState(t,e=w,s=void 0,r=void 0,o=void 0,a=void 0,l=void 0,c=void 0){const h=t?.trim();if(this.currentDocument.states.has(h)){const t=this.currentDocument.states.get(h);if(!t)throw new Error(`State not found: ${h}`);t.doc||(t.doc=s),t.type||(t.type=e)}else i.info("Adding state ",h,r),this.currentDocument.states.set(h,{stmt:C,id:h,descriptions:[],type:e,doc:s,note:o,classes:[],styles:[],textStyles:[]});if(r){i.info("Setting state description",h,r);(Array.isArray(r)?r:[r]).forEach(t=>this.addDescription(h,t.trim()))}if(o){const t=this.currentDocument.states.get(h);if(!t)throw new Error(`State not found: ${h}`);t.note=o,t.note.text=g.sanitizeText(t.note.text,n())}if(a){i.info("Setting state classes",h,a);(Array.isArray(a)?a:[a]).forEach(t=>this.setCssClass(h,t.trim()))}if(l){i.info("Setting state styles",h,l);(Array.isArray(l)?l:[l]).forEach(t=>this.setStyle(h,t.trim()))}if(c){i.info("Setting state styles",h,l);(Array.isArray(c)?c:[c]).forEach(t=>this.setTextStyle(h,t.trim()))}}clear(t){this.nodes=[],this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.documents={root:Tt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=bt(),t||(this.links=new Map,m())}getState(t){return this.currentDocument.states.get(t)}getStates(){return this.currentDocument.states}logDocuments(){i.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}addLink(t,e,s){this.links.set(t,{url:e,tooltip:s}),i.warn("Adding link",t,e,s)}getLinks(){return this.links}startIdIfNeeded(t=""){return t===ut?(this.startEndCount++,`${pt}${this.startEndCount}`):t}startTypeIfNeeded(t="",e=w){return t===ut?pt:e}endIdIfNeeded(t=""){return t===yt?(this.startEndCount++,`${gt}${this.startEndCount}`):t}endTypeIfNeeded(t="",e=w){return t===yt?gt:e}addRelationObjs(t,e,s=""){const i=this.startIdIfNeeded(t.id.trim()),r=this.startTypeIfNeeded(t.id.trim(),t.type),o=this.startIdIfNeeded(e.id.trim()),a=this.startTypeIfNeeded(e.id.trim(),e.type);this.addState(i,r,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles),this.addState(o,a,e.doc,e.description,e.note,e.classes,e.styles,e.textStyles),this.currentDocument.relations.push({id1:i,id2:o,relationTitle:g.sanitizeText(s,n())})}addRelation(t,e,s){if("object"==typeof t&&"object"==typeof e)this.addRelationObjs(t,e,s);else if("string"==typeof t&&"string"==typeof e){const i=this.startIdIfNeeded(t.trim()),r=this.startTypeIfNeeded(t),o=this.endIdIfNeeded(e.trim()),a=this.endTypeIfNeeded(e);this.addState(i,r),this.addState(o,a),this.currentDocument.relations.push({id1:i,id2:o,relationTitle:s?g.sanitizeText(s,n()):void 0})}}addDescription(t,e){const s=this.currentDocument.states.get(t),i=e.startsWith(":")?e.replace(":","").trim():e;s?.descriptions?.push(g.sanitizeText(i,n()))}cleanupLabel(t){return t.startsWith(":")?t.slice(2).trim():t.trim()}getDividerId(){return this.dividerCnt++,`divider-id-${this.dividerCnt}`}addStyleClass(t,e=""){this.classes.has(t)||this.classes.set(t,{id:t,styles:[],textStyles:[]});const s=this.classes.get(t);e&&s&&e.split(kt).forEach(t=>{const e=t.replace(/([^;]*);/,"$1").trim();if(RegExp(mt).exec(t)){const t=e.replace(ft,St).replace(mt,ft);s.textStyles.push(t)}s.styles.push(e)})}getClasses(){return this.classes}setupToolTips(t){const e=E();f(t).select("svg").selectAll("g.node, g.rough-node").on("mouseover",t=>{const s=f(t.currentTarget),i=s.attr("title");if(null===i)return;const n=t.currentTarget?.getBoundingClientRect();e.transition().duration(200).style("opacity",".9"),e.style("left",window.scrollX+n.left+(n.right-n.left)/2+"px").style("top",window.scrollY+n.bottom+"px"),e.html(S.sanitize(i)),s.classed("hover",!0)}).on("mouseout",t=>{e.transition().duration(500).style("opacity",0);f(t.currentTarget).classed("hover",!1)})}setCssClass(t,e){t.split(",").forEach(t=>{let s=this.getState(t);if(!s){const e=t.trim();this.addState(e),s=this.getState(e)}s?.classes?.push(e)})}setStyle(t,e){this.getState(t)?.styles?.push(e)}setTextStyle(t,e){this.getState(t)?.textStyles?.push(e)}bindFunctions(t){this.funs.forEach(e=>{e(t)})}getDirectionStatement(){return this.rootDoc.find(t=>"dir"===t.stmt)}getDirection(){return this.getDirectionStatement()?.value??"TB"}setDirection(t){const e=this.getDirectionStatement();e?e.value=t:this.rootDoc.unshift({stmt:"dir",value:t})}trimColon(t){return t.startsWith(":")?t.slice(1).trim():t.trim()}getData(){const t=n();for(const e of this.nodes)e.wrappingWidth??=t.state?.wrappingWidth,e.isGroup||(e.minWidth??=t.state?.minNodeWidth);return{nodes:this.nodes,edges:this.edges,other:{},config:t,direction:ht(this.getRootDocV2())}}getConfig(){return n().state}},$t=s(t=>{const{theme:e,bkgColorArray:s,borderColorArray:i}=t;if(!k(e,i))return"";const n=b(t.look),r=T(s);let o="";for(let t=0;t<_(i);t++){const e=i[t],a=r?`fill: ${s[t%s.length]};`:"",l=`[data-look="${n}"][data-color-id="color-${t}"]`;o+=`\n\n /* The title strip: \`rect.outer\` spans the whole composite and \`rect.inner\` covers\n the body, so what stays visible of \`outer\` is the band behind the label. */\n ${l}.statediagram-cluster rect.outer {\n stroke: ${e};\n ${a}\n }\n\n ${l}.statediagram-cluster rect.inner {\n stroke: ${e};\n }\n\n /* Concurrency regions. Siblings of one composite share a slot, so a divided composite\n reads as one thing split into parts rather than as several composites. */\n ${l}.statediagram-cluster rect.divider {\n stroke: ${e};\n ${a}\n }\n\n /* handDrawn draws the same container as roughjs shapes rather than plain rects, so it\n needs its own rules. \`roundedWithTitle\` and \`divider\` name those groups \`outer\`,\n \`inner\` and \`divider\` to match the classic branch, which is what lets these\n discriminate -- a bare \`.statediagram-cluster path\` rule reached the body as well and\n tinted the whole composite, losing \`compositeBackground\` and diverging from what\n classic and neo do.\n\n roughjs emits two paths per shape and marks them: the filled shape carries\n \`stroke="none"\` and the sketched outline carries \`fill="none"\`. Splitting on that is\n what keeps \`fill\` off the outline -- a rough outline is open squiggles, not a closed\n region, so filling it produces smears -- and keeps \`stroke\` off the fill shape, which\n would otherwise gain an edge it was drawn without. */\n ${l}.statediagram-cluster .outer path[stroke='none'] {\n ${a}\n }\n\n ${l}.statediagram-cluster .outer path[fill='none'] {\n stroke: ${e};\n }\n\n /* No \`.inner\` rule on purpose. The body shape is left entirely alone under handDrawn,\n where a rect's \`inner\` counterpart cannot be recoloured safely: roughjs draws a\n hachure fill as *stroked* lines, so its fill paths carry \`fill="none"\` exactly like\n the outline and no selector separates them. An \`.inner\` stroke rule therefore\n repainted the hatching of every alt composite in the palette colour instead of\n leaving it on \`altBackground\`. The container still reads as palette-coloured: the\n \`outer\` shape spans the whole composite, so its outline already frames the body. */\n\n /* Regions split the same way, which is why \`divider\` fills solid rather than taking\n roughjs's default hachure -- see the note on that call. Hatched, both of its paths\n carried \`fill="none"\` and these two rules degenerated: the tint matched nothing and\n the border rule repainted the hatching. */\n ${l}.statediagram-cluster .divider path[stroke='none'] {\n ${a}\n }\n\n ${l}.statediagram-cluster .divider path[fill='none'] {\n stroke: ${e};\n }\n `}return o},"genColor"),xt=s(t=>`\n${$t(t)}\ndefs [id$="-barbEnd"] {\n fill: ${t.transitionColor};\n stroke: ${t.transitionColor};\n }\ng.stateGroup text {\n fill: ${t.nodeBorder};\n stroke: none;\n font-size: 10px;\n}\ng.stateGroup text {\n fill: ${t.textColor};\n stroke: none;\n font-size: 10px;\n\n}\ng.stateGroup .state-title {\n font-weight: bolder;\n fill: ${t.stateLabelColor};\n}\n\ng.stateGroup rect {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n}\n\ng.stateGroup line {\n stroke: ${t.lineColor};\n stroke-width: ${t.strokeWidth||1};\n}\n\n.transition {\n stroke: ${t.transitionColor};\n stroke-width: ${t.strokeWidth||1};\n fill: none;\n}\n\n.stateGroup .composit {\n fill: ${t.background};\n border-bottom: 1px\n}\n\n.stateGroup .alt-composit {\n fill: #e0e0e0;\n border-bottom: 1px\n}\n\n.state-note {\n stroke: ${t.noteBorderColor};\n fill: ${t.noteBkgColor};\n\n text {\n fill: ${t.noteTextColor};\n stroke: none;\n font-size: 10px;\n }\n}\n\n.stateLabel .box {\n stroke: none;\n stroke-width: 0;\n fill: ${t.mainBkg};\n opacity: 0.5;\n}\n\n.edgeLabel .label rect {\n fill: ${t.labelBackgroundColor};\n opacity: 0.5;\n}\n.edgeLabel {\n background-color: ${t.edgeLabelBackground};\n p {\n background-color: ${t.edgeLabelBackground};\n }\n rect {\n opacity: 0.5;\n background-color: ${t.edgeLabelBackground};\n fill: ${t.edgeLabelBackground};\n }\n text-align: center;\n}\n.edgeLabel .label text {\n fill: ${t.transitionLabelColor||t.tertiaryTextColor};\n}\n.label div .edgeLabel {\n color: ${t.transitionLabelColor||t.tertiaryTextColor};\n}\n\n.stateLabel text {\n fill: ${t.stateLabelColor};\n font-size: 10px;\n font-weight: bold;\n}\n\n.node circle.state-start {\n fill: ${t.specialStateColor};\n stroke: ${t.specialStateColor};\n}\n\n.node .fork-join {\n fill: ${t.specialStateColor};\n stroke: ${t.specialStateColor};\n}\n\n.node circle.state-end {\n fill: ${t.innerEndBackground};\n stroke: ${t.background};\n stroke-width: 1.5\n}\n.end-state-inner {\n fill: ${t.compositeBackground||t.background};\n // stroke: ${t.background};\n stroke-width: 1.5\n}\n\n.node rect {\n fill: ${t.stateBkg||t.mainBkg};\n stroke: ${t.stateBorder||t.nodeBorder};\n stroke-width: ${t.strokeWidth||1}px;\n}\n.node polygon {\n fill: ${t.mainBkg};\n stroke: ${t.stateBorder||t.nodeBorder};;\n stroke-width: ${t.strokeWidth||1}px;\n}\n[id$="-barbEnd"] {\n fill: ${t.lineColor};\n}\n\n.statediagram-cluster rect {\n fill: ${t.compositeTitleBackground};\n stroke: ${t.stateBorder||t.nodeBorder};\n stroke-width: ${t.strokeWidth||1}px;\n}\n\n.cluster-label, .nodeLabel {\n color: ${t.stateLabelColor};\n // line-height: 1;\n}\n\n.statediagram-cluster rect.outer {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state .divider {\n stroke: ${t.stateBorder||t.nodeBorder};\n}\n\n.statediagram-state .title-state {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-cluster.statediagram-cluster .inner {\n fill: ${t.compositeBackground||t.background};\n}\n.statediagram-cluster.statediagram-cluster-alt .inner {\n fill: ${t.altBackground?t.altBackground:"#efefef"};\n}\n\n.statediagram-cluster .inner {\n rx:0;\n ry:0;\n}\n\n.statediagram-state rect.basic {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state rect.divider {\n stroke-dasharray: 10,10;\n fill: ${t.altBackground?t.altBackground:"#efefef"};\n}\n\n.note-edge {\n stroke-dasharray: 5;\n}\n\n.statediagram-note rect {\n fill: ${t.noteBkgColor};\n stroke: ${t.noteBorderColor};\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n.statediagram-note rect {\n fill: ${t.noteBkgColor};\n stroke: ${t.noteBorderColor};\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n\n.statediagram-note text {\n fill: ${t.noteTextColor};\n}\n\n.statediagram-note .nodeLabel {\n color: ${t.noteTextColor};\n}\n.statediagram .edgeLabel {\n color: red; // ${t.noteTextColor};\n}\n\n[id$="-dependencyStart"], [id$="-dependencyEnd"] {\n fill: ${t.lineColor};\n stroke: ${t.lineColor};\n stroke-width: ${t.strokeWidth||1};\n}\n\n.statediagramTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n}\n\n[data-look="neo"].statediagram-cluster rect {\n fill: ${t.mainBkg};\n stroke: ${t.useGradient?"url("+t.svgId+"-gradient)":t.stateBorder||t.nodeBorder};\n stroke-width: ${t.strokeWidth??1};\n}\n[data-look="neo"].statediagram-cluster rect.outer {\n rx: ${t.radius}px;\n ry: ${t.radius}px;\n filter: ${t.dropShadow?t.dropShadow.replace("url(#drop-shadow)",`url(${t.svgId}-drop-shadow)`):"none"}\n}\n`,"getStyles"),Ct={parser:x,get db(){return new Et(2)},renderer:dt,styles:xt,init:s(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{Ct as diagram};
@@ -0,0 +1 @@
1
+ import{a as t}from"./chunk-4EMNKR2T-CyLGLodZ.js";import{c as e}from"./chunk-ZCHMQSOR-t517tTkb.js";import{_ as n,l as o}from"./mermaid.core-VF3HuzPL.js";import"./graph-rGqC_56m.js";import"./isSymbol-D2gNAbOe.js";import"./isUndefined--MLpwE__.js";import"./index-38k9tHSo.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-BLDufAOm.js";import"./settings-6x4qNkNZ.js";import"./constants.js";import"./LoaderLayer-Csc8unUJ.js";import"./websocket-D79arGLt.js";import"./index-3QSNRp1k.js";import"motion/react";import"react-dom";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"@ably/spaces/dist/mjs/react";import"./string-DPJhNSkw.js";function r(e,{measure:n}){const o=e.config?.swimlane?.lineHops;if(!1===o)return;const r="gap"===o?"gap":"arc",s=e.edges.filter(t=>Array.isArray(t.points)&&t.points.length>=2).map(t=>({id:t.id,points:t.points,curve:t.curve,arrowTypeStart:t.arrowTypeStart,arrowTypeEnd:t.arrowTypeEnd}));t(n.groups.edgePaths,s,{enabled:!0,jumpRadius:6,jumpStyle:r})}n(r,"applySwimlaneLineJumps");var s="__swimlane_default__";function i(t){return Math.max(t.padding??20,20)}function a(t){const{x:e,y:n,width:o,height:r}=t,s=t.swimlaneContentTop;if("number"!=typeof e||"number"!=typeof n||"number"!=typeof o||"number"!=typeof r||"number"!=typeof s||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(r)||!Number.isFinite(s)||o<=0||r<=0)return void delete t.groupTitleRect;const i=n-r/2,a=Math.min(s,n+r/2),c=i+Math.min(21,Math.max(0,a-i));c<=i?delete t.groupTitleRect:t.groupTitleRect={left:e-o/2,right:e+o/2,top:i,bottom:c}}function c(t){const e=t.direction,n=t.nodes??=[];for(const n of t.nodes??[])n.isGroup&&!n.parentId&&(n.shape="swimlane",e&&(n.direction=e));const o=n.filter(t=>!t.isGroup&&!t.parentId);if(0===o.length)return;let r=n.find(t=>t.id===s);r?r.isGroup&&(r.shape="swimlane",e&&(r.direction=e)):(r={id:s,label:"",isGroup:!0,shape:"swimlane",padding:20,look:t.config?.look,colorIndex:n.reduce((t,e)=>Math.max(t,e.colorIndex??-1),-1)+1,...e?{direction:e}:{}},n.push(r));for(const t of o)t.parentId=s}function f(t){const e=new Map;for(const n of t.nodes??[])e.set(n.id,n);const n=[];for(const e of t.edges??[]){const t="string"==typeof e.start?e.start:void 0,o="string"==typeof e.end?e.end:void 0;t&&o&&(e.labelNodeId||n.push({id:e.id,src:t,dst:o,ref:e}))}const o=t.nodes??[],r=o.filter(t=>t.isGroup),s=o.filter(t=>!t.isGroup);return{nodes:[...[...r].reverse(),...s].map(t=>t.id),edges:n,layout:t,nodeById:e}}function d(t,e,n,o){const{layout:r}=t,s=t.nodeById,c=o?.layerGap??100,f=o?.nodeGap??40;let d=0;for(const t of e.layers){let e=0;for(const o of t){const t=s.get(o);if(!t){e++;continue}t.layer=d,t.order=e;const r=n.x[o]??e*f,i=n.y[o]??d*c;t.x=r,t.y=i,e++}d++}const l=r.nodes??[],u=new Map,h=[];for(const t of l){if(!t?.isGroup)continue;t.parentId||h.push(t);const e=l.filter(e=>e.parentId===t.id);let o=1/0,r=-1/0,s=1/0,a=-1/0;for(const t of e){const e=t.x??n.x[t.id],i=t.y??n.y[t.id],c=t.width??0,f=t.height??0;null!=e&&null!=i&&(o=Math.min(o,e-c/2),r=Math.max(r,e+c/2),s=Math.min(s,i-f/2),a=Math.max(a,i+f/2))}if(o===1/0||s===1/0)t.x=t.x??0,t.y=t.y??0,t.width=t.width??0,t.height=t.height??0;else{const e=t.padding??20,n=t.parentId?e:2*i(t),c=e,f=Math.max(0,r-o)+n,d=Math.max(0,a-s)+c,l=(o+r)/2,h=(s+a)/2;t.x=l,t.y=h,t.width=f,t.height=d,u.set(t.id,{minX:o,maxX:r,minY:s,maxY:a})}}if(h.length>0&&u.size>0){let t=1/0,e=-1/0,n=0;for(const o of h){const r=o.padding??20;r>n&&(n=r);const s=u.get(o.id);s&&(t=Math.min(t,s.minY),e=Math.max(e,s.maxY))}if(t!==1/0&&e!==-1/0){const o=36,r=Math.max(0,e-t)+2*Math.max(n,o),s=(t+e)/2;for(const e of h)e.y=s,e.height=r,e.swimlaneContentTop=t;const c=[...h].sort((t,e)=>(t.x??0)-(e.x??0)),f=[],d=[],l=[];for(const t of c){const e=u.get(t.id);if(!e)continue;const n=Math.max(0,e.maxX-e.minX)+2*i(t),o=(e.minX+e.maxX)/2;f.push(t.id),d.push(o),l.push(n)}const g=f.length;if(g>0){const t=new Map;if(1===g)t.set(f[0],l[0]);else{const e=[];for(let t=0;t<g-1;t++)e.push(d[t+1]-d[t]);const n=new Array(g);n[0]=0;for(let t=0;t<g-1;t++)n[t+1]=2*e[t]-n[t];let o=0,r=Number.POSITIVE_INFINITY;for(let t=0;t<g;t++){const e=l[t];t%2==0?o=Math.max(o,e-n[t]):r=Math.min(r,n[t]-e)}let s=o;s=o<=r?(o+r)/2:o;for(let e=0;e<g;e++){const o=n[e]+(e%2==0?s:-s),r=Math.max(l[e],o);t.set(f[e],r)}}for(const e of h){const n=t.get(e.id);null!=n&&(e.width=n),a(e)}}}}}n(i,"topLaneHorizontalPadding"),n(a,"assignTopLaneTitleRect"),n(c,"prepareLayoutForSwimlanes"),n(f,"toGraphView"),n(d,"writeBackToLayoutData");function l(t){const e=[],n=[],r=new Map;for(const e of t.nodes)r.set(e.id,e);for(const s of t.edges){if(!s.label||0===s.label.length)continue;if(s.isLayoutOnly)continue;if(s.labelNodeId)continue;const t=s.start?r.get(s.start):void 0,i=s.end?r.get(s.end):void 0;if(!t||!i){o.warn("[EdgeLabelNodes]",`Edge ${s.id} has missing source or target node`);continue}const a=`edge-label-${s.start}-${s.end}-${s.id}`,c=t.parentId!==i.parentId?i.parentId:t.parentId,f={id:a,label:s.label,edgeStart:s.start??"",edgeEnd:s.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:c,isGroup:!1,labelStyle:Array.isArray(s.labelStyle)?s.labelStyle[0]:s.labelStyle??"",...t.dir?{dir:t.dir}:{}};e.push(f),s.labelNodeId=a,s.label=void 0,s.text=void 0;const d={id:`${s.id}-to-label`,start:s.start,end:a,type:"normal",isLayoutOnly:!0},l={id:`${s.id}-from-label`,start:a,end:s.end,type:"normal",isLayoutOnly:!0};n.push(d,l)}const s=[...t.nodes,...e],i=[...t.edges,...n];return{...t,nodes:s,edges:i}}n(l,"createEdgeLabelNodes");var u=.001;function h(t){const e=t.x??0,n=t.y??0,o=t.width??0,r=t.height??0;return o>0&&r>0?{cx:e,cy:n,rect:T(e,n,o,r)}:void 0}function g(t){if(t.isGroup)return;const e=h(t);if(!e)return;return{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}}function p(t,e,n=u){return Math.abs(t.x-e.x)<n&&Math.abs(t.y-e.y)<n}function m(t,e,n=u){return Math.abs(t.x-e.x)<n}function x(t,e,n=u){return Math.abs(t.y-e.y)<n}function y(t,e,n=u){return x(t,e,n)&&Math.abs(t.x-e.x)>n}function b(t,e,n=u){return m(t,e,n)&&Math.abs(t.y-e.y)>n}function M(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)))}function I(t,e,n=u){return t.horizontal&&e.horizontal&&x(t.a,e.a,n)?M(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&m(t.a,e.a,n)?M(t.a.y,t.b.y,e.a.y,e.b.y):0}function S(t,e=u){const n=[];for(let o=0;o<t.length-1;o++){const r=t[o],s=t[o+1],i=y(r,s,e),a=b(r,s,e);(i||a)&&n.push({index:o,a:r,b:s,horizontal:i,vertical:a})}return n}function w(t,e=u){const n=S(t,e);let o=0;for(let t=1;t<n.length;t++)n[t-1].horizontal!==n[t].horizontal&&o++;return o}function v(t,e=u){const n=[];for(const o of t){const t=n.length>0?n[n.length-1]:void 0;t&&p(t,o,e)||n.push({x:o.x,y:o.y})}return n}function C(t,e=u){if(!t||4!==t.length)return;const[n,o,r,s]=t;if(y(n,o,e)&&b(o,r,e)&&y(r,s,e))return{kind:"HVH",p0:n,p1:o,p2:r,p3:s};return b(n,o,e)&&y(o,r,e)&&b(r,s,e)?{kind:"VHV",p0:n,p1:o,p2:r,p3:s}:void 0}function L(t,e,n,o=0){const r=Math.min(t.x,e.x),s=Math.max(t.x,e.x),i=Math.min(t.y,e.y),a=Math.max(t.y,e.y);return s>n.left-o&&r<n.right+o&&a>n.top-o&&i<n.bottom+o}function k(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}function O(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom}function R(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}function N(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}function T(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}function B(t){return h(t)?.rect}function F(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}}}function E(t,e,n,o,r,s=u){const i="left"===e||"right"===e,a="left"===o||"right"===o;if(i&&a){if("right"===e&&"left"===o&&t.x<n.x||"left"===e&&"right"===o&&t.x>n.x){if(x(t,n,s))return[t,n];const e=(t.x+n.x)/2;return[t,{x:e,y:t.y},{x:e,y:n.y},n]}if(e===o){if(x(t,n,s))return;const o="left"===e?Math.min(t.x,n.x)-r:Math.max(t.x,n.x)+r;return[t,{x:o,y:t.y},{x:o,y:n.y},n]}return}if(!i&&!a){if(e===o){if(m(t,n,s))return;const o="top"===e?Math.min(t.y,n.y)-r:Math.max(t.y,n.y)+r;return[t,{x:t.x,y:o},{x:n.x,y:o},n]}if(!("bottom"===e&&"top"===o&&t.y<n.y||"top"===e&&"bottom"===o&&t.y>n.y))return;if(m(t,n,s))return[t,n];const i=(t.y+n.y)/2;return[t,{x:t.x,y:i},{x:n.x,y:i},n]}if(i&&!a){const r="right"===e&&n.x>t.x||"left"===e&&n.x<t.x,s="top"===o&&t.y<n.y||"bottom"===o&&t.y>n.y;return r&&s?[t,{x:n.x,y:t.y},n]:void 0}const c="bottom"===e&&n.y>t.y||"top"===e&&n.y<t.y,f="left"===o&&t.x<n.x||"right"===o&&t.x>n.x;return c&&f?[t,{x:t.x,y:n.y},n]:void 0}function $(t,e,n,o){return"left"===e||"right"===e?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}function Y(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const t=g(o);t&&(e.set(t.id,t),n.push({id:t.id,rect:t.rect}))}return{nodeInfoById:e,realNodeRects:n}}function X(t){const e=[],n=[];for(const o of t){const t=g(o);if(!t)continue;const r={id:t.id,rect:t.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}function z(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const t=o.x??0,r=o.y??0,s=o.width??0,i=o.height??0;n.push({nodeId:o.id,...T(t,r,s,i)})}return n}function P(t,e,n=u){const o=t.start,r=t.end;if(!o||!r)return;const s=e.get(o),i=e.get(r);return s&&i?{srcId:o,dstId:r,srcInfo:s,dstInfo:i,collinearX:Math.abs(s.cx-i.cx)<n,collinearY:Math.abs(s.cy-i.cy)<n}:void 0}function G(t,e,n,o=[],r=0){for(const s of n)if(!o.includes(s.id)&&L(t,e,s.rect,-r))return!0;return!1}function D(t,e,n,o,r=u,s=1e-6){const i=x(t,e,r),a=m(t,e,r),c=x(n,o,r),f=m(n,o,r);if(i&&c||a&&f)return!1;if(!i&&!a||!c&&!f)return!1;const d=i?{a:t,b:e}:{a:n,b:o},l=a?{a:t,b:e}:{a:n,b:o},h=d.a.y,g=Math.min(d.a.x,d.b.x),p=Math.max(d.a.x,d.b.x),y=l.a.x,b=Math.min(l.a.y,l.b.y),M=Math.max(l.a.y,l.b.y);if(y<g||y>p||h<b||h>M)return!1;const I=Math.abs(y-d.a.x)<s&&Math.abs(h-d.a.y)<s||Math.abs(y-d.b.x)<s&&Math.abs(h-d.b.y)<s,S=Math.abs(y-l.a.x)<s&&Math.abs(h-l.a.y)<s||Math.abs(y-l.b.x)<s&&Math.abs(h-l.b.y)<s;return!(I&&S)}function A(t,e,n,o,r=u){const s=x(t,e,r),i=m(t,e,r),a=x(n,o,r),c=m(n,o,r);return i&&c&&m(t,n,r)?M(t.y,e.y,n.y,o.y)>r:!!(s&&a&&x(t,n,r))&&M(t.x,e.x,n.x,o.x)>r}function H(t,e,n,o,{epsilon:r=u,skipDegenerateOther:s=!1}={}){for(const i of n){if(i===o||i.isLayoutOnly)continue;const n=i.points;if(n&&!(n.length<2))for(let o=0;o<n.length-1;o++){const i=n[o],a=n[o+1];if((!s||!p(i,a,r))&&(D(t,e,i,a,r)||A(t,e,i,a,r)))return!0}}return!1}function j(t,e,n,o,r=u){const s=x(t,e,r),i=m(t,e,r),a=x(n,o,r),c=m(n,o,r);if(!(s&&c||i&&a))return!1;const f=s?{a:t,b:e}:{a:n,b:o},d=s?{a:n,b:o}:{a:t,b:e},l=f.a.y,h=Math.min(f.a.x,f.b.x),g=Math.max(f.a.x,f.b.x),p=d.a.x,y=Math.min(d.a.y,d.b.y),b=Math.max(d.a.y,d.b.y);return p>h+r&&p<g-r&&l>y+r&&l<b-r}function _(t,e,n){const o=Math.min(e,n),r=Math.max(e,n);return t>o+u&&t<r-u}function V(t,e,n){return m(t,e)&&m(e,n)?_(e.y,t.y,n.y):!(!x(t,e)||!x(e,n))&&_(e.x,t.x,n.x)}function W(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){const r=n[n.length-1],s=t[o],i=o+1<t.length?t[o+1]:void 0;if(r&&i){if(p(r,i)){o++,e=!0;continue}if(V(r,s,i)){e=!0;continue}}n.push(s)}return{points:n,changed:e}}function K(t){const e=[t[0]];for(let n=1;n<t.length;n++){const o=e[e.length-1],r=t[n];if(!m(o,r)&&!x(o,r)){const t=e.length>=2?e[e.length-2]:void 0,n=!!t&&m(t,o)?{x:o.x,y:r.y}:{x:r.x,y:o.y};e.push(n)}e.push(r)}const n=[];for(const t of e){const e=n[n.length-1];e&&p(e,t)||n.push(t)}return n}function q(t){if(t.length<3)return t;let e=[...t];for(let t=0;t<32;t++){const t=W(e);if(e=t.points,!t.changed)break}return e}n(h,"measuredNodeRect"),n(g,"nodeBoundsInfoFor"),n(p,"samePoint"),n(m,"sameX"),n(x,"sameY"),n(y,"isHorizontalSegment"),n(b,"isVerticalSegment"),n(M,"overlapLength"),n(I,"sameAxisSegmentOverlapLength"),n(S,"orthogonalSegmentsForPoints"),n(w,"countOrthogonalBends"),n(v,"dedupeConsecutivePoints"),n(C,"classifyThreeSegmentRoute"),n(L,"segmentBoundsOverlapRect"),n(k,"pointInsideRect"),n(O,"rectContainsRect"),n(R,"rectsOverlap"),n(N,"inflateRect"),n(T,"rectFromCenterSize"),n(B,"rectOfNodeBounds"),n(F,"portForRectSide"),n(E,"buildOrthogonalPortPath"),n($,"buildSameSideTrackPath"),n(Y,"collectRealNodeBounds"),n(X,"collectNodeRectEntries"),n(z,"collectLayoutNodeRects"),n(P,"getNodePairGeometry"),n(G,"segmentHitsAnyRect"),n(D,"orthogonalSegmentsCross"),n(A,"sameAxisSegmentsOverlap"),n(H,"segmentConflictsWithAnyEdge"),n(j,"orthogonalSegmentsStrictlyCross"),n(_,"strictlyBetween"),n(V,"isCollinearIntermediate"),n(W,"simplifyPolylineOnce"),n(K,"orthogonalizePolyline"),n(q,"simplifyPolyline");var U=.001;function J(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length<n)return;const r=o.start?e.get(o.start):void 0,s=o.end?e.get(o.end):void 0;return{edge:o,points:o.points,srcRect:r?B(r):void 0,dstRect:s?B(s):void 0}}function Z(t,e,n){if(x(t,e,U)){return{x:t.x<n.left?n.left:n.right,y:t.y}}if(m(t,e,U)){const e=t.y<n.top?n.top:n.bottom;return{x:t.x,y:e}}return{x:Math.min(n.right,Math.max(n.left,t.x)),y:Math.min(n.bottom,Math.max(n.top,t.y))}}function Q(t,e,n){const o=n?1:-1;let r=n?0:t.length-1;for(;r>=0&&r<t.length&&k(t[r],e,.5);)r+=o;if(r<0||r>=t.length)return t;const s=r-o;if(s<0||s>=t.length)return t;const i=Z(t[r],t[s],e);return n?[i,...t.slice(r)]:[...t.slice(0,r+1),i]}function tt(t,e){for(const n of t){const t=J(n,e,2);if(!t)continue;let o=[...t.points];t.srcRect&&(o=Q(o,t.srcRect,!0)),t.dstRect&&(o=Q(o,t.dstRect,!1)),o=q(K(o)),o=lt(o,t.srcRect,t.dstRect),t.edge.points=q(K(o))}}function et(t,e,n,o=!1){if(x(t,e,U)){if(e.y<n.top-U||e.y>n.bottom+U)return e;if(o){if(t.x<n.left-U)return{x:n.left,y:t.y};if(t.x>n.right+U)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(m(t,e,U)){if(e.x<n.left-U||e.x>n.right+U)return e;if(o){if(t.y<n.top-U)return{x:t.x,y:n.top};if(t.y>n.bottom+U)return{x:t.x,y:n.bottom}}const r=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:r?n.top:n.bottom}}return e}function nt(t,e,n){const o=t[e];for(let r=e+n;r>=0&&r<t.length;r+=n){const e=t[r];if(!p(e,o,U))return e}return t[e+n]}function ot(t,e){const n=t+4,o=e-4;return n<=o?{lo:n,hi:o}:{lo:(t+e)/2,hi:(t+e)/2}}function rt(t,e,n){const{lo:o,hi:r}=ot(e,n);return Math.min(r,Math.max(o,t))}function st(t){const e=Math.max(...t.map(t=>t.lo)),n=Math.min(...t.map(t=>t.hi));if(!(e>n))return{lo:e,hi:n}}function it(t,e){return"left"===e||"right"===e?ot(t.top,t.bottom):ot(t.left,t.right)}function at(t,e,n){const o=t.y>=n.top-U&&t.y<=n.bottom+U,r=t.x>=n.left-U&&t.x<=n.right+U;if(x(t,e,U)&&o){if(Math.abs(t.x-n.left)<U)return"left";if(Math.abs(t.x-n.right)<U)return"right"}if(m(t,e,U)&&r){if(Math.abs(t.y-n.top)<U)return"top";if(Math.abs(t.y-n.bottom)<U)return"bottom"}}function ct(t){return"left"===t||"right"===t}function ft(t,e,n,o,r){const s=[],i=n?at(t,e,n):void 0,a=o?at(e,t,o):void 0;return n&&i&&ct(i)===r&&s.push(it(n,i)),o&&a&&ct(a)===r&&s.push(it(o,a)),s.length>0?st(s):void 0}function dt(t,e,n,o,r){const s=ft(t,e,n,o,r);if(!s)return;const i=r?t.y:t.x,a=Math.min(s.hi,Math.max(s.lo,i));return Math.abs(a-i)<U?void 0:r?[{x:t.x,y:a},{x:e.x,y:a}]:[{x:a,y:t.y},{x:a,y:e.y}]}function lt(t,e,n){if(2!==t.length)return t;const[o,r]=t;return x(o,r,U)?dt(o,r,e,n,!0)??t:m(o,r,U)?dt(o,r,e,n,!1)??t:t}function ut(t,e,n){return ct(n)?{x:t.x,y:rt(t.y,e.top,e.bottom)}:{x:rt(t.x,e.left,e.right),y:t.y}}function ht(t,e,n,o,r,s){const i=t.map(t=>({...t}));for(let a=e;a>=0&&a<t.length;a+=n){const e=t[a];if(s&&!x(e,o,U))break;if(!s&&!m(e,o,U))break;s?i[a].y=r.y:i[a].x=r.x}return i}function gt(t,e,n){if(t.length<2)return t;const o=n?0:t.length-1,r=n?1:-1,s=t[o],i=nt(t,o,r);if(!i)return t;const a=at(s,i,e);if(!a)return t;const c=ct(a),f=ut(s,e,a);return p(s,f,U)?t:ht(t,o,r,s,f,c)}function pt(t,e,n){const o=Math.min(t.x,e.x)>=n.left-U&&Math.max(t.x,e.x)<=n.right+U,r=Math.min(t.y,e.y)>=n.top-U&&Math.max(t.y,e.y)<=n.bottom+U;return Math.abs(t.y-n.top)<U&&Math.abs(e.y-n.top)<U&&o?"top":Math.abs(t.y-n.bottom)<U&&Math.abs(e.y-n.bottom)<U&&o?"bottom":Math.abs(t.x-n.left)<U&&Math.abs(e.x-n.left)<U&&r?"left":Math.abs(t.x-n.right)<U&&Math.abs(e.x-n.right)<U&&r?"right":void 0}function mt(t,e,n,o){switch(t){case"top":return m(e,n,U)&&n.y<o.top-U;case"bottom":return m(e,n,U)&&n.y>o.bottom+U;case"left":return x(e,n,U)&&n.x<o.left-U;case"right":return x(e,n,U)&&n.x>o.right+U}}function xt(t,e,n){if(t.length<3)return t;if(n){const n=pt(t[0],t[1],e);return n&&mt(n,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,r=pt(t[o-1],t[o],e);return r&&mt(r,t[o-1],t[o-2],e)?t.slice(0,o):t}function yt(t,e,n){let o=t;if(e){const t=nt(o,0,1);if(t){const n=et(t,o[0],e);n!==o[0]&&(o=[n,...o.slice(1)])}o=xt(o,e,!0)}if(n){const t=o.length-1,e=nt(o,t,-1);if(e){const r=et(e,o[t],n,!0);r!==o[t]&&(o=[...o.slice(0,t),r])}o=xt(o,n,!1)}const r=lt(o,e,n);return r!==o||2===o.length?r:(e&&(o=gt(o,e,!0)),n&&(o=gt(o,n,!1)),o)}function bt(t,e){for(const n of t){const t=J(n,e,2);if(!t)continue;const o=yt(v(t.points,U),t.srcRect,t.dstRect);if(o.length<3){t.edge.points=o;continue}const r=[o[0],{...o[0]},...o.slice(1,-1),o[o.length-1],{...o[o.length-1]}];t.edge.points=r}}function Mt(t){return new Map(t.map(t=>[t.id,t]))}function It(t,e){let n=t.parentId,o=null;for(;n;){const t=e.get(n);if(!t?.isGroup)break;o=t.id,n=t.parentId}return o}function St(t,e){let n=0,o=t.parentId;for(;o;){const t=e.get(o);if(!t?.isGroup)break;n++,o=t.parentId}return n}function wt(t){let e=1/0,n=-1/0,o=1/0,r=-1/0;for(const s of t){const t=s.x,i=s.y;if("number"!=typeof t||"number"!=typeof i)continue;const a=s.width??0,c=s.height??0;e=Math.min(e,t-a/2),n=Math.max(n,t+a/2),o=Math.min(o,i-c/2),r=Math.max(r,i+c/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:r}}function vt(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}function Ct(t){const e=Mt(t),n=t.filter(t=>t.isGroup&&t.parentId).sort((t,n)=>St(n,e)-St(t,e));for(const e of n){const n=wt(t.filter(t=>t.parentId===e.id));n&&vt(e,n)}}function Lt(t,e){const o=t.nodes??[],r=t.edges??[],s=o.filter(t=>!t.isGroup);let i=1/0,a=-1/0;for(const t of s){const n=t[e];"number"==typeof n&&(i=Math.min(i,n),a=Math.max(a,n))}if(!Number.isFinite(i)||!Number.isFinite(a))return!1;const c=n(t=>i+a-t,"mirror");for(const t of o){const n=t[e];"number"==typeof n&&(t[e]=c(n));const o=t.groupTitleRect;o&&(t.groupTitleRect="x"===e?{...o,left:c(o.right),right:c(o.left)}:{...o,top:c(o.bottom),bottom:c(o.top)})}for(const t of r)for(const n of t.points??[])n[e]=c(n[e]);return!0}function kt(t){return!(t.nodes??[]).some(t=>!t.isGroup)||Lt(t,"y")}function Ot(t,e="LR"){const n=t.nodes??[],o=t.edges??[],r=n.filter(t=>!t.isGroup);let s=1/0,i=1/0;for(const t of r){const e=t.x??0,n=t.y??0;e<s&&(s=e),n<i&&(i=n)}if(!Number.isFinite(s)||!Number.isFinite(i))return!1;const a=36;let c=0,f=0;for(const t of r)c+=t.width??0,f+=t.height??0;const d=c/r.length,l=f/r.length,u=l>0?Math.max(1,d/l):1;for(const t of r){const e=t.x??0,n=((t.y??0)-i)*u+a,o=e-s;t.x=n,t.y=o}for(const t of o)if(t.points)for(const e of t.points){const t=e.x,n=(e.y-i)*u+a,o=t-s;e.x=n,e.y=o}Ct(n);const h=n.filter(t=>t.isGroup&&!t.parentId);if(0===h.length)return"RL"===e&&Lt(t,"x"),!0;const g=Mt(n),p=new Map;for(const t of n){if(t.isGroup)continue;const e=It(t,g);if(!e)continue;const n=p.get(e)??[];n.push(t),p.set(e,n)}let m=0;for(const t of h){const e=t.padding??0;e>m&&(m=e)}const x=[];let y=1/0,b=-1/0;for(const t of h){const e=wt(p.get(t.id)??[]);e&&(y=Math.min(y,e.minX),b=Math.max(b,e.maxX),x.push({lane:t,contentTop:e.minY,contentBottom:e.maxY,centerY:(e.minY+e.maxY)/2}))}if(y===1/0||b===-1/0)return!0;const M=Math.max(0,b-y)+2*Math.max(m,10),I=a+M,S=(y+b)/2-M/2-a,w=S+I/2,v=Math.max(m,a);x.sort((t,e)=>t.centerY-e.centerY);for(let t=0;t<x.length;t++){const e=x[t];let n,o;if(0===t)n=e.contentTop-v;else{n=(x[t-1].contentBottom+e.contentTop)/2}if(t===x.length-1)o=e.contentBottom+v;else{const n=x[t+1];o=(e.contentBottom+n.contentTop)/2}const r=Math.max(0,o-n),s=(n+o)/2;e.lane.x=w,e.lane.y=s,e.lane.width=I,e.lane.height=r,e.lane.swimlaneContentTop=e.contentTop,e.lane.groupTitleRect={left:S,right:S+a,top:n,bottom:o}}return"RL"===e&&Lt(t,"x"),!0}n(J,"endpointContextFor"),n(Z,"segmentEnterPoint"),n(Q,"clipEndpoint"),n(tt,"clipEdgeEndpointsToNodeBoundaries"),n(et,"snapEndpointToBoundary"),n(nt,"firstDistinctAdjacent"),n(ot,"cornerClearanceRange"),n(rt,"clampToCornerClearance"),n(st,"intersectRanges"),n(it,"clearanceRangeForSide"),n(at,"terminalSideForSegment"),n(ct,"isHorizontalSide"),n(ft,"straightClearanceRange"),n(dt,"clearStraightEndpointCornerAxis"),n(lt,"clearStraightEndpointCornerConnections"),n(ut,"cornerClearedEndpoint"),n(ht,"moveCollinearEndpointRun"),n(gt,"clearEndpointCornerConnection"),n(pt,"borderSideForSegment"),n(mt,"leavesOutward"),n(xt,"collapseOwnBorderStub"),n(yt,"snapAndCollapseEndpoints"),n(bt,"prepareEdgeEndpointsForRenderer"),n(Mt,"buildNodeMap"),n(It,"resolveTopLevelGroupId"),n(St,"groupDepth"),n(wt,"boundsForChildren"),n(vt,"applyGroupBounds"),n(Ct,"recomputeNestedGroupBounds"),n(Lt,"mirrorAxis"),n(kt,"applyBtDirectionTransform"),n(Ot,"applyLrDirectionTransform");var Rt=1e-6,Nt=[0,8,-8,16,-16];function Tt(t,e){const{nodeInfoById:n,realNodeRects:o}=Y(e);for(const e of t){if(e.isLayoutOnly)continue;const r=e.points;if(!r||r.length<4)continue;const s=C(v(r,Rt),Rt);if(!s)continue;const{p3:i}=s,a="HVH"===s.kind,c=P(e,n,Rt);if(!c)continue;const{srcId:f,dstId:d,srcInfo:l,dstInfo:u,collinearX:h,collinearY:g}=c;if(h||g)continue;let m;const x=l.rect;for(const n of Nt){let r,s,c;if(a){const t=u.cy>l.cy?x.bottom:x.top,e=l.cx+n;if(e<=x.left+Rt||e>=x.right-Rt)continue;r={x:e,y:t},s={x:e,y:i.y},c={x:i.x,y:i.y}}else{const t=u.cx>l.cx?x.right:x.left,e=l.cy+n;if(e<=x.top+Rt||e>=x.bottom-Rt)continue;r={x:t,y:e},s={x:i.x,y:e},c={x:i.x,y:i.y}}const h=p(r,s,Rt),g=p(s,c,Rt);if(h&&g)continue;if(!h&&G(r,s,o,[f],1))continue;if(!g&&G(s,c,o,[d],1))continue;const y=!h&&H(r,s,t,e,{epsilon:Rt,skipDegenerateOther:!0}),b=!g&&H(s,c,t,e,{epsilon:Rt,skipDegenerateOther:!0});if(!y&&!b){m=h?[s,c]:g?[r,s]:[r,s,c];break}}m&&(e.points=m)}}function Bt(t,e){const o=.001,{realNodeRects:r,labelNodeRects:s}=X(e.values());for(const i of t){if(i.isLayoutOnly)continue;const a=i.points;if(!a||a.length<4)continue;const c=v(a,o);if(c.length<4)continue;const f=c.length-1,d=c[f],l=c[f-1],u=c[f-2],h=d.x-l.x,g=d.y-l.y,p=Math.hypot(h,g);if(p>=10||p<o)continue;const M=l.x-u.x,I=l.y-u.y;if(Math.hypot(M,I)<o)continue;const S=y(l,d,o),w=b(l,d,o),C=y(u,l,o),L=b(u,l,o);if(!(S&&L||w&&C))continue;const O=i.end,R=i.start,N=O?e.get(O):void 0;if(!N)continue;const T=N.x??0,F=N.y??0,E=B(N);if(!E)continue;let $,Y;if(L){const t=I<0;$={x:T,y:u.y},Y={x:T,y:t?E.bottom:E.top}}else{const t=M>0;$={x:u.x,y:F},Y={x:t?E.right:E.left,y:F}}if(G($,Y,r,O?[O]:[],-2))continue;if(G($,Y,s,[],-2))continue;if(R){const t=e.get(R),n=t?B(t):void 0;if(n&&k($,n,2))continue}const X=n((t,e)=>`${t.x.toFixed(3)},${t.y.toFixed(3)}|${e.x.toFixed(3)},${e.y.toFixed(3)}`,"ownSegmentKey"),z=new Set;for(let t=0;t<c.length-1;t++)z.add(X(c[t],c[t+1]));const P=n((e,n)=>{for(const r of t){if(r===i)continue;if(r.isLayoutOnly)continue;const t=r.points;if(t&&!(t.length<2))for(let r=0;r<t.length-1;r++){const s=t[r],i=t[r+1];if(!z.has(X(s,i))&&j(e,n,s,i,o))return!0}}return!1},"segmentCrossesOtherEdge");if(P($,Y))continue;if(f-3>=0){const t=c[f-3];if(G(t,$,r,[R,O].filter(t=>Boolean(t)),-2))continue;if(P(t,$))continue}const D=[...c.slice(0,f-2),$,Y];i.points=D;const A=i.labelNodeId;if(A){const t=e.get(A);if(t){const e=t.width??0,n=t.height??0;if(e>0&&n>0){let r,s,i=-1;for(let t=0;t<D.length-1;t++){const a=D[t],c=D[t+1],f=Math.hypot(c.x-a.x,c.y-a.y),d=x(a,c,o),l=m(a,c,o);(d&&f>=e+2||l&&f>=n+2)&&(f>i&&(i=f,r=(a.x+c.x)/2,s=(a.y+c.y)/2))}void 0!==r&&void 0!==s&&(t.x=r,t.y=s)}}}}}n(Tt,"portSwapToLShape"),n(Bt,"collapseShortTerminalStub");var Ft=.001,Et=n(t=>"string"==typeof t?t.toUpperCase():"","upperCaseDirection"),$t=S,Yt=n((t,e)=>m(t,e,Ft)||x(t,e,Ft),"orthogonallyAligned");function Xt(t,e){const o=n((t,e)=>{const n=t.x??0,o=t.y??0,r=e.x-n,s=e.y-o;let i=(t.width??0)/2,a=(t.height??0)/2;return Math.abs(s)*i>Math.abs(r)*a?(s<0&&(a=-a),{x:n+(0===s?0:a*r/s),y:o+a}):(r<0&&(i=-i),{x:n+i,y:o+(0===r?0:i*s/r)})},"rectIntersect"),r=n((t,n)=>{const r=v(t.points??[]);if(r.length<2)return;const s=n?t.start:t.end,i=s?e.get(s):void 0,a=i?B(i):void 0;if(!i||!s||!a)return;const c=n?r[0]:r[r.length-1],f=n?r[1]:r[r.length-2],d=o(i,c);let l=c;return Yt(f,d)&&(l=f),m(d,l,Ft)?{edge:t,edgeId:String(t.id??""),nodeId:s,atStart:n,orientation:"V",coord:d.x,min:Math.min(d.y,l.y),max:Math.max(d.y,l.y),boundary:d,railEnd:l,rect:a}:x(d,l,Ft)?{edge:t,edgeId:String(t.id??""),nodeId:s,atStart:n,orientation:"H",coord:d.y,min:Math.min(d.x,l.x),max:Math.max(d.x,l.x),boundary:d,railEnd:l,rect:a}:void 0},"terminalLaneFor"),s=n((t,e)=>Math.max(0,Math.min(t.max,e.max)-Math.max(t.min,e.min)),"projectedOverlapLength"),i=n((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation)return!1;if("H"===t.orientation){return(Math.abs(t.boundary.x-t.rect.left)<1||Math.abs(t.boundary.x-t.rect.right)<1)&&m(t.boundary,e.boundary,1)}return(Math.abs(t.boundary.y-t.rect.top)<1||Math.abs(t.boundary.y-t.rect.bottom)<1)&&x(t.boundary,e.boundary,1)},"sameTerminalFace"),a=n((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation)return!1;return s(t,e)>=8&&Math.abs(t.coord-e.coord)<.5},"exactTerminalLaneConflict"),c=n((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation||"H"!==t.orientation||t.atStart===e.atStart)return!1;const n=s(t,e);if(n<8)return!1;const o=t.rect.bottom-t.rect.top;return!(n<o||n>2*o)&&(i(t,e)&&Math.abs(t.coord-e.coord)<16)},"nearTerminalLaneConflict"),f=n((t,e)=>{const o=v(t.edge.points??[]);if(o.length<2)return;const r="V"===t.orientation?{x:t.boundary.x+e,y:t.boundary.y}:{x:t.boundary.x,y:t.boundary.y+e},s="V"===t.orientation?{x:t.railEnd.x+e,y:t.railEnd.y}:{x:t.railEnd.x,y:t.railEnd.y+e};if(!n(()=>Math.abs(t.boundary.y-t.rect.top)<1||Math.abs(t.boundary.y-t.rect.bottom)<1?x(r,t.boundary,Ft)&&r.x>=t.rect.left+1&&r.x<=t.rect.right-1:(Math.abs(t.boundary.x-t.rect.left)<1||Math.abs(t.boundary.x-t.rect.right)<1)&&(m(r,t.boundary,Ft)&&r.y>=t.rect.top+1&&r.y<=t.rect.bottom-1),"boundaryStaysOnSameFace")())return;if(t.atStart){const e=o.length>1&&p(o[1],t.railEnd,Ft),n=o.slice(e?2:1),i=n[0];if(i&&!Yt(i,s))return;return[r,s,...n]}const i=o.length>1&&p(o[o.length-2],t.railEnd,Ft),a=o.slice(0,i?-2:-1),c=a[a.length-1];return!c||Yt(c,s)?[...a,s,r]:void 0},"shiftedCandidate"),d=n(t=>{const n=t.edge,o=v(n.points??[]);if(2!==o.length)return!1;const r=n.start,s=n.end,i=r?e.get(r):void 0,a=s?e.get(s):void 0;if(!i||!a)return!1;const c=i.x??0,f=i.y??0,d=a.x??0,l=a.y??0,[u,h]=o;return x(u,h,Ft)&&Math.abs(f-l)<1&&Math.abs(c-d)>1||m(u,h,Ft)&&Math.abs(c-d)<1&&Math.abs(f-l)>1},"laneIsStraightCollinearConnector"),l=[-7,7,-14,14,-21,21];for(let e=0;e<8;e++){const e=t.filter(t=>!t.isLayoutOnly).flatMap(t=>[r(t,!0),r(t,!1)]).filter(t=>Boolean(t));let n=!1;for(let t=0;t<e.length&&!n;t++)for(let o=t+1;o<e.length&&!n;o++){const s=e[t],i=e[o];if(s.edge===i.edge||!a(s,i)&&!c(s,i))continue;const u=!a(s,i),h=[s,i].sort((t,e)=>{const n=d(t),o=d(e);return n!==o?Number(n)-Number(o):Number(!e.atStart)-Number(!t.atStart)});for(const t of h){for(const o of l){const s=f(t,o);if(!s)continue;const i=r({...t.edge,points:s},t.atStart);if(i&&!e.some(e=>e.edge!==t.edge&&(a(i,e)||u&&c(i,e)))){t.edge.points=s,n=!0;break}}if(n)break}}if(!n)return}}function zt(t,e){const{realNodeRects:o,labelNodeRects:r}=X(e.values()),s=n((e,n)=>{const s=e.start,i=e.end,a=$t(n);if(a.length!==n.length-1)return!1;const c=[s,i].filter(t=>Boolean(t));for(const t of a){if(G(t.a,t.b,o,c,-2))return!1;if(G(t.a,t.b,r,[],-2))return!1}for(const n of t){if(n===e||n.isLayoutOnly)continue;const t=n.points;if(t&&!(t.length<2))for(const e of a)for(const n of $t(v(t))){if(I(e,n,.5)>=8)return!1;if(j(e.a,e.b,n.a,n.b,Ft))return!1}}return!0},"candidateIsSafe"),i=n((t,e)=>{if(e+4>=t.length)return;const n=t[e],o=t[e+1],r=t[e+2],s=t[e+3],i=t[e+4],a=y(n,o)&&b(o,r)&&y(r,s)&&b(s,i)&&m(n,s,Ft)&&m(n,i,Ft)&&m(o,r,Ft)&&(o.x-n.x)*(s.x-r.x)<0,c=b(n,o)&&y(o,r)&&b(r,s)&&y(s,i)&&x(n,s,Ft)&&x(n,i,Ft)&&x(o,r,Ft)&&(o.y-n.y)*(s.y-r.y)<0;if(a||c)return v([...t.slice(0,e+1),i,...t.slice(e+5)]);if(e+5>=t.length)return;const f=t[e+5],d=b(n,o)&&y(o,r)&&b(r,s)&&y(s,i)&&b(i,f)&&m(n,i,Ft)&&m(n,f,Ft)&&m(r,s,Ft)&&(r.x-o.x)*(i.x-s.x)<0,l=y(n,o)&&b(o,r)&&y(r,s)&&b(s,i)&&y(i,f)&&x(n,i,Ft)&&x(n,f,Ft)&&x(r,s,Ft)&&(r.y-o.y)*(i.y-s.y)<0;return d||l?v([...t.slice(0,e+1),f,...t.slice(e+6)]):void 0},"withoutDogleg");for(let e=0;e<8;e++){let e=!1;for(const n of t){if(n.isLayoutOnly)continue;const t=v(n.points??[]);for(let o=0;o<=t.length-5;o++){const r=i(t,o);if(r&&s(n,r)){n.points=r,e=!0;break}}if(e)break}if(!e)return}}function Pt(t,e){const{realNodeRects:o,labelNodeRects:r}=X(e.values()),s=t.filter(t=>!t.isLayoutOnly),i=n((t,e,n)=>v(t===e?n??[]:t.points??[]),"pointsFor"),a=n((t,e)=>{let n=0;for(let o=0;o<s.length;o++){const r=$t(i(s[o],t,e));for(let a=o+1;a<s.length;a++){const o=$t(i(s[a],t,e));for(const t of r)for(const e of o)j(t.a,t.b,e.a,e.b,Ft)&&n++}}return n},"strictCrossingCount"),c=n(t=>{const e=$t(t);if(3!==e.length)return;const n=e[1];return e[0].horizontal!==n.horizontal&&e[2].horizontal!==n.horizontal?{index:n.index,horizontal:n.horizontal,vertical:n.vertical,segment:n}:void 0},"middleRail"),f=n((t,e)=>{const n=[t.start,t.end].filter(t=>Boolean(t));return o.filter(t=>{if(n.includes(t.id))return!1;const o=t.rect;if(e.horizontal){return M(e.a.x,e.b.x,o.left,o.right)>=8&&e.a.y>=o.top-2&&e.a.y<=o.bottom+2}return M(e.a.y,e.b.y,o.top,o.bottom)>=8&&e.a.x>=o.left-2&&e.a.x<=o.right+2})},"blockingRectsFor"),d=n((t,e,n)=>{const o=t.map(t=>({...t}));if(e.horizontal)o[e.index].y=n,o[e.index+1].y=n;else{if(!e.vertical)return;o[e.index].x=n,o[e.index+1].x=n}const r=q(v(o));return $t(r).length===r.length-1?r:void 0},"candidateByMovingRail"),l=n((t,e,n)=>{const c=[t.start,t.end].filter(t=>Boolean(t)),f=$t(e);if(f.length!==e.length-1)return!1;for(const t of f){if(G(t.a,t.b,o,c,-2))return!1;if(G(t.a,t.b,r,[],-2))return!1}for(const e of s)if(e!==t)for(const t of f)for(const n of $t(i(e)))if(I(t,n,.5)>=8)return!1;return a(t,e)<=n},"candidateIsSafe");for(let t=0;t<8;t++){const t=a();let e=!1;for(const n of s){const o=i(n),r=c(o);if(!r)continue;const s=f(n,r.segment);if(0===s.length)continue;const a=r.horizontal?[Math.min(...s.map(t=>t.rect.top))-20,Math.max(...s.map(t=>t.rect.bottom))+20]:[Math.min(...s.map(t=>t.rect.left))-20,Math.max(...s.map(t=>t.rect.right))+20];for(const s of a){const i=d(o,r.segment,s);if(i&&l(n,i,t)){n.points=i,e=!0;break}}if(e)break}if(!e)return}}function Gt(t,e,o){const r=n(t=>{const e=t.groupTitleRect;if(e&&"number"==typeof e.left&&"number"==typeof e.right&&"number"==typeof e.top&&"number"==typeof e.bottom&&Number.isFinite(e.left)&&Number.isFinite(e.right)&&Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&!(e.right<=e.left)&&!(e.bottom<=e.top))return{left:e.left,right:e.right,top:e.top,bottom:e.bottom}},"validTitleRect"),s=n(t=>{if(!t.isGroup||t.parentId)return;const e=Et(t.direction??o);if("LR"===e||"RL"===e||"BT"===e)return;const n=r(t),s=t.y,i=t.height;if(!n||"number"!=typeof s||"number"!=typeof i||!Number.isFinite(s)||!Number.isFinite(i)||i<=0)return;const a=n.right-n.left,c=n.bottom-n.top;return c<=0||a<c?void 0:{node:t,rect:n}},"topLaneTitleFor"),i=n((t,e)=>{if(!t.horizontal)return!1;const n=t.a.y;return!(n<e.top-Ft||n>e.bottom+Ft)&&M(t.a.x,t.b.x,e.left,e.right)>=8},"horizontalSegmentIntersectsTitle"),a=[...e.values()].map(s).filter(t=>Boolean(t));if(0===a.length)return;let c=0;for(const e of t){if(e.isLayoutOnly)continue;const t=v(e.points??[]);for(const e of $t(t))for(const t of a)i(e,t.rect)&&(c=Math.max(c,t.rect.bottom-e.a.y+4))}if(!(c<=Ft))for(const t of a){const e=t.node.y,n=t.node.height;"number"!=typeof e||"number"!=typeof n||!Number.isFinite(e)||!Number.isFinite(n)||n<=0||(t.node.y=e-c/2,t.node.height=n+c,t.node.groupTitleRect={...t.rect,top:t.rect.top-c,bottom:t.rect.bottom-c})}}function Dt(t,e,o){const r=n(t=>{const e=t.groupTitleRect;if(e&&"number"==typeof e.left&&"number"==typeof e.right&&"number"==typeof e.top&&"number"==typeof e.bottom&&Number.isFinite(e.left)&&Number.isFinite(e.right)&&Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&!(e.right<=e.left)&&!(e.bottom<=e.top))return{left:e.left,right:e.right,top:e.top,bottom:e.bottom}},"validTitleRect"),s=n(t=>{if(!t.isGroup||t.parentId)return;if("LR"!==Et(t.direction??o))return;const e=r(t),n=t.x,s=t.width;if(!e||"number"!=typeof n||"number"!=typeof s||!Number.isFinite(n)||!Number.isFinite(s)||s<=0)return;const i=e.right-e.left,a=e.bottom-e.top;return i<=0||a<i?void 0:{node:t,rect:e}},"leftLaneTitleFor"),i=n((t,e)=>{if(!t.vertical)return!1;const n=t.a.x;return!(n<e.left-Ft||n>e.right+Ft)&&M(t.a.y,t.b.y,e.top,e.bottom)>=8},"verticalSegmentIntersectsTitle"),a=n((t,e)=>{if(!t.horizontal)return!1;const n=t.a.y;return!(n<e.top-Ft||n>e.bottom+Ft)&&M(t.a.x,t.b.x,e.left,e.right)>=8},"horizontalSegmentIntersectsTitle"),c=[...e.values()].map(s).filter(t=>Boolean(t));if(0===c.length)return;let f=0;for(const e of t){if(e.isLayoutOnly)continue;const t=v(e.points??[]);for(const e of $t(t))for(const t of c)if(i(e,t.rect))f=Math.max(f,t.rect.right-e.a.x+4);else if(a(e,t.rect)){const n=Math.min(e.a.x,e.b.x);f=Math.max(f,t.rect.right-n+4)}}if(!(f<=Ft))for(const t of c){const e=t.node.x,n=t.node.width;"number"!=typeof e||"number"!=typeof n||!Number.isFinite(e)||!Number.isFinite(n)||n<=0||(t.node.x=e-f/2,t.node.width=n+f,t.node.groupTitleRect={...t.rect,left:t.rect.left-f,right:t.rect.right-f})}}function At(t,e){const{realNodeRects:o}=X(e.values()),r=t.filter(t=>!t.isLayoutOnly),s=n((t,e=new Map)=>v(e.get(t)??t.points??[]),"replacementPointsFor"),i=n((t=new Map)=>{let e=0;for(let n=0;n<r.length;n++){const o=$t(s(r[n],t));for(let i=n+1;i<r.length;i++){const n=$t(s(r[i],t));for(const t of o)for(const o of n)j(t.a,t.b,o.a,o.b,Ft)&&e++}}return e},"crossingCount"),a=n((t=new Map)=>r.reduce((e,n)=>e+w(s(n,t)),0),"totalBends"),c=n(t=>{const e=s(t);if(e.length<4)return;const n=e[e.length-2],o=e[e.length-1];return y(n,o,Ft)||b(n,o,Ft)?{tailStart:n,terminal:o}:void 0},"terminalTailFor"),f=n((t,e)=>{const n=s(t);if(n.length<3)return;const o=n[0],r=n[1];let i;if(y(o,r,Ft))i={x:r.x,y:e.tailStart.y};else{if(!b(o,r,Ft))return;i={x:e.tailStart.x,y:r.y}}const a=q(v([o,r,i,e.tailStart,e.terminal]));return $t(a).length===a.length-1?a:void 0},"candidateWithDestinationTail"),d=n((t,e)=>{const n=[t.start,t.end].filter(t=>Boolean(t));for(const t of $t(e))if(G(t.a,t.b,o,n,-2))return!0;return!1},"pathHasNodeHit"),l=n((t,e,n)=>{for(const o of r)if(o!==t)for(const t of $t(e))for(const e of $t(s(o,n)))if(I(t,e,.5)>=8)return!0;return!1},"pathHasSharedTrack"),u=n((t,e,n)=>!d(t,e)&&!l(t,e,n),"candidateIsSafe"),h=n(()=>{const t=new Map;for(const n of r){const o=n.end;if(!o||!e.has(o))continue;if(s(n).length<4)continue;const r=t.get(o)??[];r.push(n),t.set(o,r)}return t},"edgesByDestination");for(let t=0;t<4;t++){const t=i();if(0===t)return;let e,n=t,o=a();for(const r of h().values())for(let s=0;s<r.length;s++)for(let d=s+1;d<r.length;d++){const l=r[s],h=r[d],g=c(l),p=c(h);if(!g||!p)continue;const m=f(l,p),x=f(h,g);if(!m||!x)continue;const y=new Map([[l,m],[h,x]]);if(!u(l,m,y)||!u(h,x,y))continue;const b=i(y),M=a(y);b>=t||(b>n||b===n&&M>=o||(e=y,n=b,o=M))}if(!e)return;for(const[t,n]of e)t.points=n}}function Ht(t,e){const{realNodeRects:o,labelNodeRects:r}=X(e.values()),s=t.filter(t=>!t.isLayoutOnly),i=n((t,e=new Map)=>v(e.get(t)??t.points??[]),"replacementPointsFor"),a=n((t=new Map)=>{let e=0;for(let n=0;n<s.length;n++){const o=$t(i(s[n],t));for(let r=n+1;r<s.length;r++){const n=$t(i(s[r],t));for(const t of o)for(const o of n)j(t.a,t.b,o.a,o.b,Ft)&&e++}}return e},"strictCrossingCount"),c=n((t=new Map)=>s.reduce((e,n)=>e+w(i(n,t)),0),"totalBends"),f=n(t=>{const n=t.start,o=t.end,r=n?e.get(n):void 0,s=o?e.get(o):void 0,i=r?B(r):void 0,a=s?B(s):void 0;return i&&a?{src:i,dst:a}:void 0},"endpointRectsFor"),d=n((t,e,n)=>{if(n.index<=0||n.index+1>=e.length-1)return;const o=f(t);if(o){if(n.vertical){const r=n.a.x,s=Math.min(o.src.left,o.dst.left),i=Math.max(o.src.right,o.dst.right),a=r<s-Ft?"left":r>i+Ft?"right":void 0;if(!a)return;return{edge:t,points:e,segmentIndex:n.index,axis:"vertical",side:a,coord:r,min:Math.min(n.a.y,n.b.y),max:Math.max(n.a.y,n.b.y)}}if(n.horizontal){const r=n.a.y,s=Math.min(o.src.top,o.dst.top),i=Math.max(o.src.bottom,o.dst.bottom),a=r<s-Ft?"top":r>i+Ft?"bottom":void 0;if(!a)return;return{edge:t,points:e,segmentIndex:n.index,axis:"horizontal",side:a,coord:r,min:Math.min(n.a.x,n.b.x),max:Math.max(n.a.x,n.b.x)}}}},"externalRailForSegment"),l=n(()=>{const t=[];for(const e of s){const n=i(e);for(const o of $t(n)){const r=d(e,n,o);r&&t.push(r)}}return t},"collectExternalRails"),u=n((t,e)=>t.edge!==e.edge&&t.axis===e.axis&&t.side===e.side&&M(t.min,t.max,e.min,e.max)>=8,"railsInteract"),h=n(t=>{const e=[],n=new Set;for(const o of t){if(n.has(o))continue;const r=[o],s=[];for(n.add(o);r.length>0;){const e=r.pop();s.push(e);for(const o of t)!n.has(o)&&u(e,o)&&(n.add(o),r.push(o))}s.length>1&&e.push(s)}return e},"connectedComponents"),g=n(t=>{const e=[];for(const n of t)e.some(t=>Math.abs(t-n.coord)<Ft)||e.push(n.coord);for(;e.length<t.length;){const n=Math.min(...e),o=Math.max(...e),r=t[0].side;e.push("left"===r||"top"===r?n-12*(t.length-e.length):o+12*(t.length-e.length))}return e},"uniqueCoordsFor"),p=n(t=>{const e=t.map(t=>t.coord),o=g(t),r=[];if(t.length<=6){const s=new Array(o.length).fill(!1),i=[],a=n(()=>{if(i.length!==t.length)for(const[t,e]of o.entries())s[t]||(s[t]=!0,i.push(e),a(),i.pop(),s[t]=!1);else i.some((t,n)=>Math.abs(t-e[n])>=Ft)&&r.push([...i])},"visit");return a(),r}for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){const o=[...e];[o[t],o[n]]=[o[n],o[t]],r.push(o)}return r},"coordinateAssignmentsFor"),m=n((t,e)=>{const n=new Map;for(const[o,r]of t.entries()){const t=e[o],s=n.get(r.edge)??r.points.map(t=>({x:t.x,y:t.y}));"vertical"===r.axis?(s[r.segmentIndex].x=t,s[r.segmentIndex+1].x=t):(s[r.segmentIndex].y=t,s[r.segmentIndex+1].y=t),n.set(r.edge,s)}const o=new Map;for(const[t,e]of n){const n=q(v(e));if($t(n).length!==n.length-1)return;o.set(t,n)}return o},"replacementsForAssignment"),x=n(t=>{for(const[e,n]of t){const t=[e.start,e.end].filter(t=>Boolean(t));for(const e of $t(n)){if(G(e.a,e.b,o,t,-2))return!1;if(G(e.a,e.b,r,[],-2))return!1}}for(let e=0;e<s.length;e++){const n=s[e],o=t.has(n),r=$t(i(n,t));for(let n=e+1;n<s.length;n++){const e=s[n];if(!o&&!t.has(e))continue;const a=$t(i(e,t));for(const t of r)for(const e of a)if(I(t,e,.5)>=8)return!1}}return!0},"candidateIsSafe");for(let t=0;t<4;t++){const t=a();if(0===t)return;let e,n=t,o=c(),r=Number.POSITIVE_INFINITY;for(const s of h(l()))for(const i of p(s)){const f=m(s,i);if(!f||!x(f))continue;const d=a(f);if(d>=t)continue;const l=c(f),u=s.reduce((t,e,n)=>t+Math.abs(i[n]-e.coord),0);d>n||d===n&&(l>o||l===o&&u>=r)||(e=f,n=d,o=l,r=u)}if(!e)return;for(const[t,n]of e)t.points=n}}function jt(t,e){const{realNodeRects:o,labelNodeRects:r}=X(e.values()),s=t.filter(t=>!t.isLayoutOnly),i=n((t,e,n)=>v(t===e?n??[]:t.points??[]),"pointsFor"),a=n(t=>$t(t).reduce((t,e)=>{const n=e.a.x-e.b.x,o=e.a.y-e.b.y;return t+Math.hypot(n,o)},0),"pathLength"),c=n((t,e)=>{let n=0;for(let o=0;o<s.length;o++){const r=$t(i(s[o],t,e));for(let a=o+1;a<s.length;a++){const o=$t(i(s[a],t,e));for(const t of r)for(const e of o)j(t.a,t.b,e.a,e.b,Ft)&&n++}}return n},"strictCrossingCount"),f=n((t,e)=>{if(t.horizontal){const n=t.a.y;return(Math.abs(n-e.top)<1||Math.abs(n-e.bottom)<1)&&M(t.a.x,t.b.x,e.left,e.right)>=8}if(t.vertical){const n=t.a.x;return(Math.abs(n-e.left)<1||Math.abs(n-e.right)<1)&&M(t.a.y,t.b.y,e.top,e.bottom)>=8}return!1},"segmentRunsAlongRectBorder"),d=n(t=>{const n=[t.start,t.end].filter(t=>Boolean(t)),o=[];for(const t of n){const n=e.get(t),r=n?B(n):void 0;r&&o.push(r)}return o},"endpointRectsFor"),l=n((t,e)=>{if(e+3>=t.length)return[];const n=t[e],o=t[e+1],r=t[e+2],s=t[e+3],i=y(n,o,Ft)&&b(o,r,Ft)&&y(r,s,Ft),a=b(n,o,Ft)&&y(o,r,Ft)&&b(r,s,Ft);if(!i&&!a)return[];if(!(i?Math.sign(o.x-n.x)!==Math.sign(s.x-r.x):Math.sign(o.y-n.y)!==Math.sign(s.y-r.y)))return[];const c=m(n,s,Ft)||x(n,s,Ft)?[]:[{x:n.x,y:s.y},{x:s.x,y:n.y}],f=0===c.length?[[...t.slice(0,e+1),...t.slice(e+3)]]:c.map(n=>[...t.slice(0,e+1),n,...t.slice(e+3)]),d=new Set;return f.map(t=>q(v(t))).filter(t=>{if($t(t).length!==t.length-1)return!1;if(!t.some(t=>p(t,s,Ft)))return!1;const e=t.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!d.has(e)&&(d.add(e),!0)})},"shortcutCandidatesAt"),u=n((t,e,n)=>{const a=[t.start,t.end].filter(t=>Boolean(t)),l=d(t);for(const t of $t(e)){if(G(t.a,t.b,o,a,-2))return!1;if(G(t.a,t.b,r,[],-2))return!1;if(l.some(e=>f(t,e)))return!1}for(const n of s)if(n!==t)for(const t of $t(e))for(const e of $t(i(n)))if(I(t,e,.5)>=8)return!1;return c(t,e)<=n},"candidateIsSafe");for(let t=0;t<8;t++){const t=c();let e,n,o=t,r=Number.POSITIVE_INFINITY,f=Number.POSITIVE_INFINITY;for(const d of s){const s=i(d),h=w(s,Ft),g=a(s);for(let i=0;i<=s.length-4;i++)for(const p of l(s,i)){const s=w(p,Ft),i=a(p);if(!(s<h||s===h&&i<g-Ft)||!u(d,p,t))continue;const l=c(d,p);l>o||l===o&&(s>r||s===r&&i>=f)||(e=d,n=p,o=l,r=s,f=i)}}if(!e||!n)return;e.points=n}}function _t(t,e){const o=20,r=[];for(const t of e.values()){if(t.isGroup||t.isEdgeLabel)continue;const e=t.x??0,n=t.y??0,o=B(t);o&&r.push({id:String(t.id??""),cx:e,cy:n,rect:o})}if(0===r.length)return;const s=new Map(r.map(t=>[t.id,t])),i=r.map(t=>({id:t.id,rect:t.rect})),a=["top","bottom","left","right"],c={top:Math.min(...r.map(t=>t.rect.top))-o,bottom:Math.max(...r.map(t=>t.rect.bottom))+o,left:Math.min(...r.map(t=>t.rect.left))-o,right:Math.max(...r.map(t=>t.rect.right))+o},f=t.filter(t=>!t.isLayoutOnly),d=new Map(f.map((t,e)=>[t,e])),l=n(t=>{const e="left"===t||"top"===t?-1:1,n=[];for(let r=0;r<=2;r++)n.push(c[t]+e*o*r);return n},"outwardTracksForSide"),u=n((t,e=new Map)=>v(e.get(t)??t.points??[]),"replacementPointsFor"),h=n((t,e)=>{let n=0;for(const o of t)for(const t of e)j(o.a,o.b,t.a,t.b,Ft)&&n++;return n},"crossingCountBetweenSegments"),g=n((t,e)=>h($t(t),$t(e)),"crossingCountBetweenPaths"),p=n((t=new Map)=>{let e=0;const o=[],r=new Set,s=[],i=n(t=>{r.has(t)||(r.add(t),s.push(t))},"addEdge");for(let n=0;n<f.length;n++){const r=f[n],s=u(r,t);for(let a=n+1;a<f.length;a++){const n=f[a],c=g(s,u(n,t));c>0&&(e+=c,o.push({first:r,second:n,count:c}),i(r),i(n))}}return s.sort((t,e)=>(d.get(t)??0)-(d.get(e)??0)),{count:e,pairs:o,edgeSet:r,edges:s}},"crossingSnapshot"),m=n((t,e)=>{const n=new Set(e.keys());if(0===n.size)return t.count;let o=0;for(const e of t.pairs)(n.has(e.first)||n.has(e.second))&&(o+=e.count);let r=0;for(let t=0;t<f.length;t++){const o=f[t],s=n.has(o),i=u(o,e);for(let o=t+1;o<f.length;o++){const t=f[o];(s||n.has(t))&&(r+=g(i,u(t,e)))}}return t.count-o+r},"crossingCountWithReplacements"),x=n(t=>{const e=new Map;for(const n of t.pairs){const t=e.get(n.first)??new Set;t.add(n.second),e.set(n.first,t);const o=e.get(n.second)??new Set;o.add(n.first),e.set(n.second,o)}const n=[],o=new Set;for(const r of t.edges){if(o.has(r))continue;const t=[r],s=[];for(o.add(r);t.length>0;){const n=t.pop();s.push(n);for(const r of e.get(n)??[])o.has(r)||(o.add(r),t.push(r))}s.sort((t,e)=>(d.get(t)??0)-(d.get(e)??0)),s.length>1&&n.push(s)}return n},"crossingComponents"),M=n(t=>[t.start,t.end].filter(t=>Boolean(t)),"endpointIdsFor"),S=n(t=>{const e=[];for(const n of x(t)){const t=new Set(n),o=new Set(n.flatMap(t=>M(t))),r=[...n];for(const e of f)t.has(e)||M(e).some(t=>o.has(t))&&r.push(e);r.sort((t,e)=>(d.get(t)??0)-(d.get(e)??0)),e.push(r)}return e},"pairSearchGroups"),C=n((t,e,n)=>m(t,new Map([[e,n]])),"crossingCountWithSingleReplacement"),L=n(t=>{const e=new Map;for(const n of t.pairs)e.set(n.first,(e.get(n.first)??0)+n.count),e.set(n.second,(e.get(n.second)??0)+n.count);return e},"currentCrossingsByEdge"),k=n(t=>t.slice(1).reduce((e,n,o)=>{const r=t[o];return e+Math.abs(n.x-r.x)+Math.abs(n.y-r.y)},0),"pathLength"),O=n((t=new Map)=>f.reduce((e,n)=>e+w(u(n,t)),0),"totalBends"),R=n((t=new Map)=>f.reduce((e,n)=>e+k(u(n,t)),0),"totalLength"),N=n((t,e,n=new Map)=>{const o=$t(e);for(const e of f)if(e!==t)for(const t of o)for(const o of $t(u(e,n)))if(I(t,o,.5)>=8)return!0;return!1},"pathHasSegmentConflict"),T=n((t,e)=>{const n=[t.start,t.end].filter(t=>Boolean(t));for(const t of $t(e))if(G(t.a,t.b,i,n,-2))return!0;return!1},"pathHitsNode"),Y=n((t,e)=>{const n=q(v(e));$t(n).length===n.length-1&&t.push(n)},"pushOrthogonalCandidate"),X=n(t=>"left"===t||"right"===t,"sideIsHorizontal"),z=n((t,e,n)=>{switch(e){case"left":return Math.min(t.x,n.x)-o;case"right":return Math.max(t.x,n.x)+o;case"top":return Math.min(t.y,n.y)-o;case"bottom":return Math.max(t.y,n.y)+o}},"localTrackForSameSide"),P=n((t,e,n,r)=>{const s="left"===n||"top"===n?-1:1,i=[z(e,n,r),c[n]];for(const a of i)for(let i=0;i<=2;i++)Y(t,$(e,n,r,a+s*o*i))},"addSameSideCandidates"),D=n((t,e,n,o,r)=>{for(const s of l(n))for(const n of l(r))Y(t,[e,{x:s,y:e.y},{x:s,y:n},{x:o.x,y:n},o])},"addHorizontalToVerticalCandidates"),A=n((t,e,n,o,r)=>{for(const s of l(n))for(const n of l(r))Y(t,[e,{x:e.x,y:s},{x:n,y:s},{x:n,y:o.y},o])},"addVerticalToHorizontalCandidates"),H=n((t,e,n,o,r)=>{const s=[...l("top"),...l("bottom")];for(const i of l(n))for(const n of l(r))for(const r of s)Y(t,[e,{x:i,y:e.y},{x:i,y:r},{x:n,y:r},{x:n,y:o.y},o])},"addHorizontalPairCandidates"),_=n((t,e,n,o,r)=>{const s=[...l("left"),...l("right")];for(const i of l(n))for(const n of l(r))for(const r of s)Y(t,[e,{x:e.x,y:i},{x:r,y:i},{x:r,y:n},{x:o.x,y:n},o])},"addVerticalPairCandidates"),V=n(t=>{const e=new Set;return t.map(t=>v(t)).filter(t=>{const n=t.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!(e.has(n)||t.length<2)&&(e.add(n),!0)})},"dedupeCandidatePaths"),W=n((t,e,n,r)=>{const s=[],i=E(t,e,n,r,o,Ft);i&&Y(s,i),e===r&&P(s,t,e,n);const a=X(e),c=X(r);return a&&!c?D(s,t,e,n,r):!a&&c?A(s,t,e,n,r):a?H(s,t,e,n,r):_(s,t,e,n,r),V(s)},"buildCandidatesForSides"),K=n((t,e,n,o)=>{const r=[...l("left"),...l("right")],s=[...l("top"),...l("bottom")];for(const i of a){const a=F(o,i),c="top"===i||"bottom"===i?l(i):s;for(const o of r){Y(t,[e,n,{x:o,y:n.y},{x:o,y:a.y},a]);for(const r of c)Y(t,[e,n,{x:o,y:n.y},{x:o,y:r},{x:a.x,y:r},a])}}},"addVerticalDepartureOuterTrackCandidates"),U=n((t,e,n,o)=>{const r=[...l("left"),...l("right")],s=[...l("top"),...l("bottom")];for(const i of a){const a=F(o,i),c="left"===i||"right"===i?l(i):r;for(const o of s){Y(t,[e,n,{x:n.x,y:o},{x:a.x,y:o},a]);for(const r of c)Y(t,[e,n,{x:n.x,y:o},{x:r,y:o},{x:r,y:a.y},a])}}},"addHorizontalDepartureOuterTrackCandidates"),J=n(t=>{const e=t.start,n=t.end,o=n?s.get(n):void 0;if(!e||!o)return[];const r=v(t.points??[]);if(r.length<4)return[];const i=r[0],a=r[1],c=[];return b(i,a,Ft)?K(c,i,a,o):y(i,a,Ft)&&U(c,i,a,o),c},"terminalPreservingOuterTrackCandidates"),Z=n(t=>{const e=t.start,n=t.end,o=e?s.get(e):void 0,r=n?s.get(n):void 0;if(!o||!r)return[];const i=[];for(const t of a){const e=F(o,t);for(const n of a)i.push(...W(e,t,F(r,n),n))}return i.push(...J(t)),i},"candidatePathsFor"),Q=n(()=>new Map(f.map(t=>[t,$t(u(t))])),"currentSegmentsByEdge"),tt=n((t,e,n)=>{const o=new Set;for(const r of f){if(r===t)continue;const s=n.get(r)??$t(u(r));e.some(t=>s.some(e=>I(t,e,.5)>=8))&&o.add(r)}return o},"sharedTrackConflictsFor"),et=n((t,e,n,o)=>{const r=new Set;return Z(t).map(t=>q(v(t))).filter(e=>{if(T(t,e))return!1;const n=e.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!(r.has(n)||e.length<2)&&(r.add(n),!0)}).map(r=>{const s=$t(r);let i=0;for(const e of f)e!==t&&(i+=h(s,n.get(e)??$t(u(e))));return{candidate:r,candidateSegments:s,crossings:e.count-(o.get(t)??0)+i,bends:w(r,Ft),totalBends:w(r),length:k(r)}}).filter(({crossings:t})=>t<=e.count).sort((t,e)=>t.crossings-e.crossings||t.bends-e.bends||t.length-e.length).slice(0,48).map(e=>({path:e.candidate,segments:e.candidateSegments,sharedTrackConflicts:tt(t,e.candidateSegments,n),totalBends:e.totalBends,length:e.length}))},"pairCandidatesFor"),nt=n((t,e,n,o,r,s)=>{let i=0;for(const n of t.pairs)n.first!==e&&n.second!==e&&n.first!==o&&n.second!==o||(i+=n.count);let a=h(n.segments,r.segments);for(const t of f){if(t===e||t===o)continue;const i=s.get(t)??$t(u(t));a+=h(n.segments,i)+h(r.segments,i)}return t.count-i+a},"pairCrossingCount"),ot=n((t,e)=>{for(const n of t.sharedTrackConflicts)if(n!==e)return!1;return!0},"conflictsOnlyWith"),rt=n((t,e)=>t.segments.some(t=>e.segments.some(e=>I(t,e,.5)>=8)),"candidatesShareTrack"),st=n((t,e,n,o)=>ot(e,n.edge)&&ot(o,t.edge)&&!rt(e,o),"pairCandidatesAreCompatible"),it=n((t,e,n,o,r)=>{const s=nt(t.current,e.edge,n,o.edge,r,t.baseSegments);if(!(s>=t.current.count))return{replacements:new Map([[e.edge,n.path],[o.edge,r.path]]),crossings:s,bends:t.currentBends-(t.baseBendsByEdge.get(e.edge)??0)-(t.baseBendsByEdge.get(o.edge)??0)+n.totalBends+r.totalBends,length:t.currentLength-(t.baseLengthByEdge.get(e.edge)??0)-(t.baseLengthByEdge.get(o.edge)??0)+n.length+r.length}},"scorePairReplacement"),at=n((t,e)=>t.crossings<e.crossings||t.crossings===e.crossings&&(t.bends<e.bends||t.bends===e.bends&&t.length<e.length),"pairScoreIsBetter"),ct=n((t,e,n,o)=>{let r=o;for(const o of e.candidates)for(const s of n.candidates){if(!st(e,o,n,s))continue;const i=it(t,e,o,n,s);i&&at(i,r)&&(r=i)}return r},"bestScoreForOptionPair"),ft=n(t=>{const e=O(),n=R(),o=Q(),r=L(t),s=new Map(f.map(t=>[t,w(u(t))])),i=new Map(f.map(t=>[t,k(u(t))])),a=new Map,c=S(t);for(const e of c)for(const n of e){if(a.has(n))continue;const e=et(n,t,o,r);e.length>0&&a.set(n,{edge:n,candidates:e})}let d={replacements:new Map,crossings:t.count,bends:e,length:n};const l={current:t,currentBends:e,currentLength:n,baseBendsByEdge:s,baseLengthByEdge:i,baseSegments:o};for(const e of c){const n=new Set(e.filter(e=>t.edgeSet.has(e))),o=e.map(t=>a.get(t)).filter(t=>Boolean(t));for(let t=0;t<o.length;t++){const e=o[t];for(let r=t+1;r<o.length;r++){const t=o[r];(n.has(e.edge)||n.has(t.edge))&&(d=ct(l,e,t,d))}}}return d.replacements.size>0?d.replacements:void 0},"bestPairedReplacement");for(let t=0;t<4;t++){const t=p(),e=t.count;if(0===e)return;let n,o,r=e,s=Number.POSITIVE_INFINITY;for(const i of t.edges){const a=w(u(i),Ft);for(const c of Z(i)){const f=T(i,c),d=!f&&N(i,c),l=C(t,i,c),u=w(c,Ft);if(f||d)continue;(l<e||l===e&&u<a)&&(l>r||l===r&&u>=s||(n=i,o=c,r=l,s=u))}}if(n&&o){n.points=o;continue}const i=ft(t);if(!i)return;for(const[t,e]of i)t.points=e}}n(Xt,"separateSharedRenderedTerminalLanes"),n(zt,"collapseRedundantRectangularDoglegs"),n(Pt,"liftObstacleHuggingSameSideRails"),n(Gt,"liftTopLaneTitleBandsAboveRails"),n(Dt,"shiftLeftLaneTitleBandsLeftOfRails"),n(At,"swapDestinationTerminalTailsToReduceCrossings"),n(Ht,"reassignCrossingExternalRailChannels"),n(jt,"shortcutRedundantOrthogonalJogs"),n(_t,"resolveRenderedOrthogonalCrossings");var Vt=.001;function Wt(t,e){const{nodeInfoById:o,realNodeRects:r}=Y(e),s=["top","bottom","left","right"],i={top:Math.min(...r.map(t=>t.rect.top))-20,bottom:Math.max(...r.map(t=>t.rect.bottom))+20,left:Math.min(...r.map(t=>t.rect.left))-20,right:Math.max(...r.map(t=>t.rect.right))+20},a=n((t,e,n,o)=>{const r=[],s=E(t,e,n,o,20,Vt);return s&&r.push(s),e===o&&r.push($(t,e,n,i[e])),r},"buildOrthogonalPathCandidates"),c=n((t,e)=>{for(let n=0;n<t.length-1;n++){if(G(t[n],t[n+1],r,e,1))return!0}return!1},"pathHitsNode"),f=n((e,n,o=!1)=>{let r=0;const s=S(e,Vt),i=n.start,a=n.end;for(const e of t){if(e===n||e.isLayoutOnly)continue;const t=e.start,c=e.end;if(!o&&i&&a&&(t===i||t===a||c===i||c===a))continue;const f=e.points;if(f&&!(f.length<2))for(const t of s)for(const e of S(f,Vt))(D(t.a,t.b,e.a,e.b,Vt,Vt)||I(t,e,Vt)>=8)&&r++}return r},"pathConflictCount"),d=n((t,e)=>{const n=Math.abs(t.y-e.rect.top),o=Math.abs(t.y-e.rect.bottom),r=Math.abs(t.x-e.rect.left),s=Math.abs(t.x-e.rect.right);let i="top",a=n;return o<a&&(i="bottom",a=o),r<a&&(i="left",a=r),s<a&&(i="right",a=s),i},"nearestSideOfRect"),l=new Map,u=n((t,e,n)=>{const o=l.get(t)??[];o.push({side:e,edgeId:n}),l.set(t,o)},"addFaceClaim");for(const e of t){if(e.isLayoutOnly)continue;const t=e.points??[];if(t.length<1)continue;const n=e.id??"",r=e.start,s=e.end;if(r){const e=o.get(r);e&&u(r,d(t[0],e),n)}if(s){const e=o.get(s);e&&u(s,d(t[t.length-1],e),n)}}const h=n((t,e,n)=>l.get(t)?.some(t=>t.edgeId!==n&&t.side===e)??!1,"faceIsClaimed");for(const e of t){if(e.isLayoutOnly)continue;const t=e.points;if(!t||t.length<2)continue;const n=w(t,Vt);if(n<4)continue;const r=e.start,i=e.end;if(!r||!i)continue;const g=o.get(r),p=o.get(i);if(!g||!p)continue;const m=e.id??"",x=f(t,e,!0),y=f(t,e);let b,M=x,I=n;for(const t of s){if(h(r,t,m))continue;const n=F(g,t);for(const o of s){if(h(i,o,m))continue;const s=F(p,o);for(const d of a(n,t,s,o)){if(c(d,[r,i]))continue;const t=w(d,Vt);if(x>0){const n=f(d,e,!0);if(n>M||n===M&&t>=I)continue;M=n,I=t,b=d;continue}f(d,e)>y||t<I&&(I=t,b=d)}}}if(b){e.points=b;const t=l.get(r);t&&l.set(r,t.filter(t=>t.edgeId!==m));const n=l.get(i);n&&l.set(i,n.filter(t=>t.edgeId!==m)),u(r,d(b[0],g),m),u(i,d(b[b.length-1],p),m)}}}n(Wt,"simplifyDetouredEdges");var Kt=.001;function qt(t,e){const n=e?0:t.length-1,o=e?1:-1,r=t[n],s=t[n+o];if(!r||!s)return;const i=s.x-r.x,a=s.y-r.y;if(!(Math.abs(i)+Math.abs(a)<Kt)){if(Math.abs(a)<=Kt){const t=r.x+10*Math.sign(i);return{left:Math.min(r.x,t),right:Math.max(r.x,t),top:r.y-7,bottom:r.y+7}}if(Math.abs(i)<=Kt){const t=r.y+10*Math.sign(a);return{left:r.x-7,right:r.x+7,top:Math.min(r.y,t),bottom:Math.max(r.y,t)}}return{left:Math.min(r.x,s.x),right:Math.max(r.x,s.x),top:Math.min(r.y,s.y),bottom:Math.max(r.y,s.y)}}}function Ut(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)}}function Jt(t,e){const n=v(e);return[qt(n,!0),qt(n,!1)].some(e=>e&&R(t,Ut(e)))}function Zt(t,e){const o=[];for(const e of t){if(e.isLayoutOnly)continue;const t=e.points;if(t&&!(t.length<2))for(let n=0;n<t.length-1;n++)o.push({edgeId:e.id,p1:t[n],p2:t[n+1]})}const r=[],s=[];for(const t of e.values()){const e=t.isGroup,n=t.parentId;if(e&&!n){const e=B(t);e&&s.push({id:t.id,rect:e});continue}if(e)continue;if(t.isEdgeLabel)continue;const o=B(t);o&&r.push({nodeId:t.id,rect:o})}const i=n((t,e)=>{const n=N(e,3);for(const{nodeId:e,rect:o}of r)if(e!==t&&R(n,o))return!0;return!1},"labelOverlapsForeignNode"),a=n((t,e)=>{const n=N(e,3);for(const e of o)if(e.edgeId!==t&&L(e.p1,e.p2,n))return!0;return!1},"labelOverlapsForeignEdge"),c=n((t,e,n)=>i(t,n)||a(e,n),"labelOverlapsAnything"),f=[],d=n(t=>{for(const{id:e,rect:n}of s)if(O(n,t))return e},"findContainingLane"),l=n((t,e)=>f.some(n=>n.labelId!==t&&R(e,n.rect)),"overlapsPlacedLabel");for(const o of t){if(o.isLayoutOnly)continue;const t=o.labelNodeId;if(!t)continue;const r=e.get(t);if(!r)continue;const u=o.points;if(!u||u.length<2)continue;const h=r.width??0,g=r.height??0;if(h<=0||g<=0)continue;const p=[];for(let t=0;t<u.length-1;t++){const e=u[t],n=u[t+1],o=Math.abs(e.x-n.x),r=Math.abs(e.y-n.y);o<Kt&&r<Kt||(o>=Kt&&r>=Kt||p.push({idx:t,length:o+r,orientation:o>=Kt?"horizontal":"vertical",midX:(e.x+n.x)/2,midY:(e.y+n.y)/2}))}if(0===p.length)continue;const m=p.length>=3?p.filter(t=>t.idx>0&&t.idx<p.length-1):p,x=m.length>0?m:p,y=h>=g?"horizontal":"vertical",b=n(t=>[...t].sort((t,e)=>{const n=t.orientation===y;if(n!==(e.orientation===y))return n?-1:1;const o=t.length>=("horizontal"===t.orientation?h:g)+2;return o!==e.length>=("horizontal"===e.orientation?h:g)+2?o?-1:1:e.length-t.length}),"rankSegments"),M=p[0],I=p[p.length-1],S=[.5,.25,.75,.05,.95,.15,.85,.1,.9],w=n((t,e)=>{const n=u[t.idx],o=u[t.idx+1];return{midX:n.x+(o.x-n.x)*e,midY:n.y+(o.y-n.y)*e}},"anchorAtT"),v=n((t,e,n)=>Math.min(n,Math.max(e,t)),"clamp"),C=n((t,e)=>t.midX>=e.left-Kt&&t.midX<=e.right+Kt&&t.midY>=e.top-Kt&&t.midY<=e.bottom+Kt,"pointInsideRectInclusive"),L=n(t=>{const e=T(t.midX,t.midY,h,g),n=d(e);if(n)return{laneId:n,anchor:t,rect:e};const o=s.find(({rect:e})=>C(t,e));if(!o)return;const r=o.rect.left+h/2+1,i=o.rect.right-h/2-1,a=o.rect.top+g/2+1,c=o.rect.bottom-g/2-1;if(r>i||a>c)return;const f={midX:v(t.midX,r,i),midY:v(t.midY,a,c)},l=T(f.midX,f.midY,h,g);return C(t,l)?{laneId:o.id,anchor:f,rect:l}:void 0},"placementForAnchor"),k=n((t,e,n)=>"horizontal"===t.orientation?Math.abs(e.midX-n.x):Math.abs(e.midY-n.y),"distanceAlongSegment"),O=n((t,e)=>{const n=("horizontal"===t.orientation?h/2:g/2)+12;if(t===M){const o=u[t.idx];if(k(t,e,o)+Kt<n)return!1}if(t===I){const o=u[t.idx+1];if(k(t,e,o)+Kt<n)return!1}return!0},"labelClearsTerminalEndpoints"),R=n(e=>{const n=b(e);for(const e of n)for(const n of S){const r=w(e,n);if(!O(e,r))continue;const s=L(r);if(s&&(!Jt(s.rect,u)&&!l(t,s.rect)&&!c(t,o.id,s.rect)))return{laneId:s.laneId,anchor:s.anchor}}},"tryPool"),N=n((e,n,r=!1)=>{const s=b(e);for(const e of s){const s={midX:e.midX,midY:e.midY};if(n&&!O(e,s))continue;const c=L(s);if(c&&!Jt(c.rect,u)&&!l(t,c.rect)&&!i(t,c.rect)&&(r||!a(o.id,c.rect)))return{laneId:c.laneId,anchor:c.anchor}}},"findLaneContainingFallback"),B=R(x)??(x.length<p.length?R(p):void 0)??N(p,!0)??N(p,!1)??N(p,!1,!0);if(B){r.x=B.anchor.midX,r.y=B.anchor.midY,r.parentId=B.laneId;const e=T(B.anchor.midX,B.anchor.midY,h,g),n=f.findIndex(e=>e.labelId===t);n>=0?f[n]={labelId:t,rect:e}:f.push({labelId:t,rect:e})}}}n(qt,"markerClearanceRectFor"),n(Ut,"normalizeRect"),n(Jt,"labelOverlapsOwnMarker"),n(Zt,"anchorLabelsToPolyline");var Qt=1e-6;function te(t,e){return t<e?`${t}::${e}`:`${e}::${t}`}function ee(t,e){const{nodeInfoById:o,realNodeRects:r}=Y(e),s=new Map;for(const t of e){const e=t.id;t.isGroup||t.isEdgeLabel&&s.set(e,{w:t.width??0,h:t.height??0})}const i=n((e,o,r,i)=>{const a=te(o,r);let c=0;const f=n(t=>{if(!t)return;const e=s.get(t);if(!e)return;const n="x"===i?e.w/2:e.h/2;n>c&&(c=n)},"consider");f(e.labelNodeId);for(const n of t){if(n===e)continue;if(n.isLayoutOnly)continue;const t=n.start,o=n.end;t&&o&&(te(t,o)===a&&f(n.labelNodeId))}return c>0?c+3:0},"labelClearanceFor");for(const e of t){if(e.isLayoutOnly)continue;if(!C(e.points,Qt))continue;const n=P(e,o,Qt);if(!n)continue;const{srcId:s,dstId:a,srcInfo:c,dstInfo:f,collinearX:d,collinearY:l}=n;if(d===l)continue;let u,h;if(d){const t=f.cy>c.cy;u={x:c.cx,y:t?c.rect.bottom:c.rect.top},h={x:f.cx,y:t?f.rect.top:f.rect.bottom}}else{const t=f.cx>c.cx;u={x:t?c.rect.right:c.rect.left,y:c.cy},h={x:t?f.rect.left:f.rect.right,y:f.cy}}if(G(u,h,r,[s,a],1))continue;const g=i(e,s,a,d?"x":"y"),p=g>4?g:4,m=[0,p,-p];for(const n of m){const o={...u},i={...h};if(d){if(o.x+=n,i.x+=n,o.x<=c.rect.left||o.x>=c.rect.right)continue;if(i.x<=f.rect.left||i.x>=f.rect.right)continue}else{if(o.y+=n,i.y+=n,o.y<=c.rect.top||o.y>=c.rect.bottom)continue;if(i.y<=f.rect.top||i.y>=f.rect.bottom)continue}if(!G(o,i,r,[s,a],1)&&!H(o,i,t,e,{epsilon:Qt})){e.points=[o,i];break}}}}function ne(t,e){const o=.001,{realNodeRects:r,labelNodeRects:s}=X(e.values()),i=n((t,e)=>S(e,o).map(n=>({...n,edge:t,interior:n.index>=1&&n.index<=e.length-3})),"segmentsFor"),a=n(()=>{const e=[];for(const n of t){if(n.isLayoutOnly)continue;const t=n.points;!t||t.length<2||e.push(...i(n,v(t)))}return e},"allSegments"),c=n((t,e)=>t.horizontal&&e.horizontal?M(t.a.x,t.b.x,e.a.x,e.b.x)>=8&&Math.abs(t.a.y-e.a.y)<7:!(!t.vertical||!e.vertical)&&(M(t.a.y,t.b.y,e.a.y,e.b.y)>=8&&Math.abs(t.a.x-e.a.x)<7),"hasCrowdedParallelTrack"),f=n((e,n)=>{const a=e.start,f=e.end,d=i(e,n);if(d.length!==n.length-1)return!1;const l=[a,f].filter(t=>Boolean(t)),u=e.labelNodeId?[e.labelNodeId]:[];for(const t of d){if(G(t.a,t.b,r,l,-2))return!1;if(G(t.a,t.b,s,u,-2))return!1}for(const n of t){if(n===e||n.isLayoutOnly)continue;const t=n.points;if(t&&!(t.length<2))for(const e of d)for(const r of i(n,v(t))){if(c(e,r))return!1;if(j(e.a,e.b,r.a,r.b,o))return!1}}return!0},"candidateIsSafe"),d=n((t,e)=>{const n=v(t.edge.points??[]);if(n.length<4||t.index>=n.length-1)return;const o=n.map(t=>({...t}));if(t.horizontal)o[t.index].y+=e,o[t.index+1].y+=e;else{if(!t.vertical)return;o[t.index].x+=e,o[t.index+1].x+=e}return i(t.edge,o).length===o.length-1?o:void 0},"shiftedCandidate"),l=n((t,e)=>({x:t.x??(e.left+e.right)/2,y:t.y??(e.top+e.bottom)/2}),"nodeCenter"),u=n(t=>{const n=t.edge,o=v(n.points??[]);if(4!==o.length||1!==t.index)return;const r=n.start?e.get(n.start):void 0,s=n.end?e.get(n.end):void 0,i=r?B(r):void 0,a=s?B(s):void 0,c=o.slice(t.index+2);return r&&s&&i&&a&&0!==c.length?{sourceCenter:l(r,i),targetCenter:l(s,a),sourceRect:i,tail:c}:void 0},"sourceDetourContextFor"),h=n((t,e,n,r,s,i)=>{const a=r.y>=n.y,c=a?s.bottom:s.top,f=c+(a?20:-20);if(a&&t.b.y<=f+o||!a&&t.b.y>=f-o)return;const d=t.a.x+e;return v([{x:n.x,y:c},{x:n.x,y:f},{x:d,y:f},{x:d,y:t.b.y},...i],o)},"verticalSourceDetour"),g=n((t,e,n,r,s,i)=>{const a=r.x>=n.x,c=a?s.right:s.left,f=c+(a?20:-20);if(a&&t.b.x<=f+o||!a&&t.b.x>=f-o)return;const d=t.a.y+e;return v([{x:c,y:n.y},{x:f,y:n.y},{x:f,y:d},{x:t.b.x,y:d},...i],o)},"horizontalSourceDetour"),p=n((t,e)=>{const n=u(t);if(n)return t.vertical?h(t,e,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail):t.horizontal?g(t,e,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail):void 0},"sourceDetourCandidate"),m=[-7,7,-14,14,-21,21];for(let t=0;t<12;t++){const t=a();let e=!1;for(let n=0;n<t.length&&!e;n++)for(let o=n+1;o<t.length&&!e;o++){const r=t[n],s=t[o];if(r.edge===s.edge||!c(r,s))continue;const i=[r,s].filter(t=>t.interior);for(const t of i){for(const n of m){const o=d(t,n);if(o&&f(t.edge,o)){t.edge.points=o,e=!0;break}const r=p(t,n);if(r&&f(t.edge,r)){t.edge.points=r,e=!0;break}}if(e)break}}if(!e)return}}function oe(t,e,n,o){const r=e.x-t.x,s=e.y-t.y,i=o.x-n.x,a=o.y-n.y,c=r*a-s*i;if(Math.abs(c)<1e-10)return!1;const f=n.x-t.x,d=n.y-t.y,l=(f*a-d*i)/c,u=(f*s-d*r)/c,h=.01;return l>h&&l<.99&&u>h&&u<.99}function re(t){const e=t.nodes??[],n=t.edges??[],r=[];if(!n.length||!e.length)return r;const s=z(e),i=[];for(const t of n){if(t.isLayoutOnly)continue;const e=t.points;if(!e||e.length<2)continue;const n=t.start,o=t.end,a=t.labelNodeId,c=t.id??`${n}->${o}`;for(const t of s)if(t.nodeId!==n&&t.nodeId!==o&&(!a||t.nodeId!==a))for(let n=0;n<e.length-1;n++)if(L(e[n],e[n+1],t,-1)){r.push({type:"edge-node-overlap",edgeId:c,targetId:t.nodeId,detail:`segment ${n} passes through node "${t.nodeId}"`});break}for(let t=0;t<e.length-1;t++)i.push({edgeId:c,start:n,end:o,p1:e[t],p2:e[t+1]})}const a=new Set;for(let t=0;t<i.length;t++)for(let e=t+1;e<i.length;e++){const n=i[t],o=i[e];if(n.edgeId!==o.edgeId&&(n.start!==o.start&&n.start!==o.end&&n.end!==o.start&&n.end!==o.end&&oe(n.p1,n.p2,o.p1,o.p2))){const t=n.edgeId<o.edgeId?`${n.edgeId}|${o.edgeId}`:`${o.edgeId}|${n.edgeId}`;a.has(t)||(a.add(t),r.push({type:"edge-edge-crossing",edgeId:n.edgeId,targetId:o.edgeId,detail:`edges "${n.edgeId}" and "${o.edgeId}" cross`}))}}if(r.length>0){const t=r.filter(t=>"edge-node-overlap"===t.type).length,e=r.filter(t=>"edge-edge-crossing"===t.type).length;o.warn(`[SWIMLANE_VALIDATE] ${r.length} issue(s) detected: ${t} edge-node overlap(s), ${e} edge crossing(s)`);for(const t of r)o.warn(`[SWIMLANE_VALIDATE] ${t.type}: ${t.detail}`)}return r}function se(t,e){const o=t.nodes??[],r=t.edges??[],s=o.filter(t=>!t.isGroup);if(("LR"===e||"RL"===e)&&s.length>0&&!Ot(t,e))return;if("BT"===e&&s.length>0&&!kt(t))return;for(const t of r){if(t.isLayoutOnly)continue;const e=t.points;!e||e.length<2||(t.points=q(K(e)))}Wt(r,o),ee(r,o),Tt(r,o);const i=new Map;for(const t of o)i.set(String(t.id),t);Zt(r,i),tt(r,i),Bt(r,i),ne(r,i),Xt(r,i),zt(r,i),Pt(r,i),At(r,i);const a=n(()=>{_t(r,i),Xt(r,i),Ht(r,i),jt(r,i),Zt(r,i),bt(r,i),Pt(r,i),Zt(r,i),bt(r,i)},"finalizeRenderedEdges");a(),ne(r,i),a(),Gt(r,i,e),Dt(r,i,e),Gt(r,i,e),Dt(r,i,e)}function ie(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const t=`${r.id}:${r.src}->${r.dst}`;n.has(t)||(n.add(t),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}function ae(t,e){return t.edges.filter(t=>t.dst===e)}function ce(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}function fe(t){const e=ce(t);for(const t of e.values())t.sort((t,e)=>t.localeCompare(e));return e}function de(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}function le(t,e){const o=[...e.entries()].filter(([,t])=>0===t).map(([t])=>t).sort((t,e)=>t.localeCompare(e)),r=new Set(t.edges.flatMap(t=>[t.src,t.dst])),s=n(e=>!r.has(e)&&!t.nodeById.get(e)?.isGroup,"isUnconnected"),i=[...e.keys()].filter(t=>0===e.get(t)&&s(t));let a=0;return o.map(t=>s(t)?i[a++]:t)}function ue(t,e=()=>!0){const n=new Map,o=new Map;for(const e of t.nodes)n.set(e,[]),o.set(e,[]);for(const r of t.edges)e(r)&&(o.get(r.src).push(r.dst),n.get(r.dst).push(r.src));return{preds:n,succs:o}}function he(t,e,n,o){let r=0;for(const e of t.nodes)o?.skipGroups&&t.nodeById.get(e)?.isGroup||(r=Math.max(r,n[e]??0));const s=Array.from({length:r+1},()=>[]);for(const r of e)o?.skipGroups&&t.nodeById.get(r)?.isGroup||s[Math.max(0,n[r]??0)].push(r);return s}function ge(t){const e=de(t),n=le(t,e),o=[],r=fe(t);for(;n.length;){const t=n.shift();o.push(t);for(const o of r.get(t)??[])if(e.set(o,(e.get(o)??0)-1),0===(e.get(o)??0)){let t=0;for(;t<n.length&&n[t]<o;)t++;n.splice(t,0,o)}}return o.length===t.nodes.length?o:null}function pe(t){const e=new Map;let n=0;for(const o of t)e.set(o,n),n++;return e}function me(t){const e=new Array(t.length),o=n((n,r)=>{if(r-n<=1)return 0;const s=n+r>>1;let i=o(n,s)+o(s,r),a=n,c=s,f=n;for(;a<s||c<r;)c>=r||a<s&&t[a]<=t[c]?e[f++]=t[a++]:(e[f++]=t[c++],i+=s-a);for(let o=n;o<r;o++)t[o]=e[o];return i},"count");return o(0,t.length)}function xe(t){const e=ie(t),o=new Map;for(const t of e.nodes)o.set(t,[]);for(const t of e.edges)o.get(t.src).push(t);for(const t of o.values())t.sort((t,e)=>t.dst===e.dst?t.id.localeCompare(e.id):t.dst.localeCompare(e.dst));const r=Object.create(null);for(const t of e.nodes)r[t]=0;const s=[],i=n(t=>{r[t]=1;for(const e of o.get(t)??[]){const t=e.dst;0===r[t]?i(t):1===r[t]&&s.push(e)}r[t]=2},"dfs"),a=de(e),c=[...e.nodes.filter(t=>0===(a.get(t)??0)),...e.nodes.filter(t=>0!==(a.get(t)??0))];for(const t of c)0===r[t]&&i(t);const f=new Set(s.map(t=>`${t.id}:${t.src}->${t.dst}`)),d=e.edges.map(t=>f.has(`${t.id}:${t.src}->${t.dst}`)?{id:t.id,src:t.dst,dst:t.src,weight:t.weight,ref:t.ref}:t);return{acyclic:{nodes:[...e.nodes],edges:d,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}function ye(t){const e=new Map,o=n(n=>{if(e.has(n))return e.get(n);const r=t.nodeById.get(n);if(!r)return e.set(n,null),null;const s=r.parentId;if(!s)return e.set(n,null),null;const i=o(s)??s;return e.set(n,i),i},"resolve");for(const e of t.nodes)o(e);return e}function be(t){const e=ye(t);return t=>e.get(t)??null}function Me(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}function Ie(t,e){const n=Me(t);if(!e||0===e.length)return n;const o=new Set(n),r=new Set,s=[];for(const t of e)o.has(t)&&!r.has(t)&&(r.add(t),s.push(t));for(const t of n)r.has(t)||s.push(t);return s}n(te,"pairKey"),n(ee,"straightenCollinearSiblingDetours"),n(ne,"nudgeSharedInteriorSubpaths"),n(oe,"segmentsIntersect"),n(re,"validateSwimlanesLayout"),n(se,"postProcessSwimlaneLayout"),n(ie,"normalizeGraph"),n(ae,"incoming"),n(ce,"buildSuccessorMap"),n(fe,"buildSortedSuccessorMap"),n(de,"buildInDegreeMap"),n(le,"sortedZeroInDegreeNodes"),n(ue,"buildPredecessorSuccessorMaps"),n(he,"buildLayersFromRanks"),n(ge,"topoSortIfAcyclic"),n(pe,"buildLayerIndex"),n(me,"countInversions"),n(xe,"removeCycles_DFS"),n(ye,"buildTopLaneMap"),n(be,"createTopLaneResolver"),n(Me,"buildTopLaneOrder"),n(Ie,"resolveTopLaneOrder");var Se=8,we=4,ve=!0,Ce=100,Le=40;function ke(t,e){const o=ie(t),r=e?.laneOf??(()=>null),s=e?.rankHint,{preds:i}=ue(o);for(const t of i.values())t.sort((t,e)=>t.localeCompare(e));const a=ge(o)??[...o.nodes].sort((t,e)=>t.localeCompare(e)),c=new Map;for(const[t,e]of a.entries())c.set(e,t);const f=new Map,d=new Map;for(const t of o.nodes)d.set(t,[]);for(const t of a){const e=(i.get(t)??[]).filter(t=>f.has(t));if(e.length>0){const n=Oe(t,e,{laneOf:r,rankHint:s,topoIndex:c});f.set(t,n),d.get(n).push(t)}else f.has(t)||f.set(t,null)}for(const t of o.nodes)f.has(t)||f.set(t,null);const l=new Set;for(const t of o.nodes)null===(f.get(t)??null)&&l.add(t);const u=[...l].sort((t,e)=>{const n=c.get(t)??0,o=c.get(e)??0;return n===o?t.localeCompare(e):n-o}),h=Re(o),g=new Map;for(const[t,e]of h.entries())g.set(t,[...e].sort((t,e)=>t.localeCompare(e)));const p=Ne(g),m=Te(g),x=new Map;for(const t of o.nodes)x.set(t,[]);for(const t of m)for(const e of t.nodes){const n=x.get(e);n?n.push(t.id):x.set(e,[t.id])}const y=[],b=[],M=new Set,I=n(t=>{if(!M.has(t)){M.add(t),y.push(t);for(const e of d.get(t)??[])I(e);b.push(t)}},"walk");for(const t of u)I(t);for(const t of a)I(t);return{parent:f,children:d,roots:u,componentOf:p,blocks:m,nodeBlocks:x,adjacency:g,preorder:y,postorder:b,topologicalOrder:a}}function Oe(t,e,n){const o=n.laneOf(t);return[...e].sort((t,e)=>{const r=n.laneOf(t),s=n.laneOf(e),i=null!=r&&r===o;if(i!==(null!=s&&s===o))return i?-1:1;const a=n.rankHint?.[t],c=n.rankHint?.[e];if(null!=a&&null!=c&&a!==c)return c-a;const f=n.topoIndex.get(t)??0,d=n.topoIndex.get(e)??0;return f!==d?f-d:t.localeCompare(e)})[0]}function Re(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}function Ne(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const r=[o];for(;r.length>0;){const o=r.pop();if(!e.has(o)){e.set(o,n);for(const n of t.get(o)??[])e.has(n)||r.push(n)}}n++}return e}function Te(t){const e=new Map,o=new Map,r=[],s=[];let i=0;const a=n((n,c)=>{e.set(n,++i),o.set(n,i);for(const f of t.get(n)??[])f!==c&&(e.has(f)?(e.get(f)??0)<(e.get(n)??0)&&(r.push([n,f]),o.set(n,Math.min(o.get(n)??i,e.get(f)??i))):(r.push([n,f]),a(f,n),o.set(n,Math.min(o.get(n)??i,o.get(f)??i)),(o.get(f)??0)>=(e.get(n)??0)&&s.push(Be(n,f,r,s.length))))},"visit");for(const n of t.keys())e.has(n)||a(n,null);return s}function Be(t,e,n,o){const r=[],s=new Set;for(;n.length>0;){const o=n.pop();if(r.push(o),s.add(o[0]),s.add(o[1]),o[0]===t&&o[1]===e||o[0]===e&&o[1]===t)break}return{id:o,edges:r,nodes:[...s]}}function Fe(t,e,o){const r=[...t.nodes],s=new Map;for(const[t,e]of r.entries())s.set(e,t);const i=r.length,a=new Array(i).fill(-1),c=new Array(i).fill(0),f=[],d=new Set;for(const t of r){const e=o.parent.get(t)??null,n=s.get(t);null!=n&&(null==e&&(a[n]=-1,c[n]=0,d.has(t)||(d.add(t),f.push(t))))}for(;f.length>0;){const t=f.shift(),e=s.get(t);if(null==e)continue;const n=o.children.get(t)??[];for(const t of n){if(d.has(t))continue;const n=s.get(t);null!=n&&(a[n]=e,c[n]=c[e]+1,d.add(t),f.push(t))}}for(const t of r){if(d.has(t))continue;const e=s.get(t);null!=e&&(a[e]=-1,c[e]=0,d.add(t))}const l=Math.max(1,Math.ceil(Math.log2(Math.max(1,i)))+1),u=Array.from({length:l},()=>new Array(i).fill(-1));for(let t=0;t<i;t++)u[0][t]=a[t];for(let t=1;t<l;t++)for(let e=0;e<i;e++){const n=u[t-1][e];u[t][e]=-1===n?-1:u[t-1][n]}const h=n((t,e)=>{if(-1===t||-1===e)return-1;c[t]<c[e]&&([t,e]=[e,t]);const n=c[t]-c[e];for(let e=0;e<l;e++)if(n>>e&1&&-1===(t=u[e][t]))return-1;if(t===e)return t;for(let n=l-1;n>=0;n--){const o=u[n][t],r=u[n][e];-1!==o&&-1!==r&&(o!==r&&(t=o,e=r))}return u[0][t]},"lcaIndex"),g=Array.from({length:i},()=>new Map);for(const n of t.edges){let t=n.src,o=n.dst,r=e[t],i=e[o];if(null==r||null==i)continue;if(r>i&&([t,o]=[o,t],[r,i]=[i,r]),null==r||null==i||r===i)continue;const a=s.get(t),c=s.get(o);if(null==a||null==c)continue;const f=h(a,c);if(-1===f)continue;const d=g[f];for(let t=r;t<i;t++)d.set(t,(d.get(t)??0)+1)}const p=new Map,m=n((t,e)=>{if(0!==e.size)for(const[n,o]of e)t.set(n,(t.get(n)??0)+o)},"mergeInto"),x=new Set,y=n(t=>{const n=s.get(t);x.add(t);const r=null==n?void 0:g[n],i=r?new Map(r):new Map,a=o.children.get(t)??[];for(const n of a){const o=y(n),r=e[t];if(null!=r){let s=p.get(t);s||(s=new Map,p.set(t,s));let i=o.get(r)??0;const a=e[n];null!=a&&a>r&&(i+=1),s.set(n,i)}m(i,o)}return i},"dfs");for(const t of o.roots)x.has(t)||y(t);for(const t of r)x.has(t)||y(t);return p}function Ee(t,e,o){const r=new Map,s=n(t=>{let n=o[t]??0;const i=[...e.get(t)??[]];i.sort($e(o));for(const t of i){s(t);const e=r.get(t);null!=e&&(n=Math.min(n,e))}r.set(t,n)},"annotate");for(const e of t)s(e);return r}function $e(t){return(e,n)=>{const o=t[e]??0,r=t[n]??0;return o===r?e.localeCompare(n):o-r}}function Ye(t,e,o,r){let s=0;for(const t of e){const e=o[t]??0;e>s&&(s=e)}const i=Array.from({length:s+1},()=>[]),a=new Set,c=n(t=>{if(a.has(t))return;a.add(t);const e=o[t]??0;i[e]||(i[e]=[]),i[e].push(t);for(const e of r(t))c(e)},"emit");for(const e of t)c(e);for(const t of e)if(!a.has(t)){const e=o[t]??0;i[e]||(i[e]=[]),i[e].push(t),a.add(t)}return i}function Xe(t){const e=[];for(const n of t){const t=new Set,o=[];for(const e of n)t.has(e)||(t.add(e),o.push(e));e.push(o)}return e}function ze(t,e,n,o){return r=>{const s=t.get(r)??[];if(0===s.length)return[];const i=e[r]??0,a=[],c=[],f=n.get(r);for(const t of s){const e=o.get(t)??i;e>i?a.push({child:t,min:e}):c.push(t)}return a.sort((t,e)=>t.min===e.min?t.child.localeCompare(e.child):t.min-e.min),c.sort((t,e)=>{const n=f?.get(t)??0,r=f?.get(e)??0;if(n!==r)return n-r;const s=o.get(t)??i,a=o.get(e)??i;return s!==a?s-a:t.localeCompare(e)}),[...a.map(t=>t.child),...c]}}function Pe(t,e,n){const o=ke(t,{rankHint:e,laneOf:n}),{children:r,roots:s}=o;for(const e of t.nodes)r.has(e)||r.set(e,[]);const i=Fe(t,e,o),a=[...s].sort($e(e)),c=ze(r,e,i,Ee(a,r,e));let f=Ye(a,t.nodes,e,c);return f=Xe(f),f}function Ge(t,e,n){const o=new Set(t),r=new Set(e),s=pe(e),i=[];for(const t of n)o.has(t.src)&&r.has(t.dst)&&i.push(s.get(t.dst));return me(i)}function De(t,e,n){const o=[];for(const t of e){const e=n[t.src],r=n[t.dst];if(null==e||null==r||e===r)continue;let s=t.src,i=t.dst,a=e,c=r;e>r&&(s=t.dst,i=t.src,a=r,c=e);for(let e=a;e<c;e++)o.push({id:`${t.id}@${e}`,src:s,dst:i,ref:t.ref})}let r=0;for(let e=0;e+1<t.length;e++)r+=Ge(t[e],t[e+1],o);return r}function Ae(t,e){const n={...e},{preds:o}=ue(t),r=be(t);let s=De(Pe(t,n,r),t.edges,n);const i=we;for(let e=0;e<i;e++){let e=!1;const i=[...t.nodes].sort((t,e)=>(n[e]??0)-(n[t]??0));for(const a of i){const i=n[a]??0;if(0===i)continue;let c=0;for(const t of o.get(a)??[])c=Math.max(c,(n[t]??0)+1);if(c>=i)continue;const f=i;n[a]=c;const d=De(Pe(t,n,r),t.edges,n);d<s?(s=d,e=!0):n[a]=f}if(!e)break}return n}function He(t,e){const n=be(t),o=[...t.nodes].sort((t,n)=>(e[t]??0)-(e[n]??0)||t.localeCompare(n));for(const r of o){const o=n(r);if(!o)continue;const s=t.edges.filter(t=>t.src===r);if(0===s.length)continue;let i=!1,a=0;for(const t of s){const e=n(t.dst);null==e||e===o?i=!0:a++}if(0===a||i)continue;let c=0,f=!1;for(const e of t.edges){if(e.dst!==r)continue;const t=n(e.src);t&&(t===o?f=!0:c++)}if(c>0||!f)continue;const d=e[r]??0,l=d+a;let u=0;for(const n of t.edges)n.dst===r&&(u=Math.max(u,(e[n.src]??0)+1));const h=Math.max(d,u,l);h!==d&&(e[r]=h)}}function je(t,e){const n=ie(t),o=ge(n)??[...n.nodes].sort(),r=e?.compactSingleInput??!1,s=be(n);let i=Object.create(null);for(const t of o){const o=ae(n,t),a=e?.ignoreCrossLaneEdges?o.filter(e=>{const n=s(e.src),o=s(t);return!n||!o||n===o}):o;if(0===a.length)i[t]=0;else if(r&&1===a.length){const e=a[0].src,n=s(e),o=s(t);i[t]=n!==o?i[e]??0:(i[e]??0)+1}else{let e=-1/0;for(const t of a)e=Math.max(e,(i[t.src]??0)+1);i[t]=e===-1/0?0:e}}e?.optimizeRanksByCrossings&&(i=Ae(n,i)),e?.ignoreCrossLaneEdges&&He(n,i);return{layers:Pe(n,i,s),rankOf:i,dummy:new Set}}function _e(t,e){const o=ie(t),r={...je(o,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}).rankOf},s=be(o),{preds:i,succs:a}=ue(o,t=>{if(e?.ignoreCrossLaneEdges){const e=s(t.src),n=s(t.dst);if(e&&n&&e!==n)return!1}return!0}),c=ge(o)??[...o.nodes],f=[...c].reverse(),d=n((t,e)=>{let n=0;for(const e of i.get(t)??[])n=Math.max(n,(r[e]??0)+1);let o=Number.POSITIVE_INFINITY;const s=a.get(t)??[];return s.length>0&&(o=Math.min(...s.map(t=>(r[t]??0)-1))),Number.isFinite(o)||(o=Math.max(n,e)),Math.min(Math.max(e,n),o)},"clampFeasible"),l=Se,u=n(t=>{let e=!1;for(const n of t){const t=i.get(n)??[],o=a.get(n)??[];if(0===t.length&&0===o.length)continue;const s=t.length>0?t.reduce((t,e)=>t+(r[e]??0)+1,0)/t.length:r[n]??0,c=o.length>0?o.reduce((t,e)=>t+(r[e]??0)-1,0)/o.length:r[n]??0,f=Math.round((s+c)/2),l=d(n,f);l!==r[n]&&(r[n]=l,e=!0)}return e},"relaxOrder");for(let t=0;t<l;t++){const t=u(c),e=u(f);if(!t&&!e)break}for(const t of c){let e=0;for(const n of i.get(t)??[])e=Math.max(e,(r[n]??0)+1);(r[t]??0)<e&&(r[t]=e)}for(const t of f){const e=a.get(t)??[];if(e.length>0){const n=Math.min(...e.map(t=>(r[t]??0)-1));(r[t]??0)>n&&(r[t]=n)}}return{layers:he(o,c,r),rankOf:r,dummy:new Set}}function Ve(t){const e=de(t),n=fe(t);let o=le(t,e);const r=[];for(;o.length>0;){const t=[];for(const s of o){r.push(s);for(const o of n.get(s)??[])e.set(o,(e.get(o)??0)-1),0===(e.get(o)??0)&&t.push(o)}o=t.sort((t,e)=>t.localeCompare(e))}return r.length===t.nodes.length?r:null}function We(t,e){const o=ie(t),r="LR"===e?.direction?Ve(o)??[...o.nodes].sort():ge(o)??[...o.nodes].sort(),s=be(o),i=n(t=>s(t)??t,"laneOf"),a=Object.create(null),c=new Map,f=n((t,n)=>e?.ignoreCrossLaneEdges??!0?i(t)===i(n)?1:0:1,"edgeWeight");for(const t of r){const e=o.nodeById.get(t);if(e?.isGroup)continue;const n=ae(o,t);let r=0;if(n.length>0)for(const e of n){const n=e.src,o=a[n]??0;r=Math.max(r,o+f(n,t))}const s=i(t),d=c.get(s)??0,l=Math.max(r,d);a[t]=l,c.set(s,l+1)}return{layers:he(o,r,a,{skipGroups:!0}),rankOf:a,dummy:new Set}}function Ke(t,e){const o=ie(e),{rankOf:r}=t,s=t.layers.map(t=>[...t]),i=new Set(t.dummy?[...t.dummy]:[]);let a=0;const c=new Map(o.nodeById),f=n(t=>{const e="placeholder-"+a++,n={id:e,isGroup:!1,isDummy:!0,width:0,height:0};for(c.set(e,n),i.add(e);s.length<=t;)s.push([]);return s[t].push(e),r[e]=t,e},"addDummyAt"),d=[...o.edges].sort((t,e)=>t.id===e.id?t.src===e.src?t.dst.localeCompare(e.dst):t.src.localeCompare(e.src):t.id.localeCompare(e.id)),l=[];for(const t of d){const e=r[t.src]??0,n=r[t.dst]??0;if(n-e<=1){l.push(t);continue}let o=t.src;for(let r=e+1,s=0;r<n;r++,s++){const e=f(r);l.push({id:`${t.id}#${s}`,src:o,dst:e,weight:t.weight,ref:t.ref}),o=e}const s=n-e-2;l.push({id:`${t.id}#${Math.max(s+1,0)}`,src:o,dst:t.dst,weight:t.weight,ref:t.ref})}const u={nodes:[...o.nodes,...[...i].filter(t=>!o.nodes.includes(t))],edges:l,layout:o.layout,nodeById:c};return{layering:{layers:s,rankOf:r,dummy:i},graphWithDummies:u}}function qe(t){const e=t.length;if(0===e)return Number.POSITIVE_INFINITY;const n=[...t].sort((t,e)=>t-e);return e%2==1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}function Ue(t){if(0===t.length)return Number.POSITIVE_INFINITY;return t.reduce((t,e)=>t+e,0)/t.length}function Je(t,e,n,o){const r=new Map;for(const e of t)r.set(e,[]);for(const t of n)"down"===o?e.has(t.src)&&r.has(t.dst)&&r.get(t.dst).push(e.get(t.src)):e.has(t.dst)&&r.has(t.src)&&r.get(t.src).push(e.get(t.dst));return r}function Ze(t,e,n){const o=n.get(t)??0,r=n.get(e)??0;return o!==r?o-r:t.localeCompare(e)}function Qe(t,e,n){const o=new Set(t),r=new Set(e),s=pe(t),i=pe(e),a=[];for(const t of n)o.has(t.src)&&r.has(t.dst)&&a.push({u:s.get(t.src),v:i.get(t.dst)});a.sort((t,e)=>t.u===e.u?t.v-e.v:t.u-e.u);return me(a.map(t=>t.v))}function tn(t,e,n){return[...t].sort((t,o)=>{const r=qe(e.get(t)??[]),s=qe(e.get(o)??[]);return r===s?Ze(t,o,n):isFinite(r)?isFinite(s)?r-s:-1:1})}function en(t,e,n,o,r,s){const i=pe(t),a=pe(e),c=Je(e,i,n,o);if(!r||!s||0===s.length)return tn(e,c,a);const f=new Map;for(const t of e){const e=r(t),n=f.get(e)??[];n.push(t),f.set(e,n)}const d=[];for(const t of s){const e=f.get(t);if(!e||0===e.length)continue;const n=tn(e,c,a);d.push(...n)}const l=f.get(null);if(l&&l.length>0){const t=tn(l,c,a);for(const e of t){const t=Ue(c.get(e)??[]);let n=d.length;if(isFinite(t))for(const[e,o]of d.entries()){if(t<Ue(c.get(o)??[])){n=e;break}}d.splice(n,0,e)}}return d}function nn(t,e,o,r,s){const i=[...e],a=new Set(t),c=new Set(e),f=r?new Set(r):null,d=o.filter(t=>a.has(t.src)&&c.has(t.dst)),l=f?o.filter(t=>c.has(t.src)&&f.has(t.dst)):void 0,u=n(e=>{let n=Qe(t,e,d);return l&&r&&(n+=Qe(e,r,l)),n},"crossingScore"),h=s?new Map:null;if(s&&h)for(const t of e)h.set(t,s(t));let g=!0,p=u(i);for(;g;){g=!1;for(let t=0;t+1<i.length;t++){if(h){if(h.get(i[t])!==h.get(i[t+1]))continue}const e=p;[i[t],i[t+1]]=[i[t+1],i[t]];const n=u(i);n<e?(p=n,g=!0):[i[t],i[t+1]]=[i[t+1],i[t]]}}return i}function on(t,e,n){const o=t.layers.map(t=>[...t]),r=e.edges,s=be(e),i=Ie(e,n?.laneOrder);for(let t=0;t<3;t++){for(let t=1;t<o.length;t++)o[t]=en(o[t-1],o[t],r,"down",s,i),o[t]=nn(o[t-1],o[t],r,o[t+1],s);for(let t=o.length-2;t>=0;t--)o[t]=en(o[t+1],o[t],r,"up",s,i),o[t]=nn(o[t+1],o[t],r,o[t-1],s)}return{layers:o}}function rn(t,e,o){const r=o?.layerGap??Ce,s=o?.nodeGap??Le,i=o?.laneGap??2*s,a=o?.direction??"TB",c="LR"===a||"RL"===a,f=t.layers,d=Object.create(null),l=Object.create(null),u=n(t=>e.nodeById.get(t),"getNode"),h=n(t=>u(t)?.width??0,"getWidth"),g=n(t=>u(t)?.height??0,"getHeight"),p=be(e),m=Ie(e,o?.laneOrder),x=f.map(t=>t.reduce((t,e)=>Math.max(t,g(e)),0)),y=[];if(c)for(let t=0;t+1<f.length;t++){const e=f[t].reduce((t,e)=>Math.max(t,h(e)),0),n=f[t+1].reduce((t,e)=>Math.max(t,h(e)),0),o=x[t]/2+x[t+1]/2,s=(e+n)/2,i=Math.max(0,s-o-r);y.push(i)}const b=new Set;for(const t of f)for(const e of t)b.add(p(e));const M=b.has(null),I=m.filter(t=>b.has(t)),S=[...M?[null]:[],...I],w=Object.create(null);for(const t of I)w[t]=0;M&&(w.null=0);for(const t of f){const e=Object.create(null),n=[];for(const o of t){const t=p(o);null===t?n.push(o):(e[t]||=[]).push(o)}for(const[t,n]of Object.entries(e)){const e=n.reduce((t,e)=>t+h(e),0)+s*Math.max(0,n.length-1);w[t]=Math.max(w[t]??0,e)}if(M&&n.length){const t=n.reduce((t,e)=>t+h(e),0)+s*Math.max(0,n.length-1);w.null=Math.max(w.null??0,t)}}const v=new Map;{const t=S.map(t=>(null===t?w.null:w[t])??0);let e=-(t.reduce((t,e)=>t+e,0)+i*Math.max(0,S.length-1))/2;for(let n=0;n<S.length;n++){const o=S[n],r=t[n]??0,s=e+r/2;v.set(o,s),e+=r,n<S.length-1&&(e+=i)}}let C=0;for(const[t,e]of f.entries()){const n=x[t]??0,o=new Map;for(const t of e){const e=p(t),n=o.get(e)??[];n.push(t),o.set(e,n)}for(const t of S){const e=o.get(t)??[];if(0===e.length)continue;const r=v.get(t);if(1===e.length){const t=e[0];d[t]=r,l[t]=C+n/2}else{const t=e.map(t=>h(t));let o=r-(t.reduce((t,e)=>t+e,0)+s*(e.length-1))/2;for(const[r,i]of e.entries()){const e=t[r];d[i]=o+e/2,l[i]=C+n/2,o+=e+s}}}C+=n+r+(y[t]??0)}const L=new Map;for(const t of e.edges){const e=t.ref.id;L.has(e)||L.set(e,[]),L.get(e).push(t)}for(const[,t]of L){if(0===t.length)continue;const n=t[0].ref,o=n.start,r=n.end;if(null==o||null==r)continue;const s=Math.round(((d[o]??0)+(d[r]??0))/2),i=new Set;for(const e of t)i.add(e.src),i.add(e.dst);for(const t of i){if(t===o||t===r)continue;const n=e.nodeById.get(t);n?.isDummy&&(d[t]=s)}}return{x:d,y:l}}n(ke,"buildDrivingTree"),n(Oe,"chooseParent"),n(Re,"buildAdjacency"),n(Ne,"assignComponents"),n(Te,"computeBlocks"),n(Be,"popBlock"),n(Fe,"computeSubtreeCrossCounts"),n(Ee,"annotateMinimumLayers"),n($e,"compareByRankThenId"),n(Ye,"emitNodesInTreeOrder"),n(Xe,"deduplicateLayers"),n(ze,"createChildOrderer"),n(Pe,"buildMultitreeLayerOrder"),n(Ge,"countCrossingsBetweenAdjacent"),n(De,"totalCrossings"),n(Ae,"optimizeRanksByCrossings"),n(He,"adjustCrossLaneSources"),n(je,"assignLayers_LongestPath"),n(_e,"assignLayers_Gravity"),n(Ve,"topoSortByGenerationIfAcyclic"),n(We,"assignLayers_LaneAwareCompact"),n(Ke,"makeProperLayering"),n(qe,"median"),n(Ue,"barycenter"),n(Je,"neighborPositionsFor"),n(Ze,"currentOrderTieBreak"),n(Qe,"countCrossingsBetweenAdjacent"),n(tn,"sortByHeuristic"),n(en,"reorderLayer"),n(nn,"transposeImprove"),n(on,"orderLayers"),n(rn,"assignCoordinates");function sn(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}function an(t){let e=t>>>0;return()=>{e+=1831565813;let t=e;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}function cn(t,e){const n=[...t],o=an(e);for(let t=n.length-1;t>0;t--){const e=Math.floor(o()*(t+1));[n[t],n[e]]=[n[e],n[t]]}return n}function fn(t,e){let n=0;for(const[o,r]of t.entries())n+=Math.abs(o-(e.get(r)??o));return n}function dn(t,e){const n=new Map;for(const[e,o]of t.entries())n.set(o,e);let o=0;for(const{a:t,b:r,weight:s}of e){const e=n.get(t),i=n.get(r);null!=e&&null!=i&&(o+=s*Math.abs(e-i))}return o}function ln(t){const e=Me(t);if(e.length<2)return[];const n=new Map(e.map((t,e)=>[t,e])),o=be(t),r=new Map;for(const e of t.layout.edges??[]){if(e.isLayoutOnly)continue;const s="string"==typeof e.start?e.start:void 0,i="string"==typeof e.end?e.end:void 0;if(!(s&&i&&t.nodeById.has(s)&&t.nodeById.has(i)))continue;const a=o(s),c=o(i);if(!a||!c||a===c)continue;const f=n.get(a),d=n.get(c);if(null==f||null==d)continue;const[l,u]=f<=d?[a,c]:[c,a],h=`${l}\0${u}`,g=r.get(h);g?g.weight++:r.set(h,{a:l,b:u,weight:1})}return[...r.values()]}function un(t,e,n){const o=[...t];let r=dn(o,e),s=!0,i=0;const a=Math.max(1,o.length);for(;s&&i<a;){s=!1,i++;for(let t=0;t+1<o.length;t++){[o[t],o[t+1]]=[o[t+1],o[t]];const n=dn(o,e);n<r?(r=n,s=!0):[o[t],o[t+1]]=[o[t+1],o[t]]}}return{order:o,cost:r,sourceDistance:fn(o,n)}}function hn(t,e){return t.cost!==e.cost?t.cost<e.cost:t.sourceDistance<e.sourceDistance}function gn(t,e,n){const o=[...e].sort((t,e)=>t.a===e.a?t.b.localeCompare(e.b):t.a.localeCompare(e.a)).map(({a:t,b:e,weight:n})=>`${t}:${e}:${n}`).join("|");return sn(`${t.join("|")}#${o}#${n}`)}function pn(t,e={}){const n=Me(t);if(n.length<2)return n;const o=ln(t);if(0===o.length)return n;const r=new Map(n.map((t,e)=>[t,e]));let s=un(n,o,r);const i=Math.max(0,e.restarts??8);for(let t=0;t<i;t++){const e=un(cn(n,gn(n,o,t)),o,r);hn(e,s)&&(s=e)}return s.order}function mn(t,e){const n=e?.ignoreCrossLaneEdges??!0,o=e?.optimizeRanksByCrossings??!0,r=ie(t),s=e?.automaticLaneOrdering?pn(r,{restarts:8}):void 0,i=xe(r),a=i.acyclic,c=n?We(a,{compactSingleInput:e?.compactSingleInput??ve,ignoreCrossLaneEdges:!0,direction:e?.direction}):_e(a,{compactSingleInput:e?.compactSingleInput??ve,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:o}),{layering:f,graphWithDummies:d}=Ke(c,a),l=on(f,d,{laneOrder:s}),u=rn(l,d,{layerGap:e?.layerGap,nodeGap:e?.nodeGap,direction:e?.direction,laneOrder:s});return{acyclic:a,reversed:i.reversed,layering:f,ordered:l,coordinates:u}}n(sn,"hashString"),n(an,"mulberry32"),n(cn,"deterministicShuffle"),n(fn,"sourceDistance"),n(dn,"laneArrangementCost"),n(ln,"buildWeightedLaneEdges"),n(un,"greedySwitch"),n(hn,"isBetterCandidate"),n(gn,"seedForRestart"),n(pn,"optimizeTopLaneOrder"),n(mn,"sugiyamaLayout");var xn=1e-6,yn=15,bn=15,Mn=20;function In(t,e,n){const o=t.x??0,r=t.y??0,s=e.x-o,i=e.y-r,a=Math.abs(s),c=Math.abs(i);if(a<xn&&c<xn)return n;return c>xn&&3*c>=a?i>0?"bottom":"top":a>xn?s>0?"right":"left":n}function Sn(t,e){return Math.abs(t.to-e.from)<xn||Math.abs(t.to-e.to)<xn?t.to:t.from}function wn(t,e){return"vertical"===t.orient?{x:t.coord,y:e}:{x:e,y:t.coord}}function vn(t,e){const o=t.nodes??[],r=t.edges??[],s=[];for(const t of r)t.isLayoutOnly||s.push({...t,__originalEdge:t});const i=new Map,a=new Map,c=[],f="LR"===e;for(const t of o)i.set(t.id,t);const d=o.filter(t=>t.isGroup&&!t.parentId);for(const t of d){const e={id:t.id},r=n(t=>{a.set(t.id,e),o.filter(e=>e.parentId===t.id).forEach(r)},"assignLane");r(t)}const l=o.filter(t=>!t.isGroup&&!t.isEdgeLabel).map(t=>{const e=t.width??10,n=t.height??10,o=t.x??0,r=t.y??0;return{nodeId:t.id,minX:o-e/2-8,maxX:o+e/2+8,minY:r-n/2-8,maxY:r+n/2+8,visualXHalfExtent:f?n/2+8:e/2+8}}),u=n((t,e,n,o)=>{let r=c.find(n=>n.orientation===t&&Math.abs(n.coord-e)<1);return r||(r={id:`pipe-${t}-${e.toFixed(0)}`,orientation:t,coord:e,spanMin:n,spanMax:o,tracks:[]},c.push(r)),r.spanMin=Math.min(r.spanMin,n),r.spanMax=Math.max(r.spanMax,o),r},"getOrAddPipe"),h=n((t,e)=>{const n=t.width??10,o=t.height??10,r=t.x??0,s=t.y??0;switch(e){case"top":return{x:r,y:s-o/2};case"bottom":return{x:r,y:s+o/2};case"left":return{x:r-n/2,y:s};case"right":return{x:r+n/2,y:s}}},"portForSide"),g=n((t,e,n)=>h(t,In(t,e,n?"bottom":"top")),"getOrthogonalPort"),p=[],m=[],x=new Set,y=n((t,e,n)=>{if(0===p.length)return 0;const o=Math.abs(e.y-n.y)<xn,r=Math.abs(e.x-n.x)<xn;if(!o&&!r)return 0;let s=0;if(o){const o=e.y,r=Math.min(e.x,n.x)-xn,i=Math.max(e.x,n.x)+xn;if(i<=r)return 0;for(const e of p)e.edgeIndex!==t&&"vertical"===e.orientation&&(e.pipe.coord<r||e.pipe.coord>i||e.from-xn<=o&&e.to+xn>=o&&(s+=1e3))}else if(r){const o=e.x,r=Math.min(e.y,n.y)-xn,i=Math.max(e.y,n.y)+xn;if(i<=r)return 0;for(const e of p)e.edgeIndex!==t&&"horizontal"===e.orientation&&(e.pipe.coord<r||e.pipe.coord>i||e.from-xn<=o&&e.to+xn>=o&&(s+=1e3))}return s},"crossingPenalty"),b=s.map((t,e)=>{if(!t.start||!t.end)return{idx:e,crossLane:0,dx:0,dy:0};const n=i.get(t.start),o=i.get(t.end),r=a.get(t.start),s=a.get(t.end);return{idx:e,crossLane:r&&s&&r.id!==s.id?1:0,dx:n&&o?Math.abs((o.x??0)-(n.x??0)):0,dy:n&&o?Math.abs((o.y??0)-(n.y??0)):0}}).sort((t,e)=>{if(t.crossLane!==e.crossLane)return e.crossLane-t.crossLane;const n=t.dx+t.dy,o=e.dx+e.dy;return Math.abs(n-o)>1?n-o:t.idx-e.idx}).map(t=>t.idx),M=n((t,e,n,o)=>{const r=Math.min(t.x,e.x),s=Math.max(t.x,e.x),i=Math.min(t.y,e.y),a=Math.max(t.y,e.y);return!!l.find(c=>(!n||c.nodeId!==n)&&((!o||c.nodeId!==o)&&(Math.abs(t.x-e.x)>xn?c.minY<t.y&&c.maxY>t.y&&c.maxX>r&&c.minX<s:c.minX<t.x&&c.maxX>t.x&&c.maxY>i&&c.minY<a)))},"isSegmentBlocked"),I=new Map,S=new Map;for(const t of s)t.start&&t.end&&t.start!==t.end&&(S.set(t.start,(S.get(t.start)??0)+1),S.set(t.end,(S.get(t.end)??0)+1));const w=n((t,e)=>In(t,e,"bottom"),"determineSide"),v=new Map;for(const[t,e]of s.entries()){if(!e.start||!e.end||e.start===e.end)continue;if(e.points&&e.points.length>0)continue;const n=i.get(e.start),o=i.get(e.end);if(!n||!o)continue;const r=(o.x??0)-(n.x??0),s=(o.y??0)-(n.y??0);v.set(t,{edgeIdx:t,srcId:e.start,dstId:e.end,srcSide:w(n,{x:o.x??0,y:o.y??0}),dstSide:w(o,{x:n.x??0,y:n.y??0}),absDx:Math.abs(r),absDy:Math.abs(s),dxSign:Math.sign(r),dySign:Math.sign(s)})}const C=n(t=>"top"===t.srcSide||"bottom"===t.srcSide?0===t.absDx?1/0:t.absDy/t.absDx:0===t.absDy?1/0:t.absDx/t.absDy,"preferenceStrength"),L=n(t=>"top"===t.srcSide||"bottom"===t.srcSide?t.dxSign>=0?"right":"left":t.dySign>=0?"bottom":"top","secondarySide"),k=new Map;for(const t of v.values()){const e=`${t.srcId}:${t.srcSide}`;k.has(e)||k.set(e,[]),k.get(e).push(t)}const O=new Map,R=n((t,e)=>`${t}:${e}`,"loadKey");for(const t of v.values())O.set(R(t.srcId,t.srcSide),(O.get(R(t.srcId,t.srcSide))??0)+1),O.set(R(t.dstId,t.dstSide),(O.get(R(t.dstId,t.dstSide))??0)+1);for(const t of k.values())if(!(t.length<2)){t.sort((t,e)=>{const n=C(t),o=C(e);return Math.abs(n-o)>1e-9?o-n:t.edgeIdx-e.edgeIdx});for(let e=1;e<t.length;e++){const n=t[e],o=L(n),r=O.get(R(n.srcId,n.srcSide))??0,s=O.get(R(n.srcId,o))??0;s>=r||(O.set(R(n.srcId,n.srcSide),r-1),O.set(R(n.srcId,o),s+1),n.srcSide=o)}}const N=n(t=>{const e=t?.shape;return"question"===e||"diamond"===e},"isDiamondNode"),T=new Map;for(const t of v.values())T.has(t.dstId)||T.set(t.dstId,new Set),T.get(t.dstId).add(t.dstSide);for(const t of v.values()){if(!N(i.get(t.srcId)))continue;const e=T.get(t.srcId);if(!e?.has(t.srcSide))continue;const n=L(t);if(e.has(n)||(O.get(R(t.srcId,n))??0)>0)continue;const o=O.get(R(t.srcId,t.srcSide))??0;O.set(R(t.srcId,t.srcSide),Math.max(0,o-1)),O.set(R(t.srcId,n),1),t.srcSide=n}for(const t of v.values()){const{edgeIdx:e,srcId:n,dstId:o,srcSide:r,dstSide:s}=t,a=i.get(n),c=i.get(o),f=`${n}:${r}:src`,d="top"===r||"bottom"===r?c.x??0:c.y??0;I.has(f)||I.set(f,[]),I.get(f).push({edgeIdx:e,oppositeCoord:d});const l=`${o}:${s}:dst`,u="top"===s||"bottom"===s?a.x??0:a.y??0;I.has(l)||I.set(l,[]),I.get(l).push({edgeIdx:e,oppositeCoord:u})}const B=new Map;for(const[t,e]of I){if(e.length<2)continue;e.sort((t,e)=>t.oppositeCoord-e.oppositeCoord);const n=t.split(":"),o=n.slice(0,-2).join(":"),r=n[n.length-2],s=n[n.length-1],a=i.get(o);if(!a)continue;const c="left"===r||"right"===r?a.height??10:a.width??10,f=a.shape,d="question"===f||"diamond"===f?.3*c:c,l=20,u=Math.min(l,Math.max(8,d/(e.length+1))),h=-(u*(e.length-1))/2;for(const[t,n]of e.entries()){const e=h+t*u,o=`${n.edgeIdx}:${s}`;B.set(o,e)}}const F=n(t=>Boolean(s[t]?.labelNodeId),"edgeHasLabelNode"),E=n((t,e)=>!!t&&((I.get(`${t}:${e}:src`)??[]).some(({edgeIdx:t})=>F(t))||(I.get(`${t}:${e}:dst`)??[]).some(({edgeIdx:t})=>F(t))),"faceHasLabelNode"),$=n((t,e,n)=>"top"===e||"bottom"===e?{x:t.x+n,y:t.y}:{x:t.x,y:t.y+n},"applyPortOffset"),Y=n((t,e,n)=>{const o=v.get(t),r={x:n.x??0,y:n.y??0},s={x:e.x??0,y:e.y??0},i=o?.srcSide??w(e,r),a=o?.dstSide??w(n,s);let c=o?h(e,o.srcSide):g(e,r,!0),f=o?h(n,o.dstSide):g(n,s,!1);const d=B.get(`${t}:src`),l=B.get(`${t}:dst`);return void 0!==d&&(c=$(c,i,d)),void 0!==l&&(f=$(f,a,l)),{pSrcPort:c,pDstPort:f,srcSide:i,dstSide:a}},"portsForEdge");for(const t of b){const e=s[t];if(m[t]=[],!e.start||!e.end)continue;if(e.points&&e.points.length>0)continue;if(e.start===e.end)continue;const o=i.get(e.start),r=i.get(e.end);if(!o||!r)continue;const{pSrcPort:a,pDstPort:d,srcSide:h,dstSide:g}=Y(t,o,r),b={...a},w={...d},v="top"===h||"bottom"===h,C="top"===g||"bottom"===g;if(v){const t=a.y>(o.y??0);b.y=t?a.y+Mn:a.y-Mn}else{const t=a.x>(o.x??0);b.x=t?a.x+Mn:a.x-Mn}if(C){const t=d.y>(r.y??0);w.y=t?d.y+Mn:d.y-Mn}else{const t=d.x>(r.x??0);w.x=t?d.x+Mn:d.x-Mn}const L=n((t,e)=>{for(const n of l)if(!e.includes(n.nodeId)&&t.x>n.minX&&t.x<n.maxX&&t.y>n.minY&&t.y<n.maxY)return{inside:!0,obstacle:n};return{inside:!1}},"isPointInObstacle"),k=n((t,e,n,o,r)=>{if(r){const r=t.y>(e.y??0);return{x:(n.x??0)>=t.x?o.maxX+yn:o.minX-yn,y:r?o.maxY+bn:o.minY-bn,leavesPositiveSide:r}}const s=t.x>(e.x??0),i=(n.y??0)>=t.y;return{x:s?o.maxX+yn:o.minX-yn,y:i?o.maxY+bn:o.minY-bn,leavesPositiveSide:s}},"obstacleDetour");let O=[];const R=[e.start,e.end],N=L(b,R);if(N.inside&&N.obstacle){const t=N.obstacle;if(v){const e=k(a,o,r,t,!0);b.x=e.x,b.y=e.y;const n=e.leavesPositiveSide?Math.min(t.minY-2,a.y+Mn):Math.max(t.maxY+2,a.y-Mn);O=[{x:a.x,y:n},{x:e.x,y:n},{x:e.x,y:e.y}]}else{const e=k(a,o,r,t,!1),n=e.leavesPositiveSide?Math.min(t.minX-2,a.x+Mn):Math.max(t.maxX+2,a.x-Mn);b.x=e.x,b.y=e.y,O=[{x:n,y:a.y},{x:n,y:e.y},{x:e.x,y:e.y}]}}let T=[];const F=L(w,R);if(F.inside&&F.obstacle){const t=F.obstacle;if(C){const e=k(d,r,o,t,!0);w.x=e.x,w.y=e.y,T=[{x:e.x,y:e.y},{x:d.x,y:e.y}]}else{const e=k(d,r,o,t,!1);w.x=e.x,w.y=e.y,T=[{x:e.x,y:e.y},{x:e.x,y:d.y}]}}if(0===O.length&&0===T.length){const n=yn,o=Math.abs(b.x-w.x)<n,r=Math.abs(b.y-w.y)<n,s=void 0!==B.get(`${t}:src`)||void 0!==B.get(`${t}:dst`),i=(I.get(`${e.start??""}:${h}:src`)?.length??0)+(I.get(`${e.start??""}:${h}:dst`)?.length??0),c=(I.get(`${e.end??""}:${g}:src`)?.length??0)+(I.get(`${e.end??""}:${g}:dst`)?.length??0),f=i>1||c>1,l=S.get(e.start??"")??0,u=S.get(e.end??"")??0,m=i>1&&E(e.start,h)||c>1&&E(e.end,g);if((o||r)&&!s&&(!f||f&&!m&&(i<=1||l<=2)&&(c<=1||u<=2))){if(!M(a,d,e.start,e.end)){e.points=[{...a},{...b},{...w},{...d}],x.add(t);const n=r?"horizontal":"vertical",o=r?a.y:a.x,s=r?Math.min(a.x,d.x):Math.min(a.y,d.y),i=r?Math.max(a.x,d.x):Math.max(a.y,d.y),c={id:`fast-path-${n}-${o.toFixed(0)}-${t}`,orientation:n,coord:o,spanMin:s,spanMax:i,tracks:[]};p.push({edgeIndex:t,segmentIndex:0,orientation:n,pipe:c,trackIndex:0,from:s,to:i});continue}}}const $=u("vertical",b.x,b.y,b.y);b.x=$.coord;const X=u("vertical",w.x,w.y,w.y);w.x=X.coord;let z=Math.min(b.x,w.x)-50,P=Math.max(b.x,w.x)+50,G=Math.min(b.y,w.y)-50,D=Math.max(b.y,w.y)+50;for(const t of l){const e=Math.min(b.x,w.x),n=Math.max(b.x,w.x),o=Math.min(b.y,w.y),r=Math.max(b.y,w.y);t.minX<n&&t.maxX>e&&t.minY<r&&t.maxY>o&&(z=Math.min(z,t.minX-25),P=Math.max(P,t.maxX+25),G=Math.min(G,t.minY-25),D=Math.max(D,t.maxY+25))}for(const t of l){if(t.maxX<z||t.minX>P||t.maxY<G||t.minY>D)continue;const e=yn;u("horizontal",t.minY-e,z,P),u("horizontal",t.maxY+e,z,P);const n=bn;u("vertical",t.minX-n,G,D),u("vertical",t.maxX+n,G,D)}u("horizontal",b.y,z,P),u("horizontal",w.y,z,P);const A=c.filter(t=>"horizontal"===t.orientation&&t.coord>=G&&t.coord<=D),H=c.filter(t=>"vertical"===t.orientation&&t.coord>=z&&t.coord<=P),j=n((t,e)=>`${t.toFixed(1)},${e.toFixed(1)}`,"getKey"),_=j(b.x,b.y),V=j(w.x,w.y),W=new Map,K=new Map,q=new Map,U=new Set,J=[];W.set(_,0),q.set(_,"n"),J.push({key:_,f:Math.hypot(w.x-b.x,w.y-b.y),pt:b}),U.add(_);let Z=[];const Q=n((t,n)=>M(t,n,e.start,e.end),"checkSegmentBlocked"),tt={x:w.x,y:b.y},et=Q(b,tt),nt=Q(tt,w),ot=et||nt,rt={x:b.x,y:w.y},st=Q(b,rt),it=Q(rt,w);if(ot?st||it||(Z=Math.abs(b.x-w.x)<xn?[b,w]:[b,rt,w]):Z=Math.abs(b.y-w.y)<xn||Math.abs(b.x-w.x)<xn?[b,w]:[b,tt,w],0===Z.length)for(;J.length>0;){J.sort((t,e)=>t.f-e.f);const n=J.shift();if(U.delete(n.key),n.key===V){let t=V,e=w;for(Z=[e];K.has(t);){const n=K.get(t);Z.unshift(n),e=n,t=j(n.x,n.y)}break}const o=n.pt.x,r=n.pt.y,s=H.sort((t,e)=>t.coord-e.coord),i=s.findIndex(t=>Math.abs(t.coord-o)<1),a=A.sort((t,e)=>t.coord-e.coord),c=a.findIndex(t=>Math.abs(t.coord-r)<1),f=[];i>0&&f.push({x:s[i-1].coord,y:r}),i>=0&&i<s.length-1&&f.push({x:s[i+1].coord,y:r}),c>0&&f.push({x:o,y:a[c-1].coord}),c>=0&&c<a.length-1&&f.push({x:o,y:a[c+1].coord});for(const s of f){const i=Math.min(o,s.x),a=Math.max(o,s.x),c=Math.min(r,s.y),f=Math.max(r,s.y);if(l.some(t=>t.nodeId!==e.start&&t.nodeId!==e.end&&(i!==a?t.minY<r&&t.maxY>r&&t.maxX>i&&t.minX<a:t.minX<o&&t.maxX>o&&t.maxY>c&&t.minY<f)))continue;const d=j(s.x,s.y),u=Math.abs(s.x-o)+Math.abs(s.y-r),h=y(t,n.pt,s);let g=0;const p=w.x-b.x,m=w.y-b.y,x=s.x-o,M=s.y-r;(m>10&&M<-5||m<-10&&M>5)&&(g=100*Math.abs(M)),(p>10&&x<-5||p<-10&&x>5)&&(g+=50*Math.abs(x));let I=0;const S=q.get(n.key)??"n",v=Math.abs(x)>xn?"h":"v";"n"!==S&&S!==v&&(I=50);const C=u+h+g+I,L=(W.get(n.key)??1/0)+C,k=Math.abs(w.x-s.x)+Math.abs(w.y-s.y);if(L<(W.get(d)??1/0))if(K.set(d,n.pt),W.set(d,L),q.set(d,v),U.has(d)){const t=J.findIndex(t=>t.key===d);-1!==t&&(J[t].f=L+k)}else J.push({key:d,f:L+k,pt:s}),U.add(d)}}if(0===Z.length&&(Z=[b,{x:b.x,y:w.y},w]),Z.length>4){const t=Z[0],e=Z[Z.length-1];let o=Math.min(t.x,e.x),r=Math.max(t.x,e.x),s=Math.min(t.y,e.y),i=Math.max(t.y,e.y);for(const t of Z)o=Math.min(o,t.x),r=Math.max(r,t.x),s=Math.min(s,t.y),i=Math.max(i,t.y);const a=r>Math.max(t.x,e.x),c=o<Math.min(t.x,e.x);if(f){const n=bn;if(a){const o=Math.max(t.x,e.x),s=Math.min(t.y,e.y),i=Math.max(t.y,e.y),a=l.filter(t=>t.minX<o&&t.maxX>o&&t.minY<i&&t.maxY>s);if(a.length>0){let o=Math.max(t.x,e.x);for(const t of a){const e=(t.minX+t.maxX)/2;if(void 0===t.visualXHalfExtent||isNaN(t.visualXHalfExtent))continue;const r=e+t.visualXHalfExtent+n;o=Math.max(o,r)}isNaN(o)||(r=o)}}if(c){const r=l.filter(o=>o.minX<Math.min(t.x,e.x)+n&&o.minY<Math.max(t.y,e.y)&&o.maxY>Math.min(t.y,e.y));if(r.length>0){let s=Math.min(t.x,e.x);for(const t of r){const e=(t.minX+t.maxX)/2-t.visualXHalfExtent-n;s=Math.min(s,e)}o=s}}}const d=n(n=>{const o=e.y>t.y,r=l.filter(n=>{const o=Math.min(t.x,e.x)<n.maxX&&Math.max(t.x,e.x)>n.minX,r=Math.min(t.y,e.y)<n.maxY&&Math.max(t.y,e.y)>n.minY;return o&&r});let s=r;if(f&&r.length>0){const t=r.filter(t=>t.minX<n&&t.maxX>n);t.length>0&&(s=t)}if(0===s.length)return e.y;if(o){const t=Math.max(...s.map(t=>t.maxY))+15;if(t<e.y-xn)return t}else{const t=Math.min(...s.map(t=>t.minY))-15;if(t>e.y+xn)return t}return e.y},"findBestReturnY"),u=n(n=>{const o=d(n),r={x:n,y:t.y},s={x:n,y:o},i={x:e.x,y:o},a=Q(t,r),c=Q(r,s),f=Q(s,i),l=o!==e.y&&Q(i,e);return a||c||f||l?null:Math.abs(o-e.y)<xn?[t,r,s,e]:[t,r,s,i,e]},"trySimplifyWithDetourX"),h=a&&!c?u(r):c&&!a?u(o):null;h&&(Z=h)}const at=[a,...O,...Z,...T.reverse(),d];if(at.length>=3){const t=at[at.length-1],e=at[at.length-2],n=at[at.length-3],o=Math.abs(n.y-e.y)<xn&&Math.abs(e.y-t.y)<xn,r=Math.abs(n.x-e.x)<xn&&Math.abs(e.x-t.x)<xn;if(o){const o=Math.sign(e.x-n.x),r=Math.sign(t.x-n.x);0!==o&&o===r&&Math.abs(e.x-n.x)>Math.abs(t.x-n.x)&&at.splice(-2,1)}else if(r){const o=Math.sign(e.y-n.y),r=Math.sign(t.y-n.y);0!==o&&o===r&&Math.abs(e.y-n.y)>Math.abs(t.y-n.y)&&at.splice(-2,1)}}const ct=[at[0]];for(let t=1;t<at.length-1;t++){if(1===t){ct.push(at[t]);continue}const e=ct[ct.length-1],n=at[t],o=at[t+1];if(Math.abs(e.y-n.y)<xn&&Math.abs(n.y-o.y)<xn){if(n.x>e.x!==o.x>n.x){ct.push(n);continue}continue}if(Math.abs(e.x-n.x)<xn&&Math.abs(n.x-o.x)<xn){if(n.y>e.y!==o.y>n.y){ct.push(n);continue}continue}ct.push(n)}ct.push(at[at.length-1]);for(let e=0;e<ct.length-1;e++){const n=ct[e],o=ct[e+1],r=Math.abs(n.x-o.x)<xn?"vertical":"horizontal",s="vertical"===r?n.x:n.y,i="vertical"===r?Math.min(n.y,o.y):Math.min(n.x,o.x),a="vertical"===r?Math.max(n.y,o.y):Math.max(n.x,o.x),c=u(r,s,i,a),f={edgeIndex:t,segmentIndex:e,orientation:r,pipe:c,trackIndex:0,from:i,to:a};p.push(f),m[t].push(p.length-1),c.tracks[0]||(c.tracks[0]={index:0,coord:c.coord,segments:[]}),c.tracks[0].segments.push({edgeIndex:t,segmentIndex:e,from:i,to:a})}}const X=n((t,e)=>t.from<e.to&&e.from<t.to,"segmentsOverlap"),z=n((t,e,n,o)=>{const r=!o.segments.some(n=>(n.edgeIndex!==e.edgeIndex||n.segmentIndex!==e.segmentIndex)&&X(n,t)),s=!n.segments.some(n=>(n.edgeIndex!==t.edgeIndex||n.segmentIndex!==t.segmentIndex)&&X(n,e));return!(!r||!s)&&(t.trackIndex=o.index,e.trackIndex=n.index,n.segments=[...n.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),{edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to}],o.segments=[...o.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),{edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to}],!0)},"trySwapSegmentsAcrossTracks"),P=n(t=>{const e=t.tracks.length;return t.tracks[e]={index:e,coord:t.coord,segments:[]},e},"createNewTrack"),G=n((t,e)=>{const n=t.pipe.tracks[t.trackIndex];n.segments=n.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),t.trackIndex=e;t.pipe.tracks[e].segments.push({edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to})},"moveSegmentToTrack"),D=n((t,e)=>{const n=m[t.edgeIndex];for(const o of n){const n=p[o];n.pipe===t.pipe&&G(n,e)}},"moveSegmentChainToTrack"),A=n(t=>{const e=m[t.edgeIndex],n=e.indexOf(p.indexOf(t)),o=[];return n>0&&o.push(p[e[n-1]]),n<e.length-1&&o.push(p[e[n+1]]),o},"getAdjacentSegmentsAlongEdge"),H=n((t,e)=>{if(t.orientation===e.orientation)return!1;const n="horizontal"===t.orientation?t:e,o="horizontal"===t.orientation?e:t;return o.pipe.coord>n.from&&o.pipe.coord<n.to&&n.pipe.coord>o.from&&n.pipe.coord<o.to},"haveAnyCrossing"),j=n((t,e)=>{for(const n of t.tracks){if(!n.segments.some(t=>(t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex)&&X(t,e)))return n.index}return-1},"findAvailableTrack"),_=n((t,e)=>{if(t.trackIndex===e.trackIndex)return X(t,e);const n=A(t),o=A(e);return n.some(t=>o.some(e=>H(t,e)))},"segmentsConflict"),V=n((t,e,n)=>{if(z(t,e,t.pipe.tracks[t.trackIndex],e.pipe.tracks[e.trackIndex]))return;const o=j(t.pipe,e);n(e,-1!==o?o:P(t.pipe))},"resolveTrackConflict"),W=n(t=>{let e=0;for(let n=0;n<t.length;n++)for(let o=n+1;o<t.length;o++){const r=t[n],s=t[o];r.pipe===s.pipe&&(_(r,s)&&(e++,V(r,s,D)))}return e},"resolveHandleConflicts"),K=new Map,q=n(t=>{if(K.has(t))return K.get(t);const e=m[t];if(0===e.length){const e={dest:0,deviation:0,base:0,delta:0};return K.set(t,e),e}const n=p[e[0]].pipe.coord;let o=n;for(let t=1;t<e.length;t++){const r=p[e[t]];if("horizontal"===r.orientation){const t=r.from,e=r.to;o=Math.abs(t-n)>Math.abs(e-n)?t:e;break}}const r={dest:o,deviation:Math.abs(o-n),base:n,delta:o-n};return K.set(t,r),r},"getDestInfo"),U=n(()=>{let t=0;const e=new Map;for(const[t,n]of s.entries())0!==m[t].length&&n.start&&(e.has(n.start)||e.set(n.start,[]),e.get(n.start).push(t));const o=n(t=>{const e=s[t];if(!e.start||!e.end)return 0;const n=i.get(e.start),o=i.get(e.end);if(!n||!o)return 0;const r=(o.x??0)-(n.x??0),a=(o.y??0)-(n.y??0);return Math.abs(r)+Math.abs(a)},"getEdgeDistance");for(const n of e.values()){n.sort((t,e)=>{const n=q(t),r=q(e);if(Math.abs(n.deviation-r.deviation)>1)return n.deviation-r.deviation;if(Math.abs(n.dest-r.dest)>1)return n.dest-r.dest;const s=o(t),i=o(e);if(Math.abs(s-i)>1)return i-s;const a=m[t].length,c=m[e].length;if(a!==c)return a-c;if(1===a){const n=m[t][0],o=m[e][0];if(p[n]&&p[o]){const t=p[n],e=p[o],r=Math.abs(t.to-t.from),s=Math.abs(e.to-e.from);if(Math.abs(r-s)>1)return r-s}}return 0});const e=n.map(t=>p[m[t][0]]);t+=W(e)}return t},"fixSourceHandleCrossings"),J=n(()=>{let t=0;const e=new Map;for(const[t,n]of s.entries()){0!==m[t].length&&(n.end&&(e.has(n.end)||e.set(n.end,[]),e.get(n.end).push(t)))}for(const o of e.values()){o.sort((t,e)=>{const o=n(t=>{const e=m[t];if(e.length<2)return 0;const n=p[e[e.length-2]];return Math.abs(n.to-n.from)},"getDist"),r=o(t),s=o(e);return Math.abs(r-s)>.1?r-s:t-e});const e=o.map(t=>p[m[t][m[t].length-1]]);t+=W(e)}return t},"fixTargetHandleCrossings"),Z=n(()=>{let t=0;for(const e of c){const n=[];for(const t of e.tracks)for(const e of t.segments){const t=m[e.edgeIndex].find(t=>p[t].segmentIndex===e.segmentIndex);void 0!==t&&n.push(p[t])}n.sort((t,e)=>t.edgeIndex-e.edgeIndex||t.segmentIndex-e.segmentIndex);for(let e=0;e<n.length;e++)for(let o=e+1;o<n.length;o++){const r=n[e],s=n[o];_(r,s)&&(t++,V(r,s,G))}}return t},"fixPipeCrossings");let Q=0;for(;Q<10;){let t=0;if(t+=U(),t+=J(),t+=Z(),0===t)break;Q++}const tt=new Map;for(const t of c){const e=[];t.tracks.forEach(t=>{t.segments.forEach(n=>{e.push({edgeIndex:n.edgeIndex,segmentIndex:n.segmentIndex,trackIndex:t.index,from:n.from,to:n.to})})}),e.sort((t,e)=>t.from-e.from);const o=[];if(e.length>0){let t=[e[0]],n=e[0].to;for(let r=1;r<e.length;r++){const s=e[r];s.from<n?(t.push(s),n=Math.max(n,s.to)):(o.push(t),t=[s],n=s.to)}o.push(t)}for(const e of o){const o=new Set;e.forEach(t=>o.add(t.trackIndex));const r=new Map;e.forEach(t=>{const e=q(t.edgeIndex);r.set(t.trackIndex,(r.get(t.trackIndex)??0)+e.delta)});const s=[...o].filter(t=>(r.get(t)??0)<-1),i=[...o].filter(t=>(r.get(t)??0)>1),a=[...o].filter(t=>Math.abs(r.get(t)??0)<=1);s.sort((t,e)=>(r.get(e)??0)-(r.get(t)??0)),i.sort((t,e)=>(r.get(t)??0)-(r.get(e)??0));const c=n((n,o)=>{e.filter(t=>t.trackIndex===n).forEach(e=>{const n=x.has(e.edgeIndex)?t.coord:o;tt.set(`${e.edgeIndex}-${e.segmentIndex}`,n)})},"assignCoord");let f=0;for(const e of s)f++,c(e,t.coord-10*f);if(0===a.length&&o.size>0){const t=[...o].sort((t,e)=>Math.abs(r.get(t)??0)-Math.abs(r.get(e)??0))[0],e=s.indexOf(t);-1!==e&&s.splice(e,1);const n=i.indexOf(t);-1!==n&&i.splice(n,1),a.push(t)}let d=0;for(const e of a){if(0===d)c(e,t.coord);else{const n=d%2==1?1:-1,o=Math.ceil(d/2);c(e,t.coord+n*o*10*.5)}d++}let l=0;for(const e of i)l++,c(e,t.coord+10*l)}}for(const[t,e]of s.entries()){const n=m[t]??[];if(0===n.length)continue;const o=[],r=i.get(e.start),s=i.get(e.end),{pSrcPort:a,pDstPort:c}=Y(t,r,s),f=n.map(t=>{const e=p[t],n=tt.get(`${e.edgeIndex}-${e.segmentIndex}`)??e.pipe.coord;return{orient:e.orientation,coord:n,from:e.from,to:e.to}});o.push(a);for(let t=0;t<f.length;t++){const e=f[t],n=o[o.length-1],r="vertical"===e.orient?n.y:n.x,s="vertical"===e.orient?n.x:n.y,i=f[t+1],a=t<f.length-1;if(Math.abs(s-e.coord)>xn&&o.push(wn(e,r)),a&&i.orient===e.orient)if(Math.abs(e.coord-i.coord)>xn){const t="vertical"===e.orient?(r+i.from)/2:Sn(e,i);o.push(wn(e,t),wn(i,t))}else 0!==t&&t!==f.length-2||o.push(wn(e,Sn(e,i)));else if(a)o.push(wn(e,i.coord));else{const t=Math.abs(e.from-r)<Math.abs(e.to-r)?e.to:e.from;o.push(wn(e,t))}}const d=o[o.length-1];(Math.abs(d.x-c.x)>xn||Math.abs(d.y-c.y)>xn)&&o.push(c);const l=[];o.length>0&&l.push(o[0]);for(let t=1;t<o.length;t++){const e=o[t],n=l[l.length-1];(Math.abs(e.x-n.x)>xn||Math.abs(e.y-n.y)>xn)&&l.push(e)}e.points=l}for(const t of s){const e=t.__originalEdge;e&&t.points&&(e.points=t.points)}t.edges=(t.edges??[]).filter(t=>!t.isLayoutOnly);const et=n((t,e)=>{const n=e.x??0,o=e.y??0,r=e.width??0,s=e.height??0;if(r<=0||s<=0)return t;const i=n-r/2,a=n+r/2,c=o-s/2,f=o+s/2;if(t.x<i||t.x>a||t.y<c||t.y>f)return t;const d=t.x-i,l=a-t.x,u=t.y-c,h=f-t.y,g=Math.min(d,l,u,h);return g===d?{x:i,y:t.y}:g===l?{x:a,y:t.y}:g===u?{x:t.x,y:c}:{x:t.x,y:f}},"nodeBoundaryClamp");for(const e of t.edges){const t=e.points;if(!t||t.length<2)continue;const n=e.start,o=e.end,r=n?i.get(n):void 0,s=o?i.get(o):void 0;r&&(t[0]=et(t[0],r)),s&&(t[t.length-1]=et(t[t.length-1],s))}return t}function Cn(t){return t.direction??"TB"}function Ln(t){const e=f(t),n=t.config.flowchart?.nodeSpacing??40,o=t.config.flowchart?.rankSpacing??100,r=t.config.swimlane?.ignoreCrossLaneEdges??!0,s=t.config.swimlane?.optimizeRanksByCrossings??!0,i=t.config.swimlane?.automaticLaneOrdering??!1,a=Cn(t),{ordered:c,coordinates:l}=mn(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:r,optimizeRanksByCrossings:s,automaticLaneOrdering:i,direction:a});d(e,c,l,{nodeGap:n,layerGap:o});for(const e of t.edges??[])delete e.points;vn(t,a);for(const e of t.edges??[])e.curve&&"basis"!==e.curve||(e.curve="rounded");return se(t,a),re(t),a}function kn(t){c(t);const e=l(t);t.nodes=e.nodes,t.edges=e.edges}n(In,"chooseOrthogonalSide"),n(Sn,"sharedLineEndpointCoord"),n(wn,"pointOnLine"),n(vn,"routeEdgesOrthogonal"),n(Cn,"getSwimlaneDirection"),n(Ln,"runSwimlaneLayoutCore"),n(kn,"prepareSwimlaneLayout");var On=e({prepareLayout:kn,runLayoutCore:Ln,afterPaint:r});export{On as render};
@@ -0,0 +1 @@
1
+ import{c as t,s as r}from"./chunk-NQOKRVIF-fUehRCXZ.js";import{_ as o}from"./mermaid.core-VF3HuzPL.js";import"./chunk-5VM5RSS4-D3PGx3gp.js";import"./chunk-XXDRQBXY-DLLBlZjr.js";import"./chunk-VQ5W62QI-mHHsR0s0.js";import"./chunk-55XCU76K-BN8xVJCh.js";import"./channel-5x2nMoMO.js";import"./index-38k9tHSo.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-BLDufAOm.js";import"./settings-6x4qNkNZ.js";import"./constants.js";import"./LoaderLayer-Csc8unUJ.js";import"./websocket-D79arGLt.js";import"./index-3QSNRp1k.js";import"motion/react";import"react-dom";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"@ably/spaces/dist/mjs/react";import"./string-DPJhNSkw.js";var s=t({styles:o(t=>`${r(t)}\n .swimlane.cluster:not([data-color-id]) rect {\n stroke: ${t.clusterBorder} !important;\n }\n [data-look="neo"].cluster rect {\n filter: none;\n }\n`,"getStyles")});export{s as diagram};