@juki-team/base-ui 1.5.16 → 1.5.22

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 (209) hide show
  1. package/dist/esm/ArrowForwardIcon-B_e3QWhU.js +1 -0
  2. package/dist/esm/BarChart-iS9A5dpq.js +1 -0
  3. package/dist/esm/{CartesianChart-cNl_tqN9.js → CartesianChart-DRkVAUTl.js} +6 -6
  4. package/dist/esm/ChangePasswordModal-DWcV41bD.js +1 -0
  5. package/dist/esm/CodeEditor-BIbu4VxL.js +1 -0
  6. package/dist/esm/CodeViewer-BUV-dalv.js +1 -0
  7. package/dist/esm/Collapse-paq7oWgG.js +1 -0
  8. package/dist/esm/{DataGrid-Bu-7Atkf.js → DataGrid-D3ZzYM2h.js} +1 -1
  9. package/dist/esm/DataViewer-CMI27AMZ.js +1 -0
  10. package/dist/esm/DrawerView-WQzHX5l-.js +1 -0
  11. package/dist/esm/ExcalidrawButton-Dkt-wFZK.js +1 -0
  12. package/dist/esm/GraphvizViewer-CYGvah6j.js +1 -0
  13. package/dist/esm/ImageLoaderCropper-DIEHTOiU.js +1 -0
  14. package/dist/esm/InputCellPhoneNumber-DgviNp4t.js +1 -0
  15. package/dist/esm/InputColor-BSBlv1oE.js +14 -0
  16. package/dist/esm/LineChart-BdYnYefg.js +1 -0
  17. package/dist/esm/LoaderLayer-CWElgcGs.js +1 -0
  18. package/dist/esm/MdMath-KE8c-hVy.js +1 -0
  19. package/dist/esm/MdMathEditor-DbH_jI7Y.js +28 -0
  20. package/dist/esm/{Popover-C0pozkRR.js → Popover-BLy0OI8L.js} +1 -1
  21. package/dist/esm/ReplyIcon-D3OGXdpv.js +1 -0
  22. package/dist/esm/SettingsIcon-W2HrGsHn.js +1 -0
  23. package/dist/esm/SlideDeck-o1krblz8.js +1 -0
  24. package/dist/esm/TableEyeIcon-cEB6wzrG.js +1 -0
  25. package/dist/esm/TableOfContents-DPsfG1VD.js +1 -0
  26. package/dist/esm/Tooltip-BI0Xe-XW.js +1 -0
  27. package/dist/esm/UserCodeEditor-CcaAG5g_.js +61 -0
  28. package/dist/esm/VirtualizedRowsFixed-VrMhZ4XD.js +1 -0
  29. package/dist/esm/WorksheetAsSlides-kPK5Z2vF.js +1 -0
  30. package/dist/esm/WorksheetBodies-CxDz0Rxa.js +1 -0
  31. package/dist/esm/WorksheetContents-Dxo5Xc3Y.js +1 -0
  32. package/dist/esm/WorksheetEditor-CvFYzeZC.js +1 -0
  33. package/dist/esm/WorksheetNode-DgQD3PMR.js +1 -0
  34. package/dist/esm/WorksheetViewer-DR45PXUH.js +1 -0
  35. package/dist/esm/abnfDiagram-WEYOIA3C-2vvvjt5F.js +1 -0
  36. package/dist/esm/{arc-CVDK40Ip.js → arc-C-pwTbE4.js} +1 -1
  37. package/dist/esm/architectureDiagram-ZHVYKT53-Njrg16Bb.js +1 -0
  38. package/dist/esm/blockDiagram-RJAE7QA3-OuYPx21T.js +1 -0
  39. package/dist/esm/c4Diagram-XDPPPE54-C4-sgPqw.js +1 -0
  40. package/dist/esm/channel-3HQcLN5a.js +1 -0
  41. package/dist/esm/{chunk-2E7WHVMD-CDFgC3vV.js → chunk-2E7WHVMD-BeozrAac.js} +1 -1
  42. package/dist/esm/{chunk-2Q5K7J3B-kc9wbXRi.js → chunk-2Q5K7J3B-4_3njuk_.js} +1 -1
  43. package/dist/esm/{chunk-4EMNKR2T-BOCYiV20.js → chunk-4EMNKR2T-DwE6V67-.js} +1 -1
  44. package/dist/esm/{chunk-55XCU76K-B9fq0Aas.js → chunk-55XCU76K-CpG64yyk.js} +1 -1
  45. package/dist/esm/{chunk-5VM5RSS4-BiSpRiw9.js → chunk-5VM5RSS4-CkeQhgn7.js} +1 -1
  46. package/dist/esm/{chunk-JWPE2WC7-fUi3mFpq.js → chunk-JWPE2WC7-CVtFylX6.js} +1 -1
  47. package/dist/esm/{chunk-NQOKRVIF-9yhnn9l0.js → chunk-NQOKRVIF-CYlkwWmJ.js} +1 -1
  48. package/dist/esm/{chunk-VQ5W62QI-k74sEYFL.js → chunk-VQ5W62QI-Be8I4VMn.js} +1 -1
  49. package/dist/esm/{chunk-XXDRQBXY-DJJHL2aw.js → chunk-XXDRQBXY-0jU-YNFU.js} +1 -1
  50. package/dist/esm/{chunk-ZCHMQSOR-DZxET8Hs.js → chunk-ZCHMQSOR-Cwl9AHIQ.js} +1 -1
  51. package/dist/esm/classDiagram-v2-4MYWR3UA-CgLXcYDZ.js +1 -0
  52. package/dist/esm/commons-C-9EFvh4.js +1 -0
  53. package/dist/esm/constants.js +1 -1
  54. package/dist/esm/cose-bilkent-JH36ORCC-BUYPdwFO.js +1 -0
  55. package/dist/esm/cynefinDiagram-WF24UDRP-DFlv0vTF.js +1 -0
  56. package/dist/esm/dagre-NK4GIZVX-D3hfxWjC.js +1 -0
  57. package/dist/esm/diagram-CBK3MWTC-Dz3S8vtv.js +1 -0
  58. package/dist/esm/diagram-I5XIIV2D-CWQZNyHk.js +1 -0
  59. package/dist/esm/diagram-ODIL2UCW-RwcoAn2X.js +1 -0
  60. package/dist/esm/diagram-PFBEJUXE-BQ65i8Sl.js +1 -0
  61. package/dist/esm/diagram-RJA3I4VV-D3wAXEKx.js +1 -0
  62. package/dist/esm/diagram-TYUNFSNR-CQpNNmke.js +1 -0
  63. package/dist/esm/ebnfDiagram-V4P3TTPT-x6yeSo0p.js +1 -0
  64. package/dist/esm/elk-QONTBCTQ-BKyCSI5O.js +1 -0
  65. package/dist/esm/enums.js +1 -1
  66. package/dist/esm/erDiagram-KYQIGQAA-C9n_JA_w.js +1 -0
  67. package/dist/esm/{floating-ui.dom-DGDCR4EF.js → floating-ui.dom-DpXpy_9C.js} +1 -1
  68. package/dist/esm/flowDiagram-IUGLLWBU-BS8vlVHT.js +1 -0
  69. package/dist/esm/ganttDiagram-R7GPNTJY-CKebGhU7.js +1 -0
  70. package/dist/esm/gitGraphDiagram-PDYL7XHY-Bvp1UcgM.js +1 -0
  71. package/dist/esm/helpers.js +1 -1
  72. package/dist/esm/index-B--41Rgp.js +1 -0
  73. package/dist/esm/{index-mLZqgXD7.js → index-BBCZJE-R.js} +1 -1
  74. package/dist/esm/index-BlaxEeMl.js +1 -0
  75. package/dist/esm/index-BwpxQGdp.js +1 -0
  76. package/dist/esm/{index-DWLuqDsD.js → index-C2_E6s4y.js} +1 -1
  77. package/dist/esm/{index-CffiBbeH.js → index-CB1wz24Q.js} +1 -1
  78. package/dist/esm/{index-CmWQEzQl.js → index-CWCIYdOV.js} +1 -1
  79. package/dist/esm/{index-DBWowQHL.js → index-C_OMDe9Q.js} +1 -1
  80. package/dist/esm/{index-nNMK7HvL.js → index-CqbF_7wB.js} +1 -1
  81. package/dist/esm/{index-CHgqN-d9.js → index-D2XW0y_s.js} +1 -1
  82. package/dist/esm/{index-BDQ8194g.js → index-D5f1dQka.js} +1 -1
  83. package/dist/esm/{index-CJtYjUlf.js → index-DBdTqY1b.js} +1 -1
  84. package/dist/esm/{index-CHVYA2P8.js → index-Dn0pnDCC.js} +1 -1
  85. package/dist/esm/index-DpobNvg5.js +1 -0
  86. package/dist/esm/index-Zvckkvpn.js +1 -0
  87. package/dist/esm/{index-BS7YTgMe.js → index-kHWDzZEv.js} +1 -1
  88. package/dist/esm/infoDiagram-MVDRKAX5-DrROCapb.js +1 -0
  89. package/dist/esm/ishikawaDiagram-HPEHV2GE-BGSVKWhg.js +1 -0
  90. package/dist/esm/journeyDiagram-BOSHW7O7-ogVQbHp2.js +1 -0
  91. package/dist/esm/kanban-definition-FNSA4HC5-lQM4fHQE.js +1 -0
  92. package/dist/esm/{linear-CIPQsvV7.js → linear-BCwRtKK9.js} +1 -1
  93. package/dist/esm/main.js +1 -1
  94. package/dist/esm/mermaid.core-CvFWfSA0.js +5 -0
  95. package/dist/esm/mindmap-definition-6OY57UG3-D8l0C3RA.js +1 -0
  96. package/dist/esm/pegDiagram-ECIUJNBX-D8xo2dyF.js +1 -0
  97. package/dist/esm/pieDiagram-GNMPY74T-gHG-R83G.js +1 -0
  98. package/dist/esm/quadrantDiagram-D57K4MC3-DDHGqMWG.js +1 -0
  99. package/dist/esm/railroadDiagram-Y72NRBL7-BNcAWVzf.js +1 -0
  100. package/dist/esm/requirementDiagram-EQYSW5RA-D0TQZTve.js +1 -0
  101. package/dist/esm/sankeyDiagram-SY24JHO5-BgXxfdaz.js +1 -0
  102. package/dist/esm/sequenceDiagram-BLEHNHQU-BoejQXUR.js +1 -0
  103. package/dist/esm/server.js +1 -1
  104. package/dist/esm/settings-DzQM72QE.js +1 -0
  105. package/dist/esm/settings.js +1 -1
  106. package/dist/esm/sizeCapture-INFHLROL-sNhkxZSt.js +1 -0
  107. package/dist/esm/stateDiagram-v2-A6IESKWZ-sy3VIzCQ.js +1 -0
  108. package/dist/esm/swimlanes-B3ENRKFQ-BMvTnJVa.js +1 -0
  109. package/dist/esm/swimlanesDiagram-AYQRV4AK-CBA7l1Zm.js +1 -0
  110. package/dist/esm/{throttle-tEKq3i9o.js → throttle-DvoLRXRs.js} +1 -1
  111. package/dist/esm/{time-DP3lbwAd.js → time-2Ms6XNBq.js} +1 -1
  112. package/dist/esm/timeline-definition-JXYKGLGB-B9uS-p90.js +1 -0
  113. package/dist/esm/{types-C6dLWyzP.js → types-CdWZmDRI.js} +1 -1
  114. package/dist/esm/usecaseDiagram-WPOLBNNX-55ERmenj.js +1 -0
  115. package/dist/esm/vennDiagram-Q3Y3IDCW-M46hCRun.js +1 -0
  116. package/dist/esm/wardleyDiagram-IVAIDKWA-DiF93Bmd.js +1 -0
  117. package/dist/esm/websocket-KESFarc3.js +1 -0
  118. package/dist/esm/worksheet-CKlbZOJI.js +1 -0
  119. package/dist/esm/worksheet-Tio8jHyw.js +1 -0
  120. package/dist/esm/xychartDiagram-4URNHDU4-epgUCY99.js +1 -0
  121. package/dist/module-types/src/components/helpers/websocket.d.ts +0 -8
  122. package/dist/module-types/src/components/molecules/_lazy_/CodeEditor/codemirror/types.d.ts +7 -1
  123. package/dist/module-types/src/components/types/index.d.ts +5 -0
  124. package/dist/module-types/src/enums/index.d.ts +1 -1
  125. package/dist/module-types/src/stores/websocket/topicChannels.d.ts +1 -1
  126. package/package.json +2 -2
  127. package/src/styles/components/atoms/_menu.scss +25 -13
  128. package/dist/esm/ArrowForwardIcon-BIC54sbk.js +0 -1
  129. package/dist/esm/BarChart-54h6GU3p.js +0 -1
  130. package/dist/esm/ChangePasswordModal-DGIG264-.js +0 -1
  131. package/dist/esm/CodeEditor-C5-1AgZR.js +0 -1
  132. package/dist/esm/CodeViewer-CQrzGpJT.js +0 -1
  133. package/dist/esm/Collapse-Cx9QTKZD.js +0 -1
  134. package/dist/esm/DataViewer-Cv0iOPJ_.js +0 -1
  135. package/dist/esm/DrawerView-Cbw3l2O7.js +0 -1
  136. package/dist/esm/ExcalidrawButton-zJFah1nC.js +0 -1
  137. package/dist/esm/GraphvizViewer-DsTGulG0.js +0 -1
  138. package/dist/esm/ImageLoaderCropper-Bk1LxSbD.js +0 -1
  139. package/dist/esm/InputCellPhoneNumber-BaFBGcAe.js +0 -1
  140. package/dist/esm/InputColor-DhUlWGSD.js +0 -14
  141. package/dist/esm/LineChart-BQ1UY4l8.js +0 -1
  142. package/dist/esm/LoaderLayer-aKmuHFys.js +0 -1
  143. package/dist/esm/MdMath-DvH_O_A3.js +0 -1
  144. package/dist/esm/MdMathEditor-4-bjr11C.js +0 -29
  145. package/dist/esm/ReplyIcon-DFPc1kie.js +0 -1
  146. package/dist/esm/SettingsIcon-P_1rE3U0.js +0 -1
  147. package/dist/esm/SlideDeck-0cxhxG3b.js +0 -1
  148. package/dist/esm/TableEyeIcon-5qDbI7lU.js +0 -1
  149. package/dist/esm/TableOfContents-DG7lfEl8.js +0 -1
  150. package/dist/esm/Tooltip-OI-qyixa.js +0 -1
  151. package/dist/esm/UserCodeEditor-XI5CMxYI.js +0 -61
  152. package/dist/esm/VirtualizedRowsFixed-DH6WrMq1.js +0 -1
  153. package/dist/esm/WorksheetAsSlides-vK1Nqrlr.js +0 -1
  154. package/dist/esm/WorksheetBodies-AupmhX--.js +0 -1
  155. package/dist/esm/WorksheetContents-RcU2Wigz.js +0 -1
  156. package/dist/esm/WorksheetEditor-BExsBWi8.js +0 -1
  157. package/dist/esm/WorksheetNode-BTU0R61c.js +0 -1
  158. package/dist/esm/WorksheetViewer-Bn_SoOic.js +0 -1
  159. package/dist/esm/abnfDiagram-WEYOIA3C-Dpw6XMB5.js +0 -1
  160. package/dist/esm/architectureDiagram-ZHVYKT53-CwRCJS-f.js +0 -1
  161. package/dist/esm/blockDiagram-RJAE7QA3-BsveJL2h.js +0 -1
  162. package/dist/esm/c4Diagram-XDPPPE54-DT_YwSdM.js +0 -1
  163. package/dist/esm/channel-DfU2WyO4.js +0 -1
  164. package/dist/esm/classDiagram-v2-4MYWR3UA-Ccw8sMnD.js +0 -1
  165. package/dist/esm/commons-Bam9oxAR.js +0 -1
  166. package/dist/esm/cose-bilkent-JH36ORCC-iT9n9qMD.js +0 -1
  167. package/dist/esm/cynefinDiagram-WF24UDRP-COkkadSX.js +0 -1
  168. package/dist/esm/dagre-NK4GIZVX-B2jYnU0Q.js +0 -1
  169. package/dist/esm/diagram-CBK3MWTC-DzCzOobH.js +0 -1
  170. package/dist/esm/diagram-I5XIIV2D-ChGPyzwT.js +0 -1
  171. package/dist/esm/diagram-ODIL2UCW-_jTs4ZGf.js +0 -1
  172. package/dist/esm/diagram-PFBEJUXE-C66lVsSz.js +0 -1
  173. package/dist/esm/diagram-RJA3I4VV-QELSA6fF.js +0 -1
  174. package/dist/esm/diagram-TYUNFSNR-Be-cdxPq.js +0 -1
  175. package/dist/esm/ebnfDiagram-V4P3TTPT-Cr1EANnv.js +0 -1
  176. package/dist/esm/elk-QONTBCTQ-CqfCbAWo.js +0 -1
  177. package/dist/esm/erDiagram-KYQIGQAA-DMgweTFG.js +0 -1
  178. package/dist/esm/flowDiagram-IUGLLWBU-B4pY13UK.js +0 -1
  179. package/dist/esm/ganttDiagram-R7GPNTJY-YkRR1QZl.js +0 -1
  180. package/dist/esm/gitGraphDiagram-PDYL7XHY-BuhZy85T.js +0 -1
  181. package/dist/esm/index-CTKRTL8i.js +0 -1
  182. package/dist/esm/index-DU7OAICx.js +0 -1
  183. package/dist/esm/index-c3o5xJQl.js +0 -1
  184. package/dist/esm/index-w_leOmyv.js +0 -1
  185. package/dist/esm/infoDiagram-MVDRKAX5-CfqZ5lu9.js +0 -1
  186. package/dist/esm/ishikawaDiagram-HPEHV2GE-fwZw1vDt.js +0 -1
  187. package/dist/esm/journeyDiagram-BOSHW7O7-CJ0qr25S.js +0 -1
  188. package/dist/esm/kanban-definition-FNSA4HC5-D467uQkY.js +0 -1
  189. package/dist/esm/mermaid.core-QEjDbduh.js +0 -5
  190. package/dist/esm/mindmap-definition-6OY57UG3-BLQmSwVy.js +0 -1
  191. package/dist/esm/pegDiagram-ECIUJNBX-BD9B5ipu.js +0 -1
  192. package/dist/esm/pieDiagram-GNMPY74T-ALgTthPz.js +0 -1
  193. package/dist/esm/quadrantDiagram-D57K4MC3-DvM56mui.js +0 -1
  194. package/dist/esm/railroadDiagram-Y72NRBL7-Bbmv8kBV.js +0 -1
  195. package/dist/esm/requirementDiagram-EQYSW5RA-B2-FtMv8.js +0 -1
  196. package/dist/esm/sankeyDiagram-SY24JHO5-a4Tjq4bh.js +0 -1
  197. package/dist/esm/sequenceDiagram-BLEHNHQU-D51n1e3_.js +0 -1
  198. package/dist/esm/settings-Cd8fftVp.js +0 -1
  199. package/dist/esm/sizeCapture-INFHLROL-EvtR_ZF3.js +0 -1
  200. package/dist/esm/stateDiagram-v2-A6IESKWZ-Dy_vLRVL.js +0 -1
  201. package/dist/esm/swimlanes-B3ENRKFQ-0pqT2-Jw.js +0 -1
  202. package/dist/esm/swimlanesDiagram-AYQRV4AK-COayinaD.js +0 -1
  203. package/dist/esm/timeline-definition-JXYKGLGB-DFhOynr-.js +0 -1
  204. package/dist/esm/usecaseDiagram-WPOLBNNX-MTVBbHK8.js +0 -1
  205. package/dist/esm/vennDiagram-Q3Y3IDCW-CgaIfPfv.js +0 -1
  206. package/dist/esm/wardleyDiagram-IVAIDKWA-CEQzSAI4.js +0 -1
  207. package/dist/esm/websocket-BppBoZUJ.js +0 -1
  208. package/dist/esm/worksheet-CQgex79V.js +0 -1
  209. package/dist/esm/xychartDiagram-4URNHDU4-BQJJ7mH2.js +0 -1
@@ -0,0 +1 @@
1
+ import{_ as t,l as e,k as i}from"./mermaid.core-CvFWfSA0.js";import{c as r}from"./cytoscape.esm-Bt9_GGFq.js";import{z as n}from"./index-BwpxQGdp.js";import"./string-DPJhNSkw.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-C-9EFvh4.js";import"./settings-DzQM72QE.js";import"./index-Zvckkvpn.js";import"./LoaderLayer-CWElgcGs.js";import"./websocket-KESFarc3.js";import"./index-DpobNvg5.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";var o,s={exports:{}},a={exports:{}},h={exports:{}};function l(){return o?h.exports:(o=1,t=function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.i=function(t){return t},i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=26)}([function(t,e,i){function r(){}r.QUALITY=1,r.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,r.DEFAULT_INCREMENTAL=!1,r.DEFAULT_ANIMATION_ON_LAYOUT=!0,r.DEFAULT_ANIMATION_DURING_LAYOUT=!1,r.DEFAULT_ANIMATION_PERIOD=50,r.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,r.DEFAULT_GRAPH_MARGIN=15,r.NODE_DIMENSIONS_INCLUDE_LABELS=!1,r.SIMPLE_NODE_SIZE=40,r.SIMPLE_NODE_HALF_SIZE=r.SIMPLE_NODE_SIZE/2,r.EMPTY_COMPOUND_NODE_SIZE=40,r.MIN_EDGE_LENGTH=1,r.WORLD_BOUNDARY=1e6,r.INITIAL_WORLD_BOUNDARY=r.WORLD_BOUNDARY/1e3,r.WORLD_CENTER_X=1200,r.WORLD_CENTER_Y=900,t.exports=r},function(t,e,i){var r=i(2),n=i(8),o=i(9);function s(t,e,i){r.call(this,i),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=i,this.bendpoints=[],this.source=t,this.target=e}for(var a in s.prototype=Object.create(r.prototype),r)s[a]=r[a];s.prototype.getSource=function(){return this.source},s.prototype.getTarget=function(){return this.target},s.prototype.isInterGraph=function(){return this.isInterGraph},s.prototype.getLength=function(){return this.length},s.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},s.prototype.getBendpoints=function(){return this.bendpoints},s.prototype.getLca=function(){return this.lca},s.prototype.getSourceInLca=function(){return this.sourceInLca},s.prototype.getTargetInLca=function(){return this.targetInLca},s.prototype.getOtherEnd=function(t){if(this.source===t)return this.target;if(this.target===t)return this.source;throw"Node is not incident with this edge"},s.prototype.getOtherEndInGraph=function(t,e){for(var i=this.getOtherEnd(t),r=e.getGraphManager().getRoot();;){if(i.getOwner()==e)return i;if(i.getOwner()==r)break;i=i.getOwner().getParent()}return null},s.prototype.updateLength=function(){var t=new Array(4);this.isOverlapingSourceAndTarget=n.getIntersection(this.target.getRect(),this.source.getRect(),t),this.isOverlapingSourceAndTarget||(this.lengthX=t[0]-t[2],this.lengthY=t[1]-t[3],Math.abs(this.lengthX)<1&&(this.lengthX=o.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=o.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},s.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=o.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=o.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},t.exports=s},function(t,e,i){t.exports=function(t){this.vGraphObject=t}},function(t,e,i){var r=i(2),n=i(10),o=i(13),s=i(0),a=i(16),h=i(4);function l(t,e,i,s){null==i&&null==s&&(s=e),r.call(this,s),null!=t.graphManager&&(t=t.graphManager),this.estimatedSize=n.MIN_VALUE,this.inclusionTreeDepth=n.MAX_VALUE,this.vGraphObject=s,this.edges=[],this.graphManager=t,this.rect=null!=i&&null!=e?new o(e.x,e.y,i.width,i.height):new o}for(var g in l.prototype=Object.create(r.prototype),r)l[g]=r[g];l.prototype.getEdges=function(){return this.edges},l.prototype.getChild=function(){return this.child},l.prototype.getOwner=function(){return this.owner},l.prototype.getWidth=function(){return this.rect.width},l.prototype.setWidth=function(t){this.rect.width=t},l.prototype.getHeight=function(){return this.rect.height},l.prototype.setHeight=function(t){this.rect.height=t},l.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},l.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},l.prototype.getCenter=function(){return new h(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},l.prototype.getLocation=function(){return new h(this.rect.x,this.rect.y)},l.prototype.getRect=function(){return this.rect},l.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},l.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},l.prototype.setRect=function(t,e){this.rect.x=t.x,this.rect.y=t.y,this.rect.width=e.width,this.rect.height=e.height},l.prototype.setCenter=function(t,e){this.rect.x=t-this.rect.width/2,this.rect.y=e-this.rect.height/2},l.prototype.setLocation=function(t,e){this.rect.x=t,this.rect.y=e},l.prototype.moveBy=function(t,e){this.rect.x+=t,this.rect.y+=e},l.prototype.getEdgeListToNode=function(t){var e=[],i=this;return i.edges.forEach(function(r){if(r.target==t){if(r.source!=i)throw"Incorrect edge source!";e.push(r)}}),e},l.prototype.getEdgesBetween=function(t){var e=[],i=this;return i.edges.forEach(function(r){if(r.source!=i&&r.target!=i)throw"Incorrect edge source and/or target";r.target!=t&&r.source!=t||e.push(r)}),e},l.prototype.getNeighborsList=function(){var t=new Set,e=this;return e.edges.forEach(function(i){if(i.source==e)t.add(i.target);else{if(i.target!=e)throw"Incorrect incidency!";t.add(i.source)}}),t},l.prototype.withChildren=function(){var t=new Set;if(t.add(this),null!=this.child)for(var e=this.child.getNodes(),i=0;i<e.length;i++)e[i].withChildren().forEach(function(e){t.add(e)});return t},l.prototype.getNoOfChildren=function(){var t=0;if(null==this.child)t=1;else for(var e=this.child.getNodes(),i=0;i<e.length;i++)t+=e[i].getNoOfChildren();return 0==t&&(t=1),t},l.prototype.getEstimatedSize=function(){if(this.estimatedSize==n.MIN_VALUE)throw"assert failed";return this.estimatedSize},l.prototype.calcEstimatedSize=function(){return null==this.child?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},l.prototype.scatter=function(){var t,e,i=-s.INITIAL_WORLD_BOUNDARY,r=s.INITIAL_WORLD_BOUNDARY;t=s.WORLD_CENTER_X+a.nextDouble()*(r-i)+i;var n=-s.INITIAL_WORLD_BOUNDARY,o=s.INITIAL_WORLD_BOUNDARY;e=s.WORLD_CENTER_Y+a.nextDouble()*(o-n)+n,this.rect.x=t,this.rect.y=e},l.prototype.updateBounds=function(){if(null==this.getChild())throw"assert failed";if(0!=this.getChild().getNodes().length){var t=this.getChild();if(t.updateBounds(!0),this.rect.x=t.getLeft(),this.rect.y=t.getTop(),this.setWidth(t.getRight()-t.getLeft()),this.setHeight(t.getBottom()-t.getTop()),s.NODE_DIMENSIONS_INCLUDE_LABELS){var e=t.getRight()-t.getLeft(),i=t.getBottom()-t.getTop();this.labelWidth>e&&(this.rect.x-=(this.labelWidth-e)/2,this.setWidth(this.labelWidth)),this.labelHeight>i&&("center"==this.labelPos?this.rect.y-=(this.labelHeight-i)/2:"top"==this.labelPos&&(this.rect.y-=this.labelHeight-i),this.setHeight(this.labelHeight))}}},l.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==n.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},l.prototype.transform=function(t){var e=this.rect.x;e>s.WORLD_BOUNDARY?e=s.WORLD_BOUNDARY:e<-s.WORLD_BOUNDARY&&(e=-s.WORLD_BOUNDARY);var i=this.rect.y;i>s.WORLD_BOUNDARY?i=s.WORLD_BOUNDARY:i<-s.WORLD_BOUNDARY&&(i=-s.WORLD_BOUNDARY);var r=new h(e,i),n=t.inverseTransformPoint(r);this.setLocation(n.x,n.y)},l.prototype.getLeft=function(){return this.rect.x},l.prototype.getRight=function(){return this.rect.x+this.rect.width},l.prototype.getTop=function(){return this.rect.y},l.prototype.getBottom=function(){return this.rect.y+this.rect.height},l.prototype.getParent=function(){return null==this.owner?null:this.owner.getParent()},t.exports=l},function(t,e,i){function r(t,e){null==t&&null==e?(this.x=0,this.y=0):(this.x=t,this.y=e)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.setX=function(t){this.x=t},r.prototype.setY=function(t){this.y=t},r.prototype.getDifference=function(t){return new DimensionD(this.x-t.x,this.y-t.y)},r.prototype.getCopy=function(){return new r(this.x,this.y)},r.prototype.translate=function(t){return this.x+=t.width,this.y+=t.height,this},t.exports=r},function(t,e,i){var r=i(2),n=i(10),o=i(0),s=i(6),a=i(3),h=i(1),l=i(13),g=i(12),u=i(11);function c(t,e,i){r.call(this,i),this.estimatedSize=n.MIN_VALUE,this.margin=o.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=t,null!=e&&e instanceof s?this.graphManager=e:null!=e&&e instanceof Layout&&(this.graphManager=e.graphManager)}for(var d in c.prototype=Object.create(r.prototype),r)c[d]=r[d];c.prototype.getNodes=function(){return this.nodes},c.prototype.getEdges=function(){return this.edges},c.prototype.getGraphManager=function(){return this.graphManager},c.prototype.getParent=function(){return this.parent},c.prototype.getLeft=function(){return this.left},c.prototype.getRight=function(){return this.right},c.prototype.getTop=function(){return this.top},c.prototype.getBottom=function(){return this.bottom},c.prototype.isConnected=function(){return this.isConnected},c.prototype.add=function(t,e,i){if(null==e&&null==i){var r=t;if(null==this.graphManager)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(r)>-1)throw"Node already in graph!";return r.owner=this,this.getNodes().push(r),r}var n=t;if(!(this.getNodes().indexOf(e)>-1&&this.getNodes().indexOf(i)>-1))throw"Source or target not in graph!";if(e.owner!=i.owner||e.owner!=this)throw"Both owners must be this graph!";return e.owner!=i.owner?null:(n.source=e,n.target=i,n.isInterGraph=!1,this.getEdges().push(n),e.edges.push(n),i!=e&&i.edges.push(n),n)},c.prototype.remove=function(t){var e=t;if(t instanceof a){if(null==e)throw"Node is null!";if(null==e.owner||e.owner!=this)throw"Owner graph is invalid!";if(null==this.graphManager)throw"Owner graph manager is invalid!";for(var i=e.edges.slice(),r=i.length,n=0;n<r;n++)(o=i[n]).isInterGraph?this.graphManager.remove(o):o.source.owner.remove(o);if(-1==(s=this.nodes.indexOf(e)))throw"Node not in owner node list!";this.nodes.splice(s,1)}else if(t instanceof h){var o;if(null==(o=t))throw"Edge is null!";if(null==o.source||null==o.target)throw"Source and/or target is null!";if(null==o.source.owner||null==o.target.owner||o.source.owner!=this||o.target.owner!=this)throw"Source and/or target owner is invalid!";var s,l=o.source.edges.indexOf(o),g=o.target.edges.indexOf(o);if(!(l>-1&&g>-1))throw"Source and/or target doesn't know this edge!";if(o.source.edges.splice(l,1),o.target!=o.source&&o.target.edges.splice(g,1),-1==(s=o.source.owner.getEdges().indexOf(o)))throw"Not in owner's edge list!";o.source.owner.getEdges().splice(s,1)}},c.prototype.updateLeftTop=function(){for(var t,e,i,r=n.MAX_VALUE,o=n.MAX_VALUE,s=this.getNodes(),a=s.length,h=0;h<a;h++){var l=s[h];r>(t=l.getTop())&&(r=t),o>(e=l.getLeft())&&(o=e)}return r==n.MAX_VALUE?null:(i=null!=s[0].getParent().paddingLeft?s[0].getParent().paddingLeft:this.margin,this.left=o-i,this.top=r-i,new g(this.left,this.top))},c.prototype.updateBounds=function(t){for(var e,i,r,o,s,a=n.MAX_VALUE,h=-n.MAX_VALUE,g=n.MAX_VALUE,u=-n.MAX_VALUE,c=this.nodes,d=c.length,p=0;p<d;p++){var f=c[p];t&&null!=f.child&&f.updateBounds(),a>(e=f.getLeft())&&(a=e),h<(i=f.getRight())&&(h=i),g>(r=f.getTop())&&(g=r),u<(o=f.getBottom())&&(u=o)}var y=new l(a,g,h-a,u-g);a==n.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),s=null!=c[0].getParent().paddingLeft?c[0].getParent().paddingLeft:this.margin,this.left=y.x-s,this.right=y.x+y.width+s,this.top=y.y-s,this.bottom=y.y+y.height+s},c.calculateBounds=function(t){for(var e,i,r,o,s=n.MAX_VALUE,a=-n.MAX_VALUE,h=n.MAX_VALUE,g=-n.MAX_VALUE,u=t.length,c=0;c<u;c++){var d=t[c];s>(e=d.getLeft())&&(s=e),a<(i=d.getRight())&&(a=i),h>(r=d.getTop())&&(h=r),g<(o=d.getBottom())&&(g=o)}return new l(s,h,a-s,g-h)},c.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},c.prototype.getEstimatedSize=function(){if(this.estimatedSize==n.MIN_VALUE)throw"assert failed";return this.estimatedSize},c.prototype.calcEstimatedSize=function(){for(var t=0,e=this.nodes,i=e.length,r=0;r<i;r++)t+=e[r].calcEstimatedSize();return this.estimatedSize=0==t?o.EMPTY_COMPOUND_NODE_SIZE:t/Math.sqrt(this.nodes.length),this.estimatedSize},c.prototype.updateConnected=function(){var t=this;if(0!=this.nodes.length){var e,i,r=new u,n=new Set,o=this.nodes[0];for(o.withChildren().forEach(function(t){r.push(t),n.add(t)});0!==r.length;)for(var s=(e=(o=r.shift()).getEdges()).length,a=0;a<s;a++)null==(i=e[a].getOtherEndInGraph(o,this))||n.has(i)||i.withChildren().forEach(function(t){r.push(t),n.add(t)});if(this.isConnected=!1,n.size>=this.nodes.length){var h=0;n.forEach(function(e){e.owner==t&&h++}),h==this.nodes.length&&(this.isConnected=!0)}}else this.isConnected=!0},t.exports=c},function(t,e,i){var r,n=i(1);function o(t){r=i(5),this.layout=t,this.graphs=[],this.edges=[]}o.prototype.addRoot=function(){var t=this.layout.newGraph(),e=this.layout.newNode(null),i=this.add(t,e);return this.setRootGraph(i),this.rootGraph},o.prototype.add=function(t,e,i,r,n){if(null==i&&null==r&&null==n){if(null==t)throw"Graph is null!";if(null==e)throw"Parent node is null!";if(this.graphs.indexOf(t)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(t),null!=t.parent)throw"Already has a parent!";if(null!=e.child)throw"Already has a child!";return t.parent=e,e.child=t,t}n=i,i=t;var o=(r=e).getOwner(),s=n.getOwner();if(null==o||o.getGraphManager()!=this)throw"Source not in this graph mgr!";if(null==s||s.getGraphManager()!=this)throw"Target not in this graph mgr!";if(o==s)return i.isInterGraph=!1,o.add(i,r,n);if(i.isInterGraph=!0,i.source=r,i.target=n,this.edges.indexOf(i)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(i),null==i.source||null==i.target)throw"Edge source and/or target is null!";if(-1!=i.source.edges.indexOf(i)||-1!=i.target.edges.indexOf(i))throw"Edge already in source and/or target incidency list!";return i.source.edges.push(i),i.target.edges.push(i),i},o.prototype.remove=function(t){if(t instanceof r){var e=t;if(e.getGraphManager()!=this)throw"Graph not in this graph mgr";if(e!=this.rootGraph&&(null==e.parent||e.parent.graphManager!=this))throw"Invalid parent node!";for(var i,o=[],s=(o=o.concat(e.getEdges())).length,a=0;a<s;a++)i=o[a],e.remove(i);var h,l=[];for(s=(l=l.concat(e.getNodes())).length,a=0;a<s;a++)h=l[a],e.remove(h);e==this.rootGraph&&this.setRootGraph(null);var g=this.graphs.indexOf(e);this.graphs.splice(g,1),e.parent=null}else if(t instanceof n){if(null==(i=t))throw"Edge is null!";if(!i.isInterGraph)throw"Not an inter-graph edge!";if(null==i.source||null==i.target)throw"Source and/or target is null!";if(-1==i.source.edges.indexOf(i)||-1==i.target.edges.indexOf(i))throw"Source and/or target doesn't know this edge!";if(g=i.source.edges.indexOf(i),i.source.edges.splice(g,1),g=i.target.edges.indexOf(i),i.target.edges.splice(g,1),null==i.source.owner||null==i.source.owner.getGraphManager())throw"Edge owner graph or owner graph manager is null!";if(-1==i.source.owner.getGraphManager().edges.indexOf(i))throw"Not in owner graph manager's edge list!";g=i.source.owner.getGraphManager().edges.indexOf(i),i.source.owner.getGraphManager().edges.splice(g,1)}},o.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},o.prototype.getGraphs=function(){return this.graphs},o.prototype.getAllNodes=function(){if(null==this.allNodes){for(var t=[],e=this.getGraphs(),i=e.length,r=0;r<i;r++)t=t.concat(e[r].getNodes());this.allNodes=t}return this.allNodes},o.prototype.resetAllNodes=function(){this.allNodes=null},o.prototype.resetAllEdges=function(){this.allEdges=null},o.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},o.prototype.getAllEdges=function(){if(null==this.allEdges){var t=[],e=this.getGraphs();e.length;for(var i=0;i<e.length;i++)t=t.concat(e[i].getEdges());t=t.concat(this.edges),this.allEdges=t}return this.allEdges},o.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},o.prototype.setAllNodesToApplyGravitation=function(t){if(null!=this.allNodesToApplyGravitation)throw"assert failed";this.allNodesToApplyGravitation=t},o.prototype.getRoot=function(){return this.rootGraph},o.prototype.setRootGraph=function(t){if(t.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=t,null==t.parent&&(t.parent=this.layout.newNode("Root node"))},o.prototype.getLayout=function(){return this.layout},o.prototype.isOneAncestorOfOther=function(t,e){if(null==t||null==e)throw"assert failed";if(t==e)return!0;for(var i,r=t.getOwner();null!=(i=r.getParent());){if(i==e)return!0;if(null==(r=i.getOwner()))break}for(r=e.getOwner();null!=(i=r.getParent());){if(i==t)return!0;if(null==(r=i.getOwner()))break}return!1},o.prototype.calcLowestCommonAncestors=function(){for(var t,e,i,r,n,o=this.getAllEdges(),s=o.length,a=0;a<s;a++)if(e=(t=o[a]).source,i=t.target,t.lca=null,t.sourceInLca=e,t.targetInLca=i,e!=i){for(r=e.getOwner();null==t.lca;){for(t.targetInLca=i,n=i.getOwner();null==t.lca;){if(n==r){t.lca=n;break}if(n==this.rootGraph)break;if(null!=t.lca)throw"assert failed";t.targetInLca=n.getParent(),n=t.targetInLca.getOwner()}if(r==this.rootGraph)break;null==t.lca&&(t.sourceInLca=r.getParent(),r=t.sourceInLca.getOwner())}if(null==t.lca)throw"assert failed"}else t.lca=e.getOwner()},o.prototype.calcLowestCommonAncestor=function(t,e){if(t==e)return t.getOwner();for(var i=t.getOwner();null!=i;){for(var r=e.getOwner();null!=r;){if(r==i)return r;r=r.getParent().getOwner()}i=i.getParent().getOwner()}return i},o.prototype.calcInclusionTreeDepths=function(t,e){var i;null==t&&null==e&&(t=this.rootGraph,e=1);for(var r=t.getNodes(),n=r.length,o=0;o<n;o++)(i=r[o]).inclusionTreeDepth=e,null!=i.child&&this.calcInclusionTreeDepths(i.child,e+1)},o.prototype.includesInvalidEdge=function(){for(var t,e=this.edges.length,i=0;i<e;i++)if(t=this.edges[i],this.isOneAncestorOfOther(t.source,t.target))return!0;return!1},t.exports=o},function(t,e,i){var r=i(0);function n(){}for(var o in r)n[o]=r[o];n.MAX_ITERATIONS=2500,n.DEFAULT_EDGE_LENGTH=50,n.DEFAULT_SPRING_STRENGTH=.45,n.DEFAULT_REPULSION_STRENGTH=4500,n.DEFAULT_GRAVITY_STRENGTH=.4,n.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,n.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,n.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,n.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,n.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,n.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,n.COOLING_ADAPTATION_FACTOR=.33,n.ADAPTATION_LOWER_NODE_LIMIT=1e3,n.ADAPTATION_UPPER_NODE_LIMIT=5e3,n.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,n.MAX_NODE_DISPLACEMENT=3*n.MAX_NODE_DISPLACEMENT_INCREMENTAL,n.MIN_REPULSION_DIST=n.DEFAULT_EDGE_LENGTH/10,n.CONVERGENCE_CHECK_PERIOD=100,n.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,n.MIN_EDGE_LENGTH=1,n.GRID_CALCULATION_CHECK_PERIOD=10,t.exports=n},function(t,e,i){var r=i(12);function n(){}n.calcSeparationAmount=function(t,e,i,r){if(!t.intersects(e))throw"assert failed";var n=new Array(2);this.decideDirectionsForOverlappingNodes(t,e,n),i[0]=Math.min(t.getRight(),e.getRight())-Math.max(t.x,e.x),i[1]=Math.min(t.getBottom(),e.getBottom())-Math.max(t.y,e.y),t.getX()<=e.getX()&&t.getRight()>=e.getRight()?i[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight()):e.getX()<=t.getX()&&e.getRight()>=t.getRight()&&(i[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight())),t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()?i[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom()):e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()&&(i[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom()));var o=Math.abs((e.getCenterY()-t.getCenterY())/(e.getCenterX()-t.getCenterX()));e.getCenterY()===t.getCenterY()&&e.getCenterX()===t.getCenterX()&&(o=1);var s=o*i[0],a=i[1]/o;i[0]<a?a=i[0]:s=i[1],i[0]=-1*n[0]*(a/2+r),i[1]=-1*n[1]*(s/2+r)},n.decideDirectionsForOverlappingNodes=function(t,e,i){t.getCenterX()<e.getCenterX()?i[0]=-1:i[0]=1,t.getCenterY()<e.getCenterY()?i[1]=-1:i[1]=1},n.getIntersection2=function(t,e,i){var r=t.getCenterX(),n=t.getCenterY(),o=e.getCenterX(),s=e.getCenterY();if(t.intersects(e))return i[0]=r,i[1]=n,i[2]=o,i[3]=s,!0;var a=t.getX(),h=t.getY(),l=t.getRight(),g=t.getX(),u=t.getBottom(),c=t.getRight(),d=t.getWidthHalf(),p=t.getHeightHalf(),f=e.getX(),y=e.getY(),E=e.getRight(),v=e.getX(),A=e.getBottom(),N=e.getRight(),T=e.getWidthHalf(),L=e.getHeightHalf(),m=!1,_=!1;if(r===o){if(n>s)return i[0]=r,i[1]=h,i[2]=o,i[3]=A,!1;if(n<s)return i[0]=r,i[1]=u,i[2]=o,i[3]=y,!1}else if(n===s){if(r>o)return i[0]=a,i[1]=n,i[2]=E,i[3]=s,!1;if(r<o)return i[0]=l,i[1]=n,i[2]=f,i[3]=s,!1}else{var O=t.height/t.width,I=e.height/e.width,D=(s-n)/(o-r),w=void 0,R=void 0,C=void 0,M=void 0,x=void 0,G=void 0;if(-O===D?r>o?(i[0]=g,i[1]=u,m=!0):(i[0]=l,i[1]=h,m=!0):O===D&&(r>o?(i[0]=a,i[1]=h,m=!0):(i[0]=c,i[1]=u,m=!0)),-I===D?o>r?(i[2]=v,i[3]=A,_=!0):(i[2]=E,i[3]=y,_=!0):I===D&&(o>r?(i[2]=f,i[3]=y,_=!0):(i[2]=N,i[3]=A,_=!0)),m&&_)return!1;if(r>o?n>s?(w=this.getCardinalDirection(O,D,4),R=this.getCardinalDirection(I,D,2)):(w=this.getCardinalDirection(-O,D,3),R=this.getCardinalDirection(-I,D,1)):n>s?(w=this.getCardinalDirection(-O,D,1),R=this.getCardinalDirection(-I,D,3)):(w=this.getCardinalDirection(O,D,2),R=this.getCardinalDirection(I,D,4)),!m)switch(w){case 1:M=h,C=r+-p/D,i[0]=C,i[1]=M;break;case 2:C=c,M=n+d*D,i[0]=C,i[1]=M;break;case 3:M=u,C=r+p/D,i[0]=C,i[1]=M;break;case 4:C=g,M=n+-d*D,i[0]=C,i[1]=M}if(!_)switch(R){case 1:G=y,x=o+-L/D,i[2]=x,i[3]=G;break;case 2:x=N,G=s+T*D,i[2]=x,i[3]=G;break;case 3:G=A,x=o+L/D,i[2]=x,i[3]=G;break;case 4:x=v,G=s+-T*D,i[2]=x,i[3]=G}}return!1},n.getCardinalDirection=function(t,e,i){return t>e?i:1+i%4},n.getIntersection=function(t,e,i,n){if(null==n)return this.getIntersection2(t,e,i);var o,s,a,h,l,g,u,c=t.x,d=t.y,p=e.x,f=e.y,y=i.x,E=i.y,v=n.x,A=n.y;return 0===(u=(o=f-d)*(h=y-v)-(s=A-E)*(a=c-p))?null:new r((a*(g=v*E-y*A)-h*(l=p*d-c*f))/u,(s*l-o*g)/u)},n.angleOfVector=function(t,e,i,r){var n=void 0;return t!==i?(n=Math.atan((r-e)/(i-t)),i<t?n+=Math.PI:r<e&&(n+=this.TWO_PI)):n=r<e?this.ONE_AND_HALF_PI:this.HALF_PI,n},n.doIntersect=function(t,e,i,r){var n=t.x,o=t.y,s=e.x,a=e.y,h=i.x,l=i.y,g=r.x,u=r.y,c=(s-n)*(u-l)-(g-h)*(a-o);if(0===c)return!1;var d=((u-l)*(g-n)+(h-g)*(u-o))/c,p=((o-a)*(g-n)+(s-n)*(u-o))/c;return 0<d&&d<1&&0<p&&p<1},n.HALF_PI=.5*Math.PI,n.ONE_AND_HALF_PI=1.5*Math.PI,n.TWO_PI=2*Math.PI,n.THREE_PI=3*Math.PI,t.exports=n},function(t,e,i){function r(){}r.sign=function(t){return t>0?1:t<0?-1:0},r.floor=function(t){return t<0?Math.ceil(t):Math.floor(t)},r.ceil=function(t){return t<0?Math.floor(t):Math.ceil(t)},t.exports=r},function(t,e,i){function r(){}r.MAX_VALUE=2147483647,r.MIN_VALUE=-2147483648,t.exports=r},function(t,e,i){var r=function(){function t(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,i,r){return i&&t(e.prototype,i),r&&t(e,r),e}}(),n=function(t){return{value:t,next:null,prev:null}},o=function(t,e,i,r){return null!==t?t.next=e:r.head=e,null!==i?i.prev=e:r.tail=e,e.prev=t,e.next=i,r.length++,e},s=function(t,e){var i=t.prev,r=t.next;return null!==i?i.next=r:e.head=r,null!==r?r.prev=i:e.tail=i,t.prev=t.next=null,e.length--,t},a=function(){function t(e){var i=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.length=0,this.head=null,this.tail=null,null!=e&&e.forEach(function(t){return i.push(t)})}return r(t,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(t,e){return o(e.prev,n(t),e,this)}},{key:"insertAfter",value:function(t,e){return o(e,n(t),e.next,this)}},{key:"insertNodeBefore",value:function(t,e){return o(e.prev,t,e,this)}},{key:"insertNodeAfter",value:function(t,e){return o(e,t,e.next,this)}},{key:"push",value:function(t){return o(this.tail,n(t),null,this)}},{key:"unshift",value:function(t){return o(null,n(t),this.head,this)}},{key:"remove",value:function(t){return s(t,this)}},{key:"pop",value:function(){return s(this.tail,this).value}},{key:"popNode",value:function(){return s(this.tail,this)}},{key:"shift",value:function(){return s(this.head,this).value}},{key:"shiftNode",value:function(){return s(this.head,this)}},{key:"get_object_at",value:function(t){if(t<=this.length()){for(var e=1,i=this.head;e<t;)i=i.next,e++;return i.value}}},{key:"set_object_at",value:function(t,e){if(t<=this.length()){for(var i=1,r=this.head;i<t;)r=r.next,i++;r.value=e}}}]),t}();t.exports=a},function(t,e,i){function r(t,e,i){this.x=null,this.y=null,null==t&&null==e&&null==i?(this.x=0,this.y=0):"number"==typeof t&&"number"==typeof e&&null==i?(this.x=t,this.y=e):"Point"==t.constructor.name&&null==e&&null==i&&(i=t,this.x=i.x,this.y=i.y)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.getLocation=function(){return new r(this.x,this.y)},r.prototype.setLocation=function(t,e,i){"Point"==t.constructor.name&&null==e&&null==i?(i=t,this.setLocation(i.x,i.y)):"number"==typeof t&&"number"==typeof e&&null==i&&(parseInt(t)==t&&parseInt(e)==e?this.move(t,e):(this.x=Math.floor(t+.5),this.y=Math.floor(e+.5)))},r.prototype.move=function(t,e){this.x=t,this.y=e},r.prototype.translate=function(t,e){this.x+=t,this.y+=e},r.prototype.equals=function(t){if("Point"==t.constructor.name){var e=t;return this.x==e.x&&this.y==e.y}return this==t},r.prototype.toString=function(){return(new r).constructor.name+"[x="+this.x+",y="+this.y+"]"},t.exports=r},function(t,e,i){function r(t,e,i,r){this.x=0,this.y=0,this.width=0,this.height=0,null!=t&&null!=e&&null!=i&&null!=r&&(this.x=t,this.y=e,this.width=i,this.height=r)}r.prototype.getX=function(){return this.x},r.prototype.setX=function(t){this.x=t},r.prototype.getY=function(){return this.y},r.prototype.setY=function(t){this.y=t},r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(t){this.width=t},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(t){this.height=t},r.prototype.getRight=function(){return this.x+this.width},r.prototype.getBottom=function(){return this.y+this.height},r.prototype.intersects=function(t){return!(this.getRight()<t.x||this.getBottom()<t.y||t.getRight()<this.x||t.getBottom()<this.y)},r.prototype.getCenterX=function(){return this.x+this.width/2},r.prototype.getMinX=function(){return this.getX()},r.prototype.getMaxX=function(){return this.getX()+this.width},r.prototype.getCenterY=function(){return this.y+this.height/2},r.prototype.getMinY=function(){return this.getY()},r.prototype.getMaxY=function(){return this.getY()+this.height},r.prototype.getWidthHalf=function(){return this.width/2},r.prototype.getHeightHalf=function(){return this.height/2},t.exports=r},function(t,e,i){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function n(){}n.lastID=0,n.createID=function(t){return n.isPrimitive(t)?t:(null!=t.uniqueID||(t.uniqueID=n.getString(),n.lastID++),t.uniqueID)},n.getString=function(t){return null==t&&(t=n.lastID),"Object#"+t},n.isPrimitive=function(t){var e=void 0===t?"undefined":r(t);return null==t||"object"!=e&&"function"!=e},t.exports=n},function(t,e,i){function r(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}var n=i(0),o=i(6),s=i(3),a=i(1),h=i(5),l=i(4),g=i(17),u=i(27);function c(t){u.call(this),this.layoutQuality=n.QUALITY,this.createBendsAsNeeded=n.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=n.DEFAULT_INCREMENTAL,this.animationOnLayout=n.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=n.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=n.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=n.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new o(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,null!=t&&(this.isRemoteUse=t)}c.RANDOM_SEED=1,c.prototype=Object.create(u.prototype),c.prototype.getGraphManager=function(){return this.graphManager},c.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},c.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},c.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},c.prototype.newGraphManager=function(){var t=new o(this);return this.graphManager=t,t},c.prototype.newGraph=function(t){return new h(null,this.graphManager,t)},c.prototype.newNode=function(t){return new s(this.graphManager,t)},c.prototype.newEdge=function(t){return new a(null,null,t)},c.prototype.checkLayoutSuccess=function(){return null==this.graphManager.getRoot()||0==this.graphManager.getRoot().getNodes().length||this.graphManager.includesInvalidEdge()},c.prototype.runLayout=function(){var t;return this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters(),t=!this.checkLayoutSuccess()&&this.layout(),"during"!==n.ANIMATE&&(t&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,t)},c.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},c.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var t=this.graphManager.getAllEdges(),e=0;e<t.length;e++)t[e];var i=this.graphManager.getRoot().getNodes();for(e=0;e<i.length;e++)i[e];this.update(this.graphManager.getRoot())}},c.prototype.update=function(t){if(null==t)this.update2();else if(t instanceof s){var e=t;if(null!=e.getChild())for(var i=e.getChild().getNodes(),r=0;r<i.length;r++)update(i[r]);null!=e.vGraphObject&&e.vGraphObject.update(e)}else if(t instanceof a){var n=t;null!=n.vGraphObject&&n.vGraphObject.update(n)}else if(t instanceof h){var o=t;null!=o.vGraphObject&&o.vGraphObject.update(o)}},c.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=n.QUALITY,this.animationDuringLayout=n.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=n.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=n.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=n.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=n.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=n.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},c.prototype.transform=function(t){if(null==t)this.transform(new l(0,0));else{var e=new g,i=this.graphManager.getRoot().updateLeftTop();if(null!=i){e.setWorldOrgX(t.x),e.setWorldOrgY(t.y),e.setDeviceOrgX(i.x),e.setDeviceOrgY(i.y);for(var r=this.getAllNodes(),n=0;n<r.length;n++)r[n].transform(e)}}},c.prototype.positionNodesRandomly=function(t){if(null==t)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var e,i,r=t.getNodes(),n=0;n<r.length;n++)null==(i=(e=r[n]).getChild())||0==i.getNodes().length?e.scatter():(this.positionNodesRandomly(i),e.updateBounds())},c.prototype.getFlatForest=function(){for(var t=[],e=!0,i=this.graphManager.getRoot().getNodes(),n=!0,o=0;o<i.length;o++)null!=i[o].getChild()&&(n=!1);if(!n)return t;var s=new Set,a=[],h=new Map,l=[];for(l=l.concat(i);l.length>0&&e;){for(a.push(l[0]);a.length>0&&e;){var g=a[0];a.splice(0,1),s.add(g);var u=g.getEdges();for(o=0;o<u.length;o++){var c=u[o].getOtherEnd(g);if(h.get(g)!=c){if(s.has(c)){e=!1;break}a.push(c),h.set(c,g)}}}if(e){var d=[].concat(r(s));for(t.push(d),o=0;o<d.length;o++){var p=d[o],f=l.indexOf(p);f>-1&&l.splice(f,1)}s=new Set,h=new Map}else t=[]}return t},c.prototype.createDummyNodesForBendpoints=function(t){for(var e=[],i=t.source,r=this.graphManager.calcLowestCommonAncestor(t.source,t.target),n=0;n<t.bendpoints.length;n++){var o=this.newNode(null);o.setRect(new Point(0,0),new Dimension(1,1)),r.add(o);var s=this.newEdge(null);this.graphManager.add(s,i,o),e.add(o),i=o}return s=this.newEdge(null),this.graphManager.add(s,i,t.target),this.edgeToDummyNodes.set(t,e),t.isInterGraph()?this.graphManager.remove(t):r.remove(t),e},c.prototype.createBendpointsFromDummyNodes=function(){var t=[];t=t.concat(this.graphManager.getAllEdges()),t=[].concat(r(this.edgeToDummyNodes.keys())).concat(t);for(var e=0;e<t.length;e++){var i=t[e];if(i.bendpoints.length>0){for(var n=this.edgeToDummyNodes.get(i),o=0;o<n.length;o++){var s=n[o],a=new l(s.getCenterX(),s.getCenterY()),h=i.bendpoints.get(o);h.x=a.x,h.y=a.y,s.getOwner().remove(s)}this.graphManager.add(i,i.source,i.target)}}},c.transform=function(t,e,i,r){if(null!=i&&null!=r){var n=e;return t<=50?n-=(e-e/i)/50*(50-t):n+=(e*r-e)/50*(t-50),n}var o,s;return t<=50?(o=9*e/500,s=e/10):(o=9*e/50,s=-8*e),o*t+s},c.findCenterOfTree=function(t){var e=[];e=e.concat(t);var i=[],r=new Map,n=!1,o=null;1!=e.length&&2!=e.length||(n=!0,o=e[0]);for(var s=0;s<e.length;s++){var a=(g=e[s]).getNeighborsList().size;r.set(g,g.getNeighborsList().size),1==a&&i.push(g)}var h=[];for(h=h.concat(i);!n;){var l=[];for(l=l.concat(h),h=[],s=0;s<e.length;s++){var g=e[s],u=e.indexOf(g);u>=0&&e.splice(u,1),g.getNeighborsList().forEach(function(t){if(i.indexOf(t)<0){var e=r.get(t)-1;1==e&&h.push(t),r.set(t,e)}})}i=i.concat(h),1!=e.length&&2!=e.length||(n=!0,o=e[0])}return o},c.prototype.setGraphManager=function(t){this.graphManager=t},t.exports=c},function(t,e,i){function r(){}r.seed=1,r.x=0,r.nextDouble=function(){return r.x=1e4*Math.sin(r.seed++),r.x-Math.floor(r.x)},t.exports=r},function(t,e,i){var r=i(4);function n(t,e){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}n.prototype.getWorldOrgX=function(){return this.lworldOrgX},n.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},n.prototype.getWorldOrgY=function(){return this.lworldOrgY},n.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},n.prototype.getWorldExtX=function(){return this.lworldExtX},n.prototype.setWorldExtX=function(t){this.lworldExtX=t},n.prototype.getWorldExtY=function(){return this.lworldExtY},n.prototype.setWorldExtY=function(t){this.lworldExtY=t},n.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},n.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},n.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},n.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},n.prototype.getDeviceExtX=function(){return this.ldeviceExtX},n.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},n.prototype.getDeviceExtY=function(){return this.ldeviceExtY},n.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},n.prototype.transformX=function(t){var e=0,i=this.lworldExtX;return 0!=i&&(e=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/i),e},n.prototype.transformY=function(t){var e=0,i=this.lworldExtY;return 0!=i&&(e=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/i),e},n.prototype.inverseTransformX=function(t){var e=0,i=this.ldeviceExtX;return 0!=i&&(e=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/i),e},n.prototype.inverseTransformY=function(t){var e=0,i=this.ldeviceExtY;return 0!=i&&(e=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/i),e},n.prototype.inverseTransformPoint=function(t){return new r(this.inverseTransformX(t.x),this.inverseTransformY(t.y))},t.exports=n},function(t,e,i){var r=i(15),n=i(7),o=i(0),s=i(8),a=i(9);function h(){r.call(this),this.useSmartIdealEdgeLengthCalculation=n.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=n.DEFAULT_EDGE_LENGTH,this.springConstant=n.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=n.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=n.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=n.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=n.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=n.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*n.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=n.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=n.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=n.MAX_ITERATIONS}for(var l in h.prototype=Object.create(r.prototype),r)h[l]=r[l];h.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=n.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},h.prototype.calcIdealEdgeLengths=function(){for(var t,e,i,r,s,a,h=this.getGraphManager().getAllEdges(),l=0;l<h.length;l++)(t=h[l]).idealLength=this.idealEdgeLength,t.isInterGraph&&(i=t.getSource(),r=t.getTarget(),s=t.getSourceInLca().getEstimatedSize(),a=t.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(t.idealLength+=s+a-2*o.SIMPLE_NODE_SIZE),e=t.getLca().getInclusionTreeDepth(),t.idealLength+=n.DEFAULT_EDGE_LENGTH*n.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(i.getInclusionTreeDepth()+r.getInclusionTreeDepth()-2*e))},h.prototype.initSpringEmbedder=function(){var t=this.getAllNodes().length;this.incremental?(t>n.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*n.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-n.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>n.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(n.COOLING_ADAPTATION_FACTOR,1-(t-n.ADAPTATION_LOWER_NODE_LIMIT)/(n.ADAPTATION_UPPER_NODE_LIMIT-n.ADAPTATION_LOWER_NODE_LIMIT)*(1-n.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=n.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(5*this.getAllNodes().length,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},h.prototype.calcSpringForces=function(){for(var t,e=this.getAllEdges(),i=0;i<e.length;i++)t=e[i],this.calcSpringForce(t,t.idealLength)},h.prototype.calcRepulsionForces=function(){var t,e,i,r,o,s=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],h=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&s&&this.updateGrid(),o=new Set,t=0;t<h.length;t++)i=h[t],this.calculateRepulsionForceOfANode(i,o,s,a),o.add(i);else for(t=0;t<h.length;t++)for(i=h[t],e=t+1;e<h.length;e++)r=h[e],i.getOwner()==r.getOwner()&&this.calcRepulsionForce(i,r)},h.prototype.calcGravitationalForces=function(){for(var t,e=this.getAllNodesToApplyGravitation(),i=0;i<e.length;i++)t=e[i],this.calcGravitationalForce(t)},h.prototype.moveNodes=function(){for(var t=this.getAllNodes(),e=0;e<t.length;e++)t[e].move()},h.prototype.calcSpringForce=function(t,e){var i,r,n,o,s=t.getSource(),a=t.getTarget();if(this.uniformLeafNodeSizes&&null==s.getChild()&&null==a.getChild())t.updateLengthSimple();else if(t.updateLength(),t.isOverlapingSourceAndTarget)return;0!=(i=t.getLength())&&(n=(r=this.springConstant*(i-e))*(t.lengthX/i),o=r*(t.lengthY/i),s.springForceX+=n,s.springForceY+=o,a.springForceX-=n,a.springForceY-=o)},h.prototype.calcRepulsionForce=function(t,e){var i,r,o,h,l,g,u,c=t.getRect(),d=e.getRect(),p=new Array(2),f=new Array(4);if(c.intersects(d)){s.calcSeparationAmount(c,d,p,n.DEFAULT_EDGE_LENGTH/2),g=2*p[0],u=2*p[1];var y=t.noOfChildren*e.noOfChildren/(t.noOfChildren+e.noOfChildren);t.repulsionForceX-=y*g,t.repulsionForceY-=y*u,e.repulsionForceX+=y*g,e.repulsionForceY+=y*u}else this.uniformLeafNodeSizes&&null==t.getChild()&&null==e.getChild()?(i=d.getCenterX()-c.getCenterX(),r=d.getCenterY()-c.getCenterY()):(s.getIntersection(c,d,f),i=f[2]-f[0],r=f[3]-f[1]),Math.abs(i)<n.MIN_REPULSION_DIST&&(i=a.sign(i)*n.MIN_REPULSION_DIST),Math.abs(r)<n.MIN_REPULSION_DIST&&(r=a.sign(r)*n.MIN_REPULSION_DIST),o=i*i+r*r,h=Math.sqrt(o),g=(l=this.repulsionConstant*t.noOfChildren*e.noOfChildren/o)*i/h,u=l*r/h,t.repulsionForceX-=g,t.repulsionForceY-=u,e.repulsionForceX+=g,e.repulsionForceY+=u},h.prototype.calcGravitationalForce=function(t){var e,i,r,n,o,s,a,h;i=((e=t.getOwner()).getRight()+e.getLeft())/2,r=(e.getTop()+e.getBottom())/2,n=t.getCenterX()-i,o=t.getCenterY()-r,s=Math.abs(n)+t.getWidth()/2,a=Math.abs(o)+t.getHeight()/2,t.getOwner()==this.graphManager.getRoot()?(s>(h=e.getEstimatedSize()*this.gravityRangeFactor)||a>h)&&(t.gravitationForceX=-this.gravityConstant*n,t.gravitationForceY=-this.gravityConstant*o):(s>(h=e.getEstimatedSize()*this.compoundGravityRangeFactor)||a>h)&&(t.gravitationForceX=-this.gravityConstant*n*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*o*this.compoundGravityConstant)},h.prototype.isConverged=function(){var t,e=!1;return this.totalIterations>this.maxIterations/3&&(e=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,t||e},h.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},h.prototype.calcNoOfChildrenForAllNodes=function(){for(var t,e=this.graphManager.getAllNodes(),i=0;i<e.length;i++)(t=e[i]).noOfChildren=t.getNoOfChildren()},h.prototype.calcGrid=function(t){var e,i;e=parseInt(Math.ceil((t.getRight()-t.getLeft())/this.repulsionRange)),i=parseInt(Math.ceil((t.getBottom()-t.getTop())/this.repulsionRange));for(var r=new Array(e),n=0;n<e;n++)r[n]=new Array(i);for(n=0;n<e;n++)for(var o=0;o<i;o++)r[n][o]=new Array;return r},h.prototype.addNodeToGrid=function(t,e,i){var r,n,o,s;r=parseInt(Math.floor((t.getRect().x-e)/this.repulsionRange)),n=parseInt(Math.floor((t.getRect().width+t.getRect().x-e)/this.repulsionRange)),o=parseInt(Math.floor((t.getRect().y-i)/this.repulsionRange)),s=parseInt(Math.floor((t.getRect().height+t.getRect().y-i)/this.repulsionRange));for(var a=r;a<=n;a++)for(var h=o;h<=s;h++)this.grid[a][h].push(t),t.setGridCoordinates(r,n,o,s)},h.prototype.updateGrid=function(){var t,e,i=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),t=0;t<i.length;t++)e=i[t],this.addNodeToGrid(e,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},h.prototype.calculateRepulsionForceOfANode=function(t,e,i,r){if(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&i||r){var o,s=new Set;t.surrounding=new Array;for(var a=this.grid,h=t.startX-1;h<t.finishX+2;h++)for(var l=t.startY-1;l<t.finishY+2;l++)if(!(h<0||l<0||h>=a.length||l>=a[0].length))for(var g=0;g<a[h][l].length;g++)if(o=a[h][l][g],t.getOwner()==o.getOwner()&&t!=o&&!e.has(o)&&!s.has(o)){var u=Math.abs(t.getCenterX()-o.getCenterX())-(t.getWidth()/2+o.getWidth()/2),c=Math.abs(t.getCenterY()-o.getCenterY())-(t.getHeight()/2+o.getHeight()/2);u<=this.repulsionRange&&c<=this.repulsionRange&&s.add(o)}t.surrounding=[].concat(function(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}(s))}for(h=0;h<t.surrounding.length;h++)this.calcRepulsionForce(t,t.surrounding[h])},h.prototype.calcRepulsionRange=function(){return 0},t.exports=h},function(t,e,i){var r=i(1),n=i(7);function o(t,e,i){r.call(this,t,e,i),this.idealLength=n.DEFAULT_EDGE_LENGTH}for(var s in o.prototype=Object.create(r.prototype),r)o[s]=r[s];t.exports=o},function(t,e,i){var r=i(3);function n(t,e,i,n){r.call(this,t,e,i,n),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}for(var o in n.prototype=Object.create(r.prototype),r)n[o]=r[o];n.prototype.setGridCoordinates=function(t,e,i,r){this.startX=t,this.finishX=e,this.startY=i,this.finishY=r},t.exports=n},function(t,e,i){function r(t,e){this.width=0,this.height=0,null!==t&&null!==e&&(this.height=e,this.width=t)}r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(t){this.width=t},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(t){this.height=t},t.exports=r},function(t,e,i){var r=i(14);function n(){this.map={},this.keys=[]}n.prototype.put=function(t,e){var i=r.createID(t);this.contains(i)||(this.map[i]=e,this.keys.push(t))},n.prototype.contains=function(t){return r.createID(t),null!=this.map[t]},n.prototype.get=function(t){var e=r.createID(t);return this.map[e]},n.prototype.keySet=function(){return this.keys},t.exports=n},function(t,e,i){var r=i(14);function n(){this.set={}}n.prototype.add=function(t){var e=r.createID(t);this.contains(e)||(this.set[e]=t)},n.prototype.remove=function(t){delete this.set[r.createID(t)]},n.prototype.clear=function(){this.set={}},n.prototype.contains=function(t){return this.set[r.createID(t)]==t},n.prototype.isEmpty=function(){return 0===this.size()},n.prototype.size=function(){return Object.keys(this.set).length},n.prototype.addAllTo=function(t){for(var e=Object.keys(this.set),i=e.length,r=0;r<i;r++)t.push(this.set[e[r]])},n.prototype.size=function(){return Object.keys(this.set).length},n.prototype.addAll=function(t){for(var e=t.length,i=0;i<e;i++){var r=t[i];this.add(r)}},t.exports=n},function(t,e,i){var r=function(){function t(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,i,r){return i&&t(e.prototype,i),r&&t(e,r),e}}(),n=i(11),o=function(){function t(e,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),null===i&&void 0===i||(this.compareFunction=this._defaultCompareFunction);var r=void 0;r=e instanceof n?e.size():e.length,this._quicksort(e,0,r-1)}return r(t,[{key:"_quicksort",value:function(t,e,i){if(e<i){var r=this._partition(t,e,i);this._quicksort(t,e,r),this._quicksort(t,r+1,i)}}},{key:"_partition",value:function(t,e,i){for(var r=this._get(t,e),n=e,o=i;;){for(;this.compareFunction(r,this._get(t,o));)o--;for(;this.compareFunction(this._get(t,n),r);)n++;if(!(n<o))return o;this._swap(t,n,o),n++,o--}}},{key:"_get",value:function(t,e){return t instanceof n?t.get_object_at(e):t[e]}},{key:"_set",value:function(t,e,i){t instanceof n?t.set_object_at(e,i):t[e]=i}},{key:"_swap",value:function(t,e,i){var r=this._get(t,e);this._set(t,e,this._get(t,i)),this._set(t,i,r)}},{key:"_defaultCompareFunction",value:function(t,e){return e>t}}]),t}();t.exports=o},function(t,e,i){var r=function(){function t(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,i,r){return i&&t(e.prototype,i),r&&t(e,r),e}}(),n=function(){function t(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sequence1=e,this.sequence2=i,this.match_score=r,this.mismatch_penalty=n,this.gap_penalty=o,this.iMax=e.length+1,this.jMax=i.length+1,this.grid=new Array(this.iMax);for(var s=0;s<this.iMax;s++){this.grid[s]=new Array(this.jMax);for(var a=0;a<this.jMax;a++)this.grid[s][a]=0}this.tracebackGrid=new Array(this.iMax);for(var h=0;h<this.iMax;h++){this.tracebackGrid[h]=new Array(this.jMax);for(var l=0;l<this.jMax;l++)this.tracebackGrid[h][l]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return r(t,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var t=1;t<this.jMax;t++)this.grid[0][t]=this.grid[0][t-1]+this.gap_penalty,this.tracebackGrid[0][t]=[!1,!1,!0];for(var e=1;e<this.iMax;e++)this.grid[e][0]=this.grid[e-1][0]+this.gap_penalty,this.tracebackGrid[e][0]=[!1,!0,!1];for(var i=1;i<this.iMax;i++)for(var r=1;r<this.jMax;r++){var n=[this.sequence1[i-1]===this.sequence2[r-1]?this.grid[i-1][r-1]+this.match_score:this.grid[i-1][r-1]+this.mismatch_penalty,this.grid[i-1][r]+this.gap_penalty,this.grid[i][r-1]+this.gap_penalty],o=this.arrayAllMaxIndexes(n);this.grid[i][r]=n[o[0]],this.tracebackGrid[i][r]=[o.includes(0),o.includes(1),o.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var t=[];for(t.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});t[0];){var e=t[0],i=this.tracebackGrid[e.pos[0]][e.pos[1]];i[0]&&t.push({pos:[e.pos[0]-1,e.pos[1]-1],seq1:this.sequence1[e.pos[0]-1]+e.seq1,seq2:this.sequence2[e.pos[1]-1]+e.seq2}),i[1]&&t.push({pos:[e.pos[0]-1,e.pos[1]],seq1:this.sequence1[e.pos[0]-1]+e.seq1,seq2:"-"+e.seq2}),i[2]&&t.push({pos:[e.pos[0],e.pos[1]-1],seq1:"-"+e.seq1,seq2:this.sequence2[e.pos[1]-1]+e.seq2}),0===e.pos[0]&&0===e.pos[1]&&this.alignments.push({sequence1:e.seq1,sequence2:e.seq2}),t.shift()}return this.alignments}},{key:"getAllIndexes",value:function(t,e){for(var i=[],r=-1;-1!==(r=t.indexOf(e,r+1));)i.push(r);return i}},{key:"arrayAllMaxIndexes",value:function(t){return this.getAllIndexes(t,Math.max.apply(null,t))}}]),t}();t.exports=n},function(t,e,i){var r=function(){};r.FDLayout=i(18),r.FDLayoutConstants=i(7),r.FDLayoutEdge=i(19),r.FDLayoutNode=i(20),r.DimensionD=i(21),r.HashMap=i(22),r.HashSet=i(23),r.IGeometry=i(8),r.IMath=i(9),r.Integer=i(10),r.Point=i(12),r.PointD=i(4),r.RandomSeed=i(16),r.RectangleD=i(13),r.Transform=i(17),r.UniqueIDGeneretor=i(14),r.Quicksort=i(24),r.LinkedList=i(11),r.LGraphObject=i(2),r.LGraph=i(5),r.LEdge=i(1),r.LGraphManager=i(6),r.LNode=i(3),r.Layout=i(15),r.LayoutConstants=i(0),r.NeedlemanWunsch=i(25),t.exports=r},function(t,e,i){function r(){this.listeners=[]}var n=r.prototype;n.addListener=function(t,e){this.listeners.push({event:t,callback:e})},n.removeListener=function(t,e){for(var i=this.listeners.length;i>=0;i--){var r=this.listeners[i];r.event===t&&r.callback===e&&this.listeners.splice(i,1)}},n.emit=function(t,e){for(var i=0;i<this.listeners.length;i++){var r=this.listeners[i];t===r.event&&r.callback(e)}},t.exports=r}])},h.exports=t());var t}var g;var u;var c,d,p=(u||(u=1,s.exports=(c=g?a.exports:(g=1,d=function(t){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.i=function(t){return t},i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=7)}([function(e,i){e.exports=t},function(t,e,i){var r=i(0).FDLayoutConstants;function n(){}for(var o in r)n[o]=r[o];n.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,n.DEFAULT_RADIAL_SEPARATION=r.DEFAULT_EDGE_LENGTH,n.DEFAULT_COMPONENT_SEPERATION=60,n.TILE=!0,n.TILING_PADDING_VERTICAL=10,n.TILING_PADDING_HORIZONTAL=10,n.TREE_REDUCTION_ON_INCREMENTAL=!1,t.exports=n},function(t,e,i){var r=i(0).FDLayoutEdge;function n(t,e,i){r.call(this,t,e,i)}for(var o in n.prototype=Object.create(r.prototype),r)n[o]=r[o];t.exports=n},function(t,e,i){var r=i(0).LGraph;function n(t,e,i){r.call(this,t,e,i)}for(var o in n.prototype=Object.create(r.prototype),r)n[o]=r[o];t.exports=n},function(t,e,i){var r=i(0).LGraphManager;function n(t){r.call(this,t)}for(var o in n.prototype=Object.create(r.prototype),r)n[o]=r[o];t.exports=n},function(t,e,i){var r=i(0).FDLayoutNode,n=i(0).IMath;function o(t,e,i,n){r.call(this,t,e,i,n)}for(var s in o.prototype=Object.create(r.prototype),r)o[s]=r[s];o.prototype.move=function(){var t=this.graphManager.getLayout();this.displacementX=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementX=t.coolingFactor*t.maxNodeDisplacement*n.sign(this.displacementX)),Math.abs(this.displacementY)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementY=t.coolingFactor*t.maxNodeDisplacement*n.sign(this.displacementY)),null==this.child||0==this.child.getNodes().length?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),t.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},o.prototype.propogateDisplacementToChildren=function(t,e){for(var i,r=this.getChild().getNodes(),n=0;n<r.length;n++)null==(i=r[n]).getChild()?(i.moveBy(t,e),i.displacementX+=t,i.displacementY+=e):i.propogateDisplacementToChildren(t,e)},o.prototype.setPred1=function(t){this.pred1=t},o.prototype.getPred1=function(){return pred1},o.prototype.getPred2=function(){return pred2},o.prototype.setNext=function(t){this.next=t},o.prototype.getNext=function(){return next},o.prototype.setProcessed=function(t){this.processed=t},o.prototype.isProcessed=function(){return processed},t.exports=o},function(t,e,i){var r=i(0).FDLayout,n=i(4),o=i(3),s=i(5),a=i(2),h=i(1),l=i(0).FDLayoutConstants,g=i(0).LayoutConstants,u=i(0).Point,c=i(0).PointD,d=i(0).Layout,p=i(0).Integer,f=i(0).IGeometry,y=i(0).LGraph,E=i(0).Transform;function v(){r.call(this),this.toBeTiled={}}for(var A in v.prototype=Object.create(r.prototype),r)v[A]=r[A];v.prototype.newGraphManager=function(){var t=new n(this);return this.graphManager=t,t},v.prototype.newGraph=function(t){return new o(null,this.graphManager,t)},v.prototype.newNode=function(t){return new s(this.graphManager,t)},v.prototype.newEdge=function(t){return new a(null,null,t)},v.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.isSubLayout||(h.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=h.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=l.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=l.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=l.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=l.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=l.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/l.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=l.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},v.prototype.layout=function(){return g.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},v.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental)h.TREE_REDUCTION_ON_INCREMENTAL&&(this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation(),e=new Set(this.getAllNodes()),i=this.nodesWithGravity.filter(function(t){return e.has(t)}),this.graphManager.setAllNodesToApplyGravitation(i));else{var t=this.getFlatForest();if(t.length>0)this.positionNodesRadially(t);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),i=this.nodesWithGravity.filter(function(t){return e.has(t)});this.graphManager.setAllNodesToApplyGravitation(i),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},v.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%l.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter(function(e){return t.has(e)});this.graphManager.setAllNodesToApplyGravitation(e),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var i=!this.isTreeGrowing&&!this.isGrowthFinished,r=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(i,r),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},v.prototype.getPositionsData=function(){for(var t=this.graphManager.getAllNodes(),e={},i=0;i<t.length;i++){var r=t[i].rect,n=t[i].id;e[n]={id:n,x:r.getCenterX(),y:r.getCenterY(),w:r.width,h:r.height}}return e},v.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var t=!1;if("during"===l.ANIMATE)this.emit("layoutstarted");else{for(;!t;)t=this.tick();this.graphManager.updateBounds()}},v.prototype.calculateNodesToApplyGravitationTo=function(){var t,e,i=[],r=this.graphManager.getGraphs(),n=r.length;for(e=0;e<n;e++)(t=r[e]).updateConnected(),t.isConnected||(i=i.concat(t.getNodes()));return i},v.prototype.createBendpoints=function(){var t=[];t=t.concat(this.graphManager.getAllEdges());var e,i=new Set;for(e=0;e<t.length;e++){var r=t[e];if(!i.has(r)){var n=r.getSource(),o=r.getTarget();if(n==o)r.getBendpoints().push(new c),r.getBendpoints().push(new c),this.createDummyNodesForBendpoints(r),i.add(r);else{var s=[];if(s=(s=s.concat(n.getEdgeListToNode(o))).concat(o.getEdgeListToNode(n)),!i.has(s[0])){var a;if(s.length>1)for(a=0;a<s.length;a++){var h=s[a];h.getBendpoints().push(new c),this.createDummyNodesForBendpoints(h)}s.forEach(function(t){i.add(t)})}}}if(i.size==t.length)break}},v.prototype.positionNodesRadially=function(t){for(var e=new u(0,0),i=Math.ceil(Math.sqrt(t.length)),r=0,n=0,o=0,s=new c(0,0),a=0;a<t.length;a++){a%i==0&&(o=0,n=r,0!=a&&(n+=h.DEFAULT_COMPONENT_SEPERATION),r=0);var l=t[a],p=d.findCenterOfTree(l);e.x=o,e.y=n,(s=v.radialLayout(l,p,e)).y>r&&(r=Math.floor(s.y)),o=Math.floor(s.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new c(g.WORLD_CENTER_X-s.x/2,g.WORLD_CENTER_Y-s.y/2))},v.radialLayout=function(t,e,i){var r=Math.max(this.maxDiagonalInTree(t),h.DEFAULT_RADIAL_SEPARATION);v.branchRadialLayout(e,null,0,359,0,r);var n=y.calculateBounds(t),o=new E;o.setDeviceOrgX(n.getMinX()),o.setDeviceOrgY(n.getMinY()),o.setWorldOrgX(i.x),o.setWorldOrgY(i.y);for(var s=0;s<t.length;s++)t[s].transform(o);var a=new c(n.getMaxX(),n.getMaxY());return o.inverseTransformPoint(a)},v.branchRadialLayout=function(t,e,i,r,n,o){var s=(r-i+1)/2;s<0&&(s+=180);var a=(s+i)%360*f.TWO_PI/360,h=n*Math.cos(a),l=n*Math.sin(a);t.setCenter(h,l);var g=[],u=(g=g.concat(t.getEdges())).length;null!=e&&u--;for(var c,d=0,p=g.length,y=t.getEdgesBetween(e);y.length>1;){var E=y[0];y.splice(0,1);var A=g.indexOf(E);A>=0&&g.splice(A,1),p--,u--}c=null!=e?(g.indexOf(y[0])+1)%p:0;for(var N=Math.abs(r-i)/u,T=c;d!=u;T=++T%p){var L=g[T].getOtherEnd(t);if(L!=e){var m=(i+d*N)%360,_=(m+N)%360;v.branchRadialLayout(L,t,m,_,n+o,o),d++}}},v.maxDiagonalInTree=function(t){for(var e=p.MIN_VALUE,i=0;i<t.length;i++){var r=t[i].getDiagonal();r>e&&(e=r)}return e},v.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},v.prototype.groupZeroDegreeMembers=function(){var t=this,e={};this.memberGroups={},this.idToDummyNode={};for(var i=[],r=this.graphManager.getAllNodes(),n=0;n<r.length;n++){var o=(a=r[n]).getParent();0!==this.getNodeDegreeWithChildren(a)||null!=o.id&&this.getToBeTiled(o)||i.push(a)}for(n=0;n<i.length;n++){var a,h=(a=i[n]).getParent().id;void 0===e[h]&&(e[h]=[]),e[h]=e[h].concat(a)}Object.keys(e).forEach(function(i){if(e[i].length>1){var r="DummyCompound_"+i;t.memberGroups[r]=e[i];var n=e[i][0].getParent(),o=new s(t.graphManager);o.id=r,o.paddingLeft=n.paddingLeft||0,o.paddingRight=n.paddingRight||0,o.paddingBottom=n.paddingBottom||0,o.paddingTop=n.paddingTop||0,t.idToDummyNode[r]=o;var a=t.getGraphManager().add(t.newGraph(),o),h=n.getChild();h.add(o);for(var l=0;l<e[i].length;l++){var g=e[i][l];h.remove(g),a.add(g)}}})},v.prototype.clearCompounds=function(){var t={},e={};this.performDFSOnCompounds();for(var i=0;i<this.compoundOrder.length;i++)e[this.compoundOrder[i].id]=this.compoundOrder[i],t[this.compoundOrder[i].id]=[].concat(this.compoundOrder[i].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[i].getChild()),this.compoundOrder[i].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(t,e)},v.prototype.clearZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(i){var r=t.idToDummyNode[i];e[i]=t.tileNodes(t.memberGroups[i],r.paddingLeft+r.paddingRight),r.rect.width=e[i].width,r.rect.height=e[i].height})},v.prototype.repopulateCompounds=function(){for(var t=this.compoundOrder.length-1;t>=0;t--){var e=this.compoundOrder[t],i=e.id,r=e.paddingLeft,n=e.paddingTop;this.adjustLocations(this.tiledMemberPack[i],e.rect.x,e.rect.y,r,n)}},v.prototype.repopulateZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack;Object.keys(e).forEach(function(i){var r=t.idToDummyNode[i],n=r.paddingLeft,o=r.paddingTop;t.adjustLocations(e[i],r.rect.x,r.rect.y,n,o)})},v.prototype.getToBeTiled=function(t){var e=t.id;if(null!=this.toBeTiled[e])return this.toBeTiled[e];var i=t.getChild();if(null==i)return this.toBeTiled[e]=!1,!1;for(var r=i.getNodes(),n=0;n<r.length;n++){var o=r[n];if(this.getNodeDegree(o)>0)return this.toBeTiled[e]=!1,!1;if(null!=o.getChild()){if(!this.getToBeTiled(o))return this.toBeTiled[e]=!1,!1}else this.toBeTiled[o.id]=!1}return this.toBeTiled[e]=!0,!0},v.prototype.getNodeDegree=function(t){t.id;for(var e=t.getEdges(),i=0,r=0;r<e.length;r++){var n=e[r];n.getSource().id!==n.getTarget().id&&(i+=1)}return i},v.prototype.getNodeDegreeWithChildren=function(t){var e=this.getNodeDegree(t);if(null==t.getChild())return e;for(var i=t.getChild().getNodes(),r=0;r<i.length;r++){var n=i[r];e+=this.getNodeDegreeWithChildren(n)}return e},v.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},v.prototype.fillCompexOrderByDFS=function(t){for(var e=0;e<t.length;e++){var i=t[e];null!=i.getChild()&&this.fillCompexOrderByDFS(i.getChild().getNodes()),this.getToBeTiled(i)&&this.compoundOrder.push(i)}},v.prototype.adjustLocations=function(t,e,i,r,n){i+=n;for(var o=e+=r,s=0;s<t.rows.length;s++){var a=t.rows[s];e=o;for(var h=0,l=0;l<a.length;l++){var g=a[l];g.rect.x=e,g.rect.y=i,e+=g.rect.width+t.horizontalPadding,g.rect.height>h&&(h=g.rect.height)}i+=h+t.verticalPadding}},v.prototype.tileCompoundMembers=function(t,e){var i=this;this.tiledMemberPack=[],Object.keys(t).forEach(function(r){var n=e[r];i.tiledMemberPack[r]=i.tileNodes(t[r],n.paddingLeft+n.paddingRight),n.rect.width=i.tiledMemberPack[r].width,n.rect.height=i.tiledMemberPack[r].height})},v.prototype.tileNodes=function(t,e){var i={rows:[],rowWidth:[],rowHeight:[],width:0,height:e,verticalPadding:h.TILING_PADDING_VERTICAL,horizontalPadding:h.TILING_PADDING_HORIZONTAL};t.sort(function(t,e){return t.rect.width*t.rect.height>e.rect.width*e.rect.height?-1:t.rect.width*t.rect.height<e.rect.width*e.rect.height?1:0});for(var r=0;r<t.length;r++){var n=t[r];0==i.rows.length?this.insertNodeToRow(i,n,0,e):this.canAddHorizontal(i,n.rect.width,n.rect.height)?this.insertNodeToRow(i,n,this.getShortestRowIndex(i),e):this.insertNodeToRow(i,n,i.rows.length,e),this.shiftToLastRow(i)}return i},v.prototype.insertNodeToRow=function(t,e,i,r){var n=r;i==t.rows.length&&(t.rows.push([]),t.rowWidth.push(n),t.rowHeight.push(0));var o=t.rowWidth[i]+e.rect.width;t.rows[i].length>0&&(o+=t.horizontalPadding),t.rowWidth[i]=o,t.width<o&&(t.width=o);var s=e.rect.height;i>0&&(s+=t.verticalPadding);var a=0;s>t.rowHeight[i]&&(a=t.rowHeight[i],t.rowHeight[i]=s,a=t.rowHeight[i]-a),t.height+=a,t.rows[i].push(e)},v.prototype.getShortestRowIndex=function(t){for(var e=-1,i=Number.MAX_VALUE,r=0;r<t.rows.length;r++)t.rowWidth[r]<i&&(e=r,i=t.rowWidth[r]);return e},v.prototype.getLongestRowIndex=function(t){for(var e=-1,i=Number.MIN_VALUE,r=0;r<t.rows.length;r++)t.rowWidth[r]>i&&(e=r,i=t.rowWidth[r]);return e},v.prototype.canAddHorizontal=function(t,e,i){var r=this.getShortestRowIndex(t);if(r<0)return!0;var n=t.rowWidth[r];if(n+t.horizontalPadding+e<=t.width)return!0;var o,s,a=0;return t.rowHeight[r]<i&&r>0&&(a=i+t.verticalPadding-t.rowHeight[r]),o=t.width-n>=e+t.horizontalPadding?(t.height+a)/(n+e+t.horizontalPadding):(t.height+a)/t.width,a=i+t.verticalPadding,(s=t.width<e?(t.height+a)/e:(t.height+a)/t.width)<1&&(s=1/s),o<1&&(o=1/o),o<s},v.prototype.shiftToLastRow=function(t){var e=this.getLongestRowIndex(t),i=t.rowWidth.length-1,r=t.rows[e],n=r[r.length-1],o=n.width+t.horizontalPadding;if(t.width-t.rowWidth[i]>o&&e!=i){r.splice(-1,1),t.rows[i].push(n),t.rowWidth[e]=t.rowWidth[e]-o,t.rowWidth[i]=t.rowWidth[i]+o,t.width=t.rowWidth[instance.getLongestRowIndex(t)];for(var s=Number.MIN_VALUE,a=0;a<r.length;a++)r[a].height>s&&(s=r[a].height);e>0&&(s+=t.verticalPadding);var h=t.rowHeight[e]+t.rowHeight[i];t.rowHeight[e]=s,t.rowHeight[i]<n.height+t.verticalPadding&&(t.rowHeight[i]=n.height+t.verticalPadding);var l=t.rowHeight[e]+t.rowHeight[i];t.height+=l-h,this.shiftToLastRow(t)}},v.prototype.tilingPreLayout=function(){h.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},v.prototype.tilingPostLayout=function(){h.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},v.prototype.reduceTrees=function(){for(var t,e=[],i=!0;i;){var r=this.graphManager.getAllNodes(),n=[];i=!1;for(var o=0;o<r.length;o++)1!=(t=r[o]).getEdges().length||t.getEdges()[0].isInterGraph||null!=t.getChild()||(n.push([t,t.getEdges()[0],t.getOwner()]),i=!0);if(1==i){for(var s=[],a=0;a<n.length;a++)1==n[a][0].getEdges().length&&(s.push(n[a]),n[a][0].getOwner().remove(n[a][0]));e.push(s),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=e},v.prototype.growTree=function(t){for(var e,i=t[t.length-1],r=0;r<i.length;r++)e=i[r],this.findPlaceforPrunedNode(e),e[2].add(e[0]),e[2].add(e[1],e[1].source,e[1].target);t.splice(t.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},v.prototype.findPlaceforPrunedNode=function(t){var e,i,r=t[0],n=(i=r==t[1].source?t[1].target:t[1].source).startX,o=i.finishX,s=i.startY,a=i.finishY,h=[0,0,0,0];if(s>0)for(var g=n;g<=o;g++)h[0]+=this.grid[g][s-1].length+this.grid[g][s].length-1;if(o<this.grid.length-1)for(g=s;g<=a;g++)h[1]+=this.grid[o+1][g].length+this.grid[o][g].length-1;if(a<this.grid[0].length-1)for(g=n;g<=o;g++)h[2]+=this.grid[g][a+1].length+this.grid[g][a].length-1;if(n>0)for(g=s;g<=a;g++)h[3]+=this.grid[n-1][g].length+this.grid[n][g].length-1;for(var u,c,d=p.MAX_VALUE,f=0;f<h.length;f++)h[f]<d?(d=h[f],u=1,c=f):h[f]==d&&u++;if(3==u&&0==d)0==h[0]&&0==h[1]&&0==h[2]?e=1:0==h[0]&&0==h[1]&&0==h[3]?e=0:0==h[0]&&0==h[2]&&0==h[3]?e=3:0==h[1]&&0==h[2]&&0==h[3]&&(e=2);else if(2==u&&0==d){var y=Math.floor(2*Math.random());e=0==h[0]&&0==h[1]?0==y?0:1:0==h[0]&&0==h[2]?0==y?0:2:0==h[0]&&0==h[3]?0==y?0:3:0==h[1]&&0==h[2]?0==y?1:2:0==h[1]&&0==h[3]?0==y?1:3:0==y?2:3}else e=4==u&&0==d?y=Math.floor(4*Math.random()):c;0==e?r.setCenter(i.getCenterX(),i.getCenterY()-i.getHeight()/2-l.DEFAULT_EDGE_LENGTH-r.getHeight()/2):1==e?r.setCenter(i.getCenterX()+i.getWidth()/2+l.DEFAULT_EDGE_LENGTH+r.getWidth()/2,i.getCenterY()):2==e?r.setCenter(i.getCenterX(),i.getCenterY()+i.getHeight()/2+l.DEFAULT_EDGE_LENGTH+r.getHeight()/2):r.setCenter(i.getCenterX()-i.getWidth()/2-l.DEFAULT_EDGE_LENGTH-r.getWidth()/2,i.getCenterY())},t.exports=v},function(t,e,i){var r={};r.layoutBase=i(0),r.CoSEConstants=i(1),r.CoSEEdge=i(2),r.CoSEGraph=i(3),r.CoSEGraphManager=i(4),r.CoSELayout=i(6),r.CoSENode=i(5),t.exports=r}])},a.exports=d(l())),function(t){var e={};function i(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.i=function(t){return t},i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=1)}([function(t,e){t.exports=c},function(t,e,i){var r=i(0).layoutBase.LayoutConstants,n=i(0).layoutBase.FDLayoutConstants,o=i(0).CoSEConstants,s=i(0).CoSELayout,a=i(0).CoSENode,h=i(0).layoutBase.PointD,l=i(0).layoutBase.DimensionD,g={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function u(t){this.options=function(t,e){var i={};for(var r in t)i[r]=t[r];for(var r in e)i[r]=e[r];return i}(g,t),c(this.options)}var c=function(t){null!=t.nodeRepulsion&&(o.DEFAULT_REPULSION_STRENGTH=n.DEFAULT_REPULSION_STRENGTH=t.nodeRepulsion),null!=t.idealEdgeLength&&(o.DEFAULT_EDGE_LENGTH=n.DEFAULT_EDGE_LENGTH=t.idealEdgeLength),null!=t.edgeElasticity&&(o.DEFAULT_SPRING_STRENGTH=n.DEFAULT_SPRING_STRENGTH=t.edgeElasticity),null!=t.nestingFactor&&(o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=n.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=t.nestingFactor),null!=t.gravity&&(o.DEFAULT_GRAVITY_STRENGTH=n.DEFAULT_GRAVITY_STRENGTH=t.gravity),null!=t.numIter&&(o.MAX_ITERATIONS=n.MAX_ITERATIONS=t.numIter),null!=t.gravityRange&&(o.DEFAULT_GRAVITY_RANGE_FACTOR=n.DEFAULT_GRAVITY_RANGE_FACTOR=t.gravityRange),null!=t.gravityCompound&&(o.DEFAULT_COMPOUND_GRAVITY_STRENGTH=n.DEFAULT_COMPOUND_GRAVITY_STRENGTH=t.gravityCompound),null!=t.gravityRangeCompound&&(o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=n.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=t.gravityRangeCompound),null!=t.initialEnergyOnIncremental&&(o.DEFAULT_COOLING_FACTOR_INCREMENTAL=n.DEFAULT_COOLING_FACTOR_INCREMENTAL=t.initialEnergyOnIncremental),"draft"==t.quality?r.QUALITY=0:"proof"==t.quality?r.QUALITY=2:r.QUALITY=1,o.NODE_DIMENSIONS_INCLUDE_LABELS=n.NODE_DIMENSIONS_INCLUDE_LABELS=r.NODE_DIMENSIONS_INCLUDE_LABELS=t.nodeDimensionsIncludeLabels,o.DEFAULT_INCREMENTAL=n.DEFAULT_INCREMENTAL=r.DEFAULT_INCREMENTAL=!t.randomize,o.ANIMATE=n.ANIMATE=r.ANIMATE=t.animate,o.TILE=t.tile,o.TILING_PADDING_VERTICAL="function"==typeof t.tilingPaddingVertical?t.tilingPaddingVertical.call():t.tilingPaddingVertical,o.TILING_PADDING_HORIZONTAL="function"==typeof t.tilingPaddingHorizontal?t.tilingPaddingHorizontal.call():t.tilingPaddingHorizontal};u.prototype.run=function(){var t,e,i=this.options;this.idToLNode={};var r=this.layout=new s,n=this;n.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var o=r.newGraphManager();this.gm=o;var a=this.options.eles.nodes(),h=this.options.eles.edges();this.root=o.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(a),r);for(var l=0;l<h.length;l++){var g=h[l],u=this.idToLNode[g.data("source")],c=this.idToLNode[g.data("target")];u!==c&&0==u.getEdgesBetween(c).length&&(o.add(r.newEdge(),u,c).id=g.id())}var d=function(t,e){"number"==typeof t&&(t=e);var i=t.data("id"),r=n.idToLNode[i];return{x:r.getRect().getCenterX(),y:r.getRect().getCenterY()}},p=function o(){for(var s,a=function(){i.fit&&i.cy.fit(i.eles,i.padding),t||(t=!0,n.cy.one("layoutready",i.ready),n.cy.trigger({type:"layoutready",layout:n}))},h=n.options.refresh,l=0;l<h&&!s;l++)s=n.stopped||n.layout.tick();if(s)return r.checkLayoutSuccess()&&!r.isSubLayout&&r.doPostLayout(),r.tilingPostLayout&&r.tilingPostLayout(),r.isLayoutFinished=!0,n.options.eles.nodes().positions(d),a(),n.cy.one("layoutstop",n.options.stop),n.cy.trigger({type:"layoutstop",layout:n}),e&&cancelAnimationFrame(e),void(t=!1);var g=n.layout.getPositionsData();i.eles.nodes().positions(function(t,e){if("number"==typeof t&&(t=e),!t.isParent()){for(var i=t.id(),r=g[i],n=t;null==r&&(r=g[n.data("parent")]||g["DummyCompound_"+n.data("parent")],g[i]=r,null!=(n=n.parent()[0])););return null!=r?{x:r.x,y:r.y}:{x:t.position("x"),y:t.position("y")}}}),a(),e=requestAnimationFrame(o)};return r.addListener("layoutstarted",function(){"during"===n.options.animate&&(e=requestAnimationFrame(p))}),r.runLayout(),"during"!==this.options.animate&&(n.options.eles.nodes().not(":parent").layoutPositions(n,n.options,d),t=!1),this},u.prototype.getTopMostNodes=function(t){for(var e={},i=0;i<t.length;i++)e[t[i].id()]=!0;var r=t.filter(function(t,i){"number"==typeof t&&(t=i);for(var r=t.parent()[0];null!=r;){if(e[r.id()])return!1;r=r.parent()[0]}return!0});return r},u.prototype.processChildrenList=function(t,e,i){for(var r=e.length,n=0;n<r;n++){var o,s,g=e[n],u=g.children(),c=g.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if((o=null!=g.outerWidth()&&null!=g.outerHeight()?t.add(new a(i.graphManager,new h(g.position("x")-c.w/2,g.position("y")-c.h/2),new l(parseFloat(c.w),parseFloat(c.h)))):t.add(new a(this.graphManager))).id=g.data("id"),o.paddingLeft=parseInt(g.css("padding")),o.paddingTop=parseInt(g.css("padding")),o.paddingRight=parseInt(g.css("padding")),o.paddingBottom=parseInt(g.css("padding")),this.options.nodeDimensionsIncludeLabels&&g.isParent()){var d=g.boundingBox({includeLabels:!0,includeNodes:!1}).w,p=g.boundingBox({includeLabels:!0,includeNodes:!1}).h,f=g.css("text-halign");o.labelWidth=d,o.labelHeight=p,o.labelPos=f}this.idToLNode[g.data("id")]=o,isNaN(o.rect.x)&&(o.rect.x=0),isNaN(o.rect.y)&&(o.rect.y=0),null!=u&&u.length>0&&(s=i.getGraphManager().add(i.newGraph(),o),this.processChildrenList(s,u,i))}},u.prototype.stop=function(){return this.stopped=!0,this};var d=function(t){t("layout","cose-bilkent",u)};"undefined"!=typeof cytoscape&&d(cytoscape),t.exports=d}]))),s.exports),f=n(p);function y(t,e){t.forEach(t=>{const i={id:t.id,labelText:t.label,height:t.height,width:t.width,padding:t.padding??0};Object.keys(t).forEach(e=>{["id","label","height","width","padding","x","y"].includes(e)||(i[e]=t[e])}),e.add({group:"nodes",data:i,position:{x:t.x??0,y:t.y??0}})})}function E(t,e){t.forEach(t=>{const i={id:t.id,source:t.start,target:t.end};Object.keys(t).forEach(e=>{["id","start","end"].includes(e)||(i[e]=t[e])}),e.add({group:"edges",data:i})})}function v(t){return new Promise(n=>{const o=i("body").append("div").attr("id","cy").attr("style","display:none"),s=r({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});o.remove(),y(t.nodes,s),E(t.edges,s),s.nodes().forEach(function(t){t.layoutDimensions=()=>{const e=t.data();return{w:e.width,h:e.height}}});s.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),s.ready(t=>{e.info("Cytoscape ready",t),n(s)})})}function A(t){return t.nodes().map(t=>{const e=t.data(),i=t.position(),r={id:e.id,x:i.x,y:i.y};return Object.keys(e).forEach(t=>{"id"!==t&&(r[t]=e[t])}),r})}function N(t){return t.edges().map(t=>{const e=t.data(),i=t._private.rscratch,r={id:e.id,source:e.source,target:e.target,startX:i.startX,startY:i.startY,midX:i.midX,midY:i.midY,endX:i.endX,endY:i.endY};return Object.keys(e).forEach(t=>{["id","source","target"].includes(t)||(r[t]=e[t])}),r})}async function T(t,i){e.debug("Starting cose-bilkent layout algorithm");try{L(t);const i=await v(t),r=A(i),n=N(i);return e.debug(`Layout completed: ${r.length} nodes, ${n.length} edges`),{nodes:r,edges:n}}catch(t){throw e.error("Error in cose-bilkent layout algorithm:",t),t}}function L(t){if(!t)throw new Error("Layout data is required");if(!t.config)throw new Error("Configuration is required in layout data");if(!t.rootNode)throw new Error("Root node is required");if(!t.nodes||!Array.isArray(t.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(t.edges))throw new Error("Edges array is required in layout data");return!0}r.use(f),t(y,"addNodes"),t(E,"addEdges"),t(v,"createCytoscapeInstance"),t(A,"extractPositionedNodes"),t(N,"extractPositionedEdges"),t(T,"executeCoseBilkentLayout"),t(L,"validateLayoutData");var m=t(async(t,e,{insertCluster:i,insertEdge:r,insertEdgeLabel:n,insertMarkers:o,insertNode:s,log:a,positionEdgeLabel:h},{algorithm:l})=>{const g={},u={},c=e.select("g");o(c,t.markers,t.type,t.diagramId);const d=c.insert("g").attr("class","subgraphs"),p=c.insert("g").attr("class","edgePaths"),f=c.insert("g").attr("class","edgeLabels"),y=c.insert("g").attr("class","nodes");a.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(t.nodes.map(async e=>{if(e.isGroup){const t={...e};u[e.id]=t,g[e.id]=t,await i(d,e)}else{const i={...e};g[e.id]=i;const r=await s(y,e,{config:t.config,dir:t.direction||"TB"}),n=r.node().getBBox();i.width=n.width,i.height=n.height,i.domId=r,a.debug(`Node ${e.id} dimensions: ${n.width}x${n.height}`)}})),a.debug("Running cose-bilkent layout algorithm");const E={...t,nodes:t.nodes.map(t=>{const e=g[t.id];return{...t,width:e.width,height:e.height}})},v=await T(E,t.config);a.debug("Positioning nodes based on layout results"),v.nodes.forEach(t=>{const e=g[t.id];e?.domId&&(e.domId.attr("transform",`translate(${t.x}, ${t.y})`),e.x=t.x,e.y=t.y,a.debug(`Positioned node ${e.id} at center (${t.x}, ${t.y})`))}),v.edges.forEach(e=>{const i=t.edges.find(t=>t.id===e.id);i&&(i.points=[{x:e.startX,y:e.startY},{x:e.midX,y:e.midY},{x:e.endX,y:e.endY}])}),a.debug("Inserting and positioning edges"),await Promise.all(t.edges.map(async e=>{await n(f,e);const i=g[e.start??""],o=g[e.end??""];if(i&&o){const n=v.edges.find(t=>t.id===e.id);if(n){a.debug("APA01 positionedEdge",n);const s={...e},l=r(p,s,u,t.type,i,o,t.diagramId);h(s,l)}else{const n={...e,points:[{x:i.x||0,y:i.y||0},{x:o.x||0,y:o.y||0}]},s=r(p,n,u,t.type,i,o,t.diagramId);h(n,s)}}})),a.debug("Cose-bilkent rendering completed")},"render");export{m as render};
@@ -0,0 +1 @@
1
+ import{p as t}from"./chunk-JWPE2WC7-CVtFylX6.js";import{s as e,g as n,x as a,v as r,a as o,b as i,_ as s,l as c,T as l,d,C as f,Q as p,O as m,R as y,a7 as x}from"./mermaid.core-CvFWfSA0.js";import{p as h}from"./cynefin-EF2NZ3EQ-CaJSaYBh.js";import"./index-BwpxQGdp.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-C-9EFvh4.js";import"./settings-DzQM72QE.js";import"./index-Zvckkvpn.js";import"./LoaderLayer-CWElgcGs.js";import"./websocket-KESFarc3.js";import"./index-DpobNvg5.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 g=s(()=>({domains:new Map,transitions:[]}),"createDefaultData"),$=g(),u={getDomains:s(()=>$.domains,"getDomains"),getTransitions:s(()=>$.transitions,"getTransitions"),setDomains:s(t=>{if(t)for(const e of t){const t=e.domain,n=(e.items??[]).map(t=>({label:t.label}));$.domains.set(t,{name:t,items:n})}},"setDomains"),setTransitions:s(t=>{t&&($.transitions=t.filter(t=>t.from!==t.to||(c.warn(`Cynefin: self-loop transition on domain "${t.from}" is not meaningful and will be skipped.`),!1)).map(t=>({from:t.from,to:t.to,label:t.label||void 0})))},"setTransitions"),getConfig:s(()=>p({...y.cynefin,...m().cynefin}),"getConfig"),clear:s(()=>{f(),$=g()},"clear"),setAccTitle:i,getAccTitle:o,setDiagramTitle:r,getDiagramTitle:a,getAccDescription:n,setAccDescription:e},b=s(e=>{t(e,u),u.setDomains(e.domains),u.setTransitions(e.transitions)},"populate"),w={parse:s(async t=>{const e=await h("cynefin",t);c.debug(e),b(e)},"parse")};function C(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}function k(t){let e=0;for(let n=0;n<t.length;n++){e=(e<<5)-e+t.charCodeAt(n),e|=0}return e}function D(t,e){return"number"==typeof t&&Number.isFinite(t)&&0!==t?t:k(e)}function B(t,e,n,a){const r=t/2,o=a??.015*t,i=e/7,s=[];for(let t=0;t<=7;t++){const e=C(n+17*t)*o*2-o;s.push({x:r+e,y:t*i})}let c=`M${s[0].x},${s[0].y}`;for(let t=0;t<s.length-1;t++){const e=s[t],a=s[t+1],r=(e.y+a.y)/2,i=1.5*o*(t%2==0?1:-1)*C(n+31*t+7);c+=` C${e.x+i},${r} ${a.x-i},${r} ${a.x},${a.y}`}return c}function A(t,e,n,a){const r=e/2,o=a??.015*e,i=t/7,s=[];for(let t=0;t<=7;t++){const e=C(n+23*t)*o*2-o;s.push({x:t*i,y:r+e})}let c=`M${s[0].x},${s[0].y}`;for(let t=0;t<s.length-1;t++){const e=s[t],a=s[t+1],r=(e.x+a.x)/2,i=1.5*o*(t%2==0?1:-1)*C(n+37*t+11);c+=` C${r},${e.y+i} ${r},${a.y-i} ${a.x},${a.y}`}return c}function T(t,e){const n=t/2,a=.5*e,r=.03*t;return[`M${n},${a}`,`C${n+r},${a+.2*(e-a)}`,`${n-1.5*r},${a+.55*(e-a)}`,`${n+.5*r},${a+.75*(e-a)}`,`C${n-r},${a+.85*(e-a)}`,`${n+.3*r},${a+.95*(e-a)}`,`${n},${e}`].join(" ")}function j(t,e,n,a){return[`M${t-n},${e}`,`A${n},${a} 0 1,1 ${t+n},${e}`,`A${n},${a} 0 1,1 ${t-n},${e}`,"Z"].join(" ")}s(C,"seededRandom"),s(k,"hashString"),s(D,"resolveSeed"),s(B,"generateFoldPath"),s(A,"generateHorizontalBoundary"),s(T,"generateCliffPath"),s(j,"generateConfusionPath");var S={complex:{model:"Probe → Sense → Respond",practice:"Emergent Practices"},complicated:{model:"Sense → Analyse → Respond",practice:"Good Practices"},clear:{model:"Sense → Categorise → Respond",practice:"Best Practices"},chaotic:{model:"Act → Sense → Respond",practice:"Novel Practices"},confusion:{model:"",practice:"Disorder"}},v=s((t,e)=>{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:.7*n,y:.7*a,w:.6*n,h:.6*a}}},"getDomainLayouts"),z=s(()=>{const t=x(),e=m();return p(t,e.themeVariables).cynefin},"getCynefinDomainColors"),L={draw:s((t,e,n,a)=>{const r=a.db,o=r.getDomains(),i=r.getTransitions(),s=r.getDiagramTitle(),f=r.getAccTitle(),p=r.getAccDescription(),m=r.getConfig(),y=z();c.debug("Rendering Cynefin diagram");const x=m.width,h=m.height,g=m.padding,$=m.showDomainDescriptions,u=m.boundaryAmplitude,b=x+2*g,w=h+2*g,C={complex:y.complexBg,complicated:y.complicatedBg,clear:y.clearBg,chaotic:y.chaoticBg,confusion:y.confusionBg},k=l(e);d(k,w,b,m.useMaxWidth??!0),k.attr("viewBox",`0 0 ${b} ${w}`),f&&k.append("title").text(f),p&&k.append("desc").text(p);const L=k.append("g").attr("transform",`translate(${g}, ${g})`),M=v(x,h),P=D(m.seed,e),F=L.append("g").attr("class","cynefin-backgrounds"),I=["complex","complicated","chaotic","clear"];for(const t of I){const e=M[t];F.append("rect").attr("class","cynefinDomain").attr("x",e.x).attr("y",e.y).attr("width",e.w).attr("height",e.h).attr("fill",C[t]).attr("fill-opacity",.4).attr("stroke","none")}const R=L.append("g").attr("class","cynefin-boundaries");R.append("path").attr("class","cynefinBoundary").attr("d",B(x,h,P,u)).attr("fill","none"),R.append("path").attr("class","cynefinBoundary").attr("d",A(x,h,P+100,u)).attr("fill","none"),R.append("path").attr("class","cynefinCliff").attr("d",T(x,h)).attr("fill","none");const W=.15*x,E=.15*h;L.append("path").attr("class","cynefinConfusion").attr("d",j(x/2,h/2,W,E)).attr("fill",C.confusion).attr("fill-opacity",.5);const H=L.append("g").attr("class","cynefin-labels");for(const t of I){const e=M[t];H.append("text").attr("class","cynefinDomainLabel").attr("x",e.cx).attr("y",$?e.cy-30:e.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(t.charAt(0).toUpperCase()+t.slice(1))}if(H.append("text").attr("class","cynefinDomainLabel").attr("x",x/2).attr("y",$?h/2-10:h/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),$){const t=L.append("g").attr("class","cynefin-subtitles");for(const e of I){const n=M[e],a=S[e];t.append("text").attr("class","cynefinSubtitle").attr("x",n.cx).attr("y",n.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(a.model),t.append("text").attr("class","cynefinSubtitle").attr("x",n.cx).attr("y",n.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(a.practice)}t.append("text").attr("class","cynefinSubtitle").attr("x",x/2).attr("y",h/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(S.confusion.practice)}const N=L.append("g").attr("class","cynefin-items"),O=26,Q=["complex","complicated","chaotic","clear","confusion"];for(const t of Q){const e=o.get(t);if(!e||0===e.items.length)continue;const n=M[t],a="confusion"===t;let r,i=e.items,s=0;if(a&&e.items.length>3&&(s=e.items.length-3,i=e.items.slice(0,3)),a){const t=$?22:14;r=n.cy+t}else r=n.cy+($?25:15);if([...i].forEach((e,a)=>{const o=r+30*a,i=N.append("g"),s=i.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",13).attr("text-anchor","middle").attr("dominant-baseline","central").text(e.label);let c=7*e.label.length;const l=s.node();if(l&&"function"==typeof l.getBBox){const t=l.getBBox();t.width>0&&(c=t.width)}const d=c+20,f=n.cx-d/2;i.attr("transform",`translate(${f}, ${o})`),i.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",d).attr("height",O).attr("rx",4).attr("ry",4).attr("fill",C[t]).attr("fill-opacity",.95),s.attr("x",d/2).attr("y",13)}),s>0){const e=r+30*i.length,a=`+${s} more`,o=N.append("g"),c=o.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",13).attr("text-anchor","middle").attr("dominant-baseline","central").text(a);let l=7*a.length;const d=c.node();if(d&&"function"==typeof d.getBBox){const t=d.getBBox();t.width>0&&(l=t.width)}const f=l+20,p=n.cx-f/2;o.attr("transform",`translate(${p}, ${e})`),o.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",f).attr("height",O).attr("rx",4).attr("ry",4).attr("fill",C[t]).attr("fill-opacity",.6),c.attr("x",f/2).attr("y",13)}}if(i.length>0){const t=k.select("defs").empty()?k.append("defs"):k.select("defs"),n=`cynefin-arrow-${e}`;t.append("marker").attr("id",n).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const a=L.append("g").attr("class","cynefin-arrows");i.forEach(t=>{const e=M[t.from],r=M[t.to];if(!e||!r)return;if(t.from===t.to)return void c.warn(`Cynefin renderer: skipping self-loop on domain "${t.from}"`);const o=e.cx,i=e.cy,s=r.cx,l=r.cy,d=(o+s)/2,f=(i+l)/2,p=s-o,m=l-i,y=Math.sqrt(p*p+m*m),x=.15*y,h=d+-m/y*x,g=f+p/y*x;a.append("path").attr("class","cynefinArrowLine").attr("d",`M${o},${i} Q${h},${g} ${s},${l}`).attr("fill","none").attr("marker-end",`url(#${n})`),t.label&&a.append("text").attr("class","cynefinArrowLabel").attr("x",h).attr("y",g-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(t.label)})}s&&L.append("text").attr("class","cynefinTitle").attr("x",x/2).attr("y",-g/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(s)},"draw")},M=s(()=>{const t=x(),e=m();return p(t,e.themeVariables).cynefin},"getCynefinTheme"),P={parser:w,db:u,renderer:L,styles:s(()=>{const t=M();return`\n\t.cynefinDomain {\n\t\tstroke: none;\n\t}\n\t.cynefinDomainLabel {\n\t\tfont-size: ${t.domainFontSize}px;\n\t\tfont-weight: bold;\n\t\tfill: ${t.labelColor};\n\t}\n\t.cynefinSubtitle {\n\t\tfont-size: ${t.itemFontSize-1}px;\n\t\tfill: ${t.textColor};\n\t\tfont-style: italic;\n\t}\n\t.cynefinItem {\n\t\tfill-opacity: 0.95;\n\t\tstroke: ${t.boundaryColor};\n\t\tstroke-width: 1;\n\t}\n\t.cynefinItemText {\n\t\tfont-size: ${t.itemFontSize}px;\n\t\tfill: ${t.textColor};\n\t}\n\t.cynefinItemOverflow {\n\t\tfill-opacity: 0.6;\n\t\tstroke: ${t.boundaryColor};\n\t\tstroke-width: 1;\n\t\tstroke-dasharray: 3 2;\n\t}\n\t.cynefinBoundary {\n\t\tstroke: ${t.boundaryColor};\n\t\tstroke-width: ${t.boundaryWidth};\n\t\tstroke-dasharray: 6 3;\n\t}\n\t.cynefinCliff {\n\t\tstroke: ${t.cliffColor};\n\t\tstroke-width: ${t.cliffWidth};\n\t}\n\t.cynefinConfusion {\n\t\tstroke: ${t.boundaryColor};\n\t\tstroke-width: 1.5;\n\t\tstroke-dasharray: 4 2;\n\t}\n\t.cynefinArrowLine {\n\t\tstroke: ${t.arrowColor};\n\t\tstroke-width: ${t.arrowWidth};\n\t\tfill: none;\n\t}\n\t.cynefinArrowHead {\n\t\tfill: ${t.arrowColor};\n\t\tstroke: none;\n\t}\n\t.cynefinArrowLabel {\n\t\tfont-size: ${t.itemFontSize-1}px;\n\t\tfill: ${t.textColor};\n\t}\n\t.cynefinTitle {\n\t\tfont-size: ${t.domainFontSize+2}px;\n\t\tfont-weight: bold;\n\t\tfill: ${t.labelColor};\n\t}\n\t`},"styles")};export{P as diagram};
@@ -0,0 +1 @@
1
+ import{s as e,a as n,c as t,b as r,f as o,e as a,i}from"./chunk-ZCHMQSOR-Cwl9AHIQ.js";import{_ as d,c as s,l as u,bh as c,bi as f,aD as g,aC as h,ap as l,an as p,az as v,b5 as b}from"./mermaid.core-CvFWfSA0.js";import{b as y,a as m,G as w,f as x,v as E,r as j}from"./graph-rGqC_56m.js";import{g as L,m as k,n as N,a as O,k as I,o as S,p as P,q as C,r as M,t as R,u as _,c as T,v as X,w as A,j as D,l as B}from"./isUndefined--MLpwE__.js";import{B as G,C as F,S as V,n as Y,D as q,E as U,i as z,d as J,t as H,b as Q,g as W,m as Z,a as $,s as K,v as ee,w as ne,u as te,j as re}from"./isSymbol-D2gNAbOe.js";import{b as oe,m as ae,a as ie}from"./map-CIDWRbhc.js";import{t as de,a as se,d as ue,e as ce,i as fe,f as ge,g as he,k as le,h as pe}from"./toNumber-B6ypue5Z.js";import"./index-BwpxQGdp.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-C-9EFvh4.js";import"./settings-DzQM72QE.js";import"./index-Zvckkvpn.js";import"./LoaderLayer-CWElgcGs.js";import"./websocket-KESFarc3.js";import"./index-DpobNvg5.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 ve=1/0;function be(e){return e?(e=de(e))===ve||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ye(e){return(null==e?0:e.length)?y(e):[]}var me=Object.prototype.hasOwnProperty;var we=/\w*$/;var xe=V?V.prototype:void 0,Ee=xe?xe.valueOf:void 0;function je(e,n,t){var r,o,a,i,d,s=e.constructor;switch(n){case"[object ArrayBuffer]":return se(e);case"[object Boolean]":case"[object Date]":return new s(+e);case"[object DataView]":return d=se((i=e).buffer),new i.constructor(d,i.byteOffset,i.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return ue(e,t);case"[object Map]":case"[object Set]":return new s;case"[object Number]":case"[object String]":return new s(e);case"[object RegExp]":return(a=new(o=e).constructor(o.source,we.exec(o))).lastIndex=o.lastIndex,a;case"[object Symbol]":return r=e,Ee?Object(Ee.call(r)):{}}}var Le=U&&U.isMap,ke=Le?q(Le):function(e){return Y(e)&&"[object Map]"==L(e)};var Ne=U&&U.isSet,Oe=Ne?q(Ne):function(e){return Y(e)&&"[object Set]"==L(e)},Ie="[object Arguments]",Se="[object Function]",Pe="[object Object]",Ce={};function Me(e,n,t,r,o,a){var i,d=1&n;if(void 0!==i)return i;if(!z(e))return e;var s=Q(e);if(s)i=function(e){var n=e.length,t=new e.constructor(n);return n&&"string"==typeof e[0]&&me.call(e,"index")&&(t.index=e.index,t.input=e.input),t}(e);else{var u=L(e),c=u==Se||"[object GeneratorFunction]"==u;if(J(e))return ce(e,d);if(u==Pe||u==Ie||c&&!o)i=c?{}:fe(e);else{if(!Ce[u])return o?e:{};i=je(e,u,d)}}a||(a=new H);var f=a.get(e);if(f)return f;a.set(e,i),Oe(e)?e.forEach(function(r){i.add(Me(r,n,t,r,e,a))}):ke(e)&&e.forEach(function(r,o){i.set(o,Me(r,n,t,o,e,a))});var g=s?void 0:N(e);return k(g||e,function(r,o){g&&(r=e[o=r]),ge(i,o,Me(r,n,t,o,e,a))}),i}Ce[Ie]=Ce["[object Array]"]=Ce["[object ArrayBuffer]"]=Ce["[object DataView]"]=Ce["[object Boolean]"]=Ce["[object Date]"]=Ce["[object Float32Array]"]=Ce["[object Float64Array]"]=Ce["[object Int8Array]"]=Ce["[object Int16Array]"]=Ce["[object Int32Array]"]=Ce["[object Map]"]=Ce["[object Number]"]=Ce[Pe]=Ce["[object RegExp]"]=Ce["[object Set]"]=Ce["[object String]"]=Ce["[object Symbol]"]=Ce["[object Uint8Array]"]=Ce["[object Uint8ClampedArray]"]=Ce["[object Uint16Array]"]=Ce["[object Uint32Array]"]=!0,Ce["[object Error]"]=Ce[Se]=Ce["[object WeakMap]"]=!1;function Re(e){return Me(e,5)}var _e=Object.prototype,Te=_e.hasOwnProperty,Xe=W(function(e,n){e=Object(e);var t=-1,r=n.length,o=r>2?n[2]:void 0;for(o&&he(n[0],n[1],o)&&(r=1);++t<r;)for(var a=n[t],i=le(a),d=-1,s=i.length;++d<s;){var u=i[d],c=e[u];(void 0===c||Z(c,_e[u])&&!Te.call(e,u))&&(e[u]=a[u])}return e});function Ae(e){var n=null==e?0:e.length;return n?e[n-1]:void 0}var De=Math.max;var Be,Ge=(Be=function(e,n,t){var r=null==e?0:e.length;if(!r)return-1;var o,a,i=null==t?0:(o=be(t),a=o%1,o==o?a?o-a:o:0);return i<0&&(i=De(r+i,0)),m(e,O(n),i)},function(e,n,t){var r=Object(e);if(!$(e)){var o=O(n);e=I(e),n=function(e){return o(r[e],e,r)}}var a=Be(e,n,t);return a>-1?r[o?e[a]:a]:void 0});function Fe(e,n){return e>n}var Ve=Object.prototype.hasOwnProperty;function Ye(e,n){return null!=e&&Ve.call(e,n)}function qe(e,n){return null!=e&&C(e,n,Ye)}function Ue(e,n){return e<n}function ze(e,n){var t={};return n=O(n),P(e,function(e,r,o){pe(t,r,n(e,r,o))}),t}function Je(e,n,t){for(var r=-1,o=e.length;++r<o;){var a=e[r],i=n(a);if(null!=i&&(void 0===d?i==i&&!ee(i):t(i,d)))var d=i,s=a}return s}function He(e){return e&&e.length?Je(e,ne,Fe):void 0}function Qe(e){return e&&e.length?Je(e,ne,Ue):void 0}function We(e,n){return e&&e.length?Je(e,O(n),Ue):void 0}function Ze(e,n,t,r){if(!z(e))return e;for(var o=-1,a=(n=M(n,e)).length,i=a-1,d=e;null!=d&&++o<a;){var s=R(n[o]),u=t;if("__proto__"===s||"constructor"===s||"prototype"===s)return e;if(o!=i){var c=d[s];void 0===(u=void 0)&&(u=z(c)?c:te(n[o+1])?[]:{})}ge(d,s,u),d=d[s]}return e}function $e(e,n){if(e!==n){var t=void 0!==e,r=null===e,o=e==e,a=ee(e),i=void 0!==n,d=null===n,s=n==n,u=ee(n);if(!d&&!u&&!a&&e>n||a&&i&&s&&!d&&!u||r&&i&&s||!t&&s||!o)return 1;if(!r&&!a&&!u&&e<n||u&&t&&o&&!r&&!a||d&&t&&o||!i&&o||!s)return-1}return 0}function Ke(e,n,t){n=n.length?T(n,function(e){return Q(e)?function(n){return _(n,1===e.length?e[0]:e)}:e}):[ne];var r=-1;return n=T(n,q(O)),function(e,n){var t=e.length;for(e.sort(n);t--;)e[t]=e[t].value;return e}(oe(e,function(e,t,o){return{criteria:T(n,function(n){return n(e)}),index:++r,value:e}}),function(e,n){return function(e,n,t){for(var r=-1,o=e.criteria,a=n.criteria,i=o.length,d=t.length;++r<i;){var s=$e(o[r],a[r]);if(s)return r>=d?s:s*("desc"==t[r]?-1:1)}return e.index-n.index}(e,n,t)})}function en(e,n){return function(e,n,t){for(var r=-1,o=n.length,a={};++r<o;){var i=n[r],d=_(e,i);t(d,i)&&Ze(a,M(i,e),d)}return a}(e,n,function(n,t){return X(e,t)})}var nn,tn=G(F(nn=function(e,n){return null==e?{}:en(e,n)},void 0,ye),nn+""),rn=Math.ceil,on=Math.max;var an=function(e,n,t){return t&&"number"!=typeof t&&he(e,n,t)&&(n=t=void 0),e=be(e),void 0===n?(n=e,e=0):n=be(n),function(e,n,t){for(var r=-1,o=on(rn((n-e)/(t||1)),0),a=Array(o);o--;)a[++r]=e,e+=t;return a}(e,n,t=void 0===t?e<n?1:-1:be(t))},dn=W(function(e,n){if(null==e)return[];var t=n.length;return t>1&&he(e,n[0],n[1])?n=[]:t>2&&he(n[0],n[1],n[2])&&(n=[n[0]]),Ke(e,y(n),[])}),sn=0;function un(e){var n=++sn;return A(e)+n}class cn{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,n=e._prev;if(n!==e)return fn(n),n}enqueue(e){var n=this._sentinel;e._prev&&e._next&&fn(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n}toString(){for(var e=[],n=this._sentinel,t=n._prev;t!==n;)e.push(JSON.stringify(t,gn)),t=t._prev;return"["+e.join(", ")+"]"}}function fn(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function gn(e,n){if("_next"!==e&&"_prev"!==e)return n}var hn=re(1);function ln(e,n){if(e.nodeCount()<=1)return[];var t=function(e,n){var t=new w,r=0,o=0;D(e.nodes(),function(e){t.setNode(e,{v:e,in:0,out:0})}),D(e.edges(),function(e){var a=t.edge(e.v,e.w)||0,i=n(e),d=a+i;t.setEdge(e.v,e.w,d),o=Math.max(o,t.node(e.v).out+=i),r=Math.max(r,t.node(e.w).in+=i)});var a=an(o+r+3).map(function(){return new cn}),i=r+1;return D(t.nodes(),function(e){vn(a,i,t.node(e))}),{graph:t,buckets:a,zeroIdx:i}}(e,n||hn),r=function(e,n,t){var r,o=[],a=n[n.length-1],i=n[0];for(;e.nodeCount();){for(;r=i.dequeue();)pn(e,n,t,r);for(;r=a.dequeue();)pn(e,n,t,r);if(e.nodeCount())for(var d=n.length-2;d>0;--d)if(r=n[d].dequeue()){o=o.concat(pn(e,n,t,r,!0));break}}return o}(t.graph,t.buckets,t.zeroIdx);return ye(ae(r,function(n){return e.outEdges(n.v,n.w)}))}function pn(e,n,t,r,o){var a=o?[]:void 0;return D(e.inEdges(r.v),function(r){var i=e.edge(r),d=e.node(r.v);o&&a.push({v:r.v,w:r.w}),d.out-=i,vn(n,t,d)}),D(e.outEdges(r.v),function(r){var o=e.edge(r),a=r.w,i=e.node(a);i.in-=o,vn(n,t,i)}),e.removeNode(r.v),a}function vn(e,n,t){t.out?t.in?e[t.out-t.in+n].enqueue(t):e[e.length-1].enqueue(t):e[0].enqueue(t)}function bn(e){var n="greedy"===e.graph().acyclicer?ln(e,function(e){return function(n){return e.edge(n).weight}}(e)):function(e){var n=[],t={},r={};function o(a){Object.prototype.hasOwnProperty.call(r,a)||(r[a]=!0,t[a]=!0,D(e.outEdges(a),function(e){Object.prototype.hasOwnProperty.call(t,e.w)?n.push(e):o(e.w)}),delete t[a])}return D(e.nodes(),o),n}(e);D(n,function(n){var t=e.edge(n);e.removeEdge(n),t.forwardName=n.name,t.reversed=!0,e.setEdge(n.w,n.v,t,un("rev"))})}function yn(e,n,t,r){var o;do{o=un(r)}while(e.hasNode(o));return t.dummy=n,e.setNode(o,t),o}function mn(e){var n=new w({multigraph:e.isMultigraph()}).setGraph(e.graph());return D(e.nodes(),function(t){e.children(t).length||n.setNode(t,e.node(t))}),D(e.edges(),function(t){n.setEdge(t,e.edge(t))}),n}function wn(e,n){var t,r,o=e.x,a=e.y,i=n.x-o,d=n.y-a,s=e.width/2,u=e.height/2;if(!i&&!d)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(d)*s>Math.abs(i)*u?(d<0&&(u=-u),t=u*i/d,r=u):(i<0&&(s=-s),t=s,r=s*d/i),{x:o+t,y:a+r}}function xn(e){var n=ae(an(jn(e)+1),function(){return[]});return D(e.nodes(),function(t){var r=e.node(t),o=r.rank;B(o)||(n[o][r.order]=t)}),n}function En(e,n,t,r){var o={width:0,height:0};return arguments.length>=4&&(o.rank=t,o.order=r),yn(e,"border",o,n)}function jn(e){return He(ae(e.nodes(),function(n){var t=e.node(n).rank;if(!B(t))return t}))}function Ln(e,n){return n()}function kn(e,n,t,r,o,a){var i={width:0,height:0,rank:a,borderType:n},d=o[n][a-1],s=yn(e,"border",i,t);o[n][a]=s,e.setParent(s,r),d&&e.setEdge(d,s,{weight:1})}function Nn(e){var n=e.graph().rankdir.toLowerCase();"bt"!==n&&"rl"!==n||function(e){D(e.nodes(),function(n){Sn(e.node(n))}),D(e.edges(),function(n){var t=e.edge(n);D(t.points,Sn),Object.prototype.hasOwnProperty.call(t,"y")&&Sn(t)})}(e),"lr"!==n&&"rl"!==n||(!function(e){D(e.nodes(),function(n){Pn(e.node(n))}),D(e.edges(),function(n){var t=e.edge(n);D(t.points,Pn),Object.prototype.hasOwnProperty.call(t,"x")&&Pn(t)})}(e),On(e))}function On(e){D(e.nodes(),function(n){In(e.node(n))}),D(e.edges(),function(n){In(e.edge(n))})}function In(e){var n=e.width;e.width=e.height,e.height=n}function Sn(e){e.y=-e.y}function Pn(e){var n=e.x;e.x=e.y,e.y=n}function Cn(e){e.graph().dummyChains=[],D(e.edges(),function(n){!function(e,n){var t=n.v,r=e.node(t).rank,o=n.w,a=e.node(o).rank,i=n.name,d=e.edge(n),s=d.labelRank;if(a===r+1)return;e.removeEdge(n);var u,c,f=void 0;for(c=0,++r;r<a;++c,++r)d.points=[],u=yn(e,"edge",f={width:0,height:0,edgeLabel:d,edgeObj:n,rank:r},"_d"),r===s&&(f.width=d.width,f.height=d.height,f.dummy="edge-label",f.labelpos=d.labelpos),e.setEdge(t,u,{weight:d.weight},i),0===c&&e.graph().dummyChains.push(u),t=u;e.setEdge(t,o,{weight:d.weight},i)}(e,n)})}function Mn(e){var n={};D(e.sources(),function t(r){var o=e.node(r);if(Object.prototype.hasOwnProperty.call(n,r))return o.rank;n[r]=!0;var a=Qe(ae(e.outEdges(r),function(n){return t(n.w)-e.edge(n).minlen}));return a!==Number.POSITIVE_INFINITY&&null!=a||(a=0),o.rank=a})}function Rn(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}function _n(e){var n,t,r=new w({directed:!1}),o=e.nodes()[0],a=e.nodeCount();for(r.setNode(o,{});Tn(r,e)<a;)n=Xn(r,e),t=r.hasNode(n.v)?Rn(e,n):-Rn(e,n),An(r,e,t);return r}function Tn(e,n){return D(e.nodes(),function t(r){D(n.nodeEdges(r),function(o){var a=o.v,i=r===a?o.w:a;e.hasNode(i)||Rn(n,o)||(e.setNode(i,{}),e.setEdge(r,i,{}),t(i))})}),e.nodeCount()}function Xn(e,n){return We(n.edges(),function(t){if(e.hasNode(t.v)!==e.hasNode(t.w))return Rn(n,t)})}function An(e,n,t){D(e.nodes(),function(e){n.node(e).rank+=t})}function Dn(e,n,t){Q(n)||(n=[n]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),o=[],a={};return D(n,function(n){if(!e.hasNode(n))throw new Error("Graph does not have node: "+n);Bn(e,n,"post"===t,a,r,o)}),o}function Bn(e,n,t,r,o,a){Object.prototype.hasOwnProperty.call(r,n)||(r[n]=!0,t||a.push(n),D(o(n),function(n){Bn(e,n,t,r,o,a)}),t&&a.push(n))}function Gn(e){e=function(e){var n=(new w).setGraph(e.graph());return D(e.nodes(),function(t){n.setNode(t,e.node(t))}),D(e.edges(),function(t){var r=n.edge(t.v,t.w)||{weight:0,minlen:1},o=e.edge(t);n.setEdge(t.v,t.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})}),n}(e),Mn(e);var n,t=_n(e);for(Yn(t),Fn(t,e);n=Un(t);)Jn(t,e,n,zn(t,e,n))}function Fn(e,n){var t=function(e,n){return Dn(e,n,"post")}(e,e.nodes());t=t.slice(0,t.length-1),D(t,function(t){!function(e,n,t){var r=e.node(t),o=r.parent;e.edge(t,o).cutvalue=Vn(e,n,t)}(e,n,t)})}function Vn(e,n,t){var r=e.node(t).parent,o=!0,a=n.edge(t,r),i=0;return a||(o=!1,a=n.edge(r,t)),i=a.weight,D(n.nodeEdges(t),function(a){var d,s,u=a.v===t,c=u?a.w:a.v;if(c!==r){var f=u===o,g=n.edge(a).weight;if(i+=f?g:-g,d=t,s=c,e.hasEdge(d,s)){var h=e.edge(t,c).cutvalue;i+=f?-h:h}}}),i}function Yn(e,n){arguments.length<2&&(n=e.nodes()[0]),qn(e,{},1,n)}function qn(e,n,t,r,o){var a=t,i=e.node(r);return n[r]=!0,D(e.neighbors(r),function(o){Object.prototype.hasOwnProperty.call(n,o)||(t=qn(e,n,t,o,r))}),i.low=a,i.lim=t++,o?i.parent=o:delete i.parent,t}function Un(e){return Ge(e.edges(),function(n){return e.edge(n).cutvalue<0})}function zn(e,n,t){var r=t.v,o=t.w;n.hasEdge(r,o)||(r=t.w,o=t.v);var a=e.node(r),i=e.node(o),d=a,s=!1;a.lim>i.lim&&(d=i,s=!0);var u=x(n.edges(),function(n){return s===Hn(e,e.node(n.v),d)&&s!==Hn(e,e.node(n.w),d)});return We(u,function(e){return Rn(n,e)})}function Jn(e,n,t,r){var o=t.v,a=t.w;e.removeEdge(o,a),e.setEdge(r.v,r.w,{}),Yn(e),Fn(e,n),function(e,n){var t=Ge(e.nodes(),function(e){return!n.node(e).parent}),r=function(e,n){return Dn(e,n,"pre")}(e,t);r=r.slice(1),D(r,function(t){var r=e.node(t).parent,o=n.edge(t,r),a=!1;o||(o=n.edge(r,t),a=!0),n.node(t).rank=n.node(r).rank+(a?o.minlen:-o.minlen)})}(e,n)}function Hn(e,n,t){return t.low<=n.lim&&n.lim<=t.lim}function Qn(e){switch(e.graph().ranker){case"network-simplex":default:Zn(e);break;case"tight-tree":!function(e){Mn(e),_n(e)}(e);break;case"longest-path":Wn(e)}}new Error,Gn.initLowLimValues=Yn,Gn.initCutValues=Fn,Gn.calcCutValue=Vn,Gn.leaveEdge=Un,Gn.enterEdge=zn,Gn.exchangeEdges=Jn;var Wn=Mn;function Zn(e){Gn(e)}function $n(e){var n=yn(e,"root",{},"_root"),t=function(e){var n={};function t(r,o){var a=e.children(r);a&&a.length&&D(a,function(e){t(e,o+1)}),n[r]=o}return D(e.children(),function(e){t(e,1)}),n}(e),r=He(E(t))-1,o=2*r+1;e.graph().nestingRoot=n,D(e.edges(),function(n){e.edge(n).minlen*=o});var a=function(e){return j(e.edges(),function(n,t){return n+e.edge(t).weight},0)}(e)+1;D(e.children(),function(i){Kn(e,n,o,a,r,t,i)}),e.graph().nodeRankFactor=o}function Kn(e,n,t,r,o,a,i){var d=e.children(i);if(d.length){var s=En(e,"_bt"),u=En(e,"_bb"),c=e.node(i);e.setParent(s,i),c.borderTop=s,e.setParent(u,i),c.borderBottom=u,D(d,function(d){Kn(e,n,t,r,o,a,d);var c=e.node(d),f=c.borderTop?c.borderTop:d,g=c.borderBottom?c.borderBottom:d,h=c.borderTop?r:2*r,l=f!==g?1:o-a[i]+1;e.setEdge(s,f,{weight:h,minlen:l,nestingEdge:!0}),e.setEdge(g,u,{weight:h,minlen:l,nestingEdge:!0})}),e.parent(i)||e.setEdge(n,s,{weight:0,minlen:o+a[i]})}else i!==n&&e.setEdge(n,i,{weight:0,minlen:t})}function et(e,n,t){var r=function(e){var n;for(;e.hasNode(n=un("_root")););return n}(e),o=new w({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(n){return e.node(n)});return D(e.nodes(),function(a){var i=e.node(a),d=e.parent(a);(i.rank===n||i.minRank<=n&&n<=i.maxRank)&&(o.setNode(a),o.setParent(a,d||r),D(e[t](a),function(n){var t=n.v===a?n.w:n.v,r=o.edge(t,a),i=B(r)?0:r.weight;o.setEdge(t,a,{weight:e.edge(n).weight+i})}),Object.prototype.hasOwnProperty.call(i,"minRank")&&o.setNode(a,{borderLeft:i.borderLeft[n],borderRight:i.borderRight[n]}))}),o}function nt(e,n){for(var t=0,r=1;r<n.length;++r)t+=tt(e,n[r-1],n[r]);return t}function tt(e,n,t){for(var r=function(e,n){return function(e,n,t){for(var r=-1,o=e.length,a=n.length,i={};++r<o;){var d=r<a?n[r]:void 0;t(i,e[r],d)}return i}(e||[],n||[],ge)}(t,ae(t,function(e,n){return n})),o=ye(ae(n,function(n){return dn(ae(e.outEdges(n),function(n){return{pos:r[n.w],weight:e.edge(n).weight}}),"pos")})),a=1;a<t.length;)a<<=1;var i=2*a-1;a-=1;var d=ae(new Array(i),function(){return 0}),s=0;return D(o.forEach(function(e){var n=e.pos+a;d[n]+=e.weight;for(var t=0;n>0;)n%2&&(t+=d[n+1]),d[n=n-1>>1]+=e.weight;s+=e.weight*t})),s}function rt(e,n){var t={};return D(e,function(e,n){var r=t[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};B(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),D(n.edges(),function(e){var n=t[e.v],r=t[e.w];B(n)||B(r)||(r.indegree++,n.out.push(t[e.w]))}),function(e){var n=[];function t(e){return function(n){n.merged||(B(n.barycenter)||B(e.barycenter)||n.barycenter>=e.barycenter)&&function(e,n){var t=0,r=0;e.weight&&(t+=e.barycenter*e.weight,r+=e.weight);n.weight&&(t+=n.barycenter*n.weight,r+=n.weight);e.vs=n.vs.concat(e.vs),e.barycenter=t/r,e.weight=r,e.i=Math.min(n.i,e.i),n.merged=!0}(e,n)}}function r(n){return function(t){t.in.push(n),0===--t.indegree&&e.push(t)}}for(;e.length;){var o=e.pop();n.push(o),D(o.in.reverse(),t(o)),D(o.out,r(o))}return ae(x(n,function(e){return!e.merged}),function(e){return tn(e,["vs","i","barycenter","weight"])})}(x(t,function(e){return!e.indegree}))}function ot(e,n){var t,r=function(e,n){var t={lhs:[],rhs:[]};return D(e,function(e){n(e)?t.lhs.push(e):t.rhs.push(e)}),t}(e,function(e){return Object.prototype.hasOwnProperty.call(e,"barycenter")}),o=r.lhs,a=dn(r.rhs,function(e){return-e.i}),i=[],d=0,s=0,u=0;o.sort((t=!!n,function(e,n){return e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:t?n.i-e.i:e.i-n.i})),u=at(i,a,u),D(o,function(e){u+=e.vs.length,i.push(e.vs),d+=e.barycenter*e.weight,s+=e.weight,u=at(i,a,u)});var c={vs:ye(i)};return s&&(c.barycenter=d/s,c.weight=s),c}function at(e,n,t){for(var r;n.length&&(r=Ae(n)).i<=t;)n.pop(),e.push(r.vs),t++;return t}function it(e,n,t,r){var o=e.children(n),a=e.node(n),i=a?a.borderLeft:void 0,d=a?a.borderRight:void 0,s={};i&&(o=x(o,function(e){return e!==i&&e!==d}));var u=function(e,n){return ae(n,function(n){var t=e.inEdges(n);if(t.length){var r=j(t,function(n,t){var r=e.edge(t),o=e.node(t.v);return{sum:n.sum+r.weight*o.order,weight:n.weight+r.weight}},{sum:0,weight:0});return{v:n,barycenter:r.sum/r.weight,weight:r.weight}}return{v:n}})}(e,o);D(u,function(n){if(e.children(n.v).length){var o=it(e,n.v,t,r);s[n.v]=o,Object.prototype.hasOwnProperty.call(o,"barycenter")&&(i=o,B((a=n).barycenter)?(a.barycenter=i.barycenter,a.weight=i.weight):(a.barycenter=(a.barycenter*a.weight+i.barycenter*i.weight)/(a.weight+i.weight),a.weight+=i.weight))}var a,i});var c=rt(u,t);!function(e,n){D(e,function(e){e.vs=ye(e.vs.map(function(e){return n[e]?n[e].vs:e}))})}(c,s);var f=ot(c,r);if(i&&(f.vs=ye([i,f.vs,d]),e.predecessors(i).length)){var g=e.node(e.predecessors(i)[0]),h=e.node(e.predecessors(d)[0]);Object.prototype.hasOwnProperty.call(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+g.order+h.order)/(f.weight+2),f.weight+=2}return f}function dt(e){var n=jn(e),t=st(e,an(1,n+1),"inEdges"),r=st(e,an(n-1,-1,-1),"outEdges"),o=function(e){var n={},t=x(e.nodes(),function(n){return!e.children(n).length}),r=He(ae(t,function(n){return e.node(n).rank})),o=ae(an(r+1),function(){return[]}),a=dn(t,function(n){return e.node(n).rank});return D(a,function t(r){if(!qe(n,r)){n[r]=!0;var a=e.node(r);o[a.rank].push(r),D(e.successors(r),t)}}),o}(e);ct(e,o);for(var a,i=Number.POSITIVE_INFINITY,d=0,s=0;s<4;++d,++s){ut(d%2?t:r,d%4>=2);var u=nt(e,o=xn(e));u<i&&(s=0,a=Re(o),i=u)}ct(e,a)}function st(e,n,t){return ae(n,function(n){return et(e,n,t)})}function ut(e,n){var t=new w;D(e,function(e){var r=e.graph().root,o=it(e,r,t,n);D(o.vs,function(n,t){e.node(n).order=t}),function(e,n,t){var r,o={};D(t,function(t){for(var a,i,d=e.parent(t);d;){if((a=e.parent(d))?(i=o[a],o[a]=d):(i=r,r=d),i&&i!==d)return void n.setEdge(i,d);d=a}})}(e,t,o.vs)})}function ct(e,n){D(n,function(n){D(n,function(n,t){e.node(n).order=t})})}function ft(e){var n=function(e){var n={},t=0;function r(o){var a=t;D(e.children(o),r),n[o]={low:a,lim:t++}}return D(e.children(),r),n}(e);D(e.graph().dummyChains,function(t){for(var r=e.node(t),o=r.edgeObj,a=function(e,n,t,r){var o,a,i=[],d=[],s=Math.min(n[t].low,n[r].low),u=Math.max(n[t].lim,n[r].lim);o=t;do{o=e.parent(o),i.push(o)}while(o&&(n[o].low>s||u>n[o].lim));a=o,o=r;for(;(o=e.parent(o))!==a;)d.push(o);return{path:i.concat(d.reverse()),lca:a}}(e,n,o.v,o.w),i=a.path,d=a.lca,s=0,u=i[s],c=!0;t!==o.w;){if(r=e.node(t),c){for(;(u=i[s])!==d&&e.node(u).maxRank<r.rank;)s++;u===d&&(c=!1)}if(!c){for(;s<i.length-1&&e.node(u=i[s+1]).minRank<=r.rank;)s++;u=i[s]}e.setParent(t,u),t=e.successors(t)[0]}})}function gt(e,n){var t={};return j(n,function(n,r){var o=0,a=0,i=n.length,d=Ae(r);return D(r,function(n,s){var u=function(e,n){if(e.node(n).dummy)return Ge(e.predecessors(n),function(n){return e.node(n).dummy})}(e,n),c=u?e.node(u).order:i;(u||n===d)&&(D(r.slice(a,s+1),function(n){D(e.predecessors(n),function(r){var a=e.node(r),i=a.order;!(i<o||c<i)||a.dummy&&e.node(n).dummy||ht(t,r,n)})}),a=s+1,o=c)}),r}),t}function ht(e,n,t){if(n>t){var r=n;n=t,t=r}Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,configurable:!0,value:{},writable:!0});var o=e[n];Object.defineProperty(o,t,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function lt(e,n,t){if(n>t){var r=n;n=t,t=r}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],t)}function pt(e,n,t,r,o){var a={},i=function(e,n,t,r){var o=new w,a=e.graph(),i=function(e,n,t){return function(r,o,a){var i,d=r.node(o),s=r.node(a),u=0;if(u+=d.width/2,Object.prototype.hasOwnProperty.call(d,"labelpos"))switch(d.labelpos.toLowerCase()){case"l":i=-d.width/2;break;case"r":i=d.width/2}if(i&&(u+=t?i:-i),i=0,u+=(d.dummy?n:e)/2,u+=(s.dummy?n:e)/2,u+=s.width/2,Object.prototype.hasOwnProperty.call(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":i=s.width/2;break;case"r":i=-s.width/2}return i&&(u+=t?i:-i),i=0,u}}(a.nodesep,a.edgesep,r);return D(n,function(n){var r;D(n,function(n){var a=t[n];if(o.setNode(a),r){var d=t[r],s=o.edge(d,a);o.setEdge(d,a,Math.max(i(e,n,r),s||0))}r=n})}),o}(e,n,t,o),d=o?"borderLeft":"borderRight";function s(e,n){for(var t=i.nodes(),r=t.pop(),o={};r;)o[r]?e(r):(o[r]=!0,t.push(r),t=t.concat(n(r))),r=t.pop()}return s(function(e){a[e]=i.inEdges(e).reduce(function(e,n){return Math.max(e,a[n.v]+i.edge(n))},0)},i.predecessors.bind(i)),s(function(n){var t=i.outEdges(n).reduce(function(e,n){return Math.min(e,a[n.w]-i.edge(n))},Number.POSITIVE_INFINITY),r=e.node(n);t!==Number.POSITIVE_INFINITY&&r.borderType!==d&&(a[n]=Math.max(a[n],t))},i.successors.bind(i)),D(r,function(e){a[e]=a[t[e]]}),a}function vt(e,n){return We(E(n),function(n){var t,r,o=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return r=function(n,t){var r=function(e,n){return e.node(n).width}(e,t)/2;o=Math.max(n+r,o),a=Math.min(n-r,a)},null==(t=n)||K(t,S(r),le),o-a})}function bt(e){var n,t=xn(e),r=ie(gt(e,t),function(e,n){var t={};function r(n,r,o,a,i){var d;D(an(r,o),function(r){d=n[r],e.node(d).dummy&&D(e.predecessors(d),function(n){var r=e.node(n);r.dummy&&(r.order<a||r.order>i)&&ht(t,n,d)})})}return j(n,function(n,t){var o,a=-1,i=0;return D(t,function(d,s){if("border"===e.node(d).dummy){var u=e.predecessors(d);u.length&&(o=e.node(u[0]).order,r(t,i,s,a,o),i=s,a=o)}r(t,i,t.length,o,n.length)}),t}),t}(e,t)),o={};D(["u","d"],function(a){n="u"===a?t:E(t).reverse(),D(["l","r"],function(t){"r"===t&&(n=ae(n,function(e){return E(e).reverse()}));var i=("u"===a?e.predecessors:e.successors).bind(e),d=function(e,n,t,r){var o={},a={},i={};return D(n,function(e){D(e,function(e,n){o[e]=e,a[e]=e,i[e]=n})}),D(n,function(e){var n=-1;D(e,function(e){var d=r(e);if(d.length){d=dn(d,function(e){return i[e]});for(var s=(d.length-1)/2,u=Math.floor(s),c=Math.ceil(s);u<=c;++u){var f=d[u];a[e]===e&&n<i[f]&&!lt(t,e,f)&&(a[f]=e,a[e]=o[e]=o[f],n=i[f])}}})}),{root:o,align:a}}(0,n,r,i),s=pt(e,n,d.root,d.align,"r"===t);"r"===t&&(s=ze(s,function(e){return-e})),o[a+t]=s})});var a=vt(e,o);return function(e,n){var t=E(n),r=Qe(t),o=He(t);D(["u","d"],function(t){D(["l","r"],function(a){var i,d=t+a,s=e[d];if(s!==n){var u=E(s);(i="l"===a?r-Qe(u):o-He(u))&&(e[d]=ze(s,function(e){return e+i}))}})})}(o,a),function(e,n){return ze(e.ul,function(t,r){if(n)return e[n.toLowerCase()][r];var o=dn(ae(e,r));return(o[1]+o[2])/2})}(o,e.graph().align)}function yt(e){var n,t;(function(e){var n=xn(e),t=e.graph().ranksep,r=0;D(n,function(n){var o=He(ae(n,function(n){return e.node(n).height}));D(n,function(n){e.node(n).y=r+o/2}),r+=o+t})})(e=mn(e)),n=bt(e),t=function(n,t){e.node(t).x=n},n&&P(n,S(t))}function mt(e,n){var t=Ln;t("layout",()=>{var n=t(" buildLayoutGraph",()=>function(e){var n=new w({multigraph:!0,compound:!0}),t=St(e.graph());return n.setGraph(ie({},xt,It(t,wt),tn(t,Et))),D(e.nodes(),function(t){var r=St(e.node(t));n.setNode(t,Xe(It(r,jt),Lt)),n.setParent(t,e.parent(t))}),D(e.edges(),function(t){var r=St(e.edge(t));n.setEdge(t,ie({},Nt,It(r,kt),tn(r,Ot)))}),n}(e));t(" runLayout",()=>function(e,n){n(" makeSpaceForEdgeLabels",()=>function(e){var n=e.graph();n.ranksep/=2,D(e.edges(),function(t){var r=e.edge(t);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)})}(e)),n(" removeSelfEdges",()=>function(e){D(e.edges(),function(n){if(n.v===n.w){var t=e.node(n.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}(e)),n(" acyclic",()=>bn(e)),n(" nestingGraph.run",()=>$n(e)),n(" rank",()=>Qn(mn(e))),n(" injectEdgeLabelProxies",()=>function(e){D(e.edges(),function(n){var t=e.edge(n);if(t.width&&t.height){var r=e.node(n.v),o={rank:(e.node(n.w).rank-r.rank)/2+r.rank,e:n};yn(e,"edge-proxy",o,"_ep")}})}(e)),n(" removeEmptyRanks",()=>function(e){var n=Qe(ae(e.nodes(),function(n){return e.node(n).rank})),t=[];D(e.nodes(),function(r){var o=e.node(r).rank-n;t[o]||(t[o]=[]),t[o].push(r)});var r=0,o=e.graph().nodeRankFactor;D(t,function(n,t){B(n)&&t%o!==0?--r:r&&D(n,function(n){e.node(n).rank+=r})})}(e)),n(" nestingGraph.cleanup",()=>function(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,D(e.edges(),function(n){e.edge(n).nestingEdge&&e.removeEdge(n)})}(e)),n(" normalizeRanks",()=>function(e){var n=Qe(ae(e.nodes(),function(n){return e.node(n).rank}));D(e.nodes(),function(t){var r=e.node(t);qe(r,"rank")&&(r.rank-=n)})}(e)),n(" assignRankMinMax",()=>function(e){var n=0;D(e.nodes(),function(t){var r=e.node(t);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,n=He(n,r.maxRank))}),e.graph().maxRank=n}(e)),n(" removeEdgeLabelProxies",()=>function(e){D(e.nodes(),function(n){var t=e.node(n);"edge-proxy"===t.dummy&&(e.edge(t.e).labelRank=t.rank,e.removeNode(n))})}(e)),n(" normalize.run",()=>Cn(e)),n(" parentDummyChains",()=>ft(e)),n(" addBorderSegments",()=>function(e){D(e.children(),function n(t){var r=e.children(t),o=e.node(t);if(r.length&&D(r,n),Object.prototype.hasOwnProperty.call(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var a=o.minRank,i=o.maxRank+1;a<i;++a)kn(e,"borderLeft","_bl",t,o,a),kn(e,"borderRight","_br",t,o,a)}})}(e)),n(" order",()=>dt(e)),n(" insertSelfEdges",()=>function(e){var n=xn(e);D(n,function(n){var t=0;D(n,function(n,r){var o=e.node(n);o.order=r+t,D(o.selfEdges,function(n){yn(e,"selfedge",{width:n.label.width,height:n.label.height,rank:o.rank,order:r+ ++t,e:n.e,label:n.label},"_se")}),delete o.selfEdges})})}(e)),n(" adjustCoordinateSystem",()=>function(e){var n=e.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||On(e)}(e)),n(" position",()=>yt(e)),n(" positionSelfEdges",()=>function(e){D(e.nodes(),function(n){var t=e.node(n);if("selfedge"===t.dummy){var r=e.node(t.e.v),o=r.x+r.width/2,a=r.y,i=t.x-o,d=r.height/2;e.setEdge(t.e,t.label),e.removeNode(n),t.label.points=[{x:o+2*i/3,y:a-d},{x:o+5*i/6,y:a-d},{x:o+i,y:a},{x:o+5*i/6,y:a+d},{x:o+2*i/3,y:a+d}],t.label.x=t.x,t.label.y=t.y}})}(e)),n(" removeBorderNodes",()=>function(e){D(e.nodes(),function(n){if(e.children(n).length){var t=e.node(n),r=e.node(t.borderTop),o=e.node(t.borderBottom),a=e.node(Ae(t.borderLeft)),i=e.node(Ae(t.borderRight));t.width=Math.abs(i.x-a.x),t.height=Math.abs(o.y-r.y),t.x=a.x+t.width/2,t.y=r.y+t.height/2}}),D(e.nodes(),function(n){"border"===e.node(n).dummy&&e.removeNode(n)})}(e)),n(" normalize.undo",()=>function(e){D(e.graph().dummyChains,function(n){var t,r=e.node(n),o=r.edgeLabel;for(e.setEdge(r.edgeObj,o);r.dummy;)t=e.successors(n)[0],e.removeNode(n),o.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(o.x=r.x,o.y=r.y,o.width=r.width,o.height=r.height),n=t,r=e.node(n)})}(e)),n(" fixupEdgeLabelCoords",()=>function(e){D(e.edges(),function(n){var t=e.edge(n);if(Object.prototype.hasOwnProperty.call(t,"x"))switch("l"!==t.labelpos&&"r"!==t.labelpos||(t.width-=t.labeloffset),t.labelpos){case"l":t.x-=t.width/2+t.labeloffset;break;case"r":t.x+=t.width/2+t.labeloffset}})}(e)),n(" undoCoordinateSystem",()=>Nn(e)),n(" translateGraph",()=>function(e){var n=Number.POSITIVE_INFINITY,t=0,r=Number.POSITIVE_INFINITY,o=0,a=e.graph(),i=a.marginx||0,d=a.marginy||0;function s(e){var a=e.x,i=e.y,d=e.width,s=e.height;n=Math.min(n,a-d/2),t=Math.max(t,a+d/2),r=Math.min(r,i-s/2),o=Math.max(o,i+s/2)}D(e.nodes(),function(n){s(e.node(n))}),D(e.edges(),function(n){var t=e.edge(n);Object.prototype.hasOwnProperty.call(t,"x")&&s(t)}),n-=i,r-=d,D(e.nodes(),function(t){var o=e.node(t);o.x-=n,o.y-=r}),D(e.edges(),function(t){var o=e.edge(t);D(o.points,function(e){e.x-=n,e.y-=r}),Object.prototype.hasOwnProperty.call(o,"x")&&(o.x-=n),Object.prototype.hasOwnProperty.call(o,"y")&&(o.y-=r)}),a.width=t-n+i,a.height=o-r+d}(e)),n(" assignNodeIntersects",()=>function(e){D(e.edges(),function(n){var t,r,o=e.edge(n),a=e.node(n.v),i=e.node(n.w);o.points?(t=o.points[0],r=o.points[o.points.length-1]):(o.points=[],t=i,r=a),o.points.unshift(wn(a,t)),o.points.push(wn(i,r))})}(e)),n(" reversePoints",()=>function(e){D(e.edges(),function(n){var t=e.edge(n);t.reversed&&t.points.reverse()})}(e)),n(" acyclic.undo",()=>function(e){D(e.edges(),function(n){var t=e.edge(n);if(t.reversed){e.removeEdge(n);var r=t.forwardName;delete t.reversed,delete t.forwardName,e.setEdge(n.w,n.v,t,r)}})}(e))}(n,t)),t(" updateInputGraph",()=>function(e,n){D(e.nodes(),function(t){var r=e.node(t),o=n.node(t);r&&(r.x=o.x,r.y=o.y,n.children(t).length&&(r.width=o.width,r.height=o.height))}),D(e.edges(),function(t){var r=e.edge(t),o=n.edge(t);r.points=o.points,Object.prototype.hasOwnProperty.call(o,"x")&&(r.x=o.x,r.y=o.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}(e,n))})}var wt=["nodesep","edgesep","ranksep","marginx","marginy"],xt={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Et=["acyclicer","ranker","rankdir","align"],jt=["width","height"],Lt={width:0,height:0},kt=["minlen","weight","width","height","labeloffset"],Nt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ot=["labelpos"];function It(e,n){return ze(tn(e,n),Number)}function St(e){var n={};return D(e,function(e,t){n[t.toLowerCase()]=e}),n}var Pt=d((e,n,t)=>Math.max(n,Math.min(t,e)),"clamp"),Ct=d((e="TB")=>{switch(e){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";default:return"top"}},"getDefaultSelfLoopSide"),Mt=d(e=>"flowchart"===e||"flowchart-v2"===e||"stateDiagram"===e||"er"===e||"classDiagram"===e,"shouldMergeSelfLoopSegments"),Rt=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],_t=d((e,n,t,r,o)=>{const a=[],i=new Set;if(t.forEach(({start:e,end:n})=>{e!==r&&i.add(e),n!==r&&i.add(n)}),i.forEach(n=>{const t=e.node(n);"number"==typeof t?.x&&"number"==typeof t?.y&&a.push(t)}),0===a.length&&t.forEach(({edge:e})=>{(e.points??[]).forEach(e=>{"number"==typeof e?.x&&"number"==typeof e?.y&&a.push(e)})}),0===a.length)return Ct(o);const d=a.reduce((e,n)=>({x:e.x+n.x/a.length,y:e.y+n.y/a.length}),{x:0,y:0}),s=d.x-n.x,u=d.y-n.y;return Math.abs(s)>Math.abs(u)?s>0?"right":"left":Math.abs(u)>0?u>0?"bottom":"top":Ct(o)},"getSelfLoopSide"),Tt=d((e,n="top",t=0,r=0)=>{const o=e.x,a=e.y-t,i=e.width/2,d=e.height/2,s=Math.max(36,Math.min(100,.8*e.width)),u=Pt(Math.max(r,.35*e.width),36,s),c=Pt(.45*Math.min(e.width,e.height),24,48);switch(n){case"bottom":{const e=a+d;return[{x:o-u/2,y:e},{x:o-u/2,y:e+c},{x:o+u/2,y:e+c},{x:o+u/2,y:e}]}case"right":{const e=o+i;return[{x:e,y:a-u/2},{x:e+c,y:a-u/2},{x:e+c,y:a+u/2},{x:e,y:a+u/2}]}case"left":{const e=o-i;return[{x:e,y:a-u/2},{x:e-c,y:a-u/2},{x:e-c,y:a+u/2},{x:e,y:a+u/2}]}default:{const e=a-d;return[{x:o-u/2,y:e},{x:o-u/2,y:e-c},{x:o+u/2,y:e-c},{x:o+u/2,y:e}]}}},"getSelfLoopPoints"),Xt=d((e,n,t="top",r=0,o={})=>{const a=e.x,i=e.y-r,d=o.width??0,s=o.height??0;switch(t){case"bottom":return{x:a,y:Math.max(...n.map(e=>e.y))+s/2+4};case"right":return{x:Math.max(...n.map(e=>e.x))+d/2+4,y:i};case"left":return{x:Math.min(...n.map(e=>e.x))-d/2-4,y:i};default:return{x:a,y:Math.min(...n.map(e=>e.y))-s/2-4}}},"getSelfLoopLabelPosition"),At=d((e,n=0,{mergeSelfLoops:t=!0}={})=>{const r=new Map,o=[],a=e.graph()?.rankdir;return e.edges().forEach(n=>{const a=e.edge(n);if(t&&a.selfLoop){const e=a.selfLoop.id;r.has(e)||r.set(e,[]),r.get(e).push({edge:a,start:n.v,end:n.w})}else o.push({edge:a,start:n.v,end:n.w})}),r.forEach(t=>{if(3!==t.length)return void t.forEach(e=>o.push(e));t.sort((e,n)=>e.edge.selfLoop.order-n.edge.selfLoop.order);const[r,i,d]=t,s=r.edge.originalEdge??i.edge.originalEdge??d.edge.originalEdge??i.edge,u=e.node(s.start);if(!u)return void t.forEach(e=>o.push(e));const c={width:i.edge.width,height:i.edge.height},f=_t(e,u,t,s.start,a),g=Tt(u,f,n,c.width??0),h=Xt(u,g,f,n,c),l={...i.edge,...s,id:s.id,points:g,start:s.start,end:s.end,x:h.x,y:h.y,width:c.width,height:c.height,labelStyle:i.edge.labelStyle,fromCluster:r.edge.fromCluster??i.edge.fromCluster??d.edge.fromCluster,toCluster:r.edge.toCluster??i.edge.toCluster??d.edge.toCluster};delete l.selfLoop,delete l.originalEdge,o.push({edge:l,start:l.start,end:l.end})}),o},"getEdgesToRender"),Dt=d(async({element:e,graph:n,diagramType:t,id:s,parentCluster:l,siteConfig:p})=>{const v=n.graph().rankdir;u.trace("Dir in recursive render - dir:",v);const{clusters:b,edgePaths:y,edgeLabels:m,nodes:w,rootGroups:x}=r(e,{edgePathsClass:"edgePaths"});n.nodes()?u.info("Recursive render XXX",n.nodes()):u.info("No nodes found for",n),n.edges().length>0&&u.info("Recursive edges",n.edge(n.edges()[0]));const E=Mt(t);await Promise.all(n.nodes().map(async function(e){const r=n.node(e);if(void 0!==l){const t=JSON.parse(JSON.stringify(l.clusterData));u.trace("Setting data for parent cluster XXX\n Node.id = ",e,"\n data=",t.height,"\nParent cluster",l.height),n.setNode(l.id,t),n.parent(e)||(u.trace("Setting parent",e,l.id),n.setParent(e,l.id,t))}if(u.info("(Insert) Node XXX"+e+": "+JSON.stringify(n.node(e))),r?.clusterNode){u.info("Cluster identified XBX",e,r.width,n.node(e));const{ranksep:o,nodesep:a}=n.graph();r.graph.setGraph({...r.graph.graph(),ranksep:o+25,nodesep:a});const i=await Ut({element:w,graph:r.graph,diagramType:t,id:s,parentCluster:n.node(e),siteConfig:p}),d=i.elem;c(r,d),r.diff=i.diff||0,u.info("New compound node after recursive render XAX",e,"width",r.width,"height",r.height),f(d,r)}else n.children(e).length>0?(u.trace("Cluster - the non recursive path XBX",e,r.id,r,r.width,"Graph:",n),u.trace(o(r.id,n)),a.set(r.id,{id:o(r.id,n),node:r})):(u.trace("Node - the non recursive path XAX",e,w,n.node(e),v),await i(w,n.node(e),{config:p,dir:v}))}));const j=d(async()=>{const e=n.edges().map(async function(e){const t=n.edge(e.v,e.w,e.name);if(u.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),u.info("Edge "+e.v+" -> "+e.w+": ",e," ",JSON.stringify(n.edge(e))),u.info("Fix",a,"ids:",e.v,e.w,"Translating: ",a.get(e.v),a.get(e.w)),E&&t.selfLoop){if(1!==t.selfLoop.order)return;const e={...t.originalEdge,...t,id:t.selfLoop.id,startLabelLeft:t.originalEdge?.startLabelLeft??t.startLabelLeft,startLabelRight:t.originalEdge?.startLabelRight??t.startLabelRight,endLabelLeft:t.originalEdge?.endLabelLeft??t.endLabelLeft,endLabelRight:t.originalEdge?.endLabelRight??t.endLabelRight};return await h(m,e),t.width=e.width,t.height=e.height,void(t.labelStyle=e.labelStyle)}await h(m,t)});await Promise.all(e)},"processEdges");await j();const{subGraphTitleTotalMargin:L}=g(p);return{elem:x,graph:n,groups:{clusters:b,edgePaths:y,edgeLabels:m,nodes:w,rootGroups:x},diagramType:t,id:s,mergeSelfLoops:E,subGraphTitleTotalMargin:L}},"measureDagreGraph"),Bt=d(e=>{u.info("############################################# XXX"),u.info("### Layout ### XXX"),u.info("############################################# XXX"),mt(e)},"runDagreGraphLayout"),Gt=d((e,n,t)=>{const r=e.node(n);if(!r)return;const o={...r};return r?.clusterNode?o.y=(r.y??0)+t:e.children(n).length>0?o.height=(r.height??0)+t:o.y=(r.y??0)+t/2,o},"normalizeDagreNode"),Ft=d((e,n)=>{Rt.forEach(t=>{void 0!==n[t]&&(e[t]=n[t])})},"applyDagreNodeLayout"),Vt=d((e,n,t,r)=>({...e,start:e.start??n,end:e.end??t,points:(e.points??[]).map(e=>({...e,y:"number"==typeof e.y?e.y+r:e.y}))}),"normalizeDagreEdge"),Yt=d((n,t)=>{const{graph:r,mergeSelfLoops:o,subGraphTitleTotalMargin:a=0}=t,i=new Map(n.nodes.map(e=>[e.id,e]));e(r).forEach(e=>{const n=Gt(r,e,a);if(!n)return;Ft(r.node(e),n);const t=i.get(e);t&&Ft(t,n)});const d=a/2;return n.edges=At(r,d,{mergeSelfLoops:o}).map(({edge:e,start:n,end:t})=>Vt(e,n,t,d)),n},"applyDagreLayoutResult"),qt=d(async({elem:n,graph:t,groups:{clusters:r,edgePaths:o},diagramType:i,id:d,mergeSelfLoops:s,subGraphTitleTotalMargin:c})=>{let f=0;await Promise.all(e(t).map(async function(e){const n=t.node(e);if(u.info("Position XBX => "+e+": ("+n.x,","+n.y,") width: ",n.width," height: ",n.height),n?.clusterNode)n.y+=c,u.info("A tainted cluster node XBX1",e,n.id,n.width,n.height,n.x,n.y,t.parent(e)),a.get(n.id).node=n,l(n);else if(t.children(e).length>0){u.info("A pure cluster node XBX1",e,n.id,n.x,n.y,n.width,n.height,t.parent(e)),n.height+=c,t.node(n.parentId);const o=n?.padding/2||0,i=n?.labelBBox?.height||0,d=i-o||0;u.debug("OffsetY",d,"labelHeight",i,"halfPadding",o),await p(r,n),a.get(n.id).node=n}else{const e=t.node(n.parentId);n.y+=c/2,u.info("A regular node XBX1 - using the padding",n.id,"parent",n.parentId,n.width,n.height,n.x,n.y,"offsetY",n.offsetY,"parent",e,e?.offsetY,n),l(n)}}));const g=c/2;return At(t,g,{mergeSelfLoops:s}).forEach(function({edge:e,start:n,end:r}){u.info("Edge "+n+" -> "+r+": "+JSON.stringify(e),e),e.points.forEach(e=>e.y+=g);const s=t.node(n),c=t.node(r),f=v(o,e,a,i,s,c,d);b(e,f)}),t.nodes().forEach(function(e){const n=t.node(e);u.info(e,n.type,n.diff),n.isGroup&&(f=n.diff)}),u.warn("Returning from recursive render XAX",n,f),{elem:n,diff:f}},"paintDagreLayoutCore"),Ut=d(async e=>{const n=await Dt(e);return Bt(n.graph),await qt(n)},"renderDagreSubgraph"),zt=d(e=>{const t=new w({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.nodeSpacing||e.config?.flowchart?.nodeSpacing,ranksep:e.config?.rankSpacing||e.rankSpacing||e.config?.flowchart?.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return e.nodes.forEach(e=>{t.setNode(e.id,{...e}),e.parentId&&t.setParent(e.id,e.parentId)}),u.debug("Edges:",e.edges),e.edges.forEach(e=>{if(e.start===e.end){const n=e.start,r=n+"---"+n+"---1",o=n+"---"+n+"---2",a=t.node(n);t.setNode(r,{domId:r,id:r,parentId:a.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),t.setParent(r,a.parentId),t.setNode(o,{domId:o,id:o,parentId:a.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),t.setParent(o,a.parentId);const i=structuredClone(e),d=structuredClone(e),s=structuredClone(e),u=structuredClone(e);d.originalEdge=i,d.selfLoop={id:i.id,order:0},s.originalEdge=i,s.selfLoop={id:i.id,order:1},u.originalEdge=i,u.selfLoop={id:i.id,order:2},d.label="",d.arrowTypeEnd="none",d.endLabelLeft="",d.endLabelRight="",d.startLabelLeft="",d.id=n+"-cyclic-special-1",s.startLabelRight="",s.startLabelLeft="",s.endLabelLeft="",s.endLabelRight="",s.arrowTypeStart="none",s.arrowTypeEnd="none",s.id=n+"-cyclic-special-mid",u.label="",u.startLabelRight="",u.startLabelLeft="",u.arrowTypeStart="none",a.isGroup&&(d.fromCluster=n,u.toCluster=n),u.id=n+"-cyclic-special-2",u.arrowTypeStart="none",t.setEdge(n,r,d,n+"-cyclic-special-0"),t.setEdge(r,o,s,n+"-cyclic-special-1"),t.setEdge(o,n,u,n+"-cyclic-special-2")}else t.setEdge(e.start,e.end,{...e},e.id)}),n(t),{graph:t}},"prepareLayoutForDagre"),Jt=d(async(e,{element:n,preparedLayout:t})=>{const r=t??zt(e),o=s(),a=await Dt({element:n,graph:r.graph,diagramType:e.type,id:e.diagramId,parentCluster:void 0,siteConfig:o});return r.measuredLayout=a,a},"measureDagreLayout"),Ht=d((e,n)=>{const t=n.preparedLayout?.measuredLayout;if(!t)throw new Error("runDagreLayoutCore requires measureDagreLayout to run first");return Bt(t.graph),Yt(e,t),t},"runDagreLayoutCore"),Qt=t({prepareLayout:zt,measureLayout:Jt,runLayoutCore:Ht,paintOptions:{clusterDb:a,getNodes:d((n,{measure:t})=>e(t.graph).map(e=>t.graph.node(e)).filter(Boolean),"getDagrePaintNodes"),getEdgeNode:d((e,n,{measure:t})=>e?t.graph.node(e):void 0,"getDagreEdgeNode"),skipNode:d((e,{measure:n})=>!n.graph.hasNode(e.id),"skipNode"),isCluster:d((e,{measure:n})=>n.graph.hasNode(e.id)&&(n.graph.children(e.id)??[]).length>0,"isCluster")}});export{Yt as applyDagreLayoutResult,At as getEdgesToRender,Jt as measureDagreLayout,zt as prepareLayoutForDagre,Qt as render,Ht as runDagreLayoutCore};
@@ -0,0 +1 @@
1
+ import{p as e}from"./chunk-JWPE2WC7-CVtFylX6.js";import{_ as t,a7 as a,O as n,Q as r,T as l,d as s,l as o,be as i,k as c,b as d,a as p,v as h,x as u,g as f,s as m,R as y,bf as g,C as x}from"./mermaid.core-CvFWfSA0.js";import{s as S}from"./chunk-VQ5W62QI-Be8I4VMn.js";import{p as v}from"./cynefin-EF2NZ3EQ-CaJSaYBh.js";import{b}from"./defaultLocale-HOdfsG1x.js";import{o as C}from"./ordinal-zwWoQKz9.js";import"./index-BwpxQGdp.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-C-9EFvh4.js";import"./settings-DzQM72QE.js";import"./index-Zvckkvpn.js";import"./LoaderLayer-CWElgcGs.js";import"./websocket-KESFarc3.js";import"./index-DpobNvg5.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";import"./init-DLRA0X12.js";function w(e){var t=0,a=e.children,n=a&&a.length;if(n)for(;--n>=0;)t+=a[n].value;else t=1;e.value=t}function $(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=M)):void 0===t&&(t=L);for(var a,n,r,l,s,o=new j(e),i=[o];a=i.pop();)if((r=t(a.data))&&(s=(r=Array.from(r)).length))for(a.children=r,l=s-1;l>=0;--l)i.push(n=r[l]=new j(r[l])),n.parent=a,n.depth=a.depth+1;return o.eachBefore(T)}function L(e){return e.children}function M(e){return Array.isArray(e)?e[1]:null}function k(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function T(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function j(e){this.data=e,this.depth=this.height=0,this.parent=null}function z(){return 0}function F(e){return function(){return e}}function P(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function A(e,t,a,n,r){for(var l,s=e.children,o=-1,i=s.length,c=e.value&&(n-t)/e.value;++o<i;)(l=s[o]).y0=a,l.y1=r,l.x0=t,l.x1=t+=l.value*c}function N(e,t,a,n,r){for(var l,s=e.children,o=-1,i=s.length,c=e.value&&(r-a)/e.value;++o<i;)(l=s[o]).x0=t,l.x1=n,l.y0=a,l.y1=a+=l.value*c}j.prototype=$.prototype={constructor:j,count:function(){return this.eachAfter(w)},each:function(e,t){let a=-1;for(const n of this)e.call(t,n,++a,this);return this},eachAfter:function(e,t){for(var a,n,r,l=this,s=[l],o=[],i=-1;l=s.pop();)if(o.push(l),a=l.children)for(n=0,r=a.length;n<r;++n)s.push(a[n]);for(;l=o.pop();)e.call(t,l,++i,this);return this},eachBefore:function(e,t){for(var a,n,r=this,l=[r],s=-1;r=l.pop();)if(e.call(t,r,++s,this),a=r.children)for(n=a.length-1;n>=0;--n)l.push(a[n]);return this},find:function(e,t){let a=-1;for(const n of this)if(e.call(t,n,++a,this))return n},sum:function(e){return this.eachAfter(function(t){for(var a=+e(t.data)||0,n=t.children,r=n&&n.length;--r>=0;)a+=n[r].value;t.value=a})},sort:function(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})},path:function(e){for(var t=this,a=function(e,t){if(e===t)return e;var a=e.ancestors(),n=t.ancestors(),r=null;e=a.pop(),t=n.pop();for(;e===t;)r=e,e=a.pop(),t=n.pop();return r}(t,e),n=[t];t!==a;)t=t.parent,n.push(t);for(var r=n.length;e!==a;)n.splice(r,0,e),e=e.parent;return n},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){return Array.from(this)},leaves:function(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e},links:function(){var e=this,t=[];return e.each(function(a){a!==e&&t.push({source:a.parent,target:a})}),t},copy:function(){return $(this).eachBefore(k)},[Symbol.iterator]:function*(){var e,t,a,n,r=this,l=[r];do{for(e=l.reverse(),l=[];r=e.pop();)if(yield r,t=r.children)for(a=0,n=t.length;a<n;++a)l.push(t[a])}while(l.length)}};var B=function e(t){function a(e,a,n,r,l){!function(e,t,a,n,r,l){for(var s,o,i,c,d,p,h,u,f,m,y,g=[],x=t.children,S=0,v=0,b=x.length,C=t.value;S<b;){i=r-a,c=l-n;do{d=x[v++].value}while(!d&&v<b);for(p=h=d,y=d*d*(m=Math.max(c/i,i/c)/(C*e)),f=Math.max(h/y,y/p);v<b;++v){if(d+=o=x[v].value,o<p&&(p=o),o>h&&(h=o),y=d*d*m,(u=Math.max(h/y,y/p))>f){d-=o;break}f=u}g.push(s={value:d,dice:i<c,children:x.slice(S,v)}),s.dice?A(s,a,n,r,C?n+=c*d/C:l):N(s,a,n,C?a+=i*d/C:r,l),C-=d,S=v}}(t,e,a,n,r,l)}return a.ratio=function(t){return e((t=+t)>1?t:1)},a}((1+Math.sqrt(5))/2);function W(){var e=B,t=!1,a=1,n=1,r=[0],l=z,s=z,o=z,i=z,c=z;function d(e){return e.x0=e.y0=0,e.x1=a,e.y1=n,e.eachBefore(p),r=[0],t&&e.eachBefore(P),e}function p(t){var a=r[t.depth],n=t.x0+a,d=t.y0+a,p=t.x1-a,h=t.y1-a;p<n&&(n=p=(n+p)/2),h<d&&(d=h=(d+h)/2),t.x0=n,t.y0=d,t.x1=p,t.y1=h,t.children&&(a=r[t.depth+1]=l(t)/2,n+=c(t)-a,d+=s(t)-a,(p-=o(t)-a)<n&&(n=p=(n+p)/2),(h-=i(t)-a)<d&&(d=h=(d+h)/2),e(t,n,d,p,h))}return d.round=function(e){return arguments.length?(t=!!e,d):t},d.size=function(e){return arguments.length?(a=+e[0],n=+e[1],d):[a,n]},d.tile=function(t){return arguments.length?(e=function(e){if("function"!=typeof e)throw new Error;return e}(t),d):e},d.padding=function(e){return arguments.length?d.paddingInner(e).paddingOuter(e):d.paddingInner()},d.paddingInner=function(e){return arguments.length?(l="function"==typeof e?e:F(+e),d):l},d.paddingOuter=function(e){return arguments.length?d.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):d.paddingTop()},d.paddingTop=function(e){return arguments.length?(s="function"==typeof e?e:F(+e),d):s},d.paddingRight=function(e){return arguments.length?(o="function"==typeof e?e:F(+e),d):o},d.paddingBottom=function(e){return arguments.length?(i="function"==typeof e?e:F(+e),d):i},d.paddingLeft=function(e){return arguments.length?(c="function"==typeof e?e:F(+e),d):c},d}var D=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=d,this.getAccTitle=p,this.setDiagramTitle=h,this.getDiagramTitle=u,this.getAccDescription=f,this.setAccDescription=m}static{t(this,"TreeMapDB")}getNodes(){return this.nodes}getConfig(){const e=y,t=n();return r({...e.treemap,...t.treemap??{}})}addNode(e,t){this.nodes.push(e),this.levels.set(e,t),0===t&&(this.outerNodes.push(e),this.root??=e)}getRoot(){return{name:"",children:this.outerNodes}}addClass(e,t){const a=this.classes.get(e)??{id:e,styles:[],textStyles:[]},n=t.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");n&&n.forEach(e=>{g(e)&&(a?.textStyles?a.textStyles.push(e):a.textStyles=[e]),a?.styles?a.styles.push(e):a.styles=[e]}),this.classes.set(e,a)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){x(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function E(e){if(!e.length)return[];const t=[],a=[];return e.forEach(e=>{const n={name:e.name,children:"Leaf"===e.type?void 0:[]};for(n.classSelector=e?.classSelector,e?.cssCompiledStyles&&(n.cssCompiledStyles=e.cssCompiledStyles),"Leaf"===e.type&&void 0!==e.value&&(n.value=e.value);a.length>0&&a[a.length-1].level>=e.level;)a.pop();if(0===a.length)t.push(n);else{const e=a[a.length-1].node;e.children?e.children.push(n):e.children=[n]}"Leaf"!==e.type&&a.push({node:n,level:e.level})}),t}t(E,"buildHierarchy");var R=t((a,n)=>{e(a,n);const r=[];for(const e of a.TreemapRows??[])"ClassDefStatement"===e.$type&&n.addClass(e.className??"",e.styleText??"");for(const e of a.TreemapRows??[]){const t=e.item;if(!t)continue;const a=e.indent?parseInt(e.indent):0,l=V(t),s=t.classSelector?n.getStylesForClass(t.classSelector):[],o=s.length>0?s:void 0,i={level:a,name:l,type:t.$type,value:t.value,classSelector:t.classSelector,cssCompiledStyles:o};r.push(i)}const l=E(r),s=t((e,t)=>{for(const a of e)n.addNode(a,t),a.children&&a.children.length>0&&s(a.children,t+1)},"addNodesRecursively");s(l,0)},"populate"),V=t(e=>e.name?String(e.name):"","getItemName"),I={parser:{yy:void 0},parse:t(async e=>{try{const t=v,a=await t("treemap",e);o.debug("Treemap AST:",a);const n=I.parser?.yy;if(!(n instanceof D))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");R(a,n)}catch(e){throw o.error("Error parsing treemap:",e),e}},"parse")},H=10,Q={draw:t((e,a,r,d)=>{const p=d.db,h=p.getConfig(),u=h.padding??10,f=p.getDiagramTitle(),m=p.getRoot(),{themeVariables:y}=n();if(!m)return;const g=f?30:0,x=l(a),v=h.nodeWidth?h.nodeWidth*H:960,w=h.nodeHeight?h.nodeHeight*H:500,L=v,M=w+g;let k;x.attr("viewBox",`0 0 ${L} ${M}`),s(x,M,L,h.useMaxWidth);try{const e=h.valueFormat||",";if("$0,0"===e)k=t(e=>"$"+b(",")(e),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const a=/\.\d+/.exec(e),n=a?a[0]:"";k=t(e=>"$"+b(","+n)(e),"valueFormat")}else if(e.startsWith("$")){const a=e.substring(1);k=t(e=>"$"+b(a||"")(e),"valueFormat")}else k=b(e)}catch(e){o.error("Error creating format function:",e),k=b(",")}const T=C().range(["transparent",y.cScale0,y.cScale1,y.cScale2,y.cScale3,y.cScale4,y.cScale5,y.cScale6,y.cScale7,y.cScale8,y.cScale9,y.cScale10,y.cScale11]),j=C().range(["transparent",y.cScalePeer0,y.cScalePeer1,y.cScalePeer2,y.cScalePeer3,y.cScalePeer4,y.cScalePeer5,y.cScalePeer6,y.cScalePeer7,y.cScalePeer8,y.cScalePeer9,y.cScalePeer10,y.cScalePeer11]),z=C().range([y.cScaleLabel0,y.cScaleLabel1,y.cScaleLabel2,y.cScaleLabel3,y.cScaleLabel4,y.cScaleLabel5,y.cScaleLabel6,y.cScaleLabel7,y.cScaleLabel8,y.cScaleLabel9,y.cScaleLabel10,y.cScaleLabel11]);f&&x.append("text").attr("x",L/2).attr("y",g/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(f);const F=x.append("g").attr("transform",`translate(0, ${g})`).attr("class","treemapContainer"),P=$(m).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),A=W().size([v,w]).paddingTop(e=>e.children&&e.children.length>0?35:0).paddingInner(u).paddingLeft(e=>e.children&&e.children.length>0?H:0).paddingRight(e=>e.children&&e.children.length>0?H:0).paddingBottom(e=>e.children&&e.children.length>0?H:0).round(!0)(P),N=A.descendants().filter(e=>e.children&&e.children.length>0),B=F.selectAll(".treemapSection").data(N).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);B.append("rect").attr("width",e=>e.x1-e.x0).attr("height",25).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>0===e.depth?"display: none;":""),B.append("clipPath").attr("id",(e,t)=>`clip-section-${a}-${t}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",25),B.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,t)=>`treemapSection section${t}`).attr("fill",e=>T(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>j(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(0===e.depth)return"display: none;";const t=i({cssCompiledStyles:e.data.cssCompiledStyles});return t.nodeStyles+";"+t.borderStyles.join(";")}),B.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",12.5).attr("dominant-baseline","middle").text(e=>0===e.depth?"":e.data.name).attr("font-weight","bold").attr("clip-path",(e,t)=>`url(#clip-section-${a}-${t})`).attr("style",e=>{if(0===e.depth)return"display: none;";return"dominant-baseline: middle; font-size: 12px; fill:"+z(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"+i({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")}).each(function(e){if(0===e.depth)return;const t=c(this),a=e.data.name;t.text(a);const n=e.x1-e.x0;let r;if(!1!==h.showValues&&e.value){r=n-10-30-10-6}else{r=n-6-6}const l=Math.max(15,r),s=t.node();if(s.getComputedTextLength()>l){const e="...";let n=a;for(;n.length>0;){if(n=a.substring(0,n.length-1),0===n.length){t.text(e),s.getComputedTextLength()>l&&t.text("");break}if(t.text(n+e),s.getComputedTextLength()<=l)break}}}),!1!==h.showValues&&B.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",12.5).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?k(e.value):"").attr("font-style","italic").attr("style",e=>{if(0===e.depth)return"display: none;";return"text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+z(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"+i({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")});const D=A.leaves(),E=D.length>20,R=E?16:38,V=E?14:28,I=E?4:8,Q=E?4:6,O=E?2:4,G=E?8:10,q=E?1:2,J=F.selectAll(".treemapLeafGroup").data(D).enter().append("g").attr("class",(e,t)=>`treemapNode treemapLeafGroup leaf${t}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);J.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?T(e.parent.data.name):T(e.data.name)).attr("style",e=>i({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?T(e.parent.data.name):T(e.data.name)).attr("stroke-width",3),J.append("clipPath").attr("id",(e,t)=>`clip-${a}-${t}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4));if(J.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>`text-anchor: middle; dominant-baseline: middle; font-size: ${R}px;fill:`+z(e.data.name)+";"+i({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")).attr("clip-path",(e,t)=>`url(#clip-${a}-${t})`).text(e=>e.data.name).each(function(e){const t=c(this),a=e.x1-e.x0,n=e.y1-e.y0,r=t.node(),l=a-2*O,s=n-2*O;if(l<G||s<G)return void t.style("display","none");let o=parseInt(t.style("font-size"),10);for(;r.getComputedTextLength()>l&&o>I;)o--,t.style("font-size",`${o}px`);let i=Math.max(Q,Math.min(V,Math.round(.6*o))),d=o+q+i;for(;d>s&&o>I&&(o--,i=Math.max(Q,Math.min(V,Math.round(.6*o))),!(i<Q&&o===I));)t.style("font-size",`${o}px`),d=o+q+i;t.style("font-size",`${o}px`),E?(o<I||s<I)&&t.style("display","none"):(r.getComputedTextLength()>l||o<I||s<o)&&t.style("display","none")}),!1!==h.showValues){J.append("text").attr("class","treemapValue").attr("x",e=>(e.x1-e.x0)/2).attr("y",function(e){return(e.y1-e.y0)/2}).attr("style",e=>`text-anchor: middle; dominant-baseline: hanging; font-size: ${V}px;fill:`+z(e.data.name)+";"+i({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")).attr("clip-path",(e,t)=>`url(#clip-${a}-${t})`).text(e=>e.value?k(e.value):"").each(function(e){const t=c(this),a=this.parentNode;if(!a)return void t.style("display","none");const n=c(a).select(".treemapLabel");if(n.empty()||"none"===n.style("display"))return void t.style("display","none");const r=parseFloat(n.style("font-size")),l=Math.max(Q,Math.min(V,Math.round(.6*r)));t.style("font-size",`${l}px`);const s=(e.y1-e.y0)/2+r/2+q;t.attr("y",s);const o=e.x1-e.x0,i=e.y1-e.y0-4,d=o-2*O;t.node().getComputedTextLength()>d||s+l>i||l<Q?t.style("display","none"):t.style("display",null)})}const Z=h.diagramPadding??8;S(x,Z,"flowchart",h?.useMaxWidth||!1)},"draw"),getClasses:t(function(e,t){return t.db.getClasses()},"getClasses")},O={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelFontSize:"12px",valueFontSize:"10px",titleFontSize:"14px"},G=t(({treemap:e}={})=>{const t=a(),l=n(),s=r(t,l.themeVariables),o=r(O,e),i=o.titleColor??s.titleColor,c=o.labelColor??s.textColor,d=o.valueColor??s.textColor;return`\n .treemapNode.section {\n stroke: ${o.sectionStrokeColor};\n stroke-width: ${o.sectionStrokeWidth};\n fill: ${o.sectionFillColor};\n }\n .treemapNode.leaf {\n stroke: ${o.leafStrokeColor};\n stroke-width: ${o.leafStrokeWidth};\n fill: ${o.leafFillColor};\n }\n .treemapLabel {\n fill: ${c};\n font-size: ${o.labelFontSize};\n }\n .treemapValue {\n fill: ${d};\n font-size: ${o.valueFontSize};\n }\n .treemapTitle {\n fill: ${i};\n font-size: ${o.titleFontSize};\n }\n `},"getStyles"),q={parser:I,get db(){return new D},renderer:Q,styles:G};export{q as diagram};
@@ -0,0 +1 @@
1
+ import{p as t}from"./chunk-JWPE2WC7-CVtFylX6.js";import{_ as e,Q as r,T as a,d as s,l as o,b as i,a as n,v as l,x as c,g as d,s as p,O as b,R as h,C as k}from"./mermaid.core-CvFWfSA0.js";import{p as m}from"./cynefin-EF2NZ3EQ-CaJSaYBh.js";import"./index-BwpxQGdp.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-C-9EFvh4.js";import"./settings-DzQM72QE.js";import"./index-Zvckkvpn.js";import"./LoaderLayer-CWElgcGs.js";import"./websocket-KESFarc3.js";import"./index-DpobNvg5.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 g=h.packet,f=class{constructor(){this.packet=[],this.setAccTitle=i,this.getAccTitle=n,this.setDiagramTitle=l,this.getDiagramTitle=c,this.getAccDescription=d,this.setAccDescription=p}static{e(this,"PacketDB")}getConfig(){const t=r({...g,...b().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){k(),this.packet=[]}},u=e((e,r)=>{t(e,r);let a=-1,s=[],i=1;const{bitsPerRow:n}=r.getConfig();for(let{start:t,end:l,bits:c,label:d}of e.blocks){if(void 0!==t&&void 0!==l&&l<t)throw new Error(`Packet block ${t} - ${l} is invalid. End must be greater than start.`);if(t??=a+1,t!==a+1)throw new Error(`Packet block ${t} - ${l??t} is not contiguous. It should start from ${a+1}.`);if(0===c)throw new Error(`Packet block ${t} is invalid. Cannot have a zero bit field.`);for(l??=t+(c??1)-1,c??=l-t+1,a=l,o.debug(`Packet block ${t} - ${a} with label ${d}`);s.length<=n+1&&r.getPacket().length<1e4;){const[e,a]=w({start:t,end:l,bits:c,label:d},i,n);if(s.push(e),e.end+1===i*n&&(r.pushWord(s),s=[],i++),!a)break;({start:t,end:l,bits:c,label:d}=a)}}r.pushWord(s)},"populate"),w=e((t,e,r)=>{if(void 0===t.start)throw new Error("start should have been set during first phase");if(void 0===t.end)throw new Error("end should have been set during first phase");if(t.start>t.end)throw new Error(`Block start ${t.start} is greater than block end ${t.end}.`);if(t.end+1<=e*r)return[t,void 0];const a=e*r-1,s=e*r;return[{start:t.start,end:a,label:t.label,bits:a-t.start},{start:s,end:t.end,label:t.label,bits:t.end-s}]},"getNextFittingBlock"),y={parser:{yy:void 0},parse:e(async t=>{const e=await m("packet",t),r=y.parser?.yy;if(!(r instanceof f))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");o.debug(e),u(e,r)},"parse")},x=e((t,e,r,o)=>{const i=o.db,n=i.getConfig(),{rowHeight:l,paddingY:c,bitWidth:d,bitsPerRow:p}=n,b=i.getPacket(),h=i.getDiagramTitle(),k=l+c,m=k*(b.length+1)-(h?0:l),g=d*p+2,f=a(e);f.attr("viewBox",`0 0 ${g} ${m}`),s(f,m,g,n.useMaxWidth);for(const[t,e]of b.entries())$(f,e,t,n);f.append("text").text(h).attr("x",g/2).attr("y",m-k/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),$=e((t,e,r,{rowHeight:a,paddingX:s,paddingY:o,bitWidth:i,bitsPerRow:n,showBits:l,bitOrder:c})=>{const d=t.append("g"),p=r*(a+o)+o,b="descending"===c;for(const t of e){const e=t.end-t.start+1,r=t.start%n,o=(b?n-r-e:r)*i+1,c=e*i-s;if(d.append("rect").attr("x",o).attr("y",p).attr("width",c).attr("height",a).attr("class","packetBlock"),d.append("text").attr("x",o+c/2).attr("y",p+a/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(t.label),!l)continue;const[h,k]=b?[t.end,t.start]:[t.start,t.end],m=1===e,g=p-2;d.append("text").attr("x",o+(m?c/2:0)).attr("y",g).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",m?"middle":"start").text(h),m||d.append("text").attr("x",o+c).attr("y",g).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(k)}},"drawWord"),B={draw:x},C={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},j=e(({packet:t}={})=>{const e=r(C,t);return`\n\t.packetByte {\n\t\tfont-size: ${e.byteFontSize};\n\t}\n\t.packetByte.start {\n\t\tfill: ${e.startByteColor};\n\t}\n\t.packetByte.end {\n\t\tfill: ${e.endByteColor};\n\t}\n\t.packetLabel {\n\t\tfill: ${e.labelColor};\n\t\tfont-size: ${e.labelFontSize};\n\t}\n\t.packetTitle {\n\t\tfill: ${e.titleColor};\n\t\tfont-size: ${e.titleFontSize};\n\t}\n\t.packetBlock {\n\t\tstroke: ${e.blockStrokeColor};\n\t\tstroke-width: ${e.blockStrokeWidth};\n\t\tfill: ${e.blockFillColor};\n\t}\n\t`},"styles"),v={parser:y,get db(){return new f},renderer:B,styles:j};export{v as diagram};
@@ -0,0 +1 @@
1
+ import{I as e}from"./chunk-2Q5K7J3B-4_3njuk_.js";import{p as t}from"./chunk-JWPE2WC7-CVtFylX6.js";import{v as n,b as i,s as o,x as r,g as s,a,_ as c,Q as d,l,T as p,d as h,O as g,C as f,j as m,aq as u,R as w,ar as x}from"./mermaid.core-CvFWfSA0.js";import{p as b}from"./cynefin-EF2NZ3EQ-CaJSaYBh.js";import"./index-BwpxQGdp.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-C-9EFvh4.js";import"./settings-DzQM72QE.js";import"./index-Zvckkvpn.js";import"./LoaderLayer-CWElgcGs.js";import"./websocket-KESFarc3.js";import"./index-DpobNvg5.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 y=/[─━│┃└┗├┣]/,k=/[└┗├┣]/,v=/[─━]/,$=/^[\s│┃]+$/,C=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,B=/^\s*%%/;function V(e){return e.some(e=>y.test(e))}function j(e){for(const t of e){const e=k.exec(t);if(e?.index&&e.index>0)return e.index}return 4}function T(e,t){return e.replace(/\bline\s+(\d+)\b/gi,(e,n)=>{const i=parseInt(n,10),o=t.get(i);return o?`line ${o}`:e})}function I(e){const t=e.split("\n"),n=new Map;let i=-1;for(const[e,n]of t.entries())if("treeView-beta"===n.trim()){i=e;break}if(-1===i)return{text:e,lineMap:n};const o=[];for(let e=i+1;e<t.length;e++){const n=t[e];""===n.trim()||B.test(n)||C.test(n)||($.test(n)||o.push(n.replace(/\t/g," ")))}if(!V(o))return{text:e,lineMap:n};const r=j(o),s=[];let a=0;for(let e=0;e<=i;e++)s.push(t[e]),a++,n.set(a,e+1);for(let e=i+1;e<t.length;e++){const i=t[e],o=e+1;if(""===i.trim()){s.push(i),a++,n.set(a,o);continue}if(B.test(i)){s.push(i),a++,n.set(a,o);continue}if(C.test(i)){s.push(i),a++,n.set(a,o);continue}if($.test(i))continue;const c=i.replace(/\t/g," "),d=k.exec(c);if(void 0!==d?.index){const e=d.index,t=Math.round(e/r)+1;let i=e+1;for(;i<c.length&&v.test(c[i]);)i++;for(;i<c.length&&" "===c[i];)i++;const l=c.slice(i).trimEnd();if(!l)throw new Error(`Line ${o}: Empty node — expected a filename or directory name after the box-drawing prefix`);const p=" ".repeat(t);s.push(p+l),a++,n.set(a,o)}else{if(/^[\s─━│┃└┗├┣]+$/.test(c))continue;if(y.test(c))s.push(i),a++,n.set(a,o);else{if(/^\s+/.test(c))throw new Error(`Line ${o}: Unexpected indentation without box-drawing characters. In box-drawing format, use ├── or └── prefixes for indented nodes.`);s.push(i),a++,n.set(a,o)}}}return{text:s.join("\n"),lineMap:n}}c(V,"isBoxDrawingFormat"),c(j,"inferSegmentWidth"),c(T,"remapErrorLines"),c(I,"preprocessBoxDrawing");var M=new e(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",nodeType:"directory",children:[]}]})),E=c(()=>{M.reset(),f()},"clear"),A=c(()=>M.records.stack[0],"getRoot"),L=c(()=>M.records.cnt,"getCount"),N=w.treeView,D=c(()=>d(N,g().treeView),"getConfig"),R={clear:E,addNode:c((e,t,n,i,o,r)=>{for(;e<=M.records.stack[M.records.stack.length-1].level;)M.records.stack.pop();const s={id:M.records.cnt++,level:e,name:t,nodeType:n,icon:o,cssClass:i,description:r,children:[]};M.records.stack[M.records.stack.length-1].children.push(s),M.records.stack.push(s)},"addNode"),getRoot:A,getCount:L,getConfig:D,getAccTitle:a,getAccDescription:s,getDiagramTitle:r,setAccDescription:o,setAccTitle:i,setDiagramTitle:n},W=c(e=>{t(e,R);for(const t of e.nodes){const e="number"==typeof t.indent?t.indent:0;let n=t.name;const i=n.endsWith("/");i&&(n=n.slice(0,-1));const o=i?"directory":"file",r=t.classAnnotation||void 0,s=t.iconAnnotation,a=void 0!==s?s||"none":void 0,c=t.descAnnotation||void 0,d=c?m(c,g()):void 0;R.addNode(e,n,o,r,a,d)}},"populate"),X={parse:c(async e=>{const{text:t,lineMap:n}=I(e);try{const e=await b("treeView",t);l.debug(e),W(e)}catch(e){throw n.size>0&&e instanceof Error&&(e.message=T(e.message,n)),e}},"parse")},z={prefix:"mermaid-treeview",height:24,width:24,icons:{folder:{body:'<path fill="currentColor" d="M10.59 4.59A2 2 0 0 0 9.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.17z"/>'},file:{body:'<path fill="currentColor" fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8.83a2 2 0 0 0-.59-1.42l-4.82-4.82A2 2 0 0 0 13.17 2H6Zm7.5 1.9l4.6 4.6h-3.6a1 1 0 0 1-1-1V3.9Z" clip-rule="evenodd"/>'}}};function S(e,t){const n=t?.filenameIcons?.[e];if(n)return n;const i=e.lastIndexOf(".");if(i>0){const n=e.substring(i).toLowerCase(),o=t?.extensionIcons;return o?.[n]??o?.[n.slice(1)]}}function F(e,t){return e.includes(":")?e:e in z.icons||!t?`${z.prefix}:${e}`:`${t}:${e}`}function H(e,t){if("none"!==e.icon){if(e.icon)return F(e.icon,t.defaultIconPack);if(t.showIcons){if("file"===e.nodeType){const n=S(e.name,t);if("none"===n)return;if(n)return F(n,t.defaultIconPack)}return`${z.prefix}:${"directory"===e.nodeType?"folder":"file"}`}}}c(S,"detectIcon"),c(F,"qualifyIcon"),c(H,"getNodeIcon"),x([{name:z.prefix,icons:z}]);var P=c(async(e,t)=>{const n=[],i=c(e=>{const o=H(e,t);o&&n.push({icon:o,node:e}),e.children.forEach(i)},"collect");i(e);const o=await Promise.all(n.map(async({icon:e,node:t})=>({id:t.id,svg:await u(e,{height:14,width:14})})));return new Map(o.map(({id:e,svg:t})=>[e,t]))},"resolveNodeIcons"),Y=c((e,t,n,i,o,r)=>{const s=i.append("g");let a="treeView-node-label";"directory"===n.nodeType&&(a+=" treeView-node-dir"),n.cssClass&&(a+=` ${n.cssClass}`);const c=H(n,o),d=void 0!==c;c&&s.append("g").attr("class","treeView-node-icon").attr("transform",`translate(${e+o.paddingX}, ${t+o.paddingY})`).html(r.get(n.id)??"");const l=s.append("text").text(n.name).attr("dominant-baseline","middle").attr("class",a),{height:p,width:h}=l.node().getBBox(),g=p+2*o.paddingY,f=e+o.paddingX+(d?18:0);l.attr("x",f),l.attr("y",t+g/2);const m=f+h,u=h+2*o.paddingX+(d?18:0);return n.BBox={x:e,y:t,width:u,height:g},n.cssClass?.split(/\s+/).includes("highlight")&&s.insert("rect",":first-child").attr("x",e).attr("y",t+1).attr("width",0).attr("height",g-2).attr("rx",3).attr("class","treeView-highlight-bg"),{node:n,nodeGroup:s,labelRightEdge:m,centerY:t+g/2}},"positionLabel"),G=c((e,t,n,i,o,r)=>e.append("line").attr("x1",t).attr("y1",n).attr("x2",i).attr("y2",o).attr("stroke-width",r).attr("class","treeView-node-line"),"positionLine"),Q=c((e,t,n,i)=>{let o=0,r=0;const s=[],a=c((e,t,n,a)=>{const c=a*(n.rowIndent+n.paddingX),d=Y(c,o,t,e,n,i);s.push(d);const{height:l,width:p}=t.BBox;G(e,c-n.rowIndent,o+l/2,c,o+l/2,n.lineThickness),r=Math.max(r,c+p),o+=l},"drawNode"),d=c((t,i=0)=>{a(e,t,n,i),t.children.forEach(e=>{d(e,i+1)});const{x:o,y:r,height:s}=t.BBox;if(t.children.length){const{y:i,height:a}=t.children[t.children.length-1].BBox;G(e,o+n.paddingX,r+s,o+n.paddingX,i+a/2+n.lineThickness/2,n.lineThickness)}},"processNode");d(t);const l=s.filter(e=>e.node.description);if(l.length>0){const e=Math.max(...s.map(e=>e.labelRightEdge))+16;for(const t of l){const i=t.nodeGroup.append("text").text(t.node.description).attr("dominant-baseline","middle").attr("class","treeView-node-description").attr("x",e).attr("y",t.centerY).node().getBBox();r=Math.max(r,e+i.width+n.paddingX)}}for(const e of s)if(e.node.cssClass?.split(/\s+/).includes("highlight")){const t=e.nodeGroup.select(".treeView-highlight-bg");if(!t.empty()){const n=r-e.node.BBox.x+8;t.attr("width",n),r=Math.max(r,e.node.BBox.x+n+2)}}return{totalHeight:o,totalWidth:r}},"drawTree"),Z={labelFontSize:"16px",labelColor:"black",lineColor:"black",iconColor:"#546e7a",descriptionColor:"#6a9955",highlightBg:"rgba(255, 193, 7, 0.15)",highlightStroke:"#ffc107"},q={db:R,renderer:{draw:c(async(e,t,n,i)=>{l.debug("Rendering treeView diagram\n"+e);const o=i.db,r=o.getRoot(),s=o.getConfig(),a=p(t),c=a.append("g");c.attr("class","tree-view");const d=await P(r,s),{totalHeight:g,totalWidth:f}=Q(c,r,s,d);a.attr("viewBox",`-${s.lineThickness/2} 0 ${f} ${g}`),h(a,g,f,s.useMaxWidth)},"draw")},parser:X,styles:c(({treeView:e})=>{const{labelFontSize:t,labelColor:n,lineColor:i,iconColor:o,descriptionColor:r,highlightBg:s,highlightStroke:a}=d(Z,e);return`\n .treeView-node-label {\n font-size: ${t};\n fill: ${n};\n white-space: pre;\n }\n .treeView-node-dir {\n font-weight: bold;\n }\n .treeView-node-line {\n stroke: ${i};\n }\n .treeView-node-icon {\n color: ${o};\n }\n .treeView-node-description {\n font-size: ${t};\n fill: ${r};\n font-style: italic;\n white-space: pre;\n }\n .treeView-highlight-bg {\n fill: ${s};\n stroke: ${a};\n stroke-width: 1;\n }\n `},"styles")};export{q as diagram};
@@ -0,0 +1 @@
1
+ import{p as e}from"./chunk-JWPE2WC7-CVtFylX6.js";import{x as t,v as n,s as a,g as i,a as r,b as o,_ as s,l,c as d,k as m,P as c,C as x,Q as u,O as f,R as g,j as h,w as b,as as p}from"./mermaid.core-CvFWfSA0.js";import{p as w,i as v}from"./cynefin-EF2NZ3EQ-CaJSaYBh.js";import"./index-BwpxQGdp.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-C-9EFvh4.js";import"./settings-DzQM72QE.js";import"./index-Zvckkvpn.js";import"./LoaderLayer-CWElgcGs.js";import"./websocket-KESFarc3.js";import"./index-DpobNvg5.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 y="position frame",P="frame positioned",k="position relation",M="relation positioned",S=s(function(e){l.debug("options str",e)},"setOptions"),B=s(function(){return{}},"getOptions"),F=s(function(){$(),x()},"clear");function $(){A={}}s($,"reset");var E=g.eventmodeling,j=s(()=>u({...E,...f().eventmodeling}),"getConfig"),A={};function W(){let e=C;const{ast:t}=A,n=T();if(!t)throw new Error("No data for EventModel");return t.frames.forEach((a,i)=>{const r=X(a,t.dataEntities,n);let o;e=re(e,{$kind:y,index:i,frame:a,textProps:r}),Z(a)?(l.debug("source frame",a.sourceFrames),o=t.frames.filter(e=>a.sourceFrames.some(t=>t.$refText===e.name)),o.forEach(t=>{e=re(e,{$kind:k,index:i,frame:a,sourceFrame:t})})):e=re(e,{$kind:k,index:i,frame:a})}),e={...e,sortedSwimlanesArray:Q(e.swimlanes)},e}function R(e){A.ast=void 0;const t=new Set;for(const n of e.frames){if(t.has(n.name)){const e=n.$cstNode?.range.start.line,t=void 0===e?"":` on line ${e+1}`;throw new Error(`Duplicate event modeling frame ID "${n.name}"${t}`)}t.add(n.name)}A.ast=e}s(W,"getState"),s(R,"setAst");var O={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function T(){return O}s(T,"getDiagramProps");var C={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function H(e){const t=e.split(".");if(2===t.length)return t[0]}function I(e){const t=e.split(".");return 2===t.length?t[1]:e}function D(e,t){if(t&&0!==t.length)return Object.values(e).find(e=>e.namespace===t)}function N(e,t,n){return Math.max(t,...Object.keys(e).filter(e=>{const a=Number.parseInt(e);return a>t&&a<n}).map(e=>Number.parseInt(e)))+1}function U(e,t){const n=H(e.entityIdentifier),a=D(t,n);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return a?{index:a.index,label:a.namespace||O.labelUiAutomation}:n?{index:N(t,0,100),label:O.labelUiAutomationPrefix+n}:{index:0,label:O.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return a?{index:a.index,label:a.namespace||O.labelCommandReadModel}:n?{index:N(t,100,200),label:O.labelCommandReadModelPrefix+n}:{index:100,label:O.labelCommandReadModel};default:return a?{index:a.index,label:a.namespace||O.labelEvents}:n?{index:N(t,200,300),label:O.labelEventsPrefix+n}:{index:200,label:O.labelEvents}}}function V(e){const{themeVariables:t}=f();switch(e.modelEntityType){case"ui":return{fill:t.emUiFill??"white",stroke:t.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:t.emProcessorFill??"#edb3f6",stroke:t.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:t.emReadModelFill??"#d3f1a2",stroke:t.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:t.emCommandFill??"#bcd6fe",stroke:t.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:t.emEventFill??"#ffb778",stroke:t.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}function X(e,t,n){const a=f(),i=h(I(e.entityIdentifier)??"",a);let r;const o={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"<br/>"};let s=`<b>${b(i,n.textMaxWidth,o)}</b>`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=h(r,a),r=b(r,n.textMaxWidth,o),r=r.replaceAll(" ","&nbsp;")),e.dataReference){const i=t.find(t=>t.name===e.dataReference?.$refText);i&&(r=i.dataBlockValue,r=r.substring(r.indexOf("{\n")+2),r=r.substring(0,r.lastIndexOf("}")-1),r=h(r,a),r=b(r,n.textMaxWidth,o),r=r.replaceAll(" ","&nbsp;"),r+="<br/>")}const d=void 0!==r;d&&(s+=`<br/><br/><code style="text-align: left; display: block;max-width:${n.textMaxWidth}px">${r}</code>`);const m=p(s,{fontSize:o.fontSize,fontWeight:o.fontWeight,fontFamily:o.fontFamily}),c={content:s,width:d?m.width/3:m.width,height:m.height};return l.debug(`[${e.name}] ${e.entityIdentifier} text`,c),c}function L(e,t){const n=t,a=V(n.frame),i={width:n.textProps.width+2*O.boxTextPadding,height:n.textProps.height+2*O.boxTextPadding};return[{$kind:P,frame:n.frame,index:n.index,visual:a,dimension:i,textProps:n.textProps}]}function z(e,t,n){return void 0===t?O.contentStartX:t.index===e.index&&e.r?e.r+O.boxPadding:void 0===n?O.contentStartX:n.r-O.boxOverlap+O.boxPadding}function G(e,t){const n=[...e.map(e=>e.r),t];return Math.max(...n)}function Q(e){return Object.values(e).sort((e,t)=>e.index-t.index)}function Y(e,t){const n=t,a=U(n.frame,e.swimlanes);let i;i=a.index in e.swimlanes?e.swimlanes[a.index]:{index:a.index,label:a.label,r:0,y:a.index*O.swimlaneMinHeight+O.swimlaneGap,height:O.swimlaneMinHeight,maxHeight:O.swimlaneMinHeight};const r=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,o=void 0!==e.previousSwimlaneNumber?e.swimlanes[e.previousSwimlaneNumber]:void 0,s={width:Math.max(O.boxMinWidth,Math.min(O.boxMaxWidth,n.dimension.width))+2*O.boxPadding,height:Math.max(O.boxMinHeight,Math.min(O.boxMaxHeight,n.dimension.height))+2*O.boxPadding},l=z(i,o,r),d=l+s.width+O.boxPadding,m=G(Object.values(e.swimlanes),d);i.r=l+s.width,i.maxHeight=Math.max(i.maxHeight,s.height),i.height=Math.max(O.swimlaneMinHeight,i.maxHeight)+2*O.swimlanePadding;const c={x:l,y:O.swimlanePadding+i.y,r:d,dimension:s,leftSibling:!1,swimlane:i,visual:n.visual,text:n.textProps.content,frame:n.frame,index:n.index},x={...e,boxes:[...e.boxes,c],swimlanes:{...e.swimlanes,[`${i.index}`]:i},previousSwimlaneNumber:a.index,previousFrame:n.frame,maxR:m},u=Q(x.swimlanes);u.length>0&&(u[0].y=0);for(let e=1;e<u.length;e++){const t=u[e],n=u[e-1];t.y=n.y+n.height+O.swimlaneGap}return x}function J(e,t){return 0===e&&0===t.sourceFrames.length}function Z(e){return void 0!==e.sourceFrames&&null!==e.sourceFrames&&e.sourceFrames.length>0}function _(e,t){if(null!=t)return e.find(e=>e.frame.name===t.name)}function q(e,t,n){if(!(n<0))for(let a=n;a>=0;a--){const n=e[a];if(n.swimlane.index!==t)return n}}function K(e,t){const n=t;if(J(n.index,n.frame))return[];const a=_(e.boxes,n.frame);if(void 0===a)throw new Error(`Target box not found for frame ${n.frame.name}`);let i;if(n.sourceFrame)i=_(e.boxes,n.sourceFrame);else{if(v(n.frame))return[];i=q(e.boxes,a.swimlane.index,n.index-1)}if(void 0===i)return[];return[{$kind:M,frame:n.frame,index:n.index,sourceBox:i,targetBox:a}]}function ee(e,t){const n=t,a={visual:{fill:"none",stroke:"#000"},source:{x:n.sourceBox.x,y:n.sourceBox.y},target:{x:n.targetBox.x,y:n.targetBox.y},sourceBox:n.sourceBox,targetBox:n.targetBox};return{...e,relations:[...e.relations,a]}}s(H,"extractNamespace"),s(I,"extractName"),s(D,"findSwimlaneByNamespace"),s(N,"findNextAvailableIndex"),s(U,"calculateSwimlaneProps"),s(V,"calculateEntityVisualProps"),s(X,"calculateTextProps"),s(L,"decidePositionFrame"),s(z,"calculateX"),s(G,"calculateMaxRight"),s(Q,"sortedSwimlanesArray"),s(Y,"evolveFramePositioned"),s(J,"isFirstFrame"),s(Z,"hasSourceFrame"),s(_,"findBoxByFrame"),s(q,"findBoxByLineIndex"),s(K,"decidePositionRelation"),s(ee,"evolveRelationPositioned");var te={[y]:L,[k]:K},ne={[P]:Y,[M]:ee};function ae(e,t){const n=te[t.$kind];if(null==n)return[];const a=n(e,t);return l.debug("decided events",a),a}function ie(e,t){const n=t.reduce((e,t)=>{const n=ne[t.$kind];return null==n?e:n(e,t)},e);return l.debug("evolve events",{state:e,newState:n,events:t}),n}function re(e,t){return ie(e,ae(e,t))}s(ae,"decide"),s(ie,"evolve"),s(re,"dispatch");var oe={getConfig:j,preserveCommentsWhenParsing:!0,setOptions:S,getOptions:B,clear:F,setAccTitle:o,getAccTitle:r,getAccDescription:i,setAccDescription:a,setDiagramTitle:n,getDiagramTitle:t,setAst:R,getDiagramProps:T,getState:W},se={parse:s(async t=>{const n=await w("eventmodeling",t);l.debug(n),oe.setAst(n),e(n,oe)},"parse")},le=d(),de=le?.eventmodeling;function me(e,t){return n=>{const a=n.swimlane.y+t.swimlanePadding,i=e.append("g").attr("class","em-box");i.append("rect").attr("x",n.x).attr("y",a).attr("rx","3").attr("width",n.dimension.width).attr("height",n.dimension.height).attr("stroke",n.visual.stroke).attr("fill",n.visual.fill);i.append("foreignObject").attr("x",n.x+t.boxPadding).attr("y",a+10).attr("width",n.dimension.width-2*t.boxPadding).attr("height",n.dimension.height-2*t.boxPadding).append("xhtml:div").style("display","table").style("height","100%").style("width","100%").append("span").style("display","table-cell").style("text-align","center").style("vertical-align","middle").html(n.text)}}function ce(e,t){return e>t}function xe(e,t,n,a){return i=>{const r=i.sourceBox.swimlane.y+t.swimlanePadding,o=i.targetBox.swimlane.y+t.swimlanePadding,s=ce(r,o),d=i.sourceBox.x+2*i.sourceBox.dimension.width/3,m=i.targetBox.x+i.targetBox.dimension.width/3;let c,x;l.debug(`rendering relation up=${s} for `,{sourceBox:i.sourceBox,targetBox:i.targetBox}),s?(c=r,x=o+i.targetBox.dimension.height):(c=r+i.sourceBox.dimension.height,x=o);const u=a.emRelationStroke??i.visual.stroke;e.append("path").attr("class","em-relation").attr("fill",i.visual.fill).attr("stroke",u).attr("stroke-width","1").attr("marker-end",`url(#${n})`).attr("d",`M${d} ${c} L${m} ${x}`)}}function ue(e,t,n,a){return i=>{const r=e.append("g").attr("class","em-swimlane"),o=a.emSwimlaneBackgroundOdd??"rgb(250,250,250)",s=a.emSwimlaneBackgroundStroke??"rgb(240,240,240)";r.append("rect").attr("x",0).attr("y",i.y).attr("rx","3").attr("width",t+n.swimlanePadding).attr("height",i.height).attr("fill",o).attr("stroke",s),r.append("text").attr("font-weight",n.swimlaneTextFontWeight).attr("x",30).attr("y",i.y+30).text(i.label)}}s(me,"renderD3Box"),s(ce,"dirUpwards"),s(xe,"renderD3Relation"),s(ue,"renderD3Swimlane");var fe={parser:se,db:oe,renderer:{draw:s(function(e,t,n,a){if(l.debug("in eventmodeling renderer",e+"\n","id:",t,n),!de)throw new Error("EventModeling config not found");const i=a.db,{themeVariables:r,eventmodeling:o}=d(),s=m(`[id="${t}"]`),x=i.getDiagramProps(),u=i.getState(),f=`em-arrowhead-${t}`,g=r.emArrowhead??"#000000";u.sortedSwimlanesArray.forEach(ue(s,u.maxR,x,r)),u.boxes.forEach(me(s,x)),u.relations.forEach(xe(s,x,f,r));s.append("defs").append("marker").attr("id",f).attr("markerWidth","10").attr("markerHeight","7").attr("refX","10").attr("refY","3.5").attr("orient","auto").append("polygon").attr("points","0 0, 10 3.5, 0 7").attr("fill",g),c(void 0,s,o?.padding??30,o?.useMaxWidth)},"draw")},styles:s(e=>"","getStyles")};export{fe as diagram};
@@ -0,0 +1 @@
1
+ import{p as t}from"./chunk-JWPE2WC7-CVtFylX6.js";import{s as e,g as a,x as r,v as n,a as s,b as i,_ as o,T as l,C as c,Q as d,O as p,R as m,l as g,a7 as u,d as x}from"./mermaid.core-CvFWfSA0.js";import{p as h}from"./cynefin-EF2NZ3EQ-CaJSaYBh.js";import"./index-BwpxQGdp.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-C-9EFvh4.js";import"./settings-DzQM72QE.js";import"./index-Zvckkvpn.js";import"./LoaderLayer-CWElgcGs.js";import"./websocket-KESFarc3.js";import"./index-DpobNvg5.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 f={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},$={axes:[],curves:[],options:f},y=structuredClone($),v=m.radar,b=o(()=>d({...v,...p().radar}),"getConfig"),w=o(()=>y.axes,"getAxes"),C=o(()=>y.curves,"getCurves"),L=o(()=>y.options,"getOptions"),M=o(t=>{y.axes=t.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),k=o(t=>{y.curves=t.map(t=>({name:t.name,label:t.label??t.name,entries:T(t.entries)}))},"setCurves"),T=o(t=>{if(null==t[0].axis)return t.map(t=>t.value);const e=w();if(0===e.length)throw new Error("Axes must be populated before curves for reference entries");return e.map(e=>{const a=t.find(t=>t.axis?.$refText===e.name);if(void 0===a)throw new Error("Missing entry for axis "+e.label);return a.value})},"computeCurveEntries"),j={getAxes:w,getCurves:C,getOptions:L,setAxes:M,setCurves:k,setOptions:o(t=>{const e=t.reduce((t,e)=>(t[e.name]=e,t),{});y.options={showLegend:e.showLegend?.value??f.showLegend,ticks:e.ticks?.value??f.ticks,max:e.max?.value??f.max,min:e.min?.value??f.min,graticule:e.graticule?.value??f.graticule},y.options.ticks>32&&(g.warn(`Radar diagram ticks (${y.options.ticks}) exceeds maximum allowed (32). Using 32 instead.`),y.options.ticks=32)},"setOptions"),getConfig:b,clear:o(()=>{c(),y=structuredClone($)},"clear"),setAccTitle:i,getAccTitle:s,setDiagramTitle:n,getDiagramTitle:r,getAccDescription:a,setAccDescription:e},A=o(e=>{t(e,j);const{axes:a,curves:r,options:n}=e;j.setAxes(a),j.setCurves(r),j.setOptions(n)},"populate"),O={parse:o(async t=>{const e=await h("radar",t);g.debug(e),A(e)},"parse")},S=o((t,e,a,r)=>{const n=r.db,s=n.getAxes(),i=n.getCurves(),o=n.getOptions(),c=n.getConfig(),d=n.getDiagramTitle(),p=l(e),m=E(p,c),g=o.max??Math.max(...i.map(t=>Math.max(...t.entries))),u=o.min,x=Math.min(c.width,c.height)/2;I(m,s,x,o.ticks,o.graticule),F(m,s,x,c),R(m,s,i,u,g,o.graticule,c),W(m,i,o.showLegend,c),m.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-c.height/2-c.marginTop)},"draw"),E=o((t,e)=>{const a=e.width+e.marginLeft+e.marginRight,r=e.height+e.marginTop+e.marginBottom,n=e.marginLeft+e.width/2,s=e.marginTop+e.height/2;return x(t,r,a,e.useMaxWidth??!0),t.attr("viewBox",`0 0 ${a} ${r}`).attr("overflow","visible"),t.append("g").attr("transform",`translate(${n}, ${s})`)},"drawFrame"),I=o((t,e,a,r,n)=>{if("circle"===n)for(let e=0;e<r;e++){const n=a*(e+1)/r;t.append("circle").attr("r",n).attr("class","radarGraticule")}else if("polygon"===n){const n=e.length;for(let s=0;s<r;s++){const i=a*(s+1)/r,o=e.map((t,e)=>{const a=2*e*Math.PI/n-Math.PI/2;return`${i*Math.cos(a)},${i*Math.sin(a)}`}).join(" ");t.append("polygon").attr("points",o).attr("class","radarGraticule")}}},"drawGraticule"),F=o((t,e,a,r)=>{const n=e.length;for(let s=0;s<n;s++){const i=e[s].label,o=2*s*Math.PI/n-Math.PI/2,l=Math.cos(o),c=Math.sin(o);t.append("line").attr("x1",0).attr("y1",0).attr("x2",a*r.axisScaleFactor*l).attr("y2",a*r.axisScaleFactor*c).attr("class","radarAxisLine");const d=l>.01?"start":l<-.01?"end":"middle",p=c>.01?"hanging":c<-.01?"auto":"central",m=4;t.append("text").text(i).attr("x",a*r.axisLabelFactor*l+m*l).attr("y",a*r.axisLabelFactor*c+m*c).attr("text-anchor",d).attr("dominant-baseline",p).attr("class","radarAxisLabel")}},"drawAxes");function R(t,e,a,r,n,s,i){const o=e.length,l=Math.min(i.width,i.height)/2;a.forEach((e,a)=>{if(e.entries.length!==o)return;const c=e.entries.map((t,e)=>{const a=2*Math.PI*e/o-Math.PI/2,s=P(t,r,n,l);return{x:s*Math.cos(a),y:s*Math.sin(a)}});"circle"===s?t.append("path").attr("d",z(c,i.curveTension)).attr("class",`radarCurve-${a}`):"polygon"===s&&t.append("polygon").attr("points",c.map(t=>`${t.x},${t.y}`).join(" ")).attr("class",`radarCurve-${a}`)})}function P(t,e,a,r){return r*(Math.min(Math.max(t,e),a)-e)/(a-e)}function z(t,e){const a=t.length;let r=`M${t[0].x},${t[0].y}`;for(let n=0;n<a;n++){const s=t[(n-1+a)%a],i=t[n],o=t[(n+1)%a],l=t[(n+2)%a],c={x:i.x+(o.x-s.x)*e,y:i.y+(o.y-s.y)*e},d={x:o.x-(l.x-i.x)*e,y:o.y-(l.y-i.y)*e};r+=` C${c.x},${c.y} ${d.x},${d.y} ${o.x},${o.y}`}return`${r} Z`}function W(t,e,a,r){if(!a)return;const n=3*(r.width/2+r.marginRight)/4,s=3*-(r.height/2+r.marginTop)/4;e.forEach((e,a)=>{const r=t.append("g").attr("transform",`translate(${n}, ${s+20*a})`);r.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${a}`),r.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(e.label)})}o(R,"drawCurves"),o(P,"relativeRadius"),o(z,"closedRoundCurve"),o(W,"drawLegend");var D={draw:S},B=o((t,e)=>{let a="";for(let r=0;r<t.THEME_COLOR_LIMIT;r++){const n=t[`cScale${r}`];a+=`\n\t\t.radarCurve-${r} {\n\t\t\tcolor: ${n};\n\t\t\tfill: ${n};\n\t\t\tfill-opacity: ${e.curveOpacity};\n\t\t\tstroke: ${n};\n\t\t\tstroke-width: ${e.curveStrokeWidth};\n\t\t}\n\t\t.radarLegendBox-${r} {\n\t\t\tfill: ${n};\n\t\t\tfill-opacity: ${e.curveOpacity};\n\t\t\tstroke: ${n};\n\t\t}\n\t\t`}return a},"genIndexStyles"),G=o(t=>{const e=u(),a=p(),r=d(e,a.themeVariables);return{themeVariables:r,radarOptions:d(r.radar,t)}},"buildRadarStyleOptions"),V={parser:O,db:j,renderer:D,styles:o(({radar:t}={})=>{const{themeVariables:e,radarOptions:a}=G(t);return`\n\t.radarTitle {\n\t\tfont-size: ${e.fontSize};\n\t\tcolor: ${e.titleColor};\n\t\tdominant-baseline: hanging;\n\t\ttext-anchor: middle;\n\t}\n\t.radarAxisLine {\n\t\tstroke: ${a.axisColor};\n\t\tstroke-width: ${a.axisStrokeWidth};\n\t}\n\t.radarAxisLabel {\n\t\tfont-size: ${a.axisLabelFontSize}px;\n\t\tcolor: ${a.axisColor};\n\t}\n\t.radarGraticule {\n\t\tfill: ${a.graticuleColor};\n\t\tfill-opacity: ${a.graticuleOpacity};\n\t\tstroke: ${a.graticuleColor};\n\t\tstroke-width: ${a.graticuleStrokeWidth};\n\t}\n\t.radarLegendText {\n\t\ttext-anchor: start;\n\t\tfont-size: ${a.legendFontSize}px;\n\t\tdominant-baseline: hanging;\n\t}\n\t${B(e,a)}\n\t`},"styles")};export{V as diagram};